Skip to content

Commit 4643393

Browse files
committed
fix(agent): use the existing canonical permission mode toggle
1 parent 61c6130 commit 4643393

2 files changed

Lines changed: 50 additions & 3 deletions

File tree

apps/docs/openapi-v2-workflows.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6388,6 +6388,11 @@
63886388
"enum": ["auto", "force", "none"],
63896389
"description": "When the Agent may call the tool: `auto` lets the model decide, `force` requires a call, and `none` disables it. Omitted means `auto`."
63906390
},
6391+
"usageControlExpression": {
6392+
"type": "string",
6393+
"maxLength": 2048,
6394+
"description": "Variable-capable tool mode value used when the matching canonical mode is `advanced`. It must resolve to `auto`, `force`, or `none` at execution time."
6395+
},
63916396
"params": {
63926397
"type": "object",
63936398
"propertyNames": {
@@ -6434,6 +6439,11 @@
64346439
"type": "string",
64356440
"enum": ["auto", "force", "none"],
64366441
"description": "When the Agent may call the tool: `auto` lets the model decide, `force` requires a call, and `none` disables it. Omitted means `auto`."
6442+
},
6443+
"usageControlExpression": {
6444+
"type": "string",
6445+
"maxLength": 2048,
6446+
"description": "Variable-capable tool mode value used when the matching canonical mode is `advanced`. It must resolve to `auto`, `force`, or `none` at execution time."
64376447
}
64386448
},
64396449
"required": ["type", "customToolId"],
@@ -6502,6 +6512,11 @@
65026512
"type": "string",
65036513
"enum": ["auto", "force", "none"],
65046514
"description": "When the Agent may call the tool: `auto` lets the model decide, `force` requires a call, and `none` disables it. Omitted means `auto`."
6515+
},
6516+
"usageControlExpression": {
6517+
"type": "string",
6518+
"maxLength": 2048,
6519+
"description": "Variable-capable tool mode value used when the matching canonical mode is `advanced`. It must resolve to `auto`, `force`, or `none` at execution time."
65056520
}
65066521
},
65076522
"required": ["type", "schema", "code"],
@@ -6567,6 +6582,11 @@
65676582
"type": "string",
65686583
"enum": ["auto", "force", "none"],
65696584
"description": "When the Agent may call the tool: `auto` lets the model decide, `force` requires a call, and `none` disables it. Omitted means `auto`."
6585+
},
6586+
"usageControlExpression": {
6587+
"type": "string",
6588+
"maxLength": 2048,
6589+
"description": "Variable-capable tool mode value used when the matching canonical mode is `advanced`. It must resolve to `auto`, `force`, or `none` at execution time."
65706590
}
65716591
},
65726592
"required": ["type", "params"],
@@ -6612,6 +6632,11 @@
66126632
"type": "string",
66136633
"enum": ["auto", "force", "none"],
66146634
"description": "When the Agent may call the tool: `auto` lets the model decide, `force` requires a call, and `none` disables it. Omitted means `auto`."
6635+
},
6636+
"usageControlExpression": {
6637+
"type": "string",
6638+
"maxLength": 2048,
6639+
"description": "Variable-capable tool mode value used when the matching canonical mode is `advanced`. It must resolve to `auto`, `force`, or `none` at execution time."
66156640
}
66166641
},
66176642
"required": ["type", "params"],

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/components/tools/usage-control.tsx

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { Combobox, Label } from '@sim/emcn'
1+
import { Combobox, cn, Label, Tooltip } from '@sim/emcn'
2+
import { ArrowLeftRight } from '@sim/emcn/icons'
23
import type { CanonicalMode } from '@/lib/workflows/subblocks/visibility'
34
import type { StoredTool } from '@/lib/workflows/tool-input/types'
4-
import { CanonicalModeToggle } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/canonical-mode-toggle'
55
import { ShortInput } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/short-input'
66

77
interface ToolUsageControlProps {
@@ -47,11 +47,33 @@ export function ToolUsageControl({
4747
onExpressionChange,
4848
onModeToggle,
4949
}: ToolUsageControlProps) {
50+
const toggleLabel = mode === 'advanced' ? 'Switch to selector' : 'Switch to variable'
51+
5052
return (
5153
<div className='subblock-content flex w-full min-w-0 flex-col gap-2.5'>
5254
<div className='flex items-center justify-between gap-1.5 pl-0.5'>
5355
<Label>Permission Mode</Label>
54-
<CanonicalModeToggle mode={mode} disabled={disabled} onToggle={onModeToggle} />
56+
<Tooltip.Root>
57+
<Tooltip.Trigger asChild>
58+
<button
59+
type='button'
60+
className='flex size-[12px] shrink-0 cursor-pointer items-center justify-center bg-transparent p-0 disabled:cursor-not-allowed disabled:opacity-50'
61+
onClick={onModeToggle}
62+
disabled={disabled}
63+
aria-label={toggleLabel}
64+
>
65+
<ArrowLeftRight
66+
className={cn(
67+
'size-[12px]!',
68+
mode === 'advanced'
69+
? 'text-[var(--text-primary)]'
70+
: 'text-[var(--text-secondary)]'
71+
)}
72+
/>
73+
</button>
74+
</Tooltip.Trigger>
75+
<Tooltip.Content side='top'>{toggleLabel}</Tooltip.Content>
76+
</Tooltip.Root>
5577
</div>
5678
{mode === 'advanced' ? (
5779
<ShortInput

0 commit comments

Comments
 (0)