@ellipsis-dev/sdk 0.9.0 → 0.11.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.
@@ -14,10 +14,13 @@ interface paths {
14
14
  put?: never;
15
15
  /**
16
16
  * Create Agent Config
17
- * @description Create an agent config via pull request.
17
+ * @description Create an agent config.
18
18
  *
19
- * The PR adds the config file to agents/ on the target
20
- * repository; the agent goes live when it merges.
19
+ * Name a repository and Ellipsis opens a pull request adding the
20
+ * config file to agents/ there; the agent goes live when it
21
+ * merges. Omit it and the agent is created here, with no file,
22
+ * live immediately — and every file reference in it must name the
23
+ * repository it lives in.
21
24
  *
22
25
  * Accepts an inline config or a gallery template slug. 409 when
23
26
  * another live agent already holds the name.
@@ -41,8 +44,75 @@ interface paths {
41
44
  * @description Return one saved agent config, by id or by the agent's name.
42
45
  */
43
46
  get: operations['get_agent_config'];
44
- put?: never;
47
+ /**
48
+ * Update Agent Config
49
+ * @description Replace an agent's definition, by id or by the agent's name.
50
+ *
51
+ * The whole definition is replaced, and the change is live at
52
+ * once. Only for agents managed through this API: one defined by a
53
+ * repository file is a 409, since the next push to that file would
54
+ * revert the change — unlink it first to take ownership.
55
+ */
56
+ put: operations['update_agent_config'];
45
57
  post?: never;
58
+ /**
59
+ * Delete Agent Config
60
+ * @description Delete an agent, by id or by the agent's name.
61
+ *
62
+ * The agent stops running and its name is freed immediately; its
63
+ * past sessions remain readable. Only for agents managed through
64
+ * this API — delete the file to remove one defined by a
65
+ * repository.
66
+ */
67
+ delete: operations['delete_agent_config'];
68
+ options?: never;
69
+ head?: never;
70
+ patch?: never;
71
+ trace?: never;
72
+ };
73
+ '/agents/configs/{config_id}/link': {
74
+ parameters: {
75
+ query?: never;
76
+ header?: never;
77
+ path?: never;
78
+ cookie?: never;
79
+ };
80
+ get?: never;
81
+ put?: never;
82
+ /**
83
+ * Link Agent Config
84
+ * @description Move an agent into a repository, by id or by the agent's name.
85
+ *
86
+ * Opens a pull request adding the agent's config file. The agent
87
+ * keeps running unchanged meanwhile; merging hands it over to the
88
+ * file, after which the file is what changes it. Nothing happens
89
+ * if the pull request is never merged.
90
+ */
91
+ post: operations['link_agent_config'];
92
+ delete?: never;
93
+ options?: never;
94
+ head?: never;
95
+ patch?: never;
96
+ trace?: never;
97
+ };
98
+ '/agents/configs/{config_id}/unlink': {
99
+ parameters: {
100
+ query?: never;
101
+ header?: never;
102
+ path?: never;
103
+ cookie?: never;
104
+ };
105
+ get?: never;
106
+ put?: never;
107
+ /**
108
+ * Unlink Agent Config
109
+ * @description Take over an agent from its file, by id or by the agent's name.
110
+ *
111
+ * The file stops governing the agent immediately and further
112
+ * changes go through this API. The file is left in place, inert —
113
+ * delete it whenever you like.
114
+ */
115
+ post: operations['unlink_agent_config'];
46
116
  delete?: never;
47
117
  options?: never;
48
118
  head?: never;
@@ -1446,6 +1516,17 @@ interface components {
1446
1516
  */
1447
1517
  version: string;
1448
1518
  };
1519
+ /**
1520
+ * AgentConfigEllipsisPermissions
1521
+ * @description `permissions.ellipsis` as a map: resource → level | grant | list of
1522
+ * grants. Levels are hierarchical (read < write < delete), so `write`
1523
+ * includes `read`. An unlisted resource is denied. The whole block is
1524
+ * intersected with the platform's sandbox ceiling at token mint — it can
1525
+ * narrow what a sandbox token may do, never exceed it.
1526
+ */
1527
+ AgentConfigEllipsisPermissions: {
1528
+ [key: string]: components['schemas']['Level'] | components['schemas']['EllipsisGrant'] | (components['schemas']['Level'] | components['schemas']['EllipsisGrant'])[];
1529
+ };
1449
1530
  /**
1450
1531
  * AgentConfigEnvironment
1451
1532
  * @description Everything about the environment (the sandbox) the agent runs in: which
@@ -1698,10 +1779,11 @@ interface components {
1698
1779
  *
1699
1780
  * `ellipsis` scopes the sandbox's Ellipsis API token
1700
1781
  * (`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.
1782
+ * with). `true` / the string `all` (the default) grant the full sandbox
1783
+ * ceiling everything a sandbox token can ever do. A map narrows it per
1784
+ * resource (see `AgentConfigEllipsisPermissions`); the minted token carries
1785
+ * the intersection, so a config can only ever reduce access. `false` fails
1786
+ * validation — an agent with no API token cannot report its own progress.
1705
1787
  *
1706
1788
  * `github` scopes the sandbox's GitHub installation token (`GH_TOKEN`) —
1707
1789
  * see `AgentConfigGithubPermissions`. GitHub enforces it at mint time.
@@ -1710,9 +1792,8 @@ interface components {
1710
1792
  /**
1711
1793
  * Ellipsis
1712
1794
  * @default true
1713
- * @enum {unknown}
1714
1795
  */
1715
- ellipsis: true | 'all';
1796
+ ellipsis: (true | 'all') | components['schemas']['AgentConfigEllipsisPermissions'];
1716
1797
  /** @default {} */
1717
1798
  github: components['schemas']['AgentConfigGithubPermissions'];
1718
1799
  };
@@ -1796,6 +1877,7 @@ interface components {
1796
1877
  AgentConfigSystemFileRef: {
1797
1878
  /** File */
1798
1879
  file: string;
1880
+ repository?: components['schemas']['AgentConfigRepository'] | null;
1799
1881
  };
1800
1882
  /**
1801
1883
  * AgentConfigsListResponse
@@ -2386,6 +2468,8 @@ interface components {
2386
2468
  * @description The last commit the config was synced from.
2387
2469
  */
2388
2470
  last_synced_commit_sha?: string | null;
2471
+ /** @description Which writer owns this agent. "github" agents are defined by a file in a repository and are changed by editing that file; "api" agents have no file and are changed through this API. */
2472
+ managed_by: components['schemas']['ConfigManagedBy'];
2389
2473
  /**
2390
2474
  * Name
2391
2475
  * @description The agent's customer-unique addressable name (a slug of its display name); usable anywhere an agent is referenced, interchangeably with the id.
@@ -2408,6 +2492,14 @@ interface components {
2408
2492
  */
2409
2493
  updated_at: string;
2410
2494
  };
2495
+ /**
2496
+ * ConfigManagedBy
2497
+ * @description Which writer owns an agent: the repository file it is defined in, or
2498
+ * this API. Every agent has exactly one owner, fixed when it is created and
2499
+ * changed only by linking or unlinking it.
2500
+ * @enum {string}
2501
+ */
2502
+ ConfigManagedBy: 'github' | 'api';
2411
2503
  /**
2412
2504
  * ContributorUsage
2413
2505
  * @description An author who merged a pull request in the window. The pull-request and
@@ -2453,22 +2545,22 @@ interface components {
2453
2545
  };
2454
2546
  /**
2455
2547
  * CreateAgentConfigRequest
2456
- * @description Parameters for creating an agent config via a pull request. Exactly
2457
- * one of config or template_id must be set.
2548
+ * @description Parameters for creating an agent config. Exactly one of config or
2549
+ * template_id must be set.
2458
2550
  */
2459
2551
  CreateAgentConfigRequest: {
2460
2552
  /** @description An inline agent config. */
2461
2553
  config?: components['schemas']['AgentConfig'] | null;
2462
2554
  /**
2463
2555
  * Path
2464
- * @description File path within the repo. Omit for the default agents/<slug>.yaml; if set it must be a location the config sync scans (a .yaml/.yml file under agents/, .agents/, ellipsis/, or .ellipsis/ at any depth).
2556
+ * @description File path within the repo, when a repository is named. Omit for the default agents/<slug>.yaml; if set it must be a location the config sync scans (a .yaml/.yml file under agents/, .agents/, ellipsis/, or .ellipsis/ at any depth).
2465
2557
  */
2466
2558
  path?: string | null;
2467
2559
  /**
2468
2560
  * Repository
2469
- * @description Target repository name within the caller's account; the owner is always the account, so pass a bare name (e.g. "my-service"), not "owner/my-service".
2561
+ * @description Define the agent as a file in this repository: Ellipsis opens a pull request adding it, and the agent goes live when that merges. Repository name within the caller's account; the owner is always the account, so pass a bare name (e.g. "my-service"), not "owner/my-service". Omit to create the agent through the API alone, with no file and live immediately.
2470
2562
  */
2471
- repository: string;
2563
+ repository?: string | null;
2472
2564
  /**
2473
2565
  * Template Id
2474
2566
  * @description A gallery template slug (see GET /agents/templates).
@@ -2477,21 +2569,22 @@ interface components {
2477
2569
  };
2478
2570
  /**
2479
2571
  * CreateAgentConfigResponse
2480
- * @description The created agent config and the pull request that adds its file.
2572
+ * @description The created agent config, plus the pull request that adds its file when
2573
+ * one was opened.
2481
2574
  */
2482
2575
  CreateAgentConfigResponse: {
2483
2576
  /** @description The created agent config. */
2484
2577
  config: components['schemas']['Config'];
2485
2578
  /**
2486
2579
  * Path
2487
- * @description The file path the config was written to.
2580
+ * @description The file path the config was written to, or null when the agent has no file.
2488
2581
  */
2489
- path: string;
2582
+ path?: string | null;
2490
2583
  /**
2491
2584
  * Pull Request Url
2492
- * @description The pull request that adds the config file. The agent becomes live once it merges and syncs.
2585
+ * @description The pull request that adds the config file. The agent becomes live once it merges and syncs. Null when no repository was named: the agent is already live.
2493
2586
  */
2494
- pull_request_url: string;
2587
+ pull_request_url?: string | null;
2495
2588
  };
2496
2589
  /**
2497
2590
  * CreateFileRequest
@@ -2656,6 +2749,17 @@ interface components {
2656
2749
  * @enum {string}
2657
2750
  */
2658
2751
  EffortLevel: 'low' | 'medium' | 'high' | 'xhigh' | 'max';
2752
+ /**
2753
+ * EllipsisGrant
2754
+ * @description One grant entry: a level, optionally narrowed to instances whose
2755
+ * natural key (a file's name, a memory's path, a secret's name, a config's
2756
+ * name, a session's id) matches any of the `match` globs.
2757
+ */
2758
+ EllipsisGrant: {
2759
+ level: components['schemas']['Level'];
2760
+ /** Match */
2761
+ match?: string[] | null;
2762
+ };
2659
2763
  /** ErrorInfo */
2660
2764
  ErrorInfo: {
2661
2765
  /**
@@ -3345,6 +3449,14 @@ interface components {
3345
3449
  */
3346
3450
  cloud_id: string;
3347
3451
  };
3452
+ /**
3453
+ * Level
3454
+ * @description What may be done to a resource. Strictly ordered: a grant at one level
3455
+ * includes every level below it (write-only would be a phantom capability —
3456
+ * no real client can create what it cannot read back).
3457
+ * @enum {string}
3458
+ */
3459
+ Level: 'read' | 'write' | 'delete';
3348
3460
  /**
3349
3461
  * LinearIntegrationSummary
3350
3462
  * @description The account's connected Linear organization and its teams.
@@ -3408,6 +3520,40 @@ interface components {
3408
3520
  */
3409
3521
  teams: components['schemas']['LinearTeam'][];
3410
3522
  };
3523
+ /**
3524
+ * LinkAgentConfigRequest
3525
+ * @description Where to put the config file of an agent being moved into a repository.
3526
+ */
3527
+ LinkAgentConfigRequest: {
3528
+ /**
3529
+ * Path
3530
+ * @description File path within the repo. Omit for the default agents/<slug>.yaml; if set it must be a location the config sync scans (a .yaml/.yml file under agents/, .agents/, ellipsis/, or .ellipsis/ at any depth).
3531
+ */
3532
+ path?: string | null;
3533
+ /**
3534
+ * Repository
3535
+ * @description Repository name within the caller's account; the owner is always the account, so pass a bare name (e.g. "my-service"), not "owner/my-service".
3536
+ */
3537
+ repository: string;
3538
+ };
3539
+ /**
3540
+ * LinkAgentConfigResponse
3541
+ * @description The agent and the pull request that would put it in a repository.
3542
+ */
3543
+ LinkAgentConfigResponse: {
3544
+ /** @description The agent, still managed through the API until the pull request merges. */
3545
+ config: components['schemas']['Config'];
3546
+ /**
3547
+ * Path
3548
+ * @description The file path the config will be written to.
3549
+ */
3550
+ path: string;
3551
+ /**
3552
+ * Pull Request Url
3553
+ * @description The pull request that adds the config file. The agent becomes managed by that file once it merges.
3554
+ */
3555
+ pull_request_url: string;
3556
+ };
3411
3557
  /**
3412
3558
  * LinkedGithubIdentity
3413
3559
  * @description The GitHub identity linked to a Slack member.
@@ -4255,6 +4401,14 @@ interface components {
4255
4401
  /** Watermark */
4256
4402
  watermark: string | null;
4257
4403
  };
4404
+ /**
4405
+ * Resource
4406
+ * @description Everything a credential can be granted access to, one value per /v1
4407
+ * resource family. `TOKENS` is reserved for the future token-management
4408
+ * routes; nothing maps to it yet.
4409
+ * @enum {string}
4410
+ */
4411
+ Resource: 'account' | 'alerts' | 'sessions' | 'files' | 'memories' | 'reviews' | 'configs' | 'defaults' | 'secrets' | 'templates' | 'integrations' | 'tokens';
4258
4412
  /**
4259
4413
  * Review
4260
4414
  * @description One code review: one pipeline iteration over one commit range of a pull
@@ -5212,15 +5366,10 @@ interface components {
5212
5366
  * disagree about what a session looks like.
5213
5367
  */
5214
5368
  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;
5369
+ /** @description The principal this session is attributed to. */
5370
+ attribution?: components['schemas']['SessionAttribution'];
5371
+ /** @description The spend budget enforced for this session. */
5372
+ budget?: components['schemas']['SessionBudget'];
5224
5373
  /**
5225
5374
  * Client Version
5226
5375
  * @description Version of the client that started the session, if reported.
@@ -5243,29 +5392,8 @@ interface components {
5243
5392
  * @description The "owner/name" repository context the session was started in, if any.
5244
5393
  */
5245
5394
  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;
5395
+ /** @description What the session cost, in millicents, broken down by leg and carrying its own total. */
5396
+ cost?: components['schemas']['SessionCost'];
5269
5397
  /**
5270
5398
  * Created At
5271
5399
  * Format: date-time
@@ -5311,13 +5439,8 @@ interface components {
5311
5439
  * @description Pull requests the session created or updated.
5312
5440
  */
5313
5441
  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;
5442
+ /** @description What preceded this session, if anything. */
5443
+ parent?: components['schemas']['SessionParent'];
5321
5444
  /**
5322
5445
  * Prompt
5323
5446
  * @description The per-session prompt the session was started with.
@@ -5325,18 +5448,6 @@ interface components {
5325
5448
  prompt?: string | null;
5326
5449
  /** @description Whether a client may send this session a message and, when it may not, the reason to show instead of a composer. */
5327
5450
  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
5451
  /**
5341
5452
  * Sandbox Id
5342
5453
  * @description Identifier of the sandbox the session runs in, if any.
@@ -5358,68 +5469,99 @@ interface components {
5358
5469
  * @description Human-readable reason for the current status, when there is one.
5359
5470
  */
5360
5471
  status_reason?: string | null;
5472
+ /** @description The stop request, if the session was stopped. */
5473
+ stopped?: components['schemas']['SessionStopped'];
5474
+ /** @description The public status projection; null for laptop-synced sessions. */
5475
+ surface?: components['schemas']['SessionSurface'] | null;
5476
+ /** @description The tokens the session spent and the model they went to. `total` includes the prompt-cache lanes. */
5477
+ tokens?: components['schemas']['SessionTokens'];
5361
5478
  /**
5362
- * Stopped At
5363
- * @description When a stop was requested, if one was.
5479
+ * Updated At
5480
+ * Format: date-time
5481
+ * @description When the session was last updated.
5364
5482
  */
5365
- stopped_at?: string | null;
5483
+ updated_at: string;
5366
5484
  /**
5367
- * Stopped By
5368
- * @description GitHub account id of the user who stopped the session, if known.
5485
+ * Webhook Id
5486
+ * @description Identifier of the webhook event that triggered the session, if any.
5369
5487
  */
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;
5488
+ webhook_id?: string | null;
5489
+ /** @description Type of the webhook event that triggered the session, if any. */
5490
+ webhook_type?: components['schemas']['WebhookType'] | null;
5491
+ };
5492
+ /**
5493
+ * SessionAttribution
5494
+ * @description The principal a session is attributed to: what kind, its id, and — when
5495
+ * the kind is a GitHub user — the resolved display snippet.
5496
+ */
5497
+ SessionAttribution: {
5375
5498
  /**
5376
- * Tokens Cache Creation
5377
- * @description Tokens written to the prompt cache.
5378
- * @default 0
5499
+ * Id
5500
+ * @description Identifier of the principal the session is attributed to.
5379
5501
  */
5380
- tokens_cache_creation: number;
5502
+ id?: string | null;
5503
+ /** @description Kind of principal the session is attributed to (e.g. a GitHub user or an API key). */
5504
+ type?: components['schemas']['AttributionType'] | null;
5505
+ /** @description The GitHub user the session is attributed to, resolved at read time. Null when the attribution is not a GitHub user. */
5506
+ user?: components['schemas']['GithubAccountSnippet'] | null;
5507
+ };
5508
+ /**
5509
+ * SessionBudget
5510
+ * @description The spend budget actually enforced for this session, and which layer of
5511
+ * the cascade set it.
5512
+ */
5513
+ SessionBudget: {
5381
5514
  /**
5382
- * Tokens Cache Read
5383
- * @description Tokens read from the prompt cache.
5515
+ * Cents
5516
+ * @description The spend budget resolved for this session, in cents.
5384
5517
  * @default 0
5385
5518
  */
5386
- tokens_cache_read: number;
5519
+ cents: number;
5387
5520
  /**
5388
- * Tokens Input
5389
- * @description Input tokens used.
5390
- * @default 0
5521
+ * @description Where the resolved budget came from.
5522
+ * @default account
5391
5523
  */
5392
- tokens_input: number;
5524
+ source: components['schemas']['BudgetSource'];
5525
+ };
5526
+ /**
5527
+ * SessionCost
5528
+ * @description What a session (or one turn of it) cost, in millicents.
5529
+ *
5530
+ * `llm` is deliberately NOT called `tokens`: it would sit beside the `tokens`
5531
+ * object and read as "the token count's cost" rather than "the cost of the
5532
+ * LLM leg".
5533
+ */
5534
+ SessionCost: {
5393
5535
  /**
5394
- * Tokens Model
5395
- * @description The model the token counts are attributed to.
5536
+ * Fee
5537
+ * @description Platform fee in millicents.
5538
+ * @default 0
5396
5539
  */
5397
- tokens_model: string;
5540
+ fee: number;
5398
5541
  /**
5399
- * Tokens Output
5400
- * @description Output tokens used.
5542
+ * Llm
5543
+ * @description LLM spend in millicents.
5401
5544
  * @default 0
5402
5545
  */
5403
- tokens_output: number;
5546
+ llm: number;
5404
5547
  /**
5405
- * Tokens Total
5406
- * @description Total tokens used by the session.
5548
+ * Sandbox Cpu
5549
+ * @description Sandbox CPU spend in millicents.
5407
5550
  * @default 0
5408
5551
  */
5409
- tokens_total: number;
5552
+ sandbox_cpu: number;
5410
5553
  /**
5411
- * Updated At
5412
- * Format: date-time
5413
- * @description When the session was last updated.
5554
+ * Sandbox Memory
5555
+ * @description Sandbox memory spend in millicents.
5556
+ * @default 0
5414
5557
  */
5415
- updated_at: string;
5558
+ sandbox_memory: number;
5416
5559
  /**
5417
- * Webhook Id
5418
- * @description Identifier of the webhook event that triggered the session, if any.
5560
+ * Total
5561
+ * @description The grand total in millicents: llm + sandbox_cpu + sandbox_memory + fee.
5562
+ * @default 0
5419
5563
  */
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;
5564
+ total: number;
5423
5565
  };
5424
5566
  /**
5425
5567
  * SessionExecution
@@ -5623,6 +5765,26 @@ interface components {
5623
5765
  * @enum {string}
5624
5766
  */
5625
5767
  SessionMessageStatus: 'pending' | 'delivered';
5768
+ /**
5769
+ * SessionParent
5770
+ * @description The ONE "preceded-by" chain: the predecessor session and how this one
5771
+ * relates to it. Not a parent that orchestrates children — a session never
5772
+ * spawns sub-sessions.
5773
+ */
5774
+ SessionParent: {
5775
+ /** @description How this session relates to its parent session, if any. */
5776
+ kind?: components['schemas']['ParentKind'] | null;
5777
+ /**
5778
+ * Replayed From Session Id
5779
+ * @description Identifier of the original session this one was replayed from, if it was started via replay.
5780
+ */
5781
+ replayed_from_session_id?: string | null;
5782
+ /**
5783
+ * Session Id
5784
+ * @description Identifier of the parent session that spawned this one, if any.
5785
+ */
5786
+ session_id?: string | null;
5787
+ };
5626
5788
  /**
5627
5789
  * SessionPr
5628
5790
  * @description A pull request this session created, denormalized at capture time so
@@ -5860,6 +6022,25 @@ interface components {
5860
6022
  * @enum {string}
5861
6023
  */
5862
6024
  SessionStatus: 'scheduled' | 'creating_sandbox' | 'running' | 'retrying' | 'completed' | 'error' | 'cancelled' | 'stopped';
6025
+ /**
6026
+ * SessionStopped
6027
+ * @description The stop request, if there was one: when, by which GitHub account id,
6028
+ * and that account resolved to a display snippet.
6029
+ */
6030
+ SessionStopped: {
6031
+ /**
6032
+ * At
6033
+ * @description When a stop was requested, if one was.
6034
+ */
6035
+ at?: string | null;
6036
+ /**
6037
+ * By
6038
+ * @description GitHub account id of the user who stopped the session, if known.
6039
+ */
6040
+ by?: number | null;
6041
+ /** @description The GitHub user who stopped the session, resolved at read time. */
6042
+ by_user?: components['schemas']['GithubAccountSnippet'] | null;
6043
+ };
5863
6044
  /**
5864
6045
  * SessionSurface
5865
6046
  * @description The three fields we expose. All `None` for an un-keyed (laptop) session.
@@ -5874,6 +6055,54 @@ interface components {
5874
6055
  /** Status */
5875
6056
  status: string | null;
5876
6057
  };
6058
+ /**
6059
+ * SessionTokens
6060
+ * @description The token counts a session (or turn) spent, and the model they went to.
6061
+ *
6062
+ * `total` INCLUDES the cache lanes, unlike the old flat `tokens_total` which
6063
+ * counted input+output+thinking only and left callers to add cache reads and
6064
+ * writes back themselves (the deleted `tokensTotalAll` helper). Cache tokens
6065
+ * dominate an agent run's token bill, so a "total" that omits them is the
6066
+ * wrong default and produced two competing totals in the dashboard.
6067
+ */
6068
+ SessionTokens: {
6069
+ /**
6070
+ * Cache Creation
6071
+ * @description Tokens written to the prompt cache.
6072
+ * @default 0
6073
+ */
6074
+ cache_creation: number;
6075
+ /**
6076
+ * Cache Read
6077
+ * @description Tokens read from the prompt cache.
6078
+ * @default 0
6079
+ */
6080
+ cache_read: number;
6081
+ /**
6082
+ * Input
6083
+ * @description Input tokens used.
6084
+ * @default 0
6085
+ */
6086
+ input: number;
6087
+ /**
6088
+ * Model
6089
+ * @description The model the token counts are attributed to.
6090
+ * @default
6091
+ */
6092
+ model: string;
6093
+ /**
6094
+ * Output
6095
+ * @description Output tokens used.
6096
+ * @default 0
6097
+ */
6098
+ output: number;
6099
+ /**
6100
+ * Total
6101
+ * @description Total tokens consumed, INCLUDING the prompt-cache reads and writes — the same basis the token cost is priced on.
6102
+ * @default 0
6103
+ */
6104
+ total: number;
6105
+ };
5877
6106
  /**
5878
6107
  * SessionsListResponse
5879
6108
  * @description A page of sessions in the lean wire shape.
@@ -6264,6 +6493,14 @@ interface components {
6264
6493
  /** Skipped */
6265
6494
  skipped: number;
6266
6495
  };
6496
+ /**
6497
+ * UpdateAgentConfigRequest
6498
+ * @description A replacement definition for an agent managed through the API.
6499
+ */
6500
+ UpdateAgentConfigRequest: {
6501
+ /** @description The agent's new definition. Replaces the previous one wholesale — this is not a partial update. */
6502
+ config: components['schemas']['AgentConfig'];
6503
+ };
6267
6504
  /**
6268
6505
  * UsageDailyPoint
6269
6506
  * @description One day's usage: tokens split by type, and cost split into the four
@@ -6509,7 +6746,7 @@ interface operations {
6509
6746
  'application/json': components['schemas']['ErrorResponse'];
6510
6747
  };
6511
6748
  };
6512
- /** @description The agent's name contains no usable characters. */
6749
+ /** @description The agent's name contains no usable characters, or a file reference names no repository. */
6513
6750
  422: {
6514
6751
  headers: {
6515
6752
  [name: string]: unknown;
@@ -6580,16 +6817,22 @@ interface operations {
6580
6817
  };
6581
6818
  };
6582
6819
  };
6583
- list_agent_defaults: {
6820
+ update_agent_config: {
6584
6821
  parameters: {
6585
6822
  query?: never;
6586
6823
  header?: {
6587
6824
  'user-agent'?: string | null;
6588
6825
  };
6589
- path?: never;
6826
+ path: {
6827
+ config_id: string;
6828
+ };
6590
6829
  cookie?: never;
6591
6830
  };
6592
- requestBody?: never;
6831
+ requestBody: {
6832
+ content: {
6833
+ 'application/json': components['schemas']['UpdateAgentConfigRequest'];
6834
+ };
6835
+ };
6593
6836
  responses: {
6594
6837
  /** @description Successful Response */
6595
6838
  200: {
@@ -6597,7 +6840,301 @@ interface operations {
6597
6840
  [name: string]: unknown;
6598
6841
  };
6599
6842
  content: {
6600
- 'application/json': components['schemas']['AgentDefaultsListResponse'];
6843
+ 'application/json': components['schemas']['AgentConfigResponse'];
6844
+ };
6845
+ };
6846
+ /** @description The config is invalid (for example an unschedulable cron expression). */
6847
+ 400: {
6848
+ headers: {
6849
+ [name: string]: unknown;
6850
+ };
6851
+ content: {
6852
+ 'application/json': components['schemas']['ErrorResponse'];
6853
+ };
6854
+ };
6855
+ /** @description The bearer token is missing, invalid, or revoked. */
6856
+ 401: {
6857
+ headers: {
6858
+ [name: string]: unknown;
6859
+ };
6860
+ content: {
6861
+ 'application/json': components['schemas']['ErrorResponse'];
6862
+ };
6863
+ };
6864
+ /** @description The credential may not perform this action, or the account is blocked. */
6865
+ 403: {
6866
+ headers: {
6867
+ [name: string]: unknown;
6868
+ };
6869
+ content: {
6870
+ 'application/json': components['schemas']['ErrorResponse'];
6871
+ };
6872
+ };
6873
+ /** @description No such config in your account. */
6874
+ 404: {
6875
+ headers: {
6876
+ [name: string]: unknown;
6877
+ };
6878
+ content: {
6879
+ 'application/json': components['schemas']['ErrorResponse'];
6880
+ };
6881
+ };
6882
+ /** @description The agent is defined by a file in a repository, or another live agent already holds the new name. */
6883
+ 409: {
6884
+ headers: {
6885
+ [name: string]: unknown;
6886
+ };
6887
+ content: {
6888
+ 'application/json': components['schemas']['ErrorResponse'];
6889
+ };
6890
+ };
6891
+ /** @description The agent's name is missing or malformed, or a file reference names no repository. */
6892
+ 422: {
6893
+ headers: {
6894
+ [name: string]: unknown;
6895
+ };
6896
+ content: {
6897
+ 'application/json': components['schemas']['ErrorResponse'];
6898
+ };
6899
+ };
6900
+ };
6901
+ };
6902
+ delete_agent_config: {
6903
+ parameters: {
6904
+ query?: never;
6905
+ header?: {
6906
+ 'user-agent'?: string | null;
6907
+ };
6908
+ path: {
6909
+ config_id: string;
6910
+ };
6911
+ cookie?: never;
6912
+ };
6913
+ requestBody?: never;
6914
+ responses: {
6915
+ /** @description Successful Response */
6916
+ 204: {
6917
+ headers: {
6918
+ [name: string]: unknown;
6919
+ };
6920
+ content?: never;
6921
+ };
6922
+ /** @description The bearer token is missing, invalid, or revoked. */
6923
+ 401: {
6924
+ headers: {
6925
+ [name: string]: unknown;
6926
+ };
6927
+ content: {
6928
+ 'application/json': components['schemas']['ErrorResponse'];
6929
+ };
6930
+ };
6931
+ /** @description The credential may not perform this action, or the account is blocked. */
6932
+ 403: {
6933
+ headers: {
6934
+ [name: string]: unknown;
6935
+ };
6936
+ content: {
6937
+ 'application/json': components['schemas']['ErrorResponse'];
6938
+ };
6939
+ };
6940
+ /** @description No such config in your account. */
6941
+ 404: {
6942
+ headers: {
6943
+ [name: string]: unknown;
6944
+ };
6945
+ content: {
6946
+ 'application/json': components['schemas']['ErrorResponse'];
6947
+ };
6948
+ };
6949
+ /** @description The agent is defined by a file in a repository; delete that file instead. */
6950
+ 409: {
6951
+ headers: {
6952
+ [name: string]: unknown;
6953
+ };
6954
+ content: {
6955
+ 'application/json': components['schemas']['ErrorResponse'];
6956
+ };
6957
+ };
6958
+ /** @description Validation Error */
6959
+ 422: {
6960
+ headers: {
6961
+ [name: string]: unknown;
6962
+ };
6963
+ content: {
6964
+ 'application/json': components['schemas']['HTTPValidationError'];
6965
+ };
6966
+ };
6967
+ };
6968
+ };
6969
+ link_agent_config: {
6970
+ parameters: {
6971
+ query?: never;
6972
+ header?: {
6973
+ 'user-agent'?: string | null;
6974
+ };
6975
+ path: {
6976
+ config_id: string;
6977
+ };
6978
+ cookie?: never;
6979
+ };
6980
+ requestBody: {
6981
+ content: {
6982
+ 'application/json': components['schemas']['LinkAgentConfigRequest'];
6983
+ };
6984
+ };
6985
+ responses: {
6986
+ /** @description Successful Response */
6987
+ 200: {
6988
+ headers: {
6989
+ [name: string]: unknown;
6990
+ };
6991
+ content: {
6992
+ 'application/json': components['schemas']['LinkAgentConfigResponse'];
6993
+ };
6994
+ };
6995
+ /** @description The path is not a synced config location, or the repository has no commits. */
6996
+ 400: {
6997
+ headers: {
6998
+ [name: string]: unknown;
6999
+ };
7000
+ content: {
7001
+ 'application/json': components['schemas']['ErrorResponse'];
7002
+ };
7003
+ };
7004
+ /** @description The bearer token is missing, invalid, or revoked. */
7005
+ 401: {
7006
+ headers: {
7007
+ [name: string]: unknown;
7008
+ };
7009
+ content: {
7010
+ 'application/json': components['schemas']['ErrorResponse'];
7011
+ };
7012
+ };
7013
+ /** @description The credential may not perform this action, or the account is blocked. */
7014
+ 403: {
7015
+ headers: {
7016
+ [name: string]: unknown;
7017
+ };
7018
+ content: {
7019
+ 'application/json': components['schemas']['ErrorResponse'];
7020
+ };
7021
+ };
7022
+ /** @description The config or repository was not found in your account. */
7023
+ 404: {
7024
+ headers: {
7025
+ [name: string]: unknown;
7026
+ };
7027
+ content: {
7028
+ 'application/json': components['schemas']['ErrorResponse'];
7029
+ };
7030
+ };
7031
+ /** @description The agent is already defined by a file, a link is already open for it, a file already exists at that path, or another agent syncs from it. */
7032
+ 409: {
7033
+ headers: {
7034
+ [name: string]: unknown;
7035
+ };
7036
+ content: {
7037
+ 'application/json': components['schemas']['ErrorResponse'];
7038
+ };
7039
+ };
7040
+ /** @description GitHub rejected the pull request. */
7041
+ 422: {
7042
+ headers: {
7043
+ [name: string]: unknown;
7044
+ };
7045
+ content: {
7046
+ 'application/json': components['schemas']['ErrorResponse'];
7047
+ };
7048
+ };
7049
+ };
7050
+ };
7051
+ unlink_agent_config: {
7052
+ parameters: {
7053
+ query?: never;
7054
+ header?: {
7055
+ 'user-agent'?: string | null;
7056
+ };
7057
+ path: {
7058
+ config_id: string;
7059
+ };
7060
+ cookie?: never;
7061
+ };
7062
+ requestBody?: never;
7063
+ responses: {
7064
+ /** @description Successful Response */
7065
+ 200: {
7066
+ headers: {
7067
+ [name: string]: unknown;
7068
+ };
7069
+ content: {
7070
+ 'application/json': components['schemas']['AgentConfigResponse'];
7071
+ };
7072
+ };
7073
+ /** @description The bearer token is missing, invalid, or revoked. */
7074
+ 401: {
7075
+ headers: {
7076
+ [name: string]: unknown;
7077
+ };
7078
+ content: {
7079
+ 'application/json': components['schemas']['ErrorResponse'];
7080
+ };
7081
+ };
7082
+ /** @description The credential may not perform this action, or the account is blocked. */
7083
+ 403: {
7084
+ headers: {
7085
+ [name: string]: unknown;
7086
+ };
7087
+ content: {
7088
+ 'application/json': components['schemas']['ErrorResponse'];
7089
+ };
7090
+ };
7091
+ /** @description No such config in your account. */
7092
+ 404: {
7093
+ headers: {
7094
+ [name: string]: unknown;
7095
+ };
7096
+ content: {
7097
+ 'application/json': components['schemas']['ErrorResponse'];
7098
+ };
7099
+ };
7100
+ /** @description The agent is already managed through the API. */
7101
+ 409: {
7102
+ headers: {
7103
+ [name: string]: unknown;
7104
+ };
7105
+ content: {
7106
+ 'application/json': components['schemas']['ErrorResponse'];
7107
+ };
7108
+ };
7109
+ /** @description The config has a file reference that names no repository, so it cannot resolve without its source repository. */
7110
+ 422: {
7111
+ headers: {
7112
+ [name: string]: unknown;
7113
+ };
7114
+ content: {
7115
+ 'application/json': components['schemas']['ErrorResponse'];
7116
+ };
7117
+ };
7118
+ };
7119
+ };
7120
+ list_agent_defaults: {
7121
+ parameters: {
7122
+ query?: never;
7123
+ header?: {
7124
+ 'user-agent'?: string | null;
7125
+ };
7126
+ path?: never;
7127
+ cookie?: never;
7128
+ };
7129
+ requestBody?: never;
7130
+ responses: {
7131
+ /** @description Successful Response */
7132
+ 200: {
7133
+ headers: {
7134
+ [name: string]: unknown;
7135
+ };
7136
+ content: {
7137
+ 'application/json': components['schemas']['AgentDefaultsListResponse'];
6601
7138
  };
6602
7139
  };
6603
7140
  /** @description The bearer token is missing, invalid, or revoked. */
@@ -9898,6 +10435,10 @@ type AttributionType = 'github_user' | 'linear_user' | 'slack_user' | 'api_key';
9898
10435
  */
9899
10436
  type SessionMessageStatus = 'pending' | 'delivered';
9900
10437
  type GithubAccountType = 'User' | 'Organization' | 'Bot' | 'Mannequin';
10438
+ /**
10439
+ * Where the resolved budget came from.
10440
+ */
10441
+ type BudgetSource = 'system' | 'account' | 'config' | 'run';
9901
10442
  /**
9902
10443
  * How a session that arrived with no explicit config source resolved its
9903
10444
  * config (documents/eng/DEFAULT_CONFIGS.md §4). Persisted on the session so
@@ -9936,10 +10477,6 @@ type ParentKind = 'continuation' | 'handoff' | 'resume';
9936
10477
  * Why direct prompting is refused. Absent when prompting is allowed.
9937
10478
  */
9938
10479
  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
10480
  /**
9944
10481
  * Lifecycle of a keyed (multi-turn) session — the durable conversation.
9945
10482
  * Distinct from SessionStatus, which is per-execution (one turn's run) and
@@ -10036,18 +10573,8 @@ interface SessionMessage {
10036
10573
  * The session's current state.
10037
10574
  */
10038
10575
  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;
10576
+ attribution: SessionAttribution;
10577
+ budget: SessionBudget;
10051
10578
  /**
10052
10579
  * Version of the client that started the session, if reported.
10053
10580
  */
@@ -10066,22 +10593,7 @@ interface Session {
10066
10593
  * The "owner/name" repository context the session was started in, if any.
10067
10594
  */
10068
10595
  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;
10596
+ cost: SessionCost;
10085
10597
  /**
10086
10598
  * When the session was created.
10087
10599
  */
@@ -10121,28 +10633,12 @@ interface Session {
10121
10633
  * Pull requests the session created or updated.
10122
10634
  */
10123
10635
  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;
10636
+ parent: SessionParent;
10132
10637
  /**
10133
10638
  * The per-session prompt the session was started with.
10134
10639
  */
10135
10640
  prompt: string | null;
10136
10641
  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
10642
  /**
10147
10643
  * Identifier of the sandbox the session runs in, if any.
10148
10644
  */
@@ -10161,46 +10657,12 @@ interface Session {
10161
10657
  * Human-readable reason for the current status, when there is one.
10162
10658
  */
10163
10659
  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;
10660
+ stopped: SessionStopped;
10176
10661
  /**
10177
10662
  * The public status projection; null for laptop-synced sessions.
10178
10663
  */
10179
10664
  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;
10665
+ tokens: SessionTokens;
10204
10666
  /**
10205
10667
  * When the session was last updated.
10206
10668
  */
@@ -10214,6 +10676,23 @@ interface Session {
10214
10676
  */
10215
10677
  webhook_type: WebhookType | null;
10216
10678
  }
10679
+ /**
10680
+ * The principal this session is attributed to.
10681
+ */
10682
+ interface SessionAttribution {
10683
+ /**
10684
+ * Identifier of the principal the session is attributed to.
10685
+ */
10686
+ id: string | null;
10687
+ /**
10688
+ * Kind of principal the session is attributed to (e.g. a GitHub user or an API key).
10689
+ */
10690
+ type: AttributionType | null;
10691
+ /**
10692
+ * The GitHub user the session is attributed to, resolved at read time. Null when the attribution is not a GitHub user.
10693
+ */
10694
+ user: GithubAccountSnippet | null;
10695
+ }
10217
10696
  /**
10218
10697
  * Sometimes the GitHub API returns a user of github (can include bots)
10219
10698
  * using this snippet instead of the full GithubAccount model. One example,
@@ -10227,6 +10706,41 @@ interface GithubAccountSnippet {
10227
10706
  login: string;
10228
10707
  type: GithubAccountType;
10229
10708
  }
10709
+ /**
10710
+ * The spend budget enforced for this session.
10711
+ */
10712
+ interface SessionBudget {
10713
+ /**
10714
+ * The spend budget resolved for this session, in cents.
10715
+ */
10716
+ cents: number;
10717
+ source: BudgetSource;
10718
+ }
10719
+ /**
10720
+ * What the session cost, in millicents, broken down by leg and carrying its own total.
10721
+ */
10722
+ interface SessionCost {
10723
+ /**
10724
+ * Platform fee in millicents.
10725
+ */
10726
+ fee: number;
10727
+ /**
10728
+ * LLM spend in millicents.
10729
+ */
10730
+ llm: number;
10731
+ /**
10732
+ * Sandbox CPU spend in millicents.
10733
+ */
10734
+ sandbox_cpu: number;
10735
+ /**
10736
+ * Sandbox memory spend in millicents.
10737
+ */
10738
+ sandbox_memory: number;
10739
+ /**
10740
+ * The grand total in millicents: llm + sandbox_cpu + sandbox_memory + fee.
10741
+ */
10742
+ total: number;
10743
+ }
10230
10744
  /**
10231
10745
  * A pull request this session created, denormalized at capture time so
10232
10746
  * session surfaces render a labeled link without joining gh_prs. Live PR
@@ -10239,6 +10753,23 @@ interface SessionPr {
10239
10753
  repo_full_name: string;
10240
10754
  url: string;
10241
10755
  }
10756
+ /**
10757
+ * What preceded this session, if anything.
10758
+ */
10759
+ interface SessionParent {
10760
+ /**
10761
+ * How this session relates to its parent session, if any.
10762
+ */
10763
+ kind: ParentKind | null;
10764
+ /**
10765
+ * Identifier of the original session this one was replayed from, if it was started via replay.
10766
+ */
10767
+ replayed_from_session_id: string | null;
10768
+ /**
10769
+ * Identifier of the parent session that spawned this one, if any.
10770
+ */
10771
+ session_id: string | null;
10772
+ }
10242
10773
  /**
10243
10774
  * Whether a client may send this session a message and, when it may not, the reason to show instead of a composer.
10244
10775
  */
@@ -10248,6 +10779,23 @@ interface SessionPrompting {
10248
10779
  enabled: boolean;
10249
10780
  surface_name: string | null;
10250
10781
  }
10782
+ /**
10783
+ * The stop request, if the session was stopped.
10784
+ */
10785
+ interface SessionStopped {
10786
+ /**
10787
+ * When a stop was requested, if one was.
10788
+ */
10789
+ at: string | null;
10790
+ /**
10791
+ * GitHub account id of the user who stopped the session, if known.
10792
+ */
10793
+ by: number | null;
10794
+ /**
10795
+ * The GitHub user who stopped the session, resolved at read time.
10796
+ */
10797
+ by_user: GithubAccountSnippet | null;
10798
+ }
10251
10799
  /**
10252
10800
  * The three fields we expose. All `None` for an un-keyed (laptop) session.
10253
10801
  *
@@ -10260,6 +10808,35 @@ interface SessionSurface {
10260
10808
  session: SessionLiveness | null;
10261
10809
  status: string | null;
10262
10810
  }
10811
+ /**
10812
+ * The tokens the session spent and the model they went to. `total` includes the prompt-cache lanes.
10813
+ */
10814
+ interface SessionTokens {
10815
+ /**
10816
+ * Tokens written to the prompt cache.
10817
+ */
10818
+ cache_creation: number;
10819
+ /**
10820
+ * Tokens read from the prompt cache.
10821
+ */
10822
+ cache_read: number;
10823
+ /**
10824
+ * Input tokens used.
10825
+ */
10826
+ input: number;
10827
+ /**
10828
+ * The model the token counts are attributed to.
10829
+ */
10830
+ model: string;
10831
+ /**
10832
+ * Output tokens used.
10833
+ */
10834
+ output: number;
10835
+ /**
10836
+ * Total tokens consumed, INCLUDING the prompt-cache reads and writes — the same basis the token cost is priced on.
10837
+ */
10838
+ total: number;
10839
+ }
10263
10840
  /**
10264
10841
  * Cursored append-only delivery of session records, ordered by feed_seq,
10265
10842
  * from all sources. Every record in the frame advances the resume cursor —
@@ -10377,18 +10954,8 @@ interface SessionFrame {
10377
10954
  * The session's current state.
10378
10955
  */
10379
10956
  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;
10957
+ attribution: SessionAttribution;
10958
+ budget: SessionBudget;
10392
10959
  /**
10393
10960
  * Version of the client that started the session, if reported.
10394
10961
  */
@@ -10407,22 +10974,7 @@ interface Session1 {
10407
10974
  * The "owner/name" repository context the session was started in, if any.
10408
10975
  */
10409
10976
  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;
10977
+ cost: SessionCost;
10426
10978
  /**
10427
10979
  * When the session was created.
10428
10980
  */
@@ -10462,28 +11014,12 @@ interface Session1 {
10462
11014
  * Pull requests the session created or updated.
10463
11015
  */
10464
11016
  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;
11017
+ parent: SessionParent;
10473
11018
  /**
10474
11019
  * The per-session prompt the session was started with.
10475
11020
  */
10476
11021
  prompt: string | null;
10477
11022
  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
11023
  /**
10488
11024
  * Identifier of the sandbox the session runs in, if any.
10489
11025
  */
@@ -10502,46 +11038,12 @@ interface Session1 {
10502
11038
  * Human-readable reason for the current status, when there is one.
10503
11039
  */
10504
11040
  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;
11041
+ stopped: SessionStopped;
10517
11042
  /**
10518
11043
  * The public status projection; null for laptop-synced sessions.
10519
11044
  */
10520
11045
  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;
11046
+ tokens: SessionTokens;
10545
11047
  /**
10546
11048
  * When the session was last updated.
10547
11049
  */