@michengai/dsh-btw 0.1.9 → 0.1.11
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 +9 -0
- package/CHANGELOG.zh-CN.md +9 -0
- package/README.md +4 -4
- package/README.zh-CN.md +4 -4
- package/lib/client.js +189 -139
- package/lib/index.js +16 -2
- package/lib/types/locales.d.ts +1 -0
- package/package.json +37 -37
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.1.11] - 2026-09-22
|
|
4
|
+
|
|
5
|
+
- Support DSH `0.1.7-alpha.1` while retaining compatibility with the seven previously supported host versions.
|
|
6
|
+
|
|
7
|
+
## [0.1.10] - 2026-09-18
|
|
8
|
+
|
|
9
|
+
- List `/btw` in the official command catalog with a label, description, and icon.
|
|
10
|
+
- Keep independent bubbles when submitting from the official catalog; side questions still do not run tools.
|
|
11
|
+
|
|
3
12
|
## [0.1.9] - 2026-09-18
|
|
4
13
|
|
|
5
14
|
- Support DSH `0.1.6-alpha.2` while retaining compatibility with the six previously supported host versions.
|
package/CHANGELOG.zh-CN.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# 更新日志
|
|
2
2
|
|
|
3
|
+
## [0.1.11] - 2026-09-22
|
|
4
|
+
|
|
5
|
+
- 支持 DSH `0.1.7-alpha.1`,同时保留此前七个宿主版本的兼容支持。
|
|
6
|
+
|
|
7
|
+
## [0.1.10] - 2026-09-18
|
|
8
|
+
|
|
9
|
+
- 将 `/btw` 列入官方「指令」目录,并补上名称、说明和图标。
|
|
10
|
+
- 从官方目录提交时仍走独立气泡,不执行工具。
|
|
11
|
+
|
|
3
12
|
## [0.1.9] - 2026-09-18
|
|
4
13
|
|
|
5
14
|
- 支持 DSH `0.1.6-alpha.2`,同时保留此前六个宿主版本的兼容支持。
|
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
|
|
|
@@ -68,7 +68,7 @@ For a desktop workbench, download [DSH Codex Desktop](https://github.com/Micheng
|
|
|
68
68
|
## Prerequisites
|
|
69
69
|
|
|
70
70
|
- An installed copy of DeepSeek Harness.
|
|
71
|
-
- Host peers accept exactly `0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.6-alpha.1 || 0.1.6-alpha.2`.
|
|
71
|
+
- Host peers accept exactly `0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1`.
|
|
72
72
|
- Node.js 22+ and `dsh` available in your terminal.
|
|
73
73
|
|
|
74
74
|
## Installation
|
|
@@ -160,7 +160,7 @@ npm run check
|
|
|
160
160
|
|
|
161
161
|
`npm run check` runs type checking, tests, and a build.
|
|
162
162
|
|
|
163
|
-
Development and builds target `0.1.
|
|
163
|
+
Development and builds target `0.1.7-alpha.1`. `npm run test:compat` builds with that baseline and runs the test suite on each of the eight isolated host versions, using a test model adapter. DOM component tests do not replace live-browser acceptance.
|
|
164
164
|
|
|
165
165
|
Previous manual end-to-end acceptance with Edge and a live DeepSeek model passed on `0.1.5-rc.1`: side questions, attachment rejection, copying, collapse/expand, cancellation, and continued parent-session operation. This is not part of `npm run test:compat`. The selection toolbar, draft insertion, sidebar coexistence, and real-model side answers were subsequently checked on `0.1.5-rc.2`; the full end-to-end suite remains pending on that version and the older three versions.
|
|
166
166
|
|
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
|
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
## 前置条件
|
|
69
69
|
|
|
70
70
|
- 已安装 DeepSeek Harness。
|
|
71
|
-
- 宿主 peer 依赖精确声明为 `0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.6-alpha.1 || 0.1.6-alpha.2`。
|
|
71
|
+
- 宿主 peer 依赖精确声明为 `0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1`。
|
|
72
72
|
- Node.js 22+,可在终端执行 `dsh`。
|
|
73
73
|
|
|
74
74
|
## 安装
|
|
@@ -159,7 +159,7 @@ npm run check
|
|
|
159
159
|
|
|
160
160
|
`npm run check` 执行类型检查、测试和构建。
|
|
161
161
|
|
|
162
|
-
开发与构建基线为 `0.1.
|
|
162
|
+
开发与构建基线为 `0.1.7-alpha.1`。`npm run test:compat` 用该基线编译,再在八个隔离宿主版本中分别运行测试集,模型使用测试适配器。DOM 组件测试不替代真实浏览器验收。
|
|
163
163
|
|
|
164
164
|
此前在 `0.1.5-rc.1` 上完成真实 Edge 与 DeepSeek 模型的手工端到端验收,旁问、附件拒绝、复制、折叠/展开、取消和父会话继续均通过。这不属于 `npm run test:compat`;随后在 `0.1.5-rc.2` 验证了划词横条、添加引用、侧边栏共存及真实模型旁问回答;该版本与旧三版的完整端到端用例仍未全部验收。
|
|
165
165
|
|
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.11",
|
|
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
|
]
|
|
@@ -63,44 +62,45 @@
|
|
|
63
62
|
"license": "Apache-2.0",
|
|
64
63
|
"peerDependencies": {
|
|
65
64
|
"@deepseek-ai/cordis": "^4.0.2",
|
|
66
|
-
"@deepseek-ai/dsh-commands": "0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.6-alpha.1 || 0.1.6-alpha.2",
|
|
67
|
-
"@deepseek-ai/dsh-subagent": "0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.6-alpha.1 || 0.1.6-alpha.2",
|
|
68
|
-
"@deepseek-ai/dsh-tools": "0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.6-alpha.1 || 0.1.6-alpha.2",
|
|
65
|
+
"@deepseek-ai/dsh-commands": "0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1",
|
|
66
|
+
"@deepseek-ai/dsh-subagent": "0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1",
|
|
67
|
+
"@deepseek-ai/dsh-tools": "0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1",
|
|
69
68
|
"react": "^18.3.1"
|
|
70
69
|
},
|
|
71
70
|
"devDependencies": {
|
|
72
71
|
"@deepseek-ai/cordis": "4.0.2",
|
|
73
|
-
"@deepseek-ai/dsh-agent": "0.1.
|
|
74
|
-
"@deepseek-ai/dsh-agent-loop": "0.1.
|
|
75
|
-
"@deepseek-ai/dsh-api-gateway": "0.1.
|
|
76
|
-
"@deepseek-ai/dsh-api-session-controller": "0.1.
|
|
77
|
-
"@deepseek-ai/dsh-attachment": "0.1.
|
|
78
|
-
"@deepseek-ai/dsh-client-
|
|
79
|
-
"@deepseek-ai/dsh-client-
|
|
80
|
-
"@deepseek-ai/dsh-client-ui-
|
|
81
|
-
"@deepseek-ai/dsh-client-ui-
|
|
82
|
-
"@deepseek-ai/dsh-client-ui-
|
|
83
|
-
"@deepseek-ai/dsh-client-ui-
|
|
84
|
-
"@deepseek-ai/dsh-client-ui-
|
|
85
|
-
"@deepseek-ai/dsh-
|
|
86
|
-
"@deepseek-ai/dsh-
|
|
87
|
-
"@deepseek-ai/dsh-
|
|
88
|
-
"@deepseek-ai/dsh-
|
|
89
|
-
"@deepseek-ai/dsh-
|
|
90
|
-
"@deepseek-ai/dsh-sandbox
|
|
91
|
-
"@deepseek-ai/dsh-
|
|
92
|
-
"@deepseek-ai/dsh-
|
|
93
|
-
"@deepseek-ai/dsh-session
|
|
94
|
-
"@deepseek-ai/dsh-session-
|
|
95
|
-
"@deepseek-ai/dsh-
|
|
96
|
-
"@deepseek-ai/dsh-subagent
|
|
97
|
-
"@deepseek-ai/dsh-subagent-in-process
|
|
98
|
-
"@deepseek-ai/dsh-
|
|
99
|
-
"@deepseek-ai/dsh-
|
|
100
|
-
"@deepseek-ai/dsh-
|
|
101
|
-
"@deepseek-ai/dsh-
|
|
102
|
-
"@deepseek-ai/dsh-typert-
|
|
103
|
-
"@deepseek-ai/dsh-
|
|
72
|
+
"@deepseek-ai/dsh-agent": "0.1.7-alpha.1",
|
|
73
|
+
"@deepseek-ai/dsh-agent-loop": "0.1.7-alpha.1",
|
|
74
|
+
"@deepseek-ai/dsh-api-gateway": "0.1.7-alpha.1",
|
|
75
|
+
"@deepseek-ai/dsh-api-session-controller": "0.1.7-alpha.1",
|
|
76
|
+
"@deepseek-ai/dsh-attachment": "0.1.7-alpha.1",
|
|
77
|
+
"@deepseek-ai/dsh-client-connection": "0.1.7-alpha.1",
|
|
78
|
+
"@deepseek-ai/dsh-client-locale": "0.1.7-alpha.1",
|
|
79
|
+
"@deepseek-ai/dsh-client-ui-chat": "0.1.7-alpha.1",
|
|
80
|
+
"@deepseek-ai/dsh-client-ui-conversation": "0.1.7-alpha.1",
|
|
81
|
+
"@deepseek-ai/dsh-client-ui-input-trigger": "0.1.7-alpha.1",
|
|
82
|
+
"@deepseek-ai/dsh-client-ui-renderer": "0.1.7-alpha.1",
|
|
83
|
+
"@deepseek-ai/dsh-client-ui-slots": "0.1.7-alpha.1",
|
|
84
|
+
"@deepseek-ai/dsh-client-ui-theme": "0.1.7-alpha.1",
|
|
85
|
+
"@deepseek-ai/dsh-commands": "0.1.7-alpha.1",
|
|
86
|
+
"@deepseek-ai/dsh-invariants": "0.1.7-alpha.1",
|
|
87
|
+
"@deepseek-ai/dsh-llm": "0.1.7-alpha.1",
|
|
88
|
+
"@deepseek-ai/dsh-ptc-runtime": "0.1.7-alpha.1",
|
|
89
|
+
"@deepseek-ai/dsh-sandbox": "0.1.7-alpha.1",
|
|
90
|
+
"@deepseek-ai/dsh-sandbox-policy": "0.1.7-alpha.1",
|
|
91
|
+
"@deepseek-ai/dsh-scope": "0.1.7-alpha.1",
|
|
92
|
+
"@deepseek-ai/dsh-session": "0.1.7-alpha.1",
|
|
93
|
+
"@deepseek-ai/dsh-session-persistence": "0.1.7-alpha.1",
|
|
94
|
+
"@deepseek-ai/dsh-session-projection": "0.1.7-alpha.1",
|
|
95
|
+
"@deepseek-ai/dsh-subagent": "0.1.7-alpha.1",
|
|
96
|
+
"@deepseek-ai/dsh-subagent-fork-in-process": "0.1.7-alpha.1",
|
|
97
|
+
"@deepseek-ai/dsh-subagent-in-process-driver": "0.1.7-alpha.1",
|
|
98
|
+
"@deepseek-ai/dsh-system-prompt": "0.1.7-alpha.1",
|
|
99
|
+
"@deepseek-ai/dsh-tools": "0.1.7-alpha.1",
|
|
100
|
+
"@deepseek-ai/dsh-user-approval": "0.1.7-alpha.1",
|
|
101
|
+
"@deepseek-ai/dsh-typert-protocol": "0.1.7-alpha.1",
|
|
102
|
+
"@deepseek-ai/dsh-typert-registry": "0.1.7-alpha.1",
|
|
103
|
+
"@deepseek-ai/dsh-util-time": "0.1.7-alpha.1",
|
|
104
104
|
"@types/node": "^22.0.0",
|
|
105
105
|
"@types/react": "^18.3.1",
|
|
106
106
|
"@types/react-dom": "^18.3.7",
|