agent-lyceum 0.4.9

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 (56) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +132 -0
  3. package/README.zh-TW.md +133 -0
  4. package/dist/adapters/claude.d.ts +14 -0
  5. package/dist/adapters/claude.js +155 -0
  6. package/dist/adapters/codex.d.ts +5 -0
  7. package/dist/adapters/codex.js +109 -0
  8. package/dist/adapters/index.d.ts +6 -0
  9. package/dist/adapters/index.js +20 -0
  10. package/dist/adapters/types.d.ts +61 -0
  11. package/dist/adapters/types.js +1 -0
  12. package/dist/cli.d.ts +2 -0
  13. package/dist/cli.js +471 -0
  14. package/dist/config.d.ts +115 -0
  15. package/dist/config.js +253 -0
  16. package/dist/dispatcher.d.ts +37 -0
  17. package/dist/dispatcher.js +467 -0
  18. package/dist/doctor.d.ts +46 -0
  19. package/dist/doctor.js +151 -0
  20. package/dist/format.d.ts +33 -0
  21. package/dist/format.js +100 -0
  22. package/dist/fs-util.d.ts +2 -0
  23. package/dist/fs-util.js +9 -0
  24. package/dist/guard.d.ts +20 -0
  25. package/dist/guard.js +72 -0
  26. package/dist/mailbox.d.ts +97 -0
  27. package/dist/mailbox.js +259 -0
  28. package/dist/message-store.d.ts +91 -0
  29. package/dist/message-store.js +225 -0
  30. package/dist/paths.d.ts +30 -0
  31. package/dist/paths.js +62 -0
  32. package/dist/policy.d.ts +38 -0
  33. package/dist/policy.js +143 -0
  34. package/dist/process-runner.d.ts +21 -0
  35. package/dist/process-runner.js +165 -0
  36. package/dist/project-lock.d.ts +30 -0
  37. package/dist/project-lock.js +186 -0
  38. package/dist/prompt.d.ts +11 -0
  39. package/dist/prompt.js +125 -0
  40. package/dist/run-cleanup.d.ts +51 -0
  41. package/dist/run-cleanup.js +120 -0
  42. package/dist/run-store.d.ts +111 -0
  43. package/dist/run-store.js +119 -0
  44. package/dist/scaffold.d.ts +11 -0
  45. package/dist/scaffold.js +126 -0
  46. package/dist/schema.d.ts +303 -0
  47. package/dist/schema.js +84 -0
  48. package/dist/status.d.ts +142 -0
  49. package/dist/status.js +399 -0
  50. package/dist/task.d.ts +24 -0
  51. package/dist/task.js +71 -0
  52. package/dist/validate.d.ts +13 -0
  53. package/dist/validate.js +116 -0
  54. package/dist/worktree.d.ts +103 -0
  55. package/dist/worktree.js +395 -0
  56. package/package.json +58 -0
@@ -0,0 +1,303 @@
1
+ import { z } from "zod";
2
+ export declare const RUNTIMES: readonly ["claude-code", "codex"];
3
+ export type Runtime = (typeof RUNTIMES)[number];
4
+ /** Union of both runtimes' levels; `validate` rejects the ones a given runtime does not accept. */
5
+ export declare const EFFORTS: readonly ["minimal", "low", "medium", "high", "xhigh", "max"];
6
+ export type Effort = (typeof EFFORTS)[number];
7
+ /** Levels each runtime's CLI accepts (`claude --effort`, codex `model_reasoning_effort`). */
8
+ export declare const RUNTIME_EFFORTS: Record<Runtime, readonly Effort[]>;
9
+ /** Guess the runtime from a model name: Claude aliases/IDs -> claude-code, GPT/o-series/codex names -> codex. */
10
+ export declare function inferRuntime(model: string | undefined): Runtime | undefined;
11
+ export declare const AgentPartial: z.ZodObject<{
12
+ runtime: z.ZodOptional<z.ZodEnum<["claude-code", "codex"]>>;
13
+ model: z.ZodOptional<z.ZodString>;
14
+ effort: z.ZodOptional<z.ZodEnum<["minimal", "low", "medium", "high", "xhigh", "max"]>>;
15
+ agent_md: z.ZodOptional<z.ZodString>;
16
+ memory: z.ZodOptional<z.ZodObject<{
17
+ global: z.ZodOptional<z.ZodString>;
18
+ project: z.ZodOptional<z.ZodString>;
19
+ }, "strict", z.ZodTypeAny, {
20
+ global?: string | undefined;
21
+ project?: string | undefined;
22
+ }, {
23
+ global?: string | undefined;
24
+ project?: string | undefined;
25
+ }>>;
26
+ resume: z.ZodOptional<z.ZodBoolean>;
27
+ can_message: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"all">, z.ZodArray<z.ZodString, "many">]>>;
28
+ can_edit_agent_md: z.ZodOptional<z.ZodBoolean>;
29
+ owns: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
30
+ }, "strict", z.ZodTypeAny, {
31
+ runtime?: "claude-code" | "codex" | undefined;
32
+ model?: string | undefined;
33
+ effort?: "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | undefined;
34
+ agent_md?: string | undefined;
35
+ memory?: {
36
+ global?: string | undefined;
37
+ project?: string | undefined;
38
+ } | undefined;
39
+ resume?: boolean | undefined;
40
+ can_message?: string[] | "all" | undefined;
41
+ can_edit_agent_md?: boolean | undefined;
42
+ owns?: string[] | undefined;
43
+ }, {
44
+ runtime?: "claude-code" | "codex" | undefined;
45
+ model?: string | undefined;
46
+ effort?: "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | undefined;
47
+ agent_md?: string | undefined;
48
+ memory?: {
49
+ global?: string | undefined;
50
+ project?: string | undefined;
51
+ } | undefined;
52
+ resume?: boolean | undefined;
53
+ can_message?: string[] | "all" | undefined;
54
+ can_edit_agent_md?: boolean | undefined;
55
+ owns?: string[] | undefined;
56
+ }>;
57
+ export type AgentPartialT = z.infer<typeof AgentPartial>;
58
+ export declare const DispatcherPartial: z.ZodObject<{
59
+ max_rounds: z.ZodOptional<z.ZodNumber>;
60
+ max_parallel: z.ZodOptional<z.ZodNumber>;
61
+ wake_timeout_sec: z.ZodOptional<z.ZodNumber>;
62
+ retry: z.ZodOptional<z.ZodNumber>;
63
+ strict: z.ZodOptional<z.ZodBoolean>;
64
+ workspace_mode: z.ZodOptional<z.ZodEnum<["auto", "shared", "worktree"]>>;
65
+ }, "strict", z.ZodTypeAny, {
66
+ strict?: boolean | undefined;
67
+ max_rounds?: number | undefined;
68
+ max_parallel?: number | undefined;
69
+ wake_timeout_sec?: number | undefined;
70
+ retry?: number | undefined;
71
+ workspace_mode?: "shared" | "auto" | "worktree" | undefined;
72
+ }, {
73
+ strict?: boolean | undefined;
74
+ max_rounds?: number | undefined;
75
+ max_parallel?: number | undefined;
76
+ wake_timeout_sec?: number | undefined;
77
+ retry?: number | undefined;
78
+ workspace_mode?: "shared" | "auto" | "worktree" | undefined;
79
+ }>;
80
+ export declare const GlobalConfig: z.ZodObject<{
81
+ agents: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
82
+ runtime: z.ZodOptional<z.ZodEnum<["claude-code", "codex"]>>;
83
+ model: z.ZodOptional<z.ZodString>;
84
+ effort: z.ZodOptional<z.ZodEnum<["minimal", "low", "medium", "high", "xhigh", "max"]>>;
85
+ agent_md: z.ZodOptional<z.ZodString>;
86
+ memory: z.ZodOptional<z.ZodObject<{
87
+ global: z.ZodOptional<z.ZodString>;
88
+ project: z.ZodOptional<z.ZodString>;
89
+ }, "strict", z.ZodTypeAny, {
90
+ global?: string | undefined;
91
+ project?: string | undefined;
92
+ }, {
93
+ global?: string | undefined;
94
+ project?: string | undefined;
95
+ }>>;
96
+ resume: z.ZodOptional<z.ZodBoolean>;
97
+ can_message: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"all">, z.ZodArray<z.ZodString, "many">]>>;
98
+ can_edit_agent_md: z.ZodOptional<z.ZodBoolean>;
99
+ owns: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
100
+ }, "strict", z.ZodTypeAny, {
101
+ runtime?: "claude-code" | "codex" | undefined;
102
+ model?: string | undefined;
103
+ effort?: "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | undefined;
104
+ agent_md?: string | undefined;
105
+ memory?: {
106
+ global?: string | undefined;
107
+ project?: string | undefined;
108
+ } | undefined;
109
+ resume?: boolean | undefined;
110
+ can_message?: string[] | "all" | undefined;
111
+ can_edit_agent_md?: boolean | undefined;
112
+ owns?: string[] | undefined;
113
+ }, {
114
+ runtime?: "claude-code" | "codex" | undefined;
115
+ model?: string | undefined;
116
+ effort?: "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | undefined;
117
+ agent_md?: string | undefined;
118
+ memory?: {
119
+ global?: string | undefined;
120
+ project?: string | undefined;
121
+ } | undefined;
122
+ resume?: boolean | undefined;
123
+ can_message?: string[] | "all" | undefined;
124
+ can_edit_agent_md?: boolean | undefined;
125
+ owns?: string[] | undefined;
126
+ }>>>;
127
+ }, "strict", z.ZodTypeAny, {
128
+ agents: Record<string, {
129
+ runtime?: "claude-code" | "codex" | undefined;
130
+ model?: string | undefined;
131
+ effort?: "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | undefined;
132
+ agent_md?: string | undefined;
133
+ memory?: {
134
+ global?: string | undefined;
135
+ project?: string | undefined;
136
+ } | undefined;
137
+ resume?: boolean | undefined;
138
+ can_message?: string[] | "all" | undefined;
139
+ can_edit_agent_md?: boolean | undefined;
140
+ owns?: string[] | undefined;
141
+ }>;
142
+ }, {
143
+ agents?: Record<string, {
144
+ runtime?: "claude-code" | "codex" | undefined;
145
+ model?: string | undefined;
146
+ effort?: "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | undefined;
147
+ agent_md?: string | undefined;
148
+ memory?: {
149
+ global?: string | undefined;
150
+ project?: string | undefined;
151
+ } | undefined;
152
+ resume?: boolean | undefined;
153
+ can_message?: string[] | "all" | undefined;
154
+ can_edit_agent_md?: boolean | undefined;
155
+ owns?: string[] | undefined;
156
+ }> | undefined;
157
+ }>;
158
+ export declare const ProjectConfig: z.ZodObject<{
159
+ dir: z.ZodString;
160
+ team: z.ZodObject<{
161
+ lead: z.ZodString;
162
+ }, "strict", z.ZodTypeAny, {
163
+ lead: string;
164
+ }, {
165
+ lead: string;
166
+ }>;
167
+ dispatcher: z.ZodDefault<z.ZodObject<{
168
+ max_rounds: z.ZodOptional<z.ZodNumber>;
169
+ max_parallel: z.ZodOptional<z.ZodNumber>;
170
+ wake_timeout_sec: z.ZodOptional<z.ZodNumber>;
171
+ retry: z.ZodOptional<z.ZodNumber>;
172
+ strict: z.ZodOptional<z.ZodBoolean>;
173
+ workspace_mode: z.ZodOptional<z.ZodEnum<["auto", "shared", "worktree"]>>;
174
+ }, "strict", z.ZodTypeAny, {
175
+ strict?: boolean | undefined;
176
+ max_rounds?: number | undefined;
177
+ max_parallel?: number | undefined;
178
+ wake_timeout_sec?: number | undefined;
179
+ retry?: number | undefined;
180
+ workspace_mode?: "shared" | "auto" | "worktree" | undefined;
181
+ }, {
182
+ strict?: boolean | undefined;
183
+ max_rounds?: number | undefined;
184
+ max_parallel?: number | undefined;
185
+ wake_timeout_sec?: number | undefined;
186
+ retry?: number | undefined;
187
+ workspace_mode?: "shared" | "auto" | "worktree" | undefined;
188
+ }>>;
189
+ agents: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
190
+ runtime: z.ZodOptional<z.ZodEnum<["claude-code", "codex"]>>;
191
+ model: z.ZodOptional<z.ZodString>;
192
+ effort: z.ZodOptional<z.ZodEnum<["minimal", "low", "medium", "high", "xhigh", "max"]>>;
193
+ agent_md: z.ZodOptional<z.ZodString>;
194
+ memory: z.ZodOptional<z.ZodObject<{
195
+ global: z.ZodOptional<z.ZodString>;
196
+ project: z.ZodOptional<z.ZodString>;
197
+ }, "strict", z.ZodTypeAny, {
198
+ global?: string | undefined;
199
+ project?: string | undefined;
200
+ }, {
201
+ global?: string | undefined;
202
+ project?: string | undefined;
203
+ }>>;
204
+ resume: z.ZodOptional<z.ZodBoolean>;
205
+ can_message: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"all">, z.ZodArray<z.ZodString, "many">]>>;
206
+ can_edit_agent_md: z.ZodOptional<z.ZodBoolean>;
207
+ owns: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
208
+ }, "strict", z.ZodTypeAny, {
209
+ runtime?: "claude-code" | "codex" | undefined;
210
+ model?: string | undefined;
211
+ effort?: "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | undefined;
212
+ agent_md?: string | undefined;
213
+ memory?: {
214
+ global?: string | undefined;
215
+ project?: string | undefined;
216
+ } | undefined;
217
+ resume?: boolean | undefined;
218
+ can_message?: string[] | "all" | undefined;
219
+ can_edit_agent_md?: boolean | undefined;
220
+ owns?: string[] | undefined;
221
+ }, {
222
+ runtime?: "claude-code" | "codex" | undefined;
223
+ model?: string | undefined;
224
+ effort?: "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | undefined;
225
+ agent_md?: string | undefined;
226
+ memory?: {
227
+ global?: string | undefined;
228
+ project?: string | undefined;
229
+ } | undefined;
230
+ resume?: boolean | undefined;
231
+ can_message?: string[] | "all" | undefined;
232
+ can_edit_agent_md?: boolean | undefined;
233
+ owns?: string[] | undefined;
234
+ }>>>;
235
+ }, "strict", z.ZodTypeAny, {
236
+ agents: Record<string, {
237
+ runtime?: "claude-code" | "codex" | undefined;
238
+ model?: string | undefined;
239
+ effort?: "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | undefined;
240
+ agent_md?: string | undefined;
241
+ memory?: {
242
+ global?: string | undefined;
243
+ project?: string | undefined;
244
+ } | undefined;
245
+ resume?: boolean | undefined;
246
+ can_message?: string[] | "all" | undefined;
247
+ can_edit_agent_md?: boolean | undefined;
248
+ owns?: string[] | undefined;
249
+ }>;
250
+ dir: string;
251
+ team: {
252
+ lead: string;
253
+ };
254
+ dispatcher: {
255
+ strict?: boolean | undefined;
256
+ max_rounds?: number | undefined;
257
+ max_parallel?: number | undefined;
258
+ wake_timeout_sec?: number | undefined;
259
+ retry?: number | undefined;
260
+ workspace_mode?: "shared" | "auto" | "worktree" | undefined;
261
+ };
262
+ }, {
263
+ dir: string;
264
+ team: {
265
+ lead: string;
266
+ };
267
+ agents?: Record<string, {
268
+ runtime?: "claude-code" | "codex" | undefined;
269
+ model?: string | undefined;
270
+ effort?: "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | undefined;
271
+ agent_md?: string | undefined;
272
+ memory?: {
273
+ global?: string | undefined;
274
+ project?: string | undefined;
275
+ } | undefined;
276
+ resume?: boolean | undefined;
277
+ can_message?: string[] | "all" | undefined;
278
+ can_edit_agent_md?: boolean | undefined;
279
+ owns?: string[] | undefined;
280
+ }> | undefined;
281
+ dispatcher?: {
282
+ strict?: boolean | undefined;
283
+ max_rounds?: number | undefined;
284
+ max_parallel?: number | undefined;
285
+ wake_timeout_sec?: number | undefined;
286
+ retry?: number | undefined;
287
+ workspace_mode?: "shared" | "auto" | "worktree" | undefined;
288
+ } | undefined;
289
+ }>;
290
+ export interface DispatcherSettings {
291
+ max_rounds: number;
292
+ max_parallel: number;
293
+ wake_timeout_sec: number;
294
+ retry: number;
295
+ strict: boolean;
296
+ /** "auto": a git worktree per non-lead agent when agents can run in parallel, otherwise one shared checkout. */
297
+ workspace_mode: "auto" | "shared" | "worktree";
298
+ }
299
+ export declare const DISPATCHER_DEFAULTS: DispatcherSettings;
300
+ /** How a run turned out, independent of why it stopped (`EndReason`). Only "completed" means success. */
301
+ export declare const RUN_OUTCOMES: readonly ["completed", "partial", "blocked", "failed", "cancelled"];
302
+ export type RunOutcome = (typeof RUN_OUTCOMES)[number];
303
+ export declare function exitCodeForOutcome(outcome: RunOutcome): 0 | 1 | 2 | 130;
package/dist/schema.js ADDED
@@ -0,0 +1,84 @@
1
+ import { z } from "zod";
2
+ export const RUNTIMES = ["claude-code", "codex"];
3
+ /** Union of both runtimes' levels; `validate` rejects the ones a given runtime does not accept. */
4
+ export const EFFORTS = ["minimal", "low", "medium", "high", "xhigh", "max"];
5
+ /** Levels each runtime's CLI accepts (`claude --effort`, codex `model_reasoning_effort`). */
6
+ export const RUNTIME_EFFORTS = {
7
+ "claude-code": ["low", "medium", "high", "xhigh", "max"],
8
+ codex: ["minimal", "low", "medium", "high", "xhigh"],
9
+ };
10
+ /** Guess the runtime from a model name: Claude aliases/IDs -> claude-code, GPT/o-series/codex names -> codex. */
11
+ export function inferRuntime(model) {
12
+ if (!model)
13
+ return undefined;
14
+ const m = model.trim().toLowerCase();
15
+ if (/^(claude|anthropic|opus|sonnet|haiku|fable|best|default|opusplan)\b/.test(m) || m.includes("claude"))
16
+ return "claude-code";
17
+ if (/^(gpt|codex|o\d)/.test(m) || m.includes("codex"))
18
+ return "codex";
19
+ return undefined;
20
+ }
21
+ const Memory = z
22
+ .object({
23
+ global: z.string().optional(),
24
+ project: z.string().optional(),
25
+ })
26
+ .strict();
27
+ export const AgentPartial = z
28
+ .object({
29
+ runtime: z.enum(RUNTIMES).optional(),
30
+ model: z.string().optional(),
31
+ effort: z.enum(EFFORTS).optional(),
32
+ agent_md: z.string().optional(),
33
+ memory: Memory.optional(),
34
+ resume: z.boolean().optional(),
35
+ can_message: z.union([z.literal("all"), z.array(z.string())]).optional(),
36
+ can_edit_agent_md: z.boolean().optional(),
37
+ owns: z.array(z.string()).optional(),
38
+ })
39
+ .strict();
40
+ export const DispatcherPartial = z
41
+ .object({
42
+ max_rounds: z.number().int().positive().optional(),
43
+ max_parallel: z.number().int().positive().optional(),
44
+ wake_timeout_sec: z.number().int().positive().optional(),
45
+ retry: z.number().int().min(0).optional(),
46
+ strict: z.boolean().optional(),
47
+ workspace_mode: z.enum(["auto", "shared", "worktree"]).optional(),
48
+ })
49
+ .strict();
50
+ export const GlobalConfig = z
51
+ .object({
52
+ agents: z.record(AgentPartial).default({}),
53
+ })
54
+ .strict();
55
+ export const ProjectConfig = z
56
+ .object({
57
+ dir: z.string(),
58
+ team: z.object({ lead: z.string() }).strict(),
59
+ dispatcher: DispatcherPartial.default({}),
60
+ agents: z.record(AgentPartial).default({}),
61
+ })
62
+ .strict();
63
+ export const DISPATCHER_DEFAULTS = {
64
+ max_rounds: 30,
65
+ max_parallel: 1,
66
+ wake_timeout_sec: 600,
67
+ retry: 1,
68
+ strict: false,
69
+ workspace_mode: "auto",
70
+ };
71
+ /** How a run turned out, independent of why it stopped (`EndReason`). Only "completed" means success. */
72
+ export const RUN_OUTCOMES = ["completed", "partial", "blocked", "failed", "cancelled"];
73
+ export function exitCodeForOutcome(outcome) {
74
+ switch (outcome) {
75
+ case "completed":
76
+ return 0;
77
+ case "failed":
78
+ return 1;
79
+ case "cancelled":
80
+ return 130;
81
+ default:
82
+ return 2;
83
+ }
84
+ }
@@ -0,0 +1,142 @@
1
+ import { type ActiveWake, type EndReason, type RunState, type WakeRecord } from "./run-store.js";
2
+ import type { RunOutcome } from "./schema.js";
3
+ import type { ResolvedProject } from "./config.js";
4
+ import type { Step } from "./format.js";
5
+ export declare function latestRun(project: ResolvedProject): {
6
+ dir: string;
7
+ state: RunState;
8
+ } | undefined;
9
+ /** Newest run that can still be resumed: not done and not currently running. */
10
+ export declare function latestUnfinishedRun(project: ResolvedProject): {
11
+ dir: string;
12
+ state: RunState;
13
+ } | undefined;
14
+ export declare function listRuns(project: ResolvedProject, limit: number): {
15
+ dir: string;
16
+ state: RunState;
17
+ }[];
18
+ /**
19
+ * Is this run's dispatcher running now? Runs with a project lock (schema 2) are judged by the lock holder;
20
+ * the recorded pid is only the fallback for older runs and runs started without a lock.
21
+ */
22
+ export declare function runIsAlive(s: RunState, project?: ResolvedProject): boolean;
23
+ export declare function runStateLabel(s: Pick<RunState, "outcome" | "end_reason"> & {
24
+ pid?: number;
25
+ }, live?: boolean): string;
26
+ /** ANSI styling; `paint(false)` returns identity functions so output stays plain for pipes and tests. */
27
+ export interface Paint {
28
+ bold: (t: string) => string;
29
+ dim: (t: string) => string;
30
+ red: (t: string) => string;
31
+ green: (t: string) => string;
32
+ yellow: (t: string) => string;
33
+ cyan: (t: string) => string;
34
+ }
35
+ export declare function paint(on: boolean): Paint;
36
+ export declare function progressBar(done: number, total: number, width?: number, c?: Paint): string;
37
+ export interface QueueItem {
38
+ agent: string;
39
+ from: string;
40
+ type: string;
41
+ subject: string;
42
+ }
43
+ export interface RunReport {
44
+ run_id: string;
45
+ dir: string;
46
+ /** running: its dispatcher is alive; interrupted: it died mid-run; ended: it stopped (see end_reason). */
47
+ state: "running" | "interrupted" | "ended";
48
+ live: boolean;
49
+ end_reason?: EndReason;
50
+ outcome?: RunOutcome;
51
+ /** False for runs that ended before outcomes were recorded: `outcome` is then only a cautious reading. */
52
+ outcome_verified: boolean;
53
+ outcome_note?: string;
54
+ verification?: string;
55
+ started_at: string;
56
+ ended_at?: string;
57
+ rounds: number;
58
+ max_rounds: number;
59
+ output_tokens: number;
60
+ task_source: "text" | "file";
61
+ task_path?: string;
62
+ task_summary: string;
63
+ steps?: Step[];
64
+ current_step: string | null;
65
+ active: Record<string, ActiveWake>;
66
+ /** Who is woken next, in order (empty once the run ended). */
67
+ queue: QueueItem[];
68
+ wakes: WakeRecord[];
69
+ notes: string[];
70
+ blocked_integrations: {
71
+ agent: string;
72
+ branch: string;
73
+ reason: string;
74
+ report: string;
75
+ }[];
76
+ result_path?: string;
77
+ /** First lines of the result, for the summary page. */
78
+ result_head: string[];
79
+ mail_layout: "run" | "legacy";
80
+ workspace_mode?: "shared" | "worktree";
81
+ last_wake: Record<string, {
82
+ at: string;
83
+ ok: boolean;
84
+ error?: string;
85
+ }>;
86
+ }
87
+ export interface AgentReport {
88
+ name: string;
89
+ runtime?: string;
90
+ lead: boolean;
91
+ unread: number;
92
+ last_wake?: {
93
+ at: string;
94
+ ok: boolean;
95
+ error?: string;
96
+ };
97
+ }
98
+ export interface StatusReport {
99
+ schema_version: 1;
100
+ project: {
101
+ name: string;
102
+ dir: string;
103
+ lead: string;
104
+ };
105
+ agents: AgentReport[];
106
+ run?: RunReport;
107
+ }
108
+ export interface TaskListReport {
109
+ schema_version: 1;
110
+ project: {
111
+ name: string;
112
+ dir: string;
113
+ lead: string;
114
+ };
115
+ runs: RunReport[];
116
+ }
117
+ /** One run as `status` sees it. Without `project`, liveness falls back to the recorded pid and there is no queue. */
118
+ export declare function buildRunReport(run: {
119
+ dir: string;
120
+ state: RunState;
121
+ }, project?: ResolvedProject, opts?: {
122
+ detail?: boolean;
123
+ }): RunReport;
124
+ /** The status of a project: its agents and one run (the newest, or the one named by `runId`). */
125
+ export declare function buildStatusReport(base: ResolvedProject, runId?: string): StatusReport;
126
+ /** Every run of the project, newest first. */
127
+ export declare function buildTaskListReport(project: ResolvedProject): TaskListReport;
128
+ /** Live view: summary and agent table, plus the latest run and any run still going, wake by wake. */
129
+ export declare function formatMonitor(project: ResolvedProject, now?: number, color?: boolean): string;
130
+ /** Plain `status`: the status page followed by the full wake-by-wake record of the latest run. */
131
+ export declare function formatStatusWithLog(project: ResolvedProject, now?: number, color?: boolean): string;
132
+ /** One run in full: header, every wake, the final result, and where its logs live. */
133
+ export declare function formatRunDetail(run: {
134
+ dir: string;
135
+ state: RunState;
136
+ }, now?: number, color?: boolean, project?: ResolvedProject): string;
137
+ export declare function formatRunReport(r: RunReport, now?: number, color?: boolean): string;
138
+ /** Every run of the project, newest first: id, state, rounds, progress and task. */
139
+ export declare function formatTaskList(project: ResolvedProject, color?: boolean): string;
140
+ export declare function formatTaskListReport(report: TaskListReport, color?: boolean): string;
141
+ export declare function formatStatus(base: ResolvedProject, now?: number, color?: boolean): string;
142
+ export declare function formatStatusReport(report: StatusReport, now?: number, color?: boolean): string;