@leitwerk-dev/test-support 0.3.0 → 0.4.0
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-3RWI5WJK.js} +2 -2
- package/dist/{chunk-5BZSJ4OO.js → chunk-DNUGHAYN.js} +37 -4
- package/dist/chunk-DNUGHAYN.js.map +1 -0
- package/dist/{chunk-P2FF4AP7.js → chunk-FDXRT6UZ.js} +57 -2
- package/dist/chunk-FDXRT6UZ.js.map +1 -0
- package/dist/{chunk-E4Y7XND5.js → chunk-WRAVDPEM.js} +16 -27
- package/dist/chunk-WRAVDPEM.js.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.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 +54 -101
- 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/supported-question-fixtures.d.ts.map +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 +15 -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/extension-integration-harness.ts +44 -139
- 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 +40 -1
- package/src/supported-question-fixtures.ts +0 -20
- 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 +34 -1
- package/src/worker-testing/worker-start-payload.ts +1 -0
- package/dist/chunk-5BZSJ4OO.js.map +0 -1
- package/dist/chunk-E4Y7XND5.js.map +0 -1
- package/dist/chunk-P2FF4AP7.js.map +0 -1
- /package/dist/{chunk-OE4NHDVS.js.map → chunk-3RWI5WJK.js.map} +0 -0
|
@@ -33,6 +33,19 @@ export interface StubToolCallScriptResolverContext {
|
|
|
33
33
|
tools: readonly PiCustomTool[];
|
|
34
34
|
/** @public */
|
|
35
35
|
instanceId?: string;
|
|
36
|
+
/** Active frozen item when the turn is one item of a mapped LLM turn. @public */
|
|
37
|
+
iteration?: {
|
|
38
|
+
/** @public */
|
|
39
|
+
itemKey: string;
|
|
40
|
+
/** @public */
|
|
41
|
+
itemLabel: string;
|
|
42
|
+
/** @public */
|
|
43
|
+
itemIndex: number;
|
|
44
|
+
/** @public */
|
|
45
|
+
itemCount: number;
|
|
46
|
+
/** @public */
|
|
47
|
+
item: unknown;
|
|
48
|
+
};
|
|
36
49
|
/** @public */
|
|
37
50
|
workspaceRoot?: string;
|
|
38
51
|
/** @public */
|
|
@@ -44,6 +57,8 @@ export interface StubToolCallScriptResolverContext {
|
|
|
44
57
|
}
|
|
45
58
|
/** @public */
|
|
46
59
|
export type StubToolCallScriptResolver = (context: StubToolCallScriptResolverContext) => StubToolCallScriptItem | undefined | Promise<StubToolCallScriptItem | undefined>;
|
|
60
|
+
/** Formats textual branch entries without choosing a session. @internal */
|
|
61
|
+
export declare function formatBranchText(entries?: readonly PiTreeEntry[], missingMessageText?: string): string;
|
|
47
62
|
/** @internal */
|
|
48
63
|
interface StubPiTreeState {
|
|
49
64
|
/** @internal */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stub-pi-tree-handle.d.ts","sourceRoot":"","sources":["../../src/worker-testing/stub-pi-tree-handle.ts"],"names":[],"mappings":"AAGA,OAAO,EAA2B,KAAK,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAC9F,OAAO,KAAK,EACX,oBAAoB,EACpB,YAAY,EAEZ,cAAc,EACd,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,0BAA0B,EAC1B,WAAW,EACX,YAAY,EACZ,UAAU,EACV,qBAAqB,EACrB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,KAAK,EACX,yBAAyB,EACzB,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EACtB,MAAM,sBAAsB,CAAC;AAE9B,cAAc;AACd,MAAM,WAAW,sBAAsB;IACtC,cAAc;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc;IACd,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,gBAAgB;IAChB,sBAAsB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,cAAc;AACd,MAAM,MAAM,sBAAsB,GAC/B,sBAAsB,GACtB;IACA,cAAc;IACd,KAAK,EAAE,SAAS,sBAAsB,EAAE,CAAC;IACzC,cAAc;IACd,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/B,cAAc;IACd,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,cAAc;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,yFAAyF;IACzF,eAAe,CAAC,EAAE,CACjB,IAAI,EAAE,sBAAsB,EAC5B,MAAM,EAAE,OAAO,KACX,sBAAsB,GAAG,SAAS,CAAC;CACvC,CAAC;AAEL,cAAc;AACd,MAAM,WAAW,iCAAiC;IACjD,cAAc;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,mFAAmF;IACnF,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,cAAc;IACd,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;IAC/B,cAAc;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc;IACd,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB;IAChB,YAAY,EAAE,MAAM,CAAC;CACrB;AAED,cAAc;AACd,MAAM,MAAM,0BAA0B,GAAG,CACxC,OAAO,EAAE,iCAAiC,KACtC,sBAAsB,GAAG,SAAS,GAAG,OAAO,CAAC,sBAAsB,GAAG,SAAS,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"stub-pi-tree-handle.d.ts","sourceRoot":"","sources":["../../src/worker-testing/stub-pi-tree-handle.ts"],"names":[],"mappings":"AAGA,OAAO,EAA2B,KAAK,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAC9F,OAAO,KAAK,EACX,oBAAoB,EACpB,YAAY,EAEZ,cAAc,EACd,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,0BAA0B,EAC1B,WAAW,EACX,YAAY,EACZ,UAAU,EACV,qBAAqB,EACrB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,KAAK,EACX,yBAAyB,EACzB,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EACtB,MAAM,sBAAsB,CAAC;AAE9B,cAAc;AACd,MAAM,WAAW,s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AA+B,CAC9C,OAAO,EAAE,gCAAgC,GACvC,kBAAkB,
|
|
1
|
+
{"version":3,"file":"worker-start-payload.d.ts","sourceRoot":"","sources":["../../src/worker-testing/worker-start-payload.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAGN,KAAK,aAAa,EAClB,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAG3B,KAAK,wBAAwB,EAC7B,KAAK,kBAAkB,EACvB,MAAM,+BAA+B,CAAC;AAEvC,gBAAgB;AAChB,KAAK,QAAQ,GAAG,OAAO,CAAC,iBAAiB,EAAE;IAAE,IAAI,EAAE,KAAK,CAAA;CAAE,CAAC,CAAC;AAC5D,gBAAgB;AAChB,KAAK,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;AAElC,gBAAgB;AAChB,MAAM,WAAW,gCAAgC;IAChD,gBAAgB;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB;IAChB,eAAe,EAAE,uBAAuB,CAAC;IACzC,gBAAgB;IAChB,gBAAgB,CAAC,EAAE,sBAAsB,EAAE,CAAC;IAC5C,gBAAgB;IAChB,+BAA+B,CAAC,EAAE,kBAAkB,CAAC,iCAAiC,CAAC,CAAC;IACxF,gBAAgB;IAChB,2BAA2B,CAAC,EAAE,kBAAkB,CAAC,6BAA6B,CAAC,CAAC;IAChF,gBAAgB;IAChB,aAAa,CAAC,EAAE,aAAa,EAAE,CAAC;IAChC,gBAAgB;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gBAAgB;IAChB,KAAK,CAAC,EAAE,QAAQ,CAAC;IACjB,gBAAgB;IAChB,UAAU,CAAC,EAAE,wBAAwB,GAAG,IAAI,CAAC;IAC7C,gBAAgB;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,gBAAgB;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;CACb;AAED,4FAA4F;AAC5F,wBAAgB,+BAA+B,CAC9C,OAAO,EAAE,gCAAgC,GACvC,kBAAkB,CAmGpB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leitwerk-dev/test-support",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/leitwerk-dev/leitwerk.git",
|
|
@@ -48,15 +48,15 @@
|
|
|
48
48
|
"build": "tsup && tsc -p tsconfig.tsup.json --emitDeclarationOnly"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@earendil-works/pi-coding-agent": "^0.
|
|
52
|
-
"@leitwerk-dev/domain": "0.
|
|
53
|
-
"@leitwerk-dev/extension-runtime": "0.
|
|
54
|
-
"@leitwerk-dev/process-sdk": "0.
|
|
55
|
-
"@leitwerk-dev/protocol": "0.
|
|
56
|
-
"@leitwerk-dev/server": "0.
|
|
57
|
-
"@leitwerk-dev/worker": "0.
|
|
58
|
-
"@leitwerk-dev/worker-protocol": "0.
|
|
59
|
-
"@leitwerk-dev/external-writes": "0.
|
|
51
|
+
"@earendil-works/pi-coding-agent": "^0.87.0",
|
|
52
|
+
"@leitwerk-dev/domain": "0.4.0",
|
|
53
|
+
"@leitwerk-dev/extension-runtime": "0.4.0",
|
|
54
|
+
"@leitwerk-dev/process-sdk": "0.4.0",
|
|
55
|
+
"@leitwerk-dev/protocol": "0.4.0",
|
|
56
|
+
"@leitwerk-dev/server": "0.4.0",
|
|
57
|
+
"@leitwerk-dev/worker": "0.4.0",
|
|
58
|
+
"@leitwerk-dev/worker-protocol": "0.4.0",
|
|
59
|
+
"@leitwerk-dev/external-writes": "0.4.0"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"tsup": "^8.5.1"
|
|
@@ -3,11 +3,11 @@ import type { ExtensionTestCapability } from "./test-capability.js";
|
|
|
3
3
|
export type { ExtensionTestCapability } from "./test-capability.js";
|
|
4
4
|
|
|
5
5
|
import { randomUUID } from "node:crypto";
|
|
6
|
-
import { mkdirSync, writeFileSync } from "node:fs";
|
|
7
6
|
import path from "node:path";
|
|
8
7
|
import type {
|
|
9
8
|
Actor,
|
|
10
9
|
ExternalWriteLog,
|
|
10
|
+
LaunchModelConfigInput,
|
|
11
11
|
ProcessInstance,
|
|
12
12
|
ProcessProject,
|
|
13
13
|
ProcessTurnRecord,
|
|
@@ -18,13 +18,17 @@ import {
|
|
|
18
18
|
type ExtensionProcessDefinition,
|
|
19
19
|
type LeitwerkExtensionModule,
|
|
20
20
|
} from "@leitwerk-dev/process-sdk";
|
|
21
|
-
import {
|
|
21
|
+
import {
|
|
22
|
+
createAcceptedWorkerTurn,
|
|
23
|
+
prepareAcceptedFixtureStart,
|
|
24
|
+
} from "@leitwerk-dev/server/testing";
|
|
25
|
+
import { persistPiResourceBundleForStart } from "@leitwerk-dev/worker";
|
|
22
26
|
import { postImmediateLaunch } from "./http-launch.js";
|
|
23
27
|
import { createPersistentIntegrationFixture } from "./integration-harness.js";
|
|
24
28
|
import { observe, type TestObservation } from "./observations.js";
|
|
25
29
|
import { createProcessFixture, type ProcessFixtureOptions } from "./process-fixtures.js";
|
|
26
30
|
import type { QuestionRequestFixture } from "./supported-question-fixtures.js";
|
|
27
|
-
import { StubPiTreeHandleFactory } from "./worker-testing/stub-pi-tree-handle.js";
|
|
31
|
+
import { formatBranchText, StubPiTreeHandleFactory } from "./worker-testing/stub-pi-tree-handle.js";
|
|
28
32
|
|
|
29
33
|
/** Model-visible inputs for a scripted invocation. @public */
|
|
30
34
|
export interface IntegrationPromptObservation {
|
|
@@ -394,7 +398,11 @@ export interface ExtensionIntegrationHarness {
|
|
|
394
398
|
/** @public */
|
|
395
399
|
process(id: string): ExtensionIntegrationProcess;
|
|
396
400
|
/** @public */
|
|
397
|
-
launch(
|
|
401
|
+
launch(
|
|
402
|
+
id: string,
|
|
403
|
+
input: Record<string, unknown>,
|
|
404
|
+
modelConfig?: LaunchModelConfigInput,
|
|
405
|
+
): Promise<ExtensionIntegrationProcess>;
|
|
398
406
|
/** @public */
|
|
399
407
|
createProcess<TParams, TState>(
|
|
400
408
|
definition: ExtensionProcessDefinition<TParams, TState>,
|
|
@@ -447,6 +455,7 @@ export async function createExtensionIntegrationHarness(
|
|
|
447
455
|
thinking_level: model.thinkingLevel ?? "off",
|
|
448
456
|
}));
|
|
449
457
|
if (options.defaultModel) {
|
|
458
|
+
config.pi.default_model_profile = options.defaultModel;
|
|
450
459
|
config.pi.process_title_generation.model_profile = options.defaultModel;
|
|
451
460
|
config.process_configs = Object.fromEntries(
|
|
452
461
|
[...catalog.processes.keys()].map((id) => [
|
|
@@ -462,10 +471,7 @@ export async function createExtensionIntegrationHarness(
|
|
|
462
471
|
});
|
|
463
472
|
const manual = options.execution === "manual";
|
|
464
473
|
let closed = false;
|
|
465
|
-
const pending = new Map<
|
|
466
|
-
string,
|
|
467
|
-
{ turnId: string; resolve(): void; reject(error: Error): void }
|
|
468
|
-
>();
|
|
474
|
+
const pending = new Map<string, { turnId: string; resolve(): void }>();
|
|
469
475
|
const permits = new Set<string>();
|
|
470
476
|
const executing = new Set<string>();
|
|
471
477
|
const scripts = new Map<string, IntegrationTurnScript>();
|
|
@@ -490,16 +496,7 @@ export async function createExtensionIntegrationHarness(
|
|
|
490
496
|
const session = [...piFactory.sessions]
|
|
491
497
|
.reverse()
|
|
492
498
|
.find((session) => session.treeFile === input.treeFile);
|
|
493
|
-
const history =
|
|
494
|
-
session
|
|
495
|
-
?.getBranch()
|
|
496
|
-
.map((entry) => {
|
|
497
|
-
if (entry.type === "custom_message") return entry.content;
|
|
498
|
-
if (entry.type === "message" && entry.message) return entry.message.content;
|
|
499
|
-
return "";
|
|
500
|
-
})
|
|
501
|
-
.filter((value) => typeof value === "string")
|
|
502
|
-
.join("\n\n") ?? "";
|
|
499
|
+
const history = formatBranchText(session?.getBranch(), "");
|
|
503
500
|
const script = manual
|
|
504
501
|
? scripts.get(id)
|
|
505
502
|
: await options.script?.(
|
|
@@ -572,7 +569,6 @@ export async function createExtensionIntegrationHarness(
|
|
|
572
569
|
pending.delete(id);
|
|
573
570
|
resolve();
|
|
574
571
|
},
|
|
575
|
-
reject,
|
|
576
572
|
});
|
|
577
573
|
})
|
|
578
574
|
: undefined,
|
|
@@ -633,12 +629,7 @@ export async function createExtensionIntegrationHarness(
|
|
|
633
629
|
/** @public */
|
|
634
630
|
async function waitFor(
|
|
635
631
|
condition: (snapshot: TestObservation<ExtensionIntegrationSnapshot>) => boolean,
|
|
636
|
-
options: {
|
|
637
|
-
/** @public */
|
|
638
|
-
timeoutMs?: number;
|
|
639
|
-
/** @public */
|
|
640
|
-
description?: string;
|
|
641
|
-
} = {},
|
|
632
|
+
options: Parameters<ExtensionIntegrationProcess["waitFor"]>[1] = {},
|
|
642
633
|
) {
|
|
643
634
|
const deadline = Date.now() + (options.timeoutMs ?? 12000);
|
|
644
635
|
for (;;) {
|
|
@@ -678,7 +669,7 @@ export async function createExtensionIntegrationHarness(
|
|
|
678
669
|
/** @public */
|
|
679
670
|
id,
|
|
680
671
|
/** Establish correlated accepted records under exclusive server coordination. @public */
|
|
681
|
-
async seedAcceptedTurn(fixture
|
|
672
|
+
async seedAcceptedTurn(fixture) {
|
|
682
673
|
const ctx = context();
|
|
683
674
|
return ctx.deps.processOperations.runExclusive(id, async () => {
|
|
684
675
|
const process = ctx.deps.processes.getById(id);
|
|
@@ -710,8 +701,20 @@ export async function createExtensionIntegrationHarness(
|
|
|
710
701
|
catalog.piContributions,
|
|
711
702
|
)
|
|
712
703
|
: null;
|
|
704
|
+
const turnId = `trn_${randomUUID()}`;
|
|
705
|
+
if (prepared)
|
|
706
|
+
await persistPiResourceBundleForStart({
|
|
707
|
+
bundlesDir: path.join(
|
|
708
|
+
ctx.config.storage.process_workspaces_dir,
|
|
709
|
+
id,
|
|
710
|
+
".leitwerk",
|
|
711
|
+
"pi-resource-bundles",
|
|
712
|
+
),
|
|
713
|
+
startRecordId: `tsr_${turnId}`,
|
|
714
|
+
digest: prepared.bundle.digest,
|
|
715
|
+
deliveredBundle: prepared.bundle.bytes,
|
|
716
|
+
});
|
|
713
717
|
return ctx.deps.transaction((repos) => {
|
|
714
|
-
const turnId = `trn_${randomUUID()}`;
|
|
715
718
|
const timestamp = new Date().toISOString();
|
|
716
719
|
const input = {
|
|
717
720
|
id: turnId,
|
|
@@ -731,77 +734,11 @@ export async function createExtensionIntegrationHarness(
|
|
|
731
734
|
turnResultMarkdown:
|
|
732
735
|
fixture.execution.status === "succeeded" ? fixture.execution.markdown : null,
|
|
733
736
|
};
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
".leitwerk",
|
|
740
|
-
"pi-resource-bundles",
|
|
741
|
-
);
|
|
742
|
-
mkdirSync(path.join(bundleDir, "starts"), { recursive: true, mode: 0o700 });
|
|
743
|
-
writeFileSync(
|
|
744
|
-
path.join(bundleDir, `${prepared.bundle.digest}.tar`),
|
|
745
|
-
prepared.bundle.bytes,
|
|
746
|
-
{ mode: 0o600 },
|
|
747
|
-
);
|
|
748
|
-
writeFileSync(
|
|
749
|
-
path.join(bundleDir, "starts", `tsr_${turnId}.json`),
|
|
750
|
-
JSON.stringify({
|
|
751
|
-
startRecordId: `tsr_${turnId}`,
|
|
752
|
-
digest: prepared.bundle.digest,
|
|
753
|
-
persistedAt: timestamp,
|
|
754
|
-
}),
|
|
755
|
-
{ mode: 0o600 },
|
|
756
|
-
);
|
|
757
|
-
|
|
758
|
-
createAcceptedLlmTurn(
|
|
759
|
-
{
|
|
760
|
-
...ctx,
|
|
761
|
-
deps: {
|
|
762
|
-
...ctx.deps,
|
|
763
|
-
processes: repos.processes,
|
|
764
|
-
turnRecords: repos.turnRecords,
|
|
765
|
-
turnStarts: repos.turnStarts,
|
|
766
|
-
leases: repos.leases,
|
|
767
|
-
},
|
|
768
|
-
},
|
|
769
|
-
{ ...input, turnType: "llm", modelProfileId: prepared.start.model.profileId },
|
|
770
|
-
{ current: running, preparedStart: prepared?.start },
|
|
771
|
-
);
|
|
772
|
-
} else {
|
|
773
|
-
const lease = repos.leases.create({
|
|
774
|
-
instanceId: id,
|
|
775
|
-
workerId: `wkr_${randomUUID()}`,
|
|
776
|
-
state: running ? "busy" : "exited",
|
|
777
|
-
});
|
|
778
|
-
const start = repos.turnStarts.create({
|
|
779
|
-
instanceId: id,
|
|
780
|
-
turnId: fixture.turnId,
|
|
781
|
-
turnType: "automatic",
|
|
782
|
-
proposedTurnRecordId: turnId,
|
|
783
|
-
startKind: "selected_turn",
|
|
784
|
-
recoveryTurnRecordId: null,
|
|
785
|
-
continuation: null,
|
|
786
|
-
state: {
|
|
787
|
-
kind: "accepted",
|
|
788
|
-
start: { kind: "automatic" },
|
|
789
|
-
turnRecordId: turnId,
|
|
790
|
-
acceptedWorkerLeaseId: lease.id,
|
|
791
|
-
},
|
|
792
|
-
});
|
|
793
|
-
repos.turnRecords.create({
|
|
794
|
-
...input,
|
|
795
|
-
turnType: "automatic",
|
|
796
|
-
turnStartRecordId: start.id,
|
|
797
|
-
acceptedWorkerLeaseId: lease.id,
|
|
798
|
-
});
|
|
799
|
-
if (running)
|
|
800
|
-
repos.processes.update(id, {
|
|
801
|
-
currentExecution: { kind: "worker_start", id: start.id },
|
|
802
|
-
});
|
|
803
|
-
else repos.leases.update(lease.id, { exitedAt: timestamp });
|
|
804
|
-
}
|
|
737
|
+
createAcceptedWorkerTurn(
|
|
738
|
+
{ deps: repos },
|
|
739
|
+
{ ...input, turnType: turn.kind, modelProfileId: prepared?.start.model.profileId },
|
|
740
|
+
{ current: running, preparedStart: prepared?.start },
|
|
741
|
+
);
|
|
805
742
|
if (fixture.execution.status === "succeeded")
|
|
806
743
|
repos.turnAnnotations.create({
|
|
807
744
|
instanceId: id,
|
|
@@ -817,13 +754,9 @@ export async function createExtensionIntegrationHarness(
|
|
|
817
754
|
});
|
|
818
755
|
if (running) repos.processes.update(id, { lifecycleStatus: "active" });
|
|
819
756
|
return observe({
|
|
820
|
-
/** @public */
|
|
821
757
|
id: turnId,
|
|
822
|
-
/** @public */
|
|
823
758
|
instanceId: id,
|
|
824
|
-
/** @public */
|
|
825
759
|
turnId: fixture.turnId,
|
|
826
|
-
/** @public */
|
|
827
760
|
artifact: running ? null : { kind: "turn_result" as const, turnRecordId: turnId },
|
|
828
761
|
});
|
|
829
762
|
});
|
|
@@ -834,7 +767,7 @@ export async function createExtensionIntegrationHarness(
|
|
|
834
767
|
/** Wait with a bounded deadline and final observations on failure. @public */
|
|
835
768
|
waitFor,
|
|
836
769
|
/** Execute one selected worker turn; resolves after durable completion or failure. @public */
|
|
837
|
-
async runTurn(script
|
|
770
|
+
async runTurn(script = { tools: [] }) {
|
|
838
771
|
if (!manual) throw new Error("runTurn requires manual execution mode");
|
|
839
772
|
if (executing.has(id)) throw new Error(`A turn is already running for '${id}'`);
|
|
840
773
|
const before = snapshot();
|
|
@@ -871,22 +804,16 @@ export async function createExtensionIntegrationHarness(
|
|
|
871
804
|
? context().deps.turnAnnotations.findByKey(id, `turn_milestone:${record.id}`)
|
|
872
805
|
: null;
|
|
873
806
|
return observe({
|
|
874
|
-
/** @public */
|
|
875
807
|
turn: record ?? null,
|
|
876
|
-
/** @public */
|
|
877
808
|
outcome:
|
|
878
809
|
typeof milestone?.payload.outcome === "string" ? milestone.payload.outcome : null,
|
|
879
|
-
/** @public */
|
|
880
810
|
failure:
|
|
881
811
|
record?.errorSummary ??
|
|
882
812
|
(after.process.lifecycleStatus === "error"
|
|
883
813
|
? "Worker start failed before acceptance"
|
|
884
814
|
: null),
|
|
885
|
-
/** @public */
|
|
886
815
|
prompts: observations.get(id)?.prompts ?? [],
|
|
887
|
-
/** @public */
|
|
888
816
|
toolResults: observations.get(id)?.toolResults ?? [],
|
|
889
|
-
/** @public */
|
|
890
817
|
result:
|
|
891
818
|
record?.status === "succeeded" && record.turnResultMarkdown
|
|
892
819
|
? { kind: "turn_result" as const, turnRecordId: record.id }
|
|
@@ -899,12 +826,12 @@ export async function createExtensionIntegrationHarness(
|
|
|
899
826
|
}
|
|
900
827
|
},
|
|
901
828
|
/** Execute an application action. @public */
|
|
902
|
-
action: (actionId
|
|
829
|
+
action: (actionId, input = {}) =>
|
|
903
830
|
post(`${prefix}/actions/${encodeURIComponent(actionId)}`, { input }),
|
|
904
831
|
/** Retry the failed execution through the application command. @public */
|
|
905
832
|
retry: () => post(`${prefix}/retry`),
|
|
906
833
|
/** Queue an instruction using the application command and normal delivery. @public */
|
|
907
|
-
async supplyInput(input
|
|
834
|
+
async supplyInput(input) {
|
|
908
835
|
const result = await context().deps.processEngine.queueInputs(id, [
|
|
909
836
|
{
|
|
910
837
|
source: "app_steer",
|
|
@@ -917,30 +844,13 @@ export async function createExtensionIntegrationHarness(
|
|
|
917
844
|
return snapshot();
|
|
918
845
|
},
|
|
919
846
|
/** Answer an open question request. @public */
|
|
920
|
-
answerQuestions: (
|
|
921
|
-
requestId: string,
|
|
922
|
-
answers: readonly {
|
|
923
|
-
/** @public */
|
|
924
|
-
selectedOptionIds: readonly string[];
|
|
925
|
-
/** @public */
|
|
926
|
-
freeText: string;
|
|
927
|
-
/** @public */
|
|
928
|
-
comment: string;
|
|
929
|
-
}[],
|
|
930
|
-
) =>
|
|
847
|
+
answerQuestions: (requestId, answers) =>
|
|
931
848
|
post(`${prefix}/question-requests/${encodeURIComponent(requestId)}/answers`, {
|
|
932
849
|
draft: answers,
|
|
933
850
|
}),
|
|
934
851
|
/** Resolve an open tool approval. @public */
|
|
935
|
-
respondToApproval: (
|
|
936
|
-
requestId
|
|
937
|
-
response: {
|
|
938
|
-
/** @public */
|
|
939
|
-
action: "accept" | "feedback" | "decline";
|
|
940
|
-
/** @public */
|
|
941
|
-
feedback?: string;
|
|
942
|
-
},
|
|
943
|
-
) => post(`${prefix}/tool-approval-requests/${encodeURIComponent(requestId)}`, response),
|
|
852
|
+
respondToApproval: (requestId, response) =>
|
|
853
|
+
post(`${prefix}/tool-approval-requests/${encodeURIComponent(requestId)}`, response),
|
|
944
854
|
};
|
|
945
855
|
}
|
|
946
856
|
return {
|
|
@@ -951,9 +861,10 @@ export async function createExtensionIntegrationHarness(
|
|
|
951
861
|
/** Get a handle that remains valid across restart. @public */
|
|
952
862
|
process: processHandle,
|
|
953
863
|
/** Admit work through a registered UI launcher. @public */
|
|
954
|
-
async launch(id
|
|
864
|
+
async launch(id, input, modelConfig) {
|
|
955
865
|
const response = await postImmediateLaunch(context().config.server.base_url, id, {
|
|
956
866
|
launcherInput: input,
|
|
867
|
+
...(modelConfig ? { modelConfig } : {}),
|
|
957
868
|
});
|
|
958
869
|
const body = (await response.json()) as { process?: { id: string } };
|
|
959
870
|
if (!response.ok || !body.process)
|
|
@@ -961,13 +872,7 @@ export async function createExtensionIntegrationHarness(
|
|
|
961
872
|
return processHandle(body.process.id);
|
|
962
873
|
},
|
|
963
874
|
/** Create validated business data and start an active position through the engine. @public */
|
|
964
|
-
async createProcess
|
|
965
|
-
definition: ExtensionProcessDefinition<TParams, TState>,
|
|
966
|
-
input: Omit<ProcessFixtureOptions<TParams, TState>, "id" | "processId"> & {
|
|
967
|
-
/** @public */
|
|
968
|
-
projects?: readonly ProcessProject[];
|
|
969
|
-
} = {},
|
|
970
|
-
) {
|
|
875
|
+
async createProcess(definition, input = {}) {
|
|
971
876
|
if (catalog.processes.get(definition.id) !== definition)
|
|
972
877
|
throw new Error(`Process '${definition.id}' must be registered by an extension`);
|
|
973
878
|
const fixture = createProcessFixture(input, definition);
|
package/src/index.ts
CHANGED
|
@@ -4,7 +4,9 @@ export { FakeLlmProvider } from "./fakes/fake-llm.js";
|
|
|
4
4
|
export { postImmediateLaunch, postImmediateLaunchRequest } from "./http-launch.js";
|
|
5
5
|
export {
|
|
6
6
|
type FixtureModelProviderSet,
|
|
7
|
+
fixtureModelProfiles,
|
|
7
8
|
fixtureModelProviders,
|
|
9
|
+
withDefaultModelFixture,
|
|
8
10
|
} from "./model-provider-fixtures.js";
|
|
9
11
|
export {
|
|
10
12
|
createPollingTestExtension,
|
|
@@ -2,6 +2,7 @@ import { mkdtempSync, rmSync } from "node:fs";
|
|
|
2
2
|
import { tmpdir } from "node:os";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import type { ExtensionCatalog } from "@leitwerk-dev/extension-runtime";
|
|
5
|
+
import { buildExtensionCatalogFromModules } from "@leitwerk-dev/extension-runtime/testing";
|
|
5
6
|
import type { ProvidedCapability } from "@leitwerk-dev/process-sdk";
|
|
6
7
|
import {
|
|
7
8
|
type AppContext,
|
|
@@ -14,6 +15,18 @@ import {
|
|
|
14
15
|
createInProcessWorkerSpawn,
|
|
15
16
|
type InProcessWorkerSpawnOptions,
|
|
16
17
|
} from "./in-process-worker.js";
|
|
18
|
+
import { withDefaultModelFixture } from "./model-provider-fixtures.js";
|
|
19
|
+
|
|
20
|
+
/** Server fixture with an explicit synthetic model when the test supplies no model catalog. @internal */
|
|
21
|
+
export async function createTestAppContext(options: AppOptions = {}): Promise<AppContext> {
|
|
22
|
+
const config = options.config ?? getDefaultConfig();
|
|
23
|
+
const catalog = await (options.extensionCatalog ?? buildExtensionCatalogFromModules([]));
|
|
24
|
+
return createAppContext({
|
|
25
|
+
...options,
|
|
26
|
+
config,
|
|
27
|
+
extensionCatalog: withDefaultModelFixture(config, catalog),
|
|
28
|
+
});
|
|
29
|
+
}
|
|
17
30
|
|
|
18
31
|
/** @public */
|
|
19
32
|
export interface IntegrationHarness<
|
|
@@ -117,7 +130,10 @@ export async function createIntegrationHarness<
|
|
|
117
130
|
}
|
|
118
131
|
opts.configOverride?.(config);
|
|
119
132
|
|
|
120
|
-
const extensionCatalog =
|
|
133
|
+
const extensionCatalog = withDefaultModelFixture(
|
|
134
|
+
config,
|
|
135
|
+
await Promise.resolve(opts.extensionCatalog),
|
|
136
|
+
);
|
|
121
137
|
|
|
122
138
|
const appOpts: AppOptions = {
|
|
123
139
|
logger: false,
|
package/src/integration.ts
CHANGED
package/src/local-git.ts
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { execFileSync } from "node:child_process";
|
|
2
2
|
import {
|
|
3
|
+
cpSync,
|
|
3
4
|
existsSync,
|
|
4
5
|
lstatSync,
|
|
5
6
|
mkdirSync,
|
|
7
|
+
mkdtempSync,
|
|
6
8
|
readFileSync,
|
|
7
9
|
realpathSync,
|
|
8
10
|
renameSync,
|
|
11
|
+
rmSync,
|
|
9
12
|
writeFileSync,
|
|
10
13
|
} from "node:fs";
|
|
14
|
+
import { tmpdir } from "node:os";
|
|
11
15
|
import path from "node:path";
|
|
12
16
|
import type { RepositoryFeedbackItem, RepositoryPullRequest } from "@leitwerk-dev/process-sdk";
|
|
13
17
|
import { traceTestSubprocess } from "./test-diagnostics.js";
|
|
@@ -33,6 +37,36 @@ export interface LocalRepositorySeed {
|
|
|
33
37
|
signoff?: boolean;
|
|
34
38
|
}
|
|
35
39
|
|
|
40
|
+
/** Copies immutable bare seeds into independent test fixtures. @internal */
|
|
41
|
+
export class LocalGitSeedCache {
|
|
42
|
+
private root: string | undefined;
|
|
43
|
+
private readonly templates = new Map<string, string>();
|
|
44
|
+
|
|
45
|
+
/** Seed options select the template; an existing destination is never overwritten. @internal */
|
|
46
|
+
copy(git: LocalGit, seed: LocalRepositorySeed): string {
|
|
47
|
+
const key = JSON.stringify(seed);
|
|
48
|
+
let template = this.templates.get(key);
|
|
49
|
+
if (!template) {
|
|
50
|
+
this.root ??= mkdtempSync(path.join(tmpdir(), "leitwerk-git-seeds-"));
|
|
51
|
+
const directory = mkdtempSync(path.join(this.root, "seed-"));
|
|
52
|
+
template = new LocalGit(directory).seed(seed).bare;
|
|
53
|
+
this.templates.set(key, template);
|
|
54
|
+
}
|
|
55
|
+
const destination = localPath(git.root, `repositories/${path.basename(template)}`);
|
|
56
|
+
if (existsSync(destination)) throw new Error("Git seed destination already exists");
|
|
57
|
+
mkdirSync(path.dirname(destination), { recursive: true });
|
|
58
|
+
cpSync(template, destination, { recursive: true, force: false, errorOnExist: true });
|
|
59
|
+
return destination;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** Release templates after the suite; copied repositories remain usable. @internal */
|
|
63
|
+
close(): void {
|
|
64
|
+
if (this.root) rmSync(this.root, { recursive: true, force: true });
|
|
65
|
+
this.root = undefined;
|
|
66
|
+
this.templates.clear();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
36
70
|
/** Reject escaping paths and symlinks, including a not-yet-created file's parents. @public */
|
|
37
71
|
export function localPath(root: string, relative: string): string {
|
|
38
72
|
if (lstatSync(root, { throwIfNoEntry: false })?.isSymbolicLink())
|
|
@@ -1,8 +1,22 @@
|
|
|
1
|
+
import type { ExtensionCatalog } from "@leitwerk-dev/extension-runtime";
|
|
1
2
|
import {
|
|
2
3
|
builtinPiProvider,
|
|
3
4
|
defineModelProvider,
|
|
4
5
|
defineModelProviders,
|
|
5
6
|
} from "@leitwerk-dev/process-sdk";
|
|
7
|
+
import type { ConfigSnapshot } from "@leitwerk-dev/protocol";
|
|
8
|
+
import type { ExtensionIntegrationHarnessOptions } from "./extension-integration-harness.js";
|
|
9
|
+
|
|
10
|
+
/** @internal */
|
|
11
|
+
export const fixtureModelProfiles: NonNullable<ExtensionIntegrationHarnessOptions["models"]> = [
|
|
12
|
+
{
|
|
13
|
+
id: "claude_fast",
|
|
14
|
+
thinkingLevel: "medium",
|
|
15
|
+
provider: "anthropic",
|
|
16
|
+
modelId: "claude-sonnet-4-20250514",
|
|
17
|
+
},
|
|
18
|
+
{ id: "local_qwen", thinkingLevel: "low", provider: "ollama", modelId: "qwen2.5-coder:14b" },
|
|
19
|
+
];
|
|
6
20
|
|
|
7
21
|
/** @public */
|
|
8
22
|
export type FixtureModelProviderSet = ReturnType<typeof defineModelProviders>;
|
|
@@ -34,3 +48,29 @@ export function fixtureModelProviders(
|
|
|
34
48
|
})),
|
|
35
49
|
);
|
|
36
50
|
}
|
|
51
|
+
|
|
52
|
+
/** Explicit model wiring for server tests that do not exercise an LLM. @internal */
|
|
53
|
+
export function withDefaultModelFixture(
|
|
54
|
+
config: ConfigSnapshot,
|
|
55
|
+
catalog: ExtensionCatalog,
|
|
56
|
+
): ExtensionCatalog {
|
|
57
|
+
if (config.pi.model_profiles.length === 0 && !config.pi.default_model_profile) {
|
|
58
|
+
config.pi.default_model_profile = "test-support-fixture";
|
|
59
|
+
config.pi.model_profiles = [
|
|
60
|
+
{ id: "test-support-fixture", provider: "test-support-fixture", model_id: "fixture" },
|
|
61
|
+
];
|
|
62
|
+
}
|
|
63
|
+
if (!config.pi.model_profiles.some((profile) => profile.provider === "test-support-fixture"))
|
|
64
|
+
return catalog;
|
|
65
|
+
return {
|
|
66
|
+
...catalog,
|
|
67
|
+
modelProviders: [
|
|
68
|
+
...catalog.modelProviders,
|
|
69
|
+
{
|
|
70
|
+
ownerExtensionId: "test-support-fixture",
|
|
71
|
+
packageName: "@leitwerk-dev/test-support",
|
|
72
|
+
resolve: fixtureModelProviders({ id: "test-support-fixture", modelId: "fixture" }),
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
};
|
|
76
|
+
}
|