@xmanrui/dsh-im 5.3.0 → 5.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/PROACTIVE_DELIVERY.en.md +15 -0
- package/PROACTIVE_DELIVERY.md +15 -0
- package/README.en.md +44 -3
- package/README.md +44 -3
- package/THIRD_PARTY_NOTICES.md +209 -0
- package/docs/client-integration.md +2 -2
- package/lib/client.js +3737 -433
- package/lib/index.js +415 -344
- package/package.json +1 -1
- package/plugin-src/client/channel-card-meta.js +6 -2
- package/plugin-src/client/channels/shared/token-api.js +13 -0
- package/plugin-src/client/channels/telegram/group-triggers-settings.js +393 -0
- package/plugin-src/client/channels/telegram/styles.js +4 -0
- package/plugin-src/client/channels/telegram/thinking-traces.js +138 -5
- package/plugin-src/client/delivery-settings.js +23 -3
- package/plugin-src/client/ds-bot-avatar-data.js +537 -0
- package/plugin-src/client/ds-bot-avatar.js +55 -0
- package/plugin-src/client/ds-bot-session-avatars.js +77 -0
- package/plugin-src/client/ds-bot-settings.js +194 -0
- package/plugin-src/client/i18n-ru.js +1615 -0
- package/plugin-src/client/i18n.js +130 -1
- package/plugin-src/client/index.js +20 -2
- package/plugin-src/client/plugin-page.js +3 -8
- package/plugin-src/client/styles.js +25 -5
- package/plugin-src/host/channels/dingtalk/production.mjs +2 -1
- package/plugin-src/host/channels/feishu/production.mjs +13 -5
- package/plugin-src/host/channels/qq/production.mjs +2 -1
- package/plugin-src/host/channels/shared/group-triggers-rpc.mjs +110 -0
- package/plugin-src/host/channels/shared/production.mjs +12 -1
- package/plugin-src/host/channels/shared/rpc.mjs +21 -0
- package/plugin-src/host/channels/shared/send-limit-rpc.mjs +13 -0
- package/plugin-src/host/channels/shared/thinking-cadence-rpc.mjs +16 -0
- package/plugin-src/host/channels/slack/production.mjs +2 -1
- package/plugin-src/host/channels/telegram/index.mjs +1 -0
- package/plugin-src/host/channels/telegram/production.mjs +9 -0
- package/plugin-src/host/channels/telegram/rpc.mjs +17 -2
- package/plugin-src/host/channels/wecom/production.mjs +4 -1
- package/plugin-src/host/channels/wecom-app/production.mjs +2 -1
- package/plugin-src/host/channels/weixin/production.mjs +2 -1
- package/plugin-src/host/channels/whatsapp/production.mjs +2 -1
- package/plugin-src/host/delivery-adapter.mjs +129 -41
- package/plugin-src/host/delivery-rpc.mjs +33 -1
- package/plugin-src/host/delivery-service.mjs +112 -1
- package/plugin-src/host/delivery-suggestions.mjs +11 -0
- package/plugin-src/host/ds-bot-client.mjs +87 -0
- package/plugin-src/host/ds-bot-question-sync.mjs +78 -0
- package/plugin-src/host/index.mjs +8 -1
- package/plugin-src/host/modern-harness-api.mjs +53 -8
- package/plugin-src/host/session-sync-coordinator.mjs +5 -5
- package/scripts/verify-package.mjs +17 -5
- package/src/channels/feishu/bridge.mjs +83 -5
- package/src/channels/feishu/feishu-cards.mjs +11 -7
- package/src/channels/feishu/feishu-runtime.mjs +10 -0
- package/src/channels/feishu/multi-bot-controller.mjs +12 -0
- package/src/channels/shared/AGENTS.md +19 -0
- package/src/channels/shared/bot-workspace-store.mjs +136 -7
- package/src/channels/shared/clear-command.mjs +2 -1
- package/src/channels/shared/compact-command.mjs +2 -1
- package/src/channels/shared/conversation-queue.mjs +49 -0
- package/src/channels/shared/deferred-delivery-coordinator.mjs +2 -1
- package/src/channels/shared/group-history-store.mjs +26 -0
- package/src/channels/shared/harness-client.mjs +5 -4
- package/src/channels/shared/history-command.mjs +2 -1
- package/src/channels/shared/i18n-en/feishu.mjs +1 -0
- package/src/channels/shared/i18n-en/shared-a.mjs +2 -2
- package/src/channels/shared/i18n-en/shared-b.mjs +2 -2
- package/src/channels/shared/i18n-en/shared-c.mjs +3 -2
- package/src/channels/shared/i18n-en/wecom.mjs +4 -0
- package/src/channels/shared/i18n-ru/diagnostics.mjs +104 -0
- package/src/channels/shared/i18n-ru/dingtalk.mjs +96 -0
- package/src/channels/shared/i18n-ru/discord.mjs +10 -0
- package/src/channels/shared/i18n-ru/email.mjs +23 -0
- package/src/channels/shared/i18n-ru/feishu.mjs +374 -0
- package/src/channels/shared/i18n-ru/image-input.mjs +25 -0
- package/src/channels/shared/i18n-ru/matrix.mjs +73 -0
- package/src/channels/shared/i18n-ru/office.mjs +27 -0
- package/src/channels/shared/i18n-ru/permission.mjs +45 -0
- package/src/channels/shared/i18n-ru/qq.mjs +88 -0
- package/src/channels/shared/i18n-ru/shared-a.mjs +236 -0
- package/src/channels/shared/i18n-ru/shared-b.mjs +257 -0
- package/src/channels/shared/i18n-ru/shared-c.mjs +173 -0
- package/src/channels/shared/i18n-ru/slack.mjs +22 -0
- package/src/channels/shared/i18n-ru/telegram.mjs +25 -0
- package/src/channels/shared/i18n-ru/wecom-app.mjs +43 -0
- package/src/channels/shared/i18n-ru/wecom.mjs +79 -0
- package/src/channels/shared/i18n-ru/weixin.mjs +275 -0
- package/src/channels/shared/i18n-ru/whatsapp.mjs +18 -0
- package/src/channels/shared/i18n-ru.mjs +48 -0
- package/src/channels/shared/i18n.mjs +47 -12
- package/src/channels/shared/inbound-access.mjs +1 -1
- package/src/channels/shared/interface-language.mjs +3 -3
- package/src/channels/shared/message-failure.mjs +3 -2
- package/src/channels/shared/model-command.mjs +2 -1
- package/src/channels/shared/permission-command.mjs +2 -1
- package/src/channels/shared/send-limit.mjs +38 -0
- package/src/channels/shared/session-binding-lock.mjs +2 -0
- package/src/channels/shared/session-error.mjs +3 -0
- package/src/channels/shared/status-reaction.mjs +2 -0
- package/src/channels/shared/text-harness-bridge.mjs +4 -0
- package/src/channels/shared/thinking-cadence.mjs +36 -0
- package/src/channels/shared/workspace-command.mjs +2 -1
- package/src/channels/shared/workspace-session.mjs +5 -1
- package/src/channels/telegram/config-store.mjs +38 -1
- package/src/channels/telegram/group-triggers.mjs +229 -0
- package/src/channels/telegram/telegram-api.mjs +223 -32
- package/src/channels/telegram/telegram-bridge.mjs +4 -1
- package/src/channels/telegram/telegram-controller.mjs +139 -1
- package/src/channels/telegram/telegram-runtime.mjs +522 -178
- package/src/channels/telegram/voice.mjs +250 -0
- package/src/channels/wecom/stream-supervisor.mjs +184 -0
- package/src/channels/wecom/wecom-bridge.mjs +25 -11
- package/src/channels/wecom/wecom-runtime.mjs +12 -1
|
@@ -731,6 +731,18 @@ export class MultiBotDshFeishuController {
|
|
|
731
731
|
});
|
|
732
732
|
}
|
|
733
733
|
|
|
734
|
+
async presentSessionSyncQuestion(botId, target, interaction, options = {}) {
|
|
735
|
+
this.#assertOpen();
|
|
736
|
+
return this.#withBotTransition(botId, async () => {
|
|
737
|
+
this.#assertOpen();
|
|
738
|
+
this.#requireBot(botId);
|
|
739
|
+
const runtime = this.#runtimes.get(botId);
|
|
740
|
+
if (!isConnected(connectionStatus(runtime))
|
|
741
|
+
|| typeof runtime.presentSessionSyncQuestion !== 'function') return false;
|
|
742
|
+
return runtime.presentSessionSyncQuestion(target, interaction, options);
|
|
743
|
+
});
|
|
744
|
+
}
|
|
745
|
+
|
|
734
746
|
async disconnectBot(botId) {
|
|
735
747
|
this.#assertOpen();
|
|
736
748
|
// An operational pause only: credentials/config remain durable, so the
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Translating host-side text
|
|
2
|
+
|
|
3
|
+
Host-side user-facing text is written inline in Chinese and passed to `t()` from
|
|
4
|
+
`i18n.mjs`. Chinese is the identity language, so the source literal itself is
|
|
5
|
+
the dictionary key: `t('中文')` renders that Chinese string unless a dictionary
|
|
6
|
+
carries the very same string.
|
|
7
|
+
|
|
8
|
+
- A new source string must be added to EVERY dictionary that exists here: each
|
|
9
|
+
`i18n-<lang>/` area module and the `i18n-<lang>.mjs` module that merges them.
|
|
10
|
+
A language added later inherits the same rule, no code change needed.
|
|
11
|
+
- The key must be the exact literal, byte for byte, including `\n` and the
|
|
12
|
+
names of `{placeholders}`.
|
|
13
|
+
- Placeholders stay byte-identical in the translation. Never rename, translate
|
|
14
|
+
or drop one.
|
|
15
|
+
- Product and channel names (DSH, Cordis, Feishu, Telegram, Slack, Discord,
|
|
16
|
+
WeCom, QQ, Weixin, WhatsApp, Matrix, DingTalk, email) are never translated.
|
|
17
|
+
- `test/channels/shared/i18n-coverage.test.mjs` enforces this rule: a literal
|
|
18
|
+
with no entry in a dictionary fails the build and names the file that added
|
|
19
|
+
it. A prose rule alone would not.
|
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
validateAccessPolicy,
|
|
24
24
|
} from './access-policy.mjs';
|
|
25
25
|
import { CONNECTION_TEST_STATE_IDENTITY } from './connection-test.mjs';
|
|
26
|
+
import { SESSION_BINDING_STATE_IDENTITY } from './session-binding-lock.mjs';
|
|
26
27
|
import {
|
|
27
28
|
DEFAULT_CONTEXT_ENHANCEMENT_CONFIG,
|
|
28
29
|
normalizeContextEnhancementConfig,
|
|
@@ -39,7 +40,9 @@ import { WORKSPACE_SESSION_STALE } from './workspace-session.mjs';
|
|
|
39
40
|
import { configValidationError, withConfigResource } from './config-read-error.mjs';
|
|
40
41
|
|
|
41
42
|
const DELIVERY_DOCUMENT_VERSION = 2;
|
|
42
|
-
|
|
43
|
+
const SESSION_SYNC_DOCUMENT_VERSION = 3;
|
|
44
|
+
const DS_BOT_DOCUMENT_VERSION = 4;
|
|
45
|
+
export const CURRENT_DOCUMENT_VERSION = 5;
|
|
43
46
|
const EMPTY_DOCUMENT = Object.freeze({ version: 1, workspaces: Object.freeze({}) });
|
|
44
47
|
|
|
45
48
|
function invalidWorkspaceConfig(field, issue) {
|
|
@@ -211,7 +214,7 @@ function normalizeDeliveryTargets(value, { version } = {}) {
|
|
|
211
214
|
}
|
|
212
215
|
const normalized = normalizeDeliveryTarget(candidate, {
|
|
213
216
|
targetId,
|
|
214
|
-
allowSessionSync: version >=
|
|
217
|
+
allowSessionSync: version >= SESSION_SYNC_DOCUMENT_VERSION,
|
|
215
218
|
});
|
|
216
219
|
const { targetId: _targetId, ...stored } = normalized;
|
|
217
220
|
normalizedTargets[targetId] = stored;
|
|
@@ -244,9 +247,29 @@ function normalizeAccessPolicies(value, workspaces) {
|
|
|
244
247
|
return accessPolicies;
|
|
245
248
|
}
|
|
246
249
|
|
|
250
|
+
function normalizeDsBotBindings(value) {
|
|
251
|
+
const bindings = Object.create(null);
|
|
252
|
+
if (value === undefined) return bindings;
|
|
253
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
254
|
+
return invalidWorkspaceConfig('dsBotBindings', 'expected-object');
|
|
255
|
+
}
|
|
256
|
+
try {
|
|
257
|
+
for (const [botId, conversations] of Object.entries(value)) {
|
|
258
|
+
botIdOf(botId);
|
|
259
|
+
if (!conversations || typeof conversations !== 'object' || Array.isArray(conversations)) throw new TypeError();
|
|
260
|
+
bindings[botId] = Object.fromEntries(Object.entries(conversations).map(([key, dsBotId]) => (
|
|
261
|
+
[conversationKeyOf(key), dsBotId === null ? null : botIdOf(dsBotId)]
|
|
262
|
+
)));
|
|
263
|
+
}
|
|
264
|
+
} catch {
|
|
265
|
+
return invalidWorkspaceConfig('dsBotBindings', 'invalid-binding');
|
|
266
|
+
}
|
|
267
|
+
return bindings;
|
|
268
|
+
}
|
|
269
|
+
|
|
247
270
|
function normalizeDocument(value) {
|
|
248
271
|
if (!value || typeof value !== 'object' || Array.isArray(value)) return invalidWorkspaceConfig('$', 'expected-object');
|
|
249
|
-
if (![1, DELIVERY_DOCUMENT_VERSION, CURRENT_DOCUMENT_VERSION].includes(value.version)) return invalidWorkspaceConfig('version', 'unsupported-version');
|
|
272
|
+
if (![1, DELIVERY_DOCUMENT_VERSION, SESSION_SYNC_DOCUMENT_VERSION, DS_BOT_DOCUMENT_VERSION, CURRENT_DOCUMENT_VERSION].includes(value.version)) return invalidWorkspaceConfig('version', 'unsupported-version');
|
|
250
273
|
if (!value.workspaces || typeof value.workspaces !== 'object' || Array.isArray(value.workspaces)) return invalidWorkspaceConfig('workspaces', 'expected-object');
|
|
251
274
|
const workspaces = {};
|
|
252
275
|
for (const [index, [botId, workspace]] of Object.entries(value.workspaces).entries()) {
|
|
@@ -298,6 +321,7 @@ function normalizeDocument(value) {
|
|
|
298
321
|
}
|
|
299
322
|
if (value.version === 1 && value.deliveryTargets !== undefined) return invalidWorkspaceConfig('deliveryTargets', 'unexpected-field');
|
|
300
323
|
const deliveryTargets = normalizeDeliveryTargets(value.deliveryTargets, { version: value.version });
|
|
324
|
+
const dsBotBindings = normalizeDsBotBindings(value.dsBotBindings);
|
|
301
325
|
const aliases = Object.create(null);
|
|
302
326
|
if (value.aliases && typeof value.aliases === 'object' && !Array.isArray(value.aliases)) {
|
|
303
327
|
for (const [botId, alias] of Object.entries(value.aliases)) {
|
|
@@ -330,6 +354,7 @@ function normalizeDocument(value) {
|
|
|
330
354
|
models,
|
|
331
355
|
contextEnhancement,
|
|
332
356
|
deliveryTargets,
|
|
357
|
+
dsBotBindings,
|
|
333
358
|
accessPolicies,
|
|
334
359
|
aliases,
|
|
335
360
|
busyMessageModes,
|
|
@@ -344,11 +369,13 @@ function storedDocument({
|
|
|
344
369
|
models,
|
|
345
370
|
contextEnhancement,
|
|
346
371
|
deliveryTargets,
|
|
372
|
+
dsBotBindings,
|
|
347
373
|
accessPolicies,
|
|
348
374
|
aliases,
|
|
349
375
|
busyMessageModes,
|
|
350
376
|
}) {
|
|
351
377
|
const document = { version, workspaces };
|
|
378
|
+
if (Object.keys(dsBotBindings).length > 0) document.dsBotBindings = dsBotBindings;
|
|
352
379
|
if (Object.keys(busyMessageModes).length > 0) document.busyMessageModes = busyMessageModes;
|
|
353
380
|
if (Object.keys(aliases).length > 0) document.aliases = aliases;
|
|
354
381
|
if (Object.keys(conversationWorkspaces).length > 0) {
|
|
@@ -414,6 +441,7 @@ export class BotWorkspaceStore {
|
|
|
414
441
|
#busyMessageModes = Object.create(null);
|
|
415
442
|
#contextEnhancement = {};
|
|
416
443
|
#deliveryTargets = Object.create(null);
|
|
444
|
+
#dsBotBindings = Object.create(null);
|
|
417
445
|
#accessPolicies = Object.create(null);
|
|
418
446
|
#conversationWorkspaces = Object.create(null);
|
|
419
447
|
#generations = new Map();
|
|
@@ -446,6 +474,7 @@ export class BotWorkspaceStore {
|
|
|
446
474
|
this.#busyMessageModes = normalized.busyMessageModes;
|
|
447
475
|
this.#contextEnhancement = normalized.contextEnhancement;
|
|
448
476
|
this.#deliveryTargets = normalized.deliveryTargets;
|
|
477
|
+
this.#dsBotBindings = normalized.dsBotBindings;
|
|
449
478
|
this.#accessPolicies = normalized.accessPolicies;
|
|
450
479
|
this.#conversationWorkspaces = normalized.conversationWorkspaces;
|
|
451
480
|
} catch (error) {
|
|
@@ -458,6 +487,7 @@ export class BotWorkspaceStore {
|
|
|
458
487
|
this.#busyMessageModes = Object.create(null);
|
|
459
488
|
this.#contextEnhancement = {};
|
|
460
489
|
this.#deliveryTargets = Object.create(null);
|
|
490
|
+
this.#dsBotBindings = Object.create(null);
|
|
461
491
|
this.#accessPolicies = Object.create(null);
|
|
462
492
|
this.#conversationWorkspaces = Object.create(null);
|
|
463
493
|
}
|
|
@@ -688,6 +718,49 @@ export class BotWorkspaceStore {
|
|
|
688
718
|
return this.#generations.get(botIdOf(botId)) ?? null;
|
|
689
719
|
}
|
|
690
720
|
|
|
721
|
+
dsBotBindingFor(botId, conversationKey) {
|
|
722
|
+
const dsBotId = this.#dsBotBindings[botId]?.[conversationKey];
|
|
723
|
+
return this.has(botId) && dsBotId ? { botId, conversationKey, dsBotId } : null;
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
listDsBotBindings(botId) {
|
|
727
|
+
return Object.entries(this.#dsBotBindings).flatMap(([id, conversations]) => (
|
|
728
|
+
this.has(id) && (botId === undefined || botId === id)
|
|
729
|
+
? Object.entries(conversations).filter(([, dsBotId]) => dsBotId !== null)
|
|
730
|
+
.map(([conversationKey, dsBotId]) => ({ botId: id, conversationKey, dsBotId }))
|
|
731
|
+
: []
|
|
732
|
+
));
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
dsBotConversationKeys(botId) {
|
|
736
|
+
return this.has(botId) ? Object.keys(this.#dsBotBindings[botId] ?? {}) : [];
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
async setDsBotBinding(botId, conversationKey, dsBotId) {
|
|
740
|
+
const id = botIdOf(botId);
|
|
741
|
+
const key = conversationKeyOf(conversationKey);
|
|
742
|
+
const selected = dsBotId === null ? null : botIdOf(dsBotId);
|
|
743
|
+
return this.#enqueue(id, async () => {
|
|
744
|
+
if (!this.has(id)) throw deliveryTargetError('unknown-bot', 'Unknown bot');
|
|
745
|
+
const conversations = { ...this.#dsBotBindings[id] };
|
|
746
|
+
if (selected !== null && (conversations[key] || Object.values(conversations).includes(selected))) {
|
|
747
|
+
throw deliveryTargetError('ds-bot-binding-conflict', 'DS Bot or private chat is already bound');
|
|
748
|
+
}
|
|
749
|
+
// Keep a confirmed private-chat key after unbinding so it can be selected
|
|
750
|
+
// again without keeping its old DS Bot session mapping alive.
|
|
751
|
+
conversations[key] = selected;
|
|
752
|
+
const next = { ...this.#dsBotBindings, [id]: conversations };
|
|
753
|
+
if (!Object.keys(conversations).length) delete next[id];
|
|
754
|
+
await this.#persist(
|
|
755
|
+
this.#contextEnhancement, this.#deliveryTargets, CURRENT_DOCUMENT_VERSION,
|
|
756
|
+
this.#accessPolicies, this.#aliases, this.#conversationWorkspaces, this.#busyMessageModes, next,
|
|
757
|
+
);
|
|
758
|
+
this.#dsBotBindings = next;
|
|
759
|
+
this.#version = CURRENT_DOCUMENT_VERSION;
|
|
760
|
+
return this.dsBotBindingFor(id, key);
|
|
761
|
+
});
|
|
762
|
+
}
|
|
763
|
+
|
|
691
764
|
async whenIdle() {
|
|
692
765
|
await this.#writeQueue;
|
|
693
766
|
}
|
|
@@ -1359,10 +1432,11 @@ export class BotWorkspaceStore {
|
|
|
1359
1432
|
const hadMessageMode = Object.hasOwn(this.#busyMessageModes, id);
|
|
1360
1433
|
const hadContextEnhancement = Object.hasOwn(this.#contextEnhancement, id);
|
|
1361
1434
|
const hadDeliveryTargets = Object.hasOwn(this.#deliveryTargets, id);
|
|
1435
|
+
const hadDsBotBindings = Object.hasOwn(this.#dsBotBindings, id);
|
|
1362
1436
|
const hadAccessPolicy = Object.hasOwn(this.#accessPolicies, id);
|
|
1363
1437
|
const hadConversationWorkspaces = Object.hasOwn(this.#conversationWorkspaces, id);
|
|
1364
1438
|
const needsCleanup = hadWorkspace || hadPreset || hadModel || hadAlias || hadContextEnhancement
|
|
1365
|
-
|| hadDeliveryTargets || hadAccessPolicy || hadConversationWorkspaces || hadMessageMode
|
|
1439
|
+
|| hadDeliveryTargets || hadDsBotBindings || hadAccessPolicy || hadConversationWorkspaces || hadMessageMode
|
|
1366
1440
|
|| this.#dirtyRemovals.has(id);
|
|
1367
1441
|
delete this.#workspaces[id];
|
|
1368
1442
|
delete this.#agentPresets[id];
|
|
@@ -1371,6 +1445,7 @@ export class BotWorkspaceStore {
|
|
|
1371
1445
|
delete this.#busyMessageModes[id];
|
|
1372
1446
|
delete this.#contextEnhancement[id];
|
|
1373
1447
|
delete this.#deliveryTargets[id];
|
|
1448
|
+
delete this.#dsBotBindings[id];
|
|
1374
1449
|
delete this.#accessPolicies[id];
|
|
1375
1450
|
delete this.#conversationWorkspaces[id];
|
|
1376
1451
|
this.#generations.delete(id);
|
|
@@ -1410,6 +1485,7 @@ export class BotWorkspaceStore {
|
|
|
1410
1485
|
aliases = this.#aliases,
|
|
1411
1486
|
conversationWorkspaces = this.#conversationWorkspaces,
|
|
1412
1487
|
busyMessageModes = this.#busyMessageModes,
|
|
1488
|
+
dsBotBindings = this.#dsBotBindings,
|
|
1413
1489
|
) {
|
|
1414
1490
|
await writeStoredDocument(this.#path, storedDocument({
|
|
1415
1491
|
version,
|
|
@@ -1419,6 +1495,7 @@ export class BotWorkspaceStore {
|
|
|
1419
1495
|
models: this.#models,
|
|
1420
1496
|
contextEnhancement,
|
|
1421
1497
|
deliveryTargets,
|
|
1498
|
+
dsBotBindings,
|
|
1422
1499
|
accessPolicies,
|
|
1423
1500
|
aliases,
|
|
1424
1501
|
busyMessageModes,
|
|
@@ -1434,6 +1511,7 @@ export class BotWorkspaceStore {
|
|
|
1434
1511
|
|| Object.keys(this.#busyMessageModes).length > 0
|
|
1435
1512
|
|| Object.keys(this.#contextEnhancement).length > 0
|
|
1436
1513
|
|| Object.keys(this.#deliveryTargets).length > 0
|
|
1514
|
+
|| Object.keys(this.#dsBotBindings).length > 0
|
|
1437
1515
|
|| Object.keys(this.#accessPolicies).length > 0
|
|
1438
1516
|
|| Object.keys(this.#conversationWorkspaces).length > 0) {
|
|
1439
1517
|
await this.#persist();
|
|
@@ -1564,12 +1642,18 @@ export function observeBotWorkspaceRemovals(
|
|
|
1564
1642
|
|
|
1565
1643
|
export function createBotWorkspaceScope(
|
|
1566
1644
|
harness,
|
|
1567
|
-
{ botId, workspaces, state, agentPresetCatalog } = {},
|
|
1645
|
+
{ botId, workspaces, state, agentPresetCatalog, dsBot } = {},
|
|
1568
1646
|
) {
|
|
1569
1647
|
if (!harness || !workspaces || !state) throw new TypeError('harness, workspaces, and state are required');
|
|
1570
1648
|
const incarnation = workspaces.incarnationFor(botId);
|
|
1571
1649
|
const isCurrentScope = () => workspaces.has(botId)
|
|
1572
1650
|
&& workspaces.incarnationFor(botId) === incarnation;
|
|
1651
|
+
const dsBinding = (key) => workspaces.dsBotBindingFor?.(botId, key);
|
|
1652
|
+
const assertNoDsBinding = (key) => {
|
|
1653
|
+
if (dsBinding(key)) {
|
|
1654
|
+
throw deliveryTargetError('ds-bot-bound', '请先在“绑定bot”中解除绑定,再切换会话或工作目录。');
|
|
1655
|
+
}
|
|
1656
|
+
};
|
|
1573
1657
|
const presetSettings = async (catalog = agentPresetCatalog) => {
|
|
1574
1658
|
let normalizedCatalog;
|
|
1575
1659
|
try {
|
|
@@ -1694,6 +1778,27 @@ export function createBotWorkspaceScope(
|
|
|
1694
1778
|
|
|
1695
1779
|
const scopedHarness = new Proxy(harness, {
|
|
1696
1780
|
get(target, property) {
|
|
1781
|
+
if (property === 'resolveDsBotSession') {
|
|
1782
|
+
return async (key) => {
|
|
1783
|
+
assertCurrentBotScope(isCurrentScope);
|
|
1784
|
+
const binding = dsBinding(key);
|
|
1785
|
+
if (!binding) return null;
|
|
1786
|
+
if (!dsBot) throw deliveryTargetError('ds-bot-unavailable', 'DS Bot 当前不可用,请检查插件状态。');
|
|
1787
|
+
const bot = await dsBot.resolve(binding.dsBotId);
|
|
1788
|
+
if (!(await target.sessionExists(bot.sessionId))) {
|
|
1789
|
+
throw deliveryTargetError('ds-bot-not-found', 'DS Bot 的当前会话不可用。');
|
|
1790
|
+
}
|
|
1791
|
+
assertCurrentBotScope(isCurrentScope);
|
|
1792
|
+
if (dsBinding(key)?.dsBotId !== binding.dsBotId) throw workspaceSessionStale('DS Bot binding changed');
|
|
1793
|
+
if (state.sessionFor(key) !== bot.sessionId) await state.setSession(key, bot.sessionId);
|
|
1794
|
+
sessionGenerations.set(bot.sessionId, {
|
|
1795
|
+
generation: workspaces.generationFor(botId),
|
|
1796
|
+
conversationKey: key,
|
|
1797
|
+
conversationGeneration: currentConversationGeneration(key),
|
|
1798
|
+
});
|
|
1799
|
+
return bot.sessionId;
|
|
1800
|
+
};
|
|
1801
|
+
}
|
|
1697
1802
|
if (property === 'agentPresetSettings') {
|
|
1698
1803
|
return async (options = {}) => {
|
|
1699
1804
|
options?.signal?.throwIfAborted();
|
|
@@ -1780,6 +1885,9 @@ export function createBotWorkspaceScope(
|
|
|
1780
1885
|
}
|
|
1781
1886
|
if (property === 'switchWorkspace') {
|
|
1782
1887
|
return (workspace) => {
|
|
1888
|
+
if (workspaces.listDsBotBindings(botId).length > 0) {
|
|
1889
|
+
throw deliveryTargetError('ds-bot-bound', '请先解除 DS Bot 绑定,再切换机器人工作目录。');
|
|
1890
|
+
}
|
|
1783
1891
|
if (!isCurrentScope()) {
|
|
1784
1892
|
const error = new Error('找不到要修改的机器人。');
|
|
1785
1893
|
error.code = 'workspace-bot-not-found';
|
|
@@ -1820,6 +1928,7 @@ export function createBotWorkspaceScope(
|
|
|
1820
1928
|
}
|
|
1821
1929
|
if (property === 'switchConversationWorkspace') {
|
|
1822
1930
|
return (conversationKey, workspace) => {
|
|
1931
|
+
assertNoDsBinding(conversationKey);
|
|
1823
1932
|
if (!isCurrentScope()) {
|
|
1824
1933
|
const error = new Error('找不到要修改的机器人。');
|
|
1825
1934
|
error.code = 'workspace-bot-not-found';
|
|
@@ -1841,6 +1950,7 @@ export function createBotWorkspaceScope(
|
|
|
1841
1950
|
}
|
|
1842
1951
|
if (property === 'clearConversationWorkspace') {
|
|
1843
1952
|
return (conversationKey) => {
|
|
1953
|
+
assertNoDsBinding(conversationKey);
|
|
1844
1954
|
if (!isCurrentScope()) {
|
|
1845
1955
|
const error = new Error('找不到要修改的机器人。');
|
|
1846
1956
|
error.code = 'workspace-bot-not-found';
|
|
@@ -1860,6 +1970,7 @@ export function createBotWorkspaceScope(
|
|
|
1860
1970
|
}
|
|
1861
1971
|
if (property === 'bindWorkspaceSession') {
|
|
1862
1972
|
return async (conversationKey, sessionId) => {
|
|
1973
|
+
assertNoDsBinding(conversationKey);
|
|
1863
1974
|
if (typeof conversationKey !== 'string' || !conversationKey
|
|
1864
1975
|
|| typeof sessionId !== 'string' || !sessionId) {
|
|
1865
1976
|
throw new TypeError('conversationKey and sessionId are required');
|
|
@@ -1934,6 +2045,7 @@ export function createBotWorkspaceScope(
|
|
|
1934
2045
|
if (property === 'createSession') {
|
|
1935
2046
|
return async (options = {}) => {
|
|
1936
2047
|
const { inheritBotModel = true, conversationKey, ...createOptions } = options;
|
|
2048
|
+
assertNoDsBinding(conversationKey);
|
|
1937
2049
|
// /conv publishes its generation before path validation enters the
|
|
1938
2050
|
// bot queue. Wait for both phases before pairing a workspace with its
|
|
1939
2051
|
// generation; otherwise a new session can carry a new fence but old cwd.
|
|
@@ -2016,7 +2128,9 @@ export function createBotWorkspaceScope(
|
|
|
2016
2128
|
: null;
|
|
2017
2129
|
// Copy provenance into the immutable handle, but retain it for a later
|
|
2018
2130
|
// setSession (notably /model, which binds after asynchronous selection).
|
|
2131
|
+
const dsBotId = dsBinding(conversationKey)?.dsBotId;
|
|
2019
2132
|
const isCurrentSession = () => isCurrentScope()
|
|
2133
|
+
&& dsBinding(conversationKey)?.dsBotId === dsBotId
|
|
2020
2134
|
&& generation === workspaces.generationFor(botId)
|
|
2021
2135
|
&& !conversationGenerationIsStale(conversationKey, conversationGeneration);
|
|
2022
2136
|
const invokeCurrentSession = async (method, args, action) => {
|
|
@@ -2067,6 +2181,7 @@ export function createBotWorkspaceScope(
|
|
|
2067
2181
|
},
|
|
2068
2182
|
} : {}),
|
|
2069
2183
|
selectModel(...args) {
|
|
2184
|
+
if (dsBotId) throw deliveryTargetError('ds-bot-bound', '请在 DS Bot 中修改模型。');
|
|
2070
2185
|
return invokeCurrentSession('selectSessionModel', args, 'model selection');
|
|
2071
2186
|
},
|
|
2072
2187
|
isRunning(...args) {
|
|
@@ -2089,12 +2204,19 @@ export function createBotWorkspaceScope(
|
|
|
2089
2204
|
return invokeStartedSessionMutation('executeCommand', args, 'command execution');
|
|
2090
2205
|
},
|
|
2091
2206
|
} : {}),
|
|
2092
|
-
ask(...args) {
|
|
2207
|
+
async ask(...args) {
|
|
2093
2208
|
if (!isCurrentSession()) {
|
|
2094
2209
|
throw workspaceSessionStale(
|
|
2095
2210
|
'The bot workspace changed before this prompt started.',
|
|
2096
2211
|
);
|
|
2097
2212
|
}
|
|
2213
|
+
if (dsBotId) {
|
|
2214
|
+
const bot = await dsBot?.resolve(dsBotId);
|
|
2215
|
+
if (!bot) throw deliveryTargetError('ds-bot-unavailable', 'DS Bot 当前不可用。');
|
|
2216
|
+
if (bot.sessionId !== sessionId || !isCurrentSession()) {
|
|
2217
|
+
throw workspaceSessionStale('DS Bot changed before this prompt started.');
|
|
2218
|
+
}
|
|
2219
|
+
}
|
|
2098
2220
|
return target.ask(sessionId, ...args);
|
|
2099
2221
|
},
|
|
2100
2222
|
});
|
|
@@ -2138,7 +2260,7 @@ export function createBotWorkspaceScope(
|
|
|
2138
2260
|
});
|
|
2139
2261
|
const scopedState = new Proxy(state, {
|
|
2140
2262
|
get(target, property) {
|
|
2141
|
-
if (property === CONNECTION_TEST_STATE_IDENTITY) return target;
|
|
2263
|
+
if (property === CONNECTION_TEST_STATE_IDENTITY || property === SESSION_BINDING_STATE_IDENTITY) return target;
|
|
2142
2264
|
if (property === 'sessionFor') {
|
|
2143
2265
|
return (key, ...args) => {
|
|
2144
2266
|
if (!isCurrentScope()) return null;
|
|
@@ -2164,6 +2286,7 @@ export function createBotWorkspaceScope(
|
|
|
2164
2286
|
}
|
|
2165
2287
|
if (property === 'setSession') {
|
|
2166
2288
|
return (key, sessionId, ...args) => {
|
|
2289
|
+
if (dsBinding(key) && target.sessionFor(key) !== sessionId) assertNoDsBinding(key);
|
|
2167
2290
|
const entry = sessionGenerations.get(sessionId);
|
|
2168
2291
|
if (!isCurrentScope() || generationIsStale(entry, key)) {
|
|
2169
2292
|
return false;
|
|
@@ -2171,6 +2294,12 @@ export function createBotWorkspaceScope(
|
|
|
2171
2294
|
return target.setSession(key, sessionId, ...args);
|
|
2172
2295
|
};
|
|
2173
2296
|
}
|
|
2297
|
+
if (property === 'clearSession') {
|
|
2298
|
+
return (key, ...args) => {
|
|
2299
|
+
assertNoDsBinding(key);
|
|
2300
|
+
return target.clearSession(key, ...args);
|
|
2301
|
+
};
|
|
2302
|
+
}
|
|
2174
2303
|
const value = Reflect.get(target, property, target);
|
|
2175
2304
|
return typeof value === 'function' ? value.bind(target) : value;
|
|
2176
2305
|
},
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isSessionNotFound } from './session-error.mjs';
|
|
1
2
|
import { t } from './i18n.mjs';
|
|
2
3
|
import { WORKSPACE_SESSION_STALE } from './workspace-session.mjs';
|
|
3
4
|
|
|
@@ -10,7 +11,7 @@ function commandResult(message) {
|
|
|
10
11
|
|
|
11
12
|
function clearErrorMessage(error) {
|
|
12
13
|
const code = error?.code ?? error?.failure?.code;
|
|
13
|
-
if (code
|
|
14
|
+
if (isSessionNotFound(code)) {
|
|
14
15
|
return t('当前聊天绑定的会话已不存在,未清空上下文;请先发送新消息开启会话。');
|
|
15
16
|
}
|
|
16
17
|
if (code === 'agent-busy' || code === 'pending-interaction') {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isSessionNotFound } from './session-error.mjs';
|
|
1
2
|
import { t } from './i18n.mjs';
|
|
2
3
|
import { WORKSPACE_SESSION_STALE } from './workspace-session.mjs';
|
|
3
4
|
|
|
@@ -51,7 +52,7 @@ function compactResultText(result) {
|
|
|
51
52
|
|
|
52
53
|
function compactErrorMessage(error) {
|
|
53
54
|
const code = error?.code ?? error?.failure?.code;
|
|
54
|
-
if (code
|
|
55
|
+
if (isSessionNotFound(code)) {
|
|
55
56
|
return t('当前聊天绑定的会话已不存在,请发送新消息开启会话。');
|
|
56
57
|
}
|
|
57
58
|
if (code === 'agent-busy') return t('当前会话正在生成回复,请稍后重试。');
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// conversation-queue.mjs — serialise work per conversation without blocking others.
|
|
2
|
+
//
|
|
3
|
+
// A channel may need to do expensive prep work (audio download and
|
|
4
|
+
// transcription, for example) before a message reaches the Harness. Awaiting it
|
|
5
|
+
// inside the transport loop stalls every other conversation and the update
|
|
6
|
+
// cursor alike, so the work is queued per conversation instead: ordering inside
|
|
7
|
+
// one chat is preserved, other chats and callbacks proceed immediately.
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Create a per-key promise chain.
|
|
11
|
+
*
|
|
12
|
+
* @param {{ onError?: (error: unknown, key: string) => void }} options
|
|
13
|
+
* @returns {{ run: (key: string, task: () => Promise<unknown>) => Promise<unknown>,
|
|
14
|
+
* idle: (key?: string) => Promise<void>, size: () => number }}
|
|
15
|
+
*/
|
|
16
|
+
export function createConversationQueue({ onError = null } = {}) {
|
|
17
|
+
/** @type {Map<string, Promise<unknown>>} */
|
|
18
|
+
const chains = new Map();
|
|
19
|
+
|
|
20
|
+
const run = (key, task) => {
|
|
21
|
+
const previous = chains.get(key) ?? Promise.resolve();
|
|
22
|
+
const next = previous
|
|
23
|
+
.catch(() => {})
|
|
24
|
+
.then(() => task())
|
|
25
|
+
.catch((error) => {
|
|
26
|
+
onError?.(error, key);
|
|
27
|
+
})
|
|
28
|
+
.finally(() => {
|
|
29
|
+
// The tail of the chain is dropped once it settles, so a quiet
|
|
30
|
+
// conversation holds no state.
|
|
31
|
+
if (chains.get(key) === next) chains.delete(key);
|
|
32
|
+
});
|
|
33
|
+
chains.set(key, next);
|
|
34
|
+
return next;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
return {
|
|
38
|
+
run,
|
|
39
|
+
async idle(key) {
|
|
40
|
+
if (key === undefined) {
|
|
41
|
+
while (chains.size > 0) await Promise.all([...chains.values()]);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const chain = chains.get(key);
|
|
45
|
+
if (chain) await chain;
|
|
46
|
+
},
|
|
47
|
+
size: () => chains.size,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isSessionNotFound } from './session-error.mjs';
|
|
1
2
|
import { createDeferredDeliveryRegistry, extractCompletedTurnAnswer } from './deferred-delivery.mjs';
|
|
2
3
|
import { t } from './i18n.mjs';
|
|
3
4
|
import { channelDeliveryFailure } from './message-failure.mjs';
|
|
@@ -159,7 +160,7 @@ export function createDeferredDeliveryCoordinator({
|
|
|
159
160
|
return 'delivered';
|
|
160
161
|
} catch (error) {
|
|
161
162
|
if (activeSignal.aborted) return 'none';
|
|
162
|
-
if (error?.code
|
|
163
|
+
if (isSessionNotFound(error?.code)) { await remove(entry); return 'none'; }
|
|
163
164
|
const current = await pending(id);
|
|
164
165
|
if (!current) return 'none';
|
|
165
166
|
if (!sending) {
|
|
@@ -320,6 +320,32 @@ export class GroupHistoryStore {
|
|
|
320
320
|
coverage: 'Only messages actually received by this plugin; not complete platform history.' };
|
|
321
321
|
}
|
|
322
322
|
|
|
323
|
+
/**
|
|
324
|
+
* Groups this channel has archived, newest activity first.
|
|
325
|
+
*
|
|
326
|
+
* Used by channel settings that are scoped per chat (Telegram's per-group
|
|
327
|
+
* reply rules) so the panel can offer real chat IDs with their titles.
|
|
328
|
+
*/
|
|
329
|
+
async listGroups({ channel } = {}) {
|
|
330
|
+
await this.ready();
|
|
331
|
+
if (!GROUP_HISTORY_CHANNELS.includes(channel)) return [];
|
|
332
|
+
const rows = this.#db.prepare(`SELECT g.platform_group_id AS chat_id, g.name AS title,
|
|
333
|
+
g.last_received_at AS last_received_at, g.capability AS capability,
|
|
334
|
+
(SELECT m.sender_name FROM messages m WHERE m.group_id = g.id
|
|
335
|
+
ORDER BY m.sent_at DESC, m.received_at DESC LIMIT 1) AS last_sender_name
|
|
336
|
+
FROM groups g WHERE g.channel = ? ORDER BY coalesce(g.last_received_at, 0) DESC`).all(channel);
|
|
337
|
+
return rows.map((row) => ({
|
|
338
|
+
chatId: String(row.chat_id),
|
|
339
|
+
title: typeof row.title === 'string' && row.title ? row.title : null,
|
|
340
|
+
// The archive stores no chat type; the platform reported a group.
|
|
341
|
+
type: null,
|
|
342
|
+
lastSeenAt: Number.isSafeInteger(row.last_received_at) && row.last_received_at > 0
|
|
343
|
+
? new Date(row.last_received_at).toISOString() : null,
|
|
344
|
+
lastSenderName: typeof row.last_sender_name === 'string' && row.last_sender_name
|
|
345
|
+
? row.last_sender_name : null,
|
|
346
|
+
}));
|
|
347
|
+
}
|
|
348
|
+
|
|
323
349
|
async materialize(groupId, attachmentId, workspace) {
|
|
324
350
|
await this.ready();
|
|
325
351
|
if (this.#settingsError) throw invalid(this.#settingsError);
|
|
@@ -25,6 +25,7 @@ import { t } from './i18n.mjs';
|
|
|
25
25
|
import { watchHarnessMux } from './harness-mux.mjs';
|
|
26
26
|
import { extractConnectionEvidence, messageDiagnosticError } from './connection-error.mjs';
|
|
27
27
|
import { PromptFailureTracker } from './prompt-failure-tracker.mjs';
|
|
28
|
+
import { isSessionNotFound } from './session-error.mjs';
|
|
28
29
|
|
|
29
30
|
// Every channel plugin runs in the same Host process. Sharing ownership by
|
|
30
31
|
// Host identity (or an explicitly configured HTTP origin) prevents clients
|
|
@@ -1420,7 +1421,7 @@ export class HarnessClient {
|
|
|
1420
1421
|
} catch (error) {
|
|
1421
1422
|
if (options?.signal?.aborted) throw options.signal.reason ?? error;
|
|
1422
1423
|
if (error instanceof HarnessRpcError
|
|
1423
|
-
&& ['internal', 'gateway/internal'
|
|
1424
|
+
&& (['internal', 'gateway/internal'].includes(error.code) || isSessionNotFound(error.code))) {
|
|
1424
1425
|
throw await this.#confirmedArchiveError(payload.sessionId, { signal: options?.signal }, error) ?? error;
|
|
1425
1426
|
}
|
|
1426
1427
|
throw error;
|
|
@@ -1436,7 +1437,7 @@ export class HarnessClient {
|
|
|
1436
1437
|
return true;
|
|
1437
1438
|
} catch (error) {
|
|
1438
1439
|
if (error.code === 'session-archived') return true;
|
|
1439
|
-
if (error instanceof HarnessRpcError && error.code
|
|
1440
|
+
if (error instanceof HarnessRpcError && isSessionNotFound(error.code)) return false;
|
|
1440
1441
|
throw error;
|
|
1441
1442
|
}
|
|
1442
1443
|
}
|
|
@@ -1610,7 +1611,7 @@ export class HarnessClient {
|
|
|
1610
1611
|
);
|
|
1611
1612
|
this.#consumeInteractionOwnerships(sessionId, history.events ?? []);
|
|
1612
1613
|
} catch (error) {
|
|
1613
|
-
if (!(error instanceof HarnessRpcError) || error.code
|
|
1614
|
+
if (!(error instanceof HarnessRpcError) || !isSessionNotFound(error.code)) throw error;
|
|
1614
1615
|
for (const ownership of candidates) {
|
|
1615
1616
|
ownership.active = false;
|
|
1616
1617
|
ownership.completed = true;
|
|
@@ -1681,7 +1682,7 @@ export class HarnessClient {
|
|
|
1681
1682
|
if (this.#activeControlOwnership(sessionId, control) === ownership) {
|
|
1682
1683
|
ownership.stopRequested = false;
|
|
1683
1684
|
}
|
|
1684
|
-
if (error instanceof HarnessRpcError && error.code
|
|
1685
|
+
if (error instanceof HarnessRpcError && isSessionNotFound(error.code)) return false;
|
|
1685
1686
|
throw error;
|
|
1686
1687
|
}
|
|
1687
1688
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isSessionNotFound } from './session-error.mjs';
|
|
1
2
|
import { isDeepStrictEqual } from 'node:util';
|
|
2
3
|
|
|
3
4
|
import { t } from './i18n.mjs';
|
|
@@ -90,7 +91,7 @@ function formatHistory(sessionId, records, requested, hasMore) {
|
|
|
90
91
|
|
|
91
92
|
function historyErrorMessage(error) {
|
|
92
93
|
const code = error?.code ?? error?.failure?.code;
|
|
93
|
-
if (code
|
|
94
|
+
if (isSessionNotFound(code)) return t('当前聊天绑定的会话已不存在,请重新绑定会话。');
|
|
94
95
|
if (code === WORKSPACE_SESSION_STALE || code === 'workspace-bot-not-found'
|
|
95
96
|
|| code === 'session-binding-changed') return t('会话、工作区或机器人状态已发生变化,请重新执行 /history。');
|
|
96
97
|
if (code === 'harness-api-not-found') return t('当前 Harness 暂不支持读取会话历史。');
|
|
@@ -392,6 +392,7 @@ export default {
|
|
|
392
392
|
'🔐 工具审批': '🔐 Tool approval',
|
|
393
393
|
// feishu/feishu-cards.mjs — question card
|
|
394
394
|
'❓ 请补充信息{progress}': '❓ Please provide more information{progress}',
|
|
395
|
+
'选择 {number}': 'Select {number}',
|
|
395
396
|
// feishu/bridge.mjs — deferred delivery terminal statuses
|
|
396
397
|
'后台任务已结束({reason}),没有可推送的最终结果。':
|
|
397
398
|
'The background task has finished ({reason}); there is no final result to deliver.',
|
|
@@ -80,8 +80,8 @@ export default {
|
|
|
80
80
|
'The model reached its output limit without producing a displayable result. Reduce the task scope and try again.',
|
|
81
81
|
'本轮处理被阻止,未能完成。请在 DSH 中查看会话状态和相关提示。':
|
|
82
82
|
'This turn was blocked and did not finish. Check the Session status and related notices in DSH.',
|
|
83
|
-
'
|
|
84
|
-
'The current Session is archived and cannot continue.
|
|
83
|
+
'当前会话已归档,无法继续处理。有命令权限时可发送 /new 创建新会话;否则请联系管理员在 DSH 中取消归档,或为你开启命令权限。':
|
|
84
|
+
'The current Session is archived and cannot continue. If you have command permission, send /new to create a new Session. Otherwise, ask an administrator to unarchive it in DSH or grant you command permission.',
|
|
85
85
|
'本条消息可能仍在会话队列中,请先到 DSH 查看状态,避免重复提交。':
|
|
86
86
|
'This message may still be queued in the Session. Check its status in DSH before submitting it again.',
|
|
87
87
|
'任务被意外中断,本次未完成。请重试。':
|
|
@@ -3,8 +3,8 @@ export default {
|
|
|
3
3
|
// workspace-command.mjs
|
|
4
4
|
'用法:/session Session ID 或当前工作区序号(/session N)':
|
|
5
5
|
'Usage: /session Session ID or the session index in the current Workspace (/session N)',
|
|
6
|
-
'用法:\n/sessionlist 列出当前工作区会话\n/sessionlist --limit N 列出当前工作区前 N 个会话(N 为正整数)\n/sessionlist 工作区序号 按 /workspacelist 序号列出会话\n/sessionlist 工作区绝对路径
|
|
7
|
-
'Usage:\n/sessionlist List Sessions in the current Workspace\n/sessionlist --limit N List the first N Sessions in the current Workspace (N must be a positive integer)\n/sessionlist Workspace index List Sessions by /workspacelist index\n/sessionlist Workspace absolute path List Sessions in the given Workspace',
|
|
6
|
+
'用法:\n/sessionlist 列出当前工作区会话\n/sessionlist --limit N 列出当前工作区前 N 个会话(N 为正整数)\n/sessionlist 工作区序号 按 /workspacelist 序号列出会话\n/sessionlist 工作区绝对路径 列出指定工作区会话\n不带工作区参数时,默认列出当前对话的有效工作区(未设置对话专属工作区时即 bot 默认工作区)。':
|
|
7
|
+
'Usage:\n/sessionlist List Sessions in the current Workspace\n/sessionlist --limit N List the first N Sessions in the current Workspace (N must be a positive integer)\n/sessionlist Workspace index List Sessions by /workspacelist index\n/sessionlist Workspace absolute path List Sessions in the given Workspace\nWithout a workspace argument it lists the workspace this conversation effectively uses (the bot default when no conversation workspace is set).',
|
|
8
8
|
'工作区必须是绝对路径。\n{usage}': 'The Workspace must be an absolute path.\n{usage}',
|
|
9
9
|
'工作区路径包含不支持的字符或长度超过限制。\n{usage}':
|
|
10
10
|
'The Workspace path contains unsupported characters or exceeds the length limit.\n{usage}',
|
|
@@ -77,6 +77,7 @@ export default {
|
|
|
77
77
|
'机器人端无法处理这次审批,请到 Web 查看。': 'The bot cannot handle this approval. Please check the Web interface.',
|
|
78
78
|
'未找到可处理端,本次操作未获批准。': 'No approval interface is available. This operation was not approved.',
|
|
79
79
|
'有操作在等待审批:{tool},请到 Web 处理。': 'An operation is awaiting approval: {tool}. Please handle it in the Web interface.',
|
|
80
|
+
'本会话有问题等待回答,请在桌面端回答。': 'This session has a pending question. Please answer it in the desktop app.',
|
|
80
81
|
'无法完整展示这次操作,已安全拒绝此次审批。':
|
|
81
82
|
'The operation could not be displayed in full, so this approval was safely rejected.',
|
|
82
83
|
'审批提交失败,请重新回复「批准」或「拒绝」。':
|
|
@@ -205,6 +206,6 @@ export default {
|
|
|
205
206
|
'Collected {count}/{limit} messages. The batch is full; send /send or /cancel.',
|
|
206
207
|
'批量内容提交失败,已保留 {count} 条消息。\n请再次发送 /send 重试或 /cancel 取消。':
|
|
207
208
|
'Batch submission failed; {count} messages were retained.\nSend /send to retry or /cancel to cancel.',
|
|
208
|
-
'
|
|
209
|
-
'You can send regular messages, but you do not have permission to run commands.',
|
|
209
|
+
'你可以发送普通消息,但没有执行命令的权限。请联系管理员在 DSH 设置 → IM机器人 → 对应机器人 → 访问设置中,为你开启当前私聊或群聊场景的命令权限后重试。':
|
|
210
|
+
'You can send regular messages, but you do not have permission to run commands. Ask an administrator to grant you command permission for the current direct or group chat under DSH Settings → IM Bots → the relevant bot → Access Settings, then try again.',
|
|
210
211
|
};
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
// English translations (wecom area). Keys are exact Chinese literals passed to t().
|
|
2
2
|
export default {
|
|
3
|
+
'▣ 第 {segment} 段 · 任务仍在进行,继续见下一条 ↓':
|
|
4
|
+
'▣ Part {segment} · Task still running, continuing in the next message ↓',
|
|
5
|
+
'继续执行中…': 'Continuing…',
|
|
6
|
+
'仍在执行中…': 'Still working…',
|
|
3
7
|
'/menu 或 /m 打开可点击的功能菜单': '/menu or /m Open the interactive menu',
|
|
4
8
|
'保持当前': 'Keep current',
|
|
5
9
|
'会话': 'Session',
|