@synapsor/runner 0.1.12 → 0.1.13
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/AGENTS.md +133 -0
- package/CHANGELOG.md +13 -0
- package/CONTRIBUTING.md +53 -0
- package/README.md +96 -1312
- package/THREAT_MODEL.md +79 -0
- package/dist/runner.mjs +4 -1
- package/docs/README.md +29 -4
- package/docs/getting-started-own-database.md +5 -14
- package/docs/mcp-audit.md +26 -0
- package/docs/oss-vs-cloud.md +50 -0
- package/package.json +4 -1
package/AGENTS.md
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# Agent Guide For Synapsor Runner
|
|
2
|
+
|
|
3
|
+
Synapsor Runner is an OSS MCP safety layer for Postgres/MySQL agents. It
|
|
4
|
+
replaces raw database tools such as `execute_sql` with reviewed business
|
|
5
|
+
capabilities, proposal-first writes, approval outside the model, guarded
|
|
6
|
+
writeback, and local evidence/replay.
|
|
7
|
+
|
|
8
|
+
## First Commands
|
|
9
|
+
|
|
10
|
+
Use the stable package for public/user-facing examples:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npx -y -p @synapsor/runner synapsor-runner demo --quick
|
|
14
|
+
npx -y -p @synapsor/runner synapsor-runner audit --example dangerous-db-mcp
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Use the local checkout while editing this repo:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
corepack pnpm install
|
|
21
|
+
./bin/synapsor-runner demo --quick --no-interactive
|
|
22
|
+
./scripts/verify-release-gate.sh
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## What Not To Change Casually
|
|
26
|
+
|
|
27
|
+
Do not weaken these safety boundaries without a failing test and an explicit
|
|
28
|
+
design note:
|
|
29
|
+
|
|
30
|
+
- no model-facing `execute_sql`, raw SQL, approval, commit, apply, or writeback
|
|
31
|
+
tools;
|
|
32
|
+
- trusted tenant/principal context must come from backend/session/env config,
|
|
33
|
+
not model-controlled arguments;
|
|
34
|
+
- proposals must not mutate the source database before approval;
|
|
35
|
+
- direct writeback must enforce tenant, primary key, allowed columns,
|
|
36
|
+
expected-version/conflict guard, affected-row count, idempotency, and receipt
|
|
37
|
+
recording;
|
|
38
|
+
- app-owned handlers must re-check tenant/scope, expected version,
|
|
39
|
+
idempotency, allowed business action, transaction/rollback, and safe error
|
|
40
|
+
receipts;
|
|
41
|
+
- local store lease guards and stale-lease reclaim must keep concurrent writers
|
|
42
|
+
from corrupting the SQLite store.
|
|
43
|
+
|
|
44
|
+
## How The Flow Works
|
|
45
|
+
|
|
46
|
+
```text
|
|
47
|
+
MCP tool call
|
|
48
|
+
-> trusted context
|
|
49
|
+
-> scoped read from Postgres/MySQL
|
|
50
|
+
-> evidence/query audit
|
|
51
|
+
-> proposal diff
|
|
52
|
+
-> approval outside MCP
|
|
53
|
+
-> direct writeback or app-owned executor
|
|
54
|
+
-> receipt/replay
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
The source database remains the source of truth. Runner stores local evidence,
|
|
58
|
+
proposals, receipts, query audit, and replay in SQLite.
|
|
59
|
+
|
|
60
|
+
## Add A Capability Without Reading dist/
|
|
61
|
+
|
|
62
|
+
Start from schema inspection or a recipe, then run the smoke boundary before
|
|
63
|
+
wiring an MCP client:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
export DATABASE_URL="postgres://readonly:...@localhost:5432/app"
|
|
67
|
+
./bin/synapsor-runner onboard db \
|
|
68
|
+
--from-env DATABASE_URL \
|
|
69
|
+
--engine postgres \
|
|
70
|
+
--schema public \
|
|
71
|
+
--table invoices \
|
|
72
|
+
--primary-key id \
|
|
73
|
+
--tenant-column tenant_id \
|
|
74
|
+
--conflict-column updated_at \
|
|
75
|
+
--mode review \
|
|
76
|
+
--visible-columns id,tenant_id,status,late_fee_cents,updated_at \
|
|
77
|
+
--namespace billing \
|
|
78
|
+
--object-name invoice \
|
|
79
|
+
--id-arg invoice_id \
|
|
80
|
+
--patch late_fee_cents=fixed:0 \
|
|
81
|
+
--write-url-env SYNAPSOR_DATABASE_WRITE_URL \
|
|
82
|
+
--yes \
|
|
83
|
+
--output synapsor.runner.json
|
|
84
|
+
|
|
85
|
+
./bin/synapsor-runner config validate --config ./synapsor.runner.json
|
|
86
|
+
./bin/synapsor-runner tools preview --config ./synapsor.runner.json --store ./.synapsor/local.db
|
|
87
|
+
./bin/synapsor-runner smoke call --config ./synapsor.runner.json --store ./.synapsor/local.db
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
For app-owned writes, use an executor and generate a template:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
./bin/synapsor-runner onboard db \
|
|
94
|
+
--from-env DATABASE_URL \
|
|
95
|
+
--table invoices \
|
|
96
|
+
--mode review \
|
|
97
|
+
--writeback http_handler \
|
|
98
|
+
--handler-url-env APP_WRITEBACK_URL \
|
|
99
|
+
--emit-handler \
|
|
100
|
+
--handler-template node-fastify \
|
|
101
|
+
--yes
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Test Safely
|
|
105
|
+
|
|
106
|
+
Prefer these checks before opening a PR:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
corepack pnpm typecheck
|
|
110
|
+
corepack pnpm test:mcp-client-configs
|
|
111
|
+
./scripts/verify-public-commands.sh
|
|
112
|
+
./scripts/verify-local-runner.sh
|
|
113
|
+
./scripts/verify-packed-runner.sh
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Run the full gate before release or large safety changes:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
./scripts/verify-release-gate.sh
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Do not commit generated `.synapsor/` ledgers, database credentials, `.env`
|
|
123
|
+
files, or npm tarballs.
|
|
124
|
+
|
|
125
|
+
## Source Map
|
|
126
|
+
|
|
127
|
+
- `apps/runner`: CLI, local UI, packaged README/docs/examples.
|
|
128
|
+
- `packages/mcp-server`: MCP runtime and safe tool exposure.
|
|
129
|
+
- `packages/schema-inspector`: Postgres/MySQL metadata inspection.
|
|
130
|
+
- `packages/proposal-store`: local SQLite evidence/proposal/replay store.
|
|
131
|
+
- `packages/postgres`, `packages/mysql`: guarded writeback adapters.
|
|
132
|
+
- `examples`: runnable demos and integration examples.
|
|
133
|
+
- `docs`: task guides, safety boundary, release policy.
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
### Front-Door Documentation
|
|
6
|
+
|
|
7
|
+
- Rewrites the GitHub and npm READMEs around an audit-first 60-second proof,
|
|
8
|
+
one staging-database path, and direct links to task-specific documentation.
|
|
9
|
+
- Adds a trust and verification section that links the threat model,
|
|
10
|
+
conformance fixtures, live Postgres/MySQL apply smoke, and Cloud/C++
|
|
11
|
+
contract round-trip evidence.
|
|
12
|
+
- Untracks internal progress files, preserves them under the ignored local
|
|
13
|
+
notes directory, and adds ignore guards so session state cannot return to the
|
|
14
|
+
public repository root.
|
|
15
|
+
- Stages `@synapsor/runner@0.1.13`; `@synapsor/spec` and `@synapsor/dsl` remain
|
|
16
|
+
unchanged.
|
|
17
|
+
|
|
5
18
|
### Runner Version Invocation
|
|
6
19
|
|
|
7
20
|
- Stages `@synapsor/runner@0.1.12` without changing or republishing
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Synapsor Runner is open-source software under Apache License 2.0. Until
|
|
4
|
+
Synapsor has a counsel-approved CLA or inbound-rights process for this
|
|
5
|
+
repository, external code contributions are not being accepted.
|
|
6
|
+
|
|
7
|
+
What is welcome now:
|
|
8
|
+
|
|
9
|
+
- bug reports;
|
|
10
|
+
- documentation feedback;
|
|
11
|
+
- security reports through the process in `SECURITY.md`;
|
|
12
|
+
- feature requests and reproducible examples.
|
|
13
|
+
|
|
14
|
+
Please do not submit pull requests or code patches unless the maintainers have
|
|
15
|
+
explicitly requested them under an approved contribution process.
|
|
16
|
+
|
|
17
|
+
For maintainers, use small changes with tests. Do not add support for arbitrary
|
|
18
|
+
SQL, multi-row updates, DDL, stored procedures, or model-generated write
|
|
19
|
+
statements.
|
|
20
|
+
|
|
21
|
+
Before opening a change:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
corepack pnpm install
|
|
25
|
+
corepack pnpm typecheck
|
|
26
|
+
corepack pnpm test:smoke
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Keep logs and fixtures free of secrets and customer data.
|
|
30
|
+
|
|
31
|
+
## Safety Boundary Checklist
|
|
32
|
+
|
|
33
|
+
Do not change guard semantics without a focused test. In particular, changes
|
|
34
|
+
that touch proposal creation, approval, writeback, store leases, receipts,
|
|
35
|
+
idempotency, replay, MCP tool exposure, or app-owned handlers must prove:
|
|
36
|
+
|
|
37
|
+
- no model-facing `execute_sql`, raw SQL, approval, commit, apply, or writeback
|
|
38
|
+
tool was added;
|
|
39
|
+
- tenant/scope values come from trusted context, not model-controlled args;
|
|
40
|
+
- direct writeback still checks primary key, tenant key, allowed columns,
|
|
41
|
+
expected version/conflict guard, affected-row count, idempotency, and receipt
|
|
42
|
+
recording;
|
|
43
|
+
- app-owned handler templates tell developers to re-check tenant/scope,
|
|
44
|
+
expected version, idempotency, allowed action, transaction/rollback, and
|
|
45
|
+
receipt shape.
|
|
46
|
+
|
|
47
|
+
Useful local gates:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
corepack pnpm verify:local-runner
|
|
51
|
+
corepack pnpm verify:packed-runner
|
|
52
|
+
corepack pnpm test:mcp-client-configs
|
|
53
|
+
```
|