@leitwerk-dev/test-support 0.2.0 → 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-7I4OCTF3.js → chunk-2PCDTYVH.js} +7 -2
- package/dist/chunk-2PCDTYVH.js.map +1 -0
- package/dist/{chunk-KPSK7EMY.js → chunk-5BZSJ4OO.js} +22 -157
- package/dist/chunk-5BZSJ4OO.js.map +1 -0
- package/dist/{chunk-2IICIB6D.js → chunk-ECAWLVYB.js} +38 -4
- 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 +105 -4
- package/dist/fakes/index.js.map +1 -1
- package/dist/fixtures.js +104 -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 +23 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -53
- 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 +2 -3
- package/dist/integration.d.ts.map +1 -1
- package/dist/integration.js +131 -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/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/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/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 +17 -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 +76 -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 +9 -8
- package/src/compact-process-detail-fixture.ts +9 -1
- 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 +2 -1
- package/src/index.ts +28 -42
- package/src/integration-harness.ts +100 -9
- package/src/integration.ts +2 -9
- package/src/local-git.ts +195 -45
- package/src/model-provider-fixtures.ts +15 -2
- package/src/polling.ts +1 -0
- package/src/process-driver.ts +7 -1
- package/src/question-fixtures.ts +2 -0
- package/src/server-extension-test-harness.ts +64 -7
- package/src/test-diagnostics.ts +69 -0
- package/src/worker-testing/in-process-worker-spawn.ts +29 -2
- 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 +82 -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
|
@@ -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,EAIN,KAAK,mCAAmC,EACxC,KAAK,+BAA+B,EAEpC,MAAM,wBAAwB,CAAC;AA2BhC,wBAAgB,wCAAwC;
|
|
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":"","sources":["../../src/fakes/fake-git-ops.ts"],"names":[],"mappings":"AAEA,gBAAgB;AAChB,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAElD;;;GAGG;AACH,gBAAgB;AAChB,qBAAa,UAAU;IAOV,OAAO,CAAC,QAAQ,CAAC,SAAS;IANtC,gBAAgB;IAChB,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,CAAM;IACnC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA6B;IACnD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAuE;IAEjG,gBAAgB;gBACa,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC;IAEjE,OAAO,CAAC,GAAG;IAIX,gBAAgB;IACV,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKlF,gBAAgB;IACV,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAIzE,gBAAgB;IACV,KAAK,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAsBlE,gBAAgB;IACV,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAS9D,gBAAgB;IACV,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ3F,gBAAgB;IACV,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAKzE,gBAAgB;IACV,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;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,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\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,aAAuB,CAAC;AAAA,EAChB,QAAQ,oBAAI,IAAoB;AAAA,EAChC,YAAY,oBAAI,IAA8D;AAAA,EAKvF,IAAI,SAAiB,UAA0B;AACtD,WAAO,KAAK,UAAU,KAAK,KAAK,SAAS,QAAQ,CAAC;AAAA,EACnD;AAAA;AAAA,EAGA,MAAM,UAAU,SAAiB,UAAkB,SAAgC;AAClF,SAAK,WAAW,KAAK,aAAa,QAAQ,EAAE;AAC5C,SAAK,MAAM,IAAI,KAAK,IAAI,SAAS,QAAQ,GAAG,OAAO;AAAA,EACpD;AAAA;AAAA,EAGA,MAAM,SAAS,SAAiB,UAA0C;AACzE,WAAO,KAAK,MAAM,IAAI,KAAK,IAAI,SAAS,QAAQ,CAAC,KAAK;AAAA,EACvD;AAAA;AAAA,EAGA,MAAM,MAAM,aAAqB,WAAkC;AAClE,SAAK,WAAW,KAAK,SAAS,KAAK,SAAS,SAAS,CAAC,EAAE;AACxD,UAA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AM,WAAW,SAAkC;AAClD,UAAM,KAAK,KAAK,UAAU,IAAI,KAAK,UAAU,OAAO,CAAC;AACrD,QAAI,CAAC,IAAI;AACR,YAAM,IAAI,MAAM,YAAY;AAAA,IAC7B;AACA,WAAO,OAAO,KAAK,GAAG,OAAO,IAAI,GAAG,aAAa,EAAE,EACjD,SAAS,KAAK,EACd,MAAM,GAAG,EAAE,EACX,OAAO,IAAI,GAAG;AAAA,EACjB;AAAA;AAAA,EAGA,MAAM,UAAU,SAAiB,SAAoC;AACpE,UAAM,WAAW,KAAK,UAAU,OAAO;AACvC,UAAM,SAAS,WAAW,KAAK;AAC/B,UAAM,MAAgB,CAAC;AACvB,eAAW,KAAK,KAAK,MAAM,KAAK,GAAG;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.js
CHANGED
|
@@ -1,6 +1,108 @@
|
|
|
1
|
+
// src/compact-process-detail-fixture.ts
|
|
1
2
|
import {
|
|
2
|
-
|
|
3
|
-
} from "
|
|
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
|
+
}
|
|
4
106
|
|
|
5
107
|
// src/question-fixtures.ts
|
|
6
108
|
function createTestQuestion(overrides = {}) {
|
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":"
|
|
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,SAAS;AACV;AAGO,SAAS,2CAA2C;AAC1D,QAAM,8BAA8B,oBAAI,IAOtC;AAGF,WAAS,QAAQ,OAAqD;AACrE,UAAM,SAAS;AACf,QAAI,CAAC,MAAM,QAAQ,OAAO,WAAW,GAAG;AACvC,aAAO;AAAA,IACR;AACA,UAAM,iBAAiB,OAAO,oBAAoB,CAAC;AACnD,UAAM,YAAY,wBAAwB,cAAc;AACxD,UAAM,cAAc;AAAA,MACnB,GAAG;AAAA,MACH,UAAU;AAAA,MACV,QAAQ;AAAA,MACR,SAAS,MAAM,CAAC;AAAA,IACjB;AACA,UAAM,aAAa,+BAA+B;AAAA,MACjD,MAAM;AAAA,MACN,aAAa,OAAO;AAAA,MACpB,QAAQ,OAAO;AAAA,IAChB,CAAC;AACD,UAAM,SAAS,OAAO,YAAY,UAAU;AAC5C,QAAI;AACH,iBAAW,OAAO,YAAY,IAAI;AAAA,QACjC,GAAG;AAAA,QACH,GAAG,WAAW,OAAO,YAAY;AAAA,QACjC,WAAW,OAAO;AAAA,QAClB,YAAY,OAA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C;AACD,WAAO;AAAA,EACR;AAGA,WAAS,kBACR,YACA,cACkC;AAClC,UAAM,SAAS,4BAA4B,IAAI,UAAU;AACzD,WAAO;AAAA,MACN;AAAA,MACA;AAAA,MACA,OAAO,QAAQ,qBAAqB,eAAe,SAAS;AAAA,MAC5D,sBAAsB;AAAA,MACtB,kBAAkB,QAAQ,aAAa;AAAA,MACvC,WAAW,QAAQ,WAAW,YAAY,KAAK;AAAA,IAChD;AAAA,EACD;AAEA,SAAO;AAAA;AAAA,IAEN;AAAA;AAAA,IAEA;AAAA,EACD;AACD;;;ACnJO,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;AAGO,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":[]}
|
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,25 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { createCompactProcessDetailFixtureFactory } from "./compact-process-detail-fixture.js";
|
|
3
|
-
export { FakeGitOps, type RepoTemplate } from "./fakes/fake-git-ops.js";
|
|
4
|
-
export { FakeLlmProvider, type LlmResponse } from "./fakes/fake-llm.js";
|
|
1
|
+
export { FakeLlmProvider } from "./fakes/fake-llm.js";
|
|
5
2
|
export { postImmediateLaunch, postImmediateLaunchRequest } from "./http-launch.js";
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
+
};
|
|
15
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,43 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createCompactProcessDetailFixtureFactory
|
|
3
|
-
} from "./chunk-MV4W6NOO.js";
|
|
4
1
|
import {
|
|
5
2
|
createInMemoryExternalWriteLog,
|
|
6
|
-
createIntegrationHarness,
|
|
7
3
|
createPollingTestExtension,
|
|
8
|
-
createTestApp,
|
|
9
4
|
createTestServerSetupCapability,
|
|
10
|
-
createToolCollector
|
|
11
|
-
|
|
12
|
-
waitForValue
|
|
13
|
-
} from "./chunk-KPSK7EMY.js";
|
|
14
|
-
import {
|
|
15
|
-
FakeGitOps
|
|
16
|
-
} from "./chunk-7ZK5QRGP.js";
|
|
5
|
+
createToolCollector
|
|
6
|
+
} from "./chunk-5BZSJ4OO.js";
|
|
17
7
|
import {
|
|
18
8
|
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";
|
|
9
|
+
} from "./chunk-EXHTWQAE.js";
|
|
41
10
|
|
|
42
11
|
// src/http-launch.ts
|
|
43
12
|
async function postImmediateLaunchRequest(input, init) {
|
|
@@ -127,31 +96,19 @@ function fixtureModelProviders(...models) {
|
|
|
127
96
|
}))
|
|
128
97
|
);
|
|
129
98
|
}
|
|
99
|
+
|
|
100
|
+
// src/index.ts
|
|
101
|
+
function createInMemoryExternalWriteLog2() {
|
|
102
|
+
return createInMemoryExternalWriteLog();
|
|
103
|
+
}
|
|
130
104
|
export {
|
|
131
|
-
FakeGitOps,
|
|
132
105
|
FakeLlmProvider,
|
|
133
|
-
|
|
134
|
-
StubPiTreeHandleFactory,
|
|
135
|
-
createTestIpcEnvelopeBase as baseEnvelope,
|
|
136
|
-
createCompactProcessDetailFixtureFactory,
|
|
137
|
-
createInMemoryExternalWriteLog,
|
|
138
|
-
createInProcessWorkerSpawn,
|
|
139
|
-
createIntegrationHarness,
|
|
106
|
+
createInMemoryExternalWriteLog2 as createInMemoryExternalWriteLog,
|
|
140
107
|
createPollingTestExtension,
|
|
141
|
-
createSchemaDrivenStubPiFactory,
|
|
142
|
-
createSchemaDrivenToolCallScriptResolver,
|
|
143
|
-
createStubToolScriptController,
|
|
144
|
-
createTestApp,
|
|
145
108
|
createTestServerSetupCapability,
|
|
146
109
|
createToolCollector,
|
|
147
110
|
fixtureModelProviders,
|
|
148
|
-
flushAsyncWork,
|
|
149
111
|
postImmediateLaunch,
|
|
150
|
-
postImmediateLaunchRequest
|
|
151
|
-
setupServerExtensionTest,
|
|
152
|
-
synthesizeStubArgValue,
|
|
153
|
-
synthesizeStubToolArgs,
|
|
154
|
-
createTestConfigSnapshot as testConfigSnapshot,
|
|
155
|
-
waitForValue
|
|
112
|
+
postImmediateLaunchRequest
|
|
156
113
|
};
|
|
157
114
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/
|
|
1
|
+
{"version":3,"sources":["../src/http-launch.ts","../src/model-provider-fixtures.ts","../src/index.ts"],"sourcesContent":["import type { LaunchRun } from \"@leitwerk-dev/domain\";\n\n/** Accepts a launch-run request shape and waits for its admitted process commit. @internal */\nexport async function postImmediateLaunchRequest(\n\tinput: string | URL | Request,\n\tinit?: RequestInit,\n): Promise<Response> {\n\tconst url = new URL(String(input));\n\tconst match = /^\\/api\\/launchers\\/([^/]+)\\/launch-runs$/.exec(url.pathname);\n\tif (!match?.[1]) throw new Error(`Expected an immediate launch-run URL, received '${url}'`);\n\tconst body = init?.body ? (JSON.parse(String(init.body)) as Record<string, unknown>) : {};\n\treturn postImmediateLaunch(url.origin, decodeURIComponent(match[1]), body);\n}\n\n/**\n * Admits an immediate launch through the public asynchronous HTTP contract and waits until the\n * process commit or a pre-commit failure is observable. Intended for integration-test setup.\n */\n/** @public */\nexport async function postImmediateLaunch(\n\tserverBaseUrl: string,\n\tlauncherId: string,\n\tbody: Record<string, unknown>,\n): Promise<Response> {\n\tconst admitted = await fetch(\n\t\t`${serverBaseUrl.replace(/\\/$/, \"\")}/api/launchers/${encodeURIComponent(launcherId)}/launch-runs`,\n\t\t{\n\t\t\tmethod: \"POST\",\n\t\t\theaders: { \"content-type\": \"application/json\", \"idempotency-key\": crypto.randomUUID() },\n\t\t\tbody: JSON.stringify({ ...body, schedule: { mode: \"now\" } }),\n\t\t},\n\t);\n\tconst admittedBody = (await admitted.json()) as { launchRunId?: string };\n\tif (admitted.status !== 202 || !admittedBody.launchRunId) {\n\t\treturn new Response(JSON.stringify(admittedBody), {\n\t\t\tstatus: admitted.status,\n\t\t\theaders: { \"content-type\": \"application/json\" },\n\t\t});\n\t}\n\n\tlet launchRun: LaunchRun;\n\tconst deadline = Date.now() + 10_000;\n\tfor (;;) {\n\t\tconst response = await fetch(\n\t\t\t`${serverBaseUrl.replace(/\\/$/, \"\")}/api/launch-runs/${admittedBody.launchRunId}`,\n\t\t);\n\t\tconst responseBody = (await response.json()) as { launchRun: LaunchRun };\n\t\tif (\n\t\t\tresponseBody.launchRun.instanceId ||\n\t\t\t[\"failed\", \"cancelled\"].includes(responseBody.launchRun.status)\n\t\t) {\n\t\t\tlaunchRun = responseBody.launchRun;\n\t\t\tbreak;\n\t\t}\n\t\tif (Date.now() >= deadline) throw new Error(\"Timed out waiting for immediate launch admission\");\n\t\tawait new Promise((resolve) => setTimeout(resolve, 10));\n\t}\n\n\tif (!launchRun.instanceId) {\n\t\tconst failure = launchRun.steps.find((step) => step.status === \"failed\");\n\t\treturn new Response(\n\t\t\tJSON.stringify({\n\t\t\t\terror: failure?.safeSummary ?? \"Launch failed\",\n\t\t\t\tlaunchRunId: launchRun.id,\n\t\t\t}),\n\t\t\t{ status: 400, headers: { \"content-type\": \"application/json\" } },\n\t\t);\n\t}\n\tconst detailResponse = await fetch(\n\t\t`${serverBaseUrl.replace(/\\/$/, \"\")}/api/processes/${encodeURIComponent(launchRun.instanceId)}`,\n\t);\n\tconst detail = (await detailResponse.json()) as { process: unknown; projects?: unknown[] };\n\tconst failure = launchRun.steps.find((step) => step.status === \"failed\");\n\treturn new Response(\n\t\tJSON.stringify({\n\t\t\tprocess: detail.process,\n\t\t\tprojects: detail.projects ?? [],\n\t\t\tlaunchRunId: launchRun.id,\n\t\t\t...(launchRun.status === \"failed\"\n\t\t\t\t? { error: failure?.safeSummary ?? \"Process was created, but startup failed\" }\n\t\t\t\t: {}),\n\t\t}),\n\t\t{\n\t\t\tstatus: launchRun.status === \"failed\" ? 200 : 201,\n\t\t\theaders: { \"content-type\": \"application/json\" },\n\t\t},\n\t);\n}\n","import {\n\tbuiltinPiProvider,\n\tdefineModelProvider,\n\tdefineModelProviders,\n} from \"@leitwerk-dev/process-sdk\";\n\n/** @public */\nexport type FixtureModelProviderSet = ReturnType<typeof defineModelProviders>;\n\n/** @public */\nexport function fixtureModelProviders(\n\t...models: {\n\t\t/** @public */\n\t\tid: string;\n\t\t/** @public */\n\t\tmodelId: string;\n\t\t/** @internal */\n\t\tpiProvider?: string;\n\t\t/** @public */\n\t\tserver?: boolean;\n\t}[]\n): FixtureModelProviderSet {\n\treturn defineModelProviders((rawConfig) =>\n\t\tmodels.map(({ id, modelId, piProvider = id, server = false }) => ({\n\t\t\tdefinition: defineModelProvider({\n\t\t\t\tid,\n\t\t\t\tparseConfig: () => ({ config: {} }),\n\t\t\t\tworker: builtinPiProvider(piProvider),\n\t\t\t\t...(server ? { server: builtinPiProvider(piProvider) } : {}),\n\t\t\t\tmodels: () => [{ modelId, availability: \"available\" }],\n\t\t\t\tsecrets: () => ({}),\n\t\t\t}),\n\t\t\trawConfig,\n\t\t})),\n\t);\n}\n","import { createInMemoryExternalWriteLog as createInMemoryExternalWriteLogImpl } from \"./server-extension-test-harness.js\";\n\nexport { FakeLlmProvider } from \"./fakes/fake-llm.js\";\nexport { postImmediateLaunch, postImmediateLaunchRequest } from \"./http-launch.js\";\nexport {\n\ttype FixtureModelProviderSet,\n\tfixtureModelProviders,\n} from \"./model-provider-fixtures.js\";\nexport {\n\tcreatePollingTestExtension,\n\tcreateTestServerSetupCapability,\n\tcreateToolCollector,\n} from \"./server-extension-test-harness.js\";\n/** @internal */\nexport function createInMemoryExternalWriteLog(): {\n\t/** @internal */\n\trecords: Array<{\n\t\t/** @internal */\n\t\tdedupKey: string;\n\t}>;\n\t/** @internal */\n\thasDedupKey(key: string): boolean;\n\t/** @internal */\n\trecord(input: {\n\t\t/** @internal */\n\t\tdedupKey: string;\n\t}): {\n\t\t/** @internal */\n\t\tdedupKey: string;\n\t};\n\t/** @internal */\n\tgetDedupKeys(): ReadonlySet<string>;\n} {\n\treturn createInMemoryExternalWriteLogImpl();\n}\n"],"mappings":";;;;;;;;;;;AAGA,eAAsB,2BACrB,OACA,MACoB;AACpB,QAAM,MAAM,IAAI,IAAI,OAAO,KAAK,CAAC;AACjC,QAAM,QAAQ,2CAA2C,KAAK,IAAI,QAAQ;AAC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