@synapsor/runner 0.1.4 → 0.1.5

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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,24 @@
4
4
 
5
5
  No unreleased changes yet.
6
6
 
7
+ ## 0.1.5
8
+
9
+ ### Contract Authoring Front Door
10
+
11
+ - Introduces `@synapsor/spec` and `@synapsor/dsl` in the main Runner README so
12
+ developers can find the canonical contract and SQL-like authoring layers from
13
+ the repo and npm package front door.
14
+ - Adds a copy-pasteable `CREATE AGENT CONTEXT` / `CREATE CAPABILITY` authoring
15
+ flow that compiles to `synapsor.contract.json`, validates, bundles, dry-run
16
+ pushes to Cloud, and serves through Runner local wiring.
17
+ - Refreshes capability authoring docs to lead with the contract/DSL path while
18
+ preserving direct `synapsor.runner.json` embedded capability authoring for
19
+ local experiments and compatibility.
20
+ - Clarifies that workflow declarations are supported in contracts/DSL, while
21
+ Runner 0.1 does not execute full Synapsor Cloud workflow DAGs, auto-merge,
22
+ settlement policies, or native branching.
23
+ - Updates the repository map to include `packages/spec` and `packages/dsl`.
24
+
7
25
  ## 0.1.4
8
26
 
9
27
  ### Public Repository Metadata
package/README.md CHANGED
@@ -203,6 +203,88 @@ You install only `@synapsor/runner`. There is no separate handler package to
203
203
  install. A handler is your app's endpoint or script for rich approved writes;
204
204
  Runner includes templates and examples to help you build one.
205
205
 
206
+ ## Packages
207
+
208
+ | Package | What it is |
209
+ | --- | --- |
210
+ | `@synapsor/runner` | The local runtime: CLI, MCP server, local store, evidence, proposals, approval, writeback, replay, and audit tools. |
211
+ | `@synapsor/spec` | The canonical portable contract package for contexts, resources, capabilities, workflows, evidence, proposals, receipts, and replay. |
212
+ | `@synapsor/dsl` | A SQL-like authoring layer that compiles `CREATE AGENT CONTEXT`, `CREATE CAPABILITY`, and `CREATE AGENT WORKFLOW` into `@synapsor/spec` JSON. |
213
+
214
+ Use the runner when you want something to execute locally. Use the spec when
215
+ you want a portable contract that Runner, Cloud, and the C++ engine can agree
216
+ on. Use the DSL when you want to author that contract in a reviewable,
217
+ database-style format.
218
+
219
+ ## Author Your Contract
220
+
221
+ For new capabilities, prefer the portable contract path:
222
+
223
+ ```text
224
+ contract.synapsor -> synapsor.contract.json -> synapsor.runner.json
225
+ ```
226
+
227
+ Example DSL:
228
+
229
+ ```sql
230
+ CREATE AGENT CONTEXT local_operator
231
+ BIND tenant_id FROM ENVIRONMENT SYNAPSOR_TENANT_ID REQUIRED
232
+ BIND principal FROM ENVIRONMENT SYNAPSOR_PRINCIPAL REQUIRED
233
+ TENANT BINDING tenant_id
234
+ PRINCIPAL BINDING principal
235
+ END
236
+
237
+ CREATE CAPABILITY billing.inspect_invoice
238
+ USING CONTEXT local_operator
239
+ SOURCE local_postgres
240
+ ON public.invoices
241
+ PRIMARY KEY id
242
+ TENANT KEY tenant_id
243
+ CONFLICT GUARD updated_at
244
+ LOOKUP invoice_id BY id
245
+ ARG invoice_id STRING REQUIRED MAX 128
246
+ ALLOW READ id, tenant_id, status, late_fee_cents, updated_at
247
+ REQUIRE EVIDENCE
248
+ MAX ROWS 1
249
+ END
250
+
251
+ CREATE CAPABILITY billing.propose_late_fee_waiver
252
+ USING CONTEXT local_operator
253
+ SOURCE local_postgres
254
+ ON public.invoices
255
+ PRIMARY KEY id
256
+ TENANT KEY tenant_id
257
+ CONFLICT GUARD updated_at
258
+ LOOKUP invoice_id BY id
259
+ ARG invoice_id STRING REQUIRED MAX 128
260
+ ARG reason TEXT REQUIRED MAX 500
261
+ ALLOW READ id, tenant_id, status, late_fee_cents, waiver_reason, updated_at
262
+ REQUIRE EVIDENCE
263
+ MAX ROWS 1
264
+ PROPOSE ACTION waive_late_fee
265
+ ALLOW WRITE late_fee_cents, waiver_reason
266
+ PATCH late_fee_cents = 0
267
+ PATCH waiver_reason = ARG reason
268
+ APPROVAL ROLE billing_lead
269
+ WRITEBACK DIRECT SQL
270
+ END
271
+ ```
272
+
273
+ Compile, validate, and serve it:
274
+
275
+ ```bash
276
+ synapsor-runner dsl compile ./contract.synapsor --out ./synapsor.contract.json
277
+ synapsor-runner contract validate ./synapsor.contract.json
278
+ synapsor-runner contract bundle ./synapsor.contract.json --out ./synapsor-runner-bundle
279
+ synapsor-runner cloud push ./synapsor.contract.json --dry-run
280
+ synapsor-runner mcp serve --config ./synapsor.runner.json --store ./.synapsor/local.db
281
+ ```
282
+
283
+ Your `synapsor.runner.json` supplies local wiring: database env var names,
284
+ SQLite store path, MCP transport settings, and local debug options. The
285
+ contract supplies the portable meaning: contexts, capabilities, evidence,
286
+ proposal shape, and writeback intent.
287
+
206
288
  ## Who Does What
207
289
 
208
290
  You write the config: sources, trusted context, capabilities, visible fields,
@@ -1110,6 +1192,14 @@ The runner is useful by itself for local/staging safety. Synapsor Cloud is for
1110
1192
  teams, production governance, central audit, managed runners, enterprise
1111
1193
  controls, and proprietary Synapsor platform features.
1112
1194
 
1195
+ Portable contracts can be checked locally before Cloud import:
1196
+
1197
+ ```bash
1198
+ synapsor-runner contract validate ./synapsor.contract.json
1199
+ synapsor-runner contract bundle ./synapsor.contract.json --out ./synapsor-runner-bundle
1200
+ synapsor-runner cloud push ./synapsor.contract.json --dry-run
1201
+ ```
1202
+
1113
1203
  ## Current Limitations
1114
1204
 
1115
1205
  Supported in the current alpha:
@@ -1137,13 +1227,17 @@ Not supported:
1137
1227
  - stored procedures;
1138
1228
  - physical branching of external Postgres/MySQL;
1139
1229
  - full Synapsor workflow DAG execution;
1140
- - `CREATE AGENT WORKFLOW`;
1141
1230
  - Synapsor SQL generation;
1142
1231
  - auto-merge or settlement-policy semantics;
1143
1232
  - model-callable approval or commit tools;
1144
1233
  - general prompt-injection prevention;
1145
1234
  - production SLA or compliance certification.
1146
1235
 
1236
+ Contract and DSL authoring can declare workflows and allowed capabilities with
1237
+ `CREATE AGENT WORKFLOW`. Runner 0.1 validates, bundles, and surfaces those
1238
+ contracts, but it does not execute full Synapsor Cloud workflow DAGs,
1239
+ auto-merge, settlement policies, or native branching.
1240
+
1147
1241
  Complete limits: [docs/limitations.md](docs/limitations.md).
1148
1242
 
1149
1243
  Security boundary: [docs/security-boundary.md](docs/security-boundary.md).
@@ -1227,6 +1321,8 @@ After a manual stable publish/promotion, verify `latest`:
1227
1321
  ## Repository Map
1228
1322
 
1229
1323
  - `apps/runner`: CLI entrypoint and local UI.
1324
+ - `packages/spec`: canonical portable contract schemas, normalization, CLI, and conformance fixtures.
1325
+ - `packages/dsl`: SQL-like contract authoring for contexts, capabilities, and workflow declarations.
1230
1326
  - `packages/mcp-server`: stdio/HTTP MCP server and configured tool runtime.
1231
1327
  - `packages/schema-inspector`: Postgres/MySQL metadata inspection and config generation.
1232
1328
  - `packages/proposal-store`: local SQLite evidence/proposal/replay store.
@@ -1,8 +1,107 @@
1
1
  # Capability Authoring
2
2
 
3
- Use `synapsor.runner.json` to define the database actions an MCP client can see.
4
- The model sees semantic capabilities such as `billing.inspect_invoice`, not raw
5
- SQL, table names, write credentials, approval tools, or commit tools.
3
+ For new work, author portable contracts first. The contract is the reviewable
4
+ source of truth for trusted context, resources, capabilities, evidence,
5
+ proposal shape, and writeback intent.
6
+
7
+ ```text
8
+ contract.synapsor -> synapsor.contract.json -> synapsor.runner.json
9
+ ```
10
+
11
+ Use `synapsor.runner.json` for local wiring: database env var names, SQLite
12
+ store path, MCP transport settings, and local development flags. The model sees
13
+ semantic capabilities such as `billing.inspect_invoice`, not raw SQL, table
14
+ names, write credentials, approval tools, or commit tools.
15
+
16
+ ## Contract/DSL Path
17
+
18
+ Write a small DSL contract:
19
+
20
+ ```sql
21
+ CREATE AGENT CONTEXT local_operator
22
+ BIND tenant_id FROM ENVIRONMENT SYNAPSOR_TENANT_ID REQUIRED
23
+ BIND principal FROM ENVIRONMENT SYNAPSOR_PRINCIPAL REQUIRED
24
+ TENANT BINDING tenant_id
25
+ PRINCIPAL BINDING principal
26
+ END
27
+
28
+ CREATE CAPABILITY billing.inspect_invoice
29
+ USING CONTEXT local_operator
30
+ SOURCE local_postgres
31
+ ON public.invoices
32
+ PRIMARY KEY id
33
+ TENANT KEY tenant_id
34
+ CONFLICT GUARD updated_at
35
+ LOOKUP invoice_id BY id
36
+ ARG invoice_id STRING REQUIRED MAX 128
37
+ ALLOW READ id, tenant_id, status, late_fee_cents, updated_at
38
+ REQUIRE EVIDENCE
39
+ MAX ROWS 1
40
+ END
41
+
42
+ CREATE CAPABILITY billing.propose_late_fee_waiver
43
+ USING CONTEXT local_operator
44
+ SOURCE local_postgres
45
+ ON public.invoices
46
+ PRIMARY KEY id
47
+ TENANT KEY tenant_id
48
+ CONFLICT GUARD updated_at
49
+ LOOKUP invoice_id BY id
50
+ ARG invoice_id STRING REQUIRED MAX 128
51
+ ARG reason TEXT REQUIRED MAX 500
52
+ ALLOW READ id, tenant_id, status, late_fee_cents, waiver_reason, updated_at
53
+ REQUIRE EVIDENCE
54
+ MAX ROWS 1
55
+ PROPOSE ACTION waive_late_fee
56
+ ALLOW WRITE late_fee_cents, waiver_reason
57
+ PATCH late_fee_cents = 0
58
+ PATCH waiver_reason = ARG reason
59
+ APPROVAL ROLE billing_lead
60
+ WRITEBACK DIRECT SQL
61
+ END
62
+ ```
63
+
64
+ Compile and validate:
65
+
66
+ ```bash
67
+ synapsor-runner dsl compile ./contract.synapsor --out ./synapsor.contract.json
68
+ synapsor-runner contract validate ./synapsor.contract.json
69
+ synapsor-runner contract bundle ./synapsor.contract.json --out ./synapsor-runner-bundle
70
+ synapsor-runner cloud push ./synapsor.contract.json --dry-run
71
+ ```
72
+
73
+ Reference the generated contract from local runner wiring:
74
+
75
+ ```json
76
+ {
77
+ "version": 1,
78
+ "mode": "review",
79
+ "contracts": ["./synapsor.contract.json"],
80
+ "storage": { "sqlite_path": "./.synapsor/local.db" },
81
+ "sources": {
82
+ "app_postgres": {
83
+ "engine": "postgres",
84
+ "read_url_env": "DATABASE_URL",
85
+ "write_url_env": "SYNAPSOR_DATABASE_WRITE_URL"
86
+ }
87
+ }
88
+ }
89
+ ```
90
+
91
+ Then preview or serve the MCP tools:
92
+
93
+ ```bash
94
+ synapsor-runner tools preview --config ./synapsor.runner.json --store ./.synapsor/local.db
95
+ synapsor-runner mcp serve --config ./synapsor.runner.json --store ./.synapsor/local.db
96
+ ```
97
+
98
+ ## Direct Runner Config Path
99
+
100
+ Directly embedding capabilities in `synapsor.runner.json` remains supported for
101
+ local experiments, generated configs, migration, and compatibility with earlier
102
+ Runner versions. Prefer contracts when you want definitions that can be
103
+ validated, bundled, reviewed in Git, dry-run pushed to Cloud, or shared with
104
+ Cloud/C++ import/export fixtures.
6
105
 
7
106
  For editor validation, use the JSON Schema:
8
107
 
@@ -10,7 +109,7 @@ For editor validation, use the JSON Schema:
10
109
  schemas/synapsor.runner.schema.json
11
110
  ```
12
111
 
13
- ## Minimal Shape
112
+ ## Minimal Runner Config Shape
14
113
 
15
114
  ```json
16
115
  {
@@ -10,6 +10,24 @@ npx -y -p @synapsor/runner synapsor-runner demo --quick
10
10
  The OSS runner command is `synapsor-runner`. The `synapsor` command is reserved
11
11
  for the Synapsor Cloud CLI.
12
12
 
13
+ ## 0.1.5
14
+
15
+ ### Contract Authoring Front Door
16
+
17
+ - Introduces `@synapsor/spec` and `@synapsor/dsl` in the main Runner README so
18
+ developers can find the canonical contract and SQL-like authoring layers from
19
+ the repo and npm package front door.
20
+ - Adds a copy-pasteable `CREATE AGENT CONTEXT` / `CREATE CAPABILITY` authoring
21
+ flow that compiles to `synapsor.contract.json`, validates, bundles, dry-run
22
+ pushes to Cloud, and serves through Runner local wiring.
23
+ - Refreshes capability authoring docs to lead with the contract/DSL path while
24
+ preserving direct `synapsor.runner.json` embedded capability authoring for
25
+ local experiments and compatibility.
26
+ - Clarifies that workflow declarations are supported in contracts/DSL, while
27
+ Runner 0.1 does not execute full Synapsor Cloud workflow DAGs, auto-merge,
28
+ settlement policies, or native branching.
29
+ - Updates the repository map to include `packages/spec` and `packages/dsl`.
30
+
13
31
  ## 0.1.4
14
32
 
15
33
  ### Public Repository Metadata
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synapsor/runner",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Stop giving AI agents execute_sql; expose reviewed Postgres/MySQL MCP actions with proposals, approval, writeback, and replay.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",