@leitwerk-dev/test-support 0.3.0 → 0.3.1
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/{chunk-OE4NHDVS.js → chunk-JGXSXRIJ.js} +2 -2
- package/dist/{chunk-E4Y7XND5.js → chunk-WT7V7REB.js} +2 -1
- package/dist/chunk-WT7V7REB.js.map +1 -0
- package/dist/extension-integration-harness.d.ts.map +1 -1
- package/dist/fixtures.js.map +1 -1
- package/dist/integration.js +26 -87
- package/dist/integration.js.map +1 -1
- package/dist/stub-worker-entry.js +1 -1
- package/dist/supported-question-fixtures.d.ts.map +1 -1
- package/dist/worker-testing/index.js +2 -2
- package/dist/worker-testing/stub-pi-tree-handle.d.ts +13 -0
- package/dist/worker-testing/stub-pi-tree-handle.d.ts.map +1 -1
- package/package.json +9 -9
- package/src/extension-integration-harness.ts +34 -127
- package/src/supported-question-fixtures.ts +0 -20
- package/src/worker-testing/stub-pi-tree-handle.ts +14 -0
- package/dist/chunk-E4Y7XND5.js.map +0 -1
- /package/dist/{chunk-OE4NHDVS.js.map → chunk-JGXSXRIJ.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createSchemaDrivenStubPiFactory
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-WT7V7REB.js";
|
|
4
4
|
|
|
5
5
|
// src/worker-testing/in-process-worker-spawn.ts
|
|
6
6
|
import { EventEmitter } from "events";
|
|
@@ -87,4 +87,4 @@ function createInProcessWorkerSpawn(options = {}) {
|
|
|
87
87
|
export {
|
|
88
88
|
createInProcessWorkerSpawn
|
|
89
89
|
};
|
|
90
|
-
//# sourceMappingURL=chunk-
|
|
90
|
+
//# sourceMappingURL=chunk-JGXSXRIJ.js.map
|
|
@@ -716,6 +716,7 @@ var StubPiTreeHandleFactory = class {
|
|
|
716
716
|
toolCallScriptResolver: this.toolCallScriptResolver ? (context) => this.toolCallScriptResolver?.({
|
|
717
717
|
...context,
|
|
718
718
|
instanceId: opts.instanceId,
|
|
719
|
+
...opts.iteration ? { iteration: opts.iteration } : {},
|
|
719
720
|
workspaceRoot: opts.workspaceRoot,
|
|
720
721
|
sessionCwd: opts.sessionCwd
|
|
721
722
|
}) : void 0,
|
|
@@ -806,4 +807,4 @@ export {
|
|
|
806
807
|
StubPiTreeHandleFactory,
|
|
807
808
|
createSchemaDrivenStubPiFactory
|
|
808
809
|
};
|
|
809
|
-
//# sourceMappingURL=chunk-
|
|
810
|
+
//# sourceMappingURL=chunk-WT7V7REB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/worker-testing/stub-pi-tree-handle.ts","../src/worker-testing/schema-driven-stub-pi.ts"],"sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport { mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { CURRENT_SESSION_VERSION, type SessionHeader } from \"@earendil-works/pi-coding-agent\";\nimport type {\n\tPiCustomMessageInput,\n\tPiCustomTool,\n\tPiEvent,\n\tPiEventHandler,\n\tPiPromptOptions,\n\tPiRunDetails,\n\tPiSessionDiagnostic,\n\tPiSessionDiagnosticHandler,\n\tPiTreeEntry,\n\tPiTreeHandle,\n\tPiTreeNode,\n\tPiTurnExecutionResult,\n} from \"@leitwerk-dev/process-sdk\";\nimport { isEnoent } from \"@leitwerk-dev/process-sdk\";\nimport type {\n\tPiManagedBootstrapOptions,\n\tPiManagedBootstrapResult,\n\tPiTreeHandleFactory,\n\tPiTreeHandleOptions,\n\tPiTreePlanningOptions,\n\tPiTreePlanningSnapshot,\n} from \"@leitwerk-dev/worker\";\n\n/** @public */\nexport interface StubToolCallScriptCall {\n\t/** @public */\n\ttoolName: string;\n\t/** @public */\n\targs: Record<string, unknown>;\n\t/** @internal */\n\tintermediateEntryCount?: number;\n}\n\n/** @public */\nexport type StubToolCallScriptItem =\n\t| StubToolCallScriptCall\n\t| {\n\t\t\t/** @public */\n\t\t\tcalls: readonly StubToolCallScriptCall[];\n\t\t\t/** @public */\n\t\t\ttextChunks?: readonly string[];\n\t\t\t/** @public */\n\t\t\tthinkingChunks?: readonly string[];\n\t\t\t/** @public */\n\t\t\tchunkDelayMs?: number;\n\t\t\t/** Optional scripted model reaction to a tool result, within the same turn. @internal */\n\t\t\tafterToolResult?: (\n\t\t\t\tcall: StubToolCallScriptCall,\n\t\t\t\tresult: unknown,\n\t\t\t) => StubToolCallScriptCall | undefined;\n\t };\n\n/** @public */\nexport interface StubToolCallScriptResolverContext {\n\t/** @public */\n\tpromptText: string;\n\t/** Identified turn prompt, when the SDK prompt uses a custom message. @internal */\n\tidentifiedPromptText?: string;\n\t/** @public */\n\ttools: readonly PiCustomTool[];\n\t/** @public */\n\tinstanceId?: string;\n\t/** Active frozen item when the turn is one item of a mapped LLM turn. @public */\n\titeration?: {\n\t\t/** @public */\n\t\titemKey: string;\n\t\t/** @public */\n\t\titemLabel: string;\n\t\t/** @public */\n\t\titemIndex: number;\n\t\t/** @public */\n\t\titemCount: number;\n\t\t/** @public */\n\t\titem: unknown;\n\t};\n\t/** @public */\n\tworkspaceRoot?: string;\n\t/** @public */\n\tsessionCwd?: string;\n\t/** @public */\n\ttreeFile: string;\n\t/** @internal */\n\tturnSequence: number;\n}\n\n/** @public */\nexport type StubToolCallScriptResolver = (\n\tcontext: StubToolCallScriptResolverContext,\n) => StubToolCallScriptItem | undefined | Promise<StubToolCallScriptItem | undefined>;\n\nfunction stringifyToolResult(result: unknown): string {\n\tif (typeof result === \"string\") {\n\t\treturn result;\n\t}\n\tif (result === undefined) {\n\t\treturn \"ok\";\n\t}\n\ttry {\n\t\treturn JSON.stringify(result, null, 2);\n\t} catch {\n\t\treturn String(result);\n\t}\n}\n\nfunction expandStubToolCallScriptItem(item: StubToolCallScriptItem): StubToolCallScriptCall[] {\n\tif (\"calls\" in item) {\n\t\treturn [...item.calls];\n\t}\n\treturn [item];\n}\n\nfunction stubToolCallId(turnSeq: number, totalCalls: number, index: number): string {\n\tif (totalCalls <= 1) {\n\t\treturn `tool-${turnSeq}`;\n\t}\n\treturn `tool-${turnSeq}-${index + 1}`;\n}\n\n/** @internal */\ninterface StubPiTreeState {\n\t/** @internal */\n\theader?: SessionHeader;\n\t/** @internal */\n\tturnSeq: number;\n\t/** @internal */\n\tcurrentLeafId: string | null;\n\t/** @internal */\n\tentries: Map<string, PiTreeEntry>;\n\t/** @internal */\n\tchildIdsByParent: Map<string | null, string[]>;\n}\n\ninterface PersistedStubPiTreeState {\n\tturnSeq: number;\n\tcurrentLeafId: string | null;\n\tentries: PiTreeEntry[];\n\tchildIdsByParent: Array<{ parentId: string | null; childIds: string[] }>;\n}\n\nfunction createEmptyStubPiTreeState(): StubPiTreeState {\n\treturn {\n\t\tturnSeq: 0,\n\t\tcurrentLeafId: null,\n\t\tentries: new Map<string, PiTreeEntry>(),\n\t\tchildIdsByParent: new Map<string | null, string[]>(),\n\t};\n}\n\nfunction indexStubEntry(state: StubPiTreeState, entry: PiTreeEntry): void {\n\tstate.entries.set(entry.id, entry);\n\tconst siblings = state.childIdsByParent.get(entry.parentId) ?? [];\n\tsiblings.push(entry.id);\n\tstate.childIdsByParent.set(entry.parentId, siblings);\n}\n\nfunction deriveStubLeafIdFromEntries(state: StubPiTreeState): string | null {\n\tlet leafId: string | null = null;\n\tfor (const entryId of state.entries.keys()) {\n\t\tleafId = entryId;\n\t}\n\treturn leafId;\n}\n\nfunction serializeStubPiTreeState(state: StubPiTreeState, recordSessionTrace: boolean): string {\n\tif (recordSessionTrace) {\n\t\treturn `${[\n\t\t\tJSON.stringify({\n\t\t\t\t...state.header,\n\t\t\t\tstubState: { turnSeq: state.turnSeq, currentLeafId: state.currentLeafId },\n\t\t\t}),\n\t\t\t...[...state.entries.values()].map((entry) => JSON.stringify(entry)),\n\t\t].join(\"\\n\")}\\n`;\n\t}\n\tconst persisted: PersistedStubPiTreeState = {\n\t\tturnSeq: state.turnSeq,\n\t\tcurrentLeafId: state.currentLeafId,\n\t\tentries: [...state.entries.values()],\n\t\tchildIdsByParent: [...state.childIdsByParent.entries()].map(([parentId, childIds]) => ({\n\t\t\tparentId,\n\t\t\tchildIds: [...childIds],\n\t\t})),\n\t};\n\treturn JSON.stringify(persisted);\n}\n\nfunction deserializeStubPiTreeState(value: string): StubPiTreeState {\n\tconst lines = value.trim().split(\"\\n\");\n\tconst header = JSON.parse(lines[0]) as SessionHeader & {\n\t\tstubState?: { turnSeq: number; currentLeafId: string | null };\n\t};\n\tif (header.type === \"session\") {\n\t\tconst entries = lines\n\t\t\t.slice(1)\n\t\t\t.filter(Boolean)\n\t\t\t.map((line) => JSON.parse(line) as PiTreeEntry);\n\t\tconst state = createEmptyStubPiTreeState();\n\t\tstate.header = header;\n\t\tstate.turnSeq = header.stubState?.turnSeq ?? 0;\n\t\tstate.currentLeafId = header.stubState?.currentLeafId ?? null;\n\t\tfor (const entry of entries) indexStubEntry(state, entry);\n\t\treturn state;\n\t}\n\tconst parsed = JSON.parse(value) as PersistedStubPiTreeState;\n\treturn {\n\t\tturnSeq: typeof parsed.turnSeq === \"number\" ? parsed.turnSeq : 0,\n\t\tcurrentLeafId:\n\t\t\ttypeof parsed.currentLeafId === \"string\" || parsed.currentLeafId === null\n\t\t\t\t? parsed.currentLeafId\n\t\t\t\t: null,\n\t\tentries: new Map((parsed.entries ?? []).map((entry) => [entry.id, entry])),\n\t\tchildIdsByParent: new Map(\n\t\t\t(parsed.childIdsByParent ?? []).map((entry) => [entry.parentId, [...entry.childIds]]),\n\t\t),\n\t};\n}\n\n/** @public */\nexport class StubPiTreeHandle implements PiTreeHandle {\n\t/** @public */\n\treadonly sessionId: string;\n\t/** @internal */\n\treadonly treeFile: string;\n\t/** @internal */\n\treadonly isResumed: boolean;\n\n\t/** @internal */\n\treadonly prompts: string[] = [];\n\t/** @internal */\n\treadonly steers: string[] = [];\n\t/** @internal */\n\tbeforeTurn?: (\n\t\tkind: \"prompt\" | \"literal\" | \"custom\" | \"continue\",\n\t\toptions: PiPromptOptions | undefined,\n\t\tpromptText: string | undefined,\n\t) => boolean | undefined | Promise<boolean | undefined>;\n\n\tprivate _closed = false;\n\tprivate turnAbort = new AbortController();\n\tprivate branchDriftPending = false;\n\tprivate readonly handlers = new Set<PiEventHandler>();\n\tprivate readonly diagnosticHandlers = new Set<PiSessionDiagnosticHandler>();\n\tprivate readonly toolCallScriptResolver?: StubToolCallScriptResolver;\n\tprivate readonly state: StubPiTreeState;\n\tprivate readonly runDetails: PiRunDetails;\n\tprivate readonly persistState?: (() => Promise<void>) | undefined;\n\tprivate readonly recordSessionTrace: boolean;\n\n\t/** @internal */\n\tconstructor(options: {\n\t\t/** @internal */\n\t\tsessionId: string;\n\t\t/** @internal */\n\t\ttreeFile: string;\n\t\t/** @internal */\n\t\tisResumed: boolean;\n\t\t/** @internal */\n\t\ttoolCallScriptResolver?: StubToolCallScriptResolver;\n\t\t/** @internal */\n\t\tstate?: StubPiTreeState;\n\t\t/** @internal */\n\t\trunDetails?: Partial<PiRunDetails>;\n\t\t/** @internal */\n\t\tpersistState?: () => Promise<void>;\n\t\t/** @internal */\n\t\trecordSessionTrace?: boolean;\n\t}) {\n\t\tthis.sessionId = options.sessionId;\n\t\tthis.treeFile = options.treeFile;\n\t\tthis.isResumed = options.isResumed;\n\t\tthis.toolCallScriptResolver = options.toolCallScriptResolver;\n\t\tthis.state = options.state ?? createEmptyStubPiTreeState();\n\t\tthis.persistState = options.persistState;\n\t\tthis.recordSessionTrace = options.recordSessionTrace ?? false;\n\t\tthis.runDetails = {\n\t\t\tloadedAgentsFiles: options.runDetails?.loadedAgentsFiles?.map((file) => ({ ...file })) ?? [],\n\t\t\tloadedSkills: options.runDetails?.loadedSkills?.map((skill) => ({ ...skill })) ?? [],\n\t\t\tavailableToolNames: [...(options.runDetails?.availableToolNames ?? [])],\n\t\t};\n\t}\n\n\t/** @internal */\n\tget closed(): boolean {\n\t\treturn this._closed;\n\t}\n\n\t/** @internal */\n\tfailNextTurnWithBranchDrift(): void {\n\t\tthis.branchDriftPending = true;\n\t}\n\n\tprivate assertOpen(): void {\n\t\tif (this._closed) {\n\t\t\tthrow new Error(\"Handle is closed\");\n\t\t}\n\t}\n\n\tprivate addEntry(entry: PiTreeEntry): void {\n\t\tindexStubEntry(this.state, entry);\n\t\tthis.state.currentLeafId = entry.id;\n\t}\n\n\tprivate createMessageEntry(\n\t\tid: string,\n\t\tparentId: string | null,\n\t\trole: \"user\" | \"assistant\",\n\t\tcontent: unknown,\n\t\ttimestamp: string,\n\t): PiTreeEntry {\n\t\treturn {\n\t\t\tid,\n\t\t\tparentId,\n\t\t\ttype: \"message\",\n\t\t\ttimestamp,\n\t\t\tmessage: {\n\t\t\t\trole,\n\t\t\t\tcontent,\n\t\t\t},\n\t\t};\n\t}\n\n\tprivate emitEvent(event: PiEvent): void {\n\t\tfor (const handler of this.handlers) {\n\t\t\thandler(event);\n\t\t}\n\t}\n\n\t/** @internal */\n\tgetRunDetails(): PiRunDetails {\n\t\treturn {\n\t\t\tloadedAgentsFiles: this.runDetails.loadedAgentsFiles.map((file) => ({ ...file })),\n\t\t\tloadedSkills: this.runDetails.loadedSkills.map((skill) => ({ ...skill })),\n\t\t\tavailableToolNames: [...this.runDetails.availableToolNames],\n\t\t};\n\t}\n\n\t/** @internal */\n\tgetLeafId(): string | null {\n\t\treturn this.state.currentLeafId;\n\t}\n\n\t/** @internal */\n\tgetEntry(id: string): PiTreeEntry | undefined {\n\t\treturn this.state.entries.get(id);\n\t}\n\n\t/** @public */\n\tgetBranch(fromId: string | undefined = this.state.currentLeafId ?? undefined): PiTreeEntry[] {\n\t\tif (!fromId) {\n\t\t\treturn [];\n\t\t}\n\t\tconst branch: PiTreeEntry[] = [];\n\t\tlet currentId: string | null = fromId;\n\t\twhile (currentId) {\n\t\t\tconst entry = this.state.entries.get(currentId);\n\t\t\tif (!entry) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbranch.push(entry);\n\t\t\tcurrentId = entry.parentId;\n\t\t}\n\t\tbranch.reverse();\n\t\treturn branch;\n\t}\n\n\t/** @internal */\n\tgetChildren(parentId: string): PiTreeEntry[] {\n\t\treturn (this.state.childIdsByParent.get(parentId) ?? [])\n\t\t\t.map((childId) => this.state.entries.get(childId))\n\t\t\t.filter((entry): entry is PiTreeEntry => entry !== undefined);\n\t}\n\n\t/** @internal */\n\tgetTree(): PiTreeNode[] {\n\t\tconst buildNode = (entry: PiTreeEntry): PiTreeNode => ({\n\t\t\tentry,\n\t\t\tchildren: this.getChildren(entry.id).map(buildNode),\n\t\t});\n\t\treturn (this.state.childIdsByParent.get(null) ?? [])\n\t\t\t.map((entryId) => this.state.entries.get(entryId))\n\t\t\t.filter((entry): entry is PiTreeEntry => entry !== undefined)\n\t\t\t.map(buildNode);\n\t}\n\n\t/** @internal */\n\tasync branch(entryId: string): Promise<void> {\n\t\tthis.assertOpen();\n\t\tif (!this.state.entries.has(entryId)) {\n\t\t\tthrow new Error(`Unknown Pi entry '${entryId}'`);\n\t\t}\n\t\tthis.state.currentLeafId = entryId;\n\t\tawait this.persistState?.();\n\t}\n\n\t/** @internal */\n\tasync branchFromRoot(): Promise<void> {\n\t\tthis.assertOpen();\n\t\tthis.state.currentLeafId = null;\n\t\tawait this.persistState?.();\n\t}\n\n\t/** @internal */\n\tasync resetLeaf(): Promise<void> {\n\t\tawait this.branchFromRoot();\n\t}\n\n\t/** @internal */\n\tasync compact(\n\t\t_customInstructions?: string,\n\t\tdetails?: unknown,\n\t): Promise<{\n\t\t/** @internal */\n\t\tsummary: string;\n\t}> {\n\t\tthis.assertOpen();\n\t\tconst timestamp = new Date().toISOString();\n\t\tconst compactionEntryId = `compaction-${++this.state.turnSeq}`;\n\t\tthis.addEntry({\n\t\t\tid: compactionEntryId,\n\t\t\tparentId: this.state.currentLeafId,\n\t\t\ttype: \"compaction\",\n\t\t\ttimestamp,\n\t\t\tdetails,\n\t\t});\n\t\tawait this.persistState?.();\n\t\treturn { summary: \"Stub compaction\" };\n\t}\n\n\tprivate async executeTurn(input: {\n\t\tkind: \"prompt\" | \"literal\" | \"custom\" | \"continue\";\n\t\tpromptText?: string;\n\t\tscriptPromptText?: string;\n\t\toptions?: PiPromptOptions;\n\t\tappendPromptUserMessage: boolean;\n\t}): Promise<PiTurnExecutionResult> {\n\t\tthis.assertOpen();\n\t\tthis.turnAbort = new AbortController();\n\t\tconst signal = this.turnAbort.signal;\n\t\tif ((await this.beforeTurn?.(input.kind, input.options, input.promptText)) === false) {\n\t\t\tinput.options = undefined;\n\t\t}\n\t\tsignal.throwIfAborted();\n\t\tif (this.branchDriftPending) {\n\t\t\tthis.branchDriftPending = false;\n\t\t\tthrow Object.assign(new Error(\"stubbed Pi branch drift\"), {\n\t\t\t\tname: \"PiBranchDriftError\",\n\t\t\t\tfailureCode: \"branch_drift\",\n\t\t\t\ttoTurnFailureOptions: () => ({\n\t\t\t\t\tfailureCode: \"branch_drift\",\n\t\t\t\t\tfailureDetails: { operation: input.kind },\n\t\t\t\t\trecoveryContext: null,\n\t\t\t\t\trestorePrimaryLeaf: false,\n\t\t\t\t}),\n\t\t\t});\n\t\t}\n\t\tif (input.promptText !== undefined) {\n\t\t\tthis.prompts.push(input.promptText);\n\t\t}\n\t\tconst startLeafId = this.state.currentLeafId;\n\t\tconst turnId = `turn-${++this.state.turnSeq}`;\n\t\tconst timestamp = new Date().toISOString();\n\t\tconst createdEntryIds: string[] = [];\n\t\tif (input.appendPromptUserMessage) {\n\t\t\tconst userEntryId = `user-${this.state.turnSeq}`;\n\t\t\tthis.addEntry(\n\t\t\t\tthis.createMessageEntry(\n\t\t\t\t\tuserEntryId,\n\t\t\t\t\tthis.state.currentLeafId,\n\t\t\t\t\t\"user\",\n\t\t\t\t\tinput.promptText ?? \"\",\n\t\t\t\t\ttimestamp,\n\t\t\t\t),\n\t\t\t);\n\t\t\tcreatedEntryIds.push(userEntryId);\n\t\t}\n\t\tawait this.persistState?.();\n\t\tsignal.throwIfAborted();\n\t\tthis.emitEvent({ type: \"turn.start\", turnId, data: {}, timestamp });\n\n\t\tconst tools = new Map((input.options?.tools ?? []).map((tool) => [tool.name, tool]));\n\t\tlet assistantContent = input.promptText ?? \"Continued.\";\n\t\tlet assistantContentFromScriptedMarkdown = false;\n\t\tconst scriptedItem = await this.toolCallScriptResolver?.({\n\t\t\ttreeFile: this.treeFile,\n\t\t\tturnSequence: this.state.turnSeq,\n\t\t\tpromptText: input.promptText ?? \"\",\n\t\t\tidentifiedPromptText: input.scriptPromptText,\n\t\t\ttools: input.options?.tools ?? [],\n\t\t});\n\t\tsignal.throwIfAborted();\n\t\tconst hasScriptedChunks = Boolean(\n\t\t\tscriptedItem &&\n\t\t\t\t\"calls\" in scriptedItem &&\n\t\t\t\t(scriptedItem.textChunks?.length ?? 0) + (scriptedItem.thinkingChunks?.length ?? 0),\n\t\t);\n\t\tif (hasScriptedChunks) assistantContent = \"\";\n\t\tif (scriptedItem && \"calls\" in scriptedItem) {\n\t\t\tconst streamed = { thinking: \"\", text: \"\" };\n\t\t\tconst streamEntryId = `stream-${this.state.turnSeq}`;\n\t\t\tconst streamParentId = this.state.currentLeafId;\n\t\t\tconst chunks = [\n\t\t\t\t...(scriptedItem.thinkingChunks ?? []).map((text) => ({\n\t\t\t\t\ttext,\n\t\t\t\t\tstreamType: \"thinking\" as const,\n\t\t\t\t})),\n\t\t\t\t...(scriptedItem.textChunks ?? []).map((text) => ({ text, streamType: \"text\" as const })),\n\t\t\t];\n\t\t\tfor (const { text, streamType } of chunks) {\n\t\t\t\tsignal.throwIfAborted();\n\t\t\t\tstreamed[streamType] += text;\n\t\t\t\tassistantContent = streamed.text;\n\t\t\t\tif (this.recordSessionTrace) {\n\t\t\t\t\tconst entry = this.createMessageEntry(\n\t\t\t\t\t\tstreamEntryId,\n\t\t\t\t\t\tstreamParentId,\n\t\t\t\t\t\t\"assistant\",\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t...(streamed.thinking ? [{ type: \"thinking\", thinking: streamed.thinking }] : []),\n\t\t\t\t\t\t\t...(streamed.text ? [{ type: \"text\", text: streamed.text }] : []),\n\t\t\t\t\t\t],\n\t\t\t\t\t\ttimestamp,\n\t\t\t\t\t);\n\t\t\t\t\tif (this.state.entries.has(streamEntryId)) this.state.entries.set(streamEntryId, entry);\n\t\t\t\t\telse {\n\t\t\t\t\t\tthis.addEntry(entry);\n\t\t\t\t\t\tcreatedEntryIds.push(streamEntryId);\n\t\t\t\t\t}\n\t\t\t\t\tawait this.persistState?.();\n\t\t\t\t}\n\t\t\t\tthis.emitEvent({\n\t\t\t\t\ttype: \"stream.delta\",\n\t\t\t\t\tturnId,\n\t\t\t\t\tdata: { text, streamType },\n\t\t\t\t\ttimestamp: new Date().toISOString(),\n\t\t\t\t});\n\t\t\t\tsignal.throwIfAborted();\n\t\t\t\tif (scriptedItem.chunkDelayMs)\n\t\t\t\t\tawait new Promise<void>((resolve, reject) => {\n\t\t\t\t\t\tconst timer = setTimeout(() => {\n\t\t\t\t\t\t\tsignal.removeEventListener(\"abort\", abort);\n\t\t\t\t\t\t\tresolve();\n\t\t\t\t\t\t}, scriptedItem.chunkDelayMs);\n\t\t\t\t\t\tconst abort = () => {\n\t\t\t\t\t\t\tclearTimeout(timer);\n\t\t\t\t\t\t\treject(signal.reason);\n\t\t\t\t\t\t};\n\t\t\t\t\t\tsignal.addEventListener(\"abort\", abort, { once: true });\n\t\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\tconst scriptedCalls = scriptedItem ? expandStubToolCallScriptItem(scriptedItem) : [];\n\t\tif (scriptedCalls.length > 0) {\n\t\t\tfor (const [callIndex, scriptedCall] of scriptedCalls.entries()) {\n\t\t\t\tsignal.throwIfAborted();\n\t\t\t\tconst toolCallId = stubToolCallId(this.state.turnSeq, scriptedCalls.length, callIndex);\n\t\t\t\tthis.emitEvent({\n\t\t\t\t\ttype: \"tool.call\",\n\t\t\t\t\tturnId,\n\t\t\t\t\tdata: {\n\t\t\t\t\t\ttoolCallId,\n\t\t\t\t\t\tname: scriptedCall.toolName,\n\t\t\t\t\t\targuments: scriptedCall.args,\n\t\t\t\t\t},\n\t\t\t\t\ttimestamp,\n\t\t\t\t});\n\t\t\t\tconst tool = tools.get(scriptedCall.toolName);\n\t\t\t\tif (!tool && scriptedCall.toolName === \"markdown_result\") {\n\t\t\t\t\tconst markdown = (scriptedCall.args as { markdown?: unknown }).markdown;\n\t\t\t\t\tif (typeof markdown === \"string\") {\n\t\t\t\t\t\tassistantContent = markdown;\n\t\t\t\t\t\tassistantContentFromScriptedMarkdown = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (tool) {\n\t\t\t\t\tif (this.recordSessionTrace) {\n\t\t\t\t\t\tconst entryId = `call-${toolCallId}`;\n\t\t\t\t\t\tthis.addEntry(\n\t\t\t\t\t\t\tthis.createMessageEntry(\n\t\t\t\t\t\t\t\tentryId,\n\t\t\t\t\t\t\t\tthis.state.currentLeafId,\n\t\t\t\t\t\t\t\t\"assistant\",\n\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttype: \"toolCall\",\n\t\t\t\t\t\t\t\t\t\tid: toolCallId,\n\t\t\t\t\t\t\t\t\t\tname: scriptedCall.toolName,\n\t\t\t\t\t\t\t\t\t\targuments: scriptedCall.args,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\tnew Date().toISOString(),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tcreatedEntryIds.push(entryId);\n\t\t\t\t\t\tawait this.persistState?.();\n\t\t\t\t\t}\n\t\t\t\t\tconst recordToolResult = async (result: unknown, isError: boolean) => {\n\t\t\t\t\t\tif (!this.recordSessionTrace) return;\n\t\t\t\t\t\tconst entryId = `result-${toolCallId}`;\n\t\t\t\t\t\tconst entry = {\n\t\t\t\t\t\t\tid: entryId,\n\t\t\t\t\t\t\tparentId: this.state.currentLeafId,\n\t\t\t\t\t\t\ttype: \"message\",\n\t\t\t\t\t\t\ttimestamp: new Date().toISOString(),\n\t\t\t\t\t\t\tmessage: {\n\t\t\t\t\t\t\t\trole: \"toolResult\",\n\t\t\t\t\t\t\t\ttoolCallId,\n\t\t\t\t\t\t\t\ttoolName: scriptedCall.toolName,\n\t\t\t\t\t\t\t\tcontent: [{ type: \"text\", text: stringifyToolResult(result) }],\n\t\t\t\t\t\t\t\tisError,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t\tthis.addEntry(entry);\n\t\t\t\t\t\tcreatedEntryIds.push(entryId);\n\t\t\t\t\t\tawait this.persistState?.();\n\t\t\t\t\t};\n\t\t\t\t\ttry {\n\t\t\t\t\t\tsignal.throwIfAborted();\n\t\t\t\t\t\tconst blocked = input.options?.shouldBlockToolCall?.(scriptedCall.toolName);\n\t\t\t\t\t\tif (blocked) throw new Error(blocked);\n\t\t\t\t\t\tconst result = await tool.execute(scriptedCall.args, {\n\t\t\t\t\t\t\ttoolCallId,\n\t\t\t\t\t\t\tsignal,\n\t\t\t\t\t\t\tsuspendPromptGuards: input.options?.suspendPromptGuards,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tsignal.throwIfAborted();\n\t\t\t\t\t\tif (!assistantContentFromScriptedMarkdown) {\n\t\t\t\t\t\t\tassistantContent = stringifyToolResult(result);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tawait recordToolResult(result, false);\n\t\t\t\t\t\tconst followUp =\n\t\t\t\t\t\t\tscriptedItem && \"calls\" in scriptedItem\n\t\t\t\t\t\t\t\t? scriptedItem.afterToolResult?.(scriptedCall, result)\n\t\t\t\t\t\t\t\t: undefined;\n\t\t\t\t\t\tif (followUp) scriptedCalls.push(followUp);\n\t\t\t\t\t\tthis.emitEvent({\n\t\t\t\t\t\t\ttype: \"tool.result\",\n\t\t\t\t\t\t\tturnId,\n\t\t\t\t\t\t\tdata: { toolCallId, name: scriptedCall.toolName, result },\n\t\t\t\t\t\t\ttimestamp,\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tawait recordToolResult(error instanceof Error ? error.message : String(error), true);\n\t\t\t\t\t\tthis.emitEvent({\n\t\t\t\t\t\t\ttype: \"error\",\n\t\t\t\t\t\t\tturnId,\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\tmessage: error instanceof Error ? error.message : String(error),\n\t\t\t\t\t\t\t\ttoolName: scriptedCall.toolName,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\ttimestamp,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tthrow error;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor (let i = 0; i < (scriptedCall.intermediateEntryCount ?? 0); i++) {\n\t\t\t\t\tconst intermediateEntryId =\n\t\t\t\t\t\tscriptedCalls.length === 1\n\t\t\t\t\t\t\t? `intermediate-${this.state.turnSeq}-${i + 1}`\n\t\t\t\t\t\t\t: `intermediate-${this.state.turnSeq}-${callIndex + 1}-${i + 1}`;\n\t\t\t\t\tthis.addEntry(\n\t\t\t\t\t\tthis.createMessageEntry(\n\t\t\t\t\t\t\tintermediateEntryId,\n\t\t\t\t\t\t\tthis.state.currentLeafId,\n\t\t\t\t\t\t\t\"assistant\",\n\t\t\t\t\t\t\t`Intermediate entry ${i + 1}`,\n\t\t\t\t\t\t\ttimestamp,\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t\tcreatedEntryIds.push(intermediateEntryId);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (tools.size > 0 && !hasScriptedChunks) {\n\t\t\tthrow new Error(\n\t\t\t\t`Stub Pi prompt requires a stub tool-call script when tools are provided (${[...tools.keys()].join(\", \")})`,\n\t\t\t);\n\t\t} else if (input.promptText !== undefined && !hasScriptedChunks) {\n\t\t\tthis.emitEvent({\n\t\t\t\ttype: \"stream.delta\",\n\t\t\t\tturnId,\n\t\t\t\tdata: { text: input.promptText },\n\t\t\t\ttimestamp,\n\t\t\t});\n\t\t}\n\n\t\tsignal.throwIfAborted();\n\t\t// Keep the result entry ID without repeating content already saved in the stream entry.\n\t\tthis.addEntry(\n\t\t\tthis.createMessageEntry(\n\t\t\t\tturnId,\n\t\t\t\tthis.state.currentLeafId,\n\t\t\t\t\"assistant\",\n\t\t\t\tthis.recordSessionTrace && hasScriptedChunks && scriptedCalls.length === 0\n\t\t\t\t\t? []\n\t\t\t\t\t: assistantContent,\n\t\t\t\ttimestamp,\n\t\t\t),\n\t\t);\n\t\tcreatedEntryIds.push(turnId);\n\t\tawait this.persistState?.();\n\t\tsignal.throwIfAborted();\n\t\tthis.emitEvent({ type: \"turn.end\", turnId, data: {}, timestamp });\n\t\tconst resultEntryId = this.state.currentLeafId;\n\t\tif (!resultEntryId) {\n\t\t\tthrow new Error(\n\t\t\t\tinput.appendPromptUserMessage\n\t\t\t\t\t? \"Stub Pi prompt completed without an active leaf\"\n\t\t\t\t\t: \"Stub Pi continuation completed without an active leaf\",\n\t\t\t);\n\t\t}\n\t\treturn {\n\t\t\tstartLeafId,\n\t\t\tendLeafId: resultEntryId,\n\t\t\tcreatedEntryIds,\n\t\t\tresultEntryId,\n\t\t\tassistantMarkdown: assistantContent,\n\t\t};\n\t}\n\n\t/** @internal */\n\tasync prompt(text: string, options: PiPromptOptions = {}): Promise<PiTurnExecutionResult> {\n\t\treturn await this.executeTurn({\n\t\t\tkind: \"prompt\",\n\t\t\tpromptText: text,\n\t\t\toptions,\n\t\t\tappendPromptUserMessage: true,\n\t\t});\n\t}\n\n\t/** @internal */\n\tasync promptLiteral(text: string, options: PiPromptOptions = {}): Promise<PiTurnExecutionResult> {\n\t\treturn await this.executeTurn({\n\t\t\tkind: \"literal\",\n\t\t\tpromptText: text,\n\t\t\toptions,\n\t\t\tappendPromptUserMessage: true,\n\t\t});\n\t}\n\n\t/** @internal */\n\tasync promptCustom(\n\t\tinput: PiCustomMessageInput,\n\t\toptions: PiPromptOptions = {},\n\t): Promise<PiTurnExecutionResult> {\n\t\tconst startLeafId = this.getLeafId();\n\t\tconst promptEntryId = await this.appendCustomMessage(input);\n\t\tconst result = await this.executeTurn({\n\t\t\tkind: \"custom\",\n\t\t\tscriptPromptText: input.content,\n\t\t\toptions,\n\t\t\tappendPromptUserMessage: false,\n\t\t});\n\t\treturn {\n\t\t\t...result,\n\t\t\tstartLeafId,\n\t\t\tcreatedEntryIds: [promptEntryId, ...result.createdEntryIds],\n\t\t};\n\t}\n\n\t/** @internal */\n\tasync continueTurn(options: PiPromptOptions = {}): Promise<PiTurnExecutionResult> {\n\t\treturn await this.executeTurn({\n\t\t\tkind: \"continue\",\n\t\t\toptions,\n\t\t\tappendPromptUserMessage: false,\n\t\t});\n\t}\n\n\t/** @internal */\n\tasync appendUserMessage(text: string): Promise<string> {\n\t\tthis.assertOpen();\n\t\tconst timestamp = new Date().toISOString();\n\t\tconst userEntryId = `user-${++this.state.turnSeq}`;\n\t\tthis.addEntry(\n\t\t\tthis.createMessageEntry(userEntryId, this.state.currentLeafId, \"user\", text, timestamp),\n\t\t);\n\t\tawait this.persistState?.();\n\t\treturn userEntryId;\n\t}\n\n\t/** @internal */\n\tasync appendCustomMessage(input: PiCustomMessageInput): Promise<string> {\n\t\tthis.assertOpen();\n\t\tconst timestamp = new Date().toISOString();\n\t\tconst entryId = `custom-${++this.state.turnSeq}`;\n\t\tthis.addEntry({\n\t\t\tid: entryId,\n\t\t\tparentId: this.state.currentLeafId,\n\t\t\ttype: \"custom_message\",\n\t\t\ttimestamp,\n\t\t\tcustomType: \"leitwerk\",\n\t\t\tcontent: input.content,\n\t\t\tdetails: input.details,\n\t\t});\n\t\tawait this.persistState?.();\n\t\treturn entryId;\n\t}\n\n\t/** @internal */\n\tasync steer(text: string): Promise<void> {\n\t\tthis.assertOpen();\n\t\tthis.steers.push(text);\n\t}\n\n\t/** @internal */\n\tasync abortTurn(): Promise<void> {\n\t\tthis.assertOpen();\n\t\tthis.turnAbort.abort(new Error(\"Scripted turn aborted\"));\n\t}\n\n\t/** @internal */\n\tsubscribe(handler: PiEventHandler): () => void {\n\t\tthis.handlers.add(handler);\n\t\treturn () => {\n\t\t\tthis.handlers.delete(handler);\n\t\t};\n\t}\n\n\t/** @internal */\n\tsubscribeDiagnostics(handler: PiSessionDiagnosticHandler): () => void {\n\t\tthis.diagnosticHandlers.add(handler);\n\t\treturn () => {\n\t\t\tthis.diagnosticHandlers.delete(handler);\n\t\t};\n\t}\n\n\t/** @internal */\n\temitDiagnostic(diagnostic: PiSessionDiagnostic): void {\n\t\tfor (const handler of this.diagnosticHandlers) handler(diagnostic);\n\t}\n\n\t/** @internal */\n\tasync close(): Promise<void> {\n\t\tthis.turnAbort.abort(new Error(\"Scripted session closed\"));\n\t\tawait this.persistState?.();\n\t\tthis._closed = true;\n\t\tthis.handlers.clear();\n\t\tthis.diagnosticHandlers.clear();\n\t}\n}\n\n/** @public */\nexport interface StubPiTreeHandleFactoryOptions {\n\t/** @public */\n\ttoolCallScriptResolver?: StubToolCallScriptResolver;\n\t/** Persist SDK-readable JSONL with reasoning and tool messages for history/detail tests. @public */\n\trecordSessionTrace?: boolean;\n}\n\n/** @public */\nexport class StubPiTreeHandleFactory implements PiTreeHandleFactory {\n\t/** @public */\n\treadonly sessions: StubPiTreeHandle[] = [];\n\t/** @internal */\n\ttoolCallScriptResolver?: StubToolCallScriptResolver;\n\n\tprivate seq = 0;\n\tprivate readonly treeStateByFile = new Map<string, StubPiTreeState>();\n\tprivate readonly recordSessionTrace: boolean;\n\n\t/** @public */\n\tconstructor(options: StubPiTreeHandleFactoryOptions = {}) {\n\t\tthis.toolCallScriptResolver = options.toolCallScriptResolver;\n\t\tthis.recordSessionTrace = options.recordSessionTrace ?? false;\n\t}\n\n\t/** @internal */\n\tasync prepareManagedBootstrap(\n\t\topts: PiManagedBootstrapOptions,\n\t): Promise<PiManagedBootstrapResult> {\n\t\treturn {\n\t\t\tloadedResourceIds: opts.manifest.provenance.map(\n\t\t\t\t(resource: { snapshotPath: string }) => resource.snapshotPath,\n\t\t\t),\n\t\t\tloadedAgentsFiles: [],\n\t\t\tloadedSkillFiles: [],\n\t\t\tresolvedModel: { ...opts.expectedModel },\n\t\t\tdiagnostics: [],\n\t\t};\n\t}\n\n\t/** @internal */\n\tasync inspectPrimaryTree(opts: PiTreePlanningOptions): Promise<PiTreePlanningSnapshot> {\n\t\tlet treeState = this.treeStateByFile.get(opts.treeFile);\n\t\tif (!treeState) {\n\t\t\ttry {\n\t\t\t\ttreeState = deserializeStubPiTreeState(readFileSync(opts.treeFile, \"utf8\"));\n\t\t\t} catch (error) {\n\t\t\t\tif (isEnoent(error)) {\n\t\t\t\t\treturn { currentLeafId: null, entries: [] };\n\t\t\t\t}\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t\treturn {\n\t\t\tcurrentLeafId: treeState.currentLeafId ?? deriveStubLeafIdFromEntries(treeState),\n\t\t\tentries: [...treeState.entries.values()].map((entry) => ({\n\t\t\t\tid: entry.id,\n\t\t\t\tparentId: entry.parentId,\n\t\t\t})),\n\t\t};\n\t}\n\n\t/** @public */\n\tasync createPrimaryTreeHandle(opts: PiTreeHandleOptions): Promise<PiTreeHandle> {\n\t\tconst persistState = async (state: StubPiTreeState): Promise<void> => {\n\t\t\tthis.treeStateByFile.set(opts.treeFile, state);\n\t\t\ttry {\n\t\t\t\tmkdirSync(path.dirname(opts.treeFile), { recursive: true });\n\t\t\t\twriteFileSync(\n\t\t\t\t\topts.treeFile,\n\t\t\t\t\tserializeStubPiTreeState(state, this.recordSessionTrace),\n\t\t\t\t\t\"utf8\",\n\t\t\t\t);\n\t\t\t} catch (error) {\n\t\t\t\tif (\n\t\t\t\t\ttypeof error !== \"object\" ||\n\t\t\t\t\terror === null ||\n\t\t\t\t\t!(\"code\" in error) ||\n\t\t\t\t\t![\"ENOENT\", \"EACCES\", \"EROFS\", \"EPERM\"].includes(\n\t\t\t\t\t\tString((error as { code?: unknown }).code),\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\tlet treeState = this.treeStateByFile.get(opts.treeFile);\n\t\tif (!treeState && opts.resume) {\n\t\t\ttry {\n\t\t\t\tconst persisted = readFileSync(opts.treeFile, \"utf8\");\n\t\t\t\ttreeState = deserializeStubPiTreeState(persisted);\n\t\t\t} catch (error) {\n\t\t\t\tif (\n\t\t\t\t\ttypeof error === \"object\" &&\n\t\t\t\t\terror !== null &&\n\t\t\t\t\t\"code\" in error &&\n\t\t\t\t\t(error as { code?: unknown }).code !== \"ENOENT\"\n\t\t\t\t) {\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\ttreeState ??= createEmptyStubPiTreeState();\n\t\ttreeState.header ??= {\n\t\t\ttype: \"session\",\n\t\t\tversion: CURRENT_SESSION_VERSION,\n\t\t\tid: randomUUID(),\n\t\t\ttimestamp: new Date().toISOString(),\n\t\t\tcwd: opts.sessionCwd ?? opts.workspaceRoot ?? path.dirname(opts.treeFile),\n\t\t};\n\t\tif (opts.resume) {\n\t\t\ttreeState.currentLeafId = deriveStubLeafIdFromEntries(treeState);\n\t\t}\n\t\tthis.treeStateByFile.set(opts.treeFile, treeState);\n\t\tconst piHandle = new StubPiTreeHandle({\n\t\t\tsessionId: `stub-${++this.seq}`,\n\t\t\ttreeFile: opts.treeFile,\n\t\t\tisResumed: opts.resume,\n\t\t\ttoolCallScriptResolver: this.toolCallScriptResolver\n\t\t\t\t? (context) =>\n\t\t\t\t\t\tthis.toolCallScriptResolver?.({\n\t\t\t\t\t\t\t...context,\n\t\t\t\t\t\t\tinstanceId: opts.instanceId,\n\t\t\t\t\t\t\t...(opts.iteration ? { iteration: opts.iteration } : {}),\n\t\t\t\t\t\t\tworkspaceRoot: opts.workspaceRoot,\n\t\t\t\t\t\t\tsessionCwd: opts.sessionCwd,\n\t\t\t\t\t\t})\n\t\t\t\t: undefined,\n\t\t\tstate: treeState,\n\t\t\tpersistState: () => persistState(treeState),\n\t\t\trecordSessionTrace: this.recordSessionTrace,\n\t\t\trunDetails: {\n\t\t\t\tavailableToolNames: opts.piConfig?.availableToolNames ?? [],\n\t\t\t},\n\t\t});\n\t\tthis.sessions.push(piHandle);\n\t\tif (!opts.resume) {\n\t\t\tawait persistState(treeState);\n\t\t}\n\t\treturn piHandle;\n\t}\n}\n","import {\n\tStubPiTreeHandleFactory,\n\ttype StubToolCallScriptResolver,\n\ttype StubToolCallScriptResolverContext,\n} from \"./stub-pi-tree-handle.js\";\n\nfunction isObjectLike(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null;\n}\n\n/** @internal */\nexport function synthesizeStubArgValue(key: string, spec: unknown): unknown {\n\tif (key === \"changedProjects\") {\n\t\treturn undefined;\n\t}\n\tconst type = isObjectLike(spec) && typeof spec.type === \"string\" ? spec.type : \"string\";\n\tswitch (type) {\n\t\tcase \"number\":\n\t\tcase \"integer\":\n\t\t\treturn 1;\n\t\tcase \"boolean\":\n\t\t\treturn true;\n\t\tcase \"array\": {\n\t\t\tconst itemSpec = isObjectLike(spec) ? spec.items : undefined;\n\t\t\treturn [synthesizeStubArgValue(`${key}_item`, itemSpec)];\n\t\t}\n\t\tcase \"object\":\n\t\t\treturn {};\n\t\tdefault:\n\t\t\treturn `${key} value`;\n\t}\n}\n\n/** @internal */\nexport function synthesizeStubToolArgs(\n\tparameters: Record<string, unknown>,\n): Record<string, unknown> {\n\tconst parameterEntries =\n\t\tisObjectLike(parameters) && parameters.type === \"object\" && isObjectLike(parameters.properties)\n\t\t\t? Object.entries(parameters.properties)\n\t\t\t: Object.entries(parameters);\n\treturn Object.fromEntries(\n\t\tparameterEntries.map(([key, spec]) => [key, synthesizeStubArgValue(key, spec)]),\n\t);\n}\n\n/** @internal */\nexport function createSchemaDrivenToolCallScriptResolver(): StubToolCallScriptResolver {\n\treturn ({ tools }: StubToolCallScriptResolverContext) => {\n\t\tconst markdownTool = tools.find((tool) => tool.name === \"markdown_result\");\n\t\tconst completionTool = tools.find(\n\t\t\t(tool) => tool.name !== \"markdown_result\" && tool.name !== \"upload_result_images\",\n\t\t);\n\t\tif (markdownTool && completionTool) {\n\t\t\treturn {\n\t\t\t\tcalls: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttoolName: markdownTool.name,\n\t\t\t\t\t\targs: synthesizeStubToolArgs(markdownTool.parameters),\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\ttoolName: completionTool.name,\n\t\t\t\t\t\targs: synthesizeStubToolArgs(completionTool.parameters),\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t}\n\t\tconst tool = markdownTool ?? completionTool ?? tools[0];\n\t\tif (!tool) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn {\n\t\t\ttoolName: tool.name,\n\t\t\targs: synthesizeStubToolArgs(tool.parameters),\n\t\t};\n\t};\n}\n\n/** @internal */\nexport function createSchemaDrivenStubPiFactory(\n\toptions: {\n\t\t/** @internal */\n\t\ttoolCallScriptResolver?: StubToolCallScriptResolver;\n\t} = {},\n): StubPiTreeHandleFactory {\n\treturn new StubPiTreeHandleFactory({\n\t\ttoolCallScriptResolver:\n\t\t\toptions.toolCallScriptResolver ?? createSchemaDrivenToolCallScriptResolver(),\n\t});\n}\n"],"mappings":";AAAA,SAAS,kBAAkB;AAC3B,SAAS,WAAW,cAAc,qBAAqB;AACvD,OAAO,UAAU;AACjB,SAAS,+BAAmD;AAe5D,SAAS,gBAAgB;AA6EzB,SAAS,oBAAoB,QAAyB;AACrD,MAAI,OAAO,WAAW,UAAU;AAC/B,WAAO;AAAA,EACR;AACA,MAAI,WAAW,QAAW;AACzB,WAAO;AAAA,EACR;AACA,MAAI;AACH,WAAO,KAAK,UAAU,QAAQ,MAAM,CAAC;AAAA,EACtC,QAAQ;AACP,WAAO,OAAO,MAAM;AAAA,EACrB;AACD;AAEA,SAAS,6BAA6B,MAAwD;AAC7F,MAAI,WAAW,MAAM;AACpB,WAAO,CAAC,GAAG,KAAK,KAAK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ources":["../src/extension-integration-harness.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAEpE,YAAY,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"extension-integration-harness.d.ts","sourceRoot":"","sources":["../src/extension-integration-harness.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAEpE,YAAY,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAIpE,OAAO,KAAK,EACX,KAAK,EACL,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAEN,KAAK,0BAA0B,EAC/B,KAAK,uBAAuB,EAC5B,MAAM,2BAA2B,CAAC;AAQnC,OAAO,EAAW,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAwB,KAAK,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACzF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAG/E,8DAA8D;AAC9D,MAAM,WAAW,4BAA4B;IAC5C,cAAc;IACd,MAAM,EAAE,MAAM,CAAC;IACf,wEAAwE;IACxE,GAAG,EAAE,MAAM,CAAC;IACZ,oFAAoF;IACpF,QAAQ,EAAE,MAAM,CAAC;IACjB,oDAAoD;IACpD,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc;IACd,KAAK,EAAE,SAAS;QACf,cAAc;QACd,IAAI,EAAE,MAAM,CAAC;QACb,cAAc;QACd,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACpC,EAAE,CAAC;CACJ;AAED,uDAAuD;AACvD,MAAM,WAAW,0BAA0B;IAC1C,cAAc;IACd,EAAE,EAAE,MAAM,CAAC;IACX,cAAc;IACd,UAAU,EAAE,MAAM,CAAC;IACnB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EAAkE;QAClE,YAAY,CAAC,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;KACtC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClB,cAAc;IACd,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB;AAED,sEAAsE;AACtE,wBAAsB,iCAAiC,CACtD,OAAO,EAAE,kCAAkC,GACzC,OAAO,CAAC,2BAA2B,CAAC,CA+hBtC"}
|
package/dist/fixtures.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/compact-process-detail-fixture.ts","../src/question-fixtures.ts","../src/supported-question-fixtures.ts"],"sourcesContent":["import type {\n\tProcessEvent,\n\tProcessInput,\n\tProcessInstance,\n\tProcessProject,\n\tProcessTurnAnnotation,\n\tProcessTurnRecord,\n\tWorkerLease,\n} from \"@leitwerk-dev/domain\";\nimport {\n\tcreateReadonlyEntryTree,\n\ttype PiSessionEntry,\n\ttype PrimaryPathSnapshot,\n\ttype ProcessDetailUiSnapshotResponseBody,\n\ttype TurnReasoningDetailResponseBody,\n\ttype TurnTraceSnapshot,\n} from \"@leitwerk-dev/protocol\";\nimport {\n\tbuildProcessUiSnapshotProjections,\n\tbuildTurnTraceIndexFromSession,\n\ttype ReadonlyPiSessionTree,\n} from \"@leitwerk-dev/server/testing\";\n\ntype LegacyProcessDetailFixture = Omit<ProcessDetailUiSnapshotResponseBody, \"primaryPath\"> & {\n\tprimaryPath: PrimaryPathSnapshot;\n\tprocess: ProcessInstance;\n\tprojects: ProcessProject[];\n\tinputs: ProcessInput[];\n\tevents: ProcessEvent[];\n\tturnRecords: ProcessTurnRecord[];\n\tturnAnnotations: ProcessTurnAnnotation[];\n\tworkerLease: WorkerLease | null;\n\tpiSessionEntries: PiSessionEntry[];\n};\n\nconst EMPTY_TRACE: TurnTraceSnapshot = {\n\tassistant: { text: \"\", thinking: \"\", lastUpdatedAt: null },\n\ttoolCalls: [],\n\ttraceItems: [],\n\tusage: null,\n\tpiInput: null,\n};\n\n/** @internal */\nexport function createCompactProcessDetailFixtureFactory() {\n\tconst reasoningSourceByInstanceId = new Map<\n\t\tstring,\n\t\t{\n\t\t\tsignature: string | null;\n\t\t\ttraceIndex: Record<string, TurnTraceSnapshot>;\n\t\t\tliveTurnRecordId: string | null;\n\t\t}\n\t>();\n\n\t/** @internal */\n\tfunction compact(input: unknown): ProcessDetailUiSnapshotResponseBody {\n\t\tconst legacy = input as LegacyProcessDetailFixture;\n\t\tif (!Array.isArray(legacy.turnRecords)) {\n\t\t\treturn input as ProcessDetailUiSnapshotResponseBody;\n\t\t}\n\t\tconst sessionEntries = legacy.piSessionEntries ?? [];\n\t\tconst entryTree = createReadonlyEntryTree(sessionEntries);\n\t\tconst sessionTree = {\n\t\t\t...entryTree,\n\t\t\ttreeFile: \"ui-compact-fixture\",\n\t\t\theader: null,\n\t\t\tgetTree: () => [],\n\t\t} as unknown as ReadonlyPiSessionTree;\n\t\tconst traceIndex = buildTurnTraceIndexFromSession({\n\t\t\ttree: sessionTree,\n\t\t\tturnRecords: legacy.turnRecords,\n\t\t\tevents: legacy.events,\n\t\t});\n\t\tconst active = legacy.primaryPath.turnState.activeTurn;\n\t\tif (active)\n\t\t\ttraceIndex[active.turnRecordId] = {\n\t\t\t\t...EMPTY_TRACE,\n\t\t\t\t...traceIndex[active.turnRecordId],\n\t\t\t\tassistant: active.assistant,\n\t\t\t\ttraceItems: active.traceItems,\n\t\t\t\tusage: active.usage,\n\t\t\t\ttoolCalls: active.toolCalls.map(({ result, ...tool }) => ({\n\t\t\t\t\t...tool,\n\t\t\t\t\tresultText:\n\t\t\t\t\t\ttypeof result === \"string\" ? result : result == null ? null : JSON.stringify(result),\n\t\t\t\t\ttruncated: false,\n\t\t\t\t})),\n\t\t\t};\n\t\tconst signature =\n\t\t\tsessionEntries.length > 0 ? `test-session:${JSON.stringify(sessionEntries).length}` : null;\n\t\tconst projections = buildProcessUiSnapshotProjections({\n\t\t\tprocess: legacy.process,\n\t\t\tturnRecords: legacy.turnRecords,\n\t\t\tturnAnnotations: legacy.turnAnnotations,\n\t\t\tevents: legacy.events,\n\t\t\tinputs: legacy.inputs,\n\t\t\tselectedTurn: legacy.selectedTurn ?? null,\n\t\t\tprimaryPathSnapshot: legacy.primaryPath,\n\t\t\tsessionTree,\n\t\t});\n\t\tconst compactDetail: ProcessDetailUiSnapshotResponseBody = {\n\t\t\t...projections,\n\t\t\tinstanceTree: legacy.instanceTree ?? { currentLeafId: null, nodes: [], edges: [] },\n\t\t\tleafOutcomeSnapshots: legacy.leafOutcomeSnapshots,\n\t\t\tquestionRequests: [],\n\t\t\ttoolApprovalRequests: [],\n\t\t\tprocessDisplayName: legacy.processDisplayName,\n\t\t\tprocessFlow: legacy.processFlow,\n\t\t\tdefinesLeafOutcome: legacy.definesLeafOutcome,\n\t\t\tselectedTurn: legacy.selectedTurn ?? null,\n\t\t\tscheduledAction: legacy.scheduledAction ?? null,\n\t\t\tmodelConfiguration: legacy.modelConfiguration,\n\t\t\trunDetails: legacy.runDetails,\n\t\t\tlaunchConfiguration: legacy.launchConfiguration,\n\t\t\tactions: legacy.actions,\n\t\t\ttoolRenderers: legacy.toolRenderers,\n\t\t\tpersistedModelSelectionWarning: null,\n\t\t\tsession: { signature },\n\t\t\tsessionTransfer: null,\n\t\t};\n\t\treasoningSourceByInstanceId.set(projections.process.id, {\n\t\t\tsignature,\n\t\t\ttraceIndex,\n\t\t\tliveTurnRecordId: active?.turnRecordId ?? null,\n\t\t});\n\t\treturn compactDetail;\n\t}\n\n\t/** @internal */\n\tfunction reasoningResponse(\n\t\tinstanceId: string,\n\t\tturnRecordId: string,\n\t): TurnReasoningDetailResponseBody {\n\t\tconst source = reasoningSourceByInstanceId.get(instanceId);\n\t\treturn {\n\t\t\tinstanceId,\n\t\t\tturnRecordId,\n\t\t\tstate: source?.liveTurnRecordId === turnRecordId ? \"live\" : \"committed\",\n\t\t\tthroughEventSequence: 0,\n\t\t\tsessionSignature: source?.signature ?? null,\n\t\t\treasoning: source?.traceIndex[turnRecordId] ?? EMPTY_TRACE,\n\t\t};\n\t}\n\n\treturn {\n\t\t/** @internal */\n\t\tcompact,\n\t\t/** @internal */\n\t\treasoningResponse,\n\t};\n}\n","import type { NormalizedQuestion, ProcessQuestionRequest } from \"@leitwerk-dev/domain\";\n\n/** @internal */\nexport function createTestQuestion(\n\toverrides: Partial<NormalizedQuestion> = {},\n): NormalizedQuestion {\n\treturn {\n\t\tid: \"question_1\",\n\t\tquestion: \"Choose a strategy\",\n\t\tselection: \"single\",\n\t\toptions: [{ id: \"question_1_option_1\", label: \"Safe\", details: \"Small change\" }],\n\t\t...overrides,\n\t};\n}\n\n/** @internal */\nexport function createTestQuestionRequest(\n\toverrides: Partial<ProcessQuestionRequest> = {},\n): ProcessQuestionRequest {\n\treturn {\n\t\tid: \"qst_1\",\n\t\tinstanceId: \"agt_1\",\n\t\tturnRecordId: \"trn_1\",\n\t\ttoolCallId: \"tool_1\",\n\t\tquestions: [createTestQuestion()],\n\t\tstatus: \"open\",\n\t\tanswers: null,\n\t\taskedAt: \"2026-01-01T00:00:00.000Z\",\n\t\tansweredAt: null,\n\t\tansweredBy: null,\n\t\tcancelledAt: null,\n\t\t...overrides,\n\t};\n}\n","import { type Actor, normalizeAskQuestionsInput } from \"@leitwerk-dev/domain\";\n\n/** A normalized question with stable option identities. @public */\nexport interface QuestionFixture {\n\t/** @public */\n\tid: string;\n\t/** @public */\n\tquestion: string;\n\t/** @public */\n\tselection: \"single\" | \"multiple\";\n\t/** @public */\n\toptions: readonly {\n\t\t/** @public */\n\t\tid: string;\n\t\t/** @public */\n\t\tlabel: string;\n\t\t/** @public */\n\t\tdetails: string | null;\n\t}[];\n}\n\n/** Correlated question request data without persistence access. @public */\nexport interface QuestionRequestFixture {\n\t/** @public */\n\tid: string;\n\t/** @public */\n\tinstanceId: string;\n\t/** @public */\n\tturnRecordId: string;\n\t/** @public */\n\ttoolCallId: string;\n\t/** @public */\n\tquestions: readonly QuestionFixture[];\n\t/** @public */\n\tstatus: \"open\" | \"answered\" | \"cancelled\";\n\t/** @public */\n\tanswers: readonly string[] | null;\n\t/** @public */\n\taskedAt: string;\n\t/** @public */\n\tansweredAt: string | null;\n\t/** @public */\n\tansweredBy: Actor | null;\n\t/** @public */\n\tcancelledAt: string | null;\n}\n\n/** Question content with generated stable option identities. @public */\nexport interface QuestionFixtureOptions {\n\t/** @public */\n\n\tquestion?: string;\n\n\t/** @public */\n\n\tselection?: \"single\" | \"multiple\";\n\n\t/** @public */\n\n\toptions?: readonly {\n\t\t/** @public */\n\t\tlabel: string;\n\n\t\t/** @public */\n\t\tdetails?: string | null;\n\t}[];\n}\n\n/** Normalize content using the application's question contract. @public */\nexport function createQuestionFixture(options: QuestionFixtureOptions = {}): QuestionFixture {\n\tconst [question] = normalizeAskQuestionsInput({\n\t\tquestions: [\n\t\t\t{\n\t\t\t\tquestion: options.question ?? \"Choose a strategy\",\n\t\t\t\tselection: options.selection ?? \"single\",\n\t\t\t\toptions: options.options ?? [{ label: \"Safe\", details: \"Small change\" }],\n\t\t\t},\n\t\t],\n\t});\n\tif (!question) throw new Error(\"Question normalization returned no question\");\n\treturn question;\n}\n\n/** Resolution determines status and all resolution timestamps. @public */\nexport type QuestionFixtureResolution =\n\t| {\n\t\t\t/** @public */\n\t\t\tstatus: \"answered\";\n\n\t\t\t/** @public */\n\n\t\t\tanswers: readonly string[];\n\n\t\t\t/** @public */\n\n\t\t\tactor?: Actor;\n\t }\n\t| {\n\t\t\t/** @public */\n\t\t\tstatus: \"cancelled\";\n\t };\n\n/** Reference inputs and question content, without durable status overrides. @public */\nexport interface QuestionRequestFixtureOptions {\n\t/** @public */\n\n\tid?: string;\n\n\t/** @public */\n\n\tprocess?: {\n\t\t/** @public */\n\t\tid: string;\n\t};\n\n\t/** @public */\n\n\tturn?: {\n\t\t/** @public */\n\t\tid: string;\n\n\t\t/** @public */\n\t\tinstanceId: string;\n\t};\n\n\t/** @public */\n\n\tquestions?: readonly QuestionFixtureOptions[];\n\n\t/** @public */\n\n\tresolution?: QuestionFixtureResolution;\n}\n\n/** Create a consistent request; reject conflicting process and turn references. @public */\nexport function createQuestionRequestFixture(\n\toptions: QuestionRequestFixtureOptions = {},\n): QuestionRequestFixture {\n\tconst instanceId = options.process?.id ?? options.turn?.instanceId ?? \"agt_test\";\n\tif (options.turn && options.turn.instanceId !== instanceId)\n\t\tthrow new Error(\"Question turn belongs to another process\");\n\tconst questions = normalizeAskQuestionsInput({\n\t\tquestions: (options.questions ?? [{}]).map((q) => ({\n\t\t\tquestion: q.question ?? \"Choose a strategy\",\n\t\t\tselection: q.selection ?? \"single\",\n\t\t\toptions: q.options ?? [{ label: \"Safe\" }],\n\t\t})),\n\t});\n\tconst resolution = options.resolution;\n\tif (resolution?.status === \"answered\" && resolution.answers.length !== questions.length)\n\t\tthrow new Error(\"Supply one answer per question\");\n\treturn {\n\t\tid: options.id ?? \"qst_test\",\n\t\tinstanceId,\n\t\tturnRecordId: options.turn?.id ?? \"trn_test\",\n\t\ttoolCallId: \"tool_test\",\n\t\tquestions,\n\t\tstatus: resolution?.status ?? \"open\",\n\t\taskedAt: \"2026-01-01T00:00:00.000Z\",\n\t\tanswers: resolution?.status === \"answered\" ? [...resolution.answers] : null,\n\t\tansweredAt: resolution?.status === \"answered\" ? \"2026-01-01T00:00:01.000Z\" : null,\n\t\tansweredBy:\n\t\t\tresolution?.status === \"answered\"\n\t\t\t\t? structuredClone(resolution.actor ?? { id: \"test-user\", kind: \"user\", provider: null })\n\t\t\t\t: null,\n\t\tcancelledAt: resolution?.status === \"cancelled\" ? \"2026-01-01T00:00:01.000Z\" : null,\n\t};\n}\n"],"mappings":";;;;;;AASA;AAAA,EACC;AAAA,OAMM;AACP;AAAA,EACC;AAAA,EACA;AAAA,OAEM;AAcP,IAAM,cAAiC;AAAA,EACtC,WAAW,EAAE,MAAM,IAAI,UAAU,IAAI,eAAe,KAAK;AAAA,EACzD,WAAW,CAAC;AAAA,EACZ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,UAAM,IAAI,MAAM,gCAAgC;AACjD,SAAO;AAAA,IACN,IAAI,QAAQ,MAAM;AAAA,IAClB;AAAA,IACA,cAAc,QAAQ,MAAM,MAAM;AAAA,IAClC,YAAY;AAAA,IACZ;AAAA,IACA,QAAQ,YAAY,UAAU;AAAA,IAC9B,SAAS;AAAA,IACT,SAAS,YAAY,WAAW,aAAa,CAAC,GAAG,WAAW,OAAO,IAAI;AAAA,IACvE,YAAY,YAAY,WAAW,aAAa,6BAA6B;AAAA,IAC7E,YACC,YAAY,WAAW,aACpB,gBAAgB,WAAW,SAAS,EAAE,IAAI,aAAa,MAAM,QAAQ,UAAU,KAAK,CAAC,IACrF;AAAA,IACJ,aAAa,YAAY,WAAW,cAAc,6BAA6B;AAAA,EAChF;AACD;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/compact-process-detail-fixture.ts","../src/question-fixtures.ts","../src/supported-question-fixtures.ts"],"sourcesContent":["import type {\n\tProcessEvent,\n\tProcessInput,\n\tProcessInstance,\n\tProcessProject,\n\tProcessTurnAnnotation,\n\tProcessTurnRecord,\n\tWorkerLease,\n} from \"@leitwerk-dev/domain\";\nimport {\n\tcreateReadonlyEntryTree,\n\ttype PiSessionEntry,\n\ttype PrimaryPathSnapshot,\n\ttype ProcessDetailUiSnapshotResponseBody,\n\ttype TurnReasoningDetailResponseBody,\n\ttype TurnTraceSnapshot,\n} from \"@leitwerk-dev/protocol\";\nimport {\n\tbuildProcessUiSnapshotProjections,\n\tbuildTurnTraceIndexFromSession,\n\ttype ReadonlyPiSessionTree,\n} from \"@leitwerk-dev/server/testing\";\n\ntype LegacyProcessDetailFixture = Omit<ProcessDetailUiSnapshotResponseBody, \"primaryPath\"> & {\n\tprimaryPath: PrimaryPathSnapshot;\n\tprocess: ProcessInstance;\n\tprojects: ProcessProject[];\n\tinputs: ProcessInput[];\n\tevents: ProcessEvent[];\n\tturnRecords: ProcessTurnRecord[];\n\tturnAnnotations: ProcessTurnAnnotation[];\n\tworkerLease: WorkerLease | null;\n\tpiSessionEntries: PiSessionEntry[];\n};\n\nconst EMPTY_TRACE: TurnTraceSnapshot = {\n\tassistant: { text: \"\", thinking: \"\", lastUpdatedAt: null },\n\ttoolCalls: [],\n\ttraceItems: [],\n\tusage: null,\n\tpiInput: null,\n};\n\n/** @internal */\nexport function createCompactProcessDetailFixtureFactory() {\n\tconst reasoningSourceByInstanceId = new Map<\n\t\tstring,\n\t\t{\n\t\t\tsignature: string | null;\n\t\t\ttraceIndex: Record<string, TurnTraceSnapshot>;\n\t\t\tliveTurnRecordId: string | null;\n\t\t}\n\t>();\n\n\t/** @internal */\n\tfunction compact(input: unknown): ProcessDetailUiSnapshotResponseBody {\n\t\tconst legacy = input as LegacyProcessDetailFixture;\n\t\tif (!Array.isArray(legacy.turnRecords)) {\n\t\t\treturn input as ProcessDetailUiSnapshotResponseBody;\n\t\t}\n\t\tconst sessionEntries = legacy.piSessionEntries ?? [];\n\t\tconst entryTree = createReadonlyEntryTree(sessionEntries);\n\t\tconst sessionTree = {\n\t\t\t...entryTree,\n\t\t\ttreeFile: \"ui-compact-fixture\",\n\t\t\theader: null,\n\t\t\tgetTree: () => [],\n\t\t} as unknown as ReadonlyPiSessionTree;\n\t\tconst traceIndex = buildTurnTraceIndexFromSession({\n\t\t\ttree: sessionTree,\n\t\t\tturnRecords: legacy.turnRecords,\n\t\t\tevents: legacy.events,\n\t\t});\n\t\tconst active = legacy.primaryPath.turnState.activeTurn;\n\t\tif (active)\n\t\t\ttraceIndex[active.turnRecordId] = {\n\t\t\t\t...EMPTY_TRACE,\n\t\t\t\t...traceIndex[active.turnRecordId],\n\t\t\t\tassistant: active.assistant,\n\t\t\t\ttraceItems: active.traceItems,\n\t\t\t\tusage: active.usage,\n\t\t\t\ttoolCalls: active.toolCalls.map(({ result, ...tool }) => ({\n\t\t\t\t\t...tool,\n\t\t\t\t\tresultText:\n\t\t\t\t\t\ttypeof result === \"string\" ? result : result == null ? null : JSON.stringify(result),\n\t\t\t\t\ttruncated: false,\n\t\t\t\t})),\n\t\t\t};\n\t\tconst signature =\n\t\t\tsessionEntries.length > 0 ? `test-session:${JSON.stringify(sessionEntries).length}` : null;\n\t\tconst projections = buildProcessUiSnapshotProjections({\n\t\t\tprocess: legacy.process,\n\t\t\tturnRecords: legacy.turnRecords,\n\t\t\tturnAnnotations: legacy.turnAnnotations,\n\t\t\tevents: legacy.events,\n\t\t\tinputs: legacy.inputs,\n\t\t\tselectedTurn: legacy.selectedTurn ?? null,\n\t\t\tprimaryPathSnapshot: legacy.primaryPath,\n\t\t\tsessionTree,\n\t\t});\n\t\tconst compactDetail: ProcessDetailUiSnapshotResponseBody = {\n\t\t\t...projections,\n\t\t\tinstanceTree: legacy.instanceTree ?? { currentLeafId: null, nodes: [], edges: [] },\n\t\t\tleafOutcomeSnapshots: legacy.leafOutcomeSnapshots,\n\t\t\tquestionRequests: [],\n\t\t\ttoolApprovalRequests: [],\n\t\t\tprocessDisplayName: legacy.processDisplayName,\n\t\t\tprocessFlow: legacy.processFlow,\n\t\t\tdefinesLeafOutcome: legacy.definesLeafOutcome,\n\t\t\tselectedTurn: legacy.selectedTurn ?? null,\n\t\t\tscheduledAction: legacy.scheduledAction ?? null,\n\t\t\tmodelConfiguration: legacy.modelConfiguration,\n\t\t\trunDetails: legacy.runDetails,\n\t\t\tlaunchConfiguration: legacy.launchConfiguration,\n\t\t\tactions: legacy.actions,\n\t\t\ttoolRenderers: legacy.toolRenderers,\n\t\t\tpersistedModelSelectionWarning: null,\n\t\t\tsession: { signature },\n\t\t\tsessionTransfer: null,\n\t\t};\n\t\treasoningSourceByInstanceId.set(projections.process.id, {\n\t\t\tsignature,\n\t\t\ttraceIndex,\n\t\t\tliveTurnRecordId: active?.turnRecordId ?? null,\n\t\t});\n\t\treturn compactDetail;\n\t}\n\n\t/** @internal */\n\tfunction reasoningResponse(\n\t\tinstanceId: string,\n\t\tturnRecordId: string,\n\t): TurnReasoningDetailResponseBody {\n\t\tconst source = reasoningSourceByInstanceId.get(instanceId);\n\t\treturn {\n\t\t\tinstanceId,\n\t\t\tturnRecordId,\n\t\t\tstate: source?.liveTurnRecordId === turnRecordId ? \"live\" : \"committed\",\n\t\t\tthroughEventSequence: 0,\n\t\t\tsessionSignature: source?.signature ?? null,\n\t\t\treasoning: source?.traceIndex[turnRecordId] ?? EMPTY_TRACE,\n\t\t};\n\t}\n\n\treturn {\n\t\t/** @internal */\n\t\tcompact,\n\t\t/** @internal */\n\t\treasoningResponse,\n\t};\n}\n","import type { NormalizedQuestion, ProcessQuestionRequest } from \"@leitwerk-dev/domain\";\n\n/** @internal */\nexport function createTestQuestion(\n\toverrides: Partial<NormalizedQuestion> = {},\n): NormalizedQuestion {\n\treturn {\n\t\tid: \"question_1\",\n\t\tquestion: \"Choose a strategy\",\n\t\tselection: \"single\",\n\t\toptions: [{ id: \"question_1_option_1\", label: \"Safe\", details: \"Small change\" }],\n\t\t...overrides,\n\t};\n}\n\n/** @internal */\nexport function createTestQuestionRequest(\n\toverrides: Partial<ProcessQuestionRequest> = {},\n): ProcessQuestionRequest {\n\treturn {\n\t\tid: \"qst_1\",\n\t\tinstanceId: \"agt_1\",\n\t\tturnRecordId: \"trn_1\",\n\t\ttoolCallId: \"tool_1\",\n\t\tquestions: [createTestQuestion()],\n\t\tstatus: \"open\",\n\t\tanswers: null,\n\t\taskedAt: \"2026-01-01T00:00:00.000Z\",\n\t\tansweredAt: null,\n\t\tansweredBy: null,\n\t\tcancelledAt: null,\n\t\t...overrides,\n\t};\n}\n","import { type Actor, normalizeAskQuestionsInput } from \"@leitwerk-dev/domain\";\n\n/** A normalized question with stable option identities. @public */\nexport interface QuestionFixture {\n\t/** @public */\n\tid: string;\n\t/** @public */\n\tquestion: string;\n\t/** @public */\n\tselection: \"single\" | \"multiple\";\n\t/** @public */\n\toptions: readonly {\n\t\t/** @public */\n\t\tid: string;\n\t\t/** @public */\n\t\tlabel: string;\n\t\t/** @public */\n\t\tdetails: string | null;\n\t}[];\n}\n\n/** Correlated question request data without persistence access. @public */\nexport interface QuestionRequestFixture {\n\t/** @public */\n\tid: string;\n\t/** @public */\n\tinstanceId: string;\n\t/** @public */\n\tturnRecordId: string;\n\t/** @public */\n\ttoolCallId: string;\n\t/** @public */\n\tquestions: readonly QuestionFixture[];\n\t/** @public */\n\tstatus: \"open\" | \"answered\" | \"cancelled\";\n\t/** @public */\n\tanswers: readonly string[] | null;\n\t/** @public */\n\taskedAt: string;\n\t/** @public */\n\tansweredAt: string | null;\n\t/** @public */\n\tansweredBy: Actor | null;\n\t/** @public */\n\tcancelledAt: string | null;\n}\n\n/** Question content with generated stable option identities. @public */\nexport interface QuestionFixtureOptions {\n\t/** @public */\n\tquestion?: string;\n\t/** @public */\n\tselection?: \"single\" | \"multiple\";\n\t/** @public */\n\toptions?: readonly {\n\t\t/** @public */\n\t\tlabel: string;\n\t\t/** @public */\n\t\tdetails?: string | null;\n\t}[];\n}\n\n/** Normalize content using the application's question contract. @public */\nexport function createQuestionFixture(options: QuestionFixtureOptions = {}): QuestionFixture {\n\tconst [question] = normalizeAskQuestionsInput({\n\t\tquestions: [\n\t\t\t{\n\t\t\t\tquestion: options.question ?? \"Choose a strategy\",\n\t\t\t\tselection: options.selection ?? \"single\",\n\t\t\t\toptions: options.options ?? [{ label: \"Safe\", details: \"Small change\" }],\n\t\t\t},\n\t\t],\n\t});\n\tif (!question) throw new Error(\"Question normalization returned no question\");\n\treturn question;\n}\n\n/** Resolution determines status and all resolution timestamps. @public */\nexport type QuestionFixtureResolution =\n\t| {\n\t\t\t/** @public */\n\t\t\tstatus: \"answered\";\n\t\t\t/** @public */\n\t\t\tanswers: readonly string[];\n\t\t\t/** @public */\n\t\t\tactor?: Actor;\n\t }\n\t| {\n\t\t\t/** @public */\n\t\t\tstatus: \"cancelled\";\n\t };\n\n/** Reference inputs and question content, without durable status overrides. @public */\nexport interface QuestionRequestFixtureOptions {\n\t/** @public */\n\tid?: string;\n\t/** @public */\n\tprocess?: {\n\t\t/** @public */\n\t\tid: string;\n\t};\n\t/** @public */\n\tturn?: {\n\t\t/** @public */\n\t\tid: string;\n\t\t/** @public */\n\t\tinstanceId: string;\n\t};\n\t/** @public */\n\tquestions?: readonly QuestionFixtureOptions[];\n\t/** @public */\n\tresolution?: QuestionFixtureResolution;\n}\n\n/** Create a consistent request; reject conflicting process and turn references. @public */\nexport function createQuestionRequestFixture(\n\toptions: QuestionRequestFixtureOptions = {},\n): QuestionRequestFixture {\n\tconst instanceId = options.process?.id ?? options.turn?.instanceId ?? \"agt_test\";\n\tif (options.turn && options.turn.instanceId !== instanceId)\n\t\tthrow new Error(\"Question turn belongs to another process\");\n\tconst questions = normalizeAskQuestionsInput({\n\t\tquestions: (options.questions ?? [{}]).map((q) => ({\n\t\t\tquestion: q.question ?? \"Choose a strategy\",\n\t\t\tselection: q.selection ?? \"single\",\n\t\t\toptions: q.options ?? [{ label: \"Safe\" }],\n\t\t})),\n\t});\n\tconst resolution = options.resolution;\n\tif (resolution?.status === \"answered\" && resolution.answers.length !== questions.length)\n\t\tthrow new Error(\"Supply one answer per question\");\n\treturn {\n\t\tid: options.id ?? \"qst_test\",\n\t\tinstanceId,\n\t\tturnRecordId: options.turn?.id ?? \"trn_test\",\n\t\ttoolCallId: \"tool_test\",\n\t\tquestions,\n\t\tstatus: resolution?.status ?? \"open\",\n\t\taskedAt: \"2026-01-01T00:00:00.000Z\",\n\t\tanswers: resolution?.status === \"answered\" ? [...resolution.answers] : null,\n\t\tansweredAt: resolution?.status === \"answered\" ? \"2026-01-01T00:00:01.000Z\" : null,\n\t\tansweredBy:\n\t\t\tresolution?.status === \"answered\"\n\t\t\t\t? structuredClone(resolution.actor ?? { id: \"test-user\", kind: \"user\", provider: null })\n\t\t\t\t: null,\n\t\tcancelledAt: resolution?.status === \"cancelled\" ? \"2026-01-01T00:00:01.000Z\" : null,\n\t};\n}\n"],"mappings":";;;;;;AASA;AAAA,EACC;AAAA,OAMM;AACP;AAAA,EACC;AAAA,EACA;AAAA,OAEM;AAcP,I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AAE;AAAA,EACH,CAAC;AACD,QAAM,aAAa,QAAQ;AAC3B,MAAI,YAAY,WAAW,cAAc,WAAW,QAAQ,WAAW,UAAU;AAChF,UAAM,IAAI,MAAM,gCAAgC;AACjD,SAAO;AAAA,IACN,IAAI,QAAQ,MAAM;AAAA,IAClB;AAAA,IACA,cAAc,QAAQ,MAAM,MAAM;AAAA,IAClC,YAAY;AAAA,IACZ;AAAA,IACA,QAAQ,YAAY,UAAU;AAAA,IAC9B,SAAS;AAAA,IACT,SAAS,YAAY,WAAW,aAAa,CAAC,GAAG,WAAW,OAAO,IAAI;AAAA,IACvE,YAAY,YAAY,WAAW,aAAa,6BAA6B;AAAA,IAC7E,YACC,YAAY,WAAW,aACpB,gBAAgB,WAAW,SAAS,EAAE,IAAI,aAAa,MAAM,QAAQ,UAAU,KAAK,CAAC,IACrF;AAAA,IACJ,aAAa,YAAY,WAAW,cAAc,6BAA6B;AAAA,EAChF;AACD;","names":[]}
|
package/dist/integration.js
CHANGED
|
@@ -12,20 +12,23 @@ import {
|
|
|
12
12
|
} from "./chunk-5BZSJ4OO.js";
|
|
13
13
|
import {
|
|
14
14
|
createInProcessWorkerSpawn
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-JGXSXRIJ.js";
|
|
16
16
|
import {
|
|
17
17
|
StubPiTreeHandleFactory
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-WT7V7REB.js";
|
|
19
19
|
|
|
20
20
|
// src/extension-integration-harness.ts
|
|
21
21
|
import { randomUUID } from "crypto";
|
|
22
|
-
import { mkdirSync, writeFileSync } from "fs";
|
|
23
22
|
import path2 from "path";
|
|
24
23
|
import { buildExtensionCatalogFromModules } from "@leitwerk-dev/extension-runtime/testing";
|
|
25
24
|
import {
|
|
26
25
|
coreHostCapabilities
|
|
27
26
|
} from "@leitwerk-dev/process-sdk";
|
|
28
|
-
import {
|
|
27
|
+
import {
|
|
28
|
+
createAcceptedWorkerTurn,
|
|
29
|
+
prepareAcceptedFixtureStart
|
|
30
|
+
} from "@leitwerk-dev/server/testing";
|
|
31
|
+
import { persistPiResourceBundleForStart } from "@leitwerk-dev/worker";
|
|
29
32
|
|
|
30
33
|
// src/integration-harness.ts
|
|
31
34
|
import { mkdtempSync, rmSync } from "fs";
|
|
@@ -266,8 +269,7 @@ async function createExtensionIntegrationHarness(options) {
|
|
|
266
269
|
signal.removeEventListener("abort", abort);
|
|
267
270
|
pending.delete(id);
|
|
268
271
|
resolve();
|
|
269
|
-
}
|
|
270
|
-
reject
|
|
272
|
+
}
|
|
271
273
|
});
|
|
272
274
|
}) : void 0
|
|
273
275
|
}
|
|
@@ -383,8 +385,20 @@ async function createExtensionIntegrationHarness(options) {
|
|
|
383
385
|
fixture.turnId,
|
|
384
386
|
catalog.piContributions
|
|
385
387
|
) : null;
|
|
388
|
+
const turnId = `trn_${randomUUID()}`;
|
|
389
|
+
if (prepared)
|
|
390
|
+
await persistPiResourceBundleForStart({
|
|
391
|
+
bundlesDir: path2.join(
|
|
392
|
+
ctx.config.storage.process_workspaces_dir,
|
|
393
|
+
id,
|
|
394
|
+
".leitwerk",
|
|
395
|
+
"pi-resource-bundles"
|
|
396
|
+
),
|
|
397
|
+
startRecordId: `tsr_${turnId}`,
|
|
398
|
+
digest: prepared.bundle.digest,
|
|
399
|
+
deliveredBundle: prepared.bundle.bytes
|
|
400
|
+
});
|
|
386
401
|
return ctx.deps.transaction((repos) => {
|
|
387
|
-
const turnId = `trn_${randomUUID()}`;
|
|
388
402
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
389
403
|
const input = {
|
|
390
404
|
id: turnId,
|
|
@@ -399,76 +413,11 @@ async function createExtensionIntegrationHarness(options) {
|
|
|
399
413
|
endedAt: running ? null : timestamp,
|
|
400
414
|
turnResultMarkdown: fixture.execution.status === "succeeded" ? fixture.execution.markdown : null
|
|
401
415
|
};
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
".leitwerk",
|
|
408
|
-
"pi-resource-bundles"
|
|
409
|
-
);
|
|
410
|
-
mkdirSync(path2.join(bundleDir, "starts"), { recursive: true, mode: 448 });
|
|
411
|
-
writeFileSync(
|
|
412
|
-
path2.join(bundleDir, `${prepared.bundle.digest}.tar`),
|
|
413
|
-
prepared.bundle.bytes,
|
|
414
|
-
{ mode: 384 }
|
|
415
|
-
);
|
|
416
|
-
writeFileSync(
|
|
417
|
-
path2.join(bundleDir, "starts", `tsr_${turnId}.json`),
|
|
418
|
-
JSON.stringify({
|
|
419
|
-
startRecordId: `tsr_${turnId}`,
|
|
420
|
-
digest: prepared.bundle.digest,
|
|
421
|
-
persistedAt: timestamp
|
|
422
|
-
}),
|
|
423
|
-
{ mode: 384 }
|
|
424
|
-
);
|
|
425
|
-
createAcceptedLlmTurn(
|
|
426
|
-
{
|
|
427
|
-
...ctx,
|
|
428
|
-
deps: {
|
|
429
|
-
...ctx.deps,
|
|
430
|
-
processes: repos.processes,
|
|
431
|
-
turnRecords: repos.turnRecords,
|
|
432
|
-
turnStarts: repos.turnStarts,
|
|
433
|
-
leases: repos.leases
|
|
434
|
-
}
|
|
435
|
-
},
|
|
436
|
-
{ ...input, turnType: "llm", modelProfileId: prepared.start.model.profileId },
|
|
437
|
-
{ current: running, preparedStart: prepared?.start }
|
|
438
|
-
);
|
|
439
|
-
} else {
|
|
440
|
-
const lease = repos.leases.create({
|
|
441
|
-
instanceId: id,
|
|
442
|
-
workerId: `wkr_${randomUUID()}`,
|
|
443
|
-
state: running ? "busy" : "exited"
|
|
444
|
-
});
|
|
445
|
-
const start = repos.turnStarts.create({
|
|
446
|
-
instanceId: id,
|
|
447
|
-
turnId: fixture.turnId,
|
|
448
|
-
turnType: "automatic",
|
|
449
|
-
proposedTurnRecordId: turnId,
|
|
450
|
-
startKind: "selected_turn",
|
|
451
|
-
recoveryTurnRecordId: null,
|
|
452
|
-
continuation: null,
|
|
453
|
-
state: {
|
|
454
|
-
kind: "accepted",
|
|
455
|
-
start: { kind: "automatic" },
|
|
456
|
-
turnRecordId: turnId,
|
|
457
|
-
acceptedWorkerLeaseId: lease.id
|
|
458
|
-
}
|
|
459
|
-
});
|
|
460
|
-
repos.turnRecords.create({
|
|
461
|
-
...input,
|
|
462
|
-
turnType: "automatic",
|
|
463
|
-
turnStartRecordId: start.id,
|
|
464
|
-
acceptedWorkerLeaseId: lease.id
|
|
465
|
-
});
|
|
466
|
-
if (running)
|
|
467
|
-
repos.processes.update(id, {
|
|
468
|
-
currentExecution: { kind: "worker_start", id: start.id }
|
|
469
|
-
});
|
|
470
|
-
else repos.leases.update(lease.id, { exitedAt: timestamp });
|
|
471
|
-
}
|
|
416
|
+
createAcceptedWorkerTurn(
|
|
417
|
+
{ deps: repos },
|
|
418
|
+
{ ...input, turnType: turn.kind, modelProfileId: prepared?.start.model.profileId },
|
|
419
|
+
{ current: running, preparedStart: prepared?.start }
|
|
420
|
+
);
|
|
472
421
|
if (fixture.execution.status === "succeeded")
|
|
473
422
|
repos.turnAnnotations.create({
|
|
474
423
|
instanceId: id,
|
|
@@ -484,13 +433,9 @@ async function createExtensionIntegrationHarness(options) {
|
|
|
484
433
|
});
|
|
485
434
|
if (running) repos.processes.update(id, { lifecycleStatus: "active" });
|
|
486
435
|
return observe({
|
|
487
|
-
/** @public */
|
|
488
436
|
id: turnId,
|
|
489
|
-
/** @public */
|
|
490
437
|
instanceId: id,
|
|
491
|
-
/** @public */
|
|
492
438
|
turnId: fixture.turnId,
|
|
493
|
-
/** @public */
|
|
494
439
|
artifact: running ? null : { kind: "turn_result", turnRecordId: turnId }
|
|
495
440
|
});
|
|
496
441
|
});
|
|
@@ -527,17 +472,11 @@ async function createExtensionIntegrationHarness(options) {
|
|
|
527
472
|
const record = after.turns.find((turn2) => !previous.has(turn2.id));
|
|
528
473
|
const milestone = record ? context().deps.turnAnnotations.findByKey(id, `turn_milestone:${record.id}`) : null;
|
|
529
474
|
return observe({
|
|
530
|
-
/** @public */
|
|
531
475
|
turn: record ?? null,
|
|
532
|
-
/** @public */
|
|
533
476
|
outcome: typeof milestone?.payload.outcome === "string" ? milestone.payload.outcome : null,
|
|
534
|
-
/** @public */
|
|
535
477
|
failure: record?.errorSummary ?? (after.process.lifecycleStatus === "error" ? "Worker start failed before acceptance" : null),
|
|
536
|
-
/** @public */
|
|
537
478
|
prompts: observations.get(id)?.prompts ?? [],
|
|
538
|
-
/** @public */
|
|
539
479
|
toolResults: observations.get(id)?.toolResults ?? [],
|
|
540
|
-
/** @public */
|
|
541
480
|
result: record?.status === "succeeded" && record.turnResultMarkdown ? { kind: "turn_result", turnRecordId: record.id } : null
|
|
542
481
|
});
|
|
543
482
|
} finally {
|