@synapsor/runner 1.4.1 → 1.4.121

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
@@ -1,5 +1,63 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.4.121 (prepared, not published)
4
+
5
+ ### Contract trust surface and bounded-set parser correctness
6
+
7
+ - Fixes BUG-018: `SELECT WHERE risk_level = 'high' AND case_status =
8
+ 'active'` now compiles into two ordered canonical equality terms instead of
9
+ silently folding the second term into the first string value.
10
+ - Uses a quote-aware, full-clause parser. `AND` inside a quoted literal remains
11
+ literal content, while malformed terms, trailing tokens, `OR`, parentheses,
12
+ and non-equality operators fail during DSL compilation with location-aware
13
+ errors.
14
+ - Preserves existing single-term contracts and literal types. The canonical
15
+ Spec bump in this release is limited to the additive enum and aggregate-read
16
+ fields described below.
17
+ - Adds standalone DSL and bundled Runner parity coverage plus PostgreSQL/MySQL
18
+ live proof under source-database and Runner-ledger receipt authority. The
19
+ proof excludes first-term-only, second-term-only, and wrong-tenant rows and
20
+ verifies exact receipt/replay membership.
21
+ - Adds a real stdio contract language server plus canonical `contract explain`
22
+ and deterministic text/JSON/SARIF lint for review before serving.
23
+ - Adds adopter-owned static/live contract tests with a public manifest schema,
24
+ generic operator-boundary checks, and disposable PostgreSQL/MySQL coverage.
25
+ - Adds tenant-scoped object/principal ledger reports in JSON, Markdown, and PDF
26
+ with redaction, canonical digests, optional operator signatures, and tamper
27
+ verification.
28
+ - Adds typed DSL enums and canonical fixed aggregate reads for COUNT/SUM/AVG.
29
+ Aggregate tools use trusted tenant scope, fixed equality selection, mandatory
30
+ minimum-group suppression, one scalar result, and evidence/query audit with
31
+ no member rows or IDs.
32
+ - Adds disabled-by-default graduated-trust recommendations. Evaluation uses
33
+ scoped human-reviewed outcomes, excludes auto-approval as independent
34
+ evidence, requires verified operator review, and exports a separate
35
+ digest-bound contract artifact without activating it.
36
+ - Proves additive Spec/DSL/Runner/C++ aggregate and enum parity, shared Postgres
37
+ recommendation durability, and transient PostgreSQL/MySQL timeout
38
+ classification.
39
+ - Stages `@synapsor/spec@1.4.1`, `@synapsor/dsl@1.4.2`, and
40
+ `@synapsor/runner@1.4.121`. Nothing is published by this change.
41
+
42
+ ## 1.4.12 (prepared, not published)
43
+
44
+ ### Runtime-store smoke-call consistency
45
+
46
+ - Fixes BUG-017: `smoke call` now lets the MCP runtime resolve storage from the
47
+ complete config instead of injecting a local SQLite `ProposalStore`.
48
+ - In `runtime_store` mode, proposal, evidence, query-audit, event, and replay
49
+ records land in the authoritative shared Postgres ledger and are visible to
50
+ other Runner processes and normal approve/apply commands.
51
+ - Shared-ledger failures return a redacted, retryable availability result with
52
+ a nonzero CLI status and never create a local fallback proposal.
53
+ - Keeps local SQLite and mirror modes unchanged. The source database still
54
+ remains untouched until external approval and guarded apply.
55
+ - Adds focused no-fallback coverage and a disposable two-process fleet proof
56
+ covering ownership, approval/apply, one source receipt, replay, and safe
57
+ ledger unavailability.
58
+ - Stages only `@synapsor/runner@1.4.12`; `@synapsor/dsl` remains `1.4.1` and
59
+ `@synapsor/spec` remains `1.4.0`. Nothing is published by this change.
60
+
3
61
  ## 1.4.1 (prepared, not published)
4
62
 
5
63
  ### Canonical Bounded-Set Digest Verification
package/README.md CHANGED
@@ -78,36 +78,25 @@ approval, apply, or revert tools. A human or trusted operator approves outside
78
78
  MCP, then Runner performs a guarded write or routes the proposal to an
79
79
  app-owned executor.
80
80
 
81
- The distinction is the complete boundary, not a read-only toggle or a generic
82
- approve/reject prompt:
83
-
84
- - reviewed contracts constrain tools, tenant context, visible and writable
85
- columns, numeric bounds, transitions, and approval requirements;
86
- - proposals separate model intent from commit authority, including aggregate
87
- auto-approval ceilings where configured;
88
- - evidence, query audit, idempotency receipts, and replay preserve what was
89
- inspected, requested, approved, and applied.
90
-
91
- Runner supports bounded deployments when its documented database, identity,
92
- ledger, backup, and operational controls are satisfied. It does not make raw
93
- SQL tools, host infrastructure, or prompt-injection-prone clients safe.
81
+ Contracts constrain tools, trusted context, visible and writable columns,
82
+ bounds, transitions, and approvals. Proposals separate model intent from commit
83
+ authority; evidence, query audit, receipts, and replay preserve the reviewed
84
+ lifecycle. Runner does not make raw SQL tools, hosts, or
85
+ prompt-injection-prone clients safe.
94
86
 
95
87
  ## Why Not Just Use A Prompt And App Code?
96
88
 
97
- Prompt instructions can guide behavior, but prompt-only enforcement is not an
98
- authorization boundary. First ask who produces the SQL:
89
+ Prompts are not an authorization boundary. First ask who produces the SQL:
99
90
 
100
- - **The model produces SQL:** your validator must safely understand arbitrary
101
- queries, scope, and side effects. That is `execute_sql` with an extra parser.
91
+ - **The model produces SQL:** validation must understand arbitrary queries,
92
+ scope, and side effects. That is `execute_sql` behind a parser.
102
93
  - **Trusted app code produces fixed, parameterized SQL:** good. You have built
103
94
  a semantic tool, and that may be enough for a small read-only application.
104
95
 
105
- Runner becomes useful when those tools also need one reviewed contract for
106
- trusted tenant scope, field controls, evidence, approval outside MCP, guarded
107
- and idempotent writeback, receipts, replay, and reviewed compensation. Use your
108
- own code when you do not need that lifecycle. Read the [full build-vs-adopt
109
- guide](docs/why-synapsor-vs-app-guardrails.md) for the decision table, public
110
- incident evidence, and regulated-data boundaries.
96
+ Runner adds one reviewed contract for trusted scope, field controls, evidence,
97
+ approval outside MCP, guarded writeback, receipts, replay, and compensation.
98
+ Use your own code when you do not need that lifecycle. See the [build-vs-adopt
99
+ guide](docs/why-synapsor-vs-app-guardrails.md).
111
100
 
112
101
  ## Connect A Staging Database
113
102
 
@@ -177,6 +166,23 @@ bounded inverse; `synapsor-runner revert <proposal_id>` creates a separately
177
166
  approved proposal. This is not rollback, time travel, or app-owned
178
167
  compensation.
179
168
 
169
+ ## Review And Prove Your Contract
170
+
171
+ Before serving a contract, use `contract explain` for a reviewer-readable
172
+ boundary, `contract lint --strict` for deterministic CI checks, and `contract
173
+ test` for adopter-owned allow/deny/redaction cases. The built-in language
174
+ server supplies diagnostics, completion, hover, and formatting for
175
+ `.synapsor.sql` and legacy `.synapsor` files. See [Contract
176
+ Review](docs/contract-review.md) and [Contract
177
+ Testing](docs/contract-testing.md).
178
+
179
+ Runner also supports reviewed [aggregate reads](docs/aggregate-reads.md),
180
+ tenant-scoped tamper-evident [ledger reports](docs/compliance-reports.md), and
181
+ opt-in [graduated-trust recommendations](docs/graduated-trust.md). Aggregate
182
+ tools return one scalar and no source rows. Graduated trust is disabled by
183
+ default, remains operator-only, and can export a reviewable artifact but never
184
+ activate it.
185
+
180
186
  ## Trust And Verification
181
187
 
182
188
  Start with the **[Threat Model](THREAT_MODEL.md)**. It defines protected assets,
@@ -185,6 +191,9 @@ trust boundaries, covered threats, non-goals, and required operator controls.
185
191
  - [Conformance fixtures](docs/conformance.md) prove trusted context, scoped
186
192
  reads, kept-out fields, proposal boundaries, approval, receipts, and replay
187
193
  behavior rather than only validating JSON shape.
194
+ - `contract test` lets adopters encode the same boundary checks for their own
195
+ synthetic fixtures; it never invokes an LLM and refuses remote live targets
196
+ by default.
188
197
  - MCP proposal, evidence, and replay handles are references rather than bearer
189
198
  authority: resource reads re-check the owning tenant and principal against
190
199
  the current trusted session.
@@ -204,26 +213,14 @@ See [Security Boundary](docs/security-boundary.md) and
204
213
 
205
214
  ## Operate The Approval Loop
206
215
 
207
- Reviewed policies combine per-proposal and daily ceilings; exceeding one routes
208
- the proposal to human review. Operators use `apply --all-approved --yes`,
209
- Prometheus metrics, structured logs, and optional signed reviewer/apply roles.
210
- Shared Postgres ledger mirror mode is available for bounded operator handoffs,
211
- and `storage.shared_postgres.mode = "runtime_store"` lets MCP serving use
212
- Postgres as the primary proposal/evidence/replay store with bounded CLI
213
- approval/apply/worker commands bridged through the same ledger. Local SQLite
214
- remains the default. See
215
- [Production](docs/production.md) and the
216
- [Runner Config Reference](docs/runner-config-reference.md).
217
-
218
- For a small multi-tenant fleet, bind every capability context to verified HTTP
219
- claims, use `jwt_asymmetric` session auth, and share a bounded Postgres
220
- `runtime_store`. Never assume a global `http_claims` setting overrides an
221
- environment-bound contract context; Runner rejects that contradiction before
222
- serving tools. Load balancers should use dependency-free `/healthz` for
223
- liveness and `/readyz` for source/ledger/writeback readiness. The tested
224
- two-Runner topology, pool/rate-limit budgets, metrics, backup/restore,
225
- dead-letter, and rolling-upgrade rules are in
226
- [Running A Small Runner Fleet](docs/running-a-runner-fleet.md).
216
+ Policies combine per-proposal and daily ceilings; exceeding one routes to human
217
+ review. Operators get batch apply, metrics, structured logs, and optional
218
+ signed roles. Local SQLite is the default; bounded fleets can use verified HTTP
219
+ claims, asymmetric JWT sessions, and a shared Postgres `runtime_store`.
220
+ `smoke call` follows that store and never falls back to SQLite. Use `/healthz`
221
+ for liveness and `/readyz` for dependency readiness. See
222
+ [Production](docs/production.md), [Runner Config](docs/runner-config-reference.md),
223
+ and [Small Runner Fleets](docs/running-a-runner-fleet.md).
227
224
 
228
225
  ## Packages
229
226
 
package/THREAT_MODEL.md CHANGED
@@ -50,6 +50,12 @@ idempotency boundary for effects.
50
50
  - Model asks for arbitrary SQL: no generic SQL tool is exposed in the Synapsor path.
51
51
  - Model supplies `tenant_id`, `principal`, source id, allowed columns, row version, or approval identity: runner rejects trusted-binding overrides.
52
52
  - Prompt injection in database content asks the model to bypass policy: the runner ignores text as authority and only accepts structured capability/job state.
53
+ - Aggregate inference through a one-record group: reviewed aggregate tools
54
+ require minimum-group suppression and never return member rows or IDs. This
55
+ reduces, but does not eliminate, statistical inference risk.
56
+ - Policy self-expansion from favorable automated outcomes: graduated trust is
57
+ off by default, excludes auto-approvals from human evidence, requires a
58
+ verified operator decision, and exports without activation.
53
59
  - Wrong tenant or object: reads and writes include trusted primary-key and tenant predicates.
54
60
  - Disallowed field update: patch columns must be allowlisted.
55
61
  - Stale row: conflict guard mismatch returns `conflict` instead of silently writing.
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,EAAoP,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