@synapsor/runner 0.1.0-alpha.10 → 0.1.0-alpha.11
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/README.md +41 -2
- package/dist/cli.d.ts.map +1 -1
- package/dist/runner.mjs +264 -65
- package/docs/README.md +17 -0
- package/docs/app-owned-executors.md +21 -0
- package/docs/cloud-mode.md +24 -0
- package/docs/current-scope.md +24 -0
- package/docs/dependency-license-inventory.md +35 -0
- package/docs/http-mcp.md +35 -1
- package/docs/licensing.md +36 -0
- package/docs/mcp-client-setup.md +39 -0
- package/docs/openai-agents-sdk.md +57 -0
- package/docs/release-notes.md +30 -1
- package/docs/use-your-own-database.md +18 -0
- package/docs/writeback-executors.md +11 -0
- package/examples/mcp-postgres-billing-app-handler/README.md +82 -0
- package/examples/mcp-postgres-billing-app-handler/app-handler.mjs +197 -0
- package/examples/mcp-postgres-billing-app-handler/docker-compose.yml +13 -0
- package/examples/mcp-postgres-billing-app-handler/schema.sql +59 -0
- package/examples/mcp-postgres-billing-app-handler/scripts/run-demo.sh +99 -0
- package/examples/mcp-postgres-billing-app-handler/seed.sql +39 -0
- package/examples/mcp-postgres-billing-app-handler/synapsor.runner.json +157 -0
- package/examples/openai-agents-http/README.md +10 -2
- package/examples/openai-agents-stdio/README.md +8 -4
- package/examples/openai-agents-stdio/agent.py +2 -0
- package/fixtures/benchmark/mcp-efficiency.json +53 -0
- package/fixtures/benchmark/mcp-efficiency.txt +25 -0
- package/fixtures/protocol/MANIFEST.json +54 -0
- package/fixtures/protocol/change-set.late-fee-waiver.v1.json +72 -0
- package/fixtures/protocol/execution-receipt.applied.v1.json +14 -0
- package/fixtures/protocol/execution-receipt.conflict.v1.json +15 -0
- package/fixtures/protocol/runner-registration.v1.json +22 -0
- package/fixtures/protocol/writeback-job.late-fee-waiver.v1.json +44 -0
- package/package.json +3 -1
package/docs/README.md
CHANGED
|
@@ -8,17 +8,27 @@ detail.
|
|
|
8
8
|
- [Connect Your Own Database](getting-started-own-database.md): inspect a
|
|
9
9
|
staging Postgres/MySQL database, generate `synapsor.runner.json`, preview
|
|
10
10
|
semantic tools, and serve them over MCP.
|
|
11
|
+
- [Use Your Own Database](use-your-own-database.md): short entry point that
|
|
12
|
+
links to the canonical own-database guide.
|
|
11
13
|
- [MCP Client Setup](mcp-client-setup.md): connect Claude, Cursor, VS Code, or
|
|
12
14
|
another stdio MCP client.
|
|
13
15
|
- [HTTP MCP](http-mcp.md): run Synapsor Runner as an authenticated HTTP MCP
|
|
14
16
|
service for app/server agents.
|
|
17
|
+
- [OpenAI Agents SDK](openai-agents-sdk.md): use Streamable HTTP MCP with
|
|
18
|
+
OpenAI-safe tool aliases.
|
|
15
19
|
|
|
16
20
|
## Safety And Operations
|
|
17
21
|
|
|
18
22
|
- [Security Boundary](security-boundary.md): what the model can and cannot see.
|
|
19
23
|
- [Current Limitations](limitations.md): current alpha scope.
|
|
24
|
+
- [Current Scope](current-scope.md): compact alpha scope summary.
|
|
25
|
+
- [Cloud Mode](cloud-mode.md): what stays local and what Cloud-linked mode adds.
|
|
20
26
|
- [Release Notes](release-notes.md): alpha behavior, breaking changes, and the
|
|
21
27
|
stable release policy.
|
|
28
|
+
- [Licensing](licensing.md): Apache-2.0 scope, trademark boundary, and what is
|
|
29
|
+
not included in this runner repo.
|
|
30
|
+
- [Dependency License Inventory](dependency-license-inventory.md): current
|
|
31
|
+
dependency license summary for release review.
|
|
22
32
|
- [Troubleshooting First Run](troubleshooting-first-run.md): common setup
|
|
23
33
|
failures and fixes.
|
|
24
34
|
- [Local Mode](local-mode.md): local store, proposals, approval, replay, and
|
|
@@ -30,6 +40,13 @@ detail.
|
|
|
30
40
|
- [Recipes](recipes.md): starter business-capability templates.
|
|
31
41
|
- [Writeback Executors](writeback-executors.md): app-owned writeback handlers
|
|
32
42
|
for approved proposals.
|
|
43
|
+
- [App-Owned Executors](app-owned-executors.md): short entry point for rich
|
|
44
|
+
business transactions handled by your app.
|
|
45
|
+
|
|
46
|
+
Useful examples:
|
|
47
|
+
|
|
48
|
+
- `examples/mcp-postgres-billing-app-handler/`: disposable Postgres app showing
|
|
49
|
+
guarded SQL writeback and app-owned account-credit execution side by side.
|
|
33
50
|
|
|
34
51
|
The public docs intentionally stay small. Historical implementation reports,
|
|
35
52
|
release checklists, and internal planning notes are not part of the public
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# App-Owned Executors
|
|
2
|
+
|
|
3
|
+
The canonical guide is [Writeback Executors](writeback-executors.md).
|
|
4
|
+
|
|
5
|
+
Use app-owned executors when an approved proposal needs a real business
|
|
6
|
+
transaction instead of Runner-managed single-row SQL.
|
|
7
|
+
|
|
8
|
+
Examples:
|
|
9
|
+
|
|
10
|
+
- create a credit row;
|
|
11
|
+
- open a ticket;
|
|
12
|
+
- call Stripe or Zendesk;
|
|
13
|
+
- write ledger/event rows;
|
|
14
|
+
- update multiple tables in one application transaction.
|
|
15
|
+
|
|
16
|
+
The model-facing MCP tool only creates a proposal. Approval happens outside MCP.
|
|
17
|
+
After approval, Runner calls your `http_handler` or `command_handler`, records
|
|
18
|
+
the receipt, and includes the result in replay.
|
|
19
|
+
|
|
20
|
+
Do not use generic SQL for rich business transactions. Let the model propose,
|
|
21
|
+
let Synapsor Runner approve/replay, and let your app execute the transaction.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Cloud Mode
|
|
2
|
+
|
|
3
|
+
Synapsor Runner is local-first. It does not require Synapsor Cloud for the local
|
|
4
|
+
demo, own-database onboarding, MCP serving, proposal creation, local approval,
|
|
5
|
+
guarded writeback, or replay.
|
|
6
|
+
|
|
7
|
+
Cloud-linked mode is for teams that need a shared control plane:
|
|
8
|
+
|
|
9
|
+
- team approvals and RBAC;
|
|
10
|
+
- hosted evidence/replay search;
|
|
11
|
+
- runner registration and heartbeat;
|
|
12
|
+
- job leases;
|
|
13
|
+
- receipt reporting;
|
|
14
|
+
- retention and audit visibility.
|
|
15
|
+
|
|
16
|
+
The local runner still keeps database credentials in your environment. MCP
|
|
17
|
+
client config snippets should contain command paths and runner arguments, not
|
|
18
|
+
database URLs or write credentials.
|
|
19
|
+
|
|
20
|
+
Run the local smoke for this mode with:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
corepack pnpm test:mcp-cloud-linked
|
|
24
|
+
```
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Current Scope
|
|
2
|
+
|
|
3
|
+
The canonical scope page is [Current Limitations](limitations.md).
|
|
4
|
+
|
|
5
|
+
Current alpha scope:
|
|
6
|
+
|
|
7
|
+
- local semantic MCP tools for Postgres/MySQL-backed business actions;
|
|
8
|
+
- schema inspection and guided config generation;
|
|
9
|
+
- trusted context from environment/session values;
|
|
10
|
+
- evidence handles, query audit, proposals, receipts, and local replay;
|
|
11
|
+
- guarded single-row `UPDATE` writeback for simple edits;
|
|
12
|
+
- app-owned `http_handler` and `command_handler` executors for richer approved
|
|
13
|
+
business transactions;
|
|
14
|
+
- stdio MCP, Streamable HTTP MCP, and a small JSON-RPC bridge.
|
|
15
|
+
|
|
16
|
+
Out of scope:
|
|
17
|
+
|
|
18
|
+
- raw `execute_sql`;
|
|
19
|
+
- model-generated SQL;
|
|
20
|
+
- generic INSERT/DELETE/UPSERT/DDL;
|
|
21
|
+
- generic multi-row SQL writeback;
|
|
22
|
+
- physical branching of external Postgres/MySQL;
|
|
23
|
+
- self-hosted Synapsor Cloud;
|
|
24
|
+
- production SLA or compliance certification.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Dependency License Inventory
|
|
2
|
+
|
|
3
|
+
Generated from the current lockfile/install with:
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
corepack pnpm licenses list --json
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Summary from the current dependency set:
|
|
10
|
+
|
|
11
|
+
| License | Package entries |
|
|
12
|
+
| --- | ---: |
|
|
13
|
+
| MIT | 149 |
|
|
14
|
+
| Apache-2.0 | 4 |
|
|
15
|
+
| BSD-3-Clause | 3 |
|
|
16
|
+
| BSD-2-Clause | 1 |
|
|
17
|
+
| ISC | 11 |
|
|
18
|
+
|
|
19
|
+
Apache-2.0 dependency entries reported by pnpm:
|
|
20
|
+
|
|
21
|
+
- `denque@2.1.0`
|
|
22
|
+
- `expect-type@1.3.0`
|
|
23
|
+
- `long@5.3.2`
|
|
24
|
+
- `typescript@5.9.3`
|
|
25
|
+
|
|
26
|
+
This file is an inventory summary, not a replacement for dependency license
|
|
27
|
+
review. Third-party dependency licenses and notices are not changed by the
|
|
28
|
+
first-party Synapsor Runner Apache-2.0 license.
|
|
29
|
+
|
|
30
|
+
Before public release:
|
|
31
|
+
|
|
32
|
+
- regenerate this inventory from a clean install;
|
|
33
|
+
- review dependency notices with the release owner or qualified counsel;
|
|
34
|
+
- keep third-party notices separate from the first-party Synapsor Runner
|
|
35
|
+
license.
|
package/docs/http-mcp.md
CHANGED
|
@@ -28,6 +28,38 @@ synapsor-runner mcp serve-streamable-http \
|
|
|
28
28
|
--auth-token-env SYNAPSOR_RUNNER_HTTP_TOKEN
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
+
For OpenAI Agents SDK, expose OpenAI-safe aliases because OpenAI function names
|
|
32
|
+
cannot contain dots:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
synapsor-runner mcp serve-streamable-http \
|
|
36
|
+
--host 127.0.0.1 \
|
|
37
|
+
--port 8766 \
|
|
38
|
+
--config ./synapsor.runner.json \
|
|
39
|
+
--store ./.synapsor/local.db \
|
|
40
|
+
--auth-token-env SYNAPSOR_RUNNER_HTTP_TOKEN \
|
|
41
|
+
--alias-mode openai
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Equivalent unified command:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
synapsor-runner mcp serve \
|
|
48
|
+
--transport streamable-http \
|
|
49
|
+
--host 127.0.0.1 \
|
|
50
|
+
--port 8766 \
|
|
51
|
+
--config ./synapsor.runner.json \
|
|
52
|
+
--store ./.synapsor/local.db \
|
|
53
|
+
--auth-token-env SYNAPSOR_RUNNER_HTTP_TOKEN \
|
|
54
|
+
--alias-mode openai
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
The model sees aliases such as `billing__inspect_invoice`. MCP tool metadata
|
|
58
|
+
still includes `synapsor.canonical_tool_name`, and Runner maps calls back to
|
|
59
|
+
the canonical Synapsor capability such as `billing.inspect_invoice`. Use
|
|
60
|
+
`--alias-mode both` only during migrations where some clients still need
|
|
61
|
+
canonical dotted names.
|
|
62
|
+
|
|
31
63
|
Defaults:
|
|
32
64
|
|
|
33
65
|
```text
|
|
@@ -239,4 +271,6 @@ example connects to `synapsor-runner mcp serve-streamable-http` through
|
|
|
239
271
|
want a small app-owned wrapper instead of standard HTTP MCP.
|
|
240
272
|
|
|
241
273
|
The boundary is the same in both modes: the agent calls a semantic Synapsor
|
|
242
|
-
tool, not raw SQL.
|
|
274
|
+
tool, not raw SQL. OpenAI-facing examples use `--alias-mode openai` so
|
|
275
|
+
the model sees OpenAI-valid aliases while Runner preserves canonical Synapsor
|
|
276
|
+
tool names in metadata.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Licensing
|
|
2
|
+
|
|
3
|
+
Synapsor Runner is open source under the Apache License 2.0 (`Apache-2.0`).
|
|
4
|
+
|
|
5
|
+
This page is a plain-English summary, not legal advice. If this summary
|
|
6
|
+
conflicts with `../LICENSE`, the `LICENSE` file controls.
|
|
7
|
+
|
|
8
|
+
Apache-2.0 applies to the code in this runner repository. It grants copyright
|
|
9
|
+
and patent rights under the license terms.
|
|
10
|
+
|
|
11
|
+
Apache-2.0 does not grant trademark rights. The Synapsor name, Synapsor Runner
|
|
12
|
+
name, logos, hosted Cloud service, and proprietary Synapsor platform features
|
|
13
|
+
remain separate. See `../TRADEMARKS.md`.
|
|
14
|
+
|
|
15
|
+
This license applies only to `synapsor-runner`. It does not open source:
|
|
16
|
+
|
|
17
|
+
- Synapsor Cloud;
|
|
18
|
+
- the hosted control plane;
|
|
19
|
+
- hosted capability registry;
|
|
20
|
+
- advanced policy/capability compiler;
|
|
21
|
+
- team approvals, RBAC, or SSO;
|
|
22
|
+
- hosted audit/evidence ledger;
|
|
23
|
+
- managed runners;
|
|
24
|
+
- production writeback orchestration;
|
|
25
|
+
- workflow builder;
|
|
26
|
+
- native Synapsor engine;
|
|
27
|
+
- C++/DBMS internals;
|
|
28
|
+
- branching, time travel, or settlement;
|
|
29
|
+
- compliance exports or production support/SLA.
|
|
30
|
+
|
|
31
|
+
Synapsor Cloud is a separate hosted commercial service. Use Cloud when your team
|
|
32
|
+
needs shared approvals, RBAC, hosted evidence/replay search, runner fleet
|
|
33
|
+
status, leases, retention, audit visibility, enterprise controls, and support.
|
|
34
|
+
|
|
35
|
+
Before public release, license and trademark text should be reviewed by the
|
|
36
|
+
release owner or qualified counsel.
|
package/docs/mcp-client-setup.md
CHANGED
|
@@ -51,6 +51,34 @@ npx -y -p @synapsor/runner@alpha synapsor-runner mcp serve-streamable-http \
|
|
|
51
51
|
--auth-token-env SYNAPSOR_RUNNER_HTTP_TOKEN
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
+
OpenAI Agents SDK rejects dotted function/tool names such as
|
|
55
|
+
`billing.inspect_invoice`. For OpenAI-facing transports, ask Runner to expose
|
|
56
|
+
OpenAI-safe aliases while keeping canonical Synapsor capability names in MCP
|
|
57
|
+
metadata:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
npx -y -p @synapsor/runner@alpha synapsor-runner mcp serve-streamable-http \
|
|
61
|
+
--config ./synapsor.runner.json \
|
|
62
|
+
--store ./.synapsor/local.db \
|
|
63
|
+
--auth-token-env SYNAPSOR_RUNNER_HTTP_TOKEN \
|
|
64
|
+
--alias-mode openai
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
The model sees names such as `billing__inspect_invoice`; `_meta` includes
|
|
68
|
+
`synapsor.canonical_tool_name = billing.inspect_invoice`, and Runner routes the
|
|
69
|
+
alias back to the canonical capability. Use `--alias-mode both` only when a
|
|
70
|
+
migration needs canonical dotted names and OpenAI-safe aliases exposed at the
|
|
71
|
+
same time.
|
|
72
|
+
|
|
73
|
+
Preview the exact alias mapping before wiring a client:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
npx -y -p @synapsor/runner@alpha synapsor-runner tools preview \
|
|
77
|
+
--config ./synapsor.runner.json \
|
|
78
|
+
--store ./.synapsor/local.db \
|
|
79
|
+
--alias-mode openai
|
|
80
|
+
```
|
|
81
|
+
|
|
54
82
|
Use private networking/TLS before exposing HTTP MCP beyond localhost. Details:
|
|
55
83
|
[HTTP MCP](http-mcp.md).
|
|
56
84
|
|
|
@@ -72,6 +100,17 @@ generic
|
|
|
72
100
|
claude-desktop
|
|
73
101
|
cursor
|
|
74
102
|
vscode
|
|
103
|
+
openai-agents
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
For OpenAI Agents SDK, generate the Streamable HTTP start command and Python
|
|
107
|
+
snippet:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
npx -y -p @synapsor/runner@alpha synapsor-runner mcp client-config \
|
|
111
|
+
--client openai-agents \
|
|
112
|
+
--config ./synapsor.runner.json \
|
|
113
|
+
--store ./.synapsor/local.db
|
|
75
114
|
```
|
|
76
115
|
|
|
77
116
|
The older form is still supported:
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# OpenAI Agents SDK
|
|
2
|
+
|
|
3
|
+
Use Synapsor Runner with the OpenAI Agents SDK through standard MCP Streamable
|
|
4
|
+
HTTP. Runner exposes semantic database tools to the model and keeps approval,
|
|
5
|
+
writeback, database URLs, and write credentials outside the model-facing tool
|
|
6
|
+
surface.
|
|
7
|
+
|
|
8
|
+
## Start Runner
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
export SYNAPSOR_RUNNER_HTTP_TOKEN="dev-local-token"
|
|
12
|
+
|
|
13
|
+
npx -y -p @synapsor/runner@alpha synapsor-runner mcp serve-streamable-http \
|
|
14
|
+
--config ./synapsor.runner.json \
|
|
15
|
+
--store ./.synapsor/local.db \
|
|
16
|
+
--auth-token-env SYNAPSOR_RUNNER_HTTP_TOKEN \
|
|
17
|
+
--alias-mode openai
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
`--alias-mode openai` is important because OpenAI function/tool names cannot
|
|
21
|
+
contain dots. Runner exposes names such as `billing__inspect_invoice` to the
|
|
22
|
+
model and maps calls back to canonical Synapsor capability names such as
|
|
23
|
+
`billing.inspect_invoice`.
|
|
24
|
+
|
|
25
|
+
## Generate The Snippet
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npx -y -p @synapsor/runner@alpha synapsor-runner mcp client-config \
|
|
29
|
+
--client openai-agents \
|
|
30
|
+
--config ./synapsor.runner.json \
|
|
31
|
+
--store ./.synapsor/local.db
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
The generated output includes:
|
|
35
|
+
|
|
36
|
+
- the Streamable HTTP server command;
|
|
37
|
+
- the `/mcp` URL;
|
|
38
|
+
- a Python `MCPServerStreamableHttp` snippet;
|
|
39
|
+
- the OpenAI alias note.
|
|
40
|
+
|
|
41
|
+
It does not include database URLs, passwords, write credentials, API keys, or
|
|
42
|
+
bearer token values.
|
|
43
|
+
|
|
44
|
+
## Sanity Check
|
|
45
|
+
|
|
46
|
+
Before giving the agent a real task, ask it to inspect one known object and
|
|
47
|
+
return the tool name it called plus the evidence handle. A healthy setup calls a
|
|
48
|
+
semantic tool such as `billing__inspect_invoice`. It should not expose
|
|
49
|
+
`execute_sql`, approval tools, commit/apply tools, database URLs, or write
|
|
50
|
+
credentials.
|
|
51
|
+
|
|
52
|
+
## Examples
|
|
53
|
+
|
|
54
|
+
```text
|
|
55
|
+
examples/openai-agents-http/
|
|
56
|
+
examples/openai-agents-stdio/
|
|
57
|
+
```
|
package/docs/release-notes.md
CHANGED
|
@@ -11,6 +11,35 @@ npx -y -p @synapsor/runner@alpha synapsor-runner demo --quick
|
|
|
11
11
|
The OSS runner command is `synapsor-runner`. The `synapsor` command is reserved
|
|
12
12
|
for the Synapsor Cloud CLI.
|
|
13
13
|
|
|
14
|
+
## 0.1.0-alpha.11
|
|
15
|
+
|
|
16
|
+
### OpenAI MCP Aliases
|
|
17
|
+
|
|
18
|
+
- `synapsor-runner mcp serve` and `synapsor-runner mcp serve-streamable-http`
|
|
19
|
+
now accept `--alias-mode openai` and `--openai-tool-aliases`.
|
|
20
|
+
- `synapsor-runner mcp serve --transport streamable-http` is available as a
|
|
21
|
+
unified command form for the standard HTTP MCP server.
|
|
22
|
+
- `synapsor-runner mcp client-config --client openai-agents` prints a
|
|
23
|
+
Streamable HTTP start command and OpenAI Agents SDK snippet.
|
|
24
|
+
- `synapsor-runner tools preview --alias-mode openai` shows model-visible alias
|
|
25
|
+
names and the canonical Synapsor capability each alias maps to.
|
|
26
|
+
- `examples/mcp-postgres-billing-app-handler/` adds a disposable Postgres proof
|
|
27
|
+
for the app-owned executor path: proposal first, approval outside MCP,
|
|
28
|
+
account-credit row inserted by the app handler, idempotent retry, and replay.
|
|
29
|
+
- `--alias-mode both` exposes canonical dotted names and OpenAI-safe aliases
|
|
30
|
+
together for migration/debugging.
|
|
31
|
+
- OpenAI alias mode exposes MCP tool names such as
|
|
32
|
+
`billing__inspect_invoice` instead of canonical dotted names such as
|
|
33
|
+
`billing.inspect_invoice`.
|
|
34
|
+
- Tool metadata includes `synapsor.canonical_tool_name`,
|
|
35
|
+
`synapsor.exposed_tool_name`, and `synapsor.tool_name_style`, so reviewers
|
|
36
|
+
can still see the canonical Synapsor capability.
|
|
37
|
+
- Runner routes alias calls back to the canonical capability. This removes the
|
|
38
|
+
need for user-written OpenAI wrapper code whose only job is replacing dots in
|
|
39
|
+
tool names.
|
|
40
|
+
- The OpenAI Agents SDK stdio and Streamable HTTP examples now document the
|
|
41
|
+
built-in alias mode.
|
|
42
|
+
|
|
14
43
|
## 0.1.0-alpha.10
|
|
15
44
|
|
|
16
45
|
### First-Run Flow
|
|
@@ -125,5 +154,5 @@ After publishing an alpha, verify the public package from a clean temporary
|
|
|
125
154
|
directory:
|
|
126
155
|
|
|
127
156
|
```bash
|
|
128
|
-
./scripts/verify-published-alpha.sh 0.1.0-alpha.
|
|
157
|
+
./scripts/verify-published-alpha.sh 0.1.0-alpha.11
|
|
129
158
|
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Use Your Own Database
|
|
2
|
+
|
|
3
|
+
The canonical guide is [Connect Your Own Database](getting-started-own-database.md).
|
|
4
|
+
|
|
5
|
+
Use it when you want to point Synapsor Runner at a staging Postgres/MySQL
|
|
6
|
+
database, inspect schemas/tables, generate one reviewed context/capability, and
|
|
7
|
+
serve semantic MCP tools without exposing raw SQL or write credentials to the
|
|
8
|
+
model.
|
|
9
|
+
|
|
10
|
+
Short path:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
export DATABASE_URL="postgresql://readonly_user:password@host:5432/app?sslmode=require"
|
|
14
|
+
npx -y -p @synapsor/runner@alpha synapsor-runner start --from-env DATABASE_URL --schema public
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Runner stores environment-variable names in `synapsor.runner.json`, not database
|
|
18
|
+
URLs. Keep credentials in your shell, process manager, or secret manager.
|
|
@@ -159,6 +159,17 @@ Concrete business-action examples are in:
|
|
|
159
159
|
examples/app-owned-writeback/business-actions.md
|
|
160
160
|
```
|
|
161
161
|
|
|
162
|
+
The full disposable Postgres account-credit demo is in:
|
|
163
|
+
|
|
164
|
+
```text
|
|
165
|
+
examples/mcp-postgres-billing-app-handler/
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
It proves the rich-write path end to end: the model creates a proposal, the
|
|
169
|
+
source DB is unchanged before approval, the app-owned handler inserts an
|
|
170
|
+
`account_credits` row after approval, retry is idempotent, and replay stores the
|
|
171
|
+
handler receipt.
|
|
172
|
+
|
|
162
173
|
Or generate one into your app:
|
|
163
174
|
|
|
164
175
|
```bash
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Postgres Billing App Handler
|
|
2
|
+
|
|
3
|
+
This example shows the two Synapsor Runner commit paths against one disposable
|
|
4
|
+
Postgres billing database.
|
|
5
|
+
|
|
6
|
+
Direct guarded SQL writeback:
|
|
7
|
+
|
|
8
|
+
- `billing.propose_late_fee_waiver`
|
|
9
|
+
- one-row `UPDATE`;
|
|
10
|
+
- tenant guard, allowed-column guard, conflict guard, idempotency receipt.
|
|
11
|
+
|
|
12
|
+
App-owned rich writeback:
|
|
13
|
+
|
|
14
|
+
- `billing.propose_account_credit`
|
|
15
|
+
- model-facing MCP only creates a proposal;
|
|
16
|
+
- approval happens outside MCP;
|
|
17
|
+
- Runner calls `billing_app_handler`;
|
|
18
|
+
- the app inserts an `account_credits` row and updates the invoice inside its
|
|
19
|
+
own transaction;
|
|
20
|
+
- Runner records the handler receipt and replay.
|
|
21
|
+
|
|
22
|
+
The model never receives `execute_sql`, approval tools, commit/apply tools,
|
|
23
|
+
database URLs, or write credentials.
|
|
24
|
+
|
|
25
|
+
## Run
|
|
26
|
+
|
|
27
|
+
From the repository root:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
examples/mcp-postgres-billing-app-handler/scripts/run-demo.sh
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Expected ending:
|
|
34
|
+
|
|
35
|
+
```text
|
|
36
|
+
App-owned billing handler demo passed.
|
|
37
|
+
Verified: proposal first, source unchanged before approval, account credit inserted by app handler, idempotent retry, replay.
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Manual Start
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
docker compose -f examples/mcp-postgres-billing-app-handler/docker-compose.yml up -d
|
|
44
|
+
|
|
45
|
+
export BILLING_APP_READ_URL="postgresql://synapsor_reader:synapsor_reader_password@localhost:55437/synapsor_billing_app_handler"
|
|
46
|
+
export BILLING_APP_WRITE_URL="postgresql://synapsor_writer:synapsor_writer_password@localhost:55437/synapsor_billing_app_handler"
|
|
47
|
+
export BILLING_APP_HANDLER_URL="http://127.0.0.1:8787/synapsor/writeback"
|
|
48
|
+
export BILLING_APP_HANDLER_TOKEN="dev-handler-token"
|
|
49
|
+
export SYNAPSOR_TENANT_ID="acme"
|
|
50
|
+
export SYNAPSOR_PRINCIPAL="local_billing_operator"
|
|
51
|
+
|
|
52
|
+
node examples/mcp-postgres-billing-app-handler/app-handler.mjs
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Then, in another terminal:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
synapsor-runner tools preview \
|
|
59
|
+
--config examples/mcp-postgres-billing-app-handler/synapsor.runner.json \
|
|
60
|
+
--store ./tmp/billing-app-handler/local.db
|
|
61
|
+
|
|
62
|
+
synapsor-runner propose billing.propose_account_credit \
|
|
63
|
+
--json '{"invoice_id":"INV-3001","amount_cents":2500,"reason":"support-approved credit"}' \
|
|
64
|
+
--config examples/mcp-postgres-billing-app-handler/synapsor.runner.json \
|
|
65
|
+
--store ./tmp/billing-app-handler/local.db
|
|
66
|
+
|
|
67
|
+
synapsor-runner proposals approve latest --yes --store ./tmp/billing-app-handler/local.db
|
|
68
|
+
synapsor-runner apply latest \
|
|
69
|
+
--config examples/mcp-postgres-billing-app-handler/synapsor.runner.json \
|
|
70
|
+
--store ./tmp/billing-app-handler/local.db
|
|
71
|
+
synapsor-runner replay show latest --store ./tmp/billing-app-handler/local.db
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Why This Exists
|
|
75
|
+
|
|
76
|
+
Direct Runner SQL writeback should stay intentionally narrow. It is good for
|
|
77
|
+
simple, bounded, single-row updates.
|
|
78
|
+
|
|
79
|
+
For richer business transactions such as creating credits, refund reviews,
|
|
80
|
+
ledger rows, tickets, events, or multi-row updates, keep execution in your
|
|
81
|
+
application service. Synapsor Runner still owns proposal creation, evidence,
|
|
82
|
+
approval boundary, idempotency, receipt storage, and replay.
|