{ if (value != null) { value = null } else { setMode('oidc_only') } }} options={{ right: 'Restrict the job token', rightTooltip: "Limit what the WM_TOKEN of this " + kind + "'s jobs can do through the API, e.g. only mint an OIDC token. Use it for code that handles untrusted input, such as AI agents." }} /> {#if value != null} setMode(v)}> {#snippet children({ item })} {/snippet} {#if mode === 'custom'} value ?? [], (scopes) => (value = [...scopes])} emptyLabel="No scopes selected. The job token can only reach its own job." /> {/if}

{#if kind === 'step'} The WM_TOKEN of every job this step runs can only do what these scopes allow, on top of the flow's own restriction. Loop and branch bodies, and AI agent tools, inherit it. {:else} The WM_TOKEN of every job of this {kind} can only do what these scopes allow. Jobs it starts, {kind === 'flow' ? 'its steps, ' : ''}and AI agent tools inherit the restriction. {/if} Variables and resources passed as $var:/$res: inputs, an AI agent's provider resource, relative imports and object storage each need a read scope, and script state (getState/setState) needs resources:write. Write scopes on scripts, flows, schedules or triggers let a job escape the restriction. Jobs with a restricted token never run on dedicated workers.

{/if}