@ordewell/core 0.4.23 → 0.5.1
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.
- package/dist/{ITerminalRunner-CuNYBnqK.d.mts → ITerminalRunner-DCjsa2-I.d.mts} +31 -1
- package/dist/{ITerminalRunner-Da1gIAFX.d.ts → ITerminalRunner-H1yT8LTy.d.ts} +31 -1
- package/dist/{ModeResolver-mtIWrLXn.d.mts → ModeResolver-DVJ7HV3k.d.mts} +1 -1
- package/dist/{ModeResolver-Ob-ihQbI.d.ts → ModeResolver-Dkig8ghQ.d.ts} +1 -1
- package/dist/Task-BxQkPlXO.d.mts +664 -0
- package/dist/Task-BxQkPlXO.d.ts +664 -0
- package/dist/{chunk-O2MFTRHA.mjs → chunk-GWPIYDQW.mjs} +29 -5
- package/dist/chunk-GWPIYDQW.mjs.map +1 -0
- package/dist/{chunk-T4KGVP4N.mjs → chunk-JVMDEHRQ.mjs} +1 -1
- package/dist/chunk-JVMDEHRQ.mjs.map +1 -0
- package/dist/chunk-T2S5O36I.mjs +103 -0
- package/dist/chunk-T2S5O36I.mjs.map +1 -0
- package/dist/{chunk-MKUTJDT2.mjs → chunk-XWOUIA6A.mjs} +2 -2
- package/dist/index.d.mts +614 -104
- package/dist/index.d.ts +614 -104
- package/dist/index.js +3780 -1209
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3747 -1291
- package/dist/index.mjs.map +1 -1
- package/dist/order-labels.d.mts +1 -1
- package/dist/order-labels.d.ts +1 -1
- package/dist/{parsing-BJoHbA-t.d.ts → parsing-CF_grC29.d.ts} +2 -2
- package/dist/{parsing-BWfpLch9.d.mts → parsing-DRp4dPC0.d.mts} +2 -2
- package/dist/parsing.d.mts +3 -3
- package/dist/parsing.d.ts +3 -3
- package/dist/parsing.js.map +1 -1
- package/dist/parsing.mjs +2 -2
- package/dist/{plan-utils-DJm2a7Zp.d.ts → plan-utils-CkNbqAmS.d.ts} +63 -5
- package/dist/{plan-utils-s6VL8NDF.d.mts → plan-utils-CtB3_Ovf.d.mts} +63 -5
- package/dist/plan-utils.d.mts +3 -3
- package/dist/plan-utils.d.ts +3 -3
- package/dist/plan-utils.js +7 -0
- package/dist/plan-utils.js.map +1 -1
- package/dist/plan-utils.mjs +6 -2
- package/dist/testing.d.mts +93 -3
- package/dist/testing.d.ts +93 -3
- package/dist/testing.js +200 -0
- package/dist/testing.js.map +1 -1
- package/dist/testing.mjs +179 -0
- package/dist/testing.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/Task-4rDGr8Su.d.mts +0 -271
- package/dist/Task-4rDGr8Su.d.ts +0 -271
- package/dist/chunk-O2MFTRHA.mjs.map +0 -1
- package/dist/chunk-T4KGVP4N.mjs.map +0 -1
- /package/dist/{chunk-MKUTJDT2.mjs.map → chunk-XWOUIA6A.mjs.map} +0 -0
package/dist/Task-4rDGr8Su.d.mts
DELETED
|
@@ -1,271 +0,0 @@
|
|
|
1
|
-
interface UserStep {
|
|
2
|
-
order: number;
|
|
3
|
-
instruction: string;
|
|
4
|
-
completed: boolean;
|
|
5
|
-
}
|
|
6
|
-
/** One deterministic signal gathered while verifying a completed task. */
|
|
7
|
-
interface VerificationCheck {
|
|
8
|
-
name: 'exit_code' | 'completion_marker' | 'manual';
|
|
9
|
-
passed: boolean;
|
|
10
|
-
/** A check that did not apply. Skipped checks don't affect the verdict. */
|
|
11
|
-
skipped: boolean;
|
|
12
|
-
detail: string;
|
|
13
|
-
}
|
|
14
|
-
/** Evidence-based verdict for a completed task. Single end-to-end outcome produced by verification. */
|
|
15
|
-
interface Verdict {
|
|
16
|
-
outcome: 'pass' | 'fail';
|
|
17
|
-
reason: string;
|
|
18
|
-
checks: VerificationCheck[];
|
|
19
|
-
decidedAt: string;
|
|
20
|
-
}
|
|
21
|
-
interface TaskOutputSummary {
|
|
22
|
-
reviewReason: string;
|
|
23
|
-
logTail: string;
|
|
24
|
-
capturedAt: string;
|
|
25
|
-
}
|
|
26
|
-
type TaskType = 'ai' | 'user';
|
|
27
|
-
type TaskStatus = 'pending' | 'approved' | 'in_progress' | 'completed' | 'failed' | 'blocked' | 'awaiting_user';
|
|
28
|
-
type TaskMode = string;
|
|
29
|
-
interface TaskModelAssignment {
|
|
30
|
-
modelId: string;
|
|
31
|
-
modelLabel: string;
|
|
32
|
-
thinkingEffort?: string;
|
|
33
|
-
/**
|
|
34
|
-
* All variant ids the model offered when this assignment was made. Carried
|
|
35
|
-
* on the assignment because runners need it at spawn time (opencode's TUI
|
|
36
|
-
* only honors an assigned variant when the others are config-disabled) and
|
|
37
|
-
* the discovery catalog isn't available there.
|
|
38
|
-
*/
|
|
39
|
-
availableVariants?: string[];
|
|
40
|
-
}
|
|
41
|
-
type RunnerId = string;
|
|
42
|
-
interface Task {
|
|
43
|
-
id: string;
|
|
44
|
-
order: number;
|
|
45
|
-
title: string;
|
|
46
|
-
description: string;
|
|
47
|
-
type: TaskType;
|
|
48
|
-
status: TaskStatus;
|
|
49
|
-
dependencies: string[];
|
|
50
|
-
prompt?: string;
|
|
51
|
-
userSteps?: UserStep[];
|
|
52
|
-
subtasks: Task[];
|
|
53
|
-
verdict?: Verdict;
|
|
54
|
-
outputSummary?: TaskOutputSummary;
|
|
55
|
-
assignedModel?: TaskModelAssignment;
|
|
56
|
-
assignedRunner: RunnerId;
|
|
57
|
-
thinkingEffort?: string;
|
|
58
|
-
taskMode?: TaskMode;
|
|
59
|
-
completionMarker: string;
|
|
60
|
-
autonomy?: 'AFK' | 'HITL';
|
|
61
|
-
sliceType?: 'HITL' | 'AFK';
|
|
62
|
-
userStoriesCovered?: string[];
|
|
63
|
-
}
|
|
64
|
-
interface DiscoveredMode {
|
|
65
|
-
id: string;
|
|
66
|
-
label: string;
|
|
67
|
-
description: string;
|
|
68
|
-
}
|
|
69
|
-
type ResearchToolType = 'read_file' | 'read_files' | 'glob' | 'grep' | 'find_symbol' | 'list_dir' | 'bash' | 'fetch' | 'web_search' | 'spawn_research_agent'
|
|
70
|
-
/**
|
|
71
|
-
* A tool belonging to a harness planner's own toolbox (ADR-0009) that has no
|
|
72
|
-
* Ordewell equivalent — Edit, WebFetch, TodoWrite, whatever a coding agent
|
|
73
|
-
* ships next. The real name travels in `toolLabel` rather than being
|
|
74
|
-
* relabelled as a tool it is not; the union stays closed so the
|
|
75
|
-
* exhaustiveness checks in every surface's icon/label switch survive.
|
|
76
|
-
*/
|
|
77
|
-
| 'agent_tool';
|
|
78
|
-
/**
|
|
79
|
-
* What happened when a research tool call ran, for honest per-surface
|
|
80
|
-
* rendering. The broadcast seam carries this on every `research_step_done` so
|
|
81
|
-
* surfaces do not have to pattern-match refusal text to tell a refused `rm`
|
|
82
|
-
* from a successful `rm` — the old render path flipped a `✓` for both.
|
|
83
|
-
*/
|
|
84
|
-
type ResearchStepOutcome = 'success' | 'failure' | 'refused' | 'denied' | 'not_executed';
|
|
85
|
-
interface ResearchStep {
|
|
86
|
-
id: string;
|
|
87
|
-
tool: ResearchToolType;
|
|
88
|
-
/** The tool's own name when it came from a harness planner — always set for `agent_tool`. */
|
|
89
|
-
toolLabel?: string;
|
|
90
|
-
args: string;
|
|
91
|
-
result: string;
|
|
92
|
-
success: boolean;
|
|
93
|
-
outcome: ResearchStepOutcome;
|
|
94
|
-
/** The model's tool_call id, so a surface can match `tool_result` to the
|
|
95
|
-
* pending `tool_call` it announced — robust under parallel same-tool rounds. */
|
|
96
|
-
toolCallId?: string;
|
|
97
|
-
timestamp: string;
|
|
98
|
-
thinkingText?: string;
|
|
99
|
-
}
|
|
100
|
-
interface UserPromptEntry {
|
|
101
|
-
id: string;
|
|
102
|
-
type: 'user_prompt' | 'system';
|
|
103
|
-
content: string;
|
|
104
|
-
timestamp: string;
|
|
105
|
-
}
|
|
106
|
-
type ResearchLogEntry = ResearchStep | UserPromptEntry;
|
|
107
|
-
interface ResearchProgress {
|
|
108
|
-
type: 'thinking' | 'tool_call' | 'tool_result' | 'plan_token' | 'interrupted' | 'liveness';
|
|
109
|
-
text?: string;
|
|
110
|
-
tool?: string;
|
|
111
|
-
/** Harness planners (ADR-0009): the agent's own name for a tool Ordewell has no member for. */
|
|
112
|
-
toolLabel?: string;
|
|
113
|
-
toolArgs?: string;
|
|
114
|
-
toolResult?: string;
|
|
115
|
-
planToken?: string;
|
|
116
|
-
step?: ResearchStep;
|
|
117
|
-
/** The model's tool_call id, threaded on tool_call and tool_result so a
|
|
118
|
-
* surface can match the result to its pending call — robust under parallel
|
|
119
|
-
* same-tool rounds where LIFO-by-name matching mislabels summaries. */
|
|
120
|
-
toolCallId?: string;
|
|
121
|
-
/** Present when this event originates from (or reports on) one spawned research subagent (issue #34). */
|
|
122
|
-
subagentId?: string;
|
|
123
|
-
}
|
|
124
|
-
interface ThinkingBlock {
|
|
125
|
-
id: string;
|
|
126
|
-
text: string;
|
|
127
|
-
}
|
|
128
|
-
interface StreamThinkingEvent {
|
|
129
|
-
type: 'thinking';
|
|
130
|
-
block: ThinkingBlock;
|
|
131
|
-
}
|
|
132
|
-
interface StreamStepEvent {
|
|
133
|
-
type: 'step';
|
|
134
|
-
step: ResearchStep;
|
|
135
|
-
}
|
|
136
|
-
type StreamEvent = StreamThinkingEvent | StreamStepEvent;
|
|
137
|
-
interface DiscoveredModel {
|
|
138
|
-
modelId: string;
|
|
139
|
-
modelLabel: string;
|
|
140
|
-
runnerProvider?: string;
|
|
141
|
-
/**
|
|
142
|
-
* Human-facing provider name as the runner itself reports it (e.g.
|
|
143
|
-
* "OpenCode Zen" for `runnerProvider: 'opencode'`). Populated from the
|
|
144
|
-
* runner's own provider catalog when available; when absent the UI derives a
|
|
145
|
-
* label from `runnerProvider` by title-casing.
|
|
146
|
-
*/
|
|
147
|
-
runnerProviderLabel?: string;
|
|
148
|
-
/**
|
|
149
|
-
* The runner whose catalog listed this model. Stamped once, at the single
|
|
150
|
-
* `ModelDiscovery.discover` choke point, so a flat cross-runner list can
|
|
151
|
-
* still say where each entry came from — `runnerProvider` alone cannot:
|
|
152
|
-
* OpenCode reports most of its catalog as `openrouter`, which names the
|
|
153
|
-
* serving backend, not the agent Ordewell would spawn.
|
|
154
|
-
*/
|
|
155
|
-
runnerId?: string;
|
|
156
|
-
/** The runner's display name (`OpenCode`), from its manifest. */
|
|
157
|
-
runnerLabel?: string;
|
|
158
|
-
variants: {
|
|
159
|
-
id: string;
|
|
160
|
-
label: string;
|
|
161
|
-
}[];
|
|
162
|
-
}
|
|
163
|
-
type PlanStatus = 'draft' | 'approved' | 'rejected' | 'running' | 'completed';
|
|
164
|
-
/**
|
|
165
|
-
* One entry of the planner's persisted dialogue (ADR-0002). The single source
|
|
166
|
-
* of truth for both UI redisplay and conversational context. Tool-call results
|
|
167
|
-
* are NOT stored here — they live in the AI service's tool-use history;
|
|
168
|
-
* `researchLog` remains the persisted tool trace for the UI.
|
|
169
|
-
*/
|
|
170
|
-
interface ConversationMessage {
|
|
171
|
-
role: 'user' | 'assistant';
|
|
172
|
-
content: string;
|
|
173
|
-
timestamp: string;
|
|
174
|
-
/**
|
|
175
|
-
* Timeline marker: 'plan_generated' records the point in the dialogue where
|
|
176
|
-
* the plan was committed (the UI anchors the plan card there on restore);
|
|
177
|
-
* 'system' is a host-injected notice. Absent for ordinary chat turns, so
|
|
178
|
-
* sessions saved before markers existed degrade gracefully.
|
|
179
|
-
*/
|
|
180
|
-
kind?: 'plan_generated' | 'system';
|
|
181
|
-
}
|
|
182
|
-
interface QueuedMessage {
|
|
183
|
-
id: string;
|
|
184
|
-
text: string;
|
|
185
|
-
timestamp: string;
|
|
186
|
-
}
|
|
187
|
-
interface PlanModificationWarnings {
|
|
188
|
-
deletedCompleted: string[];
|
|
189
|
-
changedCompleted: string[];
|
|
190
|
-
deletedInProgress: string[];
|
|
191
|
-
modifiedInProgress: string[];
|
|
192
|
-
brokenDependencies: string[];
|
|
193
|
-
}
|
|
194
|
-
declare function emptyWarnings(): PlanModificationWarnings;
|
|
195
|
-
interface LegacyPlanState {
|
|
196
|
-
tasks: Task[];
|
|
197
|
-
generatedAt: string;
|
|
198
|
-
status: PlanStatus;
|
|
199
|
-
runners: RunnerId[];
|
|
200
|
-
lastUpdated: string;
|
|
201
|
-
researchLog?: ResearchLogEntry[];
|
|
202
|
-
/** The planner dialogue — user messages and assistant messages, in order (ADR-0002). */
|
|
203
|
-
conversationHistory?: ConversationMessage[];
|
|
204
|
-
/** Full markdown PRD once written by the planner (PRD mode), also saved to .scratch/<slug>/PRD.md. */
|
|
205
|
-
prdMarkdown?: string;
|
|
206
|
-
/** Follow-ups queued while tasks execute — applied as plan modifications between batches. */
|
|
207
|
-
queuedMessages?: QueuedMessage[];
|
|
208
|
-
}
|
|
209
|
-
interface Message {
|
|
210
|
-
id: string;
|
|
211
|
-
role: 'user' | 'planner' | 'system';
|
|
212
|
-
content: string;
|
|
213
|
-
timestamp: number;
|
|
214
|
-
}
|
|
215
|
-
interface TaskSnapshot extends Task {
|
|
216
|
-
completedAt: number;
|
|
217
|
-
verdict?: Verdict;
|
|
218
|
-
retryCount: number;
|
|
219
|
-
finalized: boolean;
|
|
220
|
-
}
|
|
221
|
-
type PlanState = {
|
|
222
|
-
phase: 'planning';
|
|
223
|
-
history: Message[];
|
|
224
|
-
message: string;
|
|
225
|
-
pendingTasks: Task[];
|
|
226
|
-
} | {
|
|
227
|
-
phase: 'executing';
|
|
228
|
-
history: Message[];
|
|
229
|
-
message: string;
|
|
230
|
-
executionLog: TaskSnapshot[];
|
|
231
|
-
pendingTasks: Task[];
|
|
232
|
-
goal: string;
|
|
233
|
-
runners: string[];
|
|
234
|
-
status: PlanStatus;
|
|
235
|
-
};
|
|
236
|
-
declare function migratePlanState(raw: unknown): PlanState;
|
|
237
|
-
declare function migrateLegacyPlan(legacy: LegacyPlanState): PlanState;
|
|
238
|
-
|
|
239
|
-
declare function createTask(overrides?: Partial<Task>): Task;
|
|
240
|
-
declare function createEmptyPlan(): LegacyPlanState;
|
|
241
|
-
declare function flattenTasks(tasks: Task[]): Task[];
|
|
242
|
-
/** A flattened task with the parent it hangs under, null for a top-level task. */
|
|
243
|
-
interface TaskWithParent {
|
|
244
|
-
task: Task;
|
|
245
|
-
parent: Task | null;
|
|
246
|
-
}
|
|
247
|
-
declare function flattenTasksWithParents(tasks: Task[]): TaskWithParent[];
|
|
248
|
-
declare function migrateTask(task: Record<string, unknown>): Task;
|
|
249
|
-
declare function addTaskToPlan(tasks: Task[], partial: Partial<Task>): Task[];
|
|
250
|
-
declare function removeTaskFromPlan(tasks: Task[], taskId: string): Task[];
|
|
251
|
-
declare function updateTaskInPlan(tasks: Task[], taskId: string, changes: Partial<Task>): Task[];
|
|
252
|
-
declare function renumberTasks(tasks: Task[]): Task[];
|
|
253
|
-
declare function validateModifiedPlan(original: Task[], modified: Task[]): PlanModificationWarnings;
|
|
254
|
-
interface ActiveTaskSession {
|
|
255
|
-
id: string;
|
|
256
|
-
taskId: string;
|
|
257
|
-
}
|
|
258
|
-
interface ValidationResult {
|
|
259
|
-
valid: boolean;
|
|
260
|
-
errors: string[];
|
|
261
|
-
}
|
|
262
|
-
interface ValidationContext {
|
|
263
|
-
executionLog: TaskSnapshot[];
|
|
264
|
-
oldPending: Task[];
|
|
265
|
-
newPending: Task[];
|
|
266
|
-
activeSessions: Map<string, ActiveTaskSession>;
|
|
267
|
-
}
|
|
268
|
-
type ValidationCheck = (ctx: ValidationContext) => ValidationResult;
|
|
269
|
-
declare function warningsText(w: PlanModificationWarnings): string | null;
|
|
270
|
-
|
|
271
|
-
export { type ActiveTaskSession as A, emptyWarnings as B, type ConversationMessage as C, type DiscoveredMode as D, flattenTasks as E, flattenTasksWithParents as F, migrateLegacyPlan as G, migratePlanState as H, migrateTask as I, removeTaskFromPlan as J, renumberTasks as K, type LegacyPlanState as L, type Message as M, updateTaskInPlan as N, validateModifiedPlan as O, type PlanModificationWarnings as P, type QueuedMessage as Q, type ResearchLogEntry as R, type StreamEvent as S, type Task as T, type UserPromptEntry as U, type ValidationCheck as V, warningsText as W, type DiscoveredModel as a, type PlanState as b, type PlanStatus as c, type ResearchProgress as d, type ResearchStep as e, type ResearchStepOutcome as f, type ResearchToolType as g, type RunnerId as h, type StreamStepEvent as i, type StreamThinkingEvent as j, type TaskMode as k, type TaskModelAssignment as l, type TaskOutputSummary as m, type TaskSnapshot as n, type TaskStatus as o, type TaskType as p, type TaskWithParent as q, type ThinkingBlock as r, type UserStep as s, type ValidationContext as t, type ValidationResult as u, type Verdict as v, type VerificationCheck as w, addTaskToPlan as x, createEmptyPlan as y, createTask as z };
|
package/dist/Task-4rDGr8Su.d.ts
DELETED
|
@@ -1,271 +0,0 @@
|
|
|
1
|
-
interface UserStep {
|
|
2
|
-
order: number;
|
|
3
|
-
instruction: string;
|
|
4
|
-
completed: boolean;
|
|
5
|
-
}
|
|
6
|
-
/** One deterministic signal gathered while verifying a completed task. */
|
|
7
|
-
interface VerificationCheck {
|
|
8
|
-
name: 'exit_code' | 'completion_marker' | 'manual';
|
|
9
|
-
passed: boolean;
|
|
10
|
-
/** A check that did not apply. Skipped checks don't affect the verdict. */
|
|
11
|
-
skipped: boolean;
|
|
12
|
-
detail: string;
|
|
13
|
-
}
|
|
14
|
-
/** Evidence-based verdict for a completed task. Single end-to-end outcome produced by verification. */
|
|
15
|
-
interface Verdict {
|
|
16
|
-
outcome: 'pass' | 'fail';
|
|
17
|
-
reason: string;
|
|
18
|
-
checks: VerificationCheck[];
|
|
19
|
-
decidedAt: string;
|
|
20
|
-
}
|
|
21
|
-
interface TaskOutputSummary {
|
|
22
|
-
reviewReason: string;
|
|
23
|
-
logTail: string;
|
|
24
|
-
capturedAt: string;
|
|
25
|
-
}
|
|
26
|
-
type TaskType = 'ai' | 'user';
|
|
27
|
-
type TaskStatus = 'pending' | 'approved' | 'in_progress' | 'completed' | 'failed' | 'blocked' | 'awaiting_user';
|
|
28
|
-
type TaskMode = string;
|
|
29
|
-
interface TaskModelAssignment {
|
|
30
|
-
modelId: string;
|
|
31
|
-
modelLabel: string;
|
|
32
|
-
thinkingEffort?: string;
|
|
33
|
-
/**
|
|
34
|
-
* All variant ids the model offered when this assignment was made. Carried
|
|
35
|
-
* on the assignment because runners need it at spawn time (opencode's TUI
|
|
36
|
-
* only honors an assigned variant when the others are config-disabled) and
|
|
37
|
-
* the discovery catalog isn't available there.
|
|
38
|
-
*/
|
|
39
|
-
availableVariants?: string[];
|
|
40
|
-
}
|
|
41
|
-
type RunnerId = string;
|
|
42
|
-
interface Task {
|
|
43
|
-
id: string;
|
|
44
|
-
order: number;
|
|
45
|
-
title: string;
|
|
46
|
-
description: string;
|
|
47
|
-
type: TaskType;
|
|
48
|
-
status: TaskStatus;
|
|
49
|
-
dependencies: string[];
|
|
50
|
-
prompt?: string;
|
|
51
|
-
userSteps?: UserStep[];
|
|
52
|
-
subtasks: Task[];
|
|
53
|
-
verdict?: Verdict;
|
|
54
|
-
outputSummary?: TaskOutputSummary;
|
|
55
|
-
assignedModel?: TaskModelAssignment;
|
|
56
|
-
assignedRunner: RunnerId;
|
|
57
|
-
thinkingEffort?: string;
|
|
58
|
-
taskMode?: TaskMode;
|
|
59
|
-
completionMarker: string;
|
|
60
|
-
autonomy?: 'AFK' | 'HITL';
|
|
61
|
-
sliceType?: 'HITL' | 'AFK';
|
|
62
|
-
userStoriesCovered?: string[];
|
|
63
|
-
}
|
|
64
|
-
interface DiscoveredMode {
|
|
65
|
-
id: string;
|
|
66
|
-
label: string;
|
|
67
|
-
description: string;
|
|
68
|
-
}
|
|
69
|
-
type ResearchToolType = 'read_file' | 'read_files' | 'glob' | 'grep' | 'find_symbol' | 'list_dir' | 'bash' | 'fetch' | 'web_search' | 'spawn_research_agent'
|
|
70
|
-
/**
|
|
71
|
-
* A tool belonging to a harness planner's own toolbox (ADR-0009) that has no
|
|
72
|
-
* Ordewell equivalent — Edit, WebFetch, TodoWrite, whatever a coding agent
|
|
73
|
-
* ships next. The real name travels in `toolLabel` rather than being
|
|
74
|
-
* relabelled as a tool it is not; the union stays closed so the
|
|
75
|
-
* exhaustiveness checks in every surface's icon/label switch survive.
|
|
76
|
-
*/
|
|
77
|
-
| 'agent_tool';
|
|
78
|
-
/**
|
|
79
|
-
* What happened when a research tool call ran, for honest per-surface
|
|
80
|
-
* rendering. The broadcast seam carries this on every `research_step_done` so
|
|
81
|
-
* surfaces do not have to pattern-match refusal text to tell a refused `rm`
|
|
82
|
-
* from a successful `rm` — the old render path flipped a `✓` for both.
|
|
83
|
-
*/
|
|
84
|
-
type ResearchStepOutcome = 'success' | 'failure' | 'refused' | 'denied' | 'not_executed';
|
|
85
|
-
interface ResearchStep {
|
|
86
|
-
id: string;
|
|
87
|
-
tool: ResearchToolType;
|
|
88
|
-
/** The tool's own name when it came from a harness planner — always set for `agent_tool`. */
|
|
89
|
-
toolLabel?: string;
|
|
90
|
-
args: string;
|
|
91
|
-
result: string;
|
|
92
|
-
success: boolean;
|
|
93
|
-
outcome: ResearchStepOutcome;
|
|
94
|
-
/** The model's tool_call id, so a surface can match `tool_result` to the
|
|
95
|
-
* pending `tool_call` it announced — robust under parallel same-tool rounds. */
|
|
96
|
-
toolCallId?: string;
|
|
97
|
-
timestamp: string;
|
|
98
|
-
thinkingText?: string;
|
|
99
|
-
}
|
|
100
|
-
interface UserPromptEntry {
|
|
101
|
-
id: string;
|
|
102
|
-
type: 'user_prompt' | 'system';
|
|
103
|
-
content: string;
|
|
104
|
-
timestamp: string;
|
|
105
|
-
}
|
|
106
|
-
type ResearchLogEntry = ResearchStep | UserPromptEntry;
|
|
107
|
-
interface ResearchProgress {
|
|
108
|
-
type: 'thinking' | 'tool_call' | 'tool_result' | 'plan_token' | 'interrupted' | 'liveness';
|
|
109
|
-
text?: string;
|
|
110
|
-
tool?: string;
|
|
111
|
-
/** Harness planners (ADR-0009): the agent's own name for a tool Ordewell has no member for. */
|
|
112
|
-
toolLabel?: string;
|
|
113
|
-
toolArgs?: string;
|
|
114
|
-
toolResult?: string;
|
|
115
|
-
planToken?: string;
|
|
116
|
-
step?: ResearchStep;
|
|
117
|
-
/** The model's tool_call id, threaded on tool_call and tool_result so a
|
|
118
|
-
* surface can match the result to its pending call — robust under parallel
|
|
119
|
-
* same-tool rounds where LIFO-by-name matching mislabels summaries. */
|
|
120
|
-
toolCallId?: string;
|
|
121
|
-
/** Present when this event originates from (or reports on) one spawned research subagent (issue #34). */
|
|
122
|
-
subagentId?: string;
|
|
123
|
-
}
|
|
124
|
-
interface ThinkingBlock {
|
|
125
|
-
id: string;
|
|
126
|
-
text: string;
|
|
127
|
-
}
|
|
128
|
-
interface StreamThinkingEvent {
|
|
129
|
-
type: 'thinking';
|
|
130
|
-
block: ThinkingBlock;
|
|
131
|
-
}
|
|
132
|
-
interface StreamStepEvent {
|
|
133
|
-
type: 'step';
|
|
134
|
-
step: ResearchStep;
|
|
135
|
-
}
|
|
136
|
-
type StreamEvent = StreamThinkingEvent | StreamStepEvent;
|
|
137
|
-
interface DiscoveredModel {
|
|
138
|
-
modelId: string;
|
|
139
|
-
modelLabel: string;
|
|
140
|
-
runnerProvider?: string;
|
|
141
|
-
/**
|
|
142
|
-
* Human-facing provider name as the runner itself reports it (e.g.
|
|
143
|
-
* "OpenCode Zen" for `runnerProvider: 'opencode'`). Populated from the
|
|
144
|
-
* runner's own provider catalog when available; when absent the UI derives a
|
|
145
|
-
* label from `runnerProvider` by title-casing.
|
|
146
|
-
*/
|
|
147
|
-
runnerProviderLabel?: string;
|
|
148
|
-
/**
|
|
149
|
-
* The runner whose catalog listed this model. Stamped once, at the single
|
|
150
|
-
* `ModelDiscovery.discover` choke point, so a flat cross-runner list can
|
|
151
|
-
* still say where each entry came from — `runnerProvider` alone cannot:
|
|
152
|
-
* OpenCode reports most of its catalog as `openrouter`, which names the
|
|
153
|
-
* serving backend, not the agent Ordewell would spawn.
|
|
154
|
-
*/
|
|
155
|
-
runnerId?: string;
|
|
156
|
-
/** The runner's display name (`OpenCode`), from its manifest. */
|
|
157
|
-
runnerLabel?: string;
|
|
158
|
-
variants: {
|
|
159
|
-
id: string;
|
|
160
|
-
label: string;
|
|
161
|
-
}[];
|
|
162
|
-
}
|
|
163
|
-
type PlanStatus = 'draft' | 'approved' | 'rejected' | 'running' | 'completed';
|
|
164
|
-
/**
|
|
165
|
-
* One entry of the planner's persisted dialogue (ADR-0002). The single source
|
|
166
|
-
* of truth for both UI redisplay and conversational context. Tool-call results
|
|
167
|
-
* are NOT stored here — they live in the AI service's tool-use history;
|
|
168
|
-
* `researchLog` remains the persisted tool trace for the UI.
|
|
169
|
-
*/
|
|
170
|
-
interface ConversationMessage {
|
|
171
|
-
role: 'user' | 'assistant';
|
|
172
|
-
content: string;
|
|
173
|
-
timestamp: string;
|
|
174
|
-
/**
|
|
175
|
-
* Timeline marker: 'plan_generated' records the point in the dialogue where
|
|
176
|
-
* the plan was committed (the UI anchors the plan card there on restore);
|
|
177
|
-
* 'system' is a host-injected notice. Absent for ordinary chat turns, so
|
|
178
|
-
* sessions saved before markers existed degrade gracefully.
|
|
179
|
-
*/
|
|
180
|
-
kind?: 'plan_generated' | 'system';
|
|
181
|
-
}
|
|
182
|
-
interface QueuedMessage {
|
|
183
|
-
id: string;
|
|
184
|
-
text: string;
|
|
185
|
-
timestamp: string;
|
|
186
|
-
}
|
|
187
|
-
interface PlanModificationWarnings {
|
|
188
|
-
deletedCompleted: string[];
|
|
189
|
-
changedCompleted: string[];
|
|
190
|
-
deletedInProgress: string[];
|
|
191
|
-
modifiedInProgress: string[];
|
|
192
|
-
brokenDependencies: string[];
|
|
193
|
-
}
|
|
194
|
-
declare function emptyWarnings(): PlanModificationWarnings;
|
|
195
|
-
interface LegacyPlanState {
|
|
196
|
-
tasks: Task[];
|
|
197
|
-
generatedAt: string;
|
|
198
|
-
status: PlanStatus;
|
|
199
|
-
runners: RunnerId[];
|
|
200
|
-
lastUpdated: string;
|
|
201
|
-
researchLog?: ResearchLogEntry[];
|
|
202
|
-
/** The planner dialogue — user messages and assistant messages, in order (ADR-0002). */
|
|
203
|
-
conversationHistory?: ConversationMessage[];
|
|
204
|
-
/** Full markdown PRD once written by the planner (PRD mode), also saved to .scratch/<slug>/PRD.md. */
|
|
205
|
-
prdMarkdown?: string;
|
|
206
|
-
/** Follow-ups queued while tasks execute — applied as plan modifications between batches. */
|
|
207
|
-
queuedMessages?: QueuedMessage[];
|
|
208
|
-
}
|
|
209
|
-
interface Message {
|
|
210
|
-
id: string;
|
|
211
|
-
role: 'user' | 'planner' | 'system';
|
|
212
|
-
content: string;
|
|
213
|
-
timestamp: number;
|
|
214
|
-
}
|
|
215
|
-
interface TaskSnapshot extends Task {
|
|
216
|
-
completedAt: number;
|
|
217
|
-
verdict?: Verdict;
|
|
218
|
-
retryCount: number;
|
|
219
|
-
finalized: boolean;
|
|
220
|
-
}
|
|
221
|
-
type PlanState = {
|
|
222
|
-
phase: 'planning';
|
|
223
|
-
history: Message[];
|
|
224
|
-
message: string;
|
|
225
|
-
pendingTasks: Task[];
|
|
226
|
-
} | {
|
|
227
|
-
phase: 'executing';
|
|
228
|
-
history: Message[];
|
|
229
|
-
message: string;
|
|
230
|
-
executionLog: TaskSnapshot[];
|
|
231
|
-
pendingTasks: Task[];
|
|
232
|
-
goal: string;
|
|
233
|
-
runners: string[];
|
|
234
|
-
status: PlanStatus;
|
|
235
|
-
};
|
|
236
|
-
declare function migratePlanState(raw: unknown): PlanState;
|
|
237
|
-
declare function migrateLegacyPlan(legacy: LegacyPlanState): PlanState;
|
|
238
|
-
|
|
239
|
-
declare function createTask(overrides?: Partial<Task>): Task;
|
|
240
|
-
declare function createEmptyPlan(): LegacyPlanState;
|
|
241
|
-
declare function flattenTasks(tasks: Task[]): Task[];
|
|
242
|
-
/** A flattened task with the parent it hangs under, null for a top-level task. */
|
|
243
|
-
interface TaskWithParent {
|
|
244
|
-
task: Task;
|
|
245
|
-
parent: Task | null;
|
|
246
|
-
}
|
|
247
|
-
declare function flattenTasksWithParents(tasks: Task[]): TaskWithParent[];
|
|
248
|
-
declare function migrateTask(task: Record<string, unknown>): Task;
|
|
249
|
-
declare function addTaskToPlan(tasks: Task[], partial: Partial<Task>): Task[];
|
|
250
|
-
declare function removeTaskFromPlan(tasks: Task[], taskId: string): Task[];
|
|
251
|
-
declare function updateTaskInPlan(tasks: Task[], taskId: string, changes: Partial<Task>): Task[];
|
|
252
|
-
declare function renumberTasks(tasks: Task[]): Task[];
|
|
253
|
-
declare function validateModifiedPlan(original: Task[], modified: Task[]): PlanModificationWarnings;
|
|
254
|
-
interface ActiveTaskSession {
|
|
255
|
-
id: string;
|
|
256
|
-
taskId: string;
|
|
257
|
-
}
|
|
258
|
-
interface ValidationResult {
|
|
259
|
-
valid: boolean;
|
|
260
|
-
errors: string[];
|
|
261
|
-
}
|
|
262
|
-
interface ValidationContext {
|
|
263
|
-
executionLog: TaskSnapshot[];
|
|
264
|
-
oldPending: Task[];
|
|
265
|
-
newPending: Task[];
|
|
266
|
-
activeSessions: Map<string, ActiveTaskSession>;
|
|
267
|
-
}
|
|
268
|
-
type ValidationCheck = (ctx: ValidationContext) => ValidationResult;
|
|
269
|
-
declare function warningsText(w: PlanModificationWarnings): string | null;
|
|
270
|
-
|
|
271
|
-
export { type ActiveTaskSession as A, emptyWarnings as B, type ConversationMessage as C, type DiscoveredMode as D, flattenTasks as E, flattenTasksWithParents as F, migrateLegacyPlan as G, migratePlanState as H, migrateTask as I, removeTaskFromPlan as J, renumberTasks as K, type LegacyPlanState as L, type Message as M, updateTaskInPlan as N, validateModifiedPlan as O, type PlanModificationWarnings as P, type QueuedMessage as Q, type ResearchLogEntry as R, type StreamEvent as S, type Task as T, type UserPromptEntry as U, type ValidationCheck as V, warningsText as W, type DiscoveredModel as a, type PlanState as b, type PlanStatus as c, type ResearchProgress as d, type ResearchStep as e, type ResearchStepOutcome as f, type ResearchToolType as g, type RunnerId as h, type StreamStepEvent as i, type StreamThinkingEvent as j, type TaskMode as k, type TaskModelAssignment as l, type TaskOutputSummary as m, type TaskSnapshot as n, type TaskStatus as o, type TaskType as p, type TaskWithParent as q, type ThinkingBlock as r, type UserStep as s, type ValidationContext as t, type ValidationResult as u, type Verdict as v, type VerificationCheck as w, addTaskToPlan as x, createEmptyPlan as y, createTask as z };
|