@quantiya/codevibe-codex-plugin 2.0.51 → 2.0.53
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.
- package/node_modules/@quantiya/codevibe-core/dist/index.d.ts +4 -1
- package/node_modules/@quantiya/codevibe-core/dist/index.js +559 -536
- package/node_modules/@quantiya/codevibe-core/dist/local-executor/anchored-fs.d.ts +20 -1
- package/node_modules/@quantiya/codevibe-core/dist/local-executor/bounded-directory.d.ts +1 -14
- package/node_modules/@quantiya/codevibe-core/dist/local-executor/bounded-helper.d.ts +1 -1
- package/node_modules/@quantiya/codevibe-core/dist/local-executor/durable-directory.d.ts +0 -4
- package/node_modules/@quantiya/codevibe-core/dist/local-executor/process-tree.d.ts +9 -0
- package/node_modules/@quantiya/codevibe-core/dist/local-executor/shadow-protocol.d.ts +6 -0
- package/node_modules/@quantiya/codevibe-core/dist/local-executor/shadow-recovery.d.ts +55 -13
- package/node_modules/@quantiya/codevibe-core/dist/local-executor/workspace-authority.d.ts +2 -0
- package/node_modules/@quantiya/codevibe-core/dist/local-executor/workspace-shadow.d.ts +3 -2
- package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/cli.d.ts +55 -3
- package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/cli.js +3819 -851
- package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/components/OrchestrationApp.d.ts +1 -0
- package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/doctor-cli.d.ts +79 -3
- package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/emit-shell-event.d.ts +2 -0
- package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/index.d.ts +4 -2
- package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/quorum-loop.d.ts +115 -2
- package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/status-format.d.ts +1 -1
- package/node_modules/@quantiya/codevibe-core/dist/planner/client.d.ts +3 -0
- package/node_modules/@quantiya/codevibe-core/dist/planner/composite-adapter.d.ts +39 -0
- package/node_modules/@quantiya/codevibe-core/dist/planner/index.d.ts +1 -0
- package/node_modules/@quantiya/codevibe-core/dist/substrate-launch/index.d.ts +1 -1
- package/node_modules/@quantiya/codevibe-core/dist/substrate-launch/reviewer-credential-preflight.d.ts +26 -0
- package/node_modules/@quantiya/codevibe-core/package.json +2 -2
- package/package.json +3 -3
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type WorkspaceRootAuthority } from './workspace-authority.js';
|
|
2
2
|
type PublicationPrivateRetirementStage = 'disposed-publish' | '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 declare function invalidatePublicationAuthorityStoreCache(): void;
|
|
3
4
|
export interface AnchoredPublicationAuthorityResidue {
|
|
4
5
|
recordName: string;
|
|
5
6
|
authorityId: string;
|
|
@@ -100,6 +101,7 @@ export declare function anchoredReadFileWithinRoot(root: string, relativePath: s
|
|
|
100
101
|
helperTimeoutMs?: number;
|
|
101
102
|
testHangBeforeRead?: boolean;
|
|
102
103
|
testHangStage?: 'open' | 'read' | 'close';
|
|
104
|
+
signal?: AbortSignal;
|
|
103
105
|
}): Promise<AnchoredReadFile | null>;
|
|
104
106
|
/** Stream and hash one bounded file entirely in the deadline helper. */
|
|
105
107
|
export declare function anchoredHashFileWithinRoot(root: string, relativePath: string, opts: {
|
|
@@ -110,6 +112,7 @@ export declare function anchoredHashFileWithinRoot(root: string, relativePath: s
|
|
|
110
112
|
afterRead?: () => Promise<void> | void;
|
|
111
113
|
helperTimeoutMs?: number;
|
|
112
114
|
testHangStage?: 'open' | 'read' | 'close';
|
|
115
|
+
signal?: AbortSignal;
|
|
113
116
|
}): Promise<AnchoredHashedFile | null>;
|
|
114
117
|
export type AnchoredWritePrecondition = {
|
|
115
118
|
kind: 'absent';
|
|
@@ -130,6 +133,7 @@ export declare function captureAnchoredIdentity(target: string, opts?: {
|
|
|
130
133
|
expectedParent?: AnchoredFsIdentity | WorkspaceRootAuthority;
|
|
131
134
|
/** @internal after missing child, before public-parent re-authentication. */
|
|
132
135
|
beforeAbsent?: () => Promise<void> | void;
|
|
136
|
+
signal?: AbortSignal;
|
|
133
137
|
}): Promise<AnchoredPathIdentity>;
|
|
134
138
|
/** Create or reopen one real direct-child directory under an exact parent. */
|
|
135
139
|
export declare function anchoredEnsureDirectory(parent: WorkspaceRootAuthority, name: string, mode?: number): Promise<WorkspaceRootAuthority>;
|
|
@@ -145,7 +149,10 @@ export interface AnchoredEnsuredDirectory {
|
|
|
145
149
|
export declare function anchoredEnsureDirectoryWithOwnership(parent: WorkspaceRootAuthority, name: string, mode?: number): Promise<AnchoredEnsuredDirectory>;
|
|
146
150
|
/** Create one new direct-child directory without adopting a pre-existing name. */
|
|
147
151
|
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
|
|
152
|
+
export declare function captureAnchoredWritePrecondition(filePath: string, maxBytes: number, afterStat?: () => Promise<void> | void, expectedParent?: AnchoredFsIdentity | WorkspaceRootAuthority, opts?: {
|
|
153
|
+
helperTimeoutMs?: number;
|
|
154
|
+
signal?: AbortSignal;
|
|
155
|
+
}): Promise<AnchoredWritePrecondition>;
|
|
149
156
|
export declare function anchoredAtomicWrite(filePath: string, data: string | Buffer, opts: {
|
|
150
157
|
expected: AnchoredWritePrecondition;
|
|
151
158
|
mode?: number;
|
|
@@ -191,6 +198,7 @@ export declare function anchoredAtomicWrite(filePath: string, data: string | Buf
|
|
|
191
198
|
helperTimeoutMs?: number;
|
|
192
199
|
/** @internal deterministic blocked-helper seam. */
|
|
193
200
|
testHangBeforeReady?: boolean;
|
|
201
|
+
signal?: AbortSignal;
|
|
194
202
|
}): Promise<AnchoredCommittedFile>;
|
|
195
203
|
/**
|
|
196
204
|
* Hold one crash-reclaimable, inode-anchored cross-process lock for the full
|
|
@@ -218,6 +226,8 @@ export declare function anchoredRemoveTree(target: string, identity: WorkspaceRo
|
|
|
218
226
|
afterRename?: (tombstonePath: string) => Promise<void> | void;
|
|
219
227
|
/** @internal lower deterministic helper/tree-cleaner deadline for tests. */
|
|
220
228
|
helperTimeoutMs?: number;
|
|
229
|
+
/** Optional cancellation signal to bound helper execution. */
|
|
230
|
+
signal?: AbortSignal;
|
|
221
231
|
/** @internal deterministic blocked-helper seam. */
|
|
222
232
|
testHangBeforeReady?: boolean;
|
|
223
233
|
/** @internal deterministic blocked recursive tree-cleaner seam. */
|
|
@@ -228,12 +238,15 @@ export declare function anchoredRemoveFile(filePath: string, expectedIdentity?:
|
|
|
228
238
|
expectedParent?: AnchoredFsIdentity | WorkspaceRootAuthority;
|
|
229
239
|
/** @internal deterministic post-unlink directory-fsync failure seam. */
|
|
230
240
|
failDirectorySync?: boolean;
|
|
241
|
+
helperTimeoutMs?: number;
|
|
242
|
+
signal?: AbortSignal;
|
|
231
243
|
}): Promise<void>;
|
|
232
244
|
/** Reclaim dead helper temp/lock/release/token residue for one anchored marker path. */
|
|
233
245
|
export declare function anchoredCleanupWriteArtifacts(filePath: string, opts?: {
|
|
234
246
|
waitForLive?: boolean;
|
|
235
247
|
beforeFinalRemove?: (quarantinePath: string) => Promise<void> | void;
|
|
236
248
|
helperTimeoutMs?: number;
|
|
249
|
+
signal?: AbortSignal;
|
|
237
250
|
/** Exact parent directory that must own every recovered artifact. */
|
|
238
251
|
expectedParent?: AnchoredFsIdentity | WorkspaceRootAuthority;
|
|
239
252
|
/** @internal deterministic restart-disposition race seam. */
|
|
@@ -246,5 +259,11 @@ export declare function anchoredCleanupWriteArtifacts(filePath: string, opts?: {
|
|
|
246
259
|
export declare function anchoredRemoveEmptyDirectory(dir: string, expectedIdentity?: AnchoredFsIdentity, opts?: {
|
|
247
260
|
/** Exact parent directory that must own the retiring child. */
|
|
248
261
|
expectedParent?: AnchoredFsIdentity | WorkspaceRootAuthority;
|
|
262
|
+
helperTimeoutMs?: number;
|
|
263
|
+
signal?: AbortSignal;
|
|
249
264
|
}): Promise<void>;
|
|
265
|
+
export declare function withWriteLock<T>(filePath: string, operation: () => Promise<T>, opts?: {
|
|
266
|
+
signal?: AbortSignal;
|
|
267
|
+
timeoutMs?: number;
|
|
268
|
+
}): Promise<T>;
|
|
250
269
|
export {};
|
|
@@ -43,24 +43,13 @@ export interface BoundedDirectoryStat {
|
|
|
43
43
|
}
|
|
44
44
|
/** Metadata captured in the same isolated enumeration request, when requested. */
|
|
45
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
46
|
export declare function readDirectoryBounded(dirPath: string, budget: MetadataBudget, label: string, relativePrefix?: string, opts?: {
|
|
53
|
-
/** @internal lower deterministic helper deadline for tests. */
|
|
54
47
|
helperTimeoutMs?: number;
|
|
55
|
-
|
|
48
|
+
signal?: AbortSignal;
|
|
56
49
|
testHangStage?: 'open' | 'read' | 'stat' | 'close';
|
|
57
|
-
/** Capture lstat metadata inside the same deadline-bound worker request. */
|
|
58
50
|
includeStats?: boolean;
|
|
59
|
-
/** @internal deterministic seam after a missing component, before acknowledgement. */
|
|
60
51
|
beforeMissing?: () => Promise<void> | void;
|
|
61
|
-
/** @internal deterministic seam before final public-chain authentication. */
|
|
62
52
|
beforeCompletion?: () => Promise<void> | void;
|
|
63
|
-
/** Exact directory inode that must own the enumeration. */
|
|
64
53
|
expectedDirectory?: {
|
|
65
54
|
dev: string;
|
|
66
55
|
ino: string;
|
|
@@ -71,8 +60,6 @@ export declare function readDirectoryBounded(dirPath: string, budget: MetadataBu
|
|
|
71
60
|
ctimeNs?: string;
|
|
72
61
|
nlink?: string;
|
|
73
62
|
};
|
|
74
|
-
/** Persisted root authority used to enter the complete relative chain. */
|
|
75
63
|
rootAuthority?: WorkspaceRootAuthority;
|
|
76
|
-
/** Directory path relative to `rootAuthority` (empty means the root). */
|
|
77
64
|
relativeDirectory?: string;
|
|
78
65
|
}): Promise<Dirent[]>;
|
|
@@ -12,7 +12,7 @@ export declare function helperDeadlineEnv(timeoutMs: number): Record<string, str
|
|
|
12
12
|
/** Spawn every top-level helper in its own POSIX process group. */
|
|
13
13
|
export declare function spawnIsolatedHelper(command: string, args: readonly string[], options: SpawnOptions): ChildProcess;
|
|
14
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>;
|
|
15
|
+
export declare function withHelperDeadline<T>(work: Promise<T>, timeoutMs: number, label: string, signal?: AbortSignal): Promise<T>;
|
|
16
16
|
/**
|
|
17
17
|
* Best-effort full-tree termination with a hard upper bound on cleanup wait.
|
|
18
18
|
* POSIX helpers are isolated process-group leaders. Windows uses taskkill's
|
|
@@ -6,10 +6,6 @@ export interface DurableDirectoryIdentity {
|
|
|
6
6
|
mtimeMs: number;
|
|
7
7
|
created: boolean;
|
|
8
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
9
|
export declare function ensureDurableDirectoryTree(target: string, opts?: {
|
|
14
10
|
/** Existing durable ancestor; every controlled descendant is resealed on every retry. */
|
|
15
11
|
anchorPath?: string;
|
|
@@ -24,6 +24,8 @@ export declare function spawnPosixOwnedProcess(command: string, args: readonly s
|
|
|
24
24
|
/** @internal deterministic directory-durability failure seam. */
|
|
25
25
|
syncOwnerDirectory?: (dir: string, file: string) => Promise<void>;
|
|
26
26
|
}): ChildProcess;
|
|
27
|
+
export declare function processOwnerRoot(): string;
|
|
28
|
+
export declare function ensureProcessOwnerRoot(): Promise<WorkspaceRootAuthority>;
|
|
27
29
|
/** Original-handle status channel; missing/malformed status fails closed. */
|
|
28
30
|
export declare function processHostCleanupStatus(child: ChildProcess, ownership: ProcessTreeOwnership): Promise<boolean>;
|
|
29
31
|
/** Durable target-group identity emitted before the supervised command settles. */
|
|
@@ -70,10 +72,13 @@ export interface ProcessCleanupOwner {
|
|
|
70
72
|
/** OS-native process incarnation, not reusable with the numeric PID/PGID. */
|
|
71
73
|
incarnationId: string;
|
|
72
74
|
}
|
|
75
|
+
export declare function validateProcessCleanupOwner(value: ProcessCleanupOwner): void;
|
|
73
76
|
/** Restart/session-start sweep for owners durably published before user code ran. */
|
|
74
77
|
export declare function reapDurableProcessOwners(opts?: {
|
|
75
78
|
/** @internal isolated registry root for tests. */
|
|
76
79
|
rootDir?: string;
|
|
80
|
+
/** Optional cancellation signal to bound sweep execution. */
|
|
81
|
+
signal?: AbortSignal;
|
|
77
82
|
/** @internal deterministic same-inode growth seam. */
|
|
78
83
|
afterOwnerStat?: (file: string) => Promise<void> | void;
|
|
79
84
|
/** @internal lower deterministic helper deadline for tests. */
|
|
@@ -88,6 +93,8 @@ export declare function reapDurableProcessOwners(opts?: {
|
|
|
88
93
|
reaped: number;
|
|
89
94
|
retained: number;
|
|
90
95
|
}>;
|
|
96
|
+
export declare function validateDesktopProcessIdentity(value: ProcessIdentity | undefined): asserts value is ProcessIdentity;
|
|
97
|
+
export declare function legacyOwnerRecordIsDefinitelyRetired(owner: ProcessCleanupOwner): Promise<boolean>;
|
|
91
98
|
export declare class ProcessTreeTerminationError extends Error {
|
|
92
99
|
constructor(message: string);
|
|
93
100
|
}
|
|
@@ -112,6 +119,7 @@ export declare function terminateOwnedProcessTree(args: {
|
|
|
112
119
|
ownership: ProcessTreeOwnership;
|
|
113
120
|
directKill: () => void;
|
|
114
121
|
timeoutMs?: number;
|
|
122
|
+
signal?: AbortSignal;
|
|
115
123
|
/** @internal deterministic POSIX signal seam. */
|
|
116
124
|
processKill?: ProcessKill;
|
|
117
125
|
/** @internal deterministic POSIX wait seam. */
|
|
@@ -127,5 +135,6 @@ export declare function retryProcessCleanupOwner(owner: ProcessCleanupOwner, sea
|
|
|
127
135
|
readProcessIncarnation?: ReadProcessIncarnation;
|
|
128
136
|
sleep?: (ms: number) => Promise<void>;
|
|
129
137
|
timeoutMs?: number;
|
|
138
|
+
signal?: AbortSignal;
|
|
130
139
|
}): Promise<void>;
|
|
131
140
|
export {};
|
|
@@ -218,8 +218,14 @@ export interface ShadowEnv {
|
|
|
218
218
|
sleep?: (ms: number) => Promise<void>;
|
|
219
219
|
/** Override the per-task state dir root (default `~/.codevibe/shadow-state`). */
|
|
220
220
|
stateRootDir?: string;
|
|
221
|
+
/** Override the process owner root (default `~/.codevibe/process-owners`). */
|
|
222
|
+
ownerRootDir?: string;
|
|
221
223
|
/** Override the shadow temp-dir root (default `os.tmpdir()`). */
|
|
222
224
|
shadowRootDir?: string;
|
|
225
|
+
/** Optional cancellation signal to bound sweep execution. */
|
|
226
|
+
signal?: AbortSignal;
|
|
227
|
+
/** Optional helper timeout in milliseconds for subprocess operations. */
|
|
228
|
+
helperTimeoutMs?: number;
|
|
223
229
|
/** @internal lower deterministic limit for serialized-marker boundary tests. */
|
|
224
230
|
maxStateMarkerBytes?: number;
|
|
225
231
|
/** TTL for the GC reaper. */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as fs from 'node:fs/promises';
|
|
1
2
|
import { type AnchoredFsIdentity, type AnchoredCommittedFile, type AnchoredPathIdentity, type AnchoredWritePrecondition } from './anchored-fs';
|
|
2
3
|
import { type ProcessCleanupOwner } from './process-tree';
|
|
3
4
|
import { type ProcessIdentity } from './process-identity';
|
|
@@ -138,19 +139,34 @@ export declare function isWithinRoot(root: string, candidate: string): boolean;
|
|
|
138
139
|
export declare function assertSafeStateComponent(value: string): void;
|
|
139
140
|
export declare function stateFileNameForShadow(shadowDir: string): string;
|
|
140
141
|
export declare function exposureRetentionFileNameForShadow(shadowDir: string): string;
|
|
141
|
-
export declare function writeExposureRetentionMarker(stateFile: string, marker: ExposureRetentionMarker, expectedStateDir: WorkspaceRootAuthority, onCommitted?: (fileAuthority: RetainedStateFileAuthority, stateDirAuthority: WorkspaceRootAuthority) => void
|
|
142
|
+
export declare function writeExposureRetentionMarker(stateFile: string, marker: ExposureRetentionMarker, expectedStateDir: WorkspaceRootAuthority, onCommitted?: (fileAuthority: RetainedStateFileAuthority, stateDirAuthority: WorkspaceRootAuthority) => void, opts?: {
|
|
143
|
+
helperTimeoutMs?: number;
|
|
144
|
+
signal?: AbortSignal;
|
|
145
|
+
}): Promise<void>;
|
|
142
146
|
/** Publish an exact, durable delete decision before recursive removal begins. */
|
|
143
|
-
export declare function publishExposureDeleteDisposition(stateFile: string, marker: ExposureRetentionMarker, authority: WorkspaceRootAuthority, expectedStateDir: WorkspaceRootAuthority, onCommitted?: (fileAuthority: RetainedStateFileAuthority, stateDirAuthority: WorkspaceRootAuthority) => void
|
|
147
|
+
export declare function publishExposureDeleteDisposition(stateFile: string, marker: ExposureRetentionMarker, authority: WorkspaceRootAuthority, expectedStateDir: WorkspaceRootAuthority, onCommitted?: (fileAuthority: RetainedStateFileAuthority, stateDirAuthority: WorkspaceRootAuthority) => void, opts?: {
|
|
148
|
+
helperTimeoutMs?: number;
|
|
149
|
+
signal?: AbortSignal;
|
|
150
|
+
}): Promise<ExposureRetentionMarker>;
|
|
144
151
|
/** Persist that the disposition completed and no physical bytes remain owned. */
|
|
145
|
-
export declare function publishExposureReclaimed(stateFile: string, marker: ExposureRetentionMarker, expectedStateDir: WorkspaceRootAuthority, onCommitted?: (fileAuthority: RetainedStateFileAuthority, stateDirAuthority: WorkspaceRootAuthority) => void
|
|
152
|
+
export declare function publishExposureReclaimed(stateFile: string, marker: ExposureRetentionMarker, expectedStateDir: WorkspaceRootAuthority, onCommitted?: (fileAuthority: RetainedStateFileAuthority, stateDirAuthority: WorkspaceRootAuthority) => void, opts?: {
|
|
153
|
+
helperTimeoutMs?: number;
|
|
154
|
+
signal?: AbortSignal;
|
|
155
|
+
}): Promise<ExposureRetentionMarker>;
|
|
146
156
|
/** Retire a negative bridge only when its generated public name is absent. */
|
|
147
|
-
export declare function removeExposureRetentionMarkerIfPublicAbsent(stateFile: string, publicShadowDir: string, expected: ExposureRetentionMarker, shadowRoot: string, physicalCopyScope: string, expectedStateDir?: WorkspaceRootAuthority, expectedFileAuthority?: RetainedStateFileAuthority
|
|
157
|
+
export declare function removeExposureRetentionMarkerIfPublicAbsent(stateFile: string, publicShadowDir: string, expected: ExposureRetentionMarker, shadowRoot: string, physicalCopyScope: string, expectedStateDir?: WorkspaceRootAuthority, expectedFileAuthority?: RetainedStateFileAuthority, opts?: {
|
|
158
|
+
helperTimeoutMs?: number;
|
|
159
|
+
signal?: AbortSignal;
|
|
160
|
+
}): Promise<boolean>;
|
|
148
161
|
export interface ExposureRetentionSnapshot {
|
|
149
162
|
marker: ExposureRetentionMarker;
|
|
150
163
|
stateFileIdentity: AnchoredPathIdentity;
|
|
151
164
|
stateDirAuthority: WorkspaceRootAuthority;
|
|
152
165
|
}
|
|
153
|
-
export declare function readExposureRetentionMarkerSnapshot(stateFile: string, taskId: string, shadowRoot: string, physicalCopyScope: string, expectedStateDir?: WorkspaceRootAuthority
|
|
166
|
+
export declare function readExposureRetentionMarkerSnapshot(stateFile: string, taskId: string, shadowRoot: string, physicalCopyScope: string, expectedStateDir?: WorkspaceRootAuthority, opts?: {
|
|
167
|
+
helperTimeoutMs?: number;
|
|
168
|
+
signal?: AbortSignal;
|
|
169
|
+
}): Promise<ExposureRetentionSnapshot>;
|
|
154
170
|
export declare function shadowLifecycleLockPath(shadowRoot: string, snapshotPath: string): string;
|
|
155
171
|
export declare function buildCasRecoveryAuthority(root: WorkspaceRootAuthority, baseline: readonly {
|
|
156
172
|
path: string;
|
|
@@ -177,8 +193,9 @@ export declare function assertStateMarkerLifecycleCapacity(marker: ShadowStateFi
|
|
|
177
193
|
/** Retire only the exact marker bytes authenticated during failed creation. */
|
|
178
194
|
export declare function retireFailedCreateStateMarker(stateFile: string, taskId: string, stateRootAuthority: WorkspaceRootAuthority, maxBytes: number): Promise<void>;
|
|
179
195
|
export declare function validateMarkerShape(value: unknown, expectedTaskId: string): ShadowStateFileV2;
|
|
180
|
-
export declare function workspaceAuthorityOptions(env: ShadowEnv, target
|
|
196
|
+
export declare function workspaceAuthorityOptions(env: ShadowEnv, target?: string, boundary?: string): {
|
|
181
197
|
helperTimeoutMs?: number;
|
|
198
|
+
signal?: AbortSignal;
|
|
182
199
|
testHangStage?: 'realpath' | 'lstat' | 'open' | 'stat' | 'close';
|
|
183
200
|
};
|
|
184
201
|
/** Fresh, bounded cleanup-only read used by live disposal and restart GC. */
|
|
@@ -199,7 +216,10 @@ export declare function ensurePrivateDirectory(dir: string, opts?: {
|
|
|
199
216
|
anchorPath?: string;
|
|
200
217
|
failDirectorySyncStage?: 'target-child' | 'target-parent';
|
|
201
218
|
}): Promise<DurableDirectoryIdentity>;
|
|
202
|
-
export declare function atomicWriteFile(filePath: string, content: string, expected: AnchoredWritePrecondition, beforeCommit?: () => Promise<void> | void, afterValidation?: () => Promise<void> | void, serializeInProcess?: boolean, expectedParent?: AnchoredFsIdentity, maxTargetBytes?: number, failDirectorySync?: boolean, publicationOwnerKey?: string
|
|
219
|
+
export declare function atomicWriteFile(filePath: string, content: string, expected: AnchoredWritePrecondition, beforeCommit?: () => Promise<void> | void, afterValidation?: () => Promise<void> | void, serializeInProcess?: boolean, expectedParent?: AnchoredFsIdentity, maxTargetBytes?: number, failDirectorySync?: boolean, publicationOwnerKey?: string, opts?: {
|
|
220
|
+
helperTimeoutMs?: number;
|
|
221
|
+
signal?: AbortSignal;
|
|
222
|
+
}): Promise<AnchoredCommittedFile>;
|
|
203
223
|
export declare function isAnchoredWritePreconditionError(err: unknown): boolean;
|
|
204
224
|
export declare function assertMarkerTransition(from: ShadowPromoteState | null, to: ShadowPromoteState, opts: {
|
|
205
225
|
allowApplyingDisposal: boolean;
|
|
@@ -211,7 +231,10 @@ export declare function sameWorkspaceIncarnation(left: WorkspaceRootAuthority, r
|
|
|
211
231
|
export declare function buildSnapshotIncarnationIndex(shadowRootAuthority: WorkspaceRootAuthority, env?: ShadowEnv): Promise<SnapshotIncarnationIndex>;
|
|
212
232
|
/** Locate one renamed original snapshot without ever adopting its current name. */
|
|
213
233
|
export declare function findSnapshotIncarnation(shadowRootAuthority: WorkspaceRootAuthority, expected: WorkspaceRootAuthority, snapshotIncarnations?: SnapshotIncarnationIndex, env?: ShadowEnv): Promise<WorkspaceRootAuthority | null>;
|
|
214
|
-
export declare function hasCleanupBlockAnchor(shadowDir: string
|
|
234
|
+
export declare function hasCleanupBlockAnchor(shadowDir: string, opts?: {
|
|
235
|
+
helperTimeoutMs?: number;
|
|
236
|
+
signal?: AbortSignal;
|
|
237
|
+
}): Promise<boolean>;
|
|
215
238
|
interface SnapshotOwnerAnchor {
|
|
216
239
|
version: 1 | 2;
|
|
217
240
|
shadowDirIdentity: AnchoredFsIdentity;
|
|
@@ -228,7 +251,10 @@ export declare function physicalCopyScopeHash(scopeId: string): string;
|
|
|
228
251
|
* no longer authenticate its prepared target/temp state, so deletion must
|
|
229
252
|
* never outrun this reconciliation boundary.
|
|
230
253
|
*/
|
|
231
|
-
export declare function reconcileSnapshotPublicationAuthorityBeforeRemoval(snapshotRootAuthority: WorkspaceRootAuthority
|
|
254
|
+
export declare function reconcileSnapshotPublicationAuthorityBeforeRemoval(snapshotRootAuthority: WorkspaceRootAuthority, opts?: {
|
|
255
|
+
helperTimeoutMs?: number;
|
|
256
|
+
signal?: AbortSignal;
|
|
257
|
+
}): Promise<void>;
|
|
232
258
|
/**
|
|
233
259
|
* Stable, bounded ownership key for every private publication transaction
|
|
234
260
|
* created on behalf of one task-state namespace. The private publication store
|
|
@@ -237,13 +263,20 @@ export declare function reconcileSnapshotPublicationAuthorityBeforeRemoval(snaps
|
|
|
237
263
|
*/
|
|
238
264
|
export declare function workspacePublicationAuthorityOwnerKey(stateRootCanonicalPath: string, taskId: string): string;
|
|
239
265
|
export declare function writeSnapshotOwnerAnchor(ownerFile: string, snapshotRootAuthority: WorkspaceRootAuthority, ownerProcessIdentity: ProcessIdentity, physicalCopyScope: string, physicalCopyBytes: number, publicationOwnerKey: string): Promise<void>;
|
|
240
|
-
export declare function readSnapshotOwnerAnchor(shadowDir: string
|
|
266
|
+
export declare function readSnapshotOwnerAnchor(shadowDir: string, opts?: {
|
|
267
|
+
helperTimeoutMs?: number;
|
|
268
|
+
signal?: AbortSignal;
|
|
269
|
+
openFileHandle?: (filePath: string, flags: number) => Promise<fs.FileHandle>;
|
|
270
|
+
}): Promise<SnapshotOwnerAnchor | null>;
|
|
241
271
|
/**
|
|
242
272
|
* Sum durable reservations under the cross-process quota fence. Invalid owner
|
|
243
273
|
* authority consumes the whole limit, so cloning can continue but a physical
|
|
244
274
|
* fallback cannot allocate unknown additional disk.
|
|
245
275
|
*/
|
|
246
|
-
export declare function scanPersistedPhysicalCopyBytes(shadowRoots: readonly RegisteredShadowRoot[], physicalCopyScope: string, limit: number
|
|
276
|
+
export declare function scanPersistedPhysicalCopyBytes(shadowRoots: readonly RegisteredShadowRoot[], physicalCopyScope: string, limit: number, opts?: {
|
|
277
|
+
helperTimeoutMs?: number;
|
|
278
|
+
signal?: AbortSignal;
|
|
279
|
+
}): Promise<number>;
|
|
247
280
|
interface RegisteredShadowRoot extends AnchoredFsIdentity {
|
|
248
281
|
path: string;
|
|
249
282
|
version?: 1;
|
|
@@ -270,7 +303,10 @@ export declare class StaleShadowRootError extends Error {
|
|
|
270
303
|
* physical shadow root before copying, so the aggregate scan cannot be split by
|
|
271
304
|
* different temp-root configuration.
|
|
272
305
|
*/
|
|
273
|
-
export declare function registerAndListQuotaShadowRoots(stateRoot: string, stateRootIdentity: WorkspaceRootAuthority, currentShadowRoot: string, currentShadowRootIdentity: WorkspaceRootAuthority, publicationOwnerKey: string, maxStateMarkerBytes: number, afterQuotaReferenceTaskEntry?: (stateDir: string) => Promise<void> | void, afterQuotaReferenceMarkerEntry?: (filePath: string) => Promise<void> | void, afterQuotaReferenceMarkerStat?: (filePath: string) => Promise<void> | void, failDirectorySync?: boolean, mode?: 'register-current' | 'retire-current-if-unused', afterQuotaRetirementTargetProof?: (shadowRoot: string) => Promise<void> | void
|
|
306
|
+
export declare function registerAndListQuotaShadowRoots(stateRoot: string, stateRootIdentity: WorkspaceRootAuthority, currentShadowRoot: string, currentShadowRootIdentity: WorkspaceRootAuthority, publicationOwnerKey: string, maxStateMarkerBytes: number, afterQuotaReferenceTaskEntry?: (stateDir: string) => Promise<void> | void, afterQuotaReferenceMarkerEntry?: (filePath: string) => Promise<void> | void, afterQuotaReferenceMarkerStat?: (filePath: string) => Promise<void> | void, failDirectorySync?: boolean, mode?: 'register-current' | 'retire-current-if-unused', afterQuotaRetirementTargetProof?: (shadowRoot: string) => Promise<void> | void, opts?: {
|
|
307
|
+
helperTimeoutMs?: number;
|
|
308
|
+
signal?: AbortSignal;
|
|
309
|
+
}): Promise<RegisteredShadowRoot[]>;
|
|
274
310
|
/**
|
|
275
311
|
* Retire the exact current shadow-root authority after terminal cleanup.
|
|
276
312
|
*
|
|
@@ -280,7 +316,10 @@ export declare function registerAndListQuotaShadowRoots(stateRoot: string, state
|
|
|
280
316
|
* by any durable state or exposure marker. A missing, replaced, renamed, or
|
|
281
317
|
* referenced authority remains fail-closed in `registerAndListQuotaShadowRoots`.
|
|
282
318
|
*/
|
|
283
|
-
export declare function retireQuotaShadowRootIfUnused(stateRoot: string, stateRootIdentity: WorkspaceRootAuthority, currentShadowRoot: string, currentShadowRootIdentity: WorkspaceRootAuthority, publicationOwnerKey: string, maxStateMarkerBytes: number, afterQuotaReferenceTaskEntry?: (stateDir: string) => Promise<void> | void, afterQuotaReferenceMarkerEntry?: (filePath: string) => Promise<void> | void, afterQuotaReferenceMarkerStat?: (filePath: string) => Promise<void> | void, failDirectorySync?: boolean, afterQuotaRetirementTargetProof?: (shadowRoot: string) => Promise<void> | void
|
|
319
|
+
export declare function retireQuotaShadowRootIfUnused(stateRoot: string, stateRootIdentity: WorkspaceRootAuthority, currentShadowRoot: string, currentShadowRootIdentity: WorkspaceRootAuthority, publicationOwnerKey: string, maxStateMarkerBytes: number, afterQuotaReferenceTaskEntry?: (stateDir: string) => Promise<void> | void, afterQuotaReferenceMarkerEntry?: (filePath: string) => Promise<void> | void, afterQuotaReferenceMarkerStat?: (filePath: string) => Promise<void> | void, failDirectorySync?: boolean, afterQuotaRetirementTargetProof?: (shadowRoot: string) => Promise<void> | void, opts?: {
|
|
320
|
+
helperTimeoutMs?: number;
|
|
321
|
+
signal?: AbortSignal;
|
|
322
|
+
}): Promise<boolean>;
|
|
284
323
|
interface CleanupBlockAnchorRead {
|
|
285
324
|
present: boolean;
|
|
286
325
|
cleanupOwners: ProcessCleanupOwner[];
|
|
@@ -293,6 +332,9 @@ export declare function readCleanupBlockAnchor(shadowDir: string, expected: {
|
|
|
293
332
|
shadowDir: string;
|
|
294
333
|
shadowDirIdentity: AnchoredFsIdentity;
|
|
295
334
|
snapshotRootAuthority: WorkspaceRootAuthority;
|
|
335
|
+
}, opts?: {
|
|
336
|
+
helperTimeoutMs?: number;
|
|
337
|
+
signal?: AbortSignal;
|
|
296
338
|
}): Promise<CleanupBlockAnchorRead>;
|
|
297
339
|
export declare function dedupeCleanupOwners(owners: readonly ProcessCleanupOwner[]): ProcessCleanupOwner[];
|
|
298
340
|
export {};
|
|
@@ -14,6 +14,8 @@ export interface WorkspaceRootAuthority {
|
|
|
14
14
|
export interface WorkspaceAuthorityCaptureOptions {
|
|
15
15
|
/** @internal lower deterministic helper deadline for tests. */
|
|
16
16
|
helperTimeoutMs?: number;
|
|
17
|
+
/** Optional cancellation signal to abort helper execution. */
|
|
18
|
+
signal?: AbortSignal;
|
|
17
19
|
/** @internal deterministic target-filesystem stall seam. */
|
|
18
20
|
testHangStage?: 'realpath' | 'lstat' | 'open' | 'stat' | 'close';
|
|
19
21
|
}
|
|
@@ -244,7 +244,9 @@ export declare class WorkspaceShadow {
|
|
|
244
244
|
* set this flag.
|
|
245
245
|
*/
|
|
246
246
|
applyingAuthorityRetired?: boolean;
|
|
247
|
-
|
|
247
|
+
helperTimeoutMs?: number;
|
|
248
|
+
signal?: AbortSignal;
|
|
249
|
+
}): Promise<boolean>;
|
|
248
250
|
private retirePhysicalCopyRootIfUnused;
|
|
249
251
|
private retainExposureWriteAuthority;
|
|
250
252
|
private runOwnedStateFileWrite;
|
|
@@ -255,7 +257,6 @@ export declare class WorkspaceShadow {
|
|
|
255
257
|
* continue. A displaced original state directory is retained fail-closed.
|
|
256
258
|
*/
|
|
257
259
|
private exactStateResourcesAreRetired;
|
|
258
|
-
/** Reclaim a renamed original without ever adopting its public replacement. */
|
|
259
260
|
private discardDisplacedSnapshot;
|
|
260
261
|
private refreshRetainedStateAuthorities;
|
|
261
262
|
/** Orphan teardown is ordinary instance-owned teardown. */
|
|
@@ -4,12 +4,14 @@ import { Mode, Tier } from './types';
|
|
|
4
4
|
import { type ModeSelectionDeps } from './mode-selection';
|
|
5
5
|
import { type RunOrchestrationShellArgs } from './index';
|
|
6
6
|
import { type ShellEventEmit, type ShellEventEmitResult } from './emit-shell-event';
|
|
7
|
+
import { type ShadowEnv } from '../local-executor/workspace-shadow';
|
|
7
8
|
import { BackendPlannerClient, PlannerCacheLayer, PlannerHealthMachine, type LocalGemmaAdvisoryRunner, type LocalGemmaPlannerRunner } from '../planner';
|
|
8
9
|
import type { PlannerAdapter, PlannerInput, PlannerDecision, PlannerProbeResult } from '../planner/adapter';
|
|
9
10
|
import { keychainManager } from '../keychain';
|
|
10
11
|
export { keychainManager };
|
|
11
12
|
import type { TaskAuditSummaryModel } from './audit-summary';
|
|
12
13
|
import { type LocalExecutor, type AuthorityScope, type EmitShellEventFn as LEEmitShellEventFn } from '../local-executor';
|
|
14
|
+
import { type ReviewerCredentialStore } from '../substrate-launch';
|
|
13
15
|
import { type EngineGroupState } from '../local-executor';
|
|
14
16
|
import type { TeamTapEvent } from './index';
|
|
15
17
|
import type { WorkspaceOutcomeSinkTap } from './workspace-terminal-coordinator';
|
|
@@ -111,6 +113,8 @@ export interface AdmittedSessionOwnershipController {
|
|
|
111
113
|
run<T>(launch: (acceptOwnership: () => void) => Promise<T>): Promise<T>;
|
|
112
114
|
/** Close a failed bootstrap and retire any session already admitted. */
|
|
113
115
|
abort(): Promise<void>;
|
|
116
|
+
/** Synonym for abort(): await full teardown and bounded orphan sweep. */
|
|
117
|
+
close(): Promise<void>;
|
|
114
118
|
}
|
|
115
119
|
/**
|
|
116
120
|
* Install lifecycle ownership before admission begins. The pending-create path
|
|
@@ -130,7 +134,7 @@ export declare const ORCHESTRATION_ORPHAN_SWEEP_STALE_THRESHOLD_MS: number;
|
|
|
130
134
|
* aborted test runs, or ungraceful terminal closures. Non-blocking best-effort
|
|
131
135
|
* operation; mirrors companion-plugin startup sweeps.
|
|
132
136
|
*/
|
|
133
|
-
export declare function triggerStartupOrphanSweep(appsyncClient: AppSyncClient, currentSessionId: string, staleThresholdMs?: number, tmpRoot?: string): Promise<number>;
|
|
137
|
+
export declare function triggerStartupOrphanSweep(appsyncClient: AppSyncClient, currentSessionId: string, staleThresholdMs?: number, tmpRoot?: string, shadowEnv?: ShadowEnv): Promise<number>;
|
|
134
138
|
/**
|
|
135
139
|
* CP-8 Slice C (#570) — parse a top-level `audit show <task-id> [--json]
|
|
136
140
|
* [--session <id>]` subcommand from the raw argv. Returns null when the argv is
|
|
@@ -184,7 +188,19 @@ export declare function resolveLocalModelBoot(args: {
|
|
|
184
188
|
requestedMode: Mode;
|
|
185
189
|
entitlement: LocalModelEntitlement;
|
|
186
190
|
state: LocalModelState;
|
|
191
|
+
env?: NodeJS.ProcessEnv;
|
|
187
192
|
}): LocalModelBootDecision;
|
|
193
|
+
/**
|
|
194
|
+
* Preflight onboarding check: on substrate-capable platforms (macOS/Linux),
|
|
195
|
+
* verify vendor credentials exist for detected/installed implementor agents
|
|
196
|
+
* (Claude/Codex). Emits an actionable notice before entering Orchestration Mode
|
|
197
|
+
* so the user knows upfront before mid-task broker 503s occur.
|
|
198
|
+
*/
|
|
199
|
+
export declare function checkImplementorCredentialNotice(args?: {
|
|
200
|
+
detectedAgents?: string[];
|
|
201
|
+
store?: ReviewerCredentialStore;
|
|
202
|
+
platform?: string;
|
|
203
|
+
}): Promise<string | null>;
|
|
188
204
|
export interface LocalGemmaPlannerBuildResult {
|
|
189
205
|
adapter: PlannerAdapter;
|
|
190
206
|
advisoryRunner: LocalGemmaAdvisoryRunner | null;
|
|
@@ -250,11 +266,47 @@ export declare function main(argv: string[]): Promise<number>;
|
|
|
250
266
|
*
|
|
251
267
|
* Exported for unit tests; production callers go through `main()`.
|
|
252
268
|
*/
|
|
253
|
-
export
|
|
269
|
+
export interface ProductionPlannerStackResult {
|
|
254
270
|
adapter: BackendPlannerClient;
|
|
255
271
|
cache: PlannerCacheLayer;
|
|
256
272
|
health: PlannerHealthMachine;
|
|
257
|
-
}
|
|
273
|
+
}
|
|
274
|
+
export declare function buildProductionPlannerStack(appsyncClient: AppSyncClient, emitter: (args: ShellEventEmit) => Promise<unknown>): ProductionPlannerStackResult;
|
|
275
|
+
export interface ResolvePlannerAdapterArgs {
|
|
276
|
+
localPlanner: LocalGemmaPlannerBuildResult;
|
|
277
|
+
tier: Tier;
|
|
278
|
+
appsyncClient: AppSyncClient;
|
|
279
|
+
emitter: (args: ShellEventEmit) => Promise<unknown>;
|
|
280
|
+
env?: NodeJS.ProcessEnv;
|
|
281
|
+
buildHostedStack?: (appsyncClient: AppSyncClient, emitter: (args: ShellEventEmit) => Promise<unknown>) => ProductionPlannerStackResult;
|
|
282
|
+
}
|
|
283
|
+
export interface ResolvedPlannerResult {
|
|
284
|
+
adapter: PlannerAdapter;
|
|
285
|
+
runtimeKind: NonNullable<RunOrchestrationShellArgs['plannerRuntimeKind']>;
|
|
286
|
+
runtimeLabel: string;
|
|
287
|
+
advisoryRunner: LocalGemmaAdvisoryRunner | null;
|
|
288
|
+
classifyRunner: LocalGemmaPlannerRunner | null;
|
|
289
|
+
cache: PlannerCacheLayer | null;
|
|
290
|
+
health: PlannerHealthMachine | null;
|
|
291
|
+
source: 'local' | 'hosted' | 'local_unavailable';
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Resolves the active planner adapter for the orchestration shell session.
|
|
295
|
+
*
|
|
296
|
+
* Precedence & Invariants:
|
|
297
|
+
* 1. Forced hosted mode (`CODEVIBE_FORCE_HOSTED_PLANNER=1` or `CODEVIBE_PLANNER_PROVIDER=hosted`):
|
|
298
|
+
* - Allowed for PRO and MAX tiers. Returns the production hosted Bedrock planner stack.
|
|
299
|
+
* - Disallowed for FREE tier (preserves $0 marginal cost invariant). Falls back to local adapter.
|
|
300
|
+
* 2. Local-first preference:
|
|
301
|
+
* - When local Gemma is enabled and operational (`!localPlanner.reason`), returns the local adapter
|
|
302
|
+
* (`local_gemma_qat`).
|
|
303
|
+
* 3. Unavailable fallback:
|
|
304
|
+
* - When local Gemma is unavailable (`localPlanner.reason` is truthy):
|
|
305
|
+
* - PRO / MAX: Falls back to the hosted Bedrock planner stack (`hosted`).
|
|
306
|
+
* - FREE: Retains the local unavailable adapter (`local_unavailable`), strictly preventing
|
|
307
|
+
* cloud inference costs.
|
|
308
|
+
*/
|
|
309
|
+
export declare function resolvePlannerAdapter(args: ResolvePlannerAdapterArgs): ResolvedPlannerResult;
|
|
258
310
|
export interface BuildTeamLocalExecutorResult {
|
|
259
311
|
localExecutor: LocalExecutor;
|
|
260
312
|
/** Shell-installed writer-outcome coordinator used by v2 team promotion. */
|