@crazx/dsh-api-session-controller 0.1.6-alpha.1.zw.2 → 0.1.6-alpha.2.zw.1
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 +15 -3
- package/README.zh.md +15 -3
- package/lib/client.js +428 -471
- package/lib/index.js +16 -47
- package/lib/typert.host.js +179 -161
- package/lib/typert.remote-client.js +168 -150
- package/lib/types/agent.d.ts +1 -1
- package/lib/types/agent.js +8 -1
- package/lib/types/client/contract/sessions.d.ts +55 -20
- package/lib/types/client/contract/snapshot.d.ts +0 -14
- package/lib/types/client/index.d.ts +11 -2
- package/lib/types/client/index.js +16 -5
- package/lib/types/client/scope.d.ts +13 -3
- package/lib/types/client/scope.js +15 -22
- package/lib/types/client/sessions/lineage.d.ts +1 -4
- package/lib/types/client/sessions/lineage.js +1 -3
- package/lib/types/client/sessions/manager.d.ts +28 -49
- package/lib/types/client/sessions/manager.js +75 -174
- package/lib/types/client/sessions/projection-store.d.ts +5 -11
- package/lib/types/client/sessions/projection-store.js +6 -14
- package/lib/types/client/sessions/service.d.ts +34 -119
- package/lib/types/client/sessions/service.js +259 -244
- package/lib/types/client/sessions/session.d.ts +7 -20
- package/lib/types/client/sessions/session.js +29 -33
- package/lib/types/commands.d.ts +2 -2
- package/lib/types/commands.js +10 -4
- package/lib/types/control.d.ts +1 -1
- package/lib/types/control.js +1 -41
- package/lib/types/index.d.ts +2 -2
- package/lib/types/index.js +1 -1
- package/lib/types/types.d.ts +3 -17
- package/package.json +70 -70
- package/lib/types/client/sessions/queue-mirror.d.ts +0 -26
- package/lib/types/client/sessions/queue-mirror.js +0 -61
|
@@ -3,7 +3,7 @@ import type { AttachmentIdType, ImageAttachmentRef } from '@deepseek-ai/dsh-atta
|
|
|
3
3
|
import type { SubagentAddress } from '@deepseek-ai/dsh-subagent/client';
|
|
4
4
|
import type { MessageId } from '@deepseek-ai/dsh-llm/brand';
|
|
5
5
|
import { SessionSeq, type SessionId } from '@deepseek-ai/dsh-session/types';
|
|
6
|
-
import type { PromptContentPart, QueueAction,
|
|
6
|
+
import type { PromptContentPart, QueueAction, SessionRequestId } from '../../types.ts';
|
|
7
7
|
import type { BeginSubmissionInput, SessionFace, SubmissionHandle } from '../contract/session.ts';
|
|
8
8
|
import type { SessionSnapshot } from '../contract/snapshot.ts';
|
|
9
9
|
import { MutableSessionEventSource } from '../contract/events.ts';
|
|
@@ -59,8 +59,7 @@ export declare class Session implements SessionFace {
|
|
|
59
59
|
private jumpTargetSeq;
|
|
60
60
|
/** The running jump loop's completion, shared by retargeting callers. */
|
|
61
61
|
private jumpPromise;
|
|
62
|
-
|
|
63
|
-
private readonly queueMirror;
|
|
62
|
+
private readonly stopObservingInbox;
|
|
64
63
|
private readonly assistantStream;
|
|
65
64
|
private running;
|
|
66
65
|
private address;
|
|
@@ -81,7 +80,7 @@ export declare class Session implements SessionFace {
|
|
|
81
80
|
/** Local submission echoes, insertion-ordered (see SessionSnapshot.pendingSubmissions). */
|
|
82
81
|
private pendingSubmissions;
|
|
83
82
|
/** Per-echo settlement state; `retiring` latches the first observation so a
|
|
84
|
-
*
|
|
83
|
+
* Inbox projection and its durable event cannot both retire one echo. */
|
|
85
84
|
private readonly submissionSettlements;
|
|
86
85
|
/** Owns the addressed page/follow lifecycle while this Session is open. */
|
|
87
86
|
private events;
|
|
@@ -199,7 +198,7 @@ export declare class Session implements SessionFace {
|
|
|
199
198
|
/** Jump loader: page backwards until the window covers seq (see ISession.loadThrough). */
|
|
200
199
|
loadThrough(seq: SessionSeq): Promise<void>;
|
|
201
200
|
/** Rebuild an opened history source after address replacement.
|
|
202
|
-
* Invalidates any in-flight open first;
|
|
201
|
+
* Invalidates any in-flight open first; projection state belongs to the independently
|
|
203
202
|
* reconnecting control stream and remains untouched. */
|
|
204
203
|
resync(): Promise<void>;
|
|
205
204
|
/**
|
|
@@ -213,18 +212,6 @@ export declare class Session implements SessionFace {
|
|
|
213
212
|
* @returns the cached reference (stable until the next flush).
|
|
214
213
|
*/
|
|
215
214
|
getSnapshot(): SessionSnapshot;
|
|
216
|
-
/**
|
|
217
|
-
* Replace every transient control value for this Session from one stream baseline.
|
|
218
|
-
* @param queue - complete pending queue for this Session.
|
|
219
|
-
*/
|
|
220
|
-
replaceControl(queue: readonly SessionQueuedItem[]): void;
|
|
221
|
-
/**
|
|
222
|
-
* Apply one Session-addressed live control update.
|
|
223
|
-
* @param frame - queue replacement addressed to this Session.
|
|
224
|
-
*/
|
|
225
|
-
handleControlFrame(frame: Extract<SessionControlFrame, {
|
|
226
|
-
type: 'queue';
|
|
227
|
-
}>): void;
|
|
228
215
|
/**
|
|
229
216
|
* Running-bit relay from the host stream (list entry and snapshot stay consistent).
|
|
230
217
|
* @param running - the new running state.
|
|
@@ -273,10 +260,10 @@ export declare class Session implements SessionFace {
|
|
|
273
260
|
private prependWindow;
|
|
274
261
|
/** Append one stream-validated live event. */
|
|
275
262
|
private appendLive;
|
|
276
|
-
/**
|
|
263
|
+
/** Observe durable acceptance even when insertion and claim share one projection notification. */
|
|
277
264
|
private observeSubmissionEvent;
|
|
278
|
-
/** Retire echoes
|
|
279
|
-
private
|
|
265
|
+
/** Retire local echoes when their accepted messages appear in the durable Inbox projection. */
|
|
266
|
+
private observeSubmissionInbox;
|
|
280
267
|
/**
|
|
281
268
|
* Latch one observed settlement and remove the echo an animation frame
|
|
282
269
|
* later. The delay keeps the echo in the snapshot until the frame in which
|
|
@@ -8,7 +8,6 @@ import { isRemoteFailure } from '@deepseek-ai/dsh-api-gateway/client';
|
|
|
8
8
|
import { RemoteError } from '@deepseek-ai/dsh-typert-protocol';
|
|
9
9
|
import { ProjectionValueStore } from "./projection-store.js";
|
|
10
10
|
import { resolvedClientTimeZone } from "../time-zone.js";
|
|
11
|
-
import { SessionQueueMirror } from "./queue-mirror.js";
|
|
12
11
|
import { ClientAssistantStream, } from "./assistant-stream.js";
|
|
13
12
|
function projectionsBaseline(value) {
|
|
14
13
|
return {
|
|
@@ -44,8 +43,7 @@ export class Session {
|
|
|
44
43
|
jumpTargetSeq = null;
|
|
45
44
|
/** The running jump loop's completion, shared by retargeting callers. */
|
|
46
45
|
jumpPromise = null;
|
|
47
|
-
|
|
48
|
-
queueMirror = new SessionQueueMirror();
|
|
46
|
+
stopObservingInbox;
|
|
49
47
|
assistantStream = new ClientAssistantStream();
|
|
50
48
|
running = false;
|
|
51
49
|
address;
|
|
@@ -66,7 +64,7 @@ export class Session {
|
|
|
66
64
|
/** Local submission echoes, insertion-ordered (see SessionSnapshot.pendingSubmissions). */
|
|
67
65
|
pendingSubmissions = [];
|
|
68
66
|
/** Per-echo settlement state; `retiring` latches the first observation so a
|
|
69
|
-
*
|
|
67
|
+
* Inbox projection and its durable event cannot both retire one echo. */
|
|
70
68
|
submissionSettlements = new Map();
|
|
71
69
|
/** Owns the addressed page/follow lifecycle while this Session is open. */
|
|
72
70
|
events;
|
|
@@ -111,6 +109,9 @@ export class Session {
|
|
|
111
109
|
this.snapshotCache = this.buildSnapshot();
|
|
112
110
|
});
|
|
113
111
|
this.snapshotCache = this.buildSnapshot();
|
|
112
|
+
this.stopObservingInbox = this.projections.faceOf('inbox').subscribe(() => {
|
|
113
|
+
this.observeSubmissionInbox();
|
|
114
|
+
});
|
|
114
115
|
}
|
|
115
116
|
/**
|
|
116
117
|
* Bind the Agent-scoped context minted by ClientSessions (single write;
|
|
@@ -384,7 +385,7 @@ export class Session {
|
|
|
384
385
|
return this.jumpPromise;
|
|
385
386
|
}
|
|
386
387
|
/** Rebuild an opened history source after address replacement.
|
|
387
|
-
* Invalidates any in-flight open first;
|
|
388
|
+
* Invalidates any in-flight open first; projection state belongs to the independently
|
|
388
389
|
* reconnecting control stream and remains untouched. */
|
|
389
390
|
async resync() {
|
|
390
391
|
if (this.openState === 'cold')
|
|
@@ -418,24 +419,6 @@ export class Session {
|
|
|
418
419
|
return this.snapshotCache;
|
|
419
420
|
}
|
|
420
421
|
// ---- Manager-only entry points (@internal; never called by the UI) ----
|
|
421
|
-
/**
|
|
422
|
-
* Replace every transient control value for this Session from one stream baseline.
|
|
423
|
-
* @param queue - complete pending queue for this Session.
|
|
424
|
-
*/
|
|
425
|
-
replaceControl(queue) {
|
|
426
|
-
this.queueMirror.replace(queue);
|
|
427
|
-
this.observeSubmissionQueue(queue);
|
|
428
|
-
this.notifier.markDirty();
|
|
429
|
-
}
|
|
430
|
-
/**
|
|
431
|
-
* Apply one Session-addressed live control update.
|
|
432
|
-
* @param frame - queue replacement addressed to this Session.
|
|
433
|
-
*/
|
|
434
|
-
handleControlFrame(frame) {
|
|
435
|
-
this.queueMirror.replace(frame.items);
|
|
436
|
-
this.observeSubmissionQueue(frame.items);
|
|
437
|
-
this.notifier.markDirty();
|
|
438
|
-
}
|
|
439
422
|
/**
|
|
440
423
|
* Running-bit relay from the host stream (list entry and snapshot stay consistent).
|
|
441
424
|
* @param running - the new running state.
|
|
@@ -514,6 +497,7 @@ export class Session {
|
|
|
514
497
|
* @returns when the Remote iterator has completed teardown.
|
|
515
498
|
*/
|
|
516
499
|
async dispose() {
|
|
500
|
+
this.stopObservingInbox();
|
|
517
501
|
// Unsettled echoes retire as failed so their owners can restore or
|
|
518
502
|
// release browser resources; echoes already scheduled as observed keep
|
|
519
503
|
// that settlement.
|
|
@@ -635,17 +619,26 @@ export class Session {
|
|
|
635
619
|
const awaitingFirstTurn = this.firstPromptPendingTurn;
|
|
636
620
|
if (event.type === 'turn/start')
|
|
637
621
|
this.firstPromptPendingTurn = false;
|
|
638
|
-
const queueChanged = this.queueMirror.acceptDurable(event);
|
|
639
622
|
this.eventSource.append(entry);
|
|
640
623
|
// After the feed append: the conversation assembly's animation frame is
|
|
641
624
|
// registered by the feed subscribers above, so the echo-retirement frame
|
|
642
625
|
// scheduled here always runs after the durable node became renderable.
|
|
643
626
|
this.observeSubmissionEvent(event);
|
|
644
|
-
return
|
|
627
|
+
return awaitingFirstTurn !== this.firstPromptPendingTurn;
|
|
645
628
|
}
|
|
646
|
-
/**
|
|
629
|
+
/** Observe durable acceptance even when insertion and claim share one projection notification. */
|
|
647
630
|
observeSubmissionEvent(event) {
|
|
648
|
-
if (this.submissionSettlements.size === 0
|
|
631
|
+
if (this.submissionSettlements.size === 0)
|
|
632
|
+
return;
|
|
633
|
+
if (event.type === 'agent/inbox/spliced') {
|
|
634
|
+
const splice = event.data;
|
|
635
|
+
if (Array.isArray(splice?.inserted)) {
|
|
636
|
+
for (const message of splice.inserted)
|
|
637
|
+
this.observeSubmissionEvent({ type: 'user/message', data: message });
|
|
638
|
+
}
|
|
639
|
+
return;
|
|
640
|
+
}
|
|
641
|
+
if (event.type !== 'user/message')
|
|
649
642
|
return;
|
|
650
643
|
// Structural read: window entries may be compact history records, so the
|
|
651
644
|
// fields are narrowed rather than trusted (same posture as Conversation
|
|
@@ -656,13 +649,17 @@ export class Session {
|
|
|
656
649
|
return;
|
|
657
650
|
this.scheduleObservedRetirement(source.rpcId, attachmentRefsIn(data?.content));
|
|
658
651
|
}
|
|
659
|
-
/** Retire echoes
|
|
660
|
-
|
|
652
|
+
/** Retire local echoes when their accepted messages appear in the durable Inbox projection. */
|
|
653
|
+
observeSubmissionInbox() {
|
|
661
654
|
if (this.submissionSettlements.size === 0)
|
|
662
655
|
return;
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
656
|
+
const inbox = this.projections.get('inbox');
|
|
657
|
+
if (inbox === undefined)
|
|
658
|
+
return;
|
|
659
|
+
for (const message of [...inbox['next-turn'], ...inbox['next-step']]) {
|
|
660
|
+
const source = message.source;
|
|
661
|
+
if (source.kind === 'user' && 'rpcId' in source) {
|
|
662
|
+
this.scheduleObservedRetirement(source.rpcId, attachmentRefsIn(message.content));
|
|
666
663
|
}
|
|
667
664
|
}
|
|
668
665
|
}
|
|
@@ -715,7 +712,6 @@ export class Session {
|
|
|
715
712
|
buildSnapshot() {
|
|
716
713
|
return {
|
|
717
714
|
sessionId: this.sessionId,
|
|
718
|
-
queue: this.queueMirror.snapshot(),
|
|
719
715
|
pendingSubmissions: this.pendingSubmissions,
|
|
720
716
|
running: this.running,
|
|
721
717
|
subagent: this.address === undefined
|
package/lib/types/commands.d.ts
CHANGED
|
@@ -50,11 +50,11 @@ export declare class SessionCommandController {
|
|
|
50
50
|
*/
|
|
51
51
|
attachment(request: SessionAttachmentRequest): Promise<SessionAttachmentValue>;
|
|
52
52
|
/**
|
|
53
|
-
* Mutate one
|
|
53
|
+
* Mutate one pending Inbox occurrence, restoring an ordinary cold Agent when needed.
|
|
54
54
|
* @param request - Session, queue item, and requested mutation.
|
|
55
55
|
* @returns acknowledgement that the queue mutation was applied.
|
|
56
56
|
*/
|
|
57
|
-
updateQueue(request: SessionUpdateQueueRequest): SessionUpdateQueueValue
|
|
57
|
+
updateQueue(request: SessionUpdateQueueRequest): Promise<SessionUpdateQueueValue>;
|
|
58
58
|
/**
|
|
59
59
|
* Cancel one live ordinary Agent while retaining pending inbox work.
|
|
60
60
|
* @param request - Session whose active Agent turn is cancelled.
|
package/lib/types/commands.js
CHANGED
|
@@ -413,11 +413,11 @@ export class SessionCommandController {
|
|
|
413
413
|
}
|
|
414
414
|
}
|
|
415
415
|
/**
|
|
416
|
-
* Mutate one
|
|
416
|
+
* Mutate one pending Inbox occurrence, restoring an ordinary cold Agent when needed.
|
|
417
417
|
* @param request - Session, queue item, and requested mutation.
|
|
418
418
|
* @returns acknowledgement that the queue mutation was applied.
|
|
419
419
|
*/
|
|
420
|
-
updateQueue(request) {
|
|
420
|
+
async updateQueue(request) {
|
|
421
421
|
if (request.action.kind === 'edit') {
|
|
422
422
|
if (request.action.content.some(block => block.type !== 'text')) {
|
|
423
423
|
throw new RemoteError('session/attachment-invalid', 'queue edits accept text content only', { reason: 'QUEUE_EDIT_NON_TEXT' });
|
|
@@ -426,9 +426,15 @@ export class SessionCommandController {
|
|
|
426
426
|
throw new RemoteError('gateway/bad-request', 'queue edit content must include non-whitespace text', {});
|
|
427
427
|
}
|
|
428
428
|
}
|
|
429
|
-
|
|
429
|
+
let agent = this.ctx.agents.get(request.sessionId);
|
|
430
430
|
if (agent === undefined) {
|
|
431
|
-
|
|
431
|
+
const found = await this.agents.resolveAgent(request.sessionId);
|
|
432
|
+
if ('error' in found) {
|
|
433
|
+
if (found.error.code !== 'session/not-found')
|
|
434
|
+
throw found.error;
|
|
435
|
+
throw new RemoteError('session/queue-item-not-found', 'queued item is no longer pending', { itemId: request.itemId });
|
|
436
|
+
}
|
|
437
|
+
agent = found.agent;
|
|
432
438
|
}
|
|
433
439
|
if (hasApiSessionSubagentOwner(this.ctx, agent.session, agent)) {
|
|
434
440
|
const identity = this.ctx.sessionProjections
|
package/lib/types/control.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Live Session
|
|
1
|
+
/** Live Session jobs and projection state with reconnect baselines. */
|
|
2
2
|
import type { Context } from '@deepseek-ai/cordis';
|
|
3
3
|
import type { SessionControlFrame } from './types.ts';
|
|
4
4
|
/** Owns the Host-wide Session control stream. */
|
package/lib/types/control.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Live Session
|
|
1
|
+
/** Live Session jobs and projection state with reconnect baselines. */
|
|
2
2
|
import { Deque } from '@deepseek-ai/dsh-deque';
|
|
3
3
|
/** Owns the Host-wide Session control stream. */
|
|
4
4
|
export class SessionControlController {
|
|
@@ -15,16 +15,6 @@ export class SessionControlController {
|
|
|
15
15
|
value: value,
|
|
16
16
|
seq,
|
|
17
17
|
});
|
|
18
|
-
if (key !== 'inbox')
|
|
19
|
-
return;
|
|
20
|
-
const agent = this.ctx.agents.get(session.id);
|
|
21
|
-
if (agent?.session !== session)
|
|
22
|
-
return;
|
|
23
|
-
this.broadcast({
|
|
24
|
-
type: 'queue',
|
|
25
|
-
sessionId: session.id,
|
|
26
|
-
items: queueItemsFromInbox(value),
|
|
27
|
-
});
|
|
28
18
|
});
|
|
29
19
|
ctx.inject(['jobs'], (jobsCtx) => {
|
|
30
20
|
jobsCtx.jobs.onJobsChanged((owner) => { this.onJobsChanged(owner); });
|
|
@@ -60,15 +50,12 @@ export class SessionControlController {
|
|
|
60
50
|
}
|
|
61
51
|
baseline() {
|
|
62
52
|
const sessions = this.ctx.sessions.list();
|
|
63
|
-
const queues = Object.create(null);
|
|
64
53
|
const jobs = Object.create(null);
|
|
65
54
|
for (const session of sessions) {
|
|
66
55
|
const agent = this.ctx.agents.get(session.id);
|
|
67
|
-
queues[session.id] = agent?.session === session ? queueItems(agent) : [];
|
|
68
56
|
jobs[session.id] = this.jobsFor(agent);
|
|
69
57
|
}
|
|
70
58
|
return {
|
|
71
|
-
queues,
|
|
72
59
|
jobs,
|
|
73
60
|
projections: this.projectionBaseline(sessions),
|
|
74
61
|
};
|
|
@@ -148,33 +135,6 @@ class ControlQueue {
|
|
|
148
135
|
}
|
|
149
136
|
}
|
|
150
137
|
}
|
|
151
|
-
function queueItems(agent) {
|
|
152
|
-
return queueItemsFromInbox({
|
|
153
|
-
'next-turn': agent.inbox.nextTurn,
|
|
154
|
-
'next-step': agent.inbox.nextStep,
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
function queueItemsFromInbox(inbox) {
|
|
158
|
-
return [
|
|
159
|
-
...inbox['next-turn'].map(message => ({
|
|
160
|
-
id: message.id,
|
|
161
|
-
placement: 'queued',
|
|
162
|
-
...promptRpcId(message),
|
|
163
|
-
message: { id: message.id, content: message.content },
|
|
164
|
-
})),
|
|
165
|
-
...inbox['next-step'].map(message => ({
|
|
166
|
-
id: message.id,
|
|
167
|
-
placement: message.source.kind === 'user' ? 'steering' : 'context',
|
|
168
|
-
...promptRpcId(message),
|
|
169
|
-
message: { id: message.id, content: message.content },
|
|
170
|
-
})),
|
|
171
|
-
];
|
|
172
|
-
}
|
|
173
|
-
/** Prompt-RPC identity carried by a browser-submitted message's user source. */
|
|
174
|
-
function promptRpcId(message) {
|
|
175
|
-
const source = message.source;
|
|
176
|
-
return source.kind === 'user' && 'rpcId' in source ? { rpcId: source.rpcId } : {};
|
|
177
|
-
}
|
|
178
138
|
function jobView(job) {
|
|
179
139
|
return {
|
|
180
140
|
id: job.id,
|
package/lib/types/index.d.ts
CHANGED
|
@@ -143,11 +143,11 @@ export declare class SessionController extends TypertRemoteService {
|
|
|
143
143
|
*/
|
|
144
144
|
attachment(request: SessionAttachmentRequest): Promise<SessionAttachmentValue>;
|
|
145
145
|
/**
|
|
146
|
-
* Mutate one still-pending queue occurrence
|
|
146
|
+
* Mutate one still-pending queue occurrence, resuming a cold Agent first.
|
|
147
147
|
* @param request - Session, queue item, and requested mutation.
|
|
148
148
|
* @returns acknowledgement that the queue mutation was applied.
|
|
149
149
|
*/
|
|
150
|
-
updateQueue(request: SessionUpdateQueueRequest): SessionUpdateQueueValue
|
|
150
|
+
updateQueue(request: SessionUpdateQueueRequest): Promise<SessionUpdateQueueValue>;
|
|
151
151
|
/**
|
|
152
152
|
* Cancel one active Agent turn without dropping its pending inbox.
|
|
153
153
|
* @param request - Session whose active Agent turn is cancelled.
|
package/lib/types/index.js
CHANGED
|
@@ -403,7 +403,7 @@ let SessionController = (() => {
|
|
|
403
403
|
return this.commands.attachment(request);
|
|
404
404
|
}
|
|
405
405
|
/**
|
|
406
|
-
* Mutate one still-pending queue occurrence
|
|
406
|
+
* Mutate one still-pending queue occurrence, resuming a cold Agent first.
|
|
407
407
|
* @param request - Session, queue item, and requested mutation.
|
|
408
408
|
* @returns acknowledgement that the queue mutation was applied.
|
|
409
409
|
*/
|
package/lib/types/types.d.ts
CHANGED
|
@@ -172,6 +172,9 @@ declare module '@deepseek-ai/dsh-typert-protocol' {
|
|
|
172
172
|
readonly requestedCwd: string;
|
|
173
173
|
readonly existingCwd?: string;
|
|
174
174
|
};
|
|
175
|
+
'session/writer-held': {
|
|
176
|
+
readonly sessionId: SessionId;
|
|
177
|
+
};
|
|
175
178
|
'session/agent-busy': {
|
|
176
179
|
readonly reason: string;
|
|
177
180
|
};
|
|
@@ -486,18 +489,6 @@ export type SessionFollowFrame = {
|
|
|
486
489
|
readonly type: 'assistant-stream';
|
|
487
490
|
readonly frame: SessionAssistantStreamFrame;
|
|
488
491
|
};
|
|
489
|
-
/** One pending inbox occurrence in the authoritative queue snapshot. */
|
|
490
|
-
export interface SessionQueuedItem {
|
|
491
|
-
readonly id: MessageId;
|
|
492
|
-
readonly placement: 'queued' | 'steering' | 'context';
|
|
493
|
-
/** Prompt-RPC identity from the queued message's user source; clients retire the matching local submission echo on it. */
|
|
494
|
-
readonly rpcId?: SessionRequestId;
|
|
495
|
-
/** JSON-safe message fields consumed by pending-queue presentation. */
|
|
496
|
-
readonly message: {
|
|
497
|
-
readonly id: MessageId;
|
|
498
|
-
readonly content: readonly JsonValue[];
|
|
499
|
-
};
|
|
500
|
-
}
|
|
501
492
|
/** Browser-safe background-job row. */
|
|
502
493
|
export interface SessionJob {
|
|
503
494
|
readonly id: JobId;
|
|
@@ -510,7 +501,6 @@ export interface SessionJob {
|
|
|
510
501
|
}
|
|
511
502
|
/** Complete live control baseline emitted once per control stream generation. */
|
|
512
503
|
export interface SessionControlBaseline {
|
|
513
|
-
readonly queues: Readonly<Record<SessionId, readonly SessionQueuedItem[]>>;
|
|
514
504
|
readonly jobs: Readonly<Record<SessionId, readonly SessionJob[]>>;
|
|
515
505
|
readonly projections: Readonly<Record<SessionId, SessionProjectionBaseline>>;
|
|
516
506
|
}
|
|
@@ -525,10 +515,6 @@ export interface SessionProjectionUpdate {
|
|
|
525
515
|
export type SessionControlFrame = {
|
|
526
516
|
readonly type: 'baseline';
|
|
527
517
|
readonly value: SessionControlBaseline;
|
|
528
|
-
} | {
|
|
529
|
-
readonly type: 'queue';
|
|
530
|
-
readonly sessionId: SessionId;
|
|
531
|
-
readonly items: readonly SessionQueuedItem[];
|
|
532
518
|
} | {
|
|
533
519
|
readonly type: 'jobs';
|
|
534
520
|
readonly sessionId: SessionId;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crazx/dsh-api-session-controller",
|
|
3
3
|
"description": "Session Remote commands, cold reads, and live control transport",
|
|
4
|
-
"version": "0.1.6-alpha.
|
|
4
|
+
"version": "0.1.6-alpha.2.zw.1",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -65,42 +65,42 @@
|
|
|
65
65
|
],
|
|
66
66
|
"license": "MIT",
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@deepseek-ai/dsh-brand": "^0.1.6-alpha.
|
|
69
|
-
"@deepseek-ai/dsh-deque": "^0.1.6-alpha.
|
|
68
|
+
"@deepseek-ai/dsh-brand": "^0.1.6-alpha.2",
|
|
69
|
+
"@deepseek-ai/dsh-deque": "^0.1.6-alpha.2",
|
|
70
70
|
"@deepseek-ai/schemastery": "^3.18.2",
|
|
71
71
|
"mime-types": "^3.0.2",
|
|
72
72
|
"zod": "^4.4.3"
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
75
|
"@deepseek-ai/cordis": "^4.0.2",
|
|
76
|
-
"@deepseek-ai/dsh-agent": "^0.1.6-alpha.
|
|
77
|
-
"@deepseek-ai/dsh-agent-default-model": "0.1.6-alpha.
|
|
78
|
-
"@deepseek-ai/dsh-agent-presets": "^0.1.6-alpha.
|
|
79
|
-
"@deepseek-ai/dsh-api-gateway": "^0.1.6-alpha.
|
|
80
|
-
"@deepseek-ai/dsh-attachment": "^0.1.6-alpha.
|
|
81
|
-
"@deepseek-ai/dsh-client-connection": "^0.1.6-alpha.
|
|
82
|
-
"@deepseek-ai/dsh-client-file-upload": "^0.1.6-alpha.
|
|
83
|
-
"@deepseek-ai/dsh-commands": "^0.1.6-alpha.
|
|
84
|
-
"@deepseek-ai/dsh-file-reference": "^0.1.6-alpha.
|
|
85
|
-
"@deepseek-ai/dsh-fs": "^0.1.6-alpha.
|
|
86
|
-
"@deepseek-ai/dsh-jobs": "^0.1.6-alpha.
|
|
87
|
-
"@deepseek-ai/dsh-llm": "^0.1.6-alpha.
|
|
88
|
-
"@deepseek-ai/dsh-native-command": "^0.1.6-alpha.
|
|
89
|
-
"@deepseek-ai/dsh-scope": "^0.1.6-alpha.
|
|
90
|
-
"@deepseek-ai/dsh-session": "^0.1.6-alpha.
|
|
91
|
-
"@deepseek-ai/dsh-session-persistence": "^0.1.6-alpha.
|
|
92
|
-
"@deepseek-ai/dsh-session-projection": "^0.1.6-alpha.
|
|
93
|
-
"@deepseek-ai/dsh-session-projection-cache": "^0.1.6-alpha.
|
|
94
|
-
"@deepseek-ai/dsh-session-query": "^0.1.6-alpha.
|
|
95
|
-
"@deepseek-ai/dsh-session-title": "^0.1.6-alpha.
|
|
96
|
-
"@deepseek-ai/dsh-skill": "^0.1.6-alpha.
|
|
97
|
-
"@deepseek-ai/dsh-subagent": "^0.1.6-alpha.
|
|
98
|
-
"@deepseek-ai/dsh-typert-protocol": "^0.1.6-alpha.
|
|
99
|
-
"@deepseek-ai/dsh-typert-registry": "^0.1.6-alpha.
|
|
100
|
-
"@deepseek-ai/dsh-util-time": "^0.1.6-alpha.
|
|
101
|
-
"@deepseek-ai/dsh-util-values": "^0.1.6-alpha.
|
|
102
|
-
"@deepseek-ai/dsh-util-workspace-path": "^0.1.6-alpha.
|
|
103
|
-
"@deepseek-ai/dsh-workspace": "^0.1.6-alpha.
|
|
76
|
+
"@deepseek-ai/dsh-agent": "^0.1.6-alpha.2",
|
|
77
|
+
"@deepseek-ai/dsh-agent-default-model": "0.1.6-alpha.2.zw.1",
|
|
78
|
+
"@deepseek-ai/dsh-agent-presets": "^0.1.6-alpha.2",
|
|
79
|
+
"@deepseek-ai/dsh-api-gateway": "^0.1.6-alpha.2",
|
|
80
|
+
"@deepseek-ai/dsh-attachment": "^0.1.6-alpha.2",
|
|
81
|
+
"@deepseek-ai/dsh-client-connection": "^0.1.6-alpha.2",
|
|
82
|
+
"@deepseek-ai/dsh-client-file-upload": "^0.1.6-alpha.2",
|
|
83
|
+
"@deepseek-ai/dsh-commands": "^0.1.6-alpha.2",
|
|
84
|
+
"@deepseek-ai/dsh-file-reference": "^0.1.6-alpha.2",
|
|
85
|
+
"@deepseek-ai/dsh-fs": "^0.1.6-alpha.2",
|
|
86
|
+
"@deepseek-ai/dsh-jobs": "^0.1.6-alpha.2",
|
|
87
|
+
"@deepseek-ai/dsh-llm": "^0.1.6-alpha.2",
|
|
88
|
+
"@deepseek-ai/dsh-native-command": "^0.1.6-alpha.2",
|
|
89
|
+
"@deepseek-ai/dsh-scope": "^0.1.6-alpha.2",
|
|
90
|
+
"@deepseek-ai/dsh-session": "^0.1.6-alpha.2",
|
|
91
|
+
"@deepseek-ai/dsh-session-persistence": "^0.1.6-alpha.2",
|
|
92
|
+
"@deepseek-ai/dsh-session-projection": "^0.1.6-alpha.2",
|
|
93
|
+
"@deepseek-ai/dsh-session-projection-cache": "^0.1.6-alpha.2",
|
|
94
|
+
"@deepseek-ai/dsh-session-query": "^0.1.6-alpha.2",
|
|
95
|
+
"@deepseek-ai/dsh-session-title": "^0.1.6-alpha.2",
|
|
96
|
+
"@deepseek-ai/dsh-skill": "^0.1.6-alpha.2",
|
|
97
|
+
"@deepseek-ai/dsh-subagent": "^0.1.6-alpha.2",
|
|
98
|
+
"@deepseek-ai/dsh-typert-protocol": "^0.1.6-alpha.2",
|
|
99
|
+
"@deepseek-ai/dsh-typert-registry": "^0.1.6-alpha.2",
|
|
100
|
+
"@deepseek-ai/dsh-util-time": "^0.1.6-alpha.2",
|
|
101
|
+
"@deepseek-ai/dsh-util-values": "^0.1.6-alpha.2",
|
|
102
|
+
"@deepseek-ai/dsh-util-workspace-path": "^0.1.6-alpha.2",
|
|
103
|
+
"@deepseek-ai/dsh-workspace": "^0.1.6-alpha.2"
|
|
104
104
|
},
|
|
105
105
|
"peerDependenciesMeta": {
|
|
106
106
|
"@deepseek-ai/dsh-jobs": {
|
|
@@ -115,45 +115,45 @@
|
|
|
115
115
|
},
|
|
116
116
|
"devDependencies": {
|
|
117
117
|
"@deepseek-ai/cordis": "^4.0.2",
|
|
118
|
-
"@deepseek-ai/dsh-agent": "^0.1.6-alpha.
|
|
119
|
-
"@deepseek-ai/dsh-agent-default-model": "npm:@crazx/dsh-agent-default-model@0.1.6-alpha.
|
|
120
|
-
"@deepseek-ai/dsh-agent-loop": "^0.1.6-alpha.
|
|
121
|
-
"@deepseek-ai/dsh-agent-loop-testkit": "^0.1.6-alpha.
|
|
122
|
-
"@deepseek-ai/dsh-agent-presets": "^0.1.6-alpha.
|
|
123
|
-
"@deepseek-ai/dsh-api-gateway": "^0.1.6-alpha.
|
|
124
|
-
"@deepseek-ai/dsh-attachment": "^0.1.6-alpha.
|
|
125
|
-
"@deepseek-ai/dsh-client-connection": "^0.1.6-alpha.
|
|
126
|
-
"@deepseek-ai/dsh-client-file-upload": "^0.1.6-alpha.
|
|
127
|
-
"@deepseek-ai/dsh-client-store": "^0.1.6-alpha.
|
|
128
|
-
"@deepseek-ai/dsh-client-test-runtime": "npm:@crazx/dsh-client-test-runtime@0.1.6-alpha.
|
|
129
|
-
"@deepseek-ai/dsh-commands": "^0.1.6-alpha.
|
|
130
|
-
"@deepseek-ai/dsh-file-reference": "^0.1.6-alpha.
|
|
131
|
-
"@deepseek-ai/dsh-fs": "^0.1.6-alpha.
|
|
132
|
-
"@deepseek-ai/dsh-fs-local": "^0.1.6-alpha.
|
|
133
|
-
"@deepseek-ai/dsh-jobs": "^0.1.6-alpha.
|
|
134
|
-
"@deepseek-ai/dsh-llm": "^0.1.6-alpha.
|
|
135
|
-
"@deepseek-ai/dsh-native-command": "^0.1.6-alpha.
|
|
136
|
-
"@deepseek-ai/dsh-permission-presets": "^0.1.6-alpha.
|
|
137
|
-
"@deepseek-ai/dsh-remote-mock": "^0.1.6-alpha.
|
|
138
|
-
"@deepseek-ai/dsh-scope": "^0.1.6-alpha.
|
|
139
|
-
"@deepseek-ai/dsh-session": "^0.1.6-alpha.
|
|
140
|
-
"@deepseek-ai/dsh-session-persistence": "^0.1.6-alpha.
|
|
141
|
-
"@deepseek-ai/dsh-session-projection": "^0.1.6-alpha.
|
|
142
|
-
"@deepseek-ai/dsh-session-projection-cache": "^0.1.6-alpha.
|
|
143
|
-
"@deepseek-ai/dsh-session-query": "^0.1.6-alpha.
|
|
144
|
-
"@deepseek-ai/dsh-session-title": "^0.1.6-alpha.
|
|
145
|
-
"@deepseek-ai/dsh-skill": "^0.1.6-alpha.
|
|
146
|
-
"@deepseek-ai/dsh-storage": "^0.1.6-alpha.
|
|
147
|
-
"@deepseek-ai/dsh-storage-domain": "^0.1.6-alpha.
|
|
148
|
-
"@deepseek-ai/dsh-storage-json": "^0.1.6-alpha.
|
|
149
|
-
"@deepseek-ai/dsh-subagent": "^0.1.6-alpha.
|
|
150
|
-
"@deepseek-ai/dsh-typert-protocol": "^0.1.6-alpha.
|
|
151
|
-
"@deepseek-ai/dsh-typert-registry": "^0.1.6-alpha.
|
|
152
|
-
"@deepseek-ai/dsh-util-crypto": "^0.1.6-alpha.
|
|
153
|
-
"@deepseek-ai/dsh-util-time": "^0.1.6-alpha.
|
|
154
|
-
"@deepseek-ai/dsh-util-values": "^0.1.6-alpha.
|
|
155
|
-
"@deepseek-ai/dsh-util-workspace-path": "^0.1.6-alpha.
|
|
156
|
-
"@deepseek-ai/dsh-workspace": "^0.1.6-alpha.
|
|
118
|
+
"@deepseek-ai/dsh-agent": "^0.1.6-alpha.2",
|
|
119
|
+
"@deepseek-ai/dsh-agent-default-model": "npm:@crazx/dsh-agent-default-model@0.1.6-alpha.2.zw.1",
|
|
120
|
+
"@deepseek-ai/dsh-agent-loop": "^0.1.6-alpha.2",
|
|
121
|
+
"@deepseek-ai/dsh-agent-loop-testkit": "^0.1.6-alpha.2",
|
|
122
|
+
"@deepseek-ai/dsh-agent-presets": "^0.1.6-alpha.2",
|
|
123
|
+
"@deepseek-ai/dsh-api-gateway": "^0.1.6-alpha.2",
|
|
124
|
+
"@deepseek-ai/dsh-attachment": "^0.1.6-alpha.2",
|
|
125
|
+
"@deepseek-ai/dsh-client-connection": "^0.1.6-alpha.2",
|
|
126
|
+
"@deepseek-ai/dsh-client-file-upload": "^0.1.6-alpha.2",
|
|
127
|
+
"@deepseek-ai/dsh-client-store": "^0.1.6-alpha.2",
|
|
128
|
+
"@deepseek-ai/dsh-client-test-runtime": "npm:@crazx/dsh-client-test-runtime@0.1.6-alpha.2.zw.1",
|
|
129
|
+
"@deepseek-ai/dsh-commands": "^0.1.6-alpha.2",
|
|
130
|
+
"@deepseek-ai/dsh-file-reference": "^0.1.6-alpha.2",
|
|
131
|
+
"@deepseek-ai/dsh-fs": "^0.1.6-alpha.2",
|
|
132
|
+
"@deepseek-ai/dsh-fs-local": "^0.1.6-alpha.2",
|
|
133
|
+
"@deepseek-ai/dsh-jobs": "^0.1.6-alpha.2",
|
|
134
|
+
"@deepseek-ai/dsh-llm": "^0.1.6-alpha.2",
|
|
135
|
+
"@deepseek-ai/dsh-native-command": "^0.1.6-alpha.2",
|
|
136
|
+
"@deepseek-ai/dsh-permission-presets": "^0.1.6-alpha.2",
|
|
137
|
+
"@deepseek-ai/dsh-remote-mock": "^0.1.6-alpha.2",
|
|
138
|
+
"@deepseek-ai/dsh-scope": "^0.1.6-alpha.2",
|
|
139
|
+
"@deepseek-ai/dsh-session": "^0.1.6-alpha.2",
|
|
140
|
+
"@deepseek-ai/dsh-session-persistence": "^0.1.6-alpha.2",
|
|
141
|
+
"@deepseek-ai/dsh-session-projection": "^0.1.6-alpha.2",
|
|
142
|
+
"@deepseek-ai/dsh-session-projection-cache": "^0.1.6-alpha.2",
|
|
143
|
+
"@deepseek-ai/dsh-session-query": "^0.1.6-alpha.2",
|
|
144
|
+
"@deepseek-ai/dsh-session-title": "^0.1.6-alpha.2",
|
|
145
|
+
"@deepseek-ai/dsh-skill": "^0.1.6-alpha.2",
|
|
146
|
+
"@deepseek-ai/dsh-storage": "^0.1.6-alpha.2",
|
|
147
|
+
"@deepseek-ai/dsh-storage-domain": "^0.1.6-alpha.2",
|
|
148
|
+
"@deepseek-ai/dsh-storage-json": "^0.1.6-alpha.2",
|
|
149
|
+
"@deepseek-ai/dsh-subagent": "^0.1.6-alpha.2",
|
|
150
|
+
"@deepseek-ai/dsh-typert-protocol": "^0.1.6-alpha.2",
|
|
151
|
+
"@deepseek-ai/dsh-typert-registry": "^0.1.6-alpha.2",
|
|
152
|
+
"@deepseek-ai/dsh-util-crypto": "^0.1.6-alpha.2",
|
|
153
|
+
"@deepseek-ai/dsh-util-time": "^0.1.6-alpha.2",
|
|
154
|
+
"@deepseek-ai/dsh-util-values": "^0.1.6-alpha.2",
|
|
155
|
+
"@deepseek-ai/dsh-util-workspace-path": "^0.1.6-alpha.2",
|
|
156
|
+
"@deepseek-ai/dsh-workspace": "^0.1.6-alpha.2",
|
|
157
157
|
"@types/mime-types": "^3.0.1"
|
|
158
158
|
},
|
|
159
159
|
"scripts": {
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { SessionQueuedItem } from '../../types.ts';
|
|
2
|
-
import type { SessionEvent } from '@deepseek-ai/dsh-session/types';
|
|
3
|
-
import type { QueuedMessage } from '../contract/snapshot.ts';
|
|
4
|
-
type QueueItems = readonly SessionQueuedItem[];
|
|
5
|
-
/** Authoritative transient queue projection and durable steering handoff. */
|
|
6
|
-
export declare class SessionQueueMirror {
|
|
7
|
-
private current;
|
|
8
|
-
/**
|
|
9
|
-
* Return the current immutable queue projection.
|
|
10
|
-
* @returns current queue rows.
|
|
11
|
-
*/
|
|
12
|
-
snapshot(): readonly QueuedMessage[];
|
|
13
|
-
/**
|
|
14
|
-
* Replace from one authoritative stream queue frame.
|
|
15
|
-
* @param items - complete host queue snapshot.
|
|
16
|
-
*/
|
|
17
|
-
replace(items: QueueItems): void;
|
|
18
|
-
/**
|
|
19
|
-
* Retire a transient steering row once its durable message enters the log.
|
|
20
|
-
* @param event - newly contiguous durable Session event.
|
|
21
|
-
* @returns whether the projection changed.
|
|
22
|
-
*/
|
|
23
|
-
acceptDurable(event: SessionEvent): boolean;
|
|
24
|
-
}
|
|
25
|
-
export {};
|
|
26
|
-
//# sourceMappingURL=queue-mirror.d.ts.map
|