@gmickel/gno 1.27.1 → 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 (195) hide show
  1. package/README.md +46 -20
  2. package/assets/skill/SKILL.md +59 -1
  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 +2 -2
  10. package/spec/cli.md +82 -5
  11. package/spec/db/schema.sql +31 -0
  12. package/spec/mcp.md +71 -0
  13. package/spec/output-schemas/ask.schema.json +156 -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 +183 -3
  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/get.schema.json +94 -0
  22. package/spec/output-schemas/mcp-http-error.schema.json +113 -2
  23. package/spec/output-schemas/mcp-job-status.schema.json +28 -0
  24. package/spec/output-schemas/multi-get.schema.json +128 -0
  25. package/spec/output-schemas/publish-artifact.schema.json +32 -0
  26. package/spec/output-schemas/record-import.schema.json +223 -0
  27. package/spec/output-schemas/retrieval-trace-common.schema.json +31 -0
  28. package/spec/output-schemas/retrieval-trace-export.schema.json +3 -0
  29. package/spec/output-schemas/retrieval-trace-qrels.schema.json +3 -0
  30. package/spec/output-schemas/retrieval-trace-summary.schema.json +4 -0
  31. package/spec/output-schemas/search-result.schema.json +94 -0
  32. package/spec/output-schemas/search-results.schema.json +155 -0
  33. package/spec/project-profile.schema.json +66 -0
  34. package/src/app/context-format.ts +1 -1
  35. package/src/app/context-runtime-contract.ts +16 -7
  36. package/src/cli/commands/ask.ts +7 -0
  37. package/src/cli/commands/collection/index.ts +5 -0
  38. package/src/cli/commands/collection/policy.ts +126 -0
  39. package/src/cli/commands/context-build.ts +5 -0
  40. package/src/cli/commands/daemon.ts +45 -3
  41. package/src/cli/commands/egress-audit.ts +68 -0
  42. package/src/cli/commands/embed.ts +2 -0
  43. package/src/cli/commands/get.ts +12 -2
  44. package/src/cli/commands/index-cmd.ts +13 -0
  45. package/src/cli/commands/multi-get.ts +9 -2
  46. package/src/cli/commands/query.ts +12 -0
  47. package/src/cli/commands/replay.ts +13 -3
  48. package/src/cli/commands/shared.ts +28 -0
  49. package/src/cli/commands/update.ts +5 -0
  50. package/src/cli/commands/vsearch.ts +3 -1
  51. package/src/cli/program.ts +127 -0
  52. package/src/config/index.ts +9 -0
  53. package/src/config/project-profile.ts +2 -0
  54. package/src/config/types.ts +66 -0
  55. package/src/converters/adapters/browser-export/adapter.ts +199 -0
  56. package/src/converters/adapters/browser-export/formats.ts +358 -0
  57. package/src/converters/adapters/email/adapter.ts +429 -0
  58. package/src/converters/adapters/email/html.ts +162 -0
  59. package/src/converters/adapters/email/mime.ts +454 -0
  60. package/src/converters/adapters/email/parameters.ts +77 -0
  61. package/src/converters/adapters/ical/adapter.ts +475 -0
  62. package/src/converters/adapters/ical/recurrence.ts +186 -0
  63. package/src/converters/adapters/jsonl/adapter.ts +238 -0
  64. package/src/converters/adapters/jsonl/config.ts +105 -0
  65. package/src/converters/adapters/shared/html-text.ts +165 -0
  66. package/src/converters/adapters/shared/record-utils.ts +79 -0
  67. package/src/converters/adapters/shared/utf8-lines.ts +141 -0
  68. package/src/converters/adapters/transcript/adapter.ts +295 -0
  69. package/src/converters/adapters/transcript/json.ts +184 -0
  70. package/src/converters/adapters/transcript/model.ts +171 -0
  71. package/src/converters/adapters/transcript/text.ts +58 -0
  72. package/src/converters/adapters/transcript/timed.ts +152 -0
  73. package/src/converters/index.ts +11 -1
  74. package/src/converters/mime.ts +8 -0
  75. package/src/converters/pipeline.ts +15 -1
  76. package/src/converters/registry.ts +37 -1
  77. package/src/converters/types.ts +136 -0
  78. package/src/core/browser-clip.ts +16 -1
  79. package/src/core/collection-egress-policy-projection.ts +28 -0
  80. package/src/core/collection-egress-policy-service.ts +443 -0
  81. package/src/core/collection-egress-policy-validation.ts +242 -0
  82. package/src/core/config-mutation.ts +31 -19
  83. package/src/core/context-capsule-schema.ts +198 -1
  84. package/src/core/context-capsule-validation.ts +4 -4
  85. package/src/core/context-capsule-verification.ts +5 -1
  86. package/src/core/context-capsule.ts +177 -112
  87. package/src/core/context-evidence.ts +93 -15
  88. package/src/core/destination-classifier.ts +402 -0
  89. package/src/core/document-capabilities.ts +12 -0
  90. package/src/core/egress-audit.ts +239 -0
  91. package/src/core/egress-authorization.ts +50 -0
  92. package/src/core/egress-enforcement.ts +264 -0
  93. package/src/core/egress-policy.ts +440 -0
  94. package/src/core/egress-provenance.ts +336 -0
  95. package/src/core/job-manager.ts +37 -0
  96. package/src/core/network-boundary-inventory.ts +261 -0
  97. package/src/core/project-profile-apply-state.ts +5 -0
  98. package/src/core/project-profile.ts +4 -0
  99. package/src/core/record-metadata.ts +49 -0
  100. package/src/core/retrieval-qrels.ts +6 -0
  101. package/src/core/retrieval-replay.ts +18 -4
  102. package/src/core/retrieval-trace-export.ts +23 -4
  103. package/src/core/retrieval-trace-management-helpers.ts +1 -0
  104. package/src/core/retrieval-trace-management-types.ts +3 -0
  105. package/src/core/retrieval-trace-management.ts +9 -1
  106. package/src/core/retrieval-trace-session.ts +94 -0
  107. package/src/core/retrieval-trace.ts +22 -0
  108. package/src/ingestion/record-adapter-canonical.ts +433 -0
  109. package/src/ingestion/record-adapter.ts +448 -0
  110. package/src/ingestion/record-container.ts +704 -0
  111. package/src/ingestion/record-path.ts +20 -0
  112. package/src/ingestion/record-sync.ts +70 -0
  113. package/src/ingestion/sync.ts +243 -36
  114. package/src/ingestion/types.ts +71 -1
  115. package/src/ingestion/walker.ts +31 -11
  116. package/src/llm/errors.ts +10 -0
  117. package/src/llm/http-inference.ts +175 -0
  118. package/src/llm/http-policy.ts +537 -0
  119. package/src/llm/httpEmbedding.ts +47 -28
  120. package/src/llm/httpGeneration.ts +31 -18
  121. package/src/llm/httpRerank.ts +30 -18
  122. package/src/llm/index.ts +1 -0
  123. package/src/llm/nodeLlamaCpp/adapter.ts +55 -20
  124. package/src/llm/pinned-http-connection.ts +177 -0
  125. package/src/mcp/context.ts +53 -1
  126. package/src/mcp/http-egress.ts +220 -0
  127. package/src/mcp/http-security.ts +32 -21
  128. package/src/mcp/http-session.ts +13 -2
  129. package/src/mcp/http-transport.ts +96 -6
  130. package/src/mcp/sync-egress.ts +24 -0
  131. package/src/mcp/tools/add-collection.ts +4 -0
  132. package/src/mcp/tools/ask.ts +1 -1
  133. package/src/mcp/tools/context.ts +9 -2
  134. package/src/mcp/tools/egress.ts +247 -0
  135. package/src/mcp/tools/embed.ts +1 -0
  136. package/src/mcp/tools/get.ts +10 -2
  137. package/src/mcp/tools/index-cmd.ts +7 -0
  138. package/src/mcp/tools/index.ts +98 -0
  139. package/src/mcp/tools/multi-get.ts +9 -2
  140. package/src/mcp/tools/query.ts +10 -0
  141. package/src/mcp/tools/remove-collection.ts +4 -0
  142. package/src/mcp/tools/sync.ts +6 -0
  143. package/src/mcp/tools/trace.ts +7 -1
  144. package/src/mcp/tools/vsearch.ts +1 -0
  145. package/src/mcp/tools/workspace-write.ts +2 -0
  146. package/src/pipeline/egress-lineage.ts +124 -0
  147. package/src/pipeline/filters.ts +1 -1
  148. package/src/pipeline/graph-retrieval.ts +7 -4
  149. package/src/pipeline/hybrid.ts +21 -4
  150. package/src/pipeline/result-context.ts +12 -4
  151. package/src/pipeline/search.ts +23 -4
  152. package/src/pipeline/types.ts +6 -0
  153. package/src/pipeline/vsearch.ts +67 -28
  154. package/src/publish/artifact.ts +31 -3
  155. package/src/publish/export-service.ts +25 -0
  156. package/src/sdk/client.ts +119 -2
  157. package/src/sdk/documents.ts +13 -5
  158. package/src/sdk/embed.ts +1 -0
  159. package/src/sdk/types.ts +33 -0
  160. package/src/serve/browse-tree.ts +4 -2
  161. package/src/serve/clipper-capture.ts +5 -1
  162. package/src/serve/closed-json.ts +61 -0
  163. package/src/serve/config-sync.ts +4 -1
  164. package/src/serve/context.ts +1 -0
  165. package/src/serve/doc-events.ts +110 -39
  166. package/src/serve/public/components/CollectionEgressCheckPanel.tsx +411 -0
  167. package/src/serve/public/components/CollectionEgressPolicyEditor.tsx +78 -0
  168. package/src/serve/public/components/CollectionModelDialog.tsx +93 -9
  169. package/src/serve/public/components/EgressAuditPanel.tsx +278 -0
  170. package/src/serve/public/globals.built.css +1 -1
  171. package/src/serve/public/pages/Collections.tsx +3 -0
  172. package/src/serve/resident-request.ts +80 -3
  173. package/src/serve/resident-runtime.ts +63 -1
  174. package/src/serve/routes/api.ts +237 -65
  175. package/src/serve/routes/clipper.ts +64 -1
  176. package/src/serve/routes/mcp.ts +6 -0
  177. package/src/serve/routes/traces.ts +27 -4
  178. package/src/serve/server.ts +118 -7
  179. package/src/store/migrations/022-record-export-lineage.ts +42 -0
  180. package/src/store/migrations/023-collection-egress-policy.ts +61 -0
  181. package/src/store/migrations/024-egress-derived-lineage.ts +121 -0
  182. package/src/store/migrations/025-collection-egress-policy-revision.ts +40 -0
  183. package/src/store/migrations/index.ts +8 -0
  184. package/src/store/retrieval-trace-codec.ts +15 -0
  185. package/src/store/sqlite/adapter.ts +284 -14
  186. package/src/store/sqlite/change-journal-store.ts +41 -2
  187. package/src/store/sqlite/egress-audit-store.ts +485 -0
  188. package/src/store/sqlite/retrieval-trace-management-store.ts +47 -6
  189. package/src/store/sqlite/retrieval-trace-retention.ts +2 -0
  190. package/src/store/sqlite/retrieval-trace-rows.ts +8 -1
  191. package/src/store/sqlite/retrieval-trace-store.ts +104 -5
  192. package/src/store/types.ts +166 -1
  193. package/browser-extension/artifacts/gno-browser-clipper-v1.27.1.zip +0 -0
  194. package/browser-extension/artifacts/gno-browser-clipper-v1.27.1.zip.sha256 +0 -1
  195. package/browser-extension/dist/chunk-vn5f663b.js +0 -50
@@ -2,6 +2,7 @@
2
2
 
3
3
  import type { Database } from "bun:sqlite";
4
4
 
5
+ import type { EgressLineage } from "../../core/egress-provenance";
5
6
  import type {
6
7
  RetrievalTraceAppendResult,
7
8
  RetrievalTraceBundle,
@@ -16,8 +17,13 @@ import type {
16
17
  StoreResult,
17
18
  } from "../types";
18
19
 
20
+ import {
21
+ egressLineageSchema,
22
+ mergeEgressLineages,
23
+ } from "../../core/egress-provenance";
19
24
  import {
20
25
  canonicalTraceJson,
26
+ hashLegacyRetrievalTraceCreation,
21
27
  hashRetrievalTraceCreation,
22
28
  hashTraceCanonical,
23
29
  parseRetrievalTraceEventInput,
@@ -113,6 +119,7 @@ export const createTrace = (
113
119
  const queryShapeJson = canonicalTraceJson(trace.queryShape);
114
120
  const goalShapeJson = canonicalTraceJson(trace.goalShape);
115
121
  const filtersJson = canonicalTraceJson(trace.filters);
122
+ const egressLineageJson = canonicalTraceJson(trace.egressLineage);
116
123
  const queryBytes = enforceByteLimit(
117
124
  trace.queryText ?? "",
118
125
  8192,
@@ -138,16 +145,23 @@ export const createTrace = (
138
145
  16_384,
139
146
  "Retrieval trace filters"
140
147
  );
148
+ const egressLineageBytes = enforceByteLimit(
149
+ egressLineageJson,
150
+ 32_768,
151
+ "Retrieval trace egress lineage"
152
+ );
141
153
  const creationDigest = hashRetrievalTraceCreation(trace);
142
154
  const insert = db.run(
143
155
  `INSERT OR IGNORE INTO retrieval_traces (
144
156
  trace_id, schema_version, redaction_mode, replay_capable,
145
157
  query_text, query_digest, query_shape_json,
146
158
  goal_text, goal_digest, goal_shape_json, filters_json,
159
+ effective_egress_policy, egress_lineage_digest,
160
+ egress_lineage_json, egress_lineage_bytes,
147
161
  pipeline_fingerprint, model_fingerprint, config_fingerprint,
148
162
  index_fingerprint, status, created_at_ms, updated_at_ms,
149
- expires_at_ms, byte_size, creation_digest
150
- ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
163
+ expires_at_ms, byte_size, creation_digest, creation_digest_version
164
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
151
165
  [
152
166
  trace.traceId,
153
167
  trace.schemaVersion,
@@ -160,6 +174,10 @@ export const createTrace = (
160
174
  trace.goalDigest,
161
175
  goalShapeJson,
162
176
  filtersJson,
177
+ trace.egressLineage.effectivePolicy,
178
+ trace.egressLineage.digest,
179
+ egressLineageJson,
180
+ egressLineageBytes,
163
181
  trace.fingerprints.pipeline,
164
182
  trace.fingerprints.model,
165
183
  trace.fingerprints.config,
@@ -170,15 +188,51 @@ export const createTrace = (
170
188
  trace.expiresAtMs,
171
189
  queryBytes + shapeBytes + goalBytes + goalShapeBytes + filterBytes,
172
190
  creationDigest,
191
+ 1,
173
192
  ]
174
193
  );
175
194
  if (insert.changes > 0) return ok("inserted");
176
195
  const stored = db
177
- .query<{ creation_digest: string }, [string]>(
178
- "SELECT creation_digest FROM retrieval_traces WHERE trace_id = ?"
196
+ .query<
197
+ {
198
+ creation_digest: string;
199
+ creation_digest_version: 0 | 1;
200
+ egress_lineage_digest: string;
201
+ egress_lineage_json: string;
202
+ },
203
+ [string]
204
+ >(
205
+ `SELECT creation_digest, creation_digest_version,
206
+ egress_lineage_digest, egress_lineage_json
207
+ FROM retrieval_traces WHERE trace_id = ?`
179
208
  )
180
209
  .get(trace.traceId);
181
- if (stored?.creation_digest === creationDigest) return ok("duplicate");
210
+ if (stored?.creation_digest === creationDigest) {
211
+ if (stored.creation_digest_version === 0) {
212
+ db.run(
213
+ `UPDATE retrieval_traces SET creation_digest_version = 1
214
+ WHERE trace_id = ? AND creation_digest_version = 0`,
215
+ [trace.traceId]
216
+ );
217
+ }
218
+ return ok("duplicate");
219
+ }
220
+ const legacyLineage =
221
+ '{"digest":"87b249b76459c91c172da6be6cbe3f93b61c44869eb196f3470ec36ebb50b8b0","effectivePolicy":"local_only","sources":[{"collection":"legacy","policy":"local_only","source":"legacy_default"}]}';
222
+ if (
223
+ stored?.creation_digest_version === 0 &&
224
+ stored.egress_lineage_digest === trace.egressLineage.digest &&
225
+ stored.egress_lineage_json === legacyLineage &&
226
+ stored.creation_digest === hashLegacyRetrievalTraceCreation(trace)
227
+ ) {
228
+ db.run(
229
+ `UPDATE retrieval_traces
230
+ SET creation_digest = ?, creation_digest_version = 1
231
+ WHERE trace_id = ? AND creation_digest_version = 0`,
232
+ [creationDigest, trace.traceId]
233
+ );
234
+ return ok("duplicate");
235
+ }
182
236
  return err(
183
237
  "CONSTRAINT_VIOLATION",
184
238
  `trace_id ${trace.traceId} already exists with different content`
@@ -188,6 +242,51 @@ export const createTrace = (
188
242
  }
189
243
  };
190
244
 
245
+ export const mergeTraceEgressLineage = (
246
+ db: Database,
247
+ traceId: string,
248
+ input: EgressLineage
249
+ ): StoreResult<RetrievalTraceAppendResult> => {
250
+ try {
251
+ validateTraceId(traceId, "traceId");
252
+ const incoming = egressLineageSchema.parse(input);
253
+ const stored = db
254
+ .query<{ egress_lineage_json: string }, [string]>(
255
+ "SELECT egress_lineage_json FROM retrieval_traces WHERE trace_id = ?"
256
+ )
257
+ .get(traceId);
258
+ if (!stored)
259
+ return err("NOT_FOUND", `Retrieval trace ${traceId} not found`);
260
+ const current = egressLineageSchema.parse(
261
+ JSON.parse(stored.egress_lineage_json)
262
+ );
263
+ const merged = mergeEgressLineages([current, incoming]);
264
+ if (merged.digest === current.digest) return ok("duplicate");
265
+ const lineageJson = canonicalTraceJson(merged);
266
+ const lineageBytes = enforceByteLimit(
267
+ lineageJson,
268
+ 32_768,
269
+ "Retrieval trace egress lineage"
270
+ );
271
+ db.run(
272
+ `UPDATE retrieval_traces
273
+ SET effective_egress_policy = ?, egress_lineage_digest = ?,
274
+ egress_lineage_json = ?, egress_lineage_bytes = ?
275
+ WHERE trace_id = ?`,
276
+ [
277
+ merged.effectivePolicy,
278
+ merged.digest,
279
+ lineageJson,
280
+ lineageBytes,
281
+ traceId,
282
+ ]
283
+ );
284
+ return ok("inserted");
285
+ } catch (cause) {
286
+ return traceWriteError(cause, "Failed to merge retrieval trace lineage");
287
+ }
288
+ };
289
+
191
290
  export const getTrace = (
192
291
  db: Database,
193
292
  traceId: string
@@ -5,7 +5,15 @@
5
5
  * @module src/store/types
6
6
  */
7
7
 
8
- import type { Collection, Context, FtsTokenizer } from "../config/types";
8
+ import type {
9
+ Collection,
10
+ Context,
11
+ EgressPolicy,
12
+ EgressPolicySource,
13
+ FtsTokenizer,
14
+ } from "../config/types";
15
+ import type { RecordAnchor, RecordMetadata } from "../converters/types";
16
+ import type { EgressLineage } from "../core/egress-provenance";
9
17
 
10
18
  // ─────────────────────────────────────────────────────────────────────────────
11
19
  // Error Types
@@ -24,6 +32,7 @@ export type StoreErrorCode =
24
32
  | "INVALID_INPUT"
25
33
  | "IO_ERROR"
26
34
  | "INTERNAL"
35
+ | "EGRESS_DENIED"
27
36
  // Vector-specific error codes (EPIC 7)
28
37
  | "VECTOR_WRITE_FAILED"
29
38
  | "VECTOR_DELETE_FAILED"
@@ -72,6 +81,10 @@ export interface CollectionRow {
72
81
  exclude: string[] | null;
73
82
  updateCmd: string | null;
74
83
  languageHint: string | null;
84
+ /** Effective fail-closed content transfer boundary. */
85
+ egressPolicy: EgressPolicy;
86
+ /** Whether policy was explicit or supplied by a safe default. */
87
+ egressPolicySource: EgressPolicySource;
75
88
  syncedAt: string;
76
89
  }
77
90
 
@@ -113,6 +126,12 @@ export interface DocumentRow {
113
126
  author?: string | null;
114
127
  frontmatterDate?: string | null;
115
128
  dateFields?: Record<string, string> | null;
129
+ recordKey?: string | null;
130
+ recordSourcePath?: string | null;
131
+ recordSourceLocator?: string | null;
132
+ recordMetadata?: RecordMetadata | null;
133
+ recordAnchors?: RecordAnchor[] | null;
134
+ recordAdapterFingerprint?: string | null;
116
135
  indexedAt?: string | null;
117
136
 
118
137
  // Status
@@ -132,6 +151,16 @@ export interface DocumentRow {
132
151
  updatedAt: string;
133
152
  }
134
153
 
154
+ /** Minimal persisted record identity used by export snapshot reconciliation. */
155
+ export interface StoredRecordState {
156
+ recordKey: string;
157
+ sourceHash: string;
158
+ adapterVersion: string;
159
+ adapterFingerprint: string;
160
+ active: boolean;
161
+ relativePath: string;
162
+ }
163
+
135
164
  /** Chunk row from DB */
136
165
  export interface ChunkRow {
137
166
  mirrorHash: string;
@@ -300,6 +329,12 @@ export interface DocumentInput {
300
329
  author?: string;
301
330
  frontmatterDate?: string;
302
331
  dateFields?: Record<string, string>;
332
+ recordKey?: string;
333
+ recordSourcePath?: string;
334
+ recordSourceLocator?: string;
335
+ recordMetadata?: RecordMetadata;
336
+ recordAnchors?: RecordAnchor[];
337
+ recordAdapterFingerprint?: string;
303
338
  lastErrorCode?: string;
304
339
  lastErrorMessage?: string;
305
340
  /** Ingest schema version for backfill detection */
@@ -374,6 +409,7 @@ export interface DocumentChangeRow {
374
409
  oldActive: boolean | null;
375
410
  newActive: boolean | null;
376
411
  structureDelta: DocumentChangeStructureDelta;
412
+ egressLineage: EgressLineage;
377
413
  observedAtMs: number;
378
414
  byteSize: number;
379
415
  }
@@ -571,6 +607,14 @@ export interface FtsResult {
571
607
  contentType?: string;
572
608
  contentTypeSource?: string;
573
609
  categories?: string[];
610
+ converterId?: string;
611
+ converterVersion?: string;
612
+ recordKey?: string;
613
+ recordSourcePath?: string;
614
+ recordSourceLocator?: string;
615
+ recordMetadata?: RecordMetadata;
616
+ recordAnchors?: RecordAnchor[];
617
+ recordAdapterFingerprint?: string;
574
618
  }
575
619
 
576
620
  // ─────────────────────────────────────────────────────────────────────────────
@@ -581,6 +625,10 @@ export interface FtsResult {
581
625
  export interface CollectionStatus {
582
626
  name: string;
583
627
  path: string;
628
+ /** Effective fail-closed content transfer boundary. */
629
+ egressPolicy: EgressPolicy;
630
+ /** Whether policy was explicit or supplied by a safe default. */
631
+ egressPolicySource: EgressPolicySource;
584
632
  totalDocuments: number;
585
633
  activeDocuments: number;
586
634
  errorDocuments: number;
@@ -1058,6 +1106,8 @@ export interface RetrievalTraceInput {
1058
1106
  terms: number;
1059
1107
  };
1060
1108
  filters: Record<string, unknown>;
1109
+ /** Trusted collection ownership, independent from privacy-redacted filters. */
1110
+ egressLineage: EgressLineage;
1061
1111
  fingerprints: RetrievalTraceFingerprints;
1062
1112
  status: "open";
1063
1113
  createdAtMs: number;
@@ -1142,6 +1192,7 @@ export interface RetrievalTraceExportManifestInput {
1142
1192
  traceIds: string[];
1143
1193
  format: RetrievalTraceExportFormat;
1144
1194
  artifactHash: string;
1195
+ egressLineage: EgressLineage;
1145
1196
  createdAtMs: number;
1146
1197
  }
1147
1198
 
@@ -1152,6 +1203,65 @@ export interface RetrievalTraceExportManifestRow extends Omit<
1152
1203
  traceIds: string[];
1153
1204
  }
1154
1205
 
1206
+ export type EgressAuditDecision = "allow" | "deny";
1207
+
1208
+ export interface EgressAuditReceiptInput {
1209
+ auditId: string;
1210
+ decision: EgressAuditDecision;
1211
+ action: import("../core/egress-policy").EgressAction;
1212
+ destinationZone: import("../core/egress-policy").EgressDestinationZone;
1213
+ contentClass: import("../core/egress-policy").EgressContentClass;
1214
+ effectivePolicy: EgressPolicy;
1215
+ reasonCode: import("../core/egress-policy").EgressReasonCode;
1216
+ lineageDigest: string;
1217
+ createdAtMs: number;
1218
+ expiresAtMs: number;
1219
+ }
1220
+
1221
+ export interface EgressAuditReceiptRow extends EgressAuditReceiptInput {
1222
+ byteSize: number;
1223
+ }
1224
+
1225
+ export interface EgressAuditCursor {
1226
+ createdAtMs: number;
1227
+ auditId: string;
1228
+ }
1229
+
1230
+ export interface EgressAuditPage {
1231
+ receipts: EgressAuditReceiptRow[];
1232
+ nextCursor: EgressAuditCursor | null;
1233
+ }
1234
+
1235
+ export interface EgressAuditRetentionPolicy {
1236
+ maxAgeDays: number;
1237
+ maxReceipts: number;
1238
+ maxBytes: number;
1239
+ }
1240
+
1241
+ export interface EgressAuditRetentionResult {
1242
+ deleted: number;
1243
+ remainingReceipts: number;
1244
+ remainingBytes: number;
1245
+ }
1246
+
1247
+ export interface EgressAuditPurgeResult {
1248
+ deleted: number;
1249
+ physicalCleanup: RetrievalTracePhysicalCleanupStatus;
1250
+ checkpointedFrames: number;
1251
+ remainingWalFrames: number;
1252
+ }
1253
+
1254
+ export interface EgressAuditDeleteResult extends EgressAuditPurgeResult {
1255
+ auditId: string;
1256
+ }
1257
+
1258
+ export interface EgressAuditStatusResult {
1259
+ receipts: number;
1260
+ bytes: number;
1261
+ oldestCreatedAtMs: number | null;
1262
+ newestCreatedAtMs: number | null;
1263
+ }
1264
+
1155
1265
  export interface RetrievalTraceBundle {
1156
1266
  trace: RetrievalTraceRow;
1157
1267
  runs: RetrievalTraceRunRow[];
@@ -1326,6 +1436,12 @@ export interface StorePort {
1326
1436
  trace: RetrievalTraceInput
1327
1437
  ): Promise<StoreResult<RetrievalTraceAppendResult>>;
1328
1438
 
1439
+ /** Widen one trace to the canonical union of observed policy ownership. */
1440
+ mergeRetrievalTraceEgressLineage?(
1441
+ traceId: string,
1442
+ lineage: EgressLineage
1443
+ ): Promise<StoreResult<RetrievalTraceAppendResult>>;
1444
+
1329
1445
  /** Return a trace and all of its locally stored subordinate records. */
1330
1446
  getRetrievalTrace(
1331
1447
  traceId: string
@@ -1402,6 +1518,46 @@ export interface StorePort {
1402
1518
  nowMs: number
1403
1519
  ): Promise<StoreResult<RetrievalTraceRetentionResult>>;
1404
1520
 
1521
+ /** Append one content-free egress decision receipt. */
1522
+ appendEgressAuditReceipt(
1523
+ receipt: EgressAuditReceiptInput
1524
+ ): Promise<StoreResult<RetrievalTraceAppendResult>>;
1525
+
1526
+ /** Append one receipt and enforce bounds in one atomic store transaction. */
1527
+ appendEgressAuditReceiptWithRetention?(
1528
+ receipt: EgressAuditReceiptInput,
1529
+ policy: EgressAuditRetentionPolicy,
1530
+ nowMs: number
1531
+ ): Promise<StoreResult<RetrievalTraceAppendResult>>;
1532
+
1533
+ /** Inspect bounded receipts newest-first through an opaque cursor. */
1534
+ listEgressAuditReceipts(
1535
+ limit: number,
1536
+ cursor?: EgressAuditCursor
1537
+ ): Promise<StoreResult<EgressAuditPage>>;
1538
+
1539
+ /** Inspect one content-free receipt by stable local identifier. */
1540
+ getEgressAuditReceipt(
1541
+ auditId: string
1542
+ ): Promise<StoreResult<EgressAuditReceiptRow | null>>;
1543
+
1544
+ /** Delete exactly one audit receipt with truthful physical cleanup status. */
1545
+ deleteEgressAuditReceipt(
1546
+ auditId: string
1547
+ ): Promise<StoreResult<EgressAuditDeleteResult>>;
1548
+
1549
+ /** Return content-free local audit storage and retention facts. */
1550
+ getEgressAuditStatus(): Promise<StoreResult<EgressAuditStatusResult>>;
1551
+
1552
+ /** Enforce the audit domain's independent age/count/byte policy. */
1553
+ enforceEgressAuditRetention(
1554
+ policy: EgressAuditRetentionPolicy,
1555
+ nowMs: number
1556
+ ): Promise<StoreResult<EgressAuditRetentionResult>>;
1557
+
1558
+ /** Purge only audit receipts with truthful SQLite physical cleanup status. */
1559
+ purgeEgressAuditReceipts(): Promise<StoreResult<EgressAuditPurgeResult>>;
1560
+
1405
1561
  // ─────────────────────────────────────────────────────────────────────────
1406
1562
  // Documents
1407
1563
  // ─────────────────────────────────────────────────────────────────────────
@@ -1448,6 +1604,15 @@ export interface StorePort {
1448
1604
  */
1449
1605
  listDocuments(collection?: string): Promise<StoreResult<DocumentRow[]>>;
1450
1606
 
1607
+ /**
1608
+ * List logical record documents produced from one source container.
1609
+ * Uses the record-source index so targeted syncs do not scan a collection.
1610
+ */
1611
+ listRecordDocuments(
1612
+ collection: string,
1613
+ sourcePath: string
1614
+ ): Promise<StoreResult<DocumentRow[]>>;
1615
+
1451
1616
  /**
1452
1617
  * Fetch documents by mirror hashes in batch.
1453
1618
  * Useful for retrieval pipelines to avoid full document scans.
@@ -1 +0,0 @@
1
- 8161a2f2b8bb643dc2768c59a60783752b04dfedb0f5a1cf369042f623afaaa0 gno-browser-clipper-v1.27.1.zip