@leitwerk-dev/worker 0.1.5 → 0.1.7

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.
Files changed (48) hide show
  1. package/dist/{chunk-6OAKGOYC.js → chunk-ZTJ7UAOC.js} +177 -44
  2. package/dist/chunk-ZTJ7UAOC.js.map +1 -0
  3. package/dist/integration-tool-bridge.d.ts +14 -0
  4. package/dist/integration-tool-bridge.d.ts.map +1 -0
  5. package/dist/integration-tool-bridge.js +53 -0
  6. package/dist/integration-tool-bridge.js.map +1 -0
  7. package/dist/question-bridge.d.ts +1 -3
  8. package/dist/question-bridge.d.ts.map +1 -1
  9. package/dist/question-bridge.js +8 -39
  10. package/dist/question-bridge.js.map +1 -1
  11. package/dist/replaying-request-bridge.d.ts +17 -0
  12. package/dist/replaying-request-bridge.d.ts.map +1 -0
  13. package/dist/replaying-request-bridge.js +71 -0
  14. package/dist/replaying-request-bridge.js.map +1 -0
  15. package/dist/runtime/bootstrap-session.d.ts +1 -0
  16. package/dist/runtime/bootstrap-session.d.ts.map +1 -1
  17. package/dist/runtime/bootstrap-session.js +1 -0
  18. package/dist/runtime/bootstrap-session.js.map +1 -1
  19. package/dist/runtime/index.d.ts.map +1 -1
  20. package/dist/runtime/index.js +9 -0
  21. package/dist/runtime/index.js.map +1 -1
  22. package/dist/runtime/llm-turn-execution.d.ts +7 -0
  23. package/dist/runtime/llm-turn-execution.d.ts.map +1 -1
  24. package/dist/runtime/llm-turn-execution.js +24 -2
  25. package/dist/runtime/llm-turn-execution.js.map +1 -1
  26. package/dist/runtime/turn-execution.d.ts +1 -0
  27. package/dist/runtime/turn-execution.d.ts.map +1 -1
  28. package/dist/runtime/turn-execution.js +1 -0
  29. package/dist/runtime/turn-execution.js.map +1 -1
  30. package/dist/turn-outcome-tool-session.d.ts +1 -0
  31. package/dist/turn-outcome-tool-session.d.ts.map +1 -1
  32. package/dist/turn-outcome-tool-session.js +1 -0
  33. package/dist/turn-outcome-tool-session.js.map +1 -1
  34. package/package.json +7 -7
  35. package/src/integration-tool-bridge.ts +84 -0
  36. package/src/question-bridge.ts +30 -47
  37. package/src/replaying-request-bridge.ts +83 -0
  38. package/src/runtime/bootstrap-session.ts +2 -0
  39. package/src/runtime/index.ts +12 -0
  40. package/src/runtime/llm-turn-execution.ts +38 -5
  41. package/src/runtime/turn-execution.ts +2 -0
  42. package/src/turn-outcome-tool-session.ts +2 -0
  43. package/dist/chunk-6OAKGOYC.js.map +0 -1
  44. package/dist/test-helpers/worker-message-builders.d.ts +0 -21
  45. package/dist/test-helpers/worker-message-builders.d.ts.map +0 -1
  46. package/dist/test-helpers/worker-message-builders.js +0 -62
  47. package/dist/test-helpers/worker-message-builders.js.map +0 -1
  48. package/src/test-helpers/worker-message-builders.ts +0 -92
@@ -1,21 +0,0 @@
1
- import type { ProcessSemanticEntryRefKey } from "@leitwerk-dev/domain";
2
- import type { InputDelivery, ProcessInstanceSnapshot, ProcessProjectSnapshot, ServerToWorkerMessage } from "@leitwerk-dev/worker-protocol";
3
- export type TestInputDelivery = Omit<InputDelivery, "receivedAt" | "source" | "kind" | "target"> & {
4
- receivedAt?: string;
5
- source?: string;
6
- kind?: string;
7
- target?: InputDelivery["target"];
8
- };
9
- export declare function toInputDelivery(input: TestInputDelivery): InputDelivery;
10
- export declare function workerStartMessage(instanceId: string, workerId: string, opts: {
11
- processSnapshot?: ProcessInstanceSnapshot;
12
- workspaceRoot: string;
13
- primaryTreeFile: string;
14
- resume: boolean;
15
- resumeLeafEntryId?: string | null;
16
- pendingInputs?: TestInputDelivery[];
17
- projectSnapshots?: ProcessProjectSnapshot[];
18
- turnResultMarkdownBySemanticRef?: Partial<Record<ProcessSemanticEntryRefKey, string>>;
19
- turnResultMarkdownByProduct?: Record<string, string>;
20
- }): ServerToWorkerMessage;
21
- //# sourceMappingURL=worker-message-builders.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"worker-message-builders.d.ts","sourceRoot":"","sources":["../../src/test-helpers/worker-message-builders.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,KAAK,EACX,aAAa,EACb,uBAAuB,EACvB,sBAAsB,EACtB,qBAAqB,EACrB,MAAM,+BAA+B,CAAC;AAIvC,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,aAAa,EAAE,YAAY,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAC,GAAG;IAClG,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;CACjC,CAAC;AAWF,wBAAgB,eAAe,CAAC,KAAK,EAAE,iBAAiB,GAAG,aAAa,CAUvE;AAED,wBAAgB,kBAAkB,CACjC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE;IACL,eAAe,CAAC,EAAE,uBAAuB,CAAC;IAC1C,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,OAAO,CAAC;IAChB,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,aAAa,CAAC,EAAE,iBAAiB,EAAE,CAAC;IACpC,gBAAgB,CAAC,EAAE,sBAAsB,EAAE,CAAC;IAC5C,+BAA+B,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,0BAA0B,EAAE,MAAM,CAAC,CAAC,CAAC;IACtF,2BAA2B,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrD,GACC,qBAAqB,CAuCvB"}
@@ -1,62 +0,0 @@
1
- import { createIpcMessage } from "@leitwerk-dev/worker-protocol";
2
- import { baseEnvelope } from "./ipc-harness.js";
3
- const DEFAULT_PROJECT_SNAPSHOTS = [
4
- {
5
- key: "c1",
6
- repoLocator: "https://example.com/r.git",
7
- baseBranch: "main",
8
- workBranch: "feat-1",
9
- },
10
- ];
11
- export function toInputDelivery(input) {
12
- return {
13
- inputId: input.inputId,
14
- sequence: input.sequence,
15
- source: input.source ?? "user",
16
- kind: input.kind ?? "user",
17
- target: input.target ?? null,
18
- receivedAt: input.receivedAt ?? new Date().toISOString(),
19
- bodyMarkdown: input.bodyMarkdown,
20
- };
21
- }
22
- export function workerStartMessage(instanceId, workerId, opts) {
23
- return createIpcMessage({
24
- ...baseEnvelope(instanceId, workerId, "start-1"),
25
- type: "worker.start",
26
- payload: {
27
- processSnapshot: opts.processSnapshot ?? {},
28
- projectSnapshots: opts.projectSnapshots ?? DEFAULT_PROJECT_SNAPSHOTS,
29
- pendingInputs: (opts.pendingInputs ?? []).map(toInputDelivery),
30
- workerLeaseId: "lease-1",
31
- turnStart: {
32
- id: "start-1",
33
- instanceId,
34
- turnId: "automatic",
35
- turnType: "automatic",
36
- proposedTurnRecordId: "turn-record-1",
37
- startKind: "selected_turn",
38
- recoveryTurnRecordId: null,
39
- continuation: null,
40
- state: { kind: "starting", start: { kind: "automatic" } },
41
- createdAt: new Date().toISOString(),
42
- updatedAt: new Date().toISOString(),
43
- },
44
- bootstrap: { kind: "automatic" },
45
- treePaths: {
46
- primaryTreeFile: opts.primaryTreeFile,
47
- workspaceRoot: opts.workspaceRoot,
48
- },
49
- resume: opts.resume,
50
- ...(opts.resumeLeafEntryId !== undefined
51
- ? { resumeLeafEntryId: opts.resumeLeafEntryId }
52
- : {}),
53
- ...(opts.turnResultMarkdownBySemanticRef
54
- ? { turnResultMarkdownBySemanticRef: opts.turnResultMarkdownBySemanticRef }
55
- : {}),
56
- ...(opts.turnResultMarkdownByProduct
57
- ? { turnResultMarkdownByProduct: opts.turnResultMarkdownByProduct }
58
- : {}),
59
- },
60
- });
61
- }
62
- //# sourceMappingURL=worker-message-builders.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"worker-message-builders.js","sourceR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B,oBAAoB,EAAE,eAAe;gBACrC,SAAS,EAAE,eAAe;gBAC1B,oBAAoB,EAAE,IAAI;gBAC1B,YAAY,EAAE,IAAI;gBAClB,KAAK,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE;gBACzD,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBACnC,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;aACnC;YACD,SAAS,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE;YAChC,SAAS,EAAE;gBACV,eAAe,EAAE,IAAI,CAAC,eAAe;gBACrC,aAAa,EAAE,IAAI,CAAC,aAAa;aACjC;YACD,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,GAAG,CAAC,IAAI,CAAC,iBAAiB,KAAK,SAAS;gBACvC,CAAC,CAAC,EAAE,iBAAiB,EAAE,IAAI,CAAC,iBAAiB,EAAE;gBAC/C,CAAC,CAAC,EAAE,CAAC;YACN,GAAG,CAAC,IAAI,CAAC,+BAA+B;gBACvC,CAAC,CAAC,EAAE,+BAA+B,EAAE,IAAI,CAAC,+BAA+B,EAAE;gBAC3E,CAAC,CAAC,EAAE,CAAC;YACN,GAAG,CAAC,IAAI,CAAC,2BAA2B;gBACnC,CAAC,CAAC,EAAE,2BAA2B,EAAE,IAAI,CAAC,2BAA2B,EAAE;gBACnE,CAAC,CAAC,EAAE,CAAC;SACN;KACD,CAAC,CAAC;AACJ,CAAC"}
@@ -1,92 +0,0 @@
1
- import type { ProcessSemanticEntryRefKey } from "@leitwerk-dev/domain";
2
- import type {
3
- InputDelivery,
4
- ProcessInstanceSnapshot,
5
- ProcessProjectSnapshot,
6
- ServerToWorkerMessage,
7
- } from "@leitwerk-dev/worker-protocol";
8
- import { createIpcMessage } from "@leitwerk-dev/worker-protocol";
9
- import { baseEnvelope } from "./ipc-harness.js";
10
-
11
- export type TestInputDelivery = Omit<InputDelivery, "receivedAt" | "source" | "kind" | "target"> & {
12
- receivedAt?: string;
13
- source?: string;
14
- kind?: string;
15
- target?: InputDelivery["target"];
16
- };
17
-
18
- const DEFAULT_PROJECT_SNAPSHOTS: ProcessProjectSnapshot[] = [
19
- {
20
- key: "c1",
21
- repoLocator: "https://example.com/r.git",
22
- baseBranch: "main",
23
- workBranch: "feat-1",
24
- },
25
- ];
26
-
27
- export function toInputDelivery(input: TestInputDelivery): InputDelivery {
28
- return {
29
- inputId: input.inputId,
30
- sequence: input.sequence,
31
- source: input.source ?? "user",
32
- kind: input.kind ?? "user",
33
- target: input.target ?? null,
34
- receivedAt: input.receivedAt ?? new Date().toISOString(),
35
- bodyMarkdown: input.bodyMarkdown,
36
- };
37
- }
38
-
39
- export function workerStartMessage(
40
- instanceId: string,
41
- workerId: string,
42
- opts: {
43
- processSnapshot?: ProcessInstanceSnapshot;
44
- workspaceRoot: string;
45
- primaryTreeFile: string;
46
- resume: boolean;
47
- resumeLeafEntryId?: string | null;
48
- pendingInputs?: TestInputDelivery[];
49
- projectSnapshots?: ProcessProjectSnapshot[];
50
- turnResultMarkdownBySemanticRef?: Partial<Record<ProcessSemanticEntryRefKey, string>>;
51
- turnResultMarkdownByProduct?: Record<string, string>;
52
- },
53
- ): ServerToWorkerMessage {
54
- return createIpcMessage({
55
- ...baseEnvelope(instanceId, workerId, "start-1"),
56
- type: "worker.start",
57
- payload: {
58
- processSnapshot: opts.processSnapshot ?? {},
59
- projectSnapshots: opts.projectSnapshots ?? DEFAULT_PROJECT_SNAPSHOTS,
60
- pendingInputs: (opts.pendingInputs ?? []).map(toInputDelivery),
61
- workerLeaseId: "lease-1",
62
- turnStart: {
63
- id: "start-1",
64
- instanceId,
65
- turnId: "automatic",
66
- turnType: "automatic",
67
- proposedTurnRecordId: "turn-record-1",
68
- startKind: "selected_turn",
69
- recoveryTurnRecordId: null,
70
- continuation: null,
71
- state: { kind: "starting", start: { kind: "automatic" } },
72
- createdAt: new Date().toISOString(),
73
- updatedAt: new Date().toISOString(),
74
- },
75
- bootstrap: { kind: "automatic" },
76
- treePaths: {
77
- primaryTreeFile: opts.primaryTreeFile,
78
- workspaceRoot: opts.workspaceRoot,
79
- },
80
- resume: opts.resume,
81
- ...(opts.resumeLeafEntryId !== undefined
82
- ? { resumeLeafEntryId: opts.resumeLeafEntryId }
83
- : {}),
84
- ...(opts.turnResultMarkdownBySemanticRef
85
- ? { turnResultMarkdownBySemanticRef: opts.turnResultMarkdownBySemanticRef }
86
- : {}),
87
- ...(opts.turnResultMarkdownByProduct
88
- ? { turnResultMarkdownByProduct: opts.turnResultMarkdownByProduct }
89
- : {}),
90
- },
91
- });
92
- }