@ellipsis-dev/sdk 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.
@@ -0,0 +1,1192 @@
1
+ interface paths {
2
+ '/v1/sessions/{session_id}': {
3
+ parameters: {
4
+ query?: never;
5
+ header?: never;
6
+ path?: never;
7
+ cookie?: never;
8
+ };
9
+ /** Get Agent Session */
10
+ get: operations['get_agent_session_v1_sessions__session_id__get'];
11
+ put?: never;
12
+ post?: never;
13
+ delete?: never;
14
+ options?: never;
15
+ head?: never;
16
+ patch?: never;
17
+ trace?: never;
18
+ };
19
+ '/v1/sessions/{session_id}/messages': {
20
+ parameters: {
21
+ query?: never;
22
+ header?: never;
23
+ path?: never;
24
+ cookie?: never;
25
+ };
26
+ get?: never;
27
+ put?: never;
28
+ /** Send Agent Session Message */
29
+ post: operations['send_agent_session_message_v1_sessions__session_id__messages_post'];
30
+ delete?: never;
31
+ options?: never;
32
+ head?: never;
33
+ patch?: never;
34
+ trace?: never;
35
+ };
36
+ '/v1/sessions/{session_id}/records': {
37
+ parameters: {
38
+ query?: never;
39
+ header?: never;
40
+ path?: never;
41
+ cookie?: never;
42
+ };
43
+ /** Get Agent Session Records */
44
+ get: operations['get_agent_session_records_v1_sessions__session_id__records_get'];
45
+ put?: never;
46
+ post?: never;
47
+ delete?: never;
48
+ options?: never;
49
+ head?: never;
50
+ patch?: never;
51
+ trace?: never;
52
+ };
53
+ '/v1/sessions/{session_id}/turns': {
54
+ parameters: {
55
+ query?: never;
56
+ header?: never;
57
+ path?: never;
58
+ cookie?: never;
59
+ };
60
+ /** Get Agent Session Turns */
61
+ get: operations['get_agent_session_turns_v1_sessions__session_id__turns_get'];
62
+ put?: never;
63
+ post?: never;
64
+ delete?: never;
65
+ options?: never;
66
+ head?: never;
67
+ patch?: never;
68
+ trace?: never;
69
+ };
70
+ }
71
+ interface components {
72
+ schemas: {
73
+ /**
74
+ * AgentSessionExitStatus
75
+ * @description Why a terminal agent session ended — a finer-grained reason than `status`.
76
+ *
77
+ * `status` (AgentSessionStatus) is the lifecycle state: COMPLETED / ERROR /
78
+ * CANCELLED. `exit_status` explains *why* a run reached that terminal state, so
79
+ * the UI and metrics can tell a budget cutoff apart from a crashed tool call or
80
+ * a deliberate cancellation. It is None until the run reaches a terminal state.
81
+ * @enum {string}
82
+ */
83
+ AgentSessionExitStatus: 'completed' | 'budget_hit' | 'payment_required' | 'tool_call_failed' | 'lifecycle_hook_failed' | 'missing_repo_access' | 'missing_token_permissions' | 'cancelled' | 'interrupted' | 'error' | 'stopped';
84
+ /**
85
+ * AgentSessionPr
86
+ * @description A pull request this session created, denormalized at capture time so
87
+ * session surfaces render a labeled link without joining gh_prs. Live PR
88
+ * state (open/merged/closed) is not stored here — read it from gh_prs where
89
+ * a view needs it.
90
+ */
91
+ AgentSessionPr: {
92
+ /** Gh Pr Id */
93
+ gh_pr_id?: number | null;
94
+ /** Number */
95
+ number: number;
96
+ /** Repo Full Name */
97
+ repo_full_name: string;
98
+ /** Title */
99
+ title?: string | null;
100
+ /** Url */
101
+ url: string;
102
+ };
103
+ /**
104
+ * AgentSessionSource
105
+ * @enum {string}
106
+ */
107
+ AgentSessionSource: 'react' | 'manual' | 'api' | 'cli' | 'mention' | 'cron' | 'laptop';
108
+ /**
109
+ * AgentSessionStatus
110
+ * @enum {string}
111
+ */
112
+ AgentSessionStatus: 'scheduled' | 'creating_sandbox' | 'running' | 'retrying' | 'completed' | 'error' | 'cancelled' | 'stopped';
113
+ /** AgentSessionWire */
114
+ AgentSessionWire: {
115
+ /** Agent Config Id */
116
+ agent_config_id?: string | null;
117
+ attributed_user?: components['schemas']['GithubAccountSnippet'] | null;
118
+ /** Attribution Id */
119
+ attribution_id?: string | null;
120
+ attribution_type?: components['schemas']['AttributionType'] | null;
121
+ /** Client Version */
122
+ client_version?: string | null;
123
+ /** Config Override */
124
+ config_override?: {
125
+ [key: string]: unknown;
126
+ } | null;
127
+ /** Context Repository */
128
+ context_repository?: string | null;
129
+ /**
130
+ * Cost Fee
131
+ * @default 0
132
+ */
133
+ cost_fee: number;
134
+ /**
135
+ * Cost Sandbox Cpu
136
+ * @default 0
137
+ */
138
+ cost_sandbox_cpu: number;
139
+ /**
140
+ * Cost Sandbox Memory
141
+ * @default 0
142
+ */
143
+ cost_sandbox_memory: number;
144
+ /** Cost Tokens */
145
+ cost_tokens: number;
146
+ /**
147
+ * Created At
148
+ * Format: date-time
149
+ */
150
+ created_at: string;
151
+ /** Customer Id */
152
+ customer_id: string;
153
+ default_resolution?: components['schemas']['DefaultResolution'] | null;
154
+ exit_status?: components['schemas']['AgentSessionExitStatus'] | null;
155
+ harness: components['schemas']['Harness'];
156
+ /** Id */
157
+ id: string;
158
+ /** Last Activity At */
159
+ last_activity_at?: string | null;
160
+ /** Last Message At */
161
+ last_message_at?: string | null;
162
+ /** Live Summary */
163
+ live_summary?: string | null;
164
+ /**
165
+ * Metadata
166
+ * @default {}
167
+ */
168
+ metadata: {
169
+ [key: string]: string;
170
+ };
171
+ /** Output Prs */
172
+ output_prs?: components['schemas']['AgentSessionPr'][] | null;
173
+ /** Parent Agent Session Id */
174
+ parent_agent_session_id?: string | null;
175
+ parent_kind?: components['schemas']['ParentKind'] | null;
176
+ /** Prompt */
177
+ prompt?: string | null;
178
+ /** Replayed From Session Id */
179
+ replayed_from_session_id?: string | null;
180
+ /** Resolved Budget Cents */
181
+ resolved_budget_cents: number;
182
+ resolved_budget_source: components['schemas']['BudgetSource'];
183
+ /** Sandbox Id */
184
+ sandbox_id?: string | null;
185
+ /** Session Key */
186
+ session_key?: string | null;
187
+ session_state?: components['schemas']['SessionState'] | null;
188
+ source: components['schemas']['AgentSessionSource'];
189
+ status: components['schemas']['AgentSessionStatus'];
190
+ /** Status Reason */
191
+ status_reason?: string | null;
192
+ /** Stopped At */
193
+ stopped_at?: string | null;
194
+ /** Stopped By */
195
+ stopped_by?: number | null;
196
+ stopped_by_user?: components['schemas']['GithubAccountSnippet'] | null;
197
+ surface?: components['schemas']['SessionSurface'] | null;
198
+ /**
199
+ * Tokens Cache Creation
200
+ * @default 0
201
+ */
202
+ tokens_cache_creation: number;
203
+ /**
204
+ * Tokens Cache Read
205
+ * @default 0
206
+ */
207
+ tokens_cache_read: number;
208
+ /**
209
+ * Tokens Input
210
+ * @default 0
211
+ */
212
+ tokens_input: number;
213
+ /** Tokens Model */
214
+ tokens_model: string;
215
+ /**
216
+ * Tokens Output
217
+ * @default 0
218
+ */
219
+ tokens_output: number;
220
+ /**
221
+ * Tokens Total
222
+ * @default 0
223
+ */
224
+ tokens_total: number;
225
+ /**
226
+ * Updated At
227
+ * Format: date-time
228
+ */
229
+ updated_at: string;
230
+ /** Webhook Id */
231
+ webhook_id?: string | null;
232
+ webhook_type?: components['schemas']['WebhookType'] | null;
233
+ };
234
+ /**
235
+ * AgentTurn
236
+ * @description One exchange within a session: a single Claude Code execution driven by the
237
+ * session's inbox. Over subsequent slices this absorbs the per-execution fields
238
+ * (status, cost, tokens, exit_status) that currently live on agent_sessions.
239
+ */
240
+ AgentTurn: {
241
+ /** Agent Session Id */
242
+ agent_session_id: string;
243
+ /** Completed At */
244
+ completed_at?: string | null;
245
+ /**
246
+ * Cost Fee
247
+ * @default 0
248
+ */
249
+ cost_fee: number;
250
+ /**
251
+ * Cost Sandbox Cpu
252
+ * @default 0
253
+ */
254
+ cost_sandbox_cpu: number;
255
+ /**
256
+ * Cost Sandbox Memory
257
+ * @default 0
258
+ */
259
+ cost_sandbox_memory: number;
260
+ /**
261
+ * Cost Tokens
262
+ * @default 0
263
+ */
264
+ cost_tokens: number;
265
+ /**
266
+ * Created At
267
+ * Format: date-time
268
+ */
269
+ created_at: string;
270
+ exit_status?: components['schemas']['AgentSessionExitStatus'] | null;
271
+ /** Id */
272
+ id: string;
273
+ /** React Action */
274
+ react_action?: string | null;
275
+ /** Sandbox Id */
276
+ sandbox_id?: string | null;
277
+ /** Session Execution Id */
278
+ session_execution_id?: string | null;
279
+ /** Started At */
280
+ started_at?: string | null;
281
+ status: components['schemas']['AgentTurnStatus'];
282
+ /** Status Reason */
283
+ status_reason?: string | null;
284
+ /**
285
+ * Tokens Cache Creation
286
+ * @default 0
287
+ */
288
+ tokens_cache_creation: number;
289
+ /**
290
+ * Tokens Cache Read
291
+ * @default 0
292
+ */
293
+ tokens_cache_read: number;
294
+ /**
295
+ * Tokens Input
296
+ * @default 0
297
+ */
298
+ tokens_input: number;
299
+ /** Tokens Model */
300
+ tokens_model?: string | null;
301
+ /**
302
+ * Tokens Output
303
+ * @default 0
304
+ */
305
+ tokens_output: number;
306
+ /**
307
+ * Tokens Total
308
+ * @default 0
309
+ */
310
+ tokens_total: number;
311
+ /** Turn Index */
312
+ turn_index: number;
313
+ /**
314
+ * Updated At
315
+ * Format: date-time
316
+ */
317
+ updated_at: string;
318
+ /** Webhook Id */
319
+ webhook_id?: string | null;
320
+ webhook_type?: components['schemas']['WebhookType'] | null;
321
+ };
322
+ /**
323
+ * AgentTurnStatus
324
+ * @enum {string}
325
+ */
326
+ AgentTurnStatus: 'scheduled' | 'running' | 'completed' | 'error' | 'cancelled';
327
+ /**
328
+ * AttributionType
329
+ * @enum {string}
330
+ */
331
+ AttributionType: 'github_user' | 'linear_user' | 'slack_user' | 'api_key';
332
+ /**
333
+ * BudgetSource
334
+ * @description Which layer actually determined the enforced budget.
335
+ *
336
+ * Not derivable from the run row alone (the run does not store the config
337
+ * cents or the customer default), so we persist it for the UI / audit.
338
+ * @enum {string}
339
+ */
340
+ BudgetSource: 'system' | 'account' | 'config' | 'run';
341
+ /**
342
+ * DefaultResolution
343
+ * @description How a session that arrived with no explicit config source resolved its
344
+ * config (documents/eng/DEFAULT_CONFIGS.md §4). Persisted on the session so
345
+ * audit and clients can say "ran under X (repo default)". A session started
346
+ * with an explicit config/config_id/template_id never enters resolution and
347
+ * stores None.
348
+ * @enum {string}
349
+ */
350
+ DefaultResolution: 'repo_default' | 'account_default' | 'none';
351
+ /**
352
+ * GithubAccountSnippet
353
+ * @description Sometimes the GitHub API returns a user of github (can include bots)
354
+ * using this snippet instead of the full GithubAccount model. One example,
355
+ * is when the API returns a pull request.
356
+ *
357
+ * This is the least amount of info we need to represent a GitHub account.
358
+ */
359
+ GithubAccountSnippet: {
360
+ /** Avatar Url */
361
+ avatar_url: string;
362
+ /** Id */
363
+ id: number;
364
+ /** Login */
365
+ login: string;
366
+ type: components['schemas']['GithubAccountType'];
367
+ };
368
+ /**
369
+ * GithubAccountType
370
+ * @enum {string}
371
+ */
372
+ GithubAccountType: 'User' | 'Organization' | 'Bot' | 'Mannequin';
373
+ /** HTTPValidationError */
374
+ HTTPValidationError: {
375
+ /** Detail */
376
+ detail?: components['schemas']['ValidationError'][];
377
+ };
378
+ /**
379
+ * Harness
380
+ * @enum {string}
381
+ */
382
+ Harness: 'claude_code';
383
+ /** ListSessionRecordsResponse */
384
+ ListSessionRecordsResponse: {
385
+ /** Earliest Feed Seq */
386
+ earliest_feed_seq?: number | null;
387
+ /**
388
+ * Has More
389
+ * @default false
390
+ */
391
+ has_more: boolean;
392
+ /**
393
+ * Messages
394
+ * @default []
395
+ */
396
+ messages: components['schemas']['SessionMessageWire'][];
397
+ /** Records */
398
+ records: components['schemas']['SessionRecordWire'][];
399
+ };
400
+ /** ListSessionTurnsResponse */
401
+ ListSessionTurnsResponse: {
402
+ /** Messages */
403
+ messages: components['schemas']['SessionMessage'][];
404
+ /** Turns */
405
+ turns: components['schemas']['AgentTurn'][];
406
+ };
407
+ /** ModelTokensInfo */
408
+ ModelTokensInfo: {
409
+ /**
410
+ * Cache Creation Input Tokens
411
+ * @default 0
412
+ */
413
+ cache_creation_input_tokens: number;
414
+ /**
415
+ * Cache Read Input Tokens
416
+ * @default 0
417
+ */
418
+ cache_read_input_tokens: number;
419
+ /**
420
+ * Cost Usd
421
+ * @default 0
422
+ */
423
+ cost_usd: number;
424
+ /**
425
+ * Input Tokens
426
+ * @default 0
427
+ */
428
+ input_tokens: number;
429
+ /**
430
+ * Output Tokens
431
+ * @default 0
432
+ */
433
+ output_tokens: number;
434
+ };
435
+ /**
436
+ * ParentKind
437
+ * @description How a session relates to its predecessor (parent_agent_session_id) —
438
+ * the ONE "preceded-by" chain for every predecessor relationship. Routing
439
+ * reads this when the distinction matters.
440
+ *
441
+ * CONTINUATION — a follow-up in the same conversation surface (e.g. a Slack
442
+ * thread reply spawning a fresh session on the same thread).
443
+ * HANDOFF — a session started to take over work from another surface (e.g.
444
+ * laptop → cloud handoff; later phase).
445
+ * RESUME — a conversation re-hosted on a new box after its sandbox was torn
446
+ * down (interactive platform; later phase).
447
+ * @enum {string}
448
+ */
449
+ ParentKind: 'continuation' | 'handoff' | 'resume';
450
+ /**
451
+ * RecordSource
452
+ * @description `session_records.source` — the client render switch. `lifecycle` rows are
453
+ * controller-emitted platform notifications; a harness value means a native
454
+ * transcript record from that harness.
455
+ * @enum {string}
456
+ */
457
+ RecordSource: 'lifecycle' | 'claude_code';
458
+ /**
459
+ * RunStatus
460
+ * @description What the current (or most recent) execution is doing (backs `run`).
461
+ * @enum {string}
462
+ */
463
+ RunStatus: 'scheduled' | 'starting' | 'working' | 'waiting' | 'done' | 'failed' | 'stopped' | 'cancelled' | 'retrying';
464
+ /**
465
+ * SendSessionMessageRequest
466
+ * @description A human message posted into a durable (keyed) session's conversation
467
+ * (documents/eng/SESSION_IDE.md). Delivered to the live Claude Code process
468
+ * at the next turn boundary, or wakes the session when idle. This is what
469
+ * the `agent` CLI's connect composer calls — including from inside the
470
+ * session's own sandbox, where the sandbox token inherits the session's
471
+ * attribution.
472
+ */
473
+ SendSessionMessageRequest: {
474
+ /** Idempotency Key */
475
+ idempotency_key?: string | null;
476
+ /** Message */
477
+ message: string;
478
+ };
479
+ /**
480
+ * SessionLiveness
481
+ * @description The durable conversation axis (backs the surfaced `session` field).
482
+ * @enum {string}
483
+ */
484
+ SessionLiveness: 'alive' | 'sleeping' | 'closed';
485
+ /**
486
+ * SessionMessage
487
+ * @description One entry in a session's inbox: an event, rendered into a user message,
488
+ * waiting to be consumed by a turn. body is the RENDERED text (pointers to
489
+ * code/events, never embedded diffs), so a turn's initial query is built from
490
+ * the pending messages without re-fetching the trigger.
491
+ */
492
+ SessionMessage: {
493
+ /** Agent Session Id */
494
+ agent_session_id: string;
495
+ /** Author */
496
+ author?: string | null;
497
+ /** Body */
498
+ body: string;
499
+ /**
500
+ * Closes Session
501
+ * @default false
502
+ */
503
+ closes_session: boolean;
504
+ /**
505
+ * Created At
506
+ * Format: date-time
507
+ */
508
+ created_at: string;
509
+ /** Delivered At */
510
+ delivered_at?: string | null;
511
+ /** Delivered Turn Id */
512
+ delivered_turn_id?: string | null;
513
+ /** Feed Seq */
514
+ feed_seq?: number | null;
515
+ /** Id */
516
+ id: string;
517
+ /** Idempotency Key */
518
+ idempotency_key?: string | null;
519
+ /** Platform Ts */
520
+ platform_ts?: string | null;
521
+ /** Sender Attribution Id */
522
+ sender_attribution_id?: string | null;
523
+ sender_attribution_type?: components['schemas']['AttributionType'] | null;
524
+ status: components['schemas']['SessionMessageStatus'];
525
+ /** Webhook Id */
526
+ webhook_id?: string | null;
527
+ webhook_type?: components['schemas']['WebhookType'] | null;
528
+ };
529
+ /**
530
+ * SessionMessageStatus
531
+ * @enum {string}
532
+ */
533
+ SessionMessageStatus: 'pending' | 'delivered';
534
+ /**
535
+ * SessionMessageWire
536
+ * @description The wire shape of one inbox message (§3.3): what a queued chip renders
537
+ * and retires on. `author` is the message's attribution string; the webhook
538
+ * provenance internals stay off the wire.
539
+ */
540
+ SessionMessageWire: {
541
+ /** Agent Session Id */
542
+ agent_session_id: string;
543
+ /** Author */
544
+ author?: string | null;
545
+ /** Body */
546
+ body: string;
547
+ /**
548
+ * Created At
549
+ * Format: date-time
550
+ */
551
+ created_at: string;
552
+ /** Delivered At */
553
+ delivered_at?: string | null;
554
+ /** Delivered Turn Id */
555
+ delivered_turn_id?: string | null;
556
+ /** Feed Seq */
557
+ feed_seq?: number | null;
558
+ /** Id */
559
+ id: string;
560
+ /** Sender Attribution Id */
561
+ sender_attribution_id?: string | null;
562
+ sender_attribution_type?: components['schemas']['AttributionType'] | null;
563
+ status: components['schemas']['SessionMessageStatus'];
564
+ };
565
+ /**
566
+ * SessionRecordWire
567
+ * @description The wire shape of one session record (§3.3): the §3.6 stable envelope +
568
+ * the native `payload`, by explicit allowlist. Internal-only columns
569
+ * (`search_text`, `clis`, ingest bookkeeping, attribution denormalizations)
570
+ * are deliberately absent so internal model evolution stays free.
571
+ */
572
+ SessionRecordWire: {
573
+ /** Agent Session Id */
574
+ agent_session_id: string;
575
+ /** Agent Turn Id */
576
+ agent_turn_id?: string | null;
577
+ /** Cost */
578
+ cost?: number | null;
579
+ /**
580
+ * Created At
581
+ * Format: date-time
582
+ */
583
+ created_at: string;
584
+ /** Duration */
585
+ duration?: number | null;
586
+ /** Feed Seq */
587
+ feed_seq: number;
588
+ /** Id */
589
+ id: string;
590
+ /** Model */
591
+ model?: string | null;
592
+ /** Payload */
593
+ payload: {
594
+ [key: string]: unknown;
595
+ };
596
+ /** Record Format */
597
+ record_format: string;
598
+ /** Record Type */
599
+ record_type: string;
600
+ /** Session Message Id */
601
+ session_message_id?: string | null;
602
+ source: components['schemas']['RecordSource'];
603
+ /** Stream Seq */
604
+ stream_seq: number;
605
+ tokens_info?: components['schemas']['TokensInfo'] | null;
606
+ /** Tools */
607
+ tools?: string[] | null;
608
+ };
609
+ /**
610
+ * SessionState
611
+ * @description Lifecycle of a keyed (multi-turn) session — the durable conversation.
612
+ * Distinct from AgentSessionStatus, which is per-execution (one turn's run) and
613
+ * moves to agent_turns in a later slice. IDLE: alive, waiting for the next
614
+ * message. RUNNING: a turn is executing. CLOSED: the conversation is done and
615
+ * its sandbox/snapshots are torn down.
616
+ * @enum {string}
617
+ */
618
+ SessionState: 'idle' | 'running' | 'closed';
619
+ /**
620
+ * SessionSurface
621
+ * @description The three fields we expose. All `None` for an un-keyed (laptop) session.
622
+ *
623
+ * `use_enum_values=True` (from CustomBaseModel) stores the members as their
624
+ * string values, so this serializes to `{"session": "alive", "run": "waiting",
625
+ * "status": "waiting"}` — a plain object, not enum names.
626
+ */
627
+ SessionSurface: {
628
+ run: components['schemas']['RunStatus'] | null;
629
+ session: components['schemas']['SessionLiveness'] | null;
630
+ /** Status */
631
+ status: string | null;
632
+ };
633
+ /** TokensInfo */
634
+ TokensInfo: {
635
+ /**
636
+ * Cache Creation Input Tokens
637
+ * @default 0
638
+ */
639
+ cache_creation_input_tokens: number;
640
+ /**
641
+ * Cache Read Input Tokens
642
+ * @default 0
643
+ */
644
+ cache_read_input_tokens: number;
645
+ /**
646
+ * Cost Usd
647
+ * @default 0
648
+ */
649
+ cost_usd: number;
650
+ /**
651
+ * Initial System Prompt Tokens
652
+ * @default 0
653
+ */
654
+ initial_system_prompt_tokens: number;
655
+ /**
656
+ * Input Tokens
657
+ * @default 0
658
+ */
659
+ input_tokens: number;
660
+ /**
661
+ * Num Turns
662
+ * @default 0
663
+ */
664
+ num_turns: number;
665
+ /**
666
+ * Output Tokens
667
+ * @default 0
668
+ */
669
+ output_tokens: number;
670
+ /**
671
+ * Per Model
672
+ * @default {}
673
+ */
674
+ per_model: {
675
+ [key: string]: components['schemas']['ModelTokensInfo'];
676
+ };
677
+ /**
678
+ * Per Turn
679
+ * @default []
680
+ */
681
+ per_turn: components['schemas']['TurnTokensInfo'][];
682
+ /**
683
+ * Thinking Tokens
684
+ * @default 0
685
+ */
686
+ thinking_tokens: number;
687
+ };
688
+ /** TurnTokensInfo */
689
+ TurnTokensInfo: {
690
+ /**
691
+ * Cache Creation Input Tokens
692
+ * @default 0
693
+ */
694
+ cache_creation_input_tokens: number;
695
+ /**
696
+ * Cache Read Input Tokens
697
+ * @default 0
698
+ */
699
+ cache_read_input_tokens: number;
700
+ /**
701
+ * Input Tokens
702
+ * @default 0
703
+ */
704
+ input_tokens: number;
705
+ /**
706
+ * Output Tokens
707
+ * @default 0
708
+ */
709
+ output_tokens: number;
710
+ };
711
+ /** ValidationError */
712
+ ValidationError: {
713
+ /** Context */
714
+ ctx?: Record<string, never>;
715
+ /** Input */
716
+ input?: unknown;
717
+ /** Location */
718
+ loc: (string | number)[];
719
+ /** Message */
720
+ msg: string;
721
+ /** Error Type */
722
+ type: string;
723
+ };
724
+ /**
725
+ * WebhookType
726
+ * @enum {string}
727
+ */
728
+ WebhookType: 'github.issue' | 'github.issue_comment' | 'github.push' | 'github.pull_request' | 'github.pull_request_comment' | 'github.pull_request_review' | 'github.pull_request_review_comment' | 'slack.app_mention' | 'slack.message' | 'slack.channel_created' | 'linear.issue' | 'linear.issue_comment' | 'sentry.event_alert' | 'sentry.metric_alert' | 'user.message';
729
+ };
730
+ responses: never;
731
+ parameters: never;
732
+ requestBodies: never;
733
+ headers: never;
734
+ pathItems: never;
735
+ }
736
+ interface operations {
737
+ get_agent_session_v1_sessions__session_id__get: {
738
+ parameters: {
739
+ query?: never;
740
+ header?: {
741
+ 'user-agent'?: string | null;
742
+ };
743
+ path: {
744
+ session_id: string;
745
+ };
746
+ cookie?: never;
747
+ };
748
+ requestBody?: never;
749
+ responses: {
750
+ /** @description Successful Response */
751
+ 200: {
752
+ headers: {
753
+ [name: string]: unknown;
754
+ };
755
+ content: {
756
+ 'application/json': components['schemas']['AgentSessionWire'];
757
+ };
758
+ };
759
+ /** @description Validation Error */
760
+ 422: {
761
+ headers: {
762
+ [name: string]: unknown;
763
+ };
764
+ content: {
765
+ 'application/json': components['schemas']['HTTPValidationError'];
766
+ };
767
+ };
768
+ };
769
+ };
770
+ send_agent_session_message_v1_sessions__session_id__messages_post: {
771
+ parameters: {
772
+ query?: never;
773
+ header?: {
774
+ 'user-agent'?: string | null;
775
+ };
776
+ path: {
777
+ session_id: string;
778
+ };
779
+ cookie?: never;
780
+ };
781
+ requestBody: {
782
+ content: {
783
+ 'application/json': components['schemas']['SendSessionMessageRequest'];
784
+ };
785
+ };
786
+ responses: {
787
+ /** @description Successful Response */
788
+ 200: {
789
+ headers: {
790
+ [name: string]: unknown;
791
+ };
792
+ content: {
793
+ 'application/json': components['schemas']['SessionMessageWire'];
794
+ };
795
+ };
796
+ /** @description Validation Error */
797
+ 422: {
798
+ headers: {
799
+ [name: string]: unknown;
800
+ };
801
+ content: {
802
+ 'application/json': components['schemas']['HTTPValidationError'];
803
+ };
804
+ };
805
+ };
806
+ };
807
+ get_agent_session_records_v1_sessions__session_id__records_get: {
808
+ parameters: {
809
+ query?: {
810
+ after_seq?: number;
811
+ limit?: number | null;
812
+ };
813
+ header?: {
814
+ 'user-agent'?: string | null;
815
+ };
816
+ path: {
817
+ session_id: string;
818
+ };
819
+ cookie?: never;
820
+ };
821
+ requestBody?: never;
822
+ responses: {
823
+ /** @description Successful Response */
824
+ 200: {
825
+ headers: {
826
+ [name: string]: unknown;
827
+ };
828
+ content: {
829
+ 'application/json': components['schemas']['ListSessionRecordsResponse'];
830
+ };
831
+ };
832
+ /** @description Validation Error */
833
+ 422: {
834
+ headers: {
835
+ [name: string]: unknown;
836
+ };
837
+ content: {
838
+ 'application/json': components['schemas']['HTTPValidationError'];
839
+ };
840
+ };
841
+ };
842
+ };
843
+ get_agent_session_turns_v1_sessions__session_id__turns_get: {
844
+ parameters: {
845
+ query?: never;
846
+ header?: {
847
+ 'user-agent'?: string | null;
848
+ };
849
+ path: {
850
+ session_id: string;
851
+ };
852
+ cookie?: never;
853
+ };
854
+ requestBody?: never;
855
+ responses: {
856
+ /** @description Successful Response */
857
+ 200: {
858
+ headers: {
859
+ [name: string]: unknown;
860
+ };
861
+ content: {
862
+ 'application/json': components['schemas']['ListSessionTurnsResponse'];
863
+ };
864
+ };
865
+ /** @description Validation Error */
866
+ 422: {
867
+ headers: {
868
+ [name: string]: unknown;
869
+ };
870
+ content: {
871
+ 'application/json': components['schemas']['HTTPValidationError'];
872
+ };
873
+ };
874
+ };
875
+ };
876
+ }
877
+
878
+ /**
879
+ * One server-to-client frame of the Ellipsis session stream protocol v2 (WS /v1/sessions/{id}/stream?protocol=2). Clients MUST ignore frames with unknown `type` values — additive frames are not a protocol break.
880
+ */
881
+ type SessionStreamFrame = SnapshotFrame | RecordsAppendFrame | MessagesFrame | SessionFrame | DeltaFrame | HeartbeatFrame | DoneFrame | ErrorFrame;
882
+ type AttributionType = 'github_user' | 'linear_user' | 'slack_user' | 'api_key';
883
+ type SessionMessageStatus = 'pending' | 'delivered';
884
+ type GithubAccountType = 'User' | 'Organization' | 'Bot' | 'Mannequin';
885
+ /**
886
+ * How a session that arrived with no explicit config source resolved its
887
+ * config (documents/eng/DEFAULT_CONFIGS.md §4). Persisted on the session so
888
+ * audit and clients can say "ran under X (repo default)". A session started
889
+ * with an explicit config/config_id/template_id never enters resolution and
890
+ * stores None.
891
+ */
892
+ type DefaultResolution = 'repo_default' | 'account_default' | 'none';
893
+ /**
894
+ * Why a terminal agent session ended — a finer-grained reason than `status`.
895
+ *
896
+ * `status` (AgentSessionStatus) is the lifecycle state: COMPLETED / ERROR /
897
+ * CANCELLED. `exit_status` explains *why* a run reached that terminal state, so
898
+ * the UI and metrics can tell a budget cutoff apart from a crashed tool call or
899
+ * a deliberate cancellation. It is None until the run reaches a terminal state.
900
+ */
901
+ type AgentSessionExitStatus = 'completed' | 'budget_hit' | 'payment_required' | 'tool_call_failed' | 'lifecycle_hook_failed' | 'missing_repo_access' | 'missing_token_permissions' | 'cancelled' | 'interrupted' | 'error' | 'stopped';
902
+ type Harness = 'claude_code';
903
+ /**
904
+ * How a session relates to its predecessor (parent_agent_session_id) —
905
+ * the ONE "preceded-by" chain for every predecessor relationship. Routing
906
+ * reads this when the distinction matters.
907
+ *
908
+ * CONTINUATION — a follow-up in the same conversation surface (e.g. a Slack
909
+ * thread reply spawning a fresh session on the same thread).
910
+ * HANDOFF — a session started to take over work from another surface (e.g.
911
+ * laptop → cloud handoff; later phase).
912
+ * RESUME — a conversation re-hosted on a new box after its sandbox was torn
913
+ * down (interactive platform; later phase).
914
+ */
915
+ type ParentKind = 'continuation' | 'handoff' | 'resume';
916
+ /**
917
+ * Which layer actually determined the enforced budget.
918
+ *
919
+ * Not derivable from the run row alone (the run does not store the config
920
+ * cents or the customer default), so we persist it for the UI / audit.
921
+ */
922
+ type BudgetSource = 'system' | 'account' | 'config' | 'run';
923
+ /**
924
+ * Lifecycle of a keyed (multi-turn) session — the durable conversation.
925
+ * Distinct from AgentSessionStatus, which is per-execution (one turn's run) and
926
+ * moves to agent_turns in a later slice. IDLE: alive, waiting for the next
927
+ * message. RUNNING: a turn is executing. CLOSED: the conversation is done and
928
+ * its sandbox/snapshots are torn down.
929
+ */
930
+ type SessionState = 'idle' | 'running' | 'closed';
931
+ type AgentSessionSource = 'react' | 'manual' | 'api' | 'cli' | 'mention' | 'cron' | 'laptop';
932
+ type AgentSessionStatus = 'scheduled' | 'creating_sandbox' | 'running' | 'retrying' | 'completed' | 'error' | 'cancelled' | 'stopped';
933
+ /**
934
+ * What the current (or most recent) execution is doing (backs `run`).
935
+ */
936
+ type RunStatus = 'scheduled' | 'starting' | 'working' | 'waiting' | 'done' | 'failed' | 'stopped' | 'cancelled' | 'retrying';
937
+ /**
938
+ * The durable conversation axis (backs the surfaced `session` field).
939
+ */
940
+ type SessionLiveness = 'alive' | 'sleeping' | 'closed';
941
+ type WebhookType = 'github.issue' | 'github.issue_comment' | 'github.push' | 'github.pull_request' | 'github.pull_request_comment' | 'github.pull_request_review' | 'github.pull_request_review_comment' | 'slack.app_mention' | 'slack.message' | 'slack.channel_created' | 'linear.issue' | 'linear.issue_comment' | 'sentry.event_alert' | 'sentry.metric_alert' | 'user.message';
942
+ /**
943
+ * First frame after accept. Lean: session + open inbox only — records
944
+ * always arrive via records_append (§3.4).
945
+ */
946
+ interface SnapshotFrame {
947
+ earliest_feed_seq: number | null;
948
+ messages: SessionMessageWire[];
949
+ protocol: number;
950
+ session: AgentSessionWire;
951
+ type: 'snapshot';
952
+ }
953
+ /**
954
+ * The wire shape of one inbox message (§3.3): what a queued chip renders
955
+ * and retires on. `author` is the message's attribution string; the webhook
956
+ * provenance internals stay off the wire.
957
+ */
958
+ interface SessionMessageWire {
959
+ agent_session_id: string;
960
+ author: string | null;
961
+ body: string;
962
+ created_at: string;
963
+ delivered_at: string | null;
964
+ delivered_turn_id: string | null;
965
+ feed_seq: number | null;
966
+ id: string;
967
+ sender_attribution_id: string | null;
968
+ sender_attribution_type: AttributionType | null;
969
+ status: SessionMessageStatus;
970
+ }
971
+ interface AgentSessionWire {
972
+ agent_config_id: string | null;
973
+ attributed_user: GithubAccountSnippet | null;
974
+ attribution_id: string | null;
975
+ attribution_type: AttributionType | null;
976
+ client_version: string | null;
977
+ config_override: {
978
+ [k: string]: unknown;
979
+ } | null;
980
+ context_repository: string | null;
981
+ cost_fee: number;
982
+ cost_sandbox_cpu: number;
983
+ cost_sandbox_memory: number;
984
+ cost_tokens: number;
985
+ created_at: string;
986
+ customer_id: string;
987
+ default_resolution: DefaultResolution | null;
988
+ exit_status: AgentSessionExitStatus | null;
989
+ harness: Harness;
990
+ id: string;
991
+ last_activity_at: string | null;
992
+ last_message_at: string | null;
993
+ live_summary: string | null;
994
+ metadata: {
995
+ [k: string]: string;
996
+ };
997
+ output_prs: AgentSessionPr[] | null;
998
+ parent_agent_session_id: string | null;
999
+ parent_kind: ParentKind | null;
1000
+ prompt: string | null;
1001
+ replayed_from_session_id: string | null;
1002
+ resolved_budget_cents: number;
1003
+ resolved_budget_source: BudgetSource;
1004
+ sandbox_id: string | null;
1005
+ session_key: string | null;
1006
+ session_state: SessionState | null;
1007
+ source: AgentSessionSource;
1008
+ status: AgentSessionStatus;
1009
+ status_reason: string | null;
1010
+ stopped_at: string | null;
1011
+ stopped_by: number | null;
1012
+ stopped_by_user: GithubAccountSnippet | null;
1013
+ surface: SessionSurface | null;
1014
+ tokens_cache_creation: number;
1015
+ tokens_cache_read: number;
1016
+ tokens_input: number;
1017
+ tokens_model: string;
1018
+ tokens_output: number;
1019
+ tokens_total: number;
1020
+ updated_at: string;
1021
+ webhook_id: string | null;
1022
+ webhook_type: WebhookType | null;
1023
+ }
1024
+ /**
1025
+ * Sometimes the GitHub API returns a user of github (can include bots)
1026
+ * using this snippet instead of the full GithubAccount model. One example,
1027
+ * is when the API returns a pull request.
1028
+ *
1029
+ * This is the least amount of info we need to represent a GitHub account.
1030
+ */
1031
+ interface GithubAccountSnippet {
1032
+ avatar_url: string;
1033
+ id: number;
1034
+ login: string;
1035
+ type: GithubAccountType;
1036
+ }
1037
+ /**
1038
+ * A pull request this session created, denormalized at capture time so
1039
+ * session surfaces render a labeled link without joining gh_prs. Live PR
1040
+ * state (open/merged/closed) is not stored here — read it from gh_prs where
1041
+ * a view needs it.
1042
+ */
1043
+ interface AgentSessionPr {
1044
+ gh_pr_id: number | null;
1045
+ number: number;
1046
+ repo_full_name: string;
1047
+ url: string;
1048
+ }
1049
+ /**
1050
+ * The three fields we expose. All `None` for an un-keyed (laptop) session.
1051
+ *
1052
+ * `use_enum_values=True` (from CustomBaseModel) stores the members as their
1053
+ * string values, so this serializes to `{"session": "alive", "run": "waiting",
1054
+ * "status": "waiting"}` — a plain object, not enum names.
1055
+ */
1056
+ interface SessionSurface {
1057
+ run: RunStatus | null;
1058
+ session: SessionLiveness | null;
1059
+ status: string | null;
1060
+ }
1061
+ /**
1062
+ * Cursored append-only: raw records ordered by feed_seq, all sources.
1063
+ * Every record in the frame advances the resume cursor — including ones a
1064
+ * client renders as nothing (§3.4).
1065
+ */
1066
+ interface RecordsAppendFrame {
1067
+ records: SessionRecordWire[];
1068
+ type: 'records_append';
1069
+ }
1070
+ /**
1071
+ * The wire shape of one session record (§3.3): the §3.6 stable envelope +
1072
+ * the native `payload`, by explicit allowlist. Internal-only columns
1073
+ * (`search_text`, `clis`, ingest bookkeeping, attribution denormalizations)
1074
+ * are deliberately absent so internal model evolution stays free.
1075
+ */
1076
+ interface SessionRecordWire {
1077
+ agent_session_id: string;
1078
+ agent_turn_id: string | null;
1079
+ cost: number | null;
1080
+ created_at: string;
1081
+ duration: number | null;
1082
+ feed_seq: number;
1083
+ id: string;
1084
+ model: string | null;
1085
+ payload: {
1086
+ [k: string]: unknown;
1087
+ };
1088
+ record_format: string;
1089
+ record_type: string;
1090
+ session_message_id: string | null;
1091
+ /**
1092
+ * Who wrote the record. Known values: claude_code (a native harness transcript record) | lifecycle (a platform notification). Open vocabulary: ignore records with unknown sources.
1093
+ */
1094
+ source: string;
1095
+ stream_seq: number;
1096
+ tokens_info: TokensInfo | null;
1097
+ tools: string[] | null;
1098
+ }
1099
+ interface TokensInfo {
1100
+ cache_creation_input_tokens: number;
1101
+ cache_read_input_tokens: number;
1102
+ cost_usd: number;
1103
+ initial_system_prompt_tokens: number;
1104
+ input_tokens: number;
1105
+ num_turns: number;
1106
+ output_tokens: number;
1107
+ per_model: {
1108
+ [k: string]: ModelTokensInfo;
1109
+ };
1110
+ per_turn: TurnTokensInfo[];
1111
+ thinking_tokens: number;
1112
+ }
1113
+ interface ModelTokensInfo {
1114
+ cache_creation_input_tokens: number;
1115
+ cache_read_input_tokens: number;
1116
+ cost_usd: number;
1117
+ input_tokens: number;
1118
+ output_tokens: number;
1119
+ }
1120
+ interface TurnTokensInfo {
1121
+ cache_creation_input_tokens: number;
1122
+ cache_read_input_tokens: number;
1123
+ input_tokens: number;
1124
+ output_tokens: number;
1125
+ }
1126
+ /**
1127
+ * LWW snapshot of the OPEN inbox slice: all PENDING rows plus rows that
1128
+ * flipped (delivered, re-pended) within this connection since the last frame.
1129
+ * Deliberately not the full message history — delivered rows render through
1130
+ * their transcript user-echo records; structural history stays on REST
1131
+ * /turns (§3.3).
1132
+ */
1133
+ interface MessagesFrame {
1134
+ messages: SessionMessageWire[];
1135
+ type: 'messages';
1136
+ }
1137
+ /**
1138
+ * LWW snapshot of the enriched public session (§4.1) — the only way
1139
+ * status/state/cost arrive. Resent whole on any field change.
1140
+ */
1141
+ interface SessionFrame {
1142
+ session: AgentSessionWire;
1143
+ type: 'session';
1144
+ }
1145
+ /**
1146
+ * Fire-and-forget partial assistant output for the current response.
1147
+ * No seq, never resumable; superseded by the committed record.
1148
+ */
1149
+ interface DeltaFrame {
1150
+ agent_turn_id: string | null;
1151
+ /**
1152
+ * What the partial text is. Known values: text ('thinking' reserved). Open vocabulary: ignore deltas with unknown kinds.
1153
+ */
1154
+ kind: string;
1155
+ output_tokens: number | null;
1156
+ text: string | null;
1157
+ type: 'delta';
1158
+ }
1159
+ /**
1160
+ * Sent after HEARTBEAT_SECONDS of idleness; doubles as the dead-socket
1161
+ * probe.
1162
+ */
1163
+ interface HeartbeatFrame {
1164
+ ts: string;
1165
+ type: 'heartbeat';
1166
+ }
1167
+ /**
1168
+ * Terminal marker: the conversation is over, after the final session frame
1169
+ * carried the end state. Followed by close 1000.
1170
+ */
1171
+ interface DoneFrame {
1172
+ type: 'done';
1173
+ }
1174
+ /**
1175
+ * Terminal error marker, before close 1011. Curated copy only.
1176
+ */
1177
+ interface ErrorFrame {
1178
+ message: string;
1179
+ type: 'error';
1180
+ }
1181
+
1182
+ type StreamFrame = SessionStreamFrame | {
1183
+ type: string;
1184
+ [key: string]: unknown;
1185
+ };
1186
+ type SendSessionMessageRequest = components['schemas']['SendSessionMessageRequest'];
1187
+ type ListSessionRecordsResponse = components['schemas']['ListSessionRecordsResponse'];
1188
+ type ListSessionTurnsResponse = components['schemas']['ListSessionTurnsResponse'];
1189
+ type AgentTurn = components['schemas']['AgentTurn'];
1190
+ type AgentTurnStatus = components['schemas']['AgentTurnStatus'];
1191
+
1192
+ export type { AgentSessionWire as A, BudgetSource as B, DefaultResolution as D, ErrorFrame as E, GithubAccountSnippet as G, Harness as H, ListSessionRecordsResponse as L, MessagesFrame as M, ParentKind as P, RecordsAppendFrame as R, SessionMessageWire as S, TokensInfo as T, ListSessionTurnsResponse as a, AgentSessionExitStatus as b, AgentSessionPr as c, AgentSessionSource as d, AgentSessionStatus as e, AgentTurn as f, AgentTurnStatus as g, AttributionType as h, DeltaFrame as i, DoneFrame as j, GithubAccountType as k, HeartbeatFrame as l, ModelTokensInfo as m, SendSessionMessageRequest as n, SessionFrame as o, SessionLiveness as p, SessionMessageStatus as q, SessionRecordWire as r, SessionState as s, SessionStreamFrame as t, SessionSurface as u, SnapshotFrame as v, StreamFrame as w, TurnTokensInfo as x, components as y, paths as z };