maestro-flow 0.4.6 → 0.4.8
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/.claude/commands/maestro-ralph.md +548 -377
- package/.claude/commands/maestro.md +220 -191
- package/.codex/skills/maestro/SKILL.md +495 -462
- package/.codex/skills/maestro-collab/SKILL.md +218 -117
- package/.codex/skills/maestro-execute/SKILL.md +13 -11
- package/.codex/skills/maestro-milestone-audit/SKILL.md +12 -10
- package/.codex/skills/maestro-ralph/SKILL.md +491 -339
- package/.codex/skills/maestro-ui-codify/SKILL.md +18 -16
- package/.codex/skills/manage-codebase-rebuild/SKILL.md +20 -13
- package/.codex/skills/manage-issue-discover/SKILL.md +19 -17
- package/.codex/skills/quality-debug/SKILL.md +35 -31
- package/.codex/skills/quality-refactor/SKILL.md +20 -12
- package/.codex/skills/quality-review/SKILL.md +21 -17
- package/.codex/skills/team-coordinate/SKILL.md +462 -235
- package/.codex/skills/team-coordinate/specs/role-catalog.md +132 -0
- package/.codex/skills/team-lifecycle-v4/SKILL.md +445 -191
- package/.codex/skills/team-quality-assurance/SKILL.md +205 -161
- package/.codex/skills/team-review/SKILL.md +198 -159
- package/.codex/skills/team-tech-debt/SKILL.md +214 -144
- package/.codex/skills/team-testing/SKILL.md +210 -158
- package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.js +25 -33
- package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.test.js +9 -3
- package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.test.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/agents/codex-app-server-adapter.js +5 -2
- package/dashboard/dist-server/dashboard/src/server/agents/codex-app-server-adapter.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/agents/codex-cli-adapter.js +20 -8
- package/dashboard/dist-server/dashboard/src/server/agents/codex-cli-adapter.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/agents/gemini-a2a-adapter.js +6 -3
- package/dashboard/dist-server/dashboard/src/server/agents/gemini-a2a-adapter.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/agents/gemini-a2a-adapter.test.js +7 -1
- package/dashboard/dist-server/dashboard/src/server/agents/gemini-a2a-adapter.test.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/agents/opencode-adapter.d.ts +2 -0
- package/dashboard/dist-server/dashboard/src/server/agents/opencode-adapter.js +40 -15
- package/dashboard/dist-server/dashboard/src/server/agents/opencode-adapter.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/agents/process-tree-kill.d.ts +1 -0
- package/dashboard/dist-server/dashboard/src/server/agents/process-tree-kill.js +59 -0
- package/dashboard/dist-server/dashboard/src/server/agents/process-tree-kill.js.map +1 -0
- package/dashboard/dist-server/dashboard/src/server/agents/process-tree-kill.test.d.ts +1 -0
- package/dashboard/dist-server/dashboard/src/server/agents/process-tree-kill.test.js +78 -0
- package/dashboard/dist-server/dashboard/src/server/agents/process-tree-kill.test.js.map +1 -0
- package/dashboard/dist-server/dashboard/src/server/agents/stale-handler.d.ts +25 -0
- package/dashboard/dist-server/dashboard/src/server/agents/stale-handler.js +40 -0
- package/dashboard/dist-server/dashboard/src/server/agents/stale-handler.js.map +1 -0
- package/dashboard/dist-server/dashboard/src/server/agents/stale-handler.test.d.ts +1 -0
- package/dashboard/dist-server/dashboard/src/server/agents/stale-handler.test.js +89 -0
- package/dashboard/dist-server/dashboard/src/server/agents/stale-handler.test.js.map +1 -0
- package/dashboard/dist-server/dashboard/src/server/agents/stream-json-adapter.js +19 -8
- package/dashboard/dist-server/dashboard/src/server/agents/stream-json-adapter.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/agents/stream-monitor.d.ts +6 -0
- package/dashboard/dist-server/dashboard/src/server/agents/stream-monitor.js +7 -1
- package/dashboard/dist-server/dashboard/src/server/agents/stream-monitor.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/agents/stream-monitor.test.d.ts +1 -0
- package/dashboard/dist-server/dashboard/src/server/agents/stream-monitor.test.js +46 -0
- package/dashboard/dist-server/dashboard/src/server/agents/stream-monitor.test.js.map +1 -0
- package/dashboard/dist-server/shared/agent-types.d.ts +6 -0
- package/dist/shared/agent-types.d.ts +6 -0
- package/dist/shared/agent-types.d.ts.map +1 -1
- package/dist/src/agents/cli-agent-runner.d.ts +3 -0
- package/dist/src/agents/cli-agent-runner.d.ts.map +1 -1
- package/dist/src/agents/cli-agent-runner.js +1 -0
- package/dist/src/agents/cli-agent-runner.js.map +1 -1
- package/dist/src/commands/delegate.d.ts +2 -0
- package/dist/src/commands/delegate.d.ts.map +1 -1
- package/dist/src/commands/delegate.js +18 -0
- package/dist/src/commands/delegate.js.map +1 -1
- package/dist/src/config/cli-tools-config.d.ts +3 -0
- package/dist/src/config/cli-tools-config.d.ts.map +1 -1
- package/dist/src/config/cli-tools-config.js.map +1 -1
- package/package.json +1 -1
- package/shared/agent-types.ts +237 -231
- package/.codex/skills/team-coordinate/roles/coordinator/commands/analyze-task.md +0 -247
- package/.codex/skills/team-coordinate/roles/coordinator/commands/dispatch.md +0 -126
- package/.codex/skills/team-coordinate/roles/coordinator/commands/monitor.md +0 -265
- package/.codex/skills/team-coordinate/roles/coordinator/role.md +0 -403
- package/.codex/skills/team-coordinate/specs/knowledge-transfer.md +0 -113
- package/.codex/skills/team-coordinate/specs/pipelines.md +0 -97
- package/.codex/skills/team-coordinate/specs/quality-gates.md +0 -112
- package/.codex/skills/team-coordinate/specs/role-spec-template.md +0 -192
- package/.codex/skills/team-executor/SKILL.md +0 -116
- package/.codex/skills/team-executor/roles/executor/commands/monitor.md +0 -213
- package/.codex/skills/team-executor/roles/executor/role.md +0 -173
- package/.codex/skills/team-executor/specs/session-schema.md +0 -230
- package/.codex/skills/team-lifecycle-v4/roles/coordinator/commands/analyze.md +0 -56
- package/.codex/skills/team-lifecycle-v4/roles/coordinator/commands/dispatch.md +0 -61
- package/.codex/skills/team-lifecycle-v4/roles/coordinator/commands/monitor.md +0 -113
- package/.codex/skills/team-lifecycle-v4/roles/coordinator/role.md +0 -189
- package/.codex/skills/team-lifecycle-v4/schemas/tasks-schema.md +0 -100
- package/.codex/skills/team-lifecycle-v4/specs/knowledge-transfer.md +0 -204
- package/.codex/skills/team-quality-assurance/roles/coordinator/commands/analyze.md +0 -72
- package/.codex/skills/team-quality-assurance/roles/coordinator/commands/dispatch.md +0 -108
- package/.codex/skills/team-quality-assurance/roles/coordinator/commands/monitor.md +0 -163
- package/.codex/skills/team-quality-assurance/roles/coordinator/role.md +0 -177
- package/.codex/skills/team-review/roles/coordinator/commands/analyze.md +0 -71
- package/.codex/skills/team-review/roles/coordinator/commands/dispatch.md +0 -90
- package/.codex/skills/team-review/roles/coordinator/commands/monitor.md +0 -135
- package/.codex/skills/team-review/roles/coordinator/role.md +0 -176
- package/.codex/skills/team-tech-debt/roles/coordinator/commands/analyze.md +0 -47
- package/.codex/skills/team-tech-debt/roles/coordinator/commands/dispatch.md +0 -163
- package/.codex/skills/team-tech-debt/roles/coordinator/commands/monitor.md +0 -133
- package/.codex/skills/team-tech-debt/roles/coordinator/role.md +0 -173
- package/.codex/skills/team-testing/roles/coordinator/commands/analyze.md +0 -70
- package/.codex/skills/team-testing/roles/coordinator/commands/dispatch.md +0 -106
- package/.codex/skills/team-testing/roles/coordinator/commands/monitor.md +0 -156
- package/.codex/skills/team-testing/roles/coordinator/role.md +0 -185
package/shared/agent-types.ts
CHANGED
|
@@ -1,231 +1,237 @@
|
|
|
1
|
-
// ---------------------------------------------------------------------------
|
|
2
|
-
// Agent type system — protocol abstraction for CLI agent processes
|
|
3
|
-
//
|
|
4
|
-
// CANONICAL source of truth for all agent types. Both the maestro CLI (src/)
|
|
5
|
-
// and dashboard (dashboard/src/) import from this file.
|
|
6
|
-
// ---------------------------------------------------------------------------
|
|
7
|
-
|
|
8
|
-
/** Supported agent CLI types */
|
|
9
|
-
export type AgentType = 'claude-code' | 'codex' | 'codex-server' | 'gemini' | 'gemini-a2a' | 'qwen' | 'opencode' | 'agent-sdk';
|
|
10
|
-
|
|
11
|
-
/** Agent process lifecycle status */
|
|
12
|
-
export type AgentProcessStatus =
|
|
13
|
-
| 'spawning'
|
|
14
|
-
| 'running'
|
|
15
|
-
| 'paused'
|
|
16
|
-
| 'stopping'
|
|
17
|
-
| 'stopped'
|
|
18
|
-
| 'error';
|
|
19
|
-
|
|
20
|
-
// ---------------------------------------------------------------------------
|
|
21
|
-
// Agent configuration & process
|
|
22
|
-
// ---------------------------------------------------------------------------
|
|
23
|
-
|
|
24
|
-
/** Configuration for spawning an agent process */
|
|
25
|
-
export interface AgentConfig {
|
|
26
|
-
type: AgentType;
|
|
27
|
-
prompt: string;
|
|
28
|
-
workDir: string;
|
|
29
|
-
env?: Record<string, string>;
|
|
30
|
-
model?: string;
|
|
31
|
-
approvalMode?: 'suggest' | 'auto';
|
|
32
|
-
baseUrl?: string;
|
|
33
|
-
apiKey?: string;
|
|
34
|
-
settingsFile?: string;
|
|
35
|
-
/** Path to .env file for loading environment variables before spawn */
|
|
36
|
-
envFile?: string;
|
|
37
|
-
/** When true, spawn in interactive mode (stdin kept open for follow-up messages) */
|
|
38
|
-
interactive?: boolean;
|
|
39
|
-
/** Path to MCP config JSON file for CLI agents (claude-code --mcp-config) */
|
|
40
|
-
mcpConfigPath?: string;
|
|
41
|
-
/** Opaque metadata bag — used to pass team session context through the spawn pipeline */
|
|
42
|
-
metadata?: Record<string, unknown>;
|
|
43
|
-
/** Reasoning effort level (undefined = tool default) */
|
|
44
|
-
reasoningEffort?: 'low' | 'medium' | 'high' | 'max';
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
| '
|
|
81
|
-
| '
|
|
82
|
-
| '
|
|
83
|
-
| '
|
|
84
|
-
| '
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export interface
|
|
100
|
-
type: '
|
|
101
|
-
content: string;
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
export interface
|
|
140
|
-
type: '
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
export interface
|
|
146
|
-
type: '
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
export interface
|
|
152
|
-
type: '
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
|
168
|
-
|
|
|
169
|
-
|
|
|
170
|
-
|
|
|
171
|
-
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
export interface
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
/** Payload for agent:
|
|
190
|
-
export interface
|
|
191
|
-
processId: string;
|
|
192
|
-
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
/** Payload for agent:
|
|
196
|
-
export interface
|
|
197
|
-
processId: string;
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
reason?: string;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
/** Payload for agent:
|
|
209
|
-
export interface
|
|
210
|
-
processId: string;
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
1
|
+
// ---------------------------------------------------------------------------
|
|
2
|
+
// Agent type system — protocol abstraction for CLI agent processes
|
|
3
|
+
//
|
|
4
|
+
// CANONICAL source of truth for all agent types. Both the maestro CLI (src/)
|
|
5
|
+
// and dashboard (dashboard/src/) import from this file.
|
|
6
|
+
// ---------------------------------------------------------------------------
|
|
7
|
+
|
|
8
|
+
/** Supported agent CLI types */
|
|
9
|
+
export type AgentType = 'claude-code' | 'codex' | 'codex-server' | 'gemini' | 'gemini-a2a' | 'qwen' | 'opencode' | 'agent-sdk';
|
|
10
|
+
|
|
11
|
+
/** Agent process lifecycle status */
|
|
12
|
+
export type AgentProcessStatus =
|
|
13
|
+
| 'spawning'
|
|
14
|
+
| 'running'
|
|
15
|
+
| 'paused'
|
|
16
|
+
| 'stopping'
|
|
17
|
+
| 'stopped'
|
|
18
|
+
| 'error';
|
|
19
|
+
|
|
20
|
+
// ---------------------------------------------------------------------------
|
|
21
|
+
// Agent configuration & process
|
|
22
|
+
// ---------------------------------------------------------------------------
|
|
23
|
+
|
|
24
|
+
/** Configuration for spawning an agent process */
|
|
25
|
+
export interface AgentConfig {
|
|
26
|
+
type: AgentType;
|
|
27
|
+
prompt: string;
|
|
28
|
+
workDir: string;
|
|
29
|
+
env?: Record<string, string>;
|
|
30
|
+
model?: string;
|
|
31
|
+
approvalMode?: 'suggest' | 'auto';
|
|
32
|
+
baseUrl?: string;
|
|
33
|
+
apiKey?: string;
|
|
34
|
+
settingsFile?: string;
|
|
35
|
+
/** Path to .env file for loading environment variables before spawn */
|
|
36
|
+
envFile?: string;
|
|
37
|
+
/** When true, spawn in interactive mode (stdin kept open for follow-up messages) */
|
|
38
|
+
interactive?: boolean;
|
|
39
|
+
/** Path to MCP config JSON file for CLI agents (claude-code --mcp-config) */
|
|
40
|
+
mcpConfigPath?: string;
|
|
41
|
+
/** Opaque metadata bag — used to pass team session context through the spawn pipeline */
|
|
42
|
+
metadata?: Record<string, unknown>;
|
|
43
|
+
/** Reasoning effort level (undefined = tool default) */
|
|
44
|
+
reasoningEffort?: 'low' | 'medium' | 'high' | 'max';
|
|
45
|
+
/**
|
|
46
|
+
* Stale-stream silence window in ms before the adapter force-terminates a
|
|
47
|
+
* silent CLI. Undefined = StreamMonitor default (10 min). Threaded from
|
|
48
|
+
* `maestro delegate --timeout` / cli-tools.json `streamTimeoutMs`.
|
|
49
|
+
*/
|
|
50
|
+
streamTimeoutMs?: number;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Runtime state of a spawned agent process */
|
|
54
|
+
export interface AgentProcess {
|
|
55
|
+
id: string;
|
|
56
|
+
type: AgentType;
|
|
57
|
+
status: AgentProcessStatus;
|
|
58
|
+
config: AgentConfig;
|
|
59
|
+
startedAt: string;
|
|
60
|
+
pid?: number;
|
|
61
|
+
/** Whether the agent supports interactive follow-up messages */
|
|
62
|
+
interactive?: boolean;
|
|
63
|
+
/** Opaque metadata from config — carries team session context etc. */
|
|
64
|
+
metadata?: Record<string, unknown>;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// ---------------------------------------------------------------------------
|
|
68
|
+
// NormalizedEntry — 11-type discriminated union for unified agent output
|
|
69
|
+
// ---------------------------------------------------------------------------
|
|
70
|
+
|
|
71
|
+
/** Base fields shared by all normalized entries */
|
|
72
|
+
export interface NormalizedEntryBase {
|
|
73
|
+
id: string;
|
|
74
|
+
processId: string;
|
|
75
|
+
timestamp: string;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** All possible entry type discriminators */
|
|
79
|
+
export type EntryType =
|
|
80
|
+
| 'user_message'
|
|
81
|
+
| 'assistant_message'
|
|
82
|
+
| 'thinking'
|
|
83
|
+
| 'tool_use'
|
|
84
|
+
| 'file_change'
|
|
85
|
+
| 'command_exec'
|
|
86
|
+
| 'approval_request'
|
|
87
|
+
| 'approval_response'
|
|
88
|
+
| 'error'
|
|
89
|
+
| 'status_change'
|
|
90
|
+
| 'token_usage';
|
|
91
|
+
|
|
92
|
+
// --- Individual entry types ------------------------------------------------
|
|
93
|
+
|
|
94
|
+
export interface UserMessageEntry extends NormalizedEntryBase {
|
|
95
|
+
type: 'user_message';
|
|
96
|
+
content: string;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface AssistantMessageEntry extends NormalizedEntryBase {
|
|
100
|
+
type: 'assistant_message';
|
|
101
|
+
content: string;
|
|
102
|
+
partial: boolean;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export interface ThinkingEntry extends NormalizedEntryBase {
|
|
106
|
+
type: 'thinking';
|
|
107
|
+
content: string;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export interface ToolUseEntry extends NormalizedEntryBase {
|
|
111
|
+
type: 'tool_use';
|
|
112
|
+
name: string;
|
|
113
|
+
input: Record<string, unknown>;
|
|
114
|
+
status: 'pending' | 'running' | 'completed' | 'failed';
|
|
115
|
+
result?: string;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export interface FileChangeEntry extends NormalizedEntryBase {
|
|
119
|
+
type: 'file_change';
|
|
120
|
+
path: string;
|
|
121
|
+
action: 'create' | 'modify' | 'delete';
|
|
122
|
+
diff?: string;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export interface CommandExecEntry extends NormalizedEntryBase {
|
|
126
|
+
type: 'command_exec';
|
|
127
|
+
command: string;
|
|
128
|
+
exitCode?: number;
|
|
129
|
+
output?: string;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export interface ApprovalRequestEntry extends NormalizedEntryBase {
|
|
133
|
+
type: 'approval_request';
|
|
134
|
+
toolName: string;
|
|
135
|
+
toolInput: Record<string, unknown>;
|
|
136
|
+
requestId: string;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export interface ApprovalResponseEntry extends NormalizedEntryBase {
|
|
140
|
+
type: 'approval_response';
|
|
141
|
+
requestId: string;
|
|
142
|
+
allowed: boolean;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export interface ErrorEntry extends NormalizedEntryBase {
|
|
146
|
+
type: 'error';
|
|
147
|
+
message: string;
|
|
148
|
+
code?: string;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export interface StatusChangeEntry extends NormalizedEntryBase {
|
|
152
|
+
type: 'status_change';
|
|
153
|
+
status: AgentProcessStatus;
|
|
154
|
+
reason?: string;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export interface TokenUsageEntry extends NormalizedEntryBase {
|
|
158
|
+
type: 'token_usage';
|
|
159
|
+
inputTokens: number;
|
|
160
|
+
outputTokens: number;
|
|
161
|
+
cacheReadTokens?: number;
|
|
162
|
+
cacheWriteTokens?: number;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/** Discriminated union of all 11 normalized entry types */
|
|
166
|
+
export type NormalizedEntry =
|
|
167
|
+
| UserMessageEntry
|
|
168
|
+
| AssistantMessageEntry
|
|
169
|
+
| ThinkingEntry
|
|
170
|
+
| ToolUseEntry
|
|
171
|
+
| FileChangeEntry
|
|
172
|
+
| CommandExecEntry
|
|
173
|
+
| ApprovalRequestEntry
|
|
174
|
+
| ApprovalResponseEntry
|
|
175
|
+
| ErrorEntry
|
|
176
|
+
| StatusChangeEntry
|
|
177
|
+
| TokenUsageEntry;
|
|
178
|
+
|
|
179
|
+
// ---------------------------------------------------------------------------
|
|
180
|
+
// Agent event payload types (used in WS/SSE event envelopes)
|
|
181
|
+
// ---------------------------------------------------------------------------
|
|
182
|
+
|
|
183
|
+
/** Thought data from agent reasoning */
|
|
184
|
+
export interface ThoughtData {
|
|
185
|
+
subject: string;
|
|
186
|
+
description: string;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/** Payload for agent:thought events */
|
|
190
|
+
export interface AgentThoughtPayload {
|
|
191
|
+
processId: string;
|
|
192
|
+
thought: ThoughtData;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/** Payload for agent:streaming events */
|
|
196
|
+
export interface AgentStreamingPayload {
|
|
197
|
+
processId: string;
|
|
198
|
+
streaming: boolean;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/** Payload for agent:status events */
|
|
202
|
+
export interface AgentStatusPayload {
|
|
203
|
+
processId: string;
|
|
204
|
+
status: AgentProcessStatus;
|
|
205
|
+
reason?: string;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/** Payload for agent:stopped events */
|
|
209
|
+
export interface AgentStoppedPayload {
|
|
210
|
+
processId: string;
|
|
211
|
+
reason?: string;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/** Payload for agent:turnCompleted events (codex-server multi-turn) */
|
|
215
|
+
export interface AgentTurnCompletedPayload {
|
|
216
|
+
processId: string;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// ---------------------------------------------------------------------------
|
|
220
|
+
// Approval workflow types
|
|
221
|
+
// ---------------------------------------------------------------------------
|
|
222
|
+
|
|
223
|
+
/** Server-side approval request (sent to client for user decision) */
|
|
224
|
+
export interface ApprovalRequest {
|
|
225
|
+
id: string;
|
|
226
|
+
processId: string;
|
|
227
|
+
toolName: string;
|
|
228
|
+
toolInput: Record<string, unknown>;
|
|
229
|
+
timestamp: string;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/** Client-side approval decision (sent back to server) */
|
|
233
|
+
export interface ApprovalDecision {
|
|
234
|
+
id: string;
|
|
235
|
+
allow: boolean;
|
|
236
|
+
processId: string;
|
|
237
|
+
}
|