@deepseek-ai/dsh-client-ui-action-cards 0.0.0-stage → 0.2.2-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.i18n.yaml +40 -0
- package/README.md +88 -2
- package/README.zh.md +89 -0
- package/lib/client.js +896 -0
- package/lib/index.js +6 -0
- package/lib/types/client/Card.d.ts +51 -0
- package/lib/types/client/ProposeRow.d.ts +12 -0
- package/lib/types/client/index.d.ts +11 -0
- package/lib/types/client/locales.d.ts +34 -0
- package/lib/types/client/mount.d.ts +26 -0
- package/lib/types/client/registry.d.ts +75 -0
- package/lib/types/index.d.ts +4 -0
- package/locale/de.json +6 -0
- package/locale/en.json +6 -0
- package/locale/es.json +6 -0
- package/locale/fr.json +6 -0
- package/locale/ja.json +6 -0
- package/locale/pt.json +6 -0
- package/locale/ru.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +68 -3
package/lib/client.js
ADDED
|
@@ -0,0 +1,896 @@
|
|
|
1
|
+
window.__ModuleLoader__.load({
|
|
2
|
+
id: "@deepseek-ai/dsh-client-ui-action-cards",
|
|
3
|
+
factory: (require) => {
|
|
4
|
+
var module = { exports: {} };
|
|
5
|
+
var exports = module.exports;
|
|
6
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
7
|
+
let zod = require("zod");
|
|
8
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
|
+
let react = require("react");
|
|
10
|
+
let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
11
|
+
//#region ../../typert/protocol/src/remote-info.ts
|
|
12
|
+
/**
|
|
13
|
+
* Retain one generated definition per endpoint without constructing parsers or projections.
|
|
14
|
+
* The class instance builds its shared descriptor/method index on first access;
|
|
15
|
+
* input schemas and JSON Schema projections are cached only when requested.
|
|
16
|
+
* @param spec - compiler-produced method facts and Zod factories.
|
|
17
|
+
* @param zod - the generated artifact's Zod runtime for named-input parsers.
|
|
18
|
+
* @returns a lazy, mountable info instance with no registration or transport effects.
|
|
19
|
+
*/
|
|
20
|
+
function createTypertRemoteInfo(spec, zod) {
|
|
21
|
+
return new RemoteInfo(spec, zod);
|
|
22
|
+
}
|
|
23
|
+
var RemoteInfo = class {
|
|
24
|
+
spec;
|
|
25
|
+
zod;
|
|
26
|
+
index;
|
|
27
|
+
constructor(spec, zod) {
|
|
28
|
+
this.spec = spec;
|
|
29
|
+
this.zod = zod;
|
|
30
|
+
}
|
|
31
|
+
get package() {
|
|
32
|
+
return this.spec.package;
|
|
33
|
+
}
|
|
34
|
+
get descriptors() {
|
|
35
|
+
return this.resolve().descriptors;
|
|
36
|
+
}
|
|
37
|
+
get methods() {
|
|
38
|
+
return this.resolve().methods;
|
|
39
|
+
}
|
|
40
|
+
resolve() {
|
|
41
|
+
if (this.index !== void 0) return this.index;
|
|
42
|
+
const zod = this.zod;
|
|
43
|
+
const descriptors = [];
|
|
44
|
+
const methods = Object.create(null);
|
|
45
|
+
for (const [endpoint, definition] of Object.entries(this.spec.methods)) {
|
|
46
|
+
const separator = endpoint.indexOf("/");
|
|
47
|
+
const namespace = endpoint.slice(0, separator);
|
|
48
|
+
const method = endpoint.slice(separator + 1);
|
|
49
|
+
const parameters = definition.parameters.map((parameter) => ({
|
|
50
|
+
...parameter,
|
|
51
|
+
wire: parameter.wire ?? parameter.name
|
|
52
|
+
}));
|
|
53
|
+
const descriptor = {
|
|
54
|
+
...definition,
|
|
55
|
+
id: `${this.spec.package}#${endpoint}`,
|
|
56
|
+
namespace,
|
|
57
|
+
method,
|
|
58
|
+
parameters,
|
|
59
|
+
result: definition.result.description === void 0 ? definition.result : new ResultValue(definition.result)
|
|
60
|
+
};
|
|
61
|
+
if (definition.invocation.kind === "direct") {
|
|
62
|
+
const inputs = [];
|
|
63
|
+
methods[endpoint] = Object.assign(descriptor, {
|
|
64
|
+
input(options) {
|
|
65
|
+
const strict = options?.strict === true;
|
|
66
|
+
return inputs[strict ? 1 : 0] ??= new NamedInput(parameters, strict, zod);
|
|
67
|
+
},
|
|
68
|
+
invoke(remote, input, signal) {
|
|
69
|
+
const named = input;
|
|
70
|
+
const values = parameters.map((parameter) => named[parameter.wire]);
|
|
71
|
+
if (definition.cancellation !== void 0) values.push(signal);
|
|
72
|
+
const receiver = Reflect.get(remote, namespace);
|
|
73
|
+
return Reflect.get(receiver, method).apply(receiver, values);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
descriptors.push(descriptor);
|
|
78
|
+
}
|
|
79
|
+
return this.index = {
|
|
80
|
+
descriptors,
|
|
81
|
+
methods
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
function optional(parameter) {
|
|
86
|
+
return parameter.source === "json" && parameter.acceptsUndefined === true;
|
|
87
|
+
}
|
|
88
|
+
var NamedInput = class {
|
|
89
|
+
parameters;
|
|
90
|
+
strict;
|
|
91
|
+
zod;
|
|
92
|
+
schema;
|
|
93
|
+
projection;
|
|
94
|
+
constructor(parameters, strict, zod) {
|
|
95
|
+
this.parameters = parameters;
|
|
96
|
+
this.strict = strict;
|
|
97
|
+
this.zod = zod;
|
|
98
|
+
}
|
|
99
|
+
codec(parameter) {
|
|
100
|
+
return this.strict ? parameter.strictCodec : parameter.codec;
|
|
101
|
+
}
|
|
102
|
+
create = () => this.schema ??= this.zod.strictObject(Object.fromEntries(this.parameters.map((parameter) => {
|
|
103
|
+
const value = this.codec(parameter).create();
|
|
104
|
+
return [parameter.wire, optional(parameter) ? value.optional() : value.nonoptional()];
|
|
105
|
+
})));
|
|
106
|
+
get jsonSchema() {
|
|
107
|
+
return this.project().jsonSchema;
|
|
108
|
+
}
|
|
109
|
+
get jsonSchemaError() {
|
|
110
|
+
return this.project().jsonSchemaError;
|
|
111
|
+
}
|
|
112
|
+
project() {
|
|
113
|
+
if (this.projection !== void 0) return this.projection;
|
|
114
|
+
const unavailable = this.parameters.find((parameter) => this.codec(parameter).jsonSchema === void 0);
|
|
115
|
+
if (unavailable !== void 0) return this.projection = { jsonSchemaError: this.codec(unavailable).jsonSchemaError ?? `No JSON Schema for parameter ${unavailable.wire}` };
|
|
116
|
+
return this.projection = { jsonSchema: {
|
|
117
|
+
type: "object",
|
|
118
|
+
properties: Object.fromEntries(this.parameters.map((parameter) => [parameter.wire, {
|
|
119
|
+
...this.codec(parameter).jsonSchema,
|
|
120
|
+
...parameter.description === void 0 ? {} : { description: parameter.description }
|
|
121
|
+
}])),
|
|
122
|
+
required: this.parameters.filter((parameter) => !optional(parameter)).map((parameter) => parameter.wire),
|
|
123
|
+
additionalProperties: false
|
|
124
|
+
} };
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
var ResultValue = class {
|
|
128
|
+
spec;
|
|
129
|
+
projection;
|
|
130
|
+
constructor(spec) {
|
|
131
|
+
this.spec = spec;
|
|
132
|
+
}
|
|
133
|
+
get mode() {
|
|
134
|
+
return this.spec.mode;
|
|
135
|
+
}
|
|
136
|
+
get typeSymbol() {
|
|
137
|
+
return this.spec.typeSymbol;
|
|
138
|
+
}
|
|
139
|
+
get create() {
|
|
140
|
+
return this.spec.create;
|
|
141
|
+
}
|
|
142
|
+
get decode() {
|
|
143
|
+
return this.spec.decode;
|
|
144
|
+
}
|
|
145
|
+
get encode() {
|
|
146
|
+
return this.spec.encode;
|
|
147
|
+
}
|
|
148
|
+
get description() {
|
|
149
|
+
return this.spec.description;
|
|
150
|
+
}
|
|
151
|
+
get jsonSchemaError() {
|
|
152
|
+
return this.spec.jsonSchemaError;
|
|
153
|
+
}
|
|
154
|
+
get jsonSchema() {
|
|
155
|
+
if (this.projection === void 0) {
|
|
156
|
+
const schema = this.spec.jsonSchema;
|
|
157
|
+
this.projection = { value: schema === void 0 ? void 0 : {
|
|
158
|
+
...schema,
|
|
159
|
+
description: this.spec.description
|
|
160
|
+
} };
|
|
161
|
+
}
|
|
162
|
+
return this.projection.value;
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
//#endregion
|
|
166
|
+
//#region ../action-cards/lib/typert.remote-client.js
|
|
167
|
+
let _deepseek_ai_dsh_action_cards_actionCards_act_parameter_0$schema$value;
|
|
168
|
+
const _deepseek_ai_dsh_action_cards_actionCards_act_parameter_0$schema = () => _deepseek_ai_dsh_action_cards_actionCards_act_parameter_0$schema$value ??= zod.z.string();
|
|
169
|
+
let _deepseek_ai_dsh_action_cards_actionCards_act_parameter_1$schema$value;
|
|
170
|
+
const _deepseek_ai_dsh_action_cards_actionCards_act_parameter_1$schema = () => _deepseek_ai_dsh_action_cards_actionCards_act_parameter_1$schema$value ??= zod.z.string();
|
|
171
|
+
let _deepseek_ai_dsh_action_cards_actionCards_act_parameter_2$schema$value;
|
|
172
|
+
const _deepseek_ai_dsh_action_cards_actionCards_act_parameter_2$schema = () => _deepseek_ai_dsh_action_cards_actionCards_act_parameter_2$schema$value ??= zod.z.string();
|
|
173
|
+
let _deepseek_ai_dsh_action_cards_actionCards_act_parameter_3$schema$value;
|
|
174
|
+
const _deepseek_ai_dsh_action_cards_actionCards_act_parameter_3$schema = () => _deepseek_ai_dsh_action_cards_actionCards_act_parameter_3$schema$value ??= zod.z.union([zod.z.undefined(), zod.z.record(zod.z.string(), zod.z.json())]);
|
|
175
|
+
let _deepseek_ai_dsh_action_cards_actionCards_act_result$schema$value;
|
|
176
|
+
const _deepseek_ai_dsh_action_cards_actionCards_act_result$schema = () => _deepseek_ai_dsh_action_cards_actionCards_act_result$schema$value ??= zod.z.union([
|
|
177
|
+
zod.z.object({ "status": zod.z.literal("accepted").readonly() }),
|
|
178
|
+
zod.z.object({
|
|
179
|
+
"status": zod.z.literal("settled").readonly(),
|
|
180
|
+
"decision": zod.z.object({
|
|
181
|
+
"callId": zod.z.string().readonly(),
|
|
182
|
+
"action": zod.z.string().readonly(),
|
|
183
|
+
"phase": zod.z.string().readonly(),
|
|
184
|
+
"data": zod.z.union([zod.z.undefined(), zod.z.record(zod.z.string(), zod.z.json()).readonly()]).readonly().optional().describe("Kind-defined fields such as a chosen location or a created package.")
|
|
185
|
+
}).readonly()
|
|
186
|
+
}),
|
|
187
|
+
zod.z.object({
|
|
188
|
+
"status": zod.z.literal("refused").readonly(),
|
|
189
|
+
"reason": zod.z.string().readonly()
|
|
190
|
+
}),
|
|
191
|
+
zod.z.object({
|
|
192
|
+
"status": zod.z.literal("unconfirmed").readonly(),
|
|
193
|
+
"reason": zod.z.string().readonly()
|
|
194
|
+
})
|
|
195
|
+
]);
|
|
196
|
+
let _deepseek_ai_dsh_action_cards_actionCards_act_parameter_0_strict$schema$value;
|
|
197
|
+
const _deepseek_ai_dsh_action_cards_actionCards_act_parameter_0_strict$schema = () => _deepseek_ai_dsh_action_cards_actionCards_act_parameter_0_strict$schema$value ??= zod.z.string();
|
|
198
|
+
let _deepseek_ai_dsh_action_cards_actionCards_act_parameter_1_strict$schema$value;
|
|
199
|
+
const _deepseek_ai_dsh_action_cards_actionCards_act_parameter_1_strict$schema = () => _deepseek_ai_dsh_action_cards_actionCards_act_parameter_1_strict$schema$value ??= zod.z.string();
|
|
200
|
+
let _deepseek_ai_dsh_action_cards_actionCards_act_parameter_2_strict$schema$value;
|
|
201
|
+
const _deepseek_ai_dsh_action_cards_actionCards_act_parameter_2_strict$schema = () => _deepseek_ai_dsh_action_cards_actionCards_act_parameter_2_strict$schema$value ??= zod.z.string();
|
|
202
|
+
let _deepseek_ai_dsh_action_cards_actionCards_act_parameter_3_strict$schema$value;
|
|
203
|
+
const _deepseek_ai_dsh_action_cards_actionCards_act_parameter_3_strict$schema = () => _deepseek_ai_dsh_action_cards_actionCards_act_parameter_3_strict$schema$value ??= zod.z.union([zod.z.undefined(), zod.z.record(zod.z.string(), zod.z.json())]);
|
|
204
|
+
const TYPERT_REMOTE = createTypertRemoteInfo({
|
|
205
|
+
package: "@deepseek-ai/dsh-action-cards",
|
|
206
|
+
methods: { "actionCards/act": {
|
|
207
|
+
service: "actionCards",
|
|
208
|
+
description: "Apply a user action to a logged card. Shared checks run first, then the kind reconciles the card; `dismiss` is recorded here and every other verb goes to the card's kind. `dismiss` also works on an unstarted card whose kind is no longer registered. Concurrent actions on one card share one operation.",
|
|
209
|
+
invocation: { kind: "direct" },
|
|
210
|
+
scope: {
|
|
211
|
+
context: "agent",
|
|
212
|
+
wire: "agentId"
|
|
213
|
+
},
|
|
214
|
+
parameters: [
|
|
215
|
+
{
|
|
216
|
+
name: "agent",
|
|
217
|
+
wire: "agentId",
|
|
218
|
+
description: "live root resolved from the displayed Session.",
|
|
219
|
+
source: "lookup",
|
|
220
|
+
lookup: "agent",
|
|
221
|
+
codec: {
|
|
222
|
+
mode: "strict",
|
|
223
|
+
typeSymbol: "@deepseek-ai/dsh-session/types#SessionId",
|
|
224
|
+
create: _deepseek_ai_dsh_action_cards_actionCards_act_parameter_0$schema,
|
|
225
|
+
jsonSchema: { "type": "string" }
|
|
226
|
+
},
|
|
227
|
+
strictCodec: {
|
|
228
|
+
mode: "strict",
|
|
229
|
+
typeSymbol: "@deepseek-ai/dsh-session/types#SessionId",
|
|
230
|
+
create: _deepseek_ai_dsh_action_cards_actionCards_act_parameter_0_strict$schema,
|
|
231
|
+
jsonSchema: { "type": "string" }
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
name: "callId",
|
|
236
|
+
description: "the card's `propose_action` call id.",
|
|
237
|
+
source: "json",
|
|
238
|
+
codec: {
|
|
239
|
+
mode: "strict",
|
|
240
|
+
typeSymbol: "@deepseek-ai/dsh-llm/brand#ToolCallId",
|
|
241
|
+
create: _deepseek_ai_dsh_action_cards_actionCards_act_parameter_1$schema,
|
|
242
|
+
jsonSchema: { "type": "string" }
|
|
243
|
+
},
|
|
244
|
+
strictCodec: {
|
|
245
|
+
mode: "strict",
|
|
246
|
+
typeSymbol: "@deepseek-ai/dsh-llm/brand#ToolCallId",
|
|
247
|
+
create: _deepseek_ai_dsh_action_cards_actionCards_act_parameter_1_strict$schema,
|
|
248
|
+
jsonSchema: { "type": "string" }
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
name: "verb",
|
|
253
|
+
description: "`dismiss` or one of the kind's verbs.",
|
|
254
|
+
source: "json",
|
|
255
|
+
codec: {
|
|
256
|
+
mode: "strict",
|
|
257
|
+
typeSymbol: "@deepseek-ai/dsh-action-cards#actionCards/act:verb",
|
|
258
|
+
create: _deepseek_ai_dsh_action_cards_actionCards_act_parameter_2$schema,
|
|
259
|
+
jsonSchema: { "type": "string" }
|
|
260
|
+
},
|
|
261
|
+
strictCodec: {
|
|
262
|
+
mode: "strict",
|
|
263
|
+
typeSymbol: "@deepseek-ai/dsh-action-cards#actionCards/act:verb",
|
|
264
|
+
create: _deepseek_ai_dsh_action_cards_actionCards_act_parameter_2_strict$schema,
|
|
265
|
+
jsonSchema: { "type": "string" }
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
name: "payload",
|
|
270
|
+
description: "kind-defined fields such as a chosen location.",
|
|
271
|
+
source: "json",
|
|
272
|
+
acceptsUndefined: true,
|
|
273
|
+
codec: {
|
|
274
|
+
mode: "strict",
|
|
275
|
+
typeSymbol: "@deepseek-ai/dsh-action-cards#actionCards/act:payload",
|
|
276
|
+
create: _deepseek_ai_dsh_action_cards_actionCards_act_parameter_3$schema,
|
|
277
|
+
jsonSchema: {
|
|
278
|
+
"type": "object",
|
|
279
|
+
"properties": {},
|
|
280
|
+
"required": [],
|
|
281
|
+
"additionalProperties": true
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
strictCodec: {
|
|
285
|
+
mode: "strict",
|
|
286
|
+
typeSymbol: "@deepseek-ai/dsh-action-cards#actionCards/act:payload",
|
|
287
|
+
create: _deepseek_ai_dsh_action_cards_actionCards_act_parameter_3_strict$schema,
|
|
288
|
+
jsonSchema: {
|
|
289
|
+
"type": "object",
|
|
290
|
+
"properties": {},
|
|
291
|
+
"required": [],
|
|
292
|
+
"additionalProperties": true
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
],
|
|
297
|
+
result: {
|
|
298
|
+
mode: "strict",
|
|
299
|
+
typeSymbol: "@deepseek-ai/dsh-action-cards/types#ActionCardResult",
|
|
300
|
+
create: _deepseek_ai_dsh_action_cards_actionCards_act_result$schema,
|
|
301
|
+
description: "acceptance of background work, the decision in effect, or a refusal.",
|
|
302
|
+
jsonSchema: { "oneOf": [
|
|
303
|
+
{
|
|
304
|
+
"type": "object",
|
|
305
|
+
"properties": { "status": {
|
|
306
|
+
"type": "string",
|
|
307
|
+
"const": "accepted"
|
|
308
|
+
} },
|
|
309
|
+
"required": ["status"],
|
|
310
|
+
"additionalProperties": true
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
"type": "object",
|
|
314
|
+
"properties": {
|
|
315
|
+
"status": {
|
|
316
|
+
"type": "string",
|
|
317
|
+
"const": "settled"
|
|
318
|
+
},
|
|
319
|
+
"decision": {
|
|
320
|
+
"type": "object",
|
|
321
|
+
"properties": {
|
|
322
|
+
"callId": { "type": "string" },
|
|
323
|
+
"action": { "type": "string" },
|
|
324
|
+
"phase": { "type": "string" },
|
|
325
|
+
"data": {
|
|
326
|
+
"type": "object",
|
|
327
|
+
"properties": {},
|
|
328
|
+
"required": [],
|
|
329
|
+
"additionalProperties": true,
|
|
330
|
+
"description": "Kind-defined fields such as a chosen location or a created package."
|
|
331
|
+
}
|
|
332
|
+
},
|
|
333
|
+
"required": [
|
|
334
|
+
"callId",
|
|
335
|
+
"action",
|
|
336
|
+
"phase"
|
|
337
|
+
],
|
|
338
|
+
"additionalProperties": true
|
|
339
|
+
}
|
|
340
|
+
},
|
|
341
|
+
"required": ["status", "decision"],
|
|
342
|
+
"additionalProperties": true
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
"type": "object",
|
|
346
|
+
"properties": {
|
|
347
|
+
"status": {
|
|
348
|
+
"type": "string",
|
|
349
|
+
"const": "refused"
|
|
350
|
+
},
|
|
351
|
+
"reason": { "type": "string" }
|
|
352
|
+
},
|
|
353
|
+
"required": ["status", "reason"],
|
|
354
|
+
"additionalProperties": true
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
"type": "object",
|
|
358
|
+
"properties": {
|
|
359
|
+
"status": {
|
|
360
|
+
"type": "string",
|
|
361
|
+
"const": "unconfirmed"
|
|
362
|
+
},
|
|
363
|
+
"reason": { "type": "string" }
|
|
364
|
+
},
|
|
365
|
+
"required": ["status", "reason"],
|
|
366
|
+
"additionalProperties": true
|
|
367
|
+
}
|
|
368
|
+
] }
|
|
369
|
+
},
|
|
370
|
+
sourceLocation: {
|
|
371
|
+
"file": "packages/experimental/action-cards/src/index.ts",
|
|
372
|
+
"line": 338,
|
|
373
|
+
"column": 3
|
|
374
|
+
}
|
|
375
|
+
} }
|
|
376
|
+
}, zod.z);
|
|
377
|
+
//#endregion
|
|
378
|
+
//#region \0dsh-css:/home/runner/work/deepseek-harness/deepseek-harness/packages/experimental/client-ui-action-cards/src/client/Card.module.css.mjs
|
|
379
|
+
const css$1 = ".N10aSW_card{border:.5px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-lg);background:var(--dsw-alias-bg-layer-1);font-family:var(--dsw-font-family);color:var(--dsw-alias-label-primary);margin:16px 0;overflow:hidden}.N10aSW_body{padding:12px 20px 20px}.N10aSW_title{overflow-wrap:anywhere;font-size:16px;font-weight:500;line-height:1.5;display:block}.N10aSW_text{white-space:pre-wrap;overflow-wrap:anywhere;color:var(--dsw-alias-label-secondary);margin:8px 0 0;font-size:13px;line-height:1.7}.N10aSW_toggle{height:auto;min-height:24px;margin:8px 0 0;padding-inline:0;font-size:12px}.N10aSW_status{color:var(--dsw-alias-label-secondary);margin:12px 0 0;font-size:12px;line-height:1.6}.N10aSW_footer{justify-content:flex-end;align-items:center;gap:12px;margin-top:12px;display:flex}";
|
|
380
|
+
const tagId$1 = "@deepseek-ai/dsh-client-ui-action-cards/Card.module.css";
|
|
381
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$1) + "]") === null) {
|
|
382
|
+
const tag = document.createElement("style");
|
|
383
|
+
tag.dataset.plugin = "@deepseek-ai/dsh-client-ui-action-cards";
|
|
384
|
+
tag.dataset.pluginCss = tagId$1;
|
|
385
|
+
tag.textContent = css$1;
|
|
386
|
+
document.head.appendChild(tag);
|
|
387
|
+
}
|
|
388
|
+
var Card_module_css_default = {
|
|
389
|
+
"body": "N10aSW_body",
|
|
390
|
+
"card": "N10aSW_card",
|
|
391
|
+
"footer": "N10aSW_footer",
|
|
392
|
+
"status": "N10aSW_status",
|
|
393
|
+
"text": "N10aSW_text",
|
|
394
|
+
"title": "N10aSW_title",
|
|
395
|
+
"toggle": "N10aSW_toggle"
|
|
396
|
+
};
|
|
397
|
+
//#endregion
|
|
398
|
+
//#region lib/types/client/Card.js
|
|
399
|
+
/** The shared card frame below a completed answer: title, folded brief, and the kind's body or a dismiss-only fallback. */
|
|
400
|
+
/** Graphemes drawn about twice as wide as a Latin letter: CJK scripts, CJK punctuation and fullwidth forms. */
|
|
401
|
+
const WIDE_GRAPHEME = /^[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul} -〿-⦆¢-₩]/u;
|
|
402
|
+
/** Preview budget in Latin-letter widths, about two card lines at desktop width. */
|
|
403
|
+
const FOLD_WIDTH = 260;
|
|
404
|
+
/**
|
|
405
|
+
* Fold omitted text without measuring layout; a wide grapheme counts twice so Chinese and English fold near the
|
|
406
|
+
* same line. The full text is never altered.
|
|
407
|
+
* @param props - text and its localized toggle labels.
|
|
408
|
+
* @returns the paragraph and, when text was omitted, its toggle.
|
|
409
|
+
*/
|
|
410
|
+
function FoldedText({ text, expandLabel, collapseLabel }) {
|
|
411
|
+
const id = (0, react.useId)();
|
|
412
|
+
const [expanded, setExpanded] = (0, react.useState)(false);
|
|
413
|
+
const preview = (0, react.useMemo)(() => {
|
|
414
|
+
const compact = text.replace(/\s+/g, " ").trim();
|
|
415
|
+
const characters = Array.from(new Intl.Segmenter(void 0, { granularity: "grapheme" }).segment(compact), (part) => part.segment);
|
|
416
|
+
let width = 0;
|
|
417
|
+
for (const [index, character] of characters.entries()) {
|
|
418
|
+
width += WIDE_GRAPHEME.test(character) ? 2 : 1;
|
|
419
|
+
if (width > FOLD_WIDTH) return characters.slice(0, index).join("").trimEnd() + "…";
|
|
420
|
+
}
|
|
421
|
+
}, [text]);
|
|
422
|
+
return (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsx)("p", {
|
|
423
|
+
id,
|
|
424
|
+
className: Card_module_css_default.text,
|
|
425
|
+
children: expanded || preview === void 0 ? text : preview
|
|
426
|
+
}), preview !== void 0 && (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
427
|
+
variant: "ghost",
|
|
428
|
+
size: "sm",
|
|
429
|
+
className: Card_module_css_default.toggle,
|
|
430
|
+
"aria-expanded": expanded,
|
|
431
|
+
"aria-controls": id,
|
|
432
|
+
onClick: () => {
|
|
433
|
+
setExpanded((value) => !value);
|
|
434
|
+
},
|
|
435
|
+
children: expanded ? collapseLabel : expandLabel
|
|
436
|
+
})] });
|
|
437
|
+
}
|
|
438
|
+
/** The projection admits at most one card per turn; should several exist, the lowest call id is shown. */
|
|
439
|
+
function proposalOf(view, turn) {
|
|
440
|
+
let found;
|
|
441
|
+
for (const proposal of Object.values(view?.proposals ?? {})) if (proposal.turn === turn && (found === void 0 || proposal.callId < found.callId)) found = proposal;
|
|
442
|
+
return found;
|
|
443
|
+
}
|
|
444
|
+
function decisionOf(view, callId) {
|
|
445
|
+
return view !== void 0 && Object.hasOwn(view.decisions, callId) ? view.decisions[callId] : void 0;
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* Place the card admitted in a turn after that turn's final answer, once the turn has ended with one.
|
|
449
|
+
* @param props - Turn location, projection reader, registered bodies and Session-bound actions.
|
|
450
|
+
* @returns the card, or null while the turn is open or when it ended without answer text.
|
|
451
|
+
*/
|
|
452
|
+
function ActionCardTail({ turn, useProjection, ...props }) {
|
|
453
|
+
const view = useProjection("actionCards");
|
|
454
|
+
const proposal = proposalOf(view, turn.turn);
|
|
455
|
+
return proposal === void 0 || turn.end === void 0 || turn.data.get("turn-tail")?.closing == null ? null : (0, react_jsx_runtime.jsx)(ActionCard, {
|
|
456
|
+
...props,
|
|
457
|
+
proposal,
|
|
458
|
+
decision: decisionOf(view, proposal.callId)
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* Render the frame around one card.
|
|
463
|
+
* @param props - the card, its state, registered bodies and actions.
|
|
464
|
+
* @returns the card section.
|
|
465
|
+
*/
|
|
466
|
+
function ActionCard({ proposal, decision, sessionId, act, bind, useBodies, t }) {
|
|
467
|
+
const body = useBodies((bodies) => bodies.get(proposal.action));
|
|
468
|
+
const send = (0, react.useCallback)((verb, payload) => act(proposal.callId, verb, payload), [act, proposal.callId]);
|
|
469
|
+
const summary = (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsx)("strong", {
|
|
470
|
+
className: Card_module_css_default.title,
|
|
471
|
+
children: proposal.title
|
|
472
|
+
}), (0, react_jsx_runtime.jsx)(FoldedText, {
|
|
473
|
+
text: proposal.brief,
|
|
474
|
+
expandLabel: t("expandBrief"),
|
|
475
|
+
collapseLabel: t("collapseBrief")
|
|
476
|
+
})] });
|
|
477
|
+
const content = body === void 0 ? (0, react_jsx_runtime.jsx)(FallbackBody, {
|
|
478
|
+
summary,
|
|
479
|
+
decision,
|
|
480
|
+
act: send,
|
|
481
|
+
t
|
|
482
|
+
}) : body.render({
|
|
483
|
+
proposal,
|
|
484
|
+
decision,
|
|
485
|
+
sessionId,
|
|
486
|
+
summary,
|
|
487
|
+
Folded: FoldedText,
|
|
488
|
+
act: send
|
|
489
|
+
}, bind(body.locale));
|
|
490
|
+
return (0, react_jsx_runtime.jsx)("section", {
|
|
491
|
+
className: Card_module_css_default.card,
|
|
492
|
+
"aria-label": proposal.title,
|
|
493
|
+
"data-action-card": proposal.callId,
|
|
494
|
+
"data-action": proposal.action,
|
|
495
|
+
children: content
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
/** Phases the fallback can name; other kind phases leave only the summary. */
|
|
499
|
+
const NAMED_PHASES = {
|
|
500
|
+
dismissed: "dismissed",
|
|
501
|
+
replaced: "replaced"
|
|
502
|
+
};
|
|
503
|
+
/** Title, brief and Not now for a card whose kind registered no body in this browser. */
|
|
504
|
+
function FallbackBody({ summary, decision, act, t }) {
|
|
505
|
+
const [pending, setPending] = (0, react.useState)(false);
|
|
506
|
+
const [error, setError] = (0, react.useState)();
|
|
507
|
+
const phase = decision === void 0 || !Object.hasOwn(NAMED_PHASES, decision.phase) ? void 0 : NAMED_PHASES[decision.phase];
|
|
508
|
+
const dismiss = async () => {
|
|
509
|
+
setPending(true);
|
|
510
|
+
setError(void 0);
|
|
511
|
+
try {
|
|
512
|
+
const result = await act("dismiss");
|
|
513
|
+
if (result === void 0) setError("transport");
|
|
514
|
+
else if (result.status === "refused" || result.status === "unconfirmed") setError("unavailable");
|
|
515
|
+
} catch {
|
|
516
|
+
setError("transport");
|
|
517
|
+
} finally {
|
|
518
|
+
setPending(false);
|
|
519
|
+
}
|
|
520
|
+
};
|
|
521
|
+
return (0, react_jsx_runtime.jsxs)("div", {
|
|
522
|
+
className: Card_module_css_default.body,
|
|
523
|
+
children: [
|
|
524
|
+
summary,
|
|
525
|
+
phase !== void 0 && (0, react_jsx_runtime.jsx)("p", {
|
|
526
|
+
role: "status",
|
|
527
|
+
className: Card_module_css_default.status,
|
|
528
|
+
children: t(phase)
|
|
529
|
+
}),
|
|
530
|
+
error !== void 0 && (0, react_jsx_runtime.jsx)("p", {
|
|
531
|
+
role: "alert",
|
|
532
|
+
className: Card_module_css_default.status,
|
|
533
|
+
children: t(error)
|
|
534
|
+
}),
|
|
535
|
+
decision === void 0 && (0, react_jsx_runtime.jsx)("footer", {
|
|
536
|
+
className: Card_module_css_default.footer,
|
|
537
|
+
children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
538
|
+
variant: "ghost",
|
|
539
|
+
size: "sm",
|
|
540
|
+
disabled: pending,
|
|
541
|
+
onClick: () => {
|
|
542
|
+
dismiss();
|
|
543
|
+
},
|
|
544
|
+
children: t("dismiss")
|
|
545
|
+
})
|
|
546
|
+
})
|
|
547
|
+
]
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
//#endregion
|
|
551
|
+
//#region \0dsh-css:/home/runner/work/deepseek-harness/deepseek-harness/packages/experimental/client-ui-action-cards/src/client/ProposeRow.module.css.mjs
|
|
552
|
+
const css = "._29hOxG_summary{min-width:0;color:inherit;align-items:center;gap:8px;margin-left:8px;font-size:12px;display:flex}._29hOxG_summary>:first-child{flex-shrink:0}._29hOxG_title{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}._29hOxG_reason{border-radius:var(--dsw-radius-lg);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-secondary);white-space:pre-wrap;overflow-wrap:anywhere;margin:8px 0;padding:12px;font-size:12px}._29hOxG_inspect{color:var(--dsw-alias-link);font:inherit;cursor:pointer;background:0 0;border:none;align-self:flex-start;padding:4px 0;font-size:12px}";
|
|
553
|
+
const tagId = "@deepseek-ai/dsh-client-ui-action-cards/ProposeRow.module.css";
|
|
554
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
|
|
555
|
+
const tag = document.createElement("style");
|
|
556
|
+
tag.dataset.plugin = "@deepseek-ai/dsh-client-ui-action-cards";
|
|
557
|
+
tag.dataset.pluginCss = tagId;
|
|
558
|
+
tag.textContent = css;
|
|
559
|
+
document.head.appendChild(tag);
|
|
560
|
+
}
|
|
561
|
+
var ProposeRow_module_css_default = {
|
|
562
|
+
"inspect": "_29hOxG_inspect",
|
|
563
|
+
"reason": "_29hOxG_reason",
|
|
564
|
+
"summary": "_29hOxG_summary",
|
|
565
|
+
"title": "_29hOxG_title"
|
|
566
|
+
};
|
|
567
|
+
//#endregion
|
|
568
|
+
//#region lib/types/client/ProposeRow.js
|
|
569
|
+
/** One-line process row for a `propose_action` call: the card title and whether the card was shown. */
|
|
570
|
+
function stateOf(props) {
|
|
571
|
+
if (props.phase === "preparing") return "preparing";
|
|
572
|
+
if (props.phase === "start") return "running";
|
|
573
|
+
if (props.block.error?.code === "interrupted") return "stopped";
|
|
574
|
+
return props.block.isError ? "error" : "ok";
|
|
575
|
+
}
|
|
576
|
+
/**
|
|
577
|
+
* Render a `propose_action` call from its recorded arguments and result. Only a refused call expands, to show
|
|
578
|
+
* why no card followed the answer.
|
|
579
|
+
* @param props - tool call and localized status copy.
|
|
580
|
+
* @returns the status row.
|
|
581
|
+
*/
|
|
582
|
+
function ProposeRow(props) {
|
|
583
|
+
const { block, inspect, t } = props;
|
|
584
|
+
const [expanded, setExpanded] = (0, react.useState)(false);
|
|
585
|
+
const state = stateOf(props);
|
|
586
|
+
const title = block.args.text("title") ?? "";
|
|
587
|
+
const reason = props.phase === "result" && props.block.isError ? props.block.content.flatMap((item) => item.type === "text" ? [item.text] : []).join("\n") : "";
|
|
588
|
+
return (0, react_jsx_runtime.jsx)("div", {
|
|
589
|
+
"data-tool": "propose_action",
|
|
590
|
+
"data-state": state,
|
|
591
|
+
children: (0, react_jsx_runtime.jsxs)(_deepseek_ai_dsh_client_ui_primitives.DisclosureRow, {
|
|
592
|
+
title: t("row.title"),
|
|
593
|
+
icon: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconAppsAddOutlineRegular, { size: 14 }),
|
|
594
|
+
running: state === "preparing" || state === "running",
|
|
595
|
+
open: expanded && reason !== "",
|
|
596
|
+
expandable: reason !== "",
|
|
597
|
+
expandOnRowClick: true,
|
|
598
|
+
keepContentWhenOpen: true,
|
|
599
|
+
onToggle: () => {
|
|
600
|
+
setExpanded((value) => !value);
|
|
601
|
+
},
|
|
602
|
+
collapsedContent: (0, react_jsx_runtime.jsxs)("span", {
|
|
603
|
+
className: ProposeRow_module_css_default.summary,
|
|
604
|
+
children: [(0, react_jsx_runtime.jsx)("span", { children: t(`row.${state}`) }), (0, react_jsx_runtime.jsx)("span", {
|
|
605
|
+
className: ProposeRow_module_css_default.title,
|
|
606
|
+
children: title
|
|
607
|
+
})]
|
|
608
|
+
}),
|
|
609
|
+
children: [(0, react_jsx_runtime.jsx)("pre", {
|
|
610
|
+
className: ProposeRow_module_css_default.reason,
|
|
611
|
+
children: reason
|
|
612
|
+
}), inspect && (0, react_jsx_runtime.jsx)("button", {
|
|
613
|
+
type: "button",
|
|
614
|
+
className: ProposeRow_module_css_default.inspect,
|
|
615
|
+
onClick: inspect,
|
|
616
|
+
children: t("row.inspect")
|
|
617
|
+
})]
|
|
618
|
+
})
|
|
619
|
+
});
|
|
620
|
+
}
|
|
621
|
+
//#endregion
|
|
622
|
+
//#region lib/types/client/registry.js
|
|
623
|
+
/** Card bodies registered by action kind for the shared card frame. */
|
|
624
|
+
/** Card bodies by action; the frame renders a dismiss-only fallback for an action without one. */
|
|
625
|
+
var ActionCardRegistry = class {
|
|
626
|
+
ctx;
|
|
627
|
+
bodies = /* @__PURE__ */ new Map();
|
|
628
|
+
listeners = /* @__PURE__ */ new Set();
|
|
629
|
+
/** Current bodies by action; the snapshot changes on every registration change. */
|
|
630
|
+
source = {
|
|
631
|
+
getSnapshot: () => this.bodies,
|
|
632
|
+
subscribe: (listener) => {
|
|
633
|
+
this.listeners.add(listener);
|
|
634
|
+
return () => {
|
|
635
|
+
this.listeners.delete(listener);
|
|
636
|
+
};
|
|
637
|
+
}
|
|
638
|
+
};
|
|
639
|
+
/** @param ctx - Context whose effects own registered bodies. */
|
|
640
|
+
constructor(ctx) {
|
|
641
|
+
this.ctx = ctx;
|
|
642
|
+
}
|
|
643
|
+
/**
|
|
644
|
+
* Register one kind's body. The caller holds the returned disposer inside its own `ctx.effect`, so the body
|
|
645
|
+
* lives exactly as long as the plugin that contributed it.
|
|
646
|
+
* @param descriptor - the kind's action, locale namespace and body.
|
|
647
|
+
* @returns idempotent disposer.
|
|
648
|
+
* @throws when another body already serves the action.
|
|
649
|
+
*/
|
|
650
|
+
register(descriptor) {
|
|
651
|
+
const { action, locale, Body } = descriptor;
|
|
652
|
+
const body = {
|
|
653
|
+
locale,
|
|
654
|
+
render: (props, t) => (0, react.createElement)(Body, {
|
|
655
|
+
...props,
|
|
656
|
+
t
|
|
657
|
+
})
|
|
658
|
+
};
|
|
659
|
+
const dispose = this.ctx.effect(() => {
|
|
660
|
+
if (this.bodies.has(action)) throw new Error(`action-cards: a body for "${action}" is already registered`);
|
|
661
|
+
this.publish(new Map([...this.bodies, [action, body]]));
|
|
662
|
+
return () => {
|
|
663
|
+
const next = new Map(this.bodies);
|
|
664
|
+
next.delete(action);
|
|
665
|
+
this.publish(next);
|
|
666
|
+
};
|
|
667
|
+
}, `action-cards: body ${action}`);
|
|
668
|
+
return () => {
|
|
669
|
+
dispose();
|
|
670
|
+
};
|
|
671
|
+
}
|
|
672
|
+
publish(bodies) {
|
|
673
|
+
this.bodies = bodies;
|
|
674
|
+
for (const listener of [...this.listeners]) listener();
|
|
675
|
+
}
|
|
676
|
+
};
|
|
677
|
+
//#endregion
|
|
678
|
+
//#region lib/types/client/locales.js
|
|
679
|
+
/** English card frame, fallback and tool-row copy. */
|
|
680
|
+
const en = {
|
|
681
|
+
expandBrief: "Show more",
|
|
682
|
+
collapseBrief: "Show less",
|
|
683
|
+
dismiss: "Not now",
|
|
684
|
+
dismissed: "Dismissed",
|
|
685
|
+
replaced: "Replaced",
|
|
686
|
+
unavailable: "This action is unavailable. Check the plugin in Plugins.",
|
|
687
|
+
transport: "Could not confirm the result. Reconnect and check the card before retrying.",
|
|
688
|
+
"row.title": "Action card",
|
|
689
|
+
"row.preparing": "Preparing a card",
|
|
690
|
+
"row.running": "Proposing",
|
|
691
|
+
"row.ok": "Proposed",
|
|
692
|
+
"row.error": "Not shown",
|
|
693
|
+
"row.stopped": "Interrupted",
|
|
694
|
+
"row.inspect": "Inspect call"
|
|
695
|
+
};
|
|
696
|
+
/** Chinese card frame, fallback and tool-row copy. */
|
|
697
|
+
const zh = {
|
|
698
|
+
expandBrief: "展开",
|
|
699
|
+
collapseBrief: "收起",
|
|
700
|
+
dismiss: "暂不需要",
|
|
701
|
+
dismissed: "已忽略",
|
|
702
|
+
replaced: "已替换",
|
|
703
|
+
unavailable: "暂时无法执行,请到插件页面查看",
|
|
704
|
+
transport: "暂时无法确认结果,请重新连接并查看卡片状态后再重试",
|
|
705
|
+
"row.title": "操作卡片",
|
|
706
|
+
"row.preparing": "正在准备卡片",
|
|
707
|
+
"row.running": "正在提议",
|
|
708
|
+
"row.ok": "已提议",
|
|
709
|
+
"row.error": "未显示",
|
|
710
|
+
"row.stopped": "已中断",
|
|
711
|
+
"row.inspect": "查看调用"
|
|
712
|
+
};
|
|
713
|
+
/** Japanese card frame, fallback and tool-row copy. */
|
|
714
|
+
const ja = {
|
|
715
|
+
expandBrief: "すべて表示",
|
|
716
|
+
collapseBrief: "折りたたむ",
|
|
717
|
+
dismiss: "今はしない",
|
|
718
|
+
dismissed: "却下済み",
|
|
719
|
+
replaced: "置き換え済み",
|
|
720
|
+
unavailable: "この操作は利用できません。プラグイン画面でプラグインを確認してください。",
|
|
721
|
+
transport: "結果を確認できませんでした。再接続してカードを確認してから再試行してください。",
|
|
722
|
+
"row.title": "アクションカード",
|
|
723
|
+
"row.preparing": "カードを準備中",
|
|
724
|
+
"row.running": "提案中",
|
|
725
|
+
"row.ok": "提案済み",
|
|
726
|
+
"row.error": "表示されませんでした",
|
|
727
|
+
"row.stopped": "中断されました",
|
|
728
|
+
"row.inspect": "呼び出しを確認"
|
|
729
|
+
};
|
|
730
|
+
/** Spanish card frame, fallback and tool-row copy. */
|
|
731
|
+
const es = {
|
|
732
|
+
expandBrief: "Mostrar más",
|
|
733
|
+
collapseBrief: "Mostrar menos",
|
|
734
|
+
dismiss: "Ahora no",
|
|
735
|
+
dismissed: "Descartado",
|
|
736
|
+
replaced: "Reemplazado",
|
|
737
|
+
unavailable: "Esta acción no está disponible. Revisa el complemento en Complementos.",
|
|
738
|
+
transport: "No se pudo confirmar el resultado. Vuelve a conectarte y revisa la tarjeta antes de reintentar.",
|
|
739
|
+
"row.title": "Tarjeta de acción",
|
|
740
|
+
"row.preparing": "Preparando una tarjeta",
|
|
741
|
+
"row.running": "Proponiendo",
|
|
742
|
+
"row.ok": "Propuesto",
|
|
743
|
+
"row.error": "No se mostró",
|
|
744
|
+
"row.stopped": "Interrumpido",
|
|
745
|
+
"row.inspect": "Inspeccionar llamada"
|
|
746
|
+
};
|
|
747
|
+
/** French card frame, fallback and tool-row copy. */
|
|
748
|
+
const fr = {
|
|
749
|
+
expandBrief: "Afficher plus",
|
|
750
|
+
collapseBrief: "Afficher moins",
|
|
751
|
+
dismiss: "Pas maintenant",
|
|
752
|
+
dismissed: "Ignoré",
|
|
753
|
+
replaced: "Remplacé",
|
|
754
|
+
unavailable: "Cette action n'est pas disponible. Vérifiez le plugin dans Plugins.",
|
|
755
|
+
transport: "Impossible de confirmer le résultat. Reconnectez-vous et vérifiez la carte avant de réessayer.",
|
|
756
|
+
"row.title": "Carte d'action",
|
|
757
|
+
"row.preparing": "Préparation d'une carte",
|
|
758
|
+
"row.running": "Proposition en cours",
|
|
759
|
+
"row.ok": "Proposé",
|
|
760
|
+
"row.error": "Non affiché",
|
|
761
|
+
"row.stopped": "Interrompu",
|
|
762
|
+
"row.inspect": "Inspecter l'appel"
|
|
763
|
+
};
|
|
764
|
+
/** German card frame, fallback and tool-row copy. */
|
|
765
|
+
const de = {
|
|
766
|
+
expandBrief: "Mehr anzeigen",
|
|
767
|
+
collapseBrief: "Weniger anzeigen",
|
|
768
|
+
dismiss: "Nicht jetzt",
|
|
769
|
+
dismissed: "Verworfen",
|
|
770
|
+
replaced: "Ersetzt",
|
|
771
|
+
unavailable: "Diese Aktion ist nicht verfügbar. Prüfen Sie das Plugin unter Plugins.",
|
|
772
|
+
transport: "Das Ergebnis konnte nicht bestätigt werden. Verbinden Sie sich erneut und prüfen Sie die Karte, bevor Sie es erneut versuchen.",
|
|
773
|
+
"row.title": "Aktionskarte",
|
|
774
|
+
"row.preparing": "Karte wird vorbereitet",
|
|
775
|
+
"row.running": "Wird vorgeschlagen",
|
|
776
|
+
"row.ok": "Vorgeschlagen",
|
|
777
|
+
"row.error": "Nicht angezeigt",
|
|
778
|
+
"row.stopped": "Unterbrochen",
|
|
779
|
+
"row.inspect": "Aufruf prüfen"
|
|
780
|
+
};
|
|
781
|
+
/** Russian card frame, fallback and tool-row copy. */
|
|
782
|
+
const ru = {
|
|
783
|
+
expandBrief: "Показать больше",
|
|
784
|
+
collapseBrief: "Показать меньше",
|
|
785
|
+
dismiss: "Не сейчас",
|
|
786
|
+
dismissed: "Отклонено",
|
|
787
|
+
replaced: "Заменено",
|
|
788
|
+
unavailable: "Это действие недоступно. Проверьте плагин в разделе «Плагины».",
|
|
789
|
+
transport: "Не удалось подтвердить результат. Переподключитесь и проверьте карточку перед повторной попыткой.",
|
|
790
|
+
"row.title": "Карточка действия",
|
|
791
|
+
"row.preparing": "Подготовка карточки",
|
|
792
|
+
"row.running": "Предлагается",
|
|
793
|
+
"row.ok": "Предложено",
|
|
794
|
+
"row.error": "Не показано",
|
|
795
|
+
"row.stopped": "Прервано",
|
|
796
|
+
"row.inspect": "Проверить вызов"
|
|
797
|
+
};
|
|
798
|
+
/** Portuguese card frame, fallback and tool-row copy. */
|
|
799
|
+
const pt = {
|
|
800
|
+
expandBrief: "Mostrar mais",
|
|
801
|
+
collapseBrief: "Mostrar menos",
|
|
802
|
+
dismiss: "Agora não",
|
|
803
|
+
dismissed: "Dispensado",
|
|
804
|
+
replaced: "Substituído",
|
|
805
|
+
unavailable: "Esta ação não está disponível. Verifique o plug-in em Plug-ins.",
|
|
806
|
+
transport: "Não foi possível confirmar o resultado. Reconecte-se e verifique o cartão antes de tentar novamente.",
|
|
807
|
+
"row.title": "Cartão de ação",
|
|
808
|
+
"row.preparing": "Preparando um cartão",
|
|
809
|
+
"row.running": "Propondo",
|
|
810
|
+
"row.ok": "Proposto",
|
|
811
|
+
"row.error": "Não exibido",
|
|
812
|
+
"row.stopped": "Interrompido",
|
|
813
|
+
"row.inspect": "Inspecionar chamada"
|
|
814
|
+
};
|
|
815
|
+
//#endregion
|
|
816
|
+
//#region lib/types/client/mount.js
|
|
817
|
+
/** Registries available before this plugin mounts its Remote. */
|
|
818
|
+
const inject = [
|
|
819
|
+
"slots",
|
|
820
|
+
"locale",
|
|
821
|
+
"remote"
|
|
822
|
+
];
|
|
823
|
+
/**
|
|
824
|
+
* Provide the body registry, then mount the Remote and the UI for the same plugin lifetime.
|
|
825
|
+
* @param ctx - Client plugin context.
|
|
826
|
+
* @param contribution - Generated Remote descriptors supplied by the built entry.
|
|
827
|
+
* @returns disposer removing the UI before the Remote contribution.
|
|
828
|
+
*/
|
|
829
|
+
async function mountActionCards(ctx, contribution) {
|
|
830
|
+
const registry = new ActionCardRegistry(ctx);
|
|
831
|
+
ctx.reflect.provide("actionCards", registry);
|
|
832
|
+
const unmount = await ctx.remote.$mount(contribution);
|
|
833
|
+
const ui = ctx.inject(["remote.actionCards"], (inner) => {
|
|
834
|
+
registerUi(inner, registry);
|
|
835
|
+
});
|
|
836
|
+
try {
|
|
837
|
+
await ui;
|
|
838
|
+
} catch (error) {
|
|
839
|
+
await ui.dispose();
|
|
840
|
+
await unmount();
|
|
841
|
+
throw error;
|
|
842
|
+
}
|
|
843
|
+
return async () => {
|
|
844
|
+
await ui.dispose();
|
|
845
|
+
await unmount();
|
|
846
|
+
};
|
|
847
|
+
}
|
|
848
|
+
function registerUi(ctx, registry) {
|
|
849
|
+
ctx.effect(() => ctx.locale.register("actionCards", {
|
|
850
|
+
en,
|
|
851
|
+
zh,
|
|
852
|
+
ja,
|
|
853
|
+
es,
|
|
854
|
+
fr,
|
|
855
|
+
de,
|
|
856
|
+
ru,
|
|
857
|
+
pt
|
|
858
|
+
}), "action-cards: locale");
|
|
859
|
+
ctx.slots.inject("conversation.chat.turnTail", () => ctx.slots.register({
|
|
860
|
+
name: "conversation.chat.turnTail",
|
|
861
|
+
id: "@deepseek-ai/dsh-client-ui-action-cards",
|
|
862
|
+
locale: "actionCards",
|
|
863
|
+
inject: (sessionId) => ({
|
|
864
|
+
sessionId,
|
|
865
|
+
hooks: { bodies: registry.source },
|
|
866
|
+
bind: (locale) => ctx.locale.bind(locale),
|
|
867
|
+
act: async (callId, verb, payload) => {
|
|
868
|
+
const result = await ctx.remote.actionCards.act(sessionId, callId, verb, payload);
|
|
869
|
+
return result.ok ? result.value : void 0;
|
|
870
|
+
}
|
|
871
|
+
})
|
|
872
|
+
}, ActionCardTail));
|
|
873
|
+
ctx.slots.inject("tool.call.toolview", () => ctx.slots.register({
|
|
874
|
+
name: "tool.call.toolview",
|
|
875
|
+
key: "propose_action",
|
|
876
|
+
locale: "actionCards"
|
|
877
|
+
}, ProposeRow));
|
|
878
|
+
}
|
|
879
|
+
//#endregion
|
|
880
|
+
//#region lib/types/client/index.js
|
|
881
|
+
/**
|
|
882
|
+
* Mount action cards and their Remote.
|
|
883
|
+
* @param ctx - Client plugin context.
|
|
884
|
+
* @returns disposer for every contribution.
|
|
885
|
+
*/
|
|
886
|
+
async function apply(ctx) {
|
|
887
|
+
return await mountActionCards(ctx, TYPERT_REMOTE);
|
|
888
|
+
}
|
|
889
|
+
//#endregion
|
|
890
|
+
exports.apply = apply;
|
|
891
|
+
exports.inject = inject;
|
|
892
|
+
return module.exports;
|
|
893
|
+
}
|
|
894
|
+
});
|
|
895
|
+
|
|
896
|
+
//# sourceMappingURL=client.js.map
|