@khorsheed/dsh-client-message-tools 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/README.en.md +15 -11
- package/README.i18n.yaml +2 -2
- package/README.md +35 -31
- package/lib/client.js +276 -131
- package/lib/client.js.map +1 -1
- package/lib/index.js +16 -15
- package/lib/tsconfig.client.tsbuildinfo +1 -1
- package/lib/tsconfig.host.tsbuildinfo +1 -1
- package/lib/typert.host.js +3 -3
- package/lib/typert.remote-client.d.ts.map +1 -1
- package/lib/typert.remote-client.js +3 -3
- package/lib/types/client/RestoredMessageView.d.ts +1 -1
- package/lib/types/client/RestoredMessageView.d.ts.map +1 -1
- package/lib/types/client/RestoredMessageView.js +20 -1
- package/lib/types/client/UserMessageView.d.ts +1 -1
- package/lib/types/client/UserMessageView.d.ts.map +1 -1
- package/lib/types/client/UserMessageView.js +9 -6
- package/lib/types/client/WithdrawnDividerView.d.ts +1 -1
- package/lib/types/client/WithdrawnDividerView.d.ts.map +1 -1
- package/lib/types/client/WithdrawnDividerView.js +11 -7
- package/lib/types/client/chat-hook.d.ts +36 -0
- package/lib/types/client/chat-hook.d.ts.map +1 -0
- package/lib/types/client/chat-hook.js +51 -0
- package/lib/types/client/dom-hider.d.ts +3 -2
- package/lib/types/client/dom-hider.d.ts.map +1 -1
- package/lib/types/client/dom-hider.js +20 -13
- package/lib/types/client/edit-in-place.d.ts +2 -1
- package/lib/types/client/edit-in-place.d.ts.map +1 -1
- package/lib/types/client/index.d.ts +6 -4
- package/lib/types/client/index.d.ts.map +1 -1
- package/lib/types/client/index.js +42 -8
- package/lib/types/client/locales.d.ts +8 -0
- package/lib/types/client/locales.d.ts.map +1 -1
- package/lib/types/client/locales.js +8 -0
- package/lib/types/client/slots.d.ts.map +1 -1
- package/lib/types/client/withdrawn-node.d.ts +3 -2
- package/lib/types/client/withdrawn-node.d.ts.map +1 -1
- package/lib/types/client/withdrawn-node.js +43 -52
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/index.js +10 -8
- package/lib/types/withdraw.d.ts.map +1 -1
- package/lib/types/withdraw.js +10 -6
- package/package.json +19 -18
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
* Definition per event and offers no suppression seam; hiding happens in the
|
|
9
9
|
* renderers and the DOM hider.
|
|
10
10
|
*/
|
|
11
|
-
import type { ChatConversationViewNode
|
|
11
|
+
import type { ChatConversationViewNode } from '@deepseek-ai/dsh-client-ui-chat/client';
|
|
12
|
+
import type { ConversationNodeDefinition } from '@deepseek-ai/dsh-client-ui-conversation/client';
|
|
12
13
|
/** Chat node data of one withdrawal divider row. */
|
|
13
14
|
export interface WithdrawnDividerData {
|
|
14
15
|
/** Seq of the replacement event; the divider anchors here and the hidden span ends (exclusive). */
|
|
@@ -51,7 +52,7 @@ export interface RestoredAssistantMessageData {
|
|
|
51
52
|
/** The assistant reply text (model-facing frame stripped for display). */
|
|
52
53
|
readonly text: string;
|
|
53
54
|
}
|
|
54
|
-
declare module '@deepseek-ai/dsh-client-ui-
|
|
55
|
+
declare module '@deepseek-ai/dsh-client-ui-chat/client' {
|
|
55
56
|
interface ChatNodeDataMap {
|
|
56
57
|
/** message-tools withdrawal divider marking where a span was hidden. */
|
|
57
58
|
'message-tools-withdrawn': WithdrawnDividerData;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withdrawn-node.d.ts","sourceRoot":"","sources":["../../../src/client/withdrawn-node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"withdrawn-node.d.ts","sourceRoot":"","sources":["../../../src/client/withdrawn-node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAA;AACtF,OAAO,KAAK,EACe,0BAA0B,EACpD,MAAM,gDAAgD,CAAA;AA8BvD,oDAAoD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H,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,SAAS,wBAAwB,EAAE,EAC1C,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,SAAS,MAAM,EAAE,GACxB,OAAO,CAKT;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAO3E"}
|
|
@@ -1,4 +1,22 @@
|
|
|
1
1
|
import { isMessageToolsEdit, isMessageToolsReplacement, isMessageToolsRestore, isMessageToolsRestoreAssistant, stripRestoreAssistantFrame, } from '../marker.js';
|
|
2
|
+
/**
|
|
3
|
+
* Materialize one final chat-target node. The Definition contract's
|
|
4
|
+
* buildViewNode returns the ConversationViewNode base (key/kind/id/target/
|
|
5
|
+
* data), so the chat extras (anchorSeq/location/visibility) go through this
|
|
6
|
+
* explicitly typed builder instead of an excess-checked literal.
|
|
7
|
+
*/
|
|
8
|
+
function chatViewNode(context, kind, anchorSeq, data) {
|
|
9
|
+
return {
|
|
10
|
+
key: context.key,
|
|
11
|
+
kind,
|
|
12
|
+
id: context.id,
|
|
13
|
+
target: 'chat',
|
|
14
|
+
anchorSeq,
|
|
15
|
+
location: context.start?.location ?? { kind: 'unresolved' },
|
|
16
|
+
visibility: 'visible',
|
|
17
|
+
data,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
2
20
|
/**
|
|
3
21
|
* The withdrawal divider Definition: one single-event Context per
|
|
4
22
|
* message-tools replacement event, anchored at the replacement's seq so the
|
|
@@ -7,9 +25,12 @@ import { isMessageToolsEdit, isMessageToolsReplacement, isMessageToolsRestore, i
|
|
|
7
25
|
export const withdrawnDividerDefinition = {
|
|
8
26
|
kind: 'message-tools-withdrawn',
|
|
9
27
|
target: 'chat',
|
|
10
|
-
match: event =>
|
|
11
|
-
|
|
12
|
-
|
|
28
|
+
match: (event) => {
|
|
29
|
+
// Packed chunk rows share the bus; the guards speak SessionEvent only.
|
|
30
|
+
if (event.type !== 'user/message')
|
|
31
|
+
return null;
|
|
32
|
+
return isMessageToolsReplacement(event) ? { id: String(event.seq), role: 'start' } : null;
|
|
33
|
+
},
|
|
13
34
|
start: (_context, match) => {
|
|
14
35
|
const event = match.event;
|
|
15
36
|
if (!isMessageToolsReplacement(event)) {
|
|
@@ -20,16 +41,7 @@ export const withdrawnDividerDefinition = {
|
|
|
20
41
|
update: context => context.state,
|
|
21
42
|
buildViewNode: context => context.state === undefined
|
|
22
43
|
? null
|
|
23
|
-
:
|
|
24
|
-
key: context.key,
|
|
25
|
-
kind: 'message-tools-withdrawn',
|
|
26
|
-
id: context.id,
|
|
27
|
-
target: 'chat',
|
|
28
|
-
anchorSeq: context.state.seq,
|
|
29
|
-
location: context.start?.location ?? { kind: 'unresolved' },
|
|
30
|
-
visibility: 'visible',
|
|
31
|
-
data: context.state,
|
|
32
|
-
},
|
|
44
|
+
: chatViewNode(context, 'message-tools-withdrawn', context.state.seq, context.state),
|
|
33
45
|
};
|
|
34
46
|
/**
|
|
35
47
|
* The edited-bubble Definition: one single-event Context per message-tools
|
|
@@ -40,9 +52,11 @@ export const withdrawnDividerDefinition = {
|
|
|
40
52
|
export const editedMessageDefinition = {
|
|
41
53
|
kind: 'message-tools-edited',
|
|
42
54
|
target: 'chat',
|
|
43
|
-
match: event =>
|
|
44
|
-
|
|
45
|
-
|
|
55
|
+
match: (event) => {
|
|
56
|
+
if (event.type !== 'user/message')
|
|
57
|
+
return null;
|
|
58
|
+
return isMessageToolsEdit(event) ? { id: String(event.seq), role: 'start' } : null;
|
|
59
|
+
},
|
|
46
60
|
start: (_context, match) => {
|
|
47
61
|
const event = match.event;
|
|
48
62
|
if (!isMessageToolsEdit(event)) {
|
|
@@ -58,16 +72,7 @@ export const editedMessageDefinition = {
|
|
|
58
72
|
update: context => context.state,
|
|
59
73
|
buildViewNode: context => context.state === undefined
|
|
60
74
|
? null
|
|
61
|
-
:
|
|
62
|
-
key: context.key,
|
|
63
|
-
kind: 'message-tools-edited',
|
|
64
|
-
id: context.id,
|
|
65
|
-
target: 'chat',
|
|
66
|
-
anchorSeq: context.state.seq,
|
|
67
|
-
location: context.start?.location ?? { kind: 'unresolved' },
|
|
68
|
-
visibility: 'visible',
|
|
69
|
-
data: context.state,
|
|
70
|
-
},
|
|
75
|
+
: chatViewNode(context, 'message-tools-edited', context.state.seq, context.state),
|
|
71
76
|
};
|
|
72
77
|
/**
|
|
73
78
|
* Fold the hidden seq spans out of the live chat nodes, flattened to
|
|
@@ -122,9 +127,11 @@ function joinAssistantText(blocks) {
|
|
|
122
127
|
export const restoredMessageDefinition = {
|
|
123
128
|
kind: 'message-tools-restored',
|
|
124
129
|
target: 'chat',
|
|
125
|
-
match: event =>
|
|
126
|
-
|
|
127
|
-
|
|
130
|
+
match: (event) => {
|
|
131
|
+
if (event.type !== 'user/message')
|
|
132
|
+
return null;
|
|
133
|
+
return isMessageToolsRestore(event) ? { id: String(event.seq), role: 'start' } : null;
|
|
134
|
+
},
|
|
128
135
|
start: (_context, match) => {
|
|
129
136
|
const event = match.event;
|
|
130
137
|
if (!isMessageToolsRestore(event)) {
|
|
@@ -141,16 +148,7 @@ export const restoredMessageDefinition = {
|
|
|
141
148
|
update: context => context.state,
|
|
142
149
|
buildViewNode: context => context.state === undefined
|
|
143
150
|
? null
|
|
144
|
-
:
|
|
145
|
-
key: context.key,
|
|
146
|
-
kind: 'message-tools-restored',
|
|
147
|
-
id: context.id,
|
|
148
|
-
target: 'chat',
|
|
149
|
-
anchorSeq: context.state.seq,
|
|
150
|
-
location: context.start?.location ?? { kind: 'unresolved' },
|
|
151
|
-
visibility: 'visible',
|
|
152
|
-
data: context.state,
|
|
153
|
-
},
|
|
151
|
+
: chatViewNode(context, 'message-tools-restored', context.state.seq, context.state),
|
|
154
152
|
};
|
|
155
153
|
/**
|
|
156
154
|
* The restore-assistant-line Definition: one single-event Context per
|
|
@@ -162,9 +160,11 @@ export const restoredMessageDefinition = {
|
|
|
162
160
|
export const restoredAssistantMessageDefinition = {
|
|
163
161
|
kind: 'message-tools-restored-assistant',
|
|
164
162
|
target: 'chat',
|
|
165
|
-
match: event =>
|
|
166
|
-
|
|
167
|
-
|
|
163
|
+
match: (event) => {
|
|
164
|
+
if (event.type !== 'user/message')
|
|
165
|
+
return null;
|
|
166
|
+
return isMessageToolsRestoreAssistant(event) ? { id: String(event.seq), role: 'start' } : null;
|
|
167
|
+
},
|
|
168
168
|
start: (_context, match) => {
|
|
169
169
|
const event = match.event;
|
|
170
170
|
if (!isMessageToolsRestoreAssistant(event)) {
|
|
@@ -180,16 +180,7 @@ export const restoredAssistantMessageDefinition = {
|
|
|
180
180
|
update: context => context.state,
|
|
181
181
|
buildViewNode: context => context.state === undefined
|
|
182
182
|
? null
|
|
183
|
-
:
|
|
184
|
-
key: context.key,
|
|
185
|
-
kind: 'message-tools-restored-assistant',
|
|
186
|
-
id: context.id,
|
|
187
|
-
target: 'chat',
|
|
188
|
-
anchorSeq: context.state.seq,
|
|
189
|
-
location: context.start?.location ?? { kind: 'unresolved' },
|
|
190
|
-
visibility: 'visible',
|
|
191
|
-
data: context.state,
|
|
192
|
-
},
|
|
183
|
+
: chatViewNode(context, 'message-tools-restored-assistant', context.state.seq, context.state),
|
|
193
184
|
};
|
|
194
185
|
/**
|
|
195
186
|
* Count the user-visible messages hidden by one withdrawn span. This mirrors
|
package/lib/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAQlD,OAAO,EAAU,mBAAmB,EAAE,MAAM,kCAAkC,CAAA;AAM9E,OAAO,KAAK,EACV,uBAAuB,EAAE,sBAAsB,EAC/C,0BAA0B,EAAE,yBAAyB,EACrD,2BAA2B,EAAE,0BAA0B,EACxD,MAAM,YAAY,CAAA;AAEnB,mBAAmB,YAAY,CAAA;AAE/B,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,OAAO;QACf,2DAA2D;QAC3D,YAAY,EAAE,mBAAmB,CAAA;KAClC;CACF;AAED;;;;;GAKG;AACH,qBAAa,mBAAoB,SAAQ,mBAAmB;IAC1D,MAAM,CAAC,MAAM,WAAyB;IAEtC;;OAEG;IACH,YAAY,GAAG,EAAE,OAAO,EAEvB;IAED;;;;;OAKG;IAEG,QAAQ,CAAC,OAAO,EAAE,2BAA2B,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAiBxF;IAED;;;;;;;;;;;;;OAaG;IAEG,OAAO,CAAC,OAAO,EAAE,0BAA0B,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAwBrF;IAED;;;;;;;;;;OAUG;IAEG,IAAI,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAqB5E;CACF;eAEc,mBAAmB"}
|
package/lib/types/index.js
CHANGED
|
@@ -32,6 +32,8 @@ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn,
|
|
|
32
32
|
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
33
33
|
done = true;
|
|
34
34
|
};
|
|
35
|
+
// Value: the branded seq constructor the surface markers require.
|
|
36
|
+
import { SessionSeq } from '@deepseek-ai/dsh-session';
|
|
35
37
|
import { createUserMessage } from '@deepseek-ai/dsh-llm';
|
|
36
38
|
import { Remote, TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
|
|
37
39
|
import { EDIT_TRIGGER_NOTICE, MESSAGE_TOOLS_PLUGIN, WITHDRAWN_NOTICE, editReplacementSource, editTriggerSource, restoreAssistantSource, } from './marker.js';
|
|
@@ -77,15 +79,15 @@ let MessageToolsService = (() => {
|
|
|
77
79
|
const session = this.ctx.sessions.get(request.sessionId);
|
|
78
80
|
if (session === undefined)
|
|
79
81
|
return { ok: false, error: { code: 'session-not-found' } };
|
|
80
|
-
const planned = planWithdrawal(session.
|
|
82
|
+
const planned = planWithdrawal(session.snapshotEvents(), session.surface.nodes, request.targetSeq);
|
|
81
83
|
if (!planned.ok)
|
|
82
84
|
return { ok: false, error: { code: planned.code } };
|
|
83
85
|
const replacement = session.append('user/message', createUserMessage({
|
|
84
86
|
content: [{ type: 'text', text: WITHDRAWN_NOTICE }],
|
|
85
87
|
source: { kind: 'plugin', plugin: MESSAGE_TOOLS_PLUGIN },
|
|
86
88
|
}), {
|
|
87
|
-
surfaceOp: { op: 'replace', start: planned.plan.start, end: planned.plan.end },
|
|
88
|
-
sourceEventSeqs:
|
|
89
|
+
surfaceOp: { op: 'replace', start: SessionSeq(planned.plan.start), end: SessionSeq(planned.plan.end) },
|
|
90
|
+
sourceEventSeqs: planned.plan.sourceEventSeqs.map(seq => SessionSeq(seq)),
|
|
89
91
|
});
|
|
90
92
|
await this.ctx.sessions.flush(session);
|
|
91
93
|
return {
|
|
@@ -111,7 +113,7 @@ let MessageToolsService = (() => {
|
|
|
111
113
|
const session = this.ctx.sessions.get(request.sessionId);
|
|
112
114
|
if (session === undefined)
|
|
113
115
|
return { ok: false, error: { code: 'session-not-found' } };
|
|
114
|
-
const planned = planRestore(session.
|
|
116
|
+
const planned = planRestore(session.snapshotEvents(), session.surface.nodes, request.targetSeq);
|
|
115
117
|
if (!planned.ok)
|
|
116
118
|
return { ok: false, error: { code: planned.code } };
|
|
117
119
|
const appendedSeqs = [];
|
|
@@ -127,7 +129,7 @@ let MessageToolsService = (() => {
|
|
|
127
129
|
});
|
|
128
130
|
appendedSeqs.push(session.append('user/message', message, {
|
|
129
131
|
surfaceOp: 'append',
|
|
130
|
-
sourceEventSeqs: [entry.sourceSeq],
|
|
132
|
+
sourceEventSeqs: [SessionSeq(entry.sourceSeq)],
|
|
131
133
|
}).seq);
|
|
132
134
|
}
|
|
133
135
|
await this.ctx.sessions.flush(session);
|
|
@@ -149,15 +151,15 @@ let MessageToolsService = (() => {
|
|
|
149
151
|
const session = this.ctx.sessions.get(request.sessionId);
|
|
150
152
|
if (session === undefined)
|
|
151
153
|
return { ok: false, error: { code: 'session-not-found' } };
|
|
152
|
-
const planned = planEdit(session.
|
|
154
|
+
const planned = planEdit(session.snapshotEvents(), session.surface.nodes, request.targetSeq, request.text);
|
|
153
155
|
if (!planned.ok)
|
|
154
156
|
return { ok: false, error: { code: planned.code } };
|
|
155
157
|
const replacement = session.append('user/message', createUserMessage({
|
|
156
158
|
content: [{ type: 'text', text: request.text }],
|
|
157
159
|
source: editReplacementSource(),
|
|
158
160
|
}), {
|
|
159
|
-
surfaceOp: { op: 'replace', start: planned.plan.start, end: planned.plan.end },
|
|
160
|
-
sourceEventSeqs:
|
|
161
|
+
surfaceOp: { op: 'replace', start: SessionSeq(planned.plan.start), end: SessionSeq(planned.plan.end) },
|
|
162
|
+
sourceEventSeqs: planned.plan.sourceEventSeqs.map(seq => SessionSeq(seq)),
|
|
161
163
|
});
|
|
162
164
|
await this.ctx.sessions.flush(session);
|
|
163
165
|
const agent = this.ctx.agents.get(request.sessionId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withdraw.d.ts","sourceRoot":"","sources":["../../src/withdraw.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAA;AAoClE,0CAA0C;AAC1C,MAAM,MAAM,qBAAqB,GAC7B,kBAAkB,GAClB,oBAAoB,GACpB,mBAAmB,CAAA;AACvB,2DAA2D;AAC3D,MAAM,WAAW,cAAc;IAC7B,kEAAkE;IAClE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,4EAA4E;IAC5E,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,oGAAoG;IACpG,QAAQ,CAAC,eAAe,EAAE,SAAS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AAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,oDAAoD;IACpD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAC3B,CAAA;AAEH,8DAA8D;AAC9D,MAAM,WAAW,WAAW;IAC1B;;;;;;OAMG;IACH,QAAQ,CAAC,OAAO,EAAE,SAAS,kBAAkB,EAAE,CAAA;CAChD;AAED,oEAAoE;AACpE,MAAM,MAAM,iBAAiB,GACzB;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAA;CAAE,GACjD;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAA;CAAE,CAAA;AAwL7D;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,SAAS,YAAY,EAAE,EAC/B,YAAY,EAAE,SAAS,MAAM,EAAE,EAC/B,SAAS,EAAE,MAAM,GAChB,iBAAiB,CAUnB"}
|
package/lib/types/withdraw.js
CHANGED
|
@@ -120,12 +120,16 @@ function joinAssistantMessageText(blocks) {
|
|
|
120
120
|
function findWithdrawnSpan(events, targetSeq) {
|
|
121
121
|
for (let index = events.length - 1; index > targetSeq; index--) {
|
|
122
122
|
const event = events[index];
|
|
123
|
-
if (event
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
123
|
+
if (event === undefined || !isMessageToolsReplacement(event))
|
|
124
|
+
continue;
|
|
125
|
+
// The brands are compile-time only; the fold addresses the log by plain number.
|
|
126
|
+
const sources = event.sourceEventSeqs;
|
|
127
|
+
if (sources?.includes(targetSeq) !== true)
|
|
128
|
+
continue;
|
|
129
|
+
const span = [];
|
|
130
|
+
for (let seq = event.surfaceOp.start; seq < event.seq; seq++)
|
|
131
|
+
span.push(seq);
|
|
132
|
+
return span;
|
|
129
133
|
}
|
|
130
134
|
return undefined;
|
|
131
135
|
}
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"cordis",
|
|
8
8
|
"messages"
|
|
9
9
|
],
|
|
10
|
-
"version": "0.
|
|
10
|
+
"version": "0.2.0",
|
|
11
11
|
"type": "module",
|
|
12
12
|
"main": "lib/index.js",
|
|
13
13
|
"types": "lib/types/index.d.ts",
|
|
@@ -45,7 +45,6 @@
|
|
|
45
45
|
},
|
|
46
46
|
"client": {
|
|
47
47
|
"inject": [
|
|
48
|
-
"@deepseek-ai/dsh-client-runtime",
|
|
49
48
|
"@deepseek-ai/dsh-api-remotes",
|
|
50
49
|
"@deepseek-ai/dsh-client-locale",
|
|
51
50
|
"@deepseek-ai/dsh-client-ui-conversation",
|
|
@@ -54,8 +53,8 @@
|
|
|
54
53
|
"platform": "web"
|
|
55
54
|
},
|
|
56
55
|
"compat": {
|
|
57
|
-
"minHost": "0.1.
|
|
58
|
-
"verifiedHost": "0.1.
|
|
56
|
+
"minHost": "0.1.2-rc.1",
|
|
57
|
+
"verifiedHost": "0.1.2-rc.1"
|
|
59
58
|
}
|
|
60
59
|
},
|
|
61
60
|
"license": "MIT",
|
|
@@ -63,7 +62,6 @@
|
|
|
63
62
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
64
63
|
"@deepseek-ai/dsh-api-remotes": "^0.1.0-rc.6",
|
|
65
64
|
"@deepseek-ai/dsh-client-locale": "^0.1.0-rc.6",
|
|
66
|
-
"@deepseek-ai/dsh-client-runtime": "^0.1.0-rc.6",
|
|
67
65
|
"@deepseek-ai/dsh-client-ui-conversation": "^0.1.0-rc.6",
|
|
68
66
|
"@deepseek-ai/dsh-client-ui-model-selection": "^0.1.0-rc.6",
|
|
69
67
|
"@deepseek-ai/dsh-client-ui-primitives": "^0.1.0-rc.6",
|
|
@@ -76,19 +74,22 @@
|
|
|
76
74
|
},
|
|
77
75
|
"devDependencies": {
|
|
78
76
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
79
|
-
"@deepseek-ai/dsh-agent": "^0.1.
|
|
80
|
-
"@deepseek-ai/dsh-api-remotes": "^0.1.
|
|
81
|
-
"@deepseek-ai/dsh-
|
|
82
|
-
"@deepseek-ai/dsh-client-
|
|
83
|
-
"@deepseek-ai/dsh-client-
|
|
84
|
-
"@deepseek-ai/dsh-client-
|
|
85
|
-
"@deepseek-ai/dsh-client-ui-
|
|
86
|
-
"@deepseek-ai/dsh-client-ui-
|
|
87
|
-
"@deepseek-ai/dsh-client-ui-
|
|
88
|
-
"@deepseek-ai/dsh-
|
|
89
|
-
"@deepseek-ai/dsh-
|
|
90
|
-
"@deepseek-ai/dsh-
|
|
91
|
-
"@deepseek-ai/dsh-
|
|
77
|
+
"@deepseek-ai/dsh-agent": "^0.1.2-rc.1",
|
|
78
|
+
"@deepseek-ai/dsh-api-remotes": "^0.1.2-rc.1",
|
|
79
|
+
"@deepseek-ai/dsh-api-session-controller": "^0.1.2-rc.1",
|
|
80
|
+
"@deepseek-ai/dsh-client-locale": "^0.1.2-rc.1",
|
|
81
|
+
"@deepseek-ai/dsh-client-store": "^0.1.2-rc.1",
|
|
82
|
+
"@deepseek-ai/dsh-client-test-runtime": "^0.1.2-rc.1",
|
|
83
|
+
"@deepseek-ai/dsh-client-ui-chat": "^0.1.2-rc.1",
|
|
84
|
+
"@deepseek-ai/dsh-client-ui-conversation": "^0.1.2-rc.1",
|
|
85
|
+
"@deepseek-ai/dsh-client-ui-model-selection": "^0.1.2-rc.1",
|
|
86
|
+
"@deepseek-ai/dsh-client-ui-primitives": "^0.1.2-rc.1",
|
|
87
|
+
"@deepseek-ai/dsh-client-ui-renderer": "^0.1.2-rc.1",
|
|
88
|
+
"@deepseek-ai/dsh-client-ui-slots": "^0.1.2-rc.1",
|
|
89
|
+
"@deepseek-ai/dsh-invariants": "^0.1.2-rc.1",
|
|
90
|
+
"@deepseek-ai/dsh-llm": "^0.1.2-rc.1",
|
|
91
|
+
"@deepseek-ai/dsh-session": "^0.1.2-rc.1",
|
|
92
|
+
"@deepseek-ai/dsh-typert-protocol": "^0.1.2-rc.1",
|
|
92
93
|
"@testing-library/react": "^16.1.0",
|
|
93
94
|
"@types/node": "^26.2.0",
|
|
94
95
|
"@types/react": "~18.3.1",
|