@khorsheed/dsh-client-message-tools 0.2.0 → 0.3.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/CHANGELOG.md +21 -0
- package/README.en.md +10 -10
- package/README.i18n.yaml +2 -2
- package/README.md +9 -9
- package/lib/client.js +285 -112
- package/lib/index.js +238 -102
- package/lib/typert.host.js +40 -28
- package/lib/typert.remote-client.js +33 -21
- package/lib/types/client/ModelChip.js +4 -4
- package/lib/types/client/RestoredMessageView.js +2 -2
- package/lib/types/client/UserMessageView.js +11 -7
- package/lib/types/client/WithdrawnDividerView.d.ts +3 -2
- package/lib/types/client/WithdrawnDividerView.js +11 -5
- package/lib/types/client/chat-hook.js +1 -0
- package/lib/types/client/dom-hider.js +11 -4
- package/lib/types/client/icons-local.d.ts +23 -0
- package/lib/types/client/icons-local.js +11 -0
- package/lib/types/client/icons.d.ts +18 -19
- package/lib/types/client/icons.js +5 -10
- package/lib/types/client/index.js +6 -1
- package/lib/types/client/withdrawn-node.d.ts +17 -10
- package/lib/types/client/withdrawn-node.js +40 -22
- package/lib/types/index.d.ts +11 -11
- package/lib/types/index.js +21 -16
- package/lib/types/marker.d.ts +47 -15
- package/lib/types/marker.js +57 -30
- package/lib/types/restore-projection.d.ts +55 -0
- package/lib/types/restore-projection.js +123 -0
- package/lib/types/withdraw.js +67 -75
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +9 -28
- package/lib/client.js.map +0 -1
- package/lib/tsconfig.client.tsbuildinfo +0 -1
- package/lib/tsconfig.host.tsbuildinfo +0 -1
- package/lib/typert.remote-client.d.ts.map +0 -1
- package/lib/types/client/ModelChip.d.ts.map +0 -1
- package/lib/types/client/RestoredMessageView.d.ts.map +0 -1
- package/lib/types/client/UserMessageView.d.ts.map +0 -1
- package/lib/types/client/WithdrawnDividerView.d.ts.map +0 -1
- package/lib/types/client/backfill.d.ts.map +0 -1
- package/lib/types/client/chat-hook.d.ts.map +0 -1
- package/lib/types/client/dom-hider.d.ts.map +0 -1
- package/lib/types/client/edit-in-place.d.ts.map +0 -1
- package/lib/types/client/icons.d.ts.map +0 -1
- package/lib/types/client/index.d.ts.map +0 -1
- package/lib/types/client/locales.d.ts.map +0 -1
- package/lib/types/client/slots.d.ts.map +0 -1
- package/lib/types/client/withdraw-backfill.d.ts.map +0 -1
- package/lib/types/client/withdrawn-node.d.ts.map +0 -1
- package/lib/types/index.d.ts.map +0 -1
- package/lib/types/invariant.d.ts.map +0 -1
- package/lib/types/marker.d.ts.map +0 -1
- package/lib/types/types.d.ts.map +0 -1
- package/lib/types/withdraw.d.ts.map +0 -1
package/lib/client.js
CHANGED
|
@@ -4059,12 +4059,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4059
4059
|
}
|
|
4060
4060
|
//#endregion
|
|
4061
4061
|
//#region lib/typert.remote-client.js
|
|
4062
|
-
|
|
4062
|
+
let _khorsheed_dsh_client_message_tools_messageTools_edit_parameter_0$schema$value;
|
|
4063
|
+
const _khorsheed_dsh_client_message_tools_messageTools_edit_parameter_0$schema = () => _khorsheed_dsh_client_message_tools_messageTools_edit_parameter_0$schema$value ??= object({
|
|
4063
4064
|
"sessionId": intersection(string(), unknown()).readonly(),
|
|
4064
4065
|
"targetSeq": number().readonly(),
|
|
4065
4066
|
"text": string().readonly()
|
|
4066
4067
|
});
|
|
4067
|
-
|
|
4068
|
+
let _khorsheed_dsh_client_message_tools_messageTools_edit_result$schema$value;
|
|
4069
|
+
const _khorsheed_dsh_client_message_tools_messageTools_edit_result$schema = () => _khorsheed_dsh_client_message_tools_messageTools_edit_result$schema$value ??= union([object({
|
|
4068
4070
|
"ok": literal(true).readonly(),
|
|
4069
4071
|
"value": object({
|
|
4070
4072
|
"replacementSeq": number().readonly(),
|
|
@@ -4080,11 +4082,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4080
4082
|
object({ "code": literal("empty-text").readonly() })
|
|
4081
4083
|
]).readonly()
|
|
4082
4084
|
})]);
|
|
4083
|
-
|
|
4085
|
+
let _khorsheed_dsh_client_message_tools_messageTools_restore_parameter_0$schema$value;
|
|
4086
|
+
const _khorsheed_dsh_client_message_tools_messageTools_restore_parameter_0$schema = () => _khorsheed_dsh_client_message_tools_messageTools_restore_parameter_0$schema$value ??= object({
|
|
4084
4087
|
"sessionId": intersection(string(), unknown()).readonly(),
|
|
4085
4088
|
"targetSeq": number().readonly()
|
|
4086
4089
|
});
|
|
4087
|
-
|
|
4090
|
+
let _khorsheed_dsh_client_message_tools_messageTools_restore_result$schema$value;
|
|
4091
|
+
const _khorsheed_dsh_client_message_tools_messageTools_restore_result$schema = () => _khorsheed_dsh_client_message_tools_messageTools_restore_result$schema$value ??= union([object({
|
|
4088
4092
|
"ok": literal(true).readonly(),
|
|
4089
4093
|
"value": object({ "restoredSeq": number().readonly() }).readonly()
|
|
4090
4094
|
}), object({
|
|
@@ -4096,11 +4100,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4096
4100
|
object({ "code": literal("not-withdrawn").readonly() })
|
|
4097
4101
|
]).readonly()
|
|
4098
4102
|
})]);
|
|
4099
|
-
|
|
4103
|
+
let _khorsheed_dsh_client_message_tools_messageTools_withdraw_parameter_0$schema$value;
|
|
4104
|
+
const _khorsheed_dsh_client_message_tools_messageTools_withdraw_parameter_0$schema = () => _khorsheed_dsh_client_message_tools_messageTools_withdraw_parameter_0$schema$value ??= object({
|
|
4100
4105
|
"sessionId": intersection(string(), unknown()).readonly(),
|
|
4101
4106
|
"targetSeq": number().readonly()
|
|
4102
4107
|
});
|
|
4103
|
-
|
|
4108
|
+
let _khorsheed_dsh_client_message_tools_messageTools_withdraw_result$schema$value;
|
|
4109
|
+
const _khorsheed_dsh_client_message_tools_messageTools_withdraw_result$schema = () => _khorsheed_dsh_client_message_tools_messageTools_withdraw_result$schema$value ??= union([object({
|
|
4104
4110
|
"ok": literal(true).readonly(),
|
|
4105
4111
|
"value": object({
|
|
4106
4112
|
"replacementSeq": number().readonly(),
|
|
@@ -4131,17 +4137,19 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4131
4137
|
codec: {
|
|
4132
4138
|
mode: "strict",
|
|
4133
4139
|
typeSymbol: "@khorsheed/dsh-client-message-tools/types#MessageToolsEditRequest",
|
|
4134
|
-
|
|
4140
|
+
create: _khorsheed_dsh_client_message_tools_messageTools_edit_parameter_0$schema,
|
|
4141
|
+
schema: _khorsheed_dsh_client_message_tools_messageTools_edit_parameter_0$schema()
|
|
4135
4142
|
}
|
|
4136
4143
|
}],
|
|
4137
4144
|
result: {
|
|
4138
4145
|
mode: "strict",
|
|
4139
4146
|
typeSymbol: "@khorsheed/dsh-client-message-tools/types#MessageToolsEditResult",
|
|
4140
|
-
|
|
4147
|
+
create: _khorsheed_dsh_client_message_tools_messageTools_edit_result$schema,
|
|
4148
|
+
schema: _khorsheed_dsh_client_message_tools_messageTools_edit_result$schema()
|
|
4141
4149
|
},
|
|
4142
4150
|
sourceLocation: {
|
|
4143
4151
|
"file": "packages/message-tools/src/index.ts",
|
|
4144
|
-
"line":
|
|
4152
|
+
"line": 140,
|
|
4145
4153
|
"column": 9
|
|
4146
4154
|
}
|
|
4147
4155
|
},
|
|
@@ -4158,17 +4166,19 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4158
4166
|
codec: {
|
|
4159
4167
|
mode: "strict",
|
|
4160
4168
|
typeSymbol: "@khorsheed/dsh-client-message-tools/types#MessageToolsRestoreRequest",
|
|
4161
|
-
|
|
4169
|
+
create: _khorsheed_dsh_client_message_tools_messageTools_restore_parameter_0$schema,
|
|
4170
|
+
schema: _khorsheed_dsh_client_message_tools_messageTools_restore_parameter_0$schema()
|
|
4162
4171
|
}
|
|
4163
4172
|
}],
|
|
4164
4173
|
result: {
|
|
4165
4174
|
mode: "strict",
|
|
4166
4175
|
typeSymbol: "@khorsheed/dsh-client-message-tools/types#MessageToolsRestoreResult",
|
|
4167
|
-
|
|
4176
|
+
create: _khorsheed_dsh_client_message_tools_messageTools_restore_result$schema,
|
|
4177
|
+
schema: _khorsheed_dsh_client_message_tools_messageTools_restore_result$schema()
|
|
4168
4178
|
},
|
|
4169
4179
|
sourceLocation: {
|
|
4170
4180
|
"file": "packages/message-tools/src/index.ts",
|
|
4171
|
-
"line":
|
|
4181
|
+
"line": 102,
|
|
4172
4182
|
"column": 9
|
|
4173
4183
|
}
|
|
4174
4184
|
},
|
|
@@ -4185,17 +4195,19 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4185
4195
|
codec: {
|
|
4186
4196
|
mode: "strict",
|
|
4187
4197
|
typeSymbol: "@khorsheed/dsh-client-message-tools/types#MessageToolsWithdrawRequest",
|
|
4188
|
-
|
|
4198
|
+
create: _khorsheed_dsh_client_message_tools_messageTools_withdraw_parameter_0$schema,
|
|
4199
|
+
schema: _khorsheed_dsh_client_message_tools_messageTools_withdraw_parameter_0$schema()
|
|
4189
4200
|
}
|
|
4190
4201
|
}],
|
|
4191
4202
|
result: {
|
|
4192
4203
|
mode: "strict",
|
|
4193
4204
|
typeSymbol: "@khorsheed/dsh-client-message-tools/types#MessageToolsWithdrawResult",
|
|
4194
|
-
|
|
4205
|
+
create: _khorsheed_dsh_client_message_tools_messageTools_withdraw_result$schema,
|
|
4206
|
+
schema: _khorsheed_dsh_client_message_tools_messageTools_withdraw_result$schema()
|
|
4195
4207
|
},
|
|
4196
4208
|
sourceLocation: {
|
|
4197
4209
|
"file": "packages/message-tools/src/index.ts",
|
|
4198
|
-
"line":
|
|
4210
|
+
"line": 68,
|
|
4199
4211
|
"column": 9
|
|
4200
4212
|
}
|
|
4201
4213
|
}
|
|
@@ -4217,6 +4229,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4217
4229
|
getSnapshot: () => void 0,
|
|
4218
4230
|
subscribe: () => () => {}
|
|
4219
4231
|
}),
|
|
4232
|
+
turnDataSource: () => ({
|
|
4233
|
+
getSnapshot: () => [],
|
|
4234
|
+
subscribe: () => () => {}
|
|
4235
|
+
}),
|
|
4220
4236
|
processSource: () => ({
|
|
4221
4237
|
getSnapshot: () => void 0,
|
|
4222
4238
|
subscribe: () => () => {}
|
|
@@ -4270,9 +4286,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4270
4286
|
}
|
|
4271
4287
|
}
|
|
4272
4288
|
//#endregion
|
|
4273
|
-
//#region ../../node_modules/.pnpm/@deepseek-ai+dsh-session@0.1.
|
|
4289
|
+
//#region ../../node_modules/.pnpm/@deepseek-ai+dsh-session@0.1.7-rc.1_@deepseek-ai+cordis@4.0.4_@deepseek-ai+dsh-scope@0._d0632e5334fc6fa9e0d505304507fe7f/node_modules/@deepseek-ai/dsh-session/lib/types/surface.js
|
|
4274
4290
|
/** Runtime counterpart of the message-producing event union. */
|
|
4275
4291
|
const SURFACE_EVENT_TYPES = /* @__PURE__ */ new Set([
|
|
4292
|
+
"system/message",
|
|
4293
|
+
"developer/message",
|
|
4276
4294
|
"user/message",
|
|
4277
4295
|
"assistant/message",
|
|
4278
4296
|
"tool/result"
|
|
@@ -4298,17 +4316,34 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4298
4316
|
}
|
|
4299
4317
|
/**
|
|
4300
4318
|
* Model-facing frame preceding a replayed assistant text in a restore: the
|
|
4301
|
-
* replay lands as a user-role message (assistant/message
|
|
4302
|
-
*
|
|
4303
|
-
* appends), so the frame keeps the role honest for the model.
|
|
4319
|
+
* replay lands as a user-role message (assistant/message requires the model
|
|
4320
|
+
* source, and the session turn/step trace forbids ad-hoc assistant
|
|
4321
|
+
* appends), so the frame keeps the role honest for the model. On hosts whose
|
|
4322
|
+
* session fold carries the S12 `user/message` projection the frame never
|
|
4323
|
+
* reaches the model — the projection strips it and corrects the role at
|
|
4324
|
+
* derivation time; everywhere else it is the role-honesty device.
|
|
4304
4325
|
*/
|
|
4305
4326
|
const RESTORED_ASSISTANT_NOTICE = "(以下是先前被撤回、现随恢复放回的助手回复)";
|
|
4306
|
-
/** Read the op discriminator off a message source (absent on
|
|
4327
|
+
/** Read the op discriminator off a message source (absent on plain withdrawal/restore events). */
|
|
4307
4328
|
function messageToolsOp(source) {
|
|
4308
4329
|
const op = source?.op;
|
|
4309
4330
|
return op === "edit" || op === "edit-trigger" || op === "restore-assistant" ? op : void 0;
|
|
4310
4331
|
}
|
|
4311
4332
|
/**
|
|
4333
|
+
* Whether a durable source belongs to message-tools, in every form the log
|
|
4334
|
+
* can hold: the current producer-owned kind (`message-tools`), the V3→V4
|
|
4335
|
+
* migrated kind (`plugin:message-tools` — released V3 files rewritten once by
|
|
4336
|
+
* the official migration), and the released V3 wrapper a pre-V4 host still
|
|
4337
|
+
* serves verbatim (`{ kind: 'plugin', plugin: 'message-tools' }`).
|
|
4338
|
+
* @param source - the persisted message source to test.
|
|
4339
|
+
* @returns true when the source names this producer.
|
|
4340
|
+
*/
|
|
4341
|
+
function isMessageToolsSource(source) {
|
|
4342
|
+
if (typeof source !== "object" || source === null) return false;
|
|
4343
|
+
const record = source;
|
|
4344
|
+
return record.kind === "message-tools" || record.kind === `plugin:message-tools` || record.kind === "plugin" && record.plugin === "message-tools";
|
|
4345
|
+
}
|
|
4346
|
+
/**
|
|
4312
4347
|
* Strip the model-facing restore frame from a replayed assistant text for
|
|
4313
4348
|
* DISPLAY: the frame belongs to the model context (role honesty), never to
|
|
4314
4349
|
* the transcript row. Texts without the frame pass through unchanged.
|
|
@@ -4321,13 +4356,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4321
4356
|
}
|
|
4322
4357
|
/**
|
|
4323
4358
|
* Whether the event is a message-tools WITHDRAWAL replacement: a
|
|
4324
|
-
* `user/message` surface replacement whose source
|
|
4325
|
-
*
|
|
4359
|
+
* `user/message` surface replacement whose source names this producer
|
|
4360
|
+
* (any durable form — see {@link isMessageToolsSource}) with no `op`
|
|
4361
|
+
* discriminator.
|
|
4326
4362
|
* @param event - the session event to test.
|
|
4327
4363
|
* @returns the event narrowed to a withdrawal replacement when matched.
|
|
4328
4364
|
*/
|
|
4329
4365
|
function isMessageToolsReplacement(event) {
|
|
4330
|
-
return event.type === "user/message" && isReplacementSurfaceEvent(event) && event.data.source
|
|
4366
|
+
return event.type === "user/message" && isReplacementSurfaceEvent(event) && isMessageToolsSource(event.data.source) && messageToolsOp(event.data.source) === void 0;
|
|
4331
4367
|
}
|
|
4332
4368
|
/**
|
|
4333
4369
|
* Whether the event is a message-tools EDIT replacement: a `user/message`
|
|
@@ -4336,7 +4372,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4336
4372
|
* @returns the event narrowed to an edit replacement when matched.
|
|
4337
4373
|
*/
|
|
4338
4374
|
function isMessageToolsEdit(event) {
|
|
4339
|
-
return event.type === "user/message" && isReplacementSurfaceEvent(event) && event.data.source
|
|
4375
|
+
return event.type === "user/message" && isReplacementSurfaceEvent(event) && isMessageToolsSource(event.data.source) && messageToolsOp(event.data.source) === "edit";
|
|
4340
4376
|
}
|
|
4341
4377
|
/**
|
|
4342
4378
|
* Whether the event is a message-tools restore: an append-surface
|
|
@@ -4345,7 +4381,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4345
4381
|
* @returns the event narrowed to a message-tools restore when matched.
|
|
4346
4382
|
*/
|
|
4347
4383
|
function isMessageToolsRestore(event) {
|
|
4348
|
-
return event.type === "user/message" && event.surfaceOp === "append" && event.data.source
|
|
4384
|
+
return event.type === "user/message" && event.surfaceOp === "append" && isMessageToolsSource(event.data.source) && messageToolsOp(event.data.source) === void 0;
|
|
4349
4385
|
}
|
|
4350
4386
|
/**
|
|
4351
4387
|
* Whether the event is a message-tools ASSISTANT-text restore replay: an
|
|
@@ -4355,7 +4391,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4355
4391
|
* @returns the event narrowed to a restore-assistant replay when matched.
|
|
4356
4392
|
*/
|
|
4357
4393
|
function isMessageToolsRestoreAssistant(event) {
|
|
4358
|
-
return event.type === "user/message" && event.surfaceOp === "append" && event.data.source
|
|
4394
|
+
return event.type === "user/message" && event.surfaceOp === "append" && isMessageToolsSource(event.data.source) && messageToolsOp(event.data.source) === "restore-assistant";
|
|
4359
4395
|
}
|
|
4360
4396
|
//#endregion
|
|
4361
4397
|
//#region src/client/withdrawn-node.ts
|
|
@@ -4394,10 +4430,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4394
4430
|
},
|
|
4395
4431
|
start: (_context, match) => {
|
|
4396
4432
|
const event = match.event;
|
|
4397
|
-
if (!isMessageToolsReplacement(event)) throw new Error("message-tools-withdrawn start requires a message-tools replacement event");
|
|
4433
|
+
if (event.type !== "user/message" || !isMessageToolsReplacement(event)) throw new Error("message-tools-withdrawn start requires a message-tools replacement event");
|
|
4398
4434
|
return {
|
|
4399
4435
|
seq: event.seq,
|
|
4400
|
-
hiddenStartSeq: event.surfaceOp.
|
|
4436
|
+
hiddenStartSeq: event.surfaceOp.startSeq
|
|
4401
4437
|
};
|
|
4402
4438
|
},
|
|
4403
4439
|
update: (context) => context.state,
|
|
@@ -4421,12 +4457,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4421
4457
|
},
|
|
4422
4458
|
start: (_context, match) => {
|
|
4423
4459
|
const event = match.event;
|
|
4424
|
-
if (!isMessageToolsEdit(event)) throw new Error("message-tools-edited start requires a message-tools edit replacement event");
|
|
4460
|
+
if (event.type !== "user/message" || !isMessageToolsEdit(event)) throw new Error("message-tools-edited start requires a message-tools edit replacement event");
|
|
4425
4461
|
return {
|
|
4426
4462
|
seq: event.seq,
|
|
4427
4463
|
time: event.time,
|
|
4428
4464
|
content: event.data.content,
|
|
4429
|
-
hiddenStartSeq: event.surfaceOp.
|
|
4465
|
+
hiddenStartSeq: event.surfaceOp.startSeq
|
|
4430
4466
|
};
|
|
4431
4467
|
},
|
|
4432
4468
|
update: (context) => context.state,
|
|
@@ -4451,6 +4487,20 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4451
4487
|
pairs.sort((left, right) => left[0] - right[0]);
|
|
4452
4488
|
return pairs.flat();
|
|
4453
4489
|
}
|
|
4490
|
+
/**
|
|
4491
|
+
* Fold one message's content blocks into the gallery slot's image input, in
|
|
4492
|
+
* source order. Only `type: 'image'` blocks with an attachment qualify; a
|
|
4493
|
+
* withdrawn user message must keep its images visible in the divider replay
|
|
4494
|
+
* (they are exactly what the withdrawal hid).
|
|
4495
|
+
*/
|
|
4496
|
+
function imageSources(blocks) {
|
|
4497
|
+
const images = [];
|
|
4498
|
+
for (const block of blocks) {
|
|
4499
|
+
const b = block;
|
|
4500
|
+
if (b.type === "image" && b.attachment !== void 0) images.push({ attachment: b.attachment });
|
|
4501
|
+
}
|
|
4502
|
+
return images;
|
|
4503
|
+
}
|
|
4454
4504
|
/** Join text blocks into one plain string. */
|
|
4455
4505
|
function joinText(blocks) {
|
|
4456
4506
|
return blocks.filter((block) => block.type === "text" && typeof block.text === "string").map((block) => block.text).join("");
|
|
@@ -4463,7 +4513,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4463
4513
|
}
|
|
4464
4514
|
/**
|
|
4465
4515
|
* The restore-row Definition: one single-event Context per message-tools
|
|
4466
|
-
* user-message restore event (append-surface,
|
|
4516
|
+
* user-message restore event (append-surface, producer-tagged), replaying the
|
|
4467
4517
|
* withdrawn message's content at the tail.
|
|
4468
4518
|
*/
|
|
4469
4519
|
const restoredMessageDefinition = {
|
|
@@ -4478,7 +4528,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4478
4528
|
},
|
|
4479
4529
|
start: (_context, match) => {
|
|
4480
4530
|
const event = match.event;
|
|
4481
|
-
if (!isMessageToolsRestore(event)) throw new Error("message-tools-restored start requires a message-tools restore event");
|
|
4531
|
+
if (event.type !== "user/message" || !isMessageToolsRestore(event)) throw new Error("message-tools-restored start requires a message-tools restore event");
|
|
4482
4532
|
return {
|
|
4483
4533
|
seq: event.seq,
|
|
4484
4534
|
time: event.time,
|
|
@@ -4509,7 +4559,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4509
4559
|
},
|
|
4510
4560
|
start: (_context, match) => {
|
|
4511
4561
|
const event = match.event;
|
|
4512
|
-
if (!isMessageToolsRestoreAssistant(event)) throw new Error("message-tools-restored-assistant start requires a restore-assistant replay event");
|
|
4562
|
+
if (event.type !== "user/message" || !isMessageToolsRestoreAssistant(event)) throw new Error("message-tools-restored-assistant start requires a restore-assistant replay event");
|
|
4513
4563
|
return {
|
|
4514
4564
|
seq: event.seq,
|
|
4515
4565
|
time: event.time,
|
|
@@ -4524,7 +4574,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4524
4574
|
* Count the user-visible messages hidden by one withdrawn span. This mirrors
|
|
4525
4575
|
* {@link collectWithdrawnEntries}: context injections, tool calls, turn tails,
|
|
4526
4576
|
* and other UI chrome are not counted as “messages”, while restored/edited
|
|
4527
|
-
* rows
|
|
4577
|
+
* rows, reasoning-only assistant steps, and image-only user messages are.
|
|
4528
4578
|
* @param nodes - every materialized chat node.
|
|
4529
4579
|
* @param startSeq - first hidden seq (inclusive).
|
|
4530
4580
|
* @param endSeq - the divider's seq (exclusive).
|
|
@@ -4534,12 +4584,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4534
4584
|
return collectWithdrawnEntries(nodes, startSeq, endSeq).length;
|
|
4535
4585
|
}
|
|
4536
4586
|
/**
|
|
4537
|
-
* Collect the read-only replay of one withdrawn span: user originals
|
|
4538
|
-
* assistant text, in anchor order. Other kinds
|
|
4539
|
-
* and are skipped. Assistant-step data is
|
|
4540
|
-
* `data.finalNode.blocks` once settled —
|
|
4541
|
-
* not type-keyed like message content.
|
|
4542
|
-
* event handlers.
|
|
4587
|
+
* Collect the read-only replay of one withdrawn span: user originals (text
|
|
4588
|
+
* and attached images alike) and assistant text, in anchor order. Other kinds
|
|
4589
|
+
* carry no user-readable content and are skipped. Assistant-step data is
|
|
4590
|
+
* kind-keyed (`data.blocks`, with `data.finalNode.blocks` once settled —
|
|
4591
|
+
* `conversation-nodes/assistant.ts`), not type-keyed like message content.
|
|
4592
|
+
* Reads the live node store — call from event handlers.
|
|
4543
4593
|
* @param nodes - every materialized chat node.
|
|
4544
4594
|
* @param startSeq - first hidden seq (inclusive).
|
|
4545
4595
|
* @param endSeq - the divider's seq (exclusive).
|
|
@@ -4550,18 +4600,24 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4550
4600
|
const entries = [];
|
|
4551
4601
|
for (const node of inSpan) {
|
|
4552
4602
|
if (node.kind === "user" || node.kind === "steering" || node.kind === "message-tools-edited") {
|
|
4553
|
-
const
|
|
4554
|
-
|
|
4603
|
+
const content = node.data.content ?? [];
|
|
4604
|
+
const text = joinText(content);
|
|
4605
|
+
const images = imageSources(content);
|
|
4606
|
+
if (text !== "" || images.length > 0) entries.push({
|
|
4555
4607
|
kind: "user",
|
|
4556
|
-
text
|
|
4608
|
+
text,
|
|
4609
|
+
images
|
|
4557
4610
|
});
|
|
4558
4611
|
continue;
|
|
4559
4612
|
}
|
|
4560
4613
|
if (node.kind === "message-tools-restored") {
|
|
4561
|
-
const
|
|
4562
|
-
|
|
4614
|
+
const data = node.data;
|
|
4615
|
+
const text = data.text ?? "";
|
|
4616
|
+
const images = imageSources(data.content ?? []);
|
|
4617
|
+
if (text !== "" || images.length > 0) entries.push({
|
|
4563
4618
|
kind: "user",
|
|
4564
|
-
text
|
|
4619
|
+
text,
|
|
4620
|
+
images
|
|
4565
4621
|
});
|
|
4566
4622
|
continue;
|
|
4567
4623
|
}
|
|
@@ -4569,7 +4625,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4569
4625
|
const text = node.data.text ?? "";
|
|
4570
4626
|
if (text !== "") entries.push({
|
|
4571
4627
|
kind: "assistant",
|
|
4572
|
-
text
|
|
4628
|
+
text,
|
|
4629
|
+
images: []
|
|
4573
4630
|
});
|
|
4574
4631
|
continue;
|
|
4575
4632
|
}
|
|
@@ -4578,7 +4635,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4578
4635
|
const text = joinAssistantText(data.finalNode?.blocks ?? data.blocks ?? []);
|
|
4579
4636
|
if (text !== "") entries.push({
|
|
4580
4637
|
kind: "assistant",
|
|
4581
|
-
text
|
|
4638
|
+
text,
|
|
4639
|
+
images: []
|
|
4582
4640
|
});
|
|
4583
4641
|
}
|
|
4584
4642
|
}
|
|
@@ -4627,6 +4685,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4627
4685
|
//#endregion
|
|
4628
4686
|
//#region src/client/dom-hider.ts
|
|
4629
4687
|
/**
|
|
4688
|
+
* The main-view session: host 0.1.6-alpha.2 dropped SessionListState.current
|
|
4689
|
+
* for the retainedBy.mainView count on each summary (the label is ui-session's
|
|
4690
|
+
* declaration merge, read here as a plain duck-typed count so this package
|
|
4691
|
+
* needs no ui-session edge), with the legacy field as the older-host fallback.
|
|
4692
|
+
*/
|
|
4693
|
+
const mainSessionId = (list) => Object.values(list.byId ?? {}).find((session) => (session.retainedBy?.mainView ?? 0) > 0)?.id ?? list.current;
|
|
4694
|
+
/**
|
|
4630
4695
|
* Flow keys of every chat node inside a hidden span. The withdrawal divider
|
|
4631
4696
|
* itself (`message-tools-withdrawn`, anchored at the span's exclusive end) is
|
|
4632
4697
|
* never included — it is the marker that must stay visible. Restore events
|
|
@@ -4647,8 +4712,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4647
4712
|
if (node.kind === "message-tools-withdrawn") continue;
|
|
4648
4713
|
if (node.kind === "context") {
|
|
4649
4714
|
const data = node.data;
|
|
4650
|
-
|
|
4651
|
-
if (source?.kind === "plugin" && source.plugin === "message-tools" || restoredSeqs.has(data.seq ?? -1) || messageToolsOp(data.source) === "edit-trigger") {
|
|
4715
|
+
if (isMessageToolsSource(data.source) || restoredSeqs.has(data.seq ?? -1) || messageToolsOp(data.source) === "edit-trigger") {
|
|
4652
4716
|
keys.push(node.key);
|
|
4653
4717
|
continue;
|
|
4654
4718
|
}
|
|
@@ -4771,7 +4835,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4771
4835
|
});
|
|
4772
4836
|
};
|
|
4773
4837
|
const bindCurrent = () => {
|
|
4774
|
-
const current = ctx.sessions.list.getSnapshot()
|
|
4838
|
+
const current = mainSessionId(ctx.sessions.list.getSnapshot());
|
|
4775
4839
|
if (current === activeSession && stopSession !== void 0) return;
|
|
4776
4840
|
stopSession?.();
|
|
4777
4841
|
stopSession = void 0;
|
|
@@ -5003,7 +5067,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5003
5067
|
return true;
|
|
5004
5068
|
}
|
|
5005
5069
|
//#endregion
|
|
5006
|
-
//#region ../../node_modules/.pnpm/@deepseek-ai+dsh-client-store@0.1.
|
|
5070
|
+
//#region ../../node_modules/.pnpm/@deepseek-ai+dsh-client-store@0.1.7-rc.1_@deepseek-ai+cordis@4.0.4/node_modules/@deepseek-ai/dsh-client-store/lib/index.js
|
|
5007
5071
|
/**
|
|
5008
5072
|
* Shallow equality for selector slices (zustand/shallow semantics; travels
|
|
5009
5073
|
* with the engine so hook consumers need no zustand dependency).
|
|
@@ -5016,6 +5080,88 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5016
5080
|
}
|
|
5017
5081
|
//#endregion
|
|
5018
5082
|
//#region src/client/icons.tsx
|
|
5083
|
+
const IconCheckOutlineMedium = ({ size = 16, className }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
5084
|
+
width: size,
|
|
5085
|
+
height: size,
|
|
5086
|
+
className,
|
|
5087
|
+
viewBox: "0 0 16 16",
|
|
5088
|
+
fill: "none",
|
|
5089
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5090
|
+
"aria-hidden": "true",
|
|
5091
|
+
strokeWidth: 1.3,
|
|
5092
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
5093
|
+
d: "M2.25 8.5L5.49732 11.7473C5.90519 12.1552 6.57263 12.1344 6.95426 11.7018L13.75 4",
|
|
5094
|
+
stroke: "currentColor"
|
|
5095
|
+
})
|
|
5096
|
+
});
|
|
5097
|
+
const IconChevronDownOutlineMedium = ({ size = 14, className }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
5098
|
+
width: size,
|
|
5099
|
+
height: size,
|
|
5100
|
+
className,
|
|
5101
|
+
viewBox: "0 0 16 16",
|
|
5102
|
+
fill: "none",
|
|
5103
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5104
|
+
"aria-hidden": "true",
|
|
5105
|
+
strokeWidth: 1.3,
|
|
5106
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
5107
|
+
d: "M4 6L7.29289 9.29289C7.68342 9.68342 8.31658 9.68342 8.70711 9.29289L12 6",
|
|
5108
|
+
stroke: "currentColor"
|
|
5109
|
+
})
|
|
5110
|
+
});
|
|
5111
|
+
const IconChevronRightOutlineMedium = ({ size = 14, className }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
5112
|
+
width: size,
|
|
5113
|
+
height: size,
|
|
5114
|
+
className,
|
|
5115
|
+
viewBox: "0 0 16 16",
|
|
5116
|
+
fill: "none",
|
|
5117
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5118
|
+
"aria-hidden": "true",
|
|
5119
|
+
strokeWidth: 1.3,
|
|
5120
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
5121
|
+
d: "M6 12L9.29289 8.70711C9.68342 8.31658 9.68342 7.68342 9.29289 7.29289L6 4",
|
|
5122
|
+
stroke: "currentColor"
|
|
5123
|
+
})
|
|
5124
|
+
});
|
|
5125
|
+
const IconCopyOutlineMedium = ({ size = 16, className }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
5126
|
+
width: size,
|
|
5127
|
+
height: size,
|
|
5128
|
+
className,
|
|
5129
|
+
viewBox: "0 0 16 16",
|
|
5130
|
+
fill: "none",
|
|
5131
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5132
|
+
"aria-hidden": "true",
|
|
5133
|
+
strokeWidth: 1.3,
|
|
5134
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
|
|
5135
|
+
x: "1.52075",
|
|
5136
|
+
y: "4.07373",
|
|
5137
|
+
width: "10.3932",
|
|
5138
|
+
height: "10.3932",
|
|
5139
|
+
rx: "2",
|
|
5140
|
+
stroke: "currentColor"
|
|
5141
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
5142
|
+
d: "M11.9792 1.53296C13.36 1.53296 14.4792 2.65225 14.4792 4.03296V9.42847C14.4792 10.3756 13.9521 11.1987 13.1755 11.6228V10.3298C13.3652 10.0787 13.4792 9.7674 13.4792 9.42847V4.03296C13.4792 3.20453 12.8077 2.53296 11.9792 2.53296H6.58374C6.27966 2.53301 5.99684 2.6235 5.7605 2.77905H4.42358C4.85652 2.03463 5.66056 1.53304 6.58374 1.53296H11.9792Z",
|
|
5143
|
+
fill: "currentColor"
|
|
5144
|
+
})]
|
|
5145
|
+
});
|
|
5146
|
+
const IconEditOutlineMedium = ({ size = 16, className }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
5147
|
+
width: size,
|
|
5148
|
+
height: size,
|
|
5149
|
+
className,
|
|
5150
|
+
viewBox: "0 0 16 16",
|
|
5151
|
+
fill: "none",
|
|
5152
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5153
|
+
"aria-hidden": "true",
|
|
5154
|
+
strokeWidth: 1.3,
|
|
5155
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
5156
|
+
d: "M8.85596 2.69971H4.19971C3.37141 2.69971 2.69992 3.37146 2.69971 4.19971V11.8003C2.69992 12.6285 3.37141 13.3003 4.19971 13.3003H11.8003C12.6283 13.2999 13.3001 12.6283 13.3003 11.8003V7.89893H14.3003V11.8003C14.3001 13.1806 13.1806 14.2999 11.8003 14.3003H4.19971C2.81913 14.3003 1.69992 13.1808 1.69971 11.8003V4.19971C1.69992 2.81918 2.81913 1.69971 4.19971 1.69971H8.85596V2.69971Z",
|
|
5157
|
+
fill: "currentColor"
|
|
5158
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
5159
|
+
d: "M7.7849 8.23878L13.888 2.13574",
|
|
5160
|
+
stroke: "currentColor"
|
|
5161
|
+
})]
|
|
5162
|
+
});
|
|
5163
|
+
//#endregion
|
|
5164
|
+
//#region src/client/icons-local.tsx
|
|
5019
5165
|
/**
|
|
5020
5166
|
* Undo arrow (withdraw/restore), rotate-ccw style: a near-full circle arc
|
|
5021
5167
|
* (~290°, opening at the top) with a corner arrowhead at its left end
|
|
@@ -5025,7 +5171,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5025
5171
|
* @param props - size and className.
|
|
5026
5172
|
* @returns the icon element.
|
|
5027
5173
|
*/
|
|
5028
|
-
const
|
|
5174
|
+
const IconUndoOutlineMedium = ({ size = 16, className }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
5029
5175
|
width: size,
|
|
5030
5176
|
height: size,
|
|
5031
5177
|
className,
|
|
@@ -5057,7 +5203,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5057
5203
|
}
|
|
5058
5204
|
//#endregion
|
|
5059
5205
|
//#region \0dsh-css:src/client/ModelChip.module.css.mjs
|
|
5060
|
-
const css$3 = ".
|
|
5206
|
+
const css$3 = ".IO2TjW_chip{align-items:center;gap:6px;display:flex;position:relative}.IO2TjW_trigger{height:28px;color:var(--dsw-alias-label-secondary,var(--dsw-alias-label-primary));cursor:pointer;background:0 0;border:none;border-radius:24px;align-items:center;gap:4px;padding:0 8px;font-size:13px;font-weight:500;display:inline-flex}.IO2TjW_trigger:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover,var(--dsw-alias-bg-layer-1))}.IO2TjW_trigger:disabled{cursor:default;opacity:.6}.IO2TjW_triggerEffort{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-primary-dimmed))}.IO2TjW_menu{z-index:20;border:1px solid var(--dsw-alias-border-l1,var(--dsw-alias-border-l2,var(--dsw-alias-label-primary-dimmed)));background:var(--dsw-alias-bg-base,var(--dsw-alias-bg-layer-1));min-width:220px;max-height:320px;box-shadow:0 4px 16px var(--dsw-alias-shadow,var(--dsw-alias-border-l2,#0000001f));border-radius:8px;padding:4px;position:absolute;bottom:calc(100% + 4px);left:0;overflow-y:auto}.IO2TjW_group+.IO2TjW_group{margin-top:4px}.IO2TjW_groupTitle{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-primary-dimmed));padding:4px 8px;font-size:12px;line-height:18px}.IO2TjW_option{width:100%;color:var(--dsw-alias-label-primary,var(--dsw-alias-label-secondary));text-align:left;cursor:pointer;background:0 0;border:none;border-radius:6px;justify-content:space-between;align-items:center;gap:8px;padding:6px 8px;font-size:13px;line-height:20px;display:flex}.IO2TjW_option:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover,var(--dsw-alias-bg-layer-1))}.IO2TjW_option:disabled{cursor:default;opacity:.6}.IO2TjW_check{width:16px;color:var(--dsw-alias-label-primary,var(--dsw-alias-label-secondary));flex:none;display:inline-flex}.IO2TjW_empty{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-primary-dimmed));padding:8px;font-size:13px}.IO2TjW_selectFailed{color:var(--dsw-alias-state-error-primary,var(--dsw-alias-label-secondary));white-space:nowrap;font-size:12px}";
|
|
5061
5207
|
const tagId$3 = "@khorsheed/dsh-client-message-tools/ModelChip.module.css";
|
|
5062
5208
|
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$3) + "]") === null) {
|
|
5063
5209
|
const tag = document.createElement("style");
|
|
@@ -5067,16 +5213,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5067
5213
|
document.head.appendChild(tag);
|
|
5068
5214
|
}
|
|
5069
5215
|
var ModelChip_module_css_default = {
|
|
5070
|
-
"
|
|
5071
|
-
"
|
|
5072
|
-
"
|
|
5073
|
-
"
|
|
5074
|
-
"
|
|
5075
|
-
"
|
|
5076
|
-
"
|
|
5077
|
-
"check": "
|
|
5078
|
-
"
|
|
5079
|
-
"group": "
|
|
5216
|
+
"empty": "IO2TjW_empty",
|
|
5217
|
+
"menu": "IO2TjW_menu",
|
|
5218
|
+
"option": "IO2TjW_option",
|
|
5219
|
+
"chip": "IO2TjW_chip",
|
|
5220
|
+
"selectFailed": "IO2TjW_selectFailed",
|
|
5221
|
+
"trigger": "IO2TjW_trigger",
|
|
5222
|
+
"triggerEffort": "IO2TjW_triggerEffort",
|
|
5223
|
+
"check": "IO2TjW_check",
|
|
5224
|
+
"groupTitle": "IO2TjW_groupTitle",
|
|
5225
|
+
"group": "IO2TjW_group"
|
|
5080
5226
|
};
|
|
5081
5227
|
//#endregion
|
|
5082
5228
|
//#region src/client/ModelChip.tsx
|
|
@@ -5167,7 +5313,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5167
5313
|
className: ModelChip_module_css_default.triggerEffort,
|
|
5168
5314
|
children: effortLabel
|
|
5169
5315
|
}),
|
|
5170
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
5316
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconChevronDownOutlineMedium, {})
|
|
5171
5317
|
]
|
|
5172
5318
|
}),
|
|
5173
5319
|
open && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -5203,7 +5349,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5203
5349
|
children: level.label
|
|
5204
5350
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
5205
5351
|
className: ModelChip_module_css_default.check,
|
|
5206
|
-
children: effectiveEffort === level.effort ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
5352
|
+
children: effectiveEffort === level.effort ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconCheckOutlineMedium, {}) : null
|
|
5207
5353
|
})]
|
|
5208
5354
|
}, level.key))]
|
|
5209
5355
|
}),
|
|
@@ -5228,7 +5374,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5228
5374
|
children: model.name
|
|
5229
5375
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
5230
5376
|
className: ModelChip_module_css_default.check,
|
|
5231
|
-
children: selected ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
5377
|
+
children: selected ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconCheckOutlineMedium, {}) : null
|
|
5232
5378
|
})]
|
|
5233
5379
|
}, model.id);
|
|
5234
5380
|
})]
|
|
@@ -5249,7 +5395,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5249
5395
|
}
|
|
5250
5396
|
//#endregion
|
|
5251
5397
|
//#region \0dsh-css:src/client/UserMessageView.module.css.mjs
|
|
5252
|
-
const css$2 = ".
|
|
5398
|
+
const css$2 = ".uq6O-a_userRow{flex-direction:column;align-items:flex-end;gap:6px;display:flex}.uq6O-a_userStack{flex-direction:column;align-items:flex-end;gap:8px;min-width:0;max-width:min(525px,82%);display:flex}.uq6O-a_bubble{background:var(--dsw-specific-bubble,var(--dsw-alias-bg-layer-1));max-width:100%;color:var(--dsw-alias-label-primary,var(--dsw-alias-label-secondary));border-radius:22px;padding:10px 16px;font-size:16px;line-height:24px}.uq6O-a_textRun{white-space:pre-wrap;word-break:break-word;font-size:inherit;line-height:inherit}.uq6O-a_refChip{color:var(--dsw-alias-label-primary,var(--dsw-alias-label-secondary));white-space:nowrap;vertical-align:baseline;background:#6187d838;border-radius:6px;margin:0 2px;padding:0 8px;font-size:.85em;line-height:1.6;display:inline-block}.uq6O-a_actions{align-items:center;gap:10px;height:28px;display:flex}.uq6O-a_action{width:28px;height:28px;color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-primary-dimmed));cursor:pointer;background:0 0;border:none;border-radius:28px;justify-content:center;align-items:center;padding:6px;display:inline-flex}.uq6O-a_action:hover{background:var(--dsw-alias-interactive-bg-hover,var(--dsw-alias-bg-layer-1));color:var(--dsw-alias-label-secondary,var(--dsw-alias-label-primary))}.uq6O-a_editor{border:1px solid var(--dsw-alias-border-l1,var(--dsw-alias-border-l2,var(--dsw-alias-label-primary-dimmed)));background:var(--dsw-alias-bg-base,var(--dsw-alias-bg-layer-1));border-radius:8px;flex-direction:column;gap:8px;width:100%;padding:12px;display:flex}.uq6O-a_editorInput{border:1px solid var(--dsw-alias-border-l2,var(--dsw-alias-border-l1,var(--dsw-alias-label-primary-dimmed)));resize:none;width:100%;max-height:240px;color:var(--dsw-alias-label-primary,var(--dsw-alias-label-secondary));font:inherit;background:0 0;border-radius:6px;outline:none;padding:8px;overflow-y:auto}.uq6O-a_editorActions{justify-content:flex-end;align-items:center;gap:8px;display:flex}.uq6O-a_editorTrailing{align-items:center;margin-right:auto;display:flex}.uq6O-a_actionError{color:var(--dsw-alias-state-error-primary,var(--dsw-alias-label-secondary));align-self:flex-end;padding:2px 4px;font-size:13px;line-height:20px}.uq6O-a_editedLabel{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-primary-dimmed));align-self:flex-end;font-size:12px;line-height:18px}";
|
|
5253
5399
|
const tagId$2 = "@khorsheed/dsh-client-message-tools/UserMessageView.module.css";
|
|
5254
5400
|
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$2) + "]") === null) {
|
|
5255
5401
|
const tag = document.createElement("style");
|
|
@@ -5259,18 +5405,19 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5259
5405
|
document.head.appendChild(tag);
|
|
5260
5406
|
}
|
|
5261
5407
|
var UserMessageView_module_css_default = {
|
|
5262
|
-
"
|
|
5263
|
-
"
|
|
5264
|
-
"
|
|
5265
|
-
"editedLabel": "
|
|
5266
|
-
"
|
|
5267
|
-
"
|
|
5268
|
-
"
|
|
5269
|
-
"
|
|
5270
|
-
"
|
|
5271
|
-
"
|
|
5272
|
-
"
|
|
5273
|
-
"
|
|
5408
|
+
"editorTrailing": "uq6O-a_editorTrailing",
|
|
5409
|
+
"actionError": "uq6O-a_actionError",
|
|
5410
|
+
"editorInput": "uq6O-a_editorInput",
|
|
5411
|
+
"editedLabel": "uq6O-a_editedLabel",
|
|
5412
|
+
"bubble": "uq6O-a_bubble",
|
|
5413
|
+
"actions": "uq6O-a_actions",
|
|
5414
|
+
"refChip": "uq6O-a_refChip",
|
|
5415
|
+
"userRow": "uq6O-a_userRow",
|
|
5416
|
+
"editorActions": "uq6O-a_editorActions",
|
|
5417
|
+
"userStack": "uq6O-a_userStack",
|
|
5418
|
+
"textRun": "uq6O-a_textRun",
|
|
5419
|
+
"editor": "uq6O-a_editor",
|
|
5420
|
+
"action": "uq6O-a_action"
|
|
5274
5421
|
};
|
|
5275
5422
|
//#endregion
|
|
5276
5423
|
//#region src/client/UserMessageView.tsx
|
|
@@ -5317,7 +5464,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5317
5464
|
const tokenStart = m.index + (m[1]?.length ?? 0);
|
|
5318
5465
|
/* v8 ignore next -- the token group always participates in a match, so m[2] is never undefined. */
|
|
5319
5466
|
const label = m[2] ?? "";
|
|
5320
|
-
if (tokenStart > cursor) parts.push(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
5467
|
+
if (tokenStart > cursor) parts.push(/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
5468
|
+
className: UserMessageView_module_css_default.textRun,
|
|
5469
|
+
children: text.slice(cursor, tokenStart)
|
|
5470
|
+
}, cursor));
|
|
5321
5471
|
parts.push(/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
5322
5472
|
className: UserMessageView_module_css_default.refChip,
|
|
5323
5473
|
"data-ref-chip": label.startsWith("@") ? "subagent" : "skill",
|
|
@@ -5325,8 +5475,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5325
5475
|
}, tokenStart));
|
|
5326
5476
|
cursor = tokenStart + label.length;
|
|
5327
5477
|
}
|
|
5328
|
-
if (parts.length === 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
5329
|
-
|
|
5478
|
+
if (parts.length === 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
5479
|
+
className: UserMessageView_module_css_default.textRun,
|
|
5480
|
+
children: text
|
|
5481
|
+
});
|
|
5482
|
+
if (cursor < text.length) parts.push(/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
5483
|
+
className: UserMessageView_module_css_default.textRun,
|
|
5484
|
+
children: text.slice(cursor)
|
|
5485
|
+
}, cursor));
|
|
5330
5486
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: parts });
|
|
5331
5487
|
}
|
|
5332
5488
|
/** Copy action: the copy icon swaps to a short-lived check after a successful write. */
|
|
@@ -5363,7 +5519,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5363
5519
|
className: UserMessageView_module_css_default.action,
|
|
5364
5520
|
"aria-label": copied ? t("copied") : t("copy"),
|
|
5365
5521
|
onClick: onCopy,
|
|
5366
|
-
children: copied ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
5522
|
+
children: copied ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconCheckOutlineMedium, {}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconCopyOutlineMedium, {})
|
|
5367
5523
|
})
|
|
5368
5524
|
});
|
|
5369
5525
|
}
|
|
@@ -5541,7 +5697,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5541
5697
|
setFailed(null);
|
|
5542
5698
|
setEditing(true);
|
|
5543
5699
|
},
|
|
5544
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
5700
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconEditOutlineMedium, {})
|
|
5545
5701
|
})
|
|
5546
5702
|
}),
|
|
5547
5703
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
|
|
@@ -5556,7 +5712,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5556
5712
|
setAcknowledged(false);
|
|
5557
5713
|
setConfirming(true);
|
|
5558
5714
|
},
|
|
5559
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
5715
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconUndoOutlineMedium, {})
|
|
5560
5716
|
})
|
|
5561
5717
|
})
|
|
5562
5718
|
]
|
|
@@ -5588,7 +5744,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5588
5744
|
});
|
|
5589
5745
|
//#endregion
|
|
5590
5746
|
//#region \0dsh-css:src/client/RestoredMessageView.module.css.mjs
|
|
5591
|
-
const css$1 = ".
|
|
5747
|
+
const css$1 = ".MHYySG_restoredLabel{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-primary-dimmed));align-items:center;gap:4px;font-size:12px;line-height:18px;display:inline-flex}.MHYySG_restoredAssistantRow{color:var(--dsw-alias-label-primary,var(--dsw-alias-label-secondary));flex-direction:column;align-items:flex-start;gap:4px;display:flex}";
|
|
5592
5748
|
const tagId$1 = "@khorsheed/dsh-client-message-tools/RestoredMessageView.module.css";
|
|
5593
5749
|
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$1) + "]") === null) {
|
|
5594
5750
|
const tag = document.createElement("style");
|
|
@@ -5598,8 +5754,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5598
5754
|
document.head.appendChild(tag);
|
|
5599
5755
|
}
|
|
5600
5756
|
var RestoredMessageView_module_css_default = {
|
|
5601
|
-
"
|
|
5602
|
-
"
|
|
5757
|
+
"restoredAssistantRow": "MHYySG_restoredAssistantRow",
|
|
5758
|
+
"restoredLabel": "MHYySG_restoredLabel"
|
|
5603
5759
|
};
|
|
5604
5760
|
//#endregion
|
|
5605
5761
|
//#region src/client/RestoredMessageView.tsx
|
|
@@ -5631,7 +5787,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5631
5787
|
className: RestoredMessageView_module_css_default.restoredAssistantRow,
|
|
5632
5788
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
5633
5789
|
className: RestoredMessageView_module_css_default.restoredLabel,
|
|
5634
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
5790
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconUndoOutlineMedium, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("restored.assistant") })]
|
|
5635
5791
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.MarkdownText, {
|
|
5636
5792
|
text: data.text,
|
|
5637
5793
|
labels
|
|
@@ -5640,7 +5796,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5640
5796
|
}
|
|
5641
5797
|
//#endregion
|
|
5642
5798
|
//#region \0dsh-css:src/client/WithdrawnDividerView.module.css.mjs
|
|
5643
|
-
const css = ".
|
|
5799
|
+
const css = ".Hb4H5q_row{padding:2px 0}.Hb4H5q_marker{width:100%;min-width:0;height:24px;color:inherit;font:inherit;text-align:left;cursor:pointer;background:0 0;border:none;border-radius:6px;align-items:center;padding:0;display:flex}.Hb4H5q_marker:hover{background:var(--dsw-alias-interactive-bg-hover,var(--dsw-alias-bg-layer-1))}.Hb4H5q_leading{width:16px;height:16px;color:var(--dsw-alias-label-secondary,var(--dsw-alias-label-primary));flex:none;justify-content:center;align-items:center;margin-right:6px;display:inline-flex}.Hb4H5q_title{color:var(--dsw-alias-label-primary-dimmed,var(--dsw-alias-label-tertiary));flex:none;font-size:14px;line-height:24px}.Hb4H5q_badge{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-primary-dimmed));flex:none;align-items:center;gap:4px;margin-left:10px;font-size:12px;line-height:18px;display:inline-flex}.Hb4H5q_body{padding:4px 0 4px 22px}.Hb4H5q_empty{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-primary-dimmed));font-size:13px;line-height:20px}.Hb4H5q_textRun{white-space:pre-wrap;word-break:break-word;font-size:inherit;line-height:inherit}.Hb4H5q_entryUser,.Hb4H5q_entryAssistant{color:var(--dsw-alias-label-secondary,var(--dsw-alias-label-primary));padding:4px 0;font-size:14px;line-height:22px}.Hb4H5q_entryKind{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-primary-dimmed));margin-bottom:2px;font-size:12px;line-height:18px}.Hb4H5q_entryUser{border-left:2px solid var(--dsw-alias-border-l2,var(--dsw-alias-label-primary-dimmed));padding-left:8px}.Hb4H5q_entryImages{margin-top:4px}.Hb4H5q_entryAssistant{border-left:2px solid var(--dsw-alias-border-l1,var(--dsw-alias-border-l2,var(--dsw-alias-label-primary-dimmed)));padding-left:8px}.Hb4H5q_restoreRow{align-items:center;gap:8px;padding-top:8px;display:flex}.Hb4H5q_restoreFailed{color:var(--dsw-alias-state-error-primary,var(--dsw-alias-label-secondary));font-size:12px}";
|
|
5644
5800
|
const tagId = "@khorsheed/dsh-client-message-tools/WithdrawnDividerView.module.css";
|
|
5645
5801
|
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
|
|
5646
5802
|
const tag = document.createElement("style");
|
|
@@ -5650,18 +5806,20 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5650
5806
|
document.head.appendChild(tag);
|
|
5651
5807
|
}
|
|
5652
5808
|
var WithdrawnDividerView_module_css_default = {
|
|
5653
|
-
"
|
|
5654
|
-
"
|
|
5655
|
-
"
|
|
5656
|
-
"
|
|
5657
|
-
"
|
|
5658
|
-
"
|
|
5659
|
-
"
|
|
5660
|
-
"
|
|
5661
|
-
"entryAssistant": "
|
|
5662
|
-
"
|
|
5663
|
-
"
|
|
5664
|
-
"
|
|
5809
|
+
"entryUser": "Hb4H5q_entryUser",
|
|
5810
|
+
"row": "Hb4H5q_row",
|
|
5811
|
+
"title": "Hb4H5q_title",
|
|
5812
|
+
"leading": "Hb4H5q_leading",
|
|
5813
|
+
"badge": "Hb4H5q_badge",
|
|
5814
|
+
"empty": "Hb4H5q_empty",
|
|
5815
|
+
"entryKind": "Hb4H5q_entryKind",
|
|
5816
|
+
"textRun": "Hb4H5q_textRun",
|
|
5817
|
+
"entryAssistant": "Hb4H5q_entryAssistant",
|
|
5818
|
+
"restoreFailed": "Hb4H5q_restoreFailed",
|
|
5819
|
+
"restoreRow": "Hb4H5q_restoreRow",
|
|
5820
|
+
"body": "Hb4H5q_body",
|
|
5821
|
+
"marker": "Hb4H5q_marker",
|
|
5822
|
+
"entryImages": "Hb4H5q_entryImages"
|
|
5665
5823
|
};
|
|
5666
5824
|
//#endregion
|
|
5667
5825
|
//#region src/client/WithdrawnDividerView.tsx
|
|
@@ -5669,7 +5827,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5669
5827
|
* Withdrawal divider row ('message-tools-withdrawn' keyed renderer), redone
|
|
5670
5828
|
* in the official compaction-marker visual language: one dim clickable row
|
|
5671
5829
|
* (chevron +「已撤回 N 条消息」), expanding in place to a read-only replay of
|
|
5672
|
-
* the withdrawn span (user originals
|
|
5830
|
+
* the withdrawn span (user originals — text and attached images — plus
|
|
5831
|
+
* assistant text) with a「恢复到对话
|
|
5673
5832
|
* 末尾」action. The restore tail-replays the span's replayable entries (user
|
|
5674
5833
|
* messages + assistant text) — the surface fold is positional, so in-place
|
|
5675
5834
|
* restoration is impossible — and the divider carries a「已恢复」badge while
|
|
@@ -5678,8 +5837,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5678
5837
|
* once withdrawals backfill the draft automatically.
|
|
5679
5838
|
*/
|
|
5680
5839
|
/** The withdrawal divider: collapsed marker row plus the expandable replay. */
|
|
5681
|
-
function WithdrawnDividerView({ node, t, restoreMessage, ...standard }) {
|
|
5840
|
+
function WithdrawnDividerView({ node, t, restoreMessage, renderMessageImages, ...standard }) {
|
|
5682
5841
|
const data = node.data;
|
|
5842
|
+
const renderImages = renderMessageImages;
|
|
5683
5843
|
const [expanded, setExpanded] = (0, react.useState)(false);
|
|
5684
5844
|
const [entries, setEntries] = (0, react.useState)(null);
|
|
5685
5845
|
const [busy, setBusy] = (0, react.useState)(false);
|
|
@@ -5724,7 +5884,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5724
5884
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
5725
5885
|
className: WithdrawnDividerView_module_css_default.leading,
|
|
5726
5886
|
"aria-hidden": true,
|
|
5727
|
-
children: expanded ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
5887
|
+
children: expanded ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconChevronDownOutlineMedium, {}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconChevronRightOutlineMedium, {})
|
|
5728
5888
|
}),
|
|
5729
5889
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
5730
5890
|
className: WithdrawnDividerView_module_css_default.title,
|
|
@@ -5732,7 +5892,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5732
5892
|
}),
|
|
5733
5893
|
restored && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
5734
5894
|
className: WithdrawnDividerView_module_css_default.badge,
|
|
5735
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
5895
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconUndoOutlineMedium, {}), t("withdrawn.restored")]
|
|
5736
5896
|
})
|
|
5737
5897
|
]
|
|
5738
5898
|
}), expanded && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -5742,10 +5902,23 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5742
5902
|
children: t("withdrawn.empty")
|
|
5743
5903
|
}) : entries.map((entry, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
5744
5904
|
className: entry.kind === "user" ? WithdrawnDividerView_module_css_default.entryUser : WithdrawnDividerView_module_css_default.entryAssistant,
|
|
5745
|
-
children: [
|
|
5746
|
-
|
|
5747
|
-
|
|
5748
|
-
|
|
5905
|
+
children: [
|
|
5906
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
5907
|
+
className: WithdrawnDividerView_module_css_default.entryKind,
|
|
5908
|
+
children: entry.kind === "user" ? t("withdrawn.entryUser") : t("withdrawn.entryAssistant")
|
|
5909
|
+
}),
|
|
5910
|
+
entry.text !== "" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
5911
|
+
className: WithdrawnDividerView_module_css_default.textRun,
|
|
5912
|
+
children: entry.text
|
|
5913
|
+
}),
|
|
5914
|
+
renderImages !== void 0 && entry.images.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
5915
|
+
className: WithdrawnDividerView_module_css_default.entryImages,
|
|
5916
|
+
children: renderImages({
|
|
5917
|
+
images: entry.images,
|
|
5918
|
+
align: "end"
|
|
5919
|
+
})
|
|
5920
|
+
})
|
|
5921
|
+
]
|
|
5749
5922
|
}, index)), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
5750
5923
|
className: WithdrawnDividerView_module_css_default.restoreRow,
|
|
5751
5924
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
@@ -5925,7 +6098,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5925
6098
|
loadModels: () => {
|
|
5926
6099
|
directory?.load().catch(() => void 0);
|
|
5927
6100
|
},
|
|
5928
|
-
selectModel: (selection) => directory === void 0 ? Promise.resolve(false) : directory.select(selection).then(() => true, () => false),
|
|
6101
|
+
selectModel: (selection) => directory === void 0 ? Promise.resolve(false) : directory.select(selection).then((result) => result && typeof result === "object" && "ok" in result ? result.ok : true, () => false),
|
|
5929
6102
|
hooks: { modelDirectory: directory === void 0 ? EMPTY_MODEL_DIRECTORY : directory.store }
|
|
5930
6103
|
};
|
|
5931
6104
|
};
|