@leitwerk-dev/showcase-processes 0.3.0 → 0.3.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/testing/harness.d.ts +30 -4
- package/dist/testing/harness.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/testing/harness.ts +25 -25
|
@@ -5,9 +5,35 @@ export declare function http(test: ExtensionIntegrationHarness, url: string, ini
|
|
|
5
5
|
status: number;
|
|
6
6
|
json: <T = unknown>() => T;
|
|
7
7
|
}>;
|
|
8
|
-
/**
|
|
9
|
-
export declare function
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
/** Admit a launch and observe its process without requiring a transient lifecycle state. */
|
|
9
|
+
export declare function launchProcess(test: ExtensionIntegrationHarness, launcherId: string, launcherInput: {
|
|
10
|
+
prompt: string;
|
|
11
|
+
}, defaultModelProfileId: string): Promise<{
|
|
12
|
+
readonly id: string;
|
|
13
|
+
readonly processId: string;
|
|
14
|
+
readonly selectedTurnId: import("@leitwerk-dev/domain").TurnId | null;
|
|
15
|
+
readonly lifecycleStatus: import("@leitwerk-dev/domain").ProcessLifecycleStatus;
|
|
16
|
+
readonly currentExecution: {
|
|
17
|
+
readonly kind: "worker_start";
|
|
18
|
+
readonly id: string;
|
|
19
|
+
} | null;
|
|
20
|
+
readonly planRevision: number;
|
|
21
|
+
readonly title: string | null;
|
|
22
|
+
readonly externalId: string | null;
|
|
23
|
+
readonly externalUrl: string | null;
|
|
24
|
+
readonly metadata: {
|
|
25
|
+
readonly [x: string]: unknown;
|
|
26
|
+
} | null;
|
|
27
|
+
readonly defaultModelProfileId?: string | null | undefined;
|
|
28
|
+
readonly initialDefaultModelProfileId?: string | null | undefined;
|
|
29
|
+
readonly turnConfigsJson?: string | null | undefined;
|
|
30
|
+
readonly selectedTurnModelProfileId?: string | null | undefined;
|
|
31
|
+
readonly selectedTurnModelKind?: (import("@leitwerk-dev/domain").ModelSelectionKind | null) | undefined;
|
|
32
|
+
readonly selectedTurnModelSource?: (import("@leitwerk-dev/domain").ProcessSelectedTurnModelSource | null) | undefined;
|
|
33
|
+
readonly paramsJson: string | null;
|
|
34
|
+
readonly stateJson: string | null;
|
|
35
|
+
readonly createdAt: string;
|
|
36
|
+
readonly updatedAt: string;
|
|
37
|
+
readonly closedAt?: string | null | undefined;
|
|
12
38
|
}>;
|
|
13
39
|
//# sourceMappingURL=harness.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"harness.d.ts","sourceRoot":"","sources":["../../src/testing/harness.ts"],"names":[],"mappings":"AACA,OAAO,EAEN,KAAK,2BAA2B,EAChC,KAAK,kCAAkC,
|
|
1
|
+
{"version":3,"file":"harness.d.ts","sourceRoot":"","sources":["../../src/testing/harness.ts"],"names":[],"mappings":"AACA,OAAO,EAEN,KAAK,2BAA2B,EAChC,KAAK,kCAAkC,EAEvC,MAAM,wCAAwC,CAAC;AAGhD,wBAAgB,qBAAqB,CAAC,OAAO,GAAE,OAAO,CAAC,kCAAkC,CAAM,wCAqD9F;AAED,+DAA+D;AAC/D,wBAAsB,IAAI,CAAC,IAAI,EAAE,2BAA2B,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,GAAE,WAAgB;;;GAOhG;AAED,4FAA4F;AAC5F,wBAAsB,aAAa,CAClC,IAAI,EAAE,2BAA2B,EACjC,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,EACjC,qBAAqB,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyB7B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leitwerk-dev/showcase-processes",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/leitwerk-dev/leitwerk.git",
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"dev:ext-ui": "node ./scripts/write-ui-manifest.mjs && tsup --silent --watch --config tsup.ui.config.ts"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@leitwerk-dev/domain": "0.3.
|
|
35
|
-
"@leitwerk-dev/process-sdk": "0.3.
|
|
36
|
-
"@leitwerk-dev/watcher-utils": "0.3.
|
|
34
|
+
"@leitwerk-dev/domain": "0.3.1",
|
|
35
|
+
"@leitwerk-dev/process-sdk": "0.3.1",
|
|
36
|
+
"@leitwerk-dev/watcher-utils": "0.3.1"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"tsup": "^8.5.1"
|
package/src/testing/harness.ts
CHANGED
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
createExtensionIntegrationHarness,
|
|
4
4
|
type ExtensionIntegrationHarness,
|
|
5
5
|
type ExtensionIntegrationHarnessOptions,
|
|
6
|
+
waitForValue,
|
|
6
7
|
} from "@leitwerk-dev/test-support/integration";
|
|
7
8
|
import singlePromptExtension from "../index.js";
|
|
8
9
|
|
|
@@ -71,35 +72,34 @@ export async function http(test: ExtensionIntegrationHarness, url: string, init:
|
|
|
71
72
|
return { status: response.statusCode, json: response.json };
|
|
72
73
|
}
|
|
73
74
|
|
|
74
|
-
/**
|
|
75
|
-
export async function
|
|
75
|
+
/** Admit a launch and observe its process without requiring a transient lifecycle state. */
|
|
76
|
+
export async function launchProcess(
|
|
76
77
|
test: ExtensionIntegrationHarness,
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
launcherId: string,
|
|
79
|
+
launcherInput: { prompt: string },
|
|
80
|
+
defaultModelProfileId: string,
|
|
81
|
+
) {
|
|
80
82
|
const admitted = await test.request({
|
|
81
83
|
method: "POST",
|
|
82
|
-
url
|
|
84
|
+
url: `/api/launchers/${launcherId}/launch-runs`,
|
|
83
85
|
headers: { "idempotency-key": crypto.randomUUID() },
|
|
84
|
-
payload: {
|
|
86
|
+
payload: { launcherInput, modelConfig: { defaultModelProfileId }, schedule: { mode: "now" } },
|
|
85
87
|
});
|
|
86
|
-
if (admitted.statusCode !== 202)
|
|
88
|
+
if (admitted.statusCode !== 202) throw new Error(`Launch admission failed: ${admitted.body}`);
|
|
87
89
|
const { launchRunId } = admitted.json<{ launchRunId: string }>();
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
return
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
104
|
-
}
|
|
90
|
+
const launchRun = await waitForValue(
|
|
91
|
+
async () => {
|
|
92
|
+
const response = await test.request({ url: `/api/launch-runs/${launchRunId}` });
|
|
93
|
+
const { launchRun } = response.json<{
|
|
94
|
+
launchRun: { status: string; instanceId: string | null };
|
|
95
|
+
}>();
|
|
96
|
+
if (launchRun.status === "failed" && !launchRun.instanceId)
|
|
97
|
+
throw new Error(`Launch did not commit: ${response.body}`);
|
|
98
|
+
return launchRun;
|
|
99
|
+
},
|
|
100
|
+
(run) => run.instanceId !== null,
|
|
101
|
+
12000,
|
|
102
|
+
);
|
|
103
|
+
if (!launchRun.instanceId) throw new Error("Missing launched process");
|
|
104
|
+
return test.process(launchRun.instanceId).snapshot().process;
|
|
105
105
|
}
|