@ellipsis-dev/sdk 0.8.1 → 0.10.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.
@@ -17,9 +17,10 @@ interface paths {
17
17
  * @description Create an agent config via pull request.
18
18
  *
19
19
  * The PR adds the config file to agents/ on the target
20
- * repository.
20
+ * repository; the agent goes live when it merges.
21
21
  *
22
- * Accepts an inline config or a gallery template slug.
22
+ * Accepts an inline config or a gallery template slug. 409 when
23
+ * another live agent already holds the name.
23
24
  */
24
25
  post: operations['create_agent_config'];
25
26
  delete?: never;
@@ -37,7 +38,7 @@ interface paths {
37
38
  };
38
39
  /**
39
40
  * Get Agent Config
40
- * @description Return one saved agent config by id.
41
+ * @description Return one saved agent config, by id or by the agent's name.
41
42
  */
42
43
  get: operations['get_agent_config'];
43
44
  put?: never;
@@ -70,7 +71,8 @@ interface paths {
70
71
  * @description Set a default agent config.
71
72
  *
72
73
  * Addressed by rung: the account rung (repository omitted) or a
73
- * repository rung ("owner/name").
74
+ * repository rung ("owner/name"); the config by id or by the
75
+ * agent's name.
74
76
  *
75
77
  * Refused for sandbox tokens (potentially prompt-injected code
76
78
  * must not repoint the account's ambient default); an unknown or
@@ -830,8 +832,9 @@ interface paths {
830
832
  * List Agent Sessions
831
833
  * @description List cloud agent sessions, newest first.
832
834
  *
833
- * Optionally filtered by config, source, time window, attributed
834
- * author, repository, and whether the session is still going.
835
+ * Optionally filtered by config (id or `ellipsis.name`), source, time
836
+ * window, attributed author, repository, and whether the session is
837
+ * still going.
835
838
  */
836
839
  get: operations['list_agent_sessions'];
837
840
  put?: never;
@@ -839,10 +842,13 @@ interface paths {
839
842
  * Start Agent Session
840
843
  * @description Start a cloud agent session.
841
844
  *
842
- * Provide at most one of config_id, config, or template_id; with
843
- * none, the account's default-config ladder resolves the config.
844
- * 400 when idle_start is combined with prompt or handoff, or when
845
- * a handoff is combined with any config source or override.
845
+ * Provide at most one of config_id (an id or an agent name),
846
+ * config, or
847
+ * template_id; with none, the account's default-config ladder
848
+ * resolves the config. 400 when idle_start is combined with
849
+ * prompt, input, or handoff, or when a handoff is combined with
850
+ * any config source or override. 422 when the agent declares an
851
+ * input schema and the request's input is absent or invalid.
846
852
  */
847
853
  post: operations['start_agent_session'];
848
854
  delete?: never;
@@ -958,7 +964,7 @@ interface paths {
958
964
  patch?: never;
959
965
  trace?: never;
960
966
  };
961
- '/sessions/{session_id}/ide': {
967
+ '/sessions/{session_id}/export': {
962
968
  parameters: {
963
969
  query?: never;
964
970
  header?: never;
@@ -966,18 +972,19 @@ interface paths {
966
972
  cookie?: never;
967
973
  };
968
974
  /**
969
- * Get Agent Session Ide
970
- * @description Return the IDE link for the session's sandbox.
975
+ * Export Agent Session
976
+ * @description Export the complete session history.
971
977
  *
972
- * The membership-gated dashboard page, which performs the sandbox
973
- * proxy handoff itself.
978
+ * The complete, ordered history of the session (agent output, tool calls, thinking,
979
+ * lifecycle events, sandbox output, message events) as an ordered
980
+ * manifest of presigned segment URLs.
974
981
  *
975
- * No credential is minted here the URL grants nothing by
976
- * possession. 409 when the sandbox isn't running (send the
977
- * session a message to wake it first). Backs the `agent session
978
- * ide` CLI verb.
982
+ * Segments are gzip members: download in order and concatenate
983
+ * for one file. The JSON API never carries the bytes (same
984
+ * two-step as files). /records is the paged live view of the
985
+ * same data.
979
986
  */
980
- get: operations['get_agent_session_ide'];
987
+ get: operations['export_agent_session'];
981
988
  put?: never;
982
989
  post?: never;
983
990
  delete?: never;
@@ -986,7 +993,7 @@ interface paths {
986
993
  patch?: never;
987
994
  trace?: never;
988
995
  };
989
- '/sessions/{session_id}/log': {
996
+ '/sessions/{session_id}/ide': {
990
997
  parameters: {
991
998
  query?: never;
992
999
  header?: never;
@@ -994,19 +1001,18 @@ interface paths {
994
1001
  cookie?: never;
995
1002
  };
996
1003
  /**
997
- * Get Agent Session Log
998
- * @description Download the complete session log.
1004
+ * Get Agent Session Ide
1005
+ * @description Return the IDE link for the session's sandbox.
999
1006
  *
1000
- * The complete, ordered history of the session (agent output, tool calls, thinking,
1001
- * lifecycle events, sandbox output, message events) as an ordered
1002
- * manifest of presigned segment URLs.
1007
+ * The membership-gated dashboard page, which performs the sandbox
1008
+ * proxy handoff itself.
1003
1009
  *
1004
- * Segments are gzip members: download in order and concatenate
1005
- * for one file. The JSON API never carries the bytes (same
1006
- * two-step as files). /records is the paged live view of the
1007
- * same data.
1010
+ * No credential is minted here the URL grants nothing by
1011
+ * possession. 409 when the sandbox isn't running (send the
1012
+ * session a message to wake it first). Backs the `agent session
1013
+ * ide` CLI verb.
1008
1014
  */
1009
- get: operations['get_agent_session_log'];
1015
+ get: operations['get_agent_session_ide'];
1010
1016
  put?: never;
1011
1017
  post?: never;
1012
1018
  delete?: never;
@@ -1040,6 +1046,32 @@ interface paths {
1040
1046
  patch?: never;
1041
1047
  trace?: never;
1042
1048
  };
1049
+ '/sessions/{session_id}/output': {
1050
+ parameters: {
1051
+ query?: never;
1052
+ header?: never;
1053
+ path?: never;
1054
+ cookie?: never;
1055
+ };
1056
+ /**
1057
+ * Get Agent Session Output
1058
+ * @description Return the session's typed output.
1059
+ *
1060
+ * The payload the agent submitted through its config-declared
1061
+ * output.json_schema, as the raw JSON body with no envelope. 404
1062
+ * while the session is still running (poll GET /sessions/{id}),
1063
+ * when the agent declares no output block, or when no execution
1064
+ * produced output.
1065
+ */
1066
+ get: operations['get_agent_session_output'];
1067
+ put?: never;
1068
+ post?: never;
1069
+ delete?: never;
1070
+ options?: never;
1071
+ head?: never;
1072
+ patch?: never;
1073
+ trace?: never;
1074
+ };
1043
1075
  '/sessions/{session_id}/ports/{port}': {
1044
1076
  parameters: {
1045
1077
  query?: never;
@@ -1229,6 +1261,7 @@ interface components {
1229
1261
  * }
1230
1262
  */
1231
1263
  environment: components['schemas']['AgentConfigEnvironment'];
1264
+ input?: components['schemas']['AgentConfigInput'] | null;
1232
1265
  /** @default {} */
1233
1266
  llm: components['schemas']['AgentConfigLlm'];
1234
1267
  /**
@@ -1236,6 +1269,7 @@ interface components {
1236
1269
  * @default []
1237
1270
  */
1238
1271
  mcp_servers: (string | components['schemas']['AgentConfigMcpServer'])[];
1272
+ output?: components['schemas']['AgentConfigOutput'] | null;
1239
1273
  /**
1240
1274
  * @default {
1241
1275
  * "ellipsis": true,
@@ -1248,7 +1282,6 @@ interface components {
1248
1282
  * @default []
1249
1283
  */
1250
1284
  skills: components['schemas']['AgentConfigSkill'][];
1251
- structured_output?: components['schemas']['AgentConfigStructuredOutput'] | null;
1252
1285
  /** Trigger */
1253
1286
  trigger?: (components['schemas']['AgentConfigCronTrigger'] | components['schemas']['AgentConfigReactTrigger'] | components['schemas']['AgentConfigMentionTrigger']) | null;
1254
1287
  };
@@ -1413,6 +1446,17 @@ interface components {
1413
1446
  */
1414
1447
  version: string;
1415
1448
  };
1449
+ /**
1450
+ * AgentConfigEllipsisPermissions
1451
+ * @description `permissions.ellipsis` as a map: resource → level | grant | list of
1452
+ * grants. Levels are hierarchical (read < write < delete), so `write`
1453
+ * includes `read`. An unlisted resource is denied. The whole block is
1454
+ * intersected with the platform's sandbox ceiling at token mint — it can
1455
+ * narrow what a sandbox token may do, never exceed it.
1456
+ */
1457
+ AgentConfigEllipsisPermissions: {
1458
+ [key: string]: components['schemas']['Level'] | components['schemas']['EllipsisGrant'] | (components['schemas']['Level'] | components['schemas']['EllipsisGrant'])[];
1459
+ };
1416
1460
  /**
1417
1461
  * AgentConfigEnvironment
1418
1462
  * @description Everything about the environment (the sandbox) the agent runs in: which
@@ -1545,6 +1589,30 @@ interface components {
1545
1589
  /** Repositories */
1546
1590
  repositories?: string[] | null;
1547
1591
  };
1592
+ /**
1593
+ * AgentConfigInput
1594
+ * @description The typed input contract: what goes INTO a session (the trigger is
1595
+ * when it happens; this is what goes in).
1596
+ *
1597
+ * `json_schema` types the payload a caller-started session takes
1598
+ * (`POST /sessions` `input`, validated at the door; required when
1599
+ * declared). It is illegal on a react-triggered agent — react payloads are
1600
+ * platform-shaped (the published surface field sets), not caller-shaped.
1601
+ *
1602
+ * `message` is the initial-message template: exact `{{path}}` substitution
1603
+ * over the caller payload (or, on a react agent, over the surface's
1604
+ * published fields), no conditionals/loops/filters. Refs are validated at
1605
+ * deploy time against the governing field set (see AgentConfig's
1606
+ * `_check_input`).
1607
+ */
1608
+ AgentConfigInput: {
1609
+ /** Json Schema */
1610
+ json_schema?: {
1611
+ [key: string]: unknown;
1612
+ } | null;
1613
+ /** Message */
1614
+ message?: string | null;
1615
+ };
1548
1616
  /**
1549
1617
  * AgentConfigLlm
1550
1618
  * @description Where this agent's completions go.
@@ -1621,6 +1689,18 @@ interface components {
1621
1689
  */
1622
1690
  labels: string[];
1623
1691
  };
1692
+ /**
1693
+ * AgentConfigOutput
1694
+ * @description The typed output contract: the JSON Schema the agent must exit through
1695
+ * (the StructuredOutput exit tool). Read back via
1696
+ * GET /sessions/{id}/output.
1697
+ */
1698
+ AgentConfigOutput: {
1699
+ /** Json Schema */
1700
+ json_schema: {
1701
+ [key: string]: unknown;
1702
+ };
1703
+ };
1624
1704
  /**
1625
1705
  * AgentConfigPermissions
1626
1706
  * @description What the agent is allowed to touch, per credential the platform mints
@@ -1629,10 +1709,11 @@ interface components {
1629
1709
  *
1630
1710
  * `ellipsis` scopes the sandbox's Ellipsis API token
1631
1711
  * (`ELLIPSIS_API_TOKEN`, what the in-sandbox `agent` CLI authenticates
1632
- * with). Only full access exists today — `true` or the string `all`, both
1633
- * meaning the token may call any Ellipsis API a sandbox token can. The key
1634
- * is declarative for now; it reserves the spot for narrowing later, and
1635
- * anything other than true/`all` (including `false`) fails validation.
1712
+ * with). `true` / the string `all` (the default) grant the full sandbox
1713
+ * ceiling everything a sandbox token can ever do. A map narrows it per
1714
+ * resource (see `AgentConfigEllipsisPermissions`); the minted token carries
1715
+ * the intersection, so a config can only ever reduce access. `false` fails
1716
+ * validation — an agent with no API token cannot report its own progress.
1636
1717
  *
1637
1718
  * `github` scopes the sandbox's GitHub installation token (`GH_TOKEN`) —
1638
1719
  * see `AgentConfigGithubPermissions`. GitHub enforces it at mint time.
@@ -1641,9 +1722,8 @@ interface components {
1641
1722
  /**
1642
1723
  * Ellipsis
1643
1724
  * @default true
1644
- * @enum {unknown}
1645
1725
  */
1646
- ellipsis: true | 'all';
1726
+ ellipsis: (true | 'all') | components['schemas']['AgentConfigEllipsisPermissions'];
1647
1727
  /** @default {} */
1648
1728
  github: components['schemas']['AgentConfigGithubPermissions'];
1649
1729
  };
@@ -1723,19 +1803,6 @@ interface components {
1723
1803
  /** Repo Id */
1724
1804
  repo_id: number;
1725
1805
  };
1726
- /** AgentConfigStructuredOutput */
1727
- AgentConfigStructuredOutput: {
1728
- /** Json Schema */
1729
- json_schema: {
1730
- [key: string]: unknown;
1731
- };
1732
- /**
1733
- * Type
1734
- * @default json_schema
1735
- * @constant
1736
- */
1737
- type: 'json_schema';
1738
- };
1739
1806
  /** AgentConfigSystemFileRef */
1740
1807
  AgentConfigSystemFileRef: {
1741
1808
  /** File */
@@ -1809,46 +1876,6 @@ interface components {
1809
1876
  */
1810
1877
  defaults: components['schemas']['AgentDefault'][];
1811
1878
  };
1812
- /**
1813
- * AgentSessionExitStatus
1814
- * @description Why a terminal agent session ended — a finer-grained reason than `status`.
1815
- *
1816
- * `status` (AgentSessionStatus) is the lifecycle state: COMPLETED / ERROR /
1817
- * CANCELLED. `exit_status` explains *why* a run reached that terminal state, so
1818
- * the UI and metrics can tell a budget cutoff apart from a crashed tool call or
1819
- * a deliberate cancellation. It is None until the run reaches a terminal state.
1820
- * @enum {string}
1821
- */
1822
- AgentSessionExitStatus: 'completed' | 'budget_hit' | 'payment_required' | 'tool_call_failed' | 'lifecycle_hook_failed' | 'missing_repo_access' | 'missing_token_permissions' | 'missing_sandbox_variables' | 'cancelled' | 'interrupted' | 'error' | 'stopped';
1823
- /**
1824
- * AgentSessionPr
1825
- * @description A pull request this session created, denormalized at capture time so
1826
- * session surfaces render a labeled link without joining gh_prs. Live PR
1827
- * state (open/merged/closed) is not stored here — read it from gh_prs where
1828
- * a view needs it.
1829
- */
1830
- AgentSessionPr: {
1831
- /** Gh Pr Id */
1832
- gh_pr_id?: number | null;
1833
- /** Number */
1834
- number: number;
1835
- /** Repo Full Name */
1836
- repo_full_name: string;
1837
- /** Title */
1838
- title?: string | null;
1839
- /** Url */
1840
- url: string;
1841
- };
1842
- /**
1843
- * AgentSessionSource
1844
- * @enum {string}
1845
- */
1846
- AgentSessionSource: 'react' | 'manual' | 'api' | 'cli' | 'mention' | 'cron' | 'laptop';
1847
- /**
1848
- * AgentSessionStatus
1849
- * @enum {string}
1850
- */
1851
- AgentSessionStatus: 'scheduled' | 'creating_sandbox' | 'running' | 'retrying' | 'completed' | 'error' | 'cancelled' | 'stopped';
1852
1879
  /**
1853
1880
  * AgentTemplate
1854
1881
  * @description A built-in agent template: a ready-to-use agent config plus the
@@ -2338,6 +2365,11 @@ interface components {
2338
2365
  * @description When the config was created.
2339
2366
  */
2340
2367
  created_at: string;
2368
+ /**
2369
+ * Display Name
2370
+ * @description The raw ellipsis.name display text from the config file.
2371
+ */
2372
+ display_name?: string | null;
2341
2373
  /** @description The GitHub account that last edited the config, when the edit came from a known user. */
2342
2374
  edited_by?: components['schemas']['GithubAccountSnippet'] | null;
2343
2375
  /**
@@ -2365,11 +2397,21 @@ interface components {
2365
2397
  * @description The last commit the config was synced from.
2366
2398
  */
2367
2399
  last_synced_commit_sha?: string | null;
2400
+ /**
2401
+ * Name
2402
+ * @description The agent's customer-unique addressable name (a slug of its display name); usable anywhere an agent is referenced, interchangeably with the id.
2403
+ */
2404
+ name?: string | null;
2368
2405
  /**
2369
2406
  * Pending Pull Request Url
2370
2407
  * @description The open pull request that adds this config's file. Non-null means the agent is not live yet: it starts running once the pull request merges and syncs.
2371
2408
  */
2372
2409
  pending_pull_request_url?: string | null;
2410
+ /**
2411
+ * Sha
2412
+ * @description The config's content identity: the version fingerprint frozen onto each session that runs it.
2413
+ */
2414
+ sha: string;
2373
2415
  /**
2374
2416
  * Updated At
2375
2417
  * Format: date-time
@@ -2625,6 +2667,17 @@ interface components {
2625
2667
  * @enum {string}
2626
2668
  */
2627
2669
  EffortLevel: 'low' | 'medium' | 'high' | 'xhigh' | 'max';
2670
+ /**
2671
+ * EllipsisGrant
2672
+ * @description One grant entry: a level, optionally narrowed to instances whose
2673
+ * natural key (a file's name, a memory's path, a secret's name, a config's
2674
+ * name, a session's id) matches any of the `match` globs.
2675
+ */
2676
+ EllipsisGrant: {
2677
+ level: components['schemas']['Level'];
2678
+ /** Match */
2679
+ match?: string[] | null;
2680
+ };
2628
2681
  /** ErrorInfo */
2629
2682
  ErrorInfo: {
2630
2683
  /**
@@ -3314,6 +3367,14 @@ interface components {
3314
3367
  */
3315
3368
  cloud_id: string;
3316
3369
  };
3370
+ /**
3371
+ * Level
3372
+ * @description What may be done to a resource. Strictly ordered: a grant at one level
3373
+ * includes every level below it (write-only would be a phantom capability —
3374
+ * no real client can create what it cannot read back).
3375
+ * @enum {string}
3376
+ */
3377
+ Level: 'read' | 'write' | 'delete';
3317
3378
  /**
3318
3379
  * LinearIntegrationSummary
3319
3380
  * @description The account's connected Linear organization and its teams.
@@ -3887,7 +3948,7 @@ interface components {
3887
3948
  PutAgentDefaultRequest: {
3888
3949
  /**
3889
3950
  * Config Id
3890
- * @description The saved config to make the default.
3951
+ * @description The config to make the default: a config id, or the agent's customer-unique `ellipsis.name`.
3891
3952
  */
3892
3953
  config_id: string;
3893
3954
  /**
@@ -4113,7 +4174,7 @@ interface components {
4113
4174
  * Output Prs
4114
4175
  * @description Pull requests the session created, so a result row can show what it shipped without fetching the session.
4115
4176
  */
4116
- output_prs?: components['schemas']['AgentSessionPr'][] | null;
4177
+ output_prs?: components['schemas']['SessionPr'][] | null;
4117
4178
  /**
4118
4179
  * Record Type
4119
4180
  * @description The record's event type.
@@ -4125,9 +4186,9 @@ interface components {
4125
4186
  */
4126
4187
  session_id: string;
4127
4188
  /** @description Where the matching session came from. */
4128
- session_source?: components['schemas']['AgentSessionSource'] | null;
4189
+ session_source?: components['schemas']['SessionSource'] | null;
4129
4190
  /** @description The matching session's status. */
4130
- session_status?: components['schemas']['AgentSessionStatus'] | null;
4191
+ session_status?: components['schemas']['SessionStatus'] | null;
4131
4192
  /**
4132
4193
  * Snippet
4133
4194
  * @description A short window of the indexed text around the first match.
@@ -4224,6 +4285,14 @@ interface components {
4224
4285
  /** Watermark */
4225
4286
  watermark: string | null;
4226
4287
  };
4288
+ /**
4289
+ * Resource
4290
+ * @description Everything a credential can be granted access to, one value per /v1
4291
+ * resource family. `TOKENS` is reserved for the future token-management
4292
+ * routes; nothing maps to it yet.
4293
+ * @enum {string}
4294
+ */
4295
+ Resource: 'account' | 'alerts' | 'sessions' | 'files' | 'memories' | 'reviews' | 'configs' | 'defaults' | 'secrets' | 'templates' | 'integrations' | 'tokens';
4227
4296
  /**
4228
4297
  * Review
4229
4298
  * @description One code review: one pipeline iteration over one commit range of a pull
@@ -5181,15 +5250,10 @@ interface components {
5181
5250
  * disagree about what a session looks like.
5182
5251
  */
5183
5252
  Session: {
5184
- /** @description The GitHub user the session is attributed to, when the attribution is a GitHub user. */
5185
- attributed_user?: components['schemas']['GithubAccountSnippet'] | null;
5186
- /**
5187
- * Attribution Id
5188
- * @description Identifier of the principal the session is attributed to.
5189
- */
5190
- attribution_id?: string | null;
5191
- /** @description Kind of principal the session is attributed to (e.g. a GitHub user or an API key). */
5192
- attribution_type?: components['schemas']['AttributionType'] | null;
5253
+ /** @description The principal this session is attributed to. */
5254
+ attribution?: components['schemas']['SessionAttribution'];
5255
+ /** @description The spend budget enforced for this session. */
5256
+ budget?: components['schemas']['SessionBudget'];
5193
5257
  /**
5194
5258
  * Client Version
5195
5259
  * @description Version of the client that started the session, if reported.
@@ -5212,29 +5276,8 @@ interface components {
5212
5276
  * @description The "owner/name" repository context the session was started in, if any.
5213
5277
  */
5214
5278
  context_repository?: string | null;
5215
- /**
5216
- * Cost Fee
5217
- * @description Platform fee in millicents.
5218
- * @default 0
5219
- */
5220
- cost_fee: number;
5221
- /**
5222
- * Cost Sandbox Cpu
5223
- * @description Sandbox CPU spend in millicents.
5224
- * @default 0
5225
- */
5226
- cost_sandbox_cpu: number;
5227
- /**
5228
- * Cost Sandbox Memory
5229
- * @description Sandbox memory spend in millicents.
5230
- * @default 0
5231
- */
5232
- cost_sandbox_memory: number;
5233
- /**
5234
- * Cost Tokens
5235
- * @description Token spend in millicents. The session's grand total cost is the sum of cost_tokens, cost_sandbox_cpu, cost_sandbox_memory, and cost_fee.
5236
- */
5237
- cost_tokens: number;
5279
+ /** @description What the session cost, in millicents, broken down by leg and carrying its own total. */
5280
+ cost?: components['schemas']['SessionCost'];
5238
5281
  /**
5239
5282
  * Created At
5240
5283
  * Format: date-time
@@ -5244,7 +5287,7 @@ interface components {
5244
5287
  /** @description How the session's config was resolved from the account's defaults, when no explicit config was given. */
5245
5288
  default_resolution?: components['schemas']['DefaultResolution'] | null;
5246
5289
  /** @description How the session ended; null until it is terminal. */
5247
- exit_status?: components['schemas']['AgentSessionExitStatus'] | null;
5290
+ exit_status?: components['schemas']['SessionExitStatus'] | null;
5248
5291
  /** @description The coding-agent harness the session runs on. */
5249
5292
  harness: components['schemas']['Harness'];
5250
5293
  /**
@@ -5279,14 +5322,9 @@ interface components {
5279
5322
  * Output Prs
5280
5323
  * @description Pull requests the session created or updated.
5281
5324
  */
5282
- output_prs?: components['schemas']['AgentSessionPr'][] | null;
5283
- /** @description How this session relates to its parent session, if any. */
5284
- parent_kind?: components['schemas']['ParentKind'] | null;
5285
- /**
5286
- * Parent Session Id
5287
- * @description Identifier of the parent session that spawned this one, if any.
5288
- */
5289
- parent_session_id?: string | null;
5325
+ output_prs?: components['schemas']['SessionPr'][] | null;
5326
+ /** @description What preceded this session, if anything. */
5327
+ parent?: components['schemas']['SessionParent'];
5290
5328
  /**
5291
5329
  * Prompt
5292
5330
  * @description The per-session prompt the session was started with.
@@ -5294,18 +5332,6 @@ interface components {
5294
5332
  prompt?: string | null;
5295
5333
  /** @description Whether a client may send this session a message and, when it may not, the reason to show instead of a composer. */
5296
5334
  prompting: components['schemas']['SessionPrompting'];
5297
- /**
5298
- * Replayed From Session Id
5299
- * @description Identifier of the original session this one was replayed from, if it was started via replay.
5300
- */
5301
- replayed_from_session_id?: string | null;
5302
- /**
5303
- * Resolved Budget Cents
5304
- * @description The spend budget resolved for this session, in cents.
5305
- */
5306
- resolved_budget_cents: number;
5307
- /** @description Where the resolved budget came from. */
5308
- resolved_budget_source: components['schemas']['BudgetSource'];
5309
5335
  /**
5310
5336
  * Sandbox Id
5311
5337
  * @description Identifier of the sandbox the session runs in, if any.
@@ -5319,76 +5345,107 @@ interface components {
5319
5345
  /** @description Lifecycle state of the durable conversation, or null for sessions without one. */
5320
5346
  session_state?: components['schemas']['SessionState'] | null;
5321
5347
  /** @description Where the session came from (e.g. react, manual, api, cli, mention, cron, laptop). */
5322
- source: components['schemas']['AgentSessionSource'];
5348
+ source: components['schemas']['SessionSource'];
5323
5349
  /** @description Execution status of the session. */
5324
- status: components['schemas']['AgentSessionStatus'];
5350
+ status: components['schemas']['SessionStatus'];
5325
5351
  /**
5326
5352
  * Status Reason
5327
5353
  * @description Human-readable reason for the current status, when there is one.
5328
5354
  */
5329
5355
  status_reason?: string | null;
5356
+ /** @description The stop request, if the session was stopped. */
5357
+ stopped?: components['schemas']['SessionStopped'];
5358
+ /** @description The public status projection; null for laptop-synced sessions. */
5359
+ surface?: components['schemas']['SessionSurface'] | null;
5360
+ /** @description The tokens the session spent and the model they went to. `total` includes the prompt-cache lanes. */
5361
+ tokens?: components['schemas']['SessionTokens'];
5330
5362
  /**
5331
- * Stopped At
5332
- * @description When a stop was requested, if one was.
5363
+ * Updated At
5364
+ * Format: date-time
5365
+ * @description When the session was last updated.
5333
5366
  */
5334
- stopped_at?: string | null;
5367
+ updated_at: string;
5335
5368
  /**
5336
- * Stopped By
5337
- * @description GitHub account id of the user who stopped the session, if known.
5369
+ * Webhook Id
5370
+ * @description Identifier of the webhook event that triggered the session, if any.
5338
5371
  */
5339
- stopped_by?: number | null;
5340
- /** @description The GitHub user who stopped the session, if it was stopped. */
5341
- stopped_by_user?: components['schemas']['GithubAccountSnippet'] | null;
5342
- /** @description The public status projection; null for laptop-synced sessions. */
5343
- surface?: components['schemas']['SessionSurface'] | null;
5372
+ webhook_id?: string | null;
5373
+ /** @description Type of the webhook event that triggered the session, if any. */
5374
+ webhook_type?: components['schemas']['WebhookType'] | null;
5375
+ };
5376
+ /**
5377
+ * SessionAttribution
5378
+ * @description The principal a session is attributed to: what kind, its id, and — when
5379
+ * the kind is a GitHub user — the resolved display snippet.
5380
+ */
5381
+ SessionAttribution: {
5344
5382
  /**
5345
- * Tokens Cache Creation
5346
- * @description Tokens written to the prompt cache.
5347
- * @default 0
5383
+ * Id
5384
+ * @description Identifier of the principal the session is attributed to.
5348
5385
  */
5349
- tokens_cache_creation: number;
5386
+ id?: string | null;
5387
+ /** @description Kind of principal the session is attributed to (e.g. a GitHub user or an API key). */
5388
+ type?: components['schemas']['AttributionType'] | null;
5389
+ /** @description The GitHub user the session is attributed to, resolved at read time. Null when the attribution is not a GitHub user. */
5390
+ user?: components['schemas']['GithubAccountSnippet'] | null;
5391
+ };
5392
+ /**
5393
+ * SessionBudget
5394
+ * @description The spend budget actually enforced for this session, and which layer of
5395
+ * the cascade set it.
5396
+ */
5397
+ SessionBudget: {
5350
5398
  /**
5351
- * Tokens Cache Read
5352
- * @description Tokens read from the prompt cache.
5399
+ * Cents
5400
+ * @description The spend budget resolved for this session, in cents.
5353
5401
  * @default 0
5354
5402
  */
5355
- tokens_cache_read: number;
5403
+ cents: number;
5356
5404
  /**
5357
- * Tokens Input
5358
- * @description Input tokens used.
5359
- * @default 0
5405
+ * @description Where the resolved budget came from.
5406
+ * @default account
5360
5407
  */
5361
- tokens_input: number;
5408
+ source: components['schemas']['BudgetSource'];
5409
+ };
5410
+ /**
5411
+ * SessionCost
5412
+ * @description What a session (or one turn of it) cost, in millicents.
5413
+ *
5414
+ * `llm` is deliberately NOT called `tokens`: it would sit beside the `tokens`
5415
+ * object and read as "the token count's cost" rather than "the cost of the
5416
+ * LLM leg".
5417
+ */
5418
+ SessionCost: {
5362
5419
  /**
5363
- * Tokens Model
5364
- * @description The model the token counts are attributed to.
5420
+ * Fee
5421
+ * @description Platform fee in millicents.
5422
+ * @default 0
5365
5423
  */
5366
- tokens_model: string;
5424
+ fee: number;
5367
5425
  /**
5368
- * Tokens Output
5369
- * @description Output tokens used.
5426
+ * Llm
5427
+ * @description LLM spend in millicents.
5370
5428
  * @default 0
5371
5429
  */
5372
- tokens_output: number;
5430
+ llm: number;
5373
5431
  /**
5374
- * Tokens Total
5375
- * @description Total tokens used by the session.
5432
+ * Sandbox Cpu
5433
+ * @description Sandbox CPU spend in millicents.
5376
5434
  * @default 0
5377
5435
  */
5378
- tokens_total: number;
5436
+ sandbox_cpu: number;
5379
5437
  /**
5380
- * Updated At
5381
- * Format: date-time
5382
- * @description When the session was last updated.
5438
+ * Sandbox Memory
5439
+ * @description Sandbox memory spend in millicents.
5440
+ * @default 0
5383
5441
  */
5384
- updated_at: string;
5442
+ sandbox_memory: number;
5385
5443
  /**
5386
- * Webhook Id
5387
- * @description Identifier of the webhook event that triggered the session, if any.
5444
+ * Total
5445
+ * @description The grand total in millicents: llm + sandbox_cpu + sandbox_memory + fee.
5446
+ * @default 0
5388
5447
  */
5389
- webhook_id?: string | null;
5390
- /** @description Type of the webhook event that triggered the session, if any. */
5391
- webhook_type?: components['schemas']['WebhookType'] | null;
5448
+ total: number;
5392
5449
  };
5393
5450
  /**
5394
5451
  * SessionExecution
@@ -5467,6 +5524,17 @@ interface components {
5467
5524
  */
5468
5525
  executions: components['schemas']['SessionExecution'][];
5469
5526
  };
5527
+ /**
5528
+ * SessionExitStatus
5529
+ * @description Why a terminal agent session ended — a finer-grained reason than `status`.
5530
+ *
5531
+ * `status` (SessionStatus) is the lifecycle state: COMPLETED / ERROR /
5532
+ * CANCELLED. `exit_status` explains *why* a run reached that terminal state, so
5533
+ * the UI and metrics can tell a budget cutoff apart from a crashed tool call or
5534
+ * a deliberate cancellation. It is None until the run reaches a terminal state.
5535
+ * @enum {string}
5536
+ */
5537
+ SessionExitStatus: 'completed' | 'budget_hit' | 'payment_required' | 'tool_call_failed' | 'lifecycle_hook_failed' | 'missing_repo_access' | 'missing_token_permissions' | 'missing_sandbox_variables' | 'cancelled' | 'interrupted' | 'error' | 'stopped';
5470
5538
  /**
5471
5539
  * SessionLiveness
5472
5540
  * @description The durable conversation axis (backs the surfaced `session` field).
@@ -5582,20 +5650,59 @@ interface components {
5582
5650
  */
5583
5651
  SessionMessageStatus: 'pending' | 'delivered';
5584
5652
  /**
5585
- * SessionPrompting
5586
- * @description The prompt-affordance projection. `enabled` answers "would a send work",
5587
- * and when it wouldn't, `blocked_reason` + `detail` say why.
5588
- *
5589
- * `surface_name` is set only for MENTION_SURFACE, naming where to reply.
5653
+ * SessionParent
5654
+ * @description The ONE "preceded-by" chain: the predecessor session and how this one
5655
+ * relates to it. Not a parent that orchestrates children — a session never
5656
+ * spawns sub-sessions.
5590
5657
  */
5591
- SessionPrompting: {
5592
- blocked_reason?: components['schemas']['PromptBlockedReason'] | null;
5593
- /** Detail */
5594
- detail?: string | null;
5595
- /** Enabled */
5596
- enabled: boolean;
5597
- /** Surface Name */
5598
- surface_name?: string | null;
5658
+ SessionParent: {
5659
+ /** @description How this session relates to its parent session, if any. */
5660
+ kind?: components['schemas']['ParentKind'] | null;
5661
+ /**
5662
+ * Replayed From Session Id
5663
+ * @description Identifier of the original session this one was replayed from, if it was started via replay.
5664
+ */
5665
+ replayed_from_session_id?: string | null;
5666
+ /**
5667
+ * Session Id
5668
+ * @description Identifier of the parent session that spawned this one, if any.
5669
+ */
5670
+ session_id?: string | null;
5671
+ };
5672
+ /**
5673
+ * SessionPr
5674
+ * @description A pull request this session created, denormalized at capture time so
5675
+ * session surfaces render a labeled link without joining gh_prs. Live PR
5676
+ * state (open/merged/closed) is not stored here — read it from gh_prs where
5677
+ * a view needs it.
5678
+ */
5679
+ SessionPr: {
5680
+ /** Gh Pr Id */
5681
+ gh_pr_id?: number | null;
5682
+ /** Number */
5683
+ number: number;
5684
+ /** Repo Full Name */
5685
+ repo_full_name: string;
5686
+ /** Title */
5687
+ title?: string | null;
5688
+ /** Url */
5689
+ url: string;
5690
+ };
5691
+ /**
5692
+ * SessionPrompting
5693
+ * @description The prompt-affordance projection. `enabled` answers "would a send work",
5694
+ * and when it wouldn't, `blocked_reason` + `detail` say why.
5695
+ *
5696
+ * `surface_name` is set only for MENTION_SURFACE, naming where to reply.
5697
+ */
5698
+ SessionPrompting: {
5699
+ blocked_reason?: components['schemas']['PromptBlockedReason'] | null;
5700
+ /** Detail */
5701
+ detail?: string | null;
5702
+ /** Enabled */
5703
+ enabled: boolean;
5704
+ /** Surface Name */
5705
+ surface_name?: string | null;
5599
5706
  };
5600
5707
  /**
5601
5708
  * SessionRecord
@@ -5779,16 +5886,45 @@ interface components {
5779
5886
  * @enum {string}
5780
5887
  */
5781
5888
  SessionSearchScope: 'records' | 'recaps' | 'both';
5889
+ /**
5890
+ * SessionSource
5891
+ * @enum {string}
5892
+ */
5893
+ SessionSource: 'react' | 'manual' | 'api' | 'cli' | 'mention' | 'cron' | 'laptop';
5782
5894
  /**
5783
5895
  * SessionState
5784
5896
  * @description Lifecycle of a keyed (multi-turn) session — the durable conversation.
5785
- * Distinct from AgentSessionStatus, which is per-execution (one turn's run) and
5897
+ * Distinct from SessionStatus, which is per-execution (one turn's run) and
5786
5898
  * moves to agent_turns in a later slice. IDLE: alive, waiting for the next
5787
5899
  * message. RUNNING: a turn is executing. CLOSED: the conversation is done and
5788
5900
  * its sandbox/snapshots are torn down.
5789
5901
  * @enum {string}
5790
5902
  */
5791
5903
  SessionState: 'idle' | 'running' | 'closed';
5904
+ /**
5905
+ * SessionStatus
5906
+ * @enum {string}
5907
+ */
5908
+ SessionStatus: 'scheduled' | 'creating_sandbox' | 'running' | 'retrying' | 'completed' | 'error' | 'cancelled' | 'stopped';
5909
+ /**
5910
+ * SessionStopped
5911
+ * @description The stop request, if there was one: when, by which GitHub account id,
5912
+ * and that account resolved to a display snippet.
5913
+ */
5914
+ SessionStopped: {
5915
+ /**
5916
+ * At
5917
+ * @description When a stop was requested, if one was.
5918
+ */
5919
+ at?: string | null;
5920
+ /**
5921
+ * By
5922
+ * @description GitHub account id of the user who stopped the session, if known.
5923
+ */
5924
+ by?: number | null;
5925
+ /** @description The GitHub user who stopped the session, resolved at read time. */
5926
+ by_user?: components['schemas']['GithubAccountSnippet'] | null;
5927
+ };
5792
5928
  /**
5793
5929
  * SessionSurface
5794
5930
  * @description The three fields we expose. All `None` for an un-keyed (laptop) session.
@@ -5803,6 +5939,54 @@ interface components {
5803
5939
  /** Status */
5804
5940
  status: string | null;
5805
5941
  };
5942
+ /**
5943
+ * SessionTokens
5944
+ * @description The token counts a session (or turn) spent, and the model they went to.
5945
+ *
5946
+ * `total` INCLUDES the cache lanes, unlike the old flat `tokens_total` which
5947
+ * counted input+output+thinking only and left callers to add cache reads and
5948
+ * writes back themselves (the deleted `tokensTotalAll` helper). Cache tokens
5949
+ * dominate an agent run's token bill, so a "total" that omits them is the
5950
+ * wrong default and produced two competing totals in the dashboard.
5951
+ */
5952
+ SessionTokens: {
5953
+ /**
5954
+ * Cache Creation
5955
+ * @description Tokens written to the prompt cache.
5956
+ * @default 0
5957
+ */
5958
+ cache_creation: number;
5959
+ /**
5960
+ * Cache Read
5961
+ * @description Tokens read from the prompt cache.
5962
+ * @default 0
5963
+ */
5964
+ cache_read: number;
5965
+ /**
5966
+ * Input
5967
+ * @description Input tokens used.
5968
+ * @default 0
5969
+ */
5970
+ input: number;
5971
+ /**
5972
+ * Model
5973
+ * @description The model the token counts are attributed to.
5974
+ * @default
5975
+ */
5976
+ model: string;
5977
+ /**
5978
+ * Output
5979
+ * @description Output tokens used.
5980
+ * @default 0
5981
+ */
5982
+ output: number;
5983
+ /**
5984
+ * Total
5985
+ * @description Total tokens consumed, INCLUDING the prompt-cache reads and writes — the same basis the token cost is priced on.
5986
+ * @default 0
5987
+ */
5988
+ total: number;
5989
+ };
5806
5990
  /**
5807
5991
  * SessionsListResponse
5808
5992
  * @description A page of sessions in the lean wire shape.
@@ -5958,7 +6142,7 @@ interface components {
5958
6142
  config?: components['schemas']['AgentConfig'] | null;
5959
6143
  /**
5960
6144
  * Config Id
5961
- * @description A saved agent config id to run under.
6145
+ * @description A saved agent config to run under: its id, or the agent's customer-unique `ellipsis.name`.
5962
6146
  */
5963
6147
  config_id?: string | null;
5964
6148
  /**
@@ -5987,6 +6171,13 @@ interface components {
5987
6171
  * @default false
5988
6172
  */
5989
6173
  idle_start: boolean;
6174
+ /**
6175
+ * Input
6176
+ * @description The typed payload for an agent that declares input.json_schema: validated against the effective config's schema (422 on mismatch), rendered into the session's initial message (the agent's input.message template, or a JSON block). Required when the agent declares a schema; rejected when it does not.
6177
+ */
6178
+ input?: {
6179
+ [key: string]: unknown;
6180
+ } | null;
5990
6181
  /**
5991
6182
  * Metadata
5992
6183
  * @description Arbitrary string key/value metadata stored on the session.
@@ -6422,7 +6613,7 @@ interface operations {
6422
6613
  'application/json': components['schemas']['ErrorResponse'];
6423
6614
  };
6424
6615
  };
6425
- /** @description Another agent is already synced from that path, or a file already exists there. */
6616
+ /** @description An agent with that name already exists, another agent is already synced from that path, or a file already exists there. */
6426
6617
  409: {
6427
6618
  headers: {
6428
6619
  [name: string]: unknown;
@@ -6431,13 +6622,13 @@ interface operations {
6431
6622
  'application/json': components['schemas']['ErrorResponse'];
6432
6623
  };
6433
6624
  };
6434
- /** @description Validation Error */
6625
+ /** @description The agent's name contains no usable characters. */
6435
6626
  422: {
6436
6627
  headers: {
6437
6628
  [name: string]: unknown;
6438
6629
  };
6439
6630
  content: {
6440
- 'application/json': components['schemas']['HTTPValidationError'];
6631
+ 'application/json': components['schemas']['ErrorResponse'];
6441
6632
  };
6442
6633
  };
6443
6634
  };
@@ -8726,8 +8917,9 @@ interface operations {
8726
8917
  list_agent_sessions: {
8727
8918
  parameters: {
8728
8919
  query?: {
8920
+ /** @description A saved config id, or the agent's `ellipsis.name`. */
8729
8921
  config_id?: string | null;
8730
- source?: components['schemas']['AgentSessionSource'][] | null;
8922
+ source?: components['schemas']['SessionSource'][] | null;
8731
8923
  days?: number | null;
8732
8924
  start?: string | null;
8733
8925
  end?: string | null;
@@ -8810,7 +9002,7 @@ interface operations {
8810
9002
  'application/json': components['schemas']['StartAgentSessionResponse'];
8811
9003
  };
8812
9004
  };
8813
- /** @description The request combines incompatible fields (multiple config sources, idle_start with prompt/handoff, a handoff with a config source, or both override forms), or the config override / handoff repo/sha is invalid. */
9005
+ /** @description The request combines incompatible fields (multiple config sources, idle_start with prompt/input/handoff, a handoff with a config source, or both override forms), or the config override / handoff repo/sha is invalid. */
8814
9006
  400: {
8815
9007
  headers: {
8816
9008
  [name: string]: unknown;
@@ -8837,7 +9029,7 @@ interface operations {
8837
9029
  'application/json': components['schemas']['ErrorResponse'];
8838
9030
  };
8839
9031
  };
8840
- /** @description The named config, template, or handoff parent session does not exist in your account. */
9032
+ /** @description The named agent, template, or handoff parent session does not exist in your account. */
8841
9033
  404: {
8842
9034
  headers: {
8843
9035
  [name: string]: unknown;
@@ -8855,13 +9047,13 @@ interface operations {
8855
9047
  'application/json': components['schemas']['ErrorResponse'];
8856
9048
  };
8857
9049
  };
8858
- /** @description Validation Error */
9050
+ /** @description The agent requires 'input' matching its input schema (missing or failed validation), or declares no input schema and 'input' was sent. */
8859
9051
  422: {
8860
9052
  headers: {
8861
9053
  [name: string]: unknown;
8862
9054
  };
8863
9055
  content: {
8864
- 'application/json': components['schemas']['HTTPValidationError'];
9056
+ 'application/json': components['schemas']['ErrorResponse'];
8865
9057
  };
8866
9058
  };
8867
9059
  };
@@ -8871,7 +9063,7 @@ interface operations {
8871
9063
  query: {
8872
9064
  q: string;
8873
9065
  scope?: components['schemas']['SessionSearchScope'];
8874
- source?: components['schemas']['AgentSessionSource'][] | null;
9066
+ source?: components['schemas']['SessionSource'][] | null;
8875
9067
  /** @description Attributed GitHub user account ids. */
8876
9068
  author_id?: number[] | null;
8877
9069
  /** @description Saved agent config ids (ORed with author_id). */
@@ -8879,7 +9071,7 @@ interface operations {
8879
9071
  session_ids?: string[] | null;
8880
9072
  /** @description "owner/name" (exact) or a bare repo name. */
8881
9073
  repo?: string | null;
8882
- status?: components['schemas']['AgentSessionStatus'][] | null;
9074
+ status?: components['schemas']['SessionStatus'][] | null;
8883
9075
  start?: string | null;
8884
9076
  end?: string | null;
8885
9077
  limit?: number;
@@ -9130,7 +9322,7 @@ interface operations {
9130
9322
  };
9131
9323
  };
9132
9324
  };
9133
- get_agent_session_ide: {
9325
+ export_agent_session: {
9134
9326
  parameters: {
9135
9327
  query?: never;
9136
9328
  header?: {
@@ -9149,7 +9341,7 @@ interface operations {
9149
9341
  [name: string]: unknown;
9150
9342
  };
9151
9343
  content: {
9152
- 'application/json': components['schemas']['GetSessionIdeResponse'];
9344
+ 'application/json': components['schemas']['GetSessionLogResponse'];
9153
9345
  };
9154
9346
  };
9155
9347
  /** @description The bearer token is missing, invalid, or revoked. */
@@ -9179,15 +9371,6 @@ interface operations {
9179
9371
  'application/json': components['schemas']['ErrorResponse'];
9180
9372
  };
9181
9373
  };
9182
- /** @description The session's sandbox is not running; send it a message to wake it first. */
9183
- 409: {
9184
- headers: {
9185
- [name: string]: unknown;
9186
- };
9187
- content: {
9188
- 'application/json': components['schemas']['ErrorResponse'];
9189
- };
9190
- };
9191
9374
  /** @description Validation Error */
9192
9375
  422: {
9193
9376
  headers: {
@@ -9199,7 +9382,7 @@ interface operations {
9199
9382
  };
9200
9383
  };
9201
9384
  };
9202
- get_agent_session_log: {
9385
+ get_agent_session_ide: {
9203
9386
  parameters: {
9204
9387
  query?: never;
9205
9388
  header?: {
@@ -9218,7 +9401,7 @@ interface operations {
9218
9401
  [name: string]: unknown;
9219
9402
  };
9220
9403
  content: {
9221
- 'application/json': components['schemas']['GetSessionLogResponse'];
9404
+ 'application/json': components['schemas']['GetSessionIdeResponse'];
9222
9405
  };
9223
9406
  };
9224
9407
  /** @description The bearer token is missing, invalid, or revoked. */
@@ -9248,6 +9431,15 @@ interface operations {
9248
9431
  'application/json': components['schemas']['ErrorResponse'];
9249
9432
  };
9250
9433
  };
9434
+ /** @description The session's sandbox is not running; send it a message to wake it first. */
9435
+ 409: {
9436
+ headers: {
9437
+ [name: string]: unknown;
9438
+ };
9439
+ content: {
9440
+ 'application/json': components['schemas']['ErrorResponse'];
9441
+ };
9442
+ };
9251
9443
  /** @description Validation Error */
9252
9444
  422: {
9253
9445
  headers: {
@@ -9341,6 +9533,66 @@ interface operations {
9341
9533
  };
9342
9534
  };
9343
9535
  };
9536
+ get_agent_session_output: {
9537
+ parameters: {
9538
+ query?: never;
9539
+ header?: {
9540
+ 'user-agent'?: string | null;
9541
+ };
9542
+ path: {
9543
+ session_id: string;
9544
+ };
9545
+ cookie?: never;
9546
+ };
9547
+ requestBody?: never;
9548
+ responses: {
9549
+ /** @description The session's typed output, exactly as the agent submitted it — the shape is the agent's own output.json_schema, with no envelope. */
9550
+ 200: {
9551
+ headers: {
9552
+ [name: string]: unknown;
9553
+ };
9554
+ content: {
9555
+ 'application/json': Record<string, never>;
9556
+ };
9557
+ };
9558
+ /** @description The bearer token is missing, invalid, or revoked. */
9559
+ 401: {
9560
+ headers: {
9561
+ [name: string]: unknown;
9562
+ };
9563
+ content: {
9564
+ 'application/json': components['schemas']['ErrorResponse'];
9565
+ };
9566
+ };
9567
+ /** @description The credential may not perform this action, or the account is blocked. */
9568
+ 403: {
9569
+ headers: {
9570
+ [name: string]: unknown;
9571
+ };
9572
+ content: {
9573
+ 'application/json': components['schemas']['ErrorResponse'];
9574
+ };
9575
+ };
9576
+ /** @description No such session in your account, the agent declares no output schema, the session has not completed, or it produced no output. */
9577
+ 404: {
9578
+ headers: {
9579
+ [name: string]: unknown;
9580
+ };
9581
+ content: {
9582
+ 'application/json': components['schemas']['ErrorResponse'];
9583
+ };
9584
+ };
9585
+ /** @description Validation Error */
9586
+ 422: {
9587
+ headers: {
9588
+ [name: string]: unknown;
9589
+ };
9590
+ content: {
9591
+ 'application/json': components['schemas']['HTTPValidationError'];
9592
+ };
9593
+ };
9594
+ };
9595
+ };
9344
9596
  get_agent_session_port: {
9345
9597
  parameters: {
9346
9598
  query?: never;
@@ -9759,6 +10011,10 @@ type AttributionType = 'github_user' | 'linear_user' | 'slack_user' | 'api_key';
9759
10011
  */
9760
10012
  type SessionMessageStatus = 'pending' | 'delivered';
9761
10013
  type GithubAccountType = 'User' | 'Organization' | 'Bot' | 'Mannequin';
10014
+ /**
10015
+ * Where the resolved budget came from.
10016
+ */
10017
+ type BudgetSource = 'system' | 'account' | 'config' | 'run';
9762
10018
  /**
9763
10019
  * How a session that arrived with no explicit config source resolved its
9764
10020
  * config (documents/eng/DEFAULT_CONFIGS.md §4). Persisted on the session so
@@ -9770,12 +10026,12 @@ type DefaultResolution = 'repo_default' | 'account_default' | 'none';
9770
10026
  /**
9771
10027
  * Why a terminal agent session ended — a finer-grained reason than `status`.
9772
10028
  *
9773
- * `status` (AgentSessionStatus) is the lifecycle state: COMPLETED / ERROR /
10029
+ * `status` (SessionStatus) is the lifecycle state: COMPLETED / ERROR /
9774
10030
  * CANCELLED. `exit_status` explains *why* a run reached that terminal state, so
9775
10031
  * the UI and metrics can tell a budget cutoff apart from a crashed tool call or
9776
10032
  * a deliberate cancellation. It is None until the run reaches a terminal state.
9777
10033
  */
9778
- type AgentSessionExitStatus = 'completed' | 'budget_hit' | 'payment_required' | 'tool_call_failed' | 'lifecycle_hook_failed' | 'missing_repo_access' | 'missing_token_permissions' | 'missing_sandbox_variables' | 'cancelled' | 'interrupted' | 'error' | 'stopped';
10034
+ type SessionExitStatus = 'completed' | 'budget_hit' | 'payment_required' | 'tool_call_failed' | 'lifecycle_hook_failed' | 'missing_repo_access' | 'missing_token_permissions' | 'missing_sandbox_variables' | 'cancelled' | 'interrupted' | 'error' | 'stopped';
9779
10035
  /**
9780
10036
  * The coding-agent harness the session runs on.
9781
10037
  */
@@ -9797,13 +10053,9 @@ type ParentKind = 'continuation' | 'handoff' | 'resume';
9797
10053
  * Why direct prompting is refused. Absent when prompting is allowed.
9798
10054
  */
9799
10055
  type PromptBlockedReason = 'mention_surface' | 'ephemeral_trigger' | 'non_interactive' | 'harness_single_turn' | 'closed' | 'laptop';
9800
- /**
9801
- * Where the resolved budget came from.
9802
- */
9803
- type BudgetSource = 'system' | 'account' | 'config' | 'run';
9804
10056
  /**
9805
10057
  * Lifecycle of a keyed (multi-turn) session — the durable conversation.
9806
- * Distinct from AgentSessionStatus, which is per-execution (one turn's run) and
10058
+ * Distinct from SessionStatus, which is per-execution (one turn's run) and
9807
10059
  * moves to agent_turns in a later slice. IDLE: alive, waiting for the next
9808
10060
  * message. RUNNING: a turn is executing. CLOSED: the conversation is done and
9809
10061
  * its sandbox/snapshots are torn down.
@@ -9812,11 +10064,11 @@ type SessionState = 'idle' | 'running' | 'closed';
9812
10064
  /**
9813
10065
  * Where the session came from (e.g. react, manual, api, cli, mention, cron, laptop).
9814
10066
  */
9815
- type AgentSessionSource = 'react' | 'manual' | 'api' | 'cli' | 'mention' | 'cron' | 'laptop';
10067
+ type SessionSource = 'react' | 'manual' | 'api' | 'cli' | 'mention' | 'cron' | 'laptop';
9816
10068
  /**
9817
10069
  * Execution status of the session.
9818
10070
  */
9819
- type AgentSessionStatus = 'scheduled' | 'creating_sandbox' | 'running' | 'retrying' | 'completed' | 'error' | 'cancelled' | 'stopped';
10071
+ type SessionStatus = 'scheduled' | 'creating_sandbox' | 'running' | 'retrying' | 'completed' | 'error' | 'cancelled' | 'stopped';
9820
10072
  /**
9821
10073
  * What the current (or most recent) execution is doing (backs `run`).
9822
10074
  */
@@ -9897,18 +10149,8 @@ interface SessionMessage {
9897
10149
  * The session's current state.
9898
10150
  */
9899
10151
  interface Session {
9900
- /**
9901
- * The GitHub user the session is attributed to, when the attribution is a GitHub user.
9902
- */
9903
- attributed_user: GithubAccountSnippet | null;
9904
- /**
9905
- * Identifier of the principal the session is attributed to.
9906
- */
9907
- attribution_id: string | null;
9908
- /**
9909
- * Kind of principal the session is attributed to (e.g. a GitHub user or an API key).
9910
- */
9911
- attribution_type: AttributionType | null;
10152
+ attribution: SessionAttribution;
10153
+ budget: SessionBudget;
9912
10154
  /**
9913
10155
  * Version of the client that started the session, if reported.
9914
10156
  */
@@ -9927,22 +10169,7 @@ interface Session {
9927
10169
  * The "owner/name" repository context the session was started in, if any.
9928
10170
  */
9929
10171
  context_repository: string | null;
9930
- /**
9931
- * Platform fee in millicents.
9932
- */
9933
- cost_fee: number;
9934
- /**
9935
- * Sandbox CPU spend in millicents.
9936
- */
9937
- cost_sandbox_cpu: number;
9938
- /**
9939
- * Sandbox memory spend in millicents.
9940
- */
9941
- cost_sandbox_memory: number;
9942
- /**
9943
- * Token spend in millicents. The session's grand total cost is the sum of cost_tokens, cost_sandbox_cpu, cost_sandbox_memory, and cost_fee.
9944
- */
9945
- cost_tokens: number;
10172
+ cost: SessionCost;
9946
10173
  /**
9947
10174
  * When the session was created.
9948
10175
  */
@@ -9954,7 +10181,7 @@ interface Session {
9954
10181
  /**
9955
10182
  * How the session ended; null until it is terminal.
9956
10183
  */
9957
- exit_status: AgentSessionExitStatus | null;
10184
+ exit_status: SessionExitStatus | null;
9958
10185
  harness: Harness;
9959
10186
  /**
9960
10187
  * Unique identifier of the session.
@@ -9981,29 +10208,13 @@ interface Session {
9981
10208
  /**
9982
10209
  * Pull requests the session created or updated.
9983
10210
  */
9984
- output_prs: AgentSessionPr[] | null;
9985
- /**
9986
- * How this session relates to its parent session, if any.
9987
- */
9988
- parent_kind: ParentKind | null;
9989
- /**
9990
- * Identifier of the parent session that spawned this one, if any.
9991
- */
9992
- parent_session_id: string | null;
10211
+ output_prs: SessionPr[] | null;
10212
+ parent: SessionParent;
9993
10213
  /**
9994
10214
  * The per-session prompt the session was started with.
9995
10215
  */
9996
10216
  prompt: string | null;
9997
10217
  prompting: SessionPrompting;
9998
- /**
9999
- * Identifier of the original session this one was replayed from, if it was started via replay.
10000
- */
10001
- replayed_from_session_id: string | null;
10002
- /**
10003
- * The spend budget resolved for this session, in cents.
10004
- */
10005
- resolved_budget_cents: number;
10006
- resolved_budget_source: BudgetSource;
10007
10218
  /**
10008
10219
  * Identifier of the sandbox the session runs in, if any.
10009
10220
  */
@@ -10016,52 +10227,18 @@ interface Session {
10016
10227
  * Lifecycle state of the durable conversation, or null for sessions without one.
10017
10228
  */
10018
10229
  session_state: SessionState | null;
10019
- source: AgentSessionSource;
10020
- status: AgentSessionStatus;
10230
+ source: SessionSource;
10231
+ status: SessionStatus;
10021
10232
  /**
10022
10233
  * Human-readable reason for the current status, when there is one.
10023
10234
  */
10024
10235
  status_reason: string | null;
10025
- /**
10026
- * When a stop was requested, if one was.
10027
- */
10028
- stopped_at: string | null;
10029
- /**
10030
- * GitHub account id of the user who stopped the session, if known.
10031
- */
10032
- stopped_by: number | null;
10033
- /**
10034
- * The GitHub user who stopped the session, if it was stopped.
10035
- */
10036
- stopped_by_user: GithubAccountSnippet | null;
10236
+ stopped: SessionStopped;
10037
10237
  /**
10038
10238
  * The public status projection; null for laptop-synced sessions.
10039
10239
  */
10040
10240
  surface: SessionSurface | null;
10041
- /**
10042
- * Tokens written to the prompt cache.
10043
- */
10044
- tokens_cache_creation: number;
10045
- /**
10046
- * Tokens read from the prompt cache.
10047
- */
10048
- tokens_cache_read: number;
10049
- /**
10050
- * Input tokens used.
10051
- */
10052
- tokens_input: number;
10053
- /**
10054
- * The model the token counts are attributed to.
10055
- */
10056
- tokens_model: string;
10057
- /**
10058
- * Output tokens used.
10059
- */
10060
- tokens_output: number;
10061
- /**
10062
- * Total tokens used by the session.
10063
- */
10064
- tokens_total: number;
10241
+ tokens: SessionTokens;
10065
10242
  /**
10066
10243
  * When the session was last updated.
10067
10244
  */
@@ -10075,6 +10252,23 @@ interface Session {
10075
10252
  */
10076
10253
  webhook_type: WebhookType | null;
10077
10254
  }
10255
+ /**
10256
+ * The principal this session is attributed to.
10257
+ */
10258
+ interface SessionAttribution {
10259
+ /**
10260
+ * Identifier of the principal the session is attributed to.
10261
+ */
10262
+ id: string | null;
10263
+ /**
10264
+ * Kind of principal the session is attributed to (e.g. a GitHub user or an API key).
10265
+ */
10266
+ type: AttributionType | null;
10267
+ /**
10268
+ * The GitHub user the session is attributed to, resolved at read time. Null when the attribution is not a GitHub user.
10269
+ */
10270
+ user: GithubAccountSnippet | null;
10271
+ }
10078
10272
  /**
10079
10273
  * Sometimes the GitHub API returns a user of github (can include bots)
10080
10274
  * using this snippet instead of the full GithubAccount model. One example,
@@ -10088,18 +10282,70 @@ interface GithubAccountSnippet {
10088
10282
  login: string;
10089
10283
  type: GithubAccountType;
10090
10284
  }
10285
+ /**
10286
+ * The spend budget enforced for this session.
10287
+ */
10288
+ interface SessionBudget {
10289
+ /**
10290
+ * The spend budget resolved for this session, in cents.
10291
+ */
10292
+ cents: number;
10293
+ source: BudgetSource;
10294
+ }
10295
+ /**
10296
+ * What the session cost, in millicents, broken down by leg and carrying its own total.
10297
+ */
10298
+ interface SessionCost {
10299
+ /**
10300
+ * Platform fee in millicents.
10301
+ */
10302
+ fee: number;
10303
+ /**
10304
+ * LLM spend in millicents.
10305
+ */
10306
+ llm: number;
10307
+ /**
10308
+ * Sandbox CPU spend in millicents.
10309
+ */
10310
+ sandbox_cpu: number;
10311
+ /**
10312
+ * Sandbox memory spend in millicents.
10313
+ */
10314
+ sandbox_memory: number;
10315
+ /**
10316
+ * The grand total in millicents: llm + sandbox_cpu + sandbox_memory + fee.
10317
+ */
10318
+ total: number;
10319
+ }
10091
10320
  /**
10092
10321
  * A pull request this session created, denormalized at capture time so
10093
10322
  * session surfaces render a labeled link without joining gh_prs. Live PR
10094
10323
  * state (open/merged/closed) is not stored here — read it from gh_prs where
10095
10324
  * a view needs it.
10096
10325
  */
10097
- interface AgentSessionPr {
10326
+ interface SessionPr {
10098
10327
  gh_pr_id: number | null;
10099
10328
  number: number;
10100
10329
  repo_full_name: string;
10101
10330
  url: string;
10102
10331
  }
10332
+ /**
10333
+ * What preceded this session, if anything.
10334
+ */
10335
+ interface SessionParent {
10336
+ /**
10337
+ * How this session relates to its parent session, if any.
10338
+ */
10339
+ kind: ParentKind | null;
10340
+ /**
10341
+ * Identifier of the original session this one was replayed from, if it was started via replay.
10342
+ */
10343
+ replayed_from_session_id: string | null;
10344
+ /**
10345
+ * Identifier of the parent session that spawned this one, if any.
10346
+ */
10347
+ session_id: string | null;
10348
+ }
10103
10349
  /**
10104
10350
  * Whether a client may send this session a message and, when it may not, the reason to show instead of a composer.
10105
10351
  */
@@ -10109,6 +10355,23 @@ interface SessionPrompting {
10109
10355
  enabled: boolean;
10110
10356
  surface_name: string | null;
10111
10357
  }
10358
+ /**
10359
+ * The stop request, if the session was stopped.
10360
+ */
10361
+ interface SessionStopped {
10362
+ /**
10363
+ * When a stop was requested, if one was.
10364
+ */
10365
+ at: string | null;
10366
+ /**
10367
+ * GitHub account id of the user who stopped the session, if known.
10368
+ */
10369
+ by: number | null;
10370
+ /**
10371
+ * The GitHub user who stopped the session, resolved at read time.
10372
+ */
10373
+ by_user: GithubAccountSnippet | null;
10374
+ }
10112
10375
  /**
10113
10376
  * The three fields we expose. All `None` for an un-keyed (laptop) session.
10114
10377
  *
@@ -10121,6 +10384,35 @@ interface SessionSurface {
10121
10384
  session: SessionLiveness | null;
10122
10385
  status: string | null;
10123
10386
  }
10387
+ /**
10388
+ * The tokens the session spent and the model they went to. `total` includes the prompt-cache lanes.
10389
+ */
10390
+ interface SessionTokens {
10391
+ /**
10392
+ * Tokens written to the prompt cache.
10393
+ */
10394
+ cache_creation: number;
10395
+ /**
10396
+ * Tokens read from the prompt cache.
10397
+ */
10398
+ cache_read: number;
10399
+ /**
10400
+ * Input tokens used.
10401
+ */
10402
+ input: number;
10403
+ /**
10404
+ * The model the token counts are attributed to.
10405
+ */
10406
+ model: string;
10407
+ /**
10408
+ * Output tokens used.
10409
+ */
10410
+ output: number;
10411
+ /**
10412
+ * Total tokens consumed, INCLUDING the prompt-cache reads and writes — the same basis the token cost is priced on.
10413
+ */
10414
+ total: number;
10415
+ }
10124
10416
  /**
10125
10417
  * Cursored append-only delivery of session records, ordered by feed_seq,
10126
10418
  * from all sources. Every record in the frame advances the resume cursor —
@@ -10238,18 +10530,8 @@ interface SessionFrame {
10238
10530
  * The session's current state.
10239
10531
  */
10240
10532
  interface Session1 {
10241
- /**
10242
- * The GitHub user the session is attributed to, when the attribution is a GitHub user.
10243
- */
10244
- attributed_user: GithubAccountSnippet | null;
10245
- /**
10246
- * Identifier of the principal the session is attributed to.
10247
- */
10248
- attribution_id: string | null;
10249
- /**
10250
- * Kind of principal the session is attributed to (e.g. a GitHub user or an API key).
10251
- */
10252
- attribution_type: AttributionType | null;
10533
+ attribution: SessionAttribution;
10534
+ budget: SessionBudget;
10253
10535
  /**
10254
10536
  * Version of the client that started the session, if reported.
10255
10537
  */
@@ -10268,22 +10550,7 @@ interface Session1 {
10268
10550
  * The "owner/name" repository context the session was started in, if any.
10269
10551
  */
10270
10552
  context_repository: string | null;
10271
- /**
10272
- * Platform fee in millicents.
10273
- */
10274
- cost_fee: number;
10275
- /**
10276
- * Sandbox CPU spend in millicents.
10277
- */
10278
- cost_sandbox_cpu: number;
10279
- /**
10280
- * Sandbox memory spend in millicents.
10281
- */
10282
- cost_sandbox_memory: number;
10283
- /**
10284
- * Token spend in millicents. The session's grand total cost is the sum of cost_tokens, cost_sandbox_cpu, cost_sandbox_memory, and cost_fee.
10285
- */
10286
- cost_tokens: number;
10553
+ cost: SessionCost;
10287
10554
  /**
10288
10555
  * When the session was created.
10289
10556
  */
@@ -10295,7 +10562,7 @@ interface Session1 {
10295
10562
  /**
10296
10563
  * How the session ended; null until it is terminal.
10297
10564
  */
10298
- exit_status: AgentSessionExitStatus | null;
10565
+ exit_status: SessionExitStatus | null;
10299
10566
  harness: Harness;
10300
10567
  /**
10301
10568
  * Unique identifier of the session.
@@ -10322,29 +10589,13 @@ interface Session1 {
10322
10589
  /**
10323
10590
  * Pull requests the session created or updated.
10324
10591
  */
10325
- output_prs: AgentSessionPr[] | null;
10326
- /**
10327
- * How this session relates to its parent session, if any.
10328
- */
10329
- parent_kind: ParentKind | null;
10330
- /**
10331
- * Identifier of the parent session that spawned this one, if any.
10332
- */
10333
- parent_session_id: string | null;
10592
+ output_prs: SessionPr[] | null;
10593
+ parent: SessionParent;
10334
10594
  /**
10335
10595
  * The per-session prompt the session was started with.
10336
10596
  */
10337
10597
  prompt: string | null;
10338
10598
  prompting: SessionPrompting;
10339
- /**
10340
- * Identifier of the original session this one was replayed from, if it was started via replay.
10341
- */
10342
- replayed_from_session_id: string | null;
10343
- /**
10344
- * The spend budget resolved for this session, in cents.
10345
- */
10346
- resolved_budget_cents: number;
10347
- resolved_budget_source: BudgetSource;
10348
10599
  /**
10349
10600
  * Identifier of the sandbox the session runs in, if any.
10350
10601
  */
@@ -10357,52 +10608,18 @@ interface Session1 {
10357
10608
  * Lifecycle state of the durable conversation, or null for sessions without one.
10358
10609
  */
10359
10610
  session_state: SessionState | null;
10360
- source: AgentSessionSource;
10361
- status: AgentSessionStatus;
10611
+ source: SessionSource;
10612
+ status: SessionStatus;
10362
10613
  /**
10363
10614
  * Human-readable reason for the current status, when there is one.
10364
10615
  */
10365
10616
  status_reason: string | null;
10366
- /**
10367
- * When a stop was requested, if one was.
10368
- */
10369
- stopped_at: string | null;
10370
- /**
10371
- * GitHub account id of the user who stopped the session, if known.
10372
- */
10373
- stopped_by: number | null;
10374
- /**
10375
- * The GitHub user who stopped the session, if it was stopped.
10376
- */
10377
- stopped_by_user: GithubAccountSnippet | null;
10617
+ stopped: SessionStopped;
10378
10618
  /**
10379
10619
  * The public status projection; null for laptop-synced sessions.
10380
10620
  */
10381
10621
  surface: SessionSurface | null;
10382
- /**
10383
- * Tokens written to the prompt cache.
10384
- */
10385
- tokens_cache_creation: number;
10386
- /**
10387
- * Tokens read from the prompt cache.
10388
- */
10389
- tokens_cache_read: number;
10390
- /**
10391
- * Input tokens used.
10392
- */
10393
- tokens_input: number;
10394
- /**
10395
- * The model the token counts are attributed to.
10396
- */
10397
- tokens_model: string;
10398
- /**
10399
- * Output tokens used.
10400
- */
10401
- tokens_output: number;
10402
- /**
10403
- * Total tokens used by the session.
10404
- */
10405
- tokens_total: number;
10622
+ tokens: SessionTokens;
10406
10623
  /**
10407
10624
  * When the session was last updated.
10408
10625
  */
@@ -10495,4 +10712,4 @@ type ReviewRequester = components['schemas']['ReviewRequester'];
10495
10712
  type ReviewFinding = components['schemas']['ReviewFinding'];
10496
10713
  type Finding = ReviewFinding;
10497
10714
 
10498
- export type { AgentSessionExitStatus as A, BudgetSource as B, CreateReviewRequest as C, DefaultResolution as D, ErrorFrame as E, Finding as F, GithubAccountSnippet as G, Harness as H, SessionMessage as I, SessionMessageResponse as J, SessionMessageStatus as K, SessionPrompting as L, SessionRecord as M, SessionRecordsListResponse as N, SessionResponse as O, ParentKind as P, SessionState as Q, RecordsAppendFrame as R, SendSessionMessageRequest as S, SessionStreamFrame as T, SessionSurface as U, SessionsListResponse as V, SnapshotFrame as W, StreamFrame as X, TokensInfo as Y, paths as Z, AgentSessionPr as a, AgentSessionSource as b, components as c, AgentSessionStatus as d, AttributionType as e, DeltaFrame as f, DoneFrame as g, GithubAccountType as h, HeartbeatFrame as i, PromptBlockedReason as j, ResolvedReviewScope as k, Review as l, ReviewConfiguration as m, ReviewCounters as n, ReviewFinding as o, ReviewRequester as p, ReviewScope as q, ReviewScopeKind as r, ReviewStage as s, ReviewedCommit as t, ReviewsListResponse as u, Session as v, SessionExecution as w, SessionExecutionsListResponse as x, SessionFrame as y, SessionLiveness as z };
10715
+ export type { AttributionType as A, BudgetSource as B, CreateReviewRequest as C, DefaultResolution as D, ErrorFrame as E, Finding as F, GithubAccountSnippet as G, Harness as H, SessionPr as I, SessionPrompting as J, SessionRecord as K, SessionRecordsListResponse as L, SessionResponse as M, SessionSource as N, SessionState as O, ParentKind as P, SessionStatus as Q, RecordsAppendFrame as R, SendSessionMessageRequest as S, SessionStreamFrame as T, SessionSurface as U, SessionsListResponse as V, SnapshotFrame as W, StreamFrame as X, TokensInfo as Y, paths as Z, DeltaFrame as a, DoneFrame as b, components as c, GithubAccountType as d, HeartbeatFrame as e, PromptBlockedReason as f, ResolvedReviewScope as g, Review as h, ReviewConfiguration as i, ReviewCounters as j, ReviewFinding as k, ReviewRequester as l, ReviewScope as m, ReviewScopeKind as n, ReviewStage as o, ReviewedCommit as p, ReviewsListResponse as q, Session as r, SessionExecution as s, SessionExecutionsListResponse as t, SessionExitStatus as u, SessionFrame as v, SessionLiveness as w, SessionMessage as x, SessionMessageResponse as y, SessionMessageStatus as z };