Skip to content

Commit 41af1d3

Browse files
committed
fix(agent): use the existing canonical permission mode toggle
1 parent 0ddae74 commit 41af1d3

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
@@ -6244,6 +6244,11 @@
62446244
"enum": ["auto", "force", "none"],
62456245
"description": "When the Agent may call the tool: `auto` lets the model decide, `force` requires a call, and `none` disables it. Omitted means `auto`."
62466246
},
6247+
"usageControlExpression": {
6248+
"type": "string",
6249+
"maxLength": 2048,
6250+
"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."
6251+
},
62476252
"params": {
62486253
"type": "object",
62496254
"propertyNames": {
@@ -6290,6 +6295,11 @@
62906295
"type": "string",
62916296
"enum": ["auto", "force", "none"],
62926297
"description": "When the Agent may call the tool: `auto` lets the model decide, `force` requires a call, and `none` disables it. Omitted means `auto`."
6298+
},
6299+
"usageControlExpression": {
6300+
"type": "string",
6301+
"maxLength": 2048,
6302+
"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."
62936303
}
62946304
},
62956305
"required": ["type", "customToolId"],
@@ -6358,6 +6368,11 @@
63586368
"type": "string",
63596369
"enum": ["auto", "force", "none"],
63606370
"description": "When the Agent may call the tool: `auto` lets the model decide, `force` requires a call, and `none` disables it. Omitted means `auto`."
6371+
},
6372+
"usageControlExpression": {
6373+
"type": "string",
6374+
"maxLength": 2048,
6375+
"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."
63616376
}
63626377
},
63636378
"required": ["type", "schema", "code"],
@@ -6423,6 +6438,11 @@
64236438
"type": "string",
64246439
"enum": ["auto", "force", "none"],
64256440
"description": "When the Agent may call the tool: `auto` lets the model decide, `force` requires a call, and `none` disables it. Omitted means `auto`."
6441+
},
6442+
"usageControlExpression": {
6443+
"type": "string",
6444+
"maxLength": 2048,
6445+
"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."
64266446
}
64276447
},
64286448
"required": ["type", "params"],
@@ -6468,6 +6488,11 @@
64686488
"type": "string",
64696489
"enum": ["auto", "force", "none"],
64706490
"description": "When the Agent may call the tool: `auto` lets the model decide, `force` requires a call, and `none` disables it. Omitted means `auto`."
6491+
},
6492+
"usageControlExpression": {
6493+
"type": "string",
6494+
"maxLength": 2048,
6495+
"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."
64716496
}
64726497
},
64736498
"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)