@quantiya/codevibe-core 2.0.7 → 2.0.9

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 (128) hide show
  1. package/dist/appsync/__tests__/dispose-watcher-socket.test.d.ts +1 -0
  2. package/dist/appsync/__tests__/refresh-open-prompt-ttl-chunk.test.d.ts +1 -0
  3. package/dist/appsync/appsync-client.d.ts +232 -30
  4. package/dist/appsync/queries.d.ts +2 -0
  5. package/dist/auth/__tests__/keychain-cli-nudge.test.d.ts +1 -0
  6. package/dist/auth/__tests__/keychain-cli.test.d.ts +1 -0
  7. package/dist/auth/keychain-cli.d.ts +14 -0
  8. package/dist/companion-mode/index.d.ts +14 -0
  9. package/dist/credential-broker/oauth-account-lock.d.ts +47 -1
  10. package/dist/crypto/__tests__/open-prompt-id.test.d.ts +1 -0
  11. package/dist/crypto/index.d.ts +1 -0
  12. package/dist/crypto/open-prompt-id.d.ts +36 -0
  13. package/dist/e1/__tests__/prompt-raise.test.d.ts +1 -0
  14. package/dist/e1/index.d.ts +2 -0
  15. package/dist/e1/prompt-raise.d.ts +65 -0
  16. package/dist/index.d.ts +4 -1
  17. package/dist/index.js +4652 -252
  18. package/dist/keychain/__tests__/keychain-manager.test.d.ts +1 -0
  19. package/dist/keychain/__tests__/keychain-migrate.test.d.ts +1 -0
  20. package/dist/keychain/__tests__/migrate-nudge.test.d.ts +1 -0
  21. package/dist/keychain/keychain-backend.d.ts +105 -0
  22. package/dist/keychain/keychain-manager.d.ts +17 -3
  23. package/dist/keychain/keychain-migrate.d.ts +63 -0
  24. package/dist/keychain/migrate-nudge.d.ts +38 -0
  25. package/dist/local-executor/__tests__/anchored-fs.test.d.ts +1 -0
  26. package/dist/local-executor/__tests__/bounded-directory.test.d.ts +1 -0
  27. package/dist/local-executor/__tests__/bounded-output.test.d.ts +1 -0
  28. package/dist/local-executor/__tests__/durable-directory.test.d.ts +1 -0
  29. package/dist/local-executor/__tests__/hosted-class-a-sink.test.d.ts +1 -0
  30. package/dist/local-executor/__tests__/process-identity.test.d.ts +1 -0
  31. package/dist/local-executor/__tests__/process-tree.test.d.ts +1 -0
  32. package/dist/local-executor/__tests__/protocol-backlog-wiring.test.d.ts +1 -0
  33. package/dist/local-executor/__tests__/protocol-backlog.test.d.ts +1 -0
  34. package/dist/local-executor/__tests__/publication-authority-capability.test.d.ts +1 -0
  35. package/dist/local-executor/__tests__/snapshot-merge.test.d.ts +1 -0
  36. package/dist/local-executor/__tests__/workspace-authority-fixture.d.ts +3 -0
  37. package/dist/local-executor/__tests__/workspace-authority.test.d.ts +1 -0
  38. package/dist/local-executor/__tests__/workspace-cleanup-audit.test.d.ts +1 -0
  39. package/dist/local-executor/__tests__/workspace-materializer.test.d.ts +1 -0
  40. package/dist/local-executor/agentic-disposable-repo.d.ts +23 -6
  41. package/dist/local-executor/agentic-resolve.d.ts +16 -0
  42. package/dist/local-executor/anchored-fs.d.ts +250 -0
  43. package/dist/local-executor/bounded-directory.d.ts +78 -0
  44. package/dist/local-executor/bounded-helper.d.ts +22 -0
  45. package/dist/local-executor/bounded-output.d.ts +11 -0
  46. package/dist/local-executor/class-a-emit.d.ts +13 -1
  47. package/dist/local-executor/durable-directory.d.ts +25 -0
  48. package/dist/local-executor/durable-store.d.ts +217 -25
  49. package/dist/local-executor/hosted-class-a-sink.d.ts +27 -0
  50. package/dist/local-executor/index.d.ts +3 -2
  51. package/dist/local-executor/local-executor-impl.d.ts +159 -69
  52. package/dist/local-executor/process-identity.d.ts +46 -0
  53. package/dist/local-executor/process-tree.d.ts +123 -0
  54. package/dist/local-executor/protocol-backlog.d.ts +62 -0
  55. package/dist/local-executor/revert-reconcile.d.ts +4 -0
  56. package/dist/local-executor/revert-runner.d.ts +14 -1
  57. package/dist/local-executor/snapshot-merge.d.ts +124 -0
  58. package/dist/local-executor/task-group-types.d.ts +7 -6
  59. package/dist/local-executor/team-execution-flag.d.ts +2 -2
  60. package/dist/local-executor/track-registry.d.ts +2 -0
  61. package/dist/local-executor/types.d.ts +33 -2
  62. package/dist/local-executor/verification-gates/build.d.ts +5 -0
  63. package/dist/local-executor/verification-gates/deploy-preflight.d.ts +2 -0
  64. package/dist/local-executor/verification-gates/diff-sanity.d.ts +12 -0
  65. package/dist/local-executor/verification-gates/hostile-grep.d.ts +2 -0
  66. package/dist/local-executor/verification-gates/lint.d.ts +2 -0
  67. package/dist/local-executor/verification-gates/shell-runner.d.ts +5 -0
  68. package/dist/local-executor/verification-gates/source-traceability.d.ts +2 -0
  69. package/dist/local-executor/verification-gates/tests.d.ts +3 -0
  70. package/dist/local-executor/verification-gates/typecheck.d.ts +3 -0
  71. package/dist/local-executor/verification-runner.d.ts +6 -0
  72. package/dist/local-executor/workspace-authority.d.ts +45 -0
  73. package/dist/local-executor/workspace-cleanup-audit.d.ts +3 -0
  74. package/dist/local-executor/workspace-materializer.d.ts +48 -0
  75. package/dist/local-executor/workspace-shadow.d.ts +380 -85
  76. package/dist/orchestration-shell/__tests__/advisory-attachment-journal.test.d.ts +1 -0
  77. package/dist/orchestration-shell/__tests__/direct-file-delete.test.d.ts +1 -0
  78. package/dist/orchestration-shell/__tests__/flag-command.test.d.ts +1 -0
  79. package/dist/orchestration-shell/__tests__/halt-message-wire-content.test.d.ts +1 -0
  80. package/dist/orchestration-shell/__tests__/planner-offer-e1.test.d.ts +1 -0
  81. package/dist/orchestration-shell/__tests__/workspace-shutdown.test.d.ts +1 -0
  82. package/dist/orchestration-shell/advisory-attachment-journal.d.ts +165 -0
  83. package/dist/orchestration-shell/attachments.d.ts +47 -58
  84. package/dist/orchestration-shell/audit-browser.d.ts +54 -1
  85. package/dist/orchestration-shell/bounded-shutdown.d.ts +6 -0
  86. package/dist/orchestration-shell/cli.d.ts +10 -0
  87. package/dist/orchestration-shell/cli.js +38355 -27300
  88. package/dist/orchestration-shell/context-items.d.ts +3 -0
  89. package/dist/orchestration-shell/declared-test-runner.d.ts +21 -2
  90. package/dist/orchestration-shell/direct-file-delete.d.ts +22 -0
  91. package/dist/orchestration-shell/emit-shell-event.d.ts +7 -0
  92. package/dist/orchestration-shell/explicit-tty-exit.d.ts +1 -2
  93. package/dist/orchestration-shell/flag-command.d.ts +81 -0
  94. package/dist/orchestration-shell/gate-decision-submit.d.ts +11 -0
  95. package/dist/orchestration-shell/gate-prompts.d.ts +116 -0
  96. package/dist/orchestration-shell/index.d.ts +34 -6
  97. package/dist/orchestration-shell/planner-offer-e1.d.ts +97 -0
  98. package/dist/orchestration-shell/quorum-loop.d.ts +312 -61
  99. package/dist/orchestration-shell/reducer.d.ts +9 -0
  100. package/dist/orchestration-shell/task-progress.d.ts +18 -4
  101. package/dist/orchestration-shell/team-decompose.d.ts +10 -10
  102. package/dist/orchestration-shell/types.d.ts +90 -2
  103. package/dist/orchestration-shell/workspace-shutdown.d.ts +47 -0
  104. package/dist/reviewer/output-parser.d.ts +19 -0
  105. package/dist/reviewer/providers/codex.d.ts +5 -3
  106. package/dist/reviewer/token-usage.d.ts +41 -12
  107. package/dist/reviewer/types.d.ts +6 -0
  108. package/dist/reviewer/verdict-classifier.d.ts +1 -0
  109. package/dist/session/session-rekey.d.ts +4 -3
  110. package/dist/substrate/__tests__/command-runner.test.d.ts +1 -0
  111. package/dist/substrate/command-runner.d.ts +2 -0
  112. package/dist/substrate/docker.d.ts +7 -32
  113. package/dist/substrate/index.d.ts +0 -1
  114. package/dist/substrate/sandbox-exec.d.ts +0 -13
  115. package/dist/substrate/types.d.ts +15 -2
  116. package/dist/substrate-launch/__tests__/reviewer-credential-preflight.test.d.ts +1 -0
  117. package/dist/substrate-launch/engage-substrate.d.ts +3 -0
  118. package/dist/substrate-launch/index.d.ts +2 -0
  119. package/dist/substrate-launch/reviewer-credential-preflight.d.ts +50 -0
  120. package/dist/test-publication-authority-setup.d.ts +1 -0
  121. package/dist/tool-activity/replay-cursor.d.ts +42 -8
  122. package/dist/track-presentation.d.ts +2 -0
  123. package/dist/track-presentation.test.d.ts +1 -0
  124. package/dist/types/encryption.d.ts +5 -0
  125. package/dist/types/events.d.ts +5 -0
  126. package/package.json +3 -3
  127. package/dist/substrate/git-proxy.d.ts +0 -35
  128. /package/dist/{substrate/__tests__/git-proxy.test.d.ts → appsync/__tests__/appsync-client-flag-locator.test.d.ts} +0 -0
@@ -0,0 +1,250 @@
1
+ import { type WorkspaceRootAuthority } from './workspace-authority.js';
2
+ type PublicationPrivateRetirementStage = 'commit-rename' | 'commit-unlink' | 'commit-sync' | 'pending-rename' | 'pending-unlink' | 'pending-sync' | 'retiring-rename' | 'retiring-unlink' | 'retiring-sync' | 'disposed-rename' | 'disposed-unlink' | 'disposed-sync';
3
+ export interface AnchoredPublicationAuthorityResidue {
4
+ recordName: string;
5
+ authorityId: string;
6
+ targetParentCanonicalPath?: string;
7
+ targetName?: string;
8
+ /** Caller label for an authority-id owner-prefix match. */
9
+ ownerLabel?: string;
10
+ /** Read/schema failure retained for a scoped, therefore attributable, record. */
11
+ unresolvedDetail?: string;
12
+ }
13
+ /**
14
+ * Fresh bounded inventory of private publication records targeting exact
15
+ * durable parent paths or carrying exact caller-owner fingerprints. Teardown
16
+ * uses this only after all owned writers have drained; any remaining record is
17
+ * therefore retained authority, not a cache. Owner fingerprints are encoded in
18
+ * the record name before its body is written, so partial/non-JSON staging
19
+ * remains visible without adopting unrelated private records.
20
+ */
21
+ export declare function listAnchoredPublicationAuthorityResidueForParents(parentCanonicalPaths: readonly string[], owners?: readonly {
22
+ ownerKey: string;
23
+ label: string;
24
+ }[]): Promise<AnchoredPublicationAuthorityResidue[]>;
25
+ export declare class AnchoredFileRemovalDurabilityError extends Error {
26
+ readonly code = "EANCHOREDFILEREMOVALDURABILITY";
27
+ readonly removed = true;
28
+ readonly durabilityUncertain = true;
29
+ constructor(message: string);
30
+ }
31
+ export declare function isAnchoredFileRemovalDurabilityError(err: unknown): err is AnchoredFileRemovalDurabilityError;
32
+ export interface AnchoredFsIdentity {
33
+ dev: string;
34
+ ino: string;
35
+ /** Optional inode-reuse fence. Snapshot-root deletion always supplies it. */
36
+ birthtimeNs?: string;
37
+ /** Optional canonical-name binding, checked immediately before tree rename. */
38
+ canonicalPath?: string;
39
+ }
40
+ export interface AnchoredPathIdentity extends AnchoredFsIdentity {
41
+ birthtimeNs: string;
42
+ canonicalPath: string;
43
+ mtimeMs: number;
44
+ kind: 'file' | 'directory';
45
+ }
46
+ export interface AnchoredCommittedFile extends AnchoredFsIdentity {
47
+ birthtimeNs: string;
48
+ canonicalPath: string;
49
+ mode: number;
50
+ mtimeMs: number;
51
+ sha256: string;
52
+ }
53
+ export interface AnchoredReadFile extends AnchoredFsIdentity {
54
+ birthtimeNs: string;
55
+ canonicalPath: string;
56
+ bytes: Buffer;
57
+ mode: number;
58
+ mtimeMs: number;
59
+ /** Exact immediate parent inode that owned the file throughout the read. */
60
+ parent: AnchoredFsIdentity & {
61
+ birthtimeNs: string;
62
+ canonicalPath: string;
63
+ };
64
+ }
65
+ export interface AnchoredHashedFile extends AnchoredFsIdentity {
66
+ birthtimeNs: string;
67
+ canonicalPath: string;
68
+ sha256: string;
69
+ size: number;
70
+ mode: number;
71
+ mtimeMs: number;
72
+ parent: AnchoredFsIdentity & {
73
+ birthtimeNs: string;
74
+ canonicalPath: string;
75
+ };
76
+ }
77
+ /** Complete same-request witness required when opening an enumerated file. */
78
+ export interface AnchoredFileWitness extends AnchoredFsIdentity {
79
+ birthtimeNs: string;
80
+ canonicalPath: string;
81
+ size: bigint;
82
+ mtimeNs: string;
83
+ ctimeNs: string;
84
+ nlink: string;
85
+ }
86
+ /** True only when a failed atomic write deliberately left fail-closed recovery authority. */
87
+ export declare function isUnresolvedAnchoredPublicationError(err: unknown): boolean;
88
+ /** Read one bounded file through the deadline helper and return its bytes. */
89
+ export declare function anchoredReadFileWithinRoot(root: string, relativePath: string, opts: {
90
+ maxBytes: number;
91
+ expectedRoot?: AnchoredFsIdentity | WorkspaceRootAuthority;
92
+ /** Exact enumerated leaf incarnation that must be opened. */
93
+ expectedFile?: AnchoredFileWitness;
94
+ /** Reject a multiply-linked leaf throughout the complete read. */
95
+ requireSingleLink?: boolean;
96
+ beforeOpen?: () => Promise<void> | void;
97
+ beforeAbsent?: () => Promise<void> | void;
98
+ afterStat?: () => Promise<void> | void;
99
+ afterRead?: () => Promise<void> | void;
100
+ helperTimeoutMs?: number;
101
+ testHangBeforeRead?: boolean;
102
+ testHangStage?: 'open' | 'read' | 'close';
103
+ }): Promise<AnchoredReadFile | null>;
104
+ /** Stream and hash one bounded file entirely in the deadline helper. */
105
+ export declare function anchoredHashFileWithinRoot(root: string, relativePath: string, opts: {
106
+ maxBytes: number;
107
+ expectedRoot?: AnchoredFsIdentity | WorkspaceRootAuthority;
108
+ beforeOpen?: () => Promise<void> | void;
109
+ afterStat?: () => Promise<void> | void;
110
+ afterRead?: () => Promise<void> | void;
111
+ helperTimeoutMs?: number;
112
+ testHangStage?: 'open' | 'read' | 'close';
113
+ }): Promise<AnchoredHashedFile | null>;
114
+ export type AnchoredWritePrecondition = {
115
+ kind: 'absent';
116
+ } | {
117
+ kind: 'existing';
118
+ dev: string;
119
+ ino: string;
120
+ mode: number;
121
+ sha256: string;
122
+ };
123
+ export declare function captureAnchoredIdentity(target: string, opts?: {
124
+ /** @internal lower deterministic helper deadline for tests. */
125
+ helperTimeoutMs?: number;
126
+ /** @internal deterministic parent-preflight stall seam. */
127
+ testHangBeforeReady?: boolean;
128
+ expectedType?: 'file' | 'directory';
129
+ /** Full parent incarnation for root-relative stat consumers. */
130
+ expectedParent?: AnchoredFsIdentity | WorkspaceRootAuthority;
131
+ /** @internal after missing child, before public-parent re-authentication. */
132
+ beforeAbsent?: () => Promise<void> | void;
133
+ }): Promise<AnchoredPathIdentity>;
134
+ /** Create or reopen one real direct-child directory under an exact parent. */
135
+ export declare function anchoredEnsureDirectory(parent: WorkspaceRootAuthority, name: string, mode?: number): Promise<WorkspaceRootAuthority>;
136
+ export interface AnchoredEnsuredDirectory {
137
+ authority: WorkspaceRootAuthority;
138
+ /** True only when this exact anchored helper invocation won the mkdir. */
139
+ created: boolean;
140
+ }
141
+ /**
142
+ * Create or reopen one real direct-child directory while reporting mkdir
143
+ * ownership from inside the anchored helper, not from a caller-side stat.
144
+ */
145
+ export declare function anchoredEnsureDirectoryWithOwnership(parent: WorkspaceRootAuthority, name: string, mode?: number): Promise<AnchoredEnsuredDirectory>;
146
+ /** Create one new direct-child directory without adopting a pre-existing name. */
147
+ export declare function anchoredCreateDirectory(parent: WorkspaceRootAuthority, name: string, mode?: number): Promise<WorkspaceRootAuthority>;
148
+ export declare function captureAnchoredWritePrecondition(filePath: string, maxBytes: number, afterStat?: () => Promise<void> | void, expectedParent?: AnchoredFsIdentity | WorkspaceRootAuthority): Promise<AnchoredWritePrecondition>;
149
+ export declare function anchoredAtomicWrite(filePath: string, data: string | Buffer, opts: {
150
+ expected: AnchoredWritePrecondition;
151
+ mode?: number;
152
+ beforeCommit?: () => Promise<void> | void;
153
+ /** @internal deterministic seam after exact-state validation while the cross-process lock is held. */
154
+ afterValidation?: () => Promise<void> | void;
155
+ /** @internal bypass only for cross-process lock regression tests. */
156
+ serializeInProcess?: boolean;
157
+ /** @internal deterministic helper-crash seam for stale-temp recovery tests. */
158
+ crashAfterTempStage?: 'create' | 'write' | 'fsync';
159
+ /** @internal simulate disagreement from a repeated native owner probe. */
160
+ testMismatchedCurrentTempOwnerHash?: boolean;
161
+ /** @internal deterministic seam once an independent helper is waiting on the writer fence. */
162
+ afterLockContention?: () => Promise<void> | void;
163
+ /** @internal deterministic independent commit-authority crash seam. */
164
+ crashPublicationCommitStage?: 'create' | 'partial-write' | 'fsync';
165
+ /** @internal deterministic committed-cleanup crash seam. */
166
+ crashPublicationRetirementStage?: 'temp' | 'recovery' | 'quarantine' | 'marker' | 'commit';
167
+ /** @internal deterministic private transaction crash seam. */
168
+ crashPublicationPrivateRetirementStage?: PublicationPrivateRetirementStage;
169
+ /** @internal deterministic seam before committed prepared-temp disposition. */
170
+ beforePreparedTempRetirement?: (tempPath: string) => Promise<void> | void;
171
+ /** @internal deterministic seam at the final temp-name disposition boundary. */
172
+ beforePreparedTempFinalization?: (tempPath: string) => Promise<void> | void;
173
+ /** @internal after desktop proof is durable, immediately before guard unlink. */
174
+ beforePublicationAuthorityFinalization?: (tempPath: string) => Promise<void> | void;
175
+ /** Exact parent directory that must own the mutation. */
176
+ expectedParent?: AnchoredFsIdentity | WorkspaceRootAuthority;
177
+ /** Maximum existing/temp target bytes the helper may read or hash. */
178
+ maxTargetBytes: number;
179
+ /**
180
+ * Stable task/session ownership key for private crash authority. It is
181
+ * hashed before crossing the helper boundary and never written verbatim.
182
+ */
183
+ publicationOwnerKey?: string;
184
+ /** @internal deterministic post-publication directory-fsync failure seam. */
185
+ failDirectorySync?: boolean;
186
+ /** @internal deterministic seam immediately before an exact final unlink. */
187
+ beforeFinalRemove?: (quarantinePath: string) => Promise<void> | void;
188
+ /** @internal exact syscall seam before an existing target is quarantined. */
189
+ beforeTargetQuarantine?: (targetPath: string, quarantinePath: string) => Promise<void> | void;
190
+ /** @internal lower deterministic helper deadline for tests. */
191
+ helperTimeoutMs?: number;
192
+ /** @internal deterministic blocked-helper seam. */
193
+ testHangBeforeReady?: boolean;
194
+ }): Promise<AnchoredCommittedFile>;
195
+ /**
196
+ * Hold one crash-reclaimable, inode-anchored cross-process lock for the full
197
+ * lifetime of `operation`. The callback process and its OS creation identity
198
+ * own the lock; the helper merely performs anchored acquisition/release. A
199
+ * helper crash cannot split the fence, and PID reuse cannot inherit it.
200
+ * The lock file itself carries no application authority.
201
+ */
202
+ export declare function withAnchoredExclusiveLock<T>(lockPath: string, operation: () => Promise<T>, opts?: {
203
+ /** Maximum time to wait for another live owner; ownership itself has no lease. */
204
+ acquireTimeoutMs?: number;
205
+ /** Exact parent directory that must contain the lock. */
206
+ expectedParent?: AnchoredFsIdentity | WorkspaceRootAuthority;
207
+ /** Cancel only while waiting to acquire; once entered, `operation` owns shutdown semantics. */
208
+ signal?: AbortSignal;
209
+ /** @internal deterministic seam immediately before exact lock-artifact removal. */
210
+ beforeFinalRemove?: (quarantinePath: string) => Promise<void> | void;
211
+ /** @internal kill the acquisition helper after LOCKED to prove owner continuity. */
212
+ crashHelperAfterAcquire?: boolean;
213
+ /** @internal lower deterministic helper deadline for tests. */
214
+ helperTimeoutMs?: number;
215
+ }): Promise<T>;
216
+ export declare function anchoredRemoveTree(target: string, identity: WorkspaceRootAuthority, opts?: {
217
+ beforeCommit?: () => Promise<void> | void;
218
+ afterRename?: (tombstonePath: string) => Promise<void> | void;
219
+ /** @internal lower deterministic helper/tree-cleaner deadline for tests. */
220
+ helperTimeoutMs?: number;
221
+ /** @internal deterministic blocked-helper seam. */
222
+ testHangBeforeReady?: boolean;
223
+ /** @internal deterministic blocked recursive tree-cleaner seam. */
224
+ testHangTreeCleaner?: boolean;
225
+ }): Promise<void>;
226
+ export declare function anchoredRemoveFile(filePath: string, expectedIdentity?: AnchoredFsIdentity, opts?: {
227
+ beforeFinalRemove?: (quarantinePath: string) => Promise<void> | void;
228
+ expectedParent?: AnchoredFsIdentity | WorkspaceRootAuthority;
229
+ /** @internal deterministic post-unlink directory-fsync failure seam. */
230
+ failDirectorySync?: boolean;
231
+ }): Promise<void>;
232
+ /** Reclaim dead helper temp/lock/release/token residue for one anchored marker path. */
233
+ export declare function anchoredCleanupWriteArtifacts(filePath: string, opts?: {
234
+ waitForLive?: boolean;
235
+ beforeFinalRemove?: (quarantinePath: string) => Promise<void> | void;
236
+ helperTimeoutMs?: number;
237
+ /** Exact parent directory that must own every recovered artifact. */
238
+ expectedParent?: AnchoredFsIdentity | WorkspaceRootAuthority;
239
+ /** @internal deterministic restart-disposition race seam. */
240
+ beforePreparedTempFinalization?: (tempPath: string) => Promise<void> | void;
241
+ /** @internal deterministic final guard-link race seam. */
242
+ beforePublicationAuthorityFinalization?: (tempPath: string) => Promise<void> | void;
243
+ /** @internal deterministic private transaction crash seam. */
244
+ crashPublicationPrivateRetirementStage?: PublicationPrivateRetirementStage;
245
+ }): Promise<void>;
246
+ export declare function anchoredRemoveEmptyDirectory(dir: string, expectedIdentity?: AnchoredFsIdentity, opts?: {
247
+ /** Exact parent directory that must own the retiring child. */
248
+ expectedParent?: AnchoredFsIdentity | WorkspaceRootAuthority;
249
+ }): Promise<void>;
250
+ export {};
@@ -0,0 +1,78 @@
1
+ import type { Dirent } from 'node:fs';
2
+ import type { WorkspaceRootAuthority } from './workspace-authority.js';
3
+ /** Shared metadata ceilings for every CodeVibe-owned filesystem traversal. */
4
+ export declare const MAX_METADATA_ENTRY_COUNT = 100000;
5
+ export declare const MAX_METADATA_PATH_BYTES: number;
6
+ export interface MetadataBudget {
7
+ entries: number;
8
+ utf8PathBytes: number;
9
+ readonly maxEntries: number;
10
+ readonly maxUtf8PathBytes: number;
11
+ }
12
+ export declare function createMetadataBudget(maxEntries?: number, maxUtf8PathBytes?: number): MetadataBudget;
13
+ /**
14
+ * Retry a complete read-only operation when a bounded directory keeps the same
15
+ * authenticated inode but gains or loses a child during one enumeration.
16
+ *
17
+ * The operation must create fresh metadata budgets on every invocation. Only
18
+ * same-inode content churn is retried: root replacement, identity loss,
19
+ * malformed authority, helper timeout, and every other failure remain
20
+ * immediate and fail closed.
21
+ */
22
+ export declare function withTransientDirectoryEnumerationRetry<T>(operation: () => Promise<T>, opts?: {
23
+ maxAttempts?: number;
24
+ retryDelaysMs?: readonly number[];
25
+ sleep?: (ms: number) => Promise<void>;
26
+ }): Promise<T>;
27
+ /** Charge one path before retaining it or doing work derived from it. */
28
+ export declare function consumeMetadataPath(budget: MetadataBudget, value: string, label: string): void;
29
+ /** Validate an existing collection incrementally, without an intermediate map. */
30
+ export declare function assertMetadataPathCollection(values: Iterable<string>, label: string, budget?: MetadataBudget): void;
31
+ /** Validate object-backed path collections without allocating `items.map(...)`. */
32
+ export declare function assertMetadataItemPathCollection<T>(items: Iterable<T>, pathOf: (item: T) => string, label: string, budget?: MetadataBudget): void;
33
+ export interface BoundedDirectoryStat {
34
+ dev: string;
35
+ ino: string;
36
+ birthtimeNs: string;
37
+ canonicalPath: string;
38
+ size: bigint;
39
+ mtimeMs: number;
40
+ mtimeNs: string;
41
+ ctimeNs: string;
42
+ nlink: string;
43
+ }
44
+ /** Metadata captured in the same isolated enumeration request, when requested. */
45
+ export declare function boundedDirectoryStat(entry: Dirent): BoundedDirectoryStat | undefined;
46
+ /**
47
+ * Enumerate a directory in an isolated process group. The helper's absolute
48
+ * deadline is armed before its first target-filesystem access, so a blocked
49
+ * FUSE/network open, read, or close cannot retain a desktop lifecycle lock.
50
+ * Entries are streamed and charged in the desktop before being retained.
51
+ */
52
+ export declare function readDirectoryBounded(dirPath: string, budget: MetadataBudget, label: string, relativePrefix?: string, opts?: {
53
+ /** @internal lower deterministic helper deadline for tests. */
54
+ helperTimeoutMs?: number;
55
+ /** @internal deterministic target-filesystem stall seam. */
56
+ testHangStage?: 'open' | 'read' | 'stat' | 'close';
57
+ /** Capture lstat metadata inside the same deadline-bound worker request. */
58
+ includeStats?: boolean;
59
+ /** @internal deterministic seam after a missing component, before acknowledgement. */
60
+ beforeMissing?: () => Promise<void> | void;
61
+ /** @internal deterministic seam before final public-chain authentication. */
62
+ beforeCompletion?: () => Promise<void> | void;
63
+ /** Exact directory inode that must own the enumeration. */
64
+ expectedDirectory?: {
65
+ dev: string;
66
+ ino: string;
67
+ birthtimeNs?: string;
68
+ canonicalPath?: string;
69
+ size?: bigint;
70
+ mtimeNs?: string;
71
+ ctimeNs?: string;
72
+ nlink?: string;
73
+ };
74
+ /** Persisted root authority used to enter the complete relative chain. */
75
+ rootAuthority?: WorkspaceRootAuthority;
76
+ /** Directory path relative to `rootAuthority` (empty means the root). */
77
+ relativeDirectory?: string;
78
+ }): Promise<Dirent[]>;
@@ -0,0 +1,22 @@
1
+ import { type ChildProcess, type SpawnOptions } from 'node:child_process';
2
+ /** Production ceiling for one helper protocol wait or helper subtree. */
3
+ export declare const DEFAULT_HELPER_TIMEOUT_MS: number;
4
+ export declare const MAX_HELPER_TIMEOUT_MS: number;
5
+ /** Cleanup is itself bounded; callers must never wait forever for `close`. */
6
+ export declare const DEFAULT_HELPER_TERMINATION_TIMEOUT_MS = 5000;
7
+ /** Absolute deadline inherited by recursive helper descendants. */
8
+ export declare const HELPER_DEADLINE_ENV = "CODEVIBE_HELPER_DEADLINE_AT_MS";
9
+ export declare const HELPER_TIMEOUT_ENV = "CODEVIBE_HELPER_TIMEOUT_MS";
10
+ export declare function resolveHelperTimeout(value: number | undefined): number;
11
+ export declare function helperDeadlineEnv(timeoutMs: number): Record<string, string>;
12
+ /** Spawn every top-level helper in its own POSIX process group. */
13
+ export declare function spawnIsolatedHelper(command: string, args: readonly string[], options: SpawnOptions): ChildProcess;
14
+ export declare function observeChildClose(child: ChildProcess): Promise<number | null>;
15
+ export declare function withHelperDeadline<T>(work: Promise<T>, timeoutMs: number, label: string): Promise<T>;
16
+ /**
17
+ * Best-effort full-tree termination with a hard upper bound on cleanup wait.
18
+ * POSIX helpers are isolated process-group leaders. Windows uses taskkill's
19
+ * `/T` tree semantics and then a direct-kill fallback; neither path is awaited
20
+ * without a deadline.
21
+ */
22
+ export declare function terminateHelperTree(child: ChildProcess | undefined, closed: Promise<unknown> | undefined, timeoutMs?: number): Promise<void>;
@@ -0,0 +1,11 @@
1
+ /** Maximum retained bytes per stdout/stderr stream; pipes are still fully drained. */
2
+ export declare const MAX_RETAINED_PROCESS_OUTPUT_BYTES: number;
3
+ export declare class BoundedOutputBuffer {
4
+ private readonly limit;
5
+ private chunks;
6
+ private bytes;
7
+ constructor(limit?: number);
8
+ push(value: Buffer | string): void;
9
+ toBuffer(): Buffer;
10
+ toString(): string;
11
+ }
@@ -2,7 +2,7 @@ import type { AdapterProgressEnvelope } from '../adapter/progress';
2
2
  import { AuthorityRefusal, AuthorityRefusalCategory } from './authority';
3
3
  import { type DeviceSigningKey } from './class-a-sign';
4
4
  import { AgentKind, FailureClass, ProcessRole } from './types';
5
- export type ExecutionEventKind = 'PROCESS_SPAWNED' | 'TOOL_USE' | 'FILE_CHANGE' | 'VERIFICATION_RUN' | 'PROCESS_EXITED';
5
+ export type ExecutionEventKind = 'PROCESS_SPAWNED' | 'TOOL_USE' | 'FILE_CHANGE' | 'VERIFICATION_RUN' | 'PROCESS_EXITED' | 'TRACK_PROGRESS';
6
6
  export type ClassAMessageType = 'EXECUTION_EVENT' | 'EXECUTOR_REFUSAL' | 'VERIFICATION_RESULT' | 'ADAPTER_PROGRESS';
7
7
  export interface ClassAEnvelope {
8
8
  messageVersion: 1;
@@ -51,6 +51,15 @@ export interface ProcessExitedPayload {
51
51
  exitCode: number;
52
52
  failureClass: FailureClass;
53
53
  }
54
+ /** Team-child liveness fact; its hosted audit append renews the exact lease. */
55
+ export interface TrackProgressPayload {
56
+ kind: 'TRACK_PROGRESS';
57
+ taskGroupId: string;
58
+ trackIndex: number;
59
+ dispatchGeneration: number;
60
+ phase: 'track_spawned' | 'lease_heartbeat';
61
+ sequence: number;
62
+ }
54
63
  export interface ExecutorRefusalPayload {
55
64
  refusedMessageId: string;
56
65
  refusalCategory: AuthorityRefusalCategory;
@@ -124,6 +133,9 @@ export declare class ClassAEmitter {
124
133
  failureClass: FailureClass;
125
134
  occurredAt?: string;
126
135
  }): Promise<void>;
136
+ emitTrackProgress(ctx: ClassAEmitterContext, args: Omit<TrackProgressPayload, 'kind'> & {
137
+ occurredAt?: string;
138
+ }): Promise<void>;
127
139
  emitExecutorRefusal(ctx: ClassAEmitterContext, args: {
128
140
  refusal: AuthorityRefusal;
129
141
  refusedMessageId: string;
@@ -0,0 +1,25 @@
1
+ export interface DurableDirectoryIdentity {
2
+ canonicalPath: string;
3
+ dev: string;
4
+ ino: string;
5
+ birthtimeNs: string;
6
+ mtimeMs: number;
7
+ created: boolean;
8
+ }
9
+ /**
10
+ * Create/validate a directory tree and seal every acknowledged target with
11
+ * child-then-parent fsync inside a killable, deadline-bound helper.
12
+ */
13
+ export declare function ensureDurableDirectoryTree(target: string, opts?: {
14
+ /** Existing durable ancestor; every controlled descendant is resealed on every retry. */
15
+ anchorPath?: string;
16
+ mode?: number;
17
+ enforceTargetMode?: boolean;
18
+ helperTimeoutMs?: number;
19
+ /** @internal deterministic durability failure seam. */
20
+ failDirectorySyncStage?: 'created-child' | 'created-parent' | 'target-child' | 'target-parent';
21
+ /** @internal deterministic target-filesystem stall seam. */
22
+ testHangStage?: 'anchor-open' | 'component-open' | 'mkdir' | 'created-child' | 'created-parent' | 'target-child' | 'target-parent';
23
+ /** @internal replace the live anchor after binding; proves cwd anchoring and final rejection. */
24
+ testSwapAnchorTo?: string;
25
+ }): Promise<DurableDirectoryIdentity>;