@codetreker/daynight 0.21.9 → 0.21.13

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 (85) hide show
  1. package/README.md +359 -27
  2. package/dist/api/client.d.ts +4 -1
  3. package/dist/api/client.js +18 -1
  4. package/dist/api/client.js.map +1 -1
  5. package/dist/api/parse.d.ts +3 -1
  6. package/dist/api/parse.js +27 -0
  7. package/dist/api/parse.js.map +1 -1
  8. package/dist/api/types.d.ts +18 -3
  9. package/dist/cli/commands.js +2 -0
  10. package/dist/cli/commands.js.map +1 -1
  11. package/dist/commands/skill/skills/using-daynight/references/handoff.md +3 -3
  12. package/dist/commands/worker/cleanup.d.ts +6 -0
  13. package/dist/commands/worker/cleanup.js +173 -0
  14. package/dist/commands/worker/cleanup.js.map +1 -0
  15. package/dist/commands/worker/config.d.ts +21 -0
  16. package/dist/commands/worker/config.js +144 -0
  17. package/dist/commands/worker/config.js.map +1 -0
  18. package/dist/commands/worker/control.d.ts +55 -0
  19. package/dist/commands/worker/control.js +151 -0
  20. package/dist/commands/worker/control.js.map +1 -0
  21. package/dist/commands/worker/coordinator.d.ts +35 -0
  22. package/dist/commands/worker/coordinator.js +548 -0
  23. package/dist/commands/worker/coordinator.js.map +1 -0
  24. package/dist/commands/worker/definition.d.ts +2 -0
  25. package/dist/commands/worker/definition.js +50 -0
  26. package/dist/commands/worker/definition.js.map +1 -0
  27. package/dist/commands/worker/diagnostics.d.ts +20 -0
  28. package/dist/commands/worker/diagnostics.js +56 -0
  29. package/dist/commands/worker/diagnostics.js.map +1 -0
  30. package/dist/commands/worker/execution.d.ts +41 -0
  31. package/dist/commands/worker/execution.js +318 -0
  32. package/dist/commands/worker/execution.js.map +1 -0
  33. package/dist/commands/worker/herdr/agents.d.ts +186 -0
  34. package/dist/commands/worker/herdr/agents.js +726 -0
  35. package/dist/commands/worker/herdr/agents.js.map +1 -0
  36. package/dist/commands/worker/herdr/arguments.d.ts +8 -0
  37. package/dist/commands/worker/herdr/arguments.js +58 -0
  38. package/dist/commands/worker/herdr/arguments.js.map +1 -0
  39. package/dist/commands/worker/herdr/codex-input.d.ts +2 -0
  40. package/dist/commands/worker/herdr/codex-input.js +35 -0
  41. package/dist/commands/worker/herdr/codex-input.js.map +1 -0
  42. package/dist/commands/worker/herdr/command.d.ts +22 -0
  43. package/dist/commands/worker/herdr/command.js +115 -0
  44. package/dist/commands/worker/herdr/command.js.map +1 -0
  45. package/dist/commands/worker/herdr/instance.d.ts +56 -0
  46. package/dist/commands/worker/herdr/instance.js +322 -0
  47. package/dist/commands/worker/herdr/instance.js.map +1 -0
  48. package/dist/commands/worker/herdr/preflight.d.ts +40 -0
  49. package/dist/commands/worker/herdr/preflight.js +251 -0
  50. package/dist/commands/worker/herdr/preflight.js.map +1 -0
  51. package/dist/commands/worker/herdr/rpc.d.ts +29 -0
  52. package/dist/commands/worker/herdr/rpc.js +186 -0
  53. package/dist/commands/worker/herdr/rpc.js.map +1 -0
  54. package/dist/commands/worker/herdr.d.ts +95 -0
  55. package/dist/commands/worker/herdr.js +35 -0
  56. package/dist/commands/worker/herdr.js.map +1 -0
  57. package/dist/commands/worker/index.d.ts +18 -0
  58. package/dist/commands/worker/index.js +58 -0
  59. package/dist/commands/worker/index.js.map +1 -0
  60. package/dist/commands/worker/instance-lock.d.ts +5 -0
  61. package/dist/commands/worker/instance-lock.js +11 -1
  62. package/dist/commands/worker/instance-lock.js.map +1 -1
  63. package/dist/commands/worker/prompts.d.ts +4 -0
  64. package/dist/commands/worker/prompts.js +64 -0
  65. package/dist/commands/worker/prompts.js.map +1 -0
  66. package/dist/commands/worker/remote.d.ts +23 -0
  67. package/dist/commands/worker/remote.js +146 -0
  68. package/dist/commands/worker/remote.js.map +1 -0
  69. package/dist/commands/worker/runtime.d.ts +16 -0
  70. package/dist/commands/worker/runtime.js +384 -0
  71. package/dist/commands/worker/runtime.js.map +1 -0
  72. package/dist/commands/worker/store.d.ts +73 -5
  73. package/dist/commands/worker/store.js +475 -36
  74. package/dist/commands/worker/store.js.map +1 -1
  75. package/dist/commands/worker/types.d.ts +37 -1
  76. package/dist/commands/worker/worktrees.d.ts +1 -0
  77. package/dist/commands/worker/worktrees.js +9 -0
  78. package/dist/commands/worker/worktrees.js.map +1 -1
  79. package/dist/config/document.d.ts +1 -1
  80. package/dist/config/document.js +1 -0
  81. package/dist/config/document.js.map +1 -1
  82. package/dist/platform/instance-lock.d.ts +4 -0
  83. package/dist/platform/instance-lock.js +9 -1
  84. package/dist/platform/instance-lock.js.map +1 -1
  85. package/package.json +2 -2
@@ -0,0 +1,186 @@
1
+ import type { Operation } from "../../../api/operation.js";
2
+ import type { WorkerAgent } from "../../../api/types.js";
3
+ import type { HerdrAgentConfiguration } from "./arguments.js";
4
+ import type { HerdrRpcClient } from "./rpc.js";
5
+ export type { HerdrAgentConfiguration } from "./arguments.js";
6
+ export { buildHerdrAgentArguments, validateHerdrAgentArguments } from "./arguments.js";
7
+ export type HerdrExecutionContext = {
8
+ serverOrigin: string;
9
+ projectId: string;
10
+ taskId: string;
11
+ claimId: string;
12
+ worktreeId: string;
13
+ cwd: string;
14
+ agent: WorkerAgent;
15
+ };
16
+ export type HerdrExecutionOwner = Pick<HerdrExecutionContext, "serverOrigin" | "projectId" | "taskId" | "claimId" | "worktreeId">;
17
+ export type HerdrTaskBinding = {
18
+ session: string;
19
+ workspaceId: string;
20
+ paneId: string;
21
+ terminalId: string;
22
+ };
23
+ export type HerdrWorkspaceEvidence = {
24
+ binding: HerdrTaskBinding;
25
+ ownerLabel: string;
26
+ environment: HerdrWorkspaceEnvironment;
27
+ };
28
+ export type HerdrPreparedWorkspace = {
29
+ binding: HerdrTaskBinding;
30
+ workspaceEvidence: HerdrWorkspaceEvidence | null;
31
+ };
32
+ export type HerdrLaunchEvidence = {
33
+ binding: HerdrTaskBinding;
34
+ ownerLabel: string;
35
+ agent: WorkerAgent;
36
+ argv: readonly string[];
37
+ referenceBaseline: "empty";
38
+ workspaceEvidence: HerdrWorkspaceEvidence;
39
+ };
40
+ export type HerdrNativeReference = {
41
+ source: string;
42
+ agent: WorkerAgent;
43
+ sessionId: string;
44
+ };
45
+ export type HerdrAgentObservation = {
46
+ binding: HerdrTaskBinding;
47
+ kind: string | null;
48
+ name: string | null;
49
+ status: string;
50
+ launchPending: boolean;
51
+ interactiveReady: boolean;
52
+ nativeSession: HerdrNativeReference | null;
53
+ stateChangeSeq: number | null;
54
+ completionSeq: number | null;
55
+ };
56
+ export type HerdrStopObservation = {
57
+ binding: HerdrTaskBinding;
58
+ ownerLabel: string;
59
+ agent: WorkerAgent;
60
+ nativeSessionId: string | null;
61
+ shellPid: number;
62
+ processIds: readonly number[];
63
+ nativeProcessIds: readonly number[] | null;
64
+ observedAt: number;
65
+ };
66
+ export type HerdrOwnedWorkspace = {
67
+ owner: HerdrExecutionOwner;
68
+ workspaceId: string;
69
+ panes: {
70
+ binding: HerdrTaskBinding;
71
+ cwd: string | null;
72
+ kind: WorkerAgent | null;
73
+ status: string;
74
+ launchPending: boolean;
75
+ interactiveReady: boolean;
76
+ nativeSession: HerdrNativeReference | null;
77
+ stateChangeSeq: number | null;
78
+ completionSeq: number | null;
79
+ }[];
80
+ };
81
+ export type HerdrAgentPreflight = {
82
+ verifyStart(input: {
83
+ context: HerdrExecutionContext;
84
+ configuration: HerdrAgentConfiguration;
85
+ resumeSessionId?: string;
86
+ }, operation: Operation): Promise<unknown>;
87
+ };
88
+ export type HerdrWorkspaceEnvironment = Readonly<{
89
+ XDG_CONFIG_HOME: string;
90
+ XDG_STATE_HOME: string;
91
+ }>;
92
+ export declare const herdrExecutionLabel: (context: HerdrExecutionContext) => string;
93
+ export declare const herdrExecutionAgentName: (context: HerdrExecutionContext) => string;
94
+ export declare const parseHerdrExecutionLabel: (label: string) => HerdrExecutionOwner | null;
95
+ export declare class HerdrAgentActionError extends Error {
96
+ readonly action: string;
97
+ readonly submission: "not-submitted" | "rejected" | "unknown";
98
+ readonly promptSubmission: "not-submitted" | "submitted" | "unknown" | null;
99
+ readonly launchEvidence: HerdrLaunchEvidence | null;
100
+ constructor(message: string, action: string, submission: "not-submitted" | "rejected" | "unknown", options?: ErrorOptions & {
101
+ promptSubmission?: "not-submitted" | "submitted" | "unknown";
102
+ launchEvidence?: HerdrLaunchEvidence;
103
+ });
104
+ }
105
+ export declare const createHerdrAgentManager: (options: {
106
+ rpc: HerdrRpcClient;
107
+ session: string;
108
+ preflight: HerdrAgentPreflight;
109
+ workspaceEnvironment: HerdrWorkspaceEnvironment;
110
+ processExecuting?: (pid: number) => Promise<boolean>;
111
+ pollIntervalMs?: number;
112
+ }) => {
113
+ listResources: (operation: Operation) => Promise<HerdrOwnedWorkspace[]>;
114
+ prepareWorkspace: (context: HerdrExecutionContext, operation: Operation) => Promise<HerdrPreparedWorkspace>;
115
+ observe: (context: HerdrExecutionContext, binding: HerdrTaskBinding, operation: Operation) => Promise<HerdrAgentObservation>;
116
+ start: (context: HerdrExecutionContext, binding: HerdrTaskBinding, input: {
117
+ configuration: HerdrAgentConfiguration;
118
+ prompt: string;
119
+ resumeSessionId?: string;
120
+ initialPromptNotSubmitted?: true;
121
+ launchEvidence?: HerdrLaunchEvidence;
122
+ workspaceEvidence?: HerdrWorkspaceEvidence | null;
123
+ }, operation: Operation) => Promise<{
124
+ kind: "rebind-required";
125
+ reason: "retained-native-reference" | "unverified-launch" | "unverified-workspace-environment";
126
+ observation: HerdrAgentObservation;
127
+ promptSubmission: "not-submitted";
128
+ launchEvidence: null;
129
+ } | {
130
+ kind: "reconnected";
131
+ observation: HerdrAgentObservation;
132
+ promptSubmission: "not-submitted";
133
+ launchEvidence: null;
134
+ } | {
135
+ kind: "waiting";
136
+ observation: HerdrAgentObservation;
137
+ promptSubmission: "not-submitted";
138
+ launchEvidence: HerdrLaunchEvidence | null;
139
+ } | {
140
+ kind: "started";
141
+ observation: HerdrAgentObservation;
142
+ promptSubmission: "submitted";
143
+ launchEvidence: HerdrLaunchEvidence | null;
144
+ } | {
145
+ kind: "waiting";
146
+ observation: HerdrAgentObservation;
147
+ promptSubmission: "submitted";
148
+ launchEvidence: HerdrLaunchEvidence | null;
149
+ }>;
150
+ submitPrompt: (context: HerdrExecutionContext, binding: HerdrTaskBinding, prompt: string, operation: Operation) => Promise<{
151
+ submission: "submitted";
152
+ observation: HerdrAgentObservation;
153
+ }>;
154
+ captureStop: (context: HerdrExecutionContext, binding: HerdrTaskBinding, operation: Operation) => Promise<HerdrStopObservation>;
155
+ requestGracefulStop: (context: HerdrExecutionContext, binding: HerdrTaskBinding, operation: Operation) => Promise<{
156
+ submission: "submitted";
157
+ observation: HerdrAgentObservation;
158
+ }>;
159
+ confirmEmptyPane: (context: HerdrExecutionContext, binding: HerdrTaskBinding, operation: Operation) => Promise<{
160
+ noNativeProcess: true;
161
+ }>;
162
+ confirmStopped: (context: HerdrExecutionContext, binding: HerdrTaskBinding, evidence: HerdrStopObservation, operation: Operation) => Promise<{
163
+ agentStopped: true;
164
+ }>;
165
+ confirmMissingWorkspaceStopped: (context: HerdrExecutionContext, originalBinding: HerdrTaskBinding, evidence: HerdrStopObservation, operation: Operation) => Promise<{
166
+ agentStopped: true;
167
+ }>;
168
+ confirmRestoredStop: (context: HerdrExecutionContext, originalBinding: HerdrTaskBinding, restoredBinding: HerdrTaskBinding, evidence: HerdrStopObservation, operation: Operation) => Promise<{
169
+ agentStopped: true;
170
+ binding: HerdrTaskBinding;
171
+ }>;
172
+ confirmReplacedStop: (context: HerdrExecutionContext, originalBinding: HerdrTaskBinding, replacementBinding: HerdrTaskBinding, evidence: HerdrStopObservation, operation: Operation) => Promise<{
173
+ agentStopped: true;
174
+ binding: HerdrTaskBinding;
175
+ }>;
176
+ forceStop: (context: HerdrExecutionContext, binding: HerdrTaskBinding, evidence: HerdrStopObservation, operation: Operation) => Promise<{
177
+ agentStopped: true;
178
+ originalPaneClosed: true;
179
+ }>;
180
+ closeWorkspace: (context: HerdrExecutionContext, binding: HerdrTaskBinding, proof: {
181
+ agentStopped: true;
182
+ }, operation: Operation) => Promise<{
183
+ workspaceClosed: true;
184
+ }>;
185
+ };
186
+ export type HerdrAgentManager = ReturnType<typeof createHerdrAgentManager>;