@ordewell/core 0.12.2 → 0.12.4
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/dist/{ModeResolver-CA2fUU9h.d.mts → ModeResolver-CkZnbIqs.d.mts} +1 -1
- package/dist/{ModeResolver-B64aUZXJ.d.ts → ModeResolver-DS-aCVOP.d.ts} +1 -1
- package/dist/{Task-CxGgN6I0.d.mts → Task-D3O49EUo.d.mts} +43 -6
- package/dist/{Task-CxGgN6I0.d.ts → Task-D3O49EUo.d.ts} +43 -6
- package/dist/{chunk-RZ23BMVR.mjs → chunk-3S5IVTZM.mjs} +80 -22
- package/dist/chunk-3S5IVTZM.mjs.map +1 -0
- package/dist/{chunk-FX33UKAD.mjs → chunk-IOYBL3E5.mjs} +3 -3
- package/dist/{chunk-UDUATSCJ.mjs → chunk-MJKCU4U7.mjs} +1 -1
- package/dist/{chunk-UDUATSCJ.mjs.map → chunk-MJKCU4U7.mjs.map} +1 -1
- package/dist/{chunk-PKJTN2PD.mjs → chunk-POD3KZQW.mjs} +7 -1
- package/dist/chunk-POD3KZQW.mjs.map +1 -0
- package/dist/{chunk-2IFKPYPO.mjs → chunk-YZDWWXCB.mjs} +58 -17
- package/dist/chunk-YZDWWXCB.mjs.map +1 -0
- package/dist/{eventStore-CTCSKS9E.d.ts → eventStore-BcoMsZtU.d.mts} +23 -7
- package/dist/{eventStore-CcB8yELZ.d.mts → eventStore-CSFKy48Y.d.ts} +23 -7
- package/dist/index.d.mts +251 -243
- package/dist/index.d.ts +251 -243
- package/dist/index.js +3059 -1448
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2716 -1203
- package/dist/index.mjs.map +1 -1
- package/dist/parsing.d.mts +2 -2
- package/dist/parsing.d.ts +2 -2
- package/dist/parsing.js +43 -15
- package/dist/parsing.js.map +1 -1
- package/dist/parsing.mjs +3 -3
- package/dist/plan-utils.d.mts +4 -4
- package/dist/plan-utils.d.ts +4 -4
- package/dist/plan-utils.js +65 -14
- package/dist/plan-utils.js.map +1 -1
- package/dist/plan-utils.mjs +15 -3
- package/dist/plan-utils.mjs.map +1 -1
- package/dist/{runSettingsText-lKLDsyli.d.ts → runSettingsText-BFaZSPRG.d.ts} +686 -26
- package/dist/{runSettingsText-DFVpe6aU.d.mts → runSettingsText-DWsmcnBq.d.mts} +686 -26
- package/dist/testing.d.mts +46 -3
- package/dist/testing.d.ts +46 -3
- package/dist/testing.js +66 -4
- package/dist/testing.js.map +1 -1
- package/dist/testing.mjs +52 -5
- package/dist/testing.mjs.map +1 -1
- package/docker/task.Dockerfile +7 -4
- package/package.json +1 -1
- package/dist/chunk-2IFKPYPO.mjs.map +0 -1
- package/dist/chunk-PKJTN2PD.mjs.map +0 -1
- package/dist/chunk-RZ23BMVR.mjs.map +0 -1
- /package/dist/{chunk-FX33UKAD.mjs.map → chunk-IOYBL3E5.mjs.map} +0 -0
package/dist/testing.mjs
CHANGED
|
@@ -2,14 +2,56 @@ import {
|
|
|
2
2
|
GUARANTEES,
|
|
3
3
|
isWithin,
|
|
4
4
|
refuseUnproven
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-MJKCU4U7.mjs";
|
|
6
6
|
import {
|
|
7
7
|
DEFAULT_RUNNERS,
|
|
8
8
|
SELF_REPO,
|
|
9
9
|
handoffOf,
|
|
10
10
|
integrationBranchFor,
|
|
11
11
|
noRemoval
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-POD3KZQW.mjs";
|
|
13
|
+
|
|
14
|
+
// src/testEnv.ts
|
|
15
|
+
import * as fs from "fs";
|
|
16
|
+
import * as path from "path";
|
|
17
|
+
function removeDir(dir) {
|
|
18
|
+
return fs.promises.rm(dir, { recursive: true, force: true, maxRetries: 10, retryDelay: 100 });
|
|
19
|
+
}
|
|
20
|
+
function homeEnv(home, platform = process.platform) {
|
|
21
|
+
if (platform !== "win32") return { HOME: home };
|
|
22
|
+
return {
|
|
23
|
+
HOME: home,
|
|
24
|
+
USERPROFILE: home,
|
|
25
|
+
APPDATA: path.win32.join(home, "AppData", "Roaming"),
|
|
26
|
+
LOCALAPPDATA: path.win32.join(home, "AppData", "Local"),
|
|
27
|
+
ProgramData: path.win32.join(home, "ProgramData"),
|
|
28
|
+
SCOOP: void 0,
|
|
29
|
+
SCOOP_GLOBAL: void 0
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function setEnv(vars) {
|
|
33
|
+
const saved = Object.fromEntries(Object.keys(vars).map((key) => [key, process.env[key]]));
|
|
34
|
+
applyEnv(vars);
|
|
35
|
+
return () => applyEnv(saved);
|
|
36
|
+
}
|
|
37
|
+
function applyEnv(vars) {
|
|
38
|
+
for (const [key, value] of Object.entries(vars)) {
|
|
39
|
+
if (value === void 0) delete process.env[key];
|
|
40
|
+
else process.env[key] = value;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function writeStandIn(bin, name) {
|
|
44
|
+
const file = path.join(bin, process.platform === "win32" ? `${name}.exe` : name);
|
|
45
|
+
fs.writeFileSync(file, "#!/bin/sh\nexit 1\n");
|
|
46
|
+
fs.chmodSync(file, 493);
|
|
47
|
+
return file;
|
|
48
|
+
}
|
|
49
|
+
function pathWithFake(dir, command, PATH = process.env.PATH ?? "", platform = process.platform) {
|
|
50
|
+
const paths = platform === "win32" ? path.win32 : path.posix;
|
|
51
|
+
const native = platform === "win32" ? [".exe", ".com"] : [];
|
|
52
|
+
const holdsNative = (entry) => native.some((ext) => fs.existsSync(paths.join(entry.replace(/^"|"$/g, ""), `${command}${ext}`)));
|
|
53
|
+
return [dir, ...PATH.split(paths.delimiter).filter((entry) => entry && !holdsNative(entry))].join(paths.delimiter);
|
|
54
|
+
}
|
|
13
55
|
|
|
14
56
|
// src/testing.ts
|
|
15
57
|
async function flushMicrotasks(rounds = 20) {
|
|
@@ -291,9 +333,9 @@ var FakeEventStore = class {
|
|
|
291
333
|
if (this.failing) throw this.failing;
|
|
292
334
|
for (const event of events) this.events.push({ ...event, seq: this.events.length + 1 });
|
|
293
335
|
}
|
|
294
|
-
async *read(after,
|
|
336
|
+
async *read(after, path2) {
|
|
295
337
|
for (const event of [...this.events]) {
|
|
296
|
-
if (event.seq > after && (
|
|
338
|
+
if (event.seq > after && (path2 === void 0 || isWithin(event.node, path2))) yield event;
|
|
297
339
|
}
|
|
298
340
|
}
|
|
299
341
|
async close() {
|
|
@@ -695,6 +737,11 @@ export {
|
|
|
695
737
|
FakeWorktreeIsolation,
|
|
696
738
|
fakeConfig,
|
|
697
739
|
fakeFileSystem,
|
|
698
|
-
flushMicrotasks
|
|
740
|
+
flushMicrotasks,
|
|
741
|
+
homeEnv,
|
|
742
|
+
pathWithFake,
|
|
743
|
+
removeDir,
|
|
744
|
+
setEnv,
|
|
745
|
+
writeStandIn
|
|
699
746
|
};
|
|
700
747
|
//# sourceMappingURL=testing.mjs.map
|
package/dist/testing.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/testing.ts"],"sourcesContent":["import type { IConfig } from './interfaces/IConfig';\nimport type { IFileSystem, ToolOutcome } from './interfaces/IFileSystem';\nimport type { InvokedCommand, IRunnerSession, QueuedTaskMessage, ScriptExit, StructuredEvent, StructuredTurnEnd, TaskMessageFrom } from './interfaces/IRunner';\nimport type { RunnerCommand } from './models/RunnerCommand';\nimport type { RunnerSessionCost } from './models/Usage';\nimport type { HandoffCommit } from './models/Handoff';\nimport type { ApprovalDecision } from './interfaces/IApproval';\nimport type { CheckpointAnswer, TaskCompleteArgs } from './services/mcp/tools';\nimport type {\n IsolationAvailability,\n IsolationHandoff,\n IsolationMergeResult,\n IsolationOutcome,\n IsolationPruneResult,\n IsolationRemoval,\n IsolationRevertResult,\n IsolationRun,\n IntegrationDisposal,\n LandedWork,\n PreparedTask,\n PrepareIntent,\n IWorktreeIsolation,\n RepairEvidence,\n RevertCommand,\n RevertWatch,\n SetupFailure,\n TreeSnapshot,\n} from './interfaces/IWorktreeIsolation';\nimport { DEFAULT_RUNNERS, type Task } from './models/Task';\nimport { GUARANTEES, refuseUnproven, type ExecutionBackend, type Guarantee, type GuaranteeReport, type LeaseRecord, type LeaseRepo, type LeaseRequest, type LeaseSpec, type OpenLease, type ReservedLease, type RunnerPlacement } from './services/executionLease';\nimport type { EventStore } from './services/eventStore';\nimport { isWithin, type NodePath, type TreeEvent, type TreeFact } from './models/TreeEvent';\nimport { handoffOf, integrationBranchFor, noRemoval, SELF_REPO } from './services/isolationRecord';\n\n/**\n * Let an already-queued promise chain run to its next await before asserting,\n * without a wall-clock sleep. For a chain whose length is not known, drain the\n * microtask queue repeatedly. Only helps a chain that does not wait on a timer.\n */\nexport async function flushMicrotasks(rounds = 20): Promise<void> {\n for (let i = 0; i < rounds; i += 1) await Promise.resolve();\n}\n\nexport function fakeConfig(overrides: Partial<IConfig> = {}): IConfig {\n return {\n aiProvider: 'openrouter',\n apiKey: 'sk-test',\n planningModel: 'test-model',\n enabledRunners: [...DEFAULT_RUNNERS],\n maxParallelSessions: 3,\n researchEnabled: false,\n researchMaxSteps: 10,\n researchMaxFileSize: 100_000,\n openAiBaseUrl: 'https://api.openai.com/v1',\n openAiApiKey: '',\n openrouterKey: '',\n geminiKey: '',\n openaiCompatibleBaseUrl: '',\n openaiCompatibleApiKey: '',\n orchestratorModel: '',\n researchSubagentModel: '',\n geminiModel: '',\n planMapEnabled: true,\n autonomousMode: true,\n // Off so an orchestrator built without an injected isolation never runs\n // real git against whatever repository the tests happen to run in.\n worktreeIsolation: false,\n workspaceRepos: [],\n worktreeLinks: [],\n // Off so a scripted conflict stays a conflict unless a test opts into repairing it.\n conflictRepairAttempts: 0,\n approvalMode: 'ask',\n approvalPreApproved: [],\n // Off so a test that is not about the allowlist sees every prompt it raises.\n approvalDefaults: false,\n effectAllowlist: [],\n notifyCommand: [],\n webReadBudget: 40,\n plannerNativeShell: false,\n setProviderModelLists: () => {},\n getProviderBaseUrl: () => '',\n // Every vendor holds a key, so no planner turn is refused for want of one\n // unless a test takes it away.\n getProviderApiKey: () => 'sk-test',\n ...overrides,\n };\n}\n\nconst EMPTY_OUTCOME: ToolOutcome = { success: false, output: '', truncated: false };\n\n/**\n * A complete {@link IFileSystem} stub. Lives here rather than in each package's\n * test folder so adding a tool to the interface is one edit, not one per suite.\n */\nexport function fakeFileSystem(overrides: Partial<IFileSystem> = {}): IFileSystem {\n return {\n readFile: async () => EMPTY_OUTCOME,\n readFiles: async () => EMPTY_OUTCOME,\n glob: async () => EMPTY_OUTCOME,\n grep: async () => EMPTY_OUTCOME,\n findSymbol: async () => EMPTY_OUTCOME,\n listDir: async () => EMPTY_OUTCOME,\n bash: async () => EMPTY_OUTCOME,\n getWorkspaceRoot: () => '/workspace',\n ...overrides,\n };\n}\n\nexport class FakeRunnerSession implements IRunnerSession {\n private outputCbs: Array<(text: string) => void> = [];\n private exitCbs: Array<(code: number) => void> = [];\n output = '';\n written: string[] = [];\n killed = false;\n\n state: 'working' | 'idle' = 'working';\n messages: QueuedTaskMessage[] = [];\n /** Every message a turn was started with, in order. */\n delivered: string[] = [];\n /** The ones of {@link delivered} Ordewell sent: the completion reminder (ADR-0018, W1). */\n fromOrdewell: string[] = [];\n interrupts = 0;\n private messageCount = 0;\n private turnEndCbs: Array<(reason: StructuredTurnEnd) => void> = [];\n private eventCbs: Array<(event: StructuredEvent) => void> = [];\n private completeCbs: Array<(report: TaskCompleteArgs) => void> = [];\n private checkpointHandler: ((question: string, signal: AbortSignal) => Promise<CheckpointAnswer>) | null = null;\n\n constructor(public id = 's1', public taskId = 't1', public sessionId: string | null = 'native-1') {}\n\n /** `stop()` was asked for: the runner winds its turn down, still reporting, until {@link emitExit}. */\n stopped = false;\n private markGone!: () => void;\n private readonly gone = new Promise<void>((resolve) => { this.markGone = resolve; });\n\n onOutput(cb: (text: string) => void): void { this.outputCbs.push(cb); }\n onExit(cb: (code: number) => void): void { this.exitCbs.push(cb); }\n kill(): void { this.killed = true; }\n stop(): Promise<void> {\n this.stopped = true;\n return this.gone;\n }\n getOutput(): string { return this.output; }\n\n emitOutput(text: string): void {\n this.output += text;\n for (const cb of this.outputCbs) cb(text);\n }\n emitExit(code: number): void {\n for (const cb of this.exitCbs) cb(code);\n this.markGone();\n }\n write(text: string): void {\n this.written.push(text);\n const message = text.trim();\n if (message) this.sendMessage(message);\n }\n\n turnState(): 'working' | 'idle' { return this.state; }\n onTurnEnd(cb: (reason: StructuredTurnEnd) => void): void { this.turnEndCbs.push(cb); }\n onEvent(cb: (event: StructuredEvent) => void): void { this.eventCbs.push(cb); }\n onTaskComplete(cb: (report: TaskCompleteArgs) => void): void { this.completeCbs.push(cb); }\n /**\n * The runner calls `task_complete`, as `StructuredSession` relays it. Here it\n * is published at once; a test that needs the real session's turn-end\n * ordering drives `StructuredSession` itself.\n */\n reportComplete(report: TaskCompleteArgs): void {\n for (const cb of this.completeCbs) cb(report);\n }\n onToolCheckpoint(handler: (question: string, signal: AbortSignal) => Promise<CheckpointAnswer>): void { this.checkpointHandler = handler; }\n private scriptExitCbs: Array<(exit: ScriptExit) => void> = [];\n onScriptExit(cb: (exit: ScriptExit) => void): void { this.scriptExitCbs.push(cb); }\n /** A script task's body ended, as `ScriptSession` hands it on (ADR-0035). */\n reportScriptExit(exit: ScriptExit): void {\n for (const cb of this.scriptExitCbs) cb(exit);\n }\n /** The runner calls `checkpoint`, as `StructuredSession` relays it; settles with the answer. */\n callCheckpoint(question: string, signal: AbortSignal = new AbortController().signal): Promise<CheckpointAnswer> {\n if (!this.checkpointHandler) throw new Error('no checkpoint handler attached');\n return this.checkpointHandler(question, signal);\n }\n sendMessage(text: string, from?: TaskMessageFrom): string {\n this.messageCount += 1;\n const id = `msg-${this.messageCount}`;\n if (this.state === 'idle') this.deliver(text, from);\n else this.messages.push({ id, text, ...(from ? { from } : {}) });\n return id;\n }\n /** Interrupts, and the turn that replaces the interrupted one opens with the forced message. */\n forceSend(text: string): string {\n if (this.state === 'idle') return this.sendMessage(text);\n this.messageCount += 1;\n const id = `msg-${this.messageCount}`;\n this.putForced({ id, text, forced: true });\n void this.interrupt();\n return id;\n }\n forceSendQueued(id: string): boolean {\n const message = this.messages.find((m) => m.id === id);\n if (!message) return false;\n if (message.forced) return true;\n this.messages = this.messages.filter((m) => m !== message);\n this.putForced({ ...message, forced: true });\n if (this.state === 'working') void this.interrupt();\n return true;\n }\n private putForced(message: QueuedTaskMessage): void {\n const at = this.messages.findIndex((m) => !m.forced);\n this.messages.splice(at < 0 ? this.messages.length : at, 0, message);\n }\n removeQueued(id: string): boolean {\n const before = this.messages.length;\n this.messages = this.messages.filter((m) => m.id !== id);\n return this.messages.length < before;\n }\n queued(): QueuedTaskMessage[] { return this.messages.map((m) => ({ ...m })); }\n async interrupt(): Promise<void> {\n this.interrupts += 1;\n if (this.state === 'working') this.emitTurnEnd('interrupted');\n }\n nativeSessionId(): string | null { return this.sessionId; }\n /** What `sessionCost()` reports: the runner's running cost as counted, null while unknown. */\n cost: RunnerSessionCost | null = null;\n sessionCost(): RunnerSessionCost | null { return this.cost; }\n\n /** What `commands()` reports: the runner's own commands (#66). */\n runnerCommands: RunnerCommand[] = [];\n /** Every runner command invoked, in order. */\n invoked: InvokedCommand[] = [];\n commands(): RunnerCommand[] { return [...this.runnerCommands]; }\n /** Runs it as a message that starts with it, which is what a runner reads. */\n invokeCommand(name: string, args = ''): string {\n this.invoked.push({ name, ...(args.trim() ? { args: args.trim() } : {}) });\n return this.sendMessage(args.trim() ? `/${name} ${args.trim()}` : `/${name}`);\n }\n\n /** Every answer this session was given, in order. */\n answers: Array<{ id: string; decision: ApprovalDecision }> = [];\n private readonly openPermissions = new Set<string>();\n\n /** The runner asks to use a tool, as `StructuredSession` announces it. */\n requestPermission(id: string, name: string, input: Record<string, unknown>, suggestions: unknown[] = []): void {\n this.openPermissions.add(id);\n this.emitEvent({ type: 'permission_request', id, name, detail: JSON.stringify(input), input, suggestions });\n }\n /** The runner gives up on a request, as an interrupt makes it. */\n withdrawPermission(id: string): void {\n if (this.openPermissions.delete(id)) this.emitEvent({ type: 'permission_withdrawn', id });\n }\n answerPermission(id: string, decision: ApprovalDecision): boolean {\n if (!this.openPermissions.delete(id)) return false;\n this.answers.push({ id, decision });\n this.emitEvent({ type: 'permission_decided', id, decision });\n return true;\n }\n\n emitEvent(event: StructuredEvent): void {\n for (const cb of this.eventCbs) cb(event);\n }\n /** The runner reads a queued message inside the running turn, as `StructuredSession` reports it (ADR-0023). */\n deliverMidTurn(id: string): void {\n const message = this.messages.find((m) => m.id === id);\n if (!message) return;\n this.messages = this.messages.filter((m) => m !== message);\n this.emitEvent({ type: 'message_delivered', messageId: id, text: message.text, ...(message.from ? { from: message.from } : {}) });\n }\n /**\n * The turn ends without a `task_complete` call, and so does the turn the\n * completion reminder opens if one was sent (ADR-0018, W1): the task waits for input.\n */\n waitForInput(): void {\n const reminders = this.fromOrdewell.length;\n this.emitTurnEnd('completed');\n if (this.fromOrdewell.length > reminders) this.emitTurnEnd('completed');\n }\n emitTurnEnd(reason: StructuredTurnEnd): void {\n const next = this.messages.shift();\n if (!next) this.state = 'idle';\n for (const cb of this.turnEndCbs) cb(reason);\n if (next) this.deliver(next.text, next.from);\n }\n\n private deliver(text: string, from?: TaskMessageFrom): void {\n this.state = 'working';\n this.delivered.push(text);\n if (from === 'ordewell') this.fromOrdewell.push(text);\n this.emitEvent({ type: 'turn_start', text, ...(from ? { from } : {}) });\n }\n}\n\n/** An in-memory {@link EventStore}. `failing` makes the next appends reject, as a full disk would. */\nexport class FakeEventStore implements EventStore {\n readonly events: TreeEvent[] = [];\n failing: Error | null = null;\n private closed = false;\n\n async append(events: readonly TreeFact[]): Promise<void> {\n if (this.closed) throw new Error('This event log is closed.');\n if (this.failing) throw this.failing;\n for (const event of events) this.events.push({ ...event, seq: this.events.length + 1 });\n }\n\n async *read(after: number, path?: NodePath): AsyncIterable<TreeEvent> {\n for (const event of [...this.events]) {\n if (event.seq > after && (path === undefined || isWithin(event.node, path))) yield event;\n }\n }\n\n async close(): Promise<void> {\n this.closed = true;\n }\n}\n\n/**\n * An in-memory {@link ExecutionBackend}, as {@link FakeWorktreeIsolation} fakes\n * git: a count of slots and nothing else. `requests`, `opened` and `released`\n * log what the seam was asked; `holdOpen` keeps an open waiting, `openError`\n * fails one, `refuse` turns a role down, `provenGuarantees` is what its probe\n * proves, and `freed` is what a release does, a pool's tick.\n */\nexport class FakeExecutionBackend implements ExecutionBackend {\n /** Slots; a planner, a merge and a delegated task take none, as a flat run's do not. */\n limit = Infinity;\n held = 0;\n requests: LeaseRequest[] = [];\n opened: { request: LeaseRequest; spec: LeaseSpec }[] = [];\n released: { id: string; reason: string }[] = [];\n letGoCalls: { taskId: string; keep: boolean; reason: string }[] = [];\n openError: Error | null = null;\n refuse: { role: LeaseRequest['role']; reason: string } | null = null;\n provenGuarantees: readonly Guarantee[] = [];\n /** What exportResult reports of a session, in place of what it is told. */\n sessionState: { nativeSessionId: string } | null = null;\n /** The repositories an open says its worktree holds. */\n repos: readonly LeaseRepo[] = [];\n /** Where an open puts its runner, for a lease that does not run it on this host. */\n placement: RunnerPlacement | null = null;\n /** Brings a task's work back; absent, it is where the attempt ran. */\n collect?: (taskId: string) => Promise<void>;\n /** Waits on what it has running, as a closing Session does; absent, nothing outlives a runner. */\n settle?: () => Promise<void>;\n /** The workspace root's repositories; absent, none is known. */\n checkoutRepos?: () => readonly LeaseRepo[];\n records: LeaseRecord[] = [];\n freed: () => void = () => undefined;\n private openHold: Promise<void> | null = null;\n private nextId = 0;\n\n /** Make the next open wait until the returned function is called. */\n holdOpen(): () => void {\n let open!: () => void;\n this.openHold = new Promise<void>((resolve) => { open = resolve; });\n return open;\n }\n\n async probe(): Promise<GuaranteeReport> {\n const at = new Date(0).toISOString();\n return Object.fromEntries(GUARANTEES.map((g) => [g, { proven: this.provenGuarantees.includes(g), by: 'fake probe', at }])) as GuaranteeReport;\n }\n\n private takesSlot(request: LeaseRequest): boolean {\n return request.role === 'task' || request.role === 'script';\n }\n\n refusal(request: LeaseRequest): string | null {\n if (this.refuse?.role === request.role) return this.refuse.reason;\n return this.takesSlot(request) && this.held >= this.limit ? `no slot for ${request.node.taskId ?? request.role}` : null;\n }\n\n reserve(request: LeaseRequest): { lease: ReservedLease } | { refused: string } {\n this.requests.push(request);\n const refused = this.refusal(request);\n if (refused) return { refused };\n const holdsSlot = this.takesSlot(request);\n if (holdsSlot) this.held += 1;\n const id = `lease-${++this.nextId}`;\n let live = true;\n return {\n lease: {\n id,\n holdsSlot,\n open: (spec) => this.open(request, spec),\n release: (reason) => {\n if (!live) return;\n live = false;\n this.released.push({ id, reason });\n if (holdsSlot) this.held -= 1;\n this.freed();\n },\n },\n };\n }\n\n private async open(request: LeaseRequest, spec: LeaseSpec): Promise<OpenLease> {\n this.opened.push({ request, spec });\n const guarantees = await this.probe();\n refuseUnproven(spec.required, guarantees);\n const hold = this.openHold;\n this.openHold = null;\n await hold;\n if (this.openError) throw this.openError;\n const worktree = spec.workspace.kind === 'worktree';\n return {\n workspace: { cwd: worktree ? `/fake-lease/${spec.task?.id}` : '/repo', worktree, ...(this.repos.length ? { repos: this.repos } : {}) },\n guarantees,\n exportResult: (session) => ({ refs: {}, sessionState: { ...session, ...this.sessionState } }),\n ...(this.placement ? { placement: this.placement } : {}),\n };\n }\n\n async letGo(taskId: string, { keep, landing, reason }: { keep: boolean; landing?: Promise<unknown> | null; reason: string }): Promise<void> {\n await landing;\n this.letGoCalls.push({ taskId, keep, reason });\n }\n\n async list(): Promise<readonly LeaseRecord[]> {\n return this.records;\n }\n}\n\nexport type FakeIsolationCall =\n | { op: 'isActive'; workspaceRoot: string }\n | { op: 'stash'; workspaceRoot: string }\n | { op: 'startRun'; workspaceRoot: string }\n | { op: 'prepare' | 'reopen' | 'verifyRepair'; taskId: string }\n | { op: 'integrate'; taskId: string }\n | { op: 'release'; taskId: string; keep: boolean }\n | { op: 'handoff' | 'pruneOrphans' | 'reviewDiff' | 'mergeIntoCheckedOut' | 'sweep' | 'findInHead' | 'snapshotTree' | 'changedSince' }\n | { op: 'discard'; integration: IntegrationDisposal }\n | { op: 'readLanded' | 'revert'; taskIds: readonly string[] };\n\n/**\n * An in-memory {@link IWorktreeIsolation} for scheduling tests: no git, no\n * filesystem. Every call is logged in `calls`; `prepare` hands back a\n * deterministic fake cwd. Set `availability` to exercise the fallbacks, `outcomes`\n * to script a conflict, and `holdIntegration` to keep a task un-integrated so a\n * test can observe that its dependents wait. `repos` makes the run a group of\n * several; `changes` and `stopsIn` say which of them a task changes and where\n * its landing stops. `repairEvidence` scripts what a conflict repair's\n * evidence check finds, and `removal` what a removal kept back.\n */\nexport class FakeWorktreeIsolation implements IWorktreeIsolation {\n availability: IsolationAvailability = { active: true };\n /** What `gitShortfall` answers. */\n gitShortfallText: string | null = null;\n /** The repo paths `startRun` groups: a group of one at `.` unless set. */\n repos: string[] = [SELF_REPO];\n /** Per task id, the repos it changes; every repo of the group when not listed. */\n changes = new Map<string, string[]>();\n /** Per task id, the repo its landing stops in when its outcome is not `merged`; its first changed repo when not listed. */\n stopsIn = new Map<string, string>();\n /** Per task id, the files a `conflict` outcome names; empty when not listed. */\n conflictFiles = new Map<string, string[]>();\n /** What `mergeIntoCheckedOut` answers; a `merged` one also puts every landed task in HEAD, as git would. */\n mergeResult: IsolationMergeResult = { outcome: 'merged' };\n /** Task ids whose landed work `findInHead` finds in HEAD besides those a merge put there, as a merge by hand would. */\n mergedByHand = new Set<string>();\n /** What `snapshotTree` answers; null as for a workspace with no repo. */\n treeSnapshot: TreeSnapshot | null = {};\n /** What `changedSince` answers: the tracked files an ops task changed. */\n changedFiles: string[] = [];\n /** What `startRun` shares and `prepare` copies, to exercise their notices. */\n shared: string[] = [];\n sharedRepos: string[] = [];\n copied: string[] = [];\n setupFailed: SetupFailure[] = [];\n /** Set to make `startRun` throw, as git does when no repo of the group can be isolated. */\n startRunError: Error | null = null;\n /** Set to make `discard` / `sweep` throw after logging the call. */\n discardError: Error | null = null;\n sweepError: Error | null = null;\n /** What `pruneOrphans` reports as kept back from the sweep. */\n keptOnPrune: IsolationPruneResult['kept'] = [];\n /**\n * What every removal — a `release` that removes, `discard`, `pruneOrphans` —\n * reports it kept back. A refused task keeps its record, as git's does.\n */\n removal: IsolationRemoval = noRemoval();\n /** Per task id; a task not listed integrates as `merged`. */\n outcomes = new Map<string, IsolationOutcome>();\n /** What `revert` stops with; a revert that goes through when null. */\n revertStop: Exclude<IsolationRevertResult, { outcome: 'reverted' }> | null = null;\n /** What `readLanded` finds of a task's work in the user's branch, by task id. */\n inBranch = new Map<string, RevertCommand[]>();\n /** Per task id, what `verifyRepair` finds; a task not listed passes. */\n repairEvidence = new Map<string, RepairEvidence>();\n calls: FakeIsolationCall[] = [];\n private holds = new Map<string, Promise<void>>();\n private verifyHolds = new Map<string, Promise<void>>();\n private revertHold: Promise<void> | null = null;\n private runCount = 0;\n\n private log(call: FakeIsolationCall): void { this.calls.push(call); }\n\n /** Task ids in the order `op` was called for them. */\n taskIdsFor(op: 'prepare' | 'reopen' | 'verifyRepair' | 'integrate' | 'release'): string[] {\n return this.calls.flatMap((c) => (c.op === op && 'taskId' in c ? [c.taskId] : []));\n }\n\n /** Make `integrate` for this task wait until the returned function is called. */\n holdIntegration(taskId: string): () => void {\n let open!: () => void;\n this.holds.set(taskId, new Promise<void>((resolve) => { open = resolve; }));\n return open;\n }\n\n /** Make the next `revert` wait, past its `refusal`, until the returned function is called. */\n holdRevert(): () => void {\n let open!: () => void;\n this.revertHold = new Promise<void>((resolve) => { open = resolve; });\n return open;\n }\n\n /** Make `verifyRepair` for this task wait until the returned function is called. */\n holdVerification(taskId: string): () => void {\n let open!: () => void;\n this.verifyHolds.set(taskId, new Promise<void>((resolve) => { open = resolve; }));\n return open;\n }\n\n async gitShortfall(): Promise<string | null> {\n return this.gitShortfallText;\n }\n\n async isActive(workspaceRoot: string): Promise<IsolationAvailability> {\n this.log({ op: 'isActive', workspaceRoot });\n return this.availability;\n }\n\n /** Like git: once the tracked changes are stashed, the tree is no longer dirty. */\n async stash(workspaceRoot: string): Promise<void> {\n this.log({ op: 'stash', workspaceRoot });\n if (!this.availability.active && this.availability.reason === 'dirty') this.availability = { active: true };\n }\n\n async startRun(workspaceRoot: string, stateRoot?: string): Promise<IsolationRun> {\n this.log({ op: 'startRun', workspaceRoot });\n if (this.startRunError) throw this.startRunError;\n const id = `run${++this.runCount}`;\n return {\n id,\n workspaceRoot,\n ...(stateRoot !== undefined ? { stateRoot } : {}),\n repos: this.repos.map((repo) => ({\n path: repo, root: `${workspaceRoot}/${repo}`.replace(/\\/\\.$/, ''), baseRef: 'base0000', baseBranch: 'main', integrationBranch: integrationBranchFor(id),\n })),\n shared: [...this.shared],\n sharedRepos: [...this.sharedRepos],\n tasks: {},\n keepsEveryLanding: true,\n carried: {},\n };\n }\n\n async prepare(task: Task, run: IsolationRun, _intent?: PrepareIntent, opts: { readOnly?: boolean } = {}): Promise<PreparedTask> {\n this.log({ op: 'prepare', taskId: task.id });\n const name = `${task.order}-${task.id}`;\n const cwd = `/fake-worktrees/${run.id}/${name}`;\n const branch = `ordewell/${run.id}/${name}`;\n run.tasks[task.id] = {\n taskId: task.id, order: task.order, title: task.title, branch, workspace: cwd, status: 'active',\n repos: Object.fromEntries(run.repos.map((r) => [r.path, { worktree: r.path === SELF_REPO ? cwd : `${cwd}/${r.path}`, linked: [] }])),\n ...(opts.readOnly ? { readOnly: true } : {}),\n };\n return { cwd, branch, copied: [...this.copied], ...(this.setupFailed.length > 0 ? { setupFailed: [...this.setupFailed] } : {}) };\n }\n\n /** Like git: the same cwd, each changed repo's tip recorded, the repair counted. */\n async reopen(task: Task, run: IsolationRun): Promise<PreparedTask> {\n this.log({ op: 'reopen', taskId: task.id });\n const record = run.tasks[task.id];\n if (record?.status !== 'conflict') throw new Error(`Task ${task.order} has no conflict to repair`);\n const changed = Object.entries(record.repos).filter(([repo, entry]) => entry.changed || repo === record.conflictRepo).map(([repo]) => repo);\n const files = (record.conflictFiles ?? []).map((file) => (record.conflictRepo && record.conflictRepo !== SELF_REPO ? `${record.conflictRepo}/${file}` : file));\n record.repairs = (record.repairs ?? 0) + 1;\n record.repairBase = Object.fromEntries(changed.map((repo) => [repo, `tip-${repo}`]));\n record.repairedFiles = [...new Set([...(record.repairedFiles ?? []), ...files])];\n record.status = 'repairing';\n return { cwd: record.workspace, branch: record.branch, copied: [] };\n }\n\n async verifyRepair(task: Task, _run: IsolationRun): Promise<RepairEvidence> {\n this.log({ op: 'verifyRepair', taskId: task.id });\n await this.verifyHolds.get(task.id);\n return this.repairEvidence.get(task.id) ?? { ok: true };\n }\n\n /** Like git: the landing is recorded and persisted before the (held) merge, and cleared once it settles. */\n async integrate(task: Task, run: IsolationRun, persist: () => void = () => undefined, commit?: HandoffCommit): Promise<IsolationOutcome> {\n this.log({ op: 'integrate', taskId: task.id });\n const record = run.tasks[task.id];\n if (!record) return 'failed';\n if (commit) record.commit = commit;\n if (record.readOnly) {\n record.status = 'failed';\n record.landingError = 'a read-only task lands nothing';\n return 'failed';\n }\n const changed = this.changes.get(task.id) ?? run.repos.map((r) => r.path);\n for (const [repo, entry] of Object.entries(record.repos)) entry.changed = changed.includes(repo) || (entry.changed ?? false);\n if (changed.length > 0) {\n run.landing = { taskId: task.id, tips: Object.fromEntries(changed.map((repo) => [repo, `tip-${repo}`])) };\n persist();\n }\n await this.holds.get(task.id);\n delete run.landing;\n const outcome = this.outcomes.get(task.id) ?? 'merged';\n record.status = outcome;\n delete record.repairBase;\n if (outcome === 'merged') {\n delete record.conflictRepo;\n delete record.conflictFiles;\n for (const repo of changed) {\n ((run.landings ??= {})[task.id] ??= {})[repo] = [...run.landings?.[task.id]?.[repo] ?? [], `tip-${repo}`];\n (run.landedTasks ??= {})[task.id] = { taskId: task.id, order: task.order, title: task.title };\n }\n } else {\n record.conflictRepo = this.stopsIn.get(task.id) ?? changed[0] ?? SELF_REPO;\n const files = this.conflictFiles.get(task.id);\n if (files) record.conflictFiles = files;\n else delete record.conflictFiles;\n }\n return outcome;\n }\n\n /** Newest landing first, read as the plan's highest order: scheduling tests land in plan order. */\n async readLanded(run: IsolationRun, taskIds: readonly string[]): Promise<LandedWork> {\n this.log({ op: 'readLanded', taskIds });\n const records = taskIds.flatMap((id) => run.tasks[id] ?? run.landedTasks?.[id] ?? []).sort((a, b) => b.order - a.order);\n const tasks = records.map((r) => ({\n taskId: r.taskId, order: r.order, title: r.title,\n repos: Object.keys(run.landings?.[r.taskId] ?? {}),\n }));\n return { ok: true, tasks, inBranch: records.flatMap((r) => this.inBranch.get(r.taskId) ?? []) };\n }\n\n /** Like git: the turn, then the judgement, then the records go in one step with the tasks back. */\n async revert(run: IsolationRun, taskIds: readonly string[], watch: RevertWatch): Promise<IsolationRevertResult> {\n this.log({ op: 'revert', taskIds });\n const hold = this.revertHold;\n this.revertHold = null;\n await hold;\n const reason = watch.refusal();\n if (reason) return { outcome: 'refused', reason };\n if (this.revertStop) return this.revertStop;\n const landed = await this.readLanded(run, taskIds);\n if (!landed.ok) return { outcome: 'failed', error: landed.error };\n if (landed.inBranch.length > 0) return { outcome: 'in-branch', commands: landed.inBranch };\n run.landing = { taskId: taskIds[0], tips: {}, reverts: {} };\n watch.persist();\n delete run.landing;\n for (const id of taskIds) {\n // Like git: a later attempt's record that did not land stays for its worktree, its conflict over.\n if (run.tasks[id]?.status === 'merged') delete run.tasks[id];\n else if (run.tasks[id]?.status === 'conflict') run.tasks[id].status = 'kept';\n delete run.landings?.[id];\n delete run.landedTasks?.[id];\n delete run.landedOn?.[id];\n }\n run.reverted = true;\n watch.settled(taskIds);\n return { outcome: 'reverted', tasks: landed.tasks };\n }\n\n async release(run: IsolationRun, taskId: string, opts: { keep: boolean }): Promise<IsolationRemoval> {\n this.log({ op: 'release', taskId, keep: opts.keep });\n const record = run.tasks[taskId];\n // Like git: a read-only task's record goes whole, with nothing kept (ADR-0046).\n if (record?.readOnly) {\n delete run.tasks[taskId];\n return noRemoval();\n }\n const removal = opts.keep || !record ? noRemoval() : this.removed();\n const refused = removal.refused.some((r) => r.task?.taskId === taskId);\n if (!opts.keep && !refused) delete run.tasks[taskId];\n else if (record?.status === 'active') record.status = 'kept';\n else if (record?.status === 'repairing') {\n record.status = 'conflict';\n delete record.repairBase;\n }\n return removal;\n }\n\n private removed(): IsolationRemoval {\n return { preserved: [...this.removal.preserved], refused: [...this.removal.refused] };\n }\n\n async handoff(run: IsolationRun): Promise<IsolationHandoff> {\n this.log({ op: 'handoff' });\n return handoffOf(run);\n }\n\n async pruneOrphans(): Promise<IsolationPruneResult> {\n this.log({ op: 'pruneOrphans' });\n return { kept: [...this.keptOnPrune], ...this.removed() };\n }\n async reviewDiff(): Promise<string> { this.log({ op: 'reviewDiff' }); return ''; }\n async mergeIntoCheckedOut(run: IsolationRun): Promise<IsolationMergeResult> {\n this.log({ op: 'mergeIntoCheckedOut' });\n if (this.mergeResult.outcome === 'merged') {\n for (const record of Object.values(run.tasks)) if (record.status === 'merged') this.mergedByHand.add(record.taskId);\n }\n return this.mergeResult;\n }\n async findInHead(run: IsolationRun): Promise<string[]> {\n this.log({ op: 'findInHead' });\n const changed: string[] = [];\n for (const record of Object.values(run.tasks)) {\n if (record.status !== 'merged') continue;\n const merged = this.mergedByHand.has(record.taskId);\n if (merged === !!record.inHead) continue;\n if (merged) record.inHead = true;\n else delete record.inHead;\n changed.push(record.taskId);\n }\n return changed;\n }\n async snapshotTree(): Promise<TreeSnapshot | null> { this.log({ op: 'snapshotTree' }); return this.treeSnapshot; }\n async changedSince(): Promise<string[]> { this.log({ op: 'changedSince' }); return [...this.changedFiles]; }\n async discard(_run: IsolationRun, opts: { integration: IntegrationDisposal }): Promise<IsolationRemoval> {\n this.log({ op: 'discard', integration: opts.integration });\n if (this.discardError) throw this.discardError;\n return this.removed();\n }\n async sweep(): Promise<void> {\n this.log({ op: 'sweep' });\n if (this.sweepError) throw this.sweepError;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAuCA,eAAsB,gBAAgB,SAAS,IAAmB;AAChE,WAAS,IAAI,GAAG,IAAI,QAAQ,KAAK,EAAG,OAAM,QAAQ,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O,KAAK,QAAQ;AAAA,EACtB;AAAA,EACA,MAAM,QAAuB;AAC3B,SAAK,IAAI,EAAE,IAAI,QAAQ,CAAC;AACxB,QAAI,KAAK,WAAY,OAAM,KAAK;AAAA,EAClC;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/testEnv.ts","../src/testing.ts"],"sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\n\n/**\n * Remove a test's scratch directory, waiting out whatever still holds it.\n * Windows removes no directory a process works in, and a process tree it was\n * told to end takes a moment to go. The retries back off linearly, about five\n * seconds in all, and only a held directory waits. Async, so the event loop is\n * free to run the kill that lets it go.\n */\nexport function removeDir(dir: string): Promise<void> {\n return fs.promises.rm(dir, { recursive: true, force: true, maxRetries: 10, retryDelay: 100 });\n}\n\n/**\n * The variables that make `home` the user's home, for a test that gives this\n * process, or a child, a home of its own.\n *\n * HOME alone is a POSIX home. Node's `os.homedir()` reads USERPROFILE on\n * Windows, so a test that set only HOME there read and wrote the real\n * `~/.ordewell`. The per-user folders the runner probe searches on Windows\n * (`wellKnownBinDirs`: npm's prefix under APPDATA, WinGet's links under\n * LOCALAPPDATA, Chocolatey's under ProgramData, Scoop's own) hang off variables\n * of their own, so those move too, or a CLI really installed there is found.\n */\nexport function homeEnv(home: string, platform: NodeJS.Platform = process.platform): Record<string, string | undefined> {\n if (platform !== 'win32') return { HOME: home };\n return {\n HOME: home,\n USERPROFILE: home,\n APPDATA: path.win32.join(home, 'AppData', 'Roaming'),\n LOCALAPPDATA: path.win32.join(home, 'AppData', 'Local'),\n ProgramData: path.win32.join(home, 'ProgramData'),\n SCOOP: undefined,\n SCOOP_GLOBAL: undefined,\n };\n}\n\n/**\n * Set `vars` on this process's environment, and return what puts back the\n * values they replaced. A key given as undefined is deleted: assigning\n * undefined to `process.env` stores the string \"undefined\".\n */\nexport function setEnv(vars: Record<string, string | undefined>): () => void {\n const saved = Object.fromEntries(Object.keys(vars).map((key) => [key, process.env[key]]));\n applyEnv(vars);\n return () => applyEnv(saved);\n}\n\nfunction applyEnv(vars: Record<string, string | undefined>): void {\n for (const [key, value] of Object.entries(vars)) {\n if (value === undefined) delete process.env[key];\n else process.env[key] = value;\n }\n}\n\n/**\n * A file `name` resolves to on PATH from `bin`, for a test whose spawn is\n * faked: it is never run. Windows starts a native executable ahead of anything\n * else on PATH (ADR-0010), so there it is a `.exe`.\n */\nexport function writeStandIn(bin: string, name: string): string {\n const file = path.join(bin, process.platform === 'win32' ? `${name}.exe` : name);\n fs.writeFileSync(file, '#!/bin/sh\\nexit 1\\n');\n fs.chmodSync(file, 0o755);\n return file;\n}\n\n/**\n * A PATH on which `command` starts the fake in `dir`.\n *\n * First on PATH is enough on POSIX. A fake is a batch shim on Windows, and\n * `planDirectLaunch` prefers a native executable anywhere on PATH to a batch\n * shim ahead of it (ADR-0010), so every directory holding a native `command`\n * is left out as well. With {@link homeEnv}, nothing installed on the machine\n * answers in the fake's place.\n */\nexport function pathWithFake(\n dir: string,\n command: string,\n PATH: string = process.env.PATH ?? '',\n platform: NodeJS.Platform = process.platform,\n): string {\n const paths = platform === 'win32' ? path.win32 : path.posix;\n const native = platform === 'win32' ? ['.exe', '.com'] : [];\n const holdsNative = (entry: string) => native.some((ext) => fs.existsSync(paths.join(entry.replace(/^\"|\"$/g, ''), `${command}${ext}`)));\n return [dir, ...PATH.split(paths.delimiter).filter((entry) => entry && !holdsNative(entry))].join(paths.delimiter);\n}\n","import type { IConfig } from './interfaces/IConfig';\nimport type { IFileSystem, ToolOutcome } from './interfaces/IFileSystem';\nimport type { InvokedCommand, IRunnerSession, QueuedTaskMessage, ScriptExit, StructuredEvent, StructuredTurnEnd, TaskMessageFrom } from './interfaces/IRunner';\nimport type { RunnerCommand } from './models/RunnerCommand';\nimport type { RunnerSessionCost } from './models/Usage';\nimport type { HandoffCommit } from './models/Handoff';\nimport type { ApprovalDecision } from './interfaces/IApproval';\nimport type { CheckpointAnswer, TaskCompleteArgs } from './services/mcp/tools';\nimport type {\n IsolationAvailability,\n IsolationHandoff,\n IsolationMergeResult,\n IsolationOutcome,\n IsolationPruneResult,\n IsolationRemoval,\n IsolationRevertResult,\n IsolationRun,\n IntegrationDisposal,\n LandedWork,\n PreparedTask,\n PrepareIntent,\n IWorktreeIsolation,\n RepairEvidence,\n RevertCommand,\n RevertWatch,\n SetupFailure,\n TreeSnapshot,\n} from './interfaces/IWorktreeIsolation';\nimport { DEFAULT_RUNNERS, type Task } from './models/Task';\nimport { GUARANTEES, refuseUnproven, type ExecutionBackend, type Guarantee, type GuaranteeReport, type LeaseRecord, type LeaseRepo, type LeaseRequest, type LeaseSpec, type OpenLease, type ReservedLease, type RunnerPlacement } from './services/executionLease';\nimport type { EventStore } from './services/eventStore';\nimport { isWithin, type NodePath, type TreeEvent, type TreeFact } from './models/TreeEvent';\nimport { handoffOf, integrationBranchFor, noRemoval, SELF_REPO } from './services/isolationRecord';\n\nexport { homeEnv, pathWithFake, removeDir, setEnv, writeStandIn } from './testEnv';\n\n/**\n * Let an already-queued promise chain run to its next await before asserting,\n * without a wall-clock sleep. For a chain whose length is not known, drain the\n * microtask queue repeatedly. Only helps a chain that does not wait on a timer.\n */\nexport async function flushMicrotasks(rounds = 20): Promise<void> {\n for (let i = 0; i < rounds; i += 1) await Promise.resolve();\n}\n\nexport function fakeConfig(overrides: Partial<IConfig> = {}): IConfig {\n return {\n aiProvider: 'openrouter',\n apiKey: 'sk-test',\n planningModel: 'test-model',\n enabledRunners: [...DEFAULT_RUNNERS],\n maxParallelSessions: 3,\n researchEnabled: false,\n researchMaxSteps: 10,\n researchMaxFileSize: 100_000,\n openAiBaseUrl: 'https://api.openai.com/v1',\n openAiApiKey: '',\n openrouterKey: '',\n geminiKey: '',\n openaiCompatibleBaseUrl: '',\n openaiCompatibleApiKey: '',\n orchestratorModel: '',\n researchSubagentModel: '',\n geminiModel: '',\n planMapEnabled: true,\n autonomousMode: true,\n // Off so an orchestrator built without an injected isolation never runs\n // real git against whatever repository the tests happen to run in.\n worktreeIsolation: false,\n workspaceRepos: [],\n worktreeLinks: [],\n // Off so a scripted conflict stays a conflict unless a test opts into repairing it.\n conflictRepairAttempts: 0,\n approvalMode: 'ask',\n approvalPreApproved: [],\n // Off so a test that is not about the allowlist sees every prompt it raises.\n approvalDefaults: false,\n effectAllowlist: [],\n notifyCommand: [],\n webReadBudget: 40,\n plannerNativeShell: false,\n setProviderModelLists: () => {},\n getProviderBaseUrl: () => '',\n // Every vendor holds a key, so no planner turn is refused for want of one\n // unless a test takes it away.\n getProviderApiKey: () => 'sk-test',\n ...overrides,\n };\n}\n\nconst EMPTY_OUTCOME: ToolOutcome = { success: false, output: '', truncated: false };\n\n/**\n * A complete {@link IFileSystem} stub. Lives here rather than in each package's\n * test folder so adding a tool to the interface is one edit, not one per suite.\n */\nexport function fakeFileSystem(overrides: Partial<IFileSystem> = {}): IFileSystem {\n return {\n readFile: async () => EMPTY_OUTCOME,\n readFiles: async () => EMPTY_OUTCOME,\n glob: async () => EMPTY_OUTCOME,\n grep: async () => EMPTY_OUTCOME,\n findSymbol: async () => EMPTY_OUTCOME,\n listDir: async () => EMPTY_OUTCOME,\n bash: async () => EMPTY_OUTCOME,\n getWorkspaceRoot: () => '/workspace',\n ...overrides,\n };\n}\n\nexport class FakeRunnerSession implements IRunnerSession {\n private outputCbs: Array<(text: string) => void> = [];\n private exitCbs: Array<(code: number) => void> = [];\n output = '';\n written: string[] = [];\n killed = false;\n\n state: 'working' | 'idle' = 'working';\n messages: QueuedTaskMessage[] = [];\n /** Every message a turn was started with, in order. */\n delivered: string[] = [];\n /** The ones of {@link delivered} Ordewell sent: the completion reminder (ADR-0018, W1). */\n fromOrdewell: string[] = [];\n interrupts = 0;\n private messageCount = 0;\n private turnEndCbs: Array<(reason: StructuredTurnEnd) => void> = [];\n private eventCbs: Array<(event: StructuredEvent) => void> = [];\n private completeCbs: Array<(report: TaskCompleteArgs) => void> = [];\n private checkpointHandler: ((question: string, signal: AbortSignal) => Promise<CheckpointAnswer>) | null = null;\n\n constructor(public id = 's1', public taskId = 't1', public sessionId: string | null = 'native-1') {}\n\n /** `stop()` was asked for: the runner winds its turn down, still reporting, until {@link emitExit}. */\n stopped = false;\n private markGone!: () => void;\n private readonly gone = new Promise<void>((resolve) => { this.markGone = resolve; });\n\n onOutput(cb: (text: string) => void): void { this.outputCbs.push(cb); }\n onExit(cb: (code: number) => void): void { this.exitCbs.push(cb); }\n kill(): void { this.killed = true; }\n stop(): Promise<void> {\n this.stopped = true;\n return this.gone;\n }\n getOutput(): string { return this.output; }\n\n emitOutput(text: string): void {\n this.output += text;\n for (const cb of this.outputCbs) cb(text);\n }\n emitExit(code: number): void {\n for (const cb of this.exitCbs) cb(code);\n this.markGone();\n }\n write(text: string): void {\n this.written.push(text);\n const message = text.trim();\n if (message) this.sendMessage(message);\n }\n\n turnState(): 'working' | 'idle' { return this.state; }\n onTurnEnd(cb: (reason: StructuredTurnEnd) => void): void { this.turnEndCbs.push(cb); }\n onEvent(cb: (event: StructuredEvent) => void): void { this.eventCbs.push(cb); }\n onTaskComplete(cb: (report: TaskCompleteArgs) => void): void { this.completeCbs.push(cb); }\n /**\n * The runner calls `task_complete`, as `StructuredSession` relays it. Here it\n * is published at once; a test that needs the real session's turn-end\n * ordering drives `StructuredSession` itself.\n */\n reportComplete(report: TaskCompleteArgs): void {\n for (const cb of this.completeCbs) cb(report);\n }\n onToolCheckpoint(handler: (question: string, signal: AbortSignal) => Promise<CheckpointAnswer>): void { this.checkpointHandler = handler; }\n private scriptExitCbs: Array<(exit: ScriptExit) => void> = [];\n onScriptExit(cb: (exit: ScriptExit) => void): void { this.scriptExitCbs.push(cb); }\n /** A script task's body ended, as `ScriptSession` hands it on (ADR-0035). */\n reportScriptExit(exit: ScriptExit): void {\n for (const cb of this.scriptExitCbs) cb(exit);\n }\n /** The runner calls `checkpoint`, as `StructuredSession` relays it; settles with the answer. */\n callCheckpoint(question: string, signal: AbortSignal = new AbortController().signal): Promise<CheckpointAnswer> {\n if (!this.checkpointHandler) throw new Error('no checkpoint handler attached');\n return this.checkpointHandler(question, signal);\n }\n sendMessage(text: string, from?: TaskMessageFrom): string {\n this.messageCount += 1;\n const id = `msg-${this.messageCount}`;\n if (this.state === 'idle') this.deliver(text, from);\n else this.messages.push({ id, text, ...(from ? { from } : {}) });\n return id;\n }\n /** Interrupts, and the turn that replaces the interrupted one opens with the forced message. */\n forceSend(text: string): string {\n if (this.state === 'idle') return this.sendMessage(text);\n this.messageCount += 1;\n const id = `msg-${this.messageCount}`;\n this.putForced({ id, text, forced: true });\n void this.interrupt();\n return id;\n }\n forceSendQueued(id: string): boolean {\n const message = this.messages.find((m) => m.id === id);\n if (!message) return false;\n if (message.forced) return true;\n this.messages = this.messages.filter((m) => m !== message);\n this.putForced({ ...message, forced: true });\n if (this.state === 'working') void this.interrupt();\n return true;\n }\n private putForced(message: QueuedTaskMessage): void {\n const at = this.messages.findIndex((m) => !m.forced);\n this.messages.splice(at < 0 ? this.messages.length : at, 0, message);\n }\n removeQueued(id: string): boolean {\n const before = this.messages.length;\n this.messages = this.messages.filter((m) => m.id !== id);\n return this.messages.length < before;\n }\n queued(): QueuedTaskMessage[] { return this.messages.map((m) => ({ ...m })); }\n async interrupt(): Promise<void> {\n this.interrupts += 1;\n if (this.state === 'working') this.emitTurnEnd('interrupted');\n }\n nativeSessionId(): string | null { return this.sessionId; }\n /** What `sessionCost()` reports: the runner's running cost as counted, null while unknown. */\n cost: RunnerSessionCost | null = null;\n sessionCost(): RunnerSessionCost | null { return this.cost; }\n\n /** What `commands()` reports: the runner's own commands (#66). */\n runnerCommands: RunnerCommand[] = [];\n /** Every runner command invoked, in order. */\n invoked: InvokedCommand[] = [];\n commands(): RunnerCommand[] { return [...this.runnerCommands]; }\n /** Runs it as a message that starts with it, which is what a runner reads. */\n invokeCommand(name: string, args = ''): string {\n this.invoked.push({ name, ...(args.trim() ? { args: args.trim() } : {}) });\n return this.sendMessage(args.trim() ? `/${name} ${args.trim()}` : `/${name}`);\n }\n\n /** Every answer this session was given, in order. */\n answers: Array<{ id: string; decision: ApprovalDecision }> = [];\n private readonly openPermissions = new Set<string>();\n\n /** The runner asks to use a tool, as `StructuredSession` announces it. */\n requestPermission(id: string, name: string, input: Record<string, unknown>, suggestions: unknown[] = []): void {\n this.openPermissions.add(id);\n this.emitEvent({ type: 'permission_request', id, name, detail: JSON.stringify(input), input, suggestions });\n }\n /** The runner gives up on a request, as an interrupt makes it. */\n withdrawPermission(id: string): void {\n if (this.openPermissions.delete(id)) this.emitEvent({ type: 'permission_withdrawn', id });\n }\n answerPermission(id: string, decision: ApprovalDecision): boolean {\n if (!this.openPermissions.delete(id)) return false;\n this.answers.push({ id, decision });\n this.emitEvent({ type: 'permission_decided', id, decision });\n return true;\n }\n\n emitEvent(event: StructuredEvent): void {\n for (const cb of this.eventCbs) cb(event);\n }\n /** The runner reads a queued message inside the running turn, as `StructuredSession` reports it (ADR-0023). */\n deliverMidTurn(id: string): void {\n const message = this.messages.find((m) => m.id === id);\n if (!message) return;\n this.messages = this.messages.filter((m) => m !== message);\n this.emitEvent({ type: 'message_delivered', messageId: id, text: message.text, ...(message.from ? { from: message.from } : {}) });\n }\n /**\n * The turn ends without a `task_complete` call, and so does the turn the\n * completion reminder opens if one was sent (ADR-0018, W1): the task waits for input.\n */\n waitForInput(): void {\n const reminders = this.fromOrdewell.length;\n this.emitTurnEnd('completed');\n if (this.fromOrdewell.length > reminders) this.emitTurnEnd('completed');\n }\n emitTurnEnd(reason: StructuredTurnEnd): void {\n const next = this.messages.shift();\n if (!next) this.state = 'idle';\n for (const cb of this.turnEndCbs) cb(reason);\n if (next) this.deliver(next.text, next.from);\n }\n\n private deliver(text: string, from?: TaskMessageFrom): void {\n this.state = 'working';\n this.delivered.push(text);\n if (from === 'ordewell') this.fromOrdewell.push(text);\n this.emitEvent({ type: 'turn_start', text, ...(from ? { from } : {}) });\n }\n}\n\n/** An in-memory {@link EventStore}. `failing` makes the next appends reject, as a full disk would. */\nexport class FakeEventStore implements EventStore {\n readonly events: TreeEvent[] = [];\n failing: Error | null = null;\n private closed = false;\n\n async append(events: readonly TreeFact[]): Promise<void> {\n if (this.closed) throw new Error('This event log is closed.');\n if (this.failing) throw this.failing;\n for (const event of events) this.events.push({ ...event, seq: this.events.length + 1 });\n }\n\n async *read(after: number, path?: NodePath): AsyncIterable<TreeEvent> {\n for (const event of [...this.events]) {\n if (event.seq > after && (path === undefined || isWithin(event.node, path))) yield event;\n }\n }\n\n async close(): Promise<void> {\n this.closed = true;\n }\n}\n\n/**\n * An in-memory {@link ExecutionBackend}, as {@link FakeWorktreeIsolation} fakes\n * git: a count of slots and nothing else. `requests`, `opened` and `released`\n * log what the seam was asked; `holdOpen` keeps an open waiting, `openError`\n * fails one, `refuse` turns a role down, `provenGuarantees` is what its probe\n * proves, and `freed` is what a release does, a pool's tick.\n */\nexport class FakeExecutionBackend implements ExecutionBackend {\n /** Slots; a planner, a merge and a delegated task take none, as a flat run's do not. */\n limit = Infinity;\n held = 0;\n requests: LeaseRequest[] = [];\n opened: { request: LeaseRequest; spec: LeaseSpec }[] = [];\n released: { id: string; reason: string }[] = [];\n letGoCalls: { taskId: string; keep: boolean; reason: string }[] = [];\n openError: Error | null = null;\n refuse: { role: LeaseRequest['role']; reason: string } | null = null;\n provenGuarantees: readonly Guarantee[] = [];\n /** What exportResult reports of a session, in place of what it is told. */\n sessionState: { nativeSessionId: string } | null = null;\n /** The repositories an open says its worktree holds. */\n repos: readonly LeaseRepo[] = [];\n /** Where an open puts its runner, for a lease that does not run it on this host. */\n placement: RunnerPlacement | null = null;\n /** Brings a task's work back; absent, it is where the attempt ran. */\n collect?: (taskId: string) => Promise<void>;\n /** Waits on what it has running, as a closing Session does; absent, nothing outlives a runner. */\n settle?: () => Promise<void>;\n /** The workspace root's repositories; absent, none is known. */\n checkoutRepos?: () => readonly LeaseRepo[];\n records: LeaseRecord[] = [];\n freed: () => void = () => undefined;\n private openHold: Promise<void> | null = null;\n private nextId = 0;\n\n /** Make the next open wait until the returned function is called. */\n holdOpen(): () => void {\n let open!: () => void;\n this.openHold = new Promise<void>((resolve) => { open = resolve; });\n return open;\n }\n\n async probe(): Promise<GuaranteeReport> {\n const at = new Date(0).toISOString();\n return Object.fromEntries(GUARANTEES.map((g) => [g, { proven: this.provenGuarantees.includes(g), by: 'fake probe', at }])) as GuaranteeReport;\n }\n\n private takesSlot(request: LeaseRequest): boolean {\n return request.role === 'task' || request.role === 'script';\n }\n\n refusal(request: LeaseRequest): string | null {\n if (this.refuse?.role === request.role) return this.refuse.reason;\n return this.takesSlot(request) && this.held >= this.limit ? `no slot for ${request.node.taskId ?? request.role}` : null;\n }\n\n reserve(request: LeaseRequest): { lease: ReservedLease } | { refused: string } {\n this.requests.push(request);\n const refused = this.refusal(request);\n if (refused) return { refused };\n const holdsSlot = this.takesSlot(request);\n if (holdsSlot) this.held += 1;\n const id = `lease-${++this.nextId}`;\n let live = true;\n return {\n lease: {\n id,\n holdsSlot,\n open: (spec) => this.open(request, spec),\n release: (reason) => {\n if (!live) return;\n live = false;\n this.released.push({ id, reason });\n if (holdsSlot) this.held -= 1;\n this.freed();\n },\n },\n };\n }\n\n private async open(request: LeaseRequest, spec: LeaseSpec): Promise<OpenLease> {\n this.opened.push({ request, spec });\n const guarantees = await this.probe();\n refuseUnproven(spec.required, guarantees);\n const hold = this.openHold;\n this.openHold = null;\n await hold;\n if (this.openError) throw this.openError;\n const worktree = spec.workspace.kind === 'worktree';\n return {\n workspace: { cwd: worktree ? `/fake-lease/${spec.task?.id}` : '/repo', worktree, ...(this.repos.length ? { repos: this.repos } : {}) },\n guarantees,\n exportResult: (session) => ({ refs: {}, sessionState: { ...session, ...this.sessionState } }),\n ...(this.placement ? { placement: this.placement } : {}),\n };\n }\n\n async letGo(taskId: string, { keep, landing, reason }: { keep: boolean; landing?: Promise<unknown> | null; reason: string }): Promise<void> {\n await landing;\n this.letGoCalls.push({ taskId, keep, reason });\n }\n\n async list(): Promise<readonly LeaseRecord[]> {\n return this.records;\n }\n}\n\nexport type FakeIsolationCall =\n | { op: 'isActive'; workspaceRoot: string }\n | { op: 'stash'; workspaceRoot: string }\n | { op: 'startRun'; workspaceRoot: string }\n | { op: 'prepare' | 'reopen' | 'verifyRepair'; taskId: string }\n | { op: 'integrate'; taskId: string }\n | { op: 'release'; taskId: string; keep: boolean }\n | { op: 'handoff' | 'pruneOrphans' | 'reviewDiff' | 'mergeIntoCheckedOut' | 'sweep' | 'findInHead' | 'snapshotTree' | 'changedSince' }\n | { op: 'discard'; integration: IntegrationDisposal }\n | { op: 'readLanded' | 'revert'; taskIds: readonly string[] };\n\n/**\n * An in-memory {@link IWorktreeIsolation} for scheduling tests: no git, no\n * filesystem. Every call is logged in `calls`; `prepare` hands back a\n * deterministic fake cwd. Set `availability` to exercise the fallbacks, `outcomes`\n * to script a conflict, and `holdIntegration` to keep a task un-integrated so a\n * test can observe that its dependents wait. `repos` makes the run a group of\n * several; `changes` and `stopsIn` say which of them a task changes and where\n * its landing stops. `repairEvidence` scripts what a conflict repair's\n * evidence check finds, and `removal` what a removal kept back.\n */\nexport class FakeWorktreeIsolation implements IWorktreeIsolation {\n availability: IsolationAvailability = { active: true };\n /** What `gitShortfall` answers. */\n gitShortfallText: string | null = null;\n /** The repo paths `startRun` groups: a group of one at `.` unless set. */\n repos: string[] = [SELF_REPO];\n /** Per task id, the repos it changes; every repo of the group when not listed. */\n changes = new Map<string, string[]>();\n /** Per task id, the repo its landing stops in when its outcome is not `merged`; its first changed repo when not listed. */\n stopsIn = new Map<string, string>();\n /** Per task id, the files a `conflict` outcome names; empty when not listed. */\n conflictFiles = new Map<string, string[]>();\n /** What `mergeIntoCheckedOut` answers; a `merged` one also puts every landed task in HEAD, as git would. */\n mergeResult: IsolationMergeResult = { outcome: 'merged' };\n /** Task ids whose landed work `findInHead` finds in HEAD besides those a merge put there, as a merge by hand would. */\n mergedByHand = new Set<string>();\n /** What `snapshotTree` answers; null as for a workspace with no repo. */\n treeSnapshot: TreeSnapshot | null = {};\n /** What `changedSince` answers: the tracked files an ops task changed. */\n changedFiles: string[] = [];\n /** What `startRun` shares and `prepare` copies, to exercise their notices. */\n shared: string[] = [];\n sharedRepos: string[] = [];\n copied: string[] = [];\n setupFailed: SetupFailure[] = [];\n /** Set to make `startRun` throw, as git does when no repo of the group can be isolated. */\n startRunError: Error | null = null;\n /** Set to make `discard` / `sweep` throw after logging the call. */\n discardError: Error | null = null;\n sweepError: Error | null = null;\n /** What `pruneOrphans` reports as kept back from the sweep. */\n keptOnPrune: IsolationPruneResult['kept'] = [];\n /**\n * What every removal — a `release` that removes, `discard`, `pruneOrphans` —\n * reports it kept back. A refused task keeps its record, as git's does.\n */\n removal: IsolationRemoval = noRemoval();\n /** Per task id; a task not listed integrates as `merged`. */\n outcomes = new Map<string, IsolationOutcome>();\n /** What `revert` stops with; a revert that goes through when null. */\n revertStop: Exclude<IsolationRevertResult, { outcome: 'reverted' }> | null = null;\n /** What `readLanded` finds of a task's work in the user's branch, by task id. */\n inBranch = new Map<string, RevertCommand[]>();\n /** Per task id, what `verifyRepair` finds; a task not listed passes. */\n repairEvidence = new Map<string, RepairEvidence>();\n calls: FakeIsolationCall[] = [];\n private holds = new Map<string, Promise<void>>();\n private verifyHolds = new Map<string, Promise<void>>();\n private revertHold: Promise<void> | null = null;\n private runCount = 0;\n\n private log(call: FakeIsolationCall): void { this.calls.push(call); }\n\n /** Task ids in the order `op` was called for them. */\n taskIdsFor(op: 'prepare' | 'reopen' | 'verifyRepair' | 'integrate' | 'release'): string[] {\n return this.calls.flatMap((c) => (c.op === op && 'taskId' in c ? [c.taskId] : []));\n }\n\n /** Make `integrate` for this task wait until the returned function is called. */\n holdIntegration(taskId: string): () => void {\n let open!: () => void;\n this.holds.set(taskId, new Promise<void>((resolve) => { open = resolve; }));\n return open;\n }\n\n /** Make the next `revert` wait, past its `refusal`, until the returned function is called. */\n holdRevert(): () => void {\n let open!: () => void;\n this.revertHold = new Promise<void>((resolve) => { open = resolve; });\n return open;\n }\n\n /** Make `verifyRepair` for this task wait until the returned function is called. */\n holdVerification(taskId: string): () => void {\n let open!: () => void;\n this.verifyHolds.set(taskId, new Promise<void>((resolve) => { open = resolve; }));\n return open;\n }\n\n async gitShortfall(): Promise<string | null> {\n return this.gitShortfallText;\n }\n\n async isActive(workspaceRoot: string): Promise<IsolationAvailability> {\n this.log({ op: 'isActive', workspaceRoot });\n return this.availability;\n }\n\n /** Like git: once the tracked changes are stashed, the tree is no longer dirty. */\n async stash(workspaceRoot: string): Promise<void> {\n this.log({ op: 'stash', workspaceRoot });\n if (!this.availability.active && this.availability.reason === 'dirty') this.availability = { active: true };\n }\n\n async startRun(workspaceRoot: string, stateRoot?: string): Promise<IsolationRun> {\n this.log({ op: 'startRun', workspaceRoot });\n if (this.startRunError) throw this.startRunError;\n const id = `run${++this.runCount}`;\n return {\n id,\n workspaceRoot,\n ...(stateRoot !== undefined ? { stateRoot } : {}),\n repos: this.repos.map((repo) => ({\n path: repo, root: `${workspaceRoot}/${repo}`.replace(/\\/\\.$/, ''), baseRef: 'base0000', baseBranch: 'main', integrationBranch: integrationBranchFor(id),\n })),\n shared: [...this.shared],\n sharedRepos: [...this.sharedRepos],\n tasks: {},\n keepsEveryLanding: true,\n carried: {},\n };\n }\n\n async prepare(task: Task, run: IsolationRun, _intent?: PrepareIntent, opts: { readOnly?: boolean } = {}): Promise<PreparedTask> {\n this.log({ op: 'prepare', taskId: task.id });\n const name = `${task.order}-${task.id}`;\n const cwd = `/fake-worktrees/${run.id}/${name}`;\n const branch = `ordewell/${run.id}/${name}`;\n run.tasks[task.id] = {\n taskId: task.id, order: task.order, title: task.title, branch, workspace: cwd, status: 'active',\n repos: Object.fromEntries(run.repos.map((r) => [r.path, { worktree: r.path === SELF_REPO ? cwd : `${cwd}/${r.path}`, linked: [] }])),\n ...(opts.readOnly ? { readOnly: true } : {}),\n };\n return { cwd, branch, copied: [...this.copied], ...(this.setupFailed.length > 0 ? { setupFailed: [...this.setupFailed] } : {}) };\n }\n\n /** Like git: the same cwd, each changed repo's tip recorded, the repair counted. */\n async reopen(task: Task, run: IsolationRun): Promise<PreparedTask> {\n this.log({ op: 'reopen', taskId: task.id });\n const record = run.tasks[task.id];\n if (record?.status !== 'conflict') throw new Error(`Task ${task.order} has no conflict to repair`);\n const changed = Object.entries(record.repos).filter(([repo, entry]) => entry.changed || repo === record.conflictRepo).map(([repo]) => repo);\n const files = (record.conflictFiles ?? []).map((file) => (record.conflictRepo && record.conflictRepo !== SELF_REPO ? `${record.conflictRepo}/${file}` : file));\n record.repairs = (record.repairs ?? 0) + 1;\n record.repairBase = Object.fromEntries(changed.map((repo) => [repo, `tip-${repo}`]));\n record.repairedFiles = [...new Set([...(record.repairedFiles ?? []), ...files])];\n record.status = 'repairing';\n return { cwd: record.workspace, branch: record.branch, copied: [] };\n }\n\n async verifyRepair(task: Task, _run: IsolationRun): Promise<RepairEvidence> {\n this.log({ op: 'verifyRepair', taskId: task.id });\n await this.verifyHolds.get(task.id);\n return this.repairEvidence.get(task.id) ?? { ok: true };\n }\n\n /** Like git: the landing is recorded and persisted before the (held) merge, and cleared once it settles. */\n async integrate(task: Task, run: IsolationRun, persist: () => void = () => undefined, commit?: HandoffCommit): Promise<IsolationOutcome> {\n this.log({ op: 'integrate', taskId: task.id });\n const record = run.tasks[task.id];\n if (!record) return 'failed';\n if (commit) record.commit = commit;\n if (record.readOnly) {\n record.status = 'failed';\n record.landingError = 'a read-only task lands nothing';\n return 'failed';\n }\n const changed = this.changes.get(task.id) ?? run.repos.map((r) => r.path);\n for (const [repo, entry] of Object.entries(record.repos)) entry.changed = changed.includes(repo) || (entry.changed ?? false);\n if (changed.length > 0) {\n run.landing = { taskId: task.id, tips: Object.fromEntries(changed.map((repo) => [repo, `tip-${repo}`])) };\n persist();\n }\n await this.holds.get(task.id);\n delete run.landing;\n const outcome = this.outcomes.get(task.id) ?? 'merged';\n record.status = outcome;\n delete record.repairBase;\n if (outcome === 'merged') {\n delete record.conflictRepo;\n delete record.conflictFiles;\n for (const repo of changed) {\n ((run.landings ??= {})[task.id] ??= {})[repo] = [...run.landings?.[task.id]?.[repo] ?? [], `tip-${repo}`];\n (run.landedTasks ??= {})[task.id] = { taskId: task.id, order: task.order, title: task.title };\n }\n } else {\n record.conflictRepo = this.stopsIn.get(task.id) ?? changed[0] ?? SELF_REPO;\n const files = this.conflictFiles.get(task.id);\n if (files) record.conflictFiles = files;\n else delete record.conflictFiles;\n }\n return outcome;\n }\n\n /** Newest landing first, read as the plan's highest order: scheduling tests land in plan order. */\n async readLanded(run: IsolationRun, taskIds: readonly string[]): Promise<LandedWork> {\n this.log({ op: 'readLanded', taskIds });\n const records = taskIds.flatMap((id) => run.tasks[id] ?? run.landedTasks?.[id] ?? []).sort((a, b) => b.order - a.order);\n const tasks = records.map((r) => ({\n taskId: r.taskId, order: r.order, title: r.title,\n repos: Object.keys(run.landings?.[r.taskId] ?? {}),\n }));\n return { ok: true, tasks, inBranch: records.flatMap((r) => this.inBranch.get(r.taskId) ?? []) };\n }\n\n /** Like git: the turn, then the judgement, then the records go in one step with the tasks back. */\n async revert(run: IsolationRun, taskIds: readonly string[], watch: RevertWatch): Promise<IsolationRevertResult> {\n this.log({ op: 'revert', taskIds });\n const hold = this.revertHold;\n this.revertHold = null;\n await hold;\n const reason = watch.refusal();\n if (reason) return { outcome: 'refused', reason };\n if (this.revertStop) return this.revertStop;\n const landed = await this.readLanded(run, taskIds);\n if (!landed.ok) return { outcome: 'failed', error: landed.error };\n if (landed.inBranch.length > 0) return { outcome: 'in-branch', commands: landed.inBranch };\n run.landing = { taskId: taskIds[0], tips: {}, reverts: {} };\n watch.persist();\n delete run.landing;\n for (const id of taskIds) {\n // Like git: a later attempt's record that did not land stays for its worktree, its conflict over.\n if (run.tasks[id]?.status === 'merged') delete run.tasks[id];\n else if (run.tasks[id]?.status === 'conflict') run.tasks[id].status = 'kept';\n delete run.landings?.[id];\n delete run.landedTasks?.[id];\n delete run.landedOn?.[id];\n }\n run.reverted = true;\n watch.settled(taskIds);\n return { outcome: 'reverted', tasks: landed.tasks };\n }\n\n async release(run: IsolationRun, taskId: string, opts: { keep: boolean }): Promise<IsolationRemoval> {\n this.log({ op: 'release', taskId, keep: opts.keep });\n const record = run.tasks[taskId];\n // Like git: a read-only task's record goes whole, with nothing kept (ADR-0046).\n if (record?.readOnly) {\n delete run.tasks[taskId];\n return noRemoval();\n }\n const removal = opts.keep || !record ? noRemoval() : this.removed();\n const refused = removal.refused.some((r) => r.task?.taskId === taskId);\n if (!opts.keep && !refused) delete run.tasks[taskId];\n else if (record?.status === 'active') record.status = 'kept';\n else if (record?.status === 'repairing') {\n record.status = 'conflict';\n delete record.repairBase;\n }\n return removal;\n }\n\n private removed(): IsolationRemoval {\n return { preserved: [...this.removal.preserved], refused: [...this.removal.refused] };\n }\n\n async handoff(run: IsolationRun): Promise<IsolationHandoff> {\n this.log({ op: 'handoff' });\n return handoffOf(run);\n }\n\n async pruneOrphans(): Promise<IsolationPruneResult> {\n this.log({ op: 'pruneOrphans' });\n return { kept: [...this.keptOnPrune], ...this.removed() };\n }\n async reviewDiff(): Promise<string> { this.log({ op: 'reviewDiff' }); return ''; }\n async mergeIntoCheckedOut(run: IsolationRun): Promise<IsolationMergeResult> {\n this.log({ op: 'mergeIntoCheckedOut' });\n if (this.mergeResult.outcome === 'merged') {\n for (const record of Object.values(run.tasks)) if (record.status === 'merged') this.mergedByHand.add(record.taskId);\n }\n return this.mergeResult;\n }\n async findInHead(run: IsolationRun): Promise<string[]> {\n this.log({ op: 'findInHead' });\n const changed: string[] = [];\n for (const record of Object.values(run.tasks)) {\n if (record.status !== 'merged') continue;\n const merged = this.mergedByHand.has(record.taskId);\n if (merged === !!record.inHead) continue;\n if (merged) record.inHead = true;\n else delete record.inHead;\n changed.push(record.taskId);\n }\n return changed;\n }\n async snapshotTree(): Promise<TreeSnapshot | null> { this.log({ op: 'snapshotTree' }); return this.treeSnapshot; }\n async changedSince(): Promise<string[]> { this.log({ op: 'changedSince' }); return [...this.changedFiles]; }\n async discard(_run: IsolationRun, opts: { integration: IntegrationDisposal }): Promise<IsolationRemoval> {\n this.log({ op: 'discard', integration: opts.integration });\n if (this.discardError) throw this.discardError;\n return this.removed();\n }\n async sweep(): Promise<void> {\n this.log({ op: 'sweep' });\n if (this.sweepError) throw this.sweepError;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA,YAAY,QAAQ;AACpB,YAAY,UAAU;AASf,SAAS,UAAU,KAA4B;AACpD,SAAU,YAAS,GAAG,KAAK,EAAE,WAAW,MAAM,OAAO,MAAM,YAAY,IAAI,YAAY,IAAI,CAAC;AAC9F;AAaO,SAAS,QAAQ,MAAc,WAA4B,QAAQ,UAA8C;AACtH,MAAI,aAAa,QAAS,QAAO,EAAE,MAAM,KAAK;AAC9C,SAAO;AAAA,IACL,MAAM;AAAA,IACN,aAAa;AAAA,IACb,SAAc,WAAM,KAAK,MAAM,WAAW,SAAS;AAAA,IACnD,cAAmB,WAAM,KAAK,MAAM,WAAW,OAAO;AAAA,IACtD,aAAkB,WAAM,KAAK,MAAM,aAAa;AAAA,IAChD,OAAO;AAAA,IACP,cAAc;AAAA,EAChB;AACF;AAOO,SAAS,OAAO,MAAsD;AAC3E,QAAM,QAAQ,OAAO,YAAY,OAAO,KAAK,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,KAAK,QAAQ,IAAI,GAAG,CAAC,CAAC,CAAC;AACxF,WAAS,IAAI;AACb,SAAO,MAAM,SAAS,KAAK;AAC7B;AAEA,SAAS,SAAS,MAAgD;AAChE,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,IAAI,GAAG;AAC/C,QAAI,UAAU,OAAW,QAAO,QAAQ,IAAI,GAAG;AAAA,QAC1C,SAAQ,IAAI,GAAG,IAAI;AAAA,EAC1B;AACF;AAOO,SAAS,aAAa,KAAa,MAAsB;AAC9D,QAAM,OAAY,UAAK,KAAK,QAAQ,aAAa,UAAU,GAAG,IAAI,SAAS,IAAI;AAC/E,EAAG,iBAAc,MAAM,qB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O,OAAO,IAAI,KAAK,GAAG;AAC7C,UAAI,OAAO,WAAW,SAAU;AAChC,YAAM,SAAS,KAAK,aAAa,IAAI,OAAO,MAAM;AAClD,UAAI,WAAW,CAAC,CAAC,OAAO,OAAQ;AAChC,UAAI,OAAQ,QAAO,SAAS;AAAA,UACvB,QAAO,OAAO;AACnB,cAAQ,KAAK,OAAO,MAAM;AAAA,IAC5B;AACA,WAAO;AAAA,EACT;AAAA,EACA,MAAM,eAA6C;AAAE,SAAK,IAAI,EAAE,IAAI,eAAe,CAAC;AAAG,WAAO,KAAK;AAAA,EAAc;AAAA,EACjH,MAAM,eAAkC;AAAE,SAAK,IAAI,EAAE,IAAI,eAAe,CAAC;AAAG,WAAO,CAAC,GAAG,KAAK,YAAY;AAAA,EAAG;AAAA,EAC3G,MAAM,QAAQ,MAAoB,MAAuE;AACvG,SAAK,IAAI,EAAE,IAAI,WAAW,aAAa,KAAK,YAAY,CAAC;AACzD,QAAI,KAAK,aAAc,OAAM,KAAK;AAClC,WAAO,KAAK,QAAQ;AAAA,EACtB;AAAA,EACA,MAAM,QAAuB;AAC3B,SAAK,IAAI,EAAE,IAAI,QAAQ,CAAC;AACxB,QAAI,KAAK,WAAY,OAAM,KAAK;AAAA,EAClC;AACF;","names":["path"]}
|
package/docker/task.Dockerfile
CHANGED
|
@@ -5,18 +5,21 @@
|
|
|
5
5
|
# Ordewell publishes no image holding Claude Code: Anthropic's terms say
|
|
6
6
|
# preinstalling or running it in a product or service needs its Commercial
|
|
7
7
|
# Terms and an unmodified binary (ADR-0059 L5). Add your project's toolchain
|
|
8
|
-
# below, and rebuild when you want a newer
|
|
8
|
+
# below, leave out a runner you do not use, and rebuild when you want a newer one.
|
|
9
9
|
FROM node:22-slim
|
|
10
10
|
|
|
11
11
|
RUN apt-get update \
|
|
12
12
|
&& apt-get install -y --no-install-recommends git ca-certificates \
|
|
13
13
|
&& rm -rf /var/lib/apt/lists/*
|
|
14
14
|
|
|
15
|
-
RUN npm install -g @anthropic-ai/claude-code
|
|
15
|
+
RUN npm install -g @anthropic-ai/claude-code @openai/codex
|
|
16
|
+
|
|
17
|
+
# For OpenCode tasks, add its MIT-licensed package as well:
|
|
18
|
+
# RUN npm install -g @opencode/cli
|
|
16
19
|
|
|
17
20
|
# A named volume takes its owner from the folder it mounts over, and a lease
|
|
18
21
|
# runs as uid 1000, which is the `node` user here.
|
|
19
|
-
RUN mkdir -p /task /mirror /login
|
|
20
|
-
&& chown -R node:node /task /mirror /login
|
|
22
|
+
RUN mkdir -p /task /mirror /login \
|
|
23
|
+
&& chown -R node:node /task /mirror /login
|
|
21
24
|
|
|
22
25
|
USER node
|