@byokit/openclaw 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/LICENSE +202 -0
  3. package/README.md +174 -0
  4. package/dist/approvals.d.ts +29 -0
  5. package/dist/approvals.js +200 -0
  6. package/dist/bridge.d.ts +78 -0
  7. package/dist/bridge.js +345 -0
  8. package/dist/classify.d.ts +4 -0
  9. package/dist/classify.js +14 -0
  10. package/dist/config.d.ts +13 -0
  11. package/dist/config.js +74 -0
  12. package/dist/constants.d.ts +3 -0
  13. package/dist/constants.js +13 -0
  14. package/dist/device.d.ts +63 -0
  15. package/dist/device.js +192 -0
  16. package/dist/engine.d.ts +43 -0
  17. package/dist/engine.js +212 -0
  18. package/dist/generated/events.d.ts +61 -0
  19. package/dist/generated/events.js +1 -0
  20. package/dist/generated/methods.d.ts +2368 -0
  21. package/dist/generated/methods.js +1 -0
  22. package/dist/generated/params.d.ts +1717 -0
  23. package/dist/generated/params.js +5 -0
  24. package/dist/generated/report.json +1356 -0
  25. package/dist/index.d.ts +4 -0
  26. package/dist/index.js +5 -0
  27. package/dist/kit.d.ts +108 -0
  28. package/dist/kit.js +655 -0
  29. package/dist/link.d.ts +24 -0
  30. package/dist/link.js +273 -0
  31. package/dist/members.d.ts +11 -0
  32. package/dist/members.js +23 -0
  33. package/dist/migrate.d.ts +22 -0
  34. package/dist/migrate.js +118 -0
  35. package/dist/notices.d.ts +9 -0
  36. package/dist/notices.js +75 -0
  37. package/dist/routes.d.ts +9 -0
  38. package/dist/routes.js +15 -0
  39. package/dist/routes.json +398 -0
  40. package/dist/runs.d.ts +14 -0
  41. package/dist/runs.js +110 -0
  42. package/dist/signin.d.ts +24 -0
  43. package/dist/signin.js +251 -0
  44. package/dist/testing/contract.d.ts +12 -0
  45. package/dist/testing/contract.js +250 -0
  46. package/dist/testing/fake-gateway.d.ts +19 -0
  47. package/dist/testing/fake-gateway.js +378 -0
  48. package/dist/testing/index.d.ts +3 -0
  49. package/dist/testing/index.js +4 -0
  50. package/dist/testing/model-stub.d.ts +29 -0
  51. package/dist/testing/model-stub.js +182 -0
  52. package/dist/transport.d.ts +22 -0
  53. package/dist/transport.js +94 -0
  54. package/dist/types.d.ts +125 -0
  55. package/dist/types.js +2 -0
  56. package/dist/words.d.ts +12 -0
  57. package/dist/words.js +26 -0
  58. package/dist/words.json +20 -0
  59. package/engine/package-lock.json +4680 -0
  60. package/engine/package.json +1 -0
  61. package/package.json +68 -0
  62. package/plugin/index.js +183 -0
  63. package/plugin/package.json +1 -0
  64. package/policy/policy.mjs +197 -0
@@ -0,0 +1,1717 @@
1
+ export type AuditRunInspectParams = {
2
+ runId: string;
3
+ executionId?: never;
4
+ executionCursor?: string;
5
+ executionLimit?: number;
6
+ decisionCursor?: string;
7
+ decisionLimit?: number;
8
+ } | {
9
+ runId?: never;
10
+ executionId: string;
11
+ executionCursor?: never;
12
+ executionLimit?: never;
13
+ decisionCursor?: string;
14
+ decisionLimit?: number;
15
+ };
16
+ export type BoardActionParams = {
17
+ ticket: string;
18
+ action: "cron.trigger";
19
+ jobId: string;
20
+ } | {
21
+ ticket: string;
22
+ action: string;
23
+ params?: Record<string, unknown>;
24
+ };
25
+ export type BoardEventParams = {
26
+ sessionKey: string;
27
+ agentId?: string;
28
+ widget: string;
29
+ payload: unknown;
30
+ } | {
31
+ ticket: string;
32
+ payload: unknown;
33
+ };
34
+ export type ChatEvent = {
35
+ runId: string;
36
+ sessionKey: string;
37
+ agentId?: string;
38
+ spawnedBy?: string;
39
+ seq: number;
40
+ state: "status";
41
+ phase: "preparing_workspace" | "naming_worktree" | "creating_worktree" | "running_setup" | "provisioning_environment" | "preparing_context" | "starting_model";
42
+ } | {
43
+ runId: string;
44
+ sessionKey: string;
45
+ agentId?: string;
46
+ spawnedBy?: string;
47
+ seq: number;
48
+ state: "delta";
49
+ message?: unknown;
50
+ deltaText: string;
51
+ replace?: boolean;
52
+ usage?: unknown;
53
+ } | {
54
+ runId: string;
55
+ sessionKey: string;
56
+ agentId?: string;
57
+ spawnedBy?: string;
58
+ seq: number;
59
+ state: "final";
60
+ message?: unknown;
61
+ usage?: unknown;
62
+ stopReason?: string;
63
+ yielded?: true;
64
+ } | {
65
+ runId: string;
66
+ sessionKey: string;
67
+ agentId?: string;
68
+ spawnedBy?: string;
69
+ seq: number;
70
+ state: "aborted";
71
+ message?: unknown;
72
+ errorMessage?: string;
73
+ stopReason?: string;
74
+ } | {
75
+ runId: string;
76
+ sessionKey: string;
77
+ agentId?: string;
78
+ spawnedBy?: string;
79
+ seq: number;
80
+ state: "error";
81
+ message?: unknown;
82
+ errorMessage?: string;
83
+ errorKind?: "refusal" | "timeout" | "rate_limit" | "context_length" | "unknown";
84
+ usage?: unknown;
85
+ stopReason?: string;
86
+ };
87
+ export type ConversationTurnResult = {
88
+ conversationRef: string;
89
+ channel: string;
90
+ messageId: string;
91
+ correlationPersisted: boolean;
92
+ status: "replied";
93
+ reply: {
94
+ conversationRef: string;
95
+ messageId: string;
96
+ replyToId?: string;
97
+ threadId?: string;
98
+ text: string;
99
+ timestamp: number;
100
+ transcriptArtifactId?: string;
101
+ transcriptMessageId?: string;
102
+ };
103
+ } | {
104
+ conversationRef: string;
105
+ channel: string;
106
+ messageId: string;
107
+ correlationPersisted: boolean;
108
+ status: "timeout";
109
+ } | {
110
+ conversationRef: string;
111
+ channel: string;
112
+ messageId?: string;
113
+ correlationPersisted: boolean;
114
+ status: "sent" | "queued" | "suppressed" | "unknown";
115
+ error: string;
116
+ };
117
+ export type CronAddResult = {
118
+ id: string;
119
+ declarationKey?: string;
120
+ displayName?: string;
121
+ owner?: {
122
+ agentId?: string;
123
+ sessionKey?: string;
124
+ accountId?: string;
125
+ };
126
+ scheduledToolPolicy?: {
127
+ version: 1;
128
+ mode: "trusted";
129
+ } | {
130
+ version: 1;
131
+ mode: "account";
132
+ ownerSessionKey: string;
133
+ ownerAccountId: string;
134
+ };
135
+ agentId?: string;
136
+ sessionKey?: string;
137
+ name: string;
138
+ description?: string;
139
+ enabled: boolean;
140
+ deleteAfterRun?: boolean;
141
+ createdAtMs: number;
142
+ updatedAtMs: number;
143
+ configRevision?: string;
144
+ schedule: {
145
+ kind: "at";
146
+ at: string;
147
+ } | {
148
+ kind: "every";
149
+ everyMs: number;
150
+ anchorMs?: number;
151
+ } | {
152
+ kind: "cron";
153
+ expr: string;
154
+ tz?: string;
155
+ staggerMs?: number;
156
+ } | {
157
+ kind: "on-exit";
158
+ command: string;
159
+ cwd?: string;
160
+ } | {
161
+ kind: "stream";
162
+ command: string[];
163
+ cwd?: string;
164
+ mode?: "line" | "match";
165
+ match?: string;
166
+ batchMs?: number;
167
+ maxBatchBytes?: number;
168
+ };
169
+ pacing?: {
170
+ min?: string;
171
+ max?: string;
172
+ };
173
+ trigger?: {
174
+ script: string;
175
+ once?: boolean;
176
+ };
177
+ sessionTarget: "main" | "isolated" | "current" | string;
178
+ wakeMode: "next-heartbeat" | "now";
179
+ payload: {
180
+ kind: "systemEvent";
181
+ text: string;
182
+ toolsAllow?: string[];
183
+ toolsAllowIsDefault?: boolean;
184
+ } | {
185
+ kind: "agentTurn";
186
+ message: string;
187
+ model?: string;
188
+ fallbacks?: string[];
189
+ thinking?: string;
190
+ timeoutSeconds?: number;
191
+ allowUnsafeExternalContent?: boolean;
192
+ lightContext?: boolean;
193
+ toolsAllow?: string[];
194
+ toolsAllowIsDefault?: boolean;
195
+ } | {
196
+ kind: "command";
197
+ argv: string[];
198
+ cwd?: string;
199
+ env?: Record<string, string>;
200
+ input?: string;
201
+ timeoutSeconds?: number;
202
+ noOutputTimeoutSeconds?: number;
203
+ outputMaxBytes?: number;
204
+ toolsAllow?: string[];
205
+ toolsAllowIsDefault?: boolean;
206
+ } | {
207
+ kind: "script";
208
+ script: string;
209
+ timeoutSeconds?: number;
210
+ toolBudget?: number;
211
+ toolsAllow?: string[];
212
+ toolsAllowIsDefault?: boolean;
213
+ } | {
214
+ kind: "heartbeat";
215
+ } | {
216
+ kind: "skillCollectionReview";
217
+ };
218
+ delivery?: {
219
+ mode: "none";
220
+ channel?: "last" | string;
221
+ threadId?: string | number;
222
+ accountId?: string;
223
+ bestEffort?: boolean;
224
+ failureDestination?: {
225
+ channel?: "last" | string;
226
+ to?: string;
227
+ accountId?: string;
228
+ mode?: "announce" | "webhook";
229
+ };
230
+ to?: string;
231
+ } | {
232
+ mode: "announce";
233
+ channel?: "last" | string;
234
+ threadId?: string | number;
235
+ accountId?: string;
236
+ bestEffort?: boolean;
237
+ failureDestination?: {
238
+ channel?: "last" | string;
239
+ to?: string;
240
+ accountId?: string;
241
+ mode?: "announce" | "webhook";
242
+ };
243
+ completionDestination?: {
244
+ mode: "webhook";
245
+ to: string;
246
+ };
247
+ to?: string;
248
+ } | {
249
+ mode: "webhook";
250
+ channel?: "last" | string;
251
+ threadId?: string | number;
252
+ accountId?: string;
253
+ bestEffort?: boolean;
254
+ failureDestination?: {
255
+ channel?: "last" | string;
256
+ to?: string;
257
+ accountId?: string;
258
+ mode?: "announce" | "webhook";
259
+ };
260
+ to: string;
261
+ };
262
+ failureAlert?: false | {
263
+ after?: number;
264
+ channel?: "last" | string;
265
+ to?: string;
266
+ cooldownMs?: number;
267
+ includeSkipped?: boolean;
268
+ mode?: "announce" | "webhook";
269
+ accountId?: string;
270
+ };
271
+ state: {
272
+ nextRunAtMs?: number;
273
+ scheduleActivatedAtMs?: number;
274
+ runningAtMs?: number;
275
+ lastRunAtMs?: number;
276
+ lastRunStatus?: "ok" | "error" | "skipped";
277
+ lastStatus?: "ok" | "error" | "skipped";
278
+ lastError?: string;
279
+ lastDiagnostics?: {
280
+ summary?: string;
281
+ entries: {
282
+ ts: number;
283
+ source: "cron-preflight" | "cron-setup" | "model-preflight" | "agent-run" | "tool" | "exec" | "delivery";
284
+ severity: "info" | "warn" | "error";
285
+ message: string;
286
+ toolName?: string;
287
+ exitCode?: number | null;
288
+ truncated?: boolean;
289
+ }[];
290
+ };
291
+ lastDiagnosticSummary?: string;
292
+ lastErrorReason?: "auth" | "auth_permanent" | "format" | "rate_limit" | "overloaded" | "billing" | "server_error" | "timeout" | "tls_certificate" | "context_overflow" | "model_not_found" | "session_expired" | "empty_response" | "no_error_details" | "unclassified" | "unknown";
293
+ lastDurationMs?: number;
294
+ consecutiveErrors?: number;
295
+ autoDisabled?: {
296
+ reason: "consecutive-failures" | "schedule-errors";
297
+ atMs: number;
298
+ consecutiveErrors: number;
299
+ };
300
+ consecutiveSkipped?: number;
301
+ lastDelivered?: boolean;
302
+ lastDeliveryStatus?: "delivered" | "not-delivered" | "unknown" | "not-requested";
303
+ lastDeliveryError?: string;
304
+ deliverySuppressionReason?: string;
305
+ lastFailureNotificationDelivered?: boolean;
306
+ lastFailureNotificationDeliveryStatus?: "delivered" | "not-delivered" | "unknown" | "not-requested";
307
+ lastFailureNotificationDeliveryError?: string;
308
+ lastFailureAlertAtMs?: number;
309
+ lastTriggerEvalAtMs?: number;
310
+ triggerEvalCount?: number;
311
+ lastTriggerFireAtMs?: number;
312
+ triggerState?: unknown;
313
+ streamStatus?: "starting" | "running" | "restarting" | "stopped" | "disabled" | "error";
314
+ streamError?: string;
315
+ streamConsecutiveFailures?: number;
316
+ streamRestartExhausted?: boolean;
317
+ streamSourceIdentity?: string;
318
+ streamDroppedBatches?: number;
319
+ streamCoalescedBatches?: number;
320
+ streamLastStartedAtMs?: number;
321
+ streamLastExitAtMs?: number;
322
+ };
323
+ nextRunAtMs?: number;
324
+ lastRunAtMs?: number;
325
+ lastRunStatus?: "ok" | "error" | "skipped";
326
+ lastRunError?: string;
327
+ lastDelivered?: boolean;
328
+ lastDeliveryStatus?: "delivered" | "not-delivered" | "unknown" | "not-requested";
329
+ lastDeliveryError?: string;
330
+ deliverySuppressionReason?: string;
331
+ lastFailureNotificationDelivered?: boolean;
332
+ lastFailureNotificationDeliveryStatus?: "delivered" | "not-delivered" | "unknown" | "not-requested";
333
+ lastFailureNotificationDeliveryError?: string;
334
+ } | {
335
+ created: boolean;
336
+ updated?: boolean;
337
+ job: {
338
+ id: string;
339
+ declarationKey?: string;
340
+ displayName?: string;
341
+ owner?: {
342
+ agentId?: string;
343
+ sessionKey?: string;
344
+ accountId?: string;
345
+ };
346
+ scheduledToolPolicy?: {
347
+ version: 1;
348
+ mode: "trusted";
349
+ } | {
350
+ version: 1;
351
+ mode: "account";
352
+ ownerSessionKey: string;
353
+ ownerAccountId: string;
354
+ };
355
+ agentId?: string;
356
+ sessionKey?: string;
357
+ name: string;
358
+ description?: string;
359
+ enabled: boolean;
360
+ deleteAfterRun?: boolean;
361
+ createdAtMs: number;
362
+ updatedAtMs: number;
363
+ configRevision?: string;
364
+ schedule: {
365
+ kind: "at";
366
+ at: string;
367
+ } | {
368
+ kind: "every";
369
+ everyMs: number;
370
+ anchorMs?: number;
371
+ } | {
372
+ kind: "cron";
373
+ expr: string;
374
+ tz?: string;
375
+ staggerMs?: number;
376
+ } | {
377
+ kind: "on-exit";
378
+ command: string;
379
+ cwd?: string;
380
+ } | {
381
+ kind: "stream";
382
+ command: string[];
383
+ cwd?: string;
384
+ mode?: "line" | "match";
385
+ match?: string;
386
+ batchMs?: number;
387
+ maxBatchBytes?: number;
388
+ };
389
+ pacing?: {
390
+ min?: string;
391
+ max?: string;
392
+ };
393
+ trigger?: {
394
+ script: string;
395
+ once?: boolean;
396
+ };
397
+ sessionTarget: "main" | "isolated" | "current" | string;
398
+ wakeMode: "next-heartbeat" | "now";
399
+ payload: {
400
+ kind: "systemEvent";
401
+ text: string;
402
+ toolsAllow?: string[];
403
+ toolsAllowIsDefault?: boolean;
404
+ } | {
405
+ kind: "agentTurn";
406
+ message: string;
407
+ model?: string;
408
+ fallbacks?: string[];
409
+ thinking?: string;
410
+ timeoutSeconds?: number;
411
+ allowUnsafeExternalContent?: boolean;
412
+ lightContext?: boolean;
413
+ toolsAllow?: string[];
414
+ toolsAllowIsDefault?: boolean;
415
+ } | {
416
+ kind: "command";
417
+ argv: string[];
418
+ cwd?: string;
419
+ env?: Record<string, string>;
420
+ input?: string;
421
+ timeoutSeconds?: number;
422
+ noOutputTimeoutSeconds?: number;
423
+ outputMaxBytes?: number;
424
+ toolsAllow?: string[];
425
+ toolsAllowIsDefault?: boolean;
426
+ } | {
427
+ kind: "script";
428
+ script: string;
429
+ timeoutSeconds?: number;
430
+ toolBudget?: number;
431
+ toolsAllow?: string[];
432
+ toolsAllowIsDefault?: boolean;
433
+ } | {
434
+ kind: "heartbeat";
435
+ } | {
436
+ kind: "skillCollectionReview";
437
+ };
438
+ delivery?: {
439
+ mode: "none";
440
+ channel?: "last" | string;
441
+ threadId?: string | number;
442
+ accountId?: string;
443
+ bestEffort?: boolean;
444
+ failureDestination?: {
445
+ channel?: "last" | string;
446
+ to?: string;
447
+ accountId?: string;
448
+ mode?: "announce" | "webhook";
449
+ };
450
+ to?: string;
451
+ } | {
452
+ mode: "announce";
453
+ channel?: "last" | string;
454
+ threadId?: string | number;
455
+ accountId?: string;
456
+ bestEffort?: boolean;
457
+ failureDestination?: {
458
+ channel?: "last" | string;
459
+ to?: string;
460
+ accountId?: string;
461
+ mode?: "announce" | "webhook";
462
+ };
463
+ completionDestination?: {
464
+ mode: "webhook";
465
+ to: string;
466
+ };
467
+ to?: string;
468
+ } | {
469
+ mode: "webhook";
470
+ channel?: "last" | string;
471
+ threadId?: string | number;
472
+ accountId?: string;
473
+ bestEffort?: boolean;
474
+ failureDestination?: {
475
+ channel?: "last" | string;
476
+ to?: string;
477
+ accountId?: string;
478
+ mode?: "announce" | "webhook";
479
+ };
480
+ to: string;
481
+ };
482
+ failureAlert?: false | {
483
+ after?: number;
484
+ channel?: "last" | string;
485
+ to?: string;
486
+ cooldownMs?: number;
487
+ includeSkipped?: boolean;
488
+ mode?: "announce" | "webhook";
489
+ accountId?: string;
490
+ };
491
+ state: {
492
+ nextRunAtMs?: number;
493
+ scheduleActivatedAtMs?: number;
494
+ runningAtMs?: number;
495
+ lastRunAtMs?: number;
496
+ lastRunStatus?: "ok" | "error" | "skipped";
497
+ lastStatus?: "ok" | "error" | "skipped";
498
+ lastError?: string;
499
+ lastDiagnostics?: {
500
+ summary?: string;
501
+ entries: {
502
+ ts: number;
503
+ source: "cron-preflight" | "cron-setup" | "model-preflight" | "agent-run" | "tool" | "exec" | "delivery";
504
+ severity: "info" | "warn" | "error";
505
+ message: string;
506
+ toolName?: string;
507
+ exitCode?: number | null;
508
+ truncated?: boolean;
509
+ }[];
510
+ };
511
+ lastDiagnosticSummary?: string;
512
+ lastErrorReason?: "auth" | "auth_permanent" | "format" | "rate_limit" | "overloaded" | "billing" | "server_error" | "timeout" | "tls_certificate" | "context_overflow" | "model_not_found" | "session_expired" | "empty_response" | "no_error_details" | "unclassified" | "unknown";
513
+ lastDurationMs?: number;
514
+ consecutiveErrors?: number;
515
+ autoDisabled?: {
516
+ reason: "consecutive-failures" | "schedule-errors";
517
+ atMs: number;
518
+ consecutiveErrors: number;
519
+ };
520
+ consecutiveSkipped?: number;
521
+ lastDelivered?: boolean;
522
+ lastDeliveryStatus?: "delivered" | "not-delivered" | "unknown" | "not-requested";
523
+ lastDeliveryError?: string;
524
+ deliverySuppressionReason?: string;
525
+ lastFailureNotificationDelivered?: boolean;
526
+ lastFailureNotificationDeliveryStatus?: "delivered" | "not-delivered" | "unknown" | "not-requested";
527
+ lastFailureNotificationDeliveryError?: string;
528
+ lastFailureAlertAtMs?: number;
529
+ lastTriggerEvalAtMs?: number;
530
+ triggerEvalCount?: number;
531
+ lastTriggerFireAtMs?: number;
532
+ triggerState?: unknown;
533
+ streamStatus?: "starting" | "running" | "restarting" | "stopped" | "disabled" | "error";
534
+ streamError?: string;
535
+ streamConsecutiveFailures?: number;
536
+ streamRestartExhausted?: boolean;
537
+ streamSourceIdentity?: string;
538
+ streamDroppedBatches?: number;
539
+ streamCoalescedBatches?: number;
540
+ streamLastStartedAtMs?: number;
541
+ streamLastExitAtMs?: number;
542
+ };
543
+ nextRunAtMs?: number;
544
+ lastRunAtMs?: number;
545
+ lastRunStatus?: "ok" | "error" | "skipped";
546
+ lastRunError?: string;
547
+ lastDelivered?: boolean;
548
+ lastDeliveryStatus?: "delivered" | "not-delivered" | "unknown" | "not-requested";
549
+ lastDeliveryError?: string;
550
+ deliverySuppressionReason?: string;
551
+ lastFailureNotificationDelivered?: boolean;
552
+ lastFailureNotificationDeliveryStatus?: "delivered" | "not-delivered" | "unknown" | "not-requested";
553
+ lastFailureNotificationDeliveryError?: string;
554
+ };
555
+ };
556
+ export type CronGetParams = {
557
+ id: string;
558
+ } | {
559
+ jobId: string;
560
+ };
561
+ export type CronRemoveParams = {
562
+ id: string;
563
+ } | {
564
+ jobId: string;
565
+ };
566
+ export type CronRunParams = {
567
+ id: string;
568
+ mode?: "due" | "force" | "if-enabled";
569
+ expectedProcessInstanceId?: string;
570
+ } | {
571
+ jobId: string;
572
+ mode?: "due" | "force" | "if-enabled";
573
+ expectedProcessInstanceId?: string;
574
+ };
575
+ export type CronScratchGetParams = {
576
+ id: string;
577
+ } | {
578
+ jobId: string;
579
+ };
580
+ export type CronScratchSetParams = {
581
+ id: string;
582
+ content: string | null;
583
+ expectedRevision?: number;
584
+ } | {
585
+ jobId: string;
586
+ content: string | null;
587
+ expectedRevision?: number;
588
+ };
589
+ export type CronScratchSetResult = {
590
+ ok: true;
591
+ scratch: {
592
+ content: string;
593
+ revision: number;
594
+ updatedAtMs: number;
595
+ } | null;
596
+ currentRevision: number;
597
+ maxBytes: number;
598
+ } | {
599
+ ok: false;
600
+ reason: "revision-conflict";
601
+ currentRevision: number;
602
+ };
603
+ export type CronUpdateParams = {
604
+ id: string;
605
+ patch: {
606
+ name?: string;
607
+ displayName?: string | null;
608
+ agentId?: string | null;
609
+ sessionKey?: string | null;
610
+ description?: string;
611
+ enabled?: boolean;
612
+ deleteAfterRun?: boolean;
613
+ schedule?: {
614
+ kind: "at";
615
+ at: string;
616
+ } | {
617
+ kind: "every";
618
+ everyMs: number;
619
+ anchorMs?: number;
620
+ } | {
621
+ kind: "cron";
622
+ expr: string;
623
+ tz?: string;
624
+ staggerMs?: number;
625
+ } | {
626
+ kind: "on-exit";
627
+ command: string;
628
+ cwd?: string;
629
+ } | {
630
+ kind: "stream";
631
+ command: string[];
632
+ cwd?: string;
633
+ mode?: "line" | "match";
634
+ match?: string;
635
+ batchMs?: number;
636
+ maxBatchBytes?: number;
637
+ };
638
+ pacing?: {
639
+ min?: string;
640
+ max?: string;
641
+ } | null;
642
+ trigger?: {
643
+ script: string;
644
+ once?: boolean;
645
+ } | null;
646
+ sessionTarget?: "main" | "isolated" | "current" | string;
647
+ wakeMode?: "next-heartbeat" | "now";
648
+ payload?: {
649
+ kind: "systemEvent";
650
+ text?: string;
651
+ toolsAllow?: string[] | null;
652
+ toolsAllowIsDefault?: boolean;
653
+ } | {
654
+ kind: "agentTurn";
655
+ message?: string;
656
+ model?: string | null;
657
+ fallbacks?: string[] | null;
658
+ thinking?: string | null;
659
+ timeoutSeconds?: number;
660
+ allowUnsafeExternalContent?: boolean;
661
+ lightContext?: boolean;
662
+ toolsAllow?: string[] | null;
663
+ toolsAllowIsDefault?: boolean;
664
+ } | {
665
+ kind: "command";
666
+ argv?: string[];
667
+ cwd?: string;
668
+ env?: Record<string, string>;
669
+ input?: string;
670
+ timeoutSeconds?: number;
671
+ noOutputTimeoutSeconds?: number;
672
+ outputMaxBytes?: number;
673
+ toolsAllow?: string[] | null;
674
+ toolsAllowIsDefault?: boolean;
675
+ } | {
676
+ kind: "script";
677
+ script?: string;
678
+ timeoutSeconds?: number;
679
+ toolBudget?: number;
680
+ toolsAllow?: string[] | null;
681
+ toolsAllowIsDefault?: boolean;
682
+ };
683
+ delivery?: {
684
+ mode?: "none" | "announce" | "webhook";
685
+ channel?: "last" | string | null;
686
+ threadId?: string | number | null;
687
+ accountId?: string | null;
688
+ bestEffort?: boolean;
689
+ failureDestination?: {
690
+ channel?: "last" | string | null;
691
+ to?: string | null;
692
+ accountId?: string | null;
693
+ mode?: "announce" | "webhook" | null;
694
+ } | null;
695
+ completionDestination?: {
696
+ mode: "webhook";
697
+ to: string;
698
+ } | null;
699
+ to?: string | null;
700
+ };
701
+ failureAlert?: false | {
702
+ after?: number | null;
703
+ channel?: "last" | string | null;
704
+ to?: string | null;
705
+ cooldownMs?: number | null;
706
+ includeSkipped?: boolean | null;
707
+ mode?: "announce" | "webhook" | null;
708
+ accountId?: string | null;
709
+ } | null;
710
+ state?: {
711
+ nextRunAtMs?: number;
712
+ runningAtMs?: number;
713
+ lastRunAtMs?: number;
714
+ lastRunStatus?: "ok" | "error" | "skipped";
715
+ lastStatus?: "ok" | "error" | "skipped";
716
+ lastError?: string;
717
+ lastErrorReason?: "auth" | "auth_permanent" | "format" | "rate_limit" | "overloaded" | "billing" | "server_error" | "timeout" | "tls_certificate" | "context_overflow" | "model_not_found" | "session_expired" | "empty_response" | "no_error_details" | "unclassified" | "unknown";
718
+ lastDurationMs?: number;
719
+ consecutiveErrors?: number;
720
+ consecutiveSkipped?: number;
721
+ lastDelivered?: boolean;
722
+ lastDeliveryStatus?: "delivered" | "not-delivered" | "unknown" | "not-requested";
723
+ lastDeliveryError?: string;
724
+ lastFailureNotificationDelivered?: boolean;
725
+ lastFailureNotificationDeliveryStatus?: "delivered" | "not-delivered" | "unknown" | "not-requested";
726
+ lastFailureNotificationDeliveryError?: string;
727
+ lastFailureAlertAtMs?: number;
728
+ lastTriggerEvalAtMs?: number;
729
+ triggerEvalCount?: number;
730
+ lastTriggerFireAtMs?: number;
731
+ triggerState?: unknown;
732
+ streamStatus?: "starting" | "running" | "restarting" | "stopped" | "disabled" | "error";
733
+ streamError?: string;
734
+ streamConsecutiveFailures?: number;
735
+ streamRestartExhausted?: boolean;
736
+ streamDroppedBatches?: number;
737
+ streamCoalescedBatches?: number;
738
+ streamLastStartedAtMs?: number;
739
+ streamLastExitAtMs?: number;
740
+ };
741
+ };
742
+ expectedConfigRevision?: string;
743
+ } | {
744
+ jobId: string;
745
+ patch: {
746
+ name?: string;
747
+ displayName?: string | null;
748
+ agentId?: string | null;
749
+ sessionKey?: string | null;
750
+ description?: string;
751
+ enabled?: boolean;
752
+ deleteAfterRun?: boolean;
753
+ schedule?: {
754
+ kind: "at";
755
+ at: string;
756
+ } | {
757
+ kind: "every";
758
+ everyMs: number;
759
+ anchorMs?: number;
760
+ } | {
761
+ kind: "cron";
762
+ expr: string;
763
+ tz?: string;
764
+ staggerMs?: number;
765
+ } | {
766
+ kind: "on-exit";
767
+ command: string;
768
+ cwd?: string;
769
+ } | {
770
+ kind: "stream";
771
+ command: string[];
772
+ cwd?: string;
773
+ mode?: "line" | "match";
774
+ match?: string;
775
+ batchMs?: number;
776
+ maxBatchBytes?: number;
777
+ };
778
+ pacing?: {
779
+ min?: string;
780
+ max?: string;
781
+ } | null;
782
+ trigger?: {
783
+ script: string;
784
+ once?: boolean;
785
+ } | null;
786
+ sessionTarget?: "main" | "isolated" | "current" | string;
787
+ wakeMode?: "next-heartbeat" | "now";
788
+ payload?: {
789
+ kind: "systemEvent";
790
+ text?: string;
791
+ toolsAllow?: string[] | null;
792
+ toolsAllowIsDefault?: boolean;
793
+ } | {
794
+ kind: "agentTurn";
795
+ message?: string;
796
+ model?: string | null;
797
+ fallbacks?: string[] | null;
798
+ thinking?: string | null;
799
+ timeoutSeconds?: number;
800
+ allowUnsafeExternalContent?: boolean;
801
+ lightContext?: boolean;
802
+ toolsAllow?: string[] | null;
803
+ toolsAllowIsDefault?: boolean;
804
+ } | {
805
+ kind: "command";
806
+ argv?: string[];
807
+ cwd?: string;
808
+ env?: Record<string, string>;
809
+ input?: string;
810
+ timeoutSeconds?: number;
811
+ noOutputTimeoutSeconds?: number;
812
+ outputMaxBytes?: number;
813
+ toolsAllow?: string[] | null;
814
+ toolsAllowIsDefault?: boolean;
815
+ } | {
816
+ kind: "script";
817
+ script?: string;
818
+ timeoutSeconds?: number;
819
+ toolBudget?: number;
820
+ toolsAllow?: string[] | null;
821
+ toolsAllowIsDefault?: boolean;
822
+ };
823
+ delivery?: {
824
+ mode?: "none" | "announce" | "webhook";
825
+ channel?: "last" | string | null;
826
+ threadId?: string | number | null;
827
+ accountId?: string | null;
828
+ bestEffort?: boolean;
829
+ failureDestination?: {
830
+ channel?: "last" | string | null;
831
+ to?: string | null;
832
+ accountId?: string | null;
833
+ mode?: "announce" | "webhook" | null;
834
+ } | null;
835
+ completionDestination?: {
836
+ mode: "webhook";
837
+ to: string;
838
+ } | null;
839
+ to?: string | null;
840
+ };
841
+ failureAlert?: false | {
842
+ after?: number | null;
843
+ channel?: "last" | string | null;
844
+ to?: string | null;
845
+ cooldownMs?: number | null;
846
+ includeSkipped?: boolean | null;
847
+ mode?: "announce" | "webhook" | null;
848
+ accountId?: string | null;
849
+ } | null;
850
+ state?: {
851
+ nextRunAtMs?: number;
852
+ runningAtMs?: number;
853
+ lastRunAtMs?: number;
854
+ lastRunStatus?: "ok" | "error" | "skipped";
855
+ lastStatus?: "ok" | "error" | "skipped";
856
+ lastError?: string;
857
+ lastErrorReason?: "auth" | "auth_permanent" | "format" | "rate_limit" | "overloaded" | "billing" | "server_error" | "timeout" | "tls_certificate" | "context_overflow" | "model_not_found" | "session_expired" | "empty_response" | "no_error_details" | "unclassified" | "unknown";
858
+ lastDurationMs?: number;
859
+ consecutiveErrors?: number;
860
+ consecutiveSkipped?: number;
861
+ lastDelivered?: boolean;
862
+ lastDeliveryStatus?: "delivered" | "not-delivered" | "unknown" | "not-requested";
863
+ lastDeliveryError?: string;
864
+ lastFailureNotificationDelivered?: boolean;
865
+ lastFailureNotificationDeliveryStatus?: "delivered" | "not-delivered" | "unknown" | "not-requested";
866
+ lastFailureNotificationDeliveryError?: string;
867
+ lastFailureAlertAtMs?: number;
868
+ lastTriggerEvalAtMs?: number;
869
+ triggerEvalCount?: number;
870
+ lastTriggerFireAtMs?: number;
871
+ triggerState?: unknown;
872
+ streamStatus?: "starting" | "running" | "restarting" | "stopped" | "disabled" | "error";
873
+ streamError?: string;
874
+ streamConsecutiveFailures?: number;
875
+ streamRestartExhausted?: boolean;
876
+ streamDroppedBatches?: number;
877
+ streamCoalescedBatches?: number;
878
+ streamLastStartedAtMs?: number;
879
+ streamLastExitAtMs?: number;
880
+ };
881
+ };
882
+ expectedConfigRevision?: string;
883
+ };
884
+ export type DesktopObserveParams = {
885
+ source: {
886
+ kind: "host";
887
+ };
888
+ control?: boolean;
889
+ credentials?: {
890
+ username?: string;
891
+ password?: string;
892
+ };
893
+ } | {
894
+ source: {
895
+ kind: "environment";
896
+ environmentId: string;
897
+ };
898
+ control?: boolean;
899
+ } | {
900
+ source: {
901
+ kind: "node";
902
+ nodeId: string;
903
+ };
904
+ control?: boolean;
905
+ credentials?: {
906
+ username?: string;
907
+ password?: string;
908
+ };
909
+ };
910
+ export type ExecApprovalsNodeSetParams = {
911
+ nodeId: string;
912
+ file: {
913
+ version: 1;
914
+ socket?: {
915
+ path?: string;
916
+ token?: string;
917
+ };
918
+ defaults?: {
919
+ security?: string;
920
+ ask?: string;
921
+ askFallback?: string;
922
+ autoAllowSkills?: boolean;
923
+ };
924
+ agents?: Record<string, {
925
+ security?: string;
926
+ ask?: string;
927
+ askFallback?: string;
928
+ autoAllowSkills?: boolean;
929
+ allowlist?: {
930
+ id?: string;
931
+ pattern: string;
932
+ source?: "allow-always";
933
+ commandText?: string;
934
+ argPattern?: string;
935
+ lastUsedAt?: number;
936
+ lastUsedCommand?: string;
937
+ lastResolvedPath?: string;
938
+ }[];
939
+ }>;
940
+ };
941
+ native?: never;
942
+ baseHash?: string;
943
+ } | {
944
+ nodeId: string;
945
+ file?: never;
946
+ native: {
947
+ defaultAction?: "allow" | "deny" | "prompt";
948
+ rules: {
949
+ pattern: string;
950
+ action: "allow" | "deny" | "prompt";
951
+ shells?: string[];
952
+ description?: string;
953
+ enabled?: boolean;
954
+ }[];
955
+ };
956
+ baseHash: string;
957
+ };
958
+ export type GatewaySuspendPrepareResult = {
959
+ status: "busy";
960
+ reason: "active-work" | "gateway-draining";
961
+ retryAfterMs: number;
962
+ activeCount: number;
963
+ blockers: {
964
+ kind: "queue" | "reply" | "embedded-run" | "background-exec" | "cron-run" | "task" | "root-request" | "session-admission" | "session-mutation" | "chat-run" | "queued-turn" | "terminal-persistence" | "terminal-session";
965
+ count: number;
966
+ message: string;
967
+ task?: {
968
+ taskId: string;
969
+ status: "running";
970
+ runtime: "subagent" | "acp" | "cli" | "cron";
971
+ runId?: string;
972
+ label?: string;
973
+ title?: string;
974
+ };
975
+ }[];
976
+ } | {
977
+ status: "draining";
978
+ suspensionId: string;
979
+ expiresAtMs: number;
980
+ retryAfterMs: number;
981
+ activeCount: number;
982
+ blockers: {
983
+ kind: "queue" | "reply" | "embedded-run" | "background-exec" | "cron-run" | "task" | "root-request" | "session-admission" | "session-mutation" | "chat-run" | "queued-turn" | "terminal-persistence" | "terminal-session";
984
+ count: number;
985
+ message: string;
986
+ task?: {
987
+ taskId: string;
988
+ status: "running";
989
+ runtime: "subagent" | "acp" | "cli" | "cron";
990
+ runId?: string;
991
+ label?: string;
992
+ title?: string;
993
+ };
994
+ }[];
995
+ } | {
996
+ status: "ready";
997
+ suspensionId: string;
998
+ expiresAtMs: number;
999
+ activeCount: number;
1000
+ blockers: {
1001
+ kind: "queue" | "reply" | "embedded-run" | "background-exec" | "cron-run" | "task" | "root-request" | "session-admission" | "session-mutation" | "chat-run" | "queued-turn" | "terminal-persistence" | "terminal-session";
1002
+ count: number;
1003
+ message: string;
1004
+ task?: {
1005
+ taskId: string;
1006
+ status: "running";
1007
+ runtime: "subagent" | "acp" | "cli" | "cron";
1008
+ runId?: string;
1009
+ label?: string;
1010
+ title?: string;
1011
+ };
1012
+ }[];
1013
+ };
1014
+ export type GatewaySuspendStatusResult = {
1015
+ status: "running";
1016
+ } | {
1017
+ status: "draining";
1018
+ expiresAtMs: number;
1019
+ retryAfterMs: number;
1020
+ activeCount: number;
1021
+ blockers: {
1022
+ kind: "queue" | "reply" | "embedded-run" | "background-exec" | "cron-run" | "task" | "root-request" | "session-admission" | "session-mutation" | "chat-run" | "queued-turn" | "terminal-persistence" | "terminal-session";
1023
+ count: number;
1024
+ message: string;
1025
+ task?: {
1026
+ taskId: string;
1027
+ status: "running";
1028
+ runtime: "subagent" | "acp" | "cli" | "cron";
1029
+ runId?: string;
1030
+ label?: string;
1031
+ title?: string;
1032
+ };
1033
+ }[];
1034
+ } | {
1035
+ status: "ready";
1036
+ expiresAtMs: number;
1037
+ };
1038
+ export type PluginsInstallParams = {
1039
+ source: "clawhub";
1040
+ packageName: string;
1041
+ version?: string;
1042
+ acknowledgeInstallPolicyWarning?: true;
1043
+ acknowledgeCapabilities?: {
1044
+ reviewToken: string;
1045
+ };
1046
+ } | {
1047
+ source: "official";
1048
+ pluginId: string;
1049
+ acknowledgeInstallPolicyWarning?: true;
1050
+ acknowledgeCapabilities?: {
1051
+ reviewToken: string;
1052
+ };
1053
+ };
1054
+ export type PluginsSessionActionResult = {
1055
+ ok: true;
1056
+ result?: unknown;
1057
+ continueAgent?: boolean;
1058
+ reply?: unknown;
1059
+ } | {
1060
+ ok: false;
1061
+ error: string;
1062
+ code?: string;
1063
+ details?: unknown;
1064
+ };
1065
+ export type QuestionResolveParams = {
1066
+ id: string;
1067
+ answers: {
1068
+ answers: Record<string, string[]>;
1069
+ };
1070
+ secretStoreAllowedHosts?: string[];
1071
+ resolvedBy?: string;
1072
+ } | {
1073
+ id: string;
1074
+ cancel: true;
1075
+ resolvedBy?: string;
1076
+ };
1077
+ export type QuestionResolveResult = {
1078
+ status: "answered";
1079
+ answers: {
1080
+ answers: Record<string, string[]>;
1081
+ };
1082
+ } | {
1083
+ status: "cancelled";
1084
+ };
1085
+ export type QuestionResolvedEvent = {
1086
+ id: string;
1087
+ status: "answered";
1088
+ answers: {
1089
+ answers: Record<string, string[]>;
1090
+ };
1091
+ } | {
1092
+ id: string;
1093
+ status: "cancelled";
1094
+ } | {
1095
+ id: string;
1096
+ status: "expired";
1097
+ };
1098
+ export type QuestionWaitAnswerResult = {
1099
+ status: "pending";
1100
+ } | {
1101
+ status: "answered";
1102
+ answers: {
1103
+ answers: Record<string, string[]>;
1104
+ };
1105
+ } | {
1106
+ status: "cancelled";
1107
+ } | {
1108
+ status: "expired";
1109
+ };
1110
+ export type SessionApprovalEvent = {
1111
+ sessionKey: string;
1112
+ sourceSessionKey?: string;
1113
+ updatedAtMs: number;
1114
+ phase: "pending";
1115
+ approval: {
1116
+ id: string;
1117
+ urlPath: string;
1118
+ createdAtMs: number;
1119
+ expiresAtMs: number;
1120
+ presentation: {
1121
+ kind: "exec";
1122
+ commandText: string;
1123
+ commandPreview?: string | null;
1124
+ warningText?: string | null;
1125
+ host?: string | null;
1126
+ nodeId?: string | null;
1127
+ agentId?: string | null;
1128
+ scope?: {
1129
+ kind: "message-send";
1130
+ target: string;
1131
+ recipientCount: number;
1132
+ recipients?: string[];
1133
+ audience?: "internal" | "external";
1134
+ } | {
1135
+ kind: "payment";
1136
+ amount: string;
1137
+ currency: string;
1138
+ target: string;
1139
+ } | {
1140
+ kind: "external-post";
1141
+ target: string;
1142
+ visibility: "public" | "restricted";
1143
+ } | {
1144
+ kind: "standing-grant";
1145
+ automation: string;
1146
+ command: string;
1147
+ expiresInDays?: number;
1148
+ };
1149
+ allowedDecisions: ("allow-once" | "allow-always" | "deny")[];
1150
+ } | {
1151
+ kind: "plugin";
1152
+ title: string;
1153
+ description: string;
1154
+ detail?: string;
1155
+ severity: "info" | "warning" | "critical";
1156
+ pluginId?: string | null;
1157
+ toolName?: string | null;
1158
+ agentId?: string | null;
1159
+ scope?: {
1160
+ kind: "message-send";
1161
+ target: string;
1162
+ recipientCount: number;
1163
+ recipients?: string[];
1164
+ audience?: "internal" | "external";
1165
+ } | {
1166
+ kind: "payment";
1167
+ amount: string;
1168
+ currency: string;
1169
+ target: string;
1170
+ } | {
1171
+ kind: "external-post";
1172
+ target: string;
1173
+ visibility: "public" | "restricted";
1174
+ } | {
1175
+ kind: "standing-grant";
1176
+ automation: string;
1177
+ command: string;
1178
+ expiresInDays?: number;
1179
+ };
1180
+ allowedDecisions: ("allow-once" | "allow-always" | "deny")[];
1181
+ } | {
1182
+ kind: "system-agent";
1183
+ title: string;
1184
+ description: string;
1185
+ proposalHash: string;
1186
+ agentId?: string | null;
1187
+ allowedDecisions: ["allow-once", "deny"];
1188
+ };
1189
+ status: "pending";
1190
+ sourceSessionKey?: string;
1191
+ };
1192
+ } | {
1193
+ sessionKey: string;
1194
+ sourceSessionKey?: string;
1195
+ updatedAtMs: number;
1196
+ phase: "terminal";
1197
+ approval: {
1198
+ id: string;
1199
+ urlPath: string;
1200
+ createdAtMs: number;
1201
+ expiresAtMs: number;
1202
+ presentation: {
1203
+ kind: "exec";
1204
+ commandText: string;
1205
+ commandPreview?: string | null;
1206
+ warningText?: string | null;
1207
+ host?: string | null;
1208
+ nodeId?: string | null;
1209
+ agentId?: string | null;
1210
+ scope?: {
1211
+ kind: "message-send";
1212
+ target: string;
1213
+ recipientCount: number;
1214
+ recipients?: string[];
1215
+ audience?: "internal" | "external";
1216
+ } | {
1217
+ kind: "payment";
1218
+ amount: string;
1219
+ currency: string;
1220
+ target: string;
1221
+ } | {
1222
+ kind: "external-post";
1223
+ target: string;
1224
+ visibility: "public" | "restricted";
1225
+ } | {
1226
+ kind: "standing-grant";
1227
+ automation: string;
1228
+ command: string;
1229
+ expiresInDays?: number;
1230
+ };
1231
+ allowedDecisions: ("allow-once" | "allow-always" | "deny")[];
1232
+ } | {
1233
+ kind: "plugin";
1234
+ title: string;
1235
+ description: string;
1236
+ detail?: string;
1237
+ severity: "info" | "warning" | "critical";
1238
+ pluginId?: string | null;
1239
+ toolName?: string | null;
1240
+ agentId?: string | null;
1241
+ scope?: {
1242
+ kind: "message-send";
1243
+ target: string;
1244
+ recipientCount: number;
1245
+ recipients?: string[];
1246
+ audience?: "internal" | "external";
1247
+ } | {
1248
+ kind: "payment";
1249
+ amount: string;
1250
+ currency: string;
1251
+ target: string;
1252
+ } | {
1253
+ kind: "external-post";
1254
+ target: string;
1255
+ visibility: "public" | "restricted";
1256
+ } | {
1257
+ kind: "standing-grant";
1258
+ automation: string;
1259
+ command: string;
1260
+ expiresInDays?: number;
1261
+ };
1262
+ allowedDecisions: ("allow-once" | "allow-always" | "deny")[];
1263
+ } | {
1264
+ kind: "system-agent";
1265
+ title: string;
1266
+ description: string;
1267
+ proposalHash: string;
1268
+ agentId?: string | null;
1269
+ allowedDecisions: ["allow-once", "deny"];
1270
+ };
1271
+ resolvedAtMs: number;
1272
+ source?: {
1273
+ agentId?: string;
1274
+ sessionKey?: string;
1275
+ };
1276
+ resolver?: {
1277
+ kind: "device" | "channel" | "runtime" | "system";
1278
+ id?: string;
1279
+ };
1280
+ status: "allowed";
1281
+ decision: "allow-once" | "allow-always";
1282
+ reason: "user";
1283
+ } | {
1284
+ id: string;
1285
+ urlPath: string;
1286
+ createdAtMs: number;
1287
+ expiresAtMs: number;
1288
+ presentation: {
1289
+ kind: "exec";
1290
+ commandText: string;
1291
+ commandPreview?: string | null;
1292
+ warningText?: string | null;
1293
+ host?: string | null;
1294
+ nodeId?: string | null;
1295
+ agentId?: string | null;
1296
+ scope?: {
1297
+ kind: "message-send";
1298
+ target: string;
1299
+ recipientCount: number;
1300
+ recipients?: string[];
1301
+ audience?: "internal" | "external";
1302
+ } | {
1303
+ kind: "payment";
1304
+ amount: string;
1305
+ currency: string;
1306
+ target: string;
1307
+ } | {
1308
+ kind: "external-post";
1309
+ target: string;
1310
+ visibility: "public" | "restricted";
1311
+ } | {
1312
+ kind: "standing-grant";
1313
+ automation: string;
1314
+ command: string;
1315
+ expiresInDays?: number;
1316
+ };
1317
+ allowedDecisions: ("allow-once" | "allow-always" | "deny")[];
1318
+ } | {
1319
+ kind: "plugin";
1320
+ title: string;
1321
+ description: string;
1322
+ detail?: string;
1323
+ severity: "info" | "warning" | "critical";
1324
+ pluginId?: string | null;
1325
+ toolName?: string | null;
1326
+ agentId?: string | null;
1327
+ scope?: {
1328
+ kind: "message-send";
1329
+ target: string;
1330
+ recipientCount: number;
1331
+ recipients?: string[];
1332
+ audience?: "internal" | "external";
1333
+ } | {
1334
+ kind: "payment";
1335
+ amount: string;
1336
+ currency: string;
1337
+ target: string;
1338
+ } | {
1339
+ kind: "external-post";
1340
+ target: string;
1341
+ visibility: "public" | "restricted";
1342
+ } | {
1343
+ kind: "standing-grant";
1344
+ automation: string;
1345
+ command: string;
1346
+ expiresInDays?: number;
1347
+ };
1348
+ allowedDecisions: ("allow-once" | "allow-always" | "deny")[];
1349
+ } | {
1350
+ kind: "system-agent";
1351
+ title: string;
1352
+ description: string;
1353
+ proposalHash: string;
1354
+ agentId?: string | null;
1355
+ allowedDecisions: ["allow-once", "deny"];
1356
+ };
1357
+ resolvedAtMs: number;
1358
+ source?: {
1359
+ agentId?: string;
1360
+ sessionKey?: string;
1361
+ };
1362
+ resolver?: {
1363
+ kind: "device" | "channel" | "runtime" | "system";
1364
+ id?: string;
1365
+ };
1366
+ status: "denied";
1367
+ decision: "deny";
1368
+ reason: "user" | "malformed-verdict" | "no-route" | "storage-corrupt";
1369
+ } | {
1370
+ id: string;
1371
+ urlPath: string;
1372
+ createdAtMs: number;
1373
+ expiresAtMs: number;
1374
+ presentation: {
1375
+ kind: "exec";
1376
+ commandText: string;
1377
+ commandPreview?: string | null;
1378
+ warningText?: string | null;
1379
+ host?: string | null;
1380
+ nodeId?: string | null;
1381
+ agentId?: string | null;
1382
+ scope?: {
1383
+ kind: "message-send";
1384
+ target: string;
1385
+ recipientCount: number;
1386
+ recipients?: string[];
1387
+ audience?: "internal" | "external";
1388
+ } | {
1389
+ kind: "payment";
1390
+ amount: string;
1391
+ currency: string;
1392
+ target: string;
1393
+ } | {
1394
+ kind: "external-post";
1395
+ target: string;
1396
+ visibility: "public" | "restricted";
1397
+ } | {
1398
+ kind: "standing-grant";
1399
+ automation: string;
1400
+ command: string;
1401
+ expiresInDays?: number;
1402
+ };
1403
+ allowedDecisions: ("allow-once" | "allow-always" | "deny")[];
1404
+ } | {
1405
+ kind: "plugin";
1406
+ title: string;
1407
+ description: string;
1408
+ detail?: string;
1409
+ severity: "info" | "warning" | "critical";
1410
+ pluginId?: string | null;
1411
+ toolName?: string | null;
1412
+ agentId?: string | null;
1413
+ scope?: {
1414
+ kind: "message-send";
1415
+ target: string;
1416
+ recipientCount: number;
1417
+ recipients?: string[];
1418
+ audience?: "internal" | "external";
1419
+ } | {
1420
+ kind: "payment";
1421
+ amount: string;
1422
+ currency: string;
1423
+ target: string;
1424
+ } | {
1425
+ kind: "external-post";
1426
+ target: string;
1427
+ visibility: "public" | "restricted";
1428
+ } | {
1429
+ kind: "standing-grant";
1430
+ automation: string;
1431
+ command: string;
1432
+ expiresInDays?: number;
1433
+ };
1434
+ allowedDecisions: ("allow-once" | "allow-always" | "deny")[];
1435
+ } | {
1436
+ kind: "system-agent";
1437
+ title: string;
1438
+ description: string;
1439
+ proposalHash: string;
1440
+ agentId?: string | null;
1441
+ allowedDecisions: ["allow-once", "deny"];
1442
+ };
1443
+ resolvedAtMs: number;
1444
+ source?: {
1445
+ agentId?: string;
1446
+ sessionKey?: string;
1447
+ };
1448
+ resolver?: {
1449
+ kind: "device" | "channel" | "runtime" | "system";
1450
+ id?: string;
1451
+ };
1452
+ status: "expired";
1453
+ reason: "timeout";
1454
+ } | {
1455
+ id: string;
1456
+ urlPath: string;
1457
+ createdAtMs: number;
1458
+ expiresAtMs: number;
1459
+ presentation: {
1460
+ kind: "exec";
1461
+ commandText: string;
1462
+ commandPreview?: string | null;
1463
+ warningText?: string | null;
1464
+ host?: string | null;
1465
+ nodeId?: string | null;
1466
+ agentId?: string | null;
1467
+ scope?: {
1468
+ kind: "message-send";
1469
+ target: string;
1470
+ recipientCount: number;
1471
+ recipients?: string[];
1472
+ audience?: "internal" | "external";
1473
+ } | {
1474
+ kind: "payment";
1475
+ amount: string;
1476
+ currency: string;
1477
+ target: string;
1478
+ } | {
1479
+ kind: "external-post";
1480
+ target: string;
1481
+ visibility: "public" | "restricted";
1482
+ } | {
1483
+ kind: "standing-grant";
1484
+ automation: string;
1485
+ command: string;
1486
+ expiresInDays?: number;
1487
+ };
1488
+ allowedDecisions: ("allow-once" | "allow-always" | "deny")[];
1489
+ } | {
1490
+ kind: "plugin";
1491
+ title: string;
1492
+ description: string;
1493
+ detail?: string;
1494
+ severity: "info" | "warning" | "critical";
1495
+ pluginId?: string | null;
1496
+ toolName?: string | null;
1497
+ agentId?: string | null;
1498
+ scope?: {
1499
+ kind: "message-send";
1500
+ target: string;
1501
+ recipientCount: number;
1502
+ recipients?: string[];
1503
+ audience?: "internal" | "external";
1504
+ } | {
1505
+ kind: "payment";
1506
+ amount: string;
1507
+ currency: string;
1508
+ target: string;
1509
+ } | {
1510
+ kind: "external-post";
1511
+ target: string;
1512
+ visibility: "public" | "restricted";
1513
+ } | {
1514
+ kind: "standing-grant";
1515
+ automation: string;
1516
+ command: string;
1517
+ expiresInDays?: number;
1518
+ };
1519
+ allowedDecisions: ("allow-once" | "allow-always" | "deny")[];
1520
+ } | {
1521
+ kind: "system-agent";
1522
+ title: string;
1523
+ description: string;
1524
+ proposalHash: string;
1525
+ agentId?: string | null;
1526
+ allowedDecisions: ["allow-once", "deny"];
1527
+ };
1528
+ resolvedAtMs: number;
1529
+ source?: {
1530
+ agentId?: string;
1531
+ sessionKey?: string;
1532
+ };
1533
+ resolver?: {
1534
+ kind: "device" | "channel" | "runtime" | "system";
1535
+ id?: string;
1536
+ };
1537
+ status: "cancelled";
1538
+ reason: "run-aborted" | "gateway-restart";
1539
+ };
1540
+ };
1541
+ export type SessionsDispatchParams = {
1542
+ key: string;
1543
+ agentId?: string;
1544
+ profileId: string;
1545
+ deviceId?: never;
1546
+ autoDevice?: never;
1547
+ machineClass?: string;
1548
+ } | {
1549
+ key: string;
1550
+ agentId?: string;
1551
+ profileId?: never;
1552
+ deviceId: string;
1553
+ autoDevice?: never;
1554
+ machineClass?: never;
1555
+ } | {
1556
+ key: string;
1557
+ agentId?: string;
1558
+ profileId?: never;
1559
+ deviceId?: never;
1560
+ autoDevice: true;
1561
+ machineClass?: never;
1562
+ } | {
1563
+ key: string;
1564
+ agentId?: string;
1565
+ profileId?: never;
1566
+ deviceId?: never;
1567
+ autoDevice?: never;
1568
+ machineClass?: never;
1569
+ };
1570
+ export type SessionsGoalUpdateParams = {
1571
+ sessionKey: string;
1572
+ agentId?: string;
1573
+ sessionId?: string;
1574
+ goalId: string;
1575
+ operationId: string;
1576
+ issuedAtMs: number;
1577
+ action: "edit";
1578
+ objective: string;
1579
+ } | {
1580
+ sessionKey: string;
1581
+ agentId?: string;
1582
+ sessionId?: string;
1583
+ goalId: string;
1584
+ operationId: string;
1585
+ issuedAtMs: number;
1586
+ action: "pause" | "resume" | "complete" | "block";
1587
+ note?: string;
1588
+ };
1589
+ export type SessionsResolveResult = {
1590
+ ok: true;
1591
+ key: string;
1592
+ agentId: string;
1593
+ displayName?: string;
1594
+ boardFace?: "chat" | "dashboard";
1595
+ } | {
1596
+ ok: false;
1597
+ candidates?: {
1598
+ key: string;
1599
+ agentId: string;
1600
+ displayName?: string;
1601
+ boardFace?: "chat" | "dashboard";
1602
+ }[];
1603
+ };
1604
+ export type SkillsInstallParams = {
1605
+ agentId?: string;
1606
+ name: string;
1607
+ installId: string;
1608
+ dangerouslyForceUnsafeInstall?: boolean;
1609
+ timeoutMs?: number;
1610
+ } | {
1611
+ agentId?: string;
1612
+ source: "clawhub";
1613
+ slug: string;
1614
+ version?: string;
1615
+ force?: boolean;
1616
+ timeoutMs?: number;
1617
+ } | {
1618
+ agentId?: string;
1619
+ source: "upload";
1620
+ uploadId: string;
1621
+ slug: string;
1622
+ force?: boolean;
1623
+ sha256?: string;
1624
+ timeoutMs?: number;
1625
+ };
1626
+ export type SkillsUpdateParams = {
1627
+ skillKey: string;
1628
+ enabled?: boolean;
1629
+ apiKey?: string;
1630
+ env?: Record<string, string>;
1631
+ } | {
1632
+ agentId?: string;
1633
+ source: "clawhub";
1634
+ slug?: string;
1635
+ all?: boolean;
1636
+ force?: boolean;
1637
+ };
1638
+ export type SystemAgentSetupVerifyResult = {
1639
+ ok: true;
1640
+ modelRef: string;
1641
+ latencyMs: number;
1642
+ } | {
1643
+ ok: false;
1644
+ status: "auth" | "rate_limit" | "billing" | "timeout" | "format" | "unavailable" | "unknown";
1645
+ error: string;
1646
+ };
1647
+ export type TalkClientCreateResult = {
1648
+ provider: string;
1649
+ transport: "webrtc";
1650
+ voiceSessionId: string;
1651
+ clientSecret: string;
1652
+ offerUrl?: string;
1653
+ offerHeaders?: Record<string, string>;
1654
+ model?: string;
1655
+ voice?: string;
1656
+ expiresAt?: number;
1657
+ clientControl?: {
1658
+ owner: "gateway";
1659
+ };
1660
+ } | {
1661
+ provider: string;
1662
+ transport: "provider-websocket";
1663
+ voiceSessionId: string;
1664
+ protocol: string;
1665
+ clientSecret: string;
1666
+ websocketUrl: string;
1667
+ audio: {
1668
+ inputEncoding: "pcm16" | "g711_ulaw";
1669
+ inputSampleRateHz: number;
1670
+ outputEncoding: "pcm16" | "g711_ulaw";
1671
+ outputSampleRateHz: number;
1672
+ };
1673
+ initialMessage?: unknown;
1674
+ model?: string;
1675
+ voice?: string;
1676
+ expiresAt?: number;
1677
+ } | {
1678
+ provider: string;
1679
+ transport: "gateway-relay";
1680
+ voiceSessionId?: string;
1681
+ relaySessionId: string;
1682
+ audio: {
1683
+ inputEncoding: "pcm16" | "g711_ulaw";
1684
+ inputSampleRateHz: number;
1685
+ outputEncoding: "pcm16" | "g711_ulaw";
1686
+ outputSampleRateHz: number;
1687
+ };
1688
+ model?: string;
1689
+ voice?: string;
1690
+ expiresAt?: number;
1691
+ } | {
1692
+ provider: string;
1693
+ transport: "managed-room";
1694
+ voiceSessionId?: string;
1695
+ roomUrl: string;
1696
+ token?: string;
1697
+ model?: string;
1698
+ voice?: string;
1699
+ expiresAt?: number;
1700
+ };
1701
+ export type TaskSuggestionEvent = {
1702
+ action: "created";
1703
+ suggestion: {
1704
+ id: string;
1705
+ title: string;
1706
+ prompt: string;
1707
+ tldr: string;
1708
+ cwd: string;
1709
+ sessionKey: string;
1710
+ agentId?: string;
1711
+ createdAt: number;
1712
+ };
1713
+ } | {
1714
+ action: "resolved";
1715
+ taskId: string;
1716
+ resolution: "dismissed" | "accepted" | "expired";
1717
+ };