@synapsor/runner 0.1.0-alpha.11 → 0.1.0-alpha.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.
Files changed (32) hide show
  1. package/README.md +166 -23
  2. package/dist/cli.d.ts.map +1 -1
  3. package/dist/runner.mjs +855 -66
  4. package/docs/README.md +21 -0
  5. package/docs/app-owned-executors.md +5 -0
  6. package/docs/capability-authoring.md +265 -0
  7. package/docs/doctor.md +98 -0
  8. package/docs/handler-helper.md +200 -0
  9. package/docs/local-mode.md +13 -2
  10. package/docs/release-notes.md +47 -2
  11. package/docs/release-policy.md +86 -0
  12. package/docs/result-envelope-v2.md +148 -0
  13. package/docs/rfcs/001-result-envelope-v2.md +143 -0
  14. package/docs/rfcs/002-app-owned-handler-helper.md +161 -0
  15. package/docs/rfcs/003-integrator-feedback-teardown.md +97 -0
  16. package/docs/store-lifecycle.md +83 -0
  17. package/docs/writeback-executors.md +18 -0
  18. package/examples/app-owned-writeback/README.md +1 -0
  19. package/examples/mcp-postgres-billing-app-handler/README.md +6 -2
  20. package/examples/mcp-postgres-billing-app-handler/app-handler.mjs +77 -149
  21. package/examples/mcp-postgres-billing-app-handler/scripts/run-demo.sh +1 -0
  22. package/examples/mcp-postgres-billing-app-handler/synapsor-handler.mjs +437 -0
  23. package/examples/mcp-postgres-billing-app-handler/synapsor.runner.json +1 -0
  24. package/package.json +2 -1
  25. package/schemas/change-set.v1.schema.json +140 -0
  26. package/schemas/execution-receipt.v1.schema.json +34 -0
  27. package/schemas/onboarding-selection.v1.schema.json +125 -0
  28. package/schemas/runner-registration.v1.schema.json +48 -0
  29. package/schemas/synapsor.app-handler-receipt.v1.json +39 -0
  30. package/schemas/synapsor.app-handler-request.v1.json +119 -0
  31. package/schemas/synapsor.runner.schema.json +412 -0
  32. package/schemas/writeback-job.v1.schema.json +121 -0
@@ -0,0 +1,125 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schemas.synapsor.ai/runner/onboarding-selection.v1.schema.json",
4
+ "title": "Synapsor Runner onboarding selection",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["engine", "schema", "table", "primary_key", "namespace", "visible_columns"],
8
+ "properties": {
9
+ "version": { "const": 1 },
10
+ "engine": { "enum": ["postgres", "mysql"] },
11
+ "mode": { "enum": ["read_only", "shadow", "review"] },
12
+ "source_name": { "type": "string", "pattern": "^[A-Za-z_][A-Za-z0-9_]*$" },
13
+ "read_url_env": { "type": "string", "pattern": "^[A-Z_][A-Z0-9_]*$" },
14
+ "database_url_env": { "type": "string", "pattern": "^[A-Z_][A-Z0-9_]*$" },
15
+ "write_url_env": { "type": "string", "pattern": "^[A-Z_][A-Z0-9_]*$" },
16
+ "statement_timeout_ms": { "type": "integer", "minimum": 1 },
17
+ "schema": { "type": "string", "pattern": "^[A-Za-z_][A-Za-z0-9_]*$" },
18
+ "table": { "type": "string", "pattern": "^[A-Za-z_][A-Za-z0-9_]*$" },
19
+ "primary_key": { "type": "string", "pattern": "^[A-Za-z_][A-Za-z0-9_]*$" },
20
+ "tenant_key": { "type": "string", "pattern": "^[A-Za-z_][A-Za-z0-9_]*$" },
21
+ "single_tenant_dev": { "type": "boolean" },
22
+ "conflict_column": { "type": "string", "pattern": "^[A-Za-z_][A-Za-z0-9_]*$" },
23
+ "namespace": { "type": "string", "pattern": "^[A-Za-z_][A-Za-z0-9_]*$" },
24
+ "object_name": { "type": "string", "pattern": "^[A-Za-z_][A-Za-z0-9_]*$" },
25
+ "inspect_tool_name": { "type": "string", "pattern": "^[A-Za-z_][A-Za-z0-9_]*(\\.[A-Za-z_][A-Za-z0-9_]*)+$" },
26
+ "proposal_tool_name": { "type": "string", "pattern": "^[A-Za-z_][A-Za-z0-9_]*(\\.[A-Za-z_][A-Za-z0-9_]*)+$" },
27
+ "lookup_arg": { "type": "string", "pattern": "^[A-Za-z_][A-Za-z0-9_]*$" },
28
+ "visible_columns": {
29
+ "type": "array",
30
+ "items": { "type": "string", "pattern": "^[A-Za-z_][A-Za-z0-9_]*$" },
31
+ "minItems": 1,
32
+ "uniqueItems": true
33
+ },
34
+ "allowed_columns": {
35
+ "type": "array",
36
+ "items": { "type": "string", "pattern": "^[A-Za-z_][A-Za-z0-9_]*$" },
37
+ "uniqueItems": true
38
+ },
39
+ "patch": {
40
+ "type": "object",
41
+ "additionalProperties": {
42
+ "type": "object",
43
+ "additionalProperties": false,
44
+ "properties": {
45
+ "fixed": { "type": ["string", "number", "boolean", "null"] },
46
+ "from_arg": { "type": "string", "pattern": "^[A-Za-z_][A-Za-z0-9_]*$" }
47
+ },
48
+ "oneOf": [
49
+ { "required": ["fixed"] },
50
+ { "required": ["from_arg"] }
51
+ ]
52
+ }
53
+ },
54
+ "patch_args": {
55
+ "type": "object",
56
+ "additionalProperties": {
57
+ "type": "object",
58
+ "additionalProperties": false,
59
+ "properties": {
60
+ "type": { "enum": ["string", "number", "boolean"] },
61
+ "required": { "type": "boolean" },
62
+ "max_length": { "type": "integer", "minimum": 1 },
63
+ "minimum": { "type": "number" },
64
+ "maximum": { "type": "number" },
65
+ "enum": {
66
+ "type": "array",
67
+ "items": { "type": ["string", "number", "boolean", "null"] }
68
+ }
69
+ }
70
+ }
71
+ },
72
+ "numeric_bounds": {
73
+ "type": "object",
74
+ "additionalProperties": {
75
+ "type": "object",
76
+ "additionalProperties": false,
77
+ "minProperties": 1,
78
+ "properties": {
79
+ "minimum": { "type": "number" },
80
+ "maximum": { "type": "number" }
81
+ }
82
+ }
83
+ },
84
+ "transition_guards": {
85
+ "type": "object",
86
+ "additionalProperties": {
87
+ "type": "object",
88
+ "additionalProperties": false,
89
+ "required": ["allowed"],
90
+ "properties": {
91
+ "from_column": { "type": "string", "pattern": "^[A-Za-z_][A-Za-z0-9_]*$" },
92
+ "allowed": {
93
+ "type": "object",
94
+ "minProperties": 1,
95
+ "additionalProperties": {
96
+ "type": "array",
97
+ "items": { "type": "string", "minLength": 1 },
98
+ "minItems": 1,
99
+ "uniqueItems": true
100
+ }
101
+ }
102
+ }
103
+ }
104
+ },
105
+ "trusted_context": {
106
+ "type": "object",
107
+ "additionalProperties": false,
108
+ "properties": {
109
+ "tenant_id_env": { "type": "string", "pattern": "^[A-Z_][A-Z0-9_]*$" },
110
+ "principal_env": { "type": "string", "pattern": "^[A-Z_][A-Z0-9_]*$" }
111
+ }
112
+ },
113
+ "approval": {
114
+ "type": "object",
115
+ "additionalProperties": false,
116
+ "properties": {
117
+ "required_role": { "type": "string" }
118
+ }
119
+ }
120
+ },
121
+ "anyOf": [
122
+ { "required": ["tenant_key"] },
123
+ { "required": ["single_tenant_dev"] }
124
+ ]
125
+ }
@@ -0,0 +1,48 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schemas.synapsor.ai/synapsor.runner-registration.v1.schema.json",
4
+ "title": "Synapsor Runner Registration v1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "schema_version",
9
+ "runner_id",
10
+ "runner_version",
11
+ "engines",
12
+ "capabilities",
13
+ "scope",
14
+ "registered_at"
15
+ ],
16
+ "properties": {
17
+ "schema_version": { "const": "synapsor.runner-registration.v1" },
18
+ "runner_id": { "type": "string", "minLength": 1 },
19
+ "runner_version": { "type": "string", "minLength": 1 },
20
+ "engines": {
21
+ "type": "array",
22
+ "items": { "enum": ["postgres", "mysql"] },
23
+ "minItems": 1,
24
+ "uniqueItems": true
25
+ },
26
+ "capabilities": {
27
+ "type": "array",
28
+ "items": { "type": "string", "minLength": 1 },
29
+ "minItems": 1,
30
+ "uniqueItems": true
31
+ },
32
+ "scope": {
33
+ "type": "object",
34
+ "additionalProperties": false,
35
+ "required": ["project_id", "source_ids"],
36
+ "properties": {
37
+ "project_id": { "type": "string", "minLength": 1 },
38
+ "source_ids": {
39
+ "type": "array",
40
+ "items": { "type": "string", "minLength": 1 },
41
+ "minItems": 1,
42
+ "uniqueItems": true
43
+ }
44
+ }
45
+ },
46
+ "registered_at": { "type": "string", "format": "date-time" }
47
+ }
48
+ }
@@ -0,0 +1,39 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://synapsor.ai/schemas/synapsor.app-handler-receipt.v1.json",
4
+ "title": "Synapsor App-Owned Writeback Handler Receipt v1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["status", "rows_affected", "source_database_mutated"],
8
+ "properties": {
9
+ "status": {
10
+ "type": "string",
11
+ "enum": ["applied", "already_applied", "conflict", "failed"]
12
+ },
13
+ "rows_affected": {
14
+ "type": "integer",
15
+ "minimum": 0
16
+ },
17
+ "source_database_mutated": {
18
+ "type": "boolean"
19
+ },
20
+ "previous_version": {
21
+ "$ref": "#/$defs/scalar"
22
+ },
23
+ "new_version": {
24
+ "$ref": "#/$defs/scalar"
25
+ },
26
+ "safe_error_code": {
27
+ "type": ["string", "null"]
28
+ },
29
+ "details": {
30
+ "type": "object",
31
+ "additionalProperties": true
32
+ }
33
+ },
34
+ "$defs": {
35
+ "scalar": {
36
+ "type": ["string", "number", "boolean", "null"]
37
+ }
38
+ }
39
+ }
@@ -0,0 +1,119 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://synapsor.ai/schemas/synapsor.app-handler-request.v1.json",
4
+ "title": "Synapsor App-Owned Writeback Handler Request v1",
5
+ "type": "object",
6
+ "additionalProperties": true,
7
+ "required": ["proposal_id", "idempotency_key", "change_set"],
8
+ "properties": {
9
+ "protocol_version": {
10
+ "type": "string",
11
+ "enum": ["1.0"]
12
+ },
13
+ "schema_version": {
14
+ "type": "string",
15
+ "enum": ["synapsor.handler-writeback.v1"]
16
+ },
17
+ "proposal_id": {
18
+ "type": "string",
19
+ "minLength": 1
20
+ },
21
+ "idempotency_key": {
22
+ "type": "string",
23
+ "minLength": 1
24
+ },
25
+ "issued_at": {
26
+ "type": "string",
27
+ "format": "date-time"
28
+ },
29
+ "signature": {
30
+ "type": "string",
31
+ "pattern": "^sha256=[a-fA-F0-9]{64}$"
32
+ },
33
+ "change_set": {
34
+ "type": "object",
35
+ "additionalProperties": true,
36
+ "required": ["action", "scope", "target", "patch", "guards"],
37
+ "properties": {
38
+ "action": {
39
+ "type": "string",
40
+ "minLength": 1
41
+ },
42
+ "scope": {
43
+ "type": "object",
44
+ "additionalProperties": false,
45
+ "required": ["tenant_id", "object_id"],
46
+ "properties": {
47
+ "tenant_id": { "type": ["string", "number", "boolean"] },
48
+ "object_id": { "type": ["string", "number", "boolean"] }
49
+ }
50
+ },
51
+ "principal": {
52
+ "type": "object",
53
+ "additionalProperties": true,
54
+ "properties": {
55
+ "id": { "type": "string" }
56
+ }
57
+ },
58
+ "target": {
59
+ "type": "object",
60
+ "additionalProperties": false,
61
+ "required": ["schema", "table", "primary_key"],
62
+ "properties": {
63
+ "schema": { "$ref": "#/$defs/identifier" },
64
+ "table": { "$ref": "#/$defs/identifier" },
65
+ "primary_key": {
66
+ "type": "object",
67
+ "additionalProperties": false,
68
+ "required": ["column", "value"],
69
+ "properties": {
70
+ "column": { "$ref": "#/$defs/identifier" },
71
+ "value": { "$ref": "#/$defs/scalar" }
72
+ }
73
+ }
74
+ }
75
+ },
76
+ "patch": {
77
+ "type": "object",
78
+ "minProperties": 1,
79
+ "additionalProperties": { "$ref": "#/$defs/scalar" },
80
+ "propertyNames": { "$ref": "#/$defs/identifier" }
81
+ },
82
+ "guards": {
83
+ "type": "object",
84
+ "additionalProperties": true,
85
+ "required": ["tenant", "expected_version"],
86
+ "properties": {
87
+ "tenant": {
88
+ "type": "object",
89
+ "additionalProperties": false,
90
+ "required": ["column", "value"],
91
+ "properties": {
92
+ "column": { "$ref": "#/$defs/identifier" },
93
+ "value": { "$ref": "#/$defs/scalar" }
94
+ }
95
+ },
96
+ "expected_version": {
97
+ "type": "object",
98
+ "additionalProperties": false,
99
+ "required": ["column", "value"],
100
+ "properties": {
101
+ "column": { "$ref": "#/$defs/identifier" },
102
+ "value": { "$ref": "#/$defs/scalar" }
103
+ }
104
+ }
105
+ }
106
+ }
107
+ }
108
+ }
109
+ },
110
+ "$defs": {
111
+ "identifier": {
112
+ "type": "string",
113
+ "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
114
+ },
115
+ "scalar": {
116
+ "type": ["string", "number", "boolean", "null"]
117
+ }
118
+ }
119
+ }