@synapsor/runner 1.5.0 → 1.5.4

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 (83) hide show
  1. package/CHANGELOG.md +134 -3
  2. package/README.md +108 -113
  3. package/dist/authoring.d.ts +23 -0
  4. package/dist/authoring.d.ts.map +1 -0
  5. package/dist/authoring.mjs +1318 -0
  6. package/dist/cli.d.ts.map +1 -1
  7. package/dist/cli.js +4 -5
  8. package/dist/local-ui.d.ts +14 -0
  9. package/dist/local-ui.d.ts.map +1 -1
  10. package/dist/runner.mjs +12334 -5256
  11. package/dist/runtime.mjs +817 -149
  12. package/dist/shadow.d.ts +36 -0
  13. package/dist/shadow.d.ts.map +1 -0
  14. package/dist/shadow.mjs +5362 -0
  15. package/docs/README.md +25 -2
  16. package/docs/alternatives.md +122 -0
  17. package/docs/capability-authoring.md +49 -1
  18. package/docs/client-recipes.md +218 -0
  19. package/docs/cloud-mode.md +18 -0
  20. package/docs/contract-testing.md +9 -7
  21. package/docs/cursor-plugin.md +78 -0
  22. package/docs/database-enforced-scope.md +8 -0
  23. package/docs/dsl-reference.md +45 -4
  24. package/docs/effect-regression.md +39 -2
  25. package/docs/fresh-developer-usability.md +110 -0
  26. package/docs/getting-started-own-database.md +102 -5
  27. package/docs/guarded-crud-writeback.md +10 -1
  28. package/docs/host-compatibility.md +59 -0
  29. package/docs/http-mcp.md +222 -207
  30. package/docs/limitations.md +9 -2
  31. package/docs/local-mode.md +11 -7
  32. package/docs/mcp-audit.md +166 -2
  33. package/docs/mcp-client-setup.md +28 -11
  34. package/docs/mcp-clients.md +43 -8
  35. package/docs/openai-agents-sdk.md +16 -2
  36. package/docs/oss-vs-cloud.md +3 -0
  37. package/docs/production.md +72 -7
  38. package/docs/release-notes.md +131 -4
  39. package/docs/runner-bundles.md +7 -2
  40. package/docs/runner-config-reference.md +96 -6
  41. package/docs/running-a-runner-fleet.md +42 -13
  42. package/docs/security-boundary.md +58 -8
  43. package/docs/shadow-studies.md +47 -4
  44. package/docs/store-lifecycle.md +93 -5
  45. package/docs/troubleshooting-first-run.md +46 -0
  46. package/examples/openai-agents-http/README.md +10 -4
  47. package/examples/openai-agents-http/agent.py +2 -2
  48. package/examples/runner-fleet/Dockerfile +7 -2
  49. package/examples/runner-fleet/README.md +11 -7
  50. package/examples/runner-fleet/docker-compose.yml +4 -4
  51. package/examples/runner-fleet/mint-dev-token.mjs +1 -1
  52. package/examples/runner-fleet/start-tls-runner.sh +21 -0
  53. package/examples/runner-fleet/synapsor.runner.json +27 -1
  54. package/examples/support-billing-agent/README.md +18 -0
  55. package/examples/support-billing-agent/app/README.md +6 -0
  56. package/examples/support-billing-agent/app/contract.ts +28 -0
  57. package/examples/support-billing-agent/app/effect-adapter.mjs +23 -0
  58. package/examples/support-billing-agent/app/record-shadow-outcomes.mjs +44 -0
  59. package/examples/support-billing-agent/scripts/run-evaluation.sh +6 -5
  60. package/examples/support-plan-credit/README.md +54 -3
  61. package/examples/support-plan-credit/mcp-client-examples/README.md +23 -0
  62. package/examples/support-plan-credit/mcp-client-examples/claude-code.sh +34 -0
  63. package/examples/support-plan-credit/mcp-client-examples/codex.config.toml +24 -0
  64. package/examples/support-plan-credit/mcp-client-examples/generic-stdio.mjs +35 -0
  65. package/examples/support-plan-credit/mcp-client-examples/generic-streamable-http.json +4 -1
  66. package/examples/support-plan-credit/mcp-client-examples/generic-streamable-http.mjs +31 -0
  67. package/examples/support-plan-credit/mcp-client-examples/google-adk.py +40 -0
  68. package/examples/support-plan-credit/mcp-client-examples/langchain.mjs +29 -0
  69. package/examples/support-plan-credit/mcp-client-examples/llamaindex.py +36 -0
  70. package/examples/support-plan-credit/mcp-client-examples/openai-agents-stdio.ts +1 -1
  71. package/examples/support-plan-credit/mcp-client-examples/openai-agents-streamable-http.ts +5 -1
  72. package/examples/support-plan-credit/mcp-client-examples/vscode.mcp.json +20 -0
  73. package/examples/support-plan-credit/synapsor/actions/support.propose_plan_credit.contract-tests.generated.json +221 -0
  74. package/examples/support-plan-credit/synapsor/actions/support.propose_plan_credit.ts +34 -0
  75. package/examples/support-plan-credit/synapsor.contract.json +0 -3
  76. package/fixtures/mcp-audit/README.md +14 -0
  77. package/fixtures/mcp-audit/cursor-bypass-config.json +38 -0
  78. package/fixtures/mcp-audit/dangerous-tools-list.json +33 -0
  79. package/fixtures/mcp-audit/reviewed-proposal-tools-list.json +60 -0
  80. package/package.json +18 -3
  81. package/schemas/mcp-audit-report.schema.json +100 -1
  82. package/schemas/synapsor.contract-tests.schema.json +1 -1
  83. package/schemas/synapsor.runner.schema.json +80 -0
@@ -0,0 +1,33 @@
1
+ {
2
+ "jsonrpc": "2.0",
3
+ "id": 1,
4
+ "result": {
5
+ "tools": [
6
+ {
7
+ "name": "execute_sql",
8
+ "description": "Execute arbitrary SQL against the application database.",
9
+ "inputSchema": {
10
+ "type": "object",
11
+ "properties": {
12
+ "sql": { "type": "string" },
13
+ "tenant_id": { "type": "string" },
14
+ "table_name": { "type": "string" },
15
+ "where": { "type": "string" }
16
+ },
17
+ "required": ["sql"]
18
+ }
19
+ },
20
+ {
21
+ "name": "approve_and_apply_change",
22
+ "description": "Approve and apply a database change immediately.",
23
+ "inputSchema": {
24
+ "type": "object",
25
+ "properties": {
26
+ "change_id": { "type": "string" }
27
+ },
28
+ "required": ["change_id"]
29
+ }
30
+ }
31
+ ]
32
+ }
33
+ }
@@ -0,0 +1,60 @@
1
+ {
2
+ "jsonrpc": "2.0",
3
+ "id": 1,
4
+ "result": {
5
+ "tools": [
6
+ {
7
+ "name": "billing.inspect_invoice",
8
+ "description": "Inspect one tenant-scoped invoice through reviewed visible fields.",
9
+ "inputSchema": {
10
+ "type": "object",
11
+ "properties": {
12
+ "invoice_id": { "type": "string", "maxLength": 128 }
13
+ },
14
+ "required": ["invoice_id"]
15
+ },
16
+ "outputSchema": {
17
+ "type": "object",
18
+ "properties": {
19
+ "status": { "type": "string" },
20
+ "evidence_bundle_id": { "type": "string" }
21
+ },
22
+ "required": ["status", "evidence_bundle_id"]
23
+ },
24
+ "annotations": {
25
+ "readOnlyHint": true,
26
+ "destructiveHint": false
27
+ },
28
+ "x_synapsor_test_fixture": "billing-invoice-safe"
29
+ },
30
+ {
31
+ "name": "billing.propose_late_fee_waiver",
32
+ "description": "Create an exact evidence-backed proposal for review before trusted writeback.",
33
+ "inputSchema": {
34
+ "type": "object",
35
+ "properties": {
36
+ "invoice_id": { "type": "string", "maxLength": 128 },
37
+ "reason": { "type": "string", "maxLength": 500 }
38
+ },
39
+ "required": ["invoice_id", "reason"]
40
+ },
41
+ "outputSchema": {
42
+ "type": "object",
43
+ "properties": {
44
+ "status": { "type": "string" },
45
+ "proposal_id": { "type": "string" },
46
+ "receipt_hash": { "type": "string" },
47
+ "retryable": { "type": "boolean" },
48
+ "source_database_changed": { "type": "boolean" }
49
+ },
50
+ "required": ["status", "proposal_id", "source_database_changed"]
51
+ },
52
+ "annotations": {
53
+ "readOnlyHint": false,
54
+ "destructiveHint": false
55
+ },
56
+ "x_synapsor_test_fixture": "billing-waiver-proposal-safe"
57
+ }
58
+ ]
59
+ }
60
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synapsor/runner",
3
- "version": "1.5.0",
3
+ "version": "1.5.4",
4
4
  "description": "Stop giving AI agents execute_sql; expose reviewed Postgres/MySQL MCP actions with proposals, approval, writeback, and replay.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -8,6 +8,14 @@
8
8
  "synapsor-runner": "dist/cli.js"
9
9
  },
10
10
  "exports": {
11
+ "./authoring": {
12
+ "types": "./dist/authoring.d.ts",
13
+ "import": "./dist/authoring.mjs"
14
+ },
15
+ "./shadow": {
16
+ "types": "./dist/shadow.d.ts",
17
+ "import": "./dist/shadow.mjs"
18
+ },
11
19
  "./runtime": {
12
20
  "types": "./dist/runtime.d.ts",
13
21
  "import": "./dist/runtime.mjs"
@@ -23,6 +31,12 @@
23
31
  "dist/runtime.mjs",
24
32
  "dist/runtime.d.ts",
25
33
  "dist/runtime.d.ts.map",
34
+ "dist/authoring.mjs",
35
+ "dist/authoring.d.ts",
36
+ "dist/authoring.d.ts.map",
37
+ "dist/shadow.mjs",
38
+ "dist/shadow.d.ts",
39
+ "dist/shadow.d.ts.map",
26
40
  "docs/**/*.md",
27
41
  "examples/dangerous-mcp-tools.json",
28
42
  "examples/app-owned-writeback/**",
@@ -65,10 +79,11 @@
65
79
  "model-context-protocol"
66
80
  ],
67
81
  "engines": {
68
- "node": ">=22.5.0"
82
+ "node": ">=22.13.0"
69
83
  },
70
84
  "dependencies": {
71
85
  "@modelcontextprotocol/sdk": "1.29.0",
86
+ "@synapsor/spec": "^1.4.2",
72
87
  "jose": "6.2.3",
73
88
  "mysql2": "^3.11.0",
74
89
  "pdf-lib": "1.17.1",
@@ -76,7 +91,7 @@
76
91
  "typescript": "5.9.3",
77
92
  "vscode-languageserver": "9.0.1",
78
93
  "vscode-languageserver-textdocument": "1.0.12",
79
- "yaml": "2.8.1",
94
+ "yaml": "2.8.3",
80
95
  "zod": "^3.25.0"
81
96
  },
82
97
  "devDependencies": {
@@ -10,6 +10,7 @@
10
10
  "disclaimer",
11
11
  "generated_at",
12
12
  "summary",
13
+ "authority_map",
13
14
  "findings"
14
15
  ],
15
16
  "properties": {
@@ -59,6 +60,99 @@
59
60
  }
60
61
  }
61
62
  },
63
+ "authority_map": {
64
+ "type": "object",
65
+ "additionalProperties": false,
66
+ "required": [
67
+ "items",
68
+ "visibility_limit"
69
+ ],
70
+ "properties": {
71
+ "items": {
72
+ "type": "array",
73
+ "items": {
74
+ "type": "object",
75
+ "additionalProperties": false,
76
+ "required": [
77
+ "authority",
78
+ "label",
79
+ "status",
80
+ "tools",
81
+ "evidence"
82
+ ],
83
+ "properties": {
84
+ "authority": { "type": "string" },
85
+ "label": { "type": "string" },
86
+ "status": {
87
+ "enum": [
88
+ "observed",
89
+ "not_observed",
90
+ "requires_operator_verification",
91
+ "outside_static_audit_visibility"
92
+ ]
93
+ },
94
+ "tools": {
95
+ "type": "array",
96
+ "items": { "type": "string" }
97
+ },
98
+ "evidence": { "type": "string" }
99
+ }
100
+ }
101
+ },
102
+ "visibility_limit": { "type": "string" }
103
+ }
104
+ },
105
+ "bypass_check": {
106
+ "type": "object",
107
+ "additionalProperties": false,
108
+ "required": [
109
+ "mode",
110
+ "servers",
111
+ "direct_bypass_observed",
112
+ "unverified_servers",
113
+ "warning"
114
+ ],
115
+ "properties": {
116
+ "mode": {
117
+ "enum": ["static_config", "selected_live_tools_list"]
118
+ },
119
+ "servers": {
120
+ "type": "array",
121
+ "items": {
122
+ "type": "object",
123
+ "additionalProperties": false,
124
+ "required": [
125
+ "server",
126
+ "status",
127
+ "transport",
128
+ "tools_observed",
129
+ "evidence",
130
+ "remediation"
131
+ ],
132
+ "properties": {
133
+ "server": { "type": "string" },
134
+ "status": {
135
+ "enum": [
136
+ "observed_direct_authority",
137
+ "no_direct_authority_observed",
138
+ "requires_operator_verification"
139
+ ]
140
+ },
141
+ "transport": { "enum": ["stdio", "remote", "unknown"] },
142
+ "tools_observed": {
143
+ "type": "array",
144
+ "items": { "type": "string" }
145
+ },
146
+ "evidence": { "type": "string" },
147
+ "remediation": { "type": "string" }
148
+ }
149
+ }
150
+ },
151
+ "direct_bypass_observed": { "type": "boolean" },
152
+ "unverified_servers": { "type": "integer", "minimum": 0 },
153
+ "warning": { "type": "string" }
154
+ }
155
+ },
62
156
  "findings": {
63
157
  "type": "array",
64
158
  "items": {
@@ -69,7 +163,8 @@
69
163
  "code",
70
164
  "message",
71
165
  "evidence",
72
- "recommendation"
166
+ "recommendation",
167
+ "remediation_url"
73
168
  ],
74
169
  "properties": {
75
170
  "severity": {
@@ -96,6 +191,10 @@
96
191
  },
97
192
  "recommendation": {
98
193
  "type": "string"
194
+ },
195
+ "remediation_url": {
196
+ "type": "string",
197
+ "format": "uri"
99
198
  }
100
199
  }
101
200
  }
@@ -19,7 +19,7 @@
19
19
  "properties": {
20
20
  "id": { "type": "string", "minLength": 1 },
21
21
  "kind": {
22
- "enum": ["tool_allow", "tool_deny", "cross_principal_deny", "hide_fields", "argument_constraint", "transition_guard", "set_cap", "source_unchanged_before_approval", "operator_boundary"]
22
+ "enum": ["tool_allow", "tool_deny", "cross_principal_deny", "hide_fields", "argument_constraint", "transition_guard", "set_cap", "proposal_effect", "conflict_guard", "trusted_scope", "evidence_requirement", "approval_boundary", "source_unchanged_before_approval", "operator_boundary"]
23
23
  },
24
24
  "capability": { "type": "string", "minLength": 1 },
25
25
  "args": { "type": "object" },
@@ -293,6 +293,80 @@
293
293
  "max_response_bytes": { "type": "integer", "minimum": 1024, "maximum": 10485760 }
294
294
  }
295
295
  },
296
+ "http_security": {
297
+ "description": "Runner-only deployment security for networked MCP. Credential values remain in environment or secret-manager wiring and never enter portable contracts.",
298
+ "type": "object",
299
+ "additionalProperties": false,
300
+ "properties": {
301
+ "deployment": {
302
+ "description": "Trust topology. shared requires signed per-session http_claims identity; single_tenant may use one opaque service token.",
303
+ "enum": ["loopback", "single_tenant", "shared"]
304
+ },
305
+ "channel": {
306
+ "description": "How a remote listener is protected in transit. insecure_http_break_glass is unsafe and still requires authentication.",
307
+ "enum": ["direct_tls", "trusted_tls_proxy", "insecure_http_break_glass"]
308
+ },
309
+ "static_token": {
310
+ "description": "Environment-variable names for the current opaque endpoint token and at most one previous rotation token.",
311
+ "type": "object",
312
+ "additionalProperties": false,
313
+ "properties": {
314
+ "active_env": { "$ref": "#/$defs/env_name" },
315
+ "previous_env": { "$ref": "#/$defs/env_name" }
316
+ }
317
+ },
318
+ "oauth_resource": {
319
+ "description": "RFC 9728 metadata for Runner as an OAuth protected resource. The external authorization server issues tokens; Runner only verifies them.",
320
+ "type": "object",
321
+ "additionalProperties": false,
322
+ "required": ["resource", "authorization_servers"],
323
+ "properties": {
324
+ "resource": { "type": "string", "pattern": "^https://" },
325
+ "authorization_servers": {
326
+ "type": "array",
327
+ "minItems": 1,
328
+ "maxItems": 8,
329
+ "uniqueItems": true,
330
+ "items": { "type": "string", "pattern": "^https://" }
331
+ },
332
+ "scopes_supported": { "type": "array", "minItems": 1, "maxItems": 64, "uniqueItems": true, "items": { "$ref": "#/$defs/oauth_scope" } },
333
+ "required_scopes": { "type": "array", "minItems": 1, "maxItems": 64, "uniqueItems": true, "items": { "$ref": "#/$defs/oauth_scope" } },
334
+ "resource_name": { "type": "string", "minLength": 1, "maxLength": 128 },
335
+ "resource_documentation": { "type": "string", "pattern": "^https://" }
336
+ }
337
+ },
338
+ "allowed_origins": {
339
+ "description": "Exact browser origins accepted on HTTP MCP requests. Native clients may omit Origin. Wildcards are forbidden.",
340
+ "type": "array",
341
+ "maxItems": 32,
342
+ "uniqueItems": true,
343
+ "items": { "type": "string", "pattern": "^https?://[^/*]+(?::[0-9]+)?$" }
344
+ },
345
+ "allowed_hosts": {
346
+ "description": "Exact HTTP Host authorities accepted by the direct listener or trusted proxy. Forwarded host headers are never authority.",
347
+ "type": "array",
348
+ "minItems": 1,
349
+ "maxItems": 32,
350
+ "uniqueItems": true,
351
+ "items": { "type": "string", "minLength": 1, "maxLength": 255, "pattern": "^(?:\\[[0-9A-Fa-f:.]+\\]|[A-Za-z0-9.-]+)(?::[0-9]{1,5})?$" }
352
+ },
353
+ "limits": {
354
+ "description": "Bounded HTTP request, header, connection, and session resource limits.",
355
+ "type": "object",
356
+ "additionalProperties": false,
357
+ "properties": {
358
+ "max_request_bytes": { "type": "integer", "minimum": 1024, "maximum": 16777216 },
359
+ "max_header_bytes": { "type": "integer", "minimum": 4096, "maximum": 65536 },
360
+ "max_sessions": { "type": "integer", "minimum": 1, "maximum": 100000 },
361
+ "session_idle_timeout_seconds": { "type": "integer", "minimum": 10, "maximum": 86400 },
362
+ "request_timeout_ms": { "type": "integer", "minimum": 1000, "maximum": 300000 },
363
+ "headers_timeout_ms": { "type": "integer", "minimum": 1000, "maximum": 120000 },
364
+ "keep_alive_timeout_ms": { "type": "integer", "minimum": 1000, "maximum": 120000 },
365
+ "max_connections": { "type": "integer", "minimum": 1, "maximum": 100000 }
366
+ }
367
+ }
368
+ }
369
+ },
296
370
  "cloud": {
297
371
  "type": "object",
298
372
  "additionalProperties": false,
@@ -347,6 +421,12 @@
347
421
  "type": "string",
348
422
  "pattern": "^[A-Z_][A-Z0-9_]*$"
349
423
  },
424
+ "oauth_scope": {
425
+ "type": "string",
426
+ "minLength": 1,
427
+ "maxLength": 128,
428
+ "pattern": "^[!#-\\[\\]-~]+$"
429
+ },
350
430
  "identifier": {
351
431
  "type": "string",
352
432
  "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"