@agentuity/coder-tui 2.0.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/README.md +57 -0
- package/dist/chain-preview.d.ts +55 -0
- package/dist/chain-preview.d.ts.map +1 -0
- package/dist/chain-preview.js +472 -0
- package/dist/chain-preview.js.map +1 -0
- package/dist/client.d.ts +44 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +411 -0
- package/dist/client.js.map +1 -0
- package/dist/commands.d.ts +22 -0
- package/dist/commands.d.ts.map +1 -0
- package/dist/commands.js +99 -0
- package/dist/commands.js.map +1 -0
- package/dist/footer.d.ts +34 -0
- package/dist/footer.d.ts.map +1 -0
- package/dist/footer.js +249 -0
- package/dist/footer.js.map +1 -0
- package/dist/handlers.d.ts +24 -0
- package/dist/handlers.d.ts.map +1 -0
- package/dist/handlers.js +83 -0
- package/dist/handlers.js.map +1 -0
- package/dist/hub-overlay-state.d.ts +31 -0
- package/dist/hub-overlay-state.d.ts.map +1 -0
- package/dist/hub-overlay-state.js +78 -0
- package/dist/hub-overlay-state.js.map +1 -0
- package/dist/hub-overlay.d.ts +146 -0
- package/dist/hub-overlay.d.ts.map +1 -0
- package/dist/hub-overlay.js +2354 -0
- package/dist/hub-overlay.js.map +1 -0
- package/dist/inbound-rpc.d.ts +3 -0
- package/dist/inbound-rpc.d.ts.map +1 -0
- package/dist/inbound-rpc.js +29 -0
- package/dist/inbound-rpc.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1641 -0
- package/dist/index.js.map +1 -0
- package/dist/native-remote-ui-context.d.ts +5 -0
- package/dist/native-remote-ui-context.d.ts.map +1 -0
- package/dist/native-remote-ui-context.js +30 -0
- package/dist/native-remote-ui-context.js.map +1 -0
- package/dist/output-viewer.d.ts +49 -0
- package/dist/output-viewer.d.ts.map +1 -0
- package/dist/output-viewer.js +389 -0
- package/dist/output-viewer.js.map +1 -0
- package/dist/overlay.d.ts +40 -0
- package/dist/overlay.d.ts.map +1 -0
- package/dist/overlay.js +225 -0
- package/dist/overlay.js.map +1 -0
- package/dist/protocol.d.ts +605 -0
- package/dist/protocol.d.ts.map +1 -0
- package/dist/protocol.js +4 -0
- package/dist/protocol.js.map +1 -0
- package/dist/remote-lifecycle.d.ts +61 -0
- package/dist/remote-lifecycle.d.ts.map +1 -0
- package/dist/remote-lifecycle.js +190 -0
- package/dist/remote-lifecycle.js.map +1 -0
- package/dist/remote-session.d.ts +130 -0
- package/dist/remote-session.d.ts.map +1 -0
- package/dist/remote-session.js +896 -0
- package/dist/remote-session.js.map +1 -0
- package/dist/remote-tui.d.ts +42 -0
- package/dist/remote-tui.d.ts.map +1 -0
- package/dist/remote-tui.js +868 -0
- package/dist/remote-tui.js.map +1 -0
- package/dist/remote-ui-handler.d.ts +5 -0
- package/dist/remote-ui-handler.d.ts.map +1 -0
- package/dist/remote-ui-handler.js +53 -0
- package/dist/remote-ui-handler.js.map +1 -0
- package/dist/renderers.d.ts +34 -0
- package/dist/renderers.d.ts.map +1 -0
- package/dist/renderers.js +669 -0
- package/dist/renderers.js.map +1 -0
- package/dist/review.d.ts +15 -0
- package/dist/review.d.ts.map +1 -0
- package/dist/review.js +154 -0
- package/dist/review.js.map +1 -0
- package/dist/titlebar.d.ts +3 -0
- package/dist/titlebar.d.ts.map +1 -0
- package/dist/titlebar.js +59 -0
- package/dist/titlebar.js.map +1 -0
- package/dist/todo/index.d.ts +3 -0
- package/dist/todo/index.d.ts.map +1 -0
- package/dist/todo/index.js +3 -0
- package/dist/todo/index.js.map +1 -0
- package/dist/todo/store.d.ts +6 -0
- package/dist/todo/store.d.ts.map +1 -0
- package/dist/todo/store.js +43 -0
- package/dist/todo/store.js.map +1 -0
- package/dist/todo/types.d.ts +13 -0
- package/dist/todo/types.d.ts.map +1 -0
- package/dist/todo/types.js +2 -0
- package/dist/todo/types.js.map +1 -0
- package/package.json +42 -0
- package/src/chain-preview.ts +621 -0
- package/src/client.ts +527 -0
- package/src/commands.ts +132 -0
- package/src/footer.ts +305 -0
- package/src/handlers.ts +113 -0
- package/src/hub-overlay-state.ts +127 -0
- package/src/hub-overlay.ts +3037 -0
- package/src/inbound-rpc.ts +35 -0
- package/src/index.ts +1963 -0
- package/src/native-remote-ui-context.ts +41 -0
- package/src/output-viewer.ts +480 -0
- package/src/overlay.ts +294 -0
- package/src/protocol.ts +758 -0
- package/src/remote-lifecycle.ts +270 -0
- package/src/remote-session.ts +1100 -0
- package/src/remote-tui.ts +1023 -0
- package/src/remote-ui-handler.ts +86 -0
- package/src/renderers.ts +740 -0
- package/src/review.ts +201 -0
- package/src/titlebar.ts +63 -0
- package/src/todo/index.ts +2 -0
- package/src/todo/store.ts +49 -0
- package/src/todo/types.ts +14 -0
package/src/protocol.ts
ADDED
|
@@ -0,0 +1,758 @@
|
|
|
1
|
+
// Hub protocol types used by the Coder TUI package.
|
|
2
|
+
// Keep the legacy exported names stable while modeling the newer hub envelopes.
|
|
3
|
+
|
|
4
|
+
export interface HubToolDefinition {
|
|
5
|
+
name: string;
|
|
6
|
+
label: string;
|
|
7
|
+
description: string;
|
|
8
|
+
parameters: Record<string, unknown>;
|
|
9
|
+
promptSnippet?: string;
|
|
10
|
+
promptGuidelines?: string | string[];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface HubCommandDefinition {
|
|
14
|
+
name: string;
|
|
15
|
+
description: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface AckAction {
|
|
19
|
+
action: 'ACK';
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface BlockAction {
|
|
23
|
+
action: 'BLOCK';
|
|
24
|
+
reason: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface ConfirmAction {
|
|
28
|
+
action: 'CONFIRM';
|
|
29
|
+
title: string;
|
|
30
|
+
message: string;
|
|
31
|
+
deny_reason?: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface NotifyAction {
|
|
35
|
+
action: 'NOTIFY';
|
|
36
|
+
message: string;
|
|
37
|
+
level?: 'info' | 'warning' | 'error';
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface ReturnAction {
|
|
41
|
+
action: 'RETURN';
|
|
42
|
+
result: unknown;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface StatusAction {
|
|
46
|
+
action: 'STATUS';
|
|
47
|
+
key: string;
|
|
48
|
+
text?: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface SystemPromptAction {
|
|
52
|
+
action: 'SYSTEM_PROMPT';
|
|
53
|
+
systemPrompt: string;
|
|
54
|
+
mode?: 'replace' | 'prefix' | 'suffix';
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface InjectMessageAction {
|
|
58
|
+
action: 'INJECT_MESSAGE';
|
|
59
|
+
message: {
|
|
60
|
+
role: 'user' | 'assistant';
|
|
61
|
+
content: string;
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export type HubAction =
|
|
66
|
+
| AckAction
|
|
67
|
+
| BlockAction
|
|
68
|
+
| ConfirmAction
|
|
69
|
+
| NotifyAction
|
|
70
|
+
| ReturnAction
|
|
71
|
+
| StatusAction
|
|
72
|
+
| SystemPromptAction
|
|
73
|
+
| InjectMessageAction;
|
|
74
|
+
|
|
75
|
+
export interface AgentDefinition {
|
|
76
|
+
name: string;
|
|
77
|
+
displayName?: string;
|
|
78
|
+
description: string;
|
|
79
|
+
systemPrompt: string;
|
|
80
|
+
model?: string;
|
|
81
|
+
tools?: string[];
|
|
82
|
+
temperature?: number;
|
|
83
|
+
thinkingLevel?: string;
|
|
84
|
+
readOnly?: boolean;
|
|
85
|
+
hubTools?: HubToolDefinition[];
|
|
86
|
+
capabilities?: string[];
|
|
87
|
+
status?: 'available' | 'busy' | 'offline';
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface HubConfig {
|
|
91
|
+
systemPromptPrefix?: string;
|
|
92
|
+
systemPromptSuffix?: string;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface InitMessage {
|
|
96
|
+
type: 'init';
|
|
97
|
+
role: 'lead' | 'sub_agent' | 'controller';
|
|
98
|
+
sessionId?: string;
|
|
99
|
+
resume?: {
|
|
100
|
+
sessionFile: string;
|
|
101
|
+
piSessionId?: string;
|
|
102
|
+
cwd?: string;
|
|
103
|
+
};
|
|
104
|
+
tools?: HubToolDefinition[];
|
|
105
|
+
commands?: HubCommandDefinition[];
|
|
106
|
+
agents?: AgentDefinition[];
|
|
107
|
+
config?: HubConfig;
|
|
108
|
+
model?: {
|
|
109
|
+
provider: string;
|
|
110
|
+
id: string;
|
|
111
|
+
};
|
|
112
|
+
thinkingLevel?: string;
|
|
113
|
+
task?: string;
|
|
114
|
+
agentRole?: string;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export interface EventRequest {
|
|
118
|
+
id: string;
|
|
119
|
+
type: 'event';
|
|
120
|
+
event: string;
|
|
121
|
+
data: Record<string, unknown>;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export interface ToolRequest {
|
|
125
|
+
id: string;
|
|
126
|
+
type: 'tool';
|
|
127
|
+
name: string;
|
|
128
|
+
toolCallId: string;
|
|
129
|
+
params: Record<string, unknown>;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export interface CommandRequest {
|
|
133
|
+
id: string;
|
|
134
|
+
type: 'command';
|
|
135
|
+
name: string;
|
|
136
|
+
args: string;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export type HubRequest = EventRequest | ToolRequest | CommandRequest;
|
|
140
|
+
|
|
141
|
+
export interface SessionEntryMessage {
|
|
142
|
+
type: 'session_entry';
|
|
143
|
+
path: string;
|
|
144
|
+
line: string;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export interface SessionWriteMessage {
|
|
148
|
+
type: 'session_write';
|
|
149
|
+
path: string;
|
|
150
|
+
content: string;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export interface RpcCommandMessage {
|
|
154
|
+
type: 'rpc_command';
|
|
155
|
+
command: Record<string, unknown>;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export interface RpcUiResponseMessage {
|
|
159
|
+
type: 'rpc_ui_response';
|
|
160
|
+
id: string;
|
|
161
|
+
result: unknown;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export interface PingMessage {
|
|
165
|
+
type: 'ping';
|
|
166
|
+
timestamp: number;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export interface BootstrapReadyMessage {
|
|
170
|
+
type: 'bootstrap_ready';
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export type HubClientMessage =
|
|
174
|
+
| HubRequest
|
|
175
|
+
| SessionEntryMessage
|
|
176
|
+
| SessionWriteMessage
|
|
177
|
+
| BootstrapReadyMessage
|
|
178
|
+
| RpcCommandMessage
|
|
179
|
+
| RpcUiResponseMessage
|
|
180
|
+
| PingMessage;
|
|
181
|
+
|
|
182
|
+
export interface HubResponse {
|
|
183
|
+
id: string;
|
|
184
|
+
actions: HubAction[];
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export interface CoderHubStreamReadyMessage {
|
|
188
|
+
type: 'session_stream_ready';
|
|
189
|
+
streamId: string;
|
|
190
|
+
streamUrl: string;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export interface CoderHubSessionResumeMessage {
|
|
194
|
+
type: 'session_resume';
|
|
195
|
+
streamUrl: string;
|
|
196
|
+
streamId: string;
|
|
197
|
+
activePrdKey?: string;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export interface ConnectionRejectedMessage {
|
|
201
|
+
type: 'connection_rejected';
|
|
202
|
+
code: string;
|
|
203
|
+
message: string;
|
|
204
|
+
sessionId?: string;
|
|
205
|
+
reconnectState?: string;
|
|
206
|
+
expiredAt?: number;
|
|
207
|
+
timestamp: number;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export interface ProtocolErrorMessage {
|
|
211
|
+
type: 'protocol_error';
|
|
212
|
+
code: string;
|
|
213
|
+
message: string;
|
|
214
|
+
sessionId?: string;
|
|
215
|
+
timestamp: number;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export interface ConversationEntry {
|
|
219
|
+
type:
|
|
220
|
+
| 'message'
|
|
221
|
+
| 'thinking'
|
|
222
|
+
| 'tool_call'
|
|
223
|
+
| 'tool_result'
|
|
224
|
+
| 'task_result'
|
|
225
|
+
| 'runtime_status'
|
|
226
|
+
| 'runtime_output'
|
|
227
|
+
| 'runtime_preview'
|
|
228
|
+
| 'turn'
|
|
229
|
+
| 'user_prompt';
|
|
230
|
+
agent?: string;
|
|
231
|
+
content?: string;
|
|
232
|
+
thinking?: string;
|
|
233
|
+
toolName?: string;
|
|
234
|
+
toolArgs?: Record<string, unknown>;
|
|
235
|
+
toolCallId?: string;
|
|
236
|
+
runtime?:
|
|
237
|
+
| {
|
|
238
|
+
id?: string;
|
|
239
|
+
command?: string;
|
|
240
|
+
status?: string;
|
|
241
|
+
stream?: string;
|
|
242
|
+
exitCode?: number;
|
|
243
|
+
}
|
|
244
|
+
| undefined;
|
|
245
|
+
preview?:
|
|
246
|
+
| {
|
|
247
|
+
id?: string;
|
|
248
|
+
url?: string;
|
|
249
|
+
status?: string;
|
|
250
|
+
label?: string;
|
|
251
|
+
}
|
|
252
|
+
| undefined;
|
|
253
|
+
attachments?: Array<{
|
|
254
|
+
id?: string;
|
|
255
|
+
filename?: string;
|
|
256
|
+
mime?: string;
|
|
257
|
+
size?: number;
|
|
258
|
+
}>;
|
|
259
|
+
isError?: boolean;
|
|
260
|
+
taskId?: string;
|
|
261
|
+
turnId?: string;
|
|
262
|
+
replyId?: string;
|
|
263
|
+
sequence?: number;
|
|
264
|
+
elapsedMs?: number;
|
|
265
|
+
timestamp: number;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
export interface SessionTaskState {
|
|
269
|
+
taskId: string;
|
|
270
|
+
agent: string;
|
|
271
|
+
status: 'running' | 'completed' | 'failed';
|
|
272
|
+
prompt: string;
|
|
273
|
+
startedAt?: string;
|
|
274
|
+
completedAt?: string;
|
|
275
|
+
duration?: number;
|
|
276
|
+
result?: string;
|
|
277
|
+
error?: string;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
export type HydrationTaskState = SessionTaskState;
|
|
281
|
+
|
|
282
|
+
export interface SessionTaskProjection<TTaskState = SessionTaskState> {
|
|
283
|
+
tasks: TTaskState[];
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
export interface SessionStreamWorkExtension {
|
|
287
|
+
stream?: SessionStreamProjection;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
export interface SessionParticipant {
|
|
291
|
+
id: string;
|
|
292
|
+
role: 'lead' | 'observer' | 'controller';
|
|
293
|
+
transport: 'ws' | 'sse';
|
|
294
|
+
subscriptions: string[];
|
|
295
|
+
connectedAt: number;
|
|
296
|
+
lastActivity: number;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
export interface SessionStreamBlock {
|
|
300
|
+
output: string;
|
|
301
|
+
thinking: string;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
export interface SessionStreamProjection extends SessionStreamBlock {
|
|
305
|
+
tasks: Record<string, SessionStreamBlock>;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
export type WorkflowMode = 'standard' | 'loop';
|
|
309
|
+
export type LoopStatus =
|
|
310
|
+
| 'idle'
|
|
311
|
+
| 'starting'
|
|
312
|
+
| 'running'
|
|
313
|
+
| 'paused'
|
|
314
|
+
| 'awaiting_input'
|
|
315
|
+
| 'blocked'
|
|
316
|
+
| 'completed'
|
|
317
|
+
| 'failed'
|
|
318
|
+
| 'cancelled';
|
|
319
|
+
|
|
320
|
+
export interface SessionLoopState {
|
|
321
|
+
workflowMode: WorkflowMode;
|
|
322
|
+
loopId?: string;
|
|
323
|
+
status: LoopStatus;
|
|
324
|
+
goal?: string;
|
|
325
|
+
summary?: string;
|
|
326
|
+
nextAction?: string;
|
|
327
|
+
blockers: string[];
|
|
328
|
+
iteration: number;
|
|
329
|
+
maxIterations: number;
|
|
330
|
+
autoContinue: boolean;
|
|
331
|
+
allowDetached: boolean;
|
|
332
|
+
recoveryAttempts: number;
|
|
333
|
+
awaitingUser: boolean;
|
|
334
|
+
activePrdKey?: string;
|
|
335
|
+
activePrdTaskId?: string;
|
|
336
|
+
coordinationJobId?: string;
|
|
337
|
+
currentWaveId?: string;
|
|
338
|
+
currentWaveLabel?: string;
|
|
339
|
+
lastCheckpointSummary?: string;
|
|
340
|
+
startedAt?: number;
|
|
341
|
+
updatedAt?: number;
|
|
342
|
+
lastCheckpointAt?: number;
|
|
343
|
+
completedAt?: number;
|
|
344
|
+
lastError?: string;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
export type SessionBucket = 'running' | 'paused' | 'provisioning' | 'history';
|
|
348
|
+
|
|
349
|
+
export interface SessionSkillRef {
|
|
350
|
+
skillId: string;
|
|
351
|
+
repo: string;
|
|
352
|
+
name?: string;
|
|
353
|
+
url?: string;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
export interface SessionListDiagnostics {
|
|
357
|
+
inactiveRunningTasks: Array<{
|
|
358
|
+
taskId: string;
|
|
359
|
+
agent: string;
|
|
360
|
+
inactivityMs: number;
|
|
361
|
+
startedAt: string;
|
|
362
|
+
lastActivityAt?: string;
|
|
363
|
+
}>;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
export interface SessionListItem {
|
|
367
|
+
sessionId: string;
|
|
368
|
+
label: string;
|
|
369
|
+
status: string;
|
|
370
|
+
mode: 'sandbox' | 'tui';
|
|
371
|
+
sessionKind?: string;
|
|
372
|
+
parentSessionId?: string;
|
|
373
|
+
coordinationJobId?: string;
|
|
374
|
+
workflowMode: WorkflowMode;
|
|
375
|
+
loopStatus?: SessionLoopState['status'];
|
|
376
|
+
loopIteration?: number;
|
|
377
|
+
createdAt: string;
|
|
378
|
+
taskCount: number;
|
|
379
|
+
subAgentCount: number;
|
|
380
|
+
observerCount: number;
|
|
381
|
+
participantCount: number;
|
|
382
|
+
tags: string[];
|
|
383
|
+
skills: SessionSkillRef[];
|
|
384
|
+
defaultAgent?: string;
|
|
385
|
+
bucket: SessionBucket;
|
|
386
|
+
runtimeAvailable: boolean;
|
|
387
|
+
controlAvailable: boolean;
|
|
388
|
+
historyOnly: boolean;
|
|
389
|
+
diagnostics?: SessionListDiagnostics;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
export interface SandboxSessionListItem {
|
|
393
|
+
sessionId: string;
|
|
394
|
+
sandboxId: string;
|
|
395
|
+
status: string;
|
|
396
|
+
task?: string;
|
|
397
|
+
metadata?: Record<string, unknown>;
|
|
398
|
+
wsConnected: boolean;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
export interface SessionListResponse {
|
|
402
|
+
sessions: {
|
|
403
|
+
websocket: SessionListItem[];
|
|
404
|
+
sandbox: SandboxSessionListItem[];
|
|
405
|
+
};
|
|
406
|
+
total: number;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
export interface SessionDetailParticipant {
|
|
410
|
+
id: string;
|
|
411
|
+
role: string;
|
|
412
|
+
transport: string;
|
|
413
|
+
connectedAt: string;
|
|
414
|
+
idle?: boolean;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
export interface SessionAgentActivity {
|
|
418
|
+
name?: string;
|
|
419
|
+
status: string;
|
|
420
|
+
currentTool?: string;
|
|
421
|
+
currentToolArgs?: string;
|
|
422
|
+
toolCallCount: number;
|
|
423
|
+
lastActivity: number;
|
|
424
|
+
totalElapsed?: number;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
export interface SessionObservedProjection {
|
|
428
|
+
turnCount: number;
|
|
429
|
+
lastAgentModel?: string;
|
|
430
|
+
compactionCount: number;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
export interface SessionDeckGenerationState {
|
|
434
|
+
state: string;
|
|
435
|
+
requestedAt?: number;
|
|
436
|
+
startedAt?: number;
|
|
437
|
+
completedAt?: number;
|
|
438
|
+
title?: string;
|
|
439
|
+
deckType?: string;
|
|
440
|
+
prdKey?: string;
|
|
441
|
+
prdTaskId?: string;
|
|
442
|
+
todoId?: string;
|
|
443
|
+
error?: string;
|
|
444
|
+
url?: string;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
export interface SessionProductProjection {
|
|
448
|
+
activePrdKey?: string;
|
|
449
|
+
activePrdTaskId?: string;
|
|
450
|
+
deckGeneration?: SessionDeckGenerationState;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
export interface SessionActivityWorkExtensions {
|
|
454
|
+
agentActivity?: Record<string, SessionAgentActivity>;
|
|
455
|
+
diagnostics?: SessionListDiagnostics;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
export interface SessionWorkProjection<TTaskState = SessionTaskState>
|
|
459
|
+
extends SessionTaskProjection<TTaskState>,
|
|
460
|
+
SessionStreamWorkExtension,
|
|
461
|
+
SessionActivityWorkExtensions {
|
|
462
|
+
workflowMode: WorkflowMode;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
export interface SessionWorkflowProjection {
|
|
466
|
+
workflowMode: WorkflowMode;
|
|
467
|
+
loop?: SessionLoopState;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
export interface SessionLoopResponse extends Omit<SessionWorkflowProjection, 'loop'> {
|
|
471
|
+
sessionId: string;
|
|
472
|
+
loop: SessionLoopState | null;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
export interface SessionUsageAgentSummary {
|
|
476
|
+
inputTokens: number;
|
|
477
|
+
outputTokens: number;
|
|
478
|
+
reasoningTokens: number;
|
|
479
|
+
costUsd: number;
|
|
480
|
+
updatedAt: number;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
export interface SessionUsageSummary {
|
|
484
|
+
inputTokens: number;
|
|
485
|
+
outputTokens: number;
|
|
486
|
+
reasoningTokens: number;
|
|
487
|
+
costUsd: number;
|
|
488
|
+
updatedAt: number;
|
|
489
|
+
byAgent?: Record<string, SessionUsageAgentSummary>;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
export interface SessionSnapshotCore extends SessionTaskProjection {
|
|
493
|
+
sessionId: string;
|
|
494
|
+
label: string;
|
|
495
|
+
status: string;
|
|
496
|
+
createdAt: string;
|
|
497
|
+
mode: 'sandbox' | 'tui';
|
|
498
|
+
workflowMode: WorkflowMode;
|
|
499
|
+
participants: SessionDetailParticipant[];
|
|
500
|
+
task?: string;
|
|
501
|
+
error?: string;
|
|
502
|
+
bucket: SessionBucket;
|
|
503
|
+
runtimeAvailable: boolean;
|
|
504
|
+
controlAvailable: boolean;
|
|
505
|
+
historyOnly: boolean;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
export interface SessionSnapshotHistoryExtensions {
|
|
509
|
+
streamId: string | null;
|
|
510
|
+
streamUrl: string | null;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
export interface SessionSnapshotWorkExtensions
|
|
514
|
+
extends SessionStreamWorkExtension,
|
|
515
|
+
SessionActivityWorkExtensions {
|
|
516
|
+
agentActivity: Record<string, SessionAgentActivity>;
|
|
517
|
+
usage: SessionUsageSummary;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
export interface SessionSnapshotWorkflowExtensions
|
|
521
|
+
extends Pick<SessionWorkflowProjection, 'loop'> {}
|
|
522
|
+
|
|
523
|
+
export interface SessionSnapshotMetadataExtensions {
|
|
524
|
+
context: {
|
|
525
|
+
branch?: string;
|
|
526
|
+
workingDirectory?: string;
|
|
527
|
+
};
|
|
528
|
+
observed?: SessionObservedProjection;
|
|
529
|
+
product?: SessionProductProjection;
|
|
530
|
+
tags: string[];
|
|
531
|
+
skills: SessionSkillRef[];
|
|
532
|
+
defaultAgent?: string;
|
|
533
|
+
workers?: SessionListItem[];
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
export interface SessionSnapshotExtensions
|
|
537
|
+
extends SessionSnapshotHistoryExtensions,
|
|
538
|
+
SessionSnapshotWorkExtensions,
|
|
539
|
+
SessionSnapshotWorkflowExtensions,
|
|
540
|
+
SessionSnapshotMetadataExtensions {}
|
|
541
|
+
|
|
542
|
+
export interface SessionSnapshot extends SessionSnapshotCore, SessionSnapshotExtensions {}
|
|
543
|
+
|
|
544
|
+
export interface CoderHubHydrationMessage
|
|
545
|
+
extends SessionTaskProjection<HydrationTaskState>,
|
|
546
|
+
SessionStreamWorkExtension {
|
|
547
|
+
type: 'session_hydration';
|
|
548
|
+
sessionId: string;
|
|
549
|
+
label?: string;
|
|
550
|
+
resumedAt: number;
|
|
551
|
+
entries: ConversationEntry[];
|
|
552
|
+
task?: string;
|
|
553
|
+
leadConnected?: boolean;
|
|
554
|
+
streamingState?: {
|
|
555
|
+
isStreaming?: boolean;
|
|
556
|
+
activeTasks?: Array<{
|
|
557
|
+
taskId: string;
|
|
558
|
+
agent: string;
|
|
559
|
+
}>;
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
export interface PresenceEventMessage {
|
|
564
|
+
type: 'presence';
|
|
565
|
+
event: 'session_join' | 'session_leave' | 'presence_update';
|
|
566
|
+
participant?: SessionParticipant;
|
|
567
|
+
participants?: SessionParticipant[];
|
|
568
|
+
sessionId: string;
|
|
569
|
+
timestamp: number;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
export interface BroadcastEventMessage {
|
|
573
|
+
type: 'broadcast';
|
|
574
|
+
event: string;
|
|
575
|
+
data: Record<string, unknown>;
|
|
576
|
+
category?: string;
|
|
577
|
+
sessionId?: string;
|
|
578
|
+
timestamp?: number;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
export type ReplayEntry = ConversationEntry;
|
|
582
|
+
|
|
583
|
+
export interface ReplayHistoryResponse {
|
|
584
|
+
sessionId: string;
|
|
585
|
+
entriesSource: 'durable_stream' | 'session_entries' | 'event_history' | 'none';
|
|
586
|
+
sourceCounts?: {
|
|
587
|
+
durableStream: number;
|
|
588
|
+
sessionEntries: number;
|
|
589
|
+
eventHistory: number;
|
|
590
|
+
};
|
|
591
|
+
entries: ReplayEntry[];
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
export interface SessionEventHistoryItem {
|
|
595
|
+
id: number;
|
|
596
|
+
event: string;
|
|
597
|
+
category: string;
|
|
598
|
+
agent?: string;
|
|
599
|
+
taskId?: string;
|
|
600
|
+
payload: Record<string, unknown>;
|
|
601
|
+
occurredAt: string;
|
|
602
|
+
ingestedAt: string;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
export interface SessionEventHistoryResponse {
|
|
606
|
+
sessionId: string;
|
|
607
|
+
events: SessionEventHistoryItem[];
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
export interface SessionParticipantHistoryItem {
|
|
611
|
+
id: string;
|
|
612
|
+
role: string;
|
|
613
|
+
transport: string;
|
|
614
|
+
agentRole?: string;
|
|
615
|
+
connectedAt: string;
|
|
616
|
+
disconnectedAt?: string;
|
|
617
|
+
lastActivityAt: string;
|
|
618
|
+
metadata?: Record<string, unknown>;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
export interface SessionParticipantsResponse {
|
|
622
|
+
sessionId: string;
|
|
623
|
+
participants: SessionParticipantHistoryItem[];
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
export interface SessionTodoSummary {
|
|
627
|
+
open: number;
|
|
628
|
+
in_progress: number;
|
|
629
|
+
done: number;
|
|
630
|
+
closed: number;
|
|
631
|
+
cancelled: number;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
export interface SessionTodoAssignee {
|
|
635
|
+
id: string;
|
|
636
|
+
name: string;
|
|
637
|
+
type?: string;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
export interface SessionTodoItem {
|
|
641
|
+
id: string;
|
|
642
|
+
title: string;
|
|
643
|
+
status: 'open' | 'in_progress' | 'done' | 'closed' | 'cancelled';
|
|
644
|
+
type?: string | null;
|
|
645
|
+
priority?: string | null;
|
|
646
|
+
parentTaskId?: string | null;
|
|
647
|
+
prdKey?: string | null;
|
|
648
|
+
externalRef?: string | null;
|
|
649
|
+
taskKey?: string | null;
|
|
650
|
+
origin?: string | null;
|
|
651
|
+
kind?: string | null;
|
|
652
|
+
assignee?: SessionTodoAssignee | null;
|
|
653
|
+
lastSessionId?: string | null;
|
|
654
|
+
sessionIds: string[];
|
|
655
|
+
tags: string[];
|
|
656
|
+
memoryKeys: string[];
|
|
657
|
+
memoryIds: string[];
|
|
658
|
+
touchedByAgents: string[];
|
|
659
|
+
lastTouchedByAgent?: string | null;
|
|
660
|
+
attachments: Array<Record<string, unknown>>;
|
|
661
|
+
attachmentCount: number;
|
|
662
|
+
createdAt: string;
|
|
663
|
+
updatedAt: string;
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
export interface SessionTodoListResponse {
|
|
667
|
+
sessionId: string;
|
|
668
|
+
ok: boolean;
|
|
669
|
+
op: 'session_todo_list';
|
|
670
|
+
count: number;
|
|
671
|
+
summary: SessionTodoSummary;
|
|
672
|
+
todos: SessionTodoItem[];
|
|
673
|
+
unavailable?: boolean;
|
|
674
|
+
message?: string;
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
export type SseSessionSnapshotParticipant = SessionDetailParticipant;
|
|
678
|
+
|
|
679
|
+
export interface SseHydrationTaskState {
|
|
680
|
+
taskId: string;
|
|
681
|
+
agent: string;
|
|
682
|
+
status: SessionTaskState['status'];
|
|
683
|
+
prompt: string;
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
export interface SseSessionSnapshotMessage {
|
|
687
|
+
type: 'snapshot';
|
|
688
|
+
sessionId: string;
|
|
689
|
+
label: string;
|
|
690
|
+
status: string;
|
|
691
|
+
createdAt: string;
|
|
692
|
+
mode: 'sandbox' | 'tui';
|
|
693
|
+
participants: SseSessionSnapshotParticipant[];
|
|
694
|
+
taskCount: number;
|
|
695
|
+
agentActivity: Record<string, SessionAgentActivity>;
|
|
696
|
+
stream?: SessionStreamProjection;
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
export interface SseHydrationMessage
|
|
700
|
+
extends SessionTaskProjection<SseHydrationTaskState>,
|
|
701
|
+
SessionStreamWorkExtension {
|
|
702
|
+
type: 'hydration';
|
|
703
|
+
sessionId: string;
|
|
704
|
+
entries: ConversationEntry[];
|
|
705
|
+
task?: string;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
export interface RpcEventMessage {
|
|
709
|
+
type: 'rpc_event';
|
|
710
|
+
event: Record<string, unknown>;
|
|
711
|
+
timestamp: number;
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
export interface RpcResponseMessage {
|
|
715
|
+
type: 'rpc_response';
|
|
716
|
+
response: Record<string, unknown>;
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
export interface RpcUiRequestMessage {
|
|
720
|
+
type: 'rpc_ui_request';
|
|
721
|
+
id: string;
|
|
722
|
+
method: string;
|
|
723
|
+
params: Record<string, unknown>;
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
export type ServerMessage =
|
|
727
|
+
| InitMessage
|
|
728
|
+
| HubResponse
|
|
729
|
+
| CoderHubHydrationMessage
|
|
730
|
+
| CoderHubStreamReadyMessage
|
|
731
|
+
| CoderHubSessionResumeMessage
|
|
732
|
+
| ConnectionRejectedMessage
|
|
733
|
+
| ProtocolErrorMessage
|
|
734
|
+
| SseSessionSnapshotMessage
|
|
735
|
+
| SseHydrationMessage
|
|
736
|
+
| PresenceEventMessage
|
|
737
|
+
| BroadcastEventMessage
|
|
738
|
+
| RpcEventMessage
|
|
739
|
+
| RpcResponseMessage
|
|
740
|
+
| RpcUiRequestMessage;
|
|
741
|
+
|
|
742
|
+
export interface AgentProgressUpdate {
|
|
743
|
+
agentName: string;
|
|
744
|
+
status:
|
|
745
|
+
| 'running'
|
|
746
|
+
| 'tool_start'
|
|
747
|
+
| 'tool_end'
|
|
748
|
+
| 'completed'
|
|
749
|
+
| 'failed'
|
|
750
|
+
| 'thinking_delta'
|
|
751
|
+
| 'text_delta';
|
|
752
|
+
toolCallId?: string;
|
|
753
|
+
currentTool?: string;
|
|
754
|
+
currentToolArgs?: string;
|
|
755
|
+
elapsed: number;
|
|
756
|
+
tokens?: { input: number; output: number; cost: number };
|
|
757
|
+
delta?: string;
|
|
758
|
+
}
|