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
2 changes: 1 addition & 1 deletion .claude/rules/sim-workflow-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ changed.
| `.sim/base.json` (workspace) | `version: 1` | Same policy |
| `workflow_source_meta` | `version: 1` | Same policy; a bump needs a data migration |
| Fingerprints | `sf1:` (workflow), `rf1:` (resource) | Any change to canonicalize or a kind's `canonical()` output changes every stored fingerprint and makes every checkout stale; treat it as a format change |
| SDK surface | `// @sim-sdk 1`, `SDK_MAJOR`, `OLDEST_SDK_MAJOR` | Compile refuses a newer major and reads down to the floor |
| SDK surface | `// @sim-sdk 1`, `SDK_MAJOR` | Compile refuses any major but the server's |
| `apps/sim/blocks/sdk-names/` | append-only | Never rename or remove a name |

Nothing upgrades an old version: a bump is a hard refusal until a migration exists. A lock or base
Expand Down
2 changes: 1 addition & 1 deletion .cursor/rules/sim-workflow-code.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ changed.
| `.sim/base.json` (workspace) | `version: 1` | Same policy |
| `workflow_source_meta` | `version: 1` | Same policy; a bump needs a data migration |
| Fingerprints | `sf1:` (workflow), `rf1:` (resource) | Any change to canonicalize or a kind's `canonical()` output changes every stored fingerprint and makes every checkout stale; treat it as a format change |
| SDK surface | `// @sim-sdk 1`, `SDK_MAJOR`, `OLDEST_SDK_MAJOR` | Compile refuses a newer major and reads down to the floor |
| SDK surface | `// @sim-sdk 1`, `SDK_MAJOR` | Compile refuses any major but the server's |
| `apps/sim/blocks/sdk-names/` | append-only | Never rename or remove a name |

Nothing upgrades an old version: a bump is a hard refusal until a migration exists. A lock or base
Expand Down
2 changes: 0 additions & 2 deletions apps/docs/content/docs/cli/reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8622,7 +8622,6 @@ sim workflows source get <workflowId> [options]
| `--function-code <value>` | No | Where function-block code goes: `files` (default) writes it to `functions/*` files referenced with `codeFile()`; `inline` prints it in tagged templates. Accepted values: `inline`, `files`. |
| `--dir <dir>` | No | Write the source, its lock and SDK type declarations into this directory instead of printing them. |
| `--force` | No | With --dir: replace another workflow's source or edits no apply has saved. |
| `--primer` | No | Also print the primer written atop .sim/AGENTS.md (a `primer` field in JSON). |

</CommandTable>

Expand Down Expand Up @@ -10037,7 +10036,6 @@ sim workspaces source get [options]

| Option | Required | Description |
| --- | --- | --- |
| `--primer` | No | Also print the primer written atop .sim/AGENTS.md (a `primer` field in JSON). |
| `--dir <dir>` | Yes | Directory to write the workspace source into. |
| `--only <kinds>` | No | Read only these kinds (comma-separated folders: secrets.ts, credentials.ts, tools, skills, mcp, tables, knowledge, files, workflows, deployments). |
| `--force` | No | Replace files with edits no apply has saved. |
Expand Down
1 change: 0 additions & 1 deletion apps/docs/content/docs/cli/workflows.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1379,7 +1379,6 @@ sim workflows source get <workflowId> [options]
| `--function-code <value>` | No | Where function-block code goes: `files` (default) writes it to `functions/*` files referenced with `codeFile()`; `inline` prints it in tagged templates. Accepted values: `inline`, `files`. |
| `--dir <dir>` | No | Write the source, its lock and SDK type declarations into this directory instead of printing them. |
| `--force` | No | With --dir: replace another workflow's source or edits no apply has saved. |
| `--primer` | No | Also print the primer written atop .sim/AGENTS.md (a `primer` field in JSON). |

</CommandTable>

Expand Down
1 change: 0 additions & 1 deletion apps/docs/content/docs/cli/workspaces.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,6 @@ sim workspaces source get [options]

| Option | Required | Description |
| --- | --- | --- |
| `--primer` | No | Also print the primer written atop .sim/AGENTS.md (a `primer` field in JSON). |
| `--dir <dir>` | Yes | Directory to write the workspace source into. |
| `--only <kinds>` | No | Read only these kinds (comma-separated folders: secrets.ts, credentials.ts, tools, skills, mcp, tables, knowledge, files, workflows, deployments). |
| `--force` | No | Replace files with edits no apply has saved. |
Expand Down
7 changes: 4 additions & 3 deletions apps/docs/content/docs/workflows/blocks/human-in-the-loop.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ HITL blocks are excluded from the selected-output picker because pause data is i

## Resume with the v2 API

A v2 execute call can return `data.status: "paused"`. Read `contextId` from `data.output.data._resume` and the paused run's ID from `data.runId`:
A v2 execute call can return `data.status: "paused"`. Read the run to resume from `data.paused.runId`, and the `contextId` of a waiting `human` point from `data.paused.points`:

```bash
curl -X POST 'https://www.sim.ai/api/v2/workflows/WORKFLOW_ID/runs/RUN_ID/resume' \
Expand All @@ -102,12 +102,13 @@ For an originally synchronous run, the response waits for the resumed execution
"error": null,
"startedAt": "2026-10-13T10:00:00.000Z",
"endedAt": "2026-10-13T10:00:01.234Z",
"durationMs": 1234
"durationMs": 1234,
"paused": null
}
}
```

A later Human block can pause the resumed run again, returning new pause data. The resumed attempt has its own `runId`.
A later Human block can pause the resumed run again. The response then has `status: "paused"` and new `paused.points`, and `paused.runId` names the run to resume next: the run you resumed, not the attempt's own `runId`.

### Asynchronous and originally streaming runs

Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/docs/workflows/code/coding-agents.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Claude Code, Cursor, Codex and other coding agents work from a directory that `g

## What get gives an agent

- A **primer**, which opens `.sim/AGENTS.md`. `get` prints a short summary instead (the files written, the guide, and the `editLoop` command to run); `get --primer` also prints the primer (in JSON output, its `primer` field). It covers the edit loop, how block identity, references and renames work, failures and retries, test runs, deletes, deploy, exit codes, and the params of each builder the workflow already uses.
- A **primer**, which opens `.sim/AGENTS.md`. `get` prints a short summary instead (the files written, the guide, and the `editLoop` command to run). It covers the edit loop, how block identity, references and renames work, failures and retries, test runs, deletes, deploy, exit codes, and the params of each builder the workflow already uses.
- **`.sim/AGENTS.md`**: the primer followed by a reference, by task. A workspace directory also gets `.sim/GUIDE-advanced.md`.
- **`.sim/examples/`**: one correct example of each common block to copy from.
- **`.sim/sdk/`**: the type declarations, with `.sim/sdk/INDEX.md` listing the builders.
Expand Down
3 changes: 1 addition & 2 deletions apps/docs/content/docs/workflows/code/diagnostics.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ Reading and writing `workflow.ts`.
| `E_NUMBER_NOT_FINITE` | A number literal too large to store (`1e999` reads as `Infinity`). |
| `W_NUMBER_PRECISION` | A number literal whose digits a number cannot hold; write it as a string. |
| `E_SDK_HEADER` | Line 1 is not `// @sim-sdk N`. |
| `E_SDK_MAJOR` | The header's major is newer than the server supports. |
| `E_SDK_MAJOR_OLD` | The header's major is older than the oldest the server reads. |
| `E_SDK_MAJOR` | The header's major is not the one the server reads. |
| `E_UNSUPPORTED_SYNTAX` | A construct outside this grammar; the hint names the supported form. |
| `E_WORKFLOW_EXPORT` | Not exactly one `export default workflow(…)`. |
| `E_LIMIT_EXCEEDED` | Over the block, edge, total-byte, depth or `codeFile()` reference cap (`SOURCE_LIMITS`). Apply answers 413. |
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/docs/workflows/code/edit.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ sim workflows source status --dir ./support-triage
sim workflows source diff --dir ./support-triage
```

`status` lists the files you created, edited, or deleted, asks the server (with a dry run that saves nothing) whether the workflow changed since the `get`, and ends with the one command to run next. It exits `0` when nothing changed, `11` when only your edits are unsaved, and `12` when the workflow changed in the workflow builder since the `get` (a conflict, if you edited it too). Without a connection it shows your edits only and says so; `--offline` skips the server. `diff` prints each edit as a unified diff, and `diff --server` compares the directory with the workflow as it is saved now. Both take `--json` (or `--output json`).
`status` lists the files you created, edited, or deleted, asks the server (with a plan read that saves nothing) whether the workflow changed since the `get`, and ends with the one command to run next. It exits `0` when nothing changed, `11` when only your edits are unsaved, and `12` when the workflow changed in the workflow builder since the `get` (a conflict, if you edited it too). Without a connection it shows your edits only and says so; `--offline` skips the server. `diff` prints each edit as a unified diff, and `diff --server` compares the directory with the workflow as it is saved now. Both take `--json` (or `--output json`).

## 4. Dry run

Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/docs/workflows/code/how-it-works.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Sim also stores each block's `const` name, its order in the file and its comment
- the same: the apply goes ahead;
- different: someone saved the workflow since you read it. The apply is refused as stale with exit `5`, on a dry run too, and nothing is written; [Troubleshooting](/workflows/code/troubleshooting#exit-5) has the steps.

The check is made again inside the write's transaction, so two applies that race cannot both win. `status` asks the same question with a dry run and reports it as drift (exit `12`) before you apply.
The check is made again inside the write's transaction, so two applies that race cannot both win. `status` asks the same question with a plan read that saves nothing and reports it as drift (exit `12`) before you apply.

The base also records the block catalog you read against. When a compile fails and the catalog changed since, for example after a block gained a setting, the apply adds `W_APPLY_CATALOG_MOVED`: run `get` again to pick up the new types.

Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/docs/workflows/code/syntax.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export default workflow('Name', { description: '…', variables: { /* … */ } }
})
```

- Line 1 is `// @sim-sdk N`. Without it the file is refused with `E_SDK_HEADER`; a number newer or older than the server reads is `E_SDK_MAJOR` or `E_SDK_MAJOR_OLD`.
- Line 1 is `// @sim-sdk N`. Without it the file is refused with `E_SDK_HEADER`; a number other than the one the server reads is `E_SDK_MAJOR`.
- Imports are named imports from `'@sim/workflow-sdk'` only. Aliases are allowed.
- The file has exactly one `export default workflow(name, options?, body)` (`E_WORKFLOW_EXPORT`). `options` is `{ description?, variables? }`. `body` is `() => { … }` or `({ vars }) => { … }`.
- Variables are `variables: { <key>: { name?, type, value } }`. `type` is `string`, `number`, `boolean`, `object`, `array` or `plain`, and both `type` and `value` are required; `value` is plain JSON. The key is the variable's key: lowercased, with spaces and dots removed. `name` is written only when it differs, and must normalize to the key (`E_VARIABLE_NAME_MISMATCH`). Read one as `vars.<key>`.
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/docs/workflows/code/workspace.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const log = table.insertRow('Log Question', {
})
```

`get` writes a short primer for coding agents atop `.sim/AGENTS.md` (`get --primer` also prints it, in JSON output as its `primer` field), the guide, with deletes in depth, Git and CI, and promoting to another workspace in `.sim/GUIDE-advanced.md`. It also writes `.sim/examples/workspace/`, a complete example of every kind and the workflow that uses them.
`get` writes a short primer for coding agents atop `.sim/AGENTS.md`, the guide, with deletes in depth, Git and CI, and promoting to another workspace in `.sim/GUIDE-advanced.md`. It also writes `.sim/examples/workspace/`, a complete example of every kind and the workflow that uses them.

## Edit a workspace

Expand Down
15 changes: 15 additions & 0 deletions apps/docs/openapi-v2-resources.json
Original file line number Diff line number Diff line change
Expand Up @@ -32795,6 +32795,11 @@
"description": "Hidden from the output picker.",
"type": "boolean"
},
"mayBeText": {
"description": "A `json` or `any` output whose value can still be text at run time.",
"type": "boolean",
"const": true
},
"properties": {
"description": "Nested outputs by name, each of this same shape.",
"type": "object",
Expand Down Expand Up @@ -33838,6 +33843,11 @@
"description": "Hidden from the output picker.",
"type": "boolean"
},
"mayBeText": {
"description": "A `json` or `any` output whose value can still be text at run time.",
"type": "boolean",
"const": true
},
"properties": {
"description": "Nested outputs by name, each of this same shape.",
"type": "object",
Expand Down Expand Up @@ -34697,6 +34707,11 @@
"description": "Hidden from the output picker.",
"type": "boolean"
},
"mayBeText": {
"description": "A `json` or `any` output whose value can still be text at run time.",
"type": "boolean",
"const": true
},
"properties": {
"description": "Nested outputs by name, each of this same shape.",
"type": "object",
Expand Down
Loading
Loading