@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.
@@ -1,101 +1,5 @@
1
1
  {
2
2
  "$defs": {
3
- "AgentSessionExitStatus": {
4
- "description": "Why a terminal agent session ended \u2014 a finer-grained reason than `status`.\n\n`status` (AgentSessionStatus) is the lifecycle state: COMPLETED / ERROR /\nCANCELLED. `exit_status` explains *why* a run reached that terminal state, so\nthe UI and metrics can tell a budget cutoff apart from a crashed tool call or\na deliberate cancellation. It is None until the run reaches a terminal state.",
5
- "enum": [
6
- "completed",
7
- "budget_hit",
8
- "payment_required",
9
- "tool_call_failed",
10
- "lifecycle_hook_failed",
11
- "missing_repo_access",
12
- "missing_token_permissions",
13
- "missing_sandbox_variables",
14
- "cancelled",
15
- "interrupted",
16
- "error",
17
- "stopped"
18
- ],
19
- "title": "AgentSessionExitStatus",
20
- "type": "string"
21
- },
22
- "AgentSessionPr": {
23
- "description": "A pull request this session created, denormalized at capture time so\nsession surfaces render a labeled link without joining gh_prs. Live PR\nstate (open/merged/closed) is not stored here \u2014 read it from gh_prs where\na view needs it.",
24
- "properties": {
25
- "gh_pr_id": {
26
- "anyOf": [
27
- {
28
- "type": "integer"
29
- },
30
- {
31
- "type": "null"
32
- }
33
- ],
34
- "default": null,
35
- "title": "Gh Pr Id"
36
- },
37
- "number": {
38
- "title": "Number",
39
- "type": "integer"
40
- },
41
- "repo_full_name": {
42
- "title": "Repo Full Name",
43
- "type": "string"
44
- },
45
- "title": {
46
- "anyOf": [
47
- {
48
- "type": "string"
49
- },
50
- {
51
- "type": "null"
52
- }
53
- ],
54
- "default": null,
55
- "title": "Title"
56
- },
57
- "url": {
58
- "title": "Url",
59
- "type": "string"
60
- }
61
- },
62
- "required": [
63
- "gh_pr_id",
64
- "number",
65
- "repo_full_name",
66
- "title",
67
- "url"
68
- ],
69
- "title": "AgentSessionPr",
70
- "type": "object"
71
- },
72
- "AgentSessionSource": {
73
- "enum": [
74
- "react",
75
- "manual",
76
- "api",
77
- "cli",
78
- "mention",
79
- "cron",
80
- "laptop"
81
- ],
82
- "title": "AgentSessionSource",
83
- "type": "string"
84
- },
85
- "AgentSessionStatus": {
86
- "enum": [
87
- "scheduled",
88
- "creating_sandbox",
89
- "running",
90
- "retrying",
91
- "completed",
92
- "error",
93
- "cancelled",
94
- "stopped"
95
- ],
96
- "title": "AgentSessionStatus",
97
- "type": "string"
98
- },
99
3
  "AttributionType": {
100
4
  "enum": [
101
5
  "github_user",
@@ -364,42 +268,13 @@
364
268
  "Session": {
365
269
  "description": "An agent session: one conversation with an agent, from trigger to\nterminal state. Returned by `GET /sessions/{id}` and carried by the\nsession stream's `session`/`snapshot` frames \u2014 REST and stream never\ndisagree about what a session looks like.",
366
270
  "properties": {
367
- "attributed_user": {
368
- "anyOf": [
369
- {
370
- "$ref": "#/$defs/GithubAccountSnippet"
371
- },
372
- {
373
- "type": "null"
374
- }
375
- ],
376
- "default": null,
377
- "description": "The GitHub user the session is attributed to, when the attribution is a GitHub user."
271
+ "attribution": {
272
+ "$ref": "#/$defs/SessionAttribution",
273
+ "description": "The principal this session is attributed to."
378
274
  },
379
- "attribution_id": {
380
- "anyOf": [
381
- {
382
- "type": "string"
383
- },
384
- {
385
- "type": "null"
386
- }
387
- ],
388
- "default": null,
389
- "description": "Identifier of the principal the session is attributed to.",
390
- "title": "Attribution Id"
391
- },
392
- "attribution_type": {
393
- "anyOf": [
394
- {
395
- "$ref": "#/$defs/AttributionType"
396
- },
397
- {
398
- "type": "null"
399
- }
400
- ],
401
- "default": null,
402
- "description": "Kind of principal the session is attributed to (e.g. a GitHub user or an API key)."
275
+ "budget": {
276
+ "$ref": "#/$defs/SessionBudget",
277
+ "description": "The spend budget enforced for this session."
403
278
  },
404
279
  "client_version": {
405
280
  "anyOf": [
@@ -454,28 +329,9 @@
454
329
  "description": "The \"owner/name\" repository context the session was started in, if any.",
455
330
  "title": "Context Repository"
456
331
  },
457
- "cost_fee": {
458
- "default": 0,
459
- "description": "Platform fee in millicents.",
460
- "title": "Cost Fee",
461
- "type": "integer"
462
- },
463
- "cost_sandbox_cpu": {
464
- "default": 0,
465
- "description": "Sandbox CPU spend in millicents.",
466
- "title": "Cost Sandbox Cpu",
467
- "type": "integer"
468
- },
469
- "cost_sandbox_memory": {
470
- "default": 0,
471
- "description": "Sandbox memory spend in millicents.",
472
- "title": "Cost Sandbox Memory",
473
- "type": "integer"
474
- },
475
- "cost_tokens": {
476
- "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.",
477
- "title": "Cost Tokens",
478
- "type": "integer"
332
+ "cost": {
333
+ "$ref": "#/$defs/SessionCost",
334
+ "description": "What the session cost, in millicents, broken down by leg and carrying its own total."
479
335
  },
480
336
  "created_at": {
481
337
  "description": "When the session was created.",
@@ -498,7 +354,7 @@
498
354
  "exit_status": {
499
355
  "anyOf": [
500
356
  {
501
- "$ref": "#/$defs/AgentSessionExitStatus"
357
+ "$ref": "#/$defs/SessionExitStatus"
502
358
  },
503
359
  {
504
360
  "type": "null"
@@ -570,7 +426,7 @@
570
426
  "anyOf": [
571
427
  {
572
428
  "items": {
573
- "$ref": "#/$defs/AgentSessionPr"
429
+ "$ref": "#/$defs/SessionPr"
574
430
  },
575
431
  "type": "array"
576
432
  },
@@ -582,30 +438,9 @@
582
438
  "description": "Pull requests the session created or updated.",
583
439
  "title": "Output Prs"
584
440
  },
585
- "parent_kind": {
586
- "anyOf": [
587
- {
588
- "$ref": "#/$defs/ParentKind"
589
- },
590
- {
591
- "type": "null"
592
- }
593
- ],
594
- "default": null,
595
- "description": "How this session relates to its parent session, if any."
596
- },
597
- "parent_session_id": {
598
- "anyOf": [
599
- {
600
- "type": "string"
601
- },
602
- {
603
- "type": "null"
604
- }
605
- ],
606
- "default": null,
607
- "description": "Identifier of the parent session that spawned this one, if any.",
608
- "title": "Parent Session Id"
441
+ "parent": {
442
+ "$ref": "#/$defs/SessionParent",
443
+ "description": "What preceded this session, if anything."
609
444
  },
610
445
  "prompt": {
611
446
  "anyOf": [
@@ -624,28 +459,6 @@
624
459
  "$ref": "#/$defs/SessionPrompting",
625
460
  "description": "Whether a client may send this session a message and, when it may not, the reason to show instead of a composer."
626
461
  },
627
- "replayed_from_session_id": {
628
- "anyOf": [
629
- {
630
- "type": "string"
631
- },
632
- {
633
- "type": "null"
634
- }
635
- ],
636
- "default": null,
637
- "description": "Identifier of the original session this one was replayed from, if it was started via replay.",
638
- "title": "Replayed From Session Id"
639
- },
640
- "resolved_budget_cents": {
641
- "description": "The spend budget resolved for this session, in cents.",
642
- "title": "Resolved Budget Cents",
643
- "type": "integer"
644
- },
645
- "resolved_budget_source": {
646
- "$ref": "#/$defs/BudgetSource",
647
- "description": "Where the resolved budget came from."
648
- },
649
462
  "sandbox_id": {
650
463
  "anyOf": [
651
464
  {
@@ -685,11 +498,11 @@
685
498
  "description": "Lifecycle state of the durable conversation, or null for sessions without one."
686
499
  },
687
500
  "source": {
688
- "$ref": "#/$defs/AgentSessionSource",
501
+ "$ref": "#/$defs/SessionSource",
689
502
  "description": "Where the session came from (e.g. react, manual, api, cli, mention, cron, laptop)."
690
503
  },
691
504
  "status": {
692
- "$ref": "#/$defs/AgentSessionStatus",
505
+ "$ref": "#/$defs/SessionStatus",
693
506
  "description": "Execution status of the session."
694
507
  },
695
508
  "status_reason": {
@@ -705,44 +518,9 @@
705
518
  "description": "Human-readable reason for the current status, when there is one.",
706
519
  "title": "Status Reason"
707
520
  },
708
- "stopped_at": {
709
- "anyOf": [
710
- {
711
- "format": "date-time",
712
- "type": "string"
713
- },
714
- {
715
- "type": "null"
716
- }
717
- ],
718
- "default": null,
719
- "description": "When a stop was requested, if one was.",
720
- "title": "Stopped At"
721
- },
722
- "stopped_by": {
723
- "anyOf": [
724
- {
725
- "type": "integer"
726
- },
727
- {
728
- "type": "null"
729
- }
730
- ],
731
- "default": null,
732
- "description": "GitHub account id of the user who stopped the session, if known.",
733
- "title": "Stopped By"
734
- },
735
- "stopped_by_user": {
736
- "anyOf": [
737
- {
738
- "$ref": "#/$defs/GithubAccountSnippet"
739
- },
740
- {
741
- "type": "null"
742
- }
743
- ],
744
- "default": null,
745
- "description": "The GitHub user who stopped the session, if it was stopped."
521
+ "stopped": {
522
+ "$ref": "#/$defs/SessionStopped",
523
+ "description": "The stop request, if the session was stopped."
746
524
  },
747
525
  "surface": {
748
526
  "anyOf": [
@@ -756,40 +534,9 @@
756
534
  "default": null,
757
535
  "description": "The public status projection; null for laptop-synced sessions."
758
536
  },
759
- "tokens_cache_creation": {
760
- "default": 0,
761
- "description": "Tokens written to the prompt cache.",
762
- "title": "Tokens Cache Creation",
763
- "type": "integer"
764
- },
765
- "tokens_cache_read": {
766
- "default": 0,
767
- "description": "Tokens read from the prompt cache.",
768
- "title": "Tokens Cache Read",
769
- "type": "integer"
770
- },
771
- "tokens_input": {
772
- "default": 0,
773
- "description": "Input tokens used.",
774
- "title": "Tokens Input",
775
- "type": "integer"
776
- },
777
- "tokens_model": {
778
- "description": "The model the token counts are attributed to.",
779
- "title": "Tokens Model",
780
- "type": "string"
781
- },
782
- "tokens_output": {
783
- "default": 0,
784
- "description": "Output tokens used.",
785
- "title": "Tokens Output",
786
- "type": "integer"
787
- },
788
- "tokens_total": {
789
- "default": 0,
790
- "description": "Total tokens used by the session.",
791
- "title": "Tokens Total",
792
- "type": "integer"
537
+ "tokens": {
538
+ "$ref": "#/$defs/SessionTokens",
539
+ "description": "The tokens the session spent and the model they went to. `total` includes the prompt-cache lanes."
793
540
  },
794
541
  "updated_at": {
795
542
  "description": "When the session was last updated.",
@@ -824,17 +571,13 @@
824
571
  }
825
572
  },
826
573
  "required": [
827
- "attributed_user",
828
- "attribution_id",
829
- "attribution_type",
574
+ "attribution",
575
+ "budget",
830
576
  "client_version",
831
577
  "config_id",
832
578
  "config_override",
833
579
  "context_repository",
834
- "cost_fee",
835
- "cost_sandbox_cpu",
836
- "cost_sandbox_memory",
837
- "cost_tokens",
580
+ "cost",
838
581
  "created_at",
839
582
  "default_resolution",
840
583
  "exit_status",
@@ -845,29 +588,18 @@
845
588
  "live_summary",
846
589
  "metadata",
847
590
  "output_prs",
848
- "parent_kind",
849
- "parent_session_id",
591
+ "parent",
850
592
  "prompt",
851
593
  "prompting",
852
- "replayed_from_session_id",
853
- "resolved_budget_cents",
854
- "resolved_budget_source",
855
594
  "sandbox_id",
856
595
  "session_key",
857
596
  "session_state",
858
597
  "source",
859
598
  "status",
860
599
  "status_reason",
861
- "stopped_at",
862
- "stopped_by",
863
- "stopped_by_user",
600
+ "stopped",
864
601
  "surface",
865
- "tokens_cache_creation",
866
- "tokens_cache_read",
867
- "tokens_input",
868
- "tokens_model",
869
- "tokens_output",
870
- "tokens_total",
602
+ "tokens",
871
603
  "updated_at",
872
604
  "webhook_id",
873
605
  "webhook_type"
@@ -875,6 +607,140 @@
875
607
  "title": "Session",
876
608
  "type": "object"
877
609
  },
610
+ "SessionAttribution": {
611
+ "description": "The principal a session is attributed to: what kind, its id, and \u2014 when\nthe kind is a GitHub user \u2014 the resolved display snippet.",
612
+ "properties": {
613
+ "id": {
614
+ "anyOf": [
615
+ {
616
+ "type": "string"
617
+ },
618
+ {
619
+ "type": "null"
620
+ }
621
+ ],
622
+ "default": null,
623
+ "description": "Identifier of the principal the session is attributed to.",
624
+ "title": "Id"
625
+ },
626
+ "type": {
627
+ "anyOf": [
628
+ {
629
+ "$ref": "#/$defs/AttributionType"
630
+ },
631
+ {
632
+ "type": "null"
633
+ }
634
+ ],
635
+ "default": null,
636
+ "description": "Kind of principal the session is attributed to (e.g. a GitHub user or an API key)."
637
+ },
638
+ "user": {
639
+ "anyOf": [
640
+ {
641
+ "$ref": "#/$defs/GithubAccountSnippet"
642
+ },
643
+ {
644
+ "type": "null"
645
+ }
646
+ ],
647
+ "default": null,
648
+ "description": "The GitHub user the session is attributed to, resolved at read time. Null when the attribution is not a GitHub user."
649
+ }
650
+ },
651
+ "required": [
652
+ "id",
653
+ "type",
654
+ "user"
655
+ ],
656
+ "title": "SessionAttribution",
657
+ "type": "object"
658
+ },
659
+ "SessionBudget": {
660
+ "description": "The spend budget actually enforced for this session, and which layer of\nthe cascade set it.",
661
+ "properties": {
662
+ "cents": {
663
+ "default": 0,
664
+ "description": "The spend budget resolved for this session, in cents.",
665
+ "title": "Cents",
666
+ "type": "integer"
667
+ },
668
+ "source": {
669
+ "$ref": "#/$defs/BudgetSource",
670
+ "default": "account",
671
+ "description": "Where the resolved budget came from."
672
+ }
673
+ },
674
+ "required": [
675
+ "cents",
676
+ "source"
677
+ ],
678
+ "title": "SessionBudget",
679
+ "type": "object"
680
+ },
681
+ "SessionCost": {
682
+ "description": "What a session (or one turn of it) cost, in millicents.\n\n`llm` is deliberately NOT called `tokens`: it would sit beside the `tokens`\nobject and read as \"the token count's cost\" rather than \"the cost of the\nLLM leg\".",
683
+ "properties": {
684
+ "fee": {
685
+ "default": 0,
686
+ "description": "Platform fee in millicents.",
687
+ "title": "Fee",
688
+ "type": "integer"
689
+ },
690
+ "llm": {
691
+ "default": 0,
692
+ "description": "LLM spend in millicents.",
693
+ "title": "Llm",
694
+ "type": "integer"
695
+ },
696
+ "sandbox_cpu": {
697
+ "default": 0,
698
+ "description": "Sandbox CPU spend in millicents.",
699
+ "title": "Sandbox Cpu",
700
+ "type": "integer"
701
+ },
702
+ "sandbox_memory": {
703
+ "default": 0,
704
+ "description": "Sandbox memory spend in millicents.",
705
+ "title": "Sandbox Memory",
706
+ "type": "integer"
707
+ },
708
+ "total": {
709
+ "default": 0,
710
+ "description": "The grand total in millicents: llm + sandbox_cpu + sandbox_memory + fee.",
711
+ "title": "Total",
712
+ "type": "integer"
713
+ }
714
+ },
715
+ "required": [
716
+ "fee",
717
+ "llm",
718
+ "sandbox_cpu",
719
+ "sandbox_memory",
720
+ "total"
721
+ ],
722
+ "title": "SessionCost",
723
+ "type": "object"
724
+ },
725
+ "SessionExitStatus": {
726
+ "description": "Why a terminal agent session ended \u2014 a finer-grained reason than `status`.\n\n`status` (SessionStatus) is the lifecycle state: COMPLETED / ERROR /\nCANCELLED. `exit_status` explains *why* a run reached that terminal state, so\nthe UI and metrics can tell a budget cutoff apart from a crashed tool call or\na deliberate cancellation. It is None until the run reaches a terminal state.",
727
+ "enum": [
728
+ "completed",
729
+ "budget_hit",
730
+ "payment_required",
731
+ "tool_call_failed",
732
+ "lifecycle_hook_failed",
733
+ "missing_repo_access",
734
+ "missing_token_permissions",
735
+ "missing_sandbox_variables",
736
+ "cancelled",
737
+ "interrupted",
738
+ "error",
739
+ "stopped"
740
+ ],
741
+ "title": "SessionExitStatus",
742
+ "type": "string"
743
+ },
878
744
  "SessionFrame": {
879
745
  "description": "A last-writer-wins snapshot of the session \u2014 the only way status,\nstate, and cost updates arrive. Resent whole on any field change.",
880
746
  "properties": {
@@ -1037,6 +903,106 @@
1037
903
  "title": "SessionMessageStatus",
1038
904
  "type": "string"
1039
905
  },
906
+ "SessionParent": {
907
+ "description": "The ONE \"preceded-by\" chain: the predecessor session and how this one\nrelates to it. Not a parent that orchestrates children \u2014 a session never\nspawns sub-sessions.",
908
+ "properties": {
909
+ "kind": {
910
+ "anyOf": [
911
+ {
912
+ "$ref": "#/$defs/ParentKind"
913
+ },
914
+ {
915
+ "type": "null"
916
+ }
917
+ ],
918
+ "default": null,
919
+ "description": "How this session relates to its parent session, if any."
920
+ },
921
+ "replayed_from_session_id": {
922
+ "anyOf": [
923
+ {
924
+ "type": "string"
925
+ },
926
+ {
927
+ "type": "null"
928
+ }
929
+ ],
930
+ "default": null,
931
+ "description": "Identifier of the original session this one was replayed from, if it was started via replay.",
932
+ "title": "Replayed From Session Id"
933
+ },
934
+ "session_id": {
935
+ "anyOf": [
936
+ {
937
+ "type": "string"
938
+ },
939
+ {
940
+ "type": "null"
941
+ }
942
+ ],
943
+ "default": null,
944
+ "description": "Identifier of the parent session that spawned this one, if any.",
945
+ "title": "Session Id"
946
+ }
947
+ },
948
+ "required": [
949
+ "kind",
950
+ "replayed_from_session_id",
951
+ "session_id"
952
+ ],
953
+ "title": "SessionParent",
954
+ "type": "object"
955
+ },
956
+ "SessionPr": {
957
+ "description": "A pull request this session created, denormalized at capture time so\nsession surfaces render a labeled link without joining gh_prs. Live PR\nstate (open/merged/closed) is not stored here \u2014 read it from gh_prs where\na view needs it.",
958
+ "properties": {
959
+ "gh_pr_id": {
960
+ "anyOf": [
961
+ {
962
+ "type": "integer"
963
+ },
964
+ {
965
+ "type": "null"
966
+ }
967
+ ],
968
+ "default": null,
969
+ "title": "Gh Pr Id"
970
+ },
971
+ "number": {
972
+ "title": "Number",
973
+ "type": "integer"
974
+ },
975
+ "repo_full_name": {
976
+ "title": "Repo Full Name",
977
+ "type": "string"
978
+ },
979
+ "title": {
980
+ "anyOf": [
981
+ {
982
+ "type": "string"
983
+ },
984
+ {
985
+ "type": "null"
986
+ }
987
+ ],
988
+ "default": null,
989
+ "title": "Title"
990
+ },
991
+ "url": {
992
+ "title": "Url",
993
+ "type": "string"
994
+ }
995
+ },
996
+ "required": [
997
+ "gh_pr_id",
998
+ "number",
999
+ "repo_full_name",
1000
+ "title",
1001
+ "url"
1002
+ ],
1003
+ "title": "SessionPr",
1004
+ "type": "object"
1005
+ },
1040
1006
  "SessionPrompting": {
1041
1007
  "description": "The prompt-affordance projection. `enabled` answers \"would a send work\",\nand when it wouldn't, `blocked_reason` + `detail` say why.\n\n`surface_name` is set only for MENTION_SURFACE, naming where to reply.",
1042
1008
  "properties": {
@@ -1253,8 +1219,21 @@
1253
1219
  "title": "SessionRecord",
1254
1220
  "type": "object"
1255
1221
  },
1222
+ "SessionSource": {
1223
+ "enum": [
1224
+ "react",
1225
+ "manual",
1226
+ "api",
1227
+ "cli",
1228
+ "mention",
1229
+ "cron",
1230
+ "laptop"
1231
+ ],
1232
+ "title": "SessionSource",
1233
+ "type": "string"
1234
+ },
1256
1235
  "SessionState": {
1257
- "description": "Lifecycle of a keyed (multi-turn) session \u2014 the durable conversation.\nDistinct from AgentSessionStatus, which is per-execution (one turn's run) and\nmoves to agent_turns in a later slice. IDLE: alive, waiting for the next\nmessage. RUNNING: a turn is executing. CLOSED: the conversation is done and\nits sandbox/snapshots are torn down.",
1236
+ "description": "Lifecycle of a keyed (multi-turn) session \u2014 the durable conversation.\nDistinct from SessionStatus, which is per-execution (one turn's run) and\nmoves to agent_turns in a later slice. IDLE: alive, waiting for the next\nmessage. RUNNING: a turn is executing. CLOSED: the conversation is done and\nits sandbox/snapshots are torn down.",
1258
1237
  "enum": [
1259
1238
  "idle",
1260
1239
  "running",
@@ -1263,6 +1242,71 @@
1263
1242
  "title": "SessionState",
1264
1243
  "type": "string"
1265
1244
  },
1245
+ "SessionStatus": {
1246
+ "enum": [
1247
+ "scheduled",
1248
+ "creating_sandbox",
1249
+ "running",
1250
+ "retrying",
1251
+ "completed",
1252
+ "error",
1253
+ "cancelled",
1254
+ "stopped"
1255
+ ],
1256
+ "title": "SessionStatus",
1257
+ "type": "string"
1258
+ },
1259
+ "SessionStopped": {
1260
+ "description": "The stop request, if there was one: when, by which GitHub account id,\nand that account resolved to a display snippet.",
1261
+ "properties": {
1262
+ "at": {
1263
+ "anyOf": [
1264
+ {
1265
+ "format": "date-time",
1266
+ "type": "string"
1267
+ },
1268
+ {
1269
+ "type": "null"
1270
+ }
1271
+ ],
1272
+ "default": null,
1273
+ "description": "When a stop was requested, if one was.",
1274
+ "title": "At"
1275
+ },
1276
+ "by": {
1277
+ "anyOf": [
1278
+ {
1279
+ "type": "integer"
1280
+ },
1281
+ {
1282
+ "type": "null"
1283
+ }
1284
+ ],
1285
+ "default": null,
1286
+ "description": "GitHub account id of the user who stopped the session, if known.",
1287
+ "title": "By"
1288
+ },
1289
+ "by_user": {
1290
+ "anyOf": [
1291
+ {
1292
+ "$ref": "#/$defs/GithubAccountSnippet"
1293
+ },
1294
+ {
1295
+ "type": "null"
1296
+ }
1297
+ ],
1298
+ "default": null,
1299
+ "description": "The GitHub user who stopped the session, resolved at read time."
1300
+ }
1301
+ },
1302
+ "required": [
1303
+ "at",
1304
+ "by",
1305
+ "by_user"
1306
+ ],
1307
+ "title": "SessionStopped",
1308
+ "type": "object"
1309
+ },
1266
1310
  "SessionSurface": {
1267
1311
  "description": "The three fields we expose. All `None` for an un-keyed (laptop) session.\n\n`use_enum_values=True` (from CustomBaseModel) stores the members as their\nstring values, so this serializes to `{\"session\": \"alive\", \"run\": \"waiting\",\n\"status\": \"waiting\"}` \u2014 a plain object, not enum names.",
1268
1312
  "properties": {
@@ -1306,6 +1350,57 @@
1306
1350
  "title": "SessionSurface",
1307
1351
  "type": "object"
1308
1352
  },
1353
+ "SessionTokens": {
1354
+ "description": "The token counts a session (or turn) spent, and the model they went to.\n\n`total` INCLUDES the cache lanes, unlike the old flat `tokens_total` which\ncounted input+output+thinking only and left callers to add cache reads and\nwrites back themselves (the deleted `tokensTotalAll` helper). Cache tokens\ndominate an agent run's token bill, so a \"total\" that omits them is the\nwrong default and produced two competing totals in the dashboard.",
1355
+ "properties": {
1356
+ "cache_creation": {
1357
+ "default": 0,
1358
+ "description": "Tokens written to the prompt cache.",
1359
+ "title": "Cache Creation",
1360
+ "type": "integer"
1361
+ },
1362
+ "cache_read": {
1363
+ "default": 0,
1364
+ "description": "Tokens read from the prompt cache.",
1365
+ "title": "Cache Read",
1366
+ "type": "integer"
1367
+ },
1368
+ "input": {
1369
+ "default": 0,
1370
+ "description": "Input tokens used.",
1371
+ "title": "Input",
1372
+ "type": "integer"
1373
+ },
1374
+ "model": {
1375
+ "default": "",
1376
+ "description": "The model the token counts are attributed to.",
1377
+ "title": "Model",
1378
+ "type": "string"
1379
+ },
1380
+ "output": {
1381
+ "default": 0,
1382
+ "description": "Output tokens used.",
1383
+ "title": "Output",
1384
+ "type": "integer"
1385
+ },
1386
+ "total": {
1387
+ "default": 0,
1388
+ "description": "Total tokens consumed, INCLUDING the prompt-cache reads and writes \u2014 the same basis the token cost is priced on.",
1389
+ "title": "Total",
1390
+ "type": "integer"
1391
+ }
1392
+ },
1393
+ "required": [
1394
+ "cache_creation",
1395
+ "cache_read",
1396
+ "input",
1397
+ "model",
1398
+ "output",
1399
+ "total"
1400
+ ],
1401
+ "title": "SessionTokens",
1402
+ "type": "object"
1403
+ },
1309
1404
  "SnapshotFrame": {
1310
1405
  "description": "The first frame after the stream connects: the session plus its open\ninbox. Records always arrive separately via records_append frames.",
1311
1406
  "properties": {