@leitwerk-dev/test-support 0.1.9 → 0.2.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-KIDBCGNW.js → chunk-2PCDTYVH.js} +26 -26
- package/dist/chunk-2PCDTYVH.js.map +1 -0
- package/dist/chunk-5BZSJ4OO.js +192 -0
- package/dist/chunk-5BZSJ4OO.js.map +1 -0
- package/dist/{chunk-QFCJV2VA.js → chunk-ECAWLVYB.js} +224 -17
- package/dist/chunk-ECAWLVYB.js.map +1 -0
- package/dist/{chunk-JUH3LUYK.js → chunk-EXHTWQAE.js} +5 -1
- package/dist/chunk-EXHTWQAE.js.map +1 -0
- package/dist/compact-process-detail-fixture.d.ts +3 -0
- package/dist/compact-process-detail-fixture.d.ts.map +1 -1
- package/dist/fakes/fake-git-ops.d.ts +12 -0
- package/dist/fakes/fake-git-ops.d.ts.map +1 -1
- package/dist/fakes/fake-llm.d.ts +11 -0
- package/dist/fakes/fake-llm.d.ts.map +1 -1
- package/dist/fakes/index.d.ts +1 -1
- package/dist/fakes/index.d.ts.map +1 -1
- package/dist/fakes/index.js +111 -2
- package/dist/fakes/index.js.map +1 -1
- package/dist/fixtures.js +137 -2
- package/dist/fixtures.js.map +1 -1
- package/dist/http-launch.d.ts +9 -0
- package/dist/http-launch.d.ts.map +1 -0
- package/dist/index.d.ts +24 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +113 -12
- package/dist/index.js.map +1 -1
- package/dist/integration-harness.d.ts +36 -1
- package/dist/integration-harness.d.ts.map +1 -1
- package/dist/integration.d.ts +3 -3
- package/dist/integration.d.ts.map +1 -1
- package/dist/integration.js +184 -4
- package/dist/integration.js.map +1 -1
- package/dist/local-git.d.ts +231 -0
- package/dist/local-git.d.ts.map +1 -0
- package/dist/local-git.js +428 -0
- package/dist/local-git.js.map +1 -0
- package/dist/model-provider-fixtures.d.ts +15 -0
- package/dist/model-provider-fixtures.d.ts.map +1 -0
- package/dist/polling.d.ts +2 -1
- package/dist/polling.d.ts.map +1 -1
- package/dist/process-driver.d.ts +14 -0
- package/dist/process-driver.d.ts.map +1 -0
- package/dist/question-fixtures.d.ts +2 -0
- package/dist/question-fixtures.d.ts.map +1 -1
- package/dist/server-extension-test-harness.d.ts +57 -2
- package/dist/server-extension-test-harness.d.ts.map +1 -1
- package/dist/stub-worker-entry.js +9 -5
- package/dist/stub-worker-entry.js.map +1 -1
- package/dist/test-diagnostics.d.ts +14 -0
- package/dist/test-diagnostics.d.ts.map +1 -0
- package/dist/worker-testing/in-process-worker-spawn.d.ts +21 -0
- package/dist/worker-testing/in-process-worker-spawn.d.ts.map +1 -1
- package/dist/worker-testing/index.d.ts +6 -7
- package/dist/worker-testing/index.d.ts.map +1 -1
- package/dist/worker-testing/index.js +381 -7
- package/dist/worker-testing/index.js.map +1 -1
- package/dist/worker-testing/schema-driven-stub-pi.d.ts +5 -0
- package/dist/worker-testing/schema-driven-stub-pi.d.ts.map +1 -1
- package/dist/worker-testing/stub-pi-controls.d.ts +4 -0
- package/dist/worker-testing/stub-pi-controls.d.ts.map +1 -1
- package/dist/worker-testing/stub-pi-tree-handle.d.ts +93 -1
- package/dist/worker-testing/stub-pi-tree-handle.d.ts.map +1 -1
- package/dist/worker-testing/worker-runtime-harness.d.ts +37 -2
- package/dist/worker-testing/worker-runtime-harness.d.ts.map +1 -1
- package/dist/worker-testing/worker-start-payload.d.ts +17 -1
- package/dist/worker-testing/worker-start-payload.d.ts.map +1 -1
- package/package.json +15 -9
- package/src/compact-process-detail-fixture.ts +37 -3
- package/src/fakes/fake-git-ops.ts +12 -0
- package/src/fakes/fake-llm.ts +11 -0
- package/src/fakes/index.ts +1 -1
- package/src/http-launch.ts +88 -0
- package/src/index.ts +31 -41
- package/src/integration-harness.ts +100 -9
- package/src/integration.ts +3 -9
- package/src/local-git.ts +499 -0
- package/src/model-provider-fixtures.ts +36 -0
- package/src/polling.ts +3 -2
- package/src/process-driver.ts +63 -0
- package/src/question-fixtures.ts +2 -0
- package/src/server-extension-test-harness.ts +100 -6
- package/src/test-diagnostics.ts +69 -0
- package/src/worker-testing/in-process-worker-spawn.ts +49 -2
- package/src/worker-testing/index.ts +4 -26
- package/src/worker-testing/schema-driven-stub-pi.ts +8 -1
- package/src/worker-testing/stub-pi-controls.ts +4 -0
- package/src/worker-testing/stub-pi-tree-handle.ts +301 -21
- package/src/worker-testing/worker-runtime-harness.ts +57 -6
- package/src/worker-testing/worker-start-payload.ts +18 -1
- package/dist/chunk-3MQO3NCX.js +0 -15
- package/dist/chunk-3MQO3NCX.js.map +0 -1
- package/dist/chunk-7ZK5QRGP.js +0 -98
- package/dist/chunk-7ZK5QRGP.js.map +0 -1
- package/dist/chunk-JUH3LUYK.js.map +0 -1
- package/dist/chunk-KIDBCGNW.js.map +0 -1
- package/dist/chunk-QFCJV2VA.js.map +0 -1
- package/dist/chunk-R4KVUGWR.js +0 -83
- package/dist/chunk-R4KVUGWR.js.map +0 -1
- package/dist/chunk-ST2C4VKX.js +0 -297
- package/dist/chunk-ST2C4VKX.js.map +0 -1
- package/dist/compact-process-detail-fixture.js +0 -73
- package/dist/compact-process-detail-fixture.js.map +0 -1
- package/dist/fakes/fake-git-ops.js +0 -101
- package/dist/fakes/fake-git-ops.js.map +0 -1
- package/dist/fakes/fake-llm.js +0 -27
- package/dist/fakes/fake-llm.js.map +0 -1
- package/dist/in-process-worker.js +0 -2
- package/dist/in-process-worker.js.map +0 -1
- package/dist/integration-harness.js +0 -38
- package/dist/integration-harness.js.map +0 -1
- package/dist/polling.js +0 -14
- package/dist/polling.js.map +0 -1
- package/dist/question-fixtures.js +0 -26
- package/dist/question-fixtures.js.map +0 -1
- package/dist/server-extension-test-harness.js +0 -169
- package/dist/server-extension-test-harness.js.map +0 -1
- package/dist/test-app.d.ts +0 -23
- package/dist/test-app.d.ts.map +0 -1
- package/dist/test-app.js +0 -47
- package/dist/test-app.js.map +0 -1
- package/dist/worker-testing/in-process-worker-spawn.js +0 -61
- package/dist/worker-testing/in-process-worker-spawn.js.map +0 -1
- package/dist/worker-testing/ipc-harness.d.ts +0 -11
- package/dist/worker-testing/ipc-harness.d.ts.map +0 -1
- package/dist/worker-testing/ipc-harness.js +0 -17
- package/dist/worker-testing/ipc-harness.js.map +0 -1
- package/dist/worker-testing/schema-driven-stub-pi.js +0 -65
- package/dist/worker-testing/schema-driven-stub-pi.js.map +0 -1
- package/dist/worker-testing/stub-pi-controls.js +0 -10
- package/dist/worker-testing/stub-pi-controls.js.map +0 -1
- package/dist/worker-testing/stub-pi-tree-handle.js +0 -515
- package/dist/worker-testing/stub-pi-tree-handle.js.map +0 -1
- package/dist/worker-testing/worker-runtime-harness.js +0 -231
- package/dist/worker-testing/worker-runtime-harness.js.map +0 -1
- package/dist/worker-testing/worker-start-payload.js +0 -101
- package/dist/worker-testing/worker-start-payload.js.map +0 -1
- package/dist/workspace-source-aliases.d.ts +0 -6
- package/dist/workspace-source-aliases.d.ts.map +0 -1
- package/dist/workspace-source-aliases.js +0 -126
- package/dist/workspace-source-aliases.js.map +0 -1
- package/src/test-app.ts +0 -82
- package/src/worker-testing/ipc-harness.ts +0 -19
- package/src/workspace-source-aliases.ts +0 -171
|
@@ -2,10 +2,13 @@
|
|
|
2
2
|
var FakeLlmProvider = class {
|
|
3
3
|
handlers = [];
|
|
4
4
|
callIndex = 0;
|
|
5
|
+
/** @public */
|
|
5
6
|
calls = [];
|
|
7
|
+
/** @public */
|
|
6
8
|
onPrompt(handler) {
|
|
7
9
|
this.handlers.push(handler);
|
|
8
10
|
}
|
|
11
|
+
/** @public */
|
|
9
12
|
respond(prompt) {
|
|
10
13
|
this.calls.push(prompt);
|
|
11
14
|
const handler = this.handlers[this.callIndex % this.handlers.length];
|
|
@@ -15,6 +18,7 @@ var FakeLlmProvider = class {
|
|
|
15
18
|
}
|
|
16
19
|
return { content: "No handler registered for this prompt." };
|
|
17
20
|
}
|
|
21
|
+
/** @internal */
|
|
18
22
|
reset() {
|
|
19
23
|
this.handlers = [];
|
|
20
24
|
this.callIndex = 0;
|
|
@@ -25,4 +29,4 @@ var FakeLlmProvider = class {
|
|
|
25
29
|
export {
|
|
26
30
|
FakeLlmProvider
|
|
27
31
|
};
|
|
28
|
-
//# sourceMappingURL=chunk-
|
|
32
|
+
//# sourceMappingURL=chunk-EXHTWQAE.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/fakes/fake-llm.ts"],"sourcesContent":["/** @public */\nexport interface LlmResponse {\n\t/** @public */\n\tcontent: string;\n\t/** @public */\n\ttoolCalls?: Array<{\n\t\t/** @public */\n\t\tname: string;\n\t\t/** @public */\n\t\targuments: Record<string, unknown>;\n\t}>;\n}\n\n/** @public */\nexport type LlmHandler = (prompt: string) => LlmResponse;\n\n/**\n * Deterministic in-memory LLM fake for automated system tests.\n * Responds with scripted outputs based on registered handlers.\n */\n/** @public */\nexport class FakeLlmProvider {\n\tprivate handlers: LlmHandler[] = [];\n\tprivate callIndex = 0;\n\t/** @public */\n\treadonly calls: string[] = [];\n\n\t/** @public */\n\tonPrompt(handler: LlmHandler): void {\n\t\tthis.handlers.push(handler);\n\t}\n\n\t/** @public */\n\trespond(prompt: string): LlmResponse {\n\t\tthis.calls.push(prompt);\n\t\tconst handler = this.handlers[this.callIndex % this.handlers.length];\n\t\tif (handler) {\n\t\t\tthis.callIndex++;\n\t\t\treturn handler(prompt);\n\t\t}\n\t\treturn { content: \"No handler registered for this prompt.\" };\n\t}\n\n\t/** @internal */\n\treset(): void {\n\t\tthis.handlers = [];\n\t\tthis.callIndex = 0;\n\t\tthis.calls.length = 0;\n\t}\n}\n"],"mappings":";AAqBO,IAAM,kBAAN,MAAsB;AAAA,EACpB,WAAyB,CAAC;AAAA,EAC1B,YAAY;AAAA;AAAA,EAEX,QAAkB,CAAC;AAAA;AAAA,EAG5B,SAAS,SAA2B;AACnC,SAAK,SAAS,KAAK,OAAO;AAAA,EAC3B;AAAA;AAAA,EAGA,QAAQ,QAA6B;AACpC,SAAK,MAAM,KAAK,MAAM;AACtB,UAAM,UAAU,KAAK,SAAS,KAAK,YAAY,KAAK,SAAS,MAAM;AACnE,QAAI,SAAS;AACZ,WAAK;AACL,aAAO,QAAQ,MAAM;AAAA,IACtB;AACA,WAAO,EAAE,SAAS,yCAAyC;AAAA,EAC5D;AAAA;AAAA,EAGA,QAAc;AACb,SAAK,WAAW,CAAC;AACjB,SAAK,YAAY;AACjB,SAAK,MAAM,SAAS;AAAA,EACrB;AACD;","names":[]}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { type ProcessDetailUiSnapshotResponseBody, type TurnReasoningDetailResponseBody } from "@leitwerk-dev/protocol";
|
|
2
|
+
/** @internal */
|
|
2
3
|
export declare function createCompactProcessDetailFixtureFactory(): {
|
|
4
|
+
/** @internal */
|
|
3
5
|
compact: (input: unknown) => ProcessDetailUiSnapshotResponseBody;
|
|
6
|
+
/** @internal */
|
|
4
7
|
reasoningResponse: (instanceId: string, turnRecordId: string) => TurnReasoningDetailResponseBody;
|
|
5
8
|
};
|
|
6
9
|
//# sourceMappingURL=compact-process-detail-fixture.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compact-process-detail-fixture.d.ts","sourceRoot":"","sources":["../src/compact-process-detail-fixture.ts"],"names":[],"mappings":"AASA,OAAO,
|
|
1
|
+
{"version":3,"file":"compact-process-detail-fixture.d.ts","sourceRoot":"","sources":["../src/compact-process-detail-fixture.ts"],"names":[],"mappings":"AASA,OAAO,EAIN,KAAK,mCAAmC,EACxC,KAAK,+BAA+B,EAEpC,MAAM,wBAAwB,CAAC;AA2BhC,gBAAgB;AAChB,wBAAgB,wCAAwC;IAqGtD,gBAAgB;qBA1FO,OAAO,KAAG,mCAAmC;IA4FpE,gBAAgB;oCAjBJ,MAAM,gBACJ,MAAM,KAClB,+BAA+B;EAkBlC"}
|
|
@@ -1,22 +1,34 @@
|
|
|
1
|
+
/** @internal */
|
|
1
2
|
export type RepoTemplate = Record<string, string>;
|
|
2
3
|
/**
|
|
3
4
|
* Structurally compatible with RunRootGitOps — call sites annotate
|
|
4
5
|
* `const git: RunRootGitOps = new FakeGitOps(...)` so TS catches drift.
|
|
5
6
|
*/
|
|
7
|
+
/** @internal */
|
|
6
8
|
export declare class FakeGitOps {
|
|
7
9
|
private readonly templates;
|
|
10
|
+
/** @internal */
|
|
8
11
|
readonly operations: string[];
|
|
9
12
|
private readonly files;
|
|
10
13
|
private readonly repoState;
|
|
14
|
+
/** @internal */
|
|
11
15
|
constructor(templates: Map<string, RepoTemplate>);
|
|
12
16
|
private abs;
|
|
17
|
+
/** @internal */
|
|
13
18
|
writeFile(repoDir: string, filePath: string, content: string): Promise<void>;
|
|
19
|
+
/** @internal */
|
|
14
20
|
readFile(repoDir: string, filePath: string): Promise<string | null>;
|
|
21
|
+
/** @internal */
|
|
15
22
|
clone(repoLocator: string, targetDir: string): Promise<void>;
|
|
23
|
+
/** @internal */
|
|
16
24
|
checkout(repoDir: string, branch: string): Promise<void>;
|
|
25
|
+
/** @internal */
|
|
17
26
|
createBranch(repoDir: string, branchName: string, _startPoint: string): Promise<void>;
|
|
27
|
+
/** @internal */
|
|
18
28
|
branchExists(repoDir: string, branchName: string): Promise<boolean>;
|
|
29
|
+
/** @internal */
|
|
19
30
|
getHeadSha(repoDir: string): Promise<string>;
|
|
31
|
+
/** @internal */
|
|
20
32
|
listFiles(repoDir: string, pattern: string): Promise<string[]>;
|
|
21
33
|
}
|
|
22
34
|
//# sourceMappingURL=fake-git-ops.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fake-git-ops.d.ts","sourceRoot":"","sources":["../../src/fakes/fake-git-ops.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAElD;;;GAGG;AACH,qBAAa,UAAU;
|
|
1
|
+
{"version":3,"file":"fake-git-ops.d.ts","sourceRoot":"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AAC;IAWlD,gBAAgB;IACV,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAyBpE"}
|
package/dist/fakes/fake-llm.d.ts
CHANGED
|
@@ -1,21 +1,32 @@
|
|
|
1
|
+
/** @public */
|
|
1
2
|
export interface LlmResponse {
|
|
3
|
+
/** @public */
|
|
2
4
|
content: string;
|
|
5
|
+
/** @public */
|
|
3
6
|
toolCalls?: Array<{
|
|
7
|
+
/** @public */
|
|
4
8
|
name: string;
|
|
9
|
+
/** @public */
|
|
5
10
|
arguments: Record<string, unknown>;
|
|
6
11
|
}>;
|
|
7
12
|
}
|
|
13
|
+
/** @public */
|
|
8
14
|
export type LlmHandler = (prompt: string) => LlmResponse;
|
|
9
15
|
/**
|
|
10
16
|
* Deterministic in-memory LLM fake for automated system tests.
|
|
11
17
|
* Responds with scripted outputs based on registered handlers.
|
|
12
18
|
*/
|
|
19
|
+
/** @public */
|
|
13
20
|
export declare class FakeLlmProvider {
|
|
14
21
|
private handlers;
|
|
15
22
|
private callIndex;
|
|
23
|
+
/** @public */
|
|
16
24
|
readonly calls: string[];
|
|
25
|
+
/** @public */
|
|
17
26
|
onPrompt(handler: LlmHandler): void;
|
|
27
|
+
/** @public */
|
|
18
28
|
respond(prompt: string): LlmResponse;
|
|
29
|
+
/** @internal */
|
|
19
30
|
reset(): void;
|
|
20
31
|
}
|
|
21
32
|
//# sourceMappingURL=fake-llm.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fake-llm.d.ts","sourceRoot":"","sources":["../../src/fakes/fake-llm.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,KAAK,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACnC,CAAC,CAAC;CACH;AAED,MAAM,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,MAAM,KAAK,WAAW,CAAC;AAEzD;;;GAGG;AACH,qBAAa,eAAe;IAC3B,OAAO,CAAC,QAAQ,CAAoB;IACpC,OAAO,CAAC,SAAS,CAAK;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,CAAM;IAE9B,QAAQ,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI;IAInC,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW;IAUpC,KAAK,IAAI,IAAI;CAKb"}
|
|
1
|
+
{"version":3,"file":"fake-llm.d.ts","sourceRoot":"","sources":["../../src/fakes/fake-llm.ts"],"names":[],"mappings":"AAAA,cAAc;AACd,MAAM,WAAW,WAAW;IAC3B,cAAc;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc;IACd,SAAS,CAAC,EAAE,KAAK,CAAC;QACjB,cAAc;QACd,IAAI,EAAE,MAAM,CAAC;QACb,cAAc;QACd,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACnC,CAAC,CAAC;CACH;AAED,cAAc;AACd,MAAM,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,MAAM,KAAK,WAAW,CAAC;AAEzD;;;GAGG;AACH,cAAc;AACd,qBAAa,eAAe;IAC3B,OAAO,CAAC,QAAQ,CAAoB;IACpC,OAAO,CAAC,SAAS,CAAK;IACtB,cAAc;IACd,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,CAAM;IAE9B,cAAc;IACd,QAAQ,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI;IAInC,cAAc;IACd,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW;IAUpC,gBAAgB;IAChB,KAAK,IAAI,IAAI;CAKb"}
|
package/dist/fakes/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fakes/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fakes/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/fakes/index.js
CHANGED
|
@@ -1,3 +1,112 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
FakeLlmProvider
|
|
3
|
+
} from "../chunk-EXHTWQAE.js";
|
|
4
|
+
|
|
5
|
+
// src/fakes/fake-git-ops.ts
|
|
6
|
+
import path from "path";
|
|
7
|
+
var FakeGitOps = class {
|
|
8
|
+
/** @internal */
|
|
9
|
+
constructor(templates) {
|
|
10
|
+
this.templates = templates;
|
|
11
|
+
}
|
|
12
|
+
templates;
|
|
13
|
+
/** @internal */
|
|
14
|
+
operations = [];
|
|
15
|
+
files = /* @__PURE__ */ new Map();
|
|
16
|
+
repoState = /* @__PURE__ */ new Map();
|
|
17
|
+
abs(repoDir, filePath) {
|
|
18
|
+
return path.normalize(path.join(repoDir, filePath));
|
|
19
|
+
}
|
|
20
|
+
/** @internal */
|
|
21
|
+
async writeFile(repoDir, filePath, content) {
|
|
22
|
+
this.operations.push(`writeFile:${filePath}`);
|
|
23
|
+
this.files.set(this.abs(repoDir, filePath), content);
|
|
24
|
+
}
|
|
25
|
+
/** @internal */
|
|
26
|
+
async readFile(repoDir, filePath) {
|
|
27
|
+
return this.files.get(this.abs(repoDir, filePath)) ?? null;
|
|
28
|
+
}
|
|
29
|
+
/** @internal */
|
|
30
|
+
async clone(repoLocator, targetDir) {
|
|
31
|
+
this.operations.push(`clone:${path.basename(targetDir)}`);
|
|
32
|
+
const n = path.normalize(targetDir);
|
|
33
|
+
const prefix = n + path.sep;
|
|
34
|
+
for (const k of [...this.files.keys()]) {
|
|
35
|
+
if (k === n || k.startsWith(prefix)) {
|
|
36
|
+
this.files.delete(k);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
const tmpl = this.templates.get(repoLocator);
|
|
40
|
+
if (!tmpl) {
|
|
41
|
+
throw new Error(`unknown repo ${repoLocator}`);
|
|
42
|
+
}
|
|
43
|
+
for (const [rel, content] of Object.entries(tmpl)) {
|
|
44
|
+
this.files.set(path.join(targetDir, rel), content);
|
|
45
|
+
}
|
|
46
|
+
this.repoState.set(n, {
|
|
47
|
+
currentBranch: "main",
|
|
48
|
+
branches: /* @__PURE__ */ new Set(["main"])
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
/** @internal */
|
|
52
|
+
async checkout(repoDir, branch) {
|
|
53
|
+
const st = this.repoState.get(path.normalize(repoDir));
|
|
54
|
+
if (!st) {
|
|
55
|
+
throw new Error("not a repo");
|
|
56
|
+
}
|
|
57
|
+
st.branches.add(branch);
|
|
58
|
+
st.currentBranch = branch;
|
|
59
|
+
}
|
|
60
|
+
/** @internal */
|
|
61
|
+
async createBranch(repoDir, branchName, _startPoint) {
|
|
62
|
+
const st = this.repoState.get(path.normalize(repoDir));
|
|
63
|
+
if (!st) {
|
|
64
|
+
throw new Error("not a repo");
|
|
65
|
+
}
|
|
66
|
+
st.branches.add(branchName);
|
|
67
|
+
}
|
|
68
|
+
/** @internal */
|
|
69
|
+
async branchExists(repoDir, branchName) {
|
|
70
|
+
const st = this.repoState.get(path.normalize(repoDir));
|
|
71
|
+
return st?.branches.has(branchName) ?? false;
|
|
72
|
+
}
|
|
73
|
+
/** @internal */
|
|
74
|
+
async getHeadSha(repoDir) {
|
|
75
|
+
const st = this.repoState.get(path.normalize(repoDir));
|
|
76
|
+
if (!st) {
|
|
77
|
+
throw new Error("not a repo");
|
|
78
|
+
}
|
|
79
|
+
return Buffer.from(`${repoDir}:${st.currentBranch}`).toString("hex").slice(0, 40).padEnd(40, "0");
|
|
80
|
+
}
|
|
81
|
+
/** @internal */
|
|
82
|
+
async listFiles(repoDir, pattern) {
|
|
83
|
+
const normRoot = path.normalize(repoDir);
|
|
84
|
+
const prefix = normRoot + path.sep;
|
|
85
|
+
const out = [];
|
|
86
|
+
for (const k of this.files.keys()) {
|
|
87
|
+
if (k !== normRoot && !k.startsWith(prefix)) {
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
const rel = k === normRoot ? "" : k.slice(prefix.length);
|
|
91
|
+
if (!rel) {
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
const relPosix = rel.split(path.sep).join("/");
|
|
95
|
+
if (pattern === "**/AGENTS.md") {
|
|
96
|
+
if (relPosix.endsWith("AGENTS.md")) {
|
|
97
|
+
out.push(relPosix);
|
|
98
|
+
}
|
|
99
|
+
} else if (pattern === "**/.cursor/skills/**/SKILL.md") {
|
|
100
|
+
if (/^\.cursor\/skills\/[^/]+\/SKILL\.md$/.test(relPosix)) {
|
|
101
|
+
out.push(relPosix);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return out.sort((a, b) => a.localeCompare(b));
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
export {
|
|
109
|
+
FakeGitOps,
|
|
110
|
+
FakeLlmProvider
|
|
111
|
+
};
|
|
3
112
|
//# sourceMappingURL=index.js.map
|
package/dist/fakes/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../src/fakes/fake-git-ops.ts"],"sourcesContent":["import path from \"node:path\";\n\n/** @internal */\nexport type RepoTemplate = Record<string, string>;\n\n/**\n * Structurally compatible with RunRootGitOps — call sites annotate\n * `const git: RunRootGitOps = new FakeGitOps(...)` so TS catches drift.\n */\n/** @internal */\nexport class FakeGitOps {\n\t/** @internal */\n\treadonly operations: string[] = [];\n\tprivate readonly files = new Map<string, string>();\n\tprivate readonly repoState = new Map<string, { currentBranch: string; branches: Set<string> }>();\n\n\t/** @internal */\n\tconstructor(private readonly templates: Map<string, RepoTemplate>) {}\n\n\tprivate abs(repoDir: string, filePath: string): string {\n\t\treturn path.normalize(path.join(repoDir, filePath));\n\t}\n\n\t/** @internal */\n\tasync writeFile(repoDir: string, filePath: string, content: string): Promise<void> {\n\t\tthis.operations.push(`writeFile:${filePath}`);\n\t\tthis.files.set(this.abs(repoDir, filePath), content);\n\t}\n\n\t/** @internal */\n\tasync readFile(repoDir: string, filePath: string): Promise<string | null> {\n\t\treturn this.files.get(this.abs(repoDir, filePath)) ?? null;\n\t}\n\n\t/** @internal */\n\tasync clone(repoLocator: string, targetDir: string): Promise<void> {\n\t\tthis.operations.push(`clone:${path.basename(targetDir)}`);\n\t\tconst n = path.normalize(targetDir);\n\t\tconst prefix = n + path.sep;\n\t\tfor (const k of [...this.files.keys()]) {\n\t\t\tif (k === n || k.startsWith(prefix)) {\n\t\t\t\tthis.files.delete(k);\n\t\t\t}\n\t\t}\n\t\tconst tmpl = this.templates.get(repoLocator);\n\t\tif (!tmpl) {\n\t\t\tthrow new Error(`unknown repo ${repoLocator}`);\n\t\t}\n\t\tfor (const [rel, content] of Object.entries(tmpl)) {\n\t\t\tthis.files.set(path.join(targetDir, rel), content);\n\t\t}\n\t\tthis.repoState.set(n, {\n\t\t\tcurrentBranch: \"main\",\n\t\t\tbranches: new Set([\"main\"]),\n\t\t});\n\t}\n\n\t/** @internal */\n\tasync checkout(repoDir: string, branch: string): Promise<void> {\n\t\tconst st = this.repoState.get(path.normalize(repoDir));\n\t\tif (!st) {\n\t\t\tthrow new Error(\"not a repo\");\n\t\t}\n\t\tst.branches.add(branch);\n\t\tst.currentBranch = branch;\n\t}\n\n\t/** @internal */\n\tasync createBranch(repoDir: string, branchName: string, _startPoint: string): Promise<void> {\n\t\tconst st = this.repoState.get(path.normalize(repoDir));\n\t\tif (!st) {\n\t\t\tthrow new Error(\"not a repo\");\n\t\t}\n\t\tst.branches.add(branchName);\n\t}\n\n\t/** @internal */\n\tasync branchExists(repoDir: string, branchName: string): Promise<boolean> {\n\t\tconst st = this.repoState.get(path.normalize(repoDir));\n\t\treturn st?.branches.has(branchName) ?? false;\n\t}\n\n\t/** @internal */\n\tasync getHeadSha(repoDir: string): Promise<string> {\n\t\tconst st = this.repoState.get(path.normalize(repoDir));\n\t\tif (!st) {\n\t\t\tthrow new Error(\"not a repo\");\n\t\t}\n\t\treturn Buffer.from(`${repoDir}:${st.currentBranch}`)\n\t\t\t.toString(\"hex\")\n\t\t\t.slice(0, 40)\n\t\t\t.padEnd(40, \"0\");\n\t}\n\n\t/** @internal */\n\tasync listFiles(repoDir: string, pattern: string): Promise<string[]> {\n\t\tconst normRoot = path.normalize(repoDir);\n\t\tconst prefix = normRoot + path.sep;\n\t\tconst out: string[] = [];\n\t\tfor (const k of this.files.keys()) {\n\t\t\tif (k !== normRoot && !k.startsWith(prefix)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst rel = k === normRoot ? \"\" : k.slice(prefix.length);\n\t\t\tif (!rel) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst relPosix = rel.split(path.sep).join(\"/\");\n\t\t\tif (pattern === \"**/AGENTS.md\") {\n\t\t\t\tif (relPosix.endsWith(\"AGENTS.md\")) {\n\t\t\t\t\tout.push(relPosix);\n\t\t\t\t}\n\t\t\t} else if (pattern === \"**/.cursor/skills/**/SKILL.md\") {\n\t\t\t\tif (/^\\.cursor\\/skills\\/[^/]+\\/SKILL\\.md$/.test(relPosix)) {\n\t\t\t\t\tout.push(relPosix);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn out.sort((a, b) => a.localeCompare(b));\n\t}\n}\n"],"mappings":";;;;;AAAA,OAAO,UAAU;AAUV,IAAM,aAAN,MAAiB;AAAA;AAAA,EAOvB,YAA6B,WAAsC;AAAtC;AAAA,EAAuC;AAAA,EAAvC;AAAA;AAAA,EALpB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W,IAAI,MAAM,KAAK,GAAG,EAAE,KAAK,GAAG;AAC7C,UAAI,YAAY,gBAAgB;AAC/B,YAAI,SAAS,SAAS,WAAW,GAAG;AACnC,cAAI,KAAK,QAAQ;AAAA,QAClB;AAAA,MACD,WAAW,YAAY,iCAAiC;AACvD,YAAI,uCAAuC,KAAK,QAAQ,GAAG;AAC1D,cAAI,KAAK,QAAQ;AAAA,QAClB;AAAA,MACD;AAAA,IACD;AACA,WAAO,IAAI,KAAK,CAAC,GAAG,MAAM,EAAE,cAAc,CAAC,CAAC;AAAA,EAC7C;AACD;","names":[]}
|
package/dist/fixtures.js
CHANGED
|
@@ -1,3 +1,138 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
// src/compact-process-detail-fixture.ts
|
|
2
|
+
import {
|
|
3
|
+
createReadonlyEntryTree
|
|
4
|
+
} from "@leitwerk-dev/protocol";
|
|
5
|
+
import {
|
|
6
|
+
buildProcessUiSnapshotProjections,
|
|
7
|
+
buildTurnTraceIndexFromSession
|
|
8
|
+
} from "@leitwerk-dev/server/testing";
|
|
9
|
+
var EMPTY_TRACE = {
|
|
10
|
+
assistant: { text: "", thinking: "", lastUpdatedAt: null },
|
|
11
|
+
toolCalls: [],
|
|
12
|
+
traceItems: [],
|
|
13
|
+
usage: null,
|
|
14
|
+
piInput: null
|
|
15
|
+
};
|
|
16
|
+
function createCompactProcessDetailFixtureFactory() {
|
|
17
|
+
const reasoningSourceByInstanceId = /* @__PURE__ */ new Map();
|
|
18
|
+
function compact(input) {
|
|
19
|
+
const legacy = input;
|
|
20
|
+
if (!Array.isArray(legacy.turnRecords)) {
|
|
21
|
+
return input;
|
|
22
|
+
}
|
|
23
|
+
const sessionEntries = legacy.piSessionEntries ?? [];
|
|
24
|
+
const entryTree = createReadonlyEntryTree(sessionEntries);
|
|
25
|
+
const sessionTree = {
|
|
26
|
+
...entryTree,
|
|
27
|
+
treeFile: "ui-compact-fixture",
|
|
28
|
+
header: null,
|
|
29
|
+
getTree: () => []
|
|
30
|
+
};
|
|
31
|
+
const traceIndex = buildTurnTraceIndexFromSession({
|
|
32
|
+
tree: sessionTree,
|
|
33
|
+
turnRecords: legacy.turnRecords,
|
|
34
|
+
events: legacy.events
|
|
35
|
+
});
|
|
36
|
+
const active = legacy.primaryPath.turnState.activeTurn;
|
|
37
|
+
if (active)
|
|
38
|
+
traceIndex[active.turnRecordId] = {
|
|
39
|
+
...EMPTY_TRACE,
|
|
40
|
+
...traceIndex[active.turnRecordId],
|
|
41
|
+
assistant: active.assistant,
|
|
42
|
+
traceItems: active.traceItems,
|
|
43
|
+
usage: active.usage,
|
|
44
|
+
toolCalls: active.toolCalls.map(({ result, ...tool }) => ({
|
|
45
|
+
...tool,
|
|
46
|
+
resultText: typeof result === "string" ? result : result == null ? null : JSON.stringify(result),
|
|
47
|
+
truncated: false
|
|
48
|
+
}))
|
|
49
|
+
};
|
|
50
|
+
const signature = sessionEntries.length > 0 ? `test-session:${JSON.stringify(sessionEntries).length}` : null;
|
|
51
|
+
const projections = buildProcessUiSnapshotProjections({
|
|
52
|
+
process: legacy.process,
|
|
53
|
+
turnRecords: legacy.turnRecords,
|
|
54
|
+
turnAnnotations: legacy.turnAnnotations,
|
|
55
|
+
events: legacy.events,
|
|
56
|
+
inputs: legacy.inputs,
|
|
57
|
+
selectedTurn: legacy.selectedTurn ?? null,
|
|
58
|
+
primaryPathSnapshot: legacy.primaryPath,
|
|
59
|
+
sessionTree
|
|
60
|
+
});
|
|
61
|
+
const compactDetail = {
|
|
62
|
+
...projections,
|
|
63
|
+
instanceTree: legacy.instanceTree ?? { currentLeafId: null, nodes: [], edges: [] },
|
|
64
|
+
leafOutcomeSnapshots: legacy.leafOutcomeSnapshots,
|
|
65
|
+
questionRequests: [],
|
|
66
|
+
toolApprovalRequests: [],
|
|
67
|
+
processDisplayName: legacy.processDisplayName,
|
|
68
|
+
processFlow: legacy.processFlow,
|
|
69
|
+
definesLeafOutcome: legacy.definesLeafOutcome,
|
|
70
|
+
selectedTurn: legacy.selectedTurn ?? null,
|
|
71
|
+
scheduledAction: legacy.scheduledAction ?? null,
|
|
72
|
+
modelConfiguration: legacy.modelConfiguration,
|
|
73
|
+
runDetails: legacy.runDetails,
|
|
74
|
+
launchConfiguration: legacy.launchConfiguration,
|
|
75
|
+
actions: legacy.actions,
|
|
76
|
+
toolRenderers: legacy.toolRenderers,
|
|
77
|
+
persistedModelSelectionWarning: null,
|
|
78
|
+
session: { signature },
|
|
79
|
+
sessionTransfer: null
|
|
80
|
+
};
|
|
81
|
+
reasoningSourceByInstanceId.set(projections.process.id, {
|
|
82
|
+
signature,
|
|
83
|
+
traceIndex,
|
|
84
|
+
liveTurnRecordId: active?.turnRecordId ?? null
|
|
85
|
+
});
|
|
86
|
+
return compactDetail;
|
|
87
|
+
}
|
|
88
|
+
function reasoningResponse(instanceId, turnRecordId) {
|
|
89
|
+
const source = reasoningSourceByInstanceId.get(instanceId);
|
|
90
|
+
return {
|
|
91
|
+
instanceId,
|
|
92
|
+
turnRecordId,
|
|
93
|
+
state: source?.liveTurnRecordId === turnRecordId ? "live" : "committed",
|
|
94
|
+
throughEventSequence: 0,
|
|
95
|
+
sessionSignature: source?.signature ?? null,
|
|
96
|
+
reasoning: source?.traceIndex[turnRecordId] ?? EMPTY_TRACE
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
/** @internal */
|
|
101
|
+
compact,
|
|
102
|
+
/** @internal */
|
|
103
|
+
reasoningResponse
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// src/question-fixtures.ts
|
|
108
|
+
function createTestQuestion(overrides = {}) {
|
|
109
|
+
return {
|
|
110
|
+
id: "question_1",
|
|
111
|
+
question: "Choose a strategy",
|
|
112
|
+
selection: "single",
|
|
113
|
+
options: [{ id: "question_1_option_1", label: "Safe", details: "Small change" }],
|
|
114
|
+
...overrides
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
function createTestQuestionRequest(overrides = {}) {
|
|
118
|
+
return {
|
|
119
|
+
id: "qst_1",
|
|
120
|
+
instanceId: "agt_1",
|
|
121
|
+
turnRecordId: "trn_1",
|
|
122
|
+
toolCallId: "tool_1",
|
|
123
|
+
questions: [createTestQuestion()],
|
|
124
|
+
status: "open",
|
|
125
|
+
answers: null,
|
|
126
|
+
askedAt: "2026-01-01T00:00:00.000Z",
|
|
127
|
+
answeredAt: null,
|
|
128
|
+
answeredBy: null,
|
|
129
|
+
cancelledAt: null,
|
|
130
|
+
...overrides
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
export {
|
|
134
|
+
createCompactProcessDetailFixtureFactory,
|
|
135
|
+
createTestQuestion,
|
|
136
|
+
createTestQuestionRequest
|
|
137
|
+
};
|
|
3
138
|
//# sourceMappingURL=fixtures.js.map
|
package/dist/fixtures.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../src/compact-process-detail-fixture.ts","../src/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"],"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,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AS,0BACf,YAA6C,CAAC,GACrB;AACzB,SAAO;AAAA,IACN,IAAI;AAAA,IACJ,YAAY;AAAA,IACZ,cAAc;AAAA,IACd,YAAY;AAAA,IACZ,WAAW,CAAC,mBAAmB,CAAC;AAAA,IAChC,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,GAAG;AAAA,EACJ;AACD;","names":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Accepts a launch-run request shape and waits for its admitted process commit. @internal */
|
|
2
|
+
export declare function postImmediateLaunchRequest(input: string | URL | Request, init?: RequestInit): Promise<Response>;
|
|
3
|
+
/**
|
|
4
|
+
* Admits an immediate launch through the public asynchronous HTTP contract and waits until the
|
|
5
|
+
* process commit or a pre-commit failure is observable. Intended for integration-test setup.
|
|
6
|
+
*/
|
|
7
|
+
/** @public */
|
|
8
|
+
export declare function postImmediateLaunch(serverBaseUrl: string, launcherId: string, body: Record<string, unknown>): Promise<Response>;
|
|
9
|
+
//# sourceMappingURL=http-launch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-launch.d.ts","sourceRoot":"","sources":["../src/http-launch.ts"],"names":[],"mappings":"AAEA,8FAA8F;AAC9F,wBAAsB,0BAA0B,CAC/C,KAAK,EAAE,MAAM,GAAG,GAAG,GAAG,OAAO,EAC7B,IAAI,CAAC,EAAE,WAAW,GAChB,OAAO,CAAC,QAAQ,CAAC,CAMnB;AAED;;;GAGG;AACH,cAAc;AACd,wBAAsB,mBAAmB,CACxC,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC3B,OAAO,CAAC,QAAQ,CAAC,CAgEnB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,25 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
export { FakeLlmProvider } from "./fakes/fake-llm.js";
|
|
2
|
+
export { postImmediateLaunch, postImmediateLaunchRequest } from "./http-launch.js";
|
|
3
|
+
export { type FixtureModelProviderSet, fixtureModelProviders, } from "./model-provider-fixtures.js";
|
|
4
|
+
export { createPollingTestExtension, createTestServerSetupCapability, createToolCollector, } from "./server-extension-test-harness.js";
|
|
5
|
+
/** @internal */
|
|
6
|
+
export declare function createInMemoryExternalWriteLog(): {
|
|
7
|
+
/** @internal */
|
|
8
|
+
records: Array<{
|
|
9
|
+
/** @internal */
|
|
10
|
+
dedupKey: string;
|
|
11
|
+
}>;
|
|
12
|
+
/** @internal */
|
|
13
|
+
hasDedupKey(key: string): boolean;
|
|
14
|
+
/** @internal */
|
|
15
|
+
record(input: {
|
|
16
|
+
/** @internal */
|
|
17
|
+
dedupKey: string;
|
|
18
|
+
}): {
|
|
19
|
+
/** @internal */
|
|
20
|
+
dedupKey: string;
|
|
21
|
+
};
|
|
22
|
+
/** @internal */
|
|
23
|
+
getDedupKeys(): ReadonlySet<string>;
|
|
24
|
+
};
|
|
13
25
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AACnF,OAAO,EACN,KAAK,uBAAuB,EAC5B,qBAAqB,GACrB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACN,0BAA0B,EAC1B,+BAA+B,EAC/B,mBAAmB,GACnB,MAAM,oCAAoC,CAAC;AAC5C,gBAAgB;AAChB,wBAAgB,8BAA8B,IAAI;IACjD,gBAAgB;IAChB,OAAO,EAAE,KAAK,CAAC;QACd,gBAAgB;QAChB,QAAQ,EAAE,MAAM,CAAC;KACjB,CAAC,CAAC;IACH,gBAAgB;IAChB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IAClC,gBAAgB;IAChB,MAAM,CAAC,KAAK,EAAE;QACb,gBAAgB;QAChB,QAAQ,EAAE,MAAM,CAAC;KACjB,GAAG;QACH,gBAAgB;QAChB,QAAQ,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,gBAAgB;IAChB,YAAY,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC;CACpC,CAEA"}
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,114 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import {
|
|
2
|
+
createInMemoryExternalWriteLog,
|
|
3
|
+
createPollingTestExtension,
|
|
4
|
+
createTestServerSetupCapability,
|
|
5
|
+
createToolCollector
|
|
6
|
+
} from "./chunk-5BZSJ4OO.js";
|
|
7
|
+
import {
|
|
8
|
+
FakeLlmProvider
|
|
9
|
+
} from "./chunk-EXHTWQAE.js";
|
|
10
|
+
|
|
11
|
+
// src/http-launch.ts
|
|
12
|
+
async function postImmediateLaunchRequest(input, init) {
|
|
13
|
+
const url = new URL(String(input));
|
|
14
|
+
const match = /^\/api\/launchers\/([^/]+)\/launch-runs$/.exec(url.pathname);
|
|
15
|
+
if (!match?.[1]) throw new Error(`Expected an immediate launch-run URL, received '${url}'`);
|
|
16
|
+
const body = init?.body ? JSON.parse(String(init.body)) : {};
|
|
17
|
+
return postImmediateLaunch(url.origin, decodeURIComponent(match[1]), body);
|
|
18
|
+
}
|
|
19
|
+
async function postImmediateLaunch(serverBaseUrl, launcherId, body) {
|
|
20
|
+
const admitted = await fetch(
|
|
21
|
+
`${serverBaseUrl.replace(/\/$/, "")}/api/launchers/${encodeURIComponent(launcherId)}/launch-runs`,
|
|
22
|
+
{
|
|
23
|
+
method: "POST",
|
|
24
|
+
headers: { "content-type": "application/json", "idempotency-key": crypto.randomUUID() },
|
|
25
|
+
body: JSON.stringify({ ...body, schedule: { mode: "now" } })
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
const admittedBody = await admitted.json();
|
|
29
|
+
if (admitted.status !== 202 || !admittedBody.launchRunId) {
|
|
30
|
+
return new Response(JSON.stringify(admittedBody), {
|
|
31
|
+
status: admitted.status,
|
|
32
|
+
headers: { "content-type": "application/json" }
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
let launchRun;
|
|
36
|
+
const deadline = Date.now() + 1e4;
|
|
37
|
+
for (; ; ) {
|
|
38
|
+
const response = await fetch(
|
|
39
|
+
`${serverBaseUrl.replace(/\/$/, "")}/api/launch-runs/${admittedBody.launchRunId}`
|
|
40
|
+
);
|
|
41
|
+
const responseBody = await response.json();
|
|
42
|
+
if (responseBody.launchRun.instanceId || ["failed", "cancelled"].includes(responseBody.launchRun.status)) {
|
|
43
|
+
launchRun = responseBody.launchRun;
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
if (Date.now() >= deadline) throw new Error("Timed out waiting for immediate launch admission");
|
|
47
|
+
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
48
|
+
}
|
|
49
|
+
if (!launchRun.instanceId) {
|
|
50
|
+
const failure2 = launchRun.steps.find((step) => step.status === "failed");
|
|
51
|
+
return new Response(
|
|
52
|
+
JSON.stringify({
|
|
53
|
+
error: failure2?.safeSummary ?? "Launch failed",
|
|
54
|
+
launchRunId: launchRun.id
|
|
55
|
+
}),
|
|
56
|
+
{ status: 400, headers: { "content-type": "application/json" } }
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
const detailResponse = await fetch(
|
|
60
|
+
`${serverBaseUrl.replace(/\/$/, "")}/api/processes/${encodeURIComponent(launchRun.instanceId)}`
|
|
61
|
+
);
|
|
62
|
+
const detail = await detailResponse.json();
|
|
63
|
+
const failure = launchRun.steps.find((step) => step.status === "failed");
|
|
64
|
+
return new Response(
|
|
65
|
+
JSON.stringify({
|
|
66
|
+
process: detail.process,
|
|
67
|
+
projects: detail.projects ?? [],
|
|
68
|
+
launchRunId: launchRun.id,
|
|
69
|
+
...launchRun.status === "failed" ? { error: failure?.safeSummary ?? "Process was created, but startup failed" } : {}
|
|
70
|
+
}),
|
|
71
|
+
{
|
|
72
|
+
status: launchRun.status === "failed" ? 200 : 201,
|
|
73
|
+
headers: { "content-type": "application/json" }
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// src/model-provider-fixtures.ts
|
|
79
|
+
import {
|
|
80
|
+
builtinPiProvider,
|
|
81
|
+
defineModelProvider,
|
|
82
|
+
defineModelProviders
|
|
83
|
+
} from "@leitwerk-dev/process-sdk";
|
|
84
|
+
function fixtureModelProviders(...models) {
|
|
85
|
+
return defineModelProviders(
|
|
86
|
+
(rawConfig) => models.map(({ id, modelId, piProvider = id, server = false }) => ({
|
|
87
|
+
definition: defineModelProvider({
|
|
88
|
+
id,
|
|
89
|
+
parseConfig: () => ({ config: {} }),
|
|
90
|
+
worker: builtinPiProvider(piProvider),
|
|
91
|
+
...server ? { server: builtinPiProvider(piProvider) } : {},
|
|
92
|
+
models: () => [{ modelId, availability: "available" }],
|
|
93
|
+
secrets: () => ({})
|
|
94
|
+
}),
|
|
95
|
+
rawConfig
|
|
96
|
+
}))
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// src/index.ts
|
|
101
|
+
function createInMemoryExternalWriteLog2() {
|
|
102
|
+
return createInMemoryExternalWriteLog();
|
|
103
|
+
}
|
|
104
|
+
export {
|
|
105
|
+
FakeLlmProvider,
|
|
106
|
+
createInMemoryExternalWriteLog2 as createInMemoryExternalWriteLog,
|
|
107
|
+
createPollingTestExtension,
|
|
108
|
+
createTestServerSetupCapability,
|
|
109
|
+
createToolCollector,
|
|
110
|
+
fixtureModelProviders,
|
|
111
|
+
postImmediateLaunch,
|
|
112
|
+
postImmediateLaunchRequest
|
|
113
|
+
};
|
|
13
114
|
//# sourceMappingURL=index.js.map
|