Skip to content

Commit 98cd2f1

Browse files
committed
improvement(workflow-code): clean slate for workflows and workspace as code
Remove the feature's own compatibility paths now that nothing depends on them: version-less bases and the lock/base upgrade seams, numeric blob revs, the SDK-major floor (E_SDK_MAJOR_OLD), the plan-read dry-run fallback, the client-side refuses fallback, older-CLI catalog caches and folder records, old-server resource defaults, and get --primer. Declare mayBeText on block outputs (Function result, API data) and read it through the catalog in place of TEXT_CAPABLE_OUTPUTS. Name the run a pause is recorded under in paused.runId on execute, resume and run reads, and build the CLI resume command from it instead of searching output markers. Fix the stale lookup-order sample.
1 parent 3257c89 commit 98cd2f1

74 files changed

Lines changed: 724 additions & 720 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.claude/rules/sim-workflow-code.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ changed.
209209
| `.sim/base.json` (workspace) | `version: 1` | Same policy |
210210
| `workflow_source_meta` | `version: 1` | Same policy; a bump needs a data migration |
211211
| 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 |
212-
| SDK surface | `// @sim-sdk 1`, `SDK_MAJOR`, `OLDEST_SDK_MAJOR` | Compile refuses a newer major and reads down to the floor |
212+
| SDK surface | `// @sim-sdk 1`, `SDK_MAJOR` | Compile refuses any major but the server's |
213213
| `apps/sim/blocks/sdk-names/` | append-only | Never rename or remove a name |
214214

215215
Nothing upgrades an old version: a bump is a hard refusal until a migration exists. A lock or base

‎.cursor/rules/sim-workflow-code.mdc‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ changed.
189189
| `.sim/base.json` (workspace) | `version: 1` | Same policy |
190190
| `workflow_source_meta` | `version: 1` | Same policy; a bump needs a data migration |
191191
| 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 |
192-
| SDK surface | `// @sim-sdk 1`, `SDK_MAJOR`, `OLDEST_SDK_MAJOR` | Compile refuses a newer major and reads down to the floor |
192+
| SDK surface | `// @sim-sdk 1`, `SDK_MAJOR` | Compile refuses any major but the server's |
193193
| `apps/sim/blocks/sdk-names/` | append-only | Never rename or remove a name |
194194

195195
Nothing upgrades an old version: a bump is a hard refusal until a migration exists. A lock or base

‎apps/docs/content/docs/cli/reference.mdx‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8622,7 +8622,6 @@ sim workflows source get <workflowId> [options]
86228622
| `--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`. |
86238623
| `--dir <dir>` | No | Write the source, its lock and SDK type declarations into this directory instead of printing them. |
86248624
| `--force` | No | With --dir: replace another workflow's source or edits no apply has saved. |
8625-
| `--primer` | No | Also print the primer written atop .sim/AGENTS.md (a `primer` field in JSON). |
86268625

86278626
</CommandTable>
86288627

@@ -10037,7 +10036,6 @@ sim workspaces source get [options]
1003710036

1003810037
| Option | Required | Description |
1003910038
| --- | --- | --- |
10040-
| `--primer` | No | Also print the primer written atop .sim/AGENTS.md (a `primer` field in JSON). |
1004110039
| `--dir <dir>` | Yes | Directory to write the workspace source into. |
1004210040
| `--only <kinds>` | No | Read only these kinds (comma-separated folders: secrets.ts, credentials.ts, tools, skills, mcp, tables, knowledge, files, workflows, deployments). |
1004310041
| `--force` | No | Replace files with edits no apply has saved. |

‎apps/docs/content/docs/cli/workflows.mdx‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1379,7 +1379,6 @@ sim workflows source get <workflowId> [options]
13791379
| `--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`. |
13801380
| `--dir <dir>` | No | Write the source, its lock and SDK type declarations into this directory instead of printing them. |
13811381
| `--force` | No | With --dir: replace another workflow's source or edits no apply has saved. |
1382-
| `--primer` | No | Also print the primer written atop .sim/AGENTS.md (a `primer` field in JSON). |
13831382

13841383
</CommandTable>
13851384

‎apps/docs/content/docs/cli/workspaces.mdx‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,6 @@ sim workspaces source get [options]
700700

701701
| Option | Required | Description |
702702
| --- | --- | --- |
703-
| `--primer` | No | Also print the primer written atop .sim/AGENTS.md (a `primer` field in JSON). |
704703
| `--dir <dir>` | Yes | Directory to write the workspace source into. |
705704
| `--only <kinds>` | No | Read only these kinds (comma-separated folders: secrets.ts, credentials.ts, tools, skills, mcp, tables, knowledge, files, workflows, deployments). |
706705
| `--force` | No | Replace files with edits no apply has saved. |

‎apps/docs/content/docs/workflows/code/coding-agents.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Claude Code, Cursor, Codex and other coding agents work from a directory that `g
77

88
## What get gives an agent
99

10-
- 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.
10+
- 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.
1111
- **`.sim/AGENTS.md`**: the primer followed by a reference, by task. A workspace directory also gets `.sim/GUIDE-advanced.md`.
1212
- **`.sim/examples/`**: one correct example of each common block to copy from.
1313
- **`.sim/sdk/`**: the type declarations, with `.sim/sdk/INDEX.md` listing the builders.

‎apps/docs/content/docs/workflows/code/diagnostics.mdx‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ Reading and writing `workflow.ts`.
2222
| `E_NUMBER_NOT_FINITE` | A number literal too large to store (`1e999` reads as `Infinity`). |
2323
| `W_NUMBER_PRECISION` | A number literal whose digits a number cannot hold; write it as a string. |
2424
| `E_SDK_HEADER` | Line 1 is not `// @sim-sdk N`. |
25-
| `E_SDK_MAJOR` | The header's major is newer than the server supports. |
26-
| `E_SDK_MAJOR_OLD` | The header's major is older than the oldest the server reads. |
25+
| `E_SDK_MAJOR` | The header's major is not the one the server reads. |
2726
| `E_UNSUPPORTED_SYNTAX` | A construct outside this grammar; the hint names the supported form. |
2827
| `E_WORKFLOW_EXPORT` | Not exactly one `export default workflow(…)`. |
2928
| `E_LIMIT_EXCEEDED` | Over the block, edge, total-byte, depth or `codeFile()` reference cap (`SOURCE_LIMITS`). Apply answers 413. |

‎apps/docs/content/docs/workflows/code/syntax.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export default workflow('Name', { description: '…', variables: { /* … */ } }
107107
})
108108
```
109109

110-
- 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`.
110+
- 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`.
111111
- Imports are named imports from `'@sim/workflow-sdk'` only. Aliases are allowed.
112112
- The file has exactly one `export default workflow(name, options?, body)` (`E_WORKFLOW_EXPORT`). `options` is `{ description?, variables? }`. `body` is `() => { … }` or `({ vars }) => { … }`.
113113
- 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>`.

‎apps/docs/content/docs/workflows/code/workspace.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const log = table.insertRow('Log Question', {
3232
})
3333
```
3434

35-
`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.
35+
`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.
3636

3737
## Edit a workspace
3838

‎apps/docs/openapi-v2-resources.json‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32795,6 +32795,11 @@
3279532795
"description": "Hidden from the output picker.",
3279632796
"type": "boolean"
3279732797
},
32798+
"mayBeText": {
32799+
"description": "A `json` or `any` output whose value can still be text at run time.",
32800+
"type": "boolean",
32801+
"const": true
32802+
},
3279832803
"properties": {
3279932804
"description": "Nested outputs by name, each of this same shape.",
3280032805
"type": "object",
@@ -33838,6 +33843,11 @@
3383833843
"description": "Hidden from the output picker.",
3383933844
"type": "boolean"
3384033845
},
33846+
"mayBeText": {
33847+
"description": "A `json` or `any` output whose value can still be text at run time.",
33848+
"type": "boolean",
33849+
"const": true
33850+
},
3384133851
"properties": {
3384233852
"description": "Nested outputs by name, each of this same shape.",
3384333853
"type": "object",
@@ -34697,6 +34707,11 @@
3469734707
"description": "Hidden from the output picker.",
3469834708
"type": "boolean"
3469934709
},
34710+
"mayBeText": {
34711+
"description": "A `json` or `any` output whose value can still be text at run time.",
34712+
"type": "boolean",
34713+
"const": true
34714+
},
3470034715
"properties": {
3470134716
"description": "Nested outputs by name, each of this same shape.",
3470234717
"type": "object",

0 commit comments

Comments
 (0)