@synapsor/runner 1.6.0 → 1.6.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 (55) hide show
  1. package/CHANGELOG.md +32 -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 +1624 -42
  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 +30 -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/examples/app-owned-writeback/command-handler.mjs +0 -0
  24. package/examples/mcp-postgres-billing-app-handler/scripts/run-demo.sh +0 -0
  25. package/examples/reference-support-billing-app/scripts/run-demo.sh +0 -0
  26. package/examples/support-billing-agent/scripts/run-demo.sh +0 -0
  27. package/examples/support-billing-agent/scripts/run-evaluation.sh +0 -0
  28. package/fixtures/compatibility/published-1.6.0/manifest.json +76 -0
  29. package/fixtures/compatibility/published-1.6.0/sources/packages/dsl/examples/aggregate-read.synapsor.sql +21 -0
  30. package/fixtures/compatibility/published-1.6.0/sources/packages/dsl/examples/billing-late-fee.synapsor.sql +56 -0
  31. package/fixtures/compatibility/published-1.6.0/sources/packages/dsl/examples/bounded-set-multi-term.synapsor.sql +30 -0
  32. package/fixtures/compatibility/published-1.6.0/sources/packages/dsl/examples/principal-row-scope.synapsor.sql +23 -0
  33. package/fixtures/compatibility/published-1.6.0/sources/packages/spec/fixtures/conformance/aggregate-read/contract.json +119 -0
  34. package/fixtures/compatibility/published-1.6.0/sources/packages/spec/fixtures/conformance/approval-quorum/contract.json +44 -0
  35. package/fixtures/compatibility/published-1.6.0/sources/packages/spec/fixtures/conformance/bounded-set-threats/contract.json +115 -0
  36. package/fixtures/compatibility/published-1.6.0/sources/packages/spec/fixtures/conformance/principal-row-scope/contract.json +78 -0
  37. package/fixtures/compatibility/published-1.6.0/sources/packages/spec/fixtures/conformance/proposal-capability/contract.json +101 -0
  38. package/fixtures/compatibility/published-1.6.0/sources/packages/spec/fixtures/conformance/reversible-change-sets/contract.json +98 -0
  39. package/fixtures/compatibility/published-1.6.0/sources/packages/spec/fixtures/valid/basic-read.contract.json +60 -0
  40. package/fixtures/protocol/MANIFEST.json +37 -7
  41. package/fixtures/protocol/change-set.freshness-update.v2.json +58 -0
  42. package/fixtures/protocol/freshness-authority.invoice.v1.json +35 -0
  43. package/fixtures/protocol/freshness-proof.fresh.v1.json +38 -0
  44. package/fixtures/protocol/writeback-job.freshness-update.v2.json +50 -0
  45. package/llms.txt +1 -0
  46. package/package.json +9 -8
  47. package/schemas/change-set.v1.schema.json +1 -0
  48. package/schemas/change-set.v2.schema.json +1 -0
  49. package/schemas/change-set.v3.schema.json +1 -0
  50. package/schemas/freshness-authority.v1.schema.json +89 -0
  51. package/schemas/freshness-proof.v1.schema.json +73 -0
  52. package/schemas/synapsor.runner.schema.json +32 -0
  53. package/schemas/writeback-job.v1.schema.json +1 -0
  54. package/schemas/writeback-job.v2.schema.json +1 -0
  55. package/schemas/writeback-job.v3.schema.json +1 -0
package/CHANGELOG.md CHANGED
@@ -1,6 +1,35 @@
1
1
  # Changelog
2
2
 
3
- ## 1.6.0 (prepared, not published)
3
+ ## 1.6.1 (prepared, not published)
4
+
5
+ ### Fail-closed proposal and evidence freshness
6
+
7
+ - Adds optional reviewed `proposal_freshness` Runner configuration for live
8
+ target and explicitly declared same-source supporting-row checks immediately
9
+ before every local approval.
10
+ - Binds every successful human, quorum, or policy approval to a distinct
11
+ immutable short-lived proof covering the exact proposal hash/version and
12
+ deterministic dependency-set digest. Stale or unavailable checks record no
13
+ approval; stale proposals are replaced rather than silently refreshed.
14
+ - Extends PostgreSQL/MySQL direct SQL apply to lock supporting rows in
15
+ deterministic order and compare their exact versions inside the existing
16
+ mutation transaction. Post-approval drift returns a clear conflict with zero
17
+ mutation, including bounded-set rollback.
18
+ - Adds no-ID `proposals check-freshness latest` text/JSON inspection, Workbench
19
+ status and approval gating, lifecycle/replay/proof linkage, bounded
20
+ compliance metadata, counters, structured logs, and rollback-only writer
21
+ lock diagnostics.
22
+ - Keeps Cloud source-blind: Cloud may govern proposal/approval authority, while
23
+ the local Runner performs final source revalidation. Strict freshness is
24
+ rejected for app-owned and cross-source effects whose checks cannot be
25
+ transactionally atomic.
26
+ - Preserves existing contract normalization/digests, DSL, tools lists,
27
+ approval paths, receipts, and deployments when the optional overlay is
28
+ absent. `@synapsor/spec` and `@synapsor/dsl` remain at 1.5.0.
29
+ - Prepares only `@synapsor/runner@1.6.1`. Nothing is published, tagged, pushed,
30
+ or released by this change.
31
+
32
+ ## 1.6.0 (published 2026-07-23)
4
33
 
5
34
  ### Connect, Explore, Protect
6
35
 
@@ -34,9 +63,8 @@
34
63
  established CLI selectors and automation, active tools, TypeScript authoring,
35
64
  manual/headless operation, guarded writes, Data PRs, app-owned executors, and
36
65
  deployments without generation locks through packed compatibility fixtures.
37
- - Prepares `@synapsor/runner@1.6.0`, `@synapsor/dsl@1.5.0`, and
38
- `@synapsor/spec@1.5.0`. Nothing is published, tagged, pushed, or released by
39
- this change.
66
+ - Published `@synapsor/runner@1.6.0`, `@synapsor/dsl@1.5.0`, and
67
+ `@synapsor/spec@1.5.0`.
40
68
 
41
69
  ## 1.5.4 (published 2026-07-22)
42
70
 
package/README.md CHANGED
@@ -169,9 +169,22 @@ stale proposal conflicts. Inspect the latest lifecycle without copying an ID:
169
169
  synapsor-runner lifecycle --details --store ./.synapsor/local.db
170
170
  ```
171
171
 
172
+ For proposals whose review depends on other source rows, Runner 1.6.1 can also
173
+ require a live target/supporting-evidence check immediately before every local
174
+ approval. Apply rechecks those declared same-database dependencies again inside
175
+ the write transaction; stale evidence produces zero mutation and requires a new
176
+ proposal:
177
+
178
+ ```bash
179
+ synapsor-runner proposals check-freshness latest \
180
+ --config ./synapsor.runner.json \
181
+ --store ./.synapsor/local.db
182
+ ```
183
+
172
184
  See the [own-database guide](docs/getting-started-own-database.md),
173
185
  [Cursor plugin guide](docs/cursor-plugin.md), and
174
- [store lifecycle guide](docs/store-lifecycle.md) for the complete paths.
186
+ [proposal freshness](docs/proposal-evidence-freshness.md) and
187
+ [store lifecycle](docs/store-lifecycle.md) guides for the complete paths.
175
188
 
176
189
  ## Safety Model
177
190
 
@@ -214,7 +227,8 @@ trust boundaries, covered threats, non-goals, and required operator controls.
214
227
  scope, kept-out fields, proposals, approval, receipts, and replay. Resource
215
228
  handles re-check tenant/principal rather than acting as bearer authority. Live
216
229
  gates cover principal denial, no pre-approval mutation, idempotency, conflict,
217
- bounded sets, and compensation on disposable databases.
230
+ bounded sets, compensation, and proposal/evidence freshness on disposable
231
+ databases.
218
232
 
219
233
  Runner is a narrow agent/database safety boundary, not a replacement for
220
234
  least-privilege database access, host security, or application authorization.
package/dist/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAYA,OAAO,EAA2a,KAAK,WAAW,EAAyJ,MAAM,6BAA6B,CAAC;AAI/nB,OAAO,EAsBL,KAAK,qBAAqB,EAK3B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAmI,KAAK,kBAAkB,EAAE,KAAK,kBAAkB,EAAE,KAAK,kBAAkB,EAAqG,KAAK,YAAY,EAAwB,MAAM,2BAA2B,CAAC;AAEnY,OAAO,EAQL,KAAK,gBAAgB,EAEtB,MAAM,mCAAmC,CAA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EAAE,YAAY,EACjB,UAAU,EAAE,MAAM,EAClB,SAAS,CAAC,EAAE,MAAM,EAClB,OAAO,GAAE;IAAE,aAAa,CAAC,EAAE,OAAO,CAAA;CAAO,GACxC,OAAO,CAAC,IAAI,CAAC,CA0Hf;AAsvDD,wBAAgB,8BAA8B,CAAC,WAAW,EAAE,yBAAyB,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,CAKxH;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,qBAAqB,EAC7B,WAAW,EAAE,yBAAyB,EACtC,OAAO,EAAE,SAAS,GAAG,UAAU,GAAG,QAAQ,EAC1C,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,kBAAkB,GAAG,kBAAkB,GAAG,kBAAkB,CAgH9D"}
@@ -1,5 +1,6 @@
1
1
  import { type Server } from "node:http";
2
- import { ProposalStore } from "@synapsor-runner/proposal-store";
2
+ import { type ProposalFreshnessEvaluation } from "@synapsor-runner/mcp-server";
3
+ import { ProposalStore, type StoredProposal } from "@synapsor-runner/proposal-store";
3
4
  type JsonRecord = Record<string, unknown>;
4
5
  export type LocalUiOptions = {
5
6
  configPath?: string;
@@ -14,6 +15,7 @@ export type LocalUiOptions = {
14
15
  projectRoot?: string;
15
16
  storeAccess?: LocalUiStoreAccess;
16
17
  safeActionPreview?: SafeActionPreview;
18
+ freshnessEvaluator?: ProposalFreshnessEvaluator;
17
19
  };
18
20
  export type SafeActionPreview = (input: {
19
21
  projectRoot: string;
@@ -26,6 +28,7 @@ export type SafeActionPreview = (input: {
26
28
  proposal_hash: string;
27
29
  source_database_changed: boolean;
28
30
  }>;
31
+ export type ProposalFreshnessEvaluator = (proposal: StoredProposal) => Promise<ProposalFreshnessEvaluation>;
29
32
  export type LocalUiStoreAccess = <T>(mode: "read" | "write", operation: string, callback: (store: ProposalStore) => T) => Promise<T>;
30
33
  export type LocalUiServer = {
31
34
  server: Server;
@@ -1 +1 @@
1
- {"version":3,"file":"local-ui.d.ts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