@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.
- package/README.i18n.yaml +2 -2
- package/README.md +6 -6
- package/README.zh.md +6 -6
- package/lib/client.js +592 -28
- package/lib/index.js +269 -214
- package/lib/typert.host.js +183 -141
- package/lib/typert.remote-client.js +79 -97
- package/lib/types/assistant-stream.d.ts +26 -0
- package/lib/types/assistant-stream.js +83 -0
- package/lib/types/client/contract/events.d.ts +38 -7
- package/lib/types/client/contract/events.js +21 -0
- package/lib/types/client/contract/session.d.ts +7 -7
- package/lib/types/client/contract/snapshot.d.ts +15 -2
- package/lib/types/client/index.d.ts +2 -2
- package/lib/types/client/index.js +2 -0
- package/lib/types/client/sessions/assistant-stream.d.ts +51 -0
- package/lib/types/client/sessions/assistant-stream.js +168 -0
- package/lib/types/client/sessions/history-records.d.ts +2 -2
- package/lib/types/client/sessions/history-records.js +3 -8
- package/lib/types/client/sessions/queue-mirror.js +3 -3
- package/lib/types/client/sessions/remotes.d.ts +2 -2
- package/lib/types/client/sessions/session.d.ts +3 -1
- package/lib/types/client/sessions/session.js +63 -15
- package/lib/types/client/transport.d.ts +7 -3
- package/lib/types/client/transport.js +18 -3
- package/lib/types/commands.js +98 -28
- package/lib/types/history.d.ts +2 -1
- package/lib/types/history.js +66 -37
- package/lib/types/index.d.ts +4 -4
- package/lib/types/index.js +13 -5
- package/lib/types/list.d.ts +2 -9
- package/lib/types/list.js +10 -124
- package/lib/types/types.d.ts +71 -29
- 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
|
-
'
|
|
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.
|
|
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
|
-
})
|
|
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.
|
|
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
|
-
})
|
|
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({
|
|
@@ -731,7 +713,7 @@ export const TYPERT_REMOTE = {
|
|
|
731
713
|
typeSymbol: '@deepseek-ai/dsh-api-session-controller/types#SessionAttachmentValue',
|
|
732
714
|
schema: _deepseek_ai_dsh_api_session_controller_session_attachment_result$schema,
|
|
733
715
|
},
|
|
734
|
-
sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":
|
|
716
|
+
sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":340,"column":3},
|
|
735
717
|
},
|
|
736
718
|
{
|
|
737
719
|
id: '@deepseek-ai/dsh-api-session-controller#session/cancel',
|
|
@@ -756,7 +738,7 @@ export const TYPERT_REMOTE = {
|
|
|
756
738
|
typeSymbol: '@deepseek-ai/dsh-api-session-controller/types#SessionCancelValue',
|
|
757
739
|
schema: _deepseek_ai_dsh_api_session_controller_session_cancel_result$schema,
|
|
758
740
|
},
|
|
759
|
-
sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":
|
|
741
|
+
sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":360,"column":3},
|
|
760
742
|
},
|
|
761
743
|
{
|
|
762
744
|
id: '@deepseek-ai/dsh-api-session-controller#session/canOpenWorkspacePath',
|
|
@@ -771,7 +753,7 @@ export const TYPERT_REMOTE = {
|
|
|
771
753
|
typeSymbol: '@deepseek-ai/dsh-api-session-controller#session/canOpenWorkspacePath:result',
|
|
772
754
|
schema: _deepseek_ai_dsh_api_session_controller_session_canOpenWorkspacePath_result$schema,
|
|
773
755
|
},
|
|
774
|
-
sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":
|
|
756
|
+
sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":265,"column":3},
|
|
775
757
|
},
|
|
776
758
|
{
|
|
777
759
|
id: '@deepseek-ai/dsh-api-session-controller#session/control',
|
|
@@ -788,7 +770,7 @@ export const TYPERT_REMOTE = {
|
|
|
788
770
|
typeSymbol: '@deepseek-ai/dsh-api-session-controller/types#SessionControlFrame',
|
|
789
771
|
schema: _deepseek_ai_dsh_api_session_controller_session_control_result$schema,
|
|
790
772
|
},
|
|
791
|
-
sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":
|
|
773
|
+
sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":393,"column":3},
|
|
792
774
|
},
|
|
793
775
|
{
|
|
794
776
|
id: '@deepseek-ai/dsh-api-session-controller#session/create',
|
|
@@ -813,7 +795,7 @@ export const TYPERT_REMOTE = {
|
|
|
813
795
|
typeSymbol: '@deepseek-ai/dsh-api-session-controller/types#SessionCreateValue',
|
|
814
796
|
schema: _deepseek_ai_dsh_api_session_controller_session_create_result$schema,
|
|
815
797
|
},
|
|
816
|
-
sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":
|
|
798
|
+
sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":237,"column":3},
|
|
817
799
|
},
|
|
818
800
|
{
|
|
819
801
|
id: '@deepseek-ai/dsh-api-session-controller#session/follow',
|
|
@@ -840,7 +822,7 @@ export const TYPERT_REMOTE = {
|
|
|
840
822
|
typeSymbol: '@deepseek-ai/dsh-api-session-controller/types#SessionFollowFrame',
|
|
841
823
|
schema: _deepseek_ai_dsh_api_session_controller_session_follow_result$schema,
|
|
842
824
|
},
|
|
843
|
-
sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":
|
|
825
|
+
sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":383,"column":3},
|
|
844
826
|
},
|
|
845
827
|
{
|
|
846
828
|
id: '@deepseek-ai/dsh-api-session-controller#session/fork',
|
|
@@ -865,7 +847,7 @@ export const TYPERT_REMOTE = {
|
|
|
865
847
|
typeSymbol: '@deepseek-ai/dsh-api-session-controller/types#SessionForkValue',
|
|
866
848
|
schema: _deepseek_ai_dsh_api_session_controller_session_fork_result$schema,
|
|
867
849
|
},
|
|
868
|
-
sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":
|
|
850
|
+
sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":318,"column":3},
|
|
869
851
|
},
|
|
870
852
|
{
|
|
871
853
|
id: '@deepseek-ai/dsh-api-session-controller#session/list',
|
|
@@ -891,7 +873,7 @@ export const TYPERT_REMOTE = {
|
|
|
891
873
|
typeSymbol: '@deepseek-ai/dsh-api-session-controller/types#SessionListValue',
|
|
892
874
|
schema: _deepseek_ai_dsh_api_session_controller_session_list_result$schema,
|
|
893
875
|
},
|
|
894
|
-
sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":
|
|
876
|
+
sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":216,"column":9},
|
|
895
877
|
},
|
|
896
878
|
{
|
|
897
879
|
id: '@deepseek-ai/dsh-api-session-controller#session/modelCatalog',
|
|
@@ -906,7 +888,7 @@ export const TYPERT_REMOTE = {
|
|
|
906
888
|
typeSymbol: '@deepseek-ai/dsh-api-session-controller/types#ModelCatalog',
|
|
907
889
|
schema: _deepseek_ai_dsh_api_session_controller_session_modelCatalog_result$schema,
|
|
908
890
|
},
|
|
909
|
-
sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":
|
|
891
|
+
sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":256,"column":3},
|
|
910
892
|
},
|
|
911
893
|
{
|
|
912
894
|
id: '@deepseek-ai/dsh-api-session-controller#session/openWorkspacePath',
|
|
@@ -932,7 +914,7 @@ export const TYPERT_REMOTE = {
|
|
|
932
914
|
typeSymbol: '@deepseek-ai/dsh-api-session-controller/types#SessionOpenWorkspacePathValue',
|
|
933
915
|
schema: _deepseek_ai_dsh_api_session_controller_session_openWorkspacePath_result$schema,
|
|
934
916
|
},
|
|
935
|
-
sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":
|
|
917
|
+
sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":277,"column":9},
|
|
936
918
|
},
|
|
937
919
|
{
|
|
938
920
|
id: '@deepseek-ai/dsh-api-session-controller#session/page',
|
|
@@ -958,7 +940,7 @@ export const TYPERT_REMOTE = {
|
|
|
958
940
|
typeSymbol: '@deepseek-ai/dsh-api-session-controller/types#SessionPage',
|
|
959
941
|
schema: _deepseek_ai_dsh_api_session_controller_session_page_result$schema,
|
|
960
942
|
},
|
|
961
|
-
sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":
|
|
943
|
+
sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":371,"column":3},
|
|
962
944
|
},
|
|
963
945
|
{
|
|
964
946
|
id: '@deepseek-ai/dsh-api-session-controller#session/prompt',
|
|
@@ -984,7 +966,7 @@ export const TYPERT_REMOTE = {
|
|
|
984
966
|
typeSymbol: '@deepseek-ai/dsh-api-session-controller/types#SessionPromptValue',
|
|
985
967
|
schema: _deepseek_ai_dsh_api_session_controller_session_prompt_result$schema,
|
|
986
968
|
},
|
|
987
|
-
sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":
|
|
969
|
+
sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":329,"column":3},
|
|
988
970
|
},
|
|
989
971
|
{
|
|
990
972
|
id: '@deepseek-ai/dsh-api-session-controller#session/rename',
|
|
@@ -1009,7 +991,7 @@ export const TYPERT_REMOTE = {
|
|
|
1009
991
|
typeSymbol: '@deepseek-ai/dsh-api-session-controller/types#SessionRenameValue',
|
|
1010
992
|
schema: _deepseek_ai_dsh_api_session_controller_session_rename_result$schema,
|
|
1011
993
|
},
|
|
1012
|
-
sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":
|
|
994
|
+
sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":308,"column":3},
|
|
1013
995
|
},
|
|
1014
996
|
{
|
|
1015
997
|
id: '@deepseek-ai/dsh-api-session-controller#session/search',
|
|
@@ -1035,7 +1017,7 @@ export const TYPERT_REMOTE = {
|
|
|
1035
1017
|
typeSymbol: '@deepseek-ai/dsh-api-session-controller/types#SessionSearchValue',
|
|
1036
1018
|
schema: _deepseek_ai_dsh_api_session_controller_session_search_result$schema,
|
|
1037
1019
|
},
|
|
1038
|
-
sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":
|
|
1020
|
+
sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":227,"column":3},
|
|
1039
1021
|
},
|
|
1040
1022
|
{
|
|
1041
1023
|
id: '@deepseek-ai/dsh-api-session-controller#session/selectModel',
|
|
@@ -1060,7 +1042,7 @@ export const TYPERT_REMOTE = {
|
|
|
1060
1042
|
typeSymbol: '@deepseek-ai/dsh-api-session-controller/types#SessionSelectModelValue',
|
|
1061
1043
|
schema: _deepseek_ai_dsh_api_session_controller_session_selectModel_result$schema,
|
|
1062
1044
|
},
|
|
1063
|
-
sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":
|
|
1045
|
+
sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":247,"column":3},
|
|
1064
1046
|
},
|
|
1065
1047
|
{
|
|
1066
1048
|
id: '@deepseek-ai/dsh-api-session-controller#session/updateQueue',
|
|
@@ -1085,7 +1067,7 @@ export const TYPERT_REMOTE = {
|
|
|
1085
1067
|
typeSymbol: '@deepseek-ai/dsh-api-session-controller/types#SessionUpdateQueueValue',
|
|
1086
1068
|
schema: _deepseek_ai_dsh_api_session_controller_session_updateQueue_result$schema,
|
|
1087
1069
|
},
|
|
1088
|
-
sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":
|
|
1070
|
+
sourceLocation: {"file":"packages/api/session-controller/src/index.ts","line":350,"column":3},
|
|
1089
1071
|
},
|
|
1090
1072
|
{
|
|
1091
1073
|
id: '@deepseek-ai/dsh-api-session-controller#skills/list',
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** Process-local assistant state retained for reconnecting Web followers. */
|
|
2
|
+
import type { AssistantStreamFrame } from '@deepseek-ai/dsh-agent';
|
|
3
|
+
import type { SessionSeqCursor } from '@deepseek-ai/dsh-session';
|
|
4
|
+
import type { SessionAssistantStreamBaseline } from './types.ts';
|
|
5
|
+
/**
|
|
6
|
+
* Folds dense Agent frames and materializes one shared immutable reconnect
|
|
7
|
+
* baseline per accepted revision.
|
|
8
|
+
*/
|
|
9
|
+
export declare class SessionAssistantStreamAccumulator {
|
|
10
|
+
private activeAttempt;
|
|
11
|
+
private revision;
|
|
12
|
+
private snapshotValue;
|
|
13
|
+
private dirty;
|
|
14
|
+
/**
|
|
15
|
+
* Fold one trusted frame from the current attached Agent lifecycle.
|
|
16
|
+
* @param frame - next dense process-local Assistant frame.
|
|
17
|
+
* @param durableCursor - last committed Session seq when this frame was observed.
|
|
18
|
+
*/
|
|
19
|
+
accept(frame: AssistantStreamFrame, durableCursor: SessionSeqCursor): void;
|
|
20
|
+
/**
|
|
21
|
+
* Read the cached reconnect baseline, materializing it after a state change.
|
|
22
|
+
* @returns the identity-stable baseline for the latest accepted revision.
|
|
23
|
+
*/
|
|
24
|
+
snapshot(): SessionAssistantStreamBaseline;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=assistant-stream.d.ts.map
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/** Process-local assistant state retained for reconnecting Web followers. */
|
|
2
|
+
import { AssistantStreamAccumulator } from '@deepseek-ai/dsh-llm';
|
|
3
|
+
const EMPTY_BASELINE = { revision: 0 };
|
|
4
|
+
/**
|
|
5
|
+
* Folds dense Agent frames and materializes one shared immutable reconnect
|
|
6
|
+
* baseline per accepted revision.
|
|
7
|
+
*/
|
|
8
|
+
export class SessionAssistantStreamAccumulator {
|
|
9
|
+
activeAttempt;
|
|
10
|
+
revision = 0;
|
|
11
|
+
snapshotValue = EMPTY_BASELINE;
|
|
12
|
+
dirty = false;
|
|
13
|
+
/**
|
|
14
|
+
* Fold one trusted frame from the current attached Agent lifecycle.
|
|
15
|
+
* @param frame - next dense process-local Assistant frame.
|
|
16
|
+
* @param durableCursor - last committed Session seq when this frame was observed.
|
|
17
|
+
*/
|
|
18
|
+
accept(frame, durableCursor) {
|
|
19
|
+
if (frame.type === 'start' && frame.revision === 1 && this.revision !== 0) {
|
|
20
|
+
this.activeAttempt = undefined;
|
|
21
|
+
this.revision = 0;
|
|
22
|
+
}
|
|
23
|
+
if (frame.revision !== this.revision + 1) {
|
|
24
|
+
this.activeAttempt = undefined;
|
|
25
|
+
this.revision = frame.revision;
|
|
26
|
+
this.dirty = true;
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
this.revision = frame.revision;
|
|
30
|
+
switch (frame.type) {
|
|
31
|
+
case 'start':
|
|
32
|
+
this.activeAttempt = {
|
|
33
|
+
attemptId: frame.attemptId,
|
|
34
|
+
startedAfterSeq: durableCursor,
|
|
35
|
+
turn: frame.turn,
|
|
36
|
+
step: frame.step,
|
|
37
|
+
stream: new AssistantStreamAccumulator(),
|
|
38
|
+
nextIndex: 0,
|
|
39
|
+
};
|
|
40
|
+
break;
|
|
41
|
+
case 'chunk': {
|
|
42
|
+
const attempt = this.activeAttempt;
|
|
43
|
+
if (attempt === undefined
|
|
44
|
+
|| attempt.attemptId !== frame.attemptId
|
|
45
|
+
|| frame.index !== attempt.nextIndex) {
|
|
46
|
+
this.activeAttempt = undefined;
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
attempt.stream.push({ time: frame.time, chunk: frame.chunk });
|
|
50
|
+
attempt.nextIndex += 1;
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
case 'end':
|
|
54
|
+
this.activeAttempt = undefined;
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
this.dirty = true;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Read the cached reconnect baseline, materializing it after a state change.
|
|
61
|
+
* @returns the identity-stable baseline for the latest accepted revision.
|
|
62
|
+
*/
|
|
63
|
+
snapshot() {
|
|
64
|
+
if (!this.dirty)
|
|
65
|
+
return this.snapshotValue;
|
|
66
|
+
this.snapshotValue = {
|
|
67
|
+
revision: this.revision,
|
|
68
|
+
...this.activeAttempt === undefined ? {} : {
|
|
69
|
+
activeAttempt: {
|
|
70
|
+
attemptId: this.activeAttempt.attemptId,
|
|
71
|
+
startedAfterSeq: this.activeAttempt.startedAfterSeq,
|
|
72
|
+
turn: this.activeAttempt.turn,
|
|
73
|
+
step: this.activeAttempt.step,
|
|
74
|
+
nextIndex: this.activeAttempt.nextIndex,
|
|
75
|
+
stream: this.activeAttempt.stream.snapshot(),
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
this.dirty = false;
|
|
80
|
+
return this.snapshotValue;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=assistant-stream.js.map
|
|
@@ -1,21 +1,42 @@
|
|
|
1
1
|
/** Observable contiguous Session event window consumed by domain assemblers. */
|
|
2
2
|
import { type ObservableSnapshot } from '@deepseek-ai/dsh-client-store';
|
|
3
|
+
import type { LlmAttemptId, StreamChunk } from '@deepseek-ai/dsh-llm';
|
|
3
4
|
import type { SessionEvent } from '@deepseek-ai/dsh-session/types';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
/** Client-only live chunk presentation; `seq` orders the transient row between durable Session seqs. */
|
|
6
|
+
export interface AssistantLiveChunkEvent {
|
|
7
|
+
readonly type: 'assistant/live-chunk';
|
|
8
|
+
readonly seq: number;
|
|
9
|
+
readonly time: number;
|
|
10
|
+
readonly data: {
|
|
11
|
+
readonly attemptId: LlmAttemptId;
|
|
12
|
+
readonly turn: number;
|
|
13
|
+
readonly step: number;
|
|
14
|
+
readonly chunk: StreamChunk;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/** Current durable Session event or one client-only live chunk presentation. */
|
|
18
|
+
export type SessionEventLike = SessionEvent | AssistantLiveChunkEvent;
|
|
7
19
|
/** Client history entry retaining its coarse transport discriminator. */
|
|
8
20
|
export type SessionEventLikeEntry = {
|
|
9
21
|
readonly type: 'event';
|
|
10
22
|
readonly event: SessionEvent;
|
|
11
23
|
} | {
|
|
12
|
-
readonly type: '
|
|
13
|
-
readonly event:
|
|
24
|
+
readonly type: 'transient';
|
|
25
|
+
readonly event: AssistantLiveChunkEvent;
|
|
14
26
|
};
|
|
15
27
|
/** Scalar live entry accepted by append-only Client paths. */
|
|
16
28
|
export type SessionLiveEventEntry = Extract<SessionEventLikeEntry, {
|
|
17
29
|
readonly type: 'event';
|
|
18
30
|
}>;
|
|
31
|
+
/** Durable Assistant event that atomically supersedes one attempt's transient rows. */
|
|
32
|
+
export interface SessionAssistantSettlementEntry {
|
|
33
|
+
readonly type: 'event';
|
|
34
|
+
readonly event: SessionEvent<'assistant/message'> | SessionEvent<'assistant/attempt'>;
|
|
35
|
+
}
|
|
36
|
+
/** Client-only Assistant frame admitted outside durable cursor algebra. */
|
|
37
|
+
export type SessionTransientEventEntry = Extract<SessionEventLikeEntry, {
|
|
38
|
+
readonly type: 'transient';
|
|
39
|
+
}>;
|
|
19
40
|
/** Exact delta that produced the latest event-window revision. */
|
|
20
41
|
export type SessionEventChange = {
|
|
21
42
|
readonly kind: 'replace';
|
|
@@ -25,7 +46,11 @@ export type SessionEventChange = {
|
|
|
25
46
|
readonly entries: readonly SessionEventLikeEntry[];
|
|
26
47
|
} | {
|
|
27
48
|
readonly kind: 'append';
|
|
28
|
-
readonly entries: readonly
|
|
49
|
+
readonly entries: readonly SessionEventLikeEntry[];
|
|
50
|
+
} | {
|
|
51
|
+
readonly kind: 'settle-assistant';
|
|
52
|
+
readonly attemptId: LlmAttemptId;
|
|
53
|
+
readonly entry?: SessionAssistantSettlementEntry;
|
|
29
54
|
};
|
|
30
55
|
/** Current contiguous event window and its latest synchronous delta. */
|
|
31
56
|
export interface SessionEventWindow {
|
|
@@ -65,7 +90,13 @@ export declare class MutableSessionEventSource implements SessionEventSource {
|
|
|
65
90
|
* Append one contiguous live entry.
|
|
66
91
|
* @param entry - live tail entry.
|
|
67
92
|
*/
|
|
68
|
-
append(entry:
|
|
93
|
+
append(entry: SessionEventLikeEntry): void;
|
|
94
|
+
/**
|
|
95
|
+
* Replace one attempt's transient rows with its committed durable settlement.
|
|
96
|
+
* @param attemptId - process-local attempt whose live rows are now redundant.
|
|
97
|
+
* @param entry - durable settlement committed for that attempt.
|
|
98
|
+
*/
|
|
99
|
+
settleAssistant(attemptId: LlmAttemptId, entry?: SessionAssistantSettlementEntry): void;
|
|
69
100
|
private publish;
|
|
70
101
|
}
|
|
71
102
|
//# sourceMappingURL=events.d.ts.map
|
|
@@ -83,6 +83,27 @@ export class MutableSessionEventSource {
|
|
|
83
83
|
entries,
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* Replace one attempt's transient rows with its committed durable settlement.
|
|
88
|
+
* @param attemptId - process-local attempt whose live rows are now redundant.
|
|
89
|
+
* @param entry - durable settlement committed for that attempt.
|
|
90
|
+
*/
|
|
91
|
+
settleAssistant(attemptId, entry) {
|
|
92
|
+
const entries = materialize(this.window).filter(candidate => (candidate.type !== 'transient' || candidate.event.data.attemptId !== attemptId));
|
|
93
|
+
if (entry !== undefined) {
|
|
94
|
+
const index = entries.findIndex(candidate => candidate.event.seq > entry.event.seq);
|
|
95
|
+
if (index < 0)
|
|
96
|
+
entries.push(entry);
|
|
97
|
+
else
|
|
98
|
+
entries.splice(index, 0, entry);
|
|
99
|
+
}
|
|
100
|
+
this.window = leaf(entries);
|
|
101
|
+
this.publish(this.snapshot.hasMore, {
|
|
102
|
+
kind: 'settle-assistant',
|
|
103
|
+
attemptId,
|
|
104
|
+
...(entry === undefined ? {} : { entry }),
|
|
105
|
+
});
|
|
106
|
+
}
|
|
86
107
|
publish(hasMore, change) {
|
|
87
108
|
this.snapshot = windowSnapshot(this.window, hasMore, this.snapshot.revision + 1, change);
|
|
88
109
|
notifySubscribers(this.listeners, '[session-controller] event feed');
|
|
@@ -7,22 +7,22 @@
|
|
|
7
7
|
* must stub); implementation-internal entry points (history staging, wire-frame
|
|
8
8
|
* dispatch) stay on the class, invisible out here.
|
|
9
9
|
*/
|
|
10
|
-
import type { AttachmentIdType, ImageAttachmentRef } from '@deepseek-ai/dsh-attachment';
|
|
10
|
+
import type { AttachmentIdType, FileAttachmentRef, ImageAttachmentRef } from '@deepseek-ai/dsh-attachment';
|
|
11
11
|
import type { MessageId } from '@deepseek-ai/dsh-llm/brand';
|
|
12
12
|
import type { SessionId, SessionSeq } from '@deepseek-ai/dsh-session/types';
|
|
13
13
|
import type { RemoteResult } from '@deepseek-ai/dsh-typert-protocol';
|
|
14
14
|
import type { ObservableSnapshot } from '@deepseek-ai/dsh-client-store';
|
|
15
15
|
import type { PromptContentPart, QueueAction, SessionRequestId } from '../../types.ts';
|
|
16
|
-
import type {
|
|
16
|
+
import type { PendingSubmissionAttachment, SessionSnapshot } from './snapshot.ts';
|
|
17
17
|
/**
|
|
18
18
|
* Why a local submission echo left the snapshot: `observed` when its durable
|
|
19
19
|
* `user/message` event or host queue occurrence arrived (with the admitted
|
|
20
|
-
*
|
|
20
|
+
* attachment references in prompt order), `failed` when the prompt was rejected,
|
|
21
21
|
* threw, or was aborted before acceptance.
|
|
22
22
|
*/
|
|
23
23
|
export type PendingSubmissionRetirement = {
|
|
24
24
|
readonly reason: 'observed';
|
|
25
|
-
readonly attachments: readonly ImageAttachmentRef[];
|
|
25
|
+
readonly attachments: readonly (ImageAttachmentRef | FileAttachmentRef)[];
|
|
26
26
|
} | {
|
|
27
27
|
readonly reason: 'failed';
|
|
28
28
|
};
|
|
@@ -32,8 +32,8 @@ export interface BeginSubmissionInput {
|
|
|
32
32
|
readonly mode: 'queue' | 'steer';
|
|
33
33
|
/** Prompt text exactly as the upcoming prompt will send it. */
|
|
34
34
|
readonly text: string;
|
|
35
|
-
/** Ordered image previews matching the upcoming prompt
|
|
36
|
-
readonly
|
|
35
|
+
/** Ordered image previews and durable file metadata matching the upcoming prompt attachments. */
|
|
36
|
+
readonly attachments: readonly PendingSubmissionAttachment[];
|
|
37
37
|
/** Settlement callback fired exactly once when the echo retires. */
|
|
38
38
|
readonly onRetire?: (retirement: PendingSubmissionRetirement) => void;
|
|
39
39
|
}
|
|
@@ -91,7 +91,7 @@ export interface ISession {
|
|
|
91
91
|
data: Uint8Array;
|
|
92
92
|
}>>;
|
|
93
93
|
/**
|
|
94
|
-
* Apply one edit, remove, or
|
|
94
|
+
* Apply one edit, remove, or Steer action to a still-pending queue occurrence.
|
|
95
95
|
* @param itemId - agent-owned inbox occurrence identity.
|
|
96
96
|
* @param action - requested queue operation.
|
|
97
97
|
* @returns acceptance, or a business/transport error.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** Session-owned observable state excluding Conversation target data. */
|
|
2
2
|
import type { ContentBlock } from '@deepseek-ai/dsh-llm/types';
|
|
3
|
+
import type { FileAttachmentRef } from '@deepseek-ai/dsh-attachment';
|
|
3
4
|
import type { MessageId } from '@deepseek-ai/dsh-llm/brand';
|
|
4
5
|
import type { SessionId } from '@deepseek-ai/dsh-session/types';
|
|
5
6
|
import type { SubagentAddress } from '@deepseek-ai/dsh-subagent/client';
|
|
@@ -27,6 +28,18 @@ export interface PendingSubmissionImage {
|
|
|
27
28
|
/** Intrinsic pixel height, when the submitter has probed it. */
|
|
28
29
|
readonly height?: number;
|
|
29
30
|
}
|
|
31
|
+
/** Image branch of a local submission echo attachment. */
|
|
32
|
+
export interface PendingSubmissionImageAttachment {
|
|
33
|
+
readonly type: 'image';
|
|
34
|
+
readonly value: PendingSubmissionImage;
|
|
35
|
+
}
|
|
36
|
+
/** File branch of a local submission echo attachment. */
|
|
37
|
+
export interface PendingSubmissionFileAttachment {
|
|
38
|
+
readonly type: 'file';
|
|
39
|
+
readonly value: FileAttachmentRef;
|
|
40
|
+
}
|
|
41
|
+
/** One attachment displayed by a local submission echo, in prompt order. */
|
|
42
|
+
export type PendingSubmissionAttachment = PendingSubmissionImageAttachment | PendingSubmissionFileAttachment;
|
|
30
43
|
/** Client surface selected when a local submission begins. */
|
|
31
44
|
export type PendingSubmissionPlacement = 'transcript' | 'queued' | 'steering';
|
|
32
45
|
/**
|
|
@@ -44,8 +57,8 @@ export interface PendingSubmission {
|
|
|
44
57
|
readonly time: number;
|
|
45
58
|
/** Prompt text exactly as it will be sent (one text block). */
|
|
46
59
|
readonly text: string;
|
|
47
|
-
/** Ordered image previews matching the prompt
|
|
48
|
-
readonly
|
|
60
|
+
/** Ordered image previews and durable file metadata matching the prompt attachments. */
|
|
61
|
+
readonly attachments: readonly PendingSubmissionAttachment[];
|
|
49
62
|
}
|
|
50
63
|
/** History-open lifecycle of a Session event window. */
|
|
51
64
|
export type OpenState = 'cold' | 'loading' | 'open' | 'error';
|
|
@@ -12,8 +12,8 @@ export type { ProjectionsBaseline, ProjectionValueStore, SessionProjectionMap, U
|
|
|
12
12
|
export type { BeginSubmissionInput, ISession, PendingSubmissionRetirement, ProjectionsFace, SessionFace, SubmissionHandle, } from './contract/session.ts';
|
|
13
13
|
export type { ISessions } from './contract/sessions.ts';
|
|
14
14
|
export { MutableSessionEventSource } from './contract/events.ts';
|
|
15
|
-
export type { SessionEventChange, SessionEventLike, SessionEventLikeEntry, SessionEventSource, SessionEventWindow, SessionLiveEventEntry, } from './contract/events.ts';
|
|
16
|
-
export type { OpenState, PendingSubmission, PendingSubmissionImage, PendingSubmissionPlacement, PromptError, QueuedMessage, SessionSnapshot, } from './contract/snapshot.ts';
|
|
15
|
+
export type { AssistantLiveChunkEvent, SessionAssistantSettlementEntry, SessionEventChange, SessionEventLike, SessionEventLikeEntry, SessionEventSource, SessionEventWindow, SessionLiveEventEntry, SessionTransientEventEntry, } from './contract/events.ts';
|
|
16
|
+
export type { OpenState, PendingSubmission, PendingSubmissionAttachment, PendingSubmissionFileAttachment, PendingSubmissionImage, PendingSubmissionImageAttachment, PendingSubmissionPlacement, PromptError, QueuedMessage, SessionSnapshot, } from './contract/snapshot.ts';
|
|
17
17
|
declare module '@deepseek-ai/cordis' {
|
|
18
18
|
interface Context {
|
|
19
19
|
/** Client Session object layer and Agent scope owner. */
|