Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
5e96fd5
fix(workflow-sdk): look a block type up as the builder written for it…
waleedlatif1 Nov 22, 2026
84d05da
fix(sim-cli): exit a workspace dry run that would hold changes back w…
waleedlatif1 Nov 22, 2026
b4a9021
fix(sim-cli): return the output of the block a --stop-after run stopp…
waleedlatif1 Nov 22, 2026
ba6b0d0
docs(sim-cli): say what workflows run prints and how it exits, and th…
waleedlatif1 Nov 22, 2026
5e3dff0
fix(workflows): accept a block param's canonical name in workflow ope…
waleedlatif1 Nov 22, 2026
4584421
fix(workspace-source): count the blocks and variables a workflow upda…
waleedlatif1 Nov 22, 2026
b876a0f
fix(sim-cli): name --allow-delete in a workflow status's next apply w…
waleedlatif1 Nov 22, 2026
1744128
fix(sim-cli): count a workspace status's errors and warnings as its d…
waleedlatif1 Nov 22, 2026
69f1bf6
docs(sim-cli): document input names, value shapes, retry and outputs …
waleedlatif1 Nov 22, 2026
21f9534
docs(sim-cli): document -w and SIM_WORKSPACE, and the quoting trap, i…
waleedlatif1 Nov 22, 2026
61c8805
docs(workflow-sdk): add upsertRow and the Response JSON form to the c…
waleedlatif1 Nov 22, 2026
ff3af84
test(workflow-sdk): cover the core builder doc source params prints
waleedlatif1 Nov 22, 2026
6762d75
docs: regenerate the CLI reference and document the held dry run, run…
waleedlatif1 Nov 22, 2026
ff6416e
refactor: compute a workspace status's dry-run findings once and shar…
waleedlatif1 Nov 22, 2026
195e4e2
refactor: type the canonical-name pass without any and tidy its neigh…
waleedlatif1 Nov 22, 2026
5cae2c4
fix(workflow-code): show a block's error output on in the outline whe…
waleedlatif1 Nov 22, 2026
ea0d688
fix(executor): name the undeployed child a deployed run cannot call a…
waleedlatif1 Nov 22, 2026
5af85f2
fix(workflow-editing): name the fields that share a canonical param a…
waleedlatif1 Nov 22, 2026
1a10fda
fix(workflow-code): bring check to parity with the run for loop condi…
waleedlatif1 Nov 22, 2026
3369122
fix(workflow-code): report one error for a new block of an unknown type
waleedlatif1 Nov 22, 2026
ab5b228
feat(workflow-editing): lint a child's result.<key> that reads nothin…
waleedlatif1 Nov 22, 2026
ab4e482
chore(workflow-code): regenerate the OpenAPI document, CLI API types …
waleedlatif1 Nov 22, 2026
90d3419
refactor(workflow-code): share the reference and response helpers the…
waleedlatif1 Nov 22, 2026
12d4918
test(workflow-code): cover the loop condition refusal on an edited lo…
waleedlatif1 Nov 22, 2026
606959e
refactor(workflow-code): reuse the shared child-call, string-leaf and…
waleedlatif1 Nov 22, 2026
9afdc10
chore(workflow-code): trim restating comments and name the destructiv…
waleedlatif1 Nov 22, 2026
3fdbc4e
docs(sim-cli): keep the create and export summaries short and move th…
waleedlatif1 Nov 22, 2026
b16e020
chore(docs): record the CLI reference code examples the help changes …
waleedlatif1 Nov 22, 2026
5d777f9
fix(workflow-code): stand a loop condition's references in as (0) so …
waleedlatif1 Nov 22, 2026
79ab6f4
fix(lint): judge a child's result.<key> only when every run of the ch…
waleedlatif1 Nov 22, 2026
3ad3796
fix(sim-cli): select the stop block of a --stop-after run that --foll…
waleedlatif1 Nov 22, 2026
15bc7dc
fix(workspace-source): say on a dry run whether the apply would refuse
waleedlatif1 Nov 22, 2026
e0d4d25
fix(editing): resolve a canonical param name on the block's active su…
waleedlatif1 Nov 22, 2026
a3cd487
docs: fix the cookbook upsert and workspace help; pin the unknown-typ…
waleedlatif1 Nov 22, 2026
20f16f9
fix(workflow-code): flag a loop condition reading its own iteration b…
waleedlatif1 Nov 22, 2026
fb42142
fix(lint): stop a child's response check at the first else row, on a …
waleedlatif1 Nov 22, 2026
eaf21ff
docs: make the cookbook's order writes repeatable and say where each …
waleedlatif1 Nov 22, 2026
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
12 changes: 12 additions & 0 deletions apps/docs/content/docs/cli/blocks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,16 @@ sim blocks get <blockId>

</CommandTable>

```text
Reading it for `sim workflows operations apply`:
id the type to add: `blocks get table` answers table_v2 (an add of legacy
table is refused)
inputSchema the field ids inputs takes; operationInputSchema, an operation's own
inputDefinitions the block's inputs by name; one a pair of fields shares (tableId for
tableSelector and manualTableId) is accepted in place of the pair
outputs what it outputs on success; a failed block outputs {"error":"…"}
instead, read on its error path as <name.error>
Block settings such as retry are not fields: `sim workflows operations apply --help`.
```

API request and response schemas: [getBlock](/api-reference/catalog/getBlock).
53 changes: 48 additions & 5 deletions apps/docs/content/docs/cli/reference.mdx

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions apps/docs/content/docs/cli/scripting.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ The CLI resends a request the API answers `429` only when sending it twice is sa
| Code | `sim workspaces source apply` |
| --- | --- |
| `0` | Applied, or a dry run with no errors |
| `1` | The source has errors, every change it would write was held back for a secret or credential the workspace cannot satisfy (nothing was written), or command/request failure |
| `1` | The source has errors, every change it would write was held back for a secret or credential the workspace cannot satisfy (nothing was written; its dry run exits `1` too), or command/request failure |
| `5` | A resource changed since the directory was read (`409 SOURCE_STALE`): get it again into a fresh directory, reapply the edit, and retry |
| `6` | A resource (a workflow or its folder, a table) is locked (`423`); a locked block exits `1` (`E_APPLY_LOCKED_BLOCK`) |
| `7` | The directory is over the size limits (`413`) |
Expand All @@ -216,14 +216,14 @@ The CLI resends a request the API answers `429` only when sending it twice is sa
| `10` | Busy, retry: another apply is writing the workspace (`409 SOURCE_BUSY`), or another `sim workspaces source` command is using the same directory (`SOURCE_DIR_BUSY`); nothing was written: run the command again once the other finished |
| `13` | `AUTH_REQUIRED`: not logged in, or the server refused the credential; nothing was sent |
| `14` | Run without `--yes` and with no terminal to ask: the plan was printed with no errors and nothing was written; run the same command with `--yes` |
| `15` | Written in part: changes that use a declared secret with no value, or a credential key nothing binds to, were held back and the rest was applied and saved; set the secret or connect the credential, then apply again (a promotion with `--to` too) |
| `15` | Written in part: changes that use a declared secret with no value, or a credential key nothing binds to, were held back and the rest was applied and saved; set the secret or connect the credential, then apply again (a promotion with `--to` too). A dry run that would do so exits `15` too, having written nothing |
| `130` | Interrupted (Ctrl-C). A write already sent is finished and saved into the directory first, waiting up to 60s for its answer; a second Ctrl-C, or no answer by then, stops at once and prints that it may have been written and how to check |

Earlier CLI releases exited `1` when an apply held changes back, whether or not it wrote the rest. A script that reads `1` as "held back" should test for `15` too.
Earlier CLI releases exited `1` when an apply held changes back, whether or not it wrote the rest, and its dry run exited `1` in either case. A script that reads `1` as "held back" should test for `15` too.

Both waits default to 3600 seconds; `--wait-timeout 0` waits indefinitely. `SIM_TIMEOUT_SECONDS` independently bounds one API request. A timeout does not cancel the underlying run or operation.

A synchronous or followed workflow run prints its result before exiting 1 for failure/cancellation. A paused run is not failed and can return 0; use `runs wait` or inspect status if your script requires completion. Fetching a failed run or listing runs only reports their state.
A synchronous or followed workflow run prints its result before exiting 1 for failure/cancellation. The result of a run that is not followed is the run record, whose `status` is `completed`, `failed`, `paused` or `cancelled`; it has no `success` field (a followed run's result is the stream's final frame, `success` and `output`), so branch on `status` or the exit code. A paused run is not failed and can return 0; use `runs wait` or inspect status if your script requires completion. Fetching a failed run or listing runs only reports their state.

Capture a failure without losing its output:

Expand Down Expand Up @@ -381,7 +381,7 @@ exit "$status"

## Workspace source in CI

Keep a [workspace source directory](/workflows/workspace-code) in a repository, `.sim/` included, and let CI plan each pull request and apply each merge. The dry run exits `1` on errors and `5` when the workspace changed since the committed base; `check` downloads the block catalog once on a fresh runner. On GitHub Actions (`GITHUB_ACTIONS=true`), every source command also annotates each error and warning at its file and line, so they show inline on the pull request, and `apply` (a dry run too) appends its plan and errors to the job's step summary.
Keep a [workspace source directory](/workflows/workspace-code) in a repository, `.sim/` included, and let CI plan each pull request and apply each merge. The dry run exits `1` on errors, `5` when the workspace changed since the committed base, and `15` when the apply would hold back changes that use a secret with no value or a credential nothing binds to; `check` downloads the block catalog once on a fresh runner. On GitHub Actions (`GITHUB_ACTIONS=true`), every source command also annotates each error and warning at its file and line, so they show inline on the pull request, and `apply` (a dry run too) appends its plan and errors to the job's step summary.

```yaml title=".github/workflows/sim-workspace.yml"
on:
Expand Down
35 changes: 32 additions & 3 deletions apps/docs/content/docs/cli/workflows.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ sim workflows create [options]

</CommandTable>

The new workflow's draft holds one Start block (start_trigger, named Start): connect the blocks you add from it.

API request and response schemas: [createWorkflow](/api-reference/workflows/createWorkflowV2).

### Update workflow
Expand Down Expand Up @@ -354,6 +356,23 @@ Source handles:
Renames:
An edit's {"name":"New name"} also rewrites every <old key.field> reference to the block, in
other blocks' inputs and in a loop's or parallel's collection and condition.
Inputs:
inputs takes the field ids `sim blocks get <type>` lists (inputSchema, operationInputSchema),
or the name a pair of them shares (inputDefinitions: tableId for tableSelector and
manualTableId; a string goes to the typed field). Add the type it answers with: `blocks get
table` answers table_v2, and an add of legacy table is refused.
conditions (condition): [{"title":"if","value":"<start.n> > 3"},{"title":"else if","value":"…"},
{"title":"else","value":""}]; the last entry is the else, and ids are assigned.
inputFormat (Start): [{"name":"email","type":"string"}]; types string, number, boolean,
object, array, file[]; an optional default "value" as text.
Block settings, beside inputs in an add's or edit's params:
"retry":{"enabled":true,"maxTries":3,"waitBetweenTriesMs":1000} retries a failed block; null
clears it.
Outputs:
A block that fails outputs {"error":"<message>"}: connect its error handle and read
<name.error> there (without one, the run fails). A Workflow block's result is the child's
output; a child ending in a Response block gives {data, status, headers}, so read
<call.result.data.x>.
```

API request and response schemas: [applyWorkflowOperations](/api-reference/workflows/applyWorkflowOperations).
Expand Down Expand Up @@ -794,7 +813,7 @@ sim workflows run <workflowId> [options]
| `--mock-payload` | No | Use the selected trigger's server-derived mock payload; runs the current saved workflow state (implies --manual). |
| `--from-block <block>` | No | Run manually from this saved workflow block: its id, display name or key. |
| `--source-run <runId>` | No | Prior run whose persisted state supplies upstream outputs (requires --from-block). |
| `--stop-after <block>` | No | Stop the run after this saved block (its id, display name or key), failing it if the run takes a path that skips the block; with --from-block on the same block, re-runs only that block (implies --manual). |
| `--stop-after <block>` | No | Stop the run after this saved block (its id, display name or key), failing it if the run takes a path that skips the block; with --from-block on the same block, re-runs only that block (implies --manual). Unless --select-output names others, blockOutputs holds the output of that block under its key (or id); output stays empty. |
| `--dir <dir>` | No | This workflow's source directory: a failed run names the source file and line of the block that failed, read through its .sim/lock.json. Not with --async or --follow, and not for a run --wait-timeout leaves running. |
| `--wait-timeout <seconds>` | No | Wait at most this many seconds for a synchronous run (0 waits until it settles). A run still going then continues in the background under async limits: the command prints its run record and exits 4, and `sim workflows runs wait` keeps waiting. Not with --async or --follow. |
| `--follow` | No | Stream the run as it happens; progress on stderr, result on stdout. The stream reports only success and output, so the result omits the run id and timings a non-streaming run returns. |
Expand All @@ -803,6 +822,12 @@ sim workflows run <workflowId> [options]

</CommandTable>

Without --manual (or a flag that implies it) this runs the active deployment; a workflow never deployed has none. --manual runs the saved draft, as the source loop leaves it.

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.

Exit codes: 0 completed or paused (--async: queued); 1 failed or cancelled (the result is printed first, then the error on stderr), or the command failed; 4 still running when --wait-timeout elapsed.

API request and response schemas: [executeWorkflow](/api-reference/workflows/executeWorkflowV2).

### List runs for a workflow
Expand Down Expand Up @@ -1113,6 +1138,8 @@ sim workflows export <workflowId> [options]

</CommandTable>

Workspace bindings (a table, a child workflow, a knowledge base) print as null unless --include-workspace-bindings, and credentials always do: to read what a block is set to, use `sim workflows state get`.

API request and response schemas: [exportWorkflow](/api-reference/workflows/exportWorkflow).

### Preview workflow import
Expand Down Expand Up @@ -1361,6 +1388,8 @@ sim workflows source status [options]

</CommandTable>

With --json, `plan` is what applying would do as `apply --dry-run --allow-delete` reports it (its errors and warnings counted the same, a conflict as an error), and `next` the command to run (with --allow-delete only when the plan deletes something).

Exit codes: 0 clean (nothing to apply, and the server changed nothing since the directory was read); 11 local changes only (applying writes them); 12 the server changed since the directory was read: drift (a resource edited, added or deleted there that the directory leaves alone) or a conflict (also changed here, so applying it is refused as stale), with or without local changes; 7 the source is too large for the server to read in one dry run; 1 the command failed; 13 not logged in (AUTH_REQUIRED) or the credential was refused: the status shows the local changes only, then run `sim login`. A server that cannot be reached is not a failure: the status shows the local changes only and says so (exit 0 or 11).

API request and response schemas: [planWorkflowSource](/api-reference/workflows/planWorkflowSource), [applyWorkflowSource](/api-reference/workflows/applyWorkflowSource), [getSourceResources](/api-reference/workflows/getSourceResources).
Expand Down Expand Up @@ -1467,7 +1496,7 @@ Compiles workflow.ts (and the function files it names) with the compiler the ser

Exit codes: 0 no errors; 1 errors (each printed as file:line:column with its frame and hint), or no cached catalog (run the get once). With --output json, stdout is one document that also lists every finding under diagnostics.

These warnings, which an apply saves as written, fail the check as errors on every block the lock does not bind (a block added since the get, or every block of a new workflow): W_REQUIRED_MISSING, W_UNKNOWN_OPTION, W_UNKNOWN_OUTPUT_PATH, W_VALUE_KIND, W_OUT_OF_RANGE, W_LITERAL_SECRET, W_TABLE_UNKNOWN_COLUMN, W_CHILD_INPUT_UNKNOWN, W_BRANCH_UNWIRED, W_UNRESOLVED_REF, W_REF_OUT_OF_SCOPE. --strict fails on them in every block, except W_BRANCH_UNWIRED on a block the lock binds (the stored workflow may hold it, and the server then stays quiet); --no-strict fails on none of them. In every mode, as the server refuses them: W_REF_OUT_OF_SCOPE is the error E_APPLY_REF_OUT_OF_SCOPE in any file of a block the edit added or changed; W_UNKNOWN_OPTION is the error E_APPLY_INVALID_SUBBLOCK_FIELD in workflow.ts on a block the edit added or changed; W_UNKNOWN_OUTPUT_PATH is the error E_APPLY_UNRESOLVED_REF in workflow.ts on a block the edit added or changed; W_UNRESOLVED_REF is the error E_APPLY_UNRESOLVED_REF in workflow.ts on a block the edit added or changed; W_UNKNOWN_BLOCK_TYPE is the error E_APPLY_INVALID_BLOCK_TYPE in workflow.ts on a block the edit added or changed; W_TYPE_NOT_ADDABLE is the error E_APPLY_TYPE_NOT_ADDABLE in workflow.ts on a block the edit added or changed; W_UNRESOLVED_REF is the error E_APPLY_UNRESOLVED_REF in a function file changed since the get; W_UNKNOWN_OUTPUT_PATH is the error E_APPLY_UNRESOLVED_REF in a function file changed since the get; W_CODE_FILE_REF_SYNTAX is the error E_APPLY_CODE_FILE_REF_SYNTAX in a function file changed since the get. A block counts as changed when the lock does not bind it, when the source moved it into another container, or when it compiles differently than in the source the last get or apply printed (.sim/stored-edges.json records a digest of each block). That last comparison needs the catalog the source was printed with in the cache: without it, a bound block that did not move counts as unchanged, so the server may refuse what the check passes. A $ref in a function file to a block the lock binds that the source no longer declares stays a warning, unless a warning cap left findings out: the server may infer that block was renamed and rewrite the reference, and refuses it otherwise. W_JSON_REF_UNTYPED is reported only on blocks the lock does not bind, and with --strict on every block.
These warnings, which an apply saves as written, fail the check as errors on every block the lock does not bind (a block added since the get, or every block of a new workflow): W_REQUIRED_MISSING, W_UNKNOWN_OPTION, W_UNKNOWN_OUTPUT_PATH, W_VALUE_KIND, W_OUT_OF_RANGE, W_LITERAL_SECRET, W_TABLE_UNKNOWN_COLUMN, W_CHILD_INPUT_UNKNOWN, W_CHILD_RESULT_PATH, W_BRANCH_UNWIRED, W_UNRESOLVED_REF, W_REF_OUT_OF_SCOPE, W_LOOP_CONDITION_SYNTAX. --strict fails on them in every block, except W_BRANCH_UNWIRED on a block the lock binds (the stored workflow may hold it, and the server then stays quiet); --no-strict fails on none of them. In every mode, as the server refuses them: W_REF_OUT_OF_SCOPE is the error E_APPLY_REF_OUT_OF_SCOPE in any file of a block the edit added or changed; W_LOOP_CONDITION_SYNTAX is the error E_APPLY_LOOP_CONDITION_SYNTAX in any file of a block the edit added or changed; W_UNKNOWN_OPTION is the error E_APPLY_INVALID_SUBBLOCK_FIELD in workflow.ts on a block the edit added or changed; W_UNKNOWN_OUTPUT_PATH is the error E_APPLY_UNRESOLVED_REF in workflow.ts on a block the edit added or changed; W_UNRESOLVED_REF is the error E_APPLY_UNRESOLVED_REF in workflow.ts on a block the edit added or changed; W_UNKNOWN_BLOCK_TYPE is the error E_APPLY_INVALID_BLOCK_TYPE in workflow.ts on a block the edit added or changed; W_TYPE_NOT_ADDABLE is the error E_APPLY_TYPE_NOT_ADDABLE in workflow.ts on a block the edit added or changed; W_UNRESOLVED_REF is the error E_APPLY_UNRESOLVED_REF in a function file changed since the get; W_UNKNOWN_OUTPUT_PATH is the error E_APPLY_UNRESOLVED_REF in a function file changed since the get; W_CODE_FILE_REF_SYNTAX is the error E_APPLY_CODE_FILE_REF_SYNTAX in a function file changed since the get. A block counts as changed when the lock does not bind it, when the source moved it into another container, or when it compiles differently than in the source the last get or apply printed (.sim/stored-edges.json records a digest of each block). That last comparison needs the catalog the source was printed with in the cache: without it, a bound block that did not move counts as unchanged, so the server may refuse what the check passes. A $ref in a function file to a block the lock binds that the source no longer declares stays a warning, unless a warning cap left findings out: the server may infer that block was renamed and rewrite the reference, and refuses it otherwise. W_JSON_REF_UNTYPED is reported only on blocks the lock does not bind, and with --strict on every block.

### Show the content of the changes in a workflow source directory

Expand Down Expand Up @@ -1529,7 +1558,7 @@ sim workflows source params <builder> [options]

</CommandTable>

Prints a builder's params (required first, with enums and defaults), the gate field that picks which others apply, and its outputs, from the block catalog the last get, create or check cached. No request is made. &lt;builder&gt; is the dotted builder path as source writes it: table.upsertRow, agent, trigger.schedule, slack.sendMessage (slack.tool.sendMessage names the same builder). A namespace (gmail, trigger.gmail) lists its builders; a construct core.d.ts declares (loop, parallel, t, env) prints its declaration. Run it from a workflow or workspace source directory, or pass --dir.
Prints a builder's params (required first, with enums and defaults), the gate field that picks which others apply, and its outputs, from the block catalog the last get, create or check cached. No request is made. &lt;builder&gt; is the dotted builder path as source writes it: table.upsertRow, agent, trigger.schedule, slack.sendMessage (slack.tool.sendMessage names the same builder). A namespace (gmail, trigger.gmail) lists its builders; a block type prints the builder written for it (function is fn) or lists them (table_v2); a construct core.d.ts declares (loop, parallel, t, env) prints its declaration. Run it from a workflow or workspace source directory, or pass --dir.

Exit codes: 0 printed; 1 no builder or namespace of that name (the closest one is named), or no cached catalog (run a get once).

Expand Down
Loading
Loading