@gmickel/gno 1.28.0 → 1.29.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 (143) hide show
  1. package/README.md +46 -20
  2. package/assets/skill/SKILL.md +33 -0
  3. package/browser-extension/artifacts/gno-browser-clipper-v1.29.0.zip +0 -0
  4. package/browser-extension/artifacts/gno-browser-clipper-v1.29.0.zip.sha256 +1 -0
  5. package/browser-extension/dist/chunk-b2zm0jjd.js +50 -0
  6. package/browser-extension/dist/manifest.json +1 -1
  7. package/browser-extension/dist/preview.html +1 -1
  8. package/browser-extension/dist/service-worker.js +6 -6
  9. package/package.json +1 -1
  10. package/spec/cli.md +41 -1
  11. package/spec/db/schema.sql +19 -0
  12. package/spec/mcp.md +66 -0
  13. package/spec/output-schemas/ask.schema.json +31 -1
  14. package/spec/output-schemas/browser-clip-preview.schema.json +30 -0
  15. package/spec/output-schemas/collection-egress-check.schema.json +91 -0
  16. package/spec/output-schemas/collection-egress-policy-set.schema.json +56 -0
  17. package/spec/output-schemas/collection-egress-policy.schema.json +41 -0
  18. package/spec/output-schemas/context-capsule-v1.schema.json +89 -2
  19. package/spec/output-schemas/context-capsule-verification.schema.json +1 -1
  20. package/spec/output-schemas/egress-audit-management.schema.json +88 -0
  21. package/spec/output-schemas/mcp-http-error.schema.json +113 -2
  22. package/spec/output-schemas/publish-artifact.schema.json +32 -0
  23. package/spec/output-schemas/record-import.schema.json +30 -0
  24. package/spec/output-schemas/retrieval-trace-common.schema.json +31 -0
  25. package/spec/output-schemas/retrieval-trace-export.schema.json +3 -0
  26. package/spec/output-schemas/retrieval-trace-qrels.schema.json +3 -0
  27. package/spec/output-schemas/retrieval-trace-summary.schema.json +4 -0
  28. package/spec/output-schemas/search-results.schema.json +30 -0
  29. package/src/app/context-runtime-contract.ts +16 -7
  30. package/src/cli/commands/ask.ts +7 -0
  31. package/src/cli/commands/collection/index.ts +5 -0
  32. package/src/cli/commands/collection/policy.ts +126 -0
  33. package/src/cli/commands/context-build.ts +5 -0
  34. package/src/cli/commands/daemon.ts +45 -3
  35. package/src/cli/commands/egress-audit.ts +68 -0
  36. package/src/cli/commands/embed.ts +2 -0
  37. package/src/cli/commands/query.ts +12 -0
  38. package/src/cli/commands/replay.ts +13 -3
  39. package/src/cli/commands/vsearch.ts +3 -1
  40. package/src/cli/program.ts +123 -0
  41. package/src/config/index.ts +9 -0
  42. package/src/config/types.ts +50 -0
  43. package/src/core/browser-clip.ts +16 -1
  44. package/src/core/collection-egress-policy-projection.ts +28 -0
  45. package/src/core/collection-egress-policy-service.ts +443 -0
  46. package/src/core/collection-egress-policy-validation.ts +242 -0
  47. package/src/core/config-mutation.ts +31 -19
  48. package/src/core/context-capsule-schema.ts +111 -1
  49. package/src/core/context-capsule-validation.ts +4 -4
  50. package/src/core/context-capsule-verification.ts +5 -1
  51. package/src/core/context-capsule.ts +177 -132
  52. package/src/core/context-evidence.ts +86 -14
  53. package/src/core/destination-classifier.ts +402 -0
  54. package/src/core/egress-audit.ts +239 -0
  55. package/src/core/egress-authorization.ts +50 -0
  56. package/src/core/egress-enforcement.ts +264 -0
  57. package/src/core/egress-policy.ts +440 -0
  58. package/src/core/egress-provenance.ts +336 -0
  59. package/src/core/job-manager.ts +37 -0
  60. package/src/core/network-boundary-inventory.ts +261 -0
  61. package/src/core/retrieval-qrels.ts +6 -0
  62. package/src/core/retrieval-replay.ts +18 -4
  63. package/src/core/retrieval-trace-export.ts +23 -4
  64. package/src/core/retrieval-trace-management-helpers.ts +1 -0
  65. package/src/core/retrieval-trace-management-types.ts +3 -0
  66. package/src/core/retrieval-trace-management.ts +9 -1
  67. package/src/core/retrieval-trace-session.ts +94 -0
  68. package/src/core/retrieval-trace.ts +22 -0
  69. package/src/ingestion/record-adapter.ts +12 -1
  70. package/src/ingestion/record-container.ts +38 -22
  71. package/src/ingestion/sync.ts +15 -0
  72. package/src/ingestion/types.ts +2 -0
  73. package/src/llm/errors.ts +10 -0
  74. package/src/llm/http-inference.ts +175 -0
  75. package/src/llm/http-policy.ts +537 -0
  76. package/src/llm/httpEmbedding.ts +47 -28
  77. package/src/llm/httpGeneration.ts +31 -18
  78. package/src/llm/httpRerank.ts +30 -18
  79. package/src/llm/index.ts +1 -0
  80. package/src/llm/nodeLlamaCpp/adapter.ts +55 -20
  81. package/src/llm/pinned-http-connection.ts +177 -0
  82. package/src/mcp/context.ts +53 -1
  83. package/src/mcp/http-egress.ts +220 -0
  84. package/src/mcp/http-security.ts +32 -21
  85. package/src/mcp/http-session.ts +13 -2
  86. package/src/mcp/http-transport.ts +96 -6
  87. package/src/mcp/sync-egress.ts +24 -0
  88. package/src/mcp/tools/add-collection.ts +4 -0
  89. package/src/mcp/tools/ask.ts +1 -1
  90. package/src/mcp/tools/context.ts +9 -2
  91. package/src/mcp/tools/egress.ts +247 -0
  92. package/src/mcp/tools/embed.ts +1 -0
  93. package/src/mcp/tools/index-cmd.ts +7 -0
  94. package/src/mcp/tools/index.ts +98 -0
  95. package/src/mcp/tools/query.ts +10 -0
  96. package/src/mcp/tools/remove-collection.ts +4 -0
  97. package/src/mcp/tools/sync.ts +6 -0
  98. package/src/mcp/tools/trace.ts +7 -1
  99. package/src/mcp/tools/vsearch.ts +1 -0
  100. package/src/pipeline/egress-lineage.ts +124 -0
  101. package/src/pipeline/hybrid.ts +14 -0
  102. package/src/pipeline/search.ts +12 -0
  103. package/src/pipeline/types.ts +3 -0
  104. package/src/pipeline/vsearch.ts +41 -20
  105. package/src/publish/artifact.ts +31 -3
  106. package/src/publish/export-service.ts +25 -0
  107. package/src/sdk/client.ts +119 -2
  108. package/src/sdk/embed.ts +1 -0
  109. package/src/sdk/types.ts +33 -0
  110. package/src/serve/clipper-capture.ts +5 -1
  111. package/src/serve/closed-json.ts +61 -0
  112. package/src/serve/config-sync.ts +4 -1
  113. package/src/serve/context.ts +1 -0
  114. package/src/serve/doc-events.ts +110 -39
  115. package/src/serve/public/components/CollectionEgressCheckPanel.tsx +411 -0
  116. package/src/serve/public/components/CollectionEgressPolicyEditor.tsx +78 -0
  117. package/src/serve/public/components/CollectionModelDialog.tsx +93 -9
  118. package/src/serve/public/components/EgressAuditPanel.tsx +278 -0
  119. package/src/serve/public/globals.built.css +1 -1
  120. package/src/serve/public/pages/Collections.tsx +3 -0
  121. package/src/serve/resident-request.ts +80 -3
  122. package/src/serve/resident-runtime.ts +63 -1
  123. package/src/serve/routes/api.ts +174 -0
  124. package/src/serve/routes/clipper.ts +64 -1
  125. package/src/serve/routes/mcp.ts +6 -0
  126. package/src/serve/routes/traces.ts +27 -4
  127. package/src/serve/server.ts +118 -7
  128. package/src/store/migrations/023-collection-egress-policy.ts +61 -0
  129. package/src/store/migrations/024-egress-derived-lineage.ts +121 -0
  130. package/src/store/migrations/025-collection-egress-policy-revision.ts +40 -0
  131. package/src/store/migrations/index.ts +6 -0
  132. package/src/store/retrieval-trace-codec.ts +15 -0
  133. package/src/store/sqlite/adapter.ts +170 -7
  134. package/src/store/sqlite/change-journal-store.ts +41 -2
  135. package/src/store/sqlite/egress-audit-store.ts +485 -0
  136. package/src/store/sqlite/retrieval-trace-management-store.ts +47 -6
  137. package/src/store/sqlite/retrieval-trace-retention.ts +2 -0
  138. package/src/store/sqlite/retrieval-trace-rows.ts +8 -1
  139. package/src/store/sqlite/retrieval-trace-store.ts +104 -5
  140. package/src/store/types.ts +126 -1
  141. package/browser-extension/artifacts/gno-browser-clipper-v1.28.0.zip +0 -0
  142. package/browser-extension/artifacts/gno-browser-clipper-v1.28.0.zip.sha256 +0 -1
  143. package/browser-extension/dist/chunk-vn5f663b.js +0 -50
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gmickel/gno",
3
- "version": "1.28.0",
3
+ "version": "1.29.0",
4
4
  "description": "Local semantic search for your documents. Index Markdown, PDF, and Office files with hybrid BM25 + vector search.",
5
5
  "keywords": [
6
6
  "embeddings",
package/spec/cli.md CHANGED
@@ -672,6 +672,44 @@ gno collection clear-embeddings <name> [--all] [--json]
672
672
 
673
673
  ---
674
674
 
675
+ ### gno collection policy
676
+
677
+ Inspect, change, or explain one collection-owned egress boundary.
678
+
679
+ ```bash
680
+ gno collection policy get <name>
681
+ gno collection policy set <name> <local_only|lan|remote> [--confirm-relaxation <current-revision>]
682
+ gno collection policy check --action <action> --destination <zone> --content-class <class> [-c <name>...] [--authenticated] [--authorized] [--partial] [--explain-egress]
683
+ ```
684
+
685
+ `get` returns the configured value, effective value, provenance source, and a
686
+ durable monotonic revision plus a diagnostic version fingerprint. Tightening is
687
+ immediate. Relaxation requires `--confirm-relaxation` with the exact current
688
+ numeric revision returned by `get`; stale, replayed, cross-collection, and
689
+ cross-target confirmation fails without changing config or the index
690
+ projection.
691
+ `check` and `--explain-egress` perform no action. They return the same
692
+ content-free decision, lineage, partial disclosure, audit metadata, and
693
+ remediation contract.
694
+
695
+ ### gno egress-audit
696
+
697
+ Manage local content-free policy decision receipts:
698
+
699
+ ```bash
700
+ gno egress-audit list [--limit <n>] [--cursor <cursor>]
701
+ gno egress-audit show <audit-id>
702
+ gno egress-audit status
703
+ gno egress-audit delete <audit-id>
704
+ gno egress-audit purge
705
+ ```
706
+
707
+ Pages are newest-first. Delete/purge report truthful SQLite physical cleanup
708
+ status. These local inspection and deletion commands never require a relaxed
709
+ collection policy.
710
+
711
+ ---
712
+
675
713
  ### gno embed
676
714
 
677
715
  Generate embeddings for indexed chunks.
@@ -3273,7 +3311,9 @@ is blocked.
3273
3311
  - Starts a headless `/mcp` Streamable HTTP listener; it does not serve the Web UI
3274
3312
  - Exposes the same safe REST lifecycle snapshot at `/api/resident/status`;
3275
3313
  resident-aware app status at `/api/status` is loopback-only because it
3276
- includes local index and configuration details
3314
+ includes local index and configuration details. Non-loopback resident status
3315
+ intersects exact Host/Origin and bearer authentication with the current
3316
+ peer zone and all participating collection policies before returning metadata
3277
3317
  - On `--detach`: forks a detached child with stdio redirected to `--log-file`, writes pid-file JSON including the MCP gateway `port`, prints `{pid}` on stdout, exits 0
3278
3318
  - On `--status`: output matches the [process-status schema](./output-schemas/process-status.schema.json), including the MCP gateway port and a best-effort copy of the live redacted resident snapshot
3279
3319
  - On `--stop`: SIGTERM → 10s poll → SIGKILL → 2s poll; the daemon's own signal handler unlinks the pid-file, `--stop` unlinks as fallback
@@ -49,6 +49,25 @@ CREATE TABLE IF NOT EXISTS collections (
49
49
  exclude TEXT, -- JSON array of patterns
50
50
  update_cmd TEXT,
51
51
  language_hint TEXT, -- BCP-47 or NULL
52
+ -- Migration 023 backfills existing rows as local_only/legacy_default.
53
+ -- Config sync without an explicit value remains local_only/config_default;
54
+ -- only explicit config may persist lan or remote.
55
+ egress_policy TEXT NOT NULL DEFAULT 'local_only'
56
+ CHECK (egress_policy IN ('local_only', 'lan', 'remote')),
57
+ egress_policy_source TEXT NOT NULL DEFAULT 'legacy_default'
58
+ CHECK (
59
+ egress_policy_source IN (
60
+ 'explicit',
61
+ 'config_default',
62
+ 'legacy_default'
63
+ )
64
+ )
65
+ CHECK (
66
+ egress_policy_source = 'explicit'
67
+ OR egress_policy = 'local_only'
68
+ ),
69
+ egress_policy_revision INTEGER NOT NULL DEFAULT 0
70
+ CHECK (egress_policy_revision >= 0),
52
71
  synced_at TEXT NOT NULL DEFAULT (datetime('now'))
53
72
  );
54
73
 
package/spec/mcp.md CHANGED
@@ -98,6 +98,26 @@ HTTP MCP remains read-only unless `gateway.enableWrite: true` or
98
98
  authorize mutation. Unauthorized calls to write tools fail with HTTP 403 before
99
99
  SDK dispatch.
100
100
 
101
+ Every `tools/call`, `resources/list`, `resources/templates/list`, and
102
+ `resources/read` request is also checked against the current socket peer zone
103
+ and the effective policy of every referenced collection before SDK dispatch.
104
+ The check is per request, including batch members and requests that reuse an
105
+ existing session; a session's original peer zone is never reused as authority.
106
+ Non-loopback access therefore requires both a valid bearer token and a
107
+ compatible collection policy. Policy denial returns HTTP 403 with stable
108
+ `EGRESS_DENIED` data and a redacted evaluator audit. Write authorization remains
109
+ an independent additional requirement.
110
+
111
+ The MCP tool and resource registry is paired with a callsite-level
112
+ network-boundary inventory. A TypeScript AST scan covers shipped TS, TSX, JS,
113
+ and JSX and recognizes direct, qualified, bracketed, imported, and aliased
114
+ fetch, EventSource, WebSocket, Bun listener/DNS/socket, HTTP inference, and
115
+ external-process primitives. Every detected invocation has its own stable
116
+ inventory key, so adding a second call in an already-listed file still fails
117
+ the contract test. Browser same-origin calls are classified as client
118
+ transport and name the server route that performs the actual egress check; the
119
+ client scan itself is not treated as content authorization.
120
+
101
121
  Boundary failures use the closed
102
122
  [`mcp-http-error`](./output-schemas/mcp-http-error.schema.json) body with stable,
103
123
  redacted statuses: 401 (authentication), 403 (peer/Host/Origin/write), 413
@@ -2346,6 +2366,52 @@ MCP Server Status
2346
2366
 
2347
2367
  ---
2348
2368
 
2369
+ ## Collection Egress Policy and Audit Tools
2370
+
2371
+ Read tools:
2372
+
2373
+ - `gno_egress_policy_get { collection }` returns configured/effective policy,
2374
+ provenance source, current monotonic revision, and diagnostic version.
2375
+ - `gno_egress_check` accepts exact collection scope, action, destination zone,
2376
+ caller authentication/authorization, content class, and partial mode. It
2377
+ performs no action and returns the canonical decision/explanation contract.
2378
+ An explicit scope is a non-empty, duplicate-free list of at most 64 canonical
2379
+ collection names; omitted scope means all configured collections.
2380
+ - `gno_egress_audit_list`, `gno_egress_audit_show`, and
2381
+ `gno_egress_audit_status` expose only content-free local receipts.
2382
+
2383
+ Write-enabled tools:
2384
+
2385
+ - `gno_egress_policy_set` requires confirmation
2386
+ `{ collection, currentPolicy, currentRevision, targetPolicy, acknowledged: true }`
2387
+ for relaxation. The revision is durable and one-use; replayed, stale,
2388
+ cross-collection, and cross-target confirmations fail closed.
2389
+ - `gno_egress_audit_delete` deletes exactly one receipt.
2390
+ - `gno_egress_audit_purge { confirm: true }` deletes only audit receipts.
2391
+
2392
+ Policy does not replace transport authentication or `enableWrite`. Local audit
2393
+ inspection remains available when outbound content is denied. Retrieval-trace
2394
+ export resolves exact trace lineage and checks policy before creating or
2395
+ reusing an export receipt; missing traces return `NOT_FOUND` before policy
2396
+ evaluation.
2397
+
2398
+ All collection-policy and audit tool inputs are closed objects. Unknown
2399
+ top-level fields are rejected by MCP input validation before any handler,
2400
+ mutation, invalidation, or audit operation runs.
2401
+
2402
+ Active resident requests retain their admission authorization epoch. A policy
2403
+ mutation may advance its own request to the new epoch, but older REST and MCP
2404
+ responses are replaced by a content-free `EGRESS_POLICY_CHANGED` retry
2405
+ response/event before protected bytes are emitted, including streaming
2406
+ responses. `/api/events` binds each SSE subscriber to its admission epoch and
2407
+ rechecks it before every document event and heartbeat; a stale subscriber
2408
+ receives only the retry event and is then unsubscribed.
2409
+
2410
+ Schemas: `collection-egress-policy.schema.json`,
2411
+ `collection-egress-policy-set.schema.json`,
2412
+ `collection-egress-check.schema.json`, and
2413
+ `egress-audit-management.schema.json`.
2414
+
2349
2415
  ## See Also
2350
2416
 
2351
2417
  - [CLI Specification](./cli.md)
@@ -95,6 +95,35 @@
95
95
  }
96
96
  ],
97
97
  "$defs": {
98
+ "egressLineage": {
99
+ "type": "object",
100
+ "additionalProperties": false,
101
+ "required": ["effectivePolicy", "digest", "sources"],
102
+ "properties": {
103
+ "effectivePolicy": { "enum": ["local_only", "lan", "remote"] },
104
+ "digest": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
105
+ "sources": {
106
+ "type": "array",
107
+ "minItems": 1,
108
+ "maxItems": 128,
109
+ "items": {
110
+ "type": "object",
111
+ "additionalProperties": false,
112
+ "required": ["collection", "policy", "source"],
113
+ "properties": {
114
+ "collection": {
115
+ "type": "string",
116
+ "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
117
+ },
118
+ "policy": { "enum": ["local_only", "lan", "remote"] },
119
+ "source": {
120
+ "enum": ["explicit", "config_default", "legacy_default"]
121
+ }
122
+ }
123
+ }
124
+ }
125
+ }
126
+ },
98
127
  "searchResult": {
99
128
  "type": "object",
100
129
  "required": ["docid", "score", "uri", "snippet", "source"],
@@ -127,6 +156,7 @@
127
156
  "type": "string",
128
157
  "description": "Resolved user-configured retrieval guidance, ordered from global to collection to matching path prefixes"
129
158
  },
159
+ "egressLineage": { "$ref": "#/$defs/egressLineage" },
130
160
  "snippet": {
131
161
  "type": "string",
132
162
  "description": "Matching text snippet from document mirror"
@@ -431,7 +461,7 @@
431
461
  "schemaVersion": { "const": "1.0" },
432
462
  "mode": { "const": "closed_capsule" },
433
463
  "capsule": {
434
- "$ref": "gno://schemas/context-capsule-v1@1.0"
464
+ "$ref": "gno://schemas/context-capsule-v1@1.1"
435
465
  },
436
466
  "freshness": {
437
467
  "$ref": "gno://schemas/context-capsule-verification@1.0"
@@ -18,6 +18,7 @@
18
18
  "destination": {
19
19
  "$ref": "gno://schemas/browser-clip@1.0#/properties/destination"
20
20
  },
21
+ "egressLineage": { "$ref": "#/definitions/egressLineage" },
21
22
  "tags": {
22
23
  "type": "array",
23
24
  "items": { "type": "string" }
@@ -48,6 +49,35 @@
48
49
  }
49
50
  },
50
51
  "definitions": {
52
+ "egressLineage": {
53
+ "type": "object",
54
+ "additionalProperties": false,
55
+ "required": ["effectivePolicy", "digest", "sources"],
56
+ "properties": {
57
+ "effectivePolicy": { "enum": ["local_only", "lan", "remote"] },
58
+ "digest": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
59
+ "sources": {
60
+ "type": "array",
61
+ "minItems": 1,
62
+ "uniqueItems": true,
63
+ "items": {
64
+ "type": "object",
65
+ "additionalProperties": false,
66
+ "required": ["collection", "policy", "source"],
67
+ "properties": {
68
+ "collection": {
69
+ "type": "string",
70
+ "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
71
+ },
72
+ "policy": { "enum": ["local_only", "lan", "remote"] },
73
+ "source": {
74
+ "enum": ["explicit", "config_default", "legacy_default"]
75
+ }
76
+ }
77
+ }
78
+ }
79
+ }
80
+ },
51
81
  "source": {
52
82
  "type": "object",
53
83
  "additionalProperties": false,
@@ -0,0 +1,91 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://gno.sh/schemas/collection-egress-check.schema.json",
4
+ "title": "Collection egress check and explanation",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "schemaVersion",
9
+ "mode",
10
+ "allowedCollections",
11
+ "omittedCollections",
12
+ "disclosure",
13
+ "lineage",
14
+ "decision",
15
+ "remediation"
16
+ ],
17
+ "properties": {
18
+ "schemaVersion": { "const": "1.0" },
19
+ "mode": { "enum": ["complete", "partial", "denied"] },
20
+ "allowedCollections": {
21
+ "type": "array",
22
+ "items": { "type": "string" },
23
+ "uniqueItems": true
24
+ },
25
+ "omittedCollections": {
26
+ "type": "array",
27
+ "items": {
28
+ "type": "object",
29
+ "additionalProperties": false,
30
+ "required": ["collection", "reason"],
31
+ "properties": {
32
+ "collection": { "type": "string" },
33
+ "reason": { "type": "string" }
34
+ }
35
+ }
36
+ },
37
+ "disclosure": {
38
+ "oneOf": [
39
+ { "type": "null" },
40
+ {
41
+ "type": "object",
42
+ "additionalProperties": false,
43
+ "required": ["code", "omittedCount", "omittedCollections"],
44
+ "properties": {
45
+ "code": { "const": "EGRESS_PARTIAL_RESULT" },
46
+ "omittedCount": { "type": "integer", "minimum": 1 },
47
+ "omittedCollections": {
48
+ "type": "array",
49
+ "items": { "type": "string" },
50
+ "minItems": 1,
51
+ "uniqueItems": true
52
+ }
53
+ }
54
+ }
55
+ ]
56
+ },
57
+ "lineage": {
58
+ "type": "object",
59
+ "required": ["effectivePolicy", "digest", "sources"],
60
+ "properties": {
61
+ "effectivePolicy": { "enum": ["local_only", "lan", "remote"] },
62
+ "digest": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
63
+ "sources": { "type": "array", "minItems": 1 }
64
+ }
65
+ },
66
+ "decision": {
67
+ "type": "object",
68
+ "required": ["allowed", "code", "reason", "audit"],
69
+ "properties": {
70
+ "allowed": { "type": "boolean" },
71
+ "code": { "enum": ["EGRESS_ALLOWED", "EGRESS_DENIED"] },
72
+ "reason": { "type": "string" },
73
+ "audit": { "type": "object" }
74
+ }
75
+ },
76
+ "remediation": {
77
+ "oneOf": [
78
+ { "type": "null" },
79
+ {
80
+ "type": "object",
81
+ "additionalProperties": false,
82
+ "required": ["code", "message"],
83
+ "properties": {
84
+ "code": { "type": "string" },
85
+ "message": { "type": "string", "minLength": 1 }
86
+ }
87
+ }
88
+ ]
89
+ }
90
+ }
91
+ }
@@ -0,0 +1,56 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://gno.sh/schemas/collection-egress-policy-set.schema.json",
4
+ "title": "Collection egress policy mutation",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "schemaVersion",
9
+ "previous",
10
+ "current",
11
+ "change",
12
+ "invalidation"
13
+ ],
14
+ "properties": {
15
+ "schemaVersion": { "const": "1.0" },
16
+ "previous": {
17
+ "$ref": "collection-egress-policy.schema.json"
18
+ },
19
+ "current": {
20
+ "$ref": "collection-egress-policy.schema.json"
21
+ },
22
+ "change": {
23
+ "enum": ["tightened", "relaxed", "source_changed", "unchanged"]
24
+ },
25
+ "invalidation": {
26
+ "oneOf": [
27
+ { "type": "null" },
28
+ {
29
+ "type": "object",
30
+ "additionalProperties": false,
31
+ "required": [
32
+ "policyEpoch",
33
+ "queuedJobsInvalidated",
34
+ "sessionsInvalidated",
35
+ "staleWorkMustRetry"
36
+ ],
37
+ "properties": {
38
+ "policyEpoch": {
39
+ "type": "string",
40
+ "pattern": "^egress-epoch-v1:[a-f0-9]{64}$"
41
+ },
42
+ "queuedJobsInvalidated": {
43
+ "type": "integer",
44
+ "minimum": 0
45
+ },
46
+ "sessionsInvalidated": {
47
+ "type": "integer",
48
+ "minimum": 0
49
+ },
50
+ "staleWorkMustRetry": { "const": true }
51
+ }
52
+ }
53
+ ]
54
+ }
55
+ }
56
+ }
@@ -0,0 +1,41 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://gno.sh/schemas/collection-egress-policy.schema.json",
4
+ "title": "Collection egress policy state",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "schemaVersion",
9
+ "collection",
10
+ "configuredPolicy",
11
+ "effectivePolicy",
12
+ "source",
13
+ "revision",
14
+ "version"
15
+ ],
16
+ "properties": {
17
+ "schemaVersion": { "const": "1.0" },
18
+ "collection": {
19
+ "type": "string",
20
+ "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
21
+ },
22
+ "configuredPolicy": {
23
+ "type": ["string", "null"],
24
+ "enum": ["local_only", "lan", "remote", null]
25
+ },
26
+ "effectivePolicy": {
27
+ "enum": ["local_only", "lan", "remote"]
28
+ },
29
+ "source": {
30
+ "enum": ["explicit", "config_default"]
31
+ },
32
+ "revision": {
33
+ "type": "integer",
34
+ "minimum": 0
35
+ },
36
+ "version": {
37
+ "type": "string",
38
+ "pattern": "^egress-policy-v1:[a-f0-9]{64}$"
39
+ }
40
+ }
41
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "gno://schemas/context-capsule-v1@1.0",
3
+ "$id": "gno://schemas/context-capsule-v1@1.1",
4
4
  "title": "GNO Context Capsule V1",
5
5
  "description": "Deterministic, extractive evidence compiled under one canonical JSON budget.",
6
6
  "type": "object",
@@ -25,6 +25,65 @@
25
25
  "capsuleId"
26
26
  ],
27
27
  "allOf": [
28
+ {
29
+ "if": {
30
+ "properties": { "schemaVersion": { "const": "1.1" } },
31
+ "required": ["schemaVersion"]
32
+ },
33
+ "then": {
34
+ "required": ["egressLineage"],
35
+ "properties": {
36
+ "egressLineage": { "$ref": "#/definitions/egressLineage" },
37
+ "evidence": {
38
+ "type": "array",
39
+ "items": {
40
+ "allOf": [
41
+ { "$ref": "#/definitions/evidence" },
42
+ {
43
+ "type": "object",
44
+ "required": ["egressLineage"],
45
+ "properties": {
46
+ "egressLineage": {
47
+ "$ref": "#/definitions/egressLineage"
48
+ }
49
+ }
50
+ }
51
+ ]
52
+ }
53
+ }
54
+ }
55
+ },
56
+ "else": {
57
+ "not": {
58
+ "type": "object",
59
+ "required": ["egressLineage"],
60
+ "properties": {
61
+ "egressLineage": { "$ref": "#/definitions/egressLineage" }
62
+ }
63
+ },
64
+ "properties": {
65
+ "evidence": {
66
+ "type": "array",
67
+ "items": {
68
+ "allOf": [
69
+ { "$ref": "#/definitions/evidence" },
70
+ {
71
+ "not": {
72
+ "type": "object",
73
+ "required": ["egressLineage"],
74
+ "properties": {
75
+ "egressLineage": {
76
+ "$ref": "#/definitions/egressLineage"
77
+ }
78
+ }
79
+ }
80
+ }
81
+ ]
82
+ }
83
+ }
84
+ }
85
+ }
86
+ },
28
87
  {
29
88
  "if": {
30
89
  "properties": {
@@ -84,9 +143,10 @@
84
143
  }
85
144
  ],
86
145
  "properties": {
87
- "schemaVersion": { "const": "1.0" },
146
+ "schemaVersion": { "enum": ["1.0", "1.1"] },
88
147
  "coordinateSpace": { "const": "canonical_mirror" },
89
148
  "capsuleId": { "$ref": "#/definitions/sha256" },
149
+ "egressLineage": { "$ref": "#/definitions/egressLineage" },
90
150
  "goal": { "type": "string", "minLength": 1, "maxLength": 16384 },
91
151
  "query": { "type": "string", "minLength": 1, "maxLength": 16384 },
92
152
  "scope": {
@@ -446,6 +506,32 @@
446
506
  "maxLength": 64,
447
507
  "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
448
508
  },
509
+ "egressLineage": {
510
+ "type": "object",
511
+ "additionalProperties": false,
512
+ "required": ["effectivePolicy", "digest", "sources"],
513
+ "properties": {
514
+ "effectivePolicy": { "enum": ["local_only", "lan", "remote"] },
515
+ "digest": { "$ref": "#/definitions/sha256" },
516
+ "sources": {
517
+ "type": "array",
518
+ "minItems": 1,
519
+ "maxItems": 128,
520
+ "items": {
521
+ "type": "object",
522
+ "additionalProperties": false,
523
+ "required": ["collection", "policy", "source"],
524
+ "properties": {
525
+ "collection": { "$ref": "#/definitions/collection" },
526
+ "policy": { "enum": ["local_only", "lan", "remote"] },
527
+ "source": {
528
+ "enum": ["explicit", "config_default", "legacy_default"]
529
+ }
530
+ }
531
+ }
532
+ }
533
+ }
534
+ },
449
535
  "filterValues": {
450
536
  "type": "array",
451
537
  "maxItems": 128,
@@ -670,6 +756,7 @@
670
756
  "egress": {
671
757
  "enum": ["local_only", "lan", "remote", "unclassified", "unavailable"]
672
758
  },
759
+ "egressLineage": { "$ref": "#/definitions/egressLineage" },
673
760
  "record": { "$ref": "#/definitions/recordEvidenceMetadata" }
674
761
  }
675
762
  },
@@ -21,7 +21,7 @@
21
21
  "evidence"
22
22
  ],
23
23
  "properties": {
24
- "schemaVersion": { "const": "1.0" },
24
+ "schemaVersion": { "enum": ["1.0", "1.1"] },
25
25
  "coordinateSpace": { "const": "canonical_mirror" },
26
26
  "capsuleId": { "$ref": "#/definitions/sha256" },
27
27
  "operationStatus": { "const": "completed" },