@deepseek-ai/dsh-api-session-controller 0.1.2-alpha.5 → 0.1.3-alpha.2

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.
Files changed (34) hide show
  1. package/README.i18n.yaml +2 -2
  2. package/README.md +6 -6
  3. package/README.zh.md +6 -6
  4. package/lib/client.js +592 -28
  5. package/lib/index.js +269 -214
  6. package/lib/typert.host.js +183 -141
  7. package/lib/typert.remote-client.js +79 -97
  8. package/lib/types/assistant-stream.d.ts +26 -0
  9. package/lib/types/assistant-stream.js +83 -0
  10. package/lib/types/client/contract/events.d.ts +38 -7
  11. package/lib/types/client/contract/events.js +21 -0
  12. package/lib/types/client/contract/session.d.ts +7 -7
  13. package/lib/types/client/contract/snapshot.d.ts +15 -2
  14. package/lib/types/client/index.d.ts +2 -2
  15. package/lib/types/client/index.js +2 -0
  16. package/lib/types/client/sessions/assistant-stream.d.ts +51 -0
  17. package/lib/types/client/sessions/assistant-stream.js +168 -0
  18. package/lib/types/client/sessions/history-records.d.ts +2 -2
  19. package/lib/types/client/sessions/history-records.js +3 -8
  20. package/lib/types/client/sessions/queue-mirror.js +3 -3
  21. package/lib/types/client/sessions/remotes.d.ts +2 -2
  22. package/lib/types/client/sessions/session.d.ts +3 -1
  23. package/lib/types/client/sessions/session.js +63 -15
  24. package/lib/types/client/transport.d.ts +7 -3
  25. package/lib/types/client/transport.js +18 -3
  26. package/lib/types/commands.js +98 -28
  27. package/lib/types/history.d.ts +2 -1
  28. package/lib/types/history.js +66 -37
  29. package/lib/types/index.d.ts +4 -4
  30. package/lib/types/index.js +13 -5
  31. package/lib/types/list.d.ts +2 -9
  32. package/lib/types/list.js +10 -124
  33. package/lib/types/types.d.ts +71 -29
  34. package/package.json +63 -57
@@ -2,6 +2,13 @@
2
2
  import { z } from 'zod'
3
3
 
4
4
  const ContentBlockRemoteCodec$schema = z.union([z.object({
5
+ 'type': z.literal("file"),
6
+ 'attachment': z.object({
7
+ 'attachmentId': z.intersection(z.string(), z.unknown()),
8
+ 'name': z.string(),
9
+ 'bytes': z.number(),
10
+ }),
11
+ }), z.object({
5
12
  'type': z.literal("text"),
6
13
  'text': z.string(),
7
14
  }), z.object({
@@ -210,6 +217,7 @@ const _deepseek_ai_dsh_api_session_controller_session_follow_parameter_0$schema
210
217
  'mode': z.union([z.literal("one-shot"), z.literal("continuable")]).readonly(),
211
218
  })]).readonly(),
212
219
  'maxMessages': z.number().readonly().optional(),
220
+ 'assistantStream': z.literal(true).readonly().optional(),
213
221
  })
214
222
  const _deepseek_ai_dsh_api_session_controller_session_follow_result$schema = z.union([z.object({
215
223
  'type': z.literal("event").readonly(),
@@ -234,13 +242,13 @@ const _deepseek_ai_dsh_api_session_controller_session_follow_result$schema = z.u
234
242
  'createdAt': z.number().readonly(),
235
243
  'cwd': z.string().readonly().optional(),
236
244
  'parentSession': z.intersection(z.string(), z.unknown()).readonly().optional(),
237
- 'seedLength': z.number().readonly().optional(),
245
+ 'isSeeded': z.boolean().readonly(),
238
246
  'origin': z.literal("subagent").readonly().optional(),
239
247
  'delegationDepth': z.number().readonly().optional(),
240
248
  'agentPreset': z.string().readonly().optional(),
241
249
  }).readonly(),
242
250
  'cursor': z.number().readonly(),
243
- 'records': z.array(z.union([z.object({
251
+ 'records': z.array(z.object({
244
252
  'type': z.literal("event").readonly(),
245
253
  'event': z.object({
246
254
  'type': z.string().readonly(),
@@ -255,45 +263,7 @@ const _deepseek_ai_dsh_api_session_controller_session_follow_result$schema = z.u
255
263
  'end': z.number().readonly(),
256
264
  })]).readonly().optional(),
257
265
  }).readonly(),
258
- }), z.object({
259
- 'type': z.literal("chunks").readonly(),
260
- 'event': z.union([z.object({
261
- 'type': z.literal("chunkrow/text-chunks").readonly(),
262
- 'seq': z.number().readonly(),
263
- 'time': z.number().readonly(),
264
- 'data': z.object({
265
- 'texts': z.array(z.string()),
266
- 'turn': z.number(),
267
- 'step': z.number(),
268
- 'index': z.number(),
269
- 'dt': z.array(z.number()),
270
- }).readonly(),
271
- }), z.object({
272
- 'type': z.literal("chunkrow/reasoning-chunks").readonly(),
273
- 'seq': z.number().readonly(),
274
- 'time': z.number().readonly(),
275
- 'data': z.object({
276
- 'texts': z.array(z.string()),
277
- 'turn': z.number(),
278
- 'step': z.number(),
279
- 'index': z.number(),
280
- 'dt': z.array(z.number()),
281
- }).readonly(),
282
- }), z.object({
283
- 'type': z.literal("chunkrow/tool-call-chunks").readonly(),
284
- 'seq': z.number().readonly(),
285
- 'time': z.number().readonly(),
286
- 'data': z.object({
287
- 'id': z.intersection(z.string(), z.unknown()),
288
- 'name': z.string().optional(),
289
- 'args': z.array(z.string()),
290
- 'turn': z.number(),
291
- 'step': z.number(),
292
- 'index': z.number(),
293
- 'dt': z.array(z.number()),
294
- }).readonly(),
295
- })]).readonly(),
296
- })])).readonly(),
266
+ })).readonly(),
297
267
  'hasMore': z.boolean().readonly(),
298
268
  'projections': z.object({
299
269
  'asOfSeq': z.number().readonly(),
@@ -362,6 +332,46 @@ const _deepseek_ai_dsh_api_session_controller_session_follow_result$schema = z.u
362
332
  })]).optional(),
363
333
  }), z.record(z.string(), z.union([z.literal(null), z.string(), z.number(), z.literal(false), z.literal(true), z.array(z.lazy(() => JsonValueRemoteCodec$schema3)), z.record(z.string(), z.lazy(() => JsonValueRemoteCodec$schema3))])).readonly()).readonly(),
364
334
  }).readonly(),
335
+ 'assistantStream': z.object({
336
+ 'revision': z.number().readonly(),
337
+ 'activeAttempt': z.object({
338
+ 'attemptId': z.intersection(z.string(), z.unknown()).readonly(),
339
+ 'startedAfterSeq': z.union([z.intersection(z.number(), z.unknown()), z.literal(-1)]).readonly(),
340
+ 'turn': z.number().readonly(),
341
+ 'step': z.number().readonly(),
342
+ 'nextIndex': z.number().readonly(),
343
+ 'stream': z.array(z.union([z.literal(null), z.string(), z.number(), z.literal(false), z.literal(true), z.array(z.lazy(() => JsonValueRemoteCodec$schema3)), z.record(z.string(), z.lazy(() => JsonValueRemoteCodec$schema3))])).readonly(),
344
+ }).readonly().optional(),
345
+ }).readonly().optional(),
346
+ }), z.object({
347
+ 'type': z.literal("assistant-stream").readonly(),
348
+ 'frame': z.union([z.object({
349
+ 'type': z.literal("start").readonly(),
350
+ 'attemptId': z.intersection(z.string(), z.unknown()).readonly(),
351
+ 'revision': z.number().readonly(),
352
+ 'startedAfterSeq': z.union([z.intersection(z.number(), z.unknown()), z.literal(-1)]).readonly(),
353
+ 'turn': z.number().readonly(),
354
+ 'step': z.number().readonly(),
355
+ }), z.object({
356
+ 'type': z.literal("chunk").readonly(),
357
+ 'attemptId': z.intersection(z.string(), z.unknown()).readonly(),
358
+ 'revision': z.number().readonly(),
359
+ 'index': z.number().readonly(),
360
+ 'time': z.number().readonly(),
361
+ 'chunk': z.union([z.literal(null), z.string(), z.number(), z.literal(false), z.literal(true), z.array(z.lazy(() => JsonValueRemoteCodec$schema3)), z.record(z.string(), z.lazy(() => JsonValueRemoteCodec$schema3))]).readonly(),
362
+ }), z.object({
363
+ 'type': z.literal("end").readonly(),
364
+ 'attemptId': z.intersection(z.string(), z.unknown()).readonly(),
365
+ 'revision': z.number().readonly(),
366
+ 'index': z.number().readonly(),
367
+ 'outcome': z.union([z.object({
368
+ 'kind': z.literal("committed").readonly(),
369
+ 'eventType': z.union([z.literal("assistant/message"), z.literal("assistant/attempt")]).readonly(),
370
+ 'seq': z.number().readonly(),
371
+ }), z.object({
372
+ 'kind': z.literal("abandoned").readonly(),
373
+ })]).readonly(),
374
+ })]).readonly(),
365
375
  })])
366
376
  const _deepseek_ai_dsh_api_session_controller_session_fork_parameter_0$schema = z.object({
367
377
  'sessionId': z.intersection(z.string(), z.unknown()).readonly(),
@@ -502,7 +512,7 @@ const _deepseek_ai_dsh_api_session_controller_session_page_parameter_0$schema =
502
512
  'maxMessages': z.number().readonly().optional(),
503
513
  })
504
514
  const _deepseek_ai_dsh_api_session_controller_session_page_result$schema = z.object({
505
- 'records': z.array(z.union([z.object({
515
+ 'records': z.array(z.object({
506
516
  'type': z.literal("event").readonly(),
507
517
  'event': z.object({
508
518
  'type': z.string().readonly(),
@@ -517,45 +527,7 @@ const _deepseek_ai_dsh_api_session_controller_session_page_result$schema = z.obj
517
527
  'end': z.number().readonly(),
518
528
  })]).readonly().optional(),
519
529
  }).readonly(),
520
- }), z.object({
521
- 'type': z.literal("chunks").readonly(),
522
- 'event': z.union([z.object({
523
- 'type': z.literal("chunkrow/text-chunks").readonly(),
524
- 'seq': z.number().readonly(),
525
- 'time': z.number().readonly(),
526
- 'data': z.object({
527
- 'texts': z.array(z.string()),
528
- 'turn': z.number(),
529
- 'step': z.number(),
530
- 'index': z.number(),
531
- 'dt': z.array(z.number()),
532
- }).readonly(),
533
- }), z.object({
534
- 'type': z.literal("chunkrow/reasoning-chunks").readonly(),
535
- 'seq': z.number().readonly(),
536
- 'time': z.number().readonly(),
537
- 'data': z.object({
538
- 'texts': z.array(z.string()),
539
- 'turn': z.number(),
540
- 'step': z.number(),
541
- 'index': z.number(),
542
- 'dt': z.array(z.number()),
543
- }).readonly(),
544
- }), z.object({
545
- 'type': z.literal("chunkrow/tool-call-chunks").readonly(),
546
- 'seq': z.number().readonly(),
547
- 'time': z.number().readonly(),
548
- 'data': z.object({
549
- 'id': z.intersection(z.string(), z.unknown()),
550
- 'name': z.string().optional(),
551
- 'args': z.array(z.string()),
552
- 'turn': z.number(),
553
- 'step': z.number(),
554
- 'index': z.number(),
555
- 'dt': z.array(z.number()),
556
- }).readonly(),
557
- })]).readonly(),
558
- })])).readonly(),
530
+ })).readonly(),
559
531
  'hasMore': z.boolean().readonly(),
560
532
  })
561
533
  const _deepseek_ai_dsh_api_session_controller_session_prompt_parameter_0$schema = z.object({
@@ -570,6 +542,9 @@ const _deepseek_ai_dsh_api_session_controller_session_prompt_parameter_0$schema
570
542
  'mediaType': z.union([z.literal("image/png"), z.literal("image/jpeg"), z.literal("image/webp"), z.literal("image/gif")]).readonly(),
571
543
  'data': z.string().readonly(),
572
544
  'name': z.string().readonly().optional(),
545
+ }), z.object({
546
+ 'type': z.literal("file").readonly(),
547
+ 'receiptId': z.intersection(z.string(), z.unknown()).readonly(),
573
548
  })])).readonly(),
574
549
  'clientTimeZone': z.string().readonly().optional(),
575
550
  })
@@ -613,6 +588,13 @@ const _deepseek_ai_dsh_api_session_controller_session_updateQueue_parameter_0$sc
613
588
  'action': z.union([z.object({
614
589
  'kind': z.literal("edit").readonly(),
615
590
  'content': z.array(z.union([z.object({
591
+ 'type': z.literal("file"),
592
+ 'attachment': z.object({
593
+ 'attachmentId': z.intersection(z.string(), z.unknown()),
594
+ 'name': z.string(),
595
+ 'bytes': z.number(),
596
+ }),
597
+ }), z.object({
616
598
  'type': z.literal("text"),
617
599
  'text': z.string(),
618
600
  }), z.object({
@@ -734,7 +716,7 @@ export const TYPERT = {
734
716
  typeSymbol: '@deepseek-ai/dsh-api-session-controller/types#SessionAttachmentValue',
735
717
  schema: _deepseek_ai_dsh_api_session_controller_session_attachment_result$schema,
736
718
  },
737
- sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":338,"column":3},
719
+ sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":340,"column":3},
738
720
  },
739
721
  {
740
722
  id: '@deepseek-ai/dsh-api-session-controller#session/cancel',
@@ -759,7 +741,7 @@ export const TYPERT = {
759
741
  typeSymbol: '@deepseek-ai/dsh-api-session-controller/types#SessionCancelValue',
760
742
  schema: _deepseek_ai_dsh_api_session_controller_session_cancel_result$schema,
761
743
  },
762
- sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":358,"column":3},
744
+ sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":360,"column":3},
763
745
  },
764
746
  {
765
747
  id: '@deepseek-ai/dsh-api-session-controller#session/canOpenWorkspacePath',
@@ -774,7 +756,7 @@ export const TYPERT = {
774
756
  typeSymbol: '@deepseek-ai/dsh-api-session-controller#session/canOpenWorkspacePath:result',
775
757
  schema: _deepseek_ai_dsh_api_session_controller_session_canOpenWorkspacePath_result$schema,
776
758
  },
777
- sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":263,"column":3},
759
+ sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":265,"column":3},
778
760
  },
779
761
  {
780
762
  id: '@deepseek-ai/dsh-api-session-controller#session/control',
@@ -791,7 +773,7 @@ export const TYPERT = {
791
773
  typeSymbol: '@deepseek-ai/dsh-api-session-controller/types#SessionControlFrame',
792
774
  schema: _deepseek_ai_dsh_api_session_controller_session_control_result$schema,
793
775
  },
794
- sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":390,"column":3},
776
+ sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":393,"column":3},
795
777
  },
796
778
  {
797
779
  id: '@deepseek-ai/dsh-api-session-controller#session/create',
@@ -816,7 +798,7 @@ export const TYPERT = {
816
798
  typeSymbol: '@deepseek-ai/dsh-api-session-controller/types#SessionCreateValue',
817
799
  schema: _deepseek_ai_dsh_api_session_controller_session_create_result$schema,
818
800
  },
819
- sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":235,"column":3},
801
+ sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":237,"column":3},
820
802
  },
821
803
  {
822
804
  id: '@deepseek-ai/dsh-api-session-controller#session/follow',
@@ -843,7 +825,7 @@ export const TYPERT = {
843
825
  typeSymbol: '@deepseek-ai/dsh-api-session-controller/types#SessionFollowFrame',
844
826
  schema: _deepseek_ai_dsh_api_session_controller_session_follow_result$schema,
845
827
  },
846
- sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":380,"column":3},
828
+ sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":383,"column":3},
847
829
  },
848
830
  {
849
831
  id: '@deepseek-ai/dsh-api-session-controller#session/fork',
@@ -868,7 +850,7 @@ export const TYPERT = {
868
850
  typeSymbol: '@deepseek-ai/dsh-api-session-controller/types#SessionForkValue',
869
851
  schema: _deepseek_ai_dsh_api_session_controller_session_fork_result$schema,
870
852
  },
871
- sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":316,"column":3},
853
+ sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":318,"column":3},
872
854
  },
873
855
  {
874
856
  id: '@deepseek-ai/dsh-api-session-controller#session/list',
@@ -894,7 +876,7 @@ export const TYPERT = {
894
876
  typeSymbol: '@deepseek-ai/dsh-api-session-controller/types#SessionListValue',
895
877
  schema: _deepseek_ai_dsh_api_session_controller_session_list_result$schema,
896
878
  },
897
- sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":214,"column":9},
879
+ sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":216,"column":9},
898
880
  },
899
881
  {
900
882
  id: '@deepseek-ai/dsh-api-session-controller#session/modelCatalog',
@@ -909,7 +891,7 @@ export const TYPERT = {
909
891
  typeSymbol: '@deepseek-ai/dsh-api-session-controller/types#ModelCatalog',
910
892
  schema: _deepseek_ai_dsh_api_session_controller_session_modelCatalog_result$schema,
911
893
  },
912
- sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":254,"column":3},
894
+ sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":256,"column":3},
913
895
  },
914
896
  {
915
897
  id: '@deepseek-ai/dsh-api-session-controller#session/openWorkspacePath',
@@ -935,7 +917,7 @@ export const TYPERT = {
935
917
  typeSymbol: '@deepseek-ai/dsh-api-session-controller/types#SessionOpenWorkspacePathValue',
936
918
  schema: _deepseek_ai_dsh_api_session_controller_session_openWorkspacePath_result$schema,
937
919
  },
938
- sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":275,"column":9},
920
+ sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":277,"column":9},
939
921
  },
940
922
  {
941
923
  id: '@deepseek-ai/dsh-api-session-controller#session/page',
@@ -961,7 +943,7 @@ export const TYPERT = {
961
943
  typeSymbol: '@deepseek-ai/dsh-api-session-controller/types#SessionPage',
962
944
  schema: _deepseek_ai_dsh_api_session_controller_session_page_result$schema,
963
945
  },
964
- sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":369,"column":3},
946
+ sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":371,"column":3},
965
947
  },
966
948
  {
967
949
  id: '@deepseek-ai/dsh-api-session-controller#session/prompt',
@@ -987,7 +969,7 @@ export const TYPERT = {
987
969
  typeSymbol: '@deepseek-ai/dsh-api-session-controller/types#SessionPromptValue',
988
970
  schema: _deepseek_ai_dsh_api_session_controller_session_prompt_result$schema,
989
971
  },
990
- sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":327,"column":3},
972
+ sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":329,"column":3},
991
973
  },
992
974
  {
993
975
  id: '@deepseek-ai/dsh-api-session-controller#session/rename',
@@ -1012,7 +994,7 @@ export const TYPERT = {
1012
994
  typeSymbol: '@deepseek-ai/dsh-api-session-controller/types#SessionRenameValue',
1013
995
  schema: _deepseek_ai_dsh_api_session_controller_session_rename_result$schema,
1014
996
  },
1015
- sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":306,"column":3},
997
+ sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":308,"column":3},
1016
998
  },
1017
999
  {
1018
1000
  id: '@deepseek-ai/dsh-api-session-controller#session/search',
@@ -1038,7 +1020,7 @@ export const TYPERT = {
1038
1020
  typeSymbol: '@deepseek-ai/dsh-api-session-controller/types#SessionSearchValue',
1039
1021
  schema: _deepseek_ai_dsh_api_session_controller_session_search_result$schema,
1040
1022
  },
1041
- sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":225,"column":3},
1023
+ sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":227,"column":3},
1042
1024
  },
1043
1025
  {
1044
1026
  id: '@deepseek-ai/dsh-api-session-controller#session/selectModel',
@@ -1063,7 +1045,7 @@ export const TYPERT = {
1063
1045
  typeSymbol: '@deepseek-ai/dsh-api-session-controller/types#SessionSelectModelValue',
1064
1046
  schema: _deepseek_ai_dsh_api_session_controller_session_selectModel_result$schema,
1065
1047
  },
1066
- sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":245,"column":3},
1048
+ sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":247,"column":3},
1067
1049
  },
1068
1050
  {
1069
1051
  id: '@deepseek-ai/dsh-api-session-controller#session/updateQueue',
@@ -1088,7 +1070,7 @@ export const TYPERT = {
1088
1070
  typeSymbol: '@deepseek-ai/dsh-api-session-controller/types#SessionUpdateQueueValue',
1089
1071
  schema: _deepseek_ai_dsh_api_session_controller_session_updateQueue_result$schema,
1090
1072
  },
1091
- sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":348,"column":3},
1073
+ sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":350,"column":3},
1092
1074
  },
1093
1075
  {
1094
1076
  id: '@deepseek-ai/dsh-api-session-controller#skills/list',
@@ -1244,7 +1226,7 @@ export const TYPERT = {
1244
1226
  "name": "follow",
1245
1227
  "signature": "@Remote({ mode: 'stream' }) follow(request: SessionFollowRequest, signal: AbortSignal): AsyncIterable<SessionFollowFrame>",
1246
1228
  "summary": "Follow one Session log from its opening or resume cursor.",
1247
- "jsDoc": "/**\n * Follow one Session log from its opening or resume cursor.\n * @param request - durable address and last committed sequence already held by the caller.\n * @param signal - cancellation owned by the Remote stream carrier.\n * @returns a complete opening snapshot followed by gap-free event frames.\n */"
1229
+ "jsDoc": "/**\n * Follow one Session log from its opening or resume cursor.\n * @param request - durable address and last committed sequence already held by the caller.\n * @param signal - cancellation owned by the Remote stream carrier.\n * @returns a complete opening snapshot followed by gap-free durable event\n * frames and optional cursorless assistant-stream frames.\n */"
1248
1230
  },
1249
1231
  {
1250
1232
  "kind": "method",
@@ -1303,6 +1285,10 @@ export const TYPERT = {
1303
1285
  "name": "AssistantProvenance",
1304
1286
  "declaration": "export interface AssistantProvenance {\n provider: string;\n model: string;\n replayState?: unknown;\n}"
1305
1287
  },
1288
+ {
1289
+ "name": "AssistantStreamRecord",
1290
+ "declaration": "export type AssistantStreamRecord = { readonly type: 'text-chunks'; readonly time0: number; readonly index: number; readonly dt: readonly number[]; readonly texts: readonly string[]; } | { readonly type: 'reasoning-chunks'; readonly time0: number; readonly index: number; readonly dt: readonly number[]; readonly texts: readonly string[]; } | { readonly type: 'tool-call-chunks'; readonly time0: number; readonly index: number; readonly dt: readonly number[]; readonly id: ToolCallId; readonly name?: string; readonly args: readonly string[]; } | { readonly type: 'chunk'; readonly time: number; readonly chunk: StreamChunk; };"
1291
+ },
1306
1292
  {
1307
1293
  "name": "AttachmentId",
1308
1294
  "declaration": "export type AttachmentId = Branded<'AttachmentId'>;"
@@ -1319,14 +1305,6 @@ export const TYPERT = {
1319
1305
  "name": "CancelOptions",
1320
1306
  "declaration": "export interface CancelOptions {\n keepInbox?: boolean | undefined;\n}"
1321
1307
  },
1322
- {
1323
- "name": "ChunkRow",
1324
- "declaration": "export type ChunkRow = { type: 'text-chunks'; seq0: SessionSeqType; time0: number; data: TextRunData; } | { type: 'reasoning-chunks'; seq0: SessionSeqType; time0: number; data: TextRunData; } | { type: 'tool-call-chunks'; seq0: SessionSeqType; time0: number; data: ToolCallRunData; };"
1325
- },
1326
- {
1327
- "name": "ChunkRowEvent",
1328
- "declaration": "export type ChunkRowEvent = { [Kind in ChunkRow['type']]: { readonly type: `chunkrow/${Kind}`; readonly seq: number; readonly time: number; readonly data: Extract<ChunkRow, { readonly type: Kind; }>['data']; } }[ChunkRow['type']];"
1329
- },
1330
1308
  {
1331
1309
  "name": "CommandId",
1332
1310
  "declaration": "export type CommandId = Branded<'CommandId'>;"
@@ -1349,7 +1327,7 @@ export const TYPERT = {
1349
1327
  },
1350
1328
  {
1351
1329
  "name": "ContentBlockMap",
1352
- "declaration": "export interface ContentBlockMap {\n text: TextBlock;\n reasoning: ReasoningBlock;\n image: ImageBlock;\n 'tool-call': ToolCallBlock;\n 'tool-result': ToolResultBlock;\n}"
1330
+ "declaration": "export interface ContentBlockMap {\n text: TextBlock;\n reasoning: ReasoningBlock;\n image: ImageBlock;\n file: FileBlock;\n 'tool-call': ToolCallBlock;\n 'tool-result': ToolResultBlock;\n}"
1353
1331
  },
1354
1332
  {
1355
1333
  "name": "ContentBlockType",
@@ -1371,6 +1349,14 @@ export const TYPERT = {
1371
1349
  "name": "EpochHeader",
1372
1350
  "declaration": "export interface EpochHeader {\n config: LlmCallConfig;\n adapterDefaults?: LlmCallConfigAdapterDefaults;\n system?: string;\n tools?: ToolSchema[];\n}"
1373
1351
  },
1352
+ {
1353
+ "name": "FileAttachmentRef",
1354
+ "declaration": "export interface FileAttachmentRef {\n attachmentId: AttachmentId;\n name: string;\n bytes: number;\n}"
1355
+ },
1356
+ {
1357
+ "name": "FileBlock",
1358
+ "declaration": "export interface FileBlock {\n type: 'file';\n attachment: FileAttachmentRef;\n}"
1359
+ },
1374
1360
  {
1375
1361
  "name": "FinishReason",
1376
1362
  "declaration": "export type FinishReason = FinishReasonMap[keyof FinishReasonMap];"
@@ -1455,6 +1441,10 @@ export const TYPERT = {
1455
1441
  "name": "JsonValue",
1456
1442
  "declaration": "export type JsonValue = null | boolean | number | string | JsonValue[] | { [key: string]: JsonValue; };"
1457
1443
  },
1444
+ {
1445
+ "name": "LlmAttemptId",
1446
+ "declaration": "export type LlmAttemptId = Branded<'LlmAttemptId'>;"
1447
+ },
1458
1448
  {
1459
1449
  "name": "LlmCallConfig",
1460
1450
  "declaration": "export interface LlmCallConfig {\n provider: string;\n model: string;\n reasoningEffort?: ReasoningEffortId;\n temperature?: number;\n maxTokens?: number;\n stop?: string[];\n}"
@@ -1471,6 +1461,26 @@ export const TYPERT = {
1471
1461
  "name": "Message",
1472
1462
  "declaration": "export interface Message {\n readonly id: MessageId;\n readonly role: 'system' | 'user' | 'assistant';\n readonly content: ContentBlock[];\n readonly source: MessageSource;\n}"
1473
1463
  },
1464
+ {
1465
+ "name": "MessageFeedbackDelete",
1466
+ "declaration": "export interface MessageFeedbackDelete {\n readonly sessionId: SessionId;\n readonly messageId: MessageId;\n}"
1467
+ },
1468
+ {
1469
+ "name": "MessageFeedbackItem",
1470
+ "declaration": "export interface MessageFeedbackItem {\n readonly messageId: MessageId;\n readonly rating: MessageFeedbackRating;\n readonly note?: string;\n readonly version: MessageFeedbackVersion;\n readonly createdAt: number;\n readonly updatedAt: number;\n}"
1471
+ },
1472
+ {
1473
+ "name": "MessageFeedbackPut",
1474
+ "declaration": "export interface MessageFeedbackPut {\n readonly sessionId: SessionId;\n readonly item: MessageFeedbackItem;\n}"
1475
+ },
1476
+ {
1477
+ "name": "MessageFeedbackRating",
1478
+ "declaration": "export type MessageFeedbackRating = 'positive' | 'negative';"
1479
+ },
1480
+ {
1481
+ "name": "MessageFeedbackVersion",
1482
+ "declaration": "export type MessageFeedbackVersion = Branded<'MessageFeedbackVersion'>;"
1483
+ },
1474
1484
  {
1475
1485
  "name": "MessageId",
1476
1486
  "declaration": "export type MessageId = Branded<'MessageId'>;"
@@ -1529,7 +1539,7 @@ export const TYPERT = {
1529
1539
  },
1530
1540
  {
1531
1541
  "name": "PromptContentPart",
1532
- "declaration": "export type PromptContentPart = { readonly type: 'text'; readonly text: string; } | { readonly type: 'image'; readonly mediaType: ImageMediaType; readonly data: string; readonly name?: string; };"
1542
+ "declaration": "export type PromptContentPart = { readonly type: 'text'; readonly text: string; } | { readonly type: 'image'; readonly mediaType: ImageMediaType; readonly data: string; readonly name?: string; } | { readonly type: 'file'; readonly receiptId: Branded<'file-upload-receipt-id'>; };"
1533
1543
  },
1534
1544
  {
1535
1545
  "name": "ProviderRequestId",
@@ -1579,22 +1589,30 @@ export const TYPERT = {
1579
1589
  "name": "RequestHeaderReason",
1580
1590
  "declaration": "export type RequestHeaderReason = 'initial' | 'resume' | 'change' | 'series';"
1581
1591
  },
1582
- {
1583
- "name": "RunDataBase",
1584
- "declaration": "export interface RunDataBase {\n turn: number;\n step: number;\n index: number;\n dt: number[];\n}"
1585
- },
1586
1592
  {
1587
1593
  "name": "SandboxMode",
1588
1594
  "declaration": "export type SandboxMode = 'read-only' | 'workspace-write' | 'danger-full-access';"
1589
1595
  },
1590
1596
  {
1591
1597
  "name": "Session",
1592
- "declaration": "export class Session {\n get surface(): SessionSurface;\n readonly header: SessionHeader;\n readonly inheritedEventCount: SessionLogOffset;\n get id(): SessionId;\n readonly firstLiveSeq: SessionLogOffset;\n eventAt(seq: SessionSeq): SessionEvent | undefined;\n snapshotEvents(fromSeq: SessionLogOffset = SessionLogOffset(0), toSeqExclusive: SessionLogOffset = this.seq): readonly SessionEvent[];\n ownEvents(): readonly SessionEvent[];\n isOwnSeq(seq: SessionSeq): boolean;\n get seq(): SessionLogOffset;\n append<T extends SessionEventType>(type: T, data: SessionEventMap[T], ...opts: T extends SurfaceEventType ? [opts: SurfaceIntent] : []): SessionEvent<T>;\n requestHeader(): EpochHeader | undefined;\n requestContext(): RequestContext | undefined;\n deriveMessages(): Message[];\n deriveEventMessage(event: SessionEvent): Message | null;\n}"
1598
+ "declaration": "export class Session {\n get surface(): SessionSurface;\n readonly header: SessionHeader;\n readonly inheritedEventCount: SessionLogOffset;\n get id(): SessionId;\n readonly firstLiveSeq: SessionLogOffset;\n eventAt(seq: SessionSeq): SessionEvent | undefined;\n snapshotEvents(fromSeq: SessionLogOffset = SessionLogOffset(0), toSeqExclusive: SessionLogOffset = this.seq): readonly SessionEvent[];\n ownEvents(): readonly SessionEvent[];\n isOwnSeq(seq: SessionSeq): boolean;\n get seq(): SessionLogOffset;\n append<T extends SessionEventType>(type: T, data: SessionEventMap[T], ...opts: T extends SurfaceEventType ? [opts: SurfaceIntent<T>] : []): SessionEvent<T>;\n requestHeader(): EpochHeader | undefined;\n requestContext(): RequestContext | undefined;\n deriveMessages(): Message[];\n deriveEventMessage(event: SessionEvent): Message | null;\n}"
1593
1599
  },
1594
1600
  {
1595
1601
  "name": "SessionAddress",
1596
1602
  "declaration": "export type SessionAddress = { readonly kind: 'session'; readonly sessionId: SessionId; } | { readonly kind: 'subagent'; readonly parentSessionId: SessionId; readonly childSessionId: SessionId; readonly mode: 'one-shot' | 'continuable'; };"
1597
1603
  },
1604
+ {
1605
+ "name": "SessionAssistantStreamAttempt",
1606
+ "declaration": "export interface SessionAssistantStreamAttempt {\n readonly attemptId: LlmAttemptId;\n readonly startedAfterSeq: SessionSeqCursor;\n readonly turn: number;\n readonly step: number;\n readonly nextIndex: number;\n readonly stream: readonly JsonValue[];\n}"
1607
+ },
1608
+ {
1609
+ "name": "SessionAssistantStreamBaseline",
1610
+ "declaration": "export interface SessionAssistantStreamBaseline {\n readonly revision: number;\n readonly activeAttempt?: SessionAssistantStreamAttempt;\n}"
1611
+ },
1612
+ {
1613
+ "name": "SessionAssistantStreamFrame",
1614
+ "declaration": "export type SessionAssistantStreamFrame = { readonly type: 'start'; readonly attemptId: LlmAttemptId; readonly revision: number; readonly startedAfterSeq: SessionSeqCursor; readonly turn: number; readonly step: number; } | { readonly type: 'chunk'; readonly attemptId: LlmAttemptId; readonly revision: number; readonly index: number; readonly time: number; readonly chunk: JsonValue; } | { readonly type: 'end'; readonly attemptId: LlmAttemptId; readonly revision: number; readonly index: number; readonly outcome: { readonly kind: 'committed'; readonly eventType: 'assistant/message' | 'assistant/attempt'; readonly seq: number; } | { readonly kind: 'abandoned'; }; };"
1615
+ },
1598
1616
  {
1599
1617
  "name": "SessionAttachmentRequest",
1600
1618
  "declaration": "export interface SessionAttachmentRequest {\n readonly sessionId: SessionId;\n readonly attachmentId: AttachmentIdType;\n}"
@@ -1611,10 +1629,6 @@ export const TYPERT = {
1611
1629
  "name": "SessionCancelValue",
1612
1630
  "declaration": "export interface SessionCancelValue {\n readonly accepted: true;\n}"
1613
1631
  },
1614
- {
1615
- "name": "SessionChunkRun",
1616
- "declaration": "export interface SessionChunkRun {\n readonly type: 'chunks';\n readonly event: ChunkRowEvent;\n}"
1617
- },
1618
1632
  {
1619
1633
  "name": "SessionControlBaseline",
1620
1634
  "declaration": "export interface SessionControlBaseline {\n readonly queues: Readonly<Record<SessionId, readonly SessionQueuedItem[]>>;\n readonly jobs: Readonly<Record<SessionId, readonly SessionJob[]>>;\n readonly projections: Readonly<Record<SessionId, SessionProjectionBaseline>>;\n}"
@@ -1641,7 +1655,7 @@ export const TYPERT = {
1641
1655
  },
1642
1656
  {
1643
1657
  "name": "SessionEventMap",
1644
- "declaration": "export interface SessionEventMap {\n 'turn/start': { turn: number; };\n 'turn/end': { turn: number; reason: TurnEndReason; };\n 'step/start': { turn: number; step: number; };\n 'step/end': { turn: number; step: number; };\n 'user/message': UserMessage;\n 'assistant/chunk': { turn: number; step: number; chunk: StreamChunk; };\n 'assistant/message': { turn: number; step: number; message: AssistantMessage; usage?: TokenUsage; interrupted?: true; };\n 'tool/call': { turn: number; step: number; callId: ToolCallId; name: string; arguments: string; };\n 'tool/result': { turn: number; step: number; message: ToolResultMessage; error?: { name: string; code: string; }; meta?: JsonValue; };\n 'request/header': { header: EpochHeader; reason: RequestHeaderReason; startsSeries?: true; };\n 'request/context': RequestContext;\n 'session/end-seed': Record<string, never>;\n 'agent/inbox/spliced': { target: InboxTarget; start: number; removedCount?: number; inserted: UserMessage[]; outcome?: 'canceled'; };\n 'approval/asked': { id: ApprovalRequestId; toolName: string; callId?: ToolCallId; reason?: string; };\n 'approval/decided': { id: ApprovalRequestId; outcome: ApprovalOutcome; };\n 'approval/policy': { policy: ApprovalPolicy; source?: 'delegation'; };\n 'tool/code-dispatch-start': PtcDispatchStartEventData;\n 'tool/code-dispatch': PtcDispatchEventData;\n 'agent-preset/selected': { agentPreset: string; };\n 'session/title': SessionTitleEventData;\n 'todo/write': { todos: TodoItem[]; };\n 'model/selection': ModelSelection;\n 'subagent/descriptor': SubagentDescriptorData;\n 'sandbox/mode': { mode: SandboxMode; source?: 'delegation'; };\n 'command/run': { commandId: CommandId; name: string; args?: string; source: CommandSource; };\n 'command/done': { commandId: CommandId; kind: 'success' | 'error'; text?: string; sourceEventSeq?: import('@deepseek-ai/dsh-session/types').SessionSeq; };\n 'team/member': { version: 1; teamId: TeamId; member: TeamMemberSnapshot; };\n 'team/task': { version: 1; teamId: TeamId; task: TeamTaskSnapshot; };\n 'team/message/queued': { version: 1; teamId: TeamId; message: TeamMessageSnapshot; };\n 'team/message/delivered': { version: 1; teamId: TeamId; messageId: TeamMessageId; targetId: SessionId; };\n 'goal/change': GoalChangeMeta;\n 'compaction/start': { compactionId: CompactionId; sourceCommandId?: CommandId; turn: number | null; };\n 'compaction/summary': { compactionId: CompactionId; sourceCommandId?: CommandId; summary: ContentBlock[]; shadowedRange: { start: SessionSeq; end: SessionSeq; }; shadowedSeqs: SessionSeq[]; shadowedTokenCount: number; provider: string; model: string; maxTokens?: number; usage?: TokenUsage; } & ({ rawOutput: ContentBlock[]; llmStreamCall: true; } | { rawOutput?: ContentBlock[]; llmStreamCall?: never; });\n 'compaction/end': { compactionId: CompactionId; sourceCommandId?: CommandId; turn: number | null; error?: string; };\n 'compaction/prune': { shadowedRange: { start: SessionSeq; end: SessionSeq; }; shadowedSeqs: SessionSeq[]; shadowedTokenCount: number; };\n}"
1658
+ "declaration": "export interface SessionEventMap {\n 'turn/start': { turn: number; };\n 'turn/end': { turn: number; reason: TurnEndReason; };\n 'step/start': { turn: number; step: number; };\n 'step/end': { turn: number; step: number; };\n 'user/message': UserMessage;\n 'assistant/message': { turn: number; step: number; message: AssistantMessage; stream: AssistantStreamRecord[]; usage?: TokenUsage; interrupted?: true; };\n 'assistant/attempt': { turn: number; step: number; stream: AssistantStreamRecord[]; };\n 'tool/call': { turn: number; step: number; callId: ToolCallId; name: string; arguments: string; };\n 'tool/result': { turn: number; step: number; message: ToolResultMessage; error?: { name: string; code: string; }; meta?: JsonValue; };\n 'request/header': { header: EpochHeader; reason: RequestHeaderReason; startsSeries?: true; };\n 'request/context': RequestContext;\n 'session/end-seed': { inherited?: true; };\n 'agent/inbox/spliced': { target: InboxTarget; start: number; removedCount?: number; inserted: UserMessage[]; outcome?: 'canceled'; };\n 'approval/asked': { id: ApprovalRequestId; toolName: string; callId?: ToolCallId; reason?: string; };\n 'approval/decided': { id: ApprovalRequestId; outcome: ApprovalOutcome; };\n 'approval/policy': { policy: ApprovalPolicy; source?: 'delegation'; };\n 'tool/code-dispatch-start': PtcDispatchStartEventData;\n 'tool/code-dispatch': PtcDispatchEventData;\n 'agent-preset/selected': { agentPreset: string; };\n 'command/run': { commandId: CommandId; name: string; args?: string; source: CommandSource; };\n 'command/done': { commandId: CommandId; kind: 'success' | 'error'; text?: string; sourceEventSeq?: import('@deepseek-ai/dsh-session/types').SessionSeq; };\n 'session/title': SessionTitleEventData;\n 'todo/write': { todos: TodoItem[]; };\n 'model/selection': ModelSelection;\n 'subagent/descriptor': SubagentDescriptorData;\n 'sandbox/mode': { mode: SandboxMode; source?: 'delegation'; };\n 'team/member': { version: 2; teamId: TeamId; member: TeamMemberSnapshot; };\n 'team/task': { version: 2; teamId: TeamId; task: TeamTaskSnapshot; };\n 'team/message/queued': { version: 2; teamId: TeamId; message: TeamMessageSnapshot; };\n 'team/message/delivered': { version: 2; teamId: TeamId; messageId: TeamMessageId; targetId: SessionId; };\n 'goal/change': GoalChangeMeta;\n 'feedback/message-put': MessageFeedbackPut;\n 'feedback/message-delete': MessageFeedbackDelete;\n 'compaction/start': { compactionId: CompactionId; sourceCommandId?: CommandId; turn: number | null; };\n 'compaction/summary': { compactionId: CompactionId; sourceCommandId?: CommandId; summary: ContentBlock[]; shadowedRange: { start: SessionSeq; end: SessionSeq; }; shadowedSeqs: SessionSeq[]; shadowedTokenCount: number; provider: string; model: string; maxTokens?: number; usage?: TokenUsage; } & ({ rawOutput: ContentBlock[]; llmStreamCall: true; } | { rawOutput?: ContentBlock[]; llmStreamCall?: never; });\n 'compaction/end': { compactionId: CompactionId; sourceCommandId?: CommandId; turn: number | null; error?: string; };\n 'compaction/prune': { shadowedRange: { start: SessionSeq; end: SessionSeq; }; shadowedSeqs: SessionSeq[]; shadowedTokenCount: number; };\n}"
1645
1659
  },
1646
1660
  {
1647
1661
  "name": "SessionEventType",
@@ -1649,11 +1663,11 @@ export const TYPERT = {
1649
1663
  },
1650
1664
  {
1651
1665
  "name": "SessionFollowFrame",
1652
- "declaration": "export type SessionFollowFrame = { readonly type: 'snapshot'; readonly header: SessionWireHeader; readonly cursor: number; readonly records: readonly SessionHistoryRecord[]; readonly hasMore: boolean; readonly projections: SessionProjectionBaseline; } | SessionEventEntry;"
1666
+ "declaration": "export type SessionFollowFrame = { readonly type: 'snapshot'; readonly header: SessionWireHeader; readonly cursor: number; readonly records: readonly SessionHistoryRecord[]; readonly hasMore: boolean; readonly projections: SessionProjectionBaseline; readonly assistantStream?: SessionAssistantStreamBaseline; } | SessionEventEntry | { readonly type: 'assistant-stream'; readonly frame: SessionAssistantStreamFrame; };"
1653
1667
  },
1654
1668
  {
1655
1669
  "name": "SessionFollowRequest",
1656
- "declaration": "export interface SessionFollowRequest {\n readonly address: SessionAddress;\n readonly maxMessages?: number;\n}"
1670
+ "declaration": "export interface SessionFollowRequest {\n readonly address: SessionAddress;\n readonly maxMessages?: number;\n readonly assistantStream?: true;\n}"
1657
1671
  },
1658
1672
  {
1659
1673
  "name": "SessionForkRequest",
@@ -1665,11 +1679,11 @@ export const TYPERT = {
1665
1679
  },
1666
1680
  {
1667
1681
  "name": "SessionHeader",
1668
- "declaration": "export interface SessionHeader {\n readonly version: number;\n readonly id: SessionId;\n readonly createdAt: number;\n readonly cwd?: string;\n readonly parentSession?: SessionId;\n readonly isSeeded: boolean;\n readonly origin?: 'subagent';\n readonly delegationDepth?: number;\n readonly agentPreset?: string;\n}"
1682
+ "declaration": "export interface SessionHeader {\n readonly version: typeof SESSION_FORMAT_VERSION;\n readonly id: SessionId;\n readonly createdAt: number;\n readonly cwd?: string;\n readonly parentSession?: SessionId;\n readonly isSeeded: boolean;\n readonly origin?: 'subagent';\n readonly delegationDepth?: number;\n readonly agentPreset?: string;\n}"
1669
1683
  },
1670
1684
  {
1671
1685
  "name": "SessionHistoryRecord",
1672
- "declaration": "export type SessionHistoryRecord = SessionEventEntry | SessionChunkRun;"
1686
+ "declaration": "export type SessionHistoryRecord = SessionEventEntry;"
1673
1687
  },
1674
1688
  {
1675
1689
  "name": "SessionId",
@@ -1753,7 +1767,7 @@ export const TYPERT = {
1753
1767
  },
1754
1768
  {
1755
1769
  "name": "SessionReferenceSource",
1756
- "declaration": "export interface SessionReferenceSource {\n kind: 'session-reference';\n form: 'recall';\n version: 1;\n references: { sessionId: string; label: string; capturedThroughSeq: OptionalSessionSeq; compacted: boolean; originalMessages: number; retainedMessages: number; omittedMessages: number; omittedBytes: number; truncated: boolean; inputIndex: number; }[];\n}"
1770
+ "declaration": "export interface SessionReferenceSource {\n kind: 'session-reference';\n form: 'recall';\n version: 1;\n references: { sessionId: string; label: string; capturedFormatVersion?: number; capturedThroughSeq: OptionalSessionSeq; compacted: boolean; originalMessages: number; retainedMessages: number; omittedMessages: number; omittedBytes: number; truncated: boolean; inputIndex: number; }[];\n}"
1757
1771
  },
1758
1772
  {
1759
1773
  "name": "SessionRenameRequest",
@@ -1791,6 +1805,10 @@ export const TYPERT = {
1791
1805
  "name": "SessionSeq",
1792
1806
  "declaration": "export type SessionSeq = BrandedNumber<'SessionSeq'>;"
1793
1807
  },
1808
+ {
1809
+ "name": "SessionSeqCursor",
1810
+ "declaration": "export type SessionSeqCursor = SessionSeq | -1;"
1811
+ },
1794
1812
  {
1795
1813
  "name": "SessionStorageMetadata",
1796
1814
  "declaration": "export interface SessionStorageMetadata {\n readonly meta: SessionHeader;\n readonly inheritedEventCount: SessionLogOffset;\n}"
@@ -1833,7 +1851,7 @@ export const TYPERT = {
1833
1851
  },
1834
1852
  {
1835
1853
  "name": "SessionWireHeader",
1836
- "declaration": "export interface SessionWireHeader {\n readonly version: number;\n readonly id: SessionId;\n readonly createdAt: number;\n readonly cwd?: string;\n readonly parentSession?: SessionId;\n readonly seedLength?: number;\n readonly origin?: 'subagent';\n readonly delegationDepth?: number;\n readonly agentPreset?: string;\n}"
1854
+ "declaration": "export interface SessionWireHeader {\n readonly version: number;\n readonly id: SessionId;\n readonly createdAt: number;\n readonly cwd?: string;\n readonly parentSession?: SessionId;\n readonly isSeeded: boolean;\n readonly origin?: 'subagent';\n readonly delegationDepth?: number;\n readonly agentPreset?: string;\n}"
1837
1855
  },
1838
1856
  {
1839
1857
  "name": "SessionWireSurfaceOp",
@@ -1873,7 +1891,7 @@ export const TYPERT = {
1873
1891
  },
1874
1892
  {
1875
1893
  "name": "SurfaceIntent",
1876
- "declaration": "export interface SurfaceIntent {\n surfaceOp: SurfaceOp;\n sourceEventSeqs?: SessionSeq[];\n}"
1894
+ "declaration": "export type SurfaceIntent<T extends SurfaceEventType = SurfaceEventType> = { surfaceOp: SurfaceOp; } & (T extends 'assistant/message' ? { sourceEventSeqs?: never; } : { sourceEventSeqs?: SessionSeq[]; });"
1877
1895
  },
1878
1896
  {
1879
1897
  "name": "SurfaceOp",
@@ -1897,7 +1915,7 @@ export const TYPERT = {
1897
1915
  },
1898
1916
  {
1899
1917
  "name": "TeamMessageSnapshot",
1900
- "declaration": "export interface TeamMessageSnapshot {\n readonly id: TeamMessageId;\n readonly senderId: SessionId;\n readonly senderName: string;\n readonly targetId: SessionId;\n readonly delivery: 'quiet' | 'wakeup';\n readonly content: ContentBlock[];\n}"
1918
+ "declaration": "export interface TeamMessageSnapshot {\n readonly id: TeamMessageId;\n readonly senderId: SessionId;\n readonly senderName: string;\n readonly targetId: SessionId;\n readonly content: ContentBlock[];\n}"
1901
1919
  },
1902
1920
  {
1903
1921
  "name": "TeamMessageSource",
@@ -1919,10 +1937,6 @@ export const TYPERT = {
1919
1937
  "name": "TextBlock",
1920
1938
  "declaration": "export interface TextBlock {\n type: 'text';\n text: string;\n}"
1921
1939
  },
1922
- {
1923
- "name": "TextRunData",
1924
- "declaration": "export interface TextRunData extends RunDataBase {\n texts: string[];\n}"
1925
- },
1926
1940
  {
1927
1941
  "name": "TodoItem",
1928
1942
  "declaration": "export interface TodoItem {\n content: string;\n status: 'pending' | 'in_progress' | 'completed';\n}"
@@ -1939,10 +1953,6 @@ export const TYPERT = {
1939
1953
  "name": "ToolCallId",
1940
1954
  "declaration": "export type ToolCallId = Branded<'ToolCallId'>;"
1941
1955
  },
1942
- {
1943
- "name": "ToolCallRunData",
1944
- "declaration": "export interface ToolCallRunData extends RunDataBase {\n id: ToolCallId;\n name?: string;\n args: string[];\n}"
1945
- },
1946
1956
  {
1947
1957
  "name": "ToolMessageSource",
1948
1958
  "declaration": "export interface ToolMessageSource {\n kind: 'tool';\n callId: ToolCallId;\n}"
@@ -2042,6 +2052,10 @@ export const TYPERT = {
2042
2052
  "name": "AssistantProvenance",
2043
2053
  "declaration": "export interface AssistantProvenance {\n provider: string;\n model: string;\n replayState?: unknown;\n}"
2044
2054
  },
2055
+ {
2056
+ "name": "AssistantStreamRecord",
2057
+ "declaration": "export type AssistantStreamRecord = { readonly type: 'text-chunks'; readonly time0: number; readonly index: number; readonly dt: readonly number[]; readonly texts: readonly string[]; } | { readonly type: 'reasoning-chunks'; readonly time0: number; readonly index: number; readonly dt: readonly number[]; readonly texts: readonly string[]; } | { readonly type: 'tool-call-chunks'; readonly time0: number; readonly index: number; readonly dt: readonly number[]; readonly id: ToolCallId; readonly name?: string; readonly args: readonly string[]; } | { readonly type: 'chunk'; readonly time: number; readonly chunk: StreamChunk; };"
2058
+ },
2045
2059
  {
2046
2060
  "name": "AttachmentId",
2047
2061
  "declaration": "export type AttachmentId = Branded<'AttachmentId'>;"
@@ -2080,7 +2094,7 @@ export const TYPERT = {
2080
2094
  },
2081
2095
  {
2082
2096
  "name": "ContentBlockMap",
2083
- "declaration": "export interface ContentBlockMap {\n text: TextBlock;\n reasoning: ReasoningBlock;\n image: ImageBlock;\n 'tool-call': ToolCallBlock;\n 'tool-result': ToolResultBlock;\n}"
2097
+ "declaration": "export interface ContentBlockMap {\n text: TextBlock;\n reasoning: ReasoningBlock;\n image: ImageBlock;\n file: FileBlock;\n 'tool-call': ToolCallBlock;\n 'tool-result': ToolResultBlock;\n}"
2084
2098
  },
2085
2099
  {
2086
2100
  "name": "ContentBlockType",
@@ -2102,6 +2116,14 @@ export const TYPERT = {
2102
2116
  "name": "EpochHeader",
2103
2117
  "declaration": "export interface EpochHeader {\n config: LlmCallConfig;\n adapterDefaults?: LlmCallConfigAdapterDefaults;\n system?: string;\n tools?: ToolSchema[];\n}"
2104
2118
  },
2119
+ {
2120
+ "name": "FileAttachmentRef",
2121
+ "declaration": "export interface FileAttachmentRef {\n attachmentId: AttachmentId;\n name: string;\n bytes: number;\n}"
2122
+ },
2123
+ {
2124
+ "name": "FileBlock",
2125
+ "declaration": "export interface FileBlock {\n type: 'file';\n attachment: FileAttachmentRef;\n}"
2126
+ },
2105
2127
  {
2106
2128
  "name": "FileReferenceCandidate",
2107
2129
  "declaration": "export interface FileReferenceCandidate {\n path: string;\n kind: 'file' | 'directory';\n}"
@@ -2194,6 +2216,26 @@ export const TYPERT = {
2194
2216
  "name": "Message",
2195
2217
  "declaration": "export interface Message {\n readonly id: MessageId;\n readonly role: 'system' | 'user' | 'assistant';\n readonly content: ContentBlock[];\n readonly source: MessageSource;\n}"
2196
2218
  },
2219
+ {
2220
+ "name": "MessageFeedbackDelete",
2221
+ "declaration": "export interface MessageFeedbackDelete {\n readonly sessionId: SessionId;\n readonly messageId: MessageId;\n}"
2222
+ },
2223
+ {
2224
+ "name": "MessageFeedbackItem",
2225
+ "declaration": "export interface MessageFeedbackItem {\n readonly messageId: MessageId;\n readonly rating: MessageFeedbackRating;\n readonly note?: string;\n readonly version: MessageFeedbackVersion;\n readonly createdAt: number;\n readonly updatedAt: number;\n}"
2226
+ },
2227
+ {
2228
+ "name": "MessageFeedbackPut",
2229
+ "declaration": "export interface MessageFeedbackPut {\n readonly sessionId: SessionId;\n readonly item: MessageFeedbackItem;\n}"
2230
+ },
2231
+ {
2232
+ "name": "MessageFeedbackRating",
2233
+ "declaration": "export type MessageFeedbackRating = 'positive' | 'negative';"
2234
+ },
2235
+ {
2236
+ "name": "MessageFeedbackVersion",
2237
+ "declaration": "export type MessageFeedbackVersion = Branded<'MessageFeedbackVersion'>;"
2238
+ },
2197
2239
  {
2198
2240
  "name": "MessageId",
2199
2241
  "declaration": "export type MessageId = Branded<'MessageId'>;"
@@ -2260,7 +2302,7 @@ export const TYPERT = {
2260
2302
  },
2261
2303
  {
2262
2304
  "name": "Session",
2263
- "declaration": "export class Session {\n get surface(): SessionSurface;\n readonly header: SessionHeader;\n readonly inheritedEventCount: SessionLogOffset;\n get id(): SessionId;\n readonly firstLiveSeq: SessionLogOffset;\n eventAt(seq: SessionSeq): SessionEvent | undefined;\n snapshotEvents(fromSeq: SessionLogOffset = SessionLogOffset(0), toSeqExclusive: SessionLogOffset = this.seq): readonly SessionEvent[];\n ownEvents(): readonly SessionEvent[];\n isOwnSeq(seq: SessionSeq): boolean;\n get seq(): SessionLogOffset;\n append<T extends SessionEventType>(type: T, data: SessionEventMap[T], ...opts: T extends SurfaceEventType ? [opts: SurfaceIntent] : []): SessionEvent<T>;\n requestHeader(): EpochHeader | undefined;\n requestContext(): RequestContext | undefined;\n deriveMessages(): Message[];\n deriveEventMessage(event: SessionEvent): Message | null;\n}"
2305
+ "declaration": "export class Session {\n get surface(): SessionSurface;\n readonly header: SessionHeader;\n readonly inheritedEventCount: SessionLogOffset;\n get id(): SessionId;\n readonly firstLiveSeq: SessionLogOffset;\n eventAt(seq: SessionSeq): SessionEvent | undefined;\n snapshotEvents(fromSeq: SessionLogOffset = SessionLogOffset(0), toSeqExclusive: SessionLogOffset = this.seq): readonly SessionEvent[];\n ownEvents(): readonly SessionEvent[];\n isOwnSeq(seq: SessionSeq): boolean;\n get seq(): SessionLogOffset;\n append<T extends SessionEventType>(type: T, data: SessionEventMap[T], ...opts: T extends SurfaceEventType ? [opts: SurfaceIntent<T>] : []): SessionEvent<T>;\n requestHeader(): EpochHeader | undefined;\n requestContext(): RequestContext | undefined;\n deriveMessages(): Message[];\n deriveEventMessage(event: SessionEvent): Message | null;\n}"
2264
2306
  },
2265
2307
  {
2266
2308
  "name": "SessionEvent",
@@ -2268,7 +2310,7 @@ export const TYPERT = {
2268
2310
  },
2269
2311
  {
2270
2312
  "name": "SessionEventMap",
2271
- "declaration": "export interface SessionEventMap {\n 'turn/start': { turn: number; };\n 'turn/end': { turn: number; reason: TurnEndReason; };\n 'step/start': { turn: number; step: number; };\n 'step/end': { turn: number; step: number; };\n 'user/message': UserMessage;\n 'assistant/chunk': { turn: number; step: number; chunk: StreamChunk; };\n 'assistant/message': { turn: number; step: number; message: AssistantMessage; usage?: TokenUsage; interrupted?: true; };\n 'tool/call': { turn: number; step: number; callId: ToolCallId; name: string; arguments: string; };\n 'tool/result': { turn: number; step: number; message: ToolResultMessage; error?: { name: string; code: string; }; meta?: JsonValue; };\n 'request/header': { header: EpochHeader; reason: RequestHeaderReason; startsSeries?: true; };\n 'request/context': RequestContext;\n 'session/end-seed': Record<string, never>;\n 'agent/inbox/spliced': { target: InboxTarget; start: number; removedCount?: number; inserted: UserMessage[]; outcome?: 'canceled'; };\n 'approval/asked': { id: ApprovalRequestId; toolName: string; callId?: ToolCallId; reason?: string; };\n 'approval/decided': { id: ApprovalRequestId; outcome: ApprovalOutcome; };\n 'approval/policy': { policy: ApprovalPolicy; source?: 'delegation'; };\n 'tool/code-dispatch-start': PtcDispatchStartEventData;\n 'tool/code-dispatch': PtcDispatchEventData;\n 'agent-preset/selected': { agentPreset: string; };\n 'session/title': SessionTitleEventData;\n 'todo/write': { todos: TodoItem[]; };\n 'model/selection': ModelSelection;\n 'subagent/descriptor': SubagentDescriptorData;\n 'sandbox/mode': { mode: SandboxMode; source?: 'delegation'; };\n 'command/run': { commandId: CommandId; name: string; args?: string; source: CommandSource; };\n 'command/done': { commandId: CommandId; kind: 'success' | 'error'; text?: string; sourceEventSeq?: import('@deepseek-ai/dsh-session/types').SessionSeq; };\n 'team/member': { version: 1; teamId: TeamId; member: TeamMemberSnapshot; };\n 'team/task': { version: 1; teamId: TeamId; task: TeamTaskSnapshot; };\n 'team/message/queued': { version: 1; teamId: TeamId; message: TeamMessageSnapshot; };\n 'team/message/delivered': { version: 1; teamId: TeamId; messageId: TeamMessageId; targetId: SessionId; };\n 'goal/change': GoalChangeMeta;\n 'compaction/start': { compactionId: CompactionId; sourceCommandId?: CommandId; turn: number | null; };\n 'compaction/summary': { compactionId: CompactionId; sourceCommandId?: CommandId; summary: ContentBlock[]; shadowedRange: { start: SessionSeq; end: SessionSeq; }; shadowedSeqs: SessionSeq[]; shadowedTokenCount: number; provider: string; model: string; maxTokens?: number; usage?: TokenUsage; } & ({ rawOutput: ContentBlock[]; llmStreamCall: true; } | { rawOutput?: ContentBlock[]; llmStreamCall?: never; });\n 'compaction/end': { compactionId: CompactionId; sourceCommandId?: CommandId; turn: number | null; error?: string; };\n 'compaction/prune': { shadowedRange: { start: SessionSeq; end: SessionSeq; }; shadowedSeqs: SessionSeq[]; shadowedTokenCount: number; };\n}"
2313
+ "declaration": "export interface SessionEventMap {\n 'turn/start': { turn: number; };\n 'turn/end': { turn: number; reason: TurnEndReason; };\n 'step/start': { turn: number; step: number; };\n 'step/end': { turn: number; step: number; };\n 'user/message': UserMessage;\n 'assistant/message': { turn: number; step: number; message: AssistantMessage; stream: AssistantStreamRecord[]; usage?: TokenUsage; interrupted?: true; };\n 'assistant/attempt': { turn: number; step: number; stream: AssistantStreamRecord[]; };\n 'tool/call': { turn: number; step: number; callId: ToolCallId; name: string; arguments: string; };\n 'tool/result': { turn: number; step: number; message: ToolResultMessage; error?: { name: string; code: string; }; meta?: JsonValue; };\n 'request/header': { header: EpochHeader; reason: RequestHeaderReason; startsSeries?: true; };\n 'request/context': RequestContext;\n 'session/end-seed': { inherited?: true; };\n 'agent/inbox/spliced': { target: InboxTarget; start: number; removedCount?: number; inserted: UserMessage[]; outcome?: 'canceled'; };\n 'approval/asked': { id: ApprovalRequestId; toolName: string; callId?: ToolCallId; reason?: string; };\n 'approval/decided': { id: ApprovalRequestId; outcome: ApprovalOutcome; };\n 'approval/policy': { policy: ApprovalPolicy; source?: 'delegation'; };\n 'tool/code-dispatch-start': PtcDispatchStartEventData;\n 'tool/code-dispatch': PtcDispatchEventData;\n 'agent-preset/selected': { agentPreset: string; };\n 'command/run': { commandId: CommandId; name: string; args?: string; source: CommandSource; };\n 'command/done': { commandId: CommandId; kind: 'success' | 'error'; text?: string; sourceEventSeq?: import('@deepseek-ai/dsh-session/types').SessionSeq; };\n 'session/title': SessionTitleEventData;\n 'todo/write': { todos: TodoItem[]; };\n 'model/selection': ModelSelection;\n 'subagent/descriptor': SubagentDescriptorData;\n 'sandbox/mode': { mode: SandboxMode; source?: 'delegation'; };\n 'team/member': { version: 2; teamId: TeamId; member: TeamMemberSnapshot; };\n 'team/task': { version: 2; teamId: TeamId; task: TeamTaskSnapshot; };\n 'team/message/queued': { version: 2; teamId: TeamId; message: TeamMessageSnapshot; };\n 'team/message/delivered': { version: 2; teamId: TeamId; messageId: TeamMessageId; targetId: SessionId; };\n 'goal/change': GoalChangeMeta;\n 'feedback/message-put': MessageFeedbackPut;\n 'feedback/message-delete': MessageFeedbackDelete;\n 'compaction/start': { compactionId: CompactionId; sourceCommandId?: CommandId; turn: number | null; };\n 'compaction/summary': { compactionId: CompactionId; sourceCommandId?: CommandId; summary: ContentBlock[]; shadowedRange: { start: SessionSeq; end: SessionSeq; }; shadowedSeqs: SessionSeq[]; shadowedTokenCount: number; provider: string; model: string; maxTokens?: number; usage?: TokenUsage; } & ({ rawOutput: ContentBlock[]; llmStreamCall: true; } | { rawOutput?: ContentBlock[]; llmStreamCall?: never; });\n 'compaction/end': { compactionId: CompactionId; sourceCommandId?: CommandId; turn: number | null; error?: string; };\n 'compaction/prune': { shadowedRange: { start: SessionSeq; end: SessionSeq; }; shadowedSeqs: SessionSeq[]; shadowedTokenCount: number; };\n}"
2272
2314
  },
2273
2315
  {
2274
2316
  "name": "SessionEventType",
@@ -2276,7 +2318,7 @@ export const TYPERT = {
2276
2318
  },
2277
2319
  {
2278
2320
  "name": "SessionHeader",
2279
- "declaration": "export interface SessionHeader {\n readonly version: number;\n readonly id: SessionId;\n readonly createdAt: number;\n readonly cwd?: string;\n readonly parentSession?: SessionId;\n readonly isSeeded: boolean;\n readonly origin?: 'subagent';\n readonly delegationDepth?: number;\n readonly agentPreset?: string;\n}"
2321
+ "declaration": "export interface SessionHeader {\n readonly version: typeof SESSION_FORMAT_VERSION;\n readonly id: SessionId;\n readonly createdAt: number;\n readonly cwd?: string;\n readonly parentSession?: SessionId;\n readonly isSeeded: boolean;\n readonly origin?: 'subagent';\n readonly delegationDepth?: number;\n readonly agentPreset?: string;\n}"
2280
2322
  },
2281
2323
  {
2282
2324
  "name": "SessionId",
@@ -2288,7 +2330,7 @@ export const TYPERT = {
2288
2330
  },
2289
2331
  {
2290
2332
  "name": "SessionReferenceSource",
2291
- "declaration": "export interface SessionReferenceSource {\n kind: 'session-reference';\n form: 'recall';\n version: 1;\n references: { sessionId: string; label: string; capturedThroughSeq: OptionalSessionSeq; compacted: boolean; originalMessages: number; retainedMessages: number; omittedMessages: number; omittedBytes: number; truncated: boolean; inputIndex: number; }[];\n}"
2333
+ "declaration": "export interface SessionReferenceSource {\n kind: 'session-reference';\n form: 'recall';\n version: 1;\n references: { sessionId: string; label: string; capturedFormatVersion?: number; capturedThroughSeq: OptionalSessionSeq; compacted: boolean; originalMessages: number; retainedMessages: number; omittedMessages: number; omittedBytes: number; truncated: boolean; inputIndex: number; }[];\n}"
2292
2334
  },
2293
2335
  {
2294
2336
  "name": "SessionRequestId",
@@ -2344,7 +2386,7 @@ export const TYPERT = {
2344
2386
  },
2345
2387
  {
2346
2388
  "name": "SurfaceIntent",
2347
- "declaration": "export interface SurfaceIntent {\n surfaceOp: SurfaceOp;\n sourceEventSeqs?: SessionSeq[];\n}"
2389
+ "declaration": "export type SurfaceIntent<T extends SurfaceEventType = SurfaceEventType> = { surfaceOp: SurfaceOp; } & (T extends 'assistant/message' ? { sourceEventSeqs?: never; } : { sourceEventSeqs?: SessionSeq[]; });"
2348
2390
  },
2349
2391
  {
2350
2392
  "name": "SurfaceOp",
@@ -2368,7 +2410,7 @@ export const TYPERT = {
2368
2410
  },
2369
2411
  {
2370
2412
  "name": "TeamMessageSnapshot",
2371
- "declaration": "export interface TeamMessageSnapshot {\n readonly id: TeamMessageId;\n readonly senderId: SessionId;\n readonly senderName: string;\n readonly targetId: SessionId;\n readonly delivery: 'quiet' | 'wakeup';\n readonly content: ContentBlock[];\n}"
2413
+ "declaration": "export interface TeamMessageSnapshot {\n readonly id: TeamMessageId;\n readonly senderId: SessionId;\n readonly senderName: string;\n readonly targetId: SessionId;\n readonly content: ContentBlock[];\n}"
2372
2414
  },
2373
2415
  {
2374
2416
  "name": "TeamMessageSource",