@paddockai/client 0.0.0-stage → 0.0.2

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.
@@ -0,0 +1,2276 @@
1
+ interface components {
2
+ schemas: {
3
+ /** @enum {string} */
4
+ ErrorCode: "invalid_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "payload_too_large" | "unsupported" | "unavailable" | "internal";
5
+ ErrorObject: {
6
+ code: components["schemas"]["ErrorCode"];
7
+ message: string;
8
+ details?: Record<string, never>;
9
+ };
10
+ /** @description The body of every non-2xx response. */
11
+ ErrorBody: {
12
+ error: components["schemas"]["ErrorObject"];
13
+ };
14
+ /** @description Every resource list returns one page: a cursor-paged slice of items. Typed pages extend it. */
15
+ Page: {
16
+ data: unknown[];
17
+ nextCursor: string | null;
18
+ };
19
+ /** @enum {string} */
20
+ Harness: "claude-code" | "codex" | "pi";
21
+ /** @description The customer's own string keys and values; never case-converted. */
22
+ Metadata: {
23
+ [key: string]: string;
24
+ };
25
+ /**
26
+ * Format: date-time
27
+ * @description RFC 3339 in UTC with milliseconds.
28
+ */
29
+ Timestamp: string;
30
+ Template: {
31
+ name: string;
32
+ version: number;
33
+ harness: components["schemas"]["Harness"];
34
+ model: string;
35
+ labels: components["schemas"]["Metadata"];
36
+ digest: string;
37
+ /**
38
+ * @description A built-in template: paddock creates its versions, and it cannot be changed or deleted. Absent from servers that predate built-in templates, which is false.
39
+ * @default false
40
+ */
41
+ builtin?: boolean;
42
+ createdAt: components["schemas"]["Timestamp"];
43
+ };
44
+ TemplatePage: components["schemas"]["Page"] & {
45
+ data?: components["schemas"]["Template"][];
46
+ };
47
+ TemplateMetadata: {
48
+ name: string;
49
+ labels?: components["schemas"]["Metadata"];
50
+ };
51
+ EnvEntry: {
52
+ name: string;
53
+ value: string;
54
+ };
55
+ PermissionsSpec: {
56
+ allow: string[];
57
+ deny: string[];
58
+ };
59
+ McpRemoteEntry: {
60
+ name: string;
61
+ url: string;
62
+ headers?: {
63
+ [key: string]: string;
64
+ };
65
+ };
66
+ McpLocalEntry: {
67
+ name: string;
68
+ command: string;
69
+ args?: string[];
70
+ env?: {
71
+ [key: string]: string;
72
+ };
73
+ };
74
+ /** @description An MCP server: a remote one by URL, or one that runs in the sandbox. */
75
+ McpEntry: components["schemas"]["McpRemoteEntry"] | components["schemas"]["McpLocalEntry"];
76
+ MarketplaceEntry: {
77
+ name: string;
78
+ /** @description host/owner/repo: a public Git repository holding a marketplace file. */
79
+ source: string;
80
+ /** @description Read-only: raised by refresh. */
81
+ revision?: number;
82
+ };
83
+ PluginEntry: {
84
+ /** @description plugin@marketplace */
85
+ name: string;
86
+ enabled?: boolean;
87
+ };
88
+ /** @description The key patterns the agent may send to. */
89
+ OutboxSpec: {
90
+ allow: string[];
91
+ };
92
+ TemplateSpec: {
93
+ harness: components["schemas"]["Harness"];
94
+ model: string;
95
+ /** @description claude-code only: its small model. */
96
+ smallModel?: string;
97
+ systemPrompt?: string;
98
+ env?: components["schemas"]["EnvEntry"][];
99
+ permissions?: components["schemas"]["PermissionsSpec"];
100
+ mcp?: components["schemas"]["McpEntry"][];
101
+ marketplaces?: components["schemas"]["MarketplaceEntry"][];
102
+ plugins?: components["schemas"]["PluginEntry"][];
103
+ outbox?: components["schemas"]["OutboxSpec"];
104
+ };
105
+ /** @description A template as one document, in its JSON spelling. */
106
+ TemplateDocument: {
107
+ /** @enum {string} */
108
+ apiVersion: "paddock.build/v1";
109
+ /** @enum {string} */
110
+ kind: "Template";
111
+ metadata: components["schemas"]["TemplateMetadata"];
112
+ spec: components["schemas"]["TemplateSpec"];
113
+ };
114
+ /** @description A model the project can use: a platform model of paddock's catalog, or a project model of one of its providers. */
115
+ Model: {
116
+ /** @description What a template's or an agent's model names. */
117
+ name: string;
118
+ harness: components["schemas"]["Harness"];
119
+ /** @enum {string} */
120
+ source: "platform" | "project";
121
+ /** @description The project model's provider; null for a platform model. */
122
+ provider: string | null;
123
+ };
124
+ ModelPage: components["schemas"]["Page"] & {
125
+ data?: components["schemas"]["Model"][];
126
+ };
127
+ TemplateDetail: components["schemas"]["Template"] & {
128
+ document: components["schemas"]["TemplateDocument"];
129
+ };
130
+ /** @enum {string} */
131
+ AgentStatus: "sleeping" | "waking" | "awake" | "unavailable";
132
+ /** @enum {string} */
133
+ TurnErrorCode: "harness_error" | "watchdog_timeout" | "model_unavailable" | "model_auth" | "context_too_long" | "conversation_lost" | "sandbox_unavailable" | "internal";
134
+ TurnError: {
135
+ code: components["schemas"]["TurnErrorCode"];
136
+ message: string;
137
+ };
138
+ Capabilities: {
139
+ mcp: boolean;
140
+ plugins: boolean;
141
+ workflows: boolean;
142
+ memory: boolean;
143
+ };
144
+ Agent: {
145
+ id: string;
146
+ template: string;
147
+ harness: components["schemas"]["Harness"];
148
+ /** @description The effective model: the agent's own if set, otherwise the template's. */
149
+ model: string;
150
+ /** @description The generation of its effective configuration; it increases each time the configuration changes. */
151
+ generation: number;
152
+ status: components["schemas"]["AgentStatus"];
153
+ lastError: components["schemas"]["TurnError"] | null;
154
+ capabilities: components["schemas"]["Capabilities"];
155
+ /** @description Its active sessions. */
156
+ sessionCount: number;
157
+ metadata: components["schemas"]["Metadata"];
158
+ createdAt: components["schemas"]["Timestamp"];
159
+ };
160
+ AgentPage: components["schemas"]["Page"] & {
161
+ data?: components["schemas"]["Agent"][];
162
+ };
163
+ CreateAgentRequest: {
164
+ template: string;
165
+ metadata?: components["schemas"]["Metadata"];
166
+ };
167
+ /** @enum {string} */
168
+ EntrySource: "template" | "agent";
169
+ AgentMcpEntry: {
170
+ name: string;
171
+ source: components["schemas"]["EntrySource"];
172
+ /** @description The agent generation at which it last changed; 1 for the template's. */
173
+ generation: number;
174
+ /** @description An MCP server, as a template's mcp list declares it. */
175
+ spec: components["schemas"]["McpRemoteEntry"] | components["schemas"]["McpLocalEntry"];
176
+ };
177
+ AgentMcpEntryPage: components["schemas"]["Page"] & {
178
+ data?: components["schemas"]["AgentMcpEntry"][];
179
+ };
180
+ AgentMarketplaceEntry: {
181
+ name: string;
182
+ source: components["schemas"]["EntrySource"];
183
+ /** @description The agent generation at which it last changed; 1 for the template's. */
184
+ generation: number;
185
+ spec: components["schemas"]["MarketplaceEntry"];
186
+ };
187
+ AgentMarketplaceEntryPage: components["schemas"]["Page"] & {
188
+ data?: components["schemas"]["AgentMarketplaceEntry"][];
189
+ };
190
+ AgentPluginEntry: {
191
+ name: string;
192
+ source: components["schemas"]["EntrySource"];
193
+ /** @description The agent generation at which it last changed; 1 for the template's. */
194
+ generation: number;
195
+ spec: components["schemas"]["PluginEntry"];
196
+ };
197
+ AgentPluginEntryPage: components["schemas"]["Page"] & {
198
+ data?: components["schemas"]["AgentPluginEntry"][];
199
+ };
200
+ AgentEnvEntry: {
201
+ name: string;
202
+ source: components["schemas"]["EntrySource"];
203
+ /** @description The agent generation at which it last changed; 1 for the template's. */
204
+ generation: number;
205
+ spec: components["schemas"]["EnvEntry"];
206
+ };
207
+ AgentEnvEntryPage: components["schemas"]["Page"] & {
208
+ data?: components["schemas"]["AgentEnvEntry"][];
209
+ };
210
+ ModelSetting: {
211
+ value: string;
212
+ source: components["schemas"]["EntrySource"];
213
+ };
214
+ SetSettingRequest: {
215
+ value: string;
216
+ };
217
+ SystemPromptSetting: {
218
+ value: string | null;
219
+ source: components["schemas"]["EntrySource"];
220
+ };
221
+ /** @description The agent's effective outbox allow list: its own, or else the template's. */
222
+ OutboxSetting: {
223
+ value: components["schemas"]["OutboxSpec"];
224
+ source: components["schemas"]["EntrySource"];
225
+ };
226
+ WorkflowSpec: {
227
+ name: string;
228
+ description: string;
229
+ };
230
+ WorkflowEntry: {
231
+ name: string;
232
+ source: components["schemas"]["EntrySource"];
233
+ spec: components["schemas"]["WorkflowSpec"];
234
+ };
235
+ WorkflowEntryPage: components["schemas"]["Page"] & {
236
+ data?: components["schemas"]["WorkflowEntry"][];
237
+ };
238
+ SendMessageRequest: {
239
+ text: string;
240
+ };
241
+ /** @description A position in an agent's event log. */
242
+ Seq: number;
243
+ /** @description The envelope every event has. */
244
+ EventEnvelope: {
245
+ seq: components["schemas"]["Seq"];
246
+ agentId: string;
247
+ sessionId: string | null;
248
+ turnId: string | null;
249
+ createdAt: components["schemas"]["Timestamp"];
250
+ };
251
+ UserBody: {
252
+ /**
253
+ * @description discriminator enum property added by openapi-typescript
254
+ * @enum {string}
255
+ */
256
+ kind: "user";
257
+ text: string;
258
+ };
259
+ AssistantBody: {
260
+ /**
261
+ * @description discriminator enum property added by openapi-typescript
262
+ * @enum {string}
263
+ */
264
+ kind: "assistant";
265
+ text: string;
266
+ };
267
+ ReasoningBody: {
268
+ /**
269
+ * @description discriminator enum property added by openapi-typescript
270
+ * @enum {string}
271
+ */
272
+ kind: "reasoning";
273
+ text: string;
274
+ };
275
+ /** @enum {string} */
276
+ ToolName: "shell" | "file_read" | "file_write" | "file_edit" | "file_patch" | "glob" | "grep" | "web_fetch" | "web_search" | "mcp" | "subagent" | "skill" | "unknown";
277
+ ShellInput: {
278
+ /**
279
+ * @description discriminator enum property added by openapi-typescript
280
+ * @enum {string}
281
+ */
282
+ type: "shell";
283
+ command: string;
284
+ description: string;
285
+ timeoutMs: number;
286
+ };
287
+ FileReadInput: {
288
+ /**
289
+ * @description discriminator enum property added by openapi-typescript
290
+ * @enum {string}
291
+ */
292
+ type: "file_read";
293
+ path: string;
294
+ offset: number;
295
+ limit: number;
296
+ };
297
+ FileWriteInput: {
298
+ /**
299
+ * @description discriminator enum property added by openapi-typescript
300
+ * @enum {string}
301
+ */
302
+ type: "file_write";
303
+ path: string;
304
+ content: string;
305
+ };
306
+ FileEditInput: {
307
+ /**
308
+ * @description discriminator enum property added by openapi-typescript
309
+ * @enum {string}
310
+ */
311
+ type: "file_edit";
312
+ path: string;
313
+ oldString: string;
314
+ newString: string;
315
+ replaceAll: boolean;
316
+ };
317
+ FileChange: {
318
+ path: string;
319
+ /** @enum {string} */
320
+ kind: "add" | "delete" | "update";
321
+ diff: string;
322
+ };
323
+ FilePatchInput: {
324
+ /**
325
+ * @description discriminator enum property added by openapi-typescript
326
+ * @enum {string}
327
+ */
328
+ type: "file_patch";
329
+ changes: components["schemas"]["FileChange"][];
330
+ };
331
+ GlobInput: {
332
+ /**
333
+ * @description discriminator enum property added by openapi-typescript
334
+ * @enum {string}
335
+ */
336
+ type: "glob";
337
+ pattern: string;
338
+ path: string;
339
+ };
340
+ GrepInput: {
341
+ /**
342
+ * @description discriminator enum property added by openapi-typescript
343
+ * @enum {string}
344
+ */
345
+ type: "grep";
346
+ pattern: string;
347
+ path: string;
348
+ glob: string;
349
+ };
350
+ WebFetchInput: {
351
+ /**
352
+ * @description discriminator enum property added by openapi-typescript
353
+ * @enum {string}
354
+ */
355
+ type: "web_fetch";
356
+ url: string;
357
+ prompt: string;
358
+ };
359
+ WebSearchInput: {
360
+ /**
361
+ * @description discriminator enum property added by openapi-typescript
362
+ * @enum {string}
363
+ */
364
+ type: "web_search";
365
+ query: string;
366
+ };
367
+ McpInput: {
368
+ /**
369
+ * @description discriminator enum property added by openapi-typescript
370
+ * @enum {string}
371
+ */
372
+ type: "mcp";
373
+ server: string;
374
+ tool: string;
375
+ /** @description The tool's arguments, as the harness reported them. */
376
+ arguments: unknown;
377
+ };
378
+ SubagentInput: {
379
+ /**
380
+ * @description discriminator enum property added by openapi-typescript
381
+ * @enum {string}
382
+ */
383
+ type: "subagent";
384
+ description: string;
385
+ prompt: string;
386
+ /** @description agentsdk's SubagentInput.Type; renamed because type is the discriminator. */
387
+ subagentType: string;
388
+ };
389
+ SkillInput: {
390
+ /**
391
+ * @description discriminator enum property added by openapi-typescript
392
+ * @enum {string}
393
+ */
394
+ type: "skill";
395
+ /** @description The skill the harness runs, such as frontend-design:frontend-design. */
396
+ name: string;
397
+ /** @description The skill's arguments; empty when the call has none. */
398
+ args: string;
399
+ };
400
+ UnknownInput: {
401
+ /**
402
+ * @description discriminator enum property added by openapi-typescript
403
+ * @enum {string}
404
+ */
405
+ type: "unknown";
406
+ /** @description The harness's original JSON for the call. */
407
+ raw: unknown;
408
+ };
409
+ /** @description A tool call's input; type equals the tool name. */
410
+ ToolInput: components["schemas"]["ShellInput"] | components["schemas"]["FileReadInput"] | components["schemas"]["FileWriteInput"] | components["schemas"]["FileEditInput"] | components["schemas"]["FilePatchInput"] | components["schemas"]["GlobInput"] | components["schemas"]["GrepInput"] | components["schemas"]["WebFetchInput"] | components["schemas"]["WebSearchInput"] | components["schemas"]["McpInput"] | components["schemas"]["SubagentInput"] | components["schemas"]["SkillInput"] | components["schemas"]["UnknownInput"];
411
+ ToolCall: {
412
+ callId: string;
413
+ tool: components["schemas"]["ToolName"];
414
+ rawName: string;
415
+ input: components["schemas"]["ToolInput"];
416
+ };
417
+ ToolCallBody: {
418
+ /**
419
+ * @description discriminator enum property added by openapi-typescript
420
+ * @enum {string}
421
+ */
422
+ kind: "tool_call";
423
+ toolCall: components["schemas"]["ToolCall"];
424
+ };
425
+ ShellOutput: {
426
+ /**
427
+ * @description discriminator enum property added by openapi-typescript
428
+ * @enum {string}
429
+ */
430
+ type: "shell";
431
+ output: string;
432
+ exitCode: number | null;
433
+ };
434
+ FileReadOutput: {
435
+ /**
436
+ * @description discriminator enum property added by openapi-typescript
437
+ * @enum {string}
438
+ */
439
+ type: "file_read";
440
+ content: string;
441
+ };
442
+ FileWriteOutput: {
443
+ /**
444
+ * @description discriminator enum property added by openapi-typescript
445
+ * @enum {string}
446
+ */
447
+ type: "file_write";
448
+ text: string;
449
+ };
450
+ FileEditOutput: {
451
+ /**
452
+ * @description discriminator enum property added by openapi-typescript
453
+ * @enum {string}
454
+ */
455
+ type: "file_edit";
456
+ text: string;
457
+ };
458
+ FilePatchOutput: {
459
+ /**
460
+ * @description discriminator enum property added by openapi-typescript
461
+ * @enum {string}
462
+ */
463
+ type: "file_patch";
464
+ text: string;
465
+ };
466
+ GlobOutput: {
467
+ /**
468
+ * @description discriminator enum property added by openapi-typescript
469
+ * @enum {string}
470
+ */
471
+ type: "glob";
472
+ text: string;
473
+ };
474
+ GrepOutput: {
475
+ /**
476
+ * @description discriminator enum property added by openapi-typescript
477
+ * @enum {string}
478
+ */
479
+ type: "grep";
480
+ text: string;
481
+ };
482
+ WebFetchOutput: {
483
+ /**
484
+ * @description discriminator enum property added by openapi-typescript
485
+ * @enum {string}
486
+ */
487
+ type: "web_fetch";
488
+ text: string;
489
+ };
490
+ WebSearchOutput: {
491
+ /**
492
+ * @description discriminator enum property added by openapi-typescript
493
+ * @enum {string}
494
+ */
495
+ type: "web_search";
496
+ text: string;
497
+ };
498
+ McpOutput: {
499
+ /**
500
+ * @description discriminator enum property added by openapi-typescript
501
+ * @enum {string}
502
+ */
503
+ type: "mcp";
504
+ /** @description The tool's result content, as the harness reported it. */
505
+ content: unknown;
506
+ };
507
+ SubagentOutput: {
508
+ /**
509
+ * @description discriminator enum property added by openapi-typescript
510
+ * @enum {string}
511
+ */
512
+ type: "subagent";
513
+ text: string;
514
+ };
515
+ SkillOutput: {
516
+ /**
517
+ * @description discriminator enum property added by openapi-typescript
518
+ * @enum {string}
519
+ */
520
+ type: "skill";
521
+ text: string;
522
+ };
523
+ UnknownOutput: {
524
+ /**
525
+ * @description discriminator enum property added by openapi-typescript
526
+ * @enum {string}
527
+ */
528
+ type: "unknown";
529
+ /** @description The harness's original JSON for the result. */
530
+ raw: unknown;
531
+ };
532
+ /** @description A tool result's output; type equals the tool name. */
533
+ ToolOutput: components["schemas"]["ShellOutput"] | components["schemas"]["FileReadOutput"] | components["schemas"]["FileWriteOutput"] | components["schemas"]["FileEditOutput"] | components["schemas"]["FilePatchOutput"] | components["schemas"]["GlobOutput"] | components["schemas"]["GrepOutput"] | components["schemas"]["WebFetchOutput"] | components["schemas"]["WebSearchOutput"] | components["schemas"]["McpOutput"] | components["schemas"]["SubagentOutput"] | components["schemas"]["SkillOutput"] | components["schemas"]["UnknownOutput"];
534
+ ToolResult: {
535
+ callId: string;
536
+ tool: components["schemas"]["ToolName"];
537
+ isError: boolean;
538
+ output: components["schemas"]["ToolOutput"];
539
+ };
540
+ ToolResultBody: {
541
+ /**
542
+ * @description discriminator enum property added by openapi-typescript
543
+ * @enum {string}
544
+ */
545
+ kind: "tool_result";
546
+ toolResult: components["schemas"]["ToolResult"];
547
+ };
548
+ /** @description An item agentsdk maps to no known kind. */
549
+ UnknownBody: {
550
+ /**
551
+ * @description discriminator enum property added by openapi-typescript
552
+ * @enum {string}
553
+ */
554
+ kind: "unknown";
555
+ harness: components["schemas"]["Harness"];
556
+ type: string;
557
+ raw: unknown;
558
+ };
559
+ /** @description Live only: the whole text of an assistant message generated so far. */
560
+ StreamingBody: {
561
+ /**
562
+ * @description discriminator enum property added by openapi-typescript
563
+ * @enum {string}
564
+ */
565
+ kind: "streaming";
566
+ text: string;
567
+ };
568
+ MessageBody: components["schemas"]["UserBody"] | components["schemas"]["AssistantBody"] | components["schemas"]["ReasoningBody"] | components["schemas"]["ToolCallBody"] | components["schemas"]["ToolResultBody"] | components["schemas"]["UnknownBody"] | components["schemas"]["StreamingBody"];
569
+ /** @description id and parentToolUseId joined with a MessageBody. Its position belongs to the event that holds it. */
570
+ Message: {
571
+ kind: "Message";
572
+ } & ({
573
+ id: string;
574
+ parentToolUseId: string | null;
575
+ } & Omit<components["schemas"]["MessageBody"], "kind">);
576
+ /** @description A message as an event holds it: every kind but streaming. */
577
+ StoredMessage: {
578
+ kind: "StoredMessage";
579
+ } & (Omit<components["schemas"]["Message"], "kind"> & unknown);
580
+ MessageEvent: {
581
+ /**
582
+ * @description discriminator enum property added by openapi-typescript
583
+ * @enum {string}
584
+ */
585
+ type: "message";
586
+ message: components["schemas"]["StoredMessage"];
587
+ };
588
+ /**
589
+ * @description user: started over waiting messages; harness: started by the harness on its own, with no inputs, never retried.
590
+ * @enum {string}
591
+ */
592
+ TurnOrigin: "user" | "harness";
593
+ TurnStarted: {
594
+ origin: components["schemas"]["TurnOrigin"];
595
+ inputSeqs: components["schemas"]["Seq"][];
596
+ attempt: number;
597
+ };
598
+ TurnStartedEvent: {
599
+ /**
600
+ * @description discriminator enum property added by openapi-typescript
601
+ * @enum {string}
602
+ */
603
+ type: "turn.started";
604
+ turn: components["schemas"]["TurnStarted"];
605
+ };
606
+ /** @enum {string} */
607
+ TurnOutcome: "completed" | "stopped" | "failed";
608
+ /** @description paddock will retry the failed turn at this time. */
609
+ RetryAt: {
610
+ at: components["schemas"]["Timestamp"];
611
+ };
612
+ /** @description paddock gave up retrying; waiting messages at or below heldSeq are held. */
613
+ RetryGiveUp: {
614
+ /** @constant */
615
+ giveUp: true;
616
+ heldSeq: components["schemas"]["Seq"];
617
+ };
618
+ /** @description The turn's model usage. */
619
+ Usage: {
620
+ inputTokens: number;
621
+ outputTokens: number;
622
+ cacheReadTokens: number;
623
+ cacheWriteTokens: number;
624
+ };
625
+ /** @enum {string} */
626
+ TimingPhaseKind: "sandbox" | "daemon" | "harness" | "first_token" | "reasoning" | "tool" | "reply";
627
+ TimingPhase: {
628
+ kind: components["schemas"]["TimingPhaseKind"];
629
+ /** @description From the turn's start; negative for sandbox and daemon, which precede it. */
630
+ startMs: number;
631
+ /** @description null only for a tool call without a result when the turn ended. */
632
+ durationMs: number | null;
633
+ /** @description reasoning, tool, and reply: the reasoning, tool_call, or assistant message. */
634
+ messageId: string | null;
635
+ };
636
+ /** @description Where a turn's time went, as phases on the turn's own timeline, in milliseconds. */
637
+ TurnTiming: {
638
+ /** @description The turn's start to its end. */
639
+ totalMs: number;
640
+ /** @description In order of startMs. */
641
+ phases: components["schemas"]["TimingPhase"][];
642
+ };
643
+ TurnEnded: {
644
+ outcome: components["schemas"]["TurnOutcome"];
645
+ error: components["schemas"]["TurnError"] | null;
646
+ retry: components["schemas"]["RetryAt"] | components["schemas"]["RetryGiveUp"] | null;
647
+ usage: components["schemas"]["Usage"] | null;
648
+ /** @description Where the turn's time went, as Turn.timing reports it; null when none was measured. */
649
+ timing: components["schemas"]["TurnTiming"] | null;
650
+ };
651
+ TurnEndedEvent: {
652
+ /**
653
+ * @description discriminator enum property added by openapi-typescript
654
+ * @enum {string}
655
+ */
656
+ type: "turn.ended";
657
+ turn: components["schemas"]["TurnEnded"];
658
+ };
659
+ StopRequestedEvent: {
660
+ /**
661
+ * @description discriminator enum property added by openapi-typescript
662
+ * @enum {string}
663
+ */
664
+ type: "stop.requested";
665
+ };
666
+ AgentUnavailable: {
667
+ error: components["schemas"]["TurnError"];
668
+ };
669
+ AgentUnavailableEvent: {
670
+ /**
671
+ * @description discriminator enum property added by openapi-typescript
672
+ * @enum {string}
673
+ */
674
+ type: "agent.unavailable";
675
+ agent: components["schemas"]["AgentUnavailable"];
676
+ };
677
+ AgentAvailableEvent: {
678
+ /**
679
+ * @description discriminator enum property added by openapi-typescript
680
+ * @enum {string}
681
+ */
682
+ type: "agent.available";
683
+ };
684
+ DaemonOutdated: {
685
+ version: string;
686
+ required: string;
687
+ };
688
+ DaemonOutdatedEvent: {
689
+ /**
690
+ * @description discriminator enum property added by openapi-typescript
691
+ * @enum {string}
692
+ */
693
+ type: "daemon.outdated";
694
+ daemon: components["schemas"]["DaemonOutdated"];
695
+ };
696
+ ContextCategory: {
697
+ /** @description The harness's label. */
698
+ name: string;
699
+ /** @enum {string} */
700
+ kind: "used" | "deferred" | "buffer" | "free";
701
+ tokens: number;
702
+ /** @description Of windowTokens. */
703
+ percent: number;
704
+ };
705
+ ContextItem: {
706
+ name: string;
707
+ group: string | null;
708
+ source: string | null;
709
+ type: string | null;
710
+ path: string | null;
711
+ tokens: number;
712
+ deferred: boolean;
713
+ };
714
+ TokenCount: {
715
+ input: number;
716
+ cachedInput: number;
717
+ output: number;
718
+ reasoning: number;
719
+ total: number;
720
+ };
721
+ /** @description The context window's fill, as Claude Code's /context shows it or as Codex reports it. */
722
+ ContextStatus: {
723
+ model: string;
724
+ /** @description The window usage is measured against. */
725
+ windowTokens: number;
726
+ /** @description The model's window when windowTokens is the usable share of it (Codex); null when not reported. */
727
+ modelWindowTokens: number | null;
728
+ /** @description Tokens in the context window now. */
729
+ usedTokens: number;
730
+ /** @description usedTokens of windowTokens. */
731
+ percent: number;
732
+ /** @description The harness estimated the counts locally instead of counting them with the model endpoint. */
733
+ estimated: boolean;
734
+ /** @description The fill at which the harness compacts; null when not reported. */
735
+ autoCompactTokens: number | null;
736
+ autoCompactEnabled: boolean | null;
737
+ /** @description null when not reported (Codex). */
738
+ categories: components["schemas"]["ContextCategory"][] | null;
739
+ /** @description Each with its server in group; null when not reported. */
740
+ mcpTools: components["schemas"]["ContextItem"][] | null;
741
+ /** @description Custom agents with their source; null when not reported. */
742
+ agents: components["schemas"]["ContextItem"][] | null;
743
+ /** @description With type and path; null when not reported. */
744
+ memoryFiles: components["schemas"]["ContextItem"][] | null;
745
+ /** @description With their source; null when not reported. */
746
+ skills: components["schemas"]["ContextItem"][] | null;
747
+ /** @description Instruction files loaded, such as AGENTS.md. */
748
+ instructionFiles: string[];
749
+ /** @description The last model request; null when not reported. */
750
+ lastRequest: components["schemas"]["TokenCount"] | null;
751
+ /** @description The conversation's tokens so far; null when not reported. */
752
+ totalTokens: number | null;
753
+ };
754
+ /** @description A plugin, skill, MCP server, subagent, or workflow definition the harness knows. */
755
+ HarnessEntry: {
756
+ name: string;
757
+ description: string;
758
+ /**
759
+ * @description Where the harness found the entry.
760
+ * @enum {string}
761
+ */
762
+ scope: "home" | "project" | "plugin" | "builtin";
763
+ /** @description The contributing plugin when scope is plugin. */
764
+ plugin: string | null;
765
+ /** @enum {string} */
766
+ state: "loaded" | "starting" | "error";
767
+ /** @description The harness's message when state is error. */
768
+ error: string | null;
769
+ };
770
+ HarnessMcpServer: components["schemas"]["HarnessEntry"] & {
771
+ /** @description The tool names the server offers. */
772
+ tools: string[];
773
+ };
774
+ /** @enum {string} */
775
+ RunState: "running" | "completed" | "failed" | "stopped";
776
+ SubagentRun: {
777
+ /** @description The harness's task or thread ID. */
778
+ id: string;
779
+ /** @description The definition it runs. */
780
+ type: string;
781
+ description: string;
782
+ state: components["schemas"]["RunState"];
783
+ background: boolean;
784
+ startedAt: components["schemas"]["Timestamp"];
785
+ /** @description null while running */
786
+ endedAt: components["schemas"]["Timestamp"] | null;
787
+ tokens: number;
788
+ toolUses: number;
789
+ lastTool: string | null;
790
+ };
791
+ HarnessSubagents: {
792
+ definitions: components["schemas"]["HarnessEntry"][];
793
+ runs: components["schemas"]["SubagentRun"][];
794
+ };
795
+ WorkflowRun: {
796
+ id: string;
797
+ name: string;
798
+ state: components["schemas"]["RunState"];
799
+ /** @description The current or last phase's title. */
800
+ phase: string | null;
801
+ /** @description Agents started so far. */
802
+ agents: number;
803
+ agentsDone: number;
804
+ tokens: number;
805
+ startedAt: components["schemas"]["Timestamp"];
806
+ /** @description null while running */
807
+ endedAt: components["schemas"]["Timestamp"] | null;
808
+ };
809
+ HarnessWorkflows: {
810
+ definitions: components["schemas"]["HarnessEntry"][];
811
+ runs: components["schemas"]["WorkflowRun"][];
812
+ };
813
+ /** @description The harness's internal state at the end of a turn: Context, Plugins, Skills, MCP, Subagents, and Workflows. */
814
+ HarnessStatus: {
815
+ /** @enum {string} */
816
+ harness: "claude-code" | "codex";
817
+ takenAt: components["schemas"]["Timestamp"];
818
+ context: components["schemas"]["ContextStatus"];
819
+ plugins: components["schemas"]["HarnessEntry"][];
820
+ skills: components["schemas"]["HarnessEntry"][];
821
+ mcp: components["schemas"]["HarnessMcpServer"][];
822
+ subagents: components["schemas"]["HarnessSubagents"];
823
+ /** @description null on Codex, which has no workflows */
824
+ workflows: components["schemas"]["HarnessWorkflows"] | null;
825
+ };
826
+ SessionStatusEvent: {
827
+ /**
828
+ * @description discriminator enum property added by openapi-typescript
829
+ * @enum {string}
830
+ */
831
+ type: "session.status";
832
+ status: components["schemas"]["HarnessStatus"];
833
+ };
834
+ ConfigChange: {
835
+ /** @enum {string} */
836
+ kind: "model" | "mcp" | "marketplaces" | "plugins" | "env" | "permissions";
837
+ /** @description The entry or variable; null for model and permissions. */
838
+ name: string | null;
839
+ /** @enum {string} */
840
+ action: "added" | "changed" | "removed" | "refreshed";
841
+ /**
842
+ * @description start: done before the harness process started.
843
+ * @enum {string}
844
+ */
845
+ how: "hot" | "start";
846
+ /** @description The plugin version or marketplace commit the harness reported. */
847
+ version: string | null;
848
+ /** @description The command's or the harness's message when it failed. */
849
+ error: string | null;
850
+ warnings: string[];
851
+ };
852
+ /** @description One application of the agent's configuration to a session's harness. */
853
+ ConfigApplied: {
854
+ /** @description The agent generation the session's harness now runs. */
855
+ generation: number;
856
+ changes: components["schemas"]["ConfigChange"][];
857
+ };
858
+ ConfigAppliedEvent: {
859
+ /**
860
+ * @description discriminator enum property added by openapi-typescript
861
+ * @enum {string}
862
+ */
863
+ type: "config.applied";
864
+ config: components["schemas"]["ConfigApplied"];
865
+ };
866
+ OutboxAttachment: {
867
+ name: string;
868
+ contentType: string;
869
+ size: number;
870
+ };
871
+ /** @description A send committed to the outbox, or a failed message queued again by outbox.retry. */
872
+ OutboxQueued: {
873
+ id: string;
874
+ connectorId: string;
875
+ key: string;
876
+ turnId: string | null;
877
+ /** @description Markdown. */
878
+ text: string;
879
+ attachments: components["schemas"]["OutboxAttachment"][];
880
+ /** @description Queued again by outbox.retry. */
881
+ retry: boolean;
882
+ };
883
+ OutboxQueuedEvent: {
884
+ /**
885
+ * @description discriminator enum property added by openapi-typescript
886
+ * @enum {string}
887
+ */
888
+ type: "outbox.queued";
889
+ outbox: components["schemas"]["OutboxQueued"];
890
+ };
891
+ OutboxDelivered: {
892
+ id: string;
893
+ externalId: string | null;
894
+ attempts: number;
895
+ };
896
+ OutboxDeliveredEvent: {
897
+ /**
898
+ * @description discriminator enum property added by openapi-typescript
899
+ * @enum {string}
900
+ */
901
+ type: "outbox.delivered";
902
+ outbox: components["schemas"]["OutboxDelivered"];
903
+ };
904
+ OutboxFailed: {
905
+ id: string;
906
+ /** @enum {string} */
907
+ class: "retryable" | "permanent";
908
+ code: string | null;
909
+ message: string;
910
+ attempts: number;
911
+ };
912
+ OutboxFailedEvent: {
913
+ /**
914
+ * @description discriminator enum property added by openapi-typescript
915
+ * @enum {string}
916
+ */
917
+ type: "outbox.failed";
918
+ outbox: components["schemas"]["OutboxFailed"];
919
+ };
920
+ EventBody: components["schemas"]["MessageEvent"] | components["schemas"]["TurnStartedEvent"] | components["schemas"]["TurnEndedEvent"] | components["schemas"]["StopRequestedEvent"] | components["schemas"]["AgentUnavailableEvent"] | components["schemas"]["AgentAvailableEvent"] | components["schemas"]["DaemonOutdatedEvent"] | components["schemas"]["SessionStatusEvent"] | components["schemas"]["ConfigAppliedEvent"] | components["schemas"]["OutboxQueuedEvent"] | components["schemas"]["OutboxDeliveredEvent"] | components["schemas"]["OutboxFailedEvent"];
921
+ /** @description An event of an agent's log: the envelope and one event type. */
922
+ Event: components["schemas"]["EventEnvelope"] & Omit<components["schemas"]["EventBody"], "type">;
923
+ FileEntry: {
924
+ path: string;
925
+ /** @enum {string} */
926
+ type: "file" | "directory";
927
+ size: number;
928
+ modifiedAt: components["schemas"]["Timestamp"];
929
+ };
930
+ FileList: {
931
+ data: components["schemas"]["FileEntry"][];
932
+ };
933
+ /** @enum {string} */
934
+ SessionStatus: "idle" | "running" | "retrying" | "failed" | "blocked";
935
+ /** @description The session's projection of its events; status is computed when served. */
936
+ Session: {
937
+ id: string;
938
+ agentId: string;
939
+ cwd: string;
940
+ /** @description Composed at creation from the agent's system prompt and the one given; fixed for the session's life. */
941
+ systemPrompt: string | null;
942
+ status: components["schemas"]["SessionStatus"];
943
+ lastSeq: components["schemas"]["Seq"];
944
+ lastUserSeq: components["schemas"]["Seq"];
945
+ processedSeq: components["schemas"]["Seq"];
946
+ heldSeq: components["schemas"]["Seq"];
947
+ lastError: components["schemas"]["TurnError"] | null;
948
+ retryAt: components["schemas"]["Timestamp"] | null;
949
+ /** @description The createdAt of the event at lastSeq; null if none. */
950
+ lastEventAt: components["schemas"]["Timestamp"] | null;
951
+ /** @description The agent generation the session's harness runs in full; 0 before the first. */
952
+ observedGeneration: number;
953
+ metadata: components["schemas"]["Metadata"];
954
+ /** @description Where answers in this session go when send names no key; set at creation or by a connector route. */
955
+ replyKey: string | null;
956
+ createdAt: components["schemas"]["Timestamp"];
957
+ };
958
+ SessionPage: components["schemas"]["Page"] & {
959
+ data?: components["schemas"]["Session"][];
960
+ };
961
+ CreateSessionRequest: {
962
+ cwd?: string;
963
+ systemPrompt?: string;
964
+ metadata?: components["schemas"]["Metadata"];
965
+ /** @description The session's reply key: a connector's name, a colon, and an address. */
966
+ replyKey?: string;
967
+ };
968
+ CreateTokenRequest: {
969
+ ttlSeconds: number;
970
+ };
971
+ SessionToken: {
972
+ token: string;
973
+ expiresAt: components["schemas"]["Timestamp"];
974
+ };
975
+ EventPage: {
976
+ data: components["schemas"]["Event"][];
977
+ hasMore: boolean;
978
+ };
979
+ /** @enum {string} */
980
+ TurnStatus: "running" | "completed" | "stopped" | "failed" | "discarded";
981
+ /** @description The projection of a turn's turn.started and turn.ended events. */
982
+ Turn: {
983
+ id: string;
984
+ sessionId: string;
985
+ status: components["schemas"]["TurnStatus"];
986
+ origin: components["schemas"]["TurnOrigin"];
987
+ /** @description The seqs of the user messages the turn consumed; empty for a harness turn. */
988
+ inputSeqs: components["schemas"]["Seq"][];
989
+ attempt: number;
990
+ error: components["schemas"]["TurnError"] | null;
991
+ retryAt: components["schemas"]["Timestamp"] | null;
992
+ startedSeq: components["schemas"]["Seq"];
993
+ endedSeq: components["schemas"]["Seq"] | null;
994
+ startedAt: components["schemas"]["Timestamp"];
995
+ endedAt: components["schemas"]["Timestamp"] | null;
996
+ /** @description Where the turn's time went; null while running and for a discarded turn. */
997
+ timing: components["schemas"]["TurnTiming"] | null;
998
+ };
999
+ TurnPage: components["schemas"]["Page"] & {
1000
+ data?: components["schemas"]["Turn"][];
1001
+ };
1002
+ SessionStreamEvent: {
1003
+ /**
1004
+ * @description discriminator enum property added by openapi-typescript
1005
+ * @enum {string}
1006
+ */
1007
+ event: "session";
1008
+ data: components["schemas"]["Session"];
1009
+ };
1010
+ StreamingMessage: {
1011
+ id: string;
1012
+ parentToolUseId: string | null;
1013
+ } & components["schemas"]["StreamingBody"];
1014
+ /** @description A streaming message in the event envelope without seq; live only. */
1015
+ StreamingMessageEvent: {
1016
+ agentId: string;
1017
+ sessionId: string;
1018
+ turnId: string;
1019
+ createdAt: components["schemas"]["Timestamp"];
1020
+ /** @constant */
1021
+ type: "message";
1022
+ message: components["schemas"]["StreamingMessage"];
1023
+ };
1024
+ MessageStreamEvent: {
1025
+ /**
1026
+ * @description discriminator enum property added by openapi-typescript
1027
+ * @enum {string}
1028
+ */
1029
+ event: "message";
1030
+ data: components["schemas"]["Event"] | components["schemas"]["StreamingMessageEvent"];
1031
+ /** @description The event's seq in decimal; absent for a streaming message */
1032
+ id?: string;
1033
+ };
1034
+ TurnStartedStreamEvent: {
1035
+ /**
1036
+ * @description discriminator enum property added by openapi-typescript
1037
+ * @enum {string}
1038
+ */
1039
+ event: "turn.started";
1040
+ data: components["schemas"]["Event"];
1041
+ /** @description The event's seq in decimal */
1042
+ id: string;
1043
+ };
1044
+ TurnEndedStreamEvent: {
1045
+ /**
1046
+ * @description discriminator enum property added by openapi-typescript
1047
+ * @enum {string}
1048
+ */
1049
+ event: "turn.ended";
1050
+ data: components["schemas"]["Event"];
1051
+ /** @description The event's seq in decimal */
1052
+ id: string;
1053
+ };
1054
+ StopRequestedStreamEvent: {
1055
+ /**
1056
+ * @description discriminator enum property added by openapi-typescript
1057
+ * @enum {string}
1058
+ */
1059
+ event: "stop.requested";
1060
+ data: components["schemas"]["Event"];
1061
+ /** @description The event's seq in decimal */
1062
+ id: string;
1063
+ };
1064
+ AgentUnavailableStreamEvent: {
1065
+ /**
1066
+ * @description discriminator enum property added by openapi-typescript
1067
+ * @enum {string}
1068
+ */
1069
+ event: "agent.unavailable";
1070
+ data: components["schemas"]["Event"];
1071
+ /** @description The event's seq in decimal */
1072
+ id: string;
1073
+ };
1074
+ AgentAvailableStreamEvent: {
1075
+ /**
1076
+ * @description discriminator enum property added by openapi-typescript
1077
+ * @enum {string}
1078
+ */
1079
+ event: "agent.available";
1080
+ data: components["schemas"]["Event"];
1081
+ /** @description The event's seq in decimal */
1082
+ id: string;
1083
+ };
1084
+ DaemonOutdatedStreamEvent: {
1085
+ /**
1086
+ * @description discriminator enum property added by openapi-typescript
1087
+ * @enum {string}
1088
+ */
1089
+ event: "daemon.outdated";
1090
+ data: components["schemas"]["Event"];
1091
+ /** @description The event's seq in decimal */
1092
+ id: string;
1093
+ };
1094
+ ConfigAppliedStreamEvent: {
1095
+ /**
1096
+ * @description discriminator enum property added by openapi-typescript
1097
+ * @enum {string}
1098
+ */
1099
+ event: "config.applied";
1100
+ data: components["schemas"]["Event"];
1101
+ /** @description The event's seq in decimal */
1102
+ id: string;
1103
+ };
1104
+ SessionStatusStreamEvent: {
1105
+ /**
1106
+ * @description discriminator enum property added by openapi-typescript
1107
+ * @enum {string}
1108
+ */
1109
+ event: "session.status";
1110
+ data: components["schemas"]["Event"];
1111
+ /** @description The event's seq in decimal */
1112
+ id: string;
1113
+ };
1114
+ /** @description The sections of the status that changed; each present one replaces that section whole. Plugins and skills come only after a configuration change was applied between turns. */
1115
+ HarnessStatusUpdate: {
1116
+ context?: components["schemas"]["ContextStatus"];
1117
+ plugins?: components["schemas"]["HarnessEntry"][];
1118
+ skills?: components["schemas"]["HarnessEntry"][];
1119
+ mcp?: components["schemas"]["HarnessMcpServer"][];
1120
+ subagents?: components["schemas"]["HarnessSubagents"];
1121
+ workflows?: components["schemas"]["HarnessWorkflows"];
1122
+ };
1123
+ /** @description A live change of the harness's status in the event envelope without seq; live only, never stored. */
1124
+ StatusUpdateEvent: {
1125
+ agentId: string;
1126
+ sessionId: string;
1127
+ /** @description Always null: a live update belongs to no turn. */
1128
+ turnId: string | null;
1129
+ createdAt: components["schemas"]["Timestamp"];
1130
+ /** @constant */
1131
+ type: "status.update";
1132
+ update: components["schemas"]["HarnessStatusUpdate"];
1133
+ };
1134
+ StatusUpdateStreamEvent: {
1135
+ /**
1136
+ * @description discriminator enum property added by openapi-typescript
1137
+ * @enum {string}
1138
+ */
1139
+ event: "status.update";
1140
+ data: components["schemas"]["StatusUpdateEvent"];
1141
+ };
1142
+ ErrorStreamEvent: {
1143
+ /**
1144
+ * @description discriminator enum property added by openapi-typescript
1145
+ * @enum {string}
1146
+ */
1147
+ event: "error";
1148
+ data: components["schemas"]["ErrorBody"];
1149
+ };
1150
+ OutboxQueuedStreamEvent: {
1151
+ /**
1152
+ * @description discriminator enum property added by openapi-typescript
1153
+ * @enum {string}
1154
+ */
1155
+ event: "outbox.queued";
1156
+ data: components["schemas"]["Event"];
1157
+ /** @description The event's seq in decimal */
1158
+ id: string;
1159
+ };
1160
+ OutboxDeliveredStreamEvent: {
1161
+ /**
1162
+ * @description discriminator enum property added by openapi-typescript
1163
+ * @enum {string}
1164
+ */
1165
+ event: "outbox.delivered";
1166
+ data: components["schemas"]["Event"];
1167
+ /** @description The event's seq in decimal */
1168
+ id: string;
1169
+ };
1170
+ OutboxFailedStreamEvent: {
1171
+ /**
1172
+ * @description discriminator enum property added by openapi-typescript
1173
+ * @enum {string}
1174
+ */
1175
+ event: "outbox.failed";
1176
+ data: components["schemas"]["Event"];
1177
+ /** @description The event's seq in decimal */
1178
+ id: string;
1179
+ };
1180
+ /** @description An event of the stream as an SDK surfaces it: the SSE event field as event, the parsed data as data, the SSE id as id. */
1181
+ StreamEvent: components["schemas"]["SessionStreamEvent"] | components["schemas"]["MessageStreamEvent"] | components["schemas"]["TurnStartedStreamEvent"] | components["schemas"]["TurnEndedStreamEvent"] | components["schemas"]["StopRequestedStreamEvent"] | components["schemas"]["AgentUnavailableStreamEvent"] | components["schemas"]["AgentAvailableStreamEvent"] | components["schemas"]["DaemonOutdatedStreamEvent"] | components["schemas"]["ConfigAppliedStreamEvent"] | components["schemas"]["SessionStatusStreamEvent"] | components["schemas"]["OutboxQueuedStreamEvent"] | components["schemas"]["OutboxDeliveredStreamEvent"] | components["schemas"]["OutboxFailedStreamEvent"] | components["schemas"]["StatusUpdateStreamEvent"] | components["schemas"]["ErrorStreamEvent"];
1182
+ /** @enum {string} */
1183
+ ProviderKind: "anthropic" | "openai" | "anthropic-compatible" | "openai-compatible";
1184
+ /**
1185
+ * @description anthropic: the Messages API, which Claude Code speaks; openai: the Responses API, which Codex speaks.
1186
+ * @enum {string}
1187
+ */
1188
+ ModelProtocol: "anthropic" | "openai";
1189
+ ProviderModel: {
1190
+ /** @description The provider's model ID, sent upstream as it is. */
1191
+ id: string;
1192
+ /** @description provider/id: the name a template, an agent, and a request use. */
1193
+ name: string;
1194
+ protocol: components["schemas"]["ModelProtocol"];
1195
+ };
1196
+ ModelProvider: {
1197
+ /** @description Unique in the project, fixed at creation; a project model is named provider/model. */
1198
+ name: string;
1199
+ kind: components["schemas"]["ProviderKind"];
1200
+ protocol: components["schemas"]["ModelProtocol"];
1201
+ harness: components["schemas"]["Harness"];
1202
+ baseUrl: string;
1203
+ /** @description The key's first 4 and last 4 characters; the key is never returned. */
1204
+ keyPreview: string;
1205
+ models: components["schemas"]["ProviderModel"][];
1206
+ /** @enum {string} */
1207
+ status: "ok" | "failing";
1208
+ /** @description While failing: what the provider answered. */
1209
+ lastError: string | null;
1210
+ checkedAt: components["schemas"]["Timestamp"];
1211
+ createdAt: components["schemas"]["Timestamp"];
1212
+ updatedAt: components["schemas"]["Timestamp"];
1213
+ };
1214
+ ModelProviderPage: components["schemas"]["Page"] & {
1215
+ data?: components["schemas"]["ModelProvider"][];
1216
+ };
1217
+ ProviderCreate: {
1218
+ name: string;
1219
+ kind: components["schemas"]["ProviderKind"];
1220
+ /** @description Required for the compatible kinds, refused for the others. */
1221
+ baseUrl?: string;
1222
+ apiKey: string;
1223
+ /** @description Model IDs. */
1224
+ models: string[];
1225
+ /** @description The model of a one-token request; default the first of models. */
1226
+ testModel?: string;
1227
+ };
1228
+ ProviderDraft: {
1229
+ kind: components["schemas"]["ProviderKind"];
1230
+ baseUrl?: string;
1231
+ apiKey: string;
1232
+ testModel?: string;
1233
+ };
1234
+ ProviderTest: {
1235
+ ok: boolean;
1236
+ /**
1237
+ * @description How the key was verified.
1238
+ * @enum {string}
1239
+ */
1240
+ method: "list" | "request";
1241
+ /** @description The IDs the provider lists; null when it lists none. */
1242
+ models: string[] | null;
1243
+ /** @description When not ok: what the provider answered. */
1244
+ error: string | null;
1245
+ };
1246
+ /** @description An omitted field keeps its value. */
1247
+ ProviderUpdate: {
1248
+ baseUrl?: string;
1249
+ apiKey?: string;
1250
+ /** @description The whole list. */
1251
+ models?: string[];
1252
+ testModel?: string;
1253
+ };
1254
+ ProviderTestRequest: {
1255
+ testModel?: string;
1256
+ };
1257
+ /**
1258
+ * @description AWS Lambda's runtime identifiers.
1259
+ * @enum {string}
1260
+ */
1261
+ FunctionRuntime: "nodejs24.x" | "python3.14";
1262
+ FunctionSummary: {
1263
+ runtime: components["schemas"]["FunctionRuntime"];
1264
+ /** @description The preset the code was taken from when it was set. */
1265
+ preset: string | null;
1266
+ /** @description The code is still the preset's, byte for byte, so the console offers its form. */
1267
+ presetCode: boolean;
1268
+ /** @description paddock's version of the side's function, raised by every set, never reused. */
1269
+ version: number;
1270
+ /** @description SHA-256 of the code, hex. */
1271
+ codeSha256: string;
1272
+ updatedAt: components["schemas"]["Timestamp"];
1273
+ };
1274
+ Inbound: {
1275
+ /** @description https://webhook.paddockai.dev/con_… */
1276
+ url: string;
1277
+ /** @description The inbound function; null: every request is answered 503. */
1278
+ functionSummary: components["schemas"]["FunctionSummary"] | null;
1279
+ };
1280
+ RateLimit: {
1281
+ perMinute: number;
1282
+ };
1283
+ CredentialError: {
1284
+ reason: string;
1285
+ at: components["schemas"]["Timestamp"];
1286
+ };
1287
+ Outbound: {
1288
+ /** @description The deliver function; null: sends are refused until one is set. */
1289
+ functionSummary: components["schemas"]["FunctionSummary"] | null;
1290
+ rateLimit: components["schemas"]["RateLimit"];
1291
+ /** @description The last permanent error with code auth; cleared by the next delivered message. */
1292
+ credentialError: components["schemas"]["CredentialError"] | null;
1293
+ };
1294
+ Connector: {
1295
+ id: string;
1296
+ /** @description [a-z0-9-], 1 to 64 characters, unique in the project, fixed at creation. */
1297
+ name: string;
1298
+ /** @description The names of its secrets, default first; never their values. */
1299
+ secrets: string[];
1300
+ /** @description null: no webhook URL answers for it. */
1301
+ inbound: components["schemas"]["Inbound"] | null;
1302
+ /** @description null: every send to its keys is refused. */
1303
+ outbound: components["schemas"]["Outbound"] | null;
1304
+ createdAt: components["schemas"]["Timestamp"];
1305
+ updatedAt: components["schemas"]["Timestamp"];
1306
+ };
1307
+ ConnectorPage: components["schemas"]["Page"] & {
1308
+ data?: components["schemas"]["Connector"][];
1309
+ };
1310
+ /** @description Present: the connector has an inbound side. */
1311
+ InboundCreate: Record<string, never>;
1312
+ /** @description Present: the connector has an outbound side. */
1313
+ OutboundCreate: {
1314
+ rateLimit?: components["schemas"]["RateLimit"];
1315
+ };
1316
+ ConnectorCreate: {
1317
+ name: string;
1318
+ inbound?: components["schemas"]["InboundCreate"] | null;
1319
+ outbound?: components["schemas"]["OutboundCreate"] | null;
1320
+ /** @description The default secret, 16 to 256 printable ASCII characters; generated when omitted. */
1321
+ secret?: string;
1322
+ };
1323
+ PresetParam: {
1324
+ name: string;
1325
+ title: string;
1326
+ required: boolean;
1327
+ default: string | null;
1328
+ /** @description A closed set of values; null: any. */
1329
+ choices: string[] | null;
1330
+ };
1331
+ PresetSide: {
1332
+ /** @description The code by runtime. */
1333
+ code: {
1334
+ [key: string]: string;
1335
+ };
1336
+ /** @description The form the console shows. */
1337
+ params: components["schemas"]["PresetParam"][];
1338
+ };
1339
+ FunctionPreset: {
1340
+ /** @description route-all, github, slack, stripe, hubspot-v2, hubspot-v3, shopify, linear, standard-webhooks, webhook, email-ses. */
1341
+ name: string;
1342
+ title: string;
1343
+ /** @description The secret names its code reads, default first. */
1344
+ secrets: string[];
1345
+ inbound: components["schemas"]["PresetSide"] | null;
1346
+ outbound: components["schemas"]["PresetSide"] | null;
1347
+ };
1348
+ FunctionPresetList: {
1349
+ presets: components["schemas"]["FunctionPreset"][];
1350
+ };
1351
+ /** @description Sets which sides exist and the outbound rate limit; a side omitted or null is removed. */
1352
+ ConnectorUpdate: {
1353
+ inbound?: components["schemas"]["InboundCreate"] | null;
1354
+ outbound?: components["schemas"]["OutboundCreate"] | null;
1355
+ };
1356
+ ConnectorSecret: {
1357
+ name: string;
1358
+ secret: string;
1359
+ };
1360
+ SecretRotateRequest: {
1361
+ /** @description 1 to 64 of [A-Za-z0-9_]; default "default". A name the connector lacks is created. */
1362
+ name?: string;
1363
+ /** @description 16 to 256 printable ASCII characters; generated when omitted. */
1364
+ secret?: string;
1365
+ };
1366
+ /** @enum {string} */
1367
+ FunctionSide: "inbound" | "outbound";
1368
+ ConnectorFunction: components["schemas"]["FunctionSummary"] & {
1369
+ side: components["schemas"]["FunctionSide"];
1370
+ /** @description The one source file, UTF-8. */
1371
+ code: string;
1372
+ /** @description Passed to every invocation; not secret. */
1373
+ params: {
1374
+ [key: string]: string;
1375
+ };
1376
+ };
1377
+ FunctionSet: {
1378
+ runtime: components["schemas"]["FunctionRuntime"];
1379
+ /** @description At most 256 KiB; omitted: the preset's code for the side and runtime. */
1380
+ code?: string;
1381
+ /** @description A preset's name; required when code is omitted. */
1382
+ preset?: string;
1383
+ /** @description Omitted: the preset's defaults, or none. */
1384
+ params?: {
1385
+ [key: string]: string;
1386
+ };
1387
+ };
1388
+ FunctionTestEvent: {
1389
+ /** @enum {string} */
1390
+ method?: "POST";
1391
+ query?: {
1392
+ [key: string]: string;
1393
+ };
1394
+ headers?: {
1395
+ [key: string]: string;
1396
+ };
1397
+ /** @description The raw body. */
1398
+ body: string;
1399
+ /**
1400
+ * @description Default utf8.
1401
+ * @enum {string}
1402
+ */
1403
+ bodyEncoding?: "utf8" | "base64";
1404
+ };
1405
+ DeliverTestAttachment: {
1406
+ name: string;
1407
+ contentType: string;
1408
+ url: string;
1409
+ };
1410
+ DeliverTestMessage: {
1411
+ /** @description The key is the connector's name, ":", and this. */
1412
+ address: string;
1413
+ text: string;
1414
+ /** @description URLs the function downloads, as given. */
1415
+ attachments?: components["schemas"]["DeliverTestAttachment"][];
1416
+ };
1417
+ /** @description Unsaved code to run instead of the saved version, checked as set checks code. */
1418
+ FunctionDraft: {
1419
+ runtime: components["schemas"]["FunctionRuntime"];
1420
+ code: string;
1421
+ /** @description Default: none. */
1422
+ params?: {
1423
+ [key: string]: string;
1424
+ };
1425
+ };
1426
+ /** @description Inbound: a sample request, or a recorded delivery's request; outbound: a message delivered for real. With a draft, the draft runs instead of the saved version. */
1427
+ FunctionTestRequest: {
1428
+ event?: components["schemas"]["FunctionTestEvent"];
1429
+ deliveryId?: string;
1430
+ /** @description With deliveryId: run as a replay would, with ctx.replay set. */
1431
+ replay?: boolean;
1432
+ message?: components["schemas"]["DeliverTestMessage"];
1433
+ draft?: components["schemas"]["FunctionDraft"];
1434
+ };
1435
+ /** @enum {string} */
1436
+ FunctionResult: "accept" | "respond" | "reject" | "ok" | "retryable" | "permanent" | "error" | "timeout";
1437
+ /** @description As agent.sessions.create takes them; used only when a session is created. connectorKey is the route's and refused in metadata. */
1438
+ SessionSettings: {
1439
+ cwd?: string;
1440
+ systemPrompt?: string;
1441
+ metadata?: components["schemas"]["Metadata"];
1442
+ };
1443
+ /** @description One entry of an inbound function's deliver list. */
1444
+ Route: {
1445
+ /** @description An agent's ID. */
1446
+ agent: string;
1447
+ /** @description null: a new session. */
1448
+ sessionKey: string | null;
1449
+ /** @description A reply match: the external ID of the message the event answers. */
1450
+ replyTo?: string;
1451
+ /** @description With replyTo: deliver only to the matched session. */
1452
+ matchOnly?: boolean;
1453
+ message: string;
1454
+ /** @description Becomes the session's reply key when delivered. */
1455
+ replyKey?: string;
1456
+ settings?: components["schemas"]["SessionSettings"];
1457
+ };
1458
+ /** @description A handshake's answer. */
1459
+ FunctionResponse: {
1460
+ status: number;
1461
+ headers: {
1462
+ [key: string]: string;
1463
+ };
1464
+ body: string;
1465
+ };
1466
+ FunctionTest: {
1467
+ side: components["schemas"]["FunctionSide"];
1468
+ /** @description The saved version that ran; null for a draft. */
1469
+ version: number | null;
1470
+ result: components["schemas"]["FunctionResult"];
1471
+ /** @description Inbound: the HTTP status a real request would have been answered with. */
1472
+ answer: number | null;
1473
+ /** @description Inbound accept. */
1474
+ dedupeKey: string | null;
1475
+ /** @description Inbound accept: what a real request would deliver. */
1476
+ routes: components["schemas"]["Route"][] | null;
1477
+ response: components["schemas"]["FunctionResponse"] | null;
1478
+ /** @description Outbound ok. */
1479
+ externalId: string | null;
1480
+ /** @description Outbound retryable: seconds. */
1481
+ retryAfter: number | null;
1482
+ /** @description Outbound permanent. */
1483
+ code: string | null;
1484
+ /** @description Inbound reject; outbound retryable and permanent. */
1485
+ reason: string | null;
1486
+ /** @description error and timeout, and an answer outside the contract. */
1487
+ error: string | null;
1488
+ durationMs: number;
1489
+ /** @description The last 4 KiB the code wrote to its standard output and error. */
1490
+ logs: string;
1491
+ };
1492
+ /** @enum {string} */
1493
+ DeliveryStatus: "pending" | "done" | "rejected" | "handshake";
1494
+ DeliveryError: {
1495
+ /** @enum {string} */
1496
+ code: "invalid_body" | "no_function" | "function_rejected" | "function_error" | "function_timeout";
1497
+ message: string;
1498
+ };
1499
+ /** @description What a delivery records of the function that ran. */
1500
+ DeliveryFunction: {
1501
+ version: number;
1502
+ result: components["schemas"]["FunctionResult"];
1503
+ durationMs: number;
1504
+ };
1505
+ /** @enum {string} */
1506
+ DedupeSource: "function" | "body";
1507
+ Dedupe: {
1508
+ source: components["schemas"]["DedupeSource"];
1509
+ /** @description SHA-256 in hex. */
1510
+ hash: string;
1511
+ };
1512
+ /** @enum {string} */
1513
+ OutcomeStatus: "pending" | "delivered" | "unmatched" | "failed";
1514
+ OutcomeError: {
1515
+ /** @enum {string} */
1516
+ code: "agent_not_found" | "invalid_settings" | "unavailable" | "internal";
1517
+ message: string;
1518
+ };
1519
+ RouteOutcome: components["schemas"]["Route"] & {
1520
+ /** @description The route's place in the answer, from 0. */
1521
+ position: number;
1522
+ status: components["schemas"]["OutcomeStatus"];
1523
+ /** @description The key it is ordered by: the session key, dlv_…/position, or the reply match. */
1524
+ orderKey: string;
1525
+ /** @description While pending: the earlier delivery with the same agent and key it waits for. */
1526
+ waitingFor: string | null;
1527
+ error: components["schemas"]["OutcomeError"] | null;
1528
+ /** @description Set when delivered. */
1529
+ sessionId: string | null;
1530
+ sessionCreated: boolean;
1531
+ /** @description The reply match chose the session. */
1532
+ sessionMatched: boolean;
1533
+ messageId: string | null;
1534
+ seq: components["schemas"]["Seq"] | null;
1535
+ };
1536
+ Delivery: {
1537
+ id: string;
1538
+ connectorId: string;
1539
+ status: components["schemas"]["DeliveryStatus"];
1540
+ /** @description The delivery this one replays. */
1541
+ replayOf: string | null;
1542
+ error: components["schemas"]["DeliveryError"] | null;
1543
+ /** @description null: no function ran. */
1544
+ function: components["schemas"]["DeliveryFunction"] | null;
1545
+ /** @description null when rejected, a handshake, or a replay. */
1546
+ dedupe: components["schemas"]["Dedupe"] | null;
1547
+ /** @description One per route, in the function's order. */
1548
+ outcomes: components["schemas"]["RouteOutcome"][];
1549
+ attempts: number;
1550
+ nextAttemptAt: components["schemas"]["Timestamp"] | null;
1551
+ receivedAt: components["schemas"]["Timestamp"];
1552
+ finishedAt: components["schemas"]["Timestamp"] | null;
1553
+ };
1554
+ DeliveryPage: components["schemas"]["Page"] & {
1555
+ data?: components["schemas"]["Delivery"][];
1556
+ };
1557
+ DeliveryRequest: {
1558
+ method: string;
1559
+ /** @description The URL the sender called, with its raw query. */
1560
+ url: string;
1561
+ headers: {
1562
+ [key: string]: string;
1563
+ };
1564
+ /** @description As received, as UTF-8; null when it was over the limit. */
1565
+ body: string | null;
1566
+ };
1567
+ DeliveryDetail: components["schemas"]["Delivery"] & {
1568
+ request: components["schemas"]["DeliveryRequest"];
1569
+ /** @description A handshake's answer, as sent. */
1570
+ response: components["schemas"]["FunctionResponse"] | null;
1571
+ };
1572
+ /** @enum {string} */
1573
+ OutboxStatus: "queued" | "delivering" | "delivered" | "failed";
1574
+ /** @description The inbound delivery and route whose message started the turn. */
1575
+ Origin: {
1576
+ connectorId: string;
1577
+ deliveryId: string;
1578
+ position: number;
1579
+ };
1580
+ OutboxError: {
1581
+ /** @enum {string} */
1582
+ class: "retryable" | "permanent";
1583
+ code: string | null;
1584
+ message: string;
1585
+ };
1586
+ OutboxMessage: {
1587
+ id: string;
1588
+ connectorId: string;
1589
+ /** @description As resolved: the session's reply key when send named none. */
1590
+ key: string;
1591
+ sessionId: string;
1592
+ agentId: string;
1593
+ /** @description The turn that sent it. */
1594
+ turnId: string | null;
1595
+ origin: components["schemas"]["Origin"] | null;
1596
+ /** @description Markdown. */
1597
+ text: string;
1598
+ attachments: components["schemas"]["OutboxAttachment"][];
1599
+ status: components["schemas"]["OutboxStatus"];
1600
+ /** @description What the deliver function returned when delivered. */
1601
+ externalId: string | null;
1602
+ /** @description While queued: the earlier message of the key it waits for. */
1603
+ waitingFor: string | null;
1604
+ /** @description The last attempt's; on a queued retry and when failed. */
1605
+ error: components["schemas"]["OutboxError"] | null;
1606
+ /** @description The last answer's progress, which the next attempt gets; null when none. */
1607
+ progress: unknown;
1608
+ attempts: number;
1609
+ nextAttemptAt: components["schemas"]["Timestamp"] | null;
1610
+ createdAt: components["schemas"]["Timestamp"];
1611
+ finishedAt: components["schemas"]["Timestamp"] | null;
1612
+ };
1613
+ OutboxMessagePage: components["schemas"]["Page"] & {
1614
+ data?: components["schemas"]["OutboxMessage"][];
1615
+ };
1616
+ ApiKey: {
1617
+ id: string;
1618
+ name: string;
1619
+ /**
1620
+ * @description Who created the key: the console's key routes, the CLI's login, or the operator tooling.
1621
+ * @enum {string}
1622
+ */
1623
+ origin: "console" | "cli" | "operator";
1624
+ createdAt: components["schemas"]["Timestamp"];
1625
+ lastUsedAt: components["schemas"]["Timestamp"] | null;
1626
+ };
1627
+ ApiKeyPage: components["schemas"]["Page"] & {
1628
+ data?: components["schemas"]["ApiKey"][];
1629
+ /** @description When the project's first login of the paddock CLI was approved and collected its key; null before any. It never changes afterwards, whatever happens to that key. */
1630
+ firstCliLoginAt: components["schemas"]["Timestamp"] | null;
1631
+ };
1632
+ CreateApiKeyRequest: {
1633
+ name: string;
1634
+ };
1635
+ /** @description The new key; key is the full key, returned only in this response. */
1636
+ CreatedApiKey: {
1637
+ apiKey: components["schemas"]["ApiKey"];
1638
+ key: string;
1639
+ };
1640
+ /** @description The CLI's request for a device code. */
1641
+ DeviceCodeRequest: {
1642
+ hostname: string;
1643
+ };
1644
+ /** @description A device code and the user code the developer approves on the console. */
1645
+ DeviceCode: {
1646
+ deviceCode: string;
1647
+ userCode: string;
1648
+ verificationUri: string;
1649
+ verificationUriComplete: string;
1650
+ expiresIn: number;
1651
+ interval: number;
1652
+ };
1653
+ DeviceTokenRequest: {
1654
+ deviceCode: string;
1655
+ };
1656
+ DeviceApproveRequest: {
1657
+ userCode: string;
1658
+ };
1659
+ /** @description The approved login: the hostname the CLI runs on. */
1660
+ DeviceApproval: {
1661
+ hostname: string;
1662
+ };
1663
+ };
1664
+ responses: {
1665
+ /** @description Every non-2xx response */
1666
+ Error: {
1667
+ headers: {
1668
+ "Request-Id": components["headers"]["RequestId"];
1669
+ [name: string]: unknown;
1670
+ };
1671
+ content: {
1672
+ "application/json": components["schemas"]["ErrorBody"];
1673
+ };
1674
+ };
1675
+ /** @description Done */
1676
+ NoContent: {
1677
+ headers: {
1678
+ "Request-Id": components["headers"]["RequestId"];
1679
+ [name: string]: unknown;
1680
+ };
1681
+ content?: never;
1682
+ };
1683
+ };
1684
+ parameters: {
1685
+ /** @description The API key's ID */
1686
+ ApiKeyId: string;
1687
+ /** @description The agent's ID */
1688
+ AgentId: string;
1689
+ /** @description The session's ID */
1690
+ SessionId: string;
1691
+ /** @description The turn's ID */
1692
+ TurnId: string;
1693
+ /** @description The connector's ID, or for connectors.get its name */
1694
+ ConnectorIdOrName: string;
1695
+ /** @description The connector's side */
1696
+ FunctionSide: components["schemas"]["FunctionSide"];
1697
+ /** @description The outbox message's ID */
1698
+ OutboxId: string;
1699
+ /** @description Only this connector's messages */
1700
+ OutboxConnectorFilter: string;
1701
+ /** @description Only this session's messages */
1702
+ OutboxSessionFilter: string;
1703
+ /** @description Only the messages of this key */
1704
+ OutboxKeyFilter: string;
1705
+ /** @description Only the messages with this status */
1706
+ OutboxStatusFilter: components["schemas"]["OutboxStatus"];
1707
+ /** @description The delivery's ID */
1708
+ DeliveryId: string;
1709
+ /** @description The secret's name; default "default" */
1710
+ SecretName: string;
1711
+ /** @description Only the deliveries with this status */
1712
+ DeliveryStatusFilter: components["schemas"]["DeliveryStatus"];
1713
+ /** @description The model provider's name */
1714
+ ProviderName: string;
1715
+ /** @description The template's name */
1716
+ TemplateName: string;
1717
+ /** @description The template version */
1718
+ TemplateVersion: number;
1719
+ /** @description The capability entry's name */
1720
+ EntryName: string;
1721
+ /** @description A path relative to its root; it may contain slashes, which the services route as one parameter */
1722
+ Path: string;
1723
+ /** @description Page size */
1724
+ Limit: number;
1725
+ /** @description The nextCursor of the previous page */
1726
+ Cursor: string;
1727
+ /** @description Matches every listed key exactly: metadata[teamId]=t_42 */
1728
+ MetadataFilter: components["schemas"]["Metadata"];
1729
+ /** @description name or name@version */
1730
+ TemplateFilter: string;
1731
+ /** @description Only the sessions of this agent */
1732
+ AgentFilter: string;
1733
+ /** @description Only sessions created at or after this time (RFC 3339) */
1734
+ CreatedAfter: string;
1735
+ /** @description Only sessions created before this time (RFC 3339) */
1736
+ CreatedBefore: string;
1737
+ /** @description Only events with a greater seq */
1738
+ After: components["schemas"]["Seq"];
1739
+ /** @description Only events with a smaller seq */
1740
+ Before: components["schemas"]["Seq"];
1741
+ /** @description Comma-separated event types to keep */
1742
+ Types: string[];
1743
+ /** @description The directory to list; default the root */
1744
+ Dir: string;
1745
+ /** @description Include or delete every descendant */
1746
+ Recursive: boolean;
1747
+ };
1748
+ requestBodies: never;
1749
+ headers: {
1750
+ /** @description The request's ID, for support and logs */
1751
+ RequestId: string;
1752
+ };
1753
+ pathItems: never;
1754
+ }
1755
+
1756
+ type S = components["schemas"];
1757
+ /** A string union that also accepts values a newer server sends (009#open-reading). */
1758
+ type Open<T extends string> = T | (string & {});
1759
+ type Timestamp = string;
1760
+ type Page<T> = {
1761
+ data: T[];
1762
+ nextCursor: string | null;
1763
+ };
1764
+ type ErrorCode = Open<S["ErrorCode"]>;
1765
+ type ErrorBody = {
1766
+ error: {
1767
+ code: ErrorCode;
1768
+ message: string;
1769
+ details?: Record<string, unknown>;
1770
+ };
1771
+ };
1772
+ type Harness = Open<S["Harness"]>;
1773
+ type OutboxQueued = S["OutboxQueued"];
1774
+ type OutboxDelivered = S["OutboxDelivered"];
1775
+ type OutboxFailed = Omit<S["OutboxFailed"], "class"> & {
1776
+ class: Open<S["OutboxFailed"]["class"]>;
1777
+ };
1778
+ type TurnErrorCode = Open<S["TurnErrorCode"]>;
1779
+ type TurnError = {
1780
+ code: TurnErrorCode;
1781
+ message: string;
1782
+ };
1783
+ type SessionStatus = Open<S["SessionStatus"]>;
1784
+ type Session = Omit<S["Session"], "status" | "lastError"> & {
1785
+ status: SessionStatus;
1786
+ lastError: TurnError | null;
1787
+ };
1788
+ type SessionToken = S["SessionToken"];
1789
+ type TurnStatus = Open<S["TurnStatus"]>;
1790
+ /** "user": over waiting messages; "harness": started by the harness on its own, with no inputs. */
1791
+ type TurnOrigin = Open<S["TurnOrigin"]>;
1792
+ type Turn = Omit<S["Turn"], "status" | "origin" | "error" | "timing"> & {
1793
+ status: TurnStatus;
1794
+ origin: TurnOrigin;
1795
+ error: TurnError | null;
1796
+ /** Where the turn's time went; null while it runs and for a discarded turn. */
1797
+ timing: TurnTiming | null;
1798
+ };
1799
+ /** Where a turn's time went, as phases on the turn's own timeline, in milliseconds (002#turn-timing). */
1800
+ type TurnTiming = Omit<S["TurnTiming"], "phases"> & {
1801
+ phases: TimingPhase[];
1802
+ };
1803
+ type TimingPhaseKind = Open<S["TimingPhaseKind"]>;
1804
+ type TimingPhase = Omit<S["TimingPhase"], "kind"> & {
1805
+ kind: TimingPhaseKind;
1806
+ };
1807
+ type ToolName = Open<S["ToolName"]>;
1808
+ type ToolInput = S["ToolInput"];
1809
+ type ToolOutput = S["ToolOutput"];
1810
+ type ToolCall = Omit<S["ToolCall"], "tool"> & {
1811
+ tool: ToolName;
1812
+ };
1813
+ type ToolResult = Omit<S["ToolResult"], "tool"> & {
1814
+ tool: ToolName;
1815
+ };
1816
+ type UserBody = S["UserBody"];
1817
+ type AssistantBody = S["AssistantBody"];
1818
+ type ReasoningBody = S["ReasoningBody"];
1819
+ type ToolCallBody = {
1820
+ kind: "tool_call";
1821
+ toolCall: ToolCall;
1822
+ };
1823
+ type ToolResultBody = {
1824
+ kind: "tool_result";
1825
+ toolResult: ToolResult;
1826
+ };
1827
+ type UnknownBody = Omit<S["UnknownBody"], "harness"> & {
1828
+ harness: Harness;
1829
+ };
1830
+ type StreamingBody = S["StreamingBody"];
1831
+ type MessageBody = UserBody | AssistantBody | ReasoningBody | ToolCallBody | ToolResultBody | UnknownBody | StreamingBody;
1832
+ type MessageKind = MessageBody["kind"];
1833
+ /**
1834
+ * 002's Message: id and parentToolUseId joined with one body. The union is closed so
1835
+ * that kind narrows it; a message of a kind this SDK does not know is still kept as
1836
+ * received, with its own kind and raw fields (009#open-reading), and
1837
+ * isKnownMessageKind tells it apart.
1838
+ */
1839
+ type Message = {
1840
+ id: string;
1841
+ parentToolUseId: string | null;
1842
+ } & MessageBody;
1843
+ /** A message as an event stores it: every kind but streaming. */
1844
+ type StoredMessage = {
1845
+ id: string;
1846
+ parentToolUseId: string | null;
1847
+ } & Exclude<MessageBody, StreamingBody>;
1848
+ type StreamingMessage = {
1849
+ id: string;
1850
+ parentToolUseId: string | null;
1851
+ } & StreamingBody;
1852
+ type EventEnvelope = {
1853
+ seq: number;
1854
+ agentId: string;
1855
+ sessionId: string | null;
1856
+ turnId: string | null;
1857
+ createdAt: Timestamp;
1858
+ };
1859
+ type TurnStarted = S["TurnStarted"];
1860
+ type TurnEnded = Omit<S["TurnEnded"], "outcome" | "error" | "timing"> & {
1861
+ outcome: Open<S["TurnOutcome"]>;
1862
+ error: TurnError | null;
1863
+ timing: TurnTiming | null;
1864
+ };
1865
+ type AgentUnavailable = {
1866
+ error: TurnError;
1867
+ };
1868
+ type DaemonOutdated = S["DaemonOutdated"];
1869
+ type ConfigChange = Omit<S["ConfigChange"], "kind" | "action" | "how"> & {
1870
+ kind: Open<S["ConfigChange"]["kind"]>;
1871
+ action: Open<S["ConfigChange"]["action"]>;
1872
+ how: Open<S["ConfigChange"]["how"]>;
1873
+ };
1874
+ type ConfigApplied = {
1875
+ generation: number;
1876
+ changes: ConfigChange[];
1877
+ };
1878
+ type RunState = Open<S["RunState"]>;
1879
+ type HarnessEntry = Omit<S["HarnessEntry"], "scope" | "state"> & {
1880
+ scope: Open<S["HarnessEntry"]["scope"]>;
1881
+ state: Open<S["HarnessEntry"]["state"]>;
1882
+ };
1883
+ type HarnessMcpServer = HarnessEntry & {
1884
+ tools: string[];
1885
+ };
1886
+ type ContextCategory = Omit<S["ContextCategory"], "kind"> & {
1887
+ kind: Open<S["ContextCategory"]["kind"]>;
1888
+ };
1889
+ type ContextItem = S["ContextItem"];
1890
+ type ContextStatus = Omit<S["ContextStatus"], "categories"> & {
1891
+ categories: ContextCategory[] | null;
1892
+ };
1893
+ type SubagentRun = Omit<S["SubagentRun"], "state"> & {
1894
+ state: RunState;
1895
+ };
1896
+ type WorkflowRun = Omit<S["WorkflowRun"], "state"> & {
1897
+ state: RunState;
1898
+ };
1899
+ type HarnessSubagents = {
1900
+ definitions: HarnessEntry[];
1901
+ runs: SubagentRun[];
1902
+ };
1903
+ type HarnessWorkflows = {
1904
+ definitions: HarnessEntry[];
1905
+ runs: WorkflowRun[];
1906
+ };
1907
+ /** The harness's internal state at a turn's end; workflows is null on Codex. */
1908
+ type HarnessStatus = {
1909
+ harness: Harness;
1910
+ takenAt: Timestamp;
1911
+ context: ContextStatus;
1912
+ plugins: HarnessEntry[];
1913
+ skills: HarnessEntry[];
1914
+ mcp: HarnessMcpServer[];
1915
+ subagents: HarnessSubagents;
1916
+ workflows: HarnessWorkflows | null;
1917
+ };
1918
+ /** The sections of the status that changed; each present one replaces that section whole. */
1919
+ type HarnessStatusUpdate = Partial<Pick<HarnessStatus, "context" | "plugins" | "skills" | "mcp" | "subagents">> & {
1920
+ workflows?: HarnessWorkflows;
1921
+ };
1922
+ type EventBody = {
1923
+ type: "message";
1924
+ message: StoredMessage;
1925
+ } | {
1926
+ type: "turn.started";
1927
+ turn: TurnStarted;
1928
+ } | {
1929
+ type: "turn.ended";
1930
+ turn: TurnEnded;
1931
+ } | {
1932
+ type: "stop.requested";
1933
+ } | {
1934
+ type: "agent.unavailable";
1935
+ agent: AgentUnavailable;
1936
+ } | {
1937
+ type: "agent.available";
1938
+ } | {
1939
+ type: "daemon.outdated";
1940
+ daemon: DaemonOutdated;
1941
+ } | {
1942
+ type: "config.applied";
1943
+ config: ConfigApplied;
1944
+ } | {
1945
+ type: "session.status";
1946
+ status: HarnessStatus;
1947
+ } | {
1948
+ type: "outbox.queued";
1949
+ outbox: OutboxQueued;
1950
+ } | {
1951
+ type: "outbox.delivered";
1952
+ outbox: OutboxDelivered;
1953
+ } | {
1954
+ type: "outbox.failed";
1955
+ outbox: OutboxFailed;
1956
+ };
1957
+ type EventType = EventBody["type"];
1958
+ type Event = EventEnvelope & EventBody;
1959
+ type EventPage = {
1960
+ data: Event[];
1961
+ hasMore: boolean;
1962
+ };
1963
+ /** A streaming message in the envelope of an event, without seq (004#streaming-messages). */
1964
+ type StreamingMessageEvent = Omit<EventEnvelope, "seq"> & {
1965
+ sessionId: string;
1966
+ turnId: string;
1967
+ type: "message";
1968
+ message: StreamingMessage;
1969
+ };
1970
+ /** A live change of the harness's status, in the envelope without seq (012#events); never stored. */
1971
+ type StatusUpdateEvent = Omit<EventEnvelope, "seq"> & {
1972
+ sessionId: string;
1973
+ turnId: null;
1974
+ type: "status.update";
1975
+ update: HarnessStatusUpdate;
1976
+ };
1977
+ /** One event of a session's stream as the SDK yields it (009#sse-schema). */
1978
+ type StreamEvent = {
1979
+ event: "session";
1980
+ data: Session;
1981
+ } | {
1982
+ event: "message";
1983
+ data: Event | StreamingMessageEvent;
1984
+ id?: string;
1985
+ } | {
1986
+ event: "status.update";
1987
+ data: StatusUpdateEvent;
1988
+ } | {
1989
+ [T in EventType]: {
1990
+ event: T;
1991
+ data: Event & {
1992
+ type: T;
1993
+ };
1994
+ id: string;
1995
+ };
1996
+ }[Exclude<EventType, "message">] | {
1997
+ event: "error";
1998
+ data: ErrorBody;
1999
+ };
2000
+ /** Reports whether kind is a message kind this SDK knows. */
2001
+ declare function isKnownMessageKind(kind: string): kind is MessageKind;
2002
+ /** Reports whether a streamed message event is a live streaming message. */
2003
+ declare function isStreamingMessageEvent(data: Event | StreamingMessageEvent): data is StreamingMessageEvent;
2004
+
2005
+ /** A non-2xx response, or an error event that ended a stream (002#errors). */
2006
+ declare class PaddockError extends Error {
2007
+ readonly status: number;
2008
+ readonly code: ErrorCode;
2009
+ readonly details: Record<string, unknown> | undefined;
2010
+ readonly requestId: string | null;
2011
+ constructor(init: {
2012
+ status: number;
2013
+ code: ErrorCode;
2014
+ message: string;
2015
+ details?: Record<string, unknown> | undefined;
2016
+ requestId?: string | null;
2017
+ });
2018
+ static is(e: unknown): e is PaddockError;
2019
+ }
2020
+ /** No response arrived: the connection failed or was dropped. */
2021
+ declare class PaddockConnectionError extends Error {
2022
+ constructor(message: string, options?: {
2023
+ cause?: unknown;
2024
+ });
2025
+ static is(e: unknown): e is PaddockConnectionError;
2026
+ }
2027
+ /** No response arrived in time. */
2028
+ declare class PaddockTimeoutError extends PaddockConnectionError {
2029
+ constructor(message: string, options?: {
2030
+ cause?: unknown;
2031
+ });
2032
+ static is(e: unknown): e is PaddockTimeoutError;
2033
+ }
2034
+
2035
+ type Method = "GET" | "POST" | "PUT" | "DELETE";
2036
+ type QueryValue = string | number | boolean | string[] | Record<string, string> | undefined;
2037
+ type TransportOptions = {
2038
+ baseUrl?: string | undefined;
2039
+ /** The API key or session token. */
2040
+ token: string;
2041
+ /** The Paddock-Client header: sdk/version. */
2042
+ client: string;
2043
+ maxRetries?: number | undefined;
2044
+ timeoutMs?: number | undefined;
2045
+ fetch?: typeof fetch | undefined;
2046
+ /** Waits between attempts; replaced in tests. */
2047
+ sleep?: ((ms: number, signal?: AbortSignal) => Promise<void>) | undefined;
2048
+ };
2049
+ type RequestOptions = {
2050
+ method: Method;
2051
+ path: string;
2052
+ query?: Record<string, QueryValue> | undefined;
2053
+ /** A JSON body. */
2054
+ json?: unknown;
2055
+ /** A raw body with its content type. */
2056
+ body?: BodyInit | undefined;
2057
+ contentType?: string | undefined;
2058
+ /** How to read a 2xx body. */
2059
+ read?: "json" | "text" | "bytes" | "none";
2060
+ timeoutMs?: number | undefined;
2061
+ signal?: AbortSignal | undefined;
2062
+ };
2063
+ declare class Transport {
2064
+ #private;
2065
+ readonly baseUrl: string;
2066
+ readonly maxRetries: number;
2067
+ readonly timeoutMs: number;
2068
+ private readonly client;
2069
+ private readonly fetchFn;
2070
+ private readonly sleepFn;
2071
+ constructor(options: TransportOptions);
2072
+ /** The URL of path with its query; arrays are comma-joined, objects are deepObject. */
2073
+ url(path: string, query?: Record<string, QueryValue>): string;
2074
+ /** The headers every request carries; the token travels only in Authorization. */
2075
+ headers(extra?: Record<string, string>): Record<string, string>;
2076
+ get fetch(): typeof fetch;
2077
+ wait(ms: number, signal?: AbortSignal): Promise<void>;
2078
+ /** Sends one request, retrying an idempotent one after a connection error, a timeout, or a 5xx. */
2079
+ request<T>(options: RequestOptions): Promise<T>;
2080
+ }
2081
+
2082
+ type ConnectionState = "connecting" | "open" | "reconnecting" | "closed";
2083
+ type StreamOptions = {
2084
+ /** Yield only events with a greater seq; omitted, every event of the session. */
2085
+ after?: number | undefined;
2086
+ /** Called on every change of the connection's state; closed carries its error, if any. */
2087
+ onConnection?: ((state: ConnectionState, error: Error | null) => void) | undefined;
2088
+ };
2089
+ /** The stream's timing (009#stream-reconnection); replaced in tests. */
2090
+ type StreamTiming = {
2091
+ connectTimeoutMs: number;
2092
+ livenessMs: number;
2093
+ backoffBaseMs: number;
2094
+ backoffCapMs: number;
2095
+ /** How long a connection stays open before the backoff resets. */
2096
+ stableMs: number;
2097
+ };
2098
+ /** A session's stream: an async iterable of events that reconnects on its own until closed. */
2099
+ declare class EventStream implements AsyncIterable<StreamEvent> {
2100
+ private readonly transport;
2101
+ private readonly path;
2102
+ private readonly options;
2103
+ private readonly timing;
2104
+ private readonly closer;
2105
+ private readonly events;
2106
+ private highest;
2107
+ private state;
2108
+ private terminal;
2109
+ constructor(transport: Transport, path: string, options?: StreamOptions, timing?: StreamTiming);
2110
+ /** The highest seq the stream has yielded, or the after it started from. */
2111
+ get lastSeq(): number;
2112
+ [Symbol.asyncIterator](): AsyncGenerator<StreamEvent>;
2113
+ /** Ends the stream; a pending next() resolves as done. */
2114
+ close(): void;
2115
+ private setState;
2116
+ private fail;
2117
+ private run;
2118
+ }
2119
+
2120
+ /**
2121
+ * A list of 002#lists: awaiting it gives the first page; for await iterates every item
2122
+ * of every page, following nextCursor (009#naming).
2123
+ */
2124
+ declare class PageList<T> implements PromiseLike<Page<T>>, AsyncIterable<T> {
2125
+ private readonly fetchPage;
2126
+ private first;
2127
+ constructor(fetchPage: (cursor: string | undefined) => Promise<Page<T>>);
2128
+ private firstPage;
2129
+ then<R1 = Page<T>, R2 = never>(onfulfilled?: ((value: Page<T>) => R1 | PromiseLike<R1>) | null, onrejected?: ((reason: unknown) => R2 | PromiseLike<R2>) | null): Promise<R1 | R2>;
2130
+ [Symbol.asyncIterator](): AsyncIterator<T>;
2131
+ }
2132
+
2133
+ type EventListOptions = {
2134
+ after?: number;
2135
+ before?: number;
2136
+ types?: (EventType | (string & {}))[];
2137
+ limit?: number;
2138
+ };
2139
+ type PageOptions = {
2140
+ limit?: number;
2141
+ cursor?: string;
2142
+ };
2143
+ declare class SessionOperations {
2144
+ protected readonly transport: Transport;
2145
+ readonly id: string;
2146
+ readonly events: {
2147
+ list(options?: EventListOptions): Promise<EventPage>;
2148
+ };
2149
+ readonly turns: {
2150
+ list(options?: PageOptions): PageList<Turn>;
2151
+ get(turnId: string): Promise<Turn>;
2152
+ };
2153
+ constructor(transport: Transport, id: string);
2154
+ private get base();
2155
+ /** Stores a user message; resolves with its event once stored (002#operations_2). */
2156
+ send(text: string): Promise<Event>;
2157
+ /** Stores a stop.requested event and resolves with it. */
2158
+ stop(): Promise<Event>;
2159
+ /** The session's events from after, then live events, reconnecting on its own (009#stream-reconnection). */
2160
+ stream(options?: StreamOptions): EventStream;
2161
+ /** Mints a session token for the browser. */
2162
+ createToken(options: {
2163
+ ttl: number;
2164
+ }): Promise<SessionToken>;
2165
+ /** Reads the session. */
2166
+ get(): Promise<Session>;
2167
+ }
2168
+
2169
+ /** A timeline entry: a message with the position of the event that holds it. */
2170
+ type ClientMessage = Message & {
2171
+ /** null while kind is "streaming" */
2172
+ seq: number | null;
2173
+ turnId: string | null;
2174
+ createdAt: string;
2175
+ };
2176
+ type SessionState = {
2177
+ /** Stored messages in seq order, then the messages being generated. */
2178
+ messages: ClientMessage[];
2179
+ status: SessionStatus;
2180
+ /** The running turn, if any. */
2181
+ turn: Turn | null;
2182
+ /** The session's lastError. */
2183
+ error: TurnError | null;
2184
+ /** User messages above it are waiting. */
2185
+ processedSeq: number;
2186
+ /** Waiting messages at or below it are held. */
2187
+ heldSeq: number;
2188
+ /** The latest session snapshot; null until the first arrives. */
2189
+ session: Session | null;
2190
+ connection: ConnectionState;
2191
+ /** The error that closed the connection, if one did. */
2192
+ connectionError: Error | null;
2193
+ /** Every stored event received, once each, in seq order. */
2194
+ events: Event[];
2195
+ /**
2196
+ * The latest status of the session's harness (012#client-state): the newest
2197
+ * session.status with every later status.update applied by section; null until the
2198
+ * first session.status.
2199
+ */
2200
+ harnessStatus: HarnessStatus | null;
2201
+ };
2202
+ declare const initialState: SessionState;
2203
+ /**
2204
+ * Folds a session's events, streaming messages, and snapshots into SessionState. Each
2205
+ * call that changes the state replaces the state object, so a reference comparison
2206
+ * tells whether anything changed.
2207
+ */
2208
+ declare class SessionFold {
2209
+ state: SessionState;
2210
+ /** The highest seq folded. */
2211
+ lastSeq: number;
2212
+ private readonly seqs;
2213
+ private readonly endedTurns;
2214
+ private statusSeq;
2215
+ /** Folds a stored event; an event whose seq is already held is ignored. */
2216
+ event(ev: Event): void;
2217
+ /** Folds a streaming message: it adds or replaces the entry of its id. */
2218
+ streaming(ev: StreamingMessageEvent): void;
2219
+ /**
2220
+ * Folds a live status update: each section it carries replaces that section of the
2221
+ * latest status. Before the first session.status there is nothing to apply it to,
2222
+ * and the snapshot that follows carries every section.
2223
+ */
2224
+ statusUpdate(ev: StatusUpdateEvent): void;
2225
+ /** Folds a session snapshot. */
2226
+ session(session: Session): void;
2227
+ connection(connection: ConnectionState, connectionError: Error | null): void;
2228
+ private set;
2229
+ }
2230
+
2231
+ type PaddockClientOptions = {
2232
+ /** The session token, sent only in the Authorization header. */
2233
+ token: string;
2234
+ /** Default https://api.paddockai.dev/v1. */
2235
+ baseUrl?: string;
2236
+ maxRetries?: number;
2237
+ timeoutMs?: number;
2238
+ fetch?: typeof fetch;
2239
+ };
2240
+ declare class PaddockClient {
2241
+ private readonly transport;
2242
+ private readonly handles;
2243
+ constructor(options: PaddockClientOptions);
2244
+ /** The handle of a session; one per ID. */
2245
+ session(sessionId: string): SessionHandle;
2246
+ }
2247
+ type Listener = (state: SessionState) => void;
2248
+ /**
2249
+ * A session's live state. The first subscriber loads the session and its events and
2250
+ * opens the stream; the last one to leave closes it, keeping the state.
2251
+ */
2252
+ declare class SessionHandle extends SessionOperations {
2253
+ private readonly fold;
2254
+ private readonly listeners;
2255
+ private current;
2256
+ private loaded;
2257
+ private resumeSeq;
2258
+ private run;
2259
+ /** The current state; replaced, never mutated, on every change. */
2260
+ get state(): SessionState;
2261
+ subscribe(listener: Listener): () => void;
2262
+ /** Sends a message; resolves with its stored event, already folded into the state. */
2263
+ send(text: string): Promise<Event>;
2264
+ /** Stops the running turn; resolves with the stored stop.requested event. */
2265
+ stop(): Promise<Event>;
2266
+ /** Closes the stream; the state stays and a new subscriber resumes it. */
2267
+ close(): void;
2268
+ private apply;
2269
+ private start;
2270
+ private load;
2271
+ }
2272
+
2273
+ declare const version = "0.0.2";
2274
+
2275
+ export { EventStream, PaddockClient, PaddockConnectionError, PaddockError, PaddockTimeoutError, PageList, SessionFold, SessionHandle, initialState, isKnownMessageKind, isStreamingMessageEvent, version };
2276
+ export type { ClientMessage, ConnectionState, ContextCategory, ContextItem, ContextStatus, ErrorCode, Event, EventListOptions, EventPage, EventType, Harness, HarnessEntry, HarnessMcpServer, HarnessStatus, HarnessStatusUpdate, Message, MessageKind, PaddockClientOptions, Page, PageOptions, RunState, Session, SessionState, SessionStatus, StatusUpdateEvent, StoredMessage, StreamEvent, StreamOptions, StreamingMessage, StreamingMessageEvent, SubagentRun, TimingPhase, TimingPhaseKind, ToolCall, ToolInput, ToolName, ToolOutput, ToolResult, Turn, TurnEnded, TurnError, TurnErrorCode, TurnOrigin, TurnStarted, TurnStatus, TurnTiming, WorkflowRun };