@synapsor/runner 0.1.0-alpha.1 → 0.1.0-alpha.10

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 (44) hide show
  1. package/README.md +387 -19
  2. package/TRADEMARKS.md +23 -0
  3. package/dist/cli.d.ts +4 -0
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/cli.js +20 -8723
  6. package/dist/runner.mjs +12759 -0
  7. package/docs/README.md +36 -0
  8. package/docs/getting-started-own-database.md +460 -0
  9. package/docs/http-mcp.md +242 -0
  10. package/docs/limitations.md +95 -0
  11. package/docs/local-mode.md +351 -0
  12. package/docs/mcp-audit.md +152 -0
  13. package/docs/mcp-client-setup.md +231 -0
  14. package/docs/recipes.md +61 -0
  15. package/docs/release-notes.md +129 -0
  16. package/docs/security-boundary.md +94 -0
  17. package/docs/troubleshooting-first-run.md +248 -0
  18. package/docs/writeback-executors.md +209 -0
  19. package/examples/app-owned-writeback/README.md +120 -0
  20. package/examples/app-owned-writeback/business-actions.md +221 -0
  21. package/examples/app-owned-writeback/command-handler.mjs +46 -0
  22. package/examples/app-owned-writeback/node-fastify-handler.mjs +55 -0
  23. package/examples/app-owned-writeback/python-fastapi-handler.py +57 -0
  24. package/examples/dangerous-mcp-tools.json +88 -0
  25. package/examples/openai-agents-http/README.md +56 -0
  26. package/examples/openai-agents-http/agent.py +54 -0
  27. package/examples/openai-agents-http/requirements.txt +1 -0
  28. package/examples/openai-agents-stdio/README.md +62 -0
  29. package/examples/openai-agents-stdio/agent.py +70 -0
  30. package/examples/openai-agents-stdio/requirements.txt +1 -0
  31. package/examples/reference-support-billing-app/README.md +137 -0
  32. package/examples/reference-support-billing-app/docker-compose.yml +13 -0
  33. package/examples/reference-support-billing-app/mcp-client.generic.json +11 -0
  34. package/examples/reference-support-billing-app/schema.sql +68 -0
  35. package/examples/reference-support-billing-app/scripts/run-demo.sh +7 -0
  36. package/examples/reference-support-billing-app/seed.sql +33 -0
  37. package/examples/reference-support-billing-app/synapsor.runner.json +241 -0
  38. package/package.json +12 -4
  39. package/recipes/accounts.trial_extension.json +42 -0
  40. package/recipes/billing.late_fee_waiver.json +46 -0
  41. package/recipes/credits.account_credit.json +45 -0
  42. package/recipes/orders.refund_review.json +57 -0
  43. package/recipes/support.ticket_resolution.json +51 -0
  44. package/dist/bin.cjs +0 -13
@@ -0,0 +1,46 @@
1
+ {
2
+ "id": "billing.late_fee_waiver",
3
+ "title": "Late-fee waiver",
4
+ "summary": "Inspect one invoice and create a review-required proposal to waive a late fee.",
5
+ "expected_table_type": "invoice or billing table",
6
+ "required_columns": ["id", "tenant_id", "late_fee_cents", "waiver_reason", "updated_at"],
7
+ "recommended_primary_key": "id",
8
+ "recommended_tenant_key": "tenant_id",
9
+ "recommended_conflict_column": "updated_at",
10
+ "visible_columns": ["id", "tenant_id", "late_fee_cents", "waiver_reason", "status", "updated_at"],
11
+ "allowed_write_columns": ["late_fee_cents", "waiver_reason"],
12
+ "semantic_tools": ["billing.inspect_invoice", "billing.propose_late_fee_waiver"],
13
+ "notes": [
14
+ "Start against staging.",
15
+ "Keep the model-facing tool proposal-only.",
16
+ "Set a business-specific maximum waiver bound before real use."
17
+ ],
18
+ "spec": {
19
+ "version": 1,
20
+ "engine": "postgres",
21
+ "mode": "review",
22
+ "schema": "public",
23
+ "table": "invoices",
24
+ "primary_key": "id",
25
+ "tenant_key": "tenant_id",
26
+ "conflict_column": "updated_at",
27
+ "namespace": "billing",
28
+ "object_name": "invoice",
29
+ "inspect_tool_name": "billing.inspect_invoice",
30
+ "proposal_tool_name": "billing.propose_late_fee_waiver",
31
+ "lookup_arg": "invoice_id",
32
+ "visible_columns": ["id", "tenant_id", "late_fee_cents", "waiver_reason", "status", "updated_at"],
33
+ "allowed_columns": ["late_fee_cents", "waiver_reason"],
34
+ "patch": {
35
+ "late_fee_cents": { "fixed": 0 },
36
+ "waiver_reason": { "from_arg": "reason" }
37
+ },
38
+ "patch_args": {
39
+ "reason": { "type": "string", "required": true, "max_length": 500 }
40
+ },
41
+ "numeric_bounds": {
42
+ "late_fee_cents": { "minimum": 0, "maximum": 10000 }
43
+ },
44
+ "approval": { "required_role": "billing_lead" }
45
+ }
46
+ }
@@ -0,0 +1,45 @@
1
+ {
2
+ "id": "credits.account_credit",
3
+ "title": "Account credit",
4
+ "summary": "Inspect one account balance row and propose a bounded account credit.",
5
+ "expected_table_type": "account credits or balances table",
6
+ "required_columns": ["id", "tenant_id", "credit_cents", "credit_reason", "updated_at"],
7
+ "recommended_primary_key": "id",
8
+ "recommended_tenant_key": "tenant_id",
9
+ "recommended_conflict_column": "updated_at",
10
+ "visible_columns": ["id", "tenant_id", "credit_cents", "credit_reason", "updated_at"],
11
+ "allowed_write_columns": ["credit_cents", "credit_reason"],
12
+ "semantic_tools": ["credits.inspect_account_credit", "credits.propose_account_credit"],
13
+ "notes": [
14
+ "Configure the maximum credit bound before running against real data."
15
+ ],
16
+ "spec": {
17
+ "version": 1,
18
+ "engine": "postgres",
19
+ "mode": "review",
20
+ "schema": "public",
21
+ "table": "account_credits",
22
+ "primary_key": "id",
23
+ "tenant_key": "tenant_id",
24
+ "conflict_column": "updated_at",
25
+ "namespace": "credits",
26
+ "object_name": "account_credit",
27
+ "inspect_tool_name": "credits.inspect_account_credit",
28
+ "proposal_tool_name": "credits.propose_account_credit",
29
+ "lookup_arg": "credit_id",
30
+ "visible_columns": ["id", "tenant_id", "credit_cents", "credit_reason", "updated_at"],
31
+ "allowed_columns": ["credit_cents", "credit_reason"],
32
+ "patch": {
33
+ "credit_cents": { "from_arg": "credit_cents" },
34
+ "credit_reason": { "from_arg": "reason" }
35
+ },
36
+ "patch_args": {
37
+ "credit_cents": { "type": "number", "required": true, "minimum": 0, "maximum": 10000 },
38
+ "reason": { "type": "string", "required": true, "max_length": 500 }
39
+ },
40
+ "numeric_bounds": {
41
+ "credit_cents": { "minimum": 0, "maximum": 10000 }
42
+ },
43
+ "approval": { "required_role": "billing_lead" }
44
+ }
45
+ }
@@ -0,0 +1,57 @@
1
+ {
2
+ "id": "orders.refund_review",
3
+ "title": "Refund review",
4
+ "summary": "Inspect one order and propose a reviewed refund status update.",
5
+ "expected_table_type": "orders table",
6
+ "required_columns": ["id", "tenant_id", "status", "refund_cents", "refund_reason", "updated_at"],
7
+ "recommended_primary_key": "id",
8
+ "recommended_tenant_key": "tenant_id",
9
+ "recommended_conflict_column": "updated_at",
10
+ "visible_columns": ["id", "tenant_id", "status", "total_cents", "refund_cents", "refund_reason", "updated_at"],
11
+ "allowed_write_columns": ["status", "refund_cents", "refund_reason"],
12
+ "semantic_tools": ["orders.inspect_order", "orders.propose_refund_review"],
13
+ "notes": [
14
+ "Use numeric bounds that match your real refund policy.",
15
+ "Keep payment-provider execution outside MCP."
16
+ ],
17
+ "spec": {
18
+ "version": 1,
19
+ "engine": "mysql",
20
+ "mode": "review",
21
+ "schema": "app",
22
+ "table": "orders",
23
+ "primary_key": "id",
24
+ "tenant_key": "tenant_id",
25
+ "conflict_column": "updated_at",
26
+ "namespace": "orders",
27
+ "object_name": "order",
28
+ "inspect_tool_name": "orders.inspect_order",
29
+ "proposal_tool_name": "orders.propose_refund_review",
30
+ "lookup_arg": "order_id",
31
+ "visible_columns": ["id", "tenant_id", "status", "total_cents", "refund_cents", "refund_reason", "updated_at"],
32
+ "allowed_columns": ["status", "refund_cents", "refund_reason"],
33
+ "patch": {
34
+ "status": { "from_arg": "next_status" },
35
+ "refund_cents": { "from_arg": "refund_cents" },
36
+ "refund_reason": { "from_arg": "reason" }
37
+ },
38
+ "patch_args": {
39
+ "next_status": { "type": "string", "required": true, "enum": ["refund_requested", "refunded", "needs_review"] },
40
+ "refund_cents": { "type": "number", "required": true, "minimum": 0, "maximum": 100000 },
41
+ "reason": { "type": "string", "required": true, "max_length": 500 }
42
+ },
43
+ "numeric_bounds": {
44
+ "refund_cents": { "minimum": 0, "maximum": 100000 }
45
+ },
46
+ "transition_guards": {
47
+ "status": {
48
+ "allowed": {
49
+ "paid": ["refund_requested", "needs_review"],
50
+ "shipped": ["refund_requested", "needs_review"],
51
+ "refund_requested": ["refunded", "needs_review"]
52
+ }
53
+ }
54
+ },
55
+ "approval": { "required_role": "ops_lead" }
56
+ }
57
+ }
@@ -0,0 +1,51 @@
1
+ {
2
+ "id": "support.ticket_resolution",
3
+ "title": "Support ticket resolution",
4
+ "summary": "Inspect one support ticket and propose a reviewed status/resolution update.",
5
+ "expected_table_type": "support ticket table",
6
+ "required_columns": ["id", "tenant_id", "status", "resolution_note", "updated_at"],
7
+ "recommended_primary_key": "id",
8
+ "recommended_tenant_key": "tenant_id",
9
+ "recommended_conflict_column": "updated_at",
10
+ "visible_columns": ["id", "tenant_id", "subject", "status", "resolution_note", "updated_at"],
11
+ "allowed_write_columns": ["status", "resolution_note"],
12
+ "semantic_tools": ["support.inspect_ticket", "support.propose_ticket_resolution"],
13
+ "notes": [
14
+ "Use a safe view if ticket bodies contain sensitive data.",
15
+ "Keep status transitions explicit."
16
+ ],
17
+ "spec": {
18
+ "version": 1,
19
+ "engine": "postgres",
20
+ "mode": "review",
21
+ "schema": "public",
22
+ "table": "support_tickets",
23
+ "primary_key": "id",
24
+ "tenant_key": "tenant_id",
25
+ "conflict_column": "updated_at",
26
+ "namespace": "support",
27
+ "object_name": "ticket",
28
+ "inspect_tool_name": "support.inspect_ticket",
29
+ "proposal_tool_name": "support.propose_ticket_resolution",
30
+ "lookup_arg": "ticket_id",
31
+ "visible_columns": ["id", "tenant_id", "subject", "status", "resolution_note", "updated_at"],
32
+ "allowed_columns": ["status", "resolution_note"],
33
+ "patch": {
34
+ "status": { "from_arg": "next_status" },
35
+ "resolution_note": { "from_arg": "resolution_note" }
36
+ },
37
+ "patch_args": {
38
+ "next_status": { "type": "string", "required": true, "enum": ["pending_review", "resolved", "needs_human"] },
39
+ "resolution_note": { "type": "string", "required": true, "max_length": 1000 }
40
+ },
41
+ "transition_guards": {
42
+ "status": {
43
+ "allowed": {
44
+ "open": ["pending_review", "needs_human"],
45
+ "pending_review": ["resolved", "needs_human"]
46
+ }
47
+ }
48
+ },
49
+ "approval": { "required_role": "support_lead" }
50
+ }
51
+ }
package/dist/bin.cjs DELETED
@@ -1,13 +0,0 @@
1
- #!/usr/bin/env node
2
- const { spawnSync } = require('node:child_process');
3
- const { join } = require('node:path');
4
- const result = spawnSync(process.execPath, ['--no-warnings', join(__dirname, 'cli.js'), ...process.argv.slice(2)], {
5
- stdio: 'inherit',
6
- env: { ...process.env, NODE_NO_WARNINGS: '1', SYNAPSOR_RUNNER_COMMAND_NAME: 'synapsor-runner' },
7
- });
8
- if (result.error) {
9
- console.error(result.error);
10
- process.exit(1);
11
- }
12
- if (result.signal) process.kill(process.pid, result.signal);
13
- process.exit(result.status ?? 1);