@sentropic/h2a-runtime 0.98.6 → 0.98.7-rc.2

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 (130) hide show
  1. package/dist/agent-launch-args.d.ts.map +1 -1
  2. package/dist/agent-launch-args.js +5 -5
  3. package/dist/agent-launch-args.js.map +1 -1
  4. package/dist/agy-claude.d.ts +2 -0
  5. package/dist/agy-claude.d.ts.map +1 -0
  6. package/dist/agy-claude.js +3 -0
  7. package/dist/agy-claude.js.map +1 -0
  8. package/dist/agy-headless.d.ts +11 -0
  9. package/dist/agy-headless.d.ts.map +1 -0
  10. package/dist/agy-headless.js +104 -0
  11. package/dist/agy-headless.js.map +1 -0
  12. package/dist/attach.d.ts +2 -0
  13. package/dist/attach.d.ts.map +1 -1
  14. package/dist/attach.js +73 -6
  15. package/dist/attach.js.map +1 -1
  16. package/dist/auth-login.d.ts +24 -1
  17. package/dist/auth-login.d.ts.map +1 -1
  18. package/dist/auth-login.js +132 -4
  19. package/dist/auth-login.js.map +1 -1
  20. package/dist/central-mcp.d.ts +2 -0
  21. package/dist/central-mcp.d.ts.map +1 -1
  22. package/dist/central-mcp.js +90 -3
  23. package/dist/central-mcp.js.map +1 -1
  24. package/dist/claude-code-cli-isolation.d.ts +53 -0
  25. package/dist/claude-code-cli-isolation.d.ts.map +1 -0
  26. package/dist/claude-code-cli-isolation.js +277 -0
  27. package/dist/claude-code-cli-isolation.js.map +1 -0
  28. package/dist/claude-code-cli-lifecycle.d.ts +80 -0
  29. package/dist/claude-code-cli-lifecycle.d.ts.map +1 -0
  30. package/dist/claude-code-cli-lifecycle.js +402 -0
  31. package/dist/claude-code-cli-lifecycle.js.map +1 -0
  32. package/dist/claude-code-cli-runner.d.ts +89 -0
  33. package/dist/claude-code-cli-runner.d.ts.map +1 -0
  34. package/dist/claude-code-cli-runner.js +659 -0
  35. package/dist/claude-code-cli-runner.js.map +1 -0
  36. package/dist/claude-seat-input.d.ts +47 -0
  37. package/dist/claude-seat-input.d.ts.map +1 -0
  38. package/dist/claude-seat-input.js +272 -0
  39. package/dist/claude-seat-input.js.map +1 -0
  40. package/dist/claude-seat-mesh-contract.d.ts +88 -0
  41. package/dist/claude-seat-mesh-contract.d.ts.map +1 -0
  42. package/dist/claude-seat-mesh-contract.js +13 -0
  43. package/dist/claude-seat-mesh-contract.js.map +1 -0
  44. package/dist/cli-help-groups.js +1 -1
  45. package/dist/cli-help-groups.js.map +1 -1
  46. package/dist/crash-log.d.ts +112 -0
  47. package/dist/crash-log.d.ts.map +1 -0
  48. package/dist/crash-log.js +560 -0
  49. package/dist/crash-log.js.map +1 -0
  50. package/dist/delegate.d.ts +10 -0
  51. package/dist/delegate.d.ts.map +1 -1
  52. package/dist/delegate.js +29 -0
  53. package/dist/delegate.js.map +1 -1
  54. package/dist/gateway-host/claude-seat-client.d.ts +32 -0
  55. package/dist/gateway-host/claude-seat-client.d.ts.map +1 -0
  56. package/dist/gateway-host/claude-seat-client.js +38 -0
  57. package/dist/gateway-host/claude-seat-client.js.map +1 -0
  58. package/dist/gateway-host/host.d.ts +6 -0
  59. package/dist/gateway-host/host.d.ts.map +1 -1
  60. package/dist/gateway-host/host.js +24 -3
  61. package/dist/gateway-host/host.js.map +1 -1
  62. package/dist/gateway-host/live-declarations.d.ts +58 -0
  63. package/dist/gateway-host/live-declarations.d.ts.map +1 -0
  64. package/dist/gateway-host/live-declarations.js +429 -0
  65. package/dist/gateway-host/live-declarations.js.map +1 -0
  66. package/dist/gateway-host/live-github.d.ts +11 -0
  67. package/dist/gateway-host/live-github.d.ts.map +1 -0
  68. package/dist/gateway-host/live-github.js +374 -0
  69. package/dist/gateway-host/live-github.js.map +1 -0
  70. package/dist/gateway-host/live-object-store.d.ts +35 -0
  71. package/dist/gateway-host/live-object-store.d.ts.map +1 -0
  72. package/dist/gateway-host/live-object-store.js +447 -0
  73. package/dist/gateway-host/live-object-store.js.map +1 -0
  74. package/dist/gateway-host/live-registration.d.ts +162 -0
  75. package/dist/gateway-host/live-registration.d.ts.map +1 -0
  76. package/dist/gateway-host/live-registration.js +455 -0
  77. package/dist/gateway-host/live-registration.js.map +1 -0
  78. package/dist/index.d.ts.map +1 -1
  79. package/dist/index.js +290 -23
  80. package/dist/index.js.map +1 -1
  81. package/dist/llm-mesh-accounts.d.ts +70 -4
  82. package/dist/llm-mesh-accounts.d.ts.map +1 -1
  83. package/dist/llm-mesh-accounts.js +296 -9
  84. package/dist/llm-mesh-accounts.js.map +1 -1
  85. package/dist/native-host.d.ts +1 -1
  86. package/dist/native-host.d.ts.map +1 -1
  87. package/dist/native-host.js +30 -17
  88. package/dist/native-host.js.map +1 -1
  89. package/dist/native-terminal/host.d.ts +6 -1
  90. package/dist/native-terminal/host.d.ts.map +1 -1
  91. package/dist/native-terminal/host.js +6 -25
  92. package/dist/native-terminal/host.js.map +1 -1
  93. package/dist/native-terminal/journal.d.ts +5 -0
  94. package/dist/native-terminal/journal.d.ts.map +1 -1
  95. package/dist/native-terminal/journal.js +28 -16
  96. package/dist/native-terminal/journal.js.map +1 -1
  97. package/dist/native-terminal/op.d.ts +13 -0
  98. package/dist/native-terminal/op.d.ts.map +1 -1
  99. package/dist/native-terminal/op.js +64 -5
  100. package/dist/native-terminal/op.js.map +1 -1
  101. package/dist/proc-identity.d.ts +31 -0
  102. package/dist/proc-identity.d.ts.map +1 -1
  103. package/dist/proc-identity.js +54 -0
  104. package/dist/proc-identity.js.map +1 -1
  105. package/dist/prompt-delivery.d.ts +3 -0
  106. package/dist/prompt-delivery.d.ts.map +1 -1
  107. package/dist/prompt-delivery.js +8 -3
  108. package/dist/prompt-delivery.js.map +1 -1
  109. package/dist/run.d.ts.map +1 -1
  110. package/dist/run.js +79 -16
  111. package/dist/run.js.map +1 -1
  112. package/dist/terminal-reset.d.ts +104 -0
  113. package/dist/terminal-reset.d.ts.map +1 -0
  114. package/dist/terminal-reset.js +229 -0
  115. package/dist/terminal-reset.js.map +1 -0
  116. package/dist/tmux.d.ts +26 -4
  117. package/dist/tmux.d.ts.map +1 -1
  118. package/dist/tmux.js +60 -25
  119. package/dist/tmux.js.map +1 -1
  120. package/dist/vendor/engram-live/contracts.d.ts +825 -0
  121. package/dist/vendor/engram-live/contracts.js +1734 -0
  122. package/dist/vendor/engram-live/integration.d.ts +113 -0
  123. package/dist/vendor/engram-live/integration.js +254 -0
  124. package/dist/vendor/engram-live/pr-sync.d.ts +144 -0
  125. package/dist/vendor/engram-live/pr-sync.js +411 -0
  126. package/dist/vendor/engram-live/registration.d.ts +138 -0
  127. package/dist/vendor/engram-live/registration.js +358 -0
  128. package/dist/vendor/engram-live/retention.d.ts +56 -0
  129. package/dist/vendor/engram-live/retention.js +179 -0
  130. package/package.json +2 -2
@@ -0,0 +1,825 @@
1
+ // Vendored from rhanka/engram@545a57b8911ab108e84fa1778e0f268fe11bf1de: engram-live/contracts.ts.
2
+ // Compiled with TypeScript 5.9.3 (ES2022/NodeNext, declarations); do not hand-edit.
3
+ export declare const CONTRACT_NAME = "@sentropic/engram-live/contracts";
4
+ export declare const CONTRACT_VERSION = 1;
5
+ export declare const PRODUCER_NAME = "engram-live";
6
+ export declare const POLICY_VERSION = "live-git-indexing/1";
7
+ export type CapabilityId = "refs" | "history-dag" | "github-pr" | "index-snapshot" | "working-tree" | "diffs" | "code-analysis" | "retention-requests" | "reconciliation" | "publication";
8
+ export declare const CAPABILITY_IDS: readonly CapabilityId[];
9
+ /** The lot that implements each capability; part of the advertised contract. */
10
+ export declare const CAPABILITY_PLANNED_LOTS: Readonly<Record<CapabilityId, string>>;
11
+ export declare const NOT_IMPLEMENTED_REASON = "engram-live L1b supplies the package/factory seams and grammar loading only; this capability is explicitly unavailable until its lot lands";
12
+ export type CapabilityState = "available" | "unavailable";
13
+ export interface CapabilityStatus {
14
+ readonly capability: CapabilityId;
15
+ readonly state: CapabilityState;
16
+ readonly reason: string;
17
+ readonly plannedLot: string;
18
+ }
19
+ export declare function describeCapabilities(): readonly CapabilityStatus[];
20
+ export type CoverageState = "current" | "pending" | "partial" | "stale" | "unavailable";
21
+ export declare const COVERAGE_AXES: readonly string[];
22
+ export interface CoverageReport {
23
+ readonly axis: string;
24
+ readonly language?: string;
25
+ readonly state: CoverageState;
26
+ readonly reason?: string;
27
+ readonly checkedAt: number;
28
+ }
29
+ export interface LiveScope {
30
+ readonly tenant: string;
31
+ readonly clone: string;
32
+ readonly worktree?: string;
33
+ }
34
+ /**
35
+ * Explicit live workspace declaration (L6a). Every declaration carries its
36
+ * opaque identity triangle: declarationId (unique per declaration, stable
37
+ * across every revision), plus its cloneId and worktreeId attachment, so a
38
+ * revocation can target exactly one declaration. Identity uncertainty is
39
+ * explicit (LIVE §12): an absent hostFingerprint is valid only when
40
+ * identityUncertainty contains "missing_history". The product binding, when
41
+ * present, is the complete (serverWorkspaceId, serverIssuer, bindingRevision)
42
+ * triplet — never a partial binding.
43
+ */
44
+ export interface WorkspaceDeclarationDto {
45
+ readonly tenant: string;
46
+ readonly principal: string;
47
+ readonly hostFingerprint?: string;
48
+ readonly identityUncertainty: readonly IdentityUncertaintyState[];
49
+ readonly declarationId: string;
50
+ readonly cloneId: string;
51
+ readonly worktreeId: string;
52
+ readonly authorizedRoots: readonly string[];
53
+ readonly liveCapability: "live";
54
+ readonly policyVersion: string;
55
+ readonly declarationRevision: number;
56
+ readonly serverWorkspaceId?: string;
57
+ readonly serverIssuer?: string;
58
+ readonly bindingRevision?: number;
59
+ }
60
+ export interface FactBatchDto {
61
+ readonly scope: LiveScope;
62
+ readonly producerName: string;
63
+ readonly contractVersion: number;
64
+ readonly policyVersion: string;
65
+ readonly generationId: string;
66
+ readonly batchId: string;
67
+ readonly batchDigest: string;
68
+ readonly facts: readonly unknown[];
69
+ }
70
+ export interface GrammarCoverageDto {
71
+ readonly axis: "ast";
72
+ readonly language: string;
73
+ readonly state: CoverageState;
74
+ readonly reason: string;
75
+ }
76
+ /** Languages with a pinned, packaged tree-sitter WASM grammar (L1b matrix). */
77
+ export declare const ADVERTISED_LANGUAGES: readonly string[];
78
+ export declare const GRAMMAR_UNAVAILABLE_REASON = "no packaged grammar is pinned for this language; AST coverage is explicitly unavailable";
79
+ export interface ValidationResult {
80
+ readonly ok: boolean;
81
+ readonly errors: readonly string[];
82
+ }
83
+ /** Strict opaque batch/generation/key identifiers: prefixed, charset-closed. */
84
+ export declare function isStrictBatchId(value: unknown, prefix: string): value is string;
85
+ /**
86
+ * Fixed-width generation identifiers (L4b-2 m9): `gen:` plus exactly
87
+ * GENERATION_ID_WIDTH zero-padded decimal digits. Lexicographic order is
88
+ * numeric order (`gen:0000000010` > `gen:0000000009`), so a newer delivery
89
+ * is never durably rejected as stale. Producers mint monotone ids per
90
+ * target; the host keeps only the highest accepted generation per target.
91
+ */
92
+ export declare const GENERATION_ID_WIDTH = 10;
93
+ export declare function isStrictGenerationId(value: unknown): value is string;
94
+ export declare function validateLiveScope(scope: unknown): ValidationResult;
95
+ export declare function validateWorkspaceDeclaration(declaration: unknown): ValidationResult;
96
+ export declare function validateFactBatch(batch: unknown): ValidationResult;
97
+ export declare function classifyDuplicateBatch(previous: FactBatchDto, next: FactBatchDto): "idempotent" | "refused";
98
+ /** The only capability value that activates live collection (Q4 A). */
99
+ export declare const EXPLICIT_LIVE_CAPABILITY: "live";
100
+ /**
101
+ * Lifecycle kinds that never activate or remove a live declaration:
102
+ * enrollment bind, transcript upload, code-workspace creation and agent
103
+ * session open/end are distinct capabilities (spec §12).
104
+ */
105
+ export declare const NON_ACTIVATING_LIFECYCLE_KINDS: readonly ["bind", "upload", "code-workspace-create", "session-open", "session-end"];
106
+ export type NonActivatingLifecycleKind = (typeof NON_ACTIVATING_LIFECYCLE_KINDS)[number];
107
+ export declare function isNonActivatingLifecycleKind(value: unknown): value is NonActivatingLifecycleKind;
108
+ export declare const OID_ALGORITHMS: readonly ["sha1", "sha256"];
109
+ export type OidAlgorithm = (typeof OID_ALGORITHMS)[number];
110
+ export declare const REVOCATION_REASONS: readonly ["workspace-remove", "owner-request", "policy-withdrawn"];
111
+ export type RevocationReason = (typeof REVOCATION_REASONS)[number];
112
+ export declare function isRevocationReason(value: unknown): value is RevocationReason;
113
+ /**
114
+ * Explicit identity-coverage uncertainty states (LIVE §12). A repo with no
115
+ * history (unborn HEAD) declares "missing_history"; a grafted (shallow)
116
+ * history declares "shallow_history" while keeping its fingerprints, whose
117
+ * coverage stays uncertain. An absent fingerprint is valid only under
118
+ * "missing_history"; uncertainty never merges clones.
119
+ */
120
+ export declare const IDENTITY_UNCERTAINTY_STATES: readonly ["missing_history", "shallow_history"];
121
+ export type IdentityUncertaintyState = (typeof IDENTITY_UNCERTAINTY_STATES)[number];
122
+ export declare function isIdentityUncertaintyState(value: unknown): value is IdentityUncertaintyState;
123
+ /** First declaration revision: the explicit activation is revision 1. */
124
+ export declare const INITIAL_DECLARATION_REVISION = 1;
125
+ /** First product binding revision; every rebind carries a strictly greater one. */
126
+ export declare const INITIAL_BINDING_REVISION = 1;
127
+ /** The three opaque id kinds minted by the canonical derivation. */
128
+ export declare const ID_KINDS: readonly ["clone", "worktree", "declaration"];
129
+ export type IdKind = (typeof ID_KINDS)[number];
130
+ /** Opaque id prefixes; a valid id of a kind starts with its prefix. */
131
+ export declare const ID_PREFIXES: Readonly<Record<IdKind, string>>;
132
+ export declare function isIdKind(value: unknown): value is IdKind;
133
+ /**
134
+ * THE canonical identity serialization shared by every live opaque id
135
+ * (cloneId, worktreeId, declarationId). Both seats and engram mint ids
136
+ * from this exact function, so the same identity components always give
137
+ * the same id on every side. The serialization is unambiguous: a JSON
138
+ * array of the kind plus the components in order, so no component value
139
+ * can shift a boundary. NUL is refused outright in every component, so the
140
+ * ambiguous couples ("a\0b", "c") vs ("a", "b\0c") can never be
141
+ * constructed. Pure and total over valid inputs; throws on malformed
142
+ * components so no silent normalization can produce a colliding key.
143
+ */
144
+ export declare function canonicalIdKey(kind: IdKind, components: readonly string[]): string;
145
+ /**
146
+ * Local clone identity. hostScope bounds the clone to one host;
147
+ * commonDirProjectFingerprint is the project fingerprint computed over the
148
+ * common-dir history with the empty main-worktree component (spec §12) and
149
+ * is optional: it may be absent only when identityUncertainty explicitly
150
+ * contains "missing_history" (LIVE §12) — the hostScope + common-dir
151
+ * realpath components keep clones distinct even then;
152
+ * commonDirRealpath is the host-resolved common-dir path (host-local only,
153
+ * never published to sentropic); cloneId is the scoped opaque identifier
154
+ * minted from canonicalIdKey and safe to share; oidAlgorithm records the
155
+ * repository object format.
156
+ */
157
+ export interface CloneIdentityDto {
158
+ readonly hostScope: string;
159
+ readonly commonDirRealpath: string;
160
+ readonly commonDirProjectFingerprint?: string;
161
+ readonly cloneId: string;
162
+ readonly oidAlgorithm: OidAlgorithm;
163
+ readonly identityUncertainty: readonly IdentityUncertaintyState[];
164
+ }
165
+ /**
166
+ * Worktree identity: one shared cloneId plus its own host-scoped opaque
167
+ * worktreeId, isolated per-worktree fingerprint, path and resolved
168
+ * git-dir. Linked worktrees share only authorized immutable analyses;
169
+ * index snapshots and context-dependent resolution stay worktree-local
170
+ * (spec §§3, 15). The worktree fingerprint is optional: absent only under
171
+ * explicit "missing_history" uncertainty (LIVE §12).
172
+ */
173
+ export interface WorktreeIdentityDto {
174
+ readonly cloneId: string;
175
+ readonly worktreeId: string;
176
+ readonly worktreePath: string;
177
+ readonly gitDir: string;
178
+ readonly worktreeFingerprint?: string;
179
+ readonly identityUncertainty: readonly IdentityUncertaintyState[];
180
+ }
181
+ /**
182
+ * Private-purge request carried by every revocation. All purges are `true`
183
+ * and committed history is always preserved: there is no field authorizing
184
+ * deletion of committed facts.
185
+ */
186
+ export interface PrivatePurgeRequestDto {
187
+ readonly purgePrivateSnapshots: true;
188
+ readonly purgeDerivedIndexes: true;
189
+ readonly revokeDecryptability: true;
190
+ readonly preserveCommittedHistory: true;
191
+ }
192
+ /**
193
+ * Revocation of exactly one declaration: the opaque declarationId names the
194
+ * single target (stable across that declaration's revisions, unique per
195
+ * declaration), and cloneId/worktreeId carry its clone/worktree
196
+ * attachment so the recipient purges the right scope without consulting
197
+ * ambiguous public values. Withdrawing a whole clone revokes each of its
198
+ * declarations, one unambiguous revocation each.
199
+ */
200
+ export interface DeclarationRevocationDto {
201
+ readonly declarationId: string;
202
+ readonly tenant: string;
203
+ readonly cloneId: string;
204
+ readonly worktreeId: string;
205
+ readonly declarationRevision: number;
206
+ readonly reason: RevocationReason;
207
+ readonly requestPrivatePurge: PrivatePurgeRequestDto;
208
+ }
209
+ /**
210
+ * The follow-up window for branch activity (spec §4). It selects followed
211
+ * branches only; it never limits commit count, commit age, retained DAG
212
+ * facts or already acquired PR history, and it never prunes anything.
213
+ */
214
+ export declare const ACTIVITY_WINDOW_DAYS = 30;
215
+ /** A full ref name's kind, from its name alone. Tags are inventoried but never traversal roots. */
216
+ export type RefKind = "local-branch" | "remote-branch" | "pr-head" | "tag" | "other";
217
+ /** Which signal made a root a root (spec §4: record which signal selected it). */
218
+ export type RootSelectionSignal = "default-branch" | "active-window" | "pr-head" | "worktree-head" | "previously-ingested";
219
+ /** The two activity signals (spec §4): bootstrap tip committer time, or a later observed target change. */
220
+ export type ActivitySignalKind = "bootstrap-committer-time" | "observed-target-change";
221
+ /** An OID qualified by its object-format algorithm: equal OIDs under different algorithms are never the same object. */
222
+ export interface QualifiedOid {
223
+ readonly algorithm: OidAlgorithm;
224
+ readonly oid: string;
225
+ }
226
+ /** Hex length of an OID under one algorithm. */
227
+ export declare function oidHexLength(algorithm: OidAlgorithm): 40 | 64;
228
+ /** Strict algorithm-qualified OID check: lowercase hex of the algorithm's exact length. */
229
+ export declare function isValidQualifiedOid(value: QualifiedOid): boolean;
230
+ export declare function validateQualifiedOid(value: unknown): ValidationResult;
231
+ /**
232
+ * One host observation of one ref (spec §3: Ref/RefObservation). `observedAt`
233
+ * is polling time, never activity. `absent` marks a deletion observation: the
234
+ * ref no longer resolves at this generation. `tipCommitterUnixSeconds` is the
235
+ * bootstrap activity signal over the observed target; supplying it again on a
236
+ * later observation of the same target refreshes nothing.
237
+ */
238
+ export interface RawRefObservationDto {
239
+ readonly refName: string;
240
+ /** Observed target OID; empty when `absent` is true. */
241
+ readonly oid: string;
242
+ readonly observedAt: number;
243
+ readonly absent?: boolean;
244
+ readonly tipCommitterUnixSeconds?: number;
245
+ }
246
+ export declare function validateRawRefObservation(value: unknown): ValidationResult;
247
+ /** The activity provenance of a tracked ref: when it was last really worked on, and how that is known. */
248
+ export interface RefActivityDto {
249
+ readonly activityAt: number;
250
+ readonly signal: ActivitySignalKind;
251
+ }
252
+ /**
253
+ * The neutral tracked state of one ref: creation, deletion and recreation are
254
+ * separate observations (generation bumps once per reappearance after an
255
+ * absence). `oid` is null exactly while the latest observation is a deletion;
256
+ * `activity` is never refreshed by merely observing the same target again.
257
+ */
258
+ export interface TrackedRefDto {
259
+ readonly refName: string;
260
+ readonly kind: RefKind;
261
+ readonly oid: string | null;
262
+ readonly generation: number;
263
+ readonly activity: RefActivityDto | null;
264
+ readonly deletedAt: number | null;
265
+ readonly lastObservedAt: number;
266
+ }
267
+ /** The HEAD of one registered worktree, as the host resolved it. */
268
+ export type WorktreeHead = {
269
+ readonly kind: "branch";
270
+ readonly refName: string;
271
+ } | {
272
+ readonly kind: "detached";
273
+ readonly oid: string;
274
+ } | {
275
+ readonly kind: "unborn";
276
+ };
277
+ /** One provenance record of why an OID is a root. */
278
+ export interface RootSourceDto {
279
+ readonly signal: RootSelectionSignal;
280
+ readonly refName: string | null;
281
+ readonly worktreeId: string | null;
282
+ readonly activityAt: number | null;
283
+ readonly generation: number | null;
284
+ }
285
+ /** A selected history root: one qualified OID plus every provenance source that selected it. */
286
+ export interface SelectedRootDto {
287
+ readonly qualifiedOid: QualifiedOid;
288
+ /** Rev expression for the walk: always the observed OID (ref names are mobile provenance, never walk input). */
289
+ readonly rev: string;
290
+ readonly sources: readonly RootSourceDto[];
291
+ }
292
+ /**
293
+ * A previously ingested root, retained for investigation whatever later
294
+ * happens to its ref (expiry, deletion, recreation, force-push). Durable
295
+ * retention/reconstruction itself is R1's lot; this record is the neutral
296
+ * retained-root fact the persistence port keeps queryable.
297
+ */
298
+ export interface RetainedRootDto {
299
+ readonly cloneId: string;
300
+ readonly algorithm: OidAlgorithm;
301
+ readonly oid: string;
302
+ readonly firstSeenAt: number;
303
+ readonly firstSignal: RootSelectionSignal;
304
+ readonly refName: string | null;
305
+ }
306
+ /** Authorized author/committer identity of a commit, as recorded in the object. */
307
+ export interface HistoryIdentityDto {
308
+ readonly name: string;
309
+ readonly email: string;
310
+ readonly unixSeconds: number;
311
+ readonly offsetMinutes: number;
312
+ }
313
+ /**
314
+ * One immutable commit fact of the retained DAG (spec §3 Commit/Parent):
315
+ * algorithm-qualified OID, tree, ORDERED parents, authorized identities and
316
+ * message, extraction and policy versions. Shared immutably by every branch,
317
+ * PR head and worktree that reaches it; there is no commit × branch edge.
318
+ */
319
+ /**
320
+ * One changed file of a commit against one ordered parent: the path is kept
321
+ * as raw bytes (never line-parsed) and the line counts come from numstat
322
+ * (null when the content is binary or non-textual).
323
+ */
324
+ export interface HistoryFileChangeDto {
325
+ readonly path: Uint8Array;
326
+ readonly previousPath: Uint8Array | null;
327
+ readonly status: string;
328
+ readonly statusScore: number | null;
329
+ readonly oldMode: string;
330
+ readonly newMode: string;
331
+ readonly oldOid: string;
332
+ readonly newOid: string;
333
+ readonly added: number | null;
334
+ readonly deleted: number | null;
335
+ }
336
+ /** The changed files of one commit against one of its ordered parents. */
337
+ export interface HistoryParentDiffDto {
338
+ /** -1 means the empty-tree comparison of a parentless (root) commit. */
339
+ readonly parentIndex: number;
340
+ readonly files: readonly HistoryFileChangeDto[];
341
+ }
342
+ export interface HistoryCommitFactDto {
343
+ readonly cloneId: string;
344
+ readonly algorithm: OidAlgorithm;
345
+ readonly oid: string;
346
+ readonly tree: string;
347
+ readonly parents: readonly string[];
348
+ readonly author: HistoryIdentityDto;
349
+ readonly committer: HistoryIdentityDto;
350
+ readonly subject: string;
351
+ readonly message: Uint8Array;
352
+ /** Changed files per ordered parent (L2a extraction); part of the durable fact. */
353
+ readonly parentDiffs: readonly HistoryParentDiffDto[];
354
+ readonly extractorVersion: string;
355
+ readonly policyVersion: string;
356
+ }
357
+ /**
358
+ * An extraction checkpoint (spec §6): an OID is marked extracted for one
359
+ * extraction version only after the required fact set has durable
360
+ * acknowledgement. A checkpoint is extraction progress, never complete
361
+ * ancestry by itself: ancestry completeness is the separately derived
362
+ * frontier (closure over recorded parents). A known-but-partial OID is not
363
+ * a checkpoint and not a traversal stop.
364
+ */
365
+ export interface HistoryCheckpointDto {
366
+ readonly cloneId: string;
367
+ readonly algorithm: OidAlgorithm;
368
+ readonly oid: string;
369
+ readonly tree: string;
370
+ readonly parents: readonly string[];
371
+ readonly extractorVersion: string;
372
+ readonly policyVersion: string;
373
+ }
374
+ export interface HistoryCompletionQuery {
375
+ readonly cloneId: string;
376
+ readonly algorithm: OidAlgorithm;
377
+ readonly extractorVersion: string;
378
+ readonly policyVersion: string;
379
+ }
380
+ export interface HistoryCompletionState {
381
+ /** OIDs extracted for this extractor version (extraction checkpoints). */
382
+ readonly knownComplete: readonly string[];
383
+ /**
384
+ * The checkpoints behind knownComplete, parents included: the engine derives
385
+ * the ancestry frontier (closure over parents) from these, so a checkpoint
386
+ * whose parents are not durable never counts as complete ancestry.
387
+ */
388
+ readonly checkpoints: readonly HistoryCheckpointDto[];
389
+ readonly retainedRoots: readonly RetainedRootDto[];
390
+ }
391
+ /**
392
+ * THE injected persistence port (plan/09 L2b: a port, never a base). Engram
393
+ * defines the contract only; cluster-mesh (L3) and the app implement it. The
394
+ * interface deliberately exposes no commit × branch edge and no query surface
395
+ * beyond completion and retained roots: branch membership is derived from the
396
+ * retained DAG and current refs, never persisted (spec §4).
397
+ */
398
+ export interface HistoryPersistencePort {
399
+ loadCompletion(query: HistoryCompletionQuery): Promise<HistoryCompletionState>;
400
+ persistCommitFact(fact: HistoryCommitFactDto): Promise<{
401
+ received: true;
402
+ }>;
403
+ recordCompletion(checkpoint: HistoryCheckpointDto): Promise<{
404
+ received: true;
405
+ }>;
406
+ recordRetainedRoot(root: RetainedRootDto): Promise<{
407
+ received: true;
408
+ }>;
409
+ }
410
+ /**
411
+ * Explicit dag coverage (spec §4, A04): shallow boundaries, missing objects
412
+ * and inaccessible roots are explicit gaps; a gap never silently degrades
413
+ * into a current/complete claim.
414
+ */
415
+ /**
416
+ * Structured cause of a dag coverage gap: a missing object (an OID the clone
417
+ * does not hold) versus a grafted shallow boundary (ancestry cut by the host
418
+ * declaration). Anything else is a protocol failure the caller sees as a
419
+ * thrown error, never as coverage.
420
+ */
421
+ export type HistoryCoverageCause = "missing-object" | "shallow-boundary";
422
+ export interface HistoryCoverageReportDto {
423
+ readonly axis: "dag";
424
+ readonly state: CoverageState;
425
+ readonly reason: string;
426
+ readonly cause: HistoryCoverageCause;
427
+ /** Grafted shallow boundary OIDs (state "partial"). */
428
+ readonly boundary?: readonly QualifiedOid[];
429
+ /** Missing object OIDs (state "unavailable"). */
430
+ readonly missing?: readonly QualifiedOid[];
431
+ }
432
+ /**
433
+ * Lexical normalization applied to the host-resolved common-dir realpath
434
+ * before key derivation: trailing slashes are stripped (the filesystem
435
+ * root alone is kept). The host resolves symlinks to the realpath before
436
+ * calling; this function performs no I/O.
437
+ */
438
+ export declare function normalizeCommonDirRealpath(realpath: string): string;
439
+ export declare function validateCloneIdentity(identity: unknown): ValidationResult;
440
+ export declare function validateWorktreeIdentity(identity: unknown): ValidationResult;
441
+ export declare function validatePrivatePurgeRequest(request: unknown): ValidationResult;
442
+ /** The coverage axis retention reports on: object availability, never DAG currency. */
443
+ export declare const RETENTION_COVERAGE_AXIS: "object-availability";
444
+ /** Why a retention coverage gap exists: a required receipt is not durably recorded. */
445
+ export type RetentionCoverageCause = "missing-receipt";
446
+ export interface RetentionCoverageReportDto {
447
+ readonly axis: "object-availability";
448
+ readonly state: CoverageState;
449
+ readonly reason: string;
450
+ readonly cause: RetentionCoverageCause;
451
+ /** Required OIDs without a scoped durable receipt (state "unavailable"). */
452
+ readonly missing?: readonly QualifiedOid[];
453
+ }
454
+ /**
455
+ * One scoped retention request: the neutral producer asks the host to
456
+ * acquire and protect the pinned committed object. Scope is tenant + clone
457
+ * (clone-scoped, never worktree-scoped, never global). `firstSignal` is the
458
+ * current pass's first L2b selection source for the OID (sources are
459
+ * precedence-ordered: default, worktree, PR, window, then retained), and
460
+ * `refName` carries the current pass's selecting ref when one exists, else
461
+ * null (detached/retained roots). Neither is the historic first ingestion:
462
+ * that provenance stays on RetainedRootDto (firstSignal/refName at first
463
+ * sighting, kept queryable by the history persistence port), so a deleted
464
+ * ref re-requested as previously-ingested loses no history — the historic
465
+ * record is read there, not overwritten here.
466
+ * No content field exists by construction.
467
+ */
468
+ export interface RetentionRequestDto {
469
+ readonly scope: LiveScope;
470
+ readonly algorithm: OidAlgorithm;
471
+ readonly oid: string;
472
+ readonly firstSignal: RootSelectionSignal;
473
+ readonly refName: string | null;
474
+ readonly requestedAt: number;
475
+ }
476
+ /**
477
+ * One scoped durable receipt: the host confirms the pinned object is
478
+ * protected in its private store. `backupRef` is the opaque
479
+ * coordinated-backup reference L8 coordinates (stable per scope/OID);
480
+ * it carries no content and never publishes a raw pack.
481
+ */
482
+ export interface RetentionReceiptDto {
483
+ readonly scope: LiveScope;
484
+ readonly algorithm: OidAlgorithm;
485
+ readonly oid: string;
486
+ readonly receivedAt: number;
487
+ readonly backupRef: string;
488
+ }
489
+ /** The receipt lookup scope: tenant + clone plus the object-format algorithm. */
490
+ export interface RetentionReceiptQuery {
491
+ readonly scope: LiveScope;
492
+ readonly algorithm: OidAlgorithm;
493
+ }
494
+ export declare function validateRetentionRequest(request: unknown): ValidationResult;
495
+ export declare function validateRetentionReceipt(receipt: unknown): ValidationResult;
496
+ export declare function validateDeclarationRevocation(revocation: unknown): ValidationResult;
497
+ /** Every PR state indexed by live (drafts are open + isDraft true). */
498
+ export declare const PULL_REQUEST_STATES: readonly ["open", "closed", "merged"];
499
+ export type PullRequestState = (typeof PULL_REQUEST_STATES)[number];
500
+ export declare function isPullRequestState(value: unknown): value is PullRequestState;
501
+ /** Merge strategies stay distinguished; unknown means not yet evidenced. */
502
+ export declare const PULL_REQUEST_MERGE_STRATEGIES: readonly ["merge", "squash", "rebase", "unknown"];
503
+ export type PullRequestMergeStrategy = (typeof PULL_REQUEST_MERGE_STRATEGIES)[number];
504
+ export declare function isPullRequestMergeStrategy(value: unknown): value is PullRequestMergeStrategy;
505
+ /** Transport failure kinds: each preserves last success with stale coverage. */
506
+ export declare const PR_SYNC_ERROR_KINDS: readonly ["offline", "auth_required", "rate_limited", "unavailable", "protocol"];
507
+ export type PrSyncErrorKind = (typeof PR_SYNC_ERROR_KINDS)[number];
508
+ export declare function isPrSyncErrorKind(value: unknown): value is PrSyncErrorKind;
509
+ /** Neutral object-job lifecycle, independent of the metadata cursor. */
510
+ export declare const PR_OBJECT_JOB_STATES: readonly ["pending", "acquired", "failed"];
511
+ export type PrObjectJobState = (typeof PR_OBJECT_JOB_STATES)[number];
512
+ export declare function isPrObjectJobState(value: unknown): value is PrObjectJobState;
513
+ /** PR coverage axes (spec §12): metadata, objects and attribution separate. */
514
+ export declare const PR_COVERAGE_AXES: readonly ["pr-metadata", "object-availability", "pr-attribution"];
515
+ export type PrCoverageAxis = (typeof PR_COVERAGE_AXES)[number];
516
+ /** Explicit end-of-list proof: the only accepted complete-sweep terminator. */
517
+ export declare const PR_END_PROOF: "end-of-list";
518
+ export type PrEndProof = typeof PR_END_PROOF;
519
+ /** Service-owned refs for private PR acquisition (H executor, never the clone). */
520
+ export declare const PRIVATE_PR_REF_PREFIX = "refs/live-private/pr/";
521
+ /** Keys that must never enter a PR fact (tokens stay out of rows/logs). */
522
+ export declare const PR_FACT_FORBIDDEN_KEYS: readonly ["token", "credential", "secret", "authorization"];
523
+ /** A GitHub repository identity (owner + name, no URL, no credential). */
524
+ export interface GithubRepositoryDto {
525
+ readonly owner: string;
526
+ readonly repo: string;
527
+ }
528
+ /**
529
+ * One neutral PR observation: identity, all-state state/dates, pinned
530
+ * head/base observations and merge evidence. Historical bounds are pinned
531
+ * values, never derived from today's base.
532
+ */
533
+ export interface PullRequestFactDto {
534
+ readonly repositoryOwner: string;
535
+ readonly repositoryRepo: string;
536
+ readonly number: number;
537
+ readonly state: PullRequestState;
538
+ readonly isDraft: boolean;
539
+ readonly updatedAt: number;
540
+ readonly headOid: QualifiedOid;
541
+ readonly headRef: string;
542
+ readonly baseOid: QualifiedOid;
543
+ readonly baseRef: string;
544
+ readonly mergeOid?: QualifiedOid | null;
545
+ readonly mergeStrategy?: PullRequestMergeStrategy;
546
+ }
547
+ /** One transport page item: same shape as the persisted observation. */
548
+ export type PrPageItemDto = PullRequestFactDto;
549
+ /**
550
+ * One GitHub listing page over the INJECTED transport. Termination is
551
+ * coherent: hasMore false requires endProof AND a null nextCursor (a
552
+ * continuation cursor with an end proof is contradictory, never complete);
553
+ * hasMore true requires a non-empty nextCursor and carries no endProof.
554
+ * page.etag, when present, is the validator for this exact
555
+ * (repository, filter, cursor) position only, never for another page.
556
+ */
557
+ export interface PrPageDto {
558
+ readonly items: readonly PrPageItemDto[];
559
+ readonly nextCursor: string | null;
560
+ readonly hasMore: boolean;
561
+ readonly endProof?: PrEndProof;
562
+ readonly etag?: string | null;
563
+ }
564
+ /**
565
+ * Durable sync cursor: continuation/retry state with overlap discipline.
566
+ * Validators stay bound to their position: etagsByCursor maps one ETag per
567
+ * requested (filter, cursor) position so a conditional retry never sends
568
+ * page N's validator for page M. lastEtag keeps the most recently seen
569
+ * validator for hosts that only read a scalar.
570
+ */
571
+ export interface PrSyncCursorDto {
572
+ readonly repositoryOwner: string;
573
+ readonly repositoryRepo: string;
574
+ readonly updatedAtCursor: number | null;
575
+ readonly lastSuccessAt: number | null;
576
+ readonly lastEtag: string | null;
577
+ readonly etagsByCursor?: Record<string, string> | null;
578
+ readonly sweepKind: "incremental" | "full";
579
+ readonly pendingRetry?: {
580
+ readonly kind: PrSyncErrorKind;
581
+ readonly attempts: number;
582
+ readonly nextAfter: number;
583
+ } | null;
584
+ }
585
+ /** One neutral object-acquisition job, independent of the metadata cursor. */
586
+ export interface PrObjectJobDto {
587
+ readonly repositoryOwner: string;
588
+ readonly repositoryRepo: string;
589
+ readonly prNumber: number;
590
+ readonly headOid: QualifiedOid;
591
+ readonly state: PrObjectJobState;
592
+ readonly attempts: number;
593
+ readonly lastError?: PrSyncErrorKind | null;
594
+ readonly acquiredOid?: QualifiedOid | null;
595
+ readonly totalCommits?: number | null;
596
+ readonly acquiredCommits?: number | null;
597
+ }
598
+ /**
599
+ * Pinned historical attribution, separate from ancestry. "complete" needs
600
+ * observed head/base bounds plus at least one merge-base OID; anything else
601
+ * is "partial" while the acquired ancestry stays available. An unknown base
602
+ * stays an explicit null (never replaced by the head OID): a null baseOid
603
+ * is always "partial".
604
+ */
605
+ export interface PrAttributionDto {
606
+ readonly repositoryOwner: string;
607
+ readonly repositoryRepo: string;
608
+ readonly prNumber: number;
609
+ readonly baseOid: QualifiedOid | null;
610
+ readonly headOid: QualifiedOid;
611
+ readonly mergeBaseOids: readonly QualifiedOid[];
612
+ readonly mergeOid?: QualifiedOid | null;
613
+ readonly mergeStrategy: PullRequestMergeStrategy;
614
+ readonly status: "complete" | "partial";
615
+ readonly reason: string;
616
+ }
617
+ /** Explicit PR coverage per axis; unknown is never current. */
618
+ export interface PrCoverageDto {
619
+ readonly axis: PrCoverageAxis;
620
+ readonly state: CoverageState;
621
+ readonly reason: string;
622
+ readonly lastSuccessAt?: number | null;
623
+ }
624
+ /**
625
+ * Metadata receipt for the S mapping: metadata completion never implies
626
+ * object completion. S refuses to acknowledge a failed private acquisition.
627
+ */
628
+ export interface PrMetadataReceiptDto {
629
+ readonly batchId: string;
630
+ readonly repositoryOwner: string;
631
+ readonly repositoryRepo: string;
632
+ readonly prNumbers: readonly number[];
633
+ readonly cursor: PrSyncCursorDto;
634
+ readonly metadataComplete: boolean;
635
+ readonly objectComplete: boolean;
636
+ }
637
+ /** Private acquisition request for the H executor (pinned OID, service ref). */
638
+ export interface PrivateObjectAcquisitionRequestDto {
639
+ readonly repositoryOwner: string;
640
+ readonly repositoryRepo: string;
641
+ readonly prNumber: number;
642
+ readonly headOid: QualifiedOid;
643
+ readonly serviceRef: string;
644
+ }
645
+ export declare function validateGithubRepository(value: unknown): ValidationResult;
646
+ export declare function validatePullRequestFact(value: unknown): ValidationResult;
647
+ export declare function validatePrPage(value: unknown): ValidationResult;
648
+ export declare function validatePrSyncCursor(value: unknown): ValidationResult;
649
+ export declare function validatePrObjectJob(value: unknown): ValidationResult;
650
+ export declare function validatePrAttribution(value: unknown): ValidationResult;
651
+ export declare function validatePrivateObjectAcquisitionRequest(value: unknown): ValidationResult;
652
+ /** Versioned local-diff normalization evidence (spec §8: rename detection and thresholds are versioned evidence). */
653
+ export declare const LOCAL_DIFF_NORMALIZER_VERSION = "local-diff-normalizer/1";
654
+ /** Versioned deterministic content-policy rules stamped on every L4b fact. */
655
+ export declare const CONTENT_POLICY_VERSION = "live-content-policy/1";
656
+ /** Explicit coverage marker when no protection key authorizes local content. */
657
+ export declare const CONTENT_UNAVAILABLE = "content_unavailable";
658
+ /** Files larger than this are excluded before any content read (matches the L4a capture bound). */
659
+ export declare const LOCAL_MAX_FILE_BYTES = 1048576;
660
+ /** The three distinct local comparisons (spec §8; GitNexus staged/unstaged/reference distinction). */
661
+ export declare const LOCAL_DIFF_KINDS: readonly ["staged", "unstaged", "conflict"];
662
+ export type LocalDiffKind = (typeof LOCAL_DIFF_KINDS)[number];
663
+ export declare function isLocalDiffKind(value: unknown): value is LocalDiffKind;
664
+ /** Immutable recorded endpoint of one local comparison. */
665
+ export declare const LOCAL_DIFF_ENDPOINT_LABELS: readonly ["HEAD", "index", "worktree", "empty-tree", "oid"];
666
+ export type LocalDiffEndpointLabel = (typeof LOCAL_DIFF_ENDPOINT_LABELS)[number];
667
+ export interface LocalDiffEndpointDto {
668
+ readonly label: LocalDiffEndpointLabel;
669
+ /** Null exactly for the worktree and empty-tree endpoints; otherwise an algorithm hex OID/digest. */
670
+ readonly oid: string | null;
671
+ }
672
+ /** Why a path carries metadata only, never an invented text hunk. */
673
+ export declare const LOCAL_EXCLUSION_REASONS: readonly ["binary", "oversized", "unknown-size", "filtered", "protected", "symlink", "gitlink", "unstable-capture", "deleted"];
674
+ export type LocalExclusionReason = (typeof LOCAL_EXCLUSION_REASONS)[number];
675
+ /**
676
+ * Closed withheld reasons (L4b M1: no free text toward the sink).
677
+ * Secret-rule values name the matched deterministic rule only; the secret
678
+ * itself never appears. `withheld-no-protection-key` is the no-key
679
+ * downgrade of a single hunk.
680
+ */
681
+ export declare const LOCAL_WITHHELD_REASONS: readonly ["withheld-secret-aws-access-key", "withheld-secret-github-token", "withheld-secret-private-key-block", "withheld-secret-credential-assignment", "withheld-secret-credentialed-url", "withheld-secret-unknown", "withheld-no-protection-key"];
682
+ export type LocalWithheldReason = (typeof LOCAL_WITHHELD_REASONS)[number];
683
+ export declare function isLocalWithheldReason(value: unknown): value is LocalWithheldReason;
684
+ /** Closed withheld reason for a matched deterministic secret rule (the secret itself never appears). */
685
+ export declare function withheldReasonForSecretRule(rule: string | null): LocalWithheldReason;
686
+ /** Closed seal algorithm allowlist (L4b M1: the S seat extends this list by contract amendment). */
687
+ export declare const LOCAL_SEAL_ALGORITHMS: readonly ["fake-seal/1"];
688
+ export type LocalSealAlgorithm = (typeof LOCAL_SEAL_ALGORITHMS)[number];
689
+ export declare function isLocalSealAlgorithm(value: unknown): value is LocalSealAlgorithm;
690
+ /**
691
+ * Strict opaque key reference (L4b M1: host key custody identifier, never
692
+ * free text). Charset-closed; the H seat mints values within this charset.
693
+ */
694
+ export declare function isStrictKeyRef(value: unknown): value is string;
695
+ /**
696
+ * Closed coverage reasons (L4b M1: no free sentence toward the sink).
697
+ * Values carrying `content_unavailable` mark the explicit no-content
698
+ * downgrade (CONTENT_UNAVAILABLE).
699
+ */
700
+ export declare const LOCAL_COVERAGE_REASONS: readonly ["content_unavailable:no-key", "content_unavailable:unstable-capture", "content_unavailable:unknown-size", "content_unavailable:conflict-inventory-mismatch", "content_unavailable:policy-withheld", "partial:no-snapshot-payload", "current:sealed-latest"];
701
+ export type LocalCoverageReason = (typeof LOCAL_COVERAGE_REASONS)[number];
702
+ export declare function isLocalCoverageReason(value: unknown): value is LocalCoverageReason;
703
+ /** Closed snapshot metadata-only reasons (L4b M1: the no-key downgrade reason; L4b-2: the secret-exclusion reason). */
704
+ export declare const LOCAL_SNAPSHOT_METADATA_REASONS: readonly ["metadata:unstable-capture", "metadata:no-key", "metadata:no-payload", "metadata:policy-withheld"];
705
+ export type LocalSnapshotMetadataReason = (typeof LOCAL_SNAPSHOT_METADATA_REASONS)[number];
706
+ export declare function isLocalSnapshotMetadataReason(value: unknown): value is LocalSnapshotMetadataReason;
707
+ /** Strict snapshot identity: `lsnap:` plus the 64 hex characters minted at staging. */
708
+ export declare function isStrictSnapshotId(value: unknown): value is string;
709
+ /**
710
+ * Hunk payload states. "open-lines" is transient pre-persistence evidence
711
+ * only: it never reaches a sink or a store (validateSealedLocalDiff refuses
712
+ * it). "sealed" is host-encrypted bytes; "withheld" is an explicit refusal.
713
+ */
714
+ export type LocalHunkPayloadDto = {
715
+ readonly state: "open-lines";
716
+ readonly lines: readonly string[];
717
+ } | {
718
+ readonly state: "sealed";
719
+ readonly algorithm: LocalSealAlgorithm;
720
+ readonly keyRef: string;
721
+ readonly ciphertext: Uint8Array;
722
+ } | {
723
+ readonly state: "withheld";
724
+ readonly reason: LocalWithheldReason;
725
+ };
726
+ export interface LocalHunkDto {
727
+ readonly startBefore: number;
728
+ readonly countBefore: number;
729
+ readonly startAfter: number;
730
+ readonly countAfter: number;
731
+ readonly payload: LocalHunkPayloadDto;
732
+ }
733
+ export declare const LOCAL_FILE_STATUSES: readonly ["added", "modified", "deleted", "conflict"];
734
+ export type LocalFileStatus = (typeof LOCAL_FILE_STATUSES)[number];
735
+ export interface LocalFileChangeDto {
736
+ /** Raw path bytes, byte-exact (never line-parsed); a protected path stays as metadata with an explicit exclusion while its content is withheld. */
737
+ readonly path: Uint8Array;
738
+ readonly previousPath: Uint8Array | null;
739
+ readonly status: LocalFileStatus;
740
+ readonly oldMode: string;
741
+ readonly newMode: string;
742
+ readonly oldOid: string;
743
+ readonly newOid: string;
744
+ /** Numstat line counts; null for binary/non-textual content (spec §8). */
745
+ readonly added: number | null;
746
+ readonly deleted: number | null;
747
+ readonly exclusion?: LocalExclusionReason;
748
+ /** Conflict stages 1/2/3 as separate facts, present on conflict diffs only. */
749
+ readonly stageOids?: Readonly<Record<string, string>>;
750
+ readonly hunks: readonly LocalHunkDto[];
751
+ }
752
+ /** Explicit index/working-tree coverage (spec §12; A04/A09). */
753
+ export declare const LOCAL_COVERAGE_CAUSES: readonly ["unstable-capture", "missing-key", "policy-withheld"];
754
+ export type LocalCoverageCause = (typeof LOCAL_COVERAGE_CAUSES)[number];
755
+ export interface LocalCoverageReportDto {
756
+ readonly axis: "index" | "working-tree";
757
+ readonly state: CoverageState;
758
+ readonly reason: LocalCoverageReason;
759
+ readonly cause?: LocalCoverageCause;
760
+ }
761
+ /**
762
+ * One neutral local diff: immutable endpoints, versioned normalization,
763
+ * policy-screened files. A cumulative HEAD → worktree view is not a valid
764
+ * L4b kind and never validates.
765
+ */
766
+ export interface LocalDiffDto {
767
+ readonly scope: LiveScope;
768
+ readonly worktreeId: string;
769
+ readonly kind: LocalDiffKind;
770
+ readonly base: LocalDiffEndpointDto;
771
+ readonly tip: LocalDiffEndpointDto;
772
+ readonly comparedParent?: number | null;
773
+ readonly mergeBase?: string | null;
774
+ readonly normalizerVersion: string;
775
+ readonly policyVersion: string;
776
+ readonly files: readonly LocalFileChangeDto[];
777
+ readonly coverage?: LocalCoverageReportDto;
778
+ }
779
+ /**
780
+ * The sealed latest-state payload (Q2 B). "sealed" is host-encrypted bytes
781
+ * produced BEFORE any persistent write; "metadata-only" is the no-key
782
+ * downgrade carrying ranges/metadata alone.
783
+ */
784
+ export type SealedSnapshotPayloadDto = {
785
+ readonly state: "sealed";
786
+ readonly algorithm: LocalSealAlgorithm;
787
+ readonly keyRef: string;
788
+ readonly ciphertext: Uint8Array;
789
+ } | {
790
+ readonly state: "metadata-only";
791
+ readonly reason: LocalSnapshotMetadataReason;
792
+ };
793
+ /**
794
+ * The latest authorized local state only (Q2 B): no history is retained.
795
+ * Replacement is indexed by target and generation at the sink (L4b M2):
796
+ * the snapshot carries no predecessor pointer, so two concurrent captures
797
+ * can never each retire only their own predecessor and leave two states.
798
+ * The target includes the diff kind (L4b-2): staged and conflict snapshots
799
+ * share the "index" axis but hold distinct targets, so a conflict arrival
800
+ * never replaces the staged state.
801
+ */
802
+ export interface LocalSnapshotDto {
803
+ readonly scope: LiveScope;
804
+ readonly worktreeId: string;
805
+ readonly snapshotId: string;
806
+ readonly kind: "index" | "working-tree";
807
+ /** Which local comparison this state holds: staged and conflict are distinct index targets. */
808
+ readonly diffKind: LocalDiffKind;
809
+ readonly capturedAt: number;
810
+ readonly diffDigest: string;
811
+ readonly sealed: SealedSnapshotPayloadDto;
812
+ readonly policyVersion: string;
813
+ }
814
+ export declare function validateLocalDiffEndpoint(endpoint: unknown): ValidationResult;
815
+ export declare function validateLocalCoverage(coverage: unknown): ValidationResult;
816
+ /** Structural validation of a derived (possibly transient) local diff. */
817
+ export declare function validateLocalDiff(diff: unknown): ValidationResult;
818
+ /**
819
+ * Sink/store-bound validation: transient "open-lines" hunk payloads are
820
+ * refused, so persist-then-mask cannot validate. Seal through the injected
821
+ * host protection port first, or withhold explicitly.
822
+ */
823
+ export declare function validateSealedLocalDiff(diff: unknown): ValidationResult;
824
+ /** Structural validation of the latest authorized local state (Q2 B). */
825
+ export declare function validateLocalSnapshot(snapshot: unknown): ValidationResult;