@synapsor/runner 0.1.0-alpha.9 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/CHANGELOG.md +189 -0
  2. package/README.md +949 -164
  3. package/dist/cli.d.ts +2 -0
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/runner.mjs +2982 -238
  6. package/docs/README.md +90 -15
  7. package/docs/app-owned-executors.md +38 -0
  8. package/docs/capability-authoring.md +265 -0
  9. package/docs/cloud-mode.md +24 -0
  10. package/docs/current-scope.md +29 -0
  11. package/docs/dependency-license-inventory.md +35 -0
  12. package/docs/doctor.md +98 -0
  13. package/docs/getting-started-own-database.md +131 -46
  14. package/docs/handler-helper.md +228 -0
  15. package/docs/http-mcp.md +85 -17
  16. package/docs/licensing.md +36 -0
  17. package/docs/local-mode.md +44 -25
  18. package/docs/mcp-audit.md +8 -8
  19. package/docs/mcp-client-setup.md +59 -21
  20. package/docs/openai-agents-sdk.md +57 -0
  21. package/docs/recipes.md +6 -6
  22. package/docs/release-notes.md +348 -0
  23. package/docs/release-policy.md +125 -0
  24. package/docs/result-envelope-v2.md +151 -0
  25. package/docs/rfcs/001-result-envelope-v2.md +143 -0
  26. package/docs/rfcs/002-app-owned-handler-helper.md +161 -0
  27. package/docs/rfcs/003-integrator-feedback-teardown.md +97 -0
  28. package/docs/store-lifecycle.md +83 -0
  29. package/docs/troubleshooting-first-run.md +6 -6
  30. package/docs/use-your-own-database.md +18 -0
  31. package/docs/writeback-executors.md +92 -1
  32. package/examples/app-owned-writeback/README.md +128 -0
  33. package/examples/app-owned-writeback/business-actions.md +221 -0
  34. package/examples/app-owned-writeback/command-handler.mjs +55 -0
  35. package/examples/app-owned-writeback/node-fastify-handler.mjs +64 -0
  36. package/examples/app-owned-writeback/python-fastapi-handler.py +66 -0
  37. package/examples/claude-desktop-postgres/Makefile +6 -0
  38. package/examples/claude-desktop-postgres/README.md +40 -0
  39. package/examples/cursor-postgres/Makefile +6 -0
  40. package/examples/cursor-postgres/README.md +30 -0
  41. package/examples/mcp-postgres-billing-app-handler/README.md +94 -0
  42. package/examples/mcp-postgres-billing-app-handler/app-handler.mjs +123 -0
  43. package/examples/mcp-postgres-billing-app-handler/docker-compose.yml +13 -0
  44. package/examples/mcp-postgres-billing-app-handler/schema.sql +59 -0
  45. package/examples/mcp-postgres-billing-app-handler/scripts/run-demo.sh +100 -0
  46. package/examples/mcp-postgres-billing-app-handler/seed.sql +39 -0
  47. package/examples/mcp-postgres-billing-app-handler/synapsor-handler.mjs +437 -0
  48. package/examples/mcp-postgres-billing-app-handler/synapsor.runner.json +158 -0
  49. package/examples/mysql-refund-agent/Makefile +4 -0
  50. package/examples/mysql-refund-agent/README.md +36 -0
  51. package/examples/openai-agents-http/Makefile +6 -0
  52. package/examples/openai-agents-http/README.md +33 -12
  53. package/examples/openai-agents-http/agent.py +29 -65
  54. package/examples/openai-agents-stdio/Makefile +6 -0
  55. package/examples/openai-agents-stdio/README.md +24 -6
  56. package/examples/openai-agents-stdio/agent.py +4 -2
  57. package/examples/raw-sql-vs-synapsor/Makefile +11 -0
  58. package/examples/raw-sql-vs-synapsor/README.md +41 -0
  59. package/examples/reference-support-billing-app/README.md +16 -16
  60. package/examples/reference-support-billing-app/mcp-client.generic.json +1 -1
  61. package/examples/support-billing-agent/Makefile +19 -0
  62. package/examples/support-billing-agent/README.md +89 -0
  63. package/examples/support-billing-agent/app/README.md +13 -0
  64. package/examples/support-billing-agent/db/schema.sql +91 -0
  65. package/examples/support-billing-agent/db/seed.sql +43 -0
  66. package/examples/support-billing-agent/docker-compose.yml +13 -0
  67. package/examples/support-billing-agent/scripts/run-demo.sh +15 -0
  68. package/examples/support-billing-agent/synapsor.runner.json +233 -0
  69. package/fixtures/benchmark/mcp-efficiency.json +53 -0
  70. package/fixtures/benchmark/mcp-efficiency.txt +25 -0
  71. package/fixtures/protocol/MANIFEST.json +54 -0
  72. package/fixtures/protocol/change-set.late-fee-waiver.v1.json +72 -0
  73. package/fixtures/protocol/execution-receipt.applied.v1.json +14 -0
  74. package/fixtures/protocol/execution-receipt.conflict.v1.json +15 -0
  75. package/fixtures/protocol/runner-registration.v1.json +22 -0
  76. package/fixtures/protocol/writeback-job.late-fee-waiver.v1.json +44 -0
  77. package/package.json +27 -4
  78. package/schemas/change-set.v1.schema.json +140 -0
  79. package/schemas/execution-receipt.v1.schema.json +34 -0
  80. package/schemas/onboarding-selection.v1.schema.json +132 -0
  81. package/schemas/runner-registration.v1.schema.json +48 -0
  82. package/schemas/synapsor.app-handler-receipt.v1.json +39 -0
  83. package/schemas/synapsor.app-handler-request.v1.json +119 -0
  84. package/schemas/synapsor.runner.schema.json +415 -0
  85. package/schemas/writeback-job.v1.schema.json +121 -0
package/docs/recipes.md CHANGED
@@ -9,20 +9,20 @@ tenant key, conflict column, and business limits.
9
9
  List recipes:
10
10
 
11
11
  ```bash
12
- npx -y -p @synapsor/runner@alpha synapsor-runner recipes list
12
+ npx -y -p @synapsor/runner synapsor-runner recipes list
13
13
  ```
14
14
 
15
15
  Inspect one:
16
16
 
17
17
  ```bash
18
- npx -y -p @synapsor/runner@alpha synapsor-runner recipes show billing.late_fee_waiver
18
+ npx -y -p @synapsor/runner synapsor-runner recipes show billing.late_fee_waiver
19
19
  ```
20
20
 
21
21
  Initialize a starter config:
22
22
 
23
23
  ```bash
24
- npx -y -p @synapsor/runner@alpha synapsor-runner recipes init billing.late_fee_waiver --output synapsor.runner.json
25
- npx -y -p @synapsor/runner@alpha synapsor-runner config validate --config synapsor.runner.json
24
+ npx -y -p @synapsor/runner synapsor-runner recipes init billing.late_fee_waiver --output synapsor.runner.json
25
+ npx -y -p @synapsor/runner synapsor-runner config validate --config synapsor.runner.json
26
26
  ```
27
27
 
28
28
  Built-in recipes are JSON files under `recipes/`. They are starter data, not
@@ -31,8 +31,8 @@ domain, and initialize from your file:
31
31
 
32
32
  ```bash
33
33
  cp recipes/billing.late_fee_waiver.json my-recipe.json
34
- npx -y -p @synapsor/runner@alpha synapsor-runner recipes show ./my-recipe.json
35
- npx -y -p @synapsor/runner@alpha synapsor-runner recipes init ./my-recipe.json --output synapsor.runner.json
34
+ npx -y -p @synapsor/runner synapsor-runner recipes show ./my-recipe.json
35
+ npx -y -p @synapsor/runner synapsor-runner recipes init ./my-recipe.json --output synapsor.runner.json
36
36
  ```
37
37
 
38
38
  Available recipes:
@@ -0,0 +1,348 @@
1
+ # Release Notes
2
+
3
+ These notes track public Synapsor Runner behavior. Starting with `0.1.0`, the
4
+ normal install path uses the untagged stable package:
5
+
6
+ ```bash
7
+ npx -y -p @synapsor/runner synapsor-runner demo --quick
8
+ ```
9
+
10
+ The OSS runner command is `synapsor-runner`. The `synapsor` command is reserved
11
+ for the Synapsor Cloud CLI.
12
+
13
+ ## 0.1.1
14
+
15
+ ### OSS Launch Readiness
16
+
17
+ - Reworked the README and packaged npm README so the first screen leads with
18
+ the `execute_sql` risk, the reviewed-business-action alternative, badges, and
19
+ the no-database quick demo.
20
+ - Added the self-contained `examples/support-billing-agent/` flagship demo with
21
+ schema, seed data, reviewed contract, app-boundary note, one-command
22
+ `make demo`, and the exact support/billing model-facing tool list.
23
+ - Added copy-paste example entry points for raw SQL vs Synapsor, Claude
24
+ Desktop, Cursor, OpenAI Agents SDK over Streamable HTTP and stdio, and MySQL
25
+ refund review.
26
+ - Added agent-native repo guidance files and verified that an agent can create
27
+ an inspect/propose capability with the non-interactive CLI without reading
28
+ generated `dist/` files.
29
+ - Restructured the docs index into a task-first path and added release-gate
30
+ repo hygiene assets.
31
+ - Hardened package building so generated `.synapsor` local ledgers are not
32
+ included in npm examples.
33
+
34
+ ## 0.1.0
35
+
36
+ ### Stable Channel
37
+
38
+ - Promotes the alpha.17 safety/onboarding surface to the first stable
39
+ `@synapsor/runner` release.
40
+ - Documents the `0.1.x` compatibility promise for the `synapsor-runner` binary,
41
+ `synapsor.runner.json` schema version `1`, result envelope v2, stdio and
42
+ Streamable HTTP MCP surfaces, MCP client snippets, local inspection commands,
43
+ direct SQL writeback, and app-owned executor contracts.
44
+ - Keeps alpha/prerelease builds available through the `@alpha` tag for preview
45
+ behavior.
46
+
47
+ ### Included From Alpha.17
48
+
49
+ - Prompt-free onboarding for scripts, CI, and LLM agents.
50
+ - Review-mode configs that avoid silently disabled writeback.
51
+ - `up --serve`, stale lease reclaim, result envelope v2 defaults for new
52
+ configs, app-owned handler warnings, final wizard preview, friendlier
53
+ capability names, local event webhooks, and smoke-call first-run guidance.
54
+
55
+ ## 0.1.0-alpha.17
56
+
57
+ ### Scripted Onboarding
58
+
59
+ - `onboard db` and `init` now have a prompt-free path for scripts, CI, and LLM
60
+ agents. Use `--yes`, `--non-interactive`, or `--answers <file.json>`.
61
+ - Added friendly flags that match the first-run mental model:
62
+ `--tenant-column`, `--id-arg`, `--patch column=fixed:value|arg:name`,
63
+ `--patch-bounds`, `--status-guards`, `--read-description`,
64
+ `--read-returns-hint`, `--read-tool`, `--proposal-tool`,
65
+ `--handler-output`, and `--emit-handler`.
66
+ - Answers-file onboarding writes the reviewed config, `.env.example`, MCP
67
+ snippets, and optional handler template without opening a TTY prompt.
68
+ - When `--namespace` is omitted, generated capability names now derive a
69
+ namespace from the selected table instead of falling back to `source.*`.
70
+ - The guided wizard now has a final "what I am about to write" preview where
71
+ users can revise visible fields or capability names before files are written.
72
+ - README Start Here now tells users to run `tools preview` and `smoke call`
73
+ before wiring an MCP client.
74
+ - `events webhook` / `events push` can POST local proposal/writeback lifecycle
75
+ events to a local/dev/staging HTTP endpoint for review UIs or notifications.
76
+
77
+ ### Writeback Readiness
78
+
79
+ - App-owned executor configs generated by Runner now mark the Runner source as
80
+ `read_only: true` when no writer env is supplied. `config validate` no longer
81
+ reports `WRITEBACK_DISABLED` for handler-owned writeback paths.
82
+ - Direct SQL review-mode proposals still surface `WRITEBACK_DISABLED` if the
83
+ source has no `write_url_env`, because Runner cannot apply those proposals
84
+ without a trusted writer connection.
85
+
86
+ ### Handler Docs
87
+
88
+ - README and runner README now include a short "How An External Handler Works"
89
+ section: agent proposes, human approves outside MCP, Runner POSTs to your
90
+ endpoint, and your code writes in its own transaction.
91
+ - Published docs/examples no longer include install-looking imports for a
92
+ separate handler package. Use `synapsor-runner handler template ...` or the
93
+ bundled `synapsor-handler.mjs` shim in the app-owned example.
94
+
95
+ ## 0.1.0-alpha.16
96
+
97
+ ### Review-Mode Bring-Up
98
+
99
+ - Added `synapsor-runner up` as the local review-mode orientation command. It
100
+ validates the config/store, checks active store leases, summarizes
101
+ model-facing tools, identifies direct SQL versus app-owned executor writeback
102
+ paths, and prints the next smoke, approval, apply, replay, UI, and doctor
103
+ commands.
104
+ - `up` is guidance-only by default. `up --serve` starts the standard MCP
105
+ Streamable HTTP server after the same validation and guidance.
106
+ - `up --dry-run` gives the full checklist without starting a server.
107
+ - `up --handler-check` or `up --with-handler` runs the redacted handler
108
+ env/reachability doctor path before serving.
109
+ - The guided wizard now writes model-facing capability descriptions,
110
+ per-argument descriptions, returns hints, and defaults generated configs to
111
+ `result_format: 2`.
112
+ - `result_format: 2` gives MCP clients a stable envelope with `ok`, `summary`,
113
+ `data`, `proposal`, `error`, `evidence`, `source_database_changed`, and
114
+ `_meta.canonical_capability`. Pass `--result-format v1` or
115
+ `"result_format": 1` only when an older client needs the legacy shape.
116
+ - `tools list`, `tools list --aliases`, and
117
+ `mcp client-config --include-instructions` help users inspect exposed tools
118
+ and generate client snippets without source reading.
119
+
120
+ ### Handler Security
121
+
122
+ - Generated handler templates, template-list output, app-owned writeback docs,
123
+ and examples now explicitly warn that the app handler owns the final business
124
+ write. Handlers must re-check tenant/scope, expected-version or conflict
125
+ guard, idempotency, allowed business action, transaction/rollback, and safe
126
+ error receipts before mutating application state.
127
+ - The guided review-mode wizard can now write a starter handler template when
128
+ the app-owned HTTP or command handler path is selected.
129
+
130
+ ## 0.1.0-alpha.15
131
+
132
+ ### Handler Wording Clarification
133
+
134
+ - README and app-owned executor docs now state that users install only
135
+ `@synapsor/runner`. A handler is the user's own app endpoint or script for
136
+ rich approved writes, not a second Synapsor package to install.
137
+
138
+ ## 0.1.0-alpha.14
139
+
140
+ ### Handler Helper And Changelog Clarity
141
+
142
+ - Public docs now state that the handler helper is not a standalone npm package
143
+ yet. The helper currently ships as source under `packages/handler` and as the
144
+ bundled `synapsor-handler.mjs` shim in the app-owned executor example
145
+ included with `@synapsor/runner`.
146
+ - `CHANGELOG.md` is included in the `@synapsor/runner` npm tarball.
147
+
148
+ ## 0.1.0-alpha.13
149
+
150
+ ### README First-Five-Minutes Polish
151
+
152
+ - The README now opens with the plain mental model: the agent talks to Runner,
153
+ can inspect scoped data, can create proposals, cannot commit, and writeback
154
+ plus replay happen outside the model-facing tool.
155
+ - Capability, proposal, writeback, and executor are defined before the first
156
+ command so a new reader can understand the rest of the docs.
157
+ - The README now states the direct-writeback rule early: guarded one-row updates
158
+ can use Runner direct writeback; inserts, multi-table work, events, and other
159
+ rich writes belong in an app-owned executor.
160
+ - The own-database section now includes a tiny readable config with one read
161
+ capability and one proposal capability so users can picture what the wizard
162
+ generates before they run it.
163
+
164
+ ## 0.1.0-alpha.12
165
+
166
+ ### Doctor And Writeback Checks
167
+
168
+ - `synapsor-runner doctor --config synapsor.runner.json --check-writeback`
169
+ verifies direct SQL writer connectivity, receipt-table readiness, and
170
+ rollback-only target-table access for reviewed proposal capabilities.
171
+ - Plain `doctor` warns when direct SQL writeback exists but has not been probed.
172
+ - The writeback probe uses fixed identifiers from reviewed config only. It does
173
+ not accept model SQL, user SQL, arbitrary table names, or arbitrary columns.
174
+ - Probe failures are redacted to safe categories such as `connection failed`,
175
+ `permission denied`, and `configured object not found`.
176
+ - `docs/doctor.md` explains handler checks, direct SQL writeback checks, and
177
+ receipt-table DDL/grant guidance.
178
+
179
+ ### Store Lifecycle
180
+
181
+ - `synapsor-runner store reset --store ./.synapsor/local.db --yes` removes only
182
+ local SQLite ledger files and reports `source_database_changed: false`.
183
+ - Destructive store reset refuses active server leases by default and requires
184
+ `--force` for advanced/stale-lease recovery.
185
+ - Packed and public verifier scripts now cover `store reset`.
186
+
187
+ ## 0.1.0-alpha.11
188
+
189
+ ### OpenAI MCP Aliases
190
+
191
+ - `synapsor-runner mcp serve` and `synapsor-runner mcp serve-streamable-http`
192
+ now accept `--alias-mode openai` and `--openai-tool-aliases`.
193
+ - `synapsor-runner mcp serve --transport streamable-http` is available as a
194
+ unified command form for the standard HTTP MCP server.
195
+ - `synapsor-runner mcp client-config --client openai-agents` prints a
196
+ Streamable HTTP start command and OpenAI Agents SDK snippet.
197
+ - `synapsor-runner tools preview --alias-mode openai` shows model-visible alias
198
+ names and the canonical Synapsor capability each alias maps to.
199
+ - `examples/mcp-postgres-billing-app-handler/` adds a disposable Postgres proof
200
+ for the app-owned executor path: proposal first, approval outside MCP,
201
+ account-credit row inserted by the app handler, idempotent retry, and replay.
202
+ - `--alias-mode both` exposes canonical dotted names and OpenAI-safe aliases
203
+ together for migration/debugging.
204
+ - OpenAI alias mode exposes MCP tool names such as
205
+ `billing__inspect_invoice` instead of canonical dotted names such as
206
+ `billing.inspect_invoice`.
207
+ - Tool metadata includes `synapsor.canonical_tool_name`,
208
+ `synapsor.exposed_tool_name`, and `synapsor.tool_name_style`, so reviewers
209
+ can still see the canonical Synapsor capability.
210
+ - Runner routes alias calls back to the canonical capability. This removes the
211
+ need for user-written OpenAI wrapper code whose only job is replacing dots in
212
+ tool names.
213
+ - The OpenAI Agents SDK stdio and Streamable HTTP examples now document the
214
+ built-in alias mode.
215
+
216
+ ## 0.1.0-alpha.10
217
+
218
+ ### First-Run Flow
219
+
220
+ - `synapsor-runner start --from-env DATABASE_URL` is the shortest own-database
221
+ onboarding command. It is an alias for the guided `onboard db --from-env`
222
+ flow, not the legacy cloud worker.
223
+ - The wizard inspects database metadata, creates trusted context bindings,
224
+ generates semantic capabilities, writes `.env.example`, previews MCP tools,
225
+ and prints exact smoke-call, MCP, and UI commands.
226
+ - If you provide a real object id and the required environment variables are
227
+ set, onboarding attempts the first smoke tool call and stores local evidence
228
+ and query audit. If not, it prints the exact `smoke call` command to run
229
+ after setting the values.
230
+ - `synapsor-runner ui --open` opens the local review UI and is the preferred
231
+ way to inspect proposals, evidence, receipts, and replay after a demo or
232
+ smoke call.
233
+
234
+ ### MCP Transport
235
+
236
+ - `synapsor-runner mcp serve` is standard stdio MCP for local MCP clients that
237
+ can launch Runner, such as Claude Desktop, Cursor, and similar clients.
238
+ - `synapsor-runner mcp serve-streamable-http` is the standard Streamable HTTP
239
+ MCP path for app/server agents and SDK clients. It implements MCP
240
+ initialize/session behavior on the `/mcp` endpoint.
241
+ - `synapsor-runner mcp serve-http` is an authenticated JSON-RPC bridge for
242
+ simple `tools/list`, `tools/call`, and `resources/read` wrappers. It is not
243
+ the standard Streamable HTTP MCP transport and prints a runtime warning when
244
+ started.
245
+ - The OpenAI Agents SDK HTTP example uses the Streamable HTTP MCP path. Use the
246
+ JSON-RPC bridge only when you intentionally want a thin app-owned wrapper.
247
+
248
+ ### Writeback
249
+
250
+ - Direct SQL writeback is intentionally narrow: guarded single-row `UPDATE`
251
+ only. It does not support arbitrary SQL, DDL, `INSERT`, `DELETE`, `UPSERT`,
252
+ stored procedures, or multi-row writes.
253
+ - Direct SQL writeback reads the trusted writer connection from the source
254
+ `write_url_env` in `synapsor.runner.json`, such as
255
+ `SYNAPSOR_DATABASE_WRITE_URL`.
256
+ - `SYNAPSOR_DATABASE_URL` is accepted only as a legacy fallback for older
257
+ direct worker/apply flows without a local config.
258
+ - Direct SQL writeback creates or writes `synapsor_writeback_receipts` for
259
+ idempotency and replay. The trusted writer needs permission for that receipt
260
+ table, or an administrator must pre-create the table and grant access.
261
+ - Use `synapsor-runner writeback doctor`, `writeback migration`, and
262
+ `writeback grants` to inspect and prepare the direct writeback path.
263
+ - Use app-owned `http_handler` or `command_handler` executors for rich writes
264
+ such as inserting credit rows, opening tickets, deleting records through app
265
+ policy, or updating multiple related rows.
266
+ - `synapsor-runner handler template` writes starter Node/Fastify,
267
+ Python/FastAPI, or command-handler files so rich writes can start from an
268
+ app-owned transaction boundary instead of hand-writing a handler from
269
+ scratch.
270
+
271
+ ### Evidence And Replay
272
+
273
+ - Read-only capabilities produce scoped semantic tools, trusted context
274
+ binding, evidence handles, query audit, and local inspection records.
275
+ - Proposal workflows add full local replay across evidence, approval,
276
+ writeback jobs, execution receipts, and events.
277
+ - `synapsor-runner events tail` prints local lifecycle events from the SQLite
278
+ ledger and can follow new proposal/writeback events while a local flow runs.
279
+ - `synapsor-runner events webhook` pushes those local lifecycle events to a
280
+ local/dev/staging HTTP endpoint for review UIs or notifications without
281
+ polling. It is not a hosted central ledger.
282
+ - MCP server modes write an active-store lease next to the local SQLite file.
283
+ Destructive `store prune --yes` refuses while that lease points at a live
284
+ process unless `--force` is provided.
285
+ - External Postgres/MySQL databases are not physically branched by Runner.
286
+ Replay covers records captured by Runner; it is not external database
287
+ time travel.
288
+
289
+ ### Known Limitations
290
+
291
+ - This is an alpha local runner, not Synapsor Cloud, not the Synapsor DBMS, and
292
+ not a generic MCP security platform.
293
+ - Runner does not expose model-callable approval, commit, apply, or raw SQL
294
+ tools.
295
+ - Runner does not implement Synapsor Cloud workflow DAGs, native branches,
296
+ auto-merge, settlement policies, hosted RBAC/SSO, hosted evidence retention,
297
+ CDC, managed runner fleets, compliance exports, production SLA, or C++ DBMS
298
+ internals.
299
+ - The local store is single-node SQLite for local/dev/staging usage.
300
+ - Node >= 22.5.0 is required because the local ledger uses Node's
301
+ `node:sqlite` runtime. Use a supported Node runtime or the Docker-backed
302
+ source demo path.
303
+
304
+ ### Upgrade Notes From Earlier Alphas
305
+
306
+ - Public command examples now use `synapsor-runner`, not `synapsor`.
307
+ - Standard HTTP MCP examples now use `mcp serve-streamable-http`; `mcp
308
+ serve-http` is documented as the JSON-RPC bridge.
309
+ - Direct SQL writeback docs now use `write_url_env` for writer credentials and
310
+ document `SYNAPSOR_DATABASE_URL` only as a legacy fallback.
311
+ - Receipt-table permissions are now a documented writeback requirement.
312
+ - The quick demo is guided in interactive terminals, concise in noninteractive
313
+ mode, and keeps the longer explanation behind `--details`.
314
+
315
+ ## Stable Release Policy
316
+
317
+ Use untagged `@synapsor/runner` for stable installs. Use `@alpha` or an exact
318
+ prerelease only when intentionally testing preview behavior. Stable `0.1.x`
319
+ releases should keep the compatibility promise documented in
320
+ `docs/release-policy.md`.
321
+
322
+ The first stable `0.1.0` release was gated on:
323
+
324
+ - the README's npm commands match the published package;
325
+ - a clean temporary directory can run the quick demo, own-database onboarding,
326
+ MCP config generation, smoke call, UI, and replay commands;
327
+ - stdio MCP and Streamable HTTP MCP are covered by tests and examples;
328
+ - direct and app-owned writeback requirements are documented and verified; and
329
+ - known limitations are still accurate.
330
+
331
+ For the local tarball before publish, run:
332
+
333
+ ```bash
334
+ ./scripts/verify-release-gate.sh
335
+ ```
336
+
337
+ After publishing an alpha, verify the public package from a clean temporary
338
+ directory:
339
+
340
+ ```bash
341
+ VERIFY_PUBLISHED_ALPHA=1 ./scripts/verify-release-gate.sh 0.1.0-alpha.17
342
+ ```
343
+
344
+ After publishing/promoting stable `latest`, verify the stable channel:
345
+
346
+ ```bash
347
+ ./scripts/verify-published-stable.sh 0.1.0
348
+ ```
@@ -0,0 +1,125 @@
1
+ # Release Policy
2
+
3
+ Synapsor Runner `0.1.0` is the first stable local runner line. Use the stable
4
+ package for normal installs:
5
+
6
+ ```bash
7
+ npx -y -p @synapsor/runner synapsor-runner demo --quick
8
+ npm install -g @synapsor/runner
9
+ ```
10
+
11
+ Use `@alpha` or an exact prerelease only when intentionally testing the moving
12
+ preview channel.
13
+
14
+ ## Alpha Expectations
15
+
16
+ Alpha versions may change:
17
+
18
+ - command names and help text;
19
+ - MCP transport defaults;
20
+ - config fields and JSON Schema;
21
+ - local store layout;
22
+ - result envelope format;
23
+ - writeback/handler contracts;
24
+ - example layout and docs.
25
+
26
+ Alpha releases must keep the safety boundary intact:
27
+
28
+ - no model-facing `execute_sql`;
29
+ - no model-facing write credentials;
30
+ - no model-facing approval/commit/apply tools;
31
+ - no generic model-generated INSERT/DELETE/UPSERT/DDL/multi-row SQL;
32
+ - proposal-first write path stays explicit.
33
+
34
+ ## Stable Expectations
35
+
36
+ A stable `0.1.0` release should only be tagged after:
37
+
38
+ - npm README commands match the published package;
39
+ - `synapsor-runner demo --quick` works from a clean directory;
40
+ - own-database onboarding works from a clean directory;
41
+ - one-command review-mode `synapsor-runner up` is verified from a clean
42
+ directory and clearly prints model-facing tools, writeback path, handler
43
+ requirements, and next commands;
44
+ - review-mode wizard output is verified for one read capability plus one
45
+ proposal capability;
46
+ - handler template security warnings are verified in docs, CLI output, and
47
+ generated templates;
48
+ - stdio MCP and Streamable HTTP MCP are both verified;
49
+ - OpenAI alias mode is verified;
50
+ - direct SQL writeback requirements are documented and tested;
51
+ - app-owned executor requirements are documented and tested;
52
+ - local evidence/proposal/receipt/replay inspection works;
53
+ - current limitations are accurate.
54
+ - at least one external developer can follow the README without reading source;
55
+ - there are no known docs/code mismatches around transport, credentials,
56
+ receipt tables, or handler expectations.
57
+
58
+ ## Stable Compatibility Promise
59
+
60
+ Starting with `0.1.0`, Synapsor Runner keeps these public surfaces compatible
61
+ through the `0.1.x` line unless a release note marks a deprecation first:
62
+
63
+ - the `synapsor-runner` binary name and README quickstart commands;
64
+ - `synapsor.runner.json` schema version `1` for documented fields;
65
+ - result envelope v2 for new configs, with the documented v1 opt-out;
66
+ - stdio MCP and Streamable HTTP MCP command surfaces;
67
+ - generated MCP client snippets for documented clients;
68
+ - proposal, approval, guarded writeback, receipt, evidence, query-audit, and
69
+ replay inspection commands;
70
+ - direct SQL writeback and app-owned executor contracts documented in README
71
+ and `docs/writeback-executors.md`.
72
+
73
+ Stable does not promise production SLA, hosted Cloud features, compliance
74
+ certification, physical Postgres/MySQL branching, generic SQL writeback,
75
+ generic multi-row writes, or compatibility for undocumented local SQLite
76
+ internals. Local store migrations may happen inside `0.1.x`, but documented CLI
77
+ inspection commands should remain the supported way to read the store.
78
+
79
+ Alpha users should pin an exact alpha version in package.json, CI, and MCP
80
+ client snippets. Use `@alpha` only when intentionally testing the moving
81
+ preview channel.
82
+
83
+ ## Result Envelope Migration
84
+
85
+ New `init` and `onboard db` configs default to:
86
+
87
+ ```json
88
+ {
89
+ "result_format": 2
90
+ }
91
+ ```
92
+
93
+ Existing hand-written configs without `result_format` keep the legacy runtime
94
+ default for compatibility. To force v2 or opt an older client back to v1, use:
95
+
96
+ ```bash
97
+ synapsor-runner mcp serve --result-format v2
98
+ synapsor-runner mcp serve-streamable-http --result-format v2
99
+ synapsor-runner mcp serve --result-format v1
100
+ ```
101
+
102
+ v2 makes `ok` the only required branch point for MCP client code. Do not remove
103
+ the v1 escape hatch until the stable compatibility policy says legacy result
104
+ shapes are no longer supported.
105
+
106
+ ## Publish Checklist
107
+
108
+ Before publishing any release:
109
+
110
+ ```bash
111
+ ./scripts/verify-release-gate.sh
112
+ ```
113
+
114
+ After publishing an alpha prerelease:
115
+
116
+ ```bash
117
+ VERIFY_PUBLISHED_ALPHA=1 ./scripts/verify-release-gate.sh 0.1.0-alpha.17
118
+ ```
119
+
120
+ After publishing/promoting stable `latest`, verify the stable channel from a
121
+ clean temporary directory:
122
+
123
+ ```bash
124
+ ./scripts/verify-published-stable.sh 0.1.0
125
+ ```
@@ -0,0 +1,151 @@
1
+ # Result Envelope v2
2
+
3
+ Result envelope v2 gives every model-facing MCP tool call one stable shape.
4
+ Client code and agents branch only on `ok`.
5
+
6
+ Enable it in config:
7
+
8
+ ```json
9
+ {
10
+ "result_format": 2
11
+ }
12
+ ```
13
+
14
+ Or at serve time:
15
+
16
+ ```bash
17
+ synapsor-runner mcp serve \
18
+ --config ./synapsor.runner.json \
19
+ --store ./.synapsor/local.db \
20
+ --result-format v2
21
+
22
+ synapsor-runner mcp serve-streamable-http \
23
+ --config ./synapsor.runner.json \
24
+ --store ./.synapsor/local.db \
25
+ --auth-token-env SYNAPSOR_RUNNER_HTTP_TOKEN \
26
+ --result-format v2
27
+ ```
28
+
29
+ ## Shape
30
+
31
+ ```json
32
+ {
33
+ "ok": true,
34
+ "summary": "Read invoice INV-3001 through billing.inspect_invoice. Source database changed: no.",
35
+ "action": "billing.inspect_invoice",
36
+ "kind": "read",
37
+ "data": {},
38
+ "proposal": null,
39
+ "error": null,
40
+ "evidence": {
41
+ "bundle_id": "ev_...",
42
+ "note": "audit/replay handle; you do not need to act on it during this turn"
43
+ },
44
+ "source_database_changed": false,
45
+ "_meta": {
46
+ "tenant_id": "tenant_acme",
47
+ "principal": "demo-operator",
48
+ "provenance": "environment",
49
+ "canonical_capability": "billing.inspect_invoice"
50
+ }
51
+ }
52
+ ```
53
+
54
+ Rules:
55
+
56
+ - `ok` is the only field callers need to branch on.
57
+ - `summary` is always present and safe for an agent to read or echo.
58
+ - On success, exactly one of `data` or `proposal` is non-null.
59
+ - On failure, both `data` and `proposal` are null.
60
+ - `source_database_changed` is always present.
61
+ - `_meta.canonical_capability` is always the dotted Synapsor capability name,
62
+ even when the model sees an OpenAI-safe alias.
63
+
64
+ ## Proposal Result
65
+
66
+ Proposal tools create reviewable changes. They do not commit to the source
67
+ database.
68
+
69
+ ```json
70
+ {
71
+ "ok": true,
72
+ "summary": "Created proposal wrp_123 for invoices INV-3001. Source database changed: no.",
73
+ "action": "billing.propose_late_fee_waiver",
74
+ "kind": "proposal",
75
+ "data": null,
76
+ "proposal": {
77
+ "id": "wrp_123",
78
+ "state": "review_required",
79
+ "target": "invoices:INV-3001",
80
+ "diff": {
81
+ "late_fee_cents": {
82
+ "before": 2500,
83
+ "proposed": 0
84
+ }
85
+ },
86
+ "approval_required": true,
87
+ "writeback": {
88
+ "mode": "direct_update",
89
+ "applied": false
90
+ },
91
+ "next": "A human must approve outside this model-facing tool surface; nothing is committed yet."
92
+ },
93
+ "error": null,
94
+ "evidence": {
95
+ "bundle_id": "ev_..."
96
+ },
97
+ "source_database_changed": false,
98
+ "_meta": {
99
+ "canonical_capability": "billing.propose_late_fee_waiver"
100
+ }
101
+ }
102
+ ```
103
+
104
+ For app-owned executors, `proposal.writeback.mode` is `app_handler`.
105
+
106
+ ## Error Result
107
+
108
+ Model-facing errors are safe and stable. Raw driver details stay in local logs
109
+ or ledger inspection, not in the MCP result.
110
+
111
+ ```json
112
+ {
113
+ "ok": false,
114
+ "summary": "The database is temporarily unavailable. Retry later.",
115
+ "action": "billing.inspect_invoice",
116
+ "kind": "read",
117
+ "data": null,
118
+ "proposal": null,
119
+ "error": {
120
+ "code": "TEMPORARILY_UNAVAILABLE",
121
+ "message": "The database is temporarily unavailable. Retry later.",
122
+ "retryable": true
123
+ },
124
+ "evidence": null,
125
+ "source_database_changed": false,
126
+ "_meta": {
127
+ "canonical_capability": "billing.inspect_invoice"
128
+ }
129
+ }
130
+ ```
131
+
132
+ Safe error codes:
133
+
134
+ ```text
135
+ NOT_FOUND_IN_TENANT
136
+ INVALID_ARGUMENT
137
+ POLICY_VIOLATION
138
+ CAPABILITY_NOT_FOUND
139
+ VERSION_CONFLICT
140
+ MULTI_ROW_BLOCKED
141
+ APPROVAL_REQUIRED
142
+ TEMPORARILY_UNAVAILABLE
143
+ INTERNAL
144
+ ```
145
+
146
+ Current alpha implementation redacts raw connection and driver messages from v2
147
+ MCP results. New `init` and `onboard db` configs write `result_format: 2` by
148
+ default. Existing hand-written configs without `result_format` keep the legacy
149
+ runtime default for compatibility; pass `--result-format v2` when serving an
150
+ older config to force the v2 envelope, or `--result-format v1` for an older
151
+ client that still depends on the legacy shape.