@parall/sdk 1.12.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.
- package/dist/client.d.ts +329 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +718 -0
- package/dist/constants.d.ts +161 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +194 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/types.d.ts +1130 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +4 -0
- package/dist/ws.d.ts +83 -0
- package/dist/ws.d.ts.map +1 -0
- package/dist/ws.js +354 -0
- package/package.json +31 -0
- package/src/client.ts +1069 -0
- package/src/constants.ts +265 -0
- package/src/index.ts +6 -0
- package/src/types.ts +1399 -0
- package/src/ws.ts +404 -0
package/src/types.ts
ADDED
|
@@ -0,0 +1,1399 @@
|
|
|
1
|
+
// ============================================================
|
|
2
|
+
// Entity Types — mirror server data model
|
|
3
|
+
// ============================================================
|
|
4
|
+
|
|
5
|
+
export type UserType = 'human' | 'agent';
|
|
6
|
+
export type UserStatus = 'active' | 'disabled';
|
|
7
|
+
|
|
8
|
+
export interface User {
|
|
9
|
+
id: string;
|
|
10
|
+
type: UserType;
|
|
11
|
+
display_name: string;
|
|
12
|
+
avatar_url: string | null;
|
|
13
|
+
email: string | null;
|
|
14
|
+
phone: string | null;
|
|
15
|
+
status: UserStatus;
|
|
16
|
+
email_verified: boolean;
|
|
17
|
+
last_seen_at: string | null;
|
|
18
|
+
created_at: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type ChatType = 'direct' | 'group';
|
|
22
|
+
export type AgentRoutingMode = 'passive' | 'active' | 'smart';
|
|
23
|
+
|
|
24
|
+
export interface Chat {
|
|
25
|
+
id: string;
|
|
26
|
+
type: ChatType;
|
|
27
|
+
org_id: string;
|
|
28
|
+
name: string | null;
|
|
29
|
+
avatar_url: string | null;
|
|
30
|
+
description: string | null;
|
|
31
|
+
agent_routing_mode: AgentRoutingMode;
|
|
32
|
+
last_message_at: string | null;
|
|
33
|
+
last_message_preview: string | null;
|
|
34
|
+
last_message_sender: string | null;
|
|
35
|
+
creator_id: string;
|
|
36
|
+
created_at: string;
|
|
37
|
+
updated_at: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export type ChatMemberRole = 'owner' | 'admin' | 'member';
|
|
41
|
+
|
|
42
|
+
export type NotificationLevel = 'all' | 'mentions_only' | 'none';
|
|
43
|
+
|
|
44
|
+
// Push notification subscription
|
|
45
|
+
export interface PushSubscribeRequest {
|
|
46
|
+
platform: 'web' | 'ios' | 'android';
|
|
47
|
+
token: string;
|
|
48
|
+
device_id?: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Notification preferences
|
|
52
|
+
export interface NotifPrefs {
|
|
53
|
+
dm?: boolean;
|
|
54
|
+
mention?: boolean;
|
|
55
|
+
task_assign?: boolean;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface NotificationPreferences {
|
|
59
|
+
scope: string;
|
|
60
|
+
prefs: NotifPrefs;
|
|
61
|
+
updated_at: string;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface ChatMember {
|
|
65
|
+
chat_id: string;
|
|
66
|
+
user_id: string;
|
|
67
|
+
role: ChatMemberRole;
|
|
68
|
+
notification_level: NotificationLevel;
|
|
69
|
+
pinned: boolean;
|
|
70
|
+
joined_at: string;
|
|
71
|
+
user?: User;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export type MessageType =
|
|
75
|
+
| 'text'
|
|
76
|
+
| 'file'
|
|
77
|
+
| 'tool_call' // deprecated: use AgentStep
|
|
78
|
+
| 'tool_result' // deprecated: use AgentStep
|
|
79
|
+
| 'approval_card' // deprecated: use 'card' with card_type='approval'
|
|
80
|
+
| 'state_delta' // deprecated: use AgentStep
|
|
81
|
+
| 'card'
|
|
82
|
+
| 'system';
|
|
83
|
+
|
|
84
|
+
export const MENTION_ALL_USER_ID = 'all';
|
|
85
|
+
|
|
86
|
+
export interface Mention {
|
|
87
|
+
user_id: string;
|
|
88
|
+
offset: number;
|
|
89
|
+
length: number;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export interface LinkPreview {
|
|
93
|
+
url: string;
|
|
94
|
+
title?: string;
|
|
95
|
+
image?: string;
|
|
96
|
+
description?: string;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface TextContent {
|
|
100
|
+
text: string;
|
|
101
|
+
format?: string;
|
|
102
|
+
mentions?: Mention[];
|
|
103
|
+
link_previews?: LinkPreview[];
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export interface MediaContent {
|
|
107
|
+
attachment_id: string;
|
|
108
|
+
file_name: string;
|
|
109
|
+
file_size: number;
|
|
110
|
+
mime_type: string;
|
|
111
|
+
width?: number;
|
|
112
|
+
height?: number;
|
|
113
|
+
duration?: number;
|
|
114
|
+
caption?: string;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export interface ToolCallContent {
|
|
118
|
+
tool_name: string;
|
|
119
|
+
tool_input: Record<string, unknown>;
|
|
120
|
+
status: string;
|
|
121
|
+
started_at: string;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export interface ToolResultContent {
|
|
125
|
+
tool_call_id: string;
|
|
126
|
+
tool_name: string;
|
|
127
|
+
status: string;
|
|
128
|
+
output: string;
|
|
129
|
+
duration_ms: number;
|
|
130
|
+
collapsible: boolean;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export interface ApprovalOption {
|
|
134
|
+
key: string;
|
|
135
|
+
label: string;
|
|
136
|
+
style: 'primary' | 'danger' | 'secondary';
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export interface ApprovalCardContent {
|
|
140
|
+
approval_id: string;
|
|
141
|
+
title: string;
|
|
142
|
+
description: string;
|
|
143
|
+
action_type: string;
|
|
144
|
+
action_payload: Record<string, unknown>;
|
|
145
|
+
risk_level: string;
|
|
146
|
+
status: string;
|
|
147
|
+
options: ApprovalOption[];
|
|
148
|
+
expires_at: string;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// CardContent is the polymorphic content for 'card' message type.
|
|
152
|
+
// card_type discriminates the data payload.
|
|
153
|
+
export type CardContent =
|
|
154
|
+
| { card_type: 'approval'; data: ApprovalCardContent; approval_id?: string }
|
|
155
|
+
| { card_type: string; data: Record<string, unknown>; approval_id?: string };
|
|
156
|
+
|
|
157
|
+
export type AgentState = 'thinking' | 'tool_calling' | 'streaming' | 'waiting_approval' | 'completed' | 'error';
|
|
158
|
+
|
|
159
|
+
export interface StateDeltaContent {
|
|
160
|
+
state: AgentState;
|
|
161
|
+
text: string;
|
|
162
|
+
progress: number;
|
|
163
|
+
collapsible: boolean;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export type SystemEvent =
|
|
167
|
+
| 'chat_created'
|
|
168
|
+
| 'member_added'
|
|
169
|
+
| 'member_removed'
|
|
170
|
+
| 'member_role_changed'
|
|
171
|
+
| 'chat_renamed'
|
|
172
|
+
| 'chat_avatar_changed';
|
|
173
|
+
|
|
174
|
+
export interface SystemContent {
|
|
175
|
+
event: SystemEvent;
|
|
176
|
+
actor_id: string;
|
|
177
|
+
actor_name: string;
|
|
178
|
+
target_id?: string;
|
|
179
|
+
target_name?: string;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export type MessageContent =
|
|
183
|
+
| TextContent
|
|
184
|
+
| MediaContent
|
|
185
|
+
| ToolCallContent
|
|
186
|
+
| ToolResultContent
|
|
187
|
+
| ApprovalCardContent
|
|
188
|
+
| StateDeltaContent
|
|
189
|
+
| SystemContent
|
|
190
|
+
| IssueProjectionContent
|
|
191
|
+
| CardContent;
|
|
192
|
+
|
|
193
|
+
export interface Message {
|
|
194
|
+
id: string;
|
|
195
|
+
chat_id: string;
|
|
196
|
+
sender_id: string;
|
|
197
|
+
sender?: User;
|
|
198
|
+
thread_root_id: string | null;
|
|
199
|
+
message_type: MessageType;
|
|
200
|
+
content: MessageContent;
|
|
201
|
+
version: number;
|
|
202
|
+
reply_count: number;
|
|
203
|
+
edited_at: string | null;
|
|
204
|
+
deleted_at: string | null;
|
|
205
|
+
created_at: string;
|
|
206
|
+
idempotency_key: string | null;
|
|
207
|
+
agent_step_id?: string | null;
|
|
208
|
+
hints?: MessageHints | null;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export interface Attachment {
|
|
212
|
+
id: string;
|
|
213
|
+
org_id: string;
|
|
214
|
+
uploader_id: string;
|
|
215
|
+
file_name: string;
|
|
216
|
+
file_size: number;
|
|
217
|
+
mime_type: string;
|
|
218
|
+
storage_key: string;
|
|
219
|
+
status: 'pending' | 'uploaded';
|
|
220
|
+
width: number | null;
|
|
221
|
+
height: number | null;
|
|
222
|
+
thumbnail_key: string | null;
|
|
223
|
+
created_at: string;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export type ApprovalStatus = 'pending' | 'approved' | 'rejected' | 'expired';
|
|
227
|
+
|
|
228
|
+
export interface Approval {
|
|
229
|
+
id: string;
|
|
230
|
+
message_id: string;
|
|
231
|
+
chat_id: string;
|
|
232
|
+
requester_id: string;
|
|
233
|
+
status: ApprovalStatus;
|
|
234
|
+
action_type: string;
|
|
235
|
+
action_payload: Record<string, unknown>;
|
|
236
|
+
decided_by: string | null;
|
|
237
|
+
decided_at: string | null;
|
|
238
|
+
expires_at: string | null;
|
|
239
|
+
created_at: string;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
export type OrgMemberRole = 'owner' | 'admin' | 'member';
|
|
243
|
+
|
|
244
|
+
export interface Organization {
|
|
245
|
+
id: string;
|
|
246
|
+
name: string;
|
|
247
|
+
avatar_url: string | null;
|
|
248
|
+
is_personal: boolean;
|
|
249
|
+
created_at: string;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export interface OrgMember {
|
|
253
|
+
org_id: string;
|
|
254
|
+
user_id: string;
|
|
255
|
+
role: OrgMemberRole;
|
|
256
|
+
joined_at: string;
|
|
257
|
+
user?: User;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
// Invitation
|
|
261
|
+
|
|
262
|
+
export type InvitationStatus = 'pending' | 'accepted' | 'declined';
|
|
263
|
+
|
|
264
|
+
export interface OrgInvitation {
|
|
265
|
+
id: string;
|
|
266
|
+
org_id: string;
|
|
267
|
+
email: string;
|
|
268
|
+
role: OrgMemberRole;
|
|
269
|
+
status: InvitationStatus;
|
|
270
|
+
inviter_id: string;
|
|
271
|
+
expires_at: string;
|
|
272
|
+
accepted_at: string | null;
|
|
273
|
+
created_at: string;
|
|
274
|
+
inviter?: User;
|
|
275
|
+
org?: Organization;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
export interface InvitationPublicInfo {
|
|
279
|
+
id: string;
|
|
280
|
+
org_name: string;
|
|
281
|
+
org_avatar_url: string | null;
|
|
282
|
+
inviter_name: string;
|
|
283
|
+
email: string;
|
|
284
|
+
role: OrgMemberRole;
|
|
285
|
+
expires_at: string;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
export interface CreateInvitationRequest {
|
|
289
|
+
email: string;
|
|
290
|
+
role?: OrgMemberRole;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
export interface ApiKey {
|
|
294
|
+
id: string;
|
|
295
|
+
key: string;
|
|
296
|
+
agent_id: string;
|
|
297
|
+
created_at: string;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
export interface CreateAgentResponse {
|
|
301
|
+
user: User;
|
|
302
|
+
api_key: string;
|
|
303
|
+
machine?: Machine;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
export interface UnreadCount {
|
|
307
|
+
chat_id: string;
|
|
308
|
+
unread_count: number;
|
|
309
|
+
last_read_message_id: string;
|
|
310
|
+
last_read_at: string;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
// ============================================================
|
|
314
|
+
// API Response Types
|
|
315
|
+
// ============================================================
|
|
316
|
+
|
|
317
|
+
export interface PaginatedResponse<T> {
|
|
318
|
+
data: T[];
|
|
319
|
+
has_more: boolean;
|
|
320
|
+
next_cursor?: string;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
export interface ErrorResponse {
|
|
324
|
+
error: string;
|
|
325
|
+
code: string;
|
|
326
|
+
details?: Record<string, unknown>;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
export interface AuthTokens {
|
|
330
|
+
access_token: string;
|
|
331
|
+
refresh_token: string;
|
|
332
|
+
user: User;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
export interface RegisterResponse {
|
|
336
|
+
email: string;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
export interface CheckEmailResponse {
|
|
340
|
+
exists: boolean;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
export interface PresignResponse {
|
|
344
|
+
upload_url: string;
|
|
345
|
+
attachment_id: string;
|
|
346
|
+
expires_in: number;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
export interface WsTicketResponse {
|
|
350
|
+
ticket: string;
|
|
351
|
+
expires_at: string;
|
|
352
|
+
ws_url: string;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
// ============================================================
|
|
356
|
+
// API Request Types
|
|
357
|
+
// ============================================================
|
|
358
|
+
|
|
359
|
+
export interface RegisterRequest {
|
|
360
|
+
email: string;
|
|
361
|
+
password: string;
|
|
362
|
+
display_name: string;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
export interface LoginRequest {
|
|
366
|
+
email: string;
|
|
367
|
+
password: string;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
export interface CreateChatRequest {
|
|
371
|
+
type: ChatType;
|
|
372
|
+
org_id: string;
|
|
373
|
+
name?: string;
|
|
374
|
+
description?: string;
|
|
375
|
+
member_ids: string[];
|
|
376
|
+
agent_routing_mode?: AgentRoutingMode;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
export interface MessageHints {
|
|
380
|
+
no_reply?: boolean;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
export interface SendMessageRequest {
|
|
384
|
+
message_type: MessageType;
|
|
385
|
+
content: MessageContent;
|
|
386
|
+
thread_root_id?: string;
|
|
387
|
+
idempotency_key?: string;
|
|
388
|
+
agent_step_id?: string;
|
|
389
|
+
hints?: MessageHints;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
export interface SendDirectMessageRequest {
|
|
393
|
+
user_id: string;
|
|
394
|
+
message_type: MessageType;
|
|
395
|
+
content: MessageContent;
|
|
396
|
+
thread_root_id?: string;
|
|
397
|
+
idempotency_key?: string;
|
|
398
|
+
agent_step_id?: string;
|
|
399
|
+
hints?: MessageHints;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
export interface DirectMessageResponse {
|
|
403
|
+
chat: Chat;
|
|
404
|
+
message: Message;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
export interface PatchMessageRequest {
|
|
408
|
+
version: number;
|
|
409
|
+
ops: JsonPatchOp[];
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
export interface JsonPatchOp {
|
|
413
|
+
op: 'replace' | 'add';
|
|
414
|
+
path: string;
|
|
415
|
+
value: unknown;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
export interface WorkspaceFiles {
|
|
419
|
+
soul_md?: string;
|
|
420
|
+
agents_md?: string;
|
|
421
|
+
tools_md?: string;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
export interface CreateAgentRequest {
|
|
425
|
+
display_name: string;
|
|
426
|
+
agent_provider?: string;
|
|
427
|
+
agent_endpoint?: string;
|
|
428
|
+
agent_model?: string;
|
|
429
|
+
agent_permissions?: string[];
|
|
430
|
+
runtime_type?: string; // "openclaw" | "claude-code" | "codex"; default "openclaw"
|
|
431
|
+
machine_type?: string;
|
|
432
|
+
machine_label?: string;
|
|
433
|
+
workspace?: WorkspaceFiles;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
// ---- Machine types ----
|
|
437
|
+
|
|
438
|
+
export type MachineStatus = 'provisioning' | 'starting' | 'running' | 'stopped' | 'error' | 'terminated';
|
|
439
|
+
|
|
440
|
+
export interface Machine {
|
|
441
|
+
id: string;
|
|
442
|
+
org_id: string;
|
|
443
|
+
label: string;
|
|
444
|
+
status: MachineStatus;
|
|
445
|
+
compute_provider: string;
|
|
446
|
+
runtime_type: string;
|
|
447
|
+
region: string | null;
|
|
448
|
+
created_by: string;
|
|
449
|
+
created_at: string;
|
|
450
|
+
updated_at: string;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
// ---- Agent enriched types ----
|
|
454
|
+
|
|
455
|
+
export interface RunConfig {
|
|
456
|
+
intermediate_text?: 'step_only' | 'chat';
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
export interface AgentProfile {
|
|
460
|
+
user_id: string;
|
|
461
|
+
provider: string | null;
|
|
462
|
+
endpoint: string | null;
|
|
463
|
+
model: string | null;
|
|
464
|
+
permissions: string[];
|
|
465
|
+
machine_id: string | null;
|
|
466
|
+
runtime_type: string;
|
|
467
|
+
run_config?: RunConfig;
|
|
468
|
+
created_by: string;
|
|
469
|
+
created_at: string;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
export interface AgentPresence {
|
|
473
|
+
online: boolean;
|
|
474
|
+
status: string; // "online" | "busy" | "error" | "offline"
|
|
475
|
+
session_id?: string;
|
|
476
|
+
telemetry?: Record<string, unknown>;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
export interface AgentWithRuntime extends User {
|
|
480
|
+
agent_profile?: AgentProfile | null;
|
|
481
|
+
machine?: Machine | null;
|
|
482
|
+
presence?: AgentPresence | null;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
export interface PresignUploadRequest {
|
|
486
|
+
file_name: string;
|
|
487
|
+
file_size: number;
|
|
488
|
+
mime_type: string;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
export interface FileUrlResponse {
|
|
492
|
+
url: string;
|
|
493
|
+
expires_in: number;
|
|
494
|
+
width?: number;
|
|
495
|
+
height?: number;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
// ============================================================
|
|
499
|
+
// Task Types
|
|
500
|
+
// ============================================================
|
|
501
|
+
|
|
502
|
+
export type TaskStatus = 'todo' | 'in_progress' | 'in_review' | 'done' | 'canceled';
|
|
503
|
+
export type TaskPriority = 'high' | 'normal' | 'low';
|
|
504
|
+
export type TaskRelationTargetType = 'task' | 'message' | 'chat' | 'agent_session';
|
|
505
|
+
export type TaskRelationType = 'blocks' | 'related' | 'duplicate' | 'source' | 'reference' | 'discussion' | 'execution';
|
|
506
|
+
|
|
507
|
+
export interface Task {
|
|
508
|
+
id: string;
|
|
509
|
+
org_id: string;
|
|
510
|
+
title: string;
|
|
511
|
+
description: string | null;
|
|
512
|
+
status: TaskStatus;
|
|
513
|
+
priority: TaskPriority;
|
|
514
|
+
assignee_id: string | null;
|
|
515
|
+
creator_id: string;
|
|
516
|
+
parent_id: string | null;
|
|
517
|
+
project_id: string | null;
|
|
518
|
+
seq_number: number | null;
|
|
519
|
+
identifier: string | null;
|
|
520
|
+
sort_order: number;
|
|
521
|
+
assignee?: User;
|
|
522
|
+
creator?: User;
|
|
523
|
+
created_at: string;
|
|
524
|
+
updated_at: string;
|
|
525
|
+
started_at: string | null;
|
|
526
|
+
completed_at: string | null;
|
|
527
|
+
canceled_at: string | null;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/** Content shape for system messages that project issue operations into chat. */
|
|
531
|
+
export interface IssueProjectionContent {
|
|
532
|
+
event: 'issue_created' | 'issue_status_changed' | 'issue_assigned';
|
|
533
|
+
actor_id: string;
|
|
534
|
+
actor_name: string;
|
|
535
|
+
issue_id: string;
|
|
536
|
+
identifier: string;
|
|
537
|
+
title: string;
|
|
538
|
+
old_status?: string;
|
|
539
|
+
new_status?: string;
|
|
540
|
+
assignee_id?: string;
|
|
541
|
+
assignee_name?: string;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
export interface TaskRelation {
|
|
545
|
+
id: string;
|
|
546
|
+
task_id: string;
|
|
547
|
+
target_type: TaskRelationTargetType;
|
|
548
|
+
target_id: string;
|
|
549
|
+
relation_type: TaskRelationType;
|
|
550
|
+
created_by: string;
|
|
551
|
+
created_at: string;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
export interface CreateTaskRequest {
|
|
555
|
+
title: string;
|
|
556
|
+
description?: string;
|
|
557
|
+
status?: TaskStatus;
|
|
558
|
+
priority?: TaskPriority;
|
|
559
|
+
assignee_id?: string;
|
|
560
|
+
parent_id?: string;
|
|
561
|
+
project_id?: string;
|
|
562
|
+
source_chat_id?: string;
|
|
563
|
+
sort_order?: number;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
export interface UpdateTaskRequest {
|
|
567
|
+
title?: string;
|
|
568
|
+
description?: string;
|
|
569
|
+
status?: TaskStatus;
|
|
570
|
+
priority?: TaskPriority;
|
|
571
|
+
assignee_id?: string | null;
|
|
572
|
+
parent_id?: string | null;
|
|
573
|
+
project_id?: string | null;
|
|
574
|
+
sort_order?: number;
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
export interface CreateTaskRelationRequest {
|
|
578
|
+
target_type: TaskRelationTargetType;
|
|
579
|
+
target_id: string;
|
|
580
|
+
relation_type: TaskRelationType;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
// ============================================================
|
|
584
|
+
// Project Types
|
|
585
|
+
// ============================================================
|
|
586
|
+
|
|
587
|
+
export type ProjectStatus = 'active' | 'paused' | 'completed' | 'archived';
|
|
588
|
+
|
|
589
|
+
export interface Project {
|
|
590
|
+
id: string;
|
|
591
|
+
org_id: string;
|
|
592
|
+
name: string;
|
|
593
|
+
key: string;
|
|
594
|
+
description: string | null;
|
|
595
|
+
lead_id: string | null;
|
|
596
|
+
status: ProjectStatus;
|
|
597
|
+
color: string | null;
|
|
598
|
+
sort_order: number;
|
|
599
|
+
created_at: string;
|
|
600
|
+
updated_at: string;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
export interface CreateProjectRequest {
|
|
604
|
+
name: string;
|
|
605
|
+
key?: string;
|
|
606
|
+
description?: string;
|
|
607
|
+
lead_id?: string;
|
|
608
|
+
color?: string;
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
export interface UpdateProjectRequest {
|
|
612
|
+
name?: string;
|
|
613
|
+
key?: string;
|
|
614
|
+
description?: string | null;
|
|
615
|
+
lead_id?: string | null;
|
|
616
|
+
status?: ProjectStatus;
|
|
617
|
+
color?: string | null;
|
|
618
|
+
sort_order?: number;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
// ============================================================
|
|
622
|
+
// Wiki Types
|
|
623
|
+
// ============================================================
|
|
624
|
+
|
|
625
|
+
export type WikiChangesetStatus =
|
|
626
|
+
| 'draft'
|
|
627
|
+
| 'proposed'
|
|
628
|
+
| 'approval_pending'
|
|
629
|
+
| 'approved'
|
|
630
|
+
| 'rejected'
|
|
631
|
+
| 'merged'
|
|
632
|
+
| 'closed'
|
|
633
|
+
| 'superseded';
|
|
634
|
+
|
|
635
|
+
export interface Wiki {
|
|
636
|
+
id: string;
|
|
637
|
+
org_id: string;
|
|
638
|
+
slug: string;
|
|
639
|
+
name: string;
|
|
640
|
+
repo_owner: string;
|
|
641
|
+
repo_name: string;
|
|
642
|
+
default_branch: string;
|
|
643
|
+
created_by: string;
|
|
644
|
+
created_at: string;
|
|
645
|
+
updated_at: string;
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
export interface WikiFileChange {
|
|
649
|
+
path: string;
|
|
650
|
+
action: 'create' | 'update' | 'delete';
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
export interface WikiChangeset {
|
|
654
|
+
id: string;
|
|
655
|
+
wiki_id: string;
|
|
656
|
+
title: string;
|
|
657
|
+
message: string | null;
|
|
658
|
+
status: WikiChangesetStatus;
|
|
659
|
+
merge_commit: string | null;
|
|
660
|
+
file_changes: WikiFileChange[];
|
|
661
|
+
changed_paths: string[];
|
|
662
|
+
approval_id: string | null;
|
|
663
|
+
source_chat_id: string | null;
|
|
664
|
+
source_message_id: string | null;
|
|
665
|
+
source_run_id: string | null;
|
|
666
|
+
last_error: string | null;
|
|
667
|
+
created_by: string;
|
|
668
|
+
created_at: string;
|
|
669
|
+
updated_at: string;
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
export interface WikiTreeEntry {
|
|
673
|
+
name: string;
|
|
674
|
+
path: string;
|
|
675
|
+
type: 'tree' | 'blob';
|
|
676
|
+
size?: number;
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
export interface WikiTreeResponse {
|
|
680
|
+
data: WikiTreeEntry[];
|
|
681
|
+
path: string;
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
export interface WikiFileManifestEntry {
|
|
685
|
+
path: string;
|
|
686
|
+
sha256: string;
|
|
687
|
+
size: number;
|
|
688
|
+
version: number;
|
|
689
|
+
updated_at: string;
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
export interface WikiNodeSection {
|
|
693
|
+
wiki_id: string;
|
|
694
|
+
wiki_slug: string;
|
|
695
|
+
wiki_name: string;
|
|
696
|
+
node_id: string;
|
|
697
|
+
path: string;
|
|
698
|
+
title: string;
|
|
699
|
+
heading_path?: string[];
|
|
700
|
+
section_path: string;
|
|
701
|
+
level: number;
|
|
702
|
+
start_line: number;
|
|
703
|
+
end_line: number;
|
|
704
|
+
content: string;
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
export interface WikiNodeSectionArtifact {
|
|
708
|
+
version: number;
|
|
709
|
+
generated_at: string;
|
|
710
|
+
wiki_id: string;
|
|
711
|
+
wiki_slug: string;
|
|
712
|
+
wiki_name: string;
|
|
713
|
+
ref: string;
|
|
714
|
+
manifest_digest: string;
|
|
715
|
+
file_count: number;
|
|
716
|
+
nodes: WikiNodeSection[];
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
export interface WikiSearchResult {
|
|
720
|
+
wiki_id: string;
|
|
721
|
+
wiki_slug: string;
|
|
722
|
+
wiki_name: string;
|
|
723
|
+
node_id: string;
|
|
724
|
+
path: string;
|
|
725
|
+
title: string;
|
|
726
|
+
heading_path?: string[];
|
|
727
|
+
section_path: string;
|
|
728
|
+
level: number;
|
|
729
|
+
start_line: number;
|
|
730
|
+
end_line: number;
|
|
731
|
+
score: number;
|
|
732
|
+
snippet: string;
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
export interface WikiSearchResponse {
|
|
736
|
+
wiki_id: string;
|
|
737
|
+
wiki_slug: string;
|
|
738
|
+
wiki_name: string;
|
|
739
|
+
query: string;
|
|
740
|
+
ref: string;
|
|
741
|
+
results: WikiSearchResult[];
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
export interface WikiPageIndexEntry {
|
|
745
|
+
path: string;
|
|
746
|
+
title: string;
|
|
747
|
+
top_headings: string[];
|
|
748
|
+
size_bytes: number;
|
|
749
|
+
section_count: number;
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
export interface WikiPageIndex {
|
|
753
|
+
wiki_id: string;
|
|
754
|
+
wiki_slug: string;
|
|
755
|
+
wiki_name: string;
|
|
756
|
+
ref: string;
|
|
757
|
+
generated_at: string;
|
|
758
|
+
page_count: number;
|
|
759
|
+
pages: WikiPageIndexEntry[];
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
export interface WikiFileRef {
|
|
763
|
+
source_path: string;
|
|
764
|
+
uri: string;
|
|
765
|
+
context?: string;
|
|
766
|
+
prefix: string;
|
|
767
|
+
entity_id: string;
|
|
768
|
+
target_path?: string;
|
|
769
|
+
fragment?: string;
|
|
770
|
+
line: number;
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
export interface WikiRefsResponse {
|
|
774
|
+
wiki_id: string;
|
|
775
|
+
wiki_slug: string;
|
|
776
|
+
wiki_name: string;
|
|
777
|
+
ref: string;
|
|
778
|
+
total: number;
|
|
779
|
+
refs: WikiFileRef[];
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
export interface WikiBrokenRef extends WikiFileRef {
|
|
783
|
+
reason: string;
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
export interface WikiRefsCheckResponse {
|
|
787
|
+
wiki_id: string;
|
|
788
|
+
wiki_slug: string;
|
|
789
|
+
wiki_name: string;
|
|
790
|
+
ref: string;
|
|
791
|
+
total: number;
|
|
792
|
+
broken: WikiBrokenRef[];
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
export interface WikiDiffFile {
|
|
796
|
+
path: string;
|
|
797
|
+
action?: string; // "create" | "update" | "delete"
|
|
798
|
+
additions: number;
|
|
799
|
+
deletions: number;
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
export interface WikiDiff {
|
|
803
|
+
patch: string;
|
|
804
|
+
files: WikiDiffFile[];
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
export interface CreateWikiRequest {
|
|
808
|
+
slug: string;
|
|
809
|
+
name: string;
|
|
810
|
+
default_branch?: string;
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
export interface CreateWikiChangesetRequest {
|
|
814
|
+
title: string;
|
|
815
|
+
message?: string;
|
|
816
|
+
file_changes: Array<{
|
|
817
|
+
path: string;
|
|
818
|
+
action: 'create' | 'update' | 'delete';
|
|
819
|
+
content_base64?: string;
|
|
820
|
+
base_version?: number;
|
|
821
|
+
}>;
|
|
822
|
+
source_chat_id?: string;
|
|
823
|
+
source_message_id?: string;
|
|
824
|
+
source_run_id?: string;
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
export interface UpdateWikiChangesetRequest {
|
|
828
|
+
title?: string;
|
|
829
|
+
message?: string;
|
|
830
|
+
file_changes?: Array<{
|
|
831
|
+
path: string;
|
|
832
|
+
action: 'create' | 'update' | 'delete';
|
|
833
|
+
content_base64?: string;
|
|
834
|
+
base_version?: number;
|
|
835
|
+
}>;
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
export interface WikiCommit {
|
|
839
|
+
sha: string;
|
|
840
|
+
title: string;
|
|
841
|
+
message: string;
|
|
842
|
+
author_name: string;
|
|
843
|
+
author_email: string;
|
|
844
|
+
date: string;
|
|
845
|
+
changeset_id?: string;
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
export interface WikiBlameEntry {
|
|
849
|
+
sha: string;
|
|
850
|
+
lines: string[];
|
|
851
|
+
message: string;
|
|
852
|
+
author: string;
|
|
853
|
+
date: string;
|
|
854
|
+
changeset_id?: string;
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
// ============================================================
|
|
858
|
+
// Wiki Path Scopes (AFCS ACL)
|
|
859
|
+
// ============================================================
|
|
860
|
+
|
|
861
|
+
export interface WikiPathScope {
|
|
862
|
+
id: string;
|
|
863
|
+
wiki_id: string;
|
|
864
|
+
path: string;
|
|
865
|
+
readers: unknown;
|
|
866
|
+
maintainers: unknown;
|
|
867
|
+
admins: unknown;
|
|
868
|
+
created_by: string;
|
|
869
|
+
created_at: string;
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
export interface CreateWikiPathScopeRequest {
|
|
873
|
+
path: string;
|
|
874
|
+
readers?: unknown;
|
|
875
|
+
maintainers?: unknown;
|
|
876
|
+
admins?: unknown;
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
export interface WikiAccessStatus {
|
|
880
|
+
path: string;
|
|
881
|
+
read: boolean;
|
|
882
|
+
maintain: boolean;
|
|
883
|
+
admin: boolean;
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
export interface CreateWikiAccessRequest {
|
|
887
|
+
path: string;
|
|
888
|
+
reason: string;
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
// ============================================================
|
|
892
|
+
// Wiki Operations (Audit Log)
|
|
893
|
+
// ============================================================
|
|
894
|
+
|
|
895
|
+
export interface WikiOperation {
|
|
896
|
+
id: string;
|
|
897
|
+
wiki_id: string;
|
|
898
|
+
actor_id: string;
|
|
899
|
+
op_type: string;
|
|
900
|
+
changeset_id?: string | null;
|
|
901
|
+
payload: Record<string, unknown>;
|
|
902
|
+
parent_op_id?: string | null;
|
|
903
|
+
created_at: string;
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
export interface WikiOperationsResponse {
|
|
907
|
+
data: WikiOperation[];
|
|
908
|
+
has_more: boolean;
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
// ============================================================
|
|
912
|
+
// Wiki Blob
|
|
913
|
+
// ============================================================
|
|
914
|
+
|
|
915
|
+
export interface WikiBlob {
|
|
916
|
+
path: string;
|
|
917
|
+
content: string;
|
|
918
|
+
size: number;
|
|
919
|
+
encoding: string;
|
|
920
|
+
sha256?: string;
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
// ============================================================
|
|
924
|
+
// WebSocket Event Types
|
|
925
|
+
// ============================================================
|
|
926
|
+
|
|
927
|
+
export interface WsFrame<T = unknown> {
|
|
928
|
+
type: string;
|
|
929
|
+
seq?: number;
|
|
930
|
+
data: T;
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
export interface HelloData {
|
|
934
|
+
conn_id: string;
|
|
935
|
+
user_id: string;
|
|
936
|
+
session_id?: string; // agent-only: server-assigned session ID
|
|
937
|
+
server_time: string;
|
|
938
|
+
heartbeat_interval: number;
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
export interface MessageNewData {
|
|
942
|
+
id: string;
|
|
943
|
+
chat_id: string;
|
|
944
|
+
sender_id: string;
|
|
945
|
+
sender?: User;
|
|
946
|
+
thread_root_id: string | null;
|
|
947
|
+
message_type: MessageType;
|
|
948
|
+
content: MessageContent;
|
|
949
|
+
version: number;
|
|
950
|
+
created_at: string;
|
|
951
|
+
reply_count?: number;
|
|
952
|
+
edited_at?: string | null;
|
|
953
|
+
deleted_at?: string | null;
|
|
954
|
+
idempotency_key?: string | null;
|
|
955
|
+
agent_step_id?: string | null;
|
|
956
|
+
hints?: MessageHints | null;
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
export interface MessagePatchData {
|
|
960
|
+
message_id: string;
|
|
961
|
+
chat_id: string;
|
|
962
|
+
version: number;
|
|
963
|
+
ops: JsonPatchOp[];
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
export interface MessageEditData {
|
|
967
|
+
message_id: string;
|
|
968
|
+
chat_id: string;
|
|
969
|
+
content: MessageContent;
|
|
970
|
+
edited_at: string;
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
export interface MessageDeleteData {
|
|
974
|
+
message_id: string;
|
|
975
|
+
chat_id: string;
|
|
976
|
+
thread_root_id?: string;
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
export interface TypingUpdateData {
|
|
980
|
+
chat_id: string;
|
|
981
|
+
thread_root_id: string | null;
|
|
982
|
+
user_id: string;
|
|
983
|
+
action: 'start' | 'stop';
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
export interface ChatCreatedData extends Chat {}
|
|
987
|
+
|
|
988
|
+
export interface ChatUpdateData {
|
|
989
|
+
chat_id: string;
|
|
990
|
+
changes: Partial<Pick<Chat, 'name' | 'avatar_url' | 'description' | 'agent_routing_mode' | 'last_message_at' | 'last_message_preview' | 'last_message_sender'>>;
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
export interface ChatDeletedData {
|
|
994
|
+
chat_id: string;
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
/** @deprecated Use CardUpdateData */
|
|
998
|
+
export type ApprovalUpdateData = CardUpdateData;
|
|
999
|
+
|
|
1000
|
+
export interface CardUpdateData {
|
|
1001
|
+
card_type: string;
|
|
1002
|
+
approval_id?: string;
|
|
1003
|
+
message_id: string;
|
|
1004
|
+
chat_id: string;
|
|
1005
|
+
status: string;
|
|
1006
|
+
decided_by?: string;
|
|
1007
|
+
decided_at?: string;
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
export interface RecoveryOverflowData {
|
|
1011
|
+
message: string;
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
export interface WatchingData {
|
|
1015
|
+
chat_ids: string[];
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
export interface MembershipChangedData {
|
|
1019
|
+
chat_id: string;
|
|
1020
|
+
user_id: string;
|
|
1021
|
+
action: 'added' | 'removed';
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
// ---- Task Comment & Activity Types ----
|
|
1025
|
+
|
|
1026
|
+
export type TaskActivityAction = 'created' | 'field_changed' | 'commented';
|
|
1027
|
+
|
|
1028
|
+
export interface TaskComment {
|
|
1029
|
+
id: string;
|
|
1030
|
+
task_id: string;
|
|
1031
|
+
author_id: string;
|
|
1032
|
+
body: string;
|
|
1033
|
+
mentions?: Mention[];
|
|
1034
|
+
agent_step_id?: string | null;
|
|
1035
|
+
created_at: string;
|
|
1036
|
+
updated_at: string;
|
|
1037
|
+
author?: User;
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
export interface TaskActivity {
|
|
1041
|
+
id: string;
|
|
1042
|
+
task_id: string;
|
|
1043
|
+
actor_id: string;
|
|
1044
|
+
action: TaskActivityAction;
|
|
1045
|
+
field?: string;
|
|
1046
|
+
old_value?: string;
|
|
1047
|
+
new_value?: string;
|
|
1048
|
+
created_at: string;
|
|
1049
|
+
actor?: User;
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
export interface CreateTaskCommentRequest {
|
|
1053
|
+
body: string;
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
export interface UpdateTaskCommentRequest {
|
|
1057
|
+
body: string;
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
// ---- Task WS Event Data ----
|
|
1061
|
+
|
|
1062
|
+
export type TaskCreatedData = Task;
|
|
1063
|
+
export type TaskUpdatedData = Task;
|
|
1064
|
+
/** Sent to user:{agentID} channel when a task is assigned to an agent. Data is the full Task. */
|
|
1065
|
+
export type TaskAssignedData = Task;
|
|
1066
|
+
export interface TaskDeletedData {
|
|
1067
|
+
task_id: string;
|
|
1068
|
+
org_id: string;
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
export type TaskCommentCreatedData = TaskComment;
|
|
1072
|
+
export type TaskCommentUpdatedData = TaskComment;
|
|
1073
|
+
export interface TaskCommentDeletedData {
|
|
1074
|
+
comment_id: string;
|
|
1075
|
+
task_id: string;
|
|
1076
|
+
org_id: string;
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
export type ProjectCreatedData = Project;
|
|
1080
|
+
export type ProjectUpdatedData = Project;
|
|
1081
|
+
export interface ProjectDeletedData {
|
|
1082
|
+
project_id: string;
|
|
1083
|
+
org_id: string;
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
// ---- Agent Session / Step ----
|
|
1087
|
+
|
|
1088
|
+
export interface AgentSessionDB {
|
|
1089
|
+
id: string;
|
|
1090
|
+
agent_id: string;
|
|
1091
|
+
org_id: string;
|
|
1092
|
+
status: string; // idle | active | completed | failed | cancelled
|
|
1093
|
+
runtime_type: string;
|
|
1094
|
+
runtime_key: string | null;
|
|
1095
|
+
runtime_ref: Record<string, unknown> | null;
|
|
1096
|
+
started_at: string;
|
|
1097
|
+
finished_at: string | null;
|
|
1098
|
+
created_at: string;
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
export interface AgentStep {
|
|
1102
|
+
id: string;
|
|
1103
|
+
session_id: string;
|
|
1104
|
+
step_type: string;
|
|
1105
|
+
target_type: string;
|
|
1106
|
+
target_id: string | null;
|
|
1107
|
+
content: Record<string, unknown>;
|
|
1108
|
+
group_key: string | null;
|
|
1109
|
+
runtime_key: string | null;
|
|
1110
|
+
idempotency_key?: string;
|
|
1111
|
+
created_at: string;
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1114
|
+
export interface CreateAgentSessionRequest {
|
|
1115
|
+
runtime_type?: string;
|
|
1116
|
+
runtime_key?: string;
|
|
1117
|
+
runtime_ref?: Record<string, unknown>;
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
export interface CreateAgentStepRequest {
|
|
1121
|
+
step_type: string;
|
|
1122
|
+
content: Record<string, unknown>;
|
|
1123
|
+
target_type?: string;
|
|
1124
|
+
target_id?: string;
|
|
1125
|
+
group_key?: string;
|
|
1126
|
+
runtime_key?: string;
|
|
1127
|
+
idempotency_key?: string;
|
|
1128
|
+
projection?: boolean; // project text steps to chat message or task comment (controlled by agent's run_config)
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
export interface UpdateAgentSessionRequest {
|
|
1132
|
+
status: string;
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
// Agent session WS event data
|
|
1136
|
+
export type AgentSessionNewData = AgentSessionDB;
|
|
1137
|
+
|
|
1138
|
+
export interface AgentSessionUpdateData {
|
|
1139
|
+
session_id: string;
|
|
1140
|
+
status: string;
|
|
1141
|
+
finished_at?: string;
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
export interface AgentStepNewData extends AgentStep {}
|
|
1145
|
+
|
|
1146
|
+
export type WikiChangesetCreatedData = WikiChangeset & { org_id: string };
|
|
1147
|
+
export type WikiChangesetUpdatedData = WikiChangeset & { org_id: string };
|
|
1148
|
+
|
|
1149
|
+
// ============================================================
|
|
1150
|
+
// Inbox Types
|
|
1151
|
+
// ============================================================
|
|
1152
|
+
|
|
1153
|
+
export type InboxItemType =
|
|
1154
|
+
| 'mention' | 'task_assign' | 'task_update'
|
|
1155
|
+
| 'task_comment' | 'approval_request'
|
|
1156
|
+
| 'agent_alert' | 'invitation';
|
|
1157
|
+
|
|
1158
|
+
export interface InboxItem {
|
|
1159
|
+
id: string;
|
|
1160
|
+
org_id: string;
|
|
1161
|
+
recipient_id: string;
|
|
1162
|
+
actor_id: string | null;
|
|
1163
|
+
type: InboxItemType;
|
|
1164
|
+
entity_type: string;
|
|
1165
|
+
entity_id: string;
|
|
1166
|
+
group_key: string;
|
|
1167
|
+
source_type: string;
|
|
1168
|
+
source_id: string;
|
|
1169
|
+
chat_id: string | null;
|
|
1170
|
+
task_id: string | null;
|
|
1171
|
+
title: string;
|
|
1172
|
+
body: string;
|
|
1173
|
+
read_at: string | null;
|
|
1174
|
+
archived_at: string | null;
|
|
1175
|
+
snoozed_until: string | null;
|
|
1176
|
+
created_at: string;
|
|
1177
|
+
updated_at: string;
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
// ============================================================
|
|
1181
|
+
// Dispatch Types (agent event delivery)
|
|
1182
|
+
// ============================================================
|
|
1183
|
+
|
|
1184
|
+
export type DispatchEventType = 'message' | 'task_assign';
|
|
1185
|
+
export type DispatchStatus = 'pending' | 'acked';
|
|
1186
|
+
|
|
1187
|
+
export interface DispatchEvent {
|
|
1188
|
+
id: string;
|
|
1189
|
+
org_id: string;
|
|
1190
|
+
agent_id: string;
|
|
1191
|
+
event_type: DispatchEventType;
|
|
1192
|
+
source_type: string;
|
|
1193
|
+
source_id: string;
|
|
1194
|
+
chat_id: string | null;
|
|
1195
|
+
task_id: string | null;
|
|
1196
|
+
actor_id: string | null;
|
|
1197
|
+
status: DispatchStatus;
|
|
1198
|
+
acked_at: string | null;
|
|
1199
|
+
created_at: string;
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1202
|
+
export type DispatchNewData = DispatchEvent;
|
|
1203
|
+
|
|
1204
|
+
export type InboxNewData = InboxItem;
|
|
1205
|
+
|
|
1206
|
+
export interface InboxUpdateData {
|
|
1207
|
+
id: string;
|
|
1208
|
+
read_at?: string | null;
|
|
1209
|
+
archived_at?: string | null;
|
|
1210
|
+
snoozed_until?: string | null;
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
export interface InboxBulkUpdateData {
|
|
1214
|
+
action: 'mark_all_read' | 'archive_all';
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
export interface InboxUnreadCountResponse {
|
|
1218
|
+
count: number;
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
export interface ReadPositionUpdateData {
|
|
1222
|
+
chat_id: string;
|
|
1223
|
+
last_read_message_id: string;
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
export interface NotificationAlertData {
|
|
1227
|
+
title: string;
|
|
1228
|
+
body: string;
|
|
1229
|
+
category: string; // "mention" | "dm" | "task_assign"
|
|
1230
|
+
data: Record<string, string> | null; // {org_id, chat_id, url, ...}
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1233
|
+
export type WsEventMap = {
|
|
1234
|
+
'hello': HelloData;
|
|
1235
|
+
'message.new': MessageNewData;
|
|
1236
|
+
'message.patch': MessagePatchData;
|
|
1237
|
+
'message.edit': MessageEditData;
|
|
1238
|
+
'message.delete': MessageDeleteData;
|
|
1239
|
+
'typing.update': TypingUpdateData;
|
|
1240
|
+
'chat.created': ChatCreatedData;
|
|
1241
|
+
'chat.update': ChatUpdateData;
|
|
1242
|
+
'chat.deleted': ChatDeletedData;
|
|
1243
|
+
'approval.update': ApprovalUpdateData; // deprecated, kept for backward compat
|
|
1244
|
+
'card.update': CardUpdateData;
|
|
1245
|
+
'recovery.overflow': RecoveryOverflowData;
|
|
1246
|
+
'watching': WatchingData;
|
|
1247
|
+
'pong': { ts: number };
|
|
1248
|
+
'membership.changed': MembershipChangedData;
|
|
1249
|
+
'task.created': TaskCreatedData;
|
|
1250
|
+
'task.updated': TaskUpdatedData;
|
|
1251
|
+
'task.deleted': TaskDeletedData;
|
|
1252
|
+
'task.assigned': TaskAssignedData;
|
|
1253
|
+
'task.comment.created': TaskCommentCreatedData;
|
|
1254
|
+
'task.comment.updated': TaskCommentUpdatedData;
|
|
1255
|
+
'task.comment.deleted': TaskCommentDeletedData;
|
|
1256
|
+
'project.created': ProjectCreatedData;
|
|
1257
|
+
'project.updated': ProjectUpdatedData;
|
|
1258
|
+
'project.deleted': ProjectDeletedData;
|
|
1259
|
+
'agent_session.new': AgentSessionNewData;
|
|
1260
|
+
'agent_session.update': AgentSessionUpdateData;
|
|
1261
|
+
'agent_step.new': AgentStepNewData;
|
|
1262
|
+
'invitation.new': InvitationNewEventData;
|
|
1263
|
+
'invitation.accepted': InvitationAcceptedEventData;
|
|
1264
|
+
'invitation.declined': InvitationDeclinedEventData;
|
|
1265
|
+
'agent_config.update': AgentConfigUpdateData;
|
|
1266
|
+
'presence.update': PresenceUpdateData;
|
|
1267
|
+
'wiki.changeset.created': WikiChangesetCreatedData;
|
|
1268
|
+
'wiki.changeset.updated': WikiChangesetUpdatedData;
|
|
1269
|
+
'notification.alert': NotificationAlertData;
|
|
1270
|
+
'inbox.new': InboxNewData;
|
|
1271
|
+
'inbox.update': InboxUpdateData;
|
|
1272
|
+
'inbox.bulk_update': InboxBulkUpdateData;
|
|
1273
|
+
'read_position.updated': ReadPositionUpdateData;
|
|
1274
|
+
'dispatch.new': DispatchNewData;
|
|
1275
|
+
};
|
|
1276
|
+
|
|
1277
|
+
// Invitation WS event data
|
|
1278
|
+
export interface InvitationNewEventData {
|
|
1279
|
+
id: string;
|
|
1280
|
+
org_id: string;
|
|
1281
|
+
org_name: string;
|
|
1282
|
+
inviter_name: string;
|
|
1283
|
+
role: OrgMemberRole;
|
|
1284
|
+
expires_at: string;
|
|
1285
|
+
}
|
|
1286
|
+
|
|
1287
|
+
export interface InvitationAcceptedEventData {
|
|
1288
|
+
invitation_id: string;
|
|
1289
|
+
org_id: string;
|
|
1290
|
+
user_id: string;
|
|
1291
|
+
display_name: string;
|
|
1292
|
+
role: OrgMemberRole;
|
|
1293
|
+
}
|
|
1294
|
+
|
|
1295
|
+
export interface InvitationDeclinedEventData {
|
|
1296
|
+
invitation_id: string;
|
|
1297
|
+
org_id: string;
|
|
1298
|
+
email: string;
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
// ============================================================
|
|
1302
|
+
// Platform Config Types
|
|
1303
|
+
// ============================================================
|
|
1304
|
+
|
|
1305
|
+
export interface PlatformConfigResponse {
|
|
1306
|
+
version: string;
|
|
1307
|
+
schema_version: number;
|
|
1308
|
+
min_plugin_version?: string;
|
|
1309
|
+
config: Record<string, unknown>;
|
|
1310
|
+
}
|
|
1311
|
+
|
|
1312
|
+
export interface AgentConfigUpdateData {
|
|
1313
|
+
version: string;
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1316
|
+
export interface PresenceUpdateData {
|
|
1317
|
+
org_id: string;
|
|
1318
|
+
user_id: string;
|
|
1319
|
+
status: string; // "online" | "offline" (future: "busy", "error", "away")
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1322
|
+
// ============================================================
|
|
1323
|
+
// Reference Resolution Types
|
|
1324
|
+
// ============================================================
|
|
1325
|
+
|
|
1326
|
+
export interface ResolveRefsRequest {
|
|
1327
|
+
refs: string[];
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1330
|
+
export interface ResolvedRef {
|
|
1331
|
+
type: string;
|
|
1332
|
+
exists: boolean;
|
|
1333
|
+
restricted?: boolean;
|
|
1334
|
+
|
|
1335
|
+
// User fields
|
|
1336
|
+
display_name?: string;
|
|
1337
|
+
avatar_url?: string | null;
|
|
1338
|
+
user_type?: string;
|
|
1339
|
+
|
|
1340
|
+
// Task fields
|
|
1341
|
+
title?: string;
|
|
1342
|
+
status?: string;
|
|
1343
|
+
identifier?: string;
|
|
1344
|
+
|
|
1345
|
+
// Chat fields
|
|
1346
|
+
chat_name?: string | null;
|
|
1347
|
+
chat_type?: string;
|
|
1348
|
+
|
|
1349
|
+
// Message fields
|
|
1350
|
+
sender_name?: string;
|
|
1351
|
+
preview?: string;
|
|
1352
|
+
chat_id?: string;
|
|
1353
|
+
|
|
1354
|
+
// Wiki fields
|
|
1355
|
+
file_name?: string;
|
|
1356
|
+
wiki_name?: string;
|
|
1357
|
+
fragment_exists?: boolean;
|
|
1358
|
+
|
|
1359
|
+
// Task comment fields
|
|
1360
|
+
comment_author?: string;
|
|
1361
|
+
comment_body?: string;
|
|
1362
|
+
task_id?: string;
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1365
|
+
export interface ResolveRefsResponse {
|
|
1366
|
+
results: Record<string, ResolvedRef>;
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1369
|
+
export interface BacklinkItem {
|
|
1370
|
+
source_type: string;
|
|
1371
|
+
source_id: string;
|
|
1372
|
+
context?: string;
|
|
1373
|
+
snippet?: string;
|
|
1374
|
+
created_at: string;
|
|
1375
|
+
chat_id?: string;
|
|
1376
|
+
sender_name?: string;
|
|
1377
|
+
task_title?: string;
|
|
1378
|
+
task_id?: string;
|
|
1379
|
+
author_name?: string;
|
|
1380
|
+
}
|
|
1381
|
+
|
|
1382
|
+
export interface BacklinksResponse {
|
|
1383
|
+
backlinks: BacklinkItem[];
|
|
1384
|
+
next_cursor?: string;
|
|
1385
|
+
}
|
|
1386
|
+
|
|
1387
|
+
export interface BrokenRefItem {
|
|
1388
|
+
ref_link_id: string;
|
|
1389
|
+
source_type: string;
|
|
1390
|
+
source_id: string;
|
|
1391
|
+
uri: string;
|
|
1392
|
+
target_type: string;
|
|
1393
|
+
target_id: string;
|
|
1394
|
+
}
|
|
1395
|
+
|
|
1396
|
+
export interface BrokenRefsResponse {
|
|
1397
|
+
broken_refs: BrokenRefItem[];
|
|
1398
|
+
total: number;
|
|
1399
|
+
}
|