@michengai/dsh-btw 0.1.9 → 0.1.10
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 +5 -0
- package/CHANGELOG.zh-CN.md +5 -0
- package/README.md +2 -2
- package/README.zh-CN.md +2 -2
- package/lib/client.js +189 -139
- package/lib/index.js +16 -2
- package/lib/types/locales.d.ts +1 -0
- package/package.json +2 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.1.10] - 2026-09-18
|
|
4
|
+
|
|
5
|
+
- List `/btw` in the official command catalog with a label, description, and icon.
|
|
6
|
+
- Keep independent bubbles when submitting from the official catalog; side questions still do not run tools.
|
|
7
|
+
|
|
3
8
|
## [0.1.9] - 2026-09-18
|
|
4
9
|
|
|
5
10
|
- Support DSH `0.1.6-alpha.2` while retaining compatibility with the six previously supported host versions.
|
package/CHANGELOG.zh-CN.md
CHANGED
package/README.md
CHANGED
|
@@ -37,9 +37,9 @@ The main conversation stays in place, with the side answer above the composer.
|
|
|
37
37
|
|
|
38
38
|
### Command menu
|
|
39
39
|
|
|
40
|
-
Type `/` and select `btw` under
|
|
40
|
+
Type `/` and select `btw` under Commands, or enter `/btw your question` directly.
|
|
41
41
|
|
|
42
|
-

|
|
43
43
|
|
|
44
44
|
### Independent answer bubbles
|
|
45
45
|
|
package/README.zh-CN.md
CHANGED
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
|
|
38
38
|
### 命令入口
|
|
39
39
|
|
|
40
|
-
输入 `/`
|
|
40
|
+
输入 `/` 后,可在「指令」中选择 `btw`,也可以直接输入 `/btw 问题`。
|
|
41
41
|
|
|
42
|
-

|
|
43
43
|
|
|
44
44
|
### 独立答案气泡
|
|
45
45
|
|
package/lib/client.js
CHANGED
|
@@ -369,6 +369,110 @@ __export(index_exports, {
|
|
|
369
369
|
module.exports = __toCommonJS(index_exports);
|
|
370
370
|
var import_react6 = __toESM(require("react"), 1);
|
|
371
371
|
|
|
372
|
+
// node_modules/lucide-react/dist/esm/createLucideIcon.js
|
|
373
|
+
var import_react2 = require("react");
|
|
374
|
+
|
|
375
|
+
// node_modules/lucide-react/dist/esm/shared/src/utils.js
|
|
376
|
+
var toKebabCase = (string3) => string3.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
377
|
+
var mergeClasses = (...classes) => classes.filter((className, index2, array) => {
|
|
378
|
+
return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index2;
|
|
379
|
+
}).join(" ").trim();
|
|
380
|
+
|
|
381
|
+
// node_modules/lucide-react/dist/esm/Icon.js
|
|
382
|
+
var import_react = require("react");
|
|
383
|
+
|
|
384
|
+
// node_modules/lucide-react/dist/esm/defaultAttributes.js
|
|
385
|
+
var defaultAttributes = {
|
|
386
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
387
|
+
width: 24,
|
|
388
|
+
height: 24,
|
|
389
|
+
viewBox: "0 0 24 24",
|
|
390
|
+
fill: "none",
|
|
391
|
+
stroke: "currentColor",
|
|
392
|
+
strokeWidth: 2,
|
|
393
|
+
strokeLinecap: "round",
|
|
394
|
+
strokeLinejoin: "round"
|
|
395
|
+
};
|
|
396
|
+
|
|
397
|
+
// node_modules/lucide-react/dist/esm/Icon.js
|
|
398
|
+
var Icon = (0, import_react.forwardRef)(
|
|
399
|
+
({
|
|
400
|
+
color: color2 = "currentColor",
|
|
401
|
+
size = 24,
|
|
402
|
+
strokeWidth = 2,
|
|
403
|
+
absoluteStrokeWidth,
|
|
404
|
+
className = "",
|
|
405
|
+
children,
|
|
406
|
+
iconNode,
|
|
407
|
+
...rest
|
|
408
|
+
}, ref) => {
|
|
409
|
+
return (0, import_react.createElement)(
|
|
410
|
+
"svg",
|
|
411
|
+
{
|
|
412
|
+
ref,
|
|
413
|
+
...defaultAttributes,
|
|
414
|
+
width: size,
|
|
415
|
+
height: size,
|
|
416
|
+
stroke: color2,
|
|
417
|
+
strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size) : strokeWidth,
|
|
418
|
+
className: mergeClasses("lucide", className),
|
|
419
|
+
...rest
|
|
420
|
+
},
|
|
421
|
+
[
|
|
422
|
+
...iconNode.map(([tag, attrs]) => (0, import_react.createElement)(tag, attrs)),
|
|
423
|
+
...Array.isArray(children) ? children : [children]
|
|
424
|
+
]
|
|
425
|
+
);
|
|
426
|
+
}
|
|
427
|
+
);
|
|
428
|
+
|
|
429
|
+
// node_modules/lucide-react/dist/esm/createLucideIcon.js
|
|
430
|
+
var createLucideIcon = (iconName, iconNode) => {
|
|
431
|
+
const Component = (0, import_react2.forwardRef)(
|
|
432
|
+
({ className, ...props }, ref) => (0, import_react2.createElement)(Icon, {
|
|
433
|
+
ref,
|
|
434
|
+
iconNode,
|
|
435
|
+
className: mergeClasses(`lucide-${toKebabCase(iconName)}`, className),
|
|
436
|
+
...props
|
|
437
|
+
})
|
|
438
|
+
);
|
|
439
|
+
Component.displayName = `${iconName}`;
|
|
440
|
+
return Component;
|
|
441
|
+
};
|
|
442
|
+
|
|
443
|
+
// node_modules/lucide-react/dist/esm/icons/check.js
|
|
444
|
+
var Check = createLucideIcon("Check", [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]]);
|
|
445
|
+
|
|
446
|
+
// node_modules/lucide-react/dist/esm/icons/chevron-down.js
|
|
447
|
+
var ChevronDown = createLucideIcon("ChevronDown", [
|
|
448
|
+
["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]
|
|
449
|
+
]);
|
|
450
|
+
|
|
451
|
+
// node_modules/lucide-react/dist/esm/icons/chevron-up.js
|
|
452
|
+
var ChevronUp = createLucideIcon("ChevronUp", [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]]);
|
|
453
|
+
|
|
454
|
+
// node_modules/lucide-react/dist/esm/icons/copy.js
|
|
455
|
+
var Copy = createLucideIcon("Copy", [
|
|
456
|
+
["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }],
|
|
457
|
+
["path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2", key: "zix9uf" }]
|
|
458
|
+
]);
|
|
459
|
+
|
|
460
|
+
// node_modules/lucide-react/dist/esm/icons/loader-circle.js
|
|
461
|
+
var LoaderCircle = createLucideIcon("LoaderCircle", [
|
|
462
|
+
["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]
|
|
463
|
+
]);
|
|
464
|
+
|
|
465
|
+
// node_modules/lucide-react/dist/esm/icons/message-circle.js
|
|
466
|
+
var MessageCircle = createLucideIcon("MessageCircle", [
|
|
467
|
+
["path", { d: "M7.9 20A9 9 0 1 0 4 16.1L2 22Z", key: "vv11sd" }]
|
|
468
|
+
]);
|
|
469
|
+
|
|
470
|
+
// node_modules/lucide-react/dist/esm/icons/x.js
|
|
471
|
+
var X = createLucideIcon("X", [
|
|
472
|
+
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
473
|
+
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
474
|
+
]);
|
|
475
|
+
|
|
372
476
|
// src/limits.ts
|
|
373
477
|
var MAX_QUESTION_LENGTH = 8e3;
|
|
374
478
|
var MAX_REFERENCE_LENGTH = 8e3;
|
|
@@ -400,7 +504,8 @@ var zh = {
|
|
|
400
504
|
"status.closing": "\u6B63\u5728\u5173\u95ED\u2026",
|
|
401
505
|
"command.hint": "\u65C1\u95EE\u5185\u5BB9",
|
|
402
506
|
"menu.group": "\u65C1\u95EE",
|
|
403
|
-
"command.
|
|
507
|
+
"command.label": "\u65C1\u95EE",
|
|
508
|
+
"command.description": "\u6839\u636E\u5F53\u524D\u4E0A\u4E0B\u6587\u56DE\u7B54\uFF0C\u4E0D\u6267\u884C\u5DE5\u5177",
|
|
404
509
|
"error.copy": "\u590D\u5236\u5931\u8D25\uFF0C\u8BF7\u9009\u62E9\u56DE\u7B54\u6587\u5B57\u590D\u5236\u3002",
|
|
405
510
|
"error.attachments": "\u65C1\u95EE\u53EA\u63A5\u53D7\u6587\u5B57\uFF0C\u56FE\u7247\u548C\u6587\u4EF6\u4ECD\u4FDD\u7559\u5728\u8F93\u5165\u6846\u4E2D\u3002",
|
|
406
511
|
"error.removeAttachments": "\u65C1\u95EE\u53EA\u63A5\u53D7\u6587\u5B57\uFF0C\u8BF7\u5148\u79FB\u9664\u56FE\u7247\u548C\u6587\u4EF6\u3002",
|
|
@@ -448,7 +553,8 @@ var en = {
|
|
|
448
553
|
"status.closing": "Closing\u2026",
|
|
449
554
|
"command.hint": "Side question",
|
|
450
555
|
"menu.group": "Side Questions",
|
|
451
|
-
"command.
|
|
556
|
+
"command.label": "Side question",
|
|
557
|
+
"command.description": "Answer from current context without running tools",
|
|
452
558
|
"error.copy": "Copy failed. Select the answer text to copy it.",
|
|
453
559
|
"error.attachments": "Side questions accept text only. Your images and files remain in the input.",
|
|
454
560
|
"error.removeAttachments": "Side questions accept text only. Remove the images and files first.",
|
|
@@ -576,110 +682,6 @@ var BubbleStore = class {
|
|
|
576
682
|
// src/client/BubbleView.tsx
|
|
577
683
|
var import_react4 = __toESM(require("react"), 1);
|
|
578
684
|
|
|
579
|
-
// node_modules/lucide-react/dist/esm/createLucideIcon.js
|
|
580
|
-
var import_react2 = require("react");
|
|
581
|
-
|
|
582
|
-
// node_modules/lucide-react/dist/esm/shared/src/utils.js
|
|
583
|
-
var toKebabCase = (string3) => string3.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
584
|
-
var mergeClasses = (...classes) => classes.filter((className, index2, array) => {
|
|
585
|
-
return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index2;
|
|
586
|
-
}).join(" ").trim();
|
|
587
|
-
|
|
588
|
-
// node_modules/lucide-react/dist/esm/Icon.js
|
|
589
|
-
var import_react = require("react");
|
|
590
|
-
|
|
591
|
-
// node_modules/lucide-react/dist/esm/defaultAttributes.js
|
|
592
|
-
var defaultAttributes = {
|
|
593
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
594
|
-
width: 24,
|
|
595
|
-
height: 24,
|
|
596
|
-
viewBox: "0 0 24 24",
|
|
597
|
-
fill: "none",
|
|
598
|
-
stroke: "currentColor",
|
|
599
|
-
strokeWidth: 2,
|
|
600
|
-
strokeLinecap: "round",
|
|
601
|
-
strokeLinejoin: "round"
|
|
602
|
-
};
|
|
603
|
-
|
|
604
|
-
// node_modules/lucide-react/dist/esm/Icon.js
|
|
605
|
-
var Icon = (0, import_react.forwardRef)(
|
|
606
|
-
({
|
|
607
|
-
color: color2 = "currentColor",
|
|
608
|
-
size = 24,
|
|
609
|
-
strokeWidth = 2,
|
|
610
|
-
absoluteStrokeWidth,
|
|
611
|
-
className = "",
|
|
612
|
-
children,
|
|
613
|
-
iconNode,
|
|
614
|
-
...rest
|
|
615
|
-
}, ref) => {
|
|
616
|
-
return (0, import_react.createElement)(
|
|
617
|
-
"svg",
|
|
618
|
-
{
|
|
619
|
-
ref,
|
|
620
|
-
...defaultAttributes,
|
|
621
|
-
width: size,
|
|
622
|
-
height: size,
|
|
623
|
-
stroke: color2,
|
|
624
|
-
strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size) : strokeWidth,
|
|
625
|
-
className: mergeClasses("lucide", className),
|
|
626
|
-
...rest
|
|
627
|
-
},
|
|
628
|
-
[
|
|
629
|
-
...iconNode.map(([tag, attrs]) => (0, import_react.createElement)(tag, attrs)),
|
|
630
|
-
...Array.isArray(children) ? children : [children]
|
|
631
|
-
]
|
|
632
|
-
);
|
|
633
|
-
}
|
|
634
|
-
);
|
|
635
|
-
|
|
636
|
-
// node_modules/lucide-react/dist/esm/createLucideIcon.js
|
|
637
|
-
var createLucideIcon = (iconName, iconNode) => {
|
|
638
|
-
const Component = (0, import_react2.forwardRef)(
|
|
639
|
-
({ className, ...props }, ref) => (0, import_react2.createElement)(Icon, {
|
|
640
|
-
ref,
|
|
641
|
-
iconNode,
|
|
642
|
-
className: mergeClasses(`lucide-${toKebabCase(iconName)}`, className),
|
|
643
|
-
...props
|
|
644
|
-
})
|
|
645
|
-
);
|
|
646
|
-
Component.displayName = `${iconName}`;
|
|
647
|
-
return Component;
|
|
648
|
-
};
|
|
649
|
-
|
|
650
|
-
// node_modules/lucide-react/dist/esm/icons/check.js
|
|
651
|
-
var Check = createLucideIcon("Check", [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]]);
|
|
652
|
-
|
|
653
|
-
// node_modules/lucide-react/dist/esm/icons/chevron-down.js
|
|
654
|
-
var ChevronDown = createLucideIcon("ChevronDown", [
|
|
655
|
-
["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]
|
|
656
|
-
]);
|
|
657
|
-
|
|
658
|
-
// node_modules/lucide-react/dist/esm/icons/chevron-up.js
|
|
659
|
-
var ChevronUp = createLucideIcon("ChevronUp", [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]]);
|
|
660
|
-
|
|
661
|
-
// node_modules/lucide-react/dist/esm/icons/copy.js
|
|
662
|
-
var Copy = createLucideIcon("Copy", [
|
|
663
|
-
["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }],
|
|
664
|
-
["path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2", key: "zix9uf" }]
|
|
665
|
-
]);
|
|
666
|
-
|
|
667
|
-
// node_modules/lucide-react/dist/esm/icons/loader-circle.js
|
|
668
|
-
var LoaderCircle = createLucideIcon("LoaderCircle", [
|
|
669
|
-
["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]
|
|
670
|
-
]);
|
|
671
|
-
|
|
672
|
-
// node_modules/lucide-react/dist/esm/icons/message-circle.js
|
|
673
|
-
var MessageCircle = createLucideIcon("MessageCircle", [
|
|
674
|
-
["path", { d: "M7.9 20A9 9 0 1 0 4 16.1L2 22Z", key: "vv11sd" }]
|
|
675
|
-
]);
|
|
676
|
-
|
|
677
|
-
// node_modules/lucide-react/dist/esm/icons/x.js
|
|
678
|
-
var X = createLucideIcon("X", [
|
|
679
|
-
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
680
|
-
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
681
|
-
]);
|
|
682
|
-
|
|
683
685
|
// node_modules/devlop/lib/default.js
|
|
684
686
|
function ok() {
|
|
685
687
|
}
|
|
@@ -13658,7 +13660,85 @@ var CSS = `
|
|
|
13658
13660
|
`;
|
|
13659
13661
|
|
|
13660
13662
|
// src/client/index.tsx
|
|
13661
|
-
var inject = ["slots", "
|
|
13663
|
+
var inject = ["slots", "remote", "remote.commands", "locale", "conversation", "sessions"];
|
|
13664
|
+
function BtwCommandIcon({ size = 16, className }) {
|
|
13665
|
+
return /* @__PURE__ */ import_react6.default.createElement(MessageCircle, { size, className });
|
|
13666
|
+
}
|
|
13667
|
+
function sessionIdOf(session) {
|
|
13668
|
+
if (typeof session === "string") return session;
|
|
13669
|
+
if (session && typeof session === "object" && "sessionId" in session) return String(session.sessionId);
|
|
13670
|
+
return String(session);
|
|
13671
|
+
}
|
|
13672
|
+
function attachOfficialBtw(commandUi, claim, t) {
|
|
13673
|
+
const live = commandUi;
|
|
13674
|
+
if (!live) return () => {
|
|
13675
|
+
};
|
|
13676
|
+
const restore = [];
|
|
13677
|
+
if (typeof live.candidates === "function") {
|
|
13678
|
+
const original = live.candidates;
|
|
13679
|
+
live.candidates = async (...args) => {
|
|
13680
|
+
const rows = await original.apply(live, args);
|
|
13681
|
+
if (!Array.isArray(rows)) return rows;
|
|
13682
|
+
return rows.map((row) => {
|
|
13683
|
+
if (!row || typeof row !== "object" || !("name" in row) || row.name !== "btw") return row;
|
|
13684
|
+
const item = row;
|
|
13685
|
+
return {
|
|
13686
|
+
...item,
|
|
13687
|
+
label: t("command.label"),
|
|
13688
|
+
description: t("command.description"),
|
|
13689
|
+
hint: t("command.hint"),
|
|
13690
|
+
icon: item.icon ?? BtwCommandIcon
|
|
13691
|
+
};
|
|
13692
|
+
});
|
|
13693
|
+
};
|
|
13694
|
+
restore.push(() => {
|
|
13695
|
+
live.candidates = original;
|
|
13696
|
+
});
|
|
13697
|
+
}
|
|
13698
|
+
if (typeof live.dispatch === "function") {
|
|
13699
|
+
const original = live.dispatch.bind(live);
|
|
13700
|
+
live.dispatch = (pick) => pick.candidate?.name === "btw" ? claim(sessionIdOf(pick.session)) : original(pick);
|
|
13701
|
+
restore.push(() => {
|
|
13702
|
+
live.dispatch = original;
|
|
13703
|
+
});
|
|
13704
|
+
}
|
|
13705
|
+
if (typeof live.matchSpace === "function") {
|
|
13706
|
+
const original = live.matchSpace.bind(live);
|
|
13707
|
+
live.matchSpace = (session, token) => token === "/btw" ? claim(sessionIdOf(session)) : original(session, token);
|
|
13708
|
+
restore.push(() => {
|
|
13709
|
+
live.matchSpace = original;
|
|
13710
|
+
});
|
|
13711
|
+
}
|
|
13712
|
+
if (typeof live.matchEnter === "function") {
|
|
13713
|
+
const original = live.matchEnter.bind(live);
|
|
13714
|
+
live.matchEnter = async (session, line, signal, envelope) => {
|
|
13715
|
+
if (!/^\/btw(?:\s|$)/.test(line.trim())) return original(session, line, signal, envelope);
|
|
13716
|
+
if (envelope?.attachments || envelope?.images) throw new Error(t("error.removeAttachments"));
|
|
13717
|
+
return claim(sessionIdOf(session));
|
|
13718
|
+
};
|
|
13719
|
+
restore.push(() => {
|
|
13720
|
+
live.matchEnter = original;
|
|
13721
|
+
});
|
|
13722
|
+
}
|
|
13723
|
+
if (typeof live.execute === "function") {
|
|
13724
|
+
const original = live.execute.bind(live);
|
|
13725
|
+
live.execute = async (session, line, attachments) => {
|
|
13726
|
+
if (!/^\/btw(?:\s|$)/.test(line)) return original(session, line, attachments);
|
|
13727
|
+
if (Array.isArray(attachments) && attachments.length) return { kind: "error", text: t("error.attachments") };
|
|
13728
|
+
const outcome = claim(sessionIdOf(session));
|
|
13729
|
+
if (!outcome || typeof outcome !== "object" || !("claim" in outcome)) return { kind: "error", text: t("error.backend") };
|
|
13730
|
+
try {
|
|
13731
|
+
return await outcome.claim.submit(line.replace(/^\/btw\s*/, "").trim(), void 0, []);
|
|
13732
|
+
} catch (error) {
|
|
13733
|
+
return { kind: "error", text: error instanceof Error ? error.message : String(error) };
|
|
13734
|
+
}
|
|
13735
|
+
};
|
|
13736
|
+
restore.push(() => {
|
|
13737
|
+
live.execute = original;
|
|
13738
|
+
});
|
|
13739
|
+
}
|
|
13740
|
+
return () => restore.forEach((dispose) => dispose());
|
|
13741
|
+
}
|
|
13662
13742
|
function apply(ctx) {
|
|
13663
13743
|
ctx.effect(() => ctx.locale.register(NS, { zh, en }));
|
|
13664
13744
|
const t = ctx.locale.bind(NS);
|
|
@@ -13690,38 +13770,8 @@ function apply(ctx) {
|
|
|
13690
13770
|
}
|
|
13691
13771
|
}
|
|
13692
13772
|
} });
|
|
13693
|
-
|
|
13694
|
-
|
|
13695
|
-
trigger: "/",
|
|
13696
|
-
order: -100,
|
|
13697
|
-
candidates: async (_session, request) => !request.signal.aborted && "btw".startsWith(request.query.toLowerCase()) ? [{ name: "btw", description: t("command.description"), hint: t("command.hint") }] : [],
|
|
13698
|
-
onPick: (pick) => pick.candidate.name === "btw" ? claim(pick.session.sessionId) : void 0,
|
|
13699
|
-
matchSpace: (session, token) => token === "/btw" ? claim(session.sessionId) : void 0,
|
|
13700
|
-
matchEnter: async (session, line, signal, envelope) => {
|
|
13701
|
-
if (signal.aborted || !/^\/btw(?:\s|$)/.test(line)) return void 0;
|
|
13702
|
-
const input = envelope;
|
|
13703
|
-
if (input.attachments || input.images) throw new Error(t("error.removeAttachments"));
|
|
13704
|
-
return claim(session.sessionId);
|
|
13705
|
-
}
|
|
13706
|
-
};
|
|
13707
|
-
ctx.effect(() => {
|
|
13708
|
-
let registeredName;
|
|
13709
|
-
let unregister = () => {
|
|
13710
|
-
};
|
|
13711
|
-
const register = () => {
|
|
13712
|
-
const name2 = t("menu.group");
|
|
13713
|
-
if (name2 === registeredName) return;
|
|
13714
|
-
unregister();
|
|
13715
|
-
unregister = ctx.inputTriggers.registerSource({ ...source, name: name2 });
|
|
13716
|
-
registeredName = name2;
|
|
13717
|
-
};
|
|
13718
|
-
register();
|
|
13719
|
-
const unsubscribe = ctx.locale.subscribe(register);
|
|
13720
|
-
return () => {
|
|
13721
|
-
unsubscribe();
|
|
13722
|
-
unregister();
|
|
13723
|
-
};
|
|
13724
|
-
});
|
|
13773
|
+
if (typeof ctx.inject === "function") ctx.inject(["commandUi"], (scope) => attachOfficialBtw(scope.get("commandUi"), (sessionId) => claim(sessionId), t));
|
|
13774
|
+
else ctx.effect(() => attachOfficialBtw(ctx.get("commandUi"), (sessionId) => claim(sessionId), t));
|
|
13725
13775
|
ctx.effect(() => {
|
|
13726
13776
|
const style = document.createElement("style");
|
|
13727
13777
|
style.dataset.michengaiBtw = "";
|
package/lib/index.js
CHANGED
|
@@ -28,7 +28,8 @@ var zh = {
|
|
|
28
28
|
"status.closing": "\u6B63\u5728\u5173\u95ED\u2026",
|
|
29
29
|
"command.hint": "\u65C1\u95EE\u5185\u5BB9",
|
|
30
30
|
"menu.group": "\u65C1\u95EE",
|
|
31
|
-
"command.
|
|
31
|
+
"command.label": "\u65C1\u95EE",
|
|
32
|
+
"command.description": "\u6839\u636E\u5F53\u524D\u4E0A\u4E0B\u6587\u56DE\u7B54\uFF0C\u4E0D\u6267\u884C\u5DE5\u5177",
|
|
32
33
|
"error.copy": "\u590D\u5236\u5931\u8D25\uFF0C\u8BF7\u9009\u62E9\u56DE\u7B54\u6587\u5B57\u590D\u5236\u3002",
|
|
33
34
|
"error.attachments": "\u65C1\u95EE\u53EA\u63A5\u53D7\u6587\u5B57\uFF0C\u56FE\u7247\u548C\u6587\u4EF6\u4ECD\u4FDD\u7559\u5728\u8F93\u5165\u6846\u4E2D\u3002",
|
|
34
35
|
"error.removeAttachments": "\u65C1\u95EE\u53EA\u63A5\u53D7\u6587\u5B57\uFF0C\u8BF7\u5148\u79FB\u9664\u56FE\u7247\u548C\u6587\u4EF6\u3002",
|
|
@@ -76,7 +77,8 @@ var en = {
|
|
|
76
77
|
"status.closing": "Closing\u2026",
|
|
77
78
|
"command.hint": "Side question",
|
|
78
79
|
"menu.group": "Side Questions",
|
|
79
|
-
"command.
|
|
80
|
+
"command.label": "Side question",
|
|
81
|
+
"command.description": "Answer from current context without running tools",
|
|
80
82
|
"error.copy": "Copy failed. Select the answer text to copy it.",
|
|
81
83
|
"error.attachments": "Side questions accept text only. Your images and files remain in the input.",
|
|
82
84
|
"error.removeAttachments": "Side questions accept text only. Remove the images and files first.",
|
|
@@ -457,6 +459,18 @@ ${request.question}` }]
|
|
|
457
459
|
}
|
|
458
460
|
});
|
|
459
461
|
ctx.effect(() => () => jobs.dispose());
|
|
462
|
+
ctx.effect(() => ctx.commands.register({
|
|
463
|
+
name: "btw",
|
|
464
|
+
description: translate()("command.description"),
|
|
465
|
+
input: { hint: translate()("command.hint") },
|
|
466
|
+
recordInput: false,
|
|
467
|
+
handler: (invocation) => {
|
|
468
|
+
const question = invocation.rawInput.trim();
|
|
469
|
+
if (!question) return { kind: "error", text: translate()("error.empty") };
|
|
470
|
+
if (question.length > MAX_QUESTION_LENGTH) return { kind: "error", text: translate()("error.length") };
|
|
471
|
+
return jobs.ask(invocation.agent.session.header.id, globalThis.crypto.randomUUID(), question, invocation.signal, invocation.agent);
|
|
472
|
+
}
|
|
473
|
+
}));
|
|
460
474
|
ctx.effect(() => ctx.commands.register({
|
|
461
475
|
name: RUN_COMMAND,
|
|
462
476
|
description: "BTW \u6C14\u6CE1\u5185\u90E8\u8BF7\u6C42",
|
package/lib/types/locales.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@michengai/dsh-btw",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "DSH
|
|
3
|
+
"version": "0.1.10",
|
|
4
|
+
"description": "DSH 一次性只读旁问插件:基于当前上下文回答,独立气泡,不执行工具 · One-shot read-only side-ask plugin: answers from current context in an independent bubble, no tool execution",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/MichengAI/dsh-btw.git"
|
|
@@ -42,7 +42,6 @@
|
|
|
42
42
|
"platform": "web",
|
|
43
43
|
"inject": [
|
|
44
44
|
"@deepseek-ai/dsh-client-ui-conversation",
|
|
45
|
-
"@deepseek-ai/dsh-client-ui-input-trigger",
|
|
46
45
|
"@deepseek-ai/dsh-api-remotes",
|
|
47
46
|
"@deepseek-ai/dsh-client-locale"
|
|
48
47
|
]
|