@leitwerk-dev/test-support 0.3.1 → 0.4.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-JGXSXRIJ.js → chunk-3RWI5WJK.js} +2 -2
- package/dist/{chunk-P2FF4AP7.js → chunk-FDXRT6UZ.js} +57 -2
- package/dist/chunk-FDXRT6UZ.js.map +1 -0
- package/dist/{chunk-5BZSJ4OO.js → chunk-RRE5BNSZ.js} +38 -4
- package/dist/chunk-RRE5BNSZ.js.map +1 -0
- package/dist/{chunk-WT7V7REB.js → chunk-WRAVDPEM.js} +15 -27
- package/dist/chunk-WRAVDPEM.js.map +1 -0
- package/dist/dashboard-fixture.d.ts +4 -0
- package/dist/dashboard-fixture.d.ts.map +1 -0
- package/dist/extension-integration-harness.d.ts +2 -2
- package/dist/extension-integration-harness.d.ts.map +1 -1
- package/dist/fixtures.d.ts +1 -0
- package/dist/fixtures.d.ts.map +1 -1
- package/dist/fixtures.js +95 -0
- package/dist/fixtures.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -26
- package/dist/index.js.map +1 -1
- package/dist/integration-harness.d.ts +2 -0
- package/dist/integration-harness.d.ts.map +1 -1
- package/dist/integration.d.ts +1 -1
- package/dist/integration.d.ts.map +1 -1
- package/dist/integration.js +30 -16
- package/dist/integration.js.map +1 -1
- package/dist/local-git.d.ts +9 -0
- package/dist/local-git.d.ts.map +1 -1
- package/dist/local-git.js +31 -0
- package/dist/local-git.js.map +1 -1
- package/dist/model-provider-fixtures.d.ts +7 -0
- package/dist/model-provider-fixtures.d.ts.map +1 -1
- package/dist/process.d.ts +32 -2
- package/dist/process.d.ts.map +1 -1
- package/dist/process.js +24 -15
- package/dist/process.js.map +1 -1
- package/dist/server-extension-test-harness.d.ts +3 -1
- package/dist/server-extension-test-harness.d.ts.map +1 -1
- package/dist/stub-worker-entry.js +1 -1
- package/dist/worker-testing/index.d.ts +1 -1
- package/dist/worker-testing/index.d.ts.map +1 -1
- package/dist/worker-testing/index.js +7 -4
- package/dist/worker-testing/index.js.map +1 -1
- package/dist/worker-testing/schema-driven-stub-pi.d.ts.map +1 -1
- package/dist/worker-testing/stub-pi-tree-handle.d.ts +2 -0
- package/dist/worker-testing/stub-pi-tree-handle.d.ts.map +1 -1
- package/dist/worker-testing/worker-start-payload.d.ts.map +1 -1
- package/package.json +10 -10
- package/src/dashboard-fixture.ts +95 -0
- package/src/extension-integration-harness.ts +11 -13
- package/src/fixtures.ts +1 -0
- package/src/index.ts +2 -0
- package/src/integration-harness.ts +17 -1
- package/src/integration.ts +1 -0
- package/src/local-git.ts +34 -0
- package/src/model-provider-fixtures.ts +40 -0
- package/src/process.ts +22 -12
- package/src/server-extension-test-harness.ts +41 -1
- package/src/worker-testing/index.ts +1 -0
- package/src/worker-testing/schema-driven-stub-pi.ts +11 -23
- package/src/worker-testing/stub-pi-tree-handle.ts +20 -1
- package/src/worker-testing/worker-start-payload.ts +1 -0
- package/dist/chunk-5BZSJ4OO.js.map +0 -1
- package/dist/chunk-P2FF4AP7.js.map +0 -1
- package/dist/chunk-WT7V7REB.js.map +0 -1
- /package/dist/{chunk-JGXSXRIJ.js.map → chunk-3RWI5WJK.js.map} +0 -0
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\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,IAAM,cAAiC;AAAA,EACtC,WAAW,EAAE,MAAM,IAAI,UAAU,IAAI,eAAe,KAAK;AAAA,EACzD,WAAW,CAAC;AAAA,EACZ,YAAY,CAAC;AAAA,EACb,OAAO;AAAA,EACP,SAAS;AACV;AAGO,SAAS,2CAA2C;AAC1D,QAAM,8BAA8B,oBAAI,IAOtC;AAGF,WAAS,QAAQ,OAAqD;AACrE,UAAM,SAAS;AACf,QAAI,CAAC,MAAM,QAAQ,OAAO,WAAW,GAAG;AACvC,aAAO;AAAA,IACR;AACA,UAAM,iBAAiB,OAAO,oBAAoB,CAAC;AACnD,UAAM,YAAY,wBAAwB,cAAc;AACxD,UAAM,cAAc;AAAA,MACnB,GAAG;AAAA,MACH,UAAU;AAAA,MACV,QAAQ;AAAA,MACR,SAAS,MAAM,CAAC;AAAA,IACjB;AACA,UAAM,aAAa,+BAA+B;AAAA,MACjD,MAAM;AAAA,MACN,aAAa,OAAO;AAAA,MACpB,QAAQ,OAAO;AAAA,IAChB,CAAC;AACD,UAAM,SAAS,OAAO,YAAY,UAAU;AAC5C,QAAI;AACH,iBAAW,OAAO,YAAY,IAAI;AAAA,QACjC,GAAG;AAAA,QACH,GAAG,WAAW,OAAO,YAAY;AAAA,QACjC,WAAW,OAAO;AAAA,QAClB,YAAY,OAAO;AAAA,QACnB,OAAO,OAAO;AAAA,QACd,WAAW,OAAO,UAAU,IAAI,CAAC,EAAE,QA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QAAQ,SAAS,MAAM,QAAQ,MAAM,cAAc;AACtE,MAAI,QAAQ,QAAQ,QAAQ,KAAK,eAAe;AAC/C,UAAM,IAAI,MAAM,0CAA0C;AAC3D,QAAM,YAAY,2BAA2B;AAAA,IAC5C,YAAY,QAAQ,aAAa,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO;AAAA,MAClD,UAAU,EAAE,YAAY;AAAA,MACxB,WAAW,EAAE,aAAa;AAAA,MAC1B,SAAS,EAAE,WAAW,CAAC,EAAE,OAAO,OAAO,CAAC;AAAA,IACzC,EAAE;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":[]}
|
|
1
|
+
{"version":3,"sources":["../src/compact-process-detail-fixture.ts","../src/dashboard-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 { DashboardResponseBody } from \"@leitwerk-dev/protocol/http-contracts\";\n\n/** Representative server-ordered dashboard data, fresh for each test. @internal */\nexport function createDashboardFixture(): DashboardResponseBody {\n\treturn {\n\t\tgeneratedAt: \"2026-10-14T10:30:00.000Z\",\n\t\tdefinitions: {\n\t\t\ttotal: 4,\n\t\t\titems: [\n\t\t\t\t{ id: \"smoke\", name: \"Kubernetes Smoke\" },\n\t\t\t\t{ id: \"poem_creator_process\", name: \"Poem Creator\" },\n\t\t\t\t{ id: \"repo_change\", name: \"Repository Change\" },\n\t\t\t\t{ id: \"single_prompt_process\", name: \"Single Prompt\" },\n\t\t\t],\n\t\t},\n\t\twatchers: {\n\t\t\ttotal: 4,\n\t\t\tenabled: 3,\n\t\t\titems: [\n\t\t\t\t{ id: \"paused\", name: \"Paused trigger\", enabled: false },\n\t\t\t\t{ id: \"poem\", name: \"Poem file\", enabled: true },\n\t\t\t\t{ id: \"repo\", name: \"Repository issues\", enabled: true },\n\t\t\t\t{ id: \"schedule\", name: \"Scheduled checks\", enabled: true },\n\t\t\t],\n\t\t},\n\t\tskills: { total: 9, installed: 4, bundled: 5 },\n\t\tprocesses: {\n\t\t\ttotal: 27,\n\t\t\tbyStatus: [\n\t\t\t\t{ status: \"running\", count: 3 },\n\t\t\t\t{ status: \"waiting\", count: 5 },\n\t\t\t\t{ status: \"error\", count: 2 },\n\t\t\t\t{ status: \"completed\", count: 16 },\n\t\t\t\t{ status: \"aborted\", count: 1 },\n\t\t\t],\n\t\t\tbyDefinition: [\n\t\t\t\t{ processId: \"single_prompt_process\", name: \"Single Prompt\", count: 14 },\n\t\t\t\t{ processId: \"poem_creator_process\", name: \"Poem Creator\", count: 8 },\n\t\t\t\t{ processId: \"repo_change\", name: \"Repository Change\", count: 5 },\n\t\t\t],\n\t\t},\n\t\tcosts: {\n\t\t\ttotalUsd: 8.4,\n\t\t\ttotalLlmTurnCount: 65,\n\t\t\tpricedTurnCount: 60,\n\t\t\tmissingCostTurnCount: 5,\n\t\t\tisPartial: true,\n\t\t\tbyModel: [\n\t\t\t\t\"gpt-6.1\",\n\t\t\t\t\"gpt-6\",\n\t\t\t\t\"gpt-6-mini\",\n\t\t\t\t\"claude-sonnet\",\n\t\t\t\t\"claude-haiku\",\n\t\t\t\t\"historical-model\",\n\t\t\t].map((modelId, index) => ({\n\t\t\t\tproviderId: index < 3 ? \"openai\" : \"anthropic\",\n\t\t\t\tmodelId,\n\t\t\t\tcostUsd: (6 - index) * 0.4,\n\t\t\t\tturnCount: 10,\n\t\t\t})),\n\t\t},\n\t\tconfiguration: {\n\t\t\tissues: [\n\t\t\t\t{\n\t\t\t\t\tid: \"credential\",\n\t\t\t\t\tcode: \"missing_credential\",\n\t\t\t\t\tseverity: \"error\",\n\t\t\t\t\tmessage: \"The review model profile needs a provider credential.\",\n\t\t\t\t\tsources: [{ label: \"Review model\", href: \"/settings\" }],\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tid: \"default\",\n\t\t\t\t\tcode: \"missing_default\",\n\t\t\t\t\tseverity: \"warning\",\n\t\t\t\t\tmessage: \"Repository Change has no default model profile.\",\n\t\t\t\t\tsources: [{ label: \"Repository Change\", href: \"/settings\" }],\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tid: \"unavailable\",\n\t\t\t\t\tcode: \"unavailable_model\",\n\t\t\t\t\tseverity: \"error\",\n\t\t\t\t\tmessage: \"A configured model is unavailable from its provider.\",\n\t\t\t\t\tsources: [{ label: \"Model catalog\", href: \"/settings\" }],\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tid: \"override\",\n\t\t\t\t\tcode: \"invalid_override\",\n\t\t\t\t\tseverity: \"warning\",\n\t\t\t\t\tmessage: \"A turn override references a removed model profile.\",\n\t\t\t\t\tsources: [{ label: \"Turn settings\", href: \"/settings\" }],\n\t\t\t\t},\n\t\t\t],\n\t\t},\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,IAAM,cAAiC;AAAA,EACtC,WAAW,EAAE,MAAM,IAAI,UAAU,IAAI,eAAe,KAAK;AAAA,EACzD,WAAW,CAAC;AAAA,EACZ,YAAY,CAAC;AAAA,EACb,OAAO;AAAA,EACP,SAAS;AACV;AAGO,SAAS,2CAA2C;AAC1D,QAAM,8BAA8B,oBAAI,IAOtC;AAGF,WAAS,QAAQ,OAAqD;AACrE,UAAM,SAAS;AACf,QAAI,CAAC,MAAM,QAAQ,OAAO,WAAW,GAAG;AACvC,aAAO;AAAA,IACR;AACA,UAAM,iBAAiB,OAAO,oBAAoB,CAAC;AACnD,UAAM,YAAY,wBAAwB,cAAc;AACxD,UAAM,cAAc;AAAA,MACnB,GAAG;AAAA,MACH,UAAU;AAAA,MACV,QAAQ;AAAA,MACR,SAAS,MAAM,CAAC;AAAA,IACjB;AACA,UAAM,aAAa,+BAA+B;AAAA,MACjD,MAAM;AAAA,MACN,aAAa,OAAO;AAAA,MACpB,QAAQ,OAAO;AAAA,IAChB,CAAC;AACD,UAAM,SAAS,OAAO,YAAY,UAAU;AAC5C,QAAI;AACH,iBAAW,OAAO,YAAY,IAAI;AAAA,QACjC,GAAG;AAAA,QACH,GAAG,WAAW,OAAO,YAAY;AAAA,QACjC,WAAW,OAAO;AAAA,QAClB,YAAY,OAAO;AAAA,QAC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Q,aAAa,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO;AAAA,MAClD,UAAU,EAAE,YAAY;AAAA,MACxB,WAAW,EAAE,aAAa;AAAA,MAC1B,SAAS,EAAE,WAAW,CAAC,EAAE,OAAO,OAAO,CAAC;AAAA,IACzC,EAAE;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/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createInMemoryExternalWriteLog as createInMemoryExternalWriteLogImpl } from "./server-extension-test-harness.js";
|
|
2
2
|
export { FakeLlmProvider } from "./fakes/fake-llm.js";
|
|
3
3
|
export { postImmediateLaunch, postImmediateLaunchRequest } from "./http-launch.js";
|
|
4
|
-
export { type FixtureModelProviderSet, fixtureModelProviders, } from "./model-provider-fixtures.js";
|
|
4
|
+
export { type FixtureModelProviderSet, fixtureModelProfiles, fixtureModelProviders, withDefaultModelFixture, } from "./model-provider-fixtures.js";
|
|
5
5
|
export { createPollingTestExtension, createTestServerSetupCapability, createToolCollector, } from "./server-extension-test-harness.js";
|
|
6
6
|
/** @internal */
|
|
7
7
|
export declare function createInMemoryExternalWriteLog(): ReturnType<typeof createInMemoryExternalWriteLogImpl>;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,IAAI,kCAAkC,EAAE,MAAM,oCAAoC,CAAC;AAE1H,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AACnF,OAAO,EACN,KAAK,uBAAuB,EAC5B,qBAAqB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,IAAI,kCAAkC,EAAE,MAAM,oCAAoC,CAAC;AAE1H,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AACnF,OAAO,EACN,KAAK,uBAAuB,EAC5B,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,GACvB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACN,0BAA0B,EAC1B,+BAA+B,EAC/B,mBAAmB,GACnB,MAAM,oCAAoC,CAAC;AAE5C,gBAAgB;AAChB,wBAAgB,8BAA8B,IAAI,UAAU,CAC3D,OAAO,kCAAkC,CACzC,CAEA"}
|
package/dist/index.js
CHANGED
|
@@ -1,39 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
|
+
fixtureModelProfiles,
|
|
3
|
+
fixtureModelProviders,
|
|
2
4
|
postImmediateLaunch,
|
|
3
|
-
postImmediateLaunchRequest
|
|
4
|
-
|
|
5
|
+
postImmediateLaunchRequest,
|
|
6
|
+
withDefaultModelFixture
|
|
7
|
+
} from "./chunk-FDXRT6UZ.js";
|
|
5
8
|
import {
|
|
6
9
|
createInMemoryExternalWriteLog,
|
|
7
10
|
createPollingTestExtension,
|
|
8
11
|
createTestServerSetupCapability,
|
|
9
12
|
createToolCollector
|
|
10
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-RRE5BNSZ.js";
|
|
11
14
|
import {
|
|
12
15
|
FakeLlmProvider
|
|
13
16
|
} from "./chunk-EXHTWQAE.js";
|
|
14
17
|
|
|
15
|
-
// src/model-provider-fixtures.ts
|
|
16
|
-
import {
|
|
17
|
-
builtinPiProvider,
|
|
18
|
-
defineModelProvider,
|
|
19
|
-
defineModelProviders
|
|
20
|
-
} from "@leitwerk-dev/process-sdk";
|
|
21
|
-
function fixtureModelProviders(...models) {
|
|
22
|
-
return defineModelProviders(
|
|
23
|
-
(rawConfig) => models.map(({ id, modelId, piProvider = id, server = false }) => ({
|
|
24
|
-
definition: defineModelProvider({
|
|
25
|
-
id,
|
|
26
|
-
parseConfig: () => ({ config: {} }),
|
|
27
|
-
worker: builtinPiProvider(piProvider),
|
|
28
|
-
...server ? { server: builtinPiProvider(piProvider) } : {},
|
|
29
|
-
models: () => [{ modelId, availability: "available" }],
|
|
30
|
-
secrets: () => ({})
|
|
31
|
-
}),
|
|
32
|
-
rawConfig
|
|
33
|
-
}))
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
18
|
// src/index.ts
|
|
38
19
|
function createInMemoryExternalWriteLog2() {
|
|
39
20
|
return createInMemoryExternalWriteLog();
|
|
@@ -44,8 +25,10 @@ export {
|
|
|
44
25
|
createPollingTestExtension,
|
|
45
26
|
createTestServerSetupCapability,
|
|
46
27
|
createToolCollector,
|
|
28
|
+
fixtureModelProfiles,
|
|
47
29
|
fixtureModelProviders,
|
|
48
30
|
postImmediateLaunch,
|
|
49
|
-
postImmediateLaunchRequest
|
|
31
|
+
postImmediateLaunchRequest,
|
|
32
|
+
withDefaultModelFixture
|
|
50
33
|
};
|
|
51
34
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { createInMemoryExternalWriteLog as createInMemoryExternalWriteLogImpl } from \"./server-extension-test-harness.js\";\n\nexport { FakeLlmProvider } from \"./fakes/fake-llm.js\";\nexport { postImmediateLaunch, postImmediateLaunchRequest } from \"./http-launch.js\";\nexport {\n\ttype FixtureModelProviderSet,\n\tfixtureModelProfiles,\n\tfixtureModelProviders,\n\twithDefaultModelFixture,\n} from \"./model-provider-fixtures.js\";\nexport {\n\tcreatePollingTestExtension,\n\tcreateTestServerSetupCapability,\n\tcreateToolCollector,\n} from \"./server-extension-test-harness.js\";\n\n/** @internal */\nexport function createInMemoryExternalWriteLog(): ReturnType<\n\ttypeof createInMemoryExternalWriteLogImpl\n> {\n\treturn createInMemoryExternalWriteLogImpl();\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAiBO,SAASA,kCAEd;AACD,SAAO,+BAAmC;AAC3C;","names":["createInMemoryExternalWriteLog"]}
|
|
@@ -2,6 +2,8 @@ import type { ExtensionCatalog } from "@leitwerk-dev/extension-runtime";
|
|
|
2
2
|
import type { ProvidedCapability } from "@leitwerk-dev/process-sdk";
|
|
3
3
|
import { type AppContext, type AppOptions, type LeitwerkConfig } from "@leitwerk-dev/server";
|
|
4
4
|
import { type InProcessWorkerSpawnOptions } from "./in-process-worker.js";
|
|
5
|
+
/** Server fixture with an explicit synthetic model when the test supplies no model catalog. @internal */
|
|
6
|
+
export declare function createTestAppContext(options?: AppOptions): Promise<AppContext>;
|
|
5
7
|
/** @public */
|
|
6
8
|
export interface IntegrationHarness<TResources extends Record<string, unknown> = Record<string, never>> {
|
|
7
9
|
/** @public */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration-harness.d.ts","sourceRoot":"","sources":["../src/integration-harness.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"integration-harness.d.ts","sourceRoot":"","sources":["../src/integration-harness.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAExE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EACN,KAAK,UAAU,EACf,KAAK,UAAU,EAGf,KAAK,cAAc,EACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAEN,KAAK,2BAA2B,EAChC,MAAM,wBAAwB,CAAC;AAGhC,yGAAyG;AACzG,wBAAsB,oBAAoB,CAAC,OAAO,GAAE,UAAe,GAAG,OAAO,CAAC,UAAU,CAAC,CAQxF;AAED,cAAc;AACd,MAAM,WAAW,kBAAkB,CAClC,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC;IAElE,cAAc;IACd,GAAG,EAAE,UAAU,CAAC;IAChB,cAAc;IACd,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,gBAAgB;IAChB,MAAM,EAAE,cAAc,CAAC;IACvB,cAAc;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB;IAChB,SAAS,EAAE,UAAU,CAAC;CACtB;AAED,cAAc;AACd,MAAM,WAAW,yBAAyB,CACzC,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC;IAElE,gBAAgB;IAChB,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,cAAc;IACd,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI,CAAC;IAClD,cAAc;IACd,YAAY,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IACnC,gBAAgB;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,mFAAmF;IACnF,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,gBAAgB;IAChB,gBAAgB,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC,2BAA2B,EAAE,kBAAkB,CAAC,CAAC;IACnF,cAAc;IACd,gBAAgB,EAAE,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC/D,gBAAgB;IAChB,uBAAuB,CAAC,EAAE,SAAS,kBAAkB,EAAE,CAAC;IACxD,gBAAgB;IAChB,SAAS,CAAC,EAAE,UAAU,CAAC;CACvB;AAED,6GAA6G;AAC7G,wBAAgB,kCAAkC,CACjD,MAAM,EAAE,MAAM,EACd,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI;IAoB3C,gBAAgB;;IAEhB,gBAAgB;;IAEhB,gBAAgB;;IAKhB,gBAAgB;kBACI,yBAAyB;IAO7C,gBAAgB;;IAEhB,gBAAgB;;EASjB;AACD,cAAc;AACd,wBAAsB,wBAAwB,CAC7C,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EACjE,IAAI,EAAE,yBAAyB,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC,CAwDtF"}
|
package/dist/integration.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { type AcceptedTurnFixture, type AcceptedTurnReference, createExtensionIntegrationHarness, type ExtensionIntegrationHarness, type ExtensionIntegrationHarnessOptions, type ExtensionIntegrationProcess, type ExtensionIntegrationSnapshot, type ExtensionTestRequest, type ExtensionTestResponse, type IntegrationAnnotationObservation, type IntegrationApprovalObservation, type IntegrationEventObservation, type IntegrationInputObservation, type IntegrationLeafObservation, type IntegrationProcessInput, type IntegrationPromptObservation, type IntegrationToolCall, type IntegrationTurnResult, type IntegrationTurnScript, } from "./extension-integration-harness.js";
|
|
2
|
-
export { createIntegrationHarness, createPersistentIntegrationFixture, type IntegrationHarness, } from "./integration-harness.js";
|
|
2
|
+
export { createIntegrationHarness, createPersistentIntegrationFixture, createTestAppContext, type IntegrationHarness, } from "./integration-harness.js";
|
|
3
3
|
export { waitForValue } from "./polling.js";
|
|
4
4
|
export { createProcessDriver } from "./process-driver.js";
|
|
5
5
|
export { createTestServerSetupCapability } from "./server-extension-test-harness.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration.d.ts","sourceRoot":"","sources":["../src/integration.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,iCAAiC,EACjC,KAAK,2BAA2B,EAChC,KAAK,kCAAkC,EACvC,KAAK,2BAA2B,EAChC,KAAK,4BAA4B,EACjC,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,gCAAgC,EACrC,KAAK,8BAA8B,EACnC,KAAK,2BAA2B,EAChC,KAAK,2BAA2B,EAChC,KAAK,0BAA0B,EAC/B,KAAK,uBAAuB,EAC5B,KAAK,4BAA4B,EACjC,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,GAC1B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACN,wBAAwB,EACxB,kCAAkC,EAClC,KAAK,kBAAkB,GACvB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,+BAA+B,EAAE,MAAM,oCAAoC,CAAC"}
|
|
1
|
+
{"version":3,"file":"integration.d.ts","sourceRoot":"","sources":["../src/integration.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,iCAAiC,EACjC,KAAK,2BAA2B,EAChC,KAAK,kCAAkC,EACvC,KAAK,2BAA2B,EAChC,KAAK,4BAA4B,EACjC,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,gCAAgC,EACrC,KAAK,8BAA8B,EACnC,KAAK,2BAA2B,EAChC,KAAK,2BAA2B,EAChC,KAAK,0BAA0B,EAC/B,KAAK,uBAAuB,EAC5B,KAAK,4BAA4B,EACjC,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,GAC1B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACN,wBAAwB,EACxB,kCAAkC,EAClC,oBAAoB,EACpB,KAAK,kBAAkB,GACvB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,+BAA+B,EAAE,MAAM,oCAAoC,CAAC"}
|
package/dist/integration.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
postImmediateLaunch
|
|
3
|
-
|
|
2
|
+
postImmediateLaunch,
|
|
3
|
+
withDefaultModelFixture
|
|
4
|
+
} from "./chunk-FDXRT6UZ.js";
|
|
4
5
|
import {
|
|
5
6
|
observe
|
|
6
7
|
} from "./chunk-KJVNI2UP.js";
|
|
@@ -9,18 +10,19 @@ import {
|
|
|
9
10
|
} from "./chunk-RY6Y6V5E.js";
|
|
10
11
|
import {
|
|
11
12
|
createTestServerSetupCapability
|
|
12
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-RRE5BNSZ.js";
|
|
13
14
|
import {
|
|
14
15
|
createInProcessWorkerSpawn
|
|
15
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-3RWI5WJK.js";
|
|
16
17
|
import {
|
|
17
|
-
StubPiTreeHandleFactory
|
|
18
|
-
|
|
18
|
+
StubPiTreeHandleFactory,
|
|
19
|
+
formatBranchText
|
|
20
|
+
} from "./chunk-WRAVDPEM.js";
|
|
19
21
|
|
|
20
22
|
// src/extension-integration-harness.ts
|
|
21
23
|
import { randomUUID } from "crypto";
|
|
22
24
|
import path2 from "path";
|
|
23
|
-
import { buildExtensionCatalogFromModules } from "@leitwerk-dev/extension-runtime/testing";
|
|
25
|
+
import { buildExtensionCatalogFromModules as buildExtensionCatalogFromModules2 } from "@leitwerk-dev/extension-runtime/testing";
|
|
24
26
|
import {
|
|
25
27
|
coreHostCapabilities
|
|
26
28
|
} from "@leitwerk-dev/process-sdk";
|
|
@@ -34,10 +36,20 @@ import { persistPiResourceBundleForStart } from "@leitwerk-dev/worker";
|
|
|
34
36
|
import { mkdtempSync, rmSync } from "fs";
|
|
35
37
|
import { tmpdir } from "os";
|
|
36
38
|
import path from "path";
|
|
39
|
+
import { buildExtensionCatalogFromModules } from "@leitwerk-dev/extension-runtime/testing";
|
|
37
40
|
import {
|
|
38
41
|
createAppContext,
|
|
39
42
|
getDefaultConfig
|
|
40
43
|
} from "@leitwerk-dev/server";
|
|
44
|
+
async function createTestAppContext(options = {}) {
|
|
45
|
+
const config = options.config ?? getDefaultConfig();
|
|
46
|
+
const catalog = await (options.extensionCatalog ?? buildExtensionCatalogFromModules([]));
|
|
47
|
+
return createAppContext({
|
|
48
|
+
...options,
|
|
49
|
+
config,
|
|
50
|
+
extensionCatalog: withDefaultModelFixture(config, catalog)
|
|
51
|
+
});
|
|
52
|
+
}
|
|
41
53
|
function createPersistentIntegrationFixture(prefix, configure) {
|
|
42
54
|
const root = mkdtempSync(path.join(tmpdir(), prefix));
|
|
43
55
|
let harness;
|
|
@@ -90,7 +102,10 @@ async function createIntegrationHarness(opts) {
|
|
|
90
102
|
config.workers.runner = "local";
|
|
91
103
|
}
|
|
92
104
|
opts.configOverride?.(config);
|
|
93
|
-
const extensionCatalog =
|
|
105
|
+
const extensionCatalog = withDefaultModelFixture(
|
|
106
|
+
config,
|
|
107
|
+
await Promise.resolve(opts.extensionCatalog)
|
|
108
|
+
);
|
|
94
109
|
const appOpts = {
|
|
95
110
|
logger: false,
|
|
96
111
|
config,
|
|
@@ -137,7 +152,7 @@ async function createIntegrationHarness(opts) {
|
|
|
137
152
|
|
|
138
153
|
// src/extension-integration-harness.ts
|
|
139
154
|
async function createExtensionIntegrationHarness(options) {
|
|
140
|
-
const catalog = await
|
|
155
|
+
const catalog = await buildExtensionCatalogFromModules2([
|
|
141
156
|
...options.polling === "manual" ? [
|
|
142
157
|
{
|
|
143
158
|
manifest: { id: "test-support-manual-polling", version: "1" },
|
|
@@ -164,6 +179,7 @@ async function createExtensionIntegrationHarness(options) {
|
|
|
164
179
|
thinking_level: model.thinkingLevel ?? "off"
|
|
165
180
|
}));
|
|
166
181
|
if (options.defaultModel) {
|
|
182
|
+
config.pi.default_model_profile = options.defaultModel;
|
|
167
183
|
config.pi.process_title_generation.model_profile = options.defaultModel;
|
|
168
184
|
config.process_configs = Object.fromEntries(
|
|
169
185
|
[...catalog.processes.keys()].map((id) => [
|
|
@@ -199,11 +215,7 @@ async function createExtensionIntegrationHarness(options) {
|
|
|
199
215
|
const prompt = input.identifiedPromptText ?? input.promptText;
|
|
200
216
|
observation.prompts.push(prompt);
|
|
201
217
|
const session = [...piFactory.sessions].reverse().find((session2) => session2.treeFile === input.treeFile);
|
|
202
|
-
const history = session?.getBranch()
|
|
203
|
-
if (entry.type === "custom_message") return entry.content;
|
|
204
|
-
if (entry.type === "message" && entry.message) return entry.message.content;
|
|
205
|
-
return "";
|
|
206
|
-
}).filter((value) => typeof value === "string").join("\n\n") ?? "";
|
|
218
|
+
const history = formatBranchText(session?.getBranch(), "");
|
|
207
219
|
const script = manual ? scripts.get(id) : await options.script?.(
|
|
208
220
|
id,
|
|
209
221
|
prompt,
|
|
@@ -518,9 +530,10 @@ async function createExtensionIntegrationHarness(options) {
|
|
|
518
530
|
/** Get a handle that remains valid across restart. @public */
|
|
519
531
|
process: processHandle,
|
|
520
532
|
/** Admit work through a registered UI launcher. @public */
|
|
521
|
-
async launch(id, input) {
|
|
533
|
+
async launch(id, input, modelConfig) {
|
|
522
534
|
const response = await postImmediateLaunch(context().config.server.base_url, id, {
|
|
523
|
-
launcherInput: input
|
|
535
|
+
launcherInput: input,
|
|
536
|
+
...modelConfig ? { modelConfig } : {}
|
|
524
537
|
});
|
|
525
538
|
const body = await response.json();
|
|
526
539
|
if (!response.ok || !body.process)
|
|
@@ -680,6 +693,7 @@ export {
|
|
|
680
693
|
createIntegrationHarness,
|
|
681
694
|
createPersistentIntegrationFixture,
|
|
682
695
|
createProcessDriver,
|
|
696
|
+
createTestAppContext,
|
|
683
697
|
createTestServerSetupCapability,
|
|
684
698
|
waitForValue
|
|
685
699
|
};
|