@leitwerk-dev/worker-protocol 0.1.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/LICENSE +13 -0
- package/dist/chunk-DVN32ANP.js +62 -0
- package/dist/chunk-DVN32ANP.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/ipc-codec.d.ts +29 -0
- package/dist/ipc-codec.d.ts.map +1 -0
- package/dist/ipc-codec.js +48 -0
- package/dist/ipc-codec.js.map +1 -0
- package/dist/ipc-decode.d.ts +19 -0
- package/dist/ipc-decode.d.ts.map +1 -0
- package/dist/ipc-decode.js +68 -0
- package/dist/ipc-decode.js.map +1 -0
- package/dist/ipc-messages.d.ts +310 -0
- package/dist/ipc-messages.d.ts.map +1 -0
- package/dist/ipc-messages.js +14 -0
- package/dist/ipc-messages.js.map +1 -0
- package/dist/pi-resource-bundle.d.ts +19 -0
- package/dist/pi-resource-bundle.d.ts.map +1 -0
- package/dist/pi-resource-bundle.js +139 -0
- package/dist/pi-resource-bundle.js.map +1 -0
- package/dist/pi-resource-manifest.d.ts +48 -0
- package/dist/pi-resource-manifest.d.ts.map +1 -0
- package/dist/pi-resource-manifest.js +101 -0
- package/dist/pi-resource-manifest.js.map +1 -0
- package/dist/testing.d.ts +3 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +33 -0
- package/dist/testing.js.map +1 -0
- package/dist/worker-api-version.d.ts +9 -0
- package/dist/worker-api-version.d.ts.map +1 -0
- package/dist/worker-api-version.js +9 -0
- package/dist/worker-api-version.js.map +1 -0
- package/dist/worker-ipc-transport.d.ts +8 -0
- package/dist/worker-ipc-transport.d.ts.map +1 -0
- package/dist/worker-ipc-transport.js +8 -0
- package/dist/worker-ipc-transport.js.map +1 -0
- package/dist/worker-result-image.d.ts +27 -0
- package/dist/worker-result-image.d.ts.map +1 -0
- package/dist/worker-result-image.js +55 -0
- package/dist/worker-result-image.js.map +1 -0
- package/dist/worker-session-snapshot.d.ts +6 -0
- package/dist/worker-session-snapshot.d.ts.map +1 -0
- package/dist/worker-session-snapshot.js +8 -0
- package/dist/worker-session-snapshot.js.map +1 -0
- package/package.json +46 -0
- package/src/index.ts +10 -0
- package/src/ipc-codec.ts +60 -0
- package/src/ipc-decode.ts +85 -0
- package/src/ipc-messages.ts +381 -0
- package/src/pi-resource-bundle.ts +162 -0
- package/src/pi-resource-manifest.ts +130 -0
- package/src/testing.ts +34 -0
- package/src/worker-api-version.ts +8 -0
- package/src/worker-ipc-transport.ts +7 -0
- package/src/worker-result-image.ts +78 -0
- package/src/worker-session-snapshot.ts +7 -0
package/dist/LICENSE
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Copyright 2026 Leitwerk contributors.
|
|
2
|
+
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License.
|
|
5
|
+
You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
See the License for the specific language governing permissions and
|
|
13
|
+
limitations under the License.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// src/worker-result-image.ts
|
|
2
|
+
import * as v from "valibot";
|
|
3
|
+
var WORKER_RESULT_IMAGE_WORKER_ID_HEADER = "x-leitwerk-worker-id";
|
|
4
|
+
var RESULT_IMAGE_MIME_TYPES = ["image/png", "image/jpeg", "image/webp"];
|
|
5
|
+
var RESULT_IMAGE_MAX_SIZE_BYTES = 10 * 1024 * 1024;
|
|
6
|
+
var RESULT_IMAGE_STORAGE_SEGMENT_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
7
|
+
var RESULT_IMAGE_ID_PATTERN = /^img_[A-Za-z0-9]+\.(png|jpg|webp)$/;
|
|
8
|
+
function isResultImageStorageSegment(value) {
|
|
9
|
+
return RESULT_IMAGE_STORAGE_SEGMENT_PATTERN.test(value);
|
|
10
|
+
}
|
|
11
|
+
function parseResultImageId(value) {
|
|
12
|
+
const extension = RESULT_IMAGE_ID_PATTERN.exec(value)?.[1];
|
|
13
|
+
return extension === "png" || extension === "jpg" || extension === "webp" ? { extension } : null;
|
|
14
|
+
}
|
|
15
|
+
function assertResultImageStorageSegment(value) {
|
|
16
|
+
if (!isResultImageStorageSegment(value)) throw new Error("Invalid result image storage id");
|
|
17
|
+
}
|
|
18
|
+
var workerResultImageUploadResponseSchema = v.object({
|
|
19
|
+
imageId: v.string(),
|
|
20
|
+
url: v.string(),
|
|
21
|
+
mimeType: v.picklist(RESULT_IMAGE_MIME_TYPES),
|
|
22
|
+
byteSize: v.number()
|
|
23
|
+
});
|
|
24
|
+
function buildWorkerResultImageUploadPath(instanceId, turnRecordId) {
|
|
25
|
+
assertResultImageStorageSegment(instanceId);
|
|
26
|
+
assertResultImageStorageSegment(turnRecordId);
|
|
27
|
+
return `/internal/workers/${instanceId}/turn-records/${turnRecordId}/result-images`;
|
|
28
|
+
}
|
|
29
|
+
function buildManagedResultImagePath(instanceId, turnRecordId, imageId) {
|
|
30
|
+
assertResultImageStorageSegment(instanceId);
|
|
31
|
+
assertResultImageStorageSegment(turnRecordId);
|
|
32
|
+
if (!parseResultImageId(imageId)) throw new Error("Invalid result image id");
|
|
33
|
+
return `/api/processes/${instanceId}/turn-records/${turnRecordId}/result-images/${imageId}`;
|
|
34
|
+
}
|
|
35
|
+
var MANAGED_RESULT_IMAGE_PATH = /^\/api\/processes\/([^/]+)\/turn-records\/([^/]+)\/result-images\/([^/]+)$/;
|
|
36
|
+
function parseManagedResultImagePath(value) {
|
|
37
|
+
const match = MANAGED_RESULT_IMAGE_PATH.exec(value);
|
|
38
|
+
const instanceId = match?.[1];
|
|
39
|
+
const turnRecordId = match?.[2];
|
|
40
|
+
const imageId = match?.[3];
|
|
41
|
+
return instanceId && turnRecordId && imageId && isResultImageStorageSegment(instanceId) && isResultImageStorageSegment(turnRecordId) && parseResultImageId(imageId) ? { instanceId, turnRecordId, imageId } : null;
|
|
42
|
+
}
|
|
43
|
+
function parseWorkerResultImageUploadResponse(value) {
|
|
44
|
+
const parsed = v.safeParse(workerResultImageUploadResponseSchema, value);
|
|
45
|
+
return parsed.success ? parsed.output : null;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export {
|
|
49
|
+
WORKER_RESULT_IMAGE_WORKER_ID_HEADER,
|
|
50
|
+
RESULT_IMAGE_MIME_TYPES,
|
|
51
|
+
RESULT_IMAGE_MAX_SIZE_BYTES,
|
|
52
|
+
RESULT_IMAGE_STORAGE_SEGMENT_PATTERN,
|
|
53
|
+
RESULT_IMAGE_ID_PATTERN,
|
|
54
|
+
isResultImageStorageSegment,
|
|
55
|
+
parseResultImageId,
|
|
56
|
+
workerResultImageUploadResponseSchema,
|
|
57
|
+
buildWorkerResultImageUploadPath,
|
|
58
|
+
buildManagedResultImagePath,
|
|
59
|
+
parseManagedResultImagePath,
|
|
60
|
+
parseWorkerResultImageUploadResponse
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=chunk-DVN32ANP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/worker-result-image.ts"],"sourcesContent":["import * as v from \"valibot\";\n\nexport const WORKER_RESULT_IMAGE_WORKER_ID_HEADER = \"x-leitwerk-worker-id\";\nexport const RESULT_IMAGE_MIME_TYPES = [\"image/png\", \"image/jpeg\", \"image/webp\"] as const;\nexport const RESULT_IMAGE_MAX_SIZE_BYTES = 10 * 1024 * 1024;\nexport const RESULT_IMAGE_STORAGE_SEGMENT_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;\nexport const RESULT_IMAGE_ID_PATTERN = /^img_[A-Za-z0-9]+\\.(png|jpg|webp)$/;\nexport type ResultImageMimeType = (typeof RESULT_IMAGE_MIME_TYPES)[number];\n\nexport function isResultImageStorageSegment(value: string): boolean {\n\treturn RESULT_IMAGE_STORAGE_SEGMENT_PATTERN.test(value);\n}\n\nexport function parseResultImageId(value: string): { extension: \"png\" | \"jpg\" | \"webp\" } | null {\n\tconst extension = RESULT_IMAGE_ID_PATTERN.exec(value)?.[1];\n\treturn extension === \"png\" || extension === \"jpg\" || extension === \"webp\" ? { extension } : null;\n}\n\nfunction assertResultImageStorageSegment(value: string): void {\n\tif (!isResultImageStorageSegment(value)) throw new Error(\"Invalid result image storage id\");\n}\n\nexport const workerResultImageUploadResponseSchema = v.object({\n\timageId: v.string(),\n\turl: v.string(),\n\tmimeType: v.picklist(RESULT_IMAGE_MIME_TYPES),\n\tbyteSize: v.number(),\n});\n\nexport type WorkerResultImageUploadResponse = v.InferOutput<\n\ttypeof workerResultImageUploadResponseSchema\n>;\n\nexport function buildWorkerResultImageUploadPath(instanceId: string, turnRecordId: string): string {\n\tassertResultImageStorageSegment(instanceId);\n\tassertResultImageStorageSegment(turnRecordId);\n\treturn `/internal/workers/${instanceId}/turn-records/${turnRecordId}/result-images`;\n}\n\nexport function buildManagedResultImagePath(\n\tinstanceId: string,\n\tturnRecordId: string,\n\timageId: string,\n): string {\n\tassertResultImageStorageSegment(instanceId);\n\tassertResultImageStorageSegment(turnRecordId);\n\tif (!parseResultImageId(imageId)) throw new Error(\"Invalid result image id\");\n\treturn `/api/processes/${instanceId}/turn-records/${turnRecordId}/result-images/${imageId}`;\n}\n\nconst MANAGED_RESULT_IMAGE_PATH =\n\t/^\\/api\\/processes\\/([^/]+)\\/turn-records\\/([^/]+)\\/result-images\\/([^/]+)$/;\n\nexport function parseManagedResultImagePath(value: string): {\n\tinstanceId: string;\n\tturnRecordId: string;\n\timageId: string;\n} | null {\n\tconst match = MANAGED_RESULT_IMAGE_PATH.exec(value);\n\tconst instanceId = match?.[1];\n\tconst turnRecordId = match?.[2];\n\tconst imageId = match?.[3];\n\treturn instanceId &&\n\t\tturnRecordId &&\n\t\timageId &&\n\t\tisResultImageStorageSegment(instanceId) &&\n\t\tisResultImageStorageSegment(turnRecordId) &&\n\t\tparseResultImageId(imageId)\n\t\t? { instanceId, turnRecordId, imageId }\n\t\t: null;\n}\n\nexport function parseWorkerResultImageUploadResponse(\n\tvalue: unknown,\n): WorkerResultImageUploadResponse | null {\n\tconst parsed = v.safeParse(workerResultImageUploadResponseSchema, value);\n\treturn parsed.success ? parsed.output : null;\n}\n"],"mappings":";AAAA,YAAY,OAAO;AAEZ,IAAM,uCAAuC;AAC7C,IAAM,0BAA0B,CAAC,aAAa,cAAc,YAAY;AACxE,IAAM,8BAA8B,KAAK,OAAO;AAChD,IAAM,uCAAuC;AAC7C,IAAM,0BAA0B;AAGhC,SAAS,4BAA4B,OAAwB;AACnE,SAAO,qCAAqC,KAAK,KAAK;AACvD;AAEO,SAAS,mBAAmB,OAA6D;AAC/F,QAAM,YAAY,wBAAwB,KAAK,KAAK,IAAI,CAAC;AACzD,SAAO,cAAc,SAAS,cAAc,SAAS,cAAc,SAAS,EAAE,UAAU,IAAI;AAC7F;AAEA,SAAS,gCAAgC,OAAqB;AAC7D,MAAI,CAAC,4BAA4B,KAAK,EAAG,OAAM,IAAI,MAAM,iCAAiC;AAC3F;AAEO,IAAM,wCAA0C,SAAO;AAAA,EAC7D,SAAW,SAAO;AAAA,EAClB,KAAO,SAAO;AAAA,EACd,UAAY,WAAS,uBAAuB;AAAA,EAC5C,UAAY,SAAO;AACpB,CAAC;AAMM,SAAS,iCAAiC,YAAoB,cAA8B;AAClG,kCAAgC,UAAU;AAC1C,kCAAgC,YAAY;AAC5C,SAAO,qBAAqB,UAAU,iBAAiB,YAAY;AACpE;AAEO,SAAS,4BACf,YACA,cACA,SACS;AACT,kCAAgC,UAAU;AAC1C,kCAAgC,YAAY;AAC5C,MAAI,CAAC,mBAAmB,OAAO,EAAG,OAAM,IAAI,MAAM,yBAAyB;AAC3E,SAAO,kBAAkB,UAAU,iBAAiB,YAAY,kBAAkB,OAAO;AAC1F;AAEA,IAAM,4BACL;AAEM,SAAS,4BAA4B,OAInC;AACR,QAAM,QAAQ,0BAA0B,KAAK,KAAK;AAClD,QAAM,aAAa,QAAQ,CAAC;AAC5B,QAAM,eAAe,QAAQ,CAAC;AAC9B,QAAM,UAAU,QAAQ,CAAC;AACzB,SAAO,cACN,gBACA,WACA,4BAA4B,UAAU,KACtC,4BAA4B,YAAY,KACxC,mBAAmB,OAAO,IACxB,EAAE,YAAY,cAAc,QAAQ,IACpC;AACJ;AAEO,SAAS,qCACf,OACyC;AACzC,QAAM,SAAW,YAAU,uCAAuC,KAAK;AACvE,SAAO,OAAO,UAAU,OAAO,SAAS;AACzC;","names":[]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "./ipc-codec.js";
|
|
2
|
+
export * from "./ipc-decode.js";
|
|
3
|
+
export * from "./ipc-messages.js";
|
|
4
|
+
export * from "./pi-resource-bundle.js";
|
|
5
|
+
export * from "./pi-resource-manifest.js";
|
|
6
|
+
export * from "./testing.js";
|
|
7
|
+
export * from "./worker-api-version.js";
|
|
8
|
+
export * from "./worker-ipc-transport.js";
|
|
9
|
+
export * from "./worker-result-image.js";
|
|
10
|
+
export * from "./worker-session-snapshot.js";
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "./ipc-codec.js";
|
|
2
|
+
export * from "./ipc-decode.js";
|
|
3
|
+
export * from "./ipc-messages.js";
|
|
4
|
+
export * from "./pi-resource-bundle.js";
|
|
5
|
+
export * from "./pi-resource-manifest.js";
|
|
6
|
+
export * from "./testing.js";
|
|
7
|
+
export * from "./worker-api-version.js";
|
|
8
|
+
export * from "./worker-ipc-transport.js";
|
|
9
|
+
export * from "./worker-result-image.js";
|
|
10
|
+
export * from "./worker-session-snapshot.js";
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
export declare const IPC_PROTOCOL_VERSION: "leitwerk/worker-ipc/v1";
|
|
3
|
+
export declare const IPC_ENVELOPE_SCHEMA: v.ObjectSchema<{
|
|
4
|
+
readonly protocol: v.LiteralSchema<"leitwerk/worker-ipc/v1", undefined>;
|
|
5
|
+
readonly messageId: v.StringSchema<undefined>;
|
|
6
|
+
readonly correlationId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
7
|
+
readonly type: v.StringSchema<undefined>;
|
|
8
|
+
readonly instanceId: v.StringSchema<undefined>;
|
|
9
|
+
readonly workerId: v.StringSchema<undefined>;
|
|
10
|
+
readonly sentAt: v.StringSchema<undefined>;
|
|
11
|
+
readonly payload: v.UnknownSchema;
|
|
12
|
+
}, undefined>;
|
|
13
|
+
export type IpcEnvelope = v.InferOutput<typeof IPC_ENVELOPE_SCHEMA>;
|
|
14
|
+
export declare function validateEnvelope(msg: unknown): {
|
|
15
|
+
ok: true;
|
|
16
|
+
envelope: IpcEnvelope;
|
|
17
|
+
} | {
|
|
18
|
+
ok: false;
|
|
19
|
+
error: string;
|
|
20
|
+
};
|
|
21
|
+
export declare function serializeMessage<TEnvelope extends IpcEnvelope>(envelope: TEnvelope): string;
|
|
22
|
+
export declare function deserializeMessage(line: string): {
|
|
23
|
+
ok: true;
|
|
24
|
+
message: IpcEnvelope;
|
|
25
|
+
} | {
|
|
26
|
+
ok: false;
|
|
27
|
+
error: string;
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=ipc-codec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ipc-codec.d.ts","sourceRoot":"","sources":["../src/ipc-codec.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAE7B,eAAO,MAAM,oBAAoB,EAAG,wBAAiC,CAAC;AAEtE,eAAO,MAAM,mBAAmB;;;;;;;;;aAS9B,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEpE,wBAAgB,gBAAgB,CAC/B,GAAG,EAAE,OAAO,GACV;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,WAAW,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAiBpE;AAED,wBAAgB,gBAAgB,CAAC,SAAS,SAAS,WAAW,EAAE,QAAQ,EAAE,SAAS,GAAG,MAAM,CAE3F;AAED,wBAAgB,kBAAkB,CACjC,IAAI,EAAE,MAAM,GACV;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,WAAW,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAcnE"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { parseSchema } from "@leitwerk-dev/protocol";
|
|
2
|
+
import * as v from "valibot";
|
|
3
|
+
export const IPC_PROTOCOL_VERSION = "leitwerk/worker-ipc/v1";
|
|
4
|
+
export const IPC_ENVELOPE_SCHEMA = v.object({
|
|
5
|
+
protocol: v.literal(IPC_PROTOCOL_VERSION),
|
|
6
|
+
messageId: v.string(),
|
|
7
|
+
correlationId: v.optional(v.string()),
|
|
8
|
+
type: v.string(),
|
|
9
|
+
instanceId: v.string(),
|
|
10
|
+
workerId: v.string(),
|
|
11
|
+
sentAt: v.string(),
|
|
12
|
+
payload: v.unknown(),
|
|
13
|
+
});
|
|
14
|
+
export function validateEnvelope(msg) {
|
|
15
|
+
if (typeof msg === "object" &&
|
|
16
|
+
msg !== null &&
|
|
17
|
+
"protocol" in msg &&
|
|
18
|
+
typeof msg.protocol === "string" &&
|
|
19
|
+
msg.protocol !== IPC_PROTOCOL_VERSION) {
|
|
20
|
+
return {
|
|
21
|
+
ok: false,
|
|
22
|
+
error: `Worker IPC protocol '${msg.protocol}' is incompatible with expected protocol '${IPC_PROTOCOL_VERSION}'`,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
const envelope = parseSchema(IPC_ENVELOPE_SCHEMA, msg, "ipc envelope");
|
|
26
|
+
return envelope.ok
|
|
27
|
+
? { ok: true, envelope: envelope.value }
|
|
28
|
+
: { ok: false, error: envelope.error };
|
|
29
|
+
}
|
|
30
|
+
export function serializeMessage(envelope) {
|
|
31
|
+
return JSON.stringify(envelope);
|
|
32
|
+
}
|
|
33
|
+
export function deserializeMessage(line) {
|
|
34
|
+
const trimmed = line.length > 0 && line.charCodeAt(line.length - 1) === 0x0d ? line.slice(0, -1) : line;
|
|
35
|
+
let parsed;
|
|
36
|
+
try {
|
|
37
|
+
parsed = JSON.parse(trimmed);
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return { ok: false, error: "invalid JSON" };
|
|
41
|
+
}
|
|
42
|
+
const validated = validateEnvelope(parsed);
|
|
43
|
+
if (!validated.ok) {
|
|
44
|
+
return { ok: false, error: validated.error };
|
|
45
|
+
}
|
|
46
|
+
return { ok: true, message: validated.envelope };
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=ipc-codec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ipc-codec.js","sourceRoot":"","sources":["../src/ipc-codec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAE7B,MAAM,CAAC,MAAM,oBAAoB,GAAG,wBAAiC,CAAC;AAEtE,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,oBAAoB,CAAC;IACzC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,aAAa,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACrC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;CACpB,CAAC,CAAC;AAIH,MAAM,UAAU,gBAAgB,CAC/B,GAAY;IAEZ,IACC,OAAO,GAAG,KAAK,QAAQ;QACvB,GAAG,KAAK,IAAI;QACZ,UAAU,IAAI,GAAG;QACjB,OAAO,GAAG,CAAC,QAAQ,KAAK,QAAQ;QAChC,GA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CAAC,KAAK,EAAE,CAAC;IAC9C,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,CAAC,QAAQ,EAAE,CAAC;AAClD,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ServerToWorkerMessage, WorkerToServerMessage } from "./ipc-messages.js";
|
|
2
|
+
export type IpcDecodeResult<TMessage> = {
|
|
3
|
+
ok: true;
|
|
4
|
+
message: TMessage;
|
|
5
|
+
} | {
|
|
6
|
+
ok: false;
|
|
7
|
+
error: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Decode a parsed envelope coming from the server side of the IPC channel.
|
|
11
|
+
* Only envelope structure + message type are runtime-validated.
|
|
12
|
+
*/
|
|
13
|
+
export declare function decodeServerToWorkerMessage(msg: unknown): IpcDecodeResult<ServerToWorkerMessage>;
|
|
14
|
+
/**
|
|
15
|
+
* Decode a parsed envelope coming from the worker side of the IPC channel.
|
|
16
|
+
* Only envelope structure + message type are runtime-validated.
|
|
17
|
+
*/
|
|
18
|
+
export declare function decodeWorkerToServerMessage(msg: unknown): IpcDecodeResult<WorkerToServerMessage>;
|
|
19
|
+
//# sourceMappingURL=ipc-decode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ipc-decode.d.ts","sourceRoot":"","sources":["../src/ipc-decode.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAEtF,MAAM,MAAM,eAAe,CAAC,QAAQ,IACjC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,QAAQ,CAAA;CAAE,GAC/B;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAiEhC;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,OAAO,GAAG,eAAe,CAAC,qBAAqB,CAAC,CAEhG;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,OAAO,GAAG,eAAe,CAAC,qBAAqB,CAAC,CAEhG"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { validateEnvelope } from "./ipc-codec.js";
|
|
2
|
+
const SERVER_TO_WORKER_TYPES = [
|
|
3
|
+
"worker.start",
|
|
4
|
+
"worker.turn_start_accepted",
|
|
5
|
+
"worker.credential_update_accepted",
|
|
6
|
+
"worker.question_response",
|
|
7
|
+
"input.batch",
|
|
8
|
+
"worker.stop",
|
|
9
|
+
"worker.abort_turn",
|
|
10
|
+
];
|
|
11
|
+
const WORKER_TO_SERVER_TYPES = [
|
|
12
|
+
"worker.hello",
|
|
13
|
+
"worker.credential_update",
|
|
14
|
+
"worker.ready",
|
|
15
|
+
"worker.heartbeat",
|
|
16
|
+
"worker.state",
|
|
17
|
+
"worker.input_consumed",
|
|
18
|
+
"worker.event",
|
|
19
|
+
"worker.turn_started",
|
|
20
|
+
"worker.question_requested",
|
|
21
|
+
"worker.turn_outcome",
|
|
22
|
+
"worker.turn_failed",
|
|
23
|
+
"worker.lifecycle_parked",
|
|
24
|
+
"worker.cleanup_started",
|
|
25
|
+
"worker.cleanup_completed",
|
|
26
|
+
"worker.failed",
|
|
27
|
+
];
|
|
28
|
+
function hasMessageType(allowed, value) {
|
|
29
|
+
return allowed.includes(value);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Validate the generic IPC envelope and narrow it to the correct typed message
|
|
33
|
+
* union member for the given direction.
|
|
34
|
+
*
|
|
35
|
+
* This intentionally stops at the message discriminant boundary: it validates
|
|
36
|
+
* envelope structure + known message type, but does not deeply validate the
|
|
37
|
+
* payload shape. Payload fields are trusted to come from same-version
|
|
38
|
+
* leitwerk components, so malformed payloads from a buggy sender can still
|
|
39
|
+
* pass through as typed data.
|
|
40
|
+
*/
|
|
41
|
+
function decodeKnownMessage(msg, allowed, direction) {
|
|
42
|
+
const validated = validateEnvelope(msg);
|
|
43
|
+
if (!validated.ok) {
|
|
44
|
+
return { ok: false, error: validated.error };
|
|
45
|
+
}
|
|
46
|
+
if (!hasMessageType(allowed, validated.envelope.type)) {
|
|
47
|
+
return {
|
|
48
|
+
ok: false,
|
|
49
|
+
error: `unexpected ${direction} message type: ${validated.envelope.type}`,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
return { ok: true, message: validated.envelope };
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Decode a parsed envelope coming from the server side of the IPC channel.
|
|
56
|
+
* Only envelope structure + message type are runtime-validated.
|
|
57
|
+
*/
|
|
58
|
+
export function decodeServerToWorkerMessage(msg) {
|
|
59
|
+
return decodeKnownMessage(msg, SERVER_TO_WORKER_TYPES, "server-to-worker");
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Decode a parsed envelope coming from the worker side of the IPC channel.
|
|
63
|
+
* Only envelope structure + message type are runtime-validated.
|
|
64
|
+
*/
|
|
65
|
+
export function decodeWorkerToServerMessage(msg) {
|
|
66
|
+
return decodeKnownMessage(msg, WORKER_TO_SERVER_TYPES, "worker-to-server");
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=ipc-decode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ipc-decode.js","sourceRoot":"","sources":["../src/ipc-decode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAOlD,MAAM,sBAAsB,GAAG;IAC9B,cAAc;IACd,4BAA4B;IAC5B,mCAAmC;IACnC,0BAA0B;IAC1B,aAAa;IACb,aAAa;IACb,mBAAmB;CACyC,CAAC;AAE9D,MAAM,sBAAsB,GAAG;IAC9B,cAAc;IACd,0BAA0B;IAC1B,cAAc;IACd,kBAAkB;IAClB,cAAc;IACd,uBAAuB;IACvB,cAAc;IACd,qBAAqB;IACrB,2BAA2B;IAC3B,qBAAqB;IACrB,oBAAoB;IACpB,yBAAyB;IACzB,wBAAwB;IACxB,0BAA0B;IAC1B,eAAe;CAC6C,CAAC;AAE9D,SAAS,cAAc,CACtB,OAAyB,EACzB,KAAa;IAEb,OAAQ,OAA6B,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACvD,CAAC;AAED;;;;;;;;;GASG;AACH,SAAS,kBAAkB,CAC1B,GAAY,EACZ,OAAoC,EACpC,SAAiB;IAEjB,MAAM,SAAS,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC;IACxC,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,CAAC;QACnB,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,CAAC,KAAK,EAAE,CAAC;IAC9C,CAAC;IACD,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QACvD,OAAO;YACN,EAAE,EAAE,KAAK;YACT,KAAK,EAAE,cAAc,SAAS,kBAAkB,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE;SACzE,CAAC;IACH,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,CAAC,QAA+B,EAAE,CAAC;AACzE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,2BAA2B,CAAC,GAAY;IACvD,OAAO,kBAAkB,CAAC,GAAG,EAAE,sBAAsB,EAAE,kBAAkB,CAAC,CAAC;AAC5E,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,2BAA2B,CAAC,GAAY;IACvD,OAAO,kBAAkB,CAAC,GAAG,EAAE,sBAAsB,EAAE,kBAAkB,CAAC,CAAC;AAC5E,CAAC"}
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
import type { CurrentExecutionRef, NormalizedQuestion, PreparedTurnStart, ProcessInputTarget, ProcessLifecycleStatus, ProcessSemanticEntryRefKey, ProcessTurnRecordPathType, ProcessTurnType, TurnFailedPayload, TurnStartRecord, WorkerBootstrapReceipt } from "@leitwerk-dev/domain";
|
|
2
|
+
import type { ConfigSnapshot } from "@leitwerk-dev/protocol/config-snapshot";
|
|
3
|
+
import { type IpcEnvelope } from "./ipc-codec.js";
|
|
4
|
+
export interface ProcessInstanceSnapshot {
|
|
5
|
+
id?: string;
|
|
6
|
+
processId?: string;
|
|
7
|
+
selectedTurnId?: string | null;
|
|
8
|
+
lifecycleStatus?: ProcessLifecycleStatus;
|
|
9
|
+
currentExecution?: CurrentExecutionRef;
|
|
10
|
+
planRevision?: number;
|
|
11
|
+
title?: string | null;
|
|
12
|
+
externalId?: string | null;
|
|
13
|
+
externalUrl?: string | null;
|
|
14
|
+
metadata?: Record<string, unknown> | null;
|
|
15
|
+
defaultModelProfileId?: string | null;
|
|
16
|
+
turnConfigsJson?: string | null;
|
|
17
|
+
selectedTurnModelProfileId?: string | null;
|
|
18
|
+
paramsJson?: string | null;
|
|
19
|
+
stateJson?: string | null;
|
|
20
|
+
createdAt?: string;
|
|
21
|
+
updatedAt?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface ProcessProjectSnapshot {
|
|
24
|
+
id?: string;
|
|
25
|
+
instanceId?: string;
|
|
26
|
+
key: string;
|
|
27
|
+
repoLocator: string;
|
|
28
|
+
repoLocatorKind?: "remote_url" | "local_path";
|
|
29
|
+
baseBranch: string;
|
|
30
|
+
workBranch?: string | null;
|
|
31
|
+
externalId?: string | null;
|
|
32
|
+
externalUrl?: string | null;
|
|
33
|
+
metadata?: Record<string, unknown> | null;
|
|
34
|
+
pipelineStatus?: string | null;
|
|
35
|
+
createdAt?: string;
|
|
36
|
+
updatedAt?: string;
|
|
37
|
+
}
|
|
38
|
+
export interface InputDelivery {
|
|
39
|
+
inputId: string;
|
|
40
|
+
sequence: number;
|
|
41
|
+
source: string;
|
|
42
|
+
kind: string;
|
|
43
|
+
target: ProcessInputTarget | null;
|
|
44
|
+
receivedAt: string;
|
|
45
|
+
bodyMarkdown: string;
|
|
46
|
+
}
|
|
47
|
+
export interface WorkerRuntimeContextSnapshot {
|
|
48
|
+
processSnapshot: ProcessInstanceSnapshot;
|
|
49
|
+
projectSnapshots: ProcessProjectSnapshot[];
|
|
50
|
+
turnResultMarkdownBySemanticRef?: Partial<Record<ProcessSemanticEntryRefKey, string>>;
|
|
51
|
+
turnResultMarkdownByProduct?: Record<string, string>;
|
|
52
|
+
}
|
|
53
|
+
export interface WorkerCredentialMaterial {
|
|
54
|
+
providerId: string;
|
|
55
|
+
revision: number;
|
|
56
|
+
/** Secret payload. This type is valid only in worker.start and credential-update frames. */
|
|
57
|
+
values: Record<string, string>;
|
|
58
|
+
}
|
|
59
|
+
export interface WorkerGitSshCredential {
|
|
60
|
+
projectKey: string;
|
|
61
|
+
kind: "git_ssh";
|
|
62
|
+
credentialRef: string;
|
|
63
|
+
/** Secret values; valid only while preparing worker.start. */
|
|
64
|
+
privateKey: string;
|
|
65
|
+
knownHosts: string;
|
|
66
|
+
}
|
|
67
|
+
export interface LlmWorkerStartBootstrap {
|
|
68
|
+
kind: "llm";
|
|
69
|
+
resourceBundle: {
|
|
70
|
+
digest: string;
|
|
71
|
+
archiveBase64: string;
|
|
72
|
+
};
|
|
73
|
+
credential: WorkerCredentialMaterial | null;
|
|
74
|
+
}
|
|
75
|
+
export interface AutomaticWorkerStartBootstrap {
|
|
76
|
+
kind: "automatic";
|
|
77
|
+
}
|
|
78
|
+
interface WorkerStartPayloadBase extends WorkerRuntimeContextSnapshot {
|
|
79
|
+
workerLeaseId: string;
|
|
80
|
+
turnStart: TurnStartRecord;
|
|
81
|
+
/**
|
|
82
|
+
* The immutable pre-acceptance tree plan from the lease that first accepted
|
|
83
|
+
* this start. It is supplied only when a replacement resumes a running turn.
|
|
84
|
+
*/
|
|
85
|
+
acceptedPreparedStart?: PreparedTurnStart | null;
|
|
86
|
+
pendingInputs: InputDelivery[];
|
|
87
|
+
treePaths: {
|
|
88
|
+
primaryTreeFile: string;
|
|
89
|
+
workspaceRoot: string;
|
|
90
|
+
};
|
|
91
|
+
resume: boolean;
|
|
92
|
+
resumeLeafEntryId?: string | null;
|
|
93
|
+
/** Fresh secret material resolved for this physical worker start only. */
|
|
94
|
+
repositoryCredentials?: WorkerGitSshCredential[];
|
|
95
|
+
}
|
|
96
|
+
export type WorkerStartPayload = (WorkerStartPayloadBase & {
|
|
97
|
+
bootstrap: LlmWorkerStartBootstrap;
|
|
98
|
+
configSnapshot: ConfigSnapshot;
|
|
99
|
+
}) | (WorkerStartPayloadBase & {
|
|
100
|
+
bootstrap: AutomaticWorkerStartBootstrap;
|
|
101
|
+
});
|
|
102
|
+
export interface InputBatchPayload {
|
|
103
|
+
inputs: InputDelivery[];
|
|
104
|
+
}
|
|
105
|
+
export interface WorkerStopPayload {
|
|
106
|
+
reason: string;
|
|
107
|
+
}
|
|
108
|
+
export interface WorkerAbortTurnPayload {
|
|
109
|
+
reason: string;
|
|
110
|
+
}
|
|
111
|
+
export interface WorkerTurnStartAcceptedPayload {
|
|
112
|
+
startRecordId: string;
|
|
113
|
+
turnRecordId: string;
|
|
114
|
+
}
|
|
115
|
+
export interface WorkerQuestionResponsePayload {
|
|
116
|
+
turnRecordId: string;
|
|
117
|
+
toolCallId: string;
|
|
118
|
+
answers: string[];
|
|
119
|
+
}
|
|
120
|
+
export interface WorkerQuestionRequestedPayload {
|
|
121
|
+
turnRecordId: string;
|
|
122
|
+
toolCallId: string;
|
|
123
|
+
questions: NormalizedQuestion[];
|
|
124
|
+
}
|
|
125
|
+
export interface WorkerCredentialUpdateResultPayload {
|
|
126
|
+
providerId: string;
|
|
127
|
+
accepted: boolean;
|
|
128
|
+
currentRevision: number | null;
|
|
129
|
+
safeReason?: string;
|
|
130
|
+
}
|
|
131
|
+
export type ServerToWorkerMessage = (Omit<IpcEnvelope, "type" | "payload"> & {
|
|
132
|
+
type: "worker.start";
|
|
133
|
+
payload: WorkerStartPayload;
|
|
134
|
+
}) | (Omit<IpcEnvelope, "type" | "payload"> & {
|
|
135
|
+
type: "worker.turn_start_accepted";
|
|
136
|
+
payload: WorkerTurnStartAcceptedPayload;
|
|
137
|
+
}) | (Omit<IpcEnvelope, "type" | "payload"> & {
|
|
138
|
+
type: "worker.credential_update_accepted";
|
|
139
|
+
payload: WorkerCredentialUpdateResultPayload;
|
|
140
|
+
}) | (Omit<IpcEnvelope, "type" | "payload"> & {
|
|
141
|
+
type: "worker.question_response";
|
|
142
|
+
payload: WorkerQuestionResponsePayload;
|
|
143
|
+
}) | (Omit<IpcEnvelope, "type" | "payload"> & {
|
|
144
|
+
type: "input.batch";
|
|
145
|
+
payload: InputBatchPayload;
|
|
146
|
+
}) | (Omit<IpcEnvelope, "type" | "payload"> & {
|
|
147
|
+
type: "worker.stop";
|
|
148
|
+
payload: WorkerStopPayload;
|
|
149
|
+
}) | (Omit<IpcEnvelope, "type" | "payload"> & {
|
|
150
|
+
type: "worker.abort_turn";
|
|
151
|
+
payload: WorkerAbortTurnPayload;
|
|
152
|
+
});
|
|
153
|
+
export interface WorkerHelloPayload {
|
|
154
|
+
/** Package/runtime version for diagnostics. */
|
|
155
|
+
version: string;
|
|
156
|
+
/** Server-worker API compatibility version. Missing only on legacy/test workers. */
|
|
157
|
+
apiVersion?: string;
|
|
158
|
+
capabilities: string[];
|
|
159
|
+
}
|
|
160
|
+
export interface WorkerReadyPayload {
|
|
161
|
+
receipt: WorkerBootstrapReceipt;
|
|
162
|
+
resumed: boolean;
|
|
163
|
+
primaryTreeFile: string;
|
|
164
|
+
workspaceRoot: string;
|
|
165
|
+
aggregatedAgentsSources: string[];
|
|
166
|
+
loadedSkills: string[];
|
|
167
|
+
loadedAgentsFiles: Array<{
|
|
168
|
+
path: string;
|
|
169
|
+
sizeBytes: number;
|
|
170
|
+
}>;
|
|
171
|
+
loadedSkillFiles: Array<{
|
|
172
|
+
name: string;
|
|
173
|
+
path: string;
|
|
174
|
+
}>;
|
|
175
|
+
rootEntryId?: string | null;
|
|
176
|
+
}
|
|
177
|
+
export interface WorkerHeartbeatPayload {
|
|
178
|
+
/** Diagnostic worker-local runtime state; not the authoritative lease transition channel. */
|
|
179
|
+
state: string;
|
|
180
|
+
lastSequenceConsumed: number;
|
|
181
|
+
currentTurnId?: string;
|
|
182
|
+
currentSelectedTurnId?: string | null;
|
|
183
|
+
}
|
|
184
|
+
export interface WorkerStatePayload {
|
|
185
|
+
/** Explicit server-visible runtime transition, e.g. idle -> busy or busy -> idle. */
|
|
186
|
+
from: string;
|
|
187
|
+
to: string;
|
|
188
|
+
reason: string;
|
|
189
|
+
}
|
|
190
|
+
export interface WorkerInputConsumedPayload {
|
|
191
|
+
inputId: string;
|
|
192
|
+
sequence: number;
|
|
193
|
+
deliveryMode: string;
|
|
194
|
+
currentPrimaryPathLeafId?: string | null;
|
|
195
|
+
rootEntryId?: string | null;
|
|
196
|
+
targetSemanticRef?: ProcessSemanticEntryRefKey | null;
|
|
197
|
+
targetProductName?: string | null;
|
|
198
|
+
targetEntryId?: string | null;
|
|
199
|
+
}
|
|
200
|
+
export interface WorkerEventPayload {
|
|
201
|
+
eventType: string;
|
|
202
|
+
selectedTurnId?: string | null;
|
|
203
|
+
/**
|
|
204
|
+
* Object-shaped event data emitted by trusted worker senders. Decode helpers
|
|
205
|
+
* do not deeply validate this field at runtime; they only narrow it at the
|
|
206
|
+
* protocol boundary after envelope + message-type validation.
|
|
207
|
+
*/
|
|
208
|
+
data: Record<string, unknown>;
|
|
209
|
+
}
|
|
210
|
+
export interface WorkerTurnStartedPayload {
|
|
211
|
+
startRecordId: string;
|
|
212
|
+
proposedTurnRecordId: string;
|
|
213
|
+
}
|
|
214
|
+
export interface WorkerCredentialUpdatePayload {
|
|
215
|
+
providerId: string;
|
|
216
|
+
expectedRevision: number;
|
|
217
|
+
/** Secret payload. It must not be copied into receipts, events, or turn state. */
|
|
218
|
+
values: Record<string, string>;
|
|
219
|
+
}
|
|
220
|
+
export interface WorkerTurnOutcomePayload {
|
|
221
|
+
turnRecordId: string;
|
|
222
|
+
turnId: string;
|
|
223
|
+
turnType: ProcessTurnType;
|
|
224
|
+
outcome: string;
|
|
225
|
+
params: Record<string, unknown>;
|
|
226
|
+
pathType?: ProcessTurnRecordPathType;
|
|
227
|
+
forkPiEntryId?: string | null;
|
|
228
|
+
resultPiEntryId?: string | null;
|
|
229
|
+
turnResultMarkdown?: string | null;
|
|
230
|
+
rootEntryId?: string | null;
|
|
231
|
+
}
|
|
232
|
+
export interface WorkerTurnFailedPayload extends Omit<TurnFailedPayload, "instanceId" | "errorClass"> {
|
|
233
|
+
errorClass?: string;
|
|
234
|
+
}
|
|
235
|
+
export interface WorkerLifecycleParkedPayload {
|
|
236
|
+
selectedTurnId: string | null;
|
|
237
|
+
reason?: string;
|
|
238
|
+
errorClass?: string;
|
|
239
|
+
}
|
|
240
|
+
export interface WorkerCleanupStartedPayload {
|
|
241
|
+
reason: string;
|
|
242
|
+
}
|
|
243
|
+
export interface WorkerCleanupCompletedPayload {
|
|
244
|
+
releasedLocks: string[];
|
|
245
|
+
removedTransientPaths: string[];
|
|
246
|
+
}
|
|
247
|
+
export interface WorkerFailedPayload {
|
|
248
|
+
state: string;
|
|
249
|
+
errorCode: string;
|
|
250
|
+
message: string;
|
|
251
|
+
errorClass: string;
|
|
252
|
+
selectedTurnId?: string | null;
|
|
253
|
+
retryAttempt?: number;
|
|
254
|
+
}
|
|
255
|
+
export type WorkerToServerMessage = (Omit<IpcEnvelope, "type" | "payload"> & {
|
|
256
|
+
type: "worker.hello";
|
|
257
|
+
payload: WorkerHelloPayload;
|
|
258
|
+
}) | (Omit<IpcEnvelope, "type" | "payload"> & {
|
|
259
|
+
type: "worker.credential_update";
|
|
260
|
+
payload: WorkerCredentialUpdatePayload;
|
|
261
|
+
}) | (Omit<IpcEnvelope, "type" | "payload"> & {
|
|
262
|
+
type: "worker.ready";
|
|
263
|
+
payload: WorkerReadyPayload;
|
|
264
|
+
}) | (Omit<IpcEnvelope, "type" | "payload"> & {
|
|
265
|
+
type: "worker.heartbeat";
|
|
266
|
+
payload: WorkerHeartbeatPayload;
|
|
267
|
+
}) | (Omit<IpcEnvelope, "type" | "payload"> & {
|
|
268
|
+
type: "worker.state";
|
|
269
|
+
payload: WorkerStatePayload;
|
|
270
|
+
}) | (Omit<IpcEnvelope, "type" | "payload"> & {
|
|
271
|
+
type: "worker.input_consumed";
|
|
272
|
+
payload: WorkerInputConsumedPayload;
|
|
273
|
+
}) | (Omit<IpcEnvelope, "type" | "payload"> & {
|
|
274
|
+
type: "worker.event";
|
|
275
|
+
payload: WorkerEventPayload;
|
|
276
|
+
}) | (Omit<IpcEnvelope, "type" | "payload"> & {
|
|
277
|
+
type: "worker.turn_started";
|
|
278
|
+
payload: WorkerTurnStartedPayload;
|
|
279
|
+
}) | (Omit<IpcEnvelope, "type" | "payload"> & {
|
|
280
|
+
type: "worker.question_requested";
|
|
281
|
+
payload: WorkerQuestionRequestedPayload;
|
|
282
|
+
}) | (Omit<IpcEnvelope, "type" | "payload"> & {
|
|
283
|
+
type: "worker.turn_outcome";
|
|
284
|
+
payload: WorkerTurnOutcomePayload;
|
|
285
|
+
}) | (Omit<IpcEnvelope, "type" | "payload"> & {
|
|
286
|
+
type: "worker.turn_failed";
|
|
287
|
+
payload: WorkerTurnFailedPayload;
|
|
288
|
+
}) | (Omit<IpcEnvelope, "type" | "payload"> & {
|
|
289
|
+
type: "worker.lifecycle_parked";
|
|
290
|
+
payload: WorkerLifecycleParkedPayload;
|
|
291
|
+
}) | (Omit<IpcEnvelope, "type" | "payload"> & {
|
|
292
|
+
type: "worker.cleanup_started";
|
|
293
|
+
payload: WorkerCleanupStartedPayload;
|
|
294
|
+
}) | (Omit<IpcEnvelope, "type" | "payload"> & {
|
|
295
|
+
type: "worker.cleanup_completed";
|
|
296
|
+
payload: WorkerCleanupCompletedPayload;
|
|
297
|
+
}) | (Omit<IpcEnvelope, "type" | "payload"> & {
|
|
298
|
+
type: "worker.failed";
|
|
299
|
+
payload: WorkerFailedPayload;
|
|
300
|
+
});
|
|
301
|
+
export type AnyIpcMessage = ServerToWorkerMessage | WorkerToServerMessage;
|
|
302
|
+
export type IpcMessageType = AnyIpcMessage["type"];
|
|
303
|
+
export type IpcMessageOfType<TType extends IpcMessageType> = Extract<AnyIpcMessage, {
|
|
304
|
+
type: TType;
|
|
305
|
+
}>;
|
|
306
|
+
export declare function createIpcMessage<TMessage extends AnyIpcMessage>(args: Omit<TMessage, "protocol" | "sentAt"> & {
|
|
307
|
+
sentAt?: string;
|
|
308
|
+
}): TMessage;
|
|
309
|
+
export {};
|
|
310
|
+
//# sourceMappingURL=ipc-messages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ipc-messages.d.ts","sourceRoot":"","sources":["../src/ipc-messages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,sBAAsB,EACtB,0BAA0B,EAC1B,yBAAyB,EACzB,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,sBAAsB,EACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAwB,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAExE,MAAM,WAAW,uBAAuB;IACvC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,eAAe,CAAC,EAAE,sBAAsB,CAAC;IACzC,gBAAgB,CAAC,EAAE,mBAAmB,CAAC;IACvC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC,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;AAEF,wBAAgB,gBAAgB,CAAC,QAAQ,SAAS,aAAa,EAC9D,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,UAAU,GAAG,QAAQ,CAAC,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAC/D,QAAQ,CAWV"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IPC_PROTOCOL_VERSION } from "./ipc-codec.js";
|
|
2
|
+
export function createIpcMessage(args) {
|
|
3
|
+
return {
|
|
4
|
+
protocol: IPC_PROTOCOL_VERSION,
|
|
5
|
+
messageId: args.messageId,
|
|
6
|
+
correlationId: args.correlationId,
|
|
7
|
+
type: args.type,
|
|
8
|
+
instanceId: args.instanceId,
|
|
9
|
+
workerId: args.workerId,
|
|
10
|
+
sentAt: args.sentAt ?? new Date().toISOString(),
|
|
11
|
+
payload: args.payload,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=ipc-messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ipc-messages.js","sourceRoot":"","sources":["../src/ipc-messages.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,oBAAoB,EAAoB,MAAM,gBAAgB,CAAC;AAiWxE,MAAM,UAAU,gBAAgB,CAC/B,IAAiE;IAEjE,OAAO;QACN,QAAQ,EAAE,oBAAoB;QAC9B,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QAC/C,OAAO,EAAE,IAAI,CAAC,OAAO;KACT,CAAC;AACf,CAAC"}
|