@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
@@ -20,22 +20,11 @@ export type HerdrTaskBinding = {
20
20
  paneId: string;
21
21
  terminalId: string;
22
22
  };
23
- export type HerdrWorkspaceEvidence = {
23
+ export type HerdrPendingStop = {
24
+ context: HerdrExecutionOwner & {
25
+ cwd: string;
26
+ };
24
27
  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
28
  };
40
29
  export type HerdrNativeReference = {
41
30
  source: string;
@@ -53,16 +42,6 @@ export type HerdrAgentObservation = {
53
42
  stateChangeSeq: number | null;
54
43
  completionSeq: number | null;
55
44
  };
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
45
  export type HerdrOwnedWorkspace = {
67
46
  owner: HerdrExecutionOwner;
68
47
  workspaceId: string;
@@ -89,17 +68,15 @@ export type HerdrWorkspaceEnvironment = Readonly<{
89
68
  XDG_CONFIG_HOME: string;
90
69
  XDG_STATE_HOME: string;
91
70
  }>;
92
- export declare const herdrExecutionLabel: (context: HerdrExecutionContext) => string;
93
- export declare const herdrExecutionAgentName: (context: HerdrExecutionContext) => string;
71
+ export declare const herdrExecutionLabel: (context: HerdrExecutionOwner) => string;
72
+ export declare const herdrExecutionAgentName: (context: HerdrExecutionOwner) => string;
94
73
  export declare const parseHerdrExecutionLabel: (label: string) => HerdrExecutionOwner | null;
95
74
  export declare class HerdrAgentActionError extends Error {
96
75
  readonly action: string;
97
76
  readonly submission: "not-submitted" | "rejected" | "unknown";
98
77
  readonly promptSubmission: "not-submitted" | "submitted" | "unknown" | null;
99
- readonly launchEvidence: HerdrLaunchEvidence | null;
100
78
  constructor(message: string, action: string, submission: "not-submitted" | "rejected" | "unknown", options?: ErrorOptions & {
101
79
  promptSubmission?: "not-submitted" | "submitted" | "unknown";
102
- launchEvidence?: HerdrLaunchEvidence;
103
80
  });
104
81
  }
105
82
  export declare const createHerdrAgentManager: (options: {
@@ -110,77 +87,21 @@ export declare const createHerdrAgentManager: (options: {
110
87
  processExecuting?: (pid: number) => Promise<boolean>;
111
88
  pollIntervalMs?: number;
112
89
  }) => {
90
+ pendingStops: () => readonly HerdrPendingStop[];
113
91
  listResources: (operation: Operation) => Promise<HerdrOwnedWorkspace[]>;
114
- prepareWorkspace: (context: HerdrExecutionContext, operation: Operation) => Promise<HerdrPreparedWorkspace>;
92
+ prepareWorkspace: (context: HerdrExecutionContext, operation: Operation) => Promise<HerdrTaskBinding>;
115
93
  observe: (context: HerdrExecutionContext, binding: HerdrTaskBinding, operation: Operation) => Promise<HerdrAgentObservation>;
116
94
  start: (context: HerdrExecutionContext, binding: HerdrTaskBinding, input: {
117
95
  configuration: HerdrAgentConfiguration;
118
96
  prompt: string;
119
97
  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
- }>;
98
+ }, operation: Operation) => Promise<HerdrAgentObservation>;
150
99
  submitPrompt: (context: HerdrExecutionContext, binding: HerdrTaskBinding, prompt: string, operation: Operation) => Promise<{
151
100
  submission: "submitted";
152
101
  observation: HerdrAgentObservation;
153
102
  }>;
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
- }>;
103
+ stopAndClose: (context: HerdrExecutionOwner & {
104
+ cwd: string;
105
+ }, binding: HerdrTaskBinding, operation: Operation) => Promise<void>;
185
106
  };
186
107
  export type HerdrAgentManager = ReturnType<typeof createHerdrAgentManager>;