@synapsor/runner 1.4.123 → 1.5.0

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 (59) hide show
  1. package/CHANGELOG.md +55 -19
  2. package/README.md +56 -46
  3. package/dist/cli.d.ts.map +1 -1
  4. package/dist/local-ui.d.ts.map +1 -1
  5. package/dist/runner.mjs +13848 -7752
  6. package/dist/runtime.d.ts +50 -0
  7. package/dist/runtime.d.ts.map +1 -0
  8. package/dist/runtime.mjs +15066 -0
  9. package/docs/README.md +19 -3
  10. package/docs/capability-authoring.md +1 -1
  11. package/docs/database-enforced-scope.md +273 -0
  12. package/docs/dependency-license-inventory.md +6 -2
  13. package/docs/doctor.md +17 -0
  14. package/docs/effect-regression.md +142 -0
  15. package/docs/getting-started-own-database.md +7 -0
  16. package/docs/local-mode.md +7 -3
  17. package/docs/mcp-apps.md +188 -0
  18. package/docs/mcp-audit.md +54 -0
  19. package/docs/mcp-client-setup.md +16 -4
  20. package/docs/mcp-clients.md +8 -0
  21. package/docs/production.md +8 -0
  22. package/docs/release-notes.md +51 -13
  23. package/docs/release-policy.md +9 -5
  24. package/docs/runner-config-reference.md +25 -0
  25. package/docs/schema-api-candidates.md +68 -0
  26. package/docs/security-boundary.md +10 -0
  27. package/docs/shadow-studies.md +198 -0
  28. package/examples/mcp-postgres-billing-app-handler/app-handler.mjs +9 -1
  29. package/examples/mcp-postgres-billing-app-handler/schema.sql +11 -0
  30. package/examples/mcp-postgres-billing-app-handler/synapsor-handler.mjs +3 -0
  31. package/examples/raw-sql-vs-synapsor/Makefile +2 -2
  32. package/examples/raw-sql-vs-synapsor/README.md +6 -4
  33. package/examples/support-billing-agent/Makefile +5 -1
  34. package/examples/support-billing-agent/README.md +39 -5
  35. package/examples/support-billing-agent/db/schema.sql +88 -1
  36. package/examples/support-billing-agent/db/seed.sql +15 -15
  37. package/examples/support-billing-agent/scripts/run-demo.sh +4 -0
  38. package/examples/support-billing-agent/scripts/run-evaluation.sh +62 -0
  39. package/examples/support-billing-agent/shadow-study/cases.jsonl +6 -0
  40. package/examples/support-billing-agent/shadow-study/outcomes.jsonl +2 -0
  41. package/examples/support-billing-agent/synapsor.runner.json +17 -5
  42. package/fixtures/effects/changed/eff_support_late_fee_v1.result.json +58 -0
  43. package/fixtures/effects/dataset.json +8 -0
  44. package/fixtures/effects/results/eff_support_late_fee_v1.result.json +59 -0
  45. package/fixtures/effects/support-late-fee.effect.json +71 -0
  46. package/fixtures/generators/drizzle/malicious.ts +11 -0
  47. package/fixtures/generators/drizzle/schema.ts +12 -0
  48. package/fixtures/generators/openapi/external-ref.yaml +15 -0
  49. package/fixtures/generators/openapi/openapi.yaml +81 -0
  50. package/fixtures/generators/prisma/schema.prisma +34 -0
  51. package/package.json +13 -2
  52. package/schemas/effect-dataset.schema.json +19 -0
  53. package/schemas/effect-fixture.schema.json +191 -0
  54. package/schemas/effect-result.schema.json +52 -0
  55. package/schemas/mcp-audit-candidates.schema.json +41 -0
  56. package/schemas/mcp-audit-report.schema.json +104 -0
  57. package/schemas/schema-candidate-review.schema.json +167 -0
  58. package/schemas/schema-candidates.schema.json +49 -0
  59. package/schemas/synapsor.runner.schema.json +51 -0
@@ -0,0 +1,52 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://synapsor.ai/schemas/effect-result.schema.json",
4
+ "title": "Synapsor imported effect result",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "schema_version",
9
+ "fixture_id",
10
+ "capability_calls",
11
+ "trusted_context",
12
+ "proposal",
13
+ "observed_fields",
14
+ "evidence",
15
+ "source_database_changed"
16
+ ],
17
+ "properties": {
18
+ "$schema": { "type": "string" },
19
+ "schema_version": { "const": "synapsor.effect-result.v1" },
20
+ "fixture_id": { "type": "string", "minLength": 1, "maxLength": 256 },
21
+ "capability_calls": {
22
+ "type": "array",
23
+ "maxItems": 100,
24
+ "items": {
25
+ "type": "object",
26
+ "additionalProperties": false,
27
+ "required": ["name"],
28
+ "properties": {
29
+ "name": { "type": "string", "minLength": 1, "maxLength": 256 },
30
+ "args": { "type": "object" }
31
+ }
32
+ }
33
+ },
34
+ "trusted_context": { "$ref": "effect-fixture.schema.json#/$defs/trusted_context" },
35
+ "proposal": { "$ref": "effect-fixture.schema.json#/$defs/proposal" },
36
+ "observed_fields": {
37
+ "type": "array",
38
+ "maxItems": 1000,
39
+ "items": { "type": "string", "minLength": 1, "maxLength": 256 }
40
+ },
41
+ "evidence": {
42
+ "type": "object",
43
+ "additionalProperties": false,
44
+ "required": ["mode", "new_source_reads"],
45
+ "properties": {
46
+ "mode": { "enum": ["fixture", "live"] },
47
+ "new_source_reads": { "type": "boolean" }
48
+ }
49
+ },
50
+ "source_database_changed": { "type": "boolean" }
51
+ }
52
+ }
@@ -0,0 +1,41 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://synapsor.ai/schemas/mcp-audit-candidates.schema.json",
4
+ "title": "Synapsor MCP Audit Candidate Directory Marker",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "schema_version",
9
+ "owner",
10
+ "source_digest",
11
+ "activation",
12
+ "deterministic",
13
+ "files"
14
+ ],
15
+ "properties": {
16
+ "schema_version": {
17
+ "const": "synapsor.audit-candidates.v1"
18
+ },
19
+ "owner": {
20
+ "const": "@synapsor/runner"
21
+ },
22
+ "source_digest": {
23
+ "type": "string",
24
+ "pattern": "^sha256:[a-f0-9]{64}$"
25
+ },
26
+ "activation": {
27
+ "const": "blocked_unreviewed"
28
+ },
29
+ "deterministic": {
30
+ "const": true
31
+ },
32
+ "files": {
33
+ "type": "array",
34
+ "minItems": 1,
35
+ "uniqueItems": true,
36
+ "items": {
37
+ "type": "string"
38
+ }
39
+ }
40
+ }
41
+ }
@@ -0,0 +1,104 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://synapsor.ai/schemas/mcp-audit-report.schema.json",
4
+ "title": "Synapsor MCP Audit Report",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "schema_version",
9
+ "target",
10
+ "disclaimer",
11
+ "generated_at",
12
+ "summary",
13
+ "findings"
14
+ ],
15
+ "properties": {
16
+ "schema_version": {
17
+ "const": "synapsor.mcp-audit.v1"
18
+ },
19
+ "target": {
20
+ "type": "string"
21
+ },
22
+ "disclaimer": {
23
+ "const": "This is a static risk review, not proof that an MCP server is secure."
24
+ },
25
+ "generated_at": {
26
+ "type": "string",
27
+ "format": "date-time"
28
+ },
29
+ "summary": {
30
+ "type": "object",
31
+ "additionalProperties": false,
32
+ "required": [
33
+ "tools_inspected",
34
+ "high",
35
+ "medium",
36
+ "low",
37
+ "total_findings"
38
+ ],
39
+ "properties": {
40
+ "tools_inspected": {
41
+ "type": "integer",
42
+ "minimum": 0
43
+ },
44
+ "high": {
45
+ "type": "integer",
46
+ "minimum": 0
47
+ },
48
+ "medium": {
49
+ "type": "integer",
50
+ "minimum": 0
51
+ },
52
+ "low": {
53
+ "type": "integer",
54
+ "minimum": 0
55
+ },
56
+ "total_findings": {
57
+ "type": "integer",
58
+ "minimum": 0
59
+ }
60
+ }
61
+ },
62
+ "findings": {
63
+ "type": "array",
64
+ "items": {
65
+ "type": "object",
66
+ "additionalProperties": false,
67
+ "required": [
68
+ "severity",
69
+ "code",
70
+ "message",
71
+ "evidence",
72
+ "recommendation"
73
+ ],
74
+ "properties": {
75
+ "severity": {
76
+ "enum": [
77
+ "HIGH",
78
+ "MEDIUM",
79
+ "LOW"
80
+ ]
81
+ },
82
+ "code": {
83
+ "type": "string"
84
+ },
85
+ "tool": {
86
+ "type": "string"
87
+ },
88
+ "message": {
89
+ "type": "string"
90
+ },
91
+ "evidence": {
92
+ "type": "array",
93
+ "items": {
94
+ "type": "string"
95
+ }
96
+ },
97
+ "recommendation": {
98
+ "type": "string"
99
+ }
100
+ }
101
+ }
102
+ }
103
+ }
104
+ }
@@ -0,0 +1,167 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://synapsor.ai/schemas/schema-candidate-review.schema.json",
4
+ "title": "Synapsor Schema/API Candidate Review",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "schema_version",
9
+ "format",
10
+ "source_digest",
11
+ "activation",
12
+ "summary",
13
+ "warnings",
14
+ "objects"
15
+ ],
16
+ "properties": {
17
+ "schema_version": {
18
+ "const": "synapsor.schema-candidates.v1"
19
+ },
20
+ "format": {
21
+ "enum": [
22
+ "prisma",
23
+ "drizzle",
24
+ "openapi"
25
+ ]
26
+ },
27
+ "source_digest": {
28
+ "type": "string",
29
+ "pattern": "^sha256:[a-f0-9]{64}$"
30
+ },
31
+ "activation": {
32
+ "const": "blocked_unreviewed"
33
+ },
34
+ "summary": {
35
+ "type": "object",
36
+ "additionalProperties": false,
37
+ "required": [
38
+ "objects",
39
+ "fields",
40
+ "capabilities",
41
+ "write_candidates"
42
+ ],
43
+ "properties": {
44
+ "objects": {
45
+ "type": "integer",
46
+ "minimum": 0
47
+ },
48
+ "fields": {
49
+ "type": "integer",
50
+ "minimum": 0
51
+ },
52
+ "capabilities": {
53
+ "type": "integer",
54
+ "minimum": 0
55
+ },
56
+ "write_candidates": {
57
+ "type": "integer",
58
+ "minimum": 0
59
+ }
60
+ }
61
+ },
62
+ "warnings": {
63
+ "type": "array",
64
+ "items": {
65
+ "type": "string"
66
+ }
67
+ },
68
+ "objects": {
69
+ "type": "array",
70
+ "items": {
71
+ "type": "object",
72
+ "additionalProperties": false,
73
+ "required": [
74
+ "name",
75
+ "table",
76
+ "structural_primary_key_candidates",
77
+ "potential_tenant_fields",
78
+ "potential_principal_fields",
79
+ "potential_conflict_fields",
80
+ "potentially_sensitive_fields",
81
+ "suggested_kept_out_fields",
82
+ "suggested_visible_fields",
83
+ "possible_actions",
84
+ "uncertain_assumptions",
85
+ "unsupported_or_dynamic"
86
+ ],
87
+ "properties": {
88
+ "name": {
89
+ "type": "string"
90
+ },
91
+ "table": {
92
+ "type": "string"
93
+ },
94
+ "structural_primary_key_candidates": {
95
+ "$ref": "#/$defs/stringArray"
96
+ },
97
+ "potential_tenant_fields": {
98
+ "$ref": "#/$defs/stringArray"
99
+ },
100
+ "potential_principal_fields": {
101
+ "$ref": "#/$defs/stringArray"
102
+ },
103
+ "potential_conflict_fields": {
104
+ "$ref": "#/$defs/stringArray"
105
+ },
106
+ "potentially_sensitive_fields": {
107
+ "$ref": "#/$defs/stringArray"
108
+ },
109
+ "suggested_kept_out_fields": {
110
+ "$ref": "#/$defs/stringArray"
111
+ },
112
+ "suggested_visible_fields": {
113
+ "$ref": "#/$defs/stringArray"
114
+ },
115
+ "possible_actions": {
116
+ "type": "array",
117
+ "items": {
118
+ "type": "object",
119
+ "additionalProperties": false,
120
+ "required": [
121
+ "name",
122
+ "kind",
123
+ "allowed_field_candidates",
124
+ "requires_business_logic",
125
+ "requires_app_owned_handler"
126
+ ],
127
+ "properties": {
128
+ "name": {
129
+ "type": "string"
130
+ },
131
+ "kind": {
132
+ "enum": [
133
+ "read",
134
+ "proposal"
135
+ ]
136
+ },
137
+ "allowed_field_candidates": {
138
+ "$ref": "#/$defs/stringArray"
139
+ },
140
+ "requires_business_logic": {
141
+ "type": "boolean"
142
+ },
143
+ "requires_app_owned_handler": {
144
+ "type": "boolean"
145
+ }
146
+ }
147
+ }
148
+ },
149
+ "uncertain_assumptions": {
150
+ "$ref": "#/$defs/stringArray"
151
+ },
152
+ "unsupported_or_dynamic": {
153
+ "$ref": "#/$defs/stringArray"
154
+ }
155
+ }
156
+ }
157
+ }
158
+ },
159
+ "$defs": {
160
+ "stringArray": {
161
+ "type": "array",
162
+ "items": {
163
+ "type": "string"
164
+ }
165
+ }
166
+ }
167
+ }
@@ -0,0 +1,49 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://synapsor.ai/schemas/schema-candidates.schema.json",
4
+ "title": "Synapsor Schema/API Candidate Directory Marker",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "schema_version",
9
+ "owner",
10
+ "format",
11
+ "source_digest",
12
+ "activation",
13
+ "deterministic",
14
+ "files"
15
+ ],
16
+ "properties": {
17
+ "schema_version": {
18
+ "const": "synapsor.schema-candidates.v1"
19
+ },
20
+ "owner": {
21
+ "const": "@synapsor/runner"
22
+ },
23
+ "format": {
24
+ "enum": [
25
+ "prisma",
26
+ "drizzle",
27
+ "openapi"
28
+ ]
29
+ },
30
+ "source_digest": {
31
+ "type": "string",
32
+ "pattern": "^sha256:[a-f0-9]{64}$"
33
+ },
34
+ "activation": {
35
+ "const": "blocked_unreviewed"
36
+ },
37
+ "deterministic": {
38
+ "const": true
39
+ },
40
+ "files": {
41
+ "type": "array",
42
+ "minItems": 1,
43
+ "uniqueItems": true,
44
+ "items": {
45
+ "type": "string"
46
+ }
47
+ }
48
+ }
49
+ }
@@ -394,6 +394,57 @@
394
394
  "queue_limit": { "type": "integer", "minimum": 0, "maximum": 100000 }
395
395
  }
396
396
  },
397
+ "database_scope": {
398
+ "description": "Database-side scope enforcement. application uses Runner predicates; postgres_rls also binds trusted context into transaction-local PostgreSQL settings and requires verified RLS policies.",
399
+ "oneOf": [
400
+ {
401
+ "type": "object",
402
+ "additionalProperties": false,
403
+ "required": ["mode"],
404
+ "properties": {
405
+ "mode": { "const": "application" }
406
+ }
407
+ },
408
+ {
409
+ "type": "object",
410
+ "additionalProperties": false,
411
+ "required": ["mode", "tenant_setting", "principal_setting"],
412
+ "properties": {
413
+ "mode": { "const": "postgres_rls" },
414
+ "tenant_setting": {
415
+ "type": "string",
416
+ "pattern": "^[A-Za-z_][A-Za-z0-9_]*(\\.[A-Za-z_][A-Za-z0-9_]*)+$"
417
+ },
418
+ "principal_setting": {
419
+ "type": "string",
420
+ "pattern": "^[A-Za-z_][A-Za-z0-9_]*(\\.[A-Za-z_][A-Za-z0-9_]*)+$"
421
+ }
422
+ }
423
+ }
424
+ ]
425
+ },
426
+ "credential_scope": {
427
+ "description": "Connection authority. tenant_resolver names an application-supplied resolver; it never embeds credentials.",
428
+ "oneOf": [
429
+ {
430
+ "type": "object",
431
+ "additionalProperties": false,
432
+ "required": ["mode"],
433
+ "properties": {
434
+ "mode": { "const": "shared" }
435
+ }
436
+ },
437
+ {
438
+ "type": "object",
439
+ "additionalProperties": false,
440
+ "required": ["mode", "resolver"],
441
+ "properties": {
442
+ "mode": { "const": "tenant_resolver" },
443
+ "resolver": { "$ref": "#/$defs/identifier" }
444
+ }
445
+ }
446
+ ]
447
+ },
397
448
  "receipts": {
398
449
  "type": "object",
399
450
  "additionalProperties": false,