@ordewell/core 0.9.0 → 0.10.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 (63) hide show
  1. package/dist/{IFileSystem-DpaaFdit.d.ts → IFileSystem-BCJBHFwB.d.ts} +3 -1
  2. package/dist/{IFileSystem-_m7HdoxJ.d.mts → IFileSystem-Bj6fy1cG.d.mts} +3 -1
  3. package/dist/{IRunner-BiQio8gJ.d.ts → IRunner-C7_SSpzG.d.ts} +614 -77
  4. package/dist/{IRunner-CxiymkP_.d.mts → IRunner-hWAJC4hg.d.mts} +614 -77
  5. package/dist/ModeResolver-m1d8Cb-j.d.mts +35 -0
  6. package/dist/ModeResolver-u5ZhRC8x.d.ts +35 -0
  7. package/dist/{Task-1Q19y7sZ.d.mts → Task-CxwnCJLi.d.mts} +346 -127
  8. package/dist/{Task-1Q19y7sZ.d.ts → Task-CxwnCJLi.d.ts} +346 -127
  9. package/dist/{chunk-UUU46PVQ.mjs → chunk-2IIRSBEQ.mjs} +109 -142
  10. package/dist/chunk-2IIRSBEQ.mjs.map +1 -0
  11. package/dist/{chunk-QUARDKVT.mjs → chunk-CH5IGWFS.mjs} +546 -967
  12. package/dist/chunk-CH5IGWFS.mjs.map +1 -0
  13. package/dist/chunk-DJAPDO6E.mjs +1358 -0
  14. package/dist/chunk-DJAPDO6E.mjs.map +1 -0
  15. package/dist/chunk-DNFT4SQG.mjs +97 -0
  16. package/dist/chunk-DNFT4SQG.mjs.map +1 -0
  17. package/dist/index.d.mts +3204 -3926
  18. package/dist/index.d.ts +3204 -3926
  19. package/dist/index.js +22283 -16472
  20. package/dist/index.js.map +1 -1
  21. package/dist/index.mjs +20220 -14690
  22. package/dist/index.mjs.map +1 -1
  23. package/dist/parsing.d.mts +55 -3
  24. package/dist/parsing.d.ts +55 -3
  25. package/dist/parsing.js +311 -124
  26. package/dist/parsing.js.map +1 -1
  27. package/dist/parsing.mjs +86 -6
  28. package/dist/parsing.mjs.map +1 -1
  29. package/dist/plan-utils-B6yJdpgi.d.ts +2902 -0
  30. package/dist/plan-utils-CKXdD1AD.d.mts +2902 -0
  31. package/dist/plan-utils.d.mts +4 -5
  32. package/dist/plan-utils.d.ts +4 -5
  33. package/dist/plan-utils.js +471 -86
  34. package/dist/plan-utils.js.map +1 -1
  35. package/dist/plan-utils.mjs +68 -19
  36. package/dist/testing.d.mts +22 -4
  37. package/dist/testing.d.ts +22 -4
  38. package/dist/testing.js +46 -9
  39. package/dist/testing.js.map +1 -1
  40. package/dist/testing.mjs +47 -11
  41. package/dist/testing.mjs.map +1 -1
  42. package/package.json +2 -10
  43. package/skills/tdd/SKILL.md +0 -1
  44. package/dist/ModeResolver-DE-o2lRF.d.mts +0 -48
  45. package/dist/ModeResolver-EWlpmVAy.d.ts +0 -48
  46. package/dist/chunk-2M4X3VB7.mjs +0 -432
  47. package/dist/chunk-2M4X3VB7.mjs.map +0 -1
  48. package/dist/chunk-H5O74L77.mjs +0 -185
  49. package/dist/chunk-H5O74L77.mjs.map +0 -1
  50. package/dist/chunk-QUARDKVT.mjs.map +0 -1
  51. package/dist/chunk-UUU46PVQ.mjs.map +0 -1
  52. package/dist/chunk-V3JHS7AX.mjs +0 -27
  53. package/dist/chunk-V3JHS7AX.mjs.map +0 -1
  54. package/dist/order-labels.d.mts +0 -30
  55. package/dist/order-labels.d.ts +0 -30
  56. package/dist/order-labels.js +0 -54
  57. package/dist/order-labels.js.map +0 -1
  58. package/dist/order-labels.mjs +0 -13
  59. package/dist/order-labels.mjs.map +0 -1
  60. package/dist/parsing-CZdp2p_n.d.ts +0 -154
  61. package/dist/parsing-GgUJoYKs.d.mts +0 -154
  62. package/dist/plan-utils-6rUr7ZOx.d.ts +0 -1222
  63. package/dist/plan-utils-P3PIEwNa.d.mts +0 -1222
@@ -1,1222 +0,0 @@
1
- import { ag as TaskSkillSnapshot, af as TaskSkillNotice, a8 as SubagentOutcome, ao as UsageRecord, W as RunnerId, c as DiscoveredModel, a9 as Task, L as LegacyPlanState, C as ConversationMessage, a0 as SkillLoadNotice, Q as QueuedMessage, ap as UsageTotals, av as Verdict, aa as TaskIsolation, a as AwaitingReason, g as IsolationHandoff, n as IsolationMergeResult, T as ResearchStep, z as PlanState, ah as TaskSnapshot, U as ResearchStepOutcome, O as ResearchLogEntry, G as PlannerUsage, ab as TaskIsolationState } from './Task-1Q19y7sZ.mjs';
2
- import { R as RunnerModeInfo } from './ModeResolver-DE-o2lRF.mjs';
3
- import { aa as StructuredTurnEnd, h as ApprovalDecision, a9 as StructuredEvent, a0 as QueuedTaskMessage, i as ApprovalKind, o as ApprovalSource } from './IRunner-CxiymkP_.mjs';
4
- import './order-labels.mjs';
5
-
6
- /**
7
- * One entry of a structured task's log (ADR-0018, P1): what a runner did,
8
- * normalized and serializable, streamed live as `task_log` and appended to
9
- * the attempt's `.jsonl` file. The live view and the reload fold the same
10
- * events through `reduceTaskLog`, so the two cannot disagree.
11
- *
12
- * Readers skip a type they do not know, which is how later events join
13
- * without a format version.
14
- */
15
- type TaskLogEvent =
16
- /**
17
- * The task skills this attempt's prompt carried, as read at its spawn
18
- * (ADR-0024): first in its log. The file keeps their bodies; a surface is
19
- * sent notices ({@link taskLogForSurface}).
20
- */
21
- {
22
- type: 'task_skills';
23
- skills: TaskSkillSnapshot[] | TaskSkillNotice[];
24
- }
25
- /** A turn began by delivering `message`; `messageId` names it when it had been queued, `forced` when it was force sent. */
26
- | {
27
- type: 'turn_start';
28
- message: string;
29
- messageId?: string;
30
- forced?: boolean;
31
- } | {
32
- type: 'turn_end';
33
- reason: StructuredTurnEnd;
34
- } | {
35
- type: 'text_delta';
36
- text: string;
37
- }
38
- /** A complete run of the agent's reply, authoritative over the deltas streamed for it. */
39
- | {
40
- type: 'text';
41
- text: string;
42
- } | {
43
- type: 'thinking_delta';
44
- text: string;
45
- subagentId?: string;
46
- } | {
47
- type: 'thinking';
48
- text: string;
49
- subagentId?: string;
50
- }
51
- /** `args` is the call's arguments as JSON, exactly as the runner announced them. */
52
- | {
53
- type: 'tool_call';
54
- id: string;
55
- name: string;
56
- args: string;
57
- subagentId?: string;
58
- }
59
- /** `omittedLines` is set when {@link trimToolOutput} cut the middle of `output`. */
60
- | {
61
- type: 'tool_result';
62
- id: string;
63
- output: string;
64
- success: boolean;
65
- omittedLines?: number;
66
- subagentId?: string;
67
- } | {
68
- type: 'subagent_started';
69
- subagentId: string;
70
- brief: string;
71
- model?: string;
72
- } | {
73
- type: 'subagent_finished';
74
- subagentId: string;
75
- outcome: SubagentOutcome;
76
- digest: string;
77
- } | {
78
- type: 'usage';
79
- record: UsageRecord;
80
- }
81
- /**
82
- * Waiting in Ordewell's queue — again, for a message the runner was handed
83
- * and let go of (ADR-0023, D4). `forced` moves it ahead of the rest (F2).
84
- */
85
- | {
86
- type: 'message_queued';
87
- messageId: string;
88
- text: string;
89
- forced?: boolean;
90
- } | {
91
- type: 'message_removed';
92
- messageId: string;
93
- } | {
94
- type: 'message_undelivered';
95
- messageId: string;
96
- text: string;
97
- }
98
- /** The runner accepted a queued message into its running turn; it can no longer be taken back. */
99
- | {
100
- type: 'message_handed_over';
101
- messageId: string;
102
- }
103
- /**
104
- * The model read a message inside its running turn (ADR-0023, Q2), logged
105
- * where it read it. A message that opened a turn is that turn's `turn_start`.
106
- */
107
- | {
108
- type: 'message_delivered';
109
- messageId: string;
110
- text: string;
111
- }
112
- /** The agent's own words for a failed turn. */
113
- | {
114
- type: 'error';
115
- message: string;
116
- }
117
- /**
118
- * The runner asked to use a tool its mode does not cover (ADR-0018, A1).
119
- * `approvalId` is what the answer is given under; `args` is the call's
120
- * arguments as JSON; `allowForTask` says the runner offered its own
121
- * session-scoped grant.
122
- */
123
- | {
124
- type: 'approval_requested';
125
- approvalId: string;
126
- tool: string;
127
- args: string;
128
- allowForTask: boolean;
129
- toolCallId?: string;
130
- } | {
131
- type: 'approval_decided';
132
- approvalId: string;
133
- decision: ApprovalDecision['decision'];
134
- note?: string;
135
- }
136
- /** The request went unanswered: the runner withdrew it, or its process ended. */
137
- | {
138
- type: 'approval_withdrawn';
139
- approvalId: string;
140
- };
141
- /**
142
- * Keep a tool result's head and tail. A build log or a whole file read can
143
- * run to megabytes, and every attempt's file keeps it for good; the ends are
144
- * where a reader looks — the command's start, and how it finished.
145
- */
146
- declare function trimToolOutput(output: string): {
147
- output: string;
148
- omittedLines?: number;
149
- };
150
- /**
151
- * The log entry for one structured event, or null for what the log does not
152
- * keep: background-agent launches, which the subagent's own events already show.
153
- */
154
- declare function toTaskLogEvent(event: StructuredEvent): TaskLogEvent | null;
155
- /** A log as a surface is sent it, live or read back: everything but the skills' bodies. */
156
- declare function taskLogForSurface(events: readonly TaskLogEvent[]): TaskLogEvent[];
157
- /**
158
- * Merge runs of deltas into one event each. Deltas arrive a few characters at
159
- * a time; merged, a batch is one message on the wire and one line on disk,
160
- * and the view folds to the same blocks either way.
161
- */
162
- declare function coalesceTaskLog(events: readonly TaskLogEvent[]): TaskLogEvent[];
163
- /**
164
- * What an attempt did to the world, for the retry of a task whose effects
165
- * outlive it (ADR-0020): one line per tool call and how it ended.
166
- */
167
- declare function digestTaskLog(events: readonly TaskLogEvent[], maxCalls: number): string;
168
-
169
- /**
170
- * Pure, no-imports helper so a browser surface can format a conflict's files
171
- * without pulling `isolationRecord` — and its `path` import — into a webview
172
- * bundle. Kept out of `isolationRecord.ts` for exactly that reason.
173
- */
174
- declare function capConflictFiles(files: string[], max?: number): string;
175
-
176
- /**
177
- * The catalog a model/task-mode edit is checked against — the same discovered
178
- * models and manifest modes the planner was shown in the per-turn catalog
179
- * block (`PlannerConversation.catalogBlock`), so a refusal here can never name something
180
- * as invalid that the planner was never told about, or vice versa.
181
- */
182
- interface EditCatalog {
183
- modelsByRunner: Partial<Record<RunnerId, DiscoveredModel[]>>;
184
- runnerModes: Partial<Record<RunnerId, RunnerModeInfo[]>>;
185
- /** Raw (unfiltered) allowlist, keyed by runner — the same shape `coerceAssignments` takes. */
186
- perRunnerAllowlist?: Partial<Record<RunnerId, string[]>>;
187
- }
188
-
189
- /**
190
- * Targeted task edits emitted by the planner conversation (the 'task_ops'
191
- * ConversationTurn). Task references accept a task id, a "#<order>" ref, or a
192
- * bare order number — cheap models rarely echo UUIDs correctly.
193
- */
194
- type TaskOp = {
195
- op: 'update';
196
- taskId: string;
197
- changes: Partial<Task>;
198
- } | {
199
- op: 'add';
200
- task: Partial<Task>;
201
- handle?: string;
202
- } | {
203
- op: 'remove';
204
- taskId: string;
205
- } | {
206
- op: 'reorder';
207
- taskIds: string[];
208
- } | {
209
- op: 'merge';
210
- taskIds: string[];
211
- merged: Partial<Task>;
212
- handle?: string;
213
- } | {
214
- op: 'split';
215
- taskId: string;
216
- parts: Partial<Task>[];
217
- handle?: string;
218
- } | {
219
- op: 'rearm';
220
- taskId: string;
221
- changes?: Partial<Task>;
222
- };
223
- declare function textHasTaskOps(text: string): boolean;
224
- /** Parse a `{"taskOps":[...]}` reply. Throws PlanParseError when the JSON is unusable. */
225
- declare function parseTaskOpsJson(text: string): TaskOp[];
226
- interface ApplyTaskOpsResult {
227
- ok: boolean;
228
- tasks: readonly Task[];
229
- errors: string[];
230
- /** Human-readable summary of what changed, for the chat transcript. */
231
- summary: string[];
232
- }
233
- /**
234
- * Pre-flight check for a merge: would collapsing the selected tasks into one
235
- * (rewiring every dependent of any selected task to the survivor) keep the
236
- * dependency graph valid? Rejects locked tasks and merges whose rewiring would
237
- * introduce a cycle. Display order is NOT checked here — neither
238
- * consecutiveness (a UI concern) nor a dependency the merge pulls out of order,
239
- * which {@link applyTaskOps} repairs; refusing on order would make this
240
- * pre-flight stricter than the applier it stands in for.
241
- */
242
- declare function canMergeTasks(tasks: readonly Task[], selectedIds: string[]): {
243
- ok: boolean;
244
- error?: string;
245
- };
246
- /**
247
- * The shape the dependency helpers below read. Structural rather than `Task`,
248
- * because the TUI projects tasks into its own `TaskView`: a surface's
249
- * dependency picker and the API's validation must agree on which dependencies
250
- * are legal, and a signature only core can satisfy would have forced the TUI
251
- * to keep a second copy of the rule.
252
- */
253
- interface TaskRef {
254
- id: string;
255
- order: number;
256
- title: string;
257
- dependencies: string[];
258
- }
259
- /** The tasks listing `taskId` as a dependency — exactly what removing it detaches. */
260
- declare function dependentsOf<T extends Pick<TaskRef, 'id' | 'dependencies'>>(tasks: T[], taskId: string): T[];
261
- /**
262
- * The tasks that may become dependencies of `taskId`: those displayed before it.
263
- *
264
- * Offering only earlier tasks is what keeps a hand-edited graph valid without a
265
- * cycle check — dependencies then only ever point backwards in display order,
266
- * the same invariant `applyTaskOps` enforces. Omit `taskId` for a task that does
267
- * not exist yet: it lands last, so every current task is a candidate.
268
- */
269
- declare function dependencyCandidates<T extends Pick<TaskRef, 'id' | 'order'>>(tasks: readonly T[], taskId?: string): T[];
270
- /** Pre-flight check for a hand-edited dependency list: every id exists and comes earlier. */
271
- declare function canSetDependencies<T extends TaskRef>(tasks: readonly T[], taskId: string, dependencies: string[]): {
272
- ok: boolean;
273
- error?: string;
274
- };
275
- /** Pre-flight check for a split: the task exists and is not locked by execution. */
276
- declare function canSplitTask(tasks: readonly Task[], taskId: string): {
277
- ok: boolean;
278
- error?: string;
279
- };
280
- /**
281
- * Apply task ops to a snapshot of the plan, atomically: either every op
282
- * applies and the result validates (deps resolve, no cycles, running and
283
- * completed tasks untouched), or nothing is returned and `errors` explains
284
- * why. The caller commits `tasks` on ok.
285
- */
286
- declare function applyTaskOps(currentTasks: readonly Task[], ops: TaskOp[], runners: RunnerId[], catalog?: EditCatalog): ApplyTaskOpsResult;
287
-
288
- type SerializedTaskStatus = {
289
- id: string;
290
- status: string;
291
- verdict: {
292
- outcome: 'pass' | 'fail';
293
- reason: string;
294
- checks: Verdict['checks'];
295
- } | null;
296
- /** Advisory silence timestamp from VerdictEngine — not part of task status semantics. */
297
- idleSince?: string | null;
298
- /** Absent unless the plan has an isolation run, so a shared-root plan's updates are unchanged. */
299
- isolation?: TaskIsolation;
300
- /** What an `awaiting_user` task waits on, when it was saved (ADR-0018, W1). */
301
- awaitingReason?: AwaitingReason;
302
- /** The whole question of the checkpoint the task waits at; absent when it waits at none. */
303
- checkpoint?: string;
304
- /** Messages waiting for a structured task's turn to end, oldest first; absent when there are none. */
305
- queued?: QueuedTaskMessage[];
306
- /** Set when the task can be continued in its saved runner session (ADR-0018, K1); the id itself stays in the daemon. */
307
- continuable?: true;
308
- /**
309
- * How many of a structured task's runner requests wait for an answer
310
- * (ADR-0018, A1) — "waiting for approval", which leaves `status` alone.
311
- * Absent when none do.
312
- */
313
- awaitingApproval?: number;
314
- /**
315
- * The dependencies an ops or user task waits on at its merge gate: their
316
- * work has landed but is not merged into the user's branch (ADR-0020).
317
- * Absent when it waits for no Merge all.
318
- */
319
- mergeGate?: string[];
320
- /** The dependencies, by title, a force start went past the merge gate of (ADR-0020). */
321
- forcedPastGate?: string[];
322
- };
323
- /**
324
- * A run with tasks at a merge gate (ADR-0020), as a surface offers Merge all
325
- * mid-run: what has landed and is not merged yet, and whether nothing else is
326
- * running, so the run waits on the user alone.
327
- */
328
- interface MergeGateView {
329
- paused: boolean;
330
- repos: IsolationHandoff['repos'];
331
- landed: IsolationHandoff['landed'];
332
- }
333
- type SerializedTask = {
334
- id: string;
335
- order: number;
336
- title: string;
337
- type: string;
338
- description: string;
339
- dependencies: string[];
340
- assignedRunner: RunnerId;
341
- assignedModel: Task['assignedModel'] | null;
342
- taskMode: string;
343
- prompt: string | null;
344
- subtasks: SerializedTask[];
345
- userSteps: Task['userSteps'];
346
- thinkingEffort: Task['thinkingEffort'];
347
- autonomy: Task['autonomy'];
348
- sliceType: Task['sliceType'];
349
- userStoriesCovered: Task['userStoriesCovered'];
350
- /** Set only on an ops task (ADR-0020). */
351
- ops?: true;
352
- /** Task skills attached by name; absent when none. */
353
- skills?: string[];
354
- };
355
- /** Skill loads go out as notices: their bodies are for the planner, and stay in the session. */
356
- type SerializedConversationMessage = Omit<ConversationMessage, 'skill'> & {
357
- skill?: SkillLoadNotice;
358
- };
359
- type SerializedQueuedMessage = Omit<QueuedMessage, 'skills'> & {
360
- skills?: SkillLoadNotice[];
361
- };
362
- /**
363
- * A task as a surface is sent it: its attempt's skills are notices, whole in
364
- * the session only, and its runner session id stays there too — no surface shows it,
365
- * and only a continue reads the runner's own session id.
366
- */
367
- type SurfaceTask<T extends Task = Task> = Omit<T, 'attemptSkills' | 'subtasks' | 'runnerSessionId'> & {
368
- attemptSkills?: TaskSkillNotice[];
369
- subtasks: SurfaceTask[];
370
- };
371
- /** A plan as the daemon and the VS Code webview are sent it: the session's own state, minus every skill body. */
372
- type SurfacePlan = Omit<LegacyPlanState, 'tasks' | 'conversationHistory' | 'queuedMessages'> & {
373
- tasks: SurfaceTask[];
374
- conversationHistory?: SerializedConversationMessage[];
375
- queuedMessages?: SerializedQueuedMessage[];
376
- };
377
- /** The phase-tagged shape of {@link SurfacePlan}. */
378
- type SurfacePlanState = (Omit<Extract<PlanState, {
379
- phase: 'planning';
380
- }>, 'pendingTasks'> & {
381
- pendingTasks: SurfaceTask[];
382
- }) | (Omit<Extract<PlanState, {
383
- phase: 'executing';
384
- }>, 'pendingTasks' | 'executionLog'> & {
385
- pendingTasks: SurfaceTask[];
386
- executionLog: SurfaceTask<TaskSnapshot>[];
387
- });
388
- type SerializedPlan = {
389
- tasks: SerializedTask[];
390
- runners: RunnerId[];
391
- generatedAt: string;
392
- conversationHistory?: SerializedConversationMessage[];
393
- prdMarkdown?: string;
394
- queuedMessages?: SerializedQueuedMessage[];
395
- };
396
- /** How a planner turn ended: the reply kind it settled on, a user stop, or a failure. */
397
- type PlannerTurnOutcome = 'message' | 'plan' | 'task_ops' | 'stopped' | 'error';
398
- /**
399
- * Everything a session tells its surfaces, over one broadcast seam.
400
- *
401
- * A planner turn (#47) streams between `planner_turn_started` and
402
- * `planner_turn_ended` with the same `turnId`; every turn-scoped message in
403
- * between carries it. The stream is provisional and the settled messages are
404
- * authoritative:
405
- * - `planner_message` replaces the streamed text of the turn's final segment —
406
- * a surface drops what it accumulated and shows the message instead.
407
- * - A reply that is a JSON envelope (plan, taskOps, taskQuery) never arrives
408
- * as `planner_text_delta`; it streams as `plan_token`, the "building plan"
409
- * display.
410
- * - A subagent's own text never appears in the reply; its activity arrives
411
- * tagged with its `subagentId`.
412
- */
413
- type SessionMessage =
414
- /**
415
- * The plan, whole. `turnId` names the planner turn whose commit this
416
- * broadcast carries, so the turn's building plan becomes the marker; it is
417
- * absent on every other broadcast of the plan.
418
- */
419
- {
420
- type: 'plan_generated';
421
- plan: SerializedPlan;
422
- goal: string;
423
- runners: RunnerId[];
424
- turnId?: string;
425
- }
426
- /**
427
- * The settled reply of a planner turn, emitted by the session once the turn
428
- * is classified. Authoritative over any `planner_text_delta` of its turn's
429
- * final segment. `turnId` is absent for replies sent outside a streamed turn.
430
- */
431
- | {
432
- type: 'planner_message';
433
- content: string;
434
- timestamp: string;
435
- turnId?: string;
436
- }
437
- /**
438
- * A planner turn began. Emitted once per turn by whoever runs the turn,
439
- * before any other message carrying its `turnId`. `prompt` is the user's
440
- * message, as typed, when the turn answers one; `skills` are what its
441
- * `/name` tokens loaded, absent when none did.
442
- */
443
- | {
444
- type: 'planner_turn_started';
445
- turnId: string;
446
- prompt?: string;
447
- skills?: SkillLoadNotice[];
448
- } | {
449
- type: 'planner_skill_loaded';
450
- turnId: string;
451
- skill: SkillLoadNotice;
452
- }
453
- /**
454
- * A planner turn is over; nothing more carries its `turnId`. Emitted exactly
455
- * once per `planner_turn_started`, stop and failure included, after the
456
- * turn's `planner_message` when it has one.
457
- */
458
- | {
459
- type: 'planner_turn_ended';
460
- turnId: string;
461
- outcome: PlannerTurnOutcome;
462
- }
463
- /**
464
- * Reply prose as it streams, appended in order within its segment. A segment
465
- * is one continuous run of model text; text before a tool call is its own
466
- * segment, and a later segment never rewrites an earlier one. Never carries
467
- * a JSON envelope or a subagent's text (see the union's invariants).
468
- */
469
- | {
470
- type: 'planner_text_delta';
471
- turnId: string;
472
- segmentId: string;
473
- text: string;
474
- }
475
- /**
476
- * Exposed reasoning as it streams, from the planner or — tagged with
477
- * `subagentId` — from one of its subagents. Never part of the reply. The one
478
- * thinking message for every backend: `segmentId` is set only where the
479
- * backend streams thinking in segments (the API loops; harness planners do
480
- * not), and `turnId` is absent for thinking outside a turn (one-shot plans).
481
- */
482
- | {
483
- type: 'planner_thinking_delta';
484
- turnId?: string;
485
- segmentId?: string;
486
- subagentId?: string;
487
- text: string;
488
- }
489
- /**
490
- * Text streamed for an attempt the turn discarded (a corrective retry) is
491
- * taken back: a surface removes it. With `segmentId`, only that segment;
492
- * without, all of the turn's text not yet settled by a `planner_message`.
493
- * A segment that streamed to the plan display (`plan_token`) takes the
494
- * turn's building plan with it.
495
- */
496
- | {
497
- type: 'planner_text_retracted';
498
- turnId: string;
499
- segmentId?: string;
500
- }
501
- /**
502
- * The planner's running usage for the session, subagents included, emitted
503
- * after a model call reports usage. `totals` already contains every
504
- * `bySubagent` entry. `contextFill` is the last planner prompt against the
505
- * model's window, omitted when the window is unknown. Cost appears only as
506
- * reported by a provider or runner (see `UsageRecord`).
507
- */
508
- | {
509
- type: 'planner_usage';
510
- turnId?: string;
511
- totals: UsageTotals;
512
- bySubagent?: Record<string, UsageTotals>;
513
- contextFill?: {
514
- usedTokens: number;
515
- windowTokens: number;
516
- };
517
- }
518
- /**
519
- * A subagent began work on `brief`. Emitted by the planner backend that
520
- * spawned it (ADR-0005 research agents, or a harness planner's own), before
521
- * any message tagged with its `subagentId`.
522
- */
523
- | {
524
- type: 'subagent_started';
525
- turnId?: string;
526
- subagentId: string;
527
- brief: string;
528
- model?: string;
529
- }
530
- /**
531
- * A subagent is done; nothing more is tagged with its `subagentId`. Emitted
532
- * once per `subagent_started`. `digest` is what it handed back to the
533
- * planner; `usage` is its own share, already counted in `planner_usage`.
534
- */
535
- | {
536
- type: 'subagent_finished';
537
- turnId?: string;
538
- subagentId: string;
539
- outcome: SubagentOutcome;
540
- digest: string;
541
- usage?: UsageTotals;
542
- } | {
543
- type: 'status_update';
544
- tasks: SerializedTaskStatus[];
545
- gate?: MergeGateView;
546
- } | {
547
- type: 'review_needed';
548
- tasks: SerializedTask[];
549
- } | {
550
- type: 'review_approved';
551
- } | {
552
- type: 'checkpoint';
553
- taskId: string;
554
- taskTitle: string;
555
- summary: string;
556
- } | {
557
- type: 'execution_complete';
558
- summary: {
559
- total: number;
560
- completed: number;
561
- failed: number;
562
- };
563
- } | {
564
- type: 'execution_stopped';
565
- } | {
566
- type: 'task_updated';
567
- taskId: string;
568
- changes: Record<string, unknown>;
569
- } | {
570
- type: 'task_started';
571
- taskId: string;
572
- order: number;
573
- title: string;
574
- runner: RunnerId;
575
- modelId?: string;
576
- } | {
577
- type: 'task_output';
578
- taskId: string;
579
- text: string;
580
- }
581
- /**
582
- * A structured task's log as it happens (ADR-0018, P1): the next events of
583
- * the task's attempt `attempt`, in order — the same ones appended to that
584
- * attempt's file, so a surface folding these and one replaying the file
585
- * draw the same blocks.
586
- */
587
- | {
588
- type: 'task_log';
589
- taskId: string;
590
- attempt: number;
591
- events: TaskLogEvent[];
592
- } | {
593
- type: 'isolation_blocked';
594
- reason: 'dirty';
595
- repos?: string[];
596
- message: string;
597
- } | {
598
- type: 'isolation_handoff';
599
- repos: IsolationHandoff['repos'];
600
- landed: IsolationHandoff['landed'];
601
- } | {
602
- type: 'isolation_merge';
603
- result: IsolationMergeResult;
604
- } | {
605
- type: 'planner_liveness';
606
- } | {
607
- type: 'research_step';
608
- tool: string;
609
- toolLabel?: string;
610
- args: string;
611
- subagentId?: string;
612
- toolCallId?: string;
613
- turnId?: string;
614
- } | {
615
- type: 'plan_token';
616
- token: string;
617
- turnId?: string;
618
- segmentId?: string;
619
- } | {
620
- type: 'research_step_done';
621
- step: ResearchStep;
622
- subagentId?: string;
623
- turnId?: string;
624
- } | {
625
- type: 'approval_request';
626
- id: string;
627
- kind: ApprovalKind;
628
- subject: string;
629
- scope: string;
630
- detail?: string;
631
- turnId?: string;
632
- } | {
633
- type: 'approval_settled';
634
- id: string;
635
- granted: boolean;
636
- } | {
637
- type: 'approval_decided';
638
- kind: ApprovalKind;
639
- subject: string;
640
- scope: string;
641
- detail?: string;
642
- granted: boolean;
643
- source: Exclude<ApprovalSource, 'asked'>;
644
- };
645
- /**
646
- * A line a run wants the user to read — how it isolates, what it shares. Not a
647
- * {@link SessionMessage}: hosts that show notices as toasts already do, and
648
- * widening the union would break every exhaustive switch over it. A host with
649
- * no toast channel (the daemon) hands these to its clients by its own means.
650
- */
651
- type SessionNotice = {
652
- type: 'notice';
653
- level: 'info' | 'warn' | 'error';
654
- message: string;
655
- };
656
- type SessionBroadcaster = (msg: SessionMessage) => void;
657
- declare function serializeTask(t: Task): SerializedTask;
658
- declare function serializeTaskStatus(t: Task, idleSince?: string | null, isolation?: TaskIsolation | null, queued?: readonly QueuedTaskMessage[], awaitingApproval?: number, mergeGate?: readonly string[], checkpoint?: string): SerializedTaskStatus;
659
- /** The one place a plan's skill bodies come off before it leaves the session: every wire path that carries plan state goes through here. */
660
- declare function surfacePlan(plan: LegacyPlanState): SurfacePlan;
661
- declare function surfacePlanState(state: PlanState): SurfacePlanState;
662
- declare function serializePlan(plan: LegacyPlanState): SerializedPlan;
663
- declare function executionSummary(tasks: readonly Task[]): {
664
- total: number;
665
- completed: number;
666
- failed: number;
667
- };
668
- declare const CHECKPOINT_TRUNCATE_LENGTH = 120;
669
- /** Truncate a checkpoint summary to a single line of at most CHECKPOINT_TRUNCATE_LENGTH chars. */
670
- declare function truncateCheckpointSummary(summary: string): string;
671
-
672
- /**
673
- * @param toolLabel The agent's own name for the tool, when a harness planner
674
- * produced the call (ADR-0009). It replaces the member name in the summary, so
675
- * the timeline says `Edit` rather than the catch-all `agent_tool` — and says
676
- * `WebFetch` rather than claiming a shell command ran.
677
- */
678
- declare function summarizeToolCall(tool: string, argsJson: string, toolLabel?: string): string;
679
- /**
680
- * Classify a tool outcome from its result text and success flag, so a surface
681
- * can render a refused `rm` or a denied `npm test` distinctly from a
682
- * successful run without re-deriving the refusal signatures per surface. The
683
- * refusal/denial strings come from `commandPolicy.ts`, `BaseFileSystem.ts`,
684
- * and the research-subagent wrapper — keeping the matching here means the
685
- * signatures stay in one place alongside the human summary.
686
- */
687
- declare function classifyOutcome(success: boolean, output: string): ResearchStepOutcome;
688
-
689
- /**
690
- * What a surface draws for one planner conversation (#51): an ordered list of
691
- * display blocks, built once in core from the `SessionMessage` stream and drawn
692
- * per surface. Every block carries an `id` that stays the same for as long as
693
- * the block exists, so a surface can key its own UI state on it — whether a
694
- * block is expanded is that UI state, and deliberately not part of a block.
695
- */
696
- type DisplayBlock = MessageBlock | ThinkingDisplayBlock | ToolBlock | SubagentBlock | ApprovalBlock | PlanBlock | SkillLoadBlock | UsageBlock;
697
- /** `agent` is a task runner speaking in a structured task's log (ADR-0018); the planner is `planner`. */
698
- type MessageRole = 'user' | 'planner' | 'agent' | 'system' | 'error';
699
- interface MessageBlock {
700
- type: 'message';
701
- id: string;
702
- role: MessageRole;
703
- text: string;
704
- /** Deltas are still arriving. */
705
- streaming: boolean;
706
- turnId?: string;
707
- /**
708
- * Present while the text is the streamed segment of a reply rather than a
709
- * settled message: provisional, replaced by the turn's `planner_message` when
710
- * it is the final segment, and never saved to the transcript.
711
- */
712
- segmentId?: string;
713
- /** A user's message: the skills its `/name` tokens loaded, for a surface to mark those tokens (see `loadedSkillTokens`). */
714
- skills?: readonly string[];
715
- }
716
- interface ThinkingDisplayBlock {
717
- type: 'thinking';
718
- id: string;
719
- text: string;
720
- streaming: boolean;
721
- turnId?: string;
722
- segmentId?: string;
723
- /** Set when a subagent thought it; the block then sits among that subagent's children. */
724
- subagentId?: string;
725
- }
726
- /** The two halves of a Claude Code-style command row: `Name(keyArg)`. */
727
- interface ToolHeadline {
728
- name: string;
729
- keyArg: string;
730
- }
731
- type ToolStatus = 'pending' | 'ok' | 'error' | 'denied' | 'interrupted';
732
- /** What a file edit changed, counted from its diff. */
733
- interface DiffStat {
734
- added: number;
735
- removed: number;
736
- }
737
- interface ToolBlock {
738
- type: 'tool';
739
- id: string;
740
- toolCallId?: string;
741
- tool: string;
742
- toolLabel?: string;
743
- headline: ToolHeadline;
744
- /** The arguments exactly as announced (JSON), for the expanded view. */
745
- args: string;
746
- status: ToolStatus;
747
- /** How the call ended, finer than `status`: a refused command and a denied path both read `denied`. */
748
- outcome?: ResearchStepOutcome;
749
- output: string;
750
- /** Every line of `output`, counted as {@link outputPreview} counts them. */
751
- outputLineCount: number;
752
- /** Present when the call edited a file and `output` is its diff: a surface draws it as one. */
753
- diff?: DiffStat;
754
- turnId?: string;
755
- /**
756
- * The subagent this call starts. The call becomes that subagent's block once
757
- * the subagent announces itself, so the two never show as separate rows.
758
- */
759
- spawns?: string;
760
- }
761
- type SubagentStatus = 'running' | SubagentOutcome;
762
- type SubagentChild = ToolBlock | ThinkingDisplayBlock | MessageBlock;
763
- interface SubagentBlock {
764
- type: 'subagent';
765
- id: string;
766
- subagentId: string;
767
- /** The planner's call that started it, when one was announced. */
768
- toolCallId?: string;
769
- brief: string;
770
- model?: string;
771
- status: SubagentStatus;
772
- children: readonly SubagentChild[];
773
- /** What it handed back to the planner. */
774
- digest: string;
775
- /** Its own share, already counted in the usage line. */
776
- usage?: UsageTotals;
777
- turnId?: string;
778
- }
779
- /** `withdrawn`: a runner's request that went unanswered — the runner cancelled it, or its process ended. */
780
- type ApprovalStatus = 'pending' | 'granted' | 'denied' | 'withdrawn';
781
- interface ApprovalBlock {
782
- type: 'approval';
783
- id: string;
784
- /** The request's id, which a surface answers through. Absent for a decision nobody was asked about. */
785
- approvalId?: string;
786
- kind: ApprovalKind;
787
- subject: string;
788
- scope: string;
789
- detail?: string;
790
- status: ApprovalStatus;
791
- /** Absent while pending. */
792
- decidedBy?: ApprovalSource;
793
- turnId?: string;
794
- /** A runner's request (`runner_tool`) that can also be allowed for the rest of its task. */
795
- allowForTask?: boolean;
796
- /** Granted for the rest of the task, not this call alone. */
797
- forTask?: boolean;
798
- /** What a denial told the agent. */
799
- note?: string;
800
- /** The runner's tool call the request is about. */
801
- toolCallId?: string;
802
- }
803
- type PlanMarkerStatus = 'building' | 'generated' | 'updated';
804
- interface PlanBlock {
805
- type: 'plan';
806
- id: string;
807
- status: PlanMarkerStatus;
808
- /** The plan envelope streamed so far — `parsePartialPlan` reads rows from it. Empty once settled. */
809
- text: string;
810
- taskCount?: number;
811
- turnId?: string;
812
- /** While building: the segment whose envelope is streaming, which a retraction of that segment takes back. */
813
- segmentId?: string;
814
- }
815
- /** A skill loaded into the conversation: one line naming it and the SKILL.md that won. Its body is never shown. */
816
- interface SkillLoadBlock extends SkillLoadNotice {
817
- type: 'skill_load';
818
- id: string;
819
- turnId?: string;
820
- }
821
- /** The token line. There is at most one, and it is always the last block. */
822
- interface UsageBlock {
823
- type: 'usage';
824
- id: string;
825
- totals: UsageTotals;
826
- contextFill?: {
827
- usedTokens: number;
828
- windowTokens: number;
829
- };
830
- bySubagent?: Record<string, UsageTotals>;
831
- }
832
-
833
- /** What every view over display blocks holds; each view adds its own state beside it. */
834
- interface BlockList {
835
- readonly blocks: readonly DisplayBlock[];
836
- readonly nextId: number;
837
- }
838
-
839
- /**
840
- * A line a surface adds to the conversation itself rather than receiving from
841
- * the session: the user's prompt as it is sent, a notice, an error.
842
- */
843
- interface LocalEntry {
844
- type: 'local_entry';
845
- role: 'user' | 'system' | 'error';
846
- text: string;
847
- }
848
- type ConversationInput = SessionMessage | LocalEntry;
849
- interface ConversationView extends BlockList {
850
- /**
851
- * The newest transcript entry the view accounts for. Plan markers and system
852
- * notes reach a surface only inside the transcript a `plan_generated`
853
- * carries, so entries after this one are what is new in it.
854
- */
855
- readonly transcriptAt?: string;
856
- }
857
- declare const EMPTY_CONVERSATION: ConversationView;
858
- /**
859
- * Fold one input into the view. Pure and incremental: blocks the input does
860
- * not touch keep their identity, and an input that changes nothing returns
861
- * `view` itself — surfaces memoize their drawing on that, and text deltas
862
- * arrive quickly.
863
- */
864
- declare function reduceConversation(view: ConversationView, input: ConversationInput): ConversationView;
865
-
866
- /**
867
- * The view a saved session reopens with: what its transcript and research log
868
- * kept, in the order it happened — messages, notices and the compaction
869
- * summary, plan markers, tool calls with each subagent's calls nested under
870
- * it, and the token line. Reasoning and streamed text were never saved, so a
871
- * reload has none.
872
- *
873
- * The research log interleaves with the transcript by time. Entries older than
874
- * a compaction's first kept message went with the turns it condensed.
875
- */
876
- declare function fromTranscript(conversationHistory: readonly SerializedConversationMessage[] | undefined, researchLog: readonly ResearchLogEntry[] | undefined, plannerUsage?: PlannerUsage): ConversationView;
877
-
878
- /**
879
- * What a surface draws for one attempt of a structured task (ADR-0018, O1b):
880
- * the same display blocks as the planner conversation, built from the task's
881
- * {@link TaskLogEvent}s. No planner turn ids — a task's turns are its own,
882
- * one at a time.
883
- */
884
- interface TaskLogView extends BlockList {
885
- /** Messages not yet delivered, oldest first; `handedOver` marks the ones the runner already has. */
886
- readonly queued: readonly QueuedTaskMessage[];
887
- /** A turn is running. */
888
- readonly working: boolean;
889
- /** How the last turn ended; absent before the first one does. */
890
- readonly lastTurnEnd?: StructuredTurnEnd;
891
- /** What the runner reported over the attempt, subagents included. */
892
- readonly usage?: PlannerUsage;
893
- /**
894
- * The block each run of deltas streams into, keyed by stream, so the run's
895
- * authoritative copy replaces it instead of repeating it below.
896
- */
897
- readonly streams: Readonly<Record<string, string>>;
898
- }
899
- declare const EMPTY_TASK_LOG: TaskLogView;
900
- /** A runner's tool request, read the way its call's row reads: `Bash(npm test)`. */
901
- declare function runnerToolSubject(tool: string, args: string): string;
902
- /**
903
- * Fold one task-log event into the view. Pure and incremental, like
904
- * `reduceConversation`: an event that changes nothing returns `view` itself,
905
- * and an event of a type this build does not know is skipped — a log written
906
- * by a newer Ordewell still reads.
907
- */
908
- declare function reduceTaskLog(view: TaskLogView, event: TaskLogEvent): TaskLogView;
909
- /** A whole attempt's events, folded from the start — what a reload shows. */
910
- declare function replayTaskLog(events: readonly TaskLogEvent[], from?: TaskLogView): TaskLogView;
911
-
912
- /**
913
- * The one-line head of a command row, shared by every surface: the tool's name
914
- * and the argument that says what the call is about.
915
- *
916
- * @param args The call's arguments as announced (JSON). Anything that is not a
917
- * JSON object is shown as it came, on one line.
918
- * @param toolLabel A harness planner's own name for the tool (ADR-0009).
919
- */
920
- declare function toolHeadline(tool: string, args: string, toolLabel?: string): ToolHeadline;
921
- interface OutputPreview {
922
- lines: string[];
923
- hiddenLineCount: number;
924
- }
925
- /** The lines of a tool's output as a reader sees them — what {@link outputPreview} shows and counts. */
926
- declare function outputLines(output: string): string[];
927
- /** The head of a tool's output for a collapsed row, and how many lines it leaves out. */
928
- declare function outputPreview(output: string, maxLines: number): OutputPreview;
929
- /**
930
- * The lines a diff adds and removes, or null when `output` is not one: every
931
- * line a hunk header, context, an addition or a removal, and at least one of
932
- * the last two.
933
- */
934
- declare function diffStat(output: string): DiffStat | null;
935
- /** `gap` stands between two hunks, for the lines a diff leaves out. */
936
- type DiffRowKind = 'added' | 'removed' | 'context' | 'gap';
937
- interface DiffRow {
938
- kind: DiffRowKind;
939
- /** The line in the file: the old file's for a removal, the new file's otherwise. */
940
- line?: number;
941
- text: string;
942
- }
943
- /** A diff as the rows a surface draws, numbered as an editor would number them. */
944
- declare function diffRows(output: string): DiffRow[];
945
- /** "Added 2 lines, removed 1 line": the summary every surface puts on an edit's row. */
946
- declare function diffSummary({ added, removed }: DiffStat): string;
947
-
948
- /**
949
- * Prompts the user sent while a planner turn was in flight, waiting to be the
950
- * next turn's input. The hold is a plain immutable list, oldest first, so a
951
- * pure reducer can keep it in state and a host can keep it in a field — and
952
- * either can draw it as is.
953
- */
954
- type PromptHold = readonly string[];
955
- declare const EMPTY_HOLD: PromptHold;
956
- /** One prompt taken out of the hold, and what is left behind. */
957
- interface TakenPrompt {
958
- text: string;
959
- rest: PromptHold;
960
- }
961
- declare function holdPrompt(hold: PromptHold, text: string): PromptHold;
962
- /** The prompt a settled turn sends next: the oldest, so they go in the order typed. */
963
- declare function drainNext(hold: PromptHold): TakenPrompt | undefined;
964
- /**
965
- * Takes back the newest prompt — the one the user most likely just regretted —
966
- * while the older ones stay queued behind the turn.
967
- */
968
- declare function unsendLatest(hold: PromptHold): TakenPrompt | undefined;
969
- /**
970
- * A stopped turn takes its queue with it: the prompts were written against a
971
- * turn that no longer exists, so they come back as one draft to edit and
972
- * resend rather than firing off after the stop.
973
- */
974
- declare function unsendAll(hold: PromptHold): TakenPrompt | undefined;
975
- /** Where an unsent prompt lands in the drafting input: above what is being typed, never replacing it. */
976
- declare function aheadOfDraft(text: string, draft: string): string;
977
-
978
- /**
979
- * The planner turn a surface has open, and the one its user stopped. Kept
980
- * beside the view rather than in it: the view is what a turn drew, this is
981
- * whether the surface still wants to hear from it.
982
- */
983
- interface TurnGate {
984
- readonly open: string | null;
985
- readonly stopped: string | null;
986
- }
987
- declare const NO_TURN: TurnGate;
988
- interface GatedConversation {
989
- view: ConversationView;
990
- gate: TurnGate;
991
- }
992
- /**
993
- * One input into the view, the stop rule applied: a turn the user stopped is
994
- * over on screen, and whatever it streams until the backend notices is
995
- * dropped. An input that changes nothing hands back the same view and gate.
996
- */
997
- declare function followTurn(view: ConversationView, gate: TurnGate, input: ConversationInput): GatedConversation;
998
- /**
999
- * The user stopped the planner. The turn ends on screen now rather than when
1000
- * the backend notices the abort, so the surface is free at once and the
1001
- * turn's late output never lands. Nothing changes when no turn is open.
1002
- */
1003
- declare function stopTurn(view: ConversationView, gate: TurnGate): GatedConversation;
1004
-
1005
- /**
1006
- * Whether the conversation holds anything the collapsed view hides — thinking,
1007
- * a command row's arguments and output, a subagent's children and digest. The
1008
- * detail toggle is the only expansion control (ADR-0017, X1), so a surface
1009
- * offers it only when it would do something.
1010
- */
1011
- declare function hasHiddenDetail(blocks: readonly DisplayBlock[]): boolean;
1012
-
1013
- /** The conversation line for a task starting, worded the same on every surface. */
1014
- declare function taskStartedNotice(title: string, runner?: string): string;
1015
-
1016
- /** Where a skill name is invoked: `start` is its `/`, `end` is just past the name, before any punctuation. */
1017
- interface SkillToken {
1018
- name: string;
1019
- start: number;
1020
- end: number;
1021
- }
1022
- /**
1023
- * The first `/name` token for each name in `text`, names lower-cased. Only
1024
- * the first counts because a skill loads once per message however often it is
1025
- * named, so a later repeat is plain text.
1026
- */
1027
- declare function skillTokens(text: string): SkillToken[];
1028
- /** The tokens in a sent message that loaded one of `loaded` — what a surface highlights in the user's bubble. */
1029
- declare function loadedSkillTokens(text: string, loaded: readonly string[]): SkillToken[];
1030
-
1031
- /**
1032
- * What a row's status means to a reader, before any surface picks a word,
1033
- * icon or colour for it. `quiet` is a running task whose runner has printed
1034
- * nothing for a while — the status is still `in_progress`, so only the row,
1035
- * never the store, tells the two apart.
1036
- */
1037
- type TaskStatusKind = 'todo' | 'running' | 'quiet' | 'awaiting' | 'blocked' | 'failed' | 'done';
1038
- /** A task with a runner live behind it. `in_progress` is the store's own status. */
1039
- declare const isTaskRunning: (task: {
1040
- status: string;
1041
- }) => boolean;
1042
- /** Statuses of a task that has not started: what can still be started by hand, or flipped between change and ops (ADR-0020). */
1043
- declare const NOT_STARTED: ReadonlySet<string>;
1044
- declare function taskStatusKind(task: {
1045
- status: string;
1046
- idleSince?: string | null;
1047
- }): TaskStatusKind;
1048
- /** What an awaiting_user task waits on (ADR-0018, W1); null when no reason was saved. */
1049
- declare function awaitingLabel(task: {
1050
- status: string;
1051
- awaitingReason?: AwaitingReason;
1052
- }): string | null;
1053
- /** Runner requests a task waits on (ADR-0018, A1); null when none do. */
1054
- declare function approvalLabel(count: number | undefined): string | null;
1055
-
1056
- /** What a user can do to one task from its row. */
1057
- type TaskRowAction = 'cancel' | 'skip' | 'force-start' | 'complete' | 'uncomplete';
1058
- /** A subtask runs with its parent, so its row offers a different set than a top-level task's. */
1059
- type TaskRowPlacement = 'task' | 'subtask';
1060
- interface ActionSubject {
1061
- status: string;
1062
- type: 'ai' | 'user';
1063
- }
1064
- /** The actions a task's row offers while a plan runs, in the order they are laid out. */
1065
- declare function taskRowActions(task: ActionSubject, placement?: TaskRowPlacement): TaskRowAction[];
1066
- /**
1067
- * One toggle in both directions: a done task is taken back, anything else is
1068
- * marked done. A second control for the reverse is one nobody remembers.
1069
- */
1070
- declare function markAction(task: {
1071
- status: string;
1072
- }): 'complete' | 'uncomplete';
1073
- /**
1074
- * The mark an action asks the session for, or null when it is not a mark.
1075
- * Skip has no request of its own: a skipped task is marked complete, so the
1076
- * run moves on past it.
1077
- */
1078
- declare function markRequestFor(action: string): 'complete' | 'uncomplete' | null;
1079
- /** Change versus ops can still be flipped (ADR-0020): an AI task that has not started. */
1080
- declare function opsEditable(task: ActionSubject): boolean;
1081
-
1082
- /**
1083
- * A task as both surfaces hold it, with the live state each tracks beside it
1084
- * (silence, approvals, isolation, the merge gate). Structural, because the TUI
1085
- * projects tasks into its own shape.
1086
- */
1087
- interface TaskRowSubject {
1088
- id: string;
1089
- order: number;
1090
- type: 'ai' | 'user';
1091
- status: string;
1092
- dependencies: readonly string[];
1093
- taskMode?: string;
1094
- ops?: boolean;
1095
- idleSince?: string | null;
1096
- awaitingReason?: AwaitingReason;
1097
- awaitingApproval?: number;
1098
- isolation?: TaskRowIsolation | null;
1099
- mergeGate?: readonly string[];
1100
- forcedPastGate?: readonly string[];
1101
- }
1102
- interface TaskRowIsolation {
1103
- state: TaskIsolationState;
1104
- repos?: string[];
1105
- conflictRepo?: string;
1106
- conflictFiles?: string[];
1107
- repair?: {
1108
- attempt: number;
1109
- limit: number;
1110
- };
1111
- repairedFiles?: string[];
1112
- }
1113
- interface TaskRowContext {
1114
- /** Set for a subtask: it is labelled by its dotted order. */
1115
- parent?: {
1116
- order: number;
1117
- } | null;
1118
- /** Which action set the row offers; a row with a parent is a subtask's unless told otherwise. */
1119
- placement?: TaskRowPlacement;
1120
- /** Order of each task a dependency or gate may name; one missing from it is shown by id. */
1121
- orderOf?: ReadonlyMap<string, number>;
1122
- /** The modes the task's runner declares; autonomy is a tag on one of them (ADR-0001). */
1123
- modes?: readonly {
1124
- id: string;
1125
- autonomous?: boolean;
1126
- }[];
1127
- }
1128
- /** Whether the row stands for an AI task, a manual one, or an ops task (ADR-0020). */
1129
- type TaskRowKind = 'ai' | 'user' | 'ops';
1130
- interface TaskRowView {
1131
- /** "2", or "2.1" for a subtask. */
1132
- orderLabel: string;
1133
- kind: TaskRowKind;
1134
- status: TaskStatusKind;
1135
- /** A runner is live behind it — `quiet` included. */
1136
- running: boolean;
1137
- /** What an awaiting task waits on, in sentence case; null when nothing was saved. */
1138
- awaiting: string | null;
1139
- /** Runner requests waiting on the user, in sentence case; null when none do. */
1140
- approvals: string | null;
1141
- /** The task's mode is tagged autonomous: it runs without permission prompts. */
1142
- autonomous: boolean;
1143
- /** The repos its isolated work changed, by path; empty for a group of one. */
1144
- repos: string[];
1145
- /** Integration stopped on a conflict: the one isolation state that needs the user. */
1146
- conflict: {
1147
- repo: string | null;
1148
- files: string | null;
1149
- } | null;
1150
- /** A conflict repair in flight (ADR-0015) — progress, not a blocker. */
1151
- repairing: {
1152
- files: string | null;
1153
- attempt: {
1154
- attempt: number;
1155
- limit: number;
1156
- } | null;
1157
- } | null;
1158
- /** The files a conflict repair was started for; `landed` once the task is integrated. */
1159
- repaired: {
1160
- files: string;
1161
- landed: boolean;
1162
- } | null;
1163
- /** The dependencies, by reference, whose work is not merged into the user's branch yet. */
1164
- mergeGate: string[] | null;
1165
- /** An ops task changed tracked files in the user's checkout and nothing was committed. */
1166
- opsChangedFiles: boolean;
1167
- /** The dependencies, by title, a force start went past the merge gate of. */
1168
- forcedPastGate: readonly string[] | null;
1169
- /** The task's dependencies, by reference. */
1170
- dependencies: string[];
1171
- /** What the row offers while a plan runs. */
1172
- actions: TaskRowAction[];
1173
- /** The one mark its toggle sets. */
1174
- mark: 'complete' | 'uncomplete';
1175
- opsEditable: boolean;
1176
- }
1177
- /** The repos a task changed, for a row that names them; none for a group of one. */
1178
- declare const namedRepos: (repos: readonly string[] | undefined) => string[];
1179
- /**
1180
- * Everything a plan row says about one task, decided once: each surface picks
1181
- * its own words, glyphs and casing for these facts, and derives none of them.
1182
- */
1183
- declare function taskRowView(task: TaskRowSubject, context?: TaskRowContext): TaskRowView;
1184
-
1185
- interface Named {
1186
- id: string;
1187
- order: number;
1188
- title: string;
1189
- subtasks?: readonly Named[];
1190
- }
1191
- /** Each id as "#N title", subtasks included; one the plan no longer holds stays a bare id. */
1192
- declare function titledRefs(ids: readonly string[], tasks: readonly Named[]): string[];
1193
- /**
1194
- * What removing a task does to the tasks that depend on it, or null when none
1195
- * do. Named rather than counted: the removal rewrites their dependency lists,
1196
- * and a bare "Remove task?" would hide that.
1197
- */
1198
- declare function dependentsNotice(dependents: readonly {
1199
- order: number;
1200
- title: string;
1201
- }[]): string | null;
1202
- /**
1203
- * What a start past a merge gate is asked with (ADR-0020): the work the task
1204
- * would act without, named. `subject` is how the asking surface refers to the
1205
- * task — "It" under a title that already names it.
1206
- */
1207
- declare function pastGateConfirmation(unmerged: readonly string[], subject?: string): string;
1208
- interface NewTaskFields {
1209
- title: string;
1210
- description: string;
1211
- prompt: string;
1212
- type: 'ai';
1213
- }
1214
- /**
1215
- * What a hand-added task starts as: an AI task whose description is its title
1216
- * and whose prompt, unless one was typed, is too. Null for a title with nothing
1217
- * in it, rather than a nameless task. Assignments are left for the session to
1218
- * derive from the runner's catalog.
1219
- */
1220
- declare function newTaskFields(title: string, prompt?: string): NewTaskFields | null;
1221
-
1222
- export { type TaskRowView as $, type ApplyTaskOpsResult as A, type SubagentChild as B, CHECKPOINT_TRUNCATE_LENGTH as C, type DiffRow as D, EMPTY_CONVERSATION as E, type SubagentStatus as F, type GatedConversation as G, type SurfacePlan as H, type SurfacePlanState as I, type SurfaceTask as J, type TaskLogEvent as K, type LocalEntry as L, type MergeGateView as M, NOT_STARTED as N, type OutputPreview as O, type PlanBlock as P, type TaskLogView as Q, type TaskOp as R, type SerializedConversationMessage as S, type TakenPrompt as T, type TaskRef as U, type TaskRowAction as V, type TaskRowContext as W, type TaskRowIsolation as X, type TaskRowKind as Y, type TaskRowPlacement as Z, type TaskRowSubject as _, type ApprovalBlock as a, truncateCheckpointSummary as a$, type TaskStatusKind as a0, type ThinkingDisplayBlock as a1, type ToolBlock as a2, type ToolHeadline as a3, type ToolStatus as a4, type TurnGate as a5, type UsageBlock as a6, aheadOfDraft as a7, applyTaskOps as a8, approvalLabel as a9, opsEditable as aA, outputLines as aB, outputPreview as aC, parseTaskOpsJson as aD, pastGateConfirmation as aE, reduceConversation as aF, reduceTaskLog as aG, replayTaskLog as aH, runnerToolSubject as aI, serializePlan as aJ, serializeTask as aK, serializeTaskStatus as aL, skillTokens as aM, stopTurn as aN, summarizeToolCall as aO, surfacePlan as aP, surfacePlanState as aQ, taskLogForSurface as aR, taskRowActions as aS, taskRowView as aT, taskStartedNotice as aU, taskStatusKind as aV, textHasTaskOps as aW, titledRefs as aX, toTaskLogEvent as aY, toolHeadline as aZ, trimToolOutput as a_, awaitingLabel as aa, canMergeTasks as ab, canSetDependencies as ac, canSplitTask as ad, capConflictFiles as ae, classifyOutcome as af, coalesceTaskLog as ag, dependencyCandidates as ah, dependentsNotice as ai, dependentsOf as aj, diffRows as ak, diffStat as al, diffSummary as am, digestTaskLog as an, drainNext as ao, executionSummary as ap, followTurn as aq, fromTranscript as ar, hasHiddenDetail as as, holdPrompt as at, isTaskRunning as au, loadedSkillTokens as av, markAction as aw, markRequestFor as ax, namedRepos as ay, newTaskFields as az, type ApprovalStatus as b, unsendAll as b0, unsendLatest as b1, type ConversationInput as c, type ConversationView as d, type DiffRowKind as e, type DiffStat as f, type DisplayBlock as g, EMPTY_HOLD as h, EMPTY_TASK_LOG as i, type EditCatalog as j, type MessageBlock as k, type MessageRole as l, NO_TURN as m, type NewTaskFields as n, type PlanMarkerStatus as o, type PromptHold as p, type SerializedPlan as q, type SerializedQueuedMessage as r, type SerializedTask as s, type SerializedTaskStatus as t, type SessionBroadcaster as u, type SessionMessage as v, type SessionNotice as w, type SkillLoadBlock as x, type SkillToken as y, type SubagentBlock as z };