@leitwerk-dev/test-support 0.2.0 → 0.3.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-KPSK7EMY.js → chunk-5BZSJ4OO.js} +22 -157
- package/dist/chunk-5BZSJ4OO.js.map +1 -0
- package/dist/{chunk-2IICIB6D.js → chunk-E4Y7XND5.js} +40 -4
- package/dist/chunk-E4Y7XND5.js.map +1 -0
- package/dist/{chunk-JUH3LUYK.js → chunk-EXHTWQAE.js} +5 -1
- package/dist/chunk-EXHTWQAE.js.map +1 -0
- package/dist/chunk-KJVNI2UP.js +17 -0
- package/dist/chunk-KJVNI2UP.js.map +1 -0
- package/dist/{chunk-7I4OCTF3.js → chunk-OE4NHDVS.js} +15 -4
- package/dist/chunk-OE4NHDVS.js.map +1 -0
- package/dist/chunk-P2FF4AP7.js +72 -0
- package/dist/chunk-P2FF4AP7.js.map +1 -0
- package/dist/chunk-RY6Y6V5E.js +54 -0
- package/dist/chunk-RY6Y6V5E.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/extension-integration-harness.d.ts +357 -0
- package/dist/extension-integration-harness.d.ts.map +1 -0
- 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 +105 -4
- package/dist/fakes/index.js.map +1 -1
- package/dist/fixtures.d.ts +2 -0
- package/dist/fixtures.d.ts.map +1 -1
- package/dist/fixtures.js +157 -2
- package/dist/fixtures.js.map +1 -1
- package/dist/http-launch.d.ts +2 -1
- package/dist/http-launch.d.ts.map +1 -1
- package/dist/index.d.ts +6 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -119
- 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 +693 -13
- package/dist/integration.js.map +1 -1
- package/dist/local-git.d.ts +105 -8
- package/dist/local-git.d.ts.map +1 -1
- package/dist/local-git.js +155 -24
- package/dist/local-git.js.map +1 -1
- package/dist/model-provider-fixtures.d.ts +9 -1
- package/dist/model-provider-fixtures.d.ts.map +1 -1
- package/dist/observations.d.ts +7 -0
- package/dist/observations.d.ts.map +1 -0
- package/dist/polling.d.ts +1 -0
- package/dist/polling.d.ts.map +1 -1
- package/dist/process-driver.d.ts +5 -1
- package/dist/process-driver.d.ts.map +1 -1
- package/dist/process-fixtures.d.ts +56 -0
- package/dist/process-fixtures.d.ts.map +1 -0
- package/dist/process.d.ts +440 -0
- package/dist/process.d.ts.map +1 -0
- package/dist/process.js +484 -0
- package/dist/process.js.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 +43 -3
- 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 +96 -0
- package/dist/supported-question-fixtures.d.ts.map +1 -0
- package/dist/test-capability.d.ts +9 -0
- package/dist/test-capability.d.ts.map +1 -0
- 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 +19 -1
- 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 +32 -22
- 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 +78 -2
- 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 +14 -8
- package/src/compact-process-detail-fixture.ts +9 -1
- package/src/extension-integration-harness.ts +1059 -0
- 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/fixtures.ts +16 -0
- package/src/http-launch.ts +2 -1
- package/src/index.ts +13 -42
- package/src/integration-harness.ts +100 -9
- package/src/integration.ts +23 -9
- package/src/local-git.ts +196 -45
- package/src/model-provider-fixtures.ts +15 -2
- package/src/observations.ts +19 -0
- package/src/polling.ts +1 -0
- package/src/process-driver.ts +7 -1
- package/src/process-fixtures.ts +123 -0
- package/src/process.ts +768 -0
- package/src/question-fixtures.ts +2 -0
- package/src/server-extension-test-harness.ts +64 -7
- package/src/supported-question-fixtures.ts +168 -0
- package/src/test-capability.ts +9 -0
- package/src/test-diagnostics.ts +69 -0
- package/src/worker-testing/in-process-worker-spawn.ts +44 -4
- package/src/worker-testing/index.ts +4 -30
- 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 +87 -3
- package/src/worker-testing/worker-runtime-harness.ts +57 -6
- package/src/worker-testing/worker-start-payload.ts +17 -1
- package/dist/chunk-2IICIB6D.js.map +0 -1
- package/dist/chunk-3MQO3NCX.js +0 -15
- package/dist/chunk-3MQO3NCX.js.map +0 -1
- package/dist/chunk-7I4OCTF3.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-KPSK7EMY.js.map +0 -1
- package/dist/chunk-MV4W6NOO.js +0 -105
- package/dist/chunk-MV4W6NOO.js.map +0 -1
- package/dist/test-app.d.ts +0 -23
- package/dist/test-app.d.ts.map +0 -1
- package/src/test-app.ts +0 -82
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,SA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,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,9 +1,110 @@
|
|
|
1
|
-
import {
|
|
2
|
-
FakeGitOps
|
|
3
|
-
} from "../chunk-7ZK5QRGP.js";
|
|
4
1
|
import {
|
|
5
2
|
FakeLlmProvider
|
|
6
|
-
} from "../chunk-
|
|
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
|
+
};
|
|
7
108
|
export {
|
|
8
109
|
FakeGitOps,
|
|
9
110
|
FakeLlmProvider
|
package/dist/fakes/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
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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AAClC,UAAI,MAAM,YAAY,CAAC,EAAE,WAAW,MAAM,GAAG;AAC5C;AAAA,MACD;AACA,YAAM,MAAM,MAAM,WAAW,KAAK,EAAE,MAAM,OAAO,MAAM;AACvD,UAAI,CAAC,KAAK;AACT;AAAA,MACD;AACA,YAAM,WAAW,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.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export { createCompactProcessDetailFixtureFactory } from "./compact-process-detail-fixture.js";
|
|
2
|
+
export { createProcessFixture, createProjectFixture, type ProcessFixtureOptions, type ProcessFixturePosition, type ProjectFixtureOptions, } from "./process-fixtures.js";
|
|
2
3
|
export { createTestQuestion, createTestQuestionRequest } from "./question-fixtures.js";
|
|
4
|
+
export { createQuestionFixture, createQuestionRequestFixture, type QuestionFixture, type QuestionFixtureOptions, type QuestionFixtureResolution, type QuestionRequestFixture, type QuestionRequestFixtureOptions, } from "./supported-question-fixtures.js";
|
|
3
5
|
//# sourceMappingURL=fixtures.d.ts.map
|
package/dist/fixtures.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../src/fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wCAAwC,EAAE,MAAM,qCAAqC,CAAC;AAC/F,OAAO,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../src/fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wCAAwC,EAAE,MAAM,qCAAqC,CAAC;AAC/F,OAAO,EACN,oBAAoB,EACpB,oBAAoB,EACpB,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,GAC1B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACvF,OAAO,EACN,qBAAqB,EACrB,4BAA4B,EAC5B,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC9B,KAAK,sBAAsB,EAC3B,KAAK,6BAA6B,GAClC,MAAM,kCAAkC,CAAC"}
|
package/dist/fixtures.js
CHANGED
|
@@ -1,6 +1,113 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
createProcessFixture,
|
|
3
|
+
createProjectFixture
|
|
4
|
+
} from "./chunk-RY6Y6V5E.js";
|
|
5
|
+
|
|
6
|
+
// src/compact-process-detail-fixture.ts
|
|
7
|
+
import {
|
|
8
|
+
createReadonlyEntryTree
|
|
9
|
+
} from "@leitwerk-dev/protocol";
|
|
10
|
+
import {
|
|
11
|
+
buildProcessUiSnapshotProjections,
|
|
12
|
+
buildTurnTraceIndexFromSession
|
|
13
|
+
} from "@leitwerk-dev/server/testing";
|
|
14
|
+
var EMPTY_TRACE = {
|
|
15
|
+
assistant: { text: "", thinking: "", lastUpdatedAt: null },
|
|
16
|
+
toolCalls: [],
|
|
17
|
+
traceItems: [],
|
|
18
|
+
usage: null,
|
|
19
|
+
piInput: null
|
|
20
|
+
};
|
|
21
|
+
function createCompactProcessDetailFixtureFactory() {
|
|
22
|
+
const reasoningSourceByInstanceId = /* @__PURE__ */ new Map();
|
|
23
|
+
function compact(input) {
|
|
24
|
+
const legacy = input;
|
|
25
|
+
if (!Array.isArray(legacy.turnRecords)) {
|
|
26
|
+
return input;
|
|
27
|
+
}
|
|
28
|
+
const sessionEntries = legacy.piSessionEntries ?? [];
|
|
29
|
+
const entryTree = createReadonlyEntryTree(sessionEntries);
|
|
30
|
+
const sessionTree = {
|
|
31
|
+
...entryTree,
|
|
32
|
+
treeFile: "ui-compact-fixture",
|
|
33
|
+
header: null,
|
|
34
|
+
getTree: () => []
|
|
35
|
+
};
|
|
36
|
+
const traceIndex = buildTurnTraceIndexFromSession({
|
|
37
|
+
tree: sessionTree,
|
|
38
|
+
turnRecords: legacy.turnRecords,
|
|
39
|
+
events: legacy.events
|
|
40
|
+
});
|
|
41
|
+
const active = legacy.primaryPath.turnState.activeTurn;
|
|
42
|
+
if (active)
|
|
43
|
+
traceIndex[active.turnRecordId] = {
|
|
44
|
+
...EMPTY_TRACE,
|
|
45
|
+
...traceIndex[active.turnRecordId],
|
|
46
|
+
assistant: active.assistant,
|
|
47
|
+
traceItems: active.traceItems,
|
|
48
|
+
usage: active.usage,
|
|
49
|
+
toolCalls: active.toolCalls.map(({ result, ...tool }) => ({
|
|
50
|
+
...tool,
|
|
51
|
+
resultText: typeof result === "string" ? result : result == null ? null : JSON.stringify(result),
|
|
52
|
+
truncated: false
|
|
53
|
+
}))
|
|
54
|
+
};
|
|
55
|
+
const signature = sessionEntries.length > 0 ? `test-session:${JSON.stringify(sessionEntries).length}` : null;
|
|
56
|
+
const projections = buildProcessUiSnapshotProjections({
|
|
57
|
+
process: legacy.process,
|
|
58
|
+
turnRecords: legacy.turnRecords,
|
|
59
|
+
turnAnnotations: legacy.turnAnnotations,
|
|
60
|
+
events: legacy.events,
|
|
61
|
+
inputs: legacy.inputs,
|
|
62
|
+
selectedTurn: legacy.selectedTurn ?? null,
|
|
63
|
+
primaryPathSnapshot: legacy.primaryPath,
|
|
64
|
+
sessionTree
|
|
65
|
+
});
|
|
66
|
+
const compactDetail = {
|
|
67
|
+
...projections,
|
|
68
|
+
instanceTree: legacy.instanceTree ?? { currentLeafId: null, nodes: [], edges: [] },
|
|
69
|
+
leafOutcomeSnapshots: legacy.leafOutcomeSnapshots,
|
|
70
|
+
questionRequests: [],
|
|
71
|
+
toolApprovalRequests: [],
|
|
72
|
+
processDisplayName: legacy.processDisplayName,
|
|
73
|
+
processFlow: legacy.processFlow,
|
|
74
|
+
definesLeafOutcome: legacy.definesLeafOutcome,
|
|
75
|
+
selectedTurn: legacy.selectedTurn ?? null,
|
|
76
|
+
scheduledAction: legacy.scheduledAction ?? null,
|
|
77
|
+
modelConfiguration: legacy.modelConfiguration,
|
|
78
|
+
runDetails: legacy.runDetails,
|
|
79
|
+
launchConfiguration: legacy.launchConfiguration,
|
|
80
|
+
actions: legacy.actions,
|
|
81
|
+
toolRenderers: legacy.toolRenderers,
|
|
82
|
+
persistedModelSelectionWarning: null,
|
|
83
|
+
session: { signature },
|
|
84
|
+
sessionTransfer: null
|
|
85
|
+
};
|
|
86
|
+
reasoningSourceByInstanceId.set(projections.process.id, {
|
|
87
|
+
signature,
|
|
88
|
+
traceIndex,
|
|
89
|
+
liveTurnRecordId: active?.turnRecordId ?? null
|
|
90
|
+
});
|
|
91
|
+
return compactDetail;
|
|
92
|
+
}
|
|
93
|
+
function reasoningResponse(instanceId, turnRecordId) {
|
|
94
|
+
const source = reasoningSourceByInstanceId.get(instanceId);
|
|
95
|
+
return {
|
|
96
|
+
instanceId,
|
|
97
|
+
turnRecordId,
|
|
98
|
+
state: source?.liveTurnRecordId === turnRecordId ? "live" : "committed",
|
|
99
|
+
throughEventSequence: 0,
|
|
100
|
+
sessionSignature: source?.signature ?? null,
|
|
101
|
+
reasoning: source?.traceIndex[turnRecordId] ?? EMPTY_TRACE
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
return {
|
|
105
|
+
/** @internal */
|
|
106
|
+
compact,
|
|
107
|
+
/** @internal */
|
|
108
|
+
reasoningResponse
|
|
109
|
+
};
|
|
110
|
+
}
|
|
4
111
|
|
|
5
112
|
// src/question-fixtures.ts
|
|
6
113
|
function createTestQuestion(overrides = {}) {
|
|
@@ -28,8 +135,56 @@ function createTestQuestionRequest(overrides = {}) {
|
|
|
28
135
|
...overrides
|
|
29
136
|
};
|
|
30
137
|
}
|
|
138
|
+
|
|
139
|
+
// src/supported-question-fixtures.ts
|
|
140
|
+
import { normalizeAskQuestionsInput } from "@leitwerk-dev/domain";
|
|
141
|
+
function createQuestionFixture(options = {}) {
|
|
142
|
+
const [question] = normalizeAskQuestionsInput({
|
|
143
|
+
questions: [
|
|
144
|
+
{
|
|
145
|
+
question: options.question ?? "Choose a strategy",
|
|
146
|
+
selection: options.selection ?? "single",
|
|
147
|
+
options: options.options ?? [{ label: "Safe", details: "Small change" }]
|
|
148
|
+
}
|
|
149
|
+
]
|
|
150
|
+
});
|
|
151
|
+
if (!question) throw new Error("Question normalization returned no question");
|
|
152
|
+
return question;
|
|
153
|
+
}
|
|
154
|
+
function createQuestionRequestFixture(options = {}) {
|
|
155
|
+
const instanceId = options.process?.id ?? options.turn?.instanceId ?? "agt_test";
|
|
156
|
+
if (options.turn && options.turn.instanceId !== instanceId)
|
|
157
|
+
throw new Error("Question turn belongs to another process");
|
|
158
|
+
const questions = normalizeAskQuestionsInput({
|
|
159
|
+
questions: (options.questions ?? [{}]).map((q) => ({
|
|
160
|
+
question: q.question ?? "Choose a strategy",
|
|
161
|
+
selection: q.selection ?? "single",
|
|
162
|
+
options: q.options ?? [{ label: "Safe" }]
|
|
163
|
+
}))
|
|
164
|
+
});
|
|
165
|
+
const resolution = options.resolution;
|
|
166
|
+
if (resolution?.status === "answered" && resolution.answers.length !== questions.length)
|
|
167
|
+
throw new Error("Supply one answer per question");
|
|
168
|
+
return {
|
|
169
|
+
id: options.id ?? "qst_test",
|
|
170
|
+
instanceId,
|
|
171
|
+
turnRecordId: options.turn?.id ?? "trn_test",
|
|
172
|
+
toolCallId: "tool_test",
|
|
173
|
+
questions,
|
|
174
|
+
status: resolution?.status ?? "open",
|
|
175
|
+
askedAt: "2026-01-01T00:00:00.000Z",
|
|
176
|
+
answers: resolution?.status === "answered" ? [...resolution.answers] : null,
|
|
177
|
+
answeredAt: resolution?.status === "answered" ? "2026-01-01T00:00:01.000Z" : null,
|
|
178
|
+
answeredBy: resolution?.status === "answered" ? structuredClone(resolution.actor ?? { id: "test-user", kind: "user", provider: null }) : null,
|
|
179
|
+
cancelledAt: resolution?.status === "cancelled" ? "2026-01-01T00:00:01.000Z" : null
|
|
180
|
+
};
|
|
181
|
+
}
|
|
31
182
|
export {
|
|
32
183
|
createCompactProcessDetailFixtureFactory,
|
|
184
|
+
createProcessFixture,
|
|
185
|
+
createProjectFixture,
|
|
186
|
+
createQuestionFixture,
|
|
187
|
+
createQuestionRequestFixture,
|
|
33
188
|
createTestQuestion,
|
|
34
189
|
createTestQuestionRequest
|
|
35
190
|
};
|
package/dist/fixtures.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/question-fixtures.ts"],"sourcesContent":["import type { NormalizedQuestion, ProcessQuestionRequest } from \"@leitwerk-dev/domain\";\n\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\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":";;;;;AAEO,SAAS,mBACf,YAAyC,CAAC,GACrB;AACrB,SAAO;AAAA,IACN,IAAI;AAAA,IACJ,UAAU;AAAA,IACV,WAAW;AAAA,IACX,SAAS,CAAC,EAAE,IAAI,uBAAuB,OAAO,QAAQ,SAAS,eAAe,CAAC;AAAA,IAC/E,GAAG;AAAA,EACJ;AACD;AAEO,SAAS,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":[]}
|
|
1
|
+
{"version":3,"sources":["../src/compact-process-detail-fixture.ts","../src/question-fixtures.ts","../src/supported-question-fixtures.ts"],"sourcesContent":["import type {\n\tProcessEvent,\n\tProcessInput,\n\tProcessInstance,\n\tProcessProject,\n\tProcessTurnAnnotation,\n\tProcessTurnRecord,\n\tWorkerLease,\n} from \"@leitwerk-dev/domain\";\nimport {\n\tcreateReadonlyEntryTree,\n\ttype PiSessionEntry,\n\ttype PrimaryPathSnapshot,\n\ttype ProcessDetailUiSnapshotResponseBody,\n\ttype TurnReasoningDetailResponseBody,\n\ttype TurnTraceSnapshot,\n} from \"@leitwerk-dev/protocol\";\nimport {\n\tbuildProcessUiSnapshotProjections,\n\tbuildTurnTraceIndexFromSession,\n\ttype ReadonlyPiSessionTree,\n} from \"@leitwerk-dev/server/testing\";\n\ntype LegacyProcessDetailFixture = Omit<ProcessDetailUiSnapshotResponseBody, \"primaryPath\"> & {\n\tprimaryPath: PrimaryPathSnapshot;\n\tprocess: ProcessInstance;\n\tprojects: ProcessProject[];\n\tinputs: ProcessInput[];\n\tevents: ProcessEvent[];\n\tturnRecords: ProcessTurnRecord[];\n\tturnAnnotations: ProcessTurnAnnotation[];\n\tworkerLease: WorkerLease | null;\n\tpiSessionEntries: PiSessionEntry[];\n};\n\nconst EMPTY_TRACE: TurnTraceSnapshot = {\n\tassistant: { text: \"\", thinking: \"\", lastUpdatedAt: null },\n\ttoolCalls: [],\n\ttraceItems: [],\n\tusage: null,\n\tpiInput: null,\n};\n\n/** @internal */\nexport function createCompactProcessDetailFixtureFactory() {\n\tconst reasoningSourceByInstanceId = new Map<\n\t\tstring,\n\t\t{\n\t\t\tsignature: string | null;\n\t\t\ttraceIndex: Record<string, TurnTraceSnapshot>;\n\t\t\tliveTurnRecordId: string | null;\n\t\t}\n\t>();\n\n\t/** @internal */\n\tfunction compact(input: unknown): ProcessDetailUiSnapshotResponseBody {\n\t\tconst legacy = input as LegacyProcessDetailFixture;\n\t\tif (!Array.isArray(legacy.turnRecords)) {\n\t\t\treturn input as ProcessDetailUiSnapshotResponseBody;\n\t\t}\n\t\tconst sessionEntries = legacy.piSessionEntries ?? [];\n\t\tconst entryTree = createReadonlyEntryTree(sessionEntries);\n\t\tconst sessionTree = {\n\t\t\t...entryTree,\n\t\t\ttreeFile: \"ui-compact-fixture\",\n\t\t\theader: null,\n\t\t\tgetTree: () => [],\n\t\t} as unknown as ReadonlyPiSessionTree;\n\t\tconst traceIndex = buildTurnTraceIndexFromSession({\n\t\t\ttree: sessionTree,\n\t\t\tturnRecords: legacy.turnRecords,\n\t\t\tevents: legacy.events,\n\t\t});\n\t\tconst active = legacy.primaryPath.turnState.activeTurn;\n\t\tif (active)\n\t\t\ttraceIndex[active.turnRecordId] = {\n\t\t\t\t...EMPTY_TRACE,\n\t\t\t\t...traceIndex[active.turnRecordId],\n\t\t\t\tassistant: active.assistant,\n\t\t\t\ttraceItems: active.traceItems,\n\t\t\t\tusage: active.usage,\n\t\t\t\ttoolCalls: active.toolCalls.map(({ result, ...tool }) => ({\n\t\t\t\t\t...tool,\n\t\t\t\t\tresultText:\n\t\t\t\t\t\ttypeof result === \"string\" ? result : result == null ? null : JSON.stringify(result),\n\t\t\t\t\ttruncated: false,\n\t\t\t\t})),\n\t\t\t};\n\t\tconst signature =\n\t\t\tsessionEntries.length > 0 ? `test-session:${JSON.stringify(sessionEntries).length}` : null;\n\t\tconst projections = buildProcessUiSnapshotProjections({\n\t\t\tprocess: legacy.process,\n\t\t\tturnRecords: legacy.turnRecords,\n\t\t\tturnAnnotations: legacy.turnAnnotations,\n\t\t\tevents: legacy.events,\n\t\t\tinputs: legacy.inputs,\n\t\t\tselectedTurn: legacy.selectedTurn ?? null,\n\t\t\tprimaryPathSnapshot: legacy.primaryPath,\n\t\t\tsessionTree,\n\t\t});\n\t\tconst compactDetail: ProcessDetailUiSnapshotResponseBody = {\n\t\t\t...projections,\n\t\t\tinstanceTree: legacy.instanceTree ?? { currentLeafId: null, nodes: [], edges: [] },\n\t\t\tleafOutcomeSnapshots: legacy.leafOutcomeSnapshots,\n\t\t\tquestionRequests: [],\n\t\t\ttoolApprovalRequests: [],\n\t\t\tprocessDisplayName: legacy.processDisplayName,\n\t\t\tprocessFlow: legacy.processFlow,\n\t\t\tdefinesLeafOutcome: legacy.definesLeafOutcome,\n\t\t\tselectedTurn: legacy.selectedTurn ?? null,\n\t\t\tscheduledAction: legacy.scheduledAction ?? null,\n\t\t\tmodelConfiguration: legacy.modelConfiguration,\n\t\t\trunDetails: legacy.runDetails,\n\t\t\tlaunchConfiguration: legacy.launchConfiguration,\n\t\t\tactions: legacy.actions,\n\t\t\ttoolRenderers: legacy.toolRenderers,\n\t\t\tpersistedModelSelectionWarning: null,\n\t\t\tsession: { signature },\n\t\t\tsessionTransfer: null,\n\t\t};\n\t\treasoningSourceByInstanceId.set(projections.process.id, {\n\t\t\tsignature,\n\t\t\ttraceIndex,\n\t\t\tliveTurnRecordId: active?.turnRecordId ?? null,\n\t\t});\n\t\treturn compactDetail;\n\t}\n\n\t/** @internal */\n\tfunction reasoningResponse(\n\t\tinstanceId: string,\n\t\tturnRecordId: string,\n\t): TurnReasoningDetailResponseBody {\n\t\tconst source = reasoningSourceByInstanceId.get(instanceId);\n\t\treturn {\n\t\t\tinstanceId,\n\t\t\tturnRecordId,\n\t\t\tstate: source?.liveTurnRecordId === turnRecordId ? \"live\" : \"committed\",\n\t\t\tthroughEventSequence: 0,\n\t\t\tsessionSignature: source?.signature ?? null,\n\t\t\treasoning: source?.traceIndex[turnRecordId] ?? EMPTY_TRACE,\n\t\t};\n\t}\n\n\treturn {\n\t\t/** @internal */\n\t\tcompact,\n\t\t/** @internal */\n\t\treasoningResponse,\n\t};\n}\n","import type { NormalizedQuestion, ProcessQuestionRequest } from \"@leitwerk-dev/domain\";\n\n/** @internal */\nexport function createTestQuestion(\n\toverrides: Partial<NormalizedQuestion> = {},\n): NormalizedQuestion {\n\treturn {\n\t\tid: \"question_1\",\n\t\tquestion: \"Choose a strategy\",\n\t\tselection: \"single\",\n\t\toptions: [{ id: \"question_1_option_1\", label: \"Safe\", details: \"Small change\" }],\n\t\t...overrides,\n\t};\n}\n\n/** @internal */\nexport function createTestQuestionRequest(\n\toverrides: Partial<ProcessQuestionRequest> = {},\n): ProcessQuestionRequest {\n\treturn {\n\t\tid: \"qst_1\",\n\t\tinstanceId: \"agt_1\",\n\t\tturnRecordId: \"trn_1\",\n\t\ttoolCallId: \"tool_1\",\n\t\tquestions: [createTestQuestion()],\n\t\tstatus: \"open\",\n\t\tanswers: null,\n\t\taskedAt: \"2026-01-01T00:00:00.000Z\",\n\t\tansweredAt: null,\n\t\tansweredBy: null,\n\t\tcancelledAt: null,\n\t\t...overrides,\n\t};\n}\n","import { type Actor, normalizeAskQuestionsInput } from \"@leitwerk-dev/domain\";\n\n/** A normalized question with stable option identities. @public */\nexport interface QuestionFixture {\n\t/** @public */\n\tid: string;\n\t/** @public */\n\tquestion: string;\n\t/** @public */\n\tselection: \"single\" | \"multiple\";\n\t/** @public */\n\toptions: readonly {\n\t\t/** @public */\n\t\tid: string;\n\t\t/** @public */\n\t\tlabel: string;\n\t\t/** @public */\n\t\tdetails: string | null;\n\t}[];\n}\n\n/** Correlated question request data without persistence access. @public */\nexport interface QuestionRequestFixture {\n\t/** @public */\n\tid: string;\n\t/** @public */\n\tinstanceId: string;\n\t/** @public */\n\tturnRecordId: string;\n\t/** @public */\n\ttoolCallId: string;\n\t/** @public */\n\tquestions: readonly QuestionFixture[];\n\t/** @public */\n\tstatus: \"open\" | \"answered\" | \"cancelled\";\n\t/** @public */\n\tanswers: readonly string[] | null;\n\t/** @public */\n\taskedAt: string;\n\t/** @public */\n\tansweredAt: string | null;\n\t/** @public */\n\tansweredBy: Actor | null;\n\t/** @public */\n\tcancelledAt: string | null;\n}\n\n/** Question content with generated stable option identities. @public */\nexport interface QuestionFixtureOptions {\n\t/** @public */\n\n\tquestion?: string;\n\n\t/** @public */\n\n\tselection?: \"single\" | \"multiple\";\n\n\t/** @public */\n\n\toptions?: readonly {\n\t\t/** @public */\n\t\tlabel: string;\n\n\t\t/** @public */\n\t\tdetails?: string | null;\n\t}[];\n}\n\n/** Normalize content using the application's question contract. @public */\nexport function createQuestionFixture(options: QuestionFixtureOptions = {}): QuestionFixture {\n\tconst [question] = normalizeAskQuestionsInput({\n\t\tquestions: [\n\t\t\t{\n\t\t\t\tquestion: options.question ?? \"Choose a strategy\",\n\t\t\t\tselection: options.selection ?? \"single\",\n\t\t\t\toptions: options.options ?? [{ label: \"Safe\", details: \"Small change\" }],\n\t\t\t},\n\t\t],\n\t});\n\tif (!question) throw new Error(\"Question normalization returned no question\");\n\treturn question;\n}\n\n/** Resolution determines status and all resolution timestamps. @public */\nexport type QuestionFixtureResolution =\n\t| {\n\t\t\t/** @public */\n\t\t\tstatus: \"answered\";\n\n\t\t\t/** @public */\n\n\t\t\tanswers: readonly string[];\n\n\t\t\t/** @public */\n\n\t\t\tactor?: Actor;\n\t }\n\t| {\n\t\t\t/** @public */\n\t\t\tstatus: \"cancelled\";\n\t };\n\n/** Reference inputs and question content, without durable status overrides. @public */\nexport interface QuestionRequestFixtureOptions {\n\t/** @public */\n\n\tid?: string;\n\n\t/** @public */\n\n\tprocess?: {\n\t\t/** @public */\n\t\tid: string;\n\t};\n\n\t/** @public */\n\n\tturn?: {\n\t\t/** @public */\n\t\tid: string;\n\n\t\t/** @public */\n\t\tinstanceId: string;\n\t};\n\n\t/** @public */\n\n\tquestions?: readonly QuestionFixtureOptions[];\n\n\t/** @public */\n\n\tresolution?: QuestionFixtureResolution;\n}\n\n/** Create a consistent request; reject conflicting process and turn references. @public */\nexport function createQuestionRequestFixture(\n\toptions: QuestionRequestFixtureOptions = {},\n): QuestionRequestFixture {\n\tconst instanceId = options.process?.id ?? options.turn?.instanceId ?? \"agt_test\";\n\tif (options.turn && options.turn.instanceId !== instanceId)\n\t\tthrow new Error(\"Question turn belongs to another process\");\n\tconst questions = normalizeAskQuestionsInput({\n\t\tquestions: (options.questions ?? [{}]).map((q) => ({\n\t\t\tquestion: q.question ?? \"Choose a strategy\",\n\t\t\tselection: q.selection ?? \"single\",\n\t\t\toptions: q.options ?? [{ label: \"Safe\" }],\n\t\t})),\n\t});\n\tconst resolution = options.resolution;\n\tif (resolution?.status === \"answered\" && resolution.answers.length !== questions.length)\n\t\tthrow new Error(\"Supply one answer per question\");\n\treturn {\n\t\tid: options.id ?? \"qst_test\",\n\t\tinstanceId,\n\t\tturnRecordId: options.turn?.id ?? \"trn_test\",\n\t\ttoolCallId: \"tool_test\",\n\t\tquestions,\n\t\tstatus: resolution?.status ?? \"open\",\n\t\taskedAt: \"2026-01-01T00:00:00.000Z\",\n\t\tanswers: resolution?.status === \"answered\" ? [...resolution.answers] : null,\n\t\tansweredAt: resolution?.status === \"answered\" ? \"2026-01-01T00:00:01.000Z\" : null,\n\t\tansweredBy:\n\t\t\tresolution?.status === \"answered\"\n\t\t\t\t? structuredClone(resolution.actor ?? { id: \"test-user\", kind: \"user\", provider: null })\n\t\t\t\t: null,\n\t\tcancelledAt: resolution?.status === \"cancelled\" ? \"2026-01-01T00:00:01.000Z\" : null,\n\t};\n}\n"],"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AAE,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/http-launch.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
/** Accepts a launch-run request shape and waits for its admitted process commit. */
|
|
1
|
+
/** Accepts a launch-run request shape and waits for its admitted process commit. @internal */
|
|
2
2
|
export declare function postImmediateLaunchRequest(input: string | URL | Request, init?: RequestInit): Promise<Response>;
|
|
3
3
|
/**
|
|
4
4
|
* Admits an immediate launch through the public asynchronous HTTP contract and waits until the
|
|
5
5
|
* process commit or a pre-commit failure is observable. Intended for integration-test setup.
|
|
6
6
|
*/
|
|
7
|
+
/** @public */
|
|
7
8
|
export declare function postImmediateLaunch(serverBaseUrl: string, launcherId: string, body: Record<string, unknown>): Promise<Response>;
|
|
8
9
|
//# sourceMappingURL=http-launch.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-launch.d.ts","sourceRoot":"","sources":["../src/http-launch.ts"],"names":[],"mappings":"AAEA,
|
|
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,15 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
3
|
-
export { FakeGitOps, type RepoTemplate } from "./fakes/fake-git-ops.js";
|
|
4
|
-
export { FakeLlmProvider, type LlmResponse } from "./fakes/fake-llm.js";
|
|
1
|
+
import { createInMemoryExternalWriteLog as createInMemoryExternalWriteLogImpl } from "./server-extension-test-harness.js";
|
|
2
|
+
export { FakeLlmProvider } from "./fakes/fake-llm.js";
|
|
5
3
|
export { postImmediateLaunch, postImmediateLaunchRequest } from "./http-launch.js";
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
|
|
9
|
-
export
|
|
10
|
-
export { createInMemoryExternalWriteLog, createPollingTestExtension, createTestServerSetupCapability, createToolCollector, type InMemoryExternalWriteLog, type ServerExtensionTestHarness, setupServerExtensionTest, } from "./server-extension-test-harness.js";
|
|
11
|
-
export { createTestApp, type TestApp, type TestAppOptions } from "./test-app.js";
|
|
12
|
-
export { createSchemaDrivenStubPiFactory, createSchemaDrivenToolCallScriptResolver, synthesizeStubArgValue, synthesizeStubToolArgs, } from "./worker-testing/schema-driven-stub-pi.js";
|
|
13
|
-
export { createStubToolScriptController, type StubToolScriptController, } from "./worker-testing/stub-pi-controls.js";
|
|
14
|
-
export { StubPiTreeHandle, StubPiTreeHandleFactory, type StubPiTreeHandleFactoryOptions, type StubToolCallScriptCall, type StubToolCallScriptItem, type StubToolCallScriptResolver, type StubToolCallScriptResolverContext, } from "./worker-testing/stub-pi-tree-handle.js";
|
|
4
|
+
export { type FixtureModelProviderSet, fixtureModelProviders, } from "./model-provider-fixtures.js";
|
|
5
|
+
export { createPollingTestExtension, createTestServerSetupCapability, createToolCollector, } from "./server-extension-test-harness.js";
|
|
6
|
+
/** @internal */
|
|
7
|
+
export declare function createInMemoryExternalWriteLog(): ReturnType<typeof createInMemoryExternalWriteLogImpl>;
|
|
15
8
|
//# 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":"AAAA,OAAO,
|
|
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,GACrB,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,110 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
postImmediateLaunch,
|
|
3
|
+
postImmediateLaunchRequest
|
|
4
|
+
} from "./chunk-P2FF4AP7.js";
|
|
4
5
|
import {
|
|
5
6
|
createInMemoryExternalWriteLog,
|
|
6
|
-
createIntegrationHarness,
|
|
7
7
|
createPollingTestExtension,
|
|
8
|
-
createTestApp,
|
|
9
8
|
createTestServerSetupCapability,
|
|
10
|
-
createToolCollector
|
|
11
|
-
|
|
12
|
-
waitForValue
|
|
13
|
-
} from "./chunk-KPSK7EMY.js";
|
|
14
|
-
import {
|
|
15
|
-
FakeGitOps
|
|
16
|
-
} from "./chunk-7ZK5QRGP.js";
|
|
9
|
+
createToolCollector
|
|
10
|
+
} from "./chunk-5BZSJ4OO.js";
|
|
17
11
|
import {
|
|
18
12
|
FakeLlmProvider
|
|
19
|
-
} from "./chunk-
|
|
20
|
-
import {
|
|
21
|
-
createStubToolScriptController
|
|
22
|
-
} from "./chunk-3MQO3NCX.js";
|
|
23
|
-
import {
|
|
24
|
-
createInProcessWorkerSpawn
|
|
25
|
-
} from "./chunk-7I4OCTF3.js";
|
|
26
|
-
import {
|
|
27
|
-
StubPiTreeHandle,
|
|
28
|
-
StubPiTreeHandleFactory,
|
|
29
|
-
createSchemaDrivenStubPiFactory,
|
|
30
|
-
createSchemaDrivenToolCallScriptResolver,
|
|
31
|
-
synthesizeStubArgValue,
|
|
32
|
-
synthesizeStubToolArgs
|
|
33
|
-
} from "./chunk-2IICIB6D.js";
|
|
34
|
-
|
|
35
|
-
// src/index.ts
|
|
36
|
-
import {
|
|
37
|
-
createTestConfigSnapshot,
|
|
38
|
-
createTestIpcEnvelopeBase,
|
|
39
|
-
flushAsyncWork
|
|
40
|
-
} from "@leitwerk-dev/worker-protocol";
|
|
41
|
-
|
|
42
|
-
// src/http-launch.ts
|
|
43
|
-
async function postImmediateLaunchRequest(input, init) {
|
|
44
|
-
const url = new URL(String(input));
|
|
45
|
-
const match = /^\/api\/launchers\/([^/]+)\/launch-runs$/.exec(url.pathname);
|
|
46
|
-
if (!match?.[1]) throw new Error(`Expected an immediate launch-run URL, received '${url}'`);
|
|
47
|
-
const body = init?.body ? JSON.parse(String(init.body)) : {};
|
|
48
|
-
return postImmediateLaunch(url.origin, decodeURIComponent(match[1]), body);
|
|
49
|
-
}
|
|
50
|
-
async function postImmediateLaunch(serverBaseUrl, launcherId, body) {
|
|
51
|
-
const admitted = await fetch(
|
|
52
|
-
`${serverBaseUrl.replace(/\/$/, "")}/api/launchers/${encodeURIComponent(launcherId)}/launch-runs`,
|
|
53
|
-
{
|
|
54
|
-
method: "POST",
|
|
55
|
-
headers: { "content-type": "application/json", "idempotency-key": crypto.randomUUID() },
|
|
56
|
-
body: JSON.stringify({ ...body, schedule: { mode: "now" } })
|
|
57
|
-
}
|
|
58
|
-
);
|
|
59
|
-
const admittedBody = await admitted.json();
|
|
60
|
-
if (admitted.status !== 202 || !admittedBody.launchRunId) {
|
|
61
|
-
return new Response(JSON.stringify(admittedBody), {
|
|
62
|
-
status: admitted.status,
|
|
63
|
-
headers: { "content-type": "application/json" }
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
let launchRun;
|
|
67
|
-
const deadline = Date.now() + 1e4;
|
|
68
|
-
for (; ; ) {
|
|
69
|
-
const response = await fetch(
|
|
70
|
-
`${serverBaseUrl.replace(/\/$/, "")}/api/launch-runs/${admittedBody.launchRunId}`
|
|
71
|
-
);
|
|
72
|
-
const responseBody = await response.json();
|
|
73
|
-
if (responseBody.launchRun.instanceId || ["failed", "cancelled"].includes(responseBody.launchRun.status)) {
|
|
74
|
-
launchRun = responseBody.launchRun;
|
|
75
|
-
break;
|
|
76
|
-
}
|
|
77
|
-
if (Date.now() >= deadline) throw new Error("Timed out waiting for immediate launch admission");
|
|
78
|
-
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
79
|
-
}
|
|
80
|
-
if (!launchRun.instanceId) {
|
|
81
|
-
const failure2 = launchRun.steps.find((step) => step.status === "failed");
|
|
82
|
-
return new Response(
|
|
83
|
-
JSON.stringify({
|
|
84
|
-
error: failure2?.safeSummary ?? "Launch failed",
|
|
85
|
-
launchRunId: launchRun.id
|
|
86
|
-
}),
|
|
87
|
-
{ status: 400, headers: { "content-type": "application/json" } }
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
const detailResponse = await fetch(
|
|
91
|
-
`${serverBaseUrl.replace(/\/$/, "")}/api/processes/${encodeURIComponent(launchRun.instanceId)}`
|
|
92
|
-
);
|
|
93
|
-
const detail = await detailResponse.json();
|
|
94
|
-
const failure = launchRun.steps.find((step) => step.status === "failed");
|
|
95
|
-
return new Response(
|
|
96
|
-
JSON.stringify({
|
|
97
|
-
process: detail.process,
|
|
98
|
-
projects: detail.projects ?? [],
|
|
99
|
-
launchRunId: launchRun.id,
|
|
100
|
-
...launchRun.status === "failed" ? { error: failure?.safeSummary ?? "Process was created, but startup failed" } : {}
|
|
101
|
-
}),
|
|
102
|
-
{
|
|
103
|
-
status: launchRun.status === "failed" ? 200 : 201,
|
|
104
|
-
headers: { "content-type": "application/json" }
|
|
105
|
-
}
|
|
106
|
-
);
|
|
107
|
-
}
|
|
13
|
+
} from "./chunk-EXHTWQAE.js";
|
|
108
14
|
|
|
109
15
|
// src/model-provider-fixtures.ts
|
|
110
16
|
import {
|
|
@@ -127,31 +33,19 @@ function fixtureModelProviders(...models) {
|
|
|
127
33
|
}))
|
|
128
34
|
);
|
|
129
35
|
}
|
|
36
|
+
|
|
37
|
+
// src/index.ts
|
|
38
|
+
function createInMemoryExternalWriteLog2() {
|
|
39
|
+
return createInMemoryExternalWriteLog();
|
|
40
|
+
}
|
|
130
41
|
export {
|
|
131
|
-
FakeGitOps,
|
|
132
42
|
FakeLlmProvider,
|
|
133
|
-
|
|
134
|
-
StubPiTreeHandleFactory,
|
|
135
|
-
createTestIpcEnvelopeBase as baseEnvelope,
|
|
136
|
-
createCompactProcessDetailFixtureFactory,
|
|
137
|
-
createInMemoryExternalWriteLog,
|
|
138
|
-
createInProcessWorkerSpawn,
|
|
139
|
-
createIntegrationHarness,
|
|
43
|
+
createInMemoryExternalWriteLog2 as createInMemoryExternalWriteLog,
|
|
140
44
|
createPollingTestExtension,
|
|
141
|
-
createSchemaDrivenStubPiFactory,
|
|
142
|
-
createSchemaDrivenToolCallScriptResolver,
|
|
143
|
-
createStubToolScriptController,
|
|
144
|
-
createTestApp,
|
|
145
45
|
createTestServerSetupCapability,
|
|
146
46
|
createToolCollector,
|
|
147
47
|
fixtureModelProviders,
|
|
148
|
-
flushAsyncWork,
|
|
149
48
|
postImmediateLaunch,
|
|
150
|
-
postImmediateLaunchRequest
|
|
151
|
-
setupServerExtensionTest,
|
|
152
|
-
synthesizeStubArgValue,
|
|
153
|
-
synthesizeStubToolArgs,
|
|
154
|
-
createTestConfigSnapshot as testConfigSnapshot,
|
|
155
|
-
waitForValue
|
|
49
|
+
postImmediateLaunchRequest
|
|
156
50
|
};
|
|
157
51
|
//# sourceMappingURL=index.js.map
|