@synapsor/runner 1.4.123 → 1.5.3
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 +144 -19
- package/README.md +132 -135
- package/dist/authoring.d.ts +23 -0
- package/dist/authoring.d.ts.map +1 -0
- package/dist/authoring.mjs +1318 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +4 -5
- package/dist/local-ui.d.ts +14 -0
- package/dist/local-ui.d.ts.map +1 -1
- package/dist/runner.mjs +18427 -7084
- package/dist/runtime.d.ts +50 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.mjs +15094 -0
- package/dist/shadow.d.ts +36 -0
- package/dist/shadow.d.ts.map +1 -0
- package/dist/shadow.mjs +5262 -0
- package/docs/README.md +44 -5
- package/docs/alternatives.md +122 -0
- package/docs/capability-authoring.md +44 -1
- package/docs/client-recipes.md +218 -0
- package/docs/contract-testing.md +9 -7
- package/docs/cursor-plugin.md +78 -0
- package/docs/database-enforced-scope.md +273 -0
- package/docs/dependency-license-inventory.md +6 -2
- package/docs/doctor.md +17 -0
- package/docs/effect-regression.md +179 -0
- package/docs/fresh-developer-usability.md +110 -0
- package/docs/getting-started-own-database.md +103 -2
- package/docs/host-compatibility.md +59 -0
- package/docs/local-mode.md +12 -7
- package/docs/mcp-apps.md +188 -0
- package/docs/mcp-audit.md +220 -2
- package/docs/mcp-client-setup.md +20 -4
- package/docs/mcp-clients.md +41 -4
- package/docs/oss-vs-cloud.md +3 -0
- package/docs/production.md +8 -0
- package/docs/release-notes.md +138 -14
- package/docs/release-policy.md +9 -5
- package/docs/runner-config-reference.md +25 -0
- package/docs/schema-api-candidates.md +68 -0
- package/docs/security-boundary.md +30 -5
- package/docs/shadow-studies.md +241 -0
- package/docs/troubleshooting-first-run.md +46 -0
- package/examples/mcp-postgres-billing-app-handler/app-handler.mjs +9 -1
- package/examples/mcp-postgres-billing-app-handler/schema.sql +11 -0
- package/examples/mcp-postgres-billing-app-handler/synapsor-handler.mjs +3 -0
- package/examples/raw-sql-vs-synapsor/Makefile +2 -2
- package/examples/raw-sql-vs-synapsor/README.md +6 -4
- package/examples/support-billing-agent/Makefile +5 -1
- package/examples/support-billing-agent/README.md +57 -5
- package/examples/support-billing-agent/app/README.md +6 -0
- package/examples/support-billing-agent/app/contract.ts +28 -0
- package/examples/support-billing-agent/app/effect-adapter.mjs +23 -0
- package/examples/support-billing-agent/app/record-shadow-outcomes.mjs +44 -0
- package/examples/support-billing-agent/db/schema.sql +88 -1
- package/examples/support-billing-agent/db/seed.sql +15 -15
- package/examples/support-billing-agent/scripts/run-demo.sh +4 -0
- package/examples/support-billing-agent/scripts/run-evaluation.sh +63 -0
- package/examples/support-billing-agent/shadow-study/cases.jsonl +6 -0
- package/examples/support-billing-agent/shadow-study/outcomes.jsonl +2 -0
- package/examples/support-billing-agent/synapsor.runner.json +17 -5
- package/examples/support-plan-credit/README.md +48 -2
- package/examples/support-plan-credit/mcp-client-examples/README.md +23 -0
- package/examples/support-plan-credit/mcp-client-examples/claude-code.sh +34 -0
- package/examples/support-plan-credit/mcp-client-examples/codex.config.toml +24 -0
- package/examples/support-plan-credit/mcp-client-examples/generic-stdio.mjs +35 -0
- package/examples/support-plan-credit/mcp-client-examples/generic-streamable-http.mjs +31 -0
- package/examples/support-plan-credit/mcp-client-examples/google-adk.py +40 -0
- package/examples/support-plan-credit/mcp-client-examples/langchain.mjs +29 -0
- package/examples/support-plan-credit/mcp-client-examples/llamaindex.py +36 -0
- package/examples/support-plan-credit/mcp-client-examples/openai-agents-stdio.ts +1 -1
- package/examples/support-plan-credit/mcp-client-examples/openai-agents-streamable-http.ts +1 -1
- package/examples/support-plan-credit/mcp-client-examples/vscode.mcp.json +20 -0
- package/examples/support-plan-credit/synapsor/actions/support.propose_plan_credit.contract-tests.generated.json +221 -0
- package/examples/support-plan-credit/synapsor/actions/support.propose_plan_credit.ts +34 -0
- package/fixtures/effects/changed/eff_support_late_fee_v1.result.json +58 -0
- package/fixtures/effects/dataset.json +8 -0
- package/fixtures/effects/results/eff_support_late_fee_v1.result.json +59 -0
- package/fixtures/effects/support-late-fee.effect.json +71 -0
- package/fixtures/generators/drizzle/malicious.ts +11 -0
- package/fixtures/generators/drizzle/schema.ts +12 -0
- package/fixtures/generators/openapi/external-ref.yaml +15 -0
- package/fixtures/generators/openapi/openapi.yaml +81 -0
- package/fixtures/generators/prisma/schema.prisma +34 -0
- package/fixtures/mcp-audit/README.md +14 -0
- package/fixtures/mcp-audit/cursor-bypass-config.json +38 -0
- package/fixtures/mcp-audit/dangerous-tools-list.json +33 -0
- package/fixtures/mcp-audit/reviewed-proposal-tools-list.json +60 -0
- package/package.json +29 -3
- package/schemas/effect-dataset.schema.json +19 -0
- package/schemas/effect-fixture.schema.json +191 -0
- package/schemas/effect-result.schema.json +52 -0
- package/schemas/mcp-audit-candidates.schema.json +41 -0
- package/schemas/mcp-audit-report.schema.json +203 -0
- package/schemas/schema-candidate-review.schema.json +167 -0
- package/schemas/schema-candidates.schema.json +49 -0
- package/schemas/synapsor.contract-tests.schema.json +1 -1
- package/schemas/synapsor.runner.schema.json +51 -0
package/docs/README.md
CHANGED
|
@@ -23,14 +23,19 @@ no-database demo, wire your database, then read deeper concepts.
|
|
|
23
23
|
|
|
24
24
|
## 02 Why Raw SQL Is Dangerous
|
|
25
25
|
|
|
26
|
+
- [Choose The Smallest Safe Database Boundary](alternatives.md): compare raw
|
|
27
|
+
database MCP, direct read-only access, hand-built application tools, and
|
|
28
|
+
Synapsor Runner, including when each is sufficient and what remains outside
|
|
29
|
+
Runner's protection.
|
|
26
30
|
- [Security Boundary](security-boundary.md): what the model can and cannot see.
|
|
27
31
|
- [Why Synapsor Over Prompt And Application
|
|
28
32
|
Guardrails](why-synapsor-vs-app-guardrails.md): where SQL authority lives,
|
|
29
33
|
what a hand-built semantic tool already gets right, and when the shared
|
|
30
34
|
contract, approval, receipt, and replay layer is worth adopting.
|
|
31
|
-
- [MCP Audit](mcp-audit.md): static review for risky database MCP tools
|
|
32
|
-
`execute_sql`, broad query tools, model-controlled tenant filters, or
|
|
33
|
-
model-facing approval/commit tools
|
|
35
|
+
- [MCP Audit](mcp-audit.md): concise static review for risky database MCP tools
|
|
36
|
+
such as `execute_sql`, broad query tools, model-controlled tenant filters, or
|
|
37
|
+
model-facing approval/commit tools, plus explicit generation of disabled
|
|
38
|
+
canonical review candidates.
|
|
34
39
|
|
|
35
40
|
## 03 Run The Demo
|
|
36
41
|
|
|
@@ -43,12 +48,19 @@ no-database demo, wire your database, then read deeper concepts.
|
|
|
43
48
|
## 04 Connect Your DB
|
|
44
49
|
|
|
45
50
|
- [Connect Your Own Database](getting-started-own-database.md): inspect a
|
|
46
|
-
staging Postgres/MySQL database, generate
|
|
47
|
-
|
|
51
|
+
staging Postgres/MySQL database, generate canonical reviewed artifacts, open
|
|
52
|
+
the first-action workbench, add the tools to Cursor, and inspect the local
|
|
53
|
+
activation report.
|
|
48
54
|
- [Use Your Own Database](use-your-own-database.md): short entry point that
|
|
49
55
|
links to the canonical own-database guide.
|
|
56
|
+
- [Fresh-Developer Usability Protocol](fresh-developer-usability.md): the
|
|
57
|
+
repeatable five-person launch gate, timing rules, safety blockers, and honest
|
|
58
|
+
reporting template. External participant results are not yet claimed.
|
|
50
59
|
- [Doctor](doctor.md): redacted setup checks, handler probes, direct SQL
|
|
51
60
|
writeback probes, and receipt-table guidance.
|
|
61
|
+
- [Database-Enforced Scope](database-enforced-scope.md): application-level
|
|
62
|
+
scope, hardened PostgreSQL RLS, tenant-bound credentials/deployments, and
|
|
63
|
+
honest MySQL alternatives.
|
|
52
64
|
- [Guarded Single-Row CRUD Writeback](guarded-crud-writeback.md): native
|
|
53
65
|
INSERT/UPDATE/DELETE, receipt modes, crash semantics, privileges, and
|
|
54
66
|
reconciliation.
|
|
@@ -60,6 +72,18 @@ no-database demo, wire your database, then read deeper concepts.
|
|
|
60
72
|
|
|
61
73
|
## 05 Generate Capabilities
|
|
62
74
|
|
|
75
|
+
- [Connect Your Own
|
|
76
|
+
Database](getting-started-own-database.md#draft-another-safe-action-with-a-coding-agent):
|
|
77
|
+
describe one action, let a coding agent complete only the restricted
|
|
78
|
+
TypeScript draft, validate it deterministically, preview an exact staging
|
|
79
|
+
Data PR, and activate the reviewed digest outside MCP.
|
|
80
|
+
- [Cursor Plugin](cursor-plugin.md): project-scoped `/synapsor-protect`, Safe
|
|
81
|
+
Action diagnostics, package verification, and the explicit no-activation
|
|
82
|
+
boundary.
|
|
83
|
+
- [Reviewed Prisma, Drizzle, And OpenAPI
|
|
84
|
+
Candidates](schema-api-candidates.md): turn structural developer artifacts
|
|
85
|
+
into deterministic, disabled canonical review candidates without executing
|
|
86
|
+
adopter code or inferring authority.
|
|
63
87
|
- [Capability Authoring](capability-authoring.md): define read/proposal
|
|
64
88
|
capabilities, model-facing descriptions, result envelopes, trusted context,
|
|
65
89
|
and writeback guards.
|
|
@@ -74,15 +98,28 @@ no-database demo, wire your database, then read deeper concepts.
|
|
|
74
98
|
and deterministic lint/SARIF output.
|
|
75
99
|
- [Contract Testing](contract-testing.md): adopter-owned static and disposable
|
|
76
100
|
PostgreSQL/MySQL allow/deny/redaction assertions.
|
|
101
|
+
- [Agent Effect Regression](effect-regression.md): provider-neutral,
|
|
102
|
+
propose-only fixtures that catch changed capability calls, business diffs,
|
|
103
|
+
policy outcomes, tenant handling, and hidden-field behavior.
|
|
77
104
|
- [Bounded Aggregate Reads](aggregate-reads.md): fixed scalar count/sum/avg,
|
|
78
105
|
tenant scope, suppression, and no-row evidence.
|
|
79
106
|
|
|
80
107
|
## 06 Serve MCP
|
|
81
108
|
|
|
109
|
+
- [Host Compatibility](host-compatibility.md): exact Tested,
|
|
110
|
+
Protocol-tested, Unsupported, and Unknown claims for Cursor and other MCP
|
|
111
|
+
hosts, including the inline-review fallback.
|
|
112
|
+
- [Inline Proposal Review With MCP Apps](mcp-apps.md): display-only proposal
|
|
113
|
+
cards where supported, exact protocol versions, tested compatibility, and
|
|
114
|
+
secure standalone review fallback.
|
|
82
115
|
- [MCP Client Setup](mcp-client-setup.md): connect Claude, Cursor, VS Code, or
|
|
83
116
|
another stdio MCP client.
|
|
84
117
|
- [MCP Client Configs](mcp-clients.md): complete Claude, Cursor, OpenAI Agents,
|
|
85
118
|
generic stdio, and Streamable HTTP templates.
|
|
119
|
+
- [Client And Framework Recipes](client-recipes.md): one proposal-only
|
|
120
|
+
support-plan-credit flow for Claude Code, Codex, VS Code, OpenAI Agents,
|
|
121
|
+
LangChain/LangGraph, Google ADK, LlamaIndex, and generic MCP clients, with
|
|
122
|
+
explicit evidence labels.
|
|
86
123
|
- `examples/claude-desktop-postgres/`: copy-paste Claude Desktop config for the
|
|
87
124
|
Postgres billing fixture.
|
|
88
125
|
- `examples/cursor-postgres/`: copy-paste Cursor config for the Postgres
|
|
@@ -96,6 +133,8 @@ no-database demo, wire your database, then read deeper concepts.
|
|
|
96
133
|
|
|
97
134
|
- [Local Mode](local-mode.md): local store, proposals, approval, replay, and
|
|
98
135
|
writeback flow.
|
|
136
|
+
- [Shadow Studies](shadow-studies.md): compare what an agent would propose
|
|
137
|
+
with explicit authorized outcomes before granting write authority.
|
|
99
138
|
- [Writeback Executors](writeback-executors.md): app-owned writeback handlers
|
|
100
139
|
for approved proposals.
|
|
101
140
|
- [App-Owned Executors](app-owned-executors.md): short entry point for rich
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# Choose The Smallest Safe Database Boundary
|
|
2
|
+
|
|
3
|
+
You do not always need Synapsor Runner. Choose the smallest boundary that
|
|
4
|
+
matches the authority and evidence your agent actually needs.
|
|
5
|
+
|
|
6
|
+
## Decision Summary
|
|
7
|
+
|
|
8
|
+
| Approach | Good fit | Main boundary | Main trade-off |
|
|
9
|
+
| --- | --- | --- | --- |
|
|
10
|
+
| Direct database MCP | Disposable local data, synthetic demos, or tightly isolated development | Database credential and server implementation | The model can express SQL and may hold broad query authority |
|
|
11
|
+
| Read-only database access | Exploration where database permissions and result exposure are already acceptable | Read-only role, views, RLS, and query controls | Read-only is not data-safe by itself; broad reads can still expose another tenant or sensitive columns |
|
|
12
|
+
| Hand-built application tool | A few stable business operations already owned by one application team | Application endpoint or stored procedure | Your team owns every scope, review, retry, conflict, receipt, and investigation guarantee |
|
|
13
|
+
| Synapsor Runner | Consequential reads or writes needing a shared reviewed boundary | Canonical capabilities plus Runner and database controls | Adds contract and operating machinery; it does not replace database security or application handlers |
|
|
14
|
+
|
|
15
|
+
## Direct Or Raw Database MCP
|
|
16
|
+
|
|
17
|
+
A raw database MCP server can be appropriate when all data is synthetic,
|
|
18
|
+
disposable, and isolated from production. It is also useful for a trusted
|
|
19
|
+
developer exploring a local database where arbitrary SQL is the intended
|
|
20
|
+
power.
|
|
21
|
+
|
|
22
|
+
It is a poor model-facing production boundary when a tool accepts SQL, table
|
|
23
|
+
names, columns, predicates, tenant identifiers, or credentials chosen by the
|
|
24
|
+
model. Prompt instructions and SQL blocklists do not remove that authority.
|
|
25
|
+
Read-only credentials limit writes but can still permit broad or cross-tenant
|
|
26
|
+
reads.
|
|
27
|
+
|
|
28
|
+
Audit a server before adopting Runner or any other replacement:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npx -y @synapsor/runner audit --example dangerous-db-mcp
|
|
32
|
+
npx -y @synapsor/runner audit ./tools-list.json
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The audit is a structural review, not a penetration test or certification.
|
|
36
|
+
|
|
37
|
+
## Read-Only Database Access
|
|
38
|
+
|
|
39
|
+
Direct read-only access is often sufficient when:
|
|
40
|
+
|
|
41
|
+
- the agent is used by trusted internal developers;
|
|
42
|
+
- the database role can see only the rows and columns those users may see;
|
|
43
|
+
- restricted views or PostgreSQL row-level security enforce tenant scope;
|
|
44
|
+
- query cost and result size are bounded independently;
|
|
45
|
+
- no proposal, approval, receipt, or replay record is required.
|
|
46
|
+
|
|
47
|
+
Read-only does not mean harmless. Sensitive fields, cross-tenant records,
|
|
48
|
+
expensive queries, and data useful for later attacks can all be exposed without
|
|
49
|
+
a write. Keep the credential least-privileged and test the database policy as
|
|
50
|
+
the real authorization floor.
|
|
51
|
+
|
|
52
|
+
## Hand-Built Application Tools
|
|
53
|
+
|
|
54
|
+
A narrow application endpoint or stored procedure is often the best answer for
|
|
55
|
+
one or two stable operations. Trusted code should choose a fixed parameterized
|
|
56
|
+
query, derive tenant and principal scope from authenticated state, validate
|
|
57
|
+
business rules, and return only the required fields.
|
|
58
|
+
|
|
59
|
+
This may be enough when one team owns the entire path and does not need a
|
|
60
|
+
shared contract or review ledger. The team must still design and test:
|
|
61
|
+
|
|
62
|
+
- immutable intent and idempotency under retries;
|
|
63
|
+
- stale-data and concurrent-write conflicts;
|
|
64
|
+
- approval identity and quorum outside the model;
|
|
65
|
+
- exact before/after evidence and affected-row bounds;
|
|
66
|
+
- receipts, investigation, replay, and ambiguous-crash handling.
|
|
67
|
+
|
|
68
|
+
Runner can also route an approved proposal to an app-owned executor. Use that
|
|
69
|
+
boundary for external side effects, multi-table transactions, free-form
|
|
70
|
+
application logic, and operations the built-in guarded adapters intentionally
|
|
71
|
+
do not support.
|
|
72
|
+
|
|
73
|
+
## Synapsor Runner
|
|
74
|
+
|
|
75
|
+
Runner is useful when the model should receive reviewed semantic capabilities
|
|
76
|
+
instead of SQL and the organization needs the same trust mechanics across
|
|
77
|
+
tools or teams:
|
|
78
|
+
|
|
79
|
+
- trusted tenant and principal values stay outside model arguments;
|
|
80
|
+
- visible and kept-out fields are reviewed in one portable contract;
|
|
81
|
+
- model-facing writes create exact proposals without changing source data;
|
|
82
|
+
- activation, approval, apply, and compensation remain outside MCP;
|
|
83
|
+
- guarded apply rechecks scope, policy, conflict, bounds, and idempotency;
|
|
84
|
+
- evidence, proposal history, receipts, and replay preserve the lifecycle.
|
|
85
|
+
|
|
86
|
+
This is not magic and it is not a claim that these mechanics cannot be built in
|
|
87
|
+
application code. Runner packages a specific enforcement and evidence model so
|
|
88
|
+
each integration does not invent a subtly different one.
|
|
89
|
+
|
|
90
|
+
## What Runner Does Not Protect
|
|
91
|
+
|
|
92
|
+
Runner governs traffic that passes through its reviewed capabilities. It does
|
|
93
|
+
not:
|
|
94
|
+
|
|
95
|
+
- prevent prompt injection or make arbitrary SQL safe;
|
|
96
|
+
- stop a separate raw database tool, leaked credential, or application bypass;
|
|
97
|
+
- replace PostgreSQL RLS, restricted views, database grants, or network policy;
|
|
98
|
+
- make a deployment compliant with HIPAA, PCI DSS, SOC 2, or another standard;
|
|
99
|
+
- provide backups, disaster recovery, or protection from a trusted host or
|
|
100
|
+
database administrator;
|
|
101
|
+
- safely infer tenant scope, hidden fields, approval policy, or write authority.
|
|
102
|
+
|
|
103
|
+
Keep least-privilege roles, RLS or tenant-restricted views, encryption,
|
|
104
|
+
monitoring, tested backups, and application authorization underneath Runner.
|
|
105
|
+
For PostgreSQL, prefer transaction-bound RLS when the topology supports it. For
|
|
106
|
+
MySQL, use restricted views, per-tenant credentials, or isolated deployments
|
|
107
|
+
where required.
|
|
108
|
+
|
|
109
|
+
## A Practical Evaluation
|
|
110
|
+
|
|
111
|
+
1. Audit the model-facing tools and identify who chooses SQL, tenant scope,
|
|
112
|
+
fields, predicates, approval, and commit timing.
|
|
113
|
+
2. Keep direct read-only access if database policy already provides the exact
|
|
114
|
+
safe boundary and no review lifecycle is needed.
|
|
115
|
+
3. Keep a hand-built tool if it is narrow, well-tested, and its operational
|
|
116
|
+
guarantees are sufficient.
|
|
117
|
+
4. Try Runner on one consequential staging action when you need an exact Data
|
|
118
|
+
PR, approval outside the agent, guarded commit, receipt, and replay.
|
|
119
|
+
|
|
120
|
+
Continue with [Connect Your Own Database](getting-started-own-database.md),
|
|
121
|
+
[Security Boundary](security-boundary.md), or the deeper [build-versus-adopt
|
|
122
|
+
analysis](why-synapsor-vs-app-guardrails.md).
|
|
@@ -22,6 +22,49 @@ store path, MCP transport settings, and local development flags. The model sees
|
|
|
22
22
|
semantic capabilities such as `billing.inspect_invoice`, not raw SQL, table
|
|
23
23
|
names, write credentials, approval tools, or commit tools.
|
|
24
24
|
|
|
25
|
+
## Code-First TypeScript Path
|
|
26
|
+
|
|
27
|
+
Applications that prefer TypeScript can author the same canonical contract
|
|
28
|
+
through the optional `@synapsor/runner/authoring` frontend:
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
import { defineCapability } from "@synapsor/runner/authoring";
|
|
32
|
+
|
|
33
|
+
export const waiveLateFee = defineCapability({
|
|
34
|
+
name: "billing.propose_late_fee_waiver",
|
|
35
|
+
kind: "proposal",
|
|
36
|
+
context: "local_operator",
|
|
37
|
+
source: "app_postgres",
|
|
38
|
+
subject: { resource: "billing.invoice", primary_key: "id", tenant_key: "tenant_id" },
|
|
39
|
+
args: {
|
|
40
|
+
invoice_id: { type: "string", required: true, max_length: 128 },
|
|
41
|
+
reason: { type: "string", required: true, max_length: 500 },
|
|
42
|
+
},
|
|
43
|
+
lookup: { id_from_arg: "invoice_id" },
|
|
44
|
+
visible_fields: ["id", "tenant_id", "late_fee_cents", "waiver_reason", "updated_at"],
|
|
45
|
+
kept_out_fields: ["card_token", "internal_risk_note"],
|
|
46
|
+
evidence: { required: true, query_audit: true },
|
|
47
|
+
max_rows: 1,
|
|
48
|
+
proposal: {
|
|
49
|
+
action: "waive_late_fee",
|
|
50
|
+
operation: { kind: "update" },
|
|
51
|
+
allowed_fields: ["late_fee_cents", "waiver_reason"],
|
|
52
|
+
patch: { late_fee_cents: { fixed: 0 }, waiver_reason: { from_arg: "reason" } },
|
|
53
|
+
numeric_bounds: { late_fee_cents: { minimum: 0, maximum: 10000 } },
|
|
54
|
+
conflict_guard: { column: "updated_at" },
|
|
55
|
+
approval: { mode: "human", required_role: "billing_lead" },
|
|
56
|
+
writeback: { mode: "direct_sql" },
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Compose typed resources, contexts, capabilities, workflows, and policies with
|
|
62
|
+
`defineContract`, then use `contractJson` to write reviewable canonical JSON.
|
|
63
|
+
`compileContract` validates and normalizes through `@synapsor/spec`; this API
|
|
64
|
+
does not add semantics, raw SQL, or model-controlled predicates. The flagship
|
|
65
|
+
[support/billing action](../examples/support-billing-agent/app/contract.ts)
|
|
66
|
+
uses this frontend. JSON and DSL remain supported and conformance-equivalent.
|
|
67
|
+
|
|
25
68
|
## Contract/DSL Path
|
|
26
69
|
|
|
27
70
|
Write a small DSL contract:
|
|
@@ -150,7 +193,7 @@ reviewed runner JSON capabilities. Current parity:
|
|
|
150
193
|
| arg `minimum` | `ARG amount NUMBER MIN 1` | 0.1.8 | NUMBER args only. |
|
|
151
194
|
| arg `maximum` | `ARG amount NUMBER MAX 2500` | 0.1.8 | NUMBER args only. |
|
|
152
195
|
| arg `max_length` | `ARG reason TEXT MAX LENGTH 500` | 0.1.8 | STRING/TEXT args only. Legacy `MAX 500` is still accepted for existing DSL files, but `MAX LENGTH` is the reviewed spelling. |
|
|
153
|
-
| arg `enum` |
|
|
196
|
+
| arg `enum` | `ARG risk_level STRING ENUM('low', 'medium', 'high') REQUIRED` | 1.4.121 | Supports 1..64 same-type string, number, or boolean values; duplicates and mixed types fail compilation. |
|
|
154
197
|
| proposal `numeric_bounds` | `BOUND column 1..2500`, `BOUND column ..2500`, or `BOUND column 1..` | 0.1.8 | Applies to patched numeric columns. Strict mode warns when a NUMBER arg is patched without arg min/max or a matching `BOUND`. |
|
|
155
198
|
| proposal `transition_guards` | `TRANSITION status ALLOW pending -> approved\|rejected` or `TRANSITION status FROM current_status ALLOW open -> closed` | 0.1.8 | Values are state strings; use `|` for multiple target states. |
|
|
156
199
|
| proposal `conflict_guard` | `CONFLICT GUARD updated_at` | 0.1 | If omitted, DSL emits an explicit weak-guard acknowledgement. Prefer a real row-version column. |
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
# Client And Framework Recipes
|
|
2
|
+
|
|
3
|
+
Every recipe on this page connects to the same reviewed Runner boundary:
|
|
4
|
+
|
|
5
|
+
- `support.inspect_customer`
|
|
6
|
+
- `support.propose_plan_credit`
|
|
7
|
+
|
|
8
|
+
The model never receives SQL, database credentials, trusted tenant identity,
|
|
9
|
+
approval, apply, activation, or revert authority. A proposal call returns an
|
|
10
|
+
exact effect with `source_database_changed: false`; a human reviews and applies
|
|
11
|
+
it outside the model-facing client.
|
|
12
|
+
|
|
13
|
+
Checked-in files live in
|
|
14
|
+
[`examples/support-plan-credit/mcp-client-examples/`](../examples/support-plan-credit/mcp-client-examples/).
|
|
15
|
+
They contain command paths and environment-variable names only.
|
|
16
|
+
|
|
17
|
+
## Evidence Labels
|
|
18
|
+
|
|
19
|
+
| Label | Meaning |
|
|
20
|
+
| --- | --- |
|
|
21
|
+
| Host-tested | The named host was exercised manually at the recorded version. |
|
|
22
|
+
| Configuration-tested | The named host's current CLI or config parser accepted the recipe. |
|
|
23
|
+
| Protocol-tested | Runner completed MCP initialization and `tools/list` through the official MCP SDK using the same command/transport. |
|
|
24
|
+
| Recipe-checked | The file is syntax-checked, secret-scanned, and matched to current official framework documentation. Its framework runtime was not executed here. |
|
|
25
|
+
| Unknown | No compatibility claim is made. |
|
|
26
|
+
|
|
27
|
+
Protocol evidence is not presented as proof of editor UI behavior. Current
|
|
28
|
+
evidence is summarized in [Host Compatibility](host-compatibility.md).
|
|
29
|
+
|
|
30
|
+
## Shared Preflight
|
|
31
|
+
|
|
32
|
+
Run from the Runner repository root after supplying your own environment-bound
|
|
33
|
+
staging credentials and trusted scope:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npx -y -p @synapsor/runner synapsor-runner tools preview \
|
|
37
|
+
--config ./examples/support-plan-credit/synapsor.runner.json \
|
|
38
|
+
--store ./tmp/support-plan-credit/local.db
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
The list must include the two semantic tools above and must not include
|
|
42
|
+
`execute_sql`, approve, apply, commit, activation, or revert tools.
|
|
43
|
+
|
|
44
|
+
Use this exact proposal input in each client:
|
|
45
|
+
|
|
46
|
+
```json
|
|
47
|
+
{
|
|
48
|
+
"customer_id": "CUS-3001",
|
|
49
|
+
"credit_cents": 2500,
|
|
50
|
+
"reason": "SLA outage ticket SUP-481"
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Expected result: a proposal id, exact before/after effect, evidence handle, and
|
|
55
|
+
`source_database_changed: false`. Review it outside the client in the secured
|
|
56
|
+
Workbench or operator CLI. Do not add an approval or apply MCP server/tool to
|
|
57
|
+
make the client flow feel shorter.
|
|
58
|
+
|
|
59
|
+
## Cursor
|
|
60
|
+
|
|
61
|
+
**Status:** configuration-tested and protocol-tested with Cursor 3.7.21 on
|
|
62
|
+
Linux; final manual editor UI verification remains a release gate.
|
|
63
|
+
|
|
64
|
+
Use Runner's owned project lifecycle:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
synapsor-runner mcp install cursor --project --dry-run \
|
|
68
|
+
--config ./examples/support-plan-credit/synapsor.runner.json \
|
|
69
|
+
--store ./tmp/support-plan-credit/local.db
|
|
70
|
+
synapsor-runner mcp install cursor --project --yes \
|
|
71
|
+
--config ./examples/support-plan-credit/synapsor.runner.json \
|
|
72
|
+
--store ./tmp/support-plan-credit/local.db
|
|
73
|
+
synapsor-runner mcp status cursor --project --check-launch
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Ask Cursor to inspect `CUS-3001`, then call
|
|
77
|
+
`support.propose_plan_credit` with the shared input. Review the Data PR outside
|
|
78
|
+
the model-facing tool surface.
|
|
79
|
+
|
|
80
|
+
## Claude Desktop
|
|
81
|
+
|
|
82
|
+
**Status:** configuration-parsed and protocol-tested; manual Desktop UI
|
|
83
|
+
behavior is not claimed.
|
|
84
|
+
|
|
85
|
+
Merge
|
|
86
|
+
[`claude-desktop.json`](../examples/support-plan-credit/mcp-client-examples/claude-desktop.json)
|
|
87
|
+
into Claude Desktop's `mcpServers`, restart the app, and verify the exact tool
|
|
88
|
+
list. Then ask for the shared proposal call.
|
|
89
|
+
|
|
90
|
+
## Claude Code
|
|
91
|
+
|
|
92
|
+
**Status:** configuration-tested with Claude Code 2.1.216 and
|
|
93
|
+
protocol-tested; a manual model-driven call remains a release gate.
|
|
94
|
+
|
|
95
|
+
Run the checked command from the repository root:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
bash ./examples/support-plan-credit/mcp-client-examples/claude-code.sh
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Claude Code records project-scoped MCP configuration without embedding source
|
|
102
|
+
credentials. It will print the exact proposal prompt after configuration.
|
|
103
|
+
|
|
104
|
+
Official source checked 2026-07-20:
|
|
105
|
+
[Claude Code MCP](https://code.claude.com/docs/en/mcp).
|
|
106
|
+
|
|
107
|
+
## Codex
|
|
108
|
+
|
|
109
|
+
**Status:** configuration-tested with Codex CLI 0.144.6 and protocol-tested;
|
|
110
|
+
a manual model-driven call remains a release gate.
|
|
111
|
+
|
|
112
|
+
Merge the contents of
|
|
113
|
+
[`codex.config.toml`](../examples/support-plan-credit/mcp-client-examples/codex.config.toml)
|
|
114
|
+
into the trusted project's `.codex/config.toml`, start Codex from the repository
|
|
115
|
+
root, and ask it to list the Synapsor tools before making the shared proposal
|
|
116
|
+
call.
|
|
117
|
+
|
|
118
|
+
Official source checked 2026-07-20:
|
|
119
|
+
[Codex MCP configuration](https://developers.openai.com/codex/mcp/).
|
|
120
|
+
|
|
121
|
+
## VS Code
|
|
122
|
+
|
|
123
|
+
**Status:** configuration-parsed and protocol-tested; manual VS Code UI
|
|
124
|
+
behavior is not claimed.
|
|
125
|
+
|
|
126
|
+
Copy or merge
|
|
127
|
+
[`vscode.mcp.json`](../examples/support-plan-credit/mcp-client-examples/vscode.mcp.json)
|
|
128
|
+
into `.vscode/mcp.json`. Start the server from VS Code, inspect the listed
|
|
129
|
+
tools, and ask for the shared proposal call.
|
|
130
|
+
|
|
131
|
+
Official source checked 2026-07-20:
|
|
132
|
+
[VS Code MCP servers](https://code.visualstudio.com/docs/agent-customization/mcp-servers).
|
|
133
|
+
|
|
134
|
+
## OpenAI Agents SDK
|
|
135
|
+
|
|
136
|
+
**Status:** recipe-checked and underlying stdio/Streamable HTTP protocol-tested.
|
|
137
|
+
The exact SDK examples remain protocol-only until their agent calls are run
|
|
138
|
+
with an owner-supplied model API key.
|
|
139
|
+
|
|
140
|
+
Install `@openai/agents`, then run either:
|
|
141
|
+
|
|
142
|
+
- [`openai-agents-stdio.ts`](../examples/support-plan-credit/mcp-client-examples/openai-agents-stdio.ts)
|
|
143
|
+
- [`openai-agents-streamable-http.ts`](../examples/support-plan-credit/mcp-client-examples/openai-agents-streamable-http.ts)
|
|
144
|
+
|
|
145
|
+
Both examples instruct the agent to inspect the semantic tool list and create
|
|
146
|
+
the shared proposal. OpenAI-safe aliases are enabled where required; canonical
|
|
147
|
+
Synapsor capability names remain in result metadata.
|
|
148
|
+
|
|
149
|
+
Official source checked 2026-07-20:
|
|
150
|
+
[OpenAI Agents SDK MCP guide](https://openai.github.io/openai-agents-js/guides/mcp/).
|
|
151
|
+
|
|
152
|
+
## LangChain And LangGraph
|
|
153
|
+
|
|
154
|
+
**Status:** recipe-checked and protocol-only.
|
|
155
|
+
|
|
156
|
+
Install `@langchain/mcp-adapters` and run
|
|
157
|
+
[`langchain.mjs`](../examples/support-plan-credit/mcp-client-examples/langchain.mjs).
|
|
158
|
+
It calls `getTools()`, refuses an unsafe tool surface, and invokes the proposal
|
|
159
|
+
tool directly. The returned proposal still requires human review outside the
|
|
160
|
+
agent.
|
|
161
|
+
|
|
162
|
+
Official source checked 2026-07-20:
|
|
163
|
+
[LangChain JavaScript MCP](https://docs.langchain.com/oss/javascript/langchain/mcp).
|
|
164
|
+
LangGraph can use the same LangChain MCP tools; no Synapsor-specific SDK is
|
|
165
|
+
needed.
|
|
166
|
+
|
|
167
|
+
## Google ADK
|
|
168
|
+
|
|
169
|
+
**Status:** recipe-checked and protocol-only.
|
|
170
|
+
|
|
171
|
+
Install the current Google ADK Python package and run
|
|
172
|
+
[`google-adk.py`](../examples/support-plan-credit/mcp-client-examples/google-adk.py)
|
|
173
|
+
with `GOOGLE_ADK_MODEL` and the provider credential supplied through the
|
|
174
|
+
environment. The `McpToolset` is filtered to the two reviewed Synapsor tools.
|
|
175
|
+
|
|
176
|
+
Official source checked 2026-07-20:
|
|
177
|
+
[Google ADK MCP tools](https://adk.dev/tools-custom/mcp-tools/).
|
|
178
|
+
|
|
179
|
+
## LlamaIndex
|
|
180
|
+
|
|
181
|
+
**Status:** recipe-checked and protocol-only.
|
|
182
|
+
|
|
183
|
+
Install `llama-index-tools-mcp` and run
|
|
184
|
+
[`llamaindex.py`](../examples/support-plan-credit/mcp-client-examples/llamaindex.py).
|
|
185
|
+
It uses `BasicMCPClient` to list tools and make the shared proposal call without
|
|
186
|
+
requiring a model-provider API.
|
|
187
|
+
|
|
188
|
+
Official source checked 2026-07-20:
|
|
189
|
+
[LlamaIndex MCP tools](https://developers.llamaindex.ai/python/examples/tools/mcp/).
|
|
190
|
+
|
|
191
|
+
## Generic MCP Clients
|
|
192
|
+
|
|
193
|
+
**Status:** protocol-tested through the official TypeScript MCP SDK.
|
|
194
|
+
|
|
195
|
+
Use:
|
|
196
|
+
|
|
197
|
+
- [`generic-stdio.mjs`](../examples/support-plan-credit/mcp-client-examples/generic-stdio.mjs)
|
|
198
|
+
- [`generic-streamable-http.mjs`](../examples/support-plan-credit/mcp-client-examples/generic-streamable-http.mjs)
|
|
199
|
+
|
|
200
|
+
Each script performs MCP initialization, validates `tools/list`, rejects
|
|
201
|
+
model-visible commit authority, and makes the shared proposal call. The HTTP
|
|
202
|
+
script reads its bearer token from `SYNAPSOR_RUNNER_HTTP_TOKEN`; it never embeds
|
|
203
|
+
one.
|
|
204
|
+
|
|
205
|
+
Official source checked 2026-07-20:
|
|
206
|
+
[Build an MCP client](https://modelcontextprotocol.io/docs/develop/build-client).
|
|
207
|
+
|
|
208
|
+
## Verify The Checked Recipes
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
corepack pnpm test:mcp-client-configs
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
That deterministic gate syntax-checks and secret-scans every recipe and proves
|
|
215
|
+
the shared stdio tool surface. To additionally make the proposal call against
|
|
216
|
+
the disposable support-plan-credit PostgreSQL fixture, set
|
|
217
|
+
`SYNAPSOR_CLIENT_RECIPES_CALL=1` after exporting the fixture's environment.
|
|
218
|
+
The call creates a proposal but performs no approval or source mutation.
|
package/docs/contract-testing.md
CHANGED
|
@@ -11,10 +11,11 @@ synapsor-runner contract test \
|
|
|
11
11
|
--config ./synapsor.runner.json
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
Static mode checks tool exposure, operator-only boundaries,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
Static mode checks tool exposure, operator-only boundaries, trusted scope,
|
|
15
|
+
evidence and approval requirements, exact proposal effects, conflict guards,
|
|
16
|
+
argument limits, transition guards, bounded-set caps, and other assertions that
|
|
17
|
+
do not require a database. Add `--live` to call the actual MCP runtime for
|
|
18
|
+
scoped reads, proposals, evidence/replay redaction, and source-unchanged checks.
|
|
18
19
|
|
|
19
20
|
```bash
|
|
20
21
|
synapsor-runner contract test \
|
|
@@ -37,9 +38,10 @@ Summary: 6 passed / 0 failed / 6 total
|
|
|
37
38
|
```
|
|
38
39
|
|
|
39
40
|
Supported assertions cover valid scoped tools, cross-tenant denial,
|
|
40
|
-
same-tenant cross-principal denial,
|
|
41
|
-
|
|
42
|
-
state before approval, and the
|
|
41
|
+
same-tenant cross-principal denial, trusted tenant/principal scope, required
|
|
42
|
+
evidence, approval-policy boundaries, kept-out fields, argument constraints,
|
|
43
|
+
transition guards, set caps, unchanged source state before approval, and the
|
|
44
|
+
absence of model-facing approval/writeback.
|
|
43
45
|
Trusted tenant and principal values belong in test setup, not tool arguments.
|
|
44
46
|
|
|
45
47
|
Use `cross_principal_deny` to prove both the allowed and denied sides of one
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Cursor plugin
|
|
2
|
+
|
|
3
|
+
The Synapsor Cursor plugin is an official-format Cursor plugin under
|
|
4
|
+
`plugins/cursor/synapsor`. It packages the project-scoped Runner MCP server,
|
|
5
|
+
`/synapsor-protect`, and thin Cursor wrappers over Runner's canonical Safe Action
|
|
6
|
+
instructions.
|
|
7
|
+
|
|
8
|
+
Current implementation evidence was checked against Cursor's public plugin,
|
|
9
|
+
plugin-reference, MCP, and deeplink documentation on 2026-07-20:
|
|
10
|
+
|
|
11
|
+
- <https://cursor.com/docs/plugins>
|
|
12
|
+
- <https://cursor.com/docs/reference/plugins>
|
|
13
|
+
- <https://cursor.com/docs/mcp>
|
|
14
|
+
- <https://cursor.com/docs/reference/deeplinks>
|
|
15
|
+
|
|
16
|
+
The locally installed Cursor version used for validation is recorded in
|
|
17
|
+
`development/runner-1.5.3-progress.md`. Protocol/static validation is not a
|
|
18
|
+
claim that Cursor Marketplace review has completed.
|
|
19
|
+
|
|
20
|
+
## What the plugin installs
|
|
21
|
+
|
|
22
|
+
- one stdio MCP server pinned to `@synapsor/runner@1.5.3`;
|
|
23
|
+
- one `/synapsor-protect` agent command;
|
|
24
|
+
- one discoverable Safe Action skill;
|
|
25
|
+
- one file-scoped rule for `synapsor/actions/**/*.ts`;
|
|
26
|
+
- no hooks, automatic shell execution, credentials, or activation path.
|
|
27
|
+
|
|
28
|
+
The MCP entry uses Cursor's documented `${workspaceFolder}` interpolation for
|
|
29
|
+
`synapsor.runner.json` and `.synapsor/local.db`. It exposes only `mcp serve`.
|
|
30
|
+
Approval, apply, activation, commit, and revert remain outside MCP.
|
|
31
|
+
|
|
32
|
+
## Build and verify
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
corepack pnpm build:cursor-plugin
|
|
36
|
+
corepack pnpm verify:cursor-plugin
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
The verifier checks the manifest and component formats, version pin, project
|
|
40
|
+
paths, secret-free package contents, command authority boundary, deterministic
|
|
41
|
+
package inventory, disposable local install/reinstall/removal, preservation of
|
|
42
|
+
unrelated Cursor configuration, and paths containing spaces.
|
|
43
|
+
|
|
44
|
+
## Marketplace listing copy
|
|
45
|
+
|
|
46
|
+
**Name:** Synapsor
|
|
47
|
+
|
|
48
|
+
**Short description:** Turn one real application data change into a disabled,
|
|
49
|
+
reviewable MCP action without giving the Cursor agent SQL or commit authority.
|
|
50
|
+
|
|
51
|
+
**Security summary:** The plugin contains no database credentials or trusted
|
|
52
|
+
identity. Cursor can draft and validate disabled actions. Only a human using the
|
|
53
|
+
secured localhost Workbench can activate a reviewed digest; approval and apply
|
|
54
|
+
remain outside the model-facing MCP surface.
|
|
55
|
+
|
|
56
|
+
Required listing media:
|
|
57
|
+
|
|
58
|
+
- committed Synapsor logo from `assets/logo.svg`;
|
|
59
|
+
- screenshot of `/synapsor-protect` producing a disabled draft;
|
|
60
|
+
- screenshot of the Workbench exact-effect review and digest confirmation;
|
|
61
|
+
- 20-to-40-second GIF showing proposal, unchanged source, external approval,
|
|
62
|
+
guarded receipt, idempotent retry, and stale conflict.
|
|
63
|
+
|
|
64
|
+
## Submission checklist
|
|
65
|
+
|
|
66
|
+
- [ ] Runner 1.5.3 package and plugin version agree.
|
|
67
|
+
- [ ] `corepack pnpm verify:cursor-plugin` passes from a clean checkout.
|
|
68
|
+
- [ ] Plugin is manually loaded in current stable Cursor at workspace scope.
|
|
69
|
+
- [ ] `/synapsor-protect` drafts and validates without activation.
|
|
70
|
+
- [ ] Exact Cursor `tools/list` contains only reviewed semantic tools.
|
|
71
|
+
- [ ] Another direct-write MCP server triggers Runner's bypass warning.
|
|
72
|
+
- [ ] Logo and listing media contain no secrets, local paths, or customer data.
|
|
73
|
+
- [ ] Privacy/security copy matches the OSS security boundary.
|
|
74
|
+
- [ ] Public repository and release links resolve.
|
|
75
|
+
- [ ] Owner submits the repository at <https://cursor.com/marketplace/publish>.
|
|
76
|
+
|
|
77
|
+
The final submission remains an explicit owner action. Do not claim that local
|
|
78
|
+
installation or static validation equals Marketplace approval.
|