@synapsor/runner 1.6.0 → 1.6.2

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 (50) hide show
  1. package/CHANGELOG.md +52 -4
  2. package/README.md +16 -2
  3. package/dist/cli.d.ts.map +1 -1
  4. package/dist/local-ui.d.ts +4 -1
  5. package/dist/local-ui.d.ts.map +1 -1
  6. package/dist/runner.mjs +1627 -43
  7. package/dist/runtime.mjs +1011 -25
  8. package/dist/shadow.mjs +408 -15
  9. package/docs/app-owned-executors.md +8 -0
  10. package/docs/capability-authoring.md +45 -0
  11. package/docs/current-scope.md +5 -0
  12. package/docs/cursor-plugin.md +2 -2
  13. package/docs/limitations.md +15 -2
  14. package/docs/local-mode.md +22 -3
  15. package/docs/production.md +19 -0
  16. package/docs/proposal-evidence-freshness.md +334 -0
  17. package/docs/release-notes.md +49 -4
  18. package/docs/runner-config-reference.md +46 -0
  19. package/docs/security-boundary.md +17 -0
  20. package/docs/store-lifecycle.md +8 -0
  21. package/docs/troubleshooting-first-run.md +76 -0
  22. package/docs/writeback-executors.md +8 -0
  23. package/fixtures/compatibility/published-1.6.0/manifest.json +76 -0
  24. package/fixtures/compatibility/published-1.6.0/sources/packages/dsl/examples/aggregate-read.synapsor.sql +21 -0
  25. package/fixtures/compatibility/published-1.6.0/sources/packages/dsl/examples/billing-late-fee.synapsor.sql +56 -0
  26. package/fixtures/compatibility/published-1.6.0/sources/packages/dsl/examples/bounded-set-multi-term.synapsor.sql +30 -0
  27. package/fixtures/compatibility/published-1.6.0/sources/packages/dsl/examples/principal-row-scope.synapsor.sql +23 -0
  28. package/fixtures/compatibility/published-1.6.0/sources/packages/spec/fixtures/conformance/aggregate-read/contract.json +119 -0
  29. package/fixtures/compatibility/published-1.6.0/sources/packages/spec/fixtures/conformance/approval-quorum/contract.json +44 -0
  30. package/fixtures/compatibility/published-1.6.0/sources/packages/spec/fixtures/conformance/bounded-set-threats/contract.json +115 -0
  31. package/fixtures/compatibility/published-1.6.0/sources/packages/spec/fixtures/conformance/principal-row-scope/contract.json +78 -0
  32. package/fixtures/compatibility/published-1.6.0/sources/packages/spec/fixtures/conformance/proposal-capability/contract.json +101 -0
  33. package/fixtures/compatibility/published-1.6.0/sources/packages/spec/fixtures/conformance/reversible-change-sets/contract.json +98 -0
  34. package/fixtures/compatibility/published-1.6.0/sources/packages/spec/fixtures/valid/basic-read.contract.json +60 -0
  35. package/fixtures/protocol/MANIFEST.json +37 -7
  36. package/fixtures/protocol/change-set.freshness-update.v2.json +58 -0
  37. package/fixtures/protocol/freshness-authority.invoice.v1.json +35 -0
  38. package/fixtures/protocol/freshness-proof.fresh.v1.json +38 -0
  39. package/fixtures/protocol/writeback-job.freshness-update.v2.json +50 -0
  40. package/llms.txt +1 -0
  41. package/package.json +4 -3
  42. package/schemas/change-set.v1.schema.json +1 -0
  43. package/schemas/change-set.v2.schema.json +1 -0
  44. package/schemas/change-set.v3.schema.json +1 -0
  45. package/schemas/freshness-authority.v1.schema.json +89 -0
  46. package/schemas/freshness-proof.v1.schema.json +73 -0
  47. package/schemas/synapsor.runner.schema.json +32 -0
  48. package/schemas/writeback-job.v1.schema.json +1 -0
  49. package/schemas/writeback-job.v2.schema.json +1 -0
  50. package/schemas/writeback-job.v3.schema.json +1 -0
@@ -0,0 +1,38 @@
1
+ {
2
+ "schema_version": "synapsor.freshness-proof.v1",
3
+ "proposal_id": "wrp_update_2001",
4
+ "proposal_hash": "sha256:update-proposal",
5
+ "proposal_version": 1,
6
+ "dependency_set_digest": "sha256:720d1300cc30f5732c864f41ef79767268095483b0bac93d871b19299886141b",
7
+ "checked_at": "2026-07-23T18:00:00.000Z",
8
+ "valid_until": "2026-07-23T18:00:30.000Z",
9
+ "source_adapters": [
10
+ {
11
+ "source_id": "src_billing_demo",
12
+ "engine": "postgres"
13
+ }
14
+ ],
15
+ "result": "fresh",
16
+ "safe_code": "FRESHNESS_FRESH",
17
+ "target_count": 1,
18
+ "supporting_count": 1,
19
+ "checks": [
20
+ {
21
+ "id": "target",
22
+ "kind": "target",
23
+ "status": "fresh",
24
+ "safe_code": "FRESHNESS_TARGET_FRESH",
25
+ "expected_version_digest": "sha256:cf6cbc0a5d9b4fe7d9d3fd832e5e1b05b73fa6eefdc496fd95d7268ab1d9268c",
26
+ "observed_version_digest": "sha256:cf6cbc0a5d9b4fe7d9d3fd832e5e1b05b73fa6eefdc496fd95d7268ab1d9268c"
27
+ },
28
+ {
29
+ "id": "invoice_eligibility",
30
+ "kind": "supporting",
31
+ "status": "fresh",
32
+ "safe_code": "FRESHNESS_DEPENDENCY_FRESH",
33
+ "expected_version_digest": "sha256:cf6cbc0a5d9b4fe7d9d3fd832e5e1b05b73fa6eefdc496fd95d7268ab1d9268c",
34
+ "observed_version_digest": "sha256:cf6cbc0a5d9b4fe7d9d3fd832e5e1b05b73fa6eefdc496fd95d7268ab1d9268c"
35
+ }
36
+ ],
37
+ "proof_digest": "sha256:0030e42a6f494acdfd65fb4042c917444f2c6df621fcae5021b3d7d15fdc1877"
38
+ }
@@ -0,0 +1,50 @@
1
+ {
2
+ "schema_version": "synapsor.writeback-job.v2",
3
+ "writeback_job_id": "wbj_update_2001",
4
+ "proposal_id": "wrp_update_2001",
5
+ "proposal_version": 1,
6
+ "proposal_hash": "sha256:update-proposal",
7
+ "runner_scope": { "project_id": "project_demo", "source_id": "src_billing_demo" },
8
+ "engine": "postgres",
9
+ "target": {
10
+ "schema": "public",
11
+ "table": "account_credits",
12
+ "primary_key": { "column": "id", "value": "credit_2001" }
13
+ },
14
+ "tenant_guard": { "column": "tenant_id", "value": "tenant_demo" },
15
+ "allowed_columns": ["amount_cents"],
16
+ "mutation": {
17
+ "kind": "single_row_update",
18
+ "values": { "amount_cents": 2500 },
19
+ "conflict_guard": { "kind": "column", "column": "version", "expected_value": 7 },
20
+ "version_advance": { "column": "version", "strategy": "integer_increment" }
21
+ },
22
+ "freshness": {
23
+ "schema_version": "synapsor.freshness-authority.v1",
24
+ "required": true,
25
+ "target": { "mode": "exact_guard", "member_count": 1 },
26
+ "dependencies": [
27
+ {
28
+ "id": "invoice_eligibility",
29
+ "capability": "billing.inspect_invoice",
30
+ "source_id": "src_billing_demo",
31
+ "engine": "postgres",
32
+ "target": {
33
+ "schema": "public",
34
+ "table": "invoices",
35
+ "primary_key": { "column": "invoice_id", "value": "INV-3001" },
36
+ "tenant_column": "tenant_id"
37
+ },
38
+ "expected_version": { "column": "version", "value": 7 },
39
+ "evidence": {
40
+ "bundle_id": "ev_invoice_3001",
41
+ "query_fingerprint": "sha256:invoice-evidence"
42
+ },
43
+ "descriptor_digest": "sha256:c7f183d5697eff084d30ead6602383f6a0033c13080a859d2eb514d71ec4e9bf"
44
+ }
45
+ ],
46
+ "dependency_set_digest": "sha256:720d1300cc30f5732c864f41ef79767268095483b0bac93d871b19299886141b"
47
+ },
48
+ "idempotency_key": "idem_update_2001",
49
+ "lease": { "lease_id": "lease_update_2001", "attempt": 1, "expires_at": "2026-07-23T19:00:00Z" }
50
+ }
package/llms.txt CHANGED
@@ -10,6 +10,7 @@ Start here:
10
10
  - Auto Boundary, Scoped Explore, and Protect: https://github.com/Synapsor/Synapsor-Runner/blob/main/docs/auto-boundary-and-scoped-explore.md
11
11
  - Connect a staging database: https://github.com/Synapsor/Synapsor-Runner/blob/main/docs/getting-started-own-database.md
12
12
  - Security boundary: https://github.com/Synapsor/Synapsor-Runner/blob/main/docs/security-boundary.md
13
+ - Proposal and evidence freshness: https://github.com/Synapsor/Synapsor-Runner/blob/main/docs/proposal-evidence-freshness.md
13
14
  - Current scope: https://github.com/Synapsor/Synapsor-Runner/blob/main/docs/current-scope.md
14
15
  - Current limitations: https://github.com/Synapsor/Synapsor-Runner/blob/main/docs/limitations.md
15
16
  - DSL reference: https://github.com/Synapsor/Synapsor-Runner/blob/main/docs/dsl-reference.md
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synapsor/runner",
3
- "version": "1.6.0",
3
+ "version": "1.6.2",
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",
@@ -85,6 +85,7 @@
85
85
  },
86
86
  "dependencies": {
87
87
  "@modelcontextprotocol/sdk": "1.29.0",
88
+ "@synapsor/spec": "^1.5.0",
88
89
  "jose": "6.2.3",
89
90
  "mysql2": "^3.11.0",
90
91
  "pdf-lib": "1.17.1",
@@ -93,8 +94,7 @@
93
94
  "vscode-languageserver": "9.0.1",
94
95
  "vscode-languageserver-textdocument": "1.0.12",
95
96
  "yaml": "2.8.3",
96
- "zod": "^3.25.0",
97
- "@synapsor/spec": "^1.5.0"
97
+ "zod": "^3.25.0"
98
98
  },
99
99
  "devDependencies": {
100
100
  "@types/pg": "^8.11.0",
@@ -114,6 +114,7 @@
114
114
  },
115
115
  "scripts": {
116
116
  "build": "tsc -b && node ../../scripts/build-runner-package.mjs",
117
+ "check:publish-manifest": "node ../../scripts/check-runner-publish-manifest.mjs --source",
117
118
  "test": "vitest run"
118
119
  }
119
120
  }
@@ -80,6 +80,7 @@
80
80
  "expected_version": { "$ref": "#/$defs/columnValue" }
81
81
  }
82
82
  },
83
+ "freshness": { "$ref": "https://schemas.synapsor.ai/synapsor.freshness-authority.v1.schema.json" },
83
84
  "evidence": {
84
85
  "type": "object",
85
86
  "additionalProperties": true,
@@ -92,6 +92,7 @@
92
92
  "deduplication": { "$ref": "#/$defs/deduplication" }
93
93
  }
94
94
  },
95
+ "freshness": { "$ref": "https://schemas.synapsor.ai/synapsor.freshness-authority.v1.schema.json" },
95
96
  "evidence": {
96
97
  "type": "object",
97
98
  "additionalProperties": true,
@@ -42,6 +42,7 @@
42
42
  "version_advance": { "$ref": "#/$defs/versionAdvance" }
43
43
  }
44
44
  },
45
+ "freshness": { "$ref": "https://schemas.synapsor.ai/synapsor.freshness-authority.v1.schema.json" },
45
46
  "frozen_set": { "$ref": "#/$defs/frozenSet" },
46
47
  "evidence": {
47
48
  "type": "object", "additionalProperties": true, "required": ["bundle_id", "query_fingerprint", "items"],
@@ -0,0 +1,89 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schemas.synapsor.ai/synapsor.freshness-authority.v1.schema.json",
4
+ "title": "Synapsor Freshness Authority v1",
5
+ "description": "Reviewed, immutable authority for target and supporting-row freshness checks. Digests are validated by the protocol runtime.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": ["schema_version", "required", "target", "dependencies", "dependency_set_digest"],
9
+ "properties": {
10
+ "schema_version": { "const": "synapsor.freshness-authority.v1" },
11
+ "required": { "const": true },
12
+ "target": {
13
+ "type": "object",
14
+ "additionalProperties": false,
15
+ "required": ["mode", "member_count"],
16
+ "properties": {
17
+ "mode": { "enum": ["exact_guard", "frozen_set", "not_applicable"] },
18
+ "member_count": { "type": "integer", "minimum": 0, "maximum": 100 }
19
+ }
20
+ },
21
+ "dependencies": {
22
+ "type": "array",
23
+ "maxItems": 16,
24
+ "items": { "$ref": "#/$defs/dependency" }
25
+ },
26
+ "dependency_set_digest": { "$ref": "#/$defs/sha256" }
27
+ },
28
+ "$defs": {
29
+ "safeIdentifier": { "type": "string", "pattern": "^[A-Za-z_][A-Za-z0-9_]*$" },
30
+ "capabilityName": {
31
+ "type": "string",
32
+ "pattern": "^[A-Za-z_][A-Za-z0-9_.-]*\\.[A-Za-z_][A-Za-z0-9_.-]*$"
33
+ },
34
+ "sha256": { "type": "string", "pattern": "^sha256:.+" },
35
+ "scalar": { "type": ["string", "number", "boolean", "null"] },
36
+ "columnValue": {
37
+ "type": "object",
38
+ "additionalProperties": false,
39
+ "required": ["column", "value"],
40
+ "properties": {
41
+ "column": { "$ref": "#/$defs/safeIdentifier" },
42
+ "value": { "$ref": "#/$defs/scalar" }
43
+ }
44
+ },
45
+ "dependency": {
46
+ "type": "object",
47
+ "additionalProperties": false,
48
+ "required": [
49
+ "id",
50
+ "capability",
51
+ "source_id",
52
+ "engine",
53
+ "target",
54
+ "expected_version",
55
+ "evidence",
56
+ "descriptor_digest"
57
+ ],
58
+ "properties": {
59
+ "id": { "$ref": "#/$defs/safeIdentifier" },
60
+ "capability": { "$ref": "#/$defs/capabilityName" },
61
+ "source_id": { "type": "string", "minLength": 1, "maxLength": 160 },
62
+ "engine": { "enum": ["postgres", "mysql"] },
63
+ "target": {
64
+ "type": "object",
65
+ "additionalProperties": false,
66
+ "required": ["schema", "table", "primary_key", "tenant_column"],
67
+ "properties": {
68
+ "schema": { "$ref": "#/$defs/safeIdentifier" },
69
+ "table": { "$ref": "#/$defs/safeIdentifier" },
70
+ "primary_key": { "$ref": "#/$defs/columnValue" },
71
+ "tenant_column": { "$ref": "#/$defs/safeIdentifier" },
72
+ "principal_column": { "$ref": "#/$defs/safeIdentifier" }
73
+ }
74
+ },
75
+ "expected_version": { "$ref": "#/$defs/columnValue" },
76
+ "evidence": {
77
+ "type": "object",
78
+ "additionalProperties": false,
79
+ "required": ["bundle_id", "query_fingerprint"],
80
+ "properties": {
81
+ "bundle_id": { "type": "string", "minLength": 1, "maxLength": 200 },
82
+ "query_fingerprint": { "$ref": "#/$defs/sha256" }
83
+ }
84
+ },
85
+ "descriptor_digest": { "$ref": "#/$defs/sha256" }
86
+ }
87
+ }
88
+ }
89
+ }
@@ -0,0 +1,73 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schemas.synapsor.ai/synapsor.freshness-proof.v1.schema.json",
4
+ "title": "Synapsor Freshness Proof v1",
5
+ "description": "Bounded immutable result of a live freshness preflight. Digest and cross-field integrity are validated by the protocol runtime.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": [
9
+ "schema_version",
10
+ "proposal_id",
11
+ "proposal_hash",
12
+ "proposal_version",
13
+ "dependency_set_digest",
14
+ "checked_at",
15
+ "valid_until",
16
+ "source_adapters",
17
+ "result",
18
+ "safe_code",
19
+ "target_count",
20
+ "supporting_count",
21
+ "checks",
22
+ "proof_digest"
23
+ ],
24
+ "properties": {
25
+ "schema_version": { "const": "synapsor.freshness-proof.v1" },
26
+ "proposal_id": { "type": "string", "minLength": 1 },
27
+ "proposal_hash": { "$ref": "#/$defs/sha256" },
28
+ "proposal_version": { "type": "integer", "minimum": 1 },
29
+ "dependency_set_digest": { "$ref": "#/$defs/sha256" },
30
+ "checked_at": { "type": "string", "format": "date-time" },
31
+ "valid_until": { "type": "string", "format": "date-time" },
32
+ "source_adapters": {
33
+ "type": "array",
34
+ "minItems": 1,
35
+ "maxItems": 8,
36
+ "items": {
37
+ "type": "object",
38
+ "additionalProperties": false,
39
+ "required": ["source_id", "engine"],
40
+ "properties": {
41
+ "source_id": { "type": "string", "minLength": 1, "maxLength": 160 },
42
+ "engine": { "enum": ["postgres", "mysql"] }
43
+ }
44
+ }
45
+ },
46
+ "result": { "enum": ["fresh", "stale", "unavailable", "invalid", "unsupported"] },
47
+ "safe_code": { "$ref": "#/$defs/safeCode" },
48
+ "target_count": { "type": "integer", "minimum": 0, "maximum": 100 },
49
+ "supporting_count": { "type": "integer", "minimum": 0, "maximum": 16 },
50
+ "checks": {
51
+ "type": "array",
52
+ "maxItems": 116,
53
+ "items": {
54
+ "type": "object",
55
+ "additionalProperties": false,
56
+ "required": ["id", "kind", "status", "safe_code"],
57
+ "properties": {
58
+ "id": { "type": "string", "minLength": 1, "maxLength": 160 },
59
+ "kind": { "enum": ["target", "supporting"] },
60
+ "status": { "enum": ["fresh", "stale", "not_applicable", "unavailable", "invalid", "unsupported"] },
61
+ "safe_code": { "$ref": "#/$defs/safeCode" },
62
+ "expected_version_digest": { "$ref": "#/$defs/sha256" },
63
+ "observed_version_digest": { "$ref": "#/$defs/sha256" }
64
+ }
65
+ }
66
+ },
67
+ "proof_digest": { "$ref": "#/$defs/sha256" }
68
+ },
69
+ "$defs": {
70
+ "sha256": { "type": "string", "pattern": "^sha256:.+" },
71
+ "safeCode": { "type": "string", "pattern": "^[A-Z][A-Z0-9_]*$" }
72
+ }
73
+ }
@@ -162,6 +162,38 @@
162
162
  "type": "array",
163
163
  "items": { "$ref": "#/$defs/policy" }
164
164
  },
165
+ "proposal_freshness": {
166
+ "description": "Optional fail-closed live freshness policy for reviewed proposal capabilities. The model cannot configure or widen these dependencies.",
167
+ "type": "object",
168
+ "propertyNames": { "$ref": "#/$defs/qualified_name" },
169
+ "additionalProperties": {
170
+ "type": "object",
171
+ "additionalProperties": false,
172
+ "required": ["approval"],
173
+ "properties": {
174
+ "approval": {
175
+ "description": "Require a live source freshness proof immediately before every approval decision.",
176
+ "const": "required"
177
+ },
178
+ "dependencies": {
179
+ "description": "Reviewed same-source single-row reads whose exact versions must still match at approval and apply.",
180
+ "type": "array",
181
+ "maxItems": 16,
182
+ "items": {
183
+ "type": "object",
184
+ "additionalProperties": false,
185
+ "required": ["id", "capability", "identity_from_arg", "version_column"],
186
+ "properties": {
187
+ "id": { "$ref": "#/$defs/identifier" },
188
+ "capability": { "$ref": "#/$defs/qualified_name" },
189
+ "identity_from_arg": { "$ref": "#/$defs/identifier" },
190
+ "version_column": { "$ref": "#/$defs/identifier" }
191
+ }
192
+ }
193
+ }
194
+ }
195
+ }
196
+ },
165
197
  "approvals": {
166
198
  "description": "Local approval behavior overrides.",
167
199
  "type": "object",
@@ -88,6 +88,7 @@
88
88
  }
89
89
  ]
90
90
  },
91
+ "freshness": { "$ref": "https://schemas.synapsor.ai/synapsor.freshness-authority.v1.schema.json" },
91
92
  "idempotency_key": { "type": "string", "minLength": 1 },
92
93
  "lease": {
93
94
  "type": "object",
@@ -118,6 +118,7 @@
118
118
  }
119
119
  ]
120
120
  },
121
+ "freshness": { "$ref": "https://schemas.synapsor.ai/synapsor.freshness-authority.v1.schema.json" },
121
122
  "idempotency_key": { "type": "string", "minLength": 1 },
122
123
  "lease": {
123
124
  "type": "object",
@@ -21,6 +21,7 @@
21
21
  "patch": { "$ref": "#/$defs/scalarRecord" },
22
22
  "version_advance": { "$ref": "#/$defs/versionAdvance" },
23
23
  "frozen_set": { "$ref": "#/$defs/frozenSet" },
24
+ "freshness": { "$ref": "https://schemas.synapsor.ai/synapsor.freshness-authority.v1.schema.json" },
24
25
  "idempotency_key": { "type": "string", "minLength": 1 },
25
26
  "lease": { "type": "object", "additionalProperties": false, "required": ["lease_id", "attempt", "expires_at"], "properties": { "lease_id": { "type": "string", "minLength": 1 }, "attempt": { "type": "integer", "minimum": 1 }, "expires_at": { "type": "string", "format": "date-time" } } }
26
27
  },