@codetreker/daynight 0.21.13 → 0.24.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.
Files changed (102) hide show
  1. package/README.md +364 -287
  2. package/config.example.yml +69 -0
  3. package/dist/api/client.d.ts +2 -2
  4. package/dist/api/client.js +10 -7
  5. package/dist/api/client.js.map +1 -1
  6. package/dist/api/types.d.ts +1 -8
  7. package/dist/cli/prompts.d.ts +1 -0
  8. package/dist/commands/auth/credentials.js +1 -1
  9. package/dist/commands/auth/credentials.js.map +1 -1
  10. package/dist/commands/review/config.d.ts +2 -1
  11. package/dist/commands/review/config.js +22 -39
  12. package/dist/commands/review/config.js.map +1 -1
  13. package/dist/commands/review/configuration-guide.js +7 -6
  14. package/dist/commands/review/configuration-guide.js.map +1 -1
  15. package/dist/commands/review/definition.js +1 -1
  16. package/dist/commands/review/definition.js.map +1 -1
  17. package/dist/commands/review/repositories.js +19 -19
  18. package/dist/commands/review/repositories.js.map +1 -1
  19. package/dist/commands/skill/skills/using-daynight/references/execute-task-in-managed.md +6 -5
  20. package/dist/commands/skill/skills/using-daynight/references/handbook.md +1 -1
  21. package/dist/commands/skill/skills/using-daynight/references/handoff.md +1 -1
  22. package/dist/commands/worker/attach.d.ts +3 -0
  23. package/dist/commands/worker/attach.js +53 -0
  24. package/dist/commands/worker/attach.js.map +1 -0
  25. package/dist/commands/worker/cleanup.d.ts +8 -2
  26. package/dist/commands/worker/cleanup.js +44 -160
  27. package/dist/commands/worker/cleanup.js.map +1 -1
  28. package/dist/commands/worker/config.d.ts +13 -3
  29. package/dist/commands/worker/config.js +35 -13
  30. package/dist/commands/worker/config.js.map +1 -1
  31. package/dist/commands/worker/configuration-guide.d.ts +19 -0
  32. package/dist/commands/worker/configuration-guide.js +86 -0
  33. package/dist/commands/worker/configuration-guide.js.map +1 -0
  34. package/dist/commands/worker/control.d.ts +11 -18
  35. package/dist/commands/worker/control.js +75 -132
  36. package/dist/commands/worker/control.js.map +1 -1
  37. package/dist/commands/worker/coordinator.d.ts +10 -8
  38. package/dist/commands/worker/coordinator.js +311 -473
  39. package/dist/commands/worker/coordinator.js.map +1 -1
  40. package/dist/commands/worker/definition.js +34 -18
  41. package/dist/commands/worker/definition.js.map +1 -1
  42. package/dist/commands/worker/diagnostics.js +2 -3
  43. package/dist/commands/worker/diagnostics.js.map +1 -1
  44. package/dist/commands/worker/execution.d.ts +35 -10
  45. package/dist/commands/worker/execution.js +92 -283
  46. package/dist/commands/worker/execution.js.map +1 -1
  47. package/dist/commands/worker/herdr/agents.d.ts +12 -91
  48. package/dist/commands/worker/herdr/agents.js +111 -358
  49. package/dist/commands/worker/herdr/agents.js.map +1 -1
  50. package/dist/commands/worker/herdr/instance.d.ts +1 -0
  51. package/dist/commands/worker/herdr/instance.js +30 -5
  52. package/dist/commands/worker/herdr/instance.js.map +1 -1
  53. package/dist/commands/worker/herdr/preflight.d.ts +21 -9
  54. package/dist/commands/worker/herdr/preflight.js +118 -124
  55. package/dist/commands/worker/herdr/preflight.js.map +1 -1
  56. package/dist/commands/worker/herdr.d.ts +7 -63
  57. package/dist/commands/worker/herdr.js.map +1 -1
  58. package/dist/commands/worker/identity.js +2 -2
  59. package/dist/commands/worker/identity.js.map +1 -1
  60. package/dist/commands/worker/index.d.ts +8 -0
  61. package/dist/commands/worker/index.js +21 -14
  62. package/dist/commands/worker/index.js.map +1 -1
  63. package/dist/commands/worker/prompts.d.ts +10 -3
  64. package/dist/commands/worker/prompts.js +21 -32
  65. package/dist/commands/worker/prompts.js.map +1 -1
  66. package/dist/commands/worker/remote.d.ts +2 -3
  67. package/dist/commands/worker/remote.js +1 -6
  68. package/dist/commands/worker/remote.js.map +1 -1
  69. package/dist/commands/worker/repositories.d.ts +40 -0
  70. package/dist/commands/worker/repositories.js +236 -0
  71. package/dist/commands/worker/repositories.js.map +1 -0
  72. package/dist/commands/worker/runtime.d.ts +1 -0
  73. package/dist/commands/worker/runtime.js +135 -212
  74. package/dist/commands/worker/runtime.js.map +1 -1
  75. package/dist/commands/worker/setup-environment.d.ts +31 -0
  76. package/dist/commands/worker/setup-environment.js +146 -0
  77. package/dist/commands/worker/setup-environment.js.map +1 -0
  78. package/dist/commands/worker/setup.d.ts +11 -0
  79. package/dist/commands/worker/setup.js +113 -0
  80. package/dist/commands/worker/setup.js.map +1 -0
  81. package/dist/commands/worker/store.d.ts +12 -114
  82. package/dist/commands/worker/store.js +92 -817
  83. package/dist/commands/worker/store.js.map +1 -1
  84. package/dist/commands/worker/types.d.ts +10 -114
  85. package/dist/commands/worker/worktrees.d.ts +9 -9
  86. package/dist/commands/worker/worktrees.js +77 -37
  87. package/dist/commands/worker/worktrees.js.map +1 -1
  88. package/dist/config/document.d.ts +0 -1
  89. package/dist/config/document.js +1 -22
  90. package/dist/config/document.js.map +1 -1
  91. package/dist/config/errors.d.ts +2 -2
  92. package/dist/config/errors.js.map +1 -1
  93. package/dist/config/files.d.ts +7 -1
  94. package/dist/config/files.js +4 -1
  95. package/dist/config/files.js.map +1 -1
  96. package/dist/config/ownership.d.ts +12 -0
  97. package/dist/config/ownership.js +39 -0
  98. package/dist/config/ownership.js.map +1 -0
  99. package/dist/repository/location.d.ts +7 -0
  100. package/dist/repository/location.js +51 -0
  101. package/dist/repository/location.js.map +1 -0
  102. package/package.json +4 -3
@@ -24,7 +24,7 @@ export const reviewDefinition = {
24
24
  { names: ["--path"], description: "Dedicated review clone path (relative to the current directory)", value: { name: "path", kind: "directory" } },
25
25
  helpOption,
26
26
  ],
27
- details: "Without --path, repositoryRoot (default: ~/daynights) determines the clone path.\nThe resolved absolute path is saved in ~/.daynight/config.yml.\nChanges take effect the next time daynight review run starts.",
27
+ details: "Without --path, review.repositoryRoot (default: ~/daynights) determines the clone path.\nThe resolved absolute path is saved in ~/.daynight/config.yml.\nChanges take effect the next time daynight review run starts.",
28
28
  },
29
29
  ],
30
30
  options: [helpOption],
@@ -1 +1 @@
1
- {"version":3,"file":"definition.js","sourceRoot":"","sources":["../../../src/commands/review/definition.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,GAAkB,EAAE,KAAK,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAE7G,MAAM,CAAC,MAAM,gBAAgB,GAAsB;IACjD,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,mEAAmE;IAChF,QAAQ,EAAE;QACR;YACE,IAAI,EAAE,KAAK;YACX,WAAW,EAAE,4CAA4C;YACzD,OAAO,EAAE,CAAC,UAAU,CAAC;YACrB,OAAO,EAAE,0EAA0E;SACpF;QACD;YACE,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,CAAC,IAAI,CAAC;YACf,WAAW,EAAE,qDAAqD;YAClE,OAAO,EAAE,CAAC,UAAU,CAAC;YACrB,OAAO,EAAE,wTAAwT;SAClU;QACD;YACE,IAAI,EAAE,UAAU;YAChB,WAAW,EAAE,+DAA+D;YAC5E,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,wCAAwC,EAAE,CAAC;YACtF,OAAO,EAAE;gBACP,EAAE,KAAK,EAAE,CAAC,QAAQ,CAAC,EAAE,WAAW,EAAE,iEAAiE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE;gBACjJ,UAAU;aACX;YACD,OAAO,EAAE,iNAAiN;SAC3N;KACF;IACD,OAAO,EAAE,CAAC,UAAU,CAAC;IACrB,OAAO,EAAE,6JAA6J;CACvK,CAAC"}
1
+ {"version":3,"file":"definition.js","sourceRoot":"","sources":["../../../src/commands/review/definition.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,GAAkB,EAAE,KAAK,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAE7G,MAAM,CAAC,MAAM,gBAAgB,GAAsB;IACjD,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,mEAAmE;IAChF,QAAQ,EAAE;QACR;YACE,IAAI,EAAE,KAAK;YACX,WAAW,EAAE,4CAA4C;YACzD,OAAO,EAAE,CAAC,UAAU,CAAC;YACrB,OAAO,EAAE,0EAA0E;SACpF;QACD;YACE,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,CAAC,IAAI,CAAC;YACf,WAAW,EAAE,qDAAqD;YAClE,OAAO,EAAE,CAAC,UAAU,CAAC;YACrB,OAAO,EAAE,wTAAwT;SAClU;QACD;YACE,IAAI,EAAE,UAAU;YAChB,WAAW,EAAE,+DAA+D;YAC5E,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,wCAAwC,EAAE,CAAC;YACtF,OAAO,EAAE;gBACP,EAAE,KAAK,EAAE,CAAC,QAAQ,CAAC,EAAE,WAAW,EAAE,iEAAiE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE;gBACjJ,UAAU;aACX;YACD,OAAO,EAAE,wNAAwN;SAClO;KACF;IACD,OAAO,EAAE,CAAC,UAAU,CAAC;IACrB,OAAO,EAAE,6JAA6J;CACvK,CAAC"}
@@ -1,16 +1,14 @@
1
1
  import path from "node:path";
2
2
  import { Document } from "yaml";
3
+ import { verifyConfigurationUpdate } from "../../config/ownership.js";
3
4
  import { parseConfigurationDocument } from "../../config/document.js";
5
+ import { repositoryPathComponent } from "../../repository/location.js";
4
6
  import { updateConfigurationFile } from "../../config/files.js";
5
- import { defaultRepositoryRoot, remoteIdentity, resolveRepositoryRoot, validateConfigurationSource, validateRegistrationConfigurationSource } from "./config.js";
7
+ import { defaultRepositoryRoot, remoteIdentity, reviewConfigurationMapping, resolveRepositoryRoot, validateConfigurationSource, validateRegistrationConfigurationSource } from "./config.js";
6
8
  import { missingPathsReferToSameDirectory, resolvePhysicalDirectory } from "../../platform/filesystem.js";
7
- const repositoryPathComponent = (component) => {
8
- let escaped = component.replace(/[<>:"/\\|?*]/g, (character) => `%${character.charCodeAt(0).toString(16).toUpperCase()}`)
9
- .replace(/\.+$/, (dots) => "%2E".repeat(dots.length));
10
- if (/^(?:con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\.|$)/i.test(escaped)) {
11
- escaped = `%${escaped.charCodeAt(0).toString(16).toUpperCase()}${escaped.slice(1)}`;
12
- }
13
- return escaped;
9
+ const reviewRepositoryOwnership = {
10
+ section: "review", fields: ["repositoryRoot", "repositories"],
11
+ retainedSequence: { field: "repositories", identity: "remote", fields: [] },
14
12
  };
15
13
  const sameDirectory = async (first, second) => {
16
14
  const [left, right] = await Promise.all([resolvePhysicalDirectory(first), resolvePhysicalDirectory(second)]);
@@ -22,13 +20,14 @@ const sameDirectory = async (first, second) => {
22
20
  };
23
21
  export const updateRepositoryConfiguration = async (source, input, runtimePaths, options) => {
24
22
  const existing = source === undefined ? undefined : await validateRegistrationConfigurationSource(source, runtimePaths);
25
- const document = source === undefined ? new Document({ repositoryRoot: defaultRepositoryRoot, repositories: [] }) : parseConfigurationDocument(source, runtimePaths).document;
26
- const decoded = document.toJS();
27
- const root = document.has("repositoryRoot") ? decoded.repositoryRoot : defaultRepositoryRoot;
23
+ const document = source === undefined ? new Document({ review: { repositoryRoot: defaultRepositoryRoot, repositories: [] } }) : parseConfigurationDocument(source, runtimePaths).document;
24
+ const mapping = document.toJS();
25
+ const decoded = reviewConfigurationMapping(mapping);
26
+ const root = document.hasIn(["review", "repositoryRoot"]) ? decoded.repositoryRoot : defaultRepositoryRoot;
28
27
  const identity = remoteIdentity(input.remote, "remote");
29
28
  const previous = existing?.repositories.find((repository) => repository.coordinate === identity.coordinate);
30
29
  if (previous !== undefined && input.path === undefined) {
31
- return { result: { repository: previous, added: false } };
30
+ return { kind: "unchanged", result: { repository: previous, added: false } };
32
31
  }
33
32
  let repositoryPath;
34
33
  if (input.path === undefined) {
@@ -45,21 +44,22 @@ export const updateRepositoryConfiguration = async (source, input, runtimePaths,
45
44
  }
46
45
  if (previous !== undefined) {
47
46
  if (await sameDirectory(previous.path, repositoryPath)) {
48
- return { result: { repository: previous, added: false } };
47
+ return { kind: "unchanged", result: { repository: previous, added: false } };
49
48
  }
50
49
  throw new Error(`Repository ${identity.coordinate} is already configured at ${previous.path}; the requested path ${repositoryPath} differs.`);
51
50
  }
52
- if (!document.has("repositoryRoot")) {
53
- document.set("repositoryRoot", defaultRepositoryRoot);
51
+ if (!document.hasIn(["review", "repositoryRoot"])) {
52
+ document.setIn(["review", "repositoryRoot"], defaultRepositoryRoot);
54
53
  }
55
- if (!document.has("repositories")) {
56
- document.set("repositories", document.createNode([]));
54
+ if (!document.hasIn(["review", "repositories"])) {
55
+ document.setIn(["review", "repositories"], document.createNode([]));
57
56
  }
58
- document.addIn(["repositories"], { remote: input.remote, path: repositoryPath });
57
+ document.addIn(["review", "repositories"], { remote: input.remote, path: repositoryPath });
59
58
  const updatedSource = document.toString();
59
+ verifyConfigurationUpdate(mapping, parseConfigurationDocument(updatedSource, runtimePaths).mapping, reviewRepositoryOwnership);
60
60
  const configuration = await validateConfigurationSource(updatedSource, runtimePaths);
61
61
  const repository = configuration.repositories.at(-1);
62
- return { result: { repository, added: true }, source: updatedSource };
62
+ return { kind: "write", result: { repository, added: true }, source: updatedSource, ownership: reviewRepositoryOwnership };
63
63
  };
64
64
  export const addRepository = async (input, runtimePaths, options) => {
65
65
  if (!path.isAbsolute(options.workingDirectory) || !path.isAbsolute(options.homeDirectory)) {
@@ -1 +1 @@
1
- {"version":3,"file":"repositories.js","sourceRoot":"","sources":["../../../src/commands/review/repositories.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAA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aAAa,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,CAAC,CAAE,CAAC;IACtD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE,SAAS,EAAE,yBAAyB,EAAE,CAAC;AAC7H,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,EAChC,KAAyB,EACzB,YAAyB,EACzB,OAA6B,EACC,EAAE;IAChC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,CAAC;QAC1F,MAAM,IAAI,KAAK,CAAC,kEAAkE,CAAC,CAAC;IACtF,CAAC;IACD,OAAO,uBAAuB,CAAC,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,6BAA6B,CAAC,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC,CAAC;AAChI,CAAC,CAAC"}
@@ -8,8 +8,8 @@ Read [the handbook](handbook.md) for CLI operations and failure semantics.
8
8
  ## Establish the assignment
9
9
 
10
10
  The startup prompt supplies `projectId`, `taskId`, the original `claimId`,
11
- `worktreeId`, the actual worktree path and branch, and the execution's frozen
12
- configuration. Use that explicit assignment throughout execution and recovery.
11
+ `worktreeId`, the actual worktree path and branch, and the configuration selected
12
+ for this invocation. Use that explicit assignment throughout execution and recovery.
13
13
  Task properties, the working directory, environment variables, and an ordinary
14
14
  conversation request do not establish this managed context.
15
15
 
@@ -34,9 +34,10 @@ daynight task show <task-id> --project <project-id> --json
34
34
  Verify its `projectId` and `id`, `status=in_progress`, and
35
35
  `properties.worker.state=active` with the supplied `claimId` and `worktreeId`.
36
36
  Verify the actual working directory and Git branch match the supplied worktree.
37
- Use the supplied frozen execution configuration without replacing it from
38
- current defaults. If the same claim is already `completed` and the task is
39
- `done`, report the existing completion and return without reexecuting it. Any
37
+ Use the configuration supplied for this invocation. The controller selects the
38
+ current settings appropriate to the recorded agent when it launches or resumes
39
+ a native process; an executor does not independently replace that assignment.
40
+ If the same claim is already `completed` and the task is `done`, report the existing completion and return without reexecuting it. Any
40
41
  other state or identity mismatch leaves execution waiting; an observed claim
41
42
  change stops business writes immediately.
42
43
 
@@ -106,7 +106,7 @@ new execution interval and clears completion; returning to todo clears both
106
106
  endpoints. In_progress to done retains the nullable start and records completion.
107
107
  Todo to done records only completion, with unknown duration. Same-status and
108
108
  metadata updates preserve timing. Ordinary status changes provide no process ownership,
109
- release, transfer, stop, or lease semantics. The Web confirms every status choice,
109
+ release, withdrawal, stop, or lease semantics. The Web confirms every status choice,
110
110
  including the current status; cancel and Escape submit no request.
111
111
 
112
112
  **Task deletion.** `task delete <task-id> [--remove-depends] --if-version <version>`
@@ -42,7 +42,7 @@ that assumption. Follow the state rules below before any permission change.
42
42
  | `todo`, permission false, review fails | Keep permission false and report concrete gaps. Confirmed-information organization follows the review rules above. |
43
43
  | `todo`, permission true | Read-only re-audit; do not rewrite the same flag as an audit marker. |
44
44
  | `in_progress`, permission false | Report the permission lock; do not newly enable or reset status to evade it. |
45
- | `in_progress`, permission true | Read-only re-audit and report actual execution state. Review does not pause, stop, release, or transfer execution. |
45
+ | `in_progress`, permission true | Read-only re-audit and report actual execution state. Review does not pause, stop, release, or withdraw execution. |
46
46
  | `done` | Report completion and no handoff needed; do not reopen or update permission. This is mode policy, not an API prohibition on completed-task updates. |
47
47
  | Active or released worker record | Preserve ownership and execution history. An active execution keeps its original resources. A released task starts a fresh claim/worktree/native session only through an authorized management decision; enabling permission neither resumes it nor restores deleted source resources. |
48
48
 
@@ -0,0 +1,3 @@
1
+ export declare const attachWorker: (options: {
2
+ homeDirectory: string;
3
+ }) => Promise<void>;
@@ -0,0 +1,53 @@
1
+ import { createOperation } from "../../api/operation.js";
2
+ import { createHerdrInstance } from "./herdr/instance.js";
3
+ import { spawnHerdrProcess } from "./herdr/command.js";
4
+ import { resolveWorkerPaths } from "./paths.js";
5
+ export const attachWorker = async (options) => {
6
+ if (!process.stdin.isTTY || !process.stdout.isTTY)
7
+ throw new Error("daynight worker attach requires an interactive terminal.");
8
+ const instance = createHerdrInstance({ paths: resolveWorkerPaths(options.homeDirectory) });
9
+ const operation = createOperation({ limits: { totalMs: 30_000 } });
10
+ try {
11
+ await instance.connect(operation);
12
+ }
13
+ finally {
14
+ operation.dispose();
15
+ }
16
+ const attachment = instance.attachment;
17
+ const environment = Object.fromEntries(Object.entries(process.env).filter(([name]) => !attachment.unsetEnvironment.some((key) => key.toUpperCase() === name.toUpperCase())));
18
+ Object.assign(environment, attachment.environment);
19
+ // The explicit client connects only to an existing daemon, including if it exits after the probe.
20
+ // https://github.com/herdrdev/herdr/blob/2ecf19a92fc3a7fff75b6ce3655ef04f4625ec01/src/main.rs#L573-L577
21
+ const child = spawnHerdrProcess(attachment.executable, [...attachment.arguments, "client"], { env: environment, stdio: "inherit", detached: false, windowsHide: false });
22
+ const signals = process.platform === "win32" ? ["SIGINT", "SIGTERM", "SIGBREAK"] : ["SIGINT", "SIGTERM", "SIGHUP"];
23
+ let failure;
24
+ const listeners = signals.map((signal) => {
25
+ const forward = () => {
26
+ if (child.exitCode !== null || child.signalCode !== null)
27
+ return;
28
+ try {
29
+ child.kill(signal === "SIGBREAK" ? "SIGINT" : signal);
30
+ }
31
+ catch (cause) {
32
+ failure = new Error(`Cannot forward ${signal} to the Herdr attach client.`, { cause });
33
+ }
34
+ };
35
+ process.on(signal, forward);
36
+ return { signal, forward };
37
+ });
38
+ try {
39
+ const result = await new Promise((resolve) => {
40
+ child.once("error", (cause) => { failure = new Error("Cannot start the Herdr attach client.", { cause }); });
41
+ child.once("close", (code, signal) => resolve({ code, signal }));
42
+ });
43
+ if (failure !== undefined)
44
+ throw failure;
45
+ if (result.code !== 0 || result.signal !== null)
46
+ throw new Error(`The Herdr attach client failed: exit=${String(result.code)}, signal=${String(result.signal)}.`);
47
+ }
48
+ finally {
49
+ for (const { signal, forward } of listeners)
50
+ process.off(signal, forward);
51
+ }
52
+ };
53
+ //# sourceMappingURL=attach.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attach.js","sourceRoot":"","sources":["../../../src/commands/worker/attach.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,EAAE,OAAkC,EAAiB,EAAE;IACtF,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK;QAAE,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;IAC/H,MAAM,QAAQ,GAAG,mBAAmB,CAAC,EAAE,KAAK,EAAE,kBAAkB,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;IAC3F,MAAM,SAAS,GAAG,eAAe,CAAC,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;IACnE,IAAI,CAAC;QAAC,MAAM,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAAC,CAAC;YAClC,CAAC;QAAC,SAAS,CAAC,OAAO,EAAE,CAAC;IAAC,CAAC;IAChC,MAAM,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC;IACvC,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,gBAAgB,CAAC,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5B,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;IAC7B,CAAC,CAAC,CAAC;IACH,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,IAAI,OAAO,CAAyD,CAAC,OAAO,EAAE,EAAE;YACnG,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,GAAG,OAAO,GAAG,IAAI,KAAK,CAAC,uCAAuC,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC7G,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;QACnE,CAAC,CAAC,CAAC;QACH,IAAI,OAAO,KAAK,SAAS;YAAE,MAAM,OAAO,CAAC;QACzC,IAAI,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,MAAM,CAAC,MAAM,KAAK,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,wCAAwC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACpK,CAAC;YAAS,CAAC;QACT,KAAK,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,SAAS;YAAE,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC5E,CAAC;AACH,CAAC,CAAC"}
@@ -1,6 +1,12 @@
1
1
  import type { HerdrOwnedWorkspace } from "./herdr.js";
2
- import type { CleanupState, LocalTask } from "./types.js";
3
2
  import type { ExecutionDependencies } from "./execution.js";
3
+ import type { LocalTask, ResourceOwner, WorkerProject } from "./types.js";
4
+ export type CleanupInput = {
5
+ owner: ResourceOwner;
6
+ project: WorkerProject;
7
+ task?: LocalTask;
8
+ };
4
9
  export declare const createCleanupDriver: (deps: ExecutionDependencies) => {
5
- advance: (input: LocalTask, resources: readonly HerdrOwnedWorkspace[], kind: CleanupState["kind"], deadline: number, signal?: AbortSignal) => Promise<LocalTask>;
10
+ advance: (input: CleanupInput, resources: readonly HerdrOwnedWorkspace[], deleteWorktree: boolean, signal?: AbortSignal) => Promise<boolean>;
11
+ remaining: (owner: ResourceOwner) => number;
6
12
  };
@@ -1,173 +1,57 @@
1
- import { HerdrAgentActionError } from "./herdr.js";
1
+ import path from "node:path";
2
+ import { actualTaskPane, executionContext, liveAgent, settleWorkerStops, workerOperation } from "./execution.js";
2
3
  import { workerCleanupPrompt } from "./prompts.js";
3
- import { actualTaskPane, executionContext, ownedWorkspace, taskBinding, workerOperation } from "./execution.js";
4
- const sameBinding = (left, right) => left.session === right.session && left.workspaceId === right.workspaceId && left.paneId === right.paneId && left.terminalId === right.terminalId;
4
+ const key = (owner) => `${owner.projectId}/${owner.taskId}/${owner.claimId}`;
5
5
  export const createCleanupDriver = (deps) => {
6
- const refresh = (task) => {
7
- const current = deps.store.getTask(task);
8
- if (current === null)
9
- throw new Error("The local cleanup record disappeared.");
10
- return current;
11
- };
12
- const confirmChangedStop = (context, original, actual, evidence, signal) => {
13
- if (evidence === null)
14
- throw new Error("The original native stop observation is unavailable.");
15
- return original.workspaceId !== actual.workspaceId || original.paneId !== actual.paneId
16
- ? workerOperation((operation) => deps.herdr.tasks.confirmReplacedStop(context, original, actual, evidence, operation), signal)
17
- : workerOperation((operation) => deps.herdr.tasks.confirmRestoredStop(context, original, actual, evidence, operation), signal);
18
- };
6
+ const attempts = new Map();
19
7
  return {
20
- advance: async (input, resources, kind, deadline, signal) => {
21
- let task = deps.store.beginCleanup(input, { kind, deadline }, deps.now());
22
- try {
23
- let pane = actualTaskPane(task, resources);
24
- const workspace = ownedWorkspace(task, resources);
25
- // Stopped confirmation cannot precede observation of an unresolved create. Once
26
- // persisted, it lets a later empty snapshot reconcile a lost close acknowledgement.
27
- if (task.nativeExecution?.workspaceSubmission === "unknown" && workspace === undefined && !task.cleanup.agentStopped && !task.cleanup.workspaceClosed)
28
- throw new HerdrAgentActionError("The original workspace creation is unresolved; an absent snapshot does not prove workspace closure.", "workspace.create", "unknown");
29
- if (task.resources.worktree === null) {
30
- const worktree = await workerOperation((operation) => deps.git.findWorktree(task, operation), signal);
31
- if (worktree !== null)
32
- task = deps.store.bindWorktree(task, worktree, deps.now());
33
- }
34
- if (task.resources.herdr === null && pane !== undefined) {
35
- if (task.resources.worktree === null)
36
- throw new Error("An original Herdr workspace exists without its attributable task worktree; cleanup retained it.");
37
- task = deps.store.bindHerdrExecution(task, pane.binding, null, deps.now());
38
- }
39
- else if (task.resources.herdr !== null && taskBinding(task) === null && pane !== undefined) {
40
- task = deps.store.bindHerdrExecution(task, pane.binding, null, deps.now());
8
+ advance: async (input, resources, deleteWorktree, signal) => {
9
+ const identity = key(input.owner);
10
+ let attempt = attempts.get(identity);
11
+ if (attempt === undefined) {
12
+ attempt = { deadline: deps.now() + 600_000, notified: false, baseline: null };
13
+ attempts.set(identity, attempt);
14
+ deps.emit({ kind: "cleanup-started", ...(input.task === undefined ? {} : { task: input.task }), message: `Cleaning claim ${input.owner.claimId}; this attempt has a ten-minute deadline.` });
15
+ }
16
+ const stopContext = { ...input.owner, cwd: path.join(input.project.localPath, ".worktrees", "daynight", input.owner.taskId) };
17
+ const stopped = await settleWorkerStops(deps, input.owner, signal);
18
+ const pane = stopped ? undefined : actualTaskPane(input.owner, resources);
19
+ if (pane !== undefined) {
20
+ const agent = input.task?.agent ?? pane.kind ?? pane.nativeSession?.agent;
21
+ if (agent === undefined) {
22
+ await workerOperation((operation) => deps.herdr.tasks.stopAndClose(stopContext, pane.binding, operation), signal);
41
23
  }
42
- if (task.resources.herdr !== null && task.resources.nativeSession === null && pane?.nativeSession !== undefined && pane.nativeSession !== null)
43
- task = deps.store.bindNativeSession(task, { source: "herdr", sessionId: pane.nativeSession.sessionId }, deps.now());
44
- const binding = taskBinding(task);
45
- const agent = task.configuration?.agent ?? task.nativeExecution?.stopObservation?.agent ?? pane?.kind ?? pane?.nativeSession?.agent;
46
- if (!task.cleanup.agentStopped) {
47
- if (binding === null) {
48
- if (workspace !== undefined || task.nativeExecution?.launchSubmission !== "never-submitted")
49
- throw new Error("The original native launch or resource identity is unknown; agent stop cannot be inferred from missing bindings.");
50
- task = deps.store.recordCleanupInputOutcome(task, "unavailable", deps.now());
51
- task = deps.store.recordCleanupResult(task, "unavailable", "No native launch was submitted for this execution.", deps.now());
52
- task = deps.store.confirmAgentStopped(task, { agentStopped: true }, deps.now());
53
- }
54
- else {
55
- if (agent === undefined || agent === null)
56
- throw new Error("The original native agent kind is unavailable; cleanup retained its resources.");
57
- const context = executionContext(task, agent);
58
- const actual = pane?.binding ?? binding;
59
- if (task.nativeExecution?.launchSubmission === "never-submitted") {
60
- if (workspace !== undefined)
61
- await workerOperation((operation) => deps.herdr.tasks.confirmEmptyPane(context, actual, operation), signal);
62
- task = deps.store.recordCleanupInputOutcome(task, "unavailable", deps.now());
63
- task = deps.store.recordCleanupResult(task, "unavailable", "The original owned pane has no native launch submission or foreground work.", deps.now());
64
- task = deps.store.confirmAgentStopped(task, { agentStopped: true }, deps.now());
65
- }
66
- else {
67
- let evidence = task.nativeExecution?.stopObservation;
68
- if (evidence === null || evidence === undefined) {
69
- if (!sameBinding(binding, actual))
70
- throw new Error("The original terminal changed before its native process identities were persisted; cleanup cannot infer stopped confirmation.");
71
- evidence = await workerOperation((operation) => deps.herdr.tasks.captureStop(context, binding, operation), signal);
72
- task = deps.store.recordStopObservation(task, evidence, deps.now());
73
- }
74
- if (sameBinding(binding, actual) && pane !== undefined && pane.kind === null && !pane.launchPending && !pane.interactiveReady && task.cleanup.result === null) {
75
- await workerOperation((operation) => deps.herdr.tasks.confirmStopped(context, binding, evidence, operation), signal);
76
- if (task.cleanup.input === "not-submitted")
77
- task = deps.store.recordCleanupInputOutcome(task, "unavailable", deps.now());
78
- task = deps.store.recordCleanupResult(task, "unavailable", "The original native processes exited before cleanup completion was established.", deps.now());
79
- task = deps.store.confirmAgentStopped(task, { agentStopped: true }, deps.now());
80
- }
81
- if (task.cleanup.input === "not-submitted" && task.cleanup.result === null && deps.now() < task.cleanup.deadline) {
82
- if (workspace === undefined || !sameBinding(binding, actual)) {
83
- task = deps.store.recordCleanupInputOutcome(task, "unavailable", deps.now());
84
- task = deps.store.recordCleanupResult(task, "unavailable", "The original native session is unavailable for cleanup input.", deps.now());
85
- }
86
- else {
87
- deps.store.markCleanupInputSubmitting(task, deps.now());
88
- try {
89
- const receipt = await workerOperation((operation) => deps.herdr.tasks.submitPrompt(context, binding, workerCleanupPrompt(task), operation), signal, Math.max(1, Math.min(30_000, task.cleanup.deadline - deps.now())));
90
- task = deps.store.recordCleanupInputOutcome(task, "submitted", deps.now());
91
- if (receipt.observation.status === "idle" && receipt.observation.interactiveReady && receipt.observation.stateChangeSeq !== null && receipt.observation.completionSeq !== null) {
92
- task = deps.store.recordCleanupInputEvidence(task, { stateChangeSeq: receipt.observation.stateChangeSeq, completionSeq: receipt.observation.completionSeq }, deps.now());
93
- }
94
- }
95
- catch (error) {
96
- if (error instanceof HerdrAgentActionError && error.submission !== "unknown") {
97
- task = deps.store.recordCleanupInputOutcome(task, "rejected", deps.now());
98
- task = deps.store.recordCleanupResult(task, "failed", error.message, deps.now());
99
- }
100
- else {
101
- deps.store.recordCleanupError(task, error instanceof Error ? error.message : String(error), deps.now());
102
- deps.emit({ kind: "cleanup-input-unknown", task: refresh(task), message: "Cleanup input may have been submitted; it will not be replayed.", error });
103
- }
104
- }
105
- }
106
- }
107
- task = refresh(task);
108
- if (task.cleanup.result === null) {
109
- if (workspace === undefined) {
110
- await workerOperation((operation) => deps.herdr.tasks.confirmMissingWorkspaceStopped(context, binding, evidence, operation), signal);
111
- task = deps.store.recordCleanupResult(task, "unavailable", "The original workspace is absent and its original processes have stopped.", deps.now());
112
- task = deps.store.confirmAgentStopped(task, { agentStopped: true }, deps.now());
113
- }
114
- else if (!sameBinding(binding, actual)) {
115
- await confirmChangedStop(context, binding, actual, evidence, signal);
116
- task = deps.store.recordCleanupResult(task, "unavailable", "The original processes stopped before Herdr restored its inactive shell.", deps.now());
117
- task = deps.store.confirmAgentStopped(task, { agentStopped: true }, deps.now());
118
- }
119
- else if (deps.now() >= task.cleanup.deadline) {
120
- task = deps.store.recordCleanupResult(task, "timed-out", "The original cleanup deadline elapsed; temporary resource cleanup is not proven complete.", deps.now());
121
- }
122
- else {
123
- pane = actualTaskPane(task, await workerOperation((operation) => deps.herdr.tasks.listResources(operation), signal));
124
- const baseline = task.cleanup.baseline;
125
- if (pane !== undefined && pane.kind === null && !pane.launchPending && !pane.interactiveReady) {
126
- await workerOperation((operation) => deps.herdr.tasks.confirmStopped(context, binding, evidence, operation), signal);
127
- task = deps.store.recordCleanupResult(task, "unavailable", "The original native processes exited before cleanup completion was established.", deps.now());
128
- task = deps.store.confirmAgentStopped(task, { agentStopped: true }, deps.now());
129
- }
130
- else if (baseline !== null && pane !== undefined && (pane.status === "idle" || pane.status === "done") && pane.stateChangeSeq !== null && pane.stateChangeSeq > baseline.stateChangeSeq && pane.completionSeq !== null && pane.completionSeq > baseline.completionSeq) {
131
- task = deps.store.recordCleanupResult(task, "completed", null, deps.now());
132
- }
133
- else {
134
- deps.emit({ kind: "cleanup-waiting", task, message: "Waiting for the original cleanup turn or its fixed deadline; the execution still occupies capacity." });
135
- return task;
136
- }
137
- }
138
- }
139
- if (!task.cleanup.agentStopped) {
140
- if (workspace === undefined)
141
- await workerOperation((operation) => deps.herdr.tasks.confirmMissingWorkspaceStopped(context, binding, evidence, operation), signal);
142
- else if (!sameBinding(binding, actual))
143
- await confirmChangedStop(context, binding, actual, evidence, signal);
144
- else
145
- await workerOperation((operation) => deps.herdr.tasks.forceStop(context, binding, evidence, operation), signal);
146
- task = deps.store.confirmAgentStopped(task, { agentStopped: true }, deps.now());
24
+ else {
25
+ const context = executionContext({ ...input, task: { agent } });
26
+ if (liveAgent(pane) && !attempt.notified && deps.now() < attempt.deadline) {
27
+ attempt.notified = true;
28
+ try {
29
+ const { observation } = await workerOperation((operation) => deps.herdr.tasks.submitPrompt(context, pane.binding, workerCleanupPrompt(input.owner, attempt.deadline), operation), signal, Math.max(1, Math.min(30_000, attempt.deadline - deps.now())));
30
+ if (observation.status === "idle" && observation.interactiveReady
31
+ && observation.stateChangeSeq !== null
32
+ && observation.completionSeq !== null) {
33
+ attempt.baseline = { stateChangeSeq: observation.stateChangeSeq, completionSeq: observation.completionSeq };
147
34
  }
148
35
  }
36
+ catch (error) {
37
+ deps.emit({ kind: "cleanup-notification-error", ...(input.task === undefined ? {} : { task: input.task }), message: "Cleanup notification failed; the current bounded cleanup attempt continues.", error });
38
+ }
149
39
  }
40
+ const completed = attempt.baseline !== null && (pane.status === "idle" || pane.status === "done")
41
+ && pane.stateChangeSeq !== null && pane.stateChangeSeq > attempt.baseline.stateChangeSeq
42
+ && pane.completionSeq !== null && pane.completionSeq > attempt.baseline.completionSeq;
43
+ if (liveAgent(pane) && !completed && deps.now() < attempt.deadline)
44
+ return false;
45
+ await workerOperation((operation) => deps.herdr.tasks.stopAndClose(context, pane.binding, operation), signal);
150
46
  }
151
- if (!task.cleanup.workspaceClosed) {
152
- if (binding !== null) {
153
- if (agent === undefined || agent === null)
154
- throw new Error("The original native agent kind is unavailable for workspace identity verification.");
155
- await workerOperation((operation) => deps.herdr.tasks.closeWorkspace(executionContext(task, agent), pane?.binding ?? binding, { agentStopped: true }, operation), signal);
156
- }
157
- task = deps.store.confirmWorkspaceClosed(task, { workspaceClosed: true }, deps.now());
158
- }
159
- if (task.cleanup.kind === "terminal" && !task.cleanup.worktreeDeleted) {
160
- await workerOperation((operation) => deps.git.removeWorktree(task, { terminal: true, agentStopped: true, workspaceClosed: true }, operation), signal);
161
- task = deps.store.confirmWorktreeDeleted(task, { worktreeDeleted: true }, deps.now());
162
- }
163
- deps.emit({ kind: task.cleanup.kind === "terminal" ? "cleaned" : "shutdown-stopped", task, message: task.cleanup.kind === "terminal" ? "Original native agent and workspace stopped; the original worktree was deleted." : "Original agent and workspace stopped; the unfinished worktree, claim and native history were preserved." });
164
- return task;
165
- }
166
- catch (error) {
167
- deps.store.recordCleanupError(task, error instanceof Error ? error.message : String(error), deps.now());
168
- throw error;
169
47
  }
48
+ if (deleteWorktree)
49
+ await workerOperation((operation) => deps.git.removeWorktree(input.project, input.owner, operation), signal, 180_000);
50
+ attempts.delete(identity);
51
+ deps.emit({ kind: deleteWorktree ? "cleaned" : "agent-stopped", ...(input.task === undefined ? {} : { task: input.task }), message: deleteWorktree ? "Stopped the task resources and deleted its worktree; the branch remains." : "Stopped the task resources and preserved its worktree." });
52
+ return true;
170
53
  },
54
+ remaining: (owner) => Math.max(0, (attempts.get(key(owner))?.deadline ?? deps.now()) - deps.now()),
171
55
  };
172
56
  };
173
57
  //# sourceMappingURL=cleanup.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cleanup.js","sourceRoot":"","sources":["../../../src/commands/worker/cleanup.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAGnD,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,cAAc,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGhH,MAAM,WAAW,GAAG,CAAC,IAAsB,EAAE,KAAuB,EAAW,EAAE,CAAC,IAAI,CAAC,OAAO,KAAK,KAAK,CAAC,OAAO,IAAI,IAAI,CAAC,WAAW,KAAK,KAAK,CAAC,WAAW,IAAI,IAAI,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC,UAAU,KAAK,KAAK,CAAC,UAAU,CAAC;AAGnO,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,IAA2B,EAAE,EAAE;IACjE,MAAM,OAAO,GAAG,CAAC,IAAe,EAAa,EAAE;QAC7C,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CA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,CAAC,CAAC,eAAe,EAAE,GAAG,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,0EAA0E,CAAC,CAAC,CAAC,wDAAwD,EAAE,CAAC,CAAC;YAC9R,OAAO,IAAI,CAAC;QACd,CAAC;QACD,SAAS,EAAE,CAAC,KAAoB,EAAU,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;KAC1H,CAAC;AACJ,CAAC,CAAC"}
@@ -1,17 +1,24 @@
1
+ import type { ServerConfiguration } from "../../config/server.js";
1
2
  import type { PathApi } from "../../platform/filesystem.js";
2
3
  import type { WorkerPaths } from "./paths.js";
3
- import type { FrozenExecutionConfiguration } from "./types.js";
4
- export type WorkerRepositoryConfiguration = FrozenExecutionConfiguration & {
4
+ import type { ExecutionConfiguration } from "./types.js";
5
+ export type WorkerRepositoryConfiguration = ExecutionConfiguration & {
5
6
  remote: string;
6
7
  path: string;
7
8
  projectId?: string;
8
9
  };
9
- export type WorkerConfiguration = FrozenExecutionConfiguration & {
10
+ export type WorkerConfiguration = ExecutionConfiguration & {
11
+ repositoryRoot: string;
10
12
  maxConcurrent: number;
11
13
  pollIntervalMs: number;
12
14
  repositories: readonly WorkerRepositoryConfiguration[];
13
15
  };
16
+ export type WorkerConfigurationSnapshot = ServerConfiguration & {
17
+ readonly source: string | undefined;
18
+ readonly configuration: WorkerConfiguration;
19
+ };
14
20
  export declare const workerConfigurationDefaults: Readonly<{
21
+ repositoryRoot: "~/daynights";
15
22
  maxConcurrent: 1;
16
23
  pollIntervalMs: 5000;
17
24
  recoveryLimit: 3;
@@ -19,3 +26,6 @@ export declare const workerConfigurationDefaults: Readonly<{
19
26
  }>;
20
27
  export declare const parseWorkerConfiguration: (source: string, paths: WorkerPaths, pathApi?: PathApi) => WorkerConfiguration;
21
28
  export declare const readWorkerConfiguration: (paths: WorkerPaths, signal?: AbortSignal) => Promise<WorkerConfiguration>;
29
+ export declare const validateWorkerConfigurationSnapshotSource: (source: string | undefined, paths: WorkerPaths, signal?: AbortSignal) => Promise<WorkerConfigurationSnapshot>;
30
+ export declare const readWorkerConfigurationSnapshot: (paths: WorkerPaths, signal?: AbortSignal) => Promise<WorkerConfigurationSnapshot>;
31
+ export declare const validateWorkerConfigurationSource: (source: string, paths: WorkerPaths, signal?: AbortSignal) => Promise<WorkerConfiguration>;