@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
@@ -1,12 +1,12 @@
1
1
  import { createHash } from "node:crypto";
2
- import { mkdir } from "node:fs/promises";
2
+ import { lstat, mkdir } from "node:fs/promises";
3
3
  import { hostname } from "node:os";
4
4
  import { setTimeout as delay } from "node:timers/promises";
5
5
  import { createOperation } from "../../api/operation.js";
6
6
  import { loadServerConfiguration } from "../../config/server.js";
7
- import { readWorkerConfiguration } from "./config.js";
7
+ import { readWorkerConfiguration, readWorkerConfigurationSnapshot } from "./config.js";
8
8
  import { createWorkerCoordinator } from "./coordinator.js";
9
- import { createWorkerControlDriver, submitWorkerControl } from "./control.js";
9
+ import { submitWorkerControl } from "./control.js";
10
10
  import { createWorkerDiagnostics } from "./diagnostics.js";
11
11
  import { isWorkerCancellation } from "./execution.js";
12
12
  import { createWorkerHerdr } from "./herdr.js";
@@ -27,181 +27,168 @@ export const currentWorkerPlatform = (platform = process.platform) => {
27
27
  };
28
28
  const machineDescription = (platform) => {
29
29
  const name = hostname();
30
- // This is a reported host label, independent of worker identity, not machine authentication.
30
+ // The host label is reported metadata, independent of worker identity and authentication.
31
31
  const bytes = createHash("sha1").update(`daynight:machine:${platform}:${name}`).digest().subarray(0, 16);
32
32
  bytes[6] = (bytes[6] & 0x0f) | 0x50;
33
33
  bytes[8] = (bytes[8] & 0x3f) | 0x80;
34
34
  const value = bytes.toString("hex");
35
35
  return { id: `${value.slice(0, 8)}-${value.slice(8, 12)}-${value.slice(12, 16)}-${value.slice(16, 20)}-${value.slice(20)}`, name };
36
36
  };
37
+ const hasWorkerDatabase = async (file) => {
38
+ try {
39
+ await lstat(file);
40
+ return true;
41
+ }
42
+ catch (error) {
43
+ if (error instanceof Error && "code" in error && error.code === "ENOENT")
44
+ return false;
45
+ throw error;
46
+ }
47
+ };
48
+ const runtimeCancellation = (signal) => {
49
+ const controller = new AbortController();
50
+ const cancel = () => controller.abort(signal?.reason);
51
+ const interrupt = () => controller.abort(new Error("Worker operation interrupted."));
52
+ const signals = process.platform === "win32" ? ["SIGINT", "SIGTERM", "SIGBREAK"] : ["SIGINT", "SIGTERM"];
53
+ signal?.addEventListener("abort", cancel, { once: true });
54
+ if (signal?.aborted)
55
+ cancel();
56
+ for (const name of signals)
57
+ process.on(name, interrupt);
58
+ return {
59
+ controller,
60
+ dispose: () => {
61
+ signal?.removeEventListener("abort", cancel);
62
+ for (const name of signals)
63
+ process.off(name, interrupt);
64
+ },
65
+ };
66
+ };
67
+ const throwFailures = (failures) => {
68
+ if (failures.length === 1)
69
+ throw failures[0];
70
+ if (failures.length > 1)
71
+ throw new AggregateError(failures, "Worker operation and resource cleanup failed.");
72
+ };
37
73
  export const runWorker = async (options) => {
38
74
  const platform = currentWorkerPlatform();
39
75
  const paths = resolveWorkerPaths(options.homeDirectory);
40
- const cancellation = new AbortController();
41
- const cancel = () => { cancellation.abort(options.signal?.reason); };
42
- const signals = process.platform === "win32" ? ["SIGINT", "SIGTERM", "SIGBREAK"] : ["SIGINT", "SIGTERM"];
43
- const interrupt = () => { cancellation.abort(new Error("Worker shutdown requested.")); };
44
- options.signal?.addEventListener("abort", cancel, { once: true });
45
- if (options.signal?.aborted)
46
- cancel();
47
- for (const signal of signals)
48
- process.on(signal, interrupt);
76
+ const cancellation = runtimeCancellation(options.signal);
77
+ const signal = cancellation.controller.signal;
49
78
  let lock;
50
79
  let store;
51
80
  let git;
52
81
  let coordinator;
53
82
  let herdr;
54
83
  let diagnostics;
55
- let cleanupLoop;
56
- let cleanupFailure;
57
- const cleanupJobs = new Map();
58
84
  const failures = [];
59
85
  try {
60
- cancellation.signal.throwIfAborted();
61
- const configuration = await readWorkerConfiguration(paths, cancellation.signal);
62
- const { serverUrl, serverToken } = await loadServerConfiguration(paths, cancellation.signal);
86
+ signal.throwIfAborted();
87
+ let configuration = await readWorkerConfiguration(paths, signal);
88
+ const { serverUrl, serverToken } = await loadServerConfiguration(paths, signal);
63
89
  if (serverToken === undefined)
64
90
  throw new Error("You are not logged in. Run daynight login to authenticate.");
91
+ const prepareRepositories = async () => {
92
+ if (configuration.repositories.length > 0 || options.prepareRepositories === undefined)
93
+ return;
94
+ await options.prepareRepositories(signal);
95
+ signal.throwIfAborted();
96
+ const current = await readWorkerConfigurationSnapshot(paths, signal);
97
+ if (current.serverUrl !== serverUrl || current.serverToken !== serverToken)
98
+ throw new Error("The Daynight service or authentication changed during worker repository configuration; restart the worker with the current configuration.");
99
+ configuration = current.configuration;
100
+ if (configuration.repositories.length === 0)
101
+ throw new Error("Worker repository configuration did not select any repositories.");
102
+ };
103
+ if (configuration.repositories.length === 0 && options.prepareRepositories !== undefined && !await hasWorkerDatabase(paths.databaseFile))
104
+ await prepareRepositories();
65
105
  lock = await acquireWorkerInstanceLock(paths);
66
- cancellation.signal.throwIfAborted();
67
- const workerId = await ensureWorkerIdentity(paths, cancellation.signal);
106
+ signal.throwIfAborted();
107
+ const workerId = await ensureWorkerIdentity(paths, signal);
108
+ store = openWorkerStore(paths.databaseFile);
109
+ await prepareRepositories();
68
110
  for (const directory of [paths.temporaryDirectory, paths.logsDirectory])
69
111
  await mkdir(directory, { recursive: true, mode: 0o700 });
70
- store = openWorkerStore(paths.databaseFile);
71
112
  diagnostics = await createWorkerDiagnostics({ paths, workerId, platform, ...(options.log === undefined ? {} : { log: options.log }), secrets: [serverToken] });
72
- const emit = diagnostics.emit;
73
- const buildPrompt = await createWorkerPromptBuilder(options.packageDirectory);
74
113
  const remote = createWorkerRemote({ serverUrl, serverToken });
114
+ await remote.currentUserId(signal);
75
115
  git = createWorkerGitManager({ temporaryDirectory: paths.temporaryDirectory });
76
116
  herdr = createWorkerHerdr({ paths, homeDirectory: options.homeDirectory });
77
117
  const repositories = [];
78
- coordinator = createWorkerCoordinator({
79
- store, git, herdr, remote, serverOrigin: serverUrl, workerId, platform,
80
- machine: machineDescription(platform), repositories, maxConcurrent: configuration.maxConcurrent,
81
- buildPrompt, emit, signal: cancellation.signal,
82
- });
83
- const cleanupCoordinator = coordinator;
84
- const cleanupDiagnostics = diagnostics;
85
- const cleanupStore = store;
86
- cleanupLoop = (async () => {
87
- while (!cancellation.signal.aborted) {
88
- for (const task of cleanupStore.listUnfinishedTasks()) {
89
- if (task.workerId !== workerId || (task.cleanup === null && task.control === null))
90
- continue;
91
- const identity = { serverOrigin: task.serverOrigin, projectId: task.projectId, taskId: task.taskId, claimId: task.claimId };
92
- const key = JSON.stringify(identity);
93
- if (cleanupJobs.has(key))
94
- continue;
95
- const job = (async () => {
96
- while (!cancellation.signal.aborted) {
97
- try {
98
- await cleanupCoordinator.advanceCommittedCleanups(identity);
99
- }
100
- catch (error) {
101
- if (isWorkerCancellation(error, cancellation.signal))
102
- return;
103
- emit({ kind: "cleanup-error", message: "Committed cleanup could not advance; its original deadline and responsibility are retained.", error });
104
- }
105
- await cleanupDiagnostics.flush();
106
- const current = cleanupStore.getTask(identity);
107
- if (current === null)
108
- throw new Error("The committed cleanup record disappeared.");
109
- if (current.status === "done" || (current.cleanup === null && current.control === null))
110
- return;
111
- const state = current.cleanup;
112
- if (current.control === null && state !== null && state.result !== null && state.agentStopped && state.workspaceClosed && (state.kind === "shutdown" || state.worktreeDeleted))
113
- return;
114
- const remaining = state === null ? 0 : state.deadline - Date.now();
115
- try {
116
- await delay(remaining > 0 ? Math.max(1, Math.min(1_000, remaining)) : 1_000, undefined, { signal: cancellation.signal });
117
- }
118
- catch (error) {
119
- if (!isWorkerCancellation(error, cancellation.signal))
120
- throw error;
121
- }
122
- }
123
- })().catch((error) => { if (cleanupFailure === undefined)
124
- cleanupFailure = error; cancellation.abort(error); });
125
- cleanupJobs.set(key, job);
126
- void job.then(() => { if (cleanupJobs.get(key) === job)
127
- cleanupJobs.delete(key); });
128
- }
118
+ for (const repository of configuration.repositories) {
119
+ const project = await remote.resolveProject({ repoUrl: repository.remote, ...(repository.projectId === undefined ? {} : { projectId: repository.projectId }) }, signal);
120
+ const previous = store.getProject({ projectId: project.id });
121
+ if (previous !== null && (previous.repoUrl !== repository.remote || previous.localPath !== repository.path)) {
122
+ const operation = createOperation({ signal });
129
123
  try {
130
- await delay(1_000, undefined, { signal: cancellation.signal });
124
+ if ((await git.listWorktrees(previous, operation)).length > 0)
125
+ throw new Error("Owned worktrees prevent changing the project's original repository binding.");
131
126
  }
132
- catch (error) {
133
- if (!isWorkerCancellation(error, cancellation.signal))
134
- throw error;
127
+ finally {
128
+ operation.dispose();
135
129
  }
136
130
  }
137
- })().catch((error) => { if (cleanupFailure === undefined)
138
- cleanupFailure = error; cancellation.abort(error); });
139
- emit({ kind: "started", message: `Foreground worker ${workerId} on ${platform}; maxConcurrent=${configuration.maxConcurrent}; pollIntervalMs=${configuration.pollIntervalMs}; logs=${diagnostics.filename}.` });
140
- await remote.currentUserId(cancellation.signal);
141
- for (const repository of configuration.repositories) {
142
- cancellation.signal.throwIfAborted();
143
- const project = await remote.resolveProject({ repoUrl: repository.remote, ...(repository.projectId === undefined ? {} : { projectId: repository.projectId }) }, cancellation.signal);
144
- const binding = { serverOrigin: serverUrl, projectId: project.id, repoUrl: repository.remote, localPath: repository.path };
145
- const operation = createOperation({ signal: cancellation.signal });
131
+ const binding = store.registerProject({ projectId: project.id, repoUrl: repository.remote, localPath: repository.path });
132
+ const operation = createOperation({ signal });
146
133
  try {
147
134
  await git.prepareRepository(binding, operation);
148
135
  }
149
136
  finally {
150
137
  operation.dispose();
151
138
  }
152
- const registered = store.registerProject(binding);
153
- const frozen = { agent: repository.agent, model: repository.model, args: repository.args, recoveryLimit: repository.recoveryLimit };
154
- repositories.push({ project: registered, configuration: frozen });
139
+ repositories.push({ project: binding, configuration: { agent: repository.agent, model: repository.model, args: repository.args, recoveryLimit: repository.recoveryLimit } });
155
140
  }
141
+ coordinator = createWorkerCoordinator({
142
+ store, git, herdr, remote, serverOrigin: serverUrl, workerId, platform,
143
+ machine: machineDescription(platform), repositories,
144
+ maxConcurrent: configuration.maxConcurrent, globalConfiguration: configuration,
145
+ buildPrompt: await createWorkerPromptBuilder(options.packageDirectory),
146
+ emit: diagnostics.emit, signal,
147
+ });
148
+ diagnostics.emit({ kind: "started", message: `Foreground worker ${workerId} on ${platform}; maxConcurrent=${configuration.maxConcurrent}; pollIntervalMs=${configuration.pollIntervalMs}; logs=${diagnostics.filename}.` });
156
149
  let attachmentShown = false;
157
- while (!cancellation.signal.aborted) {
150
+ while (!signal.aborted) {
158
151
  try {
159
152
  await coordinator.tick();
160
153
  if (!attachmentShown) {
161
- emit({ kind: "attach", message: `Original ready private Herdr session: ${JSON.stringify(herdr.attachment)}. Apply its environment and unsetEnvironment only to the attach process.` });
154
+ diagnostics.emit({ kind: "attach", message: "Run daynight worker attach in another terminal for native input." });
162
155
  attachmentShown = true;
163
156
  }
164
157
  }
165
158
  catch (error) {
166
- if (isWorkerCancellation(error, cancellation.signal))
159
+ if (isWorkerCancellation(error, signal))
167
160
  break;
168
- if (cancellation.signal.aborted)
161
+ if (signal.aborted)
169
162
  throw error;
170
- emit({ kind: "reconciliation-error", message: "The reconciliation round failed; retained execution resources and unresolved writes require observation.", error });
163
+ diagnostics.emit({ kind: "reconciliation-error", message: "The reconciliation round failed; resources remain for the next successful observation.", error });
171
164
  }
172
165
  await diagnostics.flush();
173
- if (cancellation.signal.aborted)
166
+ if (signal.aborted)
174
167
  break;
175
168
  try {
176
- await delay(configuration.pollIntervalMs, undefined, { signal: cancellation.signal });
169
+ await delay(configuration.pollIntervalMs, undefined, { signal });
177
170
  }
178
171
  catch (error) {
179
- if (!isWorkerCancellation(error, cancellation.signal))
172
+ if (!isWorkerCancellation(error, signal))
180
173
  throw error;
181
174
  }
182
175
  }
183
176
  }
184
177
  catch (error) {
185
- if (!isWorkerCancellation(error, cancellation.signal))
178
+ if (!isWorkerCancellation(error, signal))
186
179
  failures.push(error);
187
180
  }
188
181
  finally {
189
- if (!cancellation.signal.aborted)
190
- cancellation.abort(new Error("Worker runtime is closing."));
191
- await cleanupLoop;
192
- await Promise.all(cleanupJobs.values());
193
- if (cleanupFailure !== undefined && !failures.includes(cleanupFailure))
194
- failures.push(cleanupFailure);
182
+ if (!signal.aborted)
183
+ cancellation.controller.abort(new Error("Worker runtime is closing."));
195
184
  if (coordinator !== undefined && herdr !== undefined) {
196
185
  try {
197
- diagnostics?.emit({ kind: "shutdown", message: "Stopping acquisitions and ordinary input; cleaning original executions with their persisted deadlines." });
198
- const stopped = await coordinator.shutdown();
199
- if (!stopped)
200
- throw new Error("Original task agents are not all confirmed stopped; their private Herdr instance was retained.");
186
+ diagnostics?.emit({ kind: "shutdown", message: "Stopping agents while retaining unfinished claims, worktrees and native session IDs." });
187
+ if (!await coordinator.shutdown())
188
+ throw new Error("Some task agents could not stop; the private Herdr instance was retained.");
201
189
  const operation = createOperation({ limits: { totalMs: 30_000 } });
202
190
  try {
203
- const proof = await herdr.stopInstance(operation);
204
- diagnostics?.emit({ kind: "stopped", message: `Private Herdr stop confirmed: ${JSON.stringify(proof)}. Unfinished claims, worktrees and native history are retained.` });
191
+ await herdr.stopInstance(operation);
205
192
  }
206
193
  finally {
207
194
  operation.dispose();
@@ -224,125 +211,66 @@ export const runWorker = async (options) => {
224
211
  failures.push(error);
225
212
  }
226
213
  try {
227
- await lock?.release();
214
+ await diagnostics?.flush();
228
215
  }
229
216
  catch (error) {
230
217
  failures.push(error);
231
218
  }
232
219
  try {
233
- await diagnostics?.flush();
220
+ await lock?.release();
234
221
  }
235
222
  catch (error) {
236
223
  failures.push(error);
237
224
  }
238
- for (const signal of signals)
239
- process.off(signal, interrupt);
240
- options.signal?.removeEventListener("abort", cancel);
225
+ cancellation.dispose();
241
226
  }
242
- if (failures.length === 1)
243
- throw failures[0];
244
- if (failures.length > 1)
245
- throw new AggregateError(failures, "Worker execution or shutdown failed.");
227
+ throwFailures(failures);
246
228
  };
247
229
  export const runWorkerControl = async (options) => {
248
230
  const platform = currentWorkerPlatform();
249
231
  const paths = resolveWorkerPaths(options.homeDirectory);
250
- const cancellation = new AbortController();
251
- const cancel = () => cancellation.abort(options.signal?.reason);
252
- const interrupt = () => cancellation.abort(new Error("Worker management interrupted; the persisted intent is retained."));
253
- const signals = process.platform === "win32" ? ["SIGINT", "SIGTERM", "SIGBREAK"] : ["SIGINT", "SIGTERM"];
254
- options.signal?.addEventListener("abort", cancel, { once: true });
255
- if (options.signal?.aborted)
256
- cancel();
257
- for (const signal of signals)
258
- process.on(signal, interrupt);
232
+ const cancellation = runtimeCancellation(options.signal);
233
+ const signal = cancellation.controller.signal;
259
234
  let lock;
260
235
  let store;
261
236
  let git;
262
- let coordinator;
263
237
  let diagnostics;
264
238
  const failures = [];
265
239
  try {
266
- cancellation.signal.throwIfAborted();
267
- const configuration = await readWorkerConfiguration(paths, cancellation.signal);
268
- const { serverUrl, serverToken } = await loadServerConfiguration(paths, cancellation.signal);
240
+ signal.throwIfAborted();
241
+ lock = await tryAcquireWorkerInstanceLock(paths);
242
+ if (lock === null)
243
+ throw new Error("Stop daynight worker run before running a worker management command.");
244
+ const configuration = await readWorkerConfiguration(paths, signal);
245
+ const { serverUrl, serverToken } = await loadServerConfiguration(paths, signal);
269
246
  if (serverToken === undefined)
270
247
  throw new Error("You are not logged in. Run daynight login to authenticate.");
271
- lock = await tryAcquireWorkerInstanceLock(paths);
272
- const workerId = await ensureWorkerIdentity(paths, cancellation.signal);
248
+ const workerId = await ensureWorkerIdentity(paths, signal);
273
249
  store = openWorkerStore(paths.databaseFile);
274
250
  const remote = createWorkerRemote({ serverUrl, serverToken });
275
- await remote.currentUserId(cancellation.signal);
251
+ await remote.currentUserId(signal);
276
252
  diagnostics = await createWorkerDiagnostics({ paths, workerId, platform, ...(options.log === undefined ? {} : { log: options.log }), secrets: [serverToken] });
277
253
  const repositories = [];
278
- if (options.request.kind === "resume") {
279
- for (const repository of configuration.repositories) {
280
- if (options.request.projectId !== undefined && repository.projectId !== undefined && repository.projectId !== options.request.projectId)
281
- continue;
282
- const project = await remote.resolveProject({ repoUrl: repository.remote, ...(repository.projectId === undefined ? {} : { projectId: repository.projectId }) }, cancellation.signal);
283
- if (options.request.projectId !== undefined && project.id !== options.request.projectId)
284
- continue;
285
- const binding = store.registerProject({ serverOrigin: serverUrl, projectId: project.id, repoUrl: repository.remote, localPath: repository.path });
286
- repositories.push({ project: binding, configuration: { agent: repository.agent, model: repository.model, args: repository.args, recoveryLimit: repository.recoveryLimit } });
287
- }
254
+ for (const repository of configuration.repositories) {
255
+ const project = await remote.resolveProject({ repoUrl: repository.remote, ...(repository.projectId === undefined ? {} : { projectId: repository.projectId }) }, signal);
256
+ const binding = store.registerProject({ projectId: project.id, repoUrl: repository.remote, localPath: repository.path });
257
+ repositories.push({ project: binding, configuration: { agent: repository.agent, model: repository.model, args: repository.args, recoveryLimit: repository.recoveryLimit } });
288
258
  }
289
- const result = await submitWorkerControl({ store, remote, serverOrigin: serverUrl, workerId, platform, machine: machineDescription(platform), repositories, request: options.request, signal: cancellation.signal });
259
+ await mkdir(paths.temporaryDirectory, { recursive: true, mode: 0o700 });
260
+ git = createWorkerGitManager({ temporaryDirectory: paths.temporaryDirectory });
261
+ const herdr = createWorkerHerdr({ paths, homeDirectory: options.homeDirectory });
262
+ const machine = machineDescription(platform);
263
+ const coordinator = createWorkerCoordinator({
264
+ store, git, herdr, remote, serverOrigin: serverUrl, workerId, platform, machine, repositories,
265
+ maxConcurrent: configuration.maxConcurrent, globalConfiguration: configuration,
266
+ buildPrompt: await createWorkerPromptBuilder(options.packageDirectory), emit: diagnostics.emit, signal,
267
+ });
268
+ const result = await submitWorkerControl({
269
+ store, remote, serverOrigin: serverUrl, workerId, platform, machine, repositories,
270
+ request: options.request, signal, coordinator,
271
+ emit: diagnostics.emit,
272
+ });
290
273
  diagnostics.emit({ kind: "management", ...(result.task === null ? {} : { task: result.task }), message: result.message });
291
- await diagnostics.flush();
292
- if (result.task !== null && options.request.kind !== "resume") {
293
- const identity = result.task;
294
- let lastWaitingState = null;
295
- while (true) {
296
- cancellation.signal.throwIfAborted();
297
- let task = store.getTask(identity);
298
- if (task === null)
299
- throw new Error("The managed execution record disappeared.");
300
- if (task.control?.submission === "unknown")
301
- task = await createWorkerControlDriver({ store, remote, serverOrigin: serverUrl, now: Date.now }).advance(task, cancellation.signal, { submit: false });
302
- if (task.status === "done") {
303
- diagnostics.emit({ kind: "management-complete", task, message: `Management finished for claim ${task.claimId}; outcome=${task.control?.outcome ?? "ownership-ended"}.` });
304
- break;
305
- }
306
- if (task.control?.submission === "rejected")
307
- throw new Error(`Management refused for claim ${task.claimId}: ${task.control.error}. A new explicit decision and version are required.`);
308
- if (task.control?.submission === "unknown")
309
- throw new Error(`Management result is unknown for claim ${task.claimId}; the original intent and claim identities are retained for reconciliation.`);
310
- if (lock === null)
311
- lock = await tryAcquireWorkerInstanceLock(paths);
312
- if (lock !== null) {
313
- if (coordinator === undefined) {
314
- await mkdir(paths.temporaryDirectory, { recursive: true, mode: 0o700 });
315
- git = createWorkerGitManager({ temporaryDirectory: paths.temporaryDirectory });
316
- const herdr = createWorkerHerdr({ paths, homeDirectory: options.homeDirectory });
317
- const buildPrompt = await createWorkerPromptBuilder(options.packageDirectory);
318
- coordinator = createWorkerCoordinator({ store, git, herdr, remote, serverOrigin: serverUrl, workerId, platform, machine: machineDescription(platform), repositories, maxConcurrent: configuration.maxConcurrent, buildPrompt, emit: diagnostics.emit, signal: cancellation.signal });
319
- }
320
- if (options.request.kind === "retry") {
321
- await coordinator.advanceRetry(identity);
322
- const retried = store.getTask(identity);
323
- if (retried === null)
324
- throw new Error("The retried execution record disappeared.");
325
- diagnostics.emit({ kind: "retry", task: retried, message: `Explicit recovery processed for claim ${retried.claimId}; count=${retried.recovery.count}; pause=${retried.recovery.pauseReason ?? "none"}.` });
326
- break;
327
- }
328
- await coordinator.advanceCommittedCleanups(identity);
329
- }
330
- else if (options.request.kind === "retry") {
331
- diagnostics.emit({ kind: "retry-authorized", task, message: `Claim ${task.claimId} has one persisted extra recovery authorization; the foreground worker remains its sole controller.` });
332
- break;
333
- }
334
- await diagnostics.flush();
335
- const latest = store.getTask(identity);
336
- if (latest?.status === "done" || latest?.control?.submission === "unknown" || latest?.control?.submission === "rejected")
337
- continue;
338
- const waitingState = JSON.stringify({ cleanup: latest?.cleanup, control: latest?.control });
339
- if (waitingState !== lastWaitingState) {
340
- diagnostics.emit({ kind: "management-waiting", ...(latest === null ? {} : { task: latest }), message: `Waiting for the sole worker controller to finish management of claim ${task.claimId}.` });
341
- lastWaitingState = waitingState;
342
- }
343
- await delay(1_000, undefined, { signal: cancellation.signal });
344
- }
345
- }
346
274
  }
347
275
  catch (error) {
348
276
  failures.push(error);
@@ -361,24 +289,19 @@ export const runWorkerControl = async (options) => {
361
289
  failures.push(error);
362
290
  }
363
291
  try {
364
- await lock?.release();
292
+ await diagnostics?.flush();
365
293
  }
366
294
  catch (error) {
367
295
  failures.push(error);
368
296
  }
369
297
  try {
370
- await diagnostics?.flush();
298
+ await lock?.release();
371
299
  }
372
300
  catch (error) {
373
301
  failures.push(error);
374
302
  }
375
- for (const signal of signals)
376
- process.off(signal, interrupt);
377
- options.signal?.removeEventListener("abort", cancel);
303
+ cancellation.dispose();
378
304
  }
379
- if (failures.length === 1)
380
- throw failures[0];
381
- if (failures.length > 1)
382
- throw new AggregateError(failures, "Worker management or resource disposal failed.");
305
+ throwFailures(failures);
383
306
  };
384
307
  //# sourceMappingURL=runtime.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../../src/commands/worker/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,UAAU,IAAI,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,OAAO,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAE9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,yBAAyB,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAC7F,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AA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KAAK,CAAC,CAAC;QAAC,CAAC;QAC/D,IAAI,CAAC;YAAC,MAAM,WAAW,EAAE,KAAK,EAAE,CAAC;QAAC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAAC,CAAC;QAC3E,IAAI,CAAC;YAAC,MAAM,IAAI,EAAE,OAAO,EAAE,CAAC;QAAC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAAC,CAAC;QACtE,YAAY,CAAC,OAAO,EAAE,CAAC;IACzB,CAAC;IACD,aAAa,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC,CAAC"}
@@ -0,0 +1,31 @@
1
+ import type { WorkerAgent } from "../../api/types.js";
2
+ import type { NativePrerequisiteCommandRunner } from "./herdr/preflight.js";
3
+ import type { WorkerPaths } from "./paths.js";
4
+ import { createWorkerPromptBuilder } from "./prompts.js";
5
+ export type WorkerEnvironmentCheck = {
6
+ label: string;
7
+ status: "passed" | "missing" | "unverified";
8
+ detail: string;
9
+ remedy?: string;
10
+ agent?: WorkerAgent;
11
+ };
12
+ export type WorkerEnvironmentOptions = {
13
+ homeDirectory: string;
14
+ workingDirectory: string;
15
+ paths: WorkerPaths;
16
+ signal: AbortSignal;
17
+ packageDirectory?: string;
18
+ configuration?: {
19
+ agent: WorkerAgent;
20
+ model: string | null;
21
+ args: readonly string[];
22
+ };
23
+ };
24
+ export type WorkerEnvironmentDependencies = {
25
+ environment?: NodeJS.ProcessEnv;
26
+ platform?: NodeJS.Platform;
27
+ nodeVersion?: string;
28
+ runCommand?: NativePrerequisiteCommandRunner;
29
+ verifySkill?: typeof createWorkerPromptBuilder;
30
+ };
31
+ export declare const inspectWorkerEnvironment: (options: WorkerEnvironmentOptions, dependencies?: WorkerEnvironmentDependencies) => Promise<readonly WorkerEnvironmentCheck[]>;