@ellipsis-dev/sdk 0.9.0 → 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.
@@ -1446,6 +1446,17 @@ interface components {
1446
1446
  */
1447
1447
  version: string;
1448
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
+ };
1449
1460
  /**
1450
1461
  * AgentConfigEnvironment
1451
1462
  * @description Everything about the environment (the sandbox) the agent runs in: which
@@ -1698,10 +1709,11 @@ interface components {
1698
1709
  *
1699
1710
  * `ellipsis` scopes the sandbox's Ellipsis API token
1700
1711
  * (`ELLIPSIS_API_TOKEN`, what the in-sandbox `agent` CLI authenticates
1701
- * with). Only full access exists today — `true` or the string `all`, both
1702
- * meaning the token may call any Ellipsis API a sandbox token can. The key
1703
- * is declarative for now; it reserves the spot for narrowing later, and
1704
- * 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.
1705
1717
  *
1706
1718
  * `github` scopes the sandbox's GitHub installation token (`GH_TOKEN`) —
1707
1719
  * see `AgentConfigGithubPermissions`. GitHub enforces it at mint time.
@@ -1710,9 +1722,8 @@ interface components {
1710
1722
  /**
1711
1723
  * Ellipsis
1712
1724
  * @default true
1713
- * @enum {unknown}
1714
1725
  */
1715
- ellipsis: true | 'all';
1726
+ ellipsis: (true | 'all') | components['schemas']['AgentConfigEllipsisPermissions'];
1716
1727
  /** @default {} */
1717
1728
  github: components['schemas']['AgentConfigGithubPermissions'];
1718
1729
  };
@@ -2656,6 +2667,17 @@ interface components {
2656
2667
  * @enum {string}
2657
2668
  */
2658
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
+ };
2659
2681
  /** ErrorInfo */
2660
2682
  ErrorInfo: {
2661
2683
  /**
@@ -3345,6 +3367,14 @@ interface components {
3345
3367
  */
3346
3368
  cloud_id: string;
3347
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';
3348
3378
  /**
3349
3379
  * LinearIntegrationSummary
3350
3380
  * @description The account's connected Linear organization and its teams.
@@ -4255,6 +4285,14 @@ interface components {
4255
4285
  /** Watermark */
4256
4286
  watermark: string | null;
4257
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';
4258
4296
  /**
4259
4297
  * Review
4260
4298
  * @description One code review: one pipeline iteration over one commit range of a pull
@@ -5212,15 +5250,10 @@ interface components {
5212
5250
  * disagree about what a session looks like.
5213
5251
  */
5214
5252
  Session: {
5215
- /** @description The GitHub user the session is attributed to, when the attribution is a GitHub user. */
5216
- attributed_user?: components['schemas']['GithubAccountSnippet'] | null;
5217
- /**
5218
- * Attribution Id
5219
- * @description Identifier of the principal the session is attributed to.
5220
- */
5221
- attribution_id?: string | null;
5222
- /** @description Kind of principal the session is attributed to (e.g. a GitHub user or an API key). */
5223
- 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'];
5224
5257
  /**
5225
5258
  * Client Version
5226
5259
  * @description Version of the client that started the session, if reported.
@@ -5243,29 +5276,8 @@ interface components {
5243
5276
  * @description The "owner/name" repository context the session was started in, if any.
5244
5277
  */
5245
5278
  context_repository?: string | null;
5246
- /**
5247
- * Cost Fee
5248
- * @description Platform fee in millicents.
5249
- * @default 0
5250
- */
5251
- cost_fee: number;
5252
- /**
5253
- * Cost Sandbox Cpu
5254
- * @description Sandbox CPU spend in millicents.
5255
- * @default 0
5256
- */
5257
- cost_sandbox_cpu: number;
5258
- /**
5259
- * Cost Sandbox Memory
5260
- * @description Sandbox memory spend in millicents.
5261
- * @default 0
5262
- */
5263
- cost_sandbox_memory: number;
5264
- /**
5265
- * Cost Tokens
5266
- * @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.
5267
- */
5268
- 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'];
5269
5281
  /**
5270
5282
  * Created At
5271
5283
  * Format: date-time
@@ -5311,13 +5323,8 @@ interface components {
5311
5323
  * @description Pull requests the session created or updated.
5312
5324
  */
5313
5325
  output_prs?: components['schemas']['SessionPr'][] | null;
5314
- /** @description How this session relates to its parent session, if any. */
5315
- parent_kind?: components['schemas']['ParentKind'] | null;
5316
- /**
5317
- * Parent Session Id
5318
- * @description Identifier of the parent session that spawned this one, if any.
5319
- */
5320
- parent_session_id?: string | null;
5326
+ /** @description What preceded this session, if anything. */
5327
+ parent?: components['schemas']['SessionParent'];
5321
5328
  /**
5322
5329
  * Prompt
5323
5330
  * @description The per-session prompt the session was started with.
@@ -5325,18 +5332,6 @@ interface components {
5325
5332
  prompt?: string | null;
5326
5333
  /** @description Whether a client may send this session a message and, when it may not, the reason to show instead of a composer. */
5327
5334
  prompting: components['schemas']['SessionPrompting'];
5328
- /**
5329
- * Replayed From Session Id
5330
- * @description Identifier of the original session this one was replayed from, if it was started via replay.
5331
- */
5332
- replayed_from_session_id?: string | null;
5333
- /**
5334
- * Resolved Budget Cents
5335
- * @description The spend budget resolved for this session, in cents.
5336
- */
5337
- resolved_budget_cents: number;
5338
- /** @description Where the resolved budget came from. */
5339
- resolved_budget_source: components['schemas']['BudgetSource'];
5340
5335
  /**
5341
5336
  * Sandbox Id
5342
5337
  * @description Identifier of the sandbox the session runs in, if any.
@@ -5358,68 +5353,99 @@ interface components {
5358
5353
  * @description Human-readable reason for the current status, when there is one.
5359
5354
  */
5360
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'];
5361
5362
  /**
5362
- * Stopped At
5363
- * @description When a stop was requested, if one was.
5363
+ * Updated At
5364
+ * Format: date-time
5365
+ * @description When the session was last updated.
5364
5366
  */
5365
- stopped_at?: string | null;
5367
+ updated_at: string;
5366
5368
  /**
5367
- * Stopped By
5368
- * @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.
5369
5371
  */
5370
- stopped_by?: number | null;
5371
- /** @description The GitHub user who stopped the session, if it was stopped. */
5372
- stopped_by_user?: components['schemas']['GithubAccountSnippet'] | null;
5373
- /** @description The public status projection; null for laptop-synced sessions. */
5374
- 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: {
5375
5382
  /**
5376
- * Tokens Cache Creation
5377
- * @description Tokens written to the prompt cache.
5378
- * @default 0
5383
+ * Id
5384
+ * @description Identifier of the principal the session is attributed to.
5379
5385
  */
5380
- 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: {
5381
5398
  /**
5382
- * Tokens Cache Read
5383
- * @description Tokens read from the prompt cache.
5399
+ * Cents
5400
+ * @description The spend budget resolved for this session, in cents.
5384
5401
  * @default 0
5385
5402
  */
5386
- tokens_cache_read: number;
5403
+ cents: number;
5387
5404
  /**
5388
- * Tokens Input
5389
- * @description Input tokens used.
5390
- * @default 0
5405
+ * @description Where the resolved budget came from.
5406
+ * @default account
5391
5407
  */
5392
- 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: {
5393
5419
  /**
5394
- * Tokens Model
5395
- * @description The model the token counts are attributed to.
5420
+ * Fee
5421
+ * @description Platform fee in millicents.
5422
+ * @default 0
5396
5423
  */
5397
- tokens_model: string;
5424
+ fee: number;
5398
5425
  /**
5399
- * Tokens Output
5400
- * @description Output tokens used.
5426
+ * Llm
5427
+ * @description LLM spend in millicents.
5401
5428
  * @default 0
5402
5429
  */
5403
- tokens_output: number;
5430
+ llm: number;
5404
5431
  /**
5405
- * Tokens Total
5406
- * @description Total tokens used by the session.
5432
+ * Sandbox Cpu
5433
+ * @description Sandbox CPU spend in millicents.
5407
5434
  * @default 0
5408
5435
  */
5409
- tokens_total: number;
5436
+ sandbox_cpu: number;
5410
5437
  /**
5411
- * Updated At
5412
- * Format: date-time
5413
- * @description When the session was last updated.
5438
+ * Sandbox Memory
5439
+ * @description Sandbox memory spend in millicents.
5440
+ * @default 0
5414
5441
  */
5415
- updated_at: string;
5442
+ sandbox_memory: number;
5416
5443
  /**
5417
- * Webhook Id
5418
- * @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
5419
5447
  */
5420
- webhook_id?: string | null;
5421
- /** @description Type of the webhook event that triggered the session, if any. */
5422
- webhook_type?: components['schemas']['WebhookType'] | null;
5448
+ total: number;
5423
5449
  };
5424
5450
  /**
5425
5451
  * SessionExecution
@@ -5623,6 +5649,26 @@ interface components {
5623
5649
  * @enum {string}
5624
5650
  */
5625
5651
  SessionMessageStatus: 'pending' | 'delivered';
5652
+ /**
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.
5657
+ */
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
+ };
5626
5672
  /**
5627
5673
  * SessionPr
5628
5674
  * @description A pull request this session created, denormalized at capture time so
@@ -5860,6 +5906,25 @@ interface components {
5860
5906
  * @enum {string}
5861
5907
  */
5862
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
+ };
5863
5928
  /**
5864
5929
  * SessionSurface
5865
5930
  * @description The three fields we expose. All `None` for an un-keyed (laptop) session.
@@ -5874,6 +5939,54 @@ interface components {
5874
5939
  /** Status */
5875
5940
  status: string | null;
5876
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
+ };
5877
5990
  /**
5878
5991
  * SessionsListResponse
5879
5992
  * @description A page of sessions in the lean wire shape.
@@ -9898,6 +10011,10 @@ type AttributionType = 'github_user' | 'linear_user' | 'slack_user' | 'api_key';
9898
10011
  */
9899
10012
  type SessionMessageStatus = 'pending' | 'delivered';
9900
10013
  type GithubAccountType = 'User' | 'Organization' | 'Bot' | 'Mannequin';
10014
+ /**
10015
+ * Where the resolved budget came from.
10016
+ */
10017
+ type BudgetSource = 'system' | 'account' | 'config' | 'run';
9901
10018
  /**
9902
10019
  * How a session that arrived with no explicit config source resolved its
9903
10020
  * config (documents/eng/DEFAULT_CONFIGS.md §4). Persisted on the session so
@@ -9936,10 +10053,6 @@ type ParentKind = 'continuation' | 'handoff' | 'resume';
9936
10053
  * Why direct prompting is refused. Absent when prompting is allowed.
9937
10054
  */
9938
10055
  type PromptBlockedReason = 'mention_surface' | 'ephemeral_trigger' | 'non_interactive' | 'harness_single_turn' | 'closed' | 'laptop';
9939
- /**
9940
- * Where the resolved budget came from.
9941
- */
9942
- type BudgetSource = 'system' | 'account' | 'config' | 'run';
9943
10056
  /**
9944
10057
  * Lifecycle of a keyed (multi-turn) session — the durable conversation.
9945
10058
  * Distinct from SessionStatus, which is per-execution (one turn's run) and
@@ -10036,18 +10149,8 @@ interface SessionMessage {
10036
10149
  * The session's current state.
10037
10150
  */
10038
10151
  interface Session {
10039
- /**
10040
- * The GitHub user the session is attributed to, when the attribution is a GitHub user.
10041
- */
10042
- attributed_user: GithubAccountSnippet | null;
10043
- /**
10044
- * Identifier of the principal the session is attributed to.
10045
- */
10046
- attribution_id: string | null;
10047
- /**
10048
- * Kind of principal the session is attributed to (e.g. a GitHub user or an API key).
10049
- */
10050
- attribution_type: AttributionType | null;
10152
+ attribution: SessionAttribution;
10153
+ budget: SessionBudget;
10051
10154
  /**
10052
10155
  * Version of the client that started the session, if reported.
10053
10156
  */
@@ -10066,22 +10169,7 @@ interface Session {
10066
10169
  * The "owner/name" repository context the session was started in, if any.
10067
10170
  */
10068
10171
  context_repository: string | null;
10069
- /**
10070
- * Platform fee in millicents.
10071
- */
10072
- cost_fee: number;
10073
- /**
10074
- * Sandbox CPU spend in millicents.
10075
- */
10076
- cost_sandbox_cpu: number;
10077
- /**
10078
- * Sandbox memory spend in millicents.
10079
- */
10080
- cost_sandbox_memory: number;
10081
- /**
10082
- * 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.
10083
- */
10084
- cost_tokens: number;
10172
+ cost: SessionCost;
10085
10173
  /**
10086
10174
  * When the session was created.
10087
10175
  */
@@ -10121,28 +10209,12 @@ interface Session {
10121
10209
  * Pull requests the session created or updated.
10122
10210
  */
10123
10211
  output_prs: SessionPr[] | null;
10124
- /**
10125
- * How this session relates to its parent session, if any.
10126
- */
10127
- parent_kind: ParentKind | null;
10128
- /**
10129
- * Identifier of the parent session that spawned this one, if any.
10130
- */
10131
- parent_session_id: string | null;
10212
+ parent: SessionParent;
10132
10213
  /**
10133
10214
  * The per-session prompt the session was started with.
10134
10215
  */
10135
10216
  prompt: string | null;
10136
10217
  prompting: SessionPrompting;
10137
- /**
10138
- * Identifier of the original session this one was replayed from, if it was started via replay.
10139
- */
10140
- replayed_from_session_id: string | null;
10141
- /**
10142
- * The spend budget resolved for this session, in cents.
10143
- */
10144
- resolved_budget_cents: number;
10145
- resolved_budget_source: BudgetSource;
10146
10218
  /**
10147
10219
  * Identifier of the sandbox the session runs in, if any.
10148
10220
  */
@@ -10161,46 +10233,12 @@ interface Session {
10161
10233
  * Human-readable reason for the current status, when there is one.
10162
10234
  */
10163
10235
  status_reason: string | null;
10164
- /**
10165
- * When a stop was requested, if one was.
10166
- */
10167
- stopped_at: string | null;
10168
- /**
10169
- * GitHub account id of the user who stopped the session, if known.
10170
- */
10171
- stopped_by: number | null;
10172
- /**
10173
- * The GitHub user who stopped the session, if it was stopped.
10174
- */
10175
- stopped_by_user: GithubAccountSnippet | null;
10236
+ stopped: SessionStopped;
10176
10237
  /**
10177
10238
  * The public status projection; null for laptop-synced sessions.
10178
10239
  */
10179
10240
  surface: SessionSurface | null;
10180
- /**
10181
- * Tokens written to the prompt cache.
10182
- */
10183
- tokens_cache_creation: number;
10184
- /**
10185
- * Tokens read from the prompt cache.
10186
- */
10187
- tokens_cache_read: number;
10188
- /**
10189
- * Input tokens used.
10190
- */
10191
- tokens_input: number;
10192
- /**
10193
- * The model the token counts are attributed to.
10194
- */
10195
- tokens_model: string;
10196
- /**
10197
- * Output tokens used.
10198
- */
10199
- tokens_output: number;
10200
- /**
10201
- * Total tokens used by the session.
10202
- */
10203
- tokens_total: number;
10241
+ tokens: SessionTokens;
10204
10242
  /**
10205
10243
  * When the session was last updated.
10206
10244
  */
@@ -10214,6 +10252,23 @@ interface Session {
10214
10252
  */
10215
10253
  webhook_type: WebhookType | null;
10216
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
+ }
10217
10272
  /**
10218
10273
  * Sometimes the GitHub API returns a user of github (can include bots)
10219
10274
  * using this snippet instead of the full GithubAccount model. One example,
@@ -10227,6 +10282,41 @@ interface GithubAccountSnippet {
10227
10282
  login: string;
10228
10283
  type: GithubAccountType;
10229
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
+ }
10230
10320
  /**
10231
10321
  * A pull request this session created, denormalized at capture time so
10232
10322
  * session surfaces render a labeled link without joining gh_prs. Live PR
@@ -10239,6 +10329,23 @@ interface SessionPr {
10239
10329
  repo_full_name: string;
10240
10330
  url: string;
10241
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
+ }
10242
10349
  /**
10243
10350
  * Whether a client may send this session a message and, when it may not, the reason to show instead of a composer.
10244
10351
  */
@@ -10248,6 +10355,23 @@ interface SessionPrompting {
10248
10355
  enabled: boolean;
10249
10356
  surface_name: string | null;
10250
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
+ }
10251
10375
  /**
10252
10376
  * The three fields we expose. All `None` for an un-keyed (laptop) session.
10253
10377
  *
@@ -10260,6 +10384,35 @@ interface SessionSurface {
10260
10384
  session: SessionLiveness | null;
10261
10385
  status: string | null;
10262
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
+ }
10263
10416
  /**
10264
10417
  * Cursored append-only delivery of session records, ordered by feed_seq,
10265
10418
  * from all sources. Every record in the frame advances the resume cursor —
@@ -10377,18 +10530,8 @@ interface SessionFrame {
10377
10530
  * The session's current state.
10378
10531
  */
10379
10532
  interface Session1 {
10380
- /**
10381
- * The GitHub user the session is attributed to, when the attribution is a GitHub user.
10382
- */
10383
- attributed_user: GithubAccountSnippet | null;
10384
- /**
10385
- * Identifier of the principal the session is attributed to.
10386
- */
10387
- attribution_id: string | null;
10388
- /**
10389
- * Kind of principal the session is attributed to (e.g. a GitHub user or an API key).
10390
- */
10391
- attribution_type: AttributionType | null;
10533
+ attribution: SessionAttribution;
10534
+ budget: SessionBudget;
10392
10535
  /**
10393
10536
  * Version of the client that started the session, if reported.
10394
10537
  */
@@ -10407,22 +10550,7 @@ interface Session1 {
10407
10550
  * The "owner/name" repository context the session was started in, if any.
10408
10551
  */
10409
10552
  context_repository: string | null;
10410
- /**
10411
- * Platform fee in millicents.
10412
- */
10413
- cost_fee: number;
10414
- /**
10415
- * Sandbox CPU spend in millicents.
10416
- */
10417
- cost_sandbox_cpu: number;
10418
- /**
10419
- * Sandbox memory spend in millicents.
10420
- */
10421
- cost_sandbox_memory: number;
10422
- /**
10423
- * 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.
10424
- */
10425
- cost_tokens: number;
10553
+ cost: SessionCost;
10426
10554
  /**
10427
10555
  * When the session was created.
10428
10556
  */
@@ -10462,28 +10590,12 @@ interface Session1 {
10462
10590
  * Pull requests the session created or updated.
10463
10591
  */
10464
10592
  output_prs: SessionPr[] | null;
10465
- /**
10466
- * How this session relates to its parent session, if any.
10467
- */
10468
- parent_kind: ParentKind | null;
10469
- /**
10470
- * Identifier of the parent session that spawned this one, if any.
10471
- */
10472
- parent_session_id: string | null;
10593
+ parent: SessionParent;
10473
10594
  /**
10474
10595
  * The per-session prompt the session was started with.
10475
10596
  */
10476
10597
  prompt: string | null;
10477
10598
  prompting: SessionPrompting;
10478
- /**
10479
- * Identifier of the original session this one was replayed from, if it was started via replay.
10480
- */
10481
- replayed_from_session_id: string | null;
10482
- /**
10483
- * The spend budget resolved for this session, in cents.
10484
- */
10485
- resolved_budget_cents: number;
10486
- resolved_budget_source: BudgetSource;
10487
10599
  /**
10488
10600
  * Identifier of the sandbox the session runs in, if any.
10489
10601
  */
@@ -10502,46 +10614,12 @@ interface Session1 {
10502
10614
  * Human-readable reason for the current status, when there is one.
10503
10615
  */
10504
10616
  status_reason: string | null;
10505
- /**
10506
- * When a stop was requested, if one was.
10507
- */
10508
- stopped_at: string | null;
10509
- /**
10510
- * GitHub account id of the user who stopped the session, if known.
10511
- */
10512
- stopped_by: number | null;
10513
- /**
10514
- * The GitHub user who stopped the session, if it was stopped.
10515
- */
10516
- stopped_by_user: GithubAccountSnippet | null;
10617
+ stopped: SessionStopped;
10517
10618
  /**
10518
10619
  * The public status projection; null for laptop-synced sessions.
10519
10620
  */
10520
10621
  surface: SessionSurface | null;
10521
- /**
10522
- * Tokens written to the prompt cache.
10523
- */
10524
- tokens_cache_creation: number;
10525
- /**
10526
- * Tokens read from the prompt cache.
10527
- */
10528
- tokens_cache_read: number;
10529
- /**
10530
- * Input tokens used.
10531
- */
10532
- tokens_input: number;
10533
- /**
10534
- * The model the token counts are attributed to.
10535
- */
10536
- tokens_model: string;
10537
- /**
10538
- * Output tokens used.
10539
- */
10540
- tokens_output: number;
10541
- /**
10542
- * Total tokens used by the session.
10543
- */
10544
- tokens_total: number;
10622
+ tokens: SessionTokens;
10545
10623
  /**
10546
10624
  * When the session was last updated.
10547
10625
  */