@codetreker/daynight 0.21.9 → 0.21.11

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 (72) hide show
  1. package/README.md +204 -27
  2. package/dist/api/client.d.ts +3 -1
  3. package/dist/api/client.js +12 -1
  4. package/dist/api/client.js.map +1 -1
  5. package/dist/api/parse.d.ts +2 -1
  6. package/dist/api/parse.js +8 -0
  7. package/dist/api/parse.js.map +1 -1
  8. package/dist/api/types.d.ts +7 -0
  9. package/dist/cli/commands.js +2 -0
  10. package/dist/cli/commands.js.map +1 -1
  11. package/dist/commands/worker/cleanup.d.ts +6 -0
  12. package/dist/commands/worker/cleanup.js +173 -0
  13. package/dist/commands/worker/cleanup.js.map +1 -0
  14. package/dist/commands/worker/config.d.ts +21 -0
  15. package/dist/commands/worker/config.js +144 -0
  16. package/dist/commands/worker/config.js.map +1 -0
  17. package/dist/commands/worker/coordinator.d.ts +34 -0
  18. package/dist/commands/worker/coordinator.js +508 -0
  19. package/dist/commands/worker/coordinator.js.map +1 -0
  20. package/dist/commands/worker/definition.d.ts +2 -0
  21. package/dist/commands/worker/definition.js +14 -0
  22. package/dist/commands/worker/definition.js.map +1 -0
  23. package/dist/commands/worker/diagnostics.d.ts +20 -0
  24. package/dist/commands/worker/diagnostics.js +56 -0
  25. package/dist/commands/worker/diagnostics.js.map +1 -0
  26. package/dist/commands/worker/execution.d.ts +41 -0
  27. package/dist/commands/worker/execution.js +255 -0
  28. package/dist/commands/worker/execution.js.map +1 -0
  29. package/dist/commands/worker/herdr/agents.d.ts +185 -0
  30. package/dist/commands/worker/herdr/agents.js +654 -0
  31. package/dist/commands/worker/herdr/agents.js.map +1 -0
  32. package/dist/commands/worker/herdr/arguments.d.ts +8 -0
  33. package/dist/commands/worker/herdr/arguments.js +58 -0
  34. package/dist/commands/worker/herdr/arguments.js.map +1 -0
  35. package/dist/commands/worker/herdr/command.d.ts +22 -0
  36. package/dist/commands/worker/herdr/command.js +115 -0
  37. package/dist/commands/worker/herdr/command.js.map +1 -0
  38. package/dist/commands/worker/herdr/instance.d.ts +56 -0
  39. package/dist/commands/worker/herdr/instance.js +322 -0
  40. package/dist/commands/worker/herdr/instance.js.map +1 -0
  41. package/dist/commands/worker/herdr/preflight.d.ts +40 -0
  42. package/dist/commands/worker/herdr/preflight.js +251 -0
  43. package/dist/commands/worker/herdr/preflight.js.map +1 -0
  44. package/dist/commands/worker/herdr/rpc.d.ts +29 -0
  45. package/dist/commands/worker/herdr/rpc.js +186 -0
  46. package/dist/commands/worker/herdr/rpc.js.map +1 -0
  47. package/dist/commands/worker/herdr.d.ts +95 -0
  48. package/dist/commands/worker/herdr.js +35 -0
  49. package/dist/commands/worker/herdr.js.map +1 -0
  50. package/dist/commands/worker/index.d.ts +10 -0
  51. package/dist/commands/worker/index.js +14 -0
  52. package/dist/commands/worker/index.js.map +1 -0
  53. package/dist/commands/worker/prompts.d.ts +4 -0
  54. package/dist/commands/worker/prompts.js +64 -0
  55. package/dist/commands/worker/prompts.js.map +1 -0
  56. package/dist/commands/worker/remote.d.ts +18 -0
  57. package/dist/commands/worker/remote.js +134 -0
  58. package/dist/commands/worker/remote.js.map +1 -0
  59. package/dist/commands/worker/runtime.d.ts +8 -0
  60. package/dist/commands/worker/runtime.js +246 -0
  61. package/dist/commands/worker/runtime.js.map +1 -0
  62. package/dist/commands/worker/store.d.ts +55 -5
  63. package/dist/commands/worker/store.js +381 -26
  64. package/dist/commands/worker/store.js.map +1 -1
  65. package/dist/commands/worker/types.d.ts +37 -1
  66. package/dist/commands/worker/worktrees.d.ts +1 -0
  67. package/dist/commands/worker/worktrees.js +9 -0
  68. package/dist/commands/worker/worktrees.js.map +1 -1
  69. package/dist/config/document.d.ts +1 -1
  70. package/dist/config/document.js +1 -0
  71. package/dist/config/document.js.map +1 -1
  72. package/package.json +2 -2
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preflight.js","sourceRoot":"","sources":["../../../../src/commands/worker/herdr/preflight.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CAAC,IAAI,EAAE,EAAE,EAAE,GAAG,EAAE,SAAS,CAAC,CAAC;YAC9H,CAAC;YACD,SAAS,CAAC,KAAK,EAAE,CAAC;YAClB,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAE,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE,qBAAqB,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;QAClH,CAAC;KACF,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,29 @@
1
+ import type { Operation } from "../../../api/operation.js";
2
+ export declare const HERDR_MAX_REQUEST_BYTES = 1048576;
3
+ export declare const HERDR_MAX_RESPONSE_BYTES: number;
4
+ export type HerdrRpcSubmission = "not-submitted" | "unknown";
5
+ export type HerdrRpcResult = {
6
+ readonly type: string;
7
+ readonly [key: string]: unknown;
8
+ };
9
+ /** API error codes need method-specific interpretation; a structured error can follow remote submission. */
10
+ export declare class HerdrRpcError extends Error {
11
+ readonly method: string;
12
+ readonly requestId: string;
13
+ readonly submission: HerdrRpcSubmission;
14
+ readonly code: string | null;
15
+ readonly apiMessage: string | null;
16
+ constructor(message: string, options: {
17
+ method: string;
18
+ requestId: string;
19
+ submission: HerdrRpcSubmission;
20
+ code?: string;
21
+ apiMessage?: string;
22
+ cause?: unknown;
23
+ });
24
+ }
25
+ export declare const herdrIpcAddress: (endpoint: string, platform?: NodeJS.Platform) => string;
26
+ export declare const createHerdrRpcClient: (endpoint: string) => {
27
+ request: (method: string, params: Record<string, unknown>, operation: Operation) => Promise<HerdrRpcResult>;
28
+ };
29
+ export type HerdrRpcClient = ReturnType<typeof createHerdrRpcClient>;
@@ -0,0 +1,186 @@
1
+ import { randomUUID } from "node:crypto";
2
+ import { Socket } from "node:net";
3
+ import path from "node:path";
4
+ export const HERDR_MAX_REQUEST_BYTES = 1_048_576;
5
+ export const HERDR_MAX_RESPONSE_BYTES = 16 * 1_048_576;
6
+ /** API error codes need method-specific interpretation; a structured error can follow remote submission. */
7
+ export class HerdrRpcError extends Error {
8
+ method;
9
+ requestId;
10
+ submission;
11
+ code;
12
+ apiMessage;
13
+ constructor(message, options) {
14
+ super(message, { cause: options.cause });
15
+ this.name = "HerdrRpcError";
16
+ this.method = options.method;
17
+ this.requestId = options.requestId;
18
+ this.submission = options.submission;
19
+ this.code = options.code === undefined ? null : options.code;
20
+ this.apiMessage = options.apiMessage === undefined ? null : options.apiMessage;
21
+ }
22
+ }
23
+ export const herdrIpcAddress = (endpoint, platform = process.platform) => {
24
+ const pathApi = platform === "win32" ? path.win32 : path.posix;
25
+ if (typeof endpoint !== "string" || !pathApi.isAbsolute(endpoint) || endpoint.includes("\0")) {
26
+ throw new TypeError("The Herdr endpoint must be an absolute logical path without NUL characters.");
27
+ }
28
+ return platform === "win32" ? `\\\\.\\pipe\\${endpoint}` : endpoint;
29
+ };
30
+ const record = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
31
+ const encodeRequest = (id, method, params) => {
32
+ if (typeof method !== "string" || method.trim() === "" || /[\r\n\0]/.test(method)) {
33
+ throw new TypeError("The Herdr RPC method must be nonempty text without line breaks or NUL characters.");
34
+ }
35
+ if (!record(params))
36
+ throw new TypeError("The Herdr RPC parameters must be an object.");
37
+ const json = JSON.stringify({ id, method, params }, (_key, value) => {
38
+ if (typeof value === "undefined" || typeof value === "function" || typeof value === "symbol" || typeof value === "bigint" ||
39
+ (typeof value === "number" && !Number.isFinite(value))) {
40
+ throw new TypeError("Herdr RPC parameters must contain JSON values without omitted or nonfinite entries.");
41
+ }
42
+ return value;
43
+ });
44
+ // Herdr bounds the bytes preceding the newline, not the framing byte itself.
45
+ // https://github.com/herdrdev/herdr/blob/2ecf19a92fc3a7fff75b6ce3655ef04f4625ec01/src/api/server.rs#L750-L765
46
+ if (Buffer.byteLength(json, "utf8") > HERDR_MAX_REQUEST_BYTES)
47
+ throw new RangeError("The Herdr RPC request exceeds the 1 MiB limit.");
48
+ return Buffer.from(`${json}\n`, "utf8");
49
+ };
50
+ export const createHerdrRpcClient = (endpoint) => {
51
+ const address = herdrIpcAddress(endpoint);
52
+ return {
53
+ request: async (method, params, operation) => {
54
+ const requestId = randomUUID();
55
+ let submission = "not-submitted";
56
+ const failure = (message, cause) => new HerdrRpcError(message, { method, requestId, submission, cause });
57
+ let request;
58
+ let timeoutMs;
59
+ let deadline;
60
+ try {
61
+ operation.check();
62
+ request = encodeRequest(requestId, method, params);
63
+ deadline = performance.now() + Math.min(operation.remainingMs(), operation.limits.requestMs);
64
+ timeoutMs = Math.max(1, Math.ceil(deadline - performance.now()));
65
+ }
66
+ catch (cause) {
67
+ throw failure(`Herdr RPC ${method} could not be prepared.`, cause);
68
+ }
69
+ return new Promise((resolve, reject) => {
70
+ const socket = new Socket();
71
+ const chunks = [];
72
+ const responseLimit = Math.min(HERDR_MAX_RESPONSE_BYTES, operation.limits.responseBytes);
73
+ let responseBytes = 0;
74
+ let outcome;
75
+ const finish = (next) => {
76
+ if (outcome !== undefined)
77
+ return;
78
+ outcome = next;
79
+ socket.destroy();
80
+ };
81
+ const fail = (message, cause) => { finish({ error: failure(message, cause) }); };
82
+ const onAbort = () => { fail(`Herdr RPC ${method} was cancelled.`, operation.signal.reason); };
83
+ const check = () => {
84
+ operation.check();
85
+ if (performance.now() >= deadline)
86
+ throw new Error("The Herdr RPC request deadline elapsed.");
87
+ };
88
+ const timer = setTimeout(() => {
89
+ fail(`Herdr RPC ${method} deadline exceeded.`, new Error("The Herdr RPC request deadline elapsed."));
90
+ }, timeoutMs);
91
+ const onConnect = () => {
92
+ if (outcome !== undefined)
93
+ return;
94
+ try {
95
+ check();
96
+ // A write failure cannot establish that the remote app received no bytes.
97
+ submission = "unknown";
98
+ socket.write(request, (cause) => {
99
+ if (cause !== undefined && cause !== null)
100
+ fail(`Herdr RPC ${method} could not complete its request write.`, cause);
101
+ });
102
+ }
103
+ catch (cause) {
104
+ fail(`Herdr RPC ${method} could not submit its request.`, cause);
105
+ }
106
+ };
107
+ const onData = (chunk) => {
108
+ if (outcome !== undefined)
109
+ return;
110
+ try {
111
+ check();
112
+ responseBytes += chunk.length;
113
+ if (responseBytes > responseLimit)
114
+ throw new RangeError("The Herdr RPC response exceeds its byte limit.");
115
+ operation.consume(chunk.length);
116
+ if (outcome !== undefined)
117
+ return;
118
+ const newline = chunk.indexOf(0x0a);
119
+ if (newline < 0) {
120
+ chunks.push(chunk);
121
+ return;
122
+ }
123
+ const bytes = Buffer.concat([...chunks, chunk.subarray(0, newline)]);
124
+ const frame = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(bytes);
125
+ const response = JSON.parse(frame);
126
+ if (!record(response) || response.id !== requestId || Object.hasOwn(response, "result") === Object.hasOwn(response, "error")) {
127
+ throw new Error("The Herdr RPC response must match its request ID and contain exactly one result or error.");
128
+ }
129
+ if (Object.hasOwn(response, "error")) {
130
+ const body = response.error;
131
+ if (!record(body) || typeof body.code !== "string" || body.code === "" || typeof body.message !== "string") {
132
+ throw new Error("The Herdr RPC error response is malformed.");
133
+ }
134
+ finish({ error: new HerdrRpcError(`Herdr RPC ${method} returned ${body.code}: ${body.message}`, {
135
+ method, requestId, submission, code: body.code, apiMessage: body.message, cause: body,
136
+ }) });
137
+ return;
138
+ }
139
+ if (!record(response.result) || typeof response.result.type !== "string" || response.result.type === "") {
140
+ throw new Error("The Herdr RPC result must be an object with a type tag.");
141
+ }
142
+ finish({ result: response.result });
143
+ }
144
+ catch (cause) {
145
+ fail(`Herdr RPC ${method} returned an invalid response.`, cause);
146
+ }
147
+ };
148
+ const onError = (cause) => { fail(`Herdr RPC ${method} connection failed.`, cause); };
149
+ const onEnd = () => { fail(`Herdr RPC ${method} closed before a complete response line.`, new Error("The Herdr IPC peer ended the response.")); };
150
+ const onClose = () => {
151
+ clearTimeout(timer);
152
+ operation.signal.removeEventListener("abort", onAbort);
153
+ socket.removeListener("connect", onConnect);
154
+ socket.removeListener("data", onData);
155
+ socket.removeListener("error", onError);
156
+ socket.removeListener("end", onEnd);
157
+ const completed = outcome;
158
+ if (completed === undefined) {
159
+ reject(failure(`Herdr RPC ${method} closed before a complete response line.`, new Error("The Herdr IPC connection closed.")));
160
+ }
161
+ else if ("error" in completed)
162
+ reject(completed.error);
163
+ else
164
+ resolve(completed.result);
165
+ };
166
+ socket.once("connect", onConnect);
167
+ socket.on("data", onData);
168
+ socket.on("error", onError);
169
+ socket.once("end", onEnd);
170
+ socket.once("close", onClose);
171
+ operation.signal.addEventListener("abort", onAbort, { once: true });
172
+ if (operation.signal.aborted)
173
+ onAbort();
174
+ if (outcome === undefined) {
175
+ try {
176
+ socket.connect({ path: address });
177
+ }
178
+ catch (cause) {
179
+ fail(`Herdr RPC ${method} could not connect.`, cause);
180
+ }
181
+ }
182
+ });
183
+ },
184
+ };
185
+ };
186
+ //# sourceMappingURL=rpc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rpc.js","sourceRoot":"","sources":["../../../../src/commands/worker/herdr/rpc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,MAAM,CAAC,MAAM,uBAAuB,GAAG,SAAS,CAAC;AACjD,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,GAAG,SAAS,CAAC;AAKvD,4GAA4G;AAC5G,MAAM,OAAO,aAAc,SAAQ,KAAK;IAC7B,MAAM,CAAS;IACf,SAAS,CAAS;IAClB,UAAU,CAAqB;IAC/B,IAAI,CAAgB;IACpB,UAAU,CAAgB;IAEnC,YAAY,OAAe,EAAE,OAO5B;QACC,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;QACzC,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,SAAS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M,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBACpE,IAAI,SAAS,CAAC,MAAM,CAAC,OAAO;oBAAE,OAAO,EAAE,CAAC;gBACxC,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;oBAC1B,IAAI,CAAC;wBAAC,MAAM,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;oBAAC,CAAC;oBAC1C,OAAO,KAAK,EAAE,CAAC;wBAAC,IAAI,CAAC,aAAa,MAAM,qBAAqB,EAAE,KAAK,CAAC,CAAC;oBAAC,CAAC;gBAC1E,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,95 @@
1
+ import type { WorkerPaths } from "./paths.js";
2
+ export type { HerdrExecutionContext, HerdrExecutionOwner, HerdrOwnedWorkspace, HerdrTaskBinding, HerdrWorkspaceEvidence, HerdrPreparedWorkspace, HerdrAgentConfiguration, HerdrAgentObservation, HerdrNativeReference, HerdrStopObservation, HerdrLaunchEvidence, } from "./herdr/agents.js";
3
+ export { HerdrAgentActionError, validateHerdrAgentArguments } from "./herdr/agents.js";
4
+ export { HerdrRpcError } from "./herdr/rpc.js";
5
+ export declare const createWorkerHerdr: (options: {
6
+ paths: WorkerPaths;
7
+ homeDirectory: string;
8
+ executable?: string;
9
+ environment?: NodeJS.ProcessEnv;
10
+ }) => {
11
+ ensureInstance: (operation: import("../../api/operation.js").Operation) => Promise<import("./herdr/instance.js").HerdrInstanceReady>;
12
+ stopInstance: (operation: import("../../api/operation.js").Operation) => Promise<import("./herdr/instance.js").HerdrInstanceStopped>;
13
+ attachment: {
14
+ executable: string;
15
+ arguments: string[];
16
+ environment: NodeJS.ProcessEnv;
17
+ unsetEnvironment: string[];
18
+ };
19
+ paths: import("./herdr/instance.js").HerdrInstancePaths;
20
+ tasks: {
21
+ listResources: (operation: import("../../api/operation.js").Operation) => Promise<import("./herdr/agents.js").HerdrOwnedWorkspace[]>;
22
+ prepareWorkspace: (context: import("./herdr/agents.js").HerdrExecutionContext, operation: import("../../api/operation.js").Operation) => Promise<import("./herdr/agents.js").HerdrPreparedWorkspace>;
23
+ observe: (context: import("./herdr/agents.js").HerdrExecutionContext, binding: import("./herdr/agents.js").HerdrTaskBinding, operation: import("../../api/operation.js").Operation) => Promise<import("./herdr/agents.js").HerdrAgentObservation>;
24
+ start: (context: import("./herdr/agents.js").HerdrExecutionContext, binding: import("./herdr/agents.js").HerdrTaskBinding, input: {
25
+ configuration: import("./herdr/arguments.js").HerdrAgentConfiguration;
26
+ prompt: string;
27
+ resumeSessionId?: string;
28
+ initialPromptNotSubmitted?: true;
29
+ launchEvidence?: import("./herdr/agents.js").HerdrLaunchEvidence;
30
+ workspaceEvidence?: import("./herdr/agents.js").HerdrWorkspaceEvidence | null;
31
+ }, operation: import("../../api/operation.js").Operation) => Promise<{
32
+ kind: "rebind-required";
33
+ reason: "retained-native-reference" | "unverified-launch" | "unverified-workspace-environment";
34
+ observation: import("./herdr/agents.js").HerdrAgentObservation;
35
+ promptSubmission: "not-submitted";
36
+ launchEvidence: null;
37
+ } | {
38
+ kind: "reconnected";
39
+ observation: import("./herdr/agents.js").HerdrAgentObservation;
40
+ promptSubmission: "not-submitted";
41
+ launchEvidence: null;
42
+ } | {
43
+ kind: "waiting";
44
+ observation: import("./herdr/agents.js").HerdrAgentObservation;
45
+ promptSubmission: "not-submitted";
46
+ launchEvidence: import("./herdr/agents.js").HerdrLaunchEvidence | null;
47
+ } | {
48
+ kind: "started";
49
+ observation: import("./herdr/agents.js").HerdrAgentObservation;
50
+ promptSubmission: "submitted";
51
+ launchEvidence: import("./herdr/agents.js").HerdrLaunchEvidence | null;
52
+ } | {
53
+ kind: "waiting";
54
+ observation: import("./herdr/agents.js").HerdrAgentObservation;
55
+ promptSubmission: "submitted";
56
+ launchEvidence: import("./herdr/agents.js").HerdrLaunchEvidence | null;
57
+ }>;
58
+ submitPrompt: (context: import("./herdr/agents.js").HerdrExecutionContext, binding: import("./herdr/agents.js").HerdrTaskBinding, prompt: string, operation: import("../../api/operation.js").Operation) => Promise<{
59
+ submission: "submitted";
60
+ observation: import("./herdr/agents.js").HerdrAgentObservation;
61
+ }>;
62
+ captureStop: (context: import("./herdr/agents.js").HerdrExecutionContext, binding: import("./herdr/agents.js").HerdrTaskBinding, operation: import("../../api/operation.js").Operation) => Promise<import("./herdr/agents.js").HerdrStopObservation>;
63
+ requestGracefulStop: (context: import("./herdr/agents.js").HerdrExecutionContext, binding: import("./herdr/agents.js").HerdrTaskBinding, operation: import("../../api/operation.js").Operation) => Promise<{
64
+ submission: "submitted";
65
+ observation: import("./herdr/agents.js").HerdrAgentObservation;
66
+ }>;
67
+ confirmEmptyPane: (context: import("./herdr/agents.js").HerdrExecutionContext, binding: import("./herdr/agents.js").HerdrTaskBinding, operation: import("../../api/operation.js").Operation) => Promise<{
68
+ noNativeProcess: true;
69
+ }>;
70
+ confirmStopped: (context: import("./herdr/agents.js").HerdrExecutionContext, binding: import("./herdr/agents.js").HerdrTaskBinding, evidence: import("./herdr/agents.js").HerdrStopObservation, operation: import("../../api/operation.js").Operation) => Promise<{
71
+ agentStopped: true;
72
+ }>;
73
+ confirmMissingWorkspaceStopped: (context: import("./herdr/agents.js").HerdrExecutionContext, originalBinding: import("./herdr/agents.js").HerdrTaskBinding, evidence: import("./herdr/agents.js").HerdrStopObservation, operation: import("../../api/operation.js").Operation) => Promise<{
74
+ agentStopped: true;
75
+ }>;
76
+ confirmRestoredStop: (context: import("./herdr/agents.js").HerdrExecutionContext, originalBinding: import("./herdr/agents.js").HerdrTaskBinding, restoredBinding: import("./herdr/agents.js").HerdrTaskBinding, evidence: import("./herdr/agents.js").HerdrStopObservation, operation: import("../../api/operation.js").Operation) => Promise<{
77
+ agentStopped: true;
78
+ binding: import("./herdr/agents.js").HerdrTaskBinding;
79
+ }>;
80
+ confirmReplacedStop: (context: import("./herdr/agents.js").HerdrExecutionContext, originalBinding: import("./herdr/agents.js").HerdrTaskBinding, replacementBinding: import("./herdr/agents.js").HerdrTaskBinding, evidence: import("./herdr/agents.js").HerdrStopObservation, operation: import("../../api/operation.js").Operation) => Promise<{
81
+ agentStopped: true;
82
+ binding: import("./herdr/agents.js").HerdrTaskBinding;
83
+ }>;
84
+ forceStop: (context: import("./herdr/agents.js").HerdrExecutionContext, binding: import("./herdr/agents.js").HerdrTaskBinding, evidence: import("./herdr/agents.js").HerdrStopObservation, operation: import("../../api/operation.js").Operation) => Promise<{
85
+ agentStopped: true;
86
+ originalPaneClosed: true;
87
+ }>;
88
+ closeWorkspace: (context: import("./herdr/agents.js").HerdrExecutionContext, binding: import("./herdr/agents.js").HerdrTaskBinding, proof: {
89
+ agentStopped: true;
90
+ }, operation: import("../../api/operation.js").Operation) => Promise<{
91
+ workspaceClosed: true;
92
+ }>;
93
+ };
94
+ };
95
+ export type WorkerHerdrAdapter = ReturnType<typeof createWorkerHerdr>;
@@ -0,0 +1,35 @@
1
+ import { createHerdrAgentManager } from "./herdr/agents.js";
2
+ import { createHerdrInstance } from "./herdr/instance.js";
3
+ import { createHerdrPreflight } from "./herdr/preflight.js";
4
+ export { HerdrAgentActionError, validateHerdrAgentArguments } from "./herdr/agents.js";
5
+ export { HerdrRpcError } from "./herdr/rpc.js";
6
+ export const createWorkerHerdr = (options) => {
7
+ const inheritedEnvironment = options.environment === undefined ? process.env : options.environment;
8
+ const instance = createHerdrInstance({ ...options, environment: inheritedEnvironment });
9
+ const nativeEnvironment = { ...instance.environment };
10
+ const workspaceEnvironment = { XDG_CONFIG_HOME: "", XDG_STATE_HOME: "" };
11
+ for (const key of ["XDG_CONFIG_HOME", "XDG_STATE_HOME"]) {
12
+ const value = inheritedEnvironment[key];
13
+ if (value === undefined)
14
+ delete nativeEnvironment[key];
15
+ else
16
+ nativeEnvironment[key] = value;
17
+ // Herdr's workspace map cannot remove keys; empty XDG values select the user's defaults.
18
+ // https://specifications.freedesktop.org/basedir/latest/
19
+ workspaceEnvironment[key] = value === undefined ? "" : value;
20
+ }
21
+ const preflight = createHerdrPreflight({
22
+ rpc: instance.rpc,
23
+ environment: nativeEnvironment,
24
+ homeDirectory: options.homeDirectory,
25
+ });
26
+ const tasks = createHerdrAgentManager({ rpc: instance.rpc, session: "w", preflight, workspaceEnvironment });
27
+ return {
28
+ ensureInstance: instance.ensure,
29
+ stopInstance: instance.stop,
30
+ attachment: instance.attachment,
31
+ paths: instance.paths,
32
+ tasks,
33
+ };
34
+ };
35
+ //# sourceMappingURL=herdr.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"herdr.js","sourceRoot":"","sources":["../../../src/commands/worker/herdr.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAe5D,OAAO,EAAE,qBAAqB,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AACvF,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,OAKjC,EAAE,EAAE;IACH,MAAM,oBAAoB,GAAG,OAAO,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC;IACnG,MAAM,QAAQ,GAAG,mBAAmB,CAAC,EAAE,GAAG,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,CAAC,CAAC;IACxF,MAAM,iBAAiB,GAAG,EAAE,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;IACtD,MAAM,oBAAoB,GAAG,EAAE,eAAe,EAAE,EAAE,EAAE,cAAc,EAAE,EAAE,EAAE,CAAC;IACzE,KAAK,MAAM,GAAG,IAAI,CAAC,iBAAiB,EAAE,gBAAgB,CAAU,EAAE,CAAC;QACjE,MAAM,KAAK,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAC;QACxC,IAAI,KAAK,KAAK,SAAS;YAAE,OAAO,iBAAiB,CAAC,GAAG,CAAC,CAAC;;YAClD,iBAAiB,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACpC,yFAAyF;QACzF,yDAAyD;QACzD,oBAAoB,CAAC,GAAG,CAAC,GAAG,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;IAC/D,CAAC;IACD,MAAM,SAAS,GAAG,oBAAoB,CAAC;QACrC,GAAG,EAAE,QAAQ,CAAC,GAAG;QACjB,WAAW,EAAE,iBAAiB;QAC9B,aAAa,EAAE,OAAO,CAAC,aAAa;KACrC,CAAC,CAAC;IACH,MAAM,KAAK,GAAG,uBAAuB,CAAC,EAAE,GAAG,EAAE,QAAQ,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,oBAAoB,EAAE,CAAC,CAAC;IAC5G,OAAO;QACL,cAAc,EAAE,QAAQ,CAAC,MAAM;QAC/B,YAAY,EAAE,QAAQ,CAAC,IAAI;QAC3B,UAAU,EAAE,QAAQ,CAAC,UAAU;QAC/B,KAAK,EAAE,QAAQ,CAAC,KAAK;QACrB,KAAK;KACN,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { CliContext } from "../../cli/context.js";
2
+ export type WorkerCommandDependencies = {
3
+ run: (options: {
4
+ homeDirectory: string;
5
+ packageDirectory: string;
6
+ log?: (message: string) => void;
7
+ signal?: AbortSignal;
8
+ }) => Promise<void>;
9
+ };
10
+ export declare const runWorkerCommand: (args: readonly string[], context: CliContext, dependencies?: WorkerCommandDependencies) => Promise<void>;
@@ -0,0 +1,14 @@
1
+ import { parseCommand, renderCommandHelp } from "../../cli/schema.js";
2
+ import { workerDefinition } from "./definition.js";
3
+ const defaultDependencies = {
4
+ run: async (options) => (await import("./runtime.js")).runWorker(options),
5
+ };
6
+ export const runWorkerCommand = async (args, context, dependencies = defaultDependencies) => {
7
+ const command = parseCommand(workerDefinition, args, ["daynight", "worker"], "daynight worker --help");
8
+ if (command.kind !== "run") {
9
+ context.stdout(renderCommandHelp(command.command, command.path));
10
+ return;
11
+ }
12
+ await dependencies.run({ homeDirectory: context.homeDirectory(), packageDirectory: context.packageDirectory, log: (message) => { context.stderr(message); } });
13
+ };
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/worker/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAMnD,MAAM,mBAAmB,GAA8B;IACrD,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC,MAAM,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC;CAC1E,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,EAAE,IAAuB,EAAE,OAAmB,EAAE,YAAY,GAA8B,mBAAmB,EAAiB,EAAE;IACnK,MAAM,OAAO,GAAG,YAAY,CAAC,gBAAgB,EAAE,IAAI,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC,EAAE,wBAAwB,CAAC,CAAC;IACvG,IAAI,OAAO,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;QAC3B,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QACjE,OAAO;IACT,CAAC;IACD,MAAM,YAAY,CAAC,GAAG,CAAC,EAAE,aAAa,EAAE,OAAO,CAAC,aAAa,EAAE,EAAE,gBAAgB,EAAE,OAAO,CAAC,gBAAgB,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AACjK,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { TaskPlatform } from "../../api/types.js";
2
+ import type { LocalTask } from "./types.js";
3
+ export declare const createWorkerPromptBuilder: (packageDirectory: string) => Promise<(task: LocalTask, platform: TaskPlatform) => string>;
4
+ export declare const workerCleanupPrompt: (task: LocalTask) => string;
@@ -0,0 +1,64 @@
1
+ import path from "node:path";
2
+ import { canonicalId } from "../../api/parse.js";
3
+ import { normalizeServerUrl } from "../../config/server.js";
4
+ import { captureInstalledSkill } from "../skill/install.js";
5
+ import { validateHerdrAgentArguments } from "./herdr/arguments.js";
6
+ export const createWorkerPromptBuilder = async (packageDirectory) => {
7
+ const bundle = await captureInstalledSkill(packageDirectory);
8
+ for (const name of ["SKILL.md", "references/execute-task-in-managed.md", "references/task-execution.md", "references/handbook.md", "references/goal.md", "references/task-content.md"]) {
9
+ const entry = bundle.find((item) => item.relativePath === name);
10
+ if (entry?.type !== "file" || entry.contents.length === 0)
11
+ throw new Error(`The installed using-daynight bundle is missing ${name}; reinstall the package before starting a worker.`);
12
+ }
13
+ const root = path.join(packageDirectory, "dist", "commands", "skill", "skills", "using-daynight");
14
+ return (task, platform) => {
15
+ if (task.status !== "active" || task.cleanup !== null || task.control !== null)
16
+ throw new Error("A managed launch requires an active execution without cleanup or management intent.");
17
+ for (const [name, value] of Object.entries({ projectId: task.projectId, taskId: task.taskId, claimId: task.claimId, workerId: task.workerId, worktreeId: task.worktreeId })) {
18
+ if (canonicalId(value) !== value)
19
+ throw new Error(`Managed assignment ${name} must be a canonical UUID.`);
20
+ }
21
+ if (!["linux", "macos", "windows"].includes(platform))
22
+ throw new Error("Managed execution requires a supported actual platform.");
23
+ const configuration = task.configuration;
24
+ const worktree = task.resources.worktree;
25
+ if (configuration === null || worktree === null)
26
+ throw new Error("Managed execution requires the original frozen configuration and worktree binding.");
27
+ if (!path.isAbsolute(task.repositoryPath) || worktree.repositoryPath !== task.repositoryPath || worktree.worktreePath !== path.join(task.repositoryPath, ".worktrees", "daynight", task.taskId) || worktree.branch !== `daynight/${task.taskId}`)
28
+ throw new Error("The managed assignment does not match its original fixed worktree and branch.");
29
+ validateHerdrAgentArguments(configuration.agent, configuration.args);
30
+ if ((configuration.model !== null && (typeof configuration.model !== "string" || configuration.model.trim() === "")) || !Number.isSafeInteger(configuration.recoveryLimit) || configuration.recoveryLimit < 0)
31
+ throw new Error("The managed assignment has an invalid frozen execution configuration.");
32
+ const native = task.resources.nativeSession;
33
+ if (native !== null && canonicalId(native.sessionId) !== native.sessionId)
34
+ throw new Error("The original native reference must be an exact session UUID.");
35
+ const assignment = {
36
+ serverOrigin: normalizeServerUrl(task.serverOrigin),
37
+ projectId: task.projectId, taskId: task.taskId, claimId: task.claimId,
38
+ workerId: task.workerId, worktreeId: task.worktreeId,
39
+ worktreePath: worktree.worktreePath, branch: worktree.branch,
40
+ platform, nativeSession: native, configuration,
41
+ };
42
+ return [
43
+ "The current execution environment is worker-managed.",
44
+ "Use the using-daynight skill in execute-task-in-managed mode for this already-claimed assignment.",
45
+ `Read the installed skill entry at ${JSON.stringify(path.join(root, "SKILL.md"))} and its references/execute-task-in-managed.md at ${JSON.stringify(path.join(root, "references", "execute-task-in-managed.md"))}. Resolve its other references from that same bundle.`,
46
+ "Verify the current service task, original claim, actual worktree and frozen configuration before business writes. Missing or mismatched context means wait for intervention.",
47
+ "Execute only this assignment under its task and repository authorization. Preserve the controller-owned worktree and workspace. The controller owns scheduling and cleanup.",
48
+ "After all required delivery, acceptance and evidence, complete the task with the original claimId and the version observed for that decision as the final task mutation. Unconfirmed writes require observation before any further decision.",
49
+ native === null ? "This is the initial native conversation for this execution." : "Continue this same execution using its original native conversation, worktree and frozen configuration. Reconcile interrupted work before proceeding.",
50
+ "Assignment:",
51
+ JSON.stringify(assignment, null, 2),
52
+ ].join("\n\n");
53
+ };
54
+ };
55
+ export const workerCleanupPrompt = (task) => {
56
+ if (task.cleanup === null)
57
+ throw new Error("A cleanup request requires its persisted original deadline.");
58
+ return [
59
+ `The controller is stopping this execution: project ${task.projectId}, task ${task.taskId}, original claim ${task.claimId}.`,
60
+ `Release temporary files, services and processes outside the worktree that this execution created and can attribute to itself. The original deadline is ${new Date(task.cleanup.deadline).toISOString()}.`,
61
+ "Preserve the controller-managed worktree, branch and workspace. Leave other executions and unrelated resources intact. Finish this cleanup turn when attributable temporary resources have been released; the controller will stop this original agent.",
62
+ ].join("\n\n");
63
+ };
64
+ //# sourceMappingURL=prompts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../../src/commands/worker/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AAGnE,MAAM,CAAC,MAAM,yBAAyB,GAAG,KAAK,EAAE,gBAAwB,EAAE,EAAE;IAC1E,MAAM,MAAM,GAAG,MAAM,qBAAqB,CAAC,gBAAgB,CAAC,CAAC;IAC7D,KAAK,MAAM,IAAI,IAAI,CAAC,UAAU,EAAE,uCAAuC,EAAE,8BAA8B,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,4BAA4B,CAAC,EAAE,CAAC;QACvL,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,KAAK,IAAI,CAAC,CAAC;QAChE,IAAI,KAAK,EAAE,IAAI,KAAK,MAAM,IAAI,KAAK,CAAC,QAAQ,C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YAAY,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM;YAC5D,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,aAAa;SAC/C,CAAC;QACF,OAAO;YACL,sDAAsD;YACtD,mGAAmG;YACnG,qCAAqC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,qDAAqD,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,EAAE,4BAA4B,CAAC,CAAC,uDAAuD;YACvQ,8KAA8K;YAC9K,6KAA6K;YAC7K,8OAA8O;YAC9O,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,6DAA6D,CAAC,CAAC,CAAC,uJAAuJ;YACzO,aAAa;YACb,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;SACpC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACjB,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,IAAe,EAAU,EAAE;IAC7D,IAAI,IAAI,CAAC,OAAO,KAAK,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;IAC1G,OAAO;QACL,sDAAsD,IAAI,CAAC,SAAS,UAAU,IAAI,CAAC,MAAM,oBAAoB,IAAI,CAAC,OAAO,GAAG;QAC5H,0JAA0J,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,GAAG;QAC1M,yPAAyP;KAC1P,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACjB,CAAC,CAAC"}
@@ -0,0 +1,18 @@
1
+ import type { Project, Task, TaskPlatform, UpdateWorkerClaimInput, WorkerClaimDescriptor } from "../../api/types.js";
2
+ import type { ProjectIdentity } from "./types.js";
3
+ export type WorkerRemote = {
4
+ readonly serverOrigin: string;
5
+ currentUserId(signal: AbortSignal): Promise<string>;
6
+ resolveProject(repository: {
7
+ readonly repoUrl: string;
8
+ readonly projectId?: string;
9
+ }, signal: AbortSignal): Promise<Project>;
10
+ ownInventory(projects: readonly ProjectIdentity[], workerId: string, signal: AbortSignal): Promise<readonly Task[]>;
11
+ candidates(projectId: string, platform: TaskPlatform, signal: AbortSignal): AsyncGenerator<Task>;
12
+ claim(candidate: Task, descriptor: WorkerClaimDescriptor, signal: AbortSignal): Promise<Task>;
13
+ update(task: Task, input: Omit<UpdateWorkerClaimInput, "version" | "claimId">, signal: AbortSignal): Promise<Task>;
14
+ };
15
+ export declare const createWorkerRemote: (options: {
16
+ readonly serverUrl: string;
17
+ readonly serverToken?: string;
18
+ }) => WorkerRemote;