Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions apps/docs/content/docs/cli/reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8518,9 +8518,9 @@ sim workflows run <workflowId> [options]
| `--draft` | No | Run the saved draft instead of the active deployment, sending its writes. |
| `--deployment-version <n>` | No | Run this deployed version instead of the active one (a version number from `sim workflows versions list`); a Workflow block in it still runs its child workflow's active deployment. Needs workspace write access, through a full-access API key or an OAuth token with api:write. Not with --draft or any flag that runs the draft. |
| `--dry` | No | Dry run of the saved draft (implies --draft): writes are not sent but answered with placeholders and listed with their request payloads in sideEffects; reads, model calls and code run for real. Logged as a test run. Not with --follow, --async or --wait-timeout. |
| `--allow <block>` | No | Send this block's writes for real during a --dry run (its id, display name or key, or &lt;workflow&gt;.&lt;block&gt; for a workflow it calls); for an Agent, only its own tool calls, not a workflow or custom block it calls; repeatable. |
| `--mock <block>=<json\|@file>` | No | Answer this block with the given JSON object instead of running it during a --dry run (its id, display name or key, or &lt;workflow&gt;.&lt;block&gt; for a workflow it calls), to steer a branch or give a stubbed write a realistic result; a bare --mock &lt;block&gt; takes its output from --mock-from. Not a locked block, or one of a locked workflow or folder; data only (the API reference lists the fields a mock cannot set). The run records only which blocks were mocked, not the outputs, so a rerun reads them again with --mock-from; repeatable. |
| `--mock-from <runId>` | No | Answer each block a bare --mock &lt;block&gt; names with the output it recorded in this earlier run of the workflow, redacted as the run shows it: this workflow's blocks (not a child's; not inside a loop or parallel unless that run mocked it); fields a mock cannot set, such as cost or model, are left out (requires --dry). |
| `--allow <block>` | No | Send this block's writes for real during a dry run (its id, display name or key, or &lt;workflow&gt;.&lt;block&gt; for a workflow it calls); for an Agent, only its own tool calls, not a workflow or custom block it calls.; repeatable. |
| `--mock <block>=<json\|@file>` | No | Answer this block with the given JSON object instead of running it during a dry run (its id, display name or key, or &lt;workflow&gt;.&lt;block&gt; for a workflow it calls), to steer a branch or give a stubbed write a realistic result; a bare --mock &lt;block&gt; takes its output from --mock-from. Not a locked block, or one of a locked workflow or folder; data only (the API reference lists the fields a mock cannot set). The run records only which blocks were mocked, not the outputs, so a rerun reads them again with --mock-from; repeatable. |
| `--mock-from <runId>` | No | Answer each block a bare --mock &lt;block&gt; names with the output it recorded in this earlier run of the workflow, redacted as the run shows it: this workflow's blocks (not a child's; not inside a loop or parallel unless that run mocked it); fields a mock cannot set, such as cost or model, are left out. |
| `--trigger <blockId>` | No | Enter the run through this runnable trigger, by its block id; runs the saved draft (implies --draft). |
| `--sample` | No | Run with the selected trigger's sample payload instead of --input; runs the saved draft (implies --draft), whose writes are sent unless --dry. |
| `--from-block <block>` | No | Rerun the saved draft from this block (its id, display name or key), reusing the outputs --source-run produced before it; a failed run prints this command as next. |
Expand All @@ -8536,7 +8536,7 @@ sim workflows run <workflowId> [options]

Without --draft (or a flag that implies it) this runs the active deployment; a workflow never deployed has none. --deployment-version &lt;n&gt; runs that deployed version instead (it needs workspace write access, through a full-access API key or an OAuth token with api:write); the child workflows it calls still run their own active deployment. --draft runs the saved draft, as the source loop leaves it, sending its writes.

--dry runs the saved draft without its writes: each call that could change something (a write tool, any MCP call, an HTTP request other than GET/HEAD/OPTIONS, code's other fetches) gets a placeholder (ids like dry_run_row_1, numbers above 900000000) and is listed in sideEffects.stubbed with the request it would have sent; check those payloads. A read that would send a placeholder is held back too (reason placeholder), and an MCP call its server calls read-only says so (reason mcp-read-only). Reads, model calls and code run for real; code in a remote sandbox (shell, Python, imports) is listed in sideEffects.unchecked. Child workflows run dry too; custom, Human in the loop and Wait blocks are answered whole, so the run never pauses. --allow &lt;block&gt; sends that block's writes for real (use a test resource). --mock &lt;block&gt;=&lt;json&gt; answers a block with fixed output, to steer a branch; --mock-from &lt;runId&gt; with a bare --mock &lt;block&gt; answers it with the output that run recorded. --allow and --mock also name a block of a workflow this one calls as &lt;workflow&gt;.&lt;block&gt;. Overrides the run never reached are listed in sideEffects.unreached, and mock fields a block never gets in sideEffects.mockFields. The API reference describes each list and refusal.
--dry runs the saved draft without its writes: each call that could change something (a write tool, any MCP call, an HTTP request other than GET/HEAD/OPTIONS, code's other fetches) gets a placeholder (ids like dry_run_row_1, numbers above 900000000) and is listed in sideEffects.stubbed with the request it would have sent; check those payloads. A read that would send a placeholder is held back too (reason placeholder), and an MCP call its server calls read-only says so (reason mcp-read-only). Reads, model calls and code run for real; code in a remote sandbox (shell, Python, imports) is listed in sideEffects.unchecked. Child workflows run dry too; custom, Human in the loop and Wait blocks are answered whole, so the run never pauses. --allow &lt;block&gt; sends that block's writes for real (use a test resource). --mock &lt;block&gt;=&lt;json&gt; answers a block with fixed output, to steer a branch; --mock-from &lt;runId&gt; with a bare --mock &lt;block&gt; answers it with the output that run recorded. --allow and --mock also name a block of a workflow this one calls as &lt;workflow&gt;.&lt;block&gt;. --allow, --mock and --mock-from imply --dry; --draft sends every write, so it refuses them. Overrides the run never reached are listed in sideEffects.unreached, and mock fields a block never gets in sideEffects.mockFields. The API reference describes each list and refusal.

The result is the run: runId, status (completed, failed, paused or cancelled), error, output (the workflow's final output) and blockOutputs (what --select-output named). It has no success field: branch on status, or on the exit code. With --follow it is the stream's final frame instead: success and output.

Expand Down
8 changes: 4 additions & 4 deletions apps/docs/content/docs/cli/workflows.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -835,9 +835,9 @@ sim workflows run <workflowId> [options]
| `--draft` | No | Run the saved draft instead of the active deployment, sending its writes. |
| `--deployment-version <n>` | No | Run this deployed version instead of the active one (a version number from `sim workflows versions list`); a Workflow block in it still runs its child workflow's active deployment. Needs workspace write access, through a full-access API key or an OAuth token with api:write. Not with --draft or any flag that runs the draft. |
| `--dry` | No | Dry run of the saved draft (implies --draft): writes are not sent but answered with placeholders and listed with their request payloads in sideEffects; reads, model calls and code run for real. Logged as a test run. Not with --follow, --async or --wait-timeout. |
| `--allow <block>` | No | Send this block's writes for real during a --dry run (its id, display name or key, or &lt;workflow&gt;.&lt;block&gt; for a workflow it calls); for an Agent, only its own tool calls, not a workflow or custom block it calls; repeatable. |
| `--mock <block>=<json\|@file>` | No | Answer this block with the given JSON object instead of running it during a --dry run (its id, display name or key, or &lt;workflow&gt;.&lt;block&gt; for a workflow it calls), to steer a branch or give a stubbed write a realistic result; a bare --mock &lt;block&gt; takes its output from --mock-from. Not a locked block, or one of a locked workflow or folder; data only (the API reference lists the fields a mock cannot set). The run records only which blocks were mocked, not the outputs, so a rerun reads them again with --mock-from; repeatable. |
| `--mock-from <runId>` | No | Answer each block a bare --mock &lt;block&gt; names with the output it recorded in this earlier run of the workflow, redacted as the run shows it: this workflow's blocks (not a child's; not inside a loop or parallel unless that run mocked it); fields a mock cannot set, such as cost or model, are left out (requires --dry). |
| `--allow <block>` | No | Send this block's writes for real during a dry run (its id, display name or key, or &lt;workflow&gt;.&lt;block&gt; for a workflow it calls); for an Agent, only its own tool calls, not a workflow or custom block it calls.; repeatable. |
| `--mock <block>=<json\|@file>` | No | Answer this block with the given JSON object instead of running it during a dry run (its id, display name or key, or &lt;workflow&gt;.&lt;block&gt; for a workflow it calls), to steer a branch or give a stubbed write a realistic result; a bare --mock &lt;block&gt; takes its output from --mock-from. Not a locked block, or one of a locked workflow or folder; data only (the API reference lists the fields a mock cannot set). The run records only which blocks were mocked, not the outputs, so a rerun reads them again with --mock-from; repeatable. |
| `--mock-from <runId>` | No | Answer each block a bare --mock &lt;block&gt; names with the output it recorded in this earlier run of the workflow, redacted as the run shows it: this workflow's blocks (not a child's; not inside a loop or parallel unless that run mocked it); fields a mock cannot set, such as cost or model, are left out. |
| `--trigger <blockId>` | No | Enter the run through this runnable trigger, by its block id; runs the saved draft (implies --draft). |
| `--sample` | No | Run with the selected trigger's sample payload instead of --input; runs the saved draft (implies --draft), whose writes are sent unless --dry. |
| `--from-block <block>` | No | Rerun the saved draft from this block (its id, display name or key), reusing the outputs --source-run produced before it; a failed run prints this command as next. |
Expand All @@ -853,7 +853,7 @@ sim workflows run <workflowId> [options]

Without --draft (or a flag that implies it) this runs the active deployment; a workflow never deployed has none. --deployment-version &lt;n&gt; runs that deployed version instead (it needs workspace write access, through a full-access API key or an OAuth token with api:write); the child workflows it calls still run their own active deployment. --draft runs the saved draft, as the source loop leaves it, sending its writes.

--dry runs the saved draft without its writes: each call that could change something (a write tool, any MCP call, an HTTP request other than GET/HEAD/OPTIONS, code's other fetches) gets a placeholder (ids like dry_run_row_1, numbers above 900000000) and is listed in sideEffects.stubbed with the request it would have sent; check those payloads. A read that would send a placeholder is held back too (reason placeholder), and an MCP call its server calls read-only says so (reason mcp-read-only). Reads, model calls and code run for real; code in a remote sandbox (shell, Python, imports) is listed in sideEffects.unchecked. Child workflows run dry too; custom, Human in the loop and Wait blocks are answered whole, so the run never pauses. --allow &lt;block&gt; sends that block's writes for real (use a test resource). --mock &lt;block&gt;=&lt;json&gt; answers a block with fixed output, to steer a branch; --mock-from &lt;runId&gt; with a bare --mock &lt;block&gt; answers it with the output that run recorded. --allow and --mock also name a block of a workflow this one calls as &lt;workflow&gt;.&lt;block&gt;. Overrides the run never reached are listed in sideEffects.unreached, and mock fields a block never gets in sideEffects.mockFields. The API reference describes each list and refusal.
--dry runs the saved draft without its writes: each call that could change something (a write tool, any MCP call, an HTTP request other than GET/HEAD/OPTIONS, code's other fetches) gets a placeholder (ids like dry_run_row_1, numbers above 900000000) and is listed in sideEffects.stubbed with the request it would have sent; check those payloads. A read that would send a placeholder is held back too (reason placeholder), and an MCP call its server calls read-only says so (reason mcp-read-only). Reads, model calls and code run for real; code in a remote sandbox (shell, Python, imports) is listed in sideEffects.unchecked. Child workflows run dry too; custom, Human in the loop and Wait blocks are answered whole, so the run never pauses. --allow &lt;block&gt; sends that block's writes for real (use a test resource). --mock &lt;block&gt;=&lt;json&gt; answers a block with fixed output, to steer a branch; --mock-from &lt;runId&gt; with a bare --mock &lt;block&gt; answers it with the output that run recorded. --allow and --mock also name a block of a workflow this one calls as &lt;workflow&gt;.&lt;block&gt;. --allow, --mock and --mock-from imply --dry; --draft sends every write, so it refuses them. Overrides the run never reached are listed in sideEffects.unreached, and mock fields a block never gets in sideEffects.mockFields. The API reference describes each list and refusal.

The result is the run: runId, status (completed, failed, paused or cancelled), error, output (the workflow's final output) and blockOutputs (what --select-output named). It has no success field: branch on status, or on the exit code. With --follow it is the stream's final frame instead: success and output.

Expand Down
2 changes: 1 addition & 1 deletion packages/sim-cli/src/commands/protocol/source-primer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ ${PATTERNS_HEADING} (\`.sim/examples/\`, indexed atop \`cookbook.ts\`; any build
- Tables: \`table.queryRows\` outputs \`rows\` (\`recent.rows[0].data.status\`), not \`row\`; \`table.upsertRow\` takes \`conflictColumn: 'orderId'\`.
- Rejoin: before one \`response\`, a Function picks the branch that ran with \`??\`.${extra.patterns ?? ''}
- **Credentials**: \`sim credentials connect <provider> --name "<Name>"\`, send the owner its link, then \`credential('<key>')\`.
- **Run**: \`sim workflows run <workflowId>\` runs the active deployment; \`--draft\` runs the draft for real and \`--allow <block>\` sends that block's writes (use test resources); \`--dry\` runs it stubbing writes and MCP tools (even read-only: \`mcp-read-only\`), listed in \`sideEffects\` (\`dry_run_*\` placeholders); GET \`api\` calls and plain-JS GET fetches run; sandboxed code (Python, shell, imports): \`unchecked\`. \`--mock <block>='{…}'\` fixes its output (bare, with \`--mock-from <runId>\`: that run's); a child's block: \`<workflow>.<block>\`.
- **Run**: \`sim workflows run <workflowId>\` runs the active deployment; \`--dry\` runs the draft stubbing writes and MCP tools (even read-only: \`mcp-read-only\`), listed in \`sideEffects\` (\`dry_run_*\` placeholders); GET \`api\` calls and plain-JS GET fetches run; sandboxed code (Python, shell, imports): \`unchecked\`. With \`--dry\`, \`--allow <block>\` sends its writes; \`--draft\` sends all (use test resources). \`--mock <block>='{…}'\` fixes its output (bare, with \`--mock-from <runId>\`: that run's); a child's block: \`<workflow>.<block>\`.
- **Debug**: \`--dir <dir>\` maps a failure to file:line; \`sim logs get <runId> --trace --no-include-workflow-state\`; rows: \`sim tables rows list <table>\`; rerun: \`--from-block <block> --source-run <runId>\`; \`--stop-after <block>\`.${extra.debug ?? ''}
- **Exit codes**: 0 ok, 1 errors, ${SOURCE_STALE_EXIT_CODE} stale (redo in a fresh get), ${RATE_LIMITED_EXIT_CODE} rate limited, ${SOURCE_BUSY_EXIT_CODE} busy, ${SOURCE_LOCAL_CHANGES_EXIT_CODE}/${SOURCE_DRIFT_EXIT_CODE} \`status\`: your edits / the server changed.`
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -798,9 +798,11 @@ describe('sim workflows run --dry', () => {
})

it('refuses combinations a dry run cannot honour before sending anything', async () => {
await expect(run(WORKFLOW_ID, '--allow', 'Save lead')).rejects.toThrow('add --dry')
await expect(run(WORKFLOW_ID, '--mock', 'Score={"content":"spam"}')).rejects.toThrow(
'add --dry'
await expect(run(WORKFLOW_ID, '--draft', '--allow', 'Save lead')).rejects.toThrow(
'use --dry in place of --draft'
)
await expect(run(WORKFLOW_ID, '--draft', '--mock', 'Score={"content":"spam"}')).rejects.toThrow(
'use --dry in place of --draft'
)
await expect(run(WORKFLOW_ID, '--dry', '--follow')).rejects.toThrow('drop --follow')
await expect(run(WORKFLOW_ID, '--dry', '--wait-timeout', '30')).rejects.toThrow(
Expand All @@ -816,9 +818,9 @@ describe('sim workflows run --dry', () => {
await expect(run(WORKFLOW_ID, '--dry', '--mock-from', 'run_1')).rejects.toThrow(
'name at least one'
)
await expect(run(WORKFLOW_ID, '--mock-from', 'run_1', '--mock', 'Score')).rejects.toThrow(
'--mock-from answers a block during a dry run'
)
await expect(
run(WORKFLOW_ID, '--draft', '--mock-from', 'run_1', '--mock', 'Score')
).rejects.toThrow('use --dry in place of --draft')
await expect(run(WORKFLOW_ID, '--dry', '--mock', 'Score=spam')).rejects.toThrow(
'is not valid JSON'
)
Expand Down
Loading
Loading