@leitwerk-dev/server 0.1.6 → 0.1.8

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 (143) hide show
  1. package/dist/app.d.ts.map +1 -1
  2. package/dist/app.js +31 -40
  3. package/dist/app.js.map +1 -1
  4. package/dist/auth/auth-client.d.ts +25 -0
  5. package/dist/auth/auth-client.d.ts.map +1 -0
  6. package/dist/auth/auth-client.js +19 -0
  7. package/dist/auth/auth-client.js.map +1 -0
  8. package/dist/auth/auth-config.d.ts +8 -2
  9. package/dist/auth/auth-config.d.ts.map +1 -1
  10. package/dist/auth/auth-config.js +17 -7
  11. package/dist/auth/auth-config.js.map +1 -1
  12. package/dist/auth/auth-service.d.ts +2 -0
  13. package/dist/auth/auth-service.d.ts.map +1 -1
  14. package/dist/auth/auth-service.js +9 -5
  15. package/dist/auth/auth-service.js.map +1 -1
  16. package/dist/auth/auth-test-helpers.js +2 -2
  17. package/dist/auth/auth-test-helpers.js.map +1 -1
  18. package/dist/auth/github-oauth-client.d.ts +20 -0
  19. package/dist/auth/github-oauth-client.d.ts.map +1 -0
  20. package/dist/auth/github-oauth-client.js +79 -0
  21. package/dist/auth/github-oauth-client.js.map +1 -0
  22. package/dist/auth/oidc-client.d.ts +4 -4
  23. package/dist/{chunk-G4PCN46L.js → chunk-ES5RBLAT.js} +47 -99
  24. package/dist/chunk-ES5RBLAT.js.map +1 -0
  25. package/dist/{chunk-KVHAK5UR.js → chunk-UC3OOEQ3.js} +527 -410
  26. package/dist/chunk-UC3OOEQ3.js.map +1 -0
  27. package/dist/config/config-loader.d.ts.map +1 -1
  28. package/dist/config/config-loader.js +21 -89
  29. package/dist/config/config-loader.js.map +1 -1
  30. package/dist/config/config-types.d.ts +18 -3
  31. package/dist/config/config-types.d.ts.map +1 -1
  32. package/dist/domain-logic/outcome-tools.d.ts +2 -2
  33. package/dist/domain-logic/outcome-tools.d.ts.map +1 -1
  34. package/dist/domain-logic/outcome-tools.js +1 -1
  35. package/dist/domain-logic/outcome-tools.js.map +1 -1
  36. package/dist/index.d.ts +1 -1
  37. package/dist/index.d.ts.map +1 -1
  38. package/dist/index.js +1 -1
  39. package/dist/index.js.map +1 -1
  40. package/dist/integration-tool-registry.d.ts +23 -0
  41. package/dist/integration-tool-registry.d.ts.map +1 -0
  42. package/dist/integration-tool-registry.js +140 -0
  43. package/dist/integration-tool-registry.js.map +1 -0
  44. package/dist/model-providers/builtin-server-adapter.d.ts.map +1 -1
  45. package/dist/model-providers/builtin-server-adapter.js +10 -2
  46. package/dist/model-providers/builtin-server-adapter.js.map +1 -1
  47. package/dist/process-ui-snapshot-presenter.d.ts.map +1 -1
  48. package/dist/process-ui-snapshot-presenter.js +0 -2
  49. package/dist/process-ui-snapshot-presenter.js.map +1 -1
  50. package/dist/process-watcher-registry.d.ts +3 -31
  51. package/dist/process-watcher-registry.d.ts.map +1 -1
  52. package/dist/process-watcher-registry.js +96 -97
  53. package/dist/process-watcher-registry.js.map +1 -1
  54. package/dist/routes/watchers.d.ts.map +1 -1
  55. package/dist/routes/watchers.js +14 -50
  56. package/dist/routes/watchers.js.map +1 -1
  57. package/dist/semantic-state-json.d.ts +1 -2
  58. package/dist/semantic-state-json.d.ts.map +1 -1
  59. package/dist/semantic-state-json.js +1 -2
  60. package/dist/semantic-state-json.js.map +1 -1
  61. package/dist/supervisor/ipc-handler.d.ts +4 -1
  62. package/dist/supervisor/ipc-handler.d.ts.map +1 -1
  63. package/dist/supervisor/ipc-handler.js +18 -0
  64. package/dist/supervisor/ipc-handler.js.map +1 -1
  65. package/dist/supervisor/worker-start-payload-builder.d.ts +5 -4
  66. package/dist/supervisor/worker-start-payload-builder.d.ts.map +1 -1
  67. package/dist/supervisor/worker-start-payload-builder.js +9 -0
  68. package/dist/supervisor/worker-start-payload-builder.js.map +1 -1
  69. package/dist/supervisor/worker-supervisor.d.ts +4 -5
  70. package/dist/supervisor/worker-supervisor.d.ts.map +1 -1
  71. package/dist/supervisor/worker-supervisor.js +6 -0
  72. package/dist/supervisor/worker-supervisor.js.map +1 -1
  73. package/dist/test-helpers/fake-worker-supervisor.d.ts.map +1 -1
  74. package/dist/test-helpers/fake-worker-supervisor.js +1 -0
  75. package/dist/test-helpers/fake-worker-supervisor.js.map +1 -1
  76. package/dist/test-helpers/ipc-handler-harness.d.ts +1 -0
  77. package/dist/test-helpers/ipc-handler-harness.d.ts.map +1 -1
  78. package/dist/test-helpers/ipc-handler-harness.js +4 -3
  79. package/dist/test-helpers/ipc-handler-harness.js.map +1 -1
  80. package/dist/test-helpers/process-fixtures.js +3 -3
  81. package/dist/test-helpers/process-fixtures.js.map +1 -1
  82. package/dist/{writes-irEq9SlA.d.ts → writes-CVXLCYce.d.ts} +61 -13
  83. package/package.json +10 -10
  84. package/src/app.ts +37 -44
  85. package/src/auth/auth-client.ts +40 -0
  86. package/src/auth/auth-config.ts +34 -9
  87. package/src/auth/auth-service.ts +11 -5
  88. package/src/auth/auth-test-helpers.ts +2 -2
  89. package/src/auth/github-oauth-client.ts +111 -0
  90. package/src/auth/oidc-client.ts +5 -5
  91. package/src/config/config-loader.ts +42 -103
  92. package/src/config/config-types.ts +21 -3
  93. package/src/domain-logic/outcome-tools.ts +3 -3
  94. package/src/index.ts +1 -4
  95. package/src/integration-tool-registry.ts +186 -0
  96. package/src/model-providers/builtin-server-adapter.ts +10 -2
  97. package/src/process-ui-snapshot-presenter.ts +0 -2
  98. package/src/process-watcher-registry.ts +124 -167
  99. package/src/routes/watchers.ts +14 -50
  100. package/src/semantic-state-json.ts +0 -2
  101. package/src/supervisor/ipc-handler.ts +35 -0
  102. package/src/supervisor/worker-start-payload-builder.ts +21 -1
  103. package/src/supervisor/worker-supervisor.ts +14 -4
  104. package/src/test-helpers/fake-worker-supervisor.ts +1 -0
  105. package/src/test-helpers/ipc-handler-harness.ts +7 -3
  106. package/src/test-helpers/process-fixtures.ts +3 -3
  107. package/dist/chunk-G4PCN46L.js.map +0 -1
  108. package/dist/chunk-KVHAK5UR.js.map +0 -1
  109. package/dist/domain-logic/idempotency.d.ts +0 -3
  110. package/dist/domain-logic/idempotency.d.ts.map +0 -1
  111. package/dist/domain-logic/idempotency.js +0 -3
  112. package/dist/domain-logic/idempotency.js.map +0 -1
  113. package/dist/domain-logic/index.d.ts +0 -7
  114. package/dist/domain-logic/index.d.ts.map +0 -1
  115. package/dist/domain-logic/index.js +0 -6
  116. package/dist/domain-logic/index.js.map +0 -1
  117. package/dist/domain-logic/input-sequencer.d.ts +0 -16
  118. package/dist/domain-logic/input-sequencer.d.ts.map +0 -1
  119. package/dist/domain-logic/input-sequencer.js +0 -2
  120. package/dist/domain-logic/input-sequencer.js.map +0 -1
  121. package/dist/domain-logic/string-normalize.d.ts +0 -2
  122. package/dist/domain-logic/string-normalize.d.ts.map +0 -1
  123. package/dist/domain-logic/string-normalize.js +0 -2
  124. package/dist/domain-logic/string-normalize.js.map +0 -1
  125. package/dist/filesystem-process-watchers.d.ts +0 -22
  126. package/dist/filesystem-process-watchers.d.ts.map +0 -1
  127. package/dist/filesystem-process-watchers.js +0 -79
  128. package/dist/filesystem-process-watchers.js.map +0 -1
  129. package/dist/test-helpers/in-process-worker.d.ts +0 -2
  130. package/dist/test-helpers/in-process-worker.d.ts.map +0 -1
  131. package/dist/test-helpers/in-process-worker.js +0 -2
  132. package/dist/test-helpers/in-process-worker.js.map +0 -1
  133. package/dist/test-helpers/leaf-outcome-fixtures.d.ts +0 -37
  134. package/dist/test-helpers/leaf-outcome-fixtures.d.ts.map +0 -1
  135. package/dist/test-helpers/leaf-outcome-fixtures.js +0 -81
  136. package/dist/test-helpers/leaf-outcome-fixtures.js.map +0 -1
  137. package/src/domain-logic/idempotency.ts +0 -3
  138. package/src/domain-logic/index.ts +0 -31
  139. package/src/domain-logic/input-sequencer.ts +0 -18
  140. package/src/domain-logic/string-normalize.ts +0 -1
  141. package/src/filesystem-process-watchers.ts +0 -147
  142. package/src/test-helpers/in-process-worker.ts +0 -2
  143. package/src/test-helpers/leaf-outcome-fixtures.ts +0 -140
@@ -1,3 +0,0 @@
1
- import { createWriteIdentity, type WriteIdentity } from "@leitwerk-dev/external-writes";
2
- export { createWriteIdentity, type WriteIdentity };
3
- //# sourceMappingURL=idempotency.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"idempotency.d.ts","sourceRoot":"","sources":["../../src/domain-logic/idempotency.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,KAAK,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAExF,OAAO,EAAE,mBAAmB,EAAE,KAAK,aAAa,EAAE,CAAC"}
@@ -1,3 +0,0 @@
1
- import { createWriteIdentity } from "@leitwerk-dev/external-writes";
2
- export { createWriteIdentity };
3
- //# sourceMappingURL=idempotency.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"idempotency.js","sourceRoot":"","sources":["../../src/domain-logic/idempotency.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAsB,MAAM,+BAA+B,CAAC;AAExF,OAAO,EAAE,mBAAmB,EAAsB,CAAC"}
@@ -1,7 +0,0 @@
1
- export { createWriteIdentity, type WriteIdentity } from "./idempotency.js";
2
- export type { InputSequencerState, PendingInput, SequencedInput, } from "./input-sequencer.js";
3
- export { checkTurnOutcomeAvailability, isTurnAvailableForSelectedTurn, isTurnAvailableForSelectedTurn as isTurnOutcomeAvailableForSelectedTurn, validateChangedProjects, validateTurnOutcome, } from "./outcome-tools.js";
4
- export { canAbort, type TransitionError, type TransitionResult, type TransitionTrigger, tryTransition, } from "./process-state-machine.js";
5
- export { normalizeStringArray, trimString } from "./string-normalize.js";
6
- export { type AppliedWorkerLeaseObservationResult, type InvalidWorkerLeaseObservationResult, type NoopWorkerLeaseObservationResult, normalizeWorkerLeaseState, transitionWorkerLeaseState, type WorkerLeaseObservation, type WorkerLeaseObservationResult, type WorkerLeaseTransitionRule, } from "./worker-lease-lifecycle.js";
7
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/domain-logic/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC3E,YAAY,EACX,mBAAmB,EACnB,YAAY,EACZ,cAAc,GACd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACN,4BAA4B,EAC5B,8BAA8B,EAC9B,8BAA8B,IAAI,qCAAqC,EACvE,uBAAuB,EACvB,mBAAmB,GACnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,QAAQ,EACR,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,aAAa,GACb,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EACN,KAAK,mCAAmC,EACxC,KAAK,mCAAmC,EACxC,KAAK,gCAAgC,EACrC,yBAAyB,EACzB,0BAA0B,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,4BAA4B,EACjC,KAAK,yBAAyB,GAC9B,MAAM,6BAA6B,CAAC"}
@@ -1,6 +0,0 @@
1
- export { createWriteIdentity } from "./idempotency.js";
2
- export { checkTurnOutcomeAvailability, isTurnAvailableForSelectedTurn, isTurnAvailableForSelectedTurn as isTurnOutcomeAvailableForSelectedTurn, validateChangedProjects, validateTurnOutcome, } from "./outcome-tools.js";
3
- export { canAbort, tryTransition, } from "./process-state-machine.js";
4
- export { normalizeStringArray, trimString } from "./string-normalize.js";
5
- export { normalizeWorkerLeaseState, transitionWorkerLeaseState, } from "./worker-lease-lifecycle.js";
6
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/domain-logic/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAsB,MAAM,kBAAkB,CAAC;AAM3E,OAAO,EACN,4BAA4B,EAC5B,8BAA8B,EAC9B,8BAA8B,IAAI,qCAAqC,EACvE,uBAAuB,EACvB,mBAAmB,GACnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,QAAQ,EAIR,aAAa,GACb,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAIN,yBAAyB,EACzB,0BAA0B,GAI1B,MAAM,6BAA6B,CAAC"}
@@ -1,16 +0,0 @@
1
- import type { InputKind, InputSource } from "@leitwerk-dev/domain";
2
- export interface PendingInput {
3
- id: string;
4
- instanceId: string;
5
- source: InputSource;
6
- kind: InputKind;
7
- bodyMarkdown: string;
8
- receivedAt: string;
9
- }
10
- export interface SequencedInput extends PendingInput {
11
- sequence: number;
12
- }
13
- export interface InputSequencerState {
14
- nextSequence: number;
15
- }
16
- //# sourceMappingURL=input-sequencer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"input-sequencer.d.ts","sourceRoot":"","sources":["../../src/domain-logic/input-sequencer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnE,MAAM,WAAW,YAAY;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,WAAW,CAAC;IACpB,IAAI,EAAE,SAAS,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,cAAe,SAAQ,YAAY;IACnD,QAAQ,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,mBAAmB;IACnC,YAAY,EAAE,MAAM,CAAC;CACrB"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=input-sequencer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"input-sequencer.js","sourceRoot":"","sources":["../../src/domain-logic/input-sequencer.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export { normalizeStringArray, trimString, trimToNull } from "@leitwerk-dev/domain";
2
- //# sourceMappingURL=string-normalize.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"string-normalize.d.ts","sourceRoot":"","sources":["../../src/domain-logic/string-normalize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC"}
@@ -1,2 +0,0 @@
1
- export { normalizeStringArray, trimString, trimToNull } from "@leitwerk-dev/domain";
2
- //# sourceMappingURL=string-normalize.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"string-normalize.js","sourceRoot":"","sources":["../../src/domain-logic/string-normalize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC"}
@@ -1,22 +0,0 @@
1
- import type { ProcessLaunchPlanServiceLike } from "@leitwerk-dev/process-sdk";
2
- import type { FastifyBaseLogger } from "fastify";
3
- import type { ProcessLaunchExecutorDeps } from "./process-launch-executor.js";
4
- interface FilesystemWatcherStartResult {
5
- launchPlan: import("@leitwerk-dev/process-sdk").ProcessLaunchPlan;
6
- }
7
- interface FilesystemWatcherServiceLike {
8
- listByType(type: "filesystem"): readonly unknown[];
9
- resolveLaunch(processId: string, watcherId: string, payload: unknown): Promise<FilesystemWatcherStartResult | null>;
10
- }
11
- export interface FilesystemProcessWatchersService {
12
- start(): void;
13
- stop(): void;
14
- }
15
- export declare function createFilesystemProcessWatchersService(args: {
16
- processWatchers: FilesystemWatcherServiceLike;
17
- launchPlans: ProcessLaunchPlanServiceLike;
18
- launchExecutorDeps: ProcessLaunchExecutorDeps;
19
- logger?: FastifyBaseLogger;
20
- }): FilesystemProcessWatchersService;
21
- export {};
22
- //# sourceMappingURL=filesystem-process-watchers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"filesystem-process-watchers.d.ts","sourceRoot":"","sources":["../src/filesystem-process-watchers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AAQ9E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AAe9E,UAAU,4BAA4B;IACrC,UAAU,EAAE,OAAO,2BAA2B,EAAE,iBAAiB,CAAC;CAClE;AAED,UAAU,4BAA4B;IACrC,UAAU,CAAC,IAAI,EAAE,YAAY,GAAG,SAAS,OAAO,EAAE,CAAC;IACnD,aAAa,CACZ,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,OAAO,GACd,OAAO,CAAC,4BAA4B,GAAG,IAAI,CAAC,CAAC;CAChD;AAED,MAAM,WAAW,gCAAgC;IAChD,KAAK,IAAI,IAAI,CAAC;IACd,IAAI,IAAI,IAAI,CAAC;CACb;AAED,wBAAgB,sCAAsC,CAAC,IAAI,EAAE;IAC5D,eAAe,EAAE,4BAA4B,CAAC;IAC9C,WAAW,EAAE,4BAA4B,CAAC;IAC1C,kBAAkB,EAAE,yBAAyB,CAAC;IAC9C,MAAM,CAAC,EAAE,iBAAiB,CAAC;CAC3B,GAAG,gCAAgC,CAmGnC"}
@@ -1,79 +0,0 @@
1
- import { consumeTriggerFile, createPollLoop, emptyPollResult, readTriggerFile, } from "@leitwerk-dev/watcher-utils";
2
- import { createProcessFromLaunchPlan } from "./process-launch-executor.js";
3
- export function createFilesystemProcessWatchersService(args) {
4
- const watchers = args.processWatchers.listByType("filesystem");
5
- const loops = watchers.map((watcher) => createPollLoop({
6
- pollInterval: () => watcher.pollInterval,
7
- isEnabled: () => watcher.enabled,
8
- defaultIntervalMs: 1_000,
9
- async pollOnce() {
10
- const result = emptyPollResult();
11
- if (watcher.config.type !== "filesystem") {
12
- return result;
13
- }
14
- const file = await readTriggerFile(watcher.config.file_path);
15
- if (!file.exists) {
16
- return result;
17
- }
18
- const content = file.content.trim();
19
- if (content.length === 0) {
20
- return result;
21
- }
22
- const resolved = await args.processWatchers.resolveLaunch(watcher.processId, watcher.watcherId, { filePath: watcher.config.file_path, content });
23
- if (!resolved) {
24
- result.skipped.push(`${watcher.processId}:${watcher.watcherId}`);
25
- return result;
26
- }
27
- const prepared = await args.launchPlans.prepare(resolved.launchPlan, {
28
- modelConfig: watcher.launchModelConfig,
29
- invalidModelConfig: "omit",
30
- });
31
- if (!prepared.ok) {
32
- result.errors.push(...prepared.errors.map((error) => `${watcher.processId}:${watcher.watcherId}:${error.code}`));
33
- args.logger?.warn({
34
- processId: watcher.processId,
35
- watcherId: watcher.watcherId,
36
- filePath: watcher.config.file_path,
37
- errors: prepared.errors,
38
- }, "Filesystem process watcher launch plan preparation failed");
39
- return result;
40
- }
41
- const created = await createProcessFromLaunchPlan(args.launchExecutorDeps, prepared.launchPlan);
42
- const durableProcess = created.ok
43
- ? created.process
44
- : created.stage === "post_commit"
45
- ? created.process
46
- : null;
47
- if (durableProcess) {
48
- await consumeTriggerFile(watcher.config.file_path);
49
- result.created.push(durableProcess.id);
50
- }
51
- if (!created.ok) {
52
- result.errors.push(`${watcher.processId}:${watcher.watcherId}:${created.status}:${String(created.body.error ?? "launch_failed")}`);
53
- args.logger?.warn({
54
- processId: watcher.processId,
55
- watcherId: watcher.watcherId,
56
- filePath: watcher.config.file_path,
57
- status: created.status,
58
- body: created.body,
59
- durableProcessId: durableProcess?.id ?? null,
60
- }, "Filesystem process watcher launch failed");
61
- return result;
62
- }
63
- return result;
64
- },
65
- }));
66
- return {
67
- start() {
68
- for (const loop of loops) {
69
- loop.start();
70
- }
71
- },
72
- stop() {
73
- for (const loop of loops) {
74
- loop.stop();
75
- }
76
- },
77
- };
78
- }
79
- //# sourceMappingURL=filesystem-process-watchers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"filesystem-process-watchers.js","source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,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;gBACnD,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;YACxC,CAAC;YACD,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC;gBACjB,MAAM,CAAC,MAAM,CAAC,IAAI,CACjB,GAAG,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,MAAM,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,IAAI,eAAe,CAAC,EAAE,CAC9G,CAAC;gBACF,IAAI,CAAC,MAAM,EAAE,IAAI,CAChB;oBACC,SAAS,EAAE,OAAO,CAAC,SAAS;oBAC5B,SAAS,EAAE,OAAO,CAAC,SAAS;oBAC5B,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,SAAS;oBAClC,MAAM,EAAE,OAAO,CAAC,MAAM;oBACtB,IAAI,EAAE,OAAO,CAAC,IAAI;oBAClB,gBAAgB,EAAE,cAAc,EAAE,EAAE,IAAI,IAAI;iBAC5C,EACD,0CAA0C,CAC1C,CAAC;gBACF,OAAO,MAAM,CAAC;YACf,CAAC;YACD,OAAO,MAAM,CAAC;QACf,CAAC;KACD,CAAC,CACF,CAAC;IAEF,OAAO;QACN,KAAK;YACJ,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;gBAC1B,IAAI,CAAC,KAAK,EAAE,CAAC;YACd,CAAC;QACF,CAAC;QACD,IAAI;YACH,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;gBAC1B,IAAI,CAAC,IAAI,EAAE,CAAC;YACb,CAAC;QACF,CAAC;KACD,CAAC;AACH,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=in-process-worker.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"in-process-worker.d.ts","sourceRoot":"","sources":["../../src/test-helpers/in-process-worker.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=in-process-worker.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"in-process-worker.js","sourceRoot":"","sources":["../../src/test-helpers/in-process-worker.ts"],"names":[],"mappings":""}
@@ -1,37 +0,0 @@
1
- import type { Codec, ExtensionProcessDefinition, LeitwerkExtensionModule, LlmTurnDefinition, ProcessLeafOutcomeDefinition, StructuralProcessState } from "@leitwerk-dev/process-sdk";
2
- export declare const leafOutcomePromptParamsCodec: Codec<{
3
- prompt: string;
4
- }>;
5
- export declare const leafOutcomeStructuralStateCodec: Codec<StructuralProcessState>;
6
- type LeafOutcomeResultSemanticRef = NonNullable<LlmTurnDefinition<"completed">["resultSemanticRef"]>;
7
- export interface CreateLeafOutcomeCaptureTurnOptions {
8
- description?: string;
9
- branchType?: LlmTurnDefinition<"completed">["branchType"];
10
- context?: LlmTurnDefinition<"completed">["context"];
11
- promptText?: string;
12
- resultSemanticRef?: LeafOutcomeResultSemanticRef;
13
- turnResultMarkdown?: LlmTurnDefinition<"completed">["turnResultMarkdown"];
14
- }
15
- export declare function createLeafOutcomeCaptureTurn(turnId: string, options?: CreateLeafOutcomeCaptureTurnOptions): LlmTurnDefinition<"completed", {
16
- prompt: string;
17
- }, StructuralProcessState>;
18
- export interface CreateLeafOutcomeTestProcessDefinitionOptions {
19
- displayName?: string;
20
- resultSemanticRef?: LeafOutcomeResultSemanticRef;
21
- }
22
- export declare function createLeafOutcomeTestProcessDefinition(processId: string, rendererId: string, turnId: string, capture: ProcessLeafOutcomeDefinition<{
23
- prompt: string;
24
- }, StructuralProcessState>["capture"], options?: CreateLeafOutcomeTestProcessDefinitionOptions): ExtensionProcessDefinition<{
25
- prompt: string;
26
- }, StructuralProcessState>;
27
- export interface CreateLeafOutcomeTestExtensionModuleOptions {
28
- manifestId?: string;
29
- manifestVersion?: string;
30
- turn?: CreateLeafOutcomeCaptureTurnOptions;
31
- }
32
- export declare function createLeafOutcomeTestExtensionModule(processDef: ExtensionProcessDefinition<{
33
- prompt: string;
34
- }, StructuralProcessState>, _turnId: string, options?: CreateLeafOutcomeTestExtensionModuleOptions): LeitwerkExtensionModule;
35
- export declare function createLeafOutcomeBaseStateJson(rootEntryId: string, overrides?: Partial<StructuralProcessState["semanticEntryRefs"]>): string;
36
- export {};
37
- //# sourceMappingURL=leaf-outcome-fixtures.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"leaf-outcome-fixtures.d.ts","sourceRoot":"","sources":["../../src/test-helpers/leaf-outcome-fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,KAAK,EACL,0BAA0B,EAC1B,uBAAuB,EACvB,iBAAiB,EACjB,4BAA4B,EAC5B,sBAAsB,EACtB,MAAM,2BAA2B,CAAC;AAQnC,eAAO,MAAM,4BAA4B,EAAE,KAAK,CAAC;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAalE,CAAC;AAEF,eAAO,MAAM,+BAA+B,EAAE,KAAK,CAAC,sBAAsB,CAC9C,CAAC;AAE7B,KAAK,4BAA4B,GAAG,WAAW,CAC9C,iBAAiB,CAAC,WAAW,CAAC,CAAC,mBAAmB,CAAC,CACnD,CAAC;AAEF,MAAM,WAAW,mCAAmC;IACnD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,iBAAiB,CAAC,WAAW,CAAC,CAAC,YAAY,CAAC,CAAC;IAC1D,OAAO,CAAC,EAAE,iBAAiB,CAAC,WAAW,CAAC,CAAC,SAAS,CAAC,CAAC;IACpD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iBAAiB,CAAC,EAAE,4BAA4B,CAAC;IACjD,kBAAkB,CAAC,EAAE,iBAAiB,CAAC,WAAW,CAAC,CAAC,oBAAoB,CAAC,CAAC;CAC1E;AAED,wBAAgB,4BAA4B,CAC3C,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,mCAAwC,GAC/C,iBAAiB,CAAC,WAAW,EAAE;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,EAAE,sBAAsB,CAAC,CAiB5E;AAED,MAAM,WAAW,6CAA6C;IAC7D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,4BAA4B,CAAC;CACjD;AAED,wBAAgB,sCAAsC,CACrD,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,4BAA4B,CAAC;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,EAAE,sBAAsB,CAAC,CAAC,SAAS,CAAC,EAC5F,OAAO,GAAE,6CAAkD,GACzD,0BAA0B,CAAC;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,EAAE,sBAAsB,CAAC,CAyBxE;AAED,MAAM,WAAW,2CAA2C;IAC3D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,IAAI,CAAC,EAAE,mCAAmC,CAAC;CAC3C;AAED,wBAAgB,oCAAoC,CACnD,UAAU,EAAE,0BAA0B,CAAC;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,EAAE,sBAAsB,CAAC,EAClF,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,2CAAgD,GACvD,uBAAuB,CAUzB;AAED,wBAAgB,8BAA8B,CAC7C,WAAW,EAAE,MAAM,EACnB,SAAS,GAAE,OAAO,CAAC,sBAAsB,CAAC,mBAAmB,CAAC,CAAM,GAClE,MAAM,CAQR"}
@@ -1,81 +0,0 @@
1
- import { defineProcess, llmTurn } from "@leitwerk-dev/process-sdk";
2
- import { createStructuralProcessState, createStructuralStateJson, structuralProcessStateCodec, } from "./structural-process-fixtures.js";
3
- export const leafOutcomePromptParamsCodec = {
4
- parse(value) {
5
- const record = typeof value === "object" && value !== null ? value : {};
6
- return {
7
- prompt: typeof record.prompt === "string"
8
- ? record.prompt
9
- : "",
10
- };
11
- },
12
- serialize(value) {
13
- return value;
14
- },
15
- };
16
- export const leafOutcomeStructuralStateCodec = structuralProcessStateCodec;
17
- export function createLeafOutcomeCaptureTurn(turnId, options = {}) {
18
- return llmTurn({
19
- description: options.description ?? "Produce a captured leaf outcome",
20
- availableTools: [],
21
- completionMode: "turn_end",
22
- branchType: options.branchType ?? "primary",
23
- context: options.context ?? "fresh",
24
- prompt: async () => options.promptText ?? turnId,
25
- outcomes: {},
26
- turnEnd: {
27
- outcome: "completed",
28
- params: {},
29
- complete: true,
30
- },
31
- ...(options.turnResultMarkdown ? { turnResultMarkdown: options.turnResultMarkdown } : {}),
32
- resultSemanticRef: options.resultSemanticRef ?? "plan",
33
- });
34
- }
35
- export function createLeafOutcomeTestProcessDefinition(processId, rendererId, turnId, capture, options = {}) {
36
- return defineProcess({
37
- id: processId,
38
- displayName: options.displayName ?? processId,
39
- entry: turnId,
40
- turns: {
41
- [turnId]: createLeafOutcomeCaptureTurn(turnId, {
42
- resultSemanticRef: options.resultSemanticRef ?? "plan",
43
- }),
44
- },
45
- paramsCodec: leafOutcomePromptParamsCodec,
46
- stateCodec: leafOutcomeStructuralStateCodec,
47
- initialState() {
48
- return createStructuralProcessState();
49
- },
50
- worker(api) {
51
- api.start(turnId);
52
- },
53
- ui(api) {
54
- api.leafOutcome({
55
- rendererId,
56
- capture,
57
- });
58
- },
59
- });
60
- }
61
- export function createLeafOutcomeTestExtensionModule(processDef, _turnId, options = {}) {
62
- return {
63
- manifest: {
64
- id: options.manifestId ?? `${processDef.id}-test`,
65
- version: options.manifestVersion ?? "0.1.0",
66
- },
67
- setupCatalog(api) {
68
- api.registerProcess(processDef);
69
- },
70
- };
71
- }
72
- export function createLeafOutcomeBaseStateJson(rootEntryId, overrides = {}) {
73
- return createStructuralStateJson({
74
- semanticEntryRefs: {
75
- rootEntry: { entryId: rootEntryId, turnRecordId: null },
76
- currentPrimaryPathLeaf: { entryId: rootEntryId, turnRecordId: null },
77
- ...overrides,
78
- },
79
- });
80
- }
81
- //# sourceMappingURL=leaf-outcome-fixtures.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"leaf-outcome-fixtures.js","sourceRoot":"","sources":["../../src/test-helpers/leaf-outcome-fixtures.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EACN,4BAA4B,EAC5B,yBAAyB,EACzB,2BAA2B,GAC3B,MAAM,kCAAkC,CAAC;AAE1C,MAAM,CAAC,MAAM,4BAA4B,GAA8B;IACtE,KAAK,CAAC,KAAK;QACV,MAAM,MAAM,GAAG,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;QACxE,OAAO;YACN,MAAM,EACL,OAAQ,MAA+B,CAAC,MAAM,KAAK,QAAQ;gBAC1D,CAAC,CAAE,MAA6B,CAAC,MAAM;gBACvC,CAAC,CAAC,EAAE;SACN,CAAC;IACH,CAAC;IACD,SAAS,CAAC,KAAK;QACd,OAAO,KAAK,CAAC;IACd,CAAC;CACD,CAAC;AAEF,MAAM,CAAC,MAAM,+BAA+B,GAC3C,2BAA2B,CAAC;AAe7B,MAAM,UAAU,4BAA4B,CAC3C,MAAc,EACd,UAA+C,EAAE;IAEjD,OAAO,OAAO,CAA0D;QACvE,WAAW,EAAE,OAAO,CAAC,WAAW,IAAI,iCAAiC;QACrE,cAAc,EAAE,EAAE;QAClB,cAAc,EAAE,UAAU;QAC1B,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,SAAS;QAC3C,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,OAAO;QACnC,MAAM,EAAE,KAAK,IAAI,EAAE,CAAC,OAAO,CAAC,UAAU,IAAI,MAAM;QAChD,QAAQ,EAAE,EAAE;QACZ,OAAO,EAAE;YACR,OAAO,EAAE,WAAW;YACpB,MAAM,EAAE,EAAE;YACV,QAAQ,EAAE,IAAI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,CAAC;AAED,MAAM,UAAU,8BAA8B,CAC7C,WAAmB,EACnB,YAAkE,EAAE;IAEpE,OAAO,yBAAyB,CAAC;QAChC,iBAAiB,EAAE;YAClB,SAAS,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,IAAI,EAAE;YACvD,sBAAsB,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,IAAI,EAAE;YACpE,GAAG,SAAS;SACZ;KACD,CAAC,CAAC;AACJ,CAAC"}
@@ -1,3 +0,0 @@
1
- import { createWriteIdentity, type WriteIdentity } from "@leitwerk-dev/external-writes";
2
-
3
- export { createWriteIdentity, type WriteIdentity };
@@ -1,31 +0,0 @@
1
- export { createWriteIdentity, type WriteIdentity } from "./idempotency.js";
2
- export type {
3
- InputSequencerState,
4
- PendingInput,
5
- SequencedInput,
6
- } from "./input-sequencer.js";
7
- export {
8
- checkTurnOutcomeAvailability,
9
- isTurnAvailableForSelectedTurn,
10
- isTurnAvailableForSelectedTurn as isTurnOutcomeAvailableForSelectedTurn,
11
- validateChangedProjects,
12
- validateTurnOutcome,
13
- } from "./outcome-tools.js";
14
- export {
15
- canAbort,
16
- type TransitionError,
17
- type TransitionResult,
18
- type TransitionTrigger,
19
- tryTransition,
20
- } from "./process-state-machine.js";
21
- export { normalizeStringArray, trimString } from "./string-normalize.js";
22
- export {
23
- type AppliedWorkerLeaseObservationResult,
24
- type InvalidWorkerLeaseObservationResult,
25
- type NoopWorkerLeaseObservationResult,
26
- normalizeWorkerLeaseState,
27
- transitionWorkerLeaseState,
28
- type WorkerLeaseObservation,
29
- type WorkerLeaseObservationResult,
30
- type WorkerLeaseTransitionRule,
31
- } from "./worker-lease-lifecycle.js";
@@ -1,18 +0,0 @@
1
- import type { InputKind, InputSource } from "@leitwerk-dev/domain";
2
-
3
- export interface PendingInput {
4
- id: string;
5
- instanceId: string;
6
- source: InputSource;
7
- kind: InputKind;
8
- bodyMarkdown: string;
9
- receivedAt: string;
10
- }
11
-
12
- export interface SequencedInput extends PendingInput {
13
- sequence: number;
14
- }
15
-
16
- export interface InputSequencerState {
17
- nextSequence: number;
18
- }
@@ -1 +0,0 @@
1
- export { normalizeStringArray, trimString, trimToNull } from "@leitwerk-dev/domain";
@@ -1,147 +0,0 @@
1
- import type { ProcessLaunchPlanServiceLike } from "@leitwerk-dev/process-sdk";
2
- import {
3
- consumeTriggerFile,
4
- createPollLoop,
5
- emptyPollResult,
6
- type PollLoop,
7
- readTriggerFile,
8
- } from "@leitwerk-dev/watcher-utils";
9
- import type { FastifyBaseLogger } from "fastify";
10
- import type { ProcessLaunchExecutorDeps } from "./process-launch-executor.js";
11
- import { createProcessFromLaunchPlan } from "./process-launch-executor.js";
12
-
13
- interface FilesystemWatcherRegistration {
14
- processId: string;
15
- watcherId: string;
16
- enabled: boolean;
17
- pollInterval: string;
18
- config: { type: "filesystem"; file_path: string };
19
- launchModelConfig: {
20
- defaultModelProfileId?: string | null;
21
- turnConfigs?: Record<string, { modelProfileId?: string | null }>;
22
- };
23
- }
24
-
25
- interface FilesystemWatcherStartResult {
26
- launchPlan: import("@leitwerk-dev/process-sdk").ProcessLaunchPlan;
27
- }
28
-
29
- interface FilesystemWatcherServiceLike {
30
- listByType(type: "filesystem"): readonly unknown[];
31
- resolveLaunch(
32
- processId: string,
33
- watcherId: string,
34
- payload: unknown,
35
- ): Promise<FilesystemWatcherStartResult | null>;
36
- }
37
-
38
- export interface FilesystemProcessWatchersService {
39
- start(): void;
40
- stop(): void;
41
- }
42
-
43
- export function createFilesystemProcessWatchersService(args: {
44
- processWatchers: FilesystemWatcherServiceLike;
45
- launchPlans: ProcessLaunchPlanServiceLike;
46
- launchExecutorDeps: ProcessLaunchExecutorDeps;
47
- logger?: FastifyBaseLogger;
48
- }): FilesystemProcessWatchersService {
49
- const watchers = args.processWatchers.listByType(
50
- "filesystem",
51
- ) as readonly FilesystemWatcherRegistration[];
52
- const loops: PollLoop[] = watchers.map((watcher: FilesystemWatcherRegistration) =>
53
- createPollLoop({
54
- pollInterval: () => watcher.pollInterval,
55
- isEnabled: () => watcher.enabled,
56
- defaultIntervalMs: 1_000,
57
- async pollOnce() {
58
- const result = emptyPollResult();
59
- if (watcher.config.type !== "filesystem") {
60
- return result;
61
- }
62
- const file = await readTriggerFile(watcher.config.file_path);
63
- if (!file.exists) {
64
- return result;
65
- }
66
- const content = file.content.trim();
67
- if (content.length === 0) {
68
- return result;
69
- }
70
- const resolved = await args.processWatchers.resolveLaunch(
71
- watcher.processId,
72
- watcher.watcherId,
73
- { filePath: watcher.config.file_path, content },
74
- );
75
- if (!resolved) {
76
- result.skipped.push(`${watcher.processId}:${watcher.watcherId}`);
77
- return result;
78
- }
79
- const prepared = await args.launchPlans.prepare(resolved.launchPlan, {
80
- modelConfig: watcher.launchModelConfig,
81
- invalidModelConfig: "omit",
82
- });
83
- if (!prepared.ok) {
84
- result.errors.push(
85
- ...prepared.errors.map(
86
- (error) => `${watcher.processId}:${watcher.watcherId}:${error.code}`,
87
- ),
88
- );
89
- args.logger?.warn(
90
- {
91
- processId: watcher.processId,
92
- watcherId: watcher.watcherId,
93
- filePath: watcher.config.file_path,
94
- errors: prepared.errors,
95
- },
96
- "Filesystem process watcher launch plan preparation failed",
97
- );
98
- return result;
99
- }
100
- const created = await createProcessFromLaunchPlan(
101
- args.launchExecutorDeps,
102
- prepared.launchPlan,
103
- );
104
- const durableProcess = created.ok
105
- ? created.process
106
- : created.stage === "post_commit"
107
- ? created.process
108
- : null;
109
- if (durableProcess) {
110
- await consumeTriggerFile(watcher.config.file_path);
111
- result.created.push(durableProcess.id);
112
- }
113
- if (!created.ok) {
114
- result.errors.push(
115
- `${watcher.processId}:${watcher.watcherId}:${created.status}:${String(created.body.error ?? "launch_failed")}`,
116
- );
117
- args.logger?.warn(
118
- {
119
- processId: watcher.processId,
120
- watcherId: watcher.watcherId,
121
- filePath: watcher.config.file_path,
122
- status: created.status,
123
- body: created.body,
124
- durableProcessId: durableProcess?.id ?? null,
125
- },
126
- "Filesystem process watcher launch failed",
127
- );
128
- return result;
129
- }
130
- return result;
131
- },
132
- }),
133
- );
134
-
135
- return {
136
- start() {
137
- for (const loop of loops) {
138
- loop.start();
139
- }
140
- },
141
- stop() {
142
- for (const loop of loops) {
143
- loop.stop();
144
- }
145
- },
146
- };
147
- }
@@ -1,2 +0,0 @@
1
- // Deprecated test helper shim. Use the worker testing subpath instead.
2
- export {};