@oh-my-dsh/dsh-better-subagent 0.5.5-alpha.1 → 0.5.7-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/docs/DEVELOPMENT.md +1 -1
- package/lib/client.js +168 -352
- package/lib/subagents.js +2 -4
- package/lib/subagents.js.map +1 -1
- package/package.json +35 -35
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<p align="center">
|
|
13
13
|
<a href="https://www.npmjs.com/package/@oh-my-dsh/dsh-better-subagent"><img src="https://img.shields.io/npm/v/%40oh-my-dsh%2Fdsh-better-subagent.svg" alt="npm 版本"></a>
|
|
14
14
|
<a href="LICENSE"><img alt="Apache-2.0" src="https://img.shields.io/github/license/omdsh-dev/dsh-better-subagent?color=blue"></a>
|
|
15
|
-
<a href="package.json"><img alt="DSH 0.2.3-alpha.
|
|
15
|
+
<a href="package.json"><img alt="DSH 0.2.3-alpha.3" src="https://img.shields.io/badge/DSH-0.2.3--alpha.2-4B32C3"></a>
|
|
16
16
|
<a href="https://github.com/omdsh-dev/dsh-better-dsh"><img alt="Part of Better DSH" src="https://img.shields.io/badge/part%20of-dsh--better--dsh-2F80B7"></a>
|
|
17
17
|
</p>
|
|
18
18
|
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
|
|
43
43
|
```sh
|
|
44
44
|
# 只安装这个插件
|
|
45
|
-
dsh plugin --profile <profile> add @oh-my-dsh/dsh-better-subagent@0.5.
|
|
45
|
+
dsh plugin --profile <profile> add @oh-my-dsh/dsh-better-subagent@0.5.7-alpha.1
|
|
46
46
|
|
|
47
47
|
# 或安装 Better DSH(会自动带上所有独立插件)
|
|
48
48
|
dsh plugin --profile <profile> add dsh-better-dsh@0.11.7
|
|
@@ -57,7 +57,7 @@ dsh plugin --profile <profile> add dsh-better-dsh@0.11.7
|
|
|
57
57
|
| 稳定行 id | `dsh-better-subagent` |
|
|
58
58
|
| 入口 / 工具 | `wait_subagent` · `/better-subagent/api/*` · 子代理设置页 |
|
|
59
59
|
| 设置 | `childExitGuard`、`delegation.prompt`、`tiers.*`、两个 CLI 后端、`trustedHosts` |
|
|
60
|
-
| npm 包 | `@oh-my-dsh/dsh-better-subagent@0.5.
|
|
60
|
+
| npm 包 | `@oh-my-dsh/dsh-better-subagent@0.5.7-alpha.1` |
|
|
61
61
|
| 仓库 | https://github.com/omdsh-dev/dsh-better-subagent |
|
|
62
62
|
|
|
63
63
|
## 设置
|
package/docs/DEVELOPMENT.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
- 宿主源码使用严格 TypeScript(`src/index.ts`),构建为纯 ESM `lib/index.js` 与 `.d.ts`;浏览器源码 `src/client/index.ts` 经 esbuild 编译后包装为宿主加载的 `lib/client.js` closure。
|
|
8
8
|
- `package.json` 的 `dsh.bundle.patch` 指向 `cordis.patch.yml`;`dsh.client.platform = "web"`。
|
|
9
9
|
- `files` 白名单:`lib`、`docs`、`cordis.patch.yml`、`README.md`、`LICENSE`、`third-party`。测试、脚本、设计 Spec、凭据、临时 profile 都不进发布包。
|
|
10
|
-
- 依赖:运行时只直接 import `@deepseek-ai/schemastery`;其余 DSH 包是 peer 范围(`>=0.2.3-alpha.
|
|
10
|
+
- 依赖:运行时只直接 import `@deepseek-ai/schemastery`;其余 DSH 包是 peer 范围(`>=0.2.3-alpha.3 <0.3.0`),由宿主运行环境提供,服务全部经 `ctx` 获取。
|
|
11
11
|
- 浏览器半边只 `require('react')`,不 import 任何 DSH client 包;样式全部使用宿主主题 token(`--dsw-alias-*`),不写 DOM。
|
|
12
12
|
|
|
13
13
|
## 2. 宿主行与配置
|
package/lib/client.js
CHANGED
|
@@ -136,7 +136,7 @@ var zh = {
|
|
|
136
136
|
globalOverrides: "\u6240\u6709\u9884\u8BBE\u5DF2\u5305\u542B\u5DE5\u7A0B\u9884\u8BBE\u3002",
|
|
137
137
|
summary: "\u5B50\u4EE3\u7406\u6A21\u578B\u3001\u672C\u673A Codex / Claude \u4E0E\u8FD0\u884C\u8BBE\u7F6E",
|
|
138
138
|
title: "\u5B50\u4EE3\u7406",
|
|
139
|
-
intro: "\
|
|
139
|
+
intro: "\u51B3\u5B9A\u5B50\u4EE3\u7406\u4F7F\u7528\u54EA\u4E2A\u6A21\u578B\u3001\u4F55\u65F6\u7B49\u5F85\uFF0C\u4EE5\u53CA\u672C\u673A Codex / Claude \u662F\u5426\u53EF\u7528\u3002",
|
|
140
140
|
loading: "\u6B63\u5728\u52A0\u8F7D\u8BBE\u7F6E\u2026",
|
|
141
141
|
waitingForm: "\u6B63\u5728\u52A0\u8F7D\u8BBE\u7F6E\u2026",
|
|
142
142
|
noFormHint: "\u6682\u65F6\u65E0\u6CD5\u52A0\u8F7D\u8BBE\u7F6E\uFF0C\u8BF7\u5237\u65B0\u9875\u9762\u6216\u68C0\u67E5\u8FDE\u63A5\u3002",
|
|
@@ -157,7 +157,7 @@ var zh = {
|
|
|
157
157
|
tierRouteLabel: "{tier}\u6A21\u578B",
|
|
158
158
|
tierEffortLabel: "{tier}\u601D\u8003\u5F3A\u5EA6",
|
|
159
159
|
tierOffList: "(\u4E0D\u53EF\u7528) {route}",
|
|
160
|
-
tiersInactive: "\
|
|
160
|
+
tiersInactive: "\u5F53\u524D\u6CA1\u6709\u53EF\u7528\u7684\u6A21\u578B\u540D\u5355\uFF0C\u4E24\u6863\u53EA\u80FD\u6CBF\u7528\u4E3B\u4F1A\u8BDD\u6A21\u578B\uFF1B\u5728\u5BBF\u4E3B\u7684\u6A21\u578B\u8BBE\u7F6E\u91CC\u542F\u7528\u540E\u53EF\u5728\u8FD9\u91CC\u9009\u62E9\u5177\u4F53\u6A21\u578B\u3002",
|
|
161
161
|
routesLoading: "\u6B63\u5728\u8BFB\u53D6\u53EF\u7528\u6A21\u578B\u2026",
|
|
162
162
|
routesError: "\u6682\u65F6\u65E0\u6CD5\u8BFB\u53D6\u53EF\u7528\u6A21\u578B\uFF0C\u8BF7\u5237\u65B0\u91CD\u8BD5\u3002",
|
|
163
163
|
invalidTierRoute: "{backend}\u6240\u9009\u6A21\u578B\u4E0D\u53EF\u7528\uFF0C\u8BF7\u6539\u9009\u6216\u6CBF\u7528\u4E3B\u4F1A\u8BDD\u6A21\u578B\u3002",
|
|
@@ -298,7 +298,7 @@ var en = {
|
|
|
298
298
|
globalOverrides: "All presets already includes engineering presets.",
|
|
299
299
|
summary: "Subagent models, local Codex / Claude and run settings",
|
|
300
300
|
title: "Subagents",
|
|
301
|
-
intro: "
|
|
301
|
+
intro: "Set which models subagents use, when to wait for them, and whether local Codex / Claude is available.",
|
|
302
302
|
loading: "Loading settings\u2026",
|
|
303
303
|
waitingForm: "Loading settings\u2026",
|
|
304
304
|
noFormHint: "Settings are not loading. Refresh the page or check your connection.",
|
|
@@ -319,7 +319,7 @@ var en = {
|
|
|
319
319
|
tierRouteLabel: "{tier} model",
|
|
320
320
|
tierEffortLabel: "{tier} thinking effort",
|
|
321
321
|
tierOffList: "(unavailable) {route}",
|
|
322
|
-
tiersInactive: "
|
|
322
|
+
tiersInactive: "No models are allowed right now, so both tiers inherit the main conversation model. Allow models in the host model settings to choose one here.",
|
|
323
323
|
routesLoading: "Loading available models\u2026",
|
|
324
324
|
routesError: "Available models could not be loaded. Refresh to try again.",
|
|
325
325
|
invalidTierRoute: "The {backend} model is unavailable. Choose another or use the main conversation model.",
|
|
@@ -405,35 +405,25 @@ var STYLE_ID = "@oh-my-dsh/dsh-better-subagent/settings.css";
|
|
|
405
405
|
var CSS = `.bs-root{--cfg-accent:var(--dsw-alias-state-business-primary,#4176e6);--cfg-accent-solid:var(--dsw-alias-button-primary-fill,#0f1115);--cfg-accent-fg:var(--dsw-alias-label-primary-foreground,#fff);--cfg-accent-text:color-mix(in srgb,var(--cfg-accent) 72%,var(--cfg-ink));--cfg-accent-hover:color-mix(in srgb,var(--cfg-accent-solid) 88%,var(--cfg-bg));--cfg-accent-soft:color-mix(in srgb,var(--cfg-accent) 10%,transparent);--cfg-bg:var(--dsw-alias-bg-layer-1);--cfg-raised:var(--dsw-alias-bg-layer-2);--cfg-overlay:var(--dsw-alias-bg-layer-3);--cfg-sunken:color-mix(in srgb,var(--dsw-alias-label-primary) 4%,var(--dsw-alias-bg-layer-1));--cfg-ink:var(--dsw-alias-label-primary);--cfg-muted:var(--dsw-alias-label-secondary);--cfg-dim:color-mix(in srgb,var(--dsw-alias-label-tertiary) 80%,var(--cfg-ink));--cfg-line:var(--dsw-alias-border-l2);--cfg-line-strong:var(--dsw-alias-border-l3);--cfg-hover:var(--dsw-alias-interactive-bg-hover);--cfg-danger:var(--dsw-alias-state-error-primary);--cfg-warn:color-mix(in srgb,var(--dsw-alias-state-warn-primary) 60%,var(--cfg-ink));--cfg-success:color-mix(in srgb,var(--dsw-alias-state-success-primary) 60%,var(--cfg-ink));--cfg-mono:var(--dsw-font-family-mono,ui-monospace,SFMono-Regular,Menlo,Consolas,monospace);color:var(--cfg-ink);font:inherit;font-size:13px;line-height:20px;font-variant-numeric:tabular-nums;min-width:0;width:100%;--bs-action-size:32px;container:bs-settings / inline-size}
|
|
406
406
|
.bs-root *{box-sizing:border-box}
|
|
407
407
|
.bs-root [hidden]{display:none!important}
|
|
408
|
-
.bs-cfg{display:flex;flex-direction:column;gap:
|
|
409
|
-
.bs-header{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;min-height:
|
|
408
|
+
.bs-cfg{display:flex;flex-direction:column;gap:0;max-width:none;width:100%;margin:0;min-width:0}
|
|
409
|
+
.bs-header{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;min-height:0;padding:2px 0 14px}
|
|
410
410
|
.bs-headerMain{display:flex;flex-direction:column;gap:2px;min-width:0}
|
|
411
411
|
.bs-headerIntro{color:var(--cfg-dim);font-size:12px;line-height:18px}
|
|
412
412
|
.bs-headerMeta{display:flex;align-items:center;gap:6px;flex-wrap:wrap;justify-content:flex-end}
|
|
413
413
|
.bs-title{margin:0;font-size:12px;line-height:18px;font-weight:500;color:var(--cfg-dim)}
|
|
414
|
-
.bs-header .bs-title{font-size:
|
|
415
|
-
.bs-sectionTitle{margin:0;font-size:
|
|
416
|
-
.bs-cardTitle{margin:0;font-size:
|
|
414
|
+
.bs-header .bs-title{font-size:15px;line-height:22px;font-weight:500;letter-spacing:0;color:var(--cfg-ink)}
|
|
415
|
+
.bs-sectionTitle{margin:18px 0 0;font-size:14px;line-height:22px;font-weight:500;color:var(--cfg-ink)}
|
|
416
|
+
.bs-cardTitle{margin:0;font-size:14px;line-height:22px;font-weight:500;color:var(--cfg-ink)}
|
|
417
417
|
.bs-hint,.bs-status{margin:0;color:var(--cfg-dim);font-size:12px;line-height:18px}
|
|
418
418
|
.bs-hintWarn{color:var(--cfg-warn)}
|
|
419
419
|
.bs-note{margin:0;padding:8px 10px;border:1px solid var(--cfg-line);border-radius:8px;background:var(--cfg-sunken);color:var(--cfg-muted);font-size:12px;line-height:18px}
|
|
420
420
|
.bs-note[data-tone=error],.bs-hint[data-tone=error],.bs-status[data-tone=error]{color:var(--cfg-danger)}
|
|
421
421
|
.bs-note[data-tone=warn]{border-color:var(--cfg-warn);color:var(--cfg-warn)}
|
|
422
422
|
.bs-hint[data-tone=ok],.bs-status[data-tone=ok]{color:var(--cfg-success)}
|
|
423
|
-
.bs-
|
|
424
|
-
.bs-
|
|
425
|
-
.bs-tab:hover{color:var(--cfg-ink)}
|
|
426
|
-
.bs-tab[aria-selected=true]{color:var(--cfg-ink)}
|
|
427
|
-
.bs-tab[aria-selected=true]::after{content:"";position:absolute;inset-inline:0;bottom:0;height:1px;background:var(--cfg-accent)}
|
|
428
|
-
.bs-subtabs{align-self:flex-start;gap:16px;padding:0;border:0;border-bottom:1px solid var(--cfg-line);border-radius:0;background:transparent}
|
|
429
|
-
.bs-subtabs .bs-tab{height:32px;padding:0 0 7px;border:0;border-radius:0;font-weight:400}
|
|
430
|
-
.bs-subtabs .bs-tab:hover{background:transparent;color:var(--cfg-ink)}
|
|
431
|
-
.bs-subtabs .bs-tab[aria-selected=true]{background:transparent;border:0;color:var(--cfg-ink);font-weight:500}
|
|
432
|
-
.bs-tabpanel{display:flex;flex-direction:column;gap:20px;min-width:0}
|
|
433
|
-
.bs-section{display:flex;flex-direction:column;gap:6px;min-width:0}
|
|
434
|
-
.bs-sectionHead,.bs-cardHead{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:28px}
|
|
423
|
+
.bs-section{display:flex;flex-direction:column;gap:4px;min-width:0}
|
|
424
|
+
.bs-sectionHead,.bs-cardHead{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:22px}
|
|
435
425
|
.bs-toolbar{display:flex;align-items:center;gap:8px;min-width:0}
|
|
436
|
-
.bs-card{display:flex;flex-direction:column;gap:
|
|
426
|
+
.bs-card{display:flex;flex-direction:column;gap:10px;min-width:0;padding:14px 16px;border:1px solid var(--cfg-line);border-radius:12px;background:var(--cfg-raised)}
|
|
437
427
|
.bs-cardBody{display:flex;flex-direction:column;gap:8px;min-width:0}
|
|
438
428
|
.bs-cardHead .bs-switchRow{padding:0;gap:10px}
|
|
439
429
|
.bs-cardHead .bs-switchLabel{color:var(--cfg-muted);font-weight:400}
|
|
@@ -465,9 +455,9 @@ var CSS = `.bs-root{--cfg-accent:var(--dsw-alias-state-business-primary,#4176e6)
|
|
|
465
455
|
.bs-option[aria-selected=true]{color:var(--cfg-accent-text);background:var(--cfg-accent-soft)}
|
|
466
456
|
.bs-optionCheck{width:12px;flex:none}
|
|
467
457
|
.bs-optionLabel{min-width:0}
|
|
468
|
-
.bs-switchRow{position:relative;display:flex;align-items:center;justify-content:space-between;gap:16px;padding:4px 0}
|
|
458
|
+
.bs-switchRow{position:relative;display:flex;align-items:center;justify-content:space-between;gap:16px;padding:4px 0}.bs-section>.bs-switchRow{padding:12px 0;border-bottom:1px solid var(--cfg-line)}.bs-section>.bs-switchRow:last-of-type{border-bottom:0;padding-bottom:8px}
|
|
469
459
|
.bs-switchMain{flex:1;min-width:0}
|
|
470
|
-
.bs-switchLabel{font-weight:
|
|
460
|
+
.bs-switchLabel{font-weight:400;font-size:14px;line-height:22px}
|
|
471
461
|
.bs-switch{appearance:none;display:flex;align-items:center;justify-content:center;flex:none;width:32px;height:32px;padding:0;border:0;border-radius:6px;background:transparent;cursor:pointer}
|
|
472
462
|
.bs-switchTrack{display:block;width:32px;height:18px;padding:2px;border:1px solid var(--cfg-line-strong);border-radius:9px;background:var(--cfg-sunken)}
|
|
473
463
|
.bs-switch:hover:not(:disabled) .bs-switchTrack{border-color:var(--cfg-muted)}
|
|
@@ -505,25 +495,11 @@ var CSS = `.bs-root{--cfg-accent:var(--dsw-alias-state-business-primary,#4176e6)
|
|
|
505
495
|
.bs-badge[data-active=true]{border-color:var(--cfg-accent);color:var(--cfg-accent-text)}
|
|
506
496
|
.bs-dot{width:6px;height:6px;flex:none;border-radius:50%;background:var(--cfg-dim)}
|
|
507
497
|
.bs-dot[data-active=true]{background:var(--cfg-accent)}
|
|
508
|
-
.bs-
|
|
509
|
-
.bs-overviewGlyph{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;flex:none;border:1px solid var(--cfg-line);border-radius:6px;background:var(--cfg-raised);color:var(--cfg-muted)}
|
|
510
|
-
.bs-overviewMeta{font-size:12px;line-height:18px;color:var(--cfg-dim);overflow-wrap:anywhere}
|
|
511
|
-
.bs-overviewRow{appearance:none;display:flex;align-items:center;gap:12px;width:100%;padding:8px 6px;margin-inline:-6px;border:0;border-radius:6px;background:transparent;color:inherit;font:inherit;cursor:pointer;text-align:left}
|
|
512
|
-
.bs-overviewRow:hover,.bs-overviewRow:active{background:var(--cfg-hover)}
|
|
513
|
-
.bs-overviewName{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}
|
|
514
|
-
.bs-overviewName>span:first-child{font-weight:500}
|
|
515
|
-
.bs-overviewRow>svg{color:var(--cfg-dim);flex:none}
|
|
516
|
-
.bs-routingDiagram{display:flex;flex-direction:column;gap:2px;padding:2px 0 0;min-width:0}
|
|
498
|
+
.bs-routingDiagram{display:flex;flex-direction:column;gap:10px;padding:2px 0 0;min-width:0}
|
|
517
499
|
.bs-routingSource{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:6px 8px;border:1px solid var(--cfg-line);border-radius:8px;background:var(--cfg-sunken);min-width:0}
|
|
518
500
|
.bs-routingSourceLabel{display:inline-flex;align-items:center;gap:6px;font-weight:500}
|
|
519
501
|
.bs-routingSourceLabel::before{content:"";width:6px;height:6px;flex:none;border-radius:50%;background:var(--cfg-accent)}
|
|
520
|
-
.bs-routing{display:grid;grid-template-columns:auto minmax(0,1fr) minmax(0,1.1fr) auto;gap:8px 12px;align-items:center;padding:8px 8px 8px 12px;border:0;border-radius:8px;min-width:0}
|
|
521
|
-
.bs-routing:hover{background:var(--cfg-hover)}
|
|
522
|
-
.bs-routingBranchGlyph{color:var(--cfg-dim);font-family:var(--cfg-mono)}
|
|
523
|
-
.bs-routingLabel{font-weight:500}
|
|
524
|
-
.bs-routingModel{font-size:12px;line-height:18px;color:var(--cfg-muted);overflow-wrap:anywhere}
|
|
525
502
|
.bs-routingNote{margin:2px 0 0}
|
|
526
|
-
.bs-tierGrid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;align-items:start;min-width:0}
|
|
527
503
|
.bs-tierCard{min-width:0}
|
|
528
504
|
.bs-tierHead{display:flex;flex-direction:column;gap:2px;min-width:0}
|
|
529
505
|
.bs-empty{display:flex;flex-direction:column;gap:4px;padding:8px 10px;border:1px solid var(--cfg-line);border-radius:6px;background:var(--cfg-sunken)}
|
|
@@ -533,17 +509,17 @@ var CSS = `.bs-root{--cfg-accent:var(--dsw-alias-state-business-primary,#4176e6)
|
|
|
533
509
|
.bs-metric{display:flex;flex-direction:column;gap:2px;min-width:0;padding:8px 10px;border:1px solid var(--cfg-line);border-radius:6px;background:var(--cfg-sunken)}
|
|
534
510
|
.bs-metricLabel{font-size:12px;line-height:18px;color:var(--cfg-dim)}
|
|
535
511
|
.bs-metricValue{font-size:13px;line-height:20px;font-weight:500;overflow-wrap:anywhere}
|
|
536
|
-
.bs-footer{position:sticky;bottom:0;z-index:
|
|
512
|
+
.bs-footer{position:sticky;bottom:0;z-index:50;display:flex;align-items:center;justify-content:flex-end;flex-wrap:wrap;gap:8px;padding:14px 0 18px;border-top:1px solid var(--cfg-line);background:var(--cfg-bg)}
|
|
537
513
|
.bs-footer .bs-status{flex:1;min-width:140px;font-size:12px;line-height:18px;color:var(--cfg-dim)}
|
|
538
514
|
.bs-errorLink{color:var(--cfg-danger);text-align:left;white-space:normal;height:auto;min-height:28px}
|
|
539
|
-
.bs-feedback{min-height:20px}
|
|
540
515
|
.bs-spinner{width:12px;height:12px;flex:none;border:1.5px solid currentColor;border-right-color:transparent;border-radius:50%;animation:bs-spin .7s linear infinite}
|
|
541
516
|
@keyframes bs-spin{to{transform:rotate(360deg)}}
|
|
542
517
|
.bs-pulse{animation:bs-pulse 2s ease infinite}
|
|
543
518
|
@keyframes bs-pulse{50%{opacity:.55}}
|
|
544
|
-
@container bs-settings (max-width:
|
|
545
|
-
@container bs-settings (max-width:
|
|
546
|
-
@
|
|
519
|
+
@container bs-settings (max-width:520px){.bs-metricGrid{grid-template-columns:repeat(2,minmax(0,1fr))}}
|
|
520
|
+
@container bs-settings (max-width:760px){.bs-fieldGrid{grid-template-columns:minmax(0,1fr)}}
|
|
521
|
+
@container bs-settings (max-width:640px){.bs-header .bs-title{font-size:15px}.bs-sectionHead,.bs-cardHead,.bs-toolbar{flex-wrap:wrap}.bs-field{grid-template-columns:minmax(0,1fr);gap:4px}.bs-fieldLabel{padding:0}.bs-modelHead{display:none}.bs-model{grid-template-columns:minmax(0,1fr) var(--bs-action-size);gap:8px}.bs-modelCell{grid-column:1}.bs-cellLabel{display:block;font-size:12px;line-height:18px}.bs-model .bs-iconButton{grid-column:2;grid-row:1}.bs-connectionRow{align-items:flex-start;flex-direction:column;gap:4px;padding:6px 0}.bs-connectionRow .bs-hint{text-align:start}.bs-advancedSummary{white-space:normal}}
|
|
522
|
+
@media(pointer:coarse),(max-width:640px){.bs-root{--bs-action-size:44px}.bs-input,.bs-select,.bs-button,.bs-iconButton,.bs-switch{height:44px;min-height:44px}.bs-textarea{min-height:88px}.bs-switch,.bs-iconButton{width:44px}.bs-option,.bs-advanced>summary{min-height:44px}}
|
|
547
523
|
@media(prefers-reduced-motion:reduce){.bs-root *{animation:none!important;transition:none!important}}`;
|
|
548
524
|
function isRecord(value) {
|
|
549
525
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -749,9 +725,6 @@ function detectionOf(capabilities, spec, backend, translate) {
|
|
|
749
725
|
}
|
|
750
726
|
return translate("missing", { executable: backend.executable });
|
|
751
727
|
}
|
|
752
|
-
function Chevron() {
|
|
753
|
-
return h("svg", { width: 16, height: 16, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 1.5, "aria-hidden": true }, h("path", { d: "m9 5 7 7-7 7" }));
|
|
754
|
-
}
|
|
755
728
|
function Advanced({ summary, children, detailsRef, label }) {
|
|
756
729
|
return h(
|
|
757
730
|
"details",
|
|
@@ -886,39 +859,6 @@ function Select({ children: options, value, onChange, disabled, id, className, .
|
|
|
886
859
|
)
|
|
887
860
|
);
|
|
888
861
|
}
|
|
889
|
-
function Tabs({ id, label, items, value, onChange, compact, tabRefs }) {
|
|
890
|
-
const refs = (0, import_react.useRef)({});
|
|
891
|
-
return h(
|
|
892
|
-
"div",
|
|
893
|
-
{ className: compact ? "bs-tabs bs-subtabs" : "bs-tabs", role: "tablist", "aria-label": label },
|
|
894
|
-
items.map((item, index) => h("button", {
|
|
895
|
-
key: item.id,
|
|
896
|
-
type: "button",
|
|
897
|
-
className: "bs-tab",
|
|
898
|
-
role: "tab",
|
|
899
|
-
id: id + "-tab-" + item.id,
|
|
900
|
-
"aria-controls": id + "-panel-" + item.id,
|
|
901
|
-
"aria-selected": value === item.id,
|
|
902
|
-
tabIndex: value === item.id ? 0 : -1,
|
|
903
|
-
ref: (node) => {
|
|
904
|
-
refs.current[item.id] = node;
|
|
905
|
-
if (tabRefs) tabRefs.current[item.id] = node;
|
|
906
|
-
},
|
|
907
|
-
onClick: () => onChange(item.id),
|
|
908
|
-
onKeyDown: (event) => {
|
|
909
|
-
let next;
|
|
910
|
-
if (event.key === "ArrowRight") next = (index + 1) % items.length;
|
|
911
|
-
else if (event.key === "ArrowLeft") next = (index + items.length - 1) % items.length;
|
|
912
|
-
else if (event.key === "Home") next = 0;
|
|
913
|
-
else if (event.key === "End") next = items.length - 1;
|
|
914
|
-
else return;
|
|
915
|
-
event.preventDefault();
|
|
916
|
-
onChange(items[next].id);
|
|
917
|
-
refs.current[items[next].id]?.focus();
|
|
918
|
-
}
|
|
919
|
-
}, item.active === void 0 ? null : h("span", { className: "bs-dot", "data-active": item.active, "aria-hidden": true }), item.label))
|
|
920
|
-
);
|
|
921
|
-
}
|
|
922
862
|
function Field({ id, label, hint, showHint = true, wide, children }) {
|
|
923
863
|
const hintId = "bs-hint-" + (0, import_react.useId)().replace(/[^a-zA-Z0-9_-]/g, "");
|
|
924
864
|
const control = hint === void 0 || children === null || typeof children !== "object" ? children : Array.isArray(children) ? children.map((child, at) => at === 0 && (0, import_react.isValidElement)(child) ? (0, import_react.cloneElement)(child, { key: child.key ?? "control", "aria-describedby": hintId }) : child) : (0, import_react.cloneElement)(children, { "aria-describedby": hintId });
|
|
@@ -1123,11 +1063,6 @@ function TierRow({ tier, value, allowed, disabled, t: translate, onPatch }) {
|
|
|
1123
1063
|
{ className: "bs-tierHead" },
|
|
1124
1064
|
h("h3", { className: "bs-cardTitle" }, title),
|
|
1125
1065
|
h("p", { className: "bs-hint" }, translate(TIER_HINT_KEYS[tier]))
|
|
1126
|
-
),
|
|
1127
|
-
h(
|
|
1128
|
-
"span",
|
|
1129
|
-
{ className: "bs-badge", "data-active": current !== "" },
|
|
1130
|
-
current === "" ? translate("tierInherit") : selected?.model ?? value.model
|
|
1131
1066
|
)
|
|
1132
1067
|
),
|
|
1133
1068
|
h(
|
|
@@ -1343,9 +1278,6 @@ function BetterSubagentConfigPage({ form, t: translate }) {
|
|
|
1343
1278
|
return () => clearTimeout(timer);
|
|
1344
1279
|
}, [notice]);
|
|
1345
1280
|
const [discovery, setDiscovery] = (0, import_react.useState)({});
|
|
1346
|
-
const [tab, setTab] = (0, import_react.useState)("general");
|
|
1347
|
-
const [backendTab, setBackendTab] = (0, import_react.useState)("codex");
|
|
1348
|
-
const navigationTabs = (0, import_react.useRef)({});
|
|
1349
1281
|
const latest = (0, import_react.useRef)(null);
|
|
1350
1282
|
const requests = (0, import_react.useRef)({});
|
|
1351
1283
|
const host = state?.status === "ready" ? shape(state.value) : null;
|
|
@@ -1510,7 +1442,6 @@ function BetterSubagentConfigPage({ form, t: translate }) {
|
|
|
1510
1442
|
const accepted = await form.mutate(ops, revision);
|
|
1511
1443
|
if (accepted) {
|
|
1512
1444
|
setNotice({ tone: "ok", text: translate("saved") });
|
|
1513
|
-
navigationTabs.current[tab]?.focus();
|
|
1514
1445
|
} else {
|
|
1515
1446
|
setDraft(null);
|
|
1516
1447
|
setGeneration((value) => value + 1);
|
|
@@ -1528,7 +1459,6 @@ function BetterSubagentConfigPage({ form, t: translate }) {
|
|
|
1528
1459
|
return;
|
|
1529
1460
|
}
|
|
1530
1461
|
setDiscardFor(null);
|
|
1531
|
-
navigationTabs.current[tab]?.focus();
|
|
1532
1462
|
requests.current = {};
|
|
1533
1463
|
setDiscovery({});
|
|
1534
1464
|
setDraft(null);
|
|
@@ -1536,29 +1466,11 @@ function BetterSubagentConfigPage({ form, t: translate }) {
|
|
|
1536
1466
|
setNotice(null);
|
|
1537
1467
|
};
|
|
1538
1468
|
const scopeActive = currentLive.subagents.eng || currentLive.subagents.global;
|
|
1539
|
-
const
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1469
|
+
const invalidSection = invalid?.titleKey?.startsWith("tier") ? "routing" : invalid?.titleKey ? "backends" : "trusted";
|
|
1470
|
+
const scrollToSection = (id) => {
|
|
1471
|
+
const doc = globalThis["document"];
|
|
1472
|
+
doc?.getElementById("bs-section-" + id)?.scrollIntoView?.({ block: "start" });
|
|
1543
1473
|
};
|
|
1544
|
-
const invalidTab = invalid?.titleKey?.startsWith("tier") ? "tiers" : invalid?.titleKey ? "cli" : "connection";
|
|
1545
|
-
const status = notice !== null ? h("span", { className: "bs-status", "data-tone": notice.tone, role: notice.tone === "error" ? "alert" : "status" }, notice.text) : invalid !== null ? h("span", { className: "bs-status", role: "alert" }, h(
|
|
1546
|
-
"button",
|
|
1547
|
-
{
|
|
1548
|
-
type: "button",
|
|
1549
|
-
className: "bs-button bs-errorLink",
|
|
1550
|
-
onClick: () => navigate(invalidTab, invalid.titleKey === "claudeTitle" ? "claude" : "codex")
|
|
1551
|
-
},
|
|
1552
|
-
translate(invalid.key, { backend: invalid.titleKey ? translate(invalid.titleKey) : "" })
|
|
1553
|
-
)) : null;
|
|
1554
|
-
const panelProps = (name) => ({
|
|
1555
|
-
id: "bs-settings-panel-" + name,
|
|
1556
|
-
className: "bs-tabpanel",
|
|
1557
|
-
role: "tabpanel",
|
|
1558
|
-
"aria-labelledby": "bs-settings-tab-" + name,
|
|
1559
|
-
tabIndex: 0,
|
|
1560
|
-
hidden: tab !== name
|
|
1561
|
-
});
|
|
1562
1474
|
return h(
|
|
1563
1475
|
"div",
|
|
1564
1476
|
{ className: "bs-cfg", "data-settings-dirty": dirty, "data-settings-busy": busy },
|
|
@@ -1578,147 +1490,22 @@ function BetterSubagentConfigPage({ form, t: translate }) {
|
|
|
1578
1490
|
writable ? null : h("span", { className: "bs-badge", role: "status", title: translate("readonly") }, translate("readonlyShort"))
|
|
1579
1491
|
)
|
|
1580
1492
|
),
|
|
1581
|
-
h(Tabs, { id: "bs-settings", label: translate("title"), value: tab, onChange: setTab, tabRefs: navigationTabs, items: [
|
|
1582
|
-
{ id: "general", label: translate("tabGeneral") },
|
|
1583
|
-
{ id: "cli", label: translate("tabCli") },
|
|
1584
|
-
{ id: "tiers", label: translate("tabTiers") },
|
|
1585
|
-
{ id: "connection", label: translate("tabConnection") }
|
|
1586
|
-
] }),
|
|
1587
1493
|
h(
|
|
1588
|
-
"
|
|
1589
|
-
|
|
1494
|
+
"section",
|
|
1495
|
+
{ className: "bs-section", id: "bs-section-routing", "aria-label": translate("routingTitle") },
|
|
1496
|
+
h("div", { className: "bs-sectionHead" }, h("h3", { className: "bs-sectionTitle" }, translate("routingTitle"))),
|
|
1497
|
+
h("p", { className: "bs-hint" }, translate("modelRecommendations")),
|
|
1498
|
+
routesState.status === "loading" ? h("p", { className: "bs-hint", role: "status" }, translate("routesLoading")) : allowed === null ? h("p", { className: "bs-note", "data-tone": "warn" }, translate("routesError")) : !allowed.enabled || allowed.routes.length === 0 ? h("p", { className: "bs-note", "data-tone": "warn" }, translate("tiersInactive")) : null,
|
|
1590
1499
|
h(
|
|
1591
|
-
"
|
|
1592
|
-
{ className: "bs-
|
|
1593
|
-
h("div", { className: "bs-sectionHead" }, h("h3", { className: "bs-sectionTitle" }, translate("routingTitle"))),
|
|
1594
|
-
h("p", { className: "bs-hint" }, translate("modelRecommendations")),
|
|
1500
|
+
"div",
|
|
1501
|
+
{ className: "bs-routingDiagram", "data-routing": "main-agent" },
|
|
1595
1502
|
h(
|
|
1596
1503
|
"div",
|
|
1597
|
-
{ className: "bs-
|
|
1598
|
-
h(
|
|
1599
|
-
|
|
1600
|
-
{ className: "bs-routingSource", id: "bs-routing-source" },
|
|
1601
|
-
h("span", { className: "bs-routingSourceLabel" }, translate("mainAgent")),
|
|
1602
|
-
h("span", { className: "bs-hint" }, translate("mainAgentNote"))
|
|
1603
|
-
),
|
|
1604
|
-
...TIERS.map((tier) => {
|
|
1605
|
-
const value = currentLive.tiers[tier];
|
|
1606
|
-
const current = routeKey(value);
|
|
1607
|
-
const title = translate(TIER_TITLE_KEYS[tier]);
|
|
1608
|
-
return h(
|
|
1609
|
-
"div",
|
|
1610
|
-
{ key: tier, className: "bs-routing" },
|
|
1611
|
-
h("span", { className: "bs-routingBranchGlyph", "aria-hidden": true }, "\u21B3"),
|
|
1612
|
-
h(
|
|
1613
|
-
"div",
|
|
1614
|
-
{ className: "bs-overviewName" },
|
|
1615
|
-
h("span", { className: "bs-routingLabel" }, title),
|
|
1616
|
-
h("span", { className: "bs-overviewMeta" }, translate(TIER_HINT_KEYS[tier]))
|
|
1617
|
-
),
|
|
1618
|
-
h("span", { className: "bs-routingModel bs-mono" }, current === "" ? translate("tierInherit") : current),
|
|
1619
|
-
h(
|
|
1620
|
-
"button",
|
|
1621
|
-
{
|
|
1622
|
-
type: "button",
|
|
1623
|
-
id: "bs-tier-" + tier + "-change",
|
|
1624
|
-
className: "bs-button",
|
|
1625
|
-
"data-variant": "outline",
|
|
1626
|
-
"data-tier-change": tier,
|
|
1627
|
-
onClick: () => navigate("tiers")
|
|
1628
|
-
},
|
|
1629
|
-
translate(current === "" ? "chooseModel" : "changeModel")
|
|
1630
|
-
)
|
|
1631
|
-
);
|
|
1632
|
-
})
|
|
1504
|
+
{ className: "bs-routingSource", id: "bs-routing-source" },
|
|
1505
|
+
h("span", { className: "bs-routingSourceLabel" }, translate("mainAgent")),
|
|
1506
|
+
h("span", { className: "bs-hint" }, translate("mainAgentNote"))
|
|
1633
1507
|
),
|
|
1634
|
-
h(
|
|
1635
|
-
),
|
|
1636
|
-
h(
|
|
1637
|
-
"section",
|
|
1638
|
-
{ className: "bs-section" },
|
|
1639
|
-
h("div", { className: "bs-sectionHead" }, h("h3", { className: "bs-sectionTitle" }, translate("backendsTitle"))),
|
|
1640
|
-
h("p", { className: "bs-hint" }, translate("backendsIntro")),
|
|
1641
|
-
h("div", { className: "bs-overview" }, BACKENDS.map((spec) => {
|
|
1642
|
-
const backend = currentLive.subagents[spec.cli];
|
|
1643
|
-
const title = spec.cli === "codex" ? "Codex" : "Claude";
|
|
1644
|
-
return h(
|
|
1645
|
-
"button",
|
|
1646
|
-
{
|
|
1647
|
-
key: spec.cli,
|
|
1648
|
-
type: "button",
|
|
1649
|
-
id: "bs-open-" + spec.cli,
|
|
1650
|
-
className: "bs-overviewRow",
|
|
1651
|
-
"aria-label": translate("configureBackend", { backend: title }),
|
|
1652
|
-
onClick: () => navigate("cli", spec.cli)
|
|
1653
|
-
},
|
|
1654
|
-
h("span", { className: "bs-overviewGlyph", "aria-hidden": true }, h("svg", { width: 16, height: 16, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", strokeLinejoin: "round" }, h("path", { d: "M4 5h16v14H4Zm4 5 2 2-2 2m5 0h3" }))),
|
|
1655
|
-
h(
|
|
1656
|
-
"span",
|
|
1657
|
-
{ className: "bs-overviewName" },
|
|
1658
|
-
h("span", null, title),
|
|
1659
|
-
h("span", { className: "bs-overviewMeta bs-mono" }, backend.enabled ? translate("modelCount", { count: backend.models.length }) + (backend.defaultModel ? " \xB7 " + backend.defaultModel : "") : "")
|
|
1660
|
-
),
|
|
1661
|
-
h(
|
|
1662
|
-
"span",
|
|
1663
|
-
{ className: "bs-badge", "data-active": backend.enabled && scopeActive },
|
|
1664
|
-
h("span", { className: "bs-dot", "data-active": backend.enabled && scopeActive, "aria-hidden": true }),
|
|
1665
|
-
translate(!backend.enabled ? "inactive" : !scopeActive ? "scopeInactive" : "configured")
|
|
1666
|
-
),
|
|
1667
|
-
h(Chevron)
|
|
1668
|
-
);
|
|
1669
|
-
}))
|
|
1670
|
-
)
|
|
1671
|
-
),
|
|
1672
|
-
h(
|
|
1673
|
-
"div",
|
|
1674
|
-
panelProps("cli"),
|
|
1675
|
-
h(Tabs, {
|
|
1676
|
-
id: "bs-backend",
|
|
1677
|
-
label: translate("tabCli"),
|
|
1678
|
-
compact: true,
|
|
1679
|
-
value: backendTab,
|
|
1680
|
-
onChange: setBackendTab,
|
|
1681
|
-
items: BACKENDS.map((spec) => ({ id: spec.cli, label: spec.cli === "codex" ? "Codex" : "Claude", active: currentLive.subagents[spec.cli].enabled && scopeActive }))
|
|
1682
|
-
}),
|
|
1683
|
-
...BACKENDS.map((spec) => h(
|
|
1684
|
-
"div",
|
|
1685
|
-
{
|
|
1686
|
-
key: spec.cli,
|
|
1687
|
-
id: "bs-backend-panel-" + spec.cli,
|
|
1688
|
-
role: "tabpanel",
|
|
1689
|
-
"aria-labelledby": "bs-backend-tab-" + spec.cli,
|
|
1690
|
-
tabIndex: 0,
|
|
1691
|
-
hidden: backendTab !== spec.cli
|
|
1692
|
-
},
|
|
1693
|
-
h(BackendCard, {
|
|
1694
|
-
spec,
|
|
1695
|
-
backend: currentLive.subagents[spec.cli],
|
|
1696
|
-
disabled: !writable || busy,
|
|
1697
|
-
capabilities,
|
|
1698
|
-
discovery,
|
|
1699
|
-
discoveryMatches: currentLive.subagents[spec.cli].executable === host.subagents[spec.cli].executable && currentLive.subagents[spec.cli].profile === host.subagents[spec.cli].profile,
|
|
1700
|
-
scopeActive,
|
|
1701
|
-
t: translate,
|
|
1702
|
-
generation,
|
|
1703
|
-
onPatch: (patch) => patchBackend(spec, patch),
|
|
1704
|
-
onModelPatch: (index, patch) => patchModel(spec, index, patch),
|
|
1705
|
-
onModelAdd: () => addModel(spec),
|
|
1706
|
-
onModelRemove: (index) => removeModel(spec, index),
|
|
1707
|
-
onDiscover: () => discoverModels(spec),
|
|
1708
|
-
onDiagnostics: () => navigate("connection")
|
|
1709
|
-
})
|
|
1710
|
-
))
|
|
1711
|
-
),
|
|
1712
|
-
h(
|
|
1713
|
-
"div",
|
|
1714
|
-
panelProps("tiers"),
|
|
1715
|
-
h(
|
|
1716
|
-
"section",
|
|
1717
|
-
{ className: "bs-section" },
|
|
1718
|
-
h("div", { className: "bs-sectionHead" }, h("h3", { className: "bs-sectionTitle" }, translate("tiersTitle"))),
|
|
1719
|
-
h("p", { className: "bs-hint" }, translate("tiersIntro")),
|
|
1720
|
-
routesState.status === "loading" ? h("p", { className: "bs-hint", role: "status" }, translate("routesLoading")) : allowed === null ? h("p", { className: "bs-note", "data-tone": "warn" }, translate("routesError")) : !allowed.enabled || allowed.routes.length === 0 ? h("p", { className: "bs-note", "data-tone": "warn" }, translate("tiersInactive")) : null,
|
|
1721
|
-
h("div", { className: "bs-tierGrid" }, ...TIERS.map((tier) => h(TierRow, {
|
|
1508
|
+
...TIERS.map((tier) => h(TierRow, {
|
|
1722
1509
|
key: tier,
|
|
1723
1510
|
tier,
|
|
1724
1511
|
value: currentLive.tiers[tier],
|
|
@@ -1726,132 +1513,160 @@ function BetterSubagentConfigPage({ form, t: translate }) {
|
|
|
1726
1513
|
disabled: !writable || busy,
|
|
1727
1514
|
t: translate,
|
|
1728
1515
|
onPatch: (patch) => patchTier(tier, patch)
|
|
1729
|
-
}))
|
|
1730
|
-
)
|
|
1516
|
+
}))
|
|
1517
|
+
),
|
|
1518
|
+
h("p", { className: "bs-hint bs-routingNote" }, translate("routingNote"))
|
|
1731
1519
|
),
|
|
1732
1520
|
h(
|
|
1733
|
-
"
|
|
1734
|
-
|
|
1735
|
-
h(
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1521
|
+
"section",
|
|
1522
|
+
{ className: "bs-section", id: "bs-section-backends", "aria-label": translate("backendsTitle") },
|
|
1523
|
+
h("div", { className: "bs-sectionHead" }, h("h3", { className: "bs-sectionTitle" }, translate("backendsTitle"))),
|
|
1524
|
+
h("p", { className: "bs-hint" }, translate("backendsIntro")),
|
|
1525
|
+
...BACKENDS.map((spec) => h(BackendCard, {
|
|
1526
|
+
key: spec.cli,
|
|
1527
|
+
spec,
|
|
1528
|
+
backend: currentLive.subagents[spec.cli],
|
|
1529
|
+
disabled: !writable || busy,
|
|
1530
|
+
capabilities,
|
|
1531
|
+
discovery,
|
|
1532
|
+
discoveryMatches: currentLive.subagents[spec.cli].executable === host.subagents[spec.cli].executable && currentLive.subagents[spec.cli].profile === host.subagents[spec.cli].profile,
|
|
1533
|
+
scopeActive,
|
|
1534
|
+
t: translate,
|
|
1535
|
+
generation,
|
|
1536
|
+
onPatch: (patch) => patchBackend(spec, patch),
|
|
1537
|
+
onModelPatch: (index, patch) => patchModel(spec, index, patch),
|
|
1538
|
+
onModelAdd: () => addModel(spec),
|
|
1539
|
+
onModelRemove: (index) => removeModel(spec, index),
|
|
1540
|
+
onDiscover: () => discoverModels(spec),
|
|
1541
|
+
onDiagnostics: () => scrollToSection("diagnostics")
|
|
1542
|
+
}))
|
|
1543
|
+
),
|
|
1544
|
+
h(
|
|
1545
|
+
"section",
|
|
1546
|
+
{ className: "bs-section", id: "bs-section-scope", "aria-label": translate("scopeTitle") },
|
|
1547
|
+
h("div", { className: "bs-sectionHead" }, h("h3", { className: "bs-sectionTitle" }, translate("scopeTitle"))),
|
|
1548
|
+
h(SwitchRow, {
|
|
1549
|
+
id: "bs-scope-eng",
|
|
1550
|
+
label: currentLive.subagents.global ? translate("scopeEngIncluded") : translate("scopeEng"),
|
|
1551
|
+
hint: currentLive.subagents.global ? translate("globalOverrides") : translate("scopeEngHint"),
|
|
1552
|
+
checked: currentLive.subagents.global ? true : currentLive.subagents.eng,
|
|
1553
|
+
disabled: !writable || busy || currentLive.subagents.global,
|
|
1554
|
+
onChange: (eng) => edit((current) => ({ ...current, subagents: { ...current.subagents, eng } }))
|
|
1555
|
+
}),
|
|
1556
|
+
h(SwitchRow, {
|
|
1557
|
+
id: "bs-scope-global",
|
|
1558
|
+
label: translate("scopeGlobal"),
|
|
1559
|
+
hint: translate("scopeGlobalHint"),
|
|
1560
|
+
checked: currentLive.subagents.global,
|
|
1561
|
+
disabled: !writable || busy,
|
|
1562
|
+
onChange: (global) => edit((current) => ({ ...current, subagents: { ...current.subagents, global } }))
|
|
1563
|
+
}),
|
|
1564
|
+
!scopeActive ? h("p", { className: "bs-note", "data-tone": "warn" }, translate("scopeNone")) : null
|
|
1565
|
+
),
|
|
1566
|
+
h(
|
|
1567
|
+
"section",
|
|
1568
|
+
{ className: "bs-section", id: "bs-section-behavior", "aria-label": translate("behaviorTitle") },
|
|
1569
|
+
h("div", { className: "bs-sectionHead" }, h("h3", { className: "bs-sectionTitle" }, translate("behaviorTitle"))),
|
|
1570
|
+
h(SwitchRow, {
|
|
1571
|
+
id: "bs-delegation-prompt",
|
|
1572
|
+
label: translate("delegationPromptLabel"),
|
|
1573
|
+
hint: translate("delegationPromptHint"),
|
|
1574
|
+
checked: currentLive.delegationPrompt,
|
|
1575
|
+
disabled: !writable || busy,
|
|
1576
|
+
onChange: (delegationPrompt) => edit((current) => ({ ...current, delegationPrompt }))
|
|
1577
|
+
}),
|
|
1578
|
+
h(SwitchRow, {
|
|
1579
|
+
id: "bs-child-exit-guard",
|
|
1580
|
+
label: translate("childExitGuardLabel"),
|
|
1581
|
+
hint: translate("childExitGuardHint"),
|
|
1582
|
+
checked: currentLive.childExitGuard,
|
|
1583
|
+
disabled: !writable || busy,
|
|
1584
|
+
onChange: (childExitGuard) => edit((current) => ({ ...current, childExitGuard }))
|
|
1585
|
+
})
|
|
1586
|
+
),
|
|
1587
|
+
h(
|
|
1588
|
+
"section",
|
|
1589
|
+
{ className: "bs-section", id: "bs-section-diagnostics", "aria-label": translate("readonlyDiagnostics") },
|
|
1757
1590
|
h(
|
|
1758
|
-
"
|
|
1759
|
-
{ className: "bs-
|
|
1760
|
-
h("
|
|
1761
|
-
h(
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
disabled:
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
checked: currentLive.childExitGuard,
|
|
1774
|
-
disabled: !writable || busy,
|
|
1775
|
-
onChange: (childExitGuard) => edit((current) => ({ ...current, childExitGuard }))
|
|
1776
|
-
})
|
|
1591
|
+
"div",
|
|
1592
|
+
{ className: "bs-sectionHead" },
|
|
1593
|
+
h("h3", { className: "bs-sectionTitle" }, translate("readonlyDiagnostics")),
|
|
1594
|
+
h("button", {
|
|
1595
|
+
type: "button",
|
|
1596
|
+
id: "bs-refresh",
|
|
1597
|
+
className: "bs-button",
|
|
1598
|
+
"data-variant": "outline",
|
|
1599
|
+
disabled: capabilities.status === "loading" || routesState.status === "loading",
|
|
1600
|
+
"aria-busy": capabilities.status === "loading" || routesState.status === "loading",
|
|
1601
|
+
onClick: () => {
|
|
1602
|
+
capabilities.reload();
|
|
1603
|
+
routesState.reload();
|
|
1604
|
+
}
|
|
1605
|
+
}, translate("refresh"))
|
|
1777
1606
|
),
|
|
1778
1607
|
h(
|
|
1779
|
-
"
|
|
1780
|
-
{ className: "bs-
|
|
1608
|
+
"div",
|
|
1609
|
+
{ className: "bs-metricGrid" },
|
|
1781
1610
|
h(
|
|
1782
1611
|
"div",
|
|
1783
|
-
{ className: "bs-
|
|
1784
|
-
h("
|
|
1785
|
-
h("
|
|
1786
|
-
type: "button",
|
|
1787
|
-
id: "bs-refresh",
|
|
1788
|
-
className: "bs-button",
|
|
1789
|
-
"data-variant": "outline",
|
|
1790
|
-
disabled: capabilities.status === "loading" || routesState.status === "loading",
|
|
1791
|
-
"aria-busy": capabilities.status === "loading" || routesState.status === "loading",
|
|
1792
|
-
onClick: () => {
|
|
1793
|
-
capabilities.reload();
|
|
1794
|
-
routesState.reload();
|
|
1795
|
-
}
|
|
1796
|
-
}, translate("refresh"))
|
|
1612
|
+
{ className: "bs-metric" },
|
|
1613
|
+
h("span", { className: "bs-metricLabel" }, translate("connectionMode")),
|
|
1614
|
+
h("span", { className: "bs-metricValue" }, translate(writable ? "connectionWritable" : "connectionReadonly"))
|
|
1797
1615
|
),
|
|
1798
1616
|
h(
|
|
1799
1617
|
"div",
|
|
1800
|
-
{ className: "bs-
|
|
1801
|
-
h(
|
|
1802
|
-
|
|
1803
|
-
{ className: "bs-metric" },
|
|
1804
|
-
h("span", { className: "bs-metricLabel" }, translate("connectionMode")),
|
|
1805
|
-
h("span", { className: "bs-metricValue" }, translate(writable ? "connectionWritable" : "connectionReadonly"))
|
|
1806
|
-
),
|
|
1807
|
-
h(
|
|
1808
|
-
"div",
|
|
1809
|
-
{ className: "bs-metric" },
|
|
1810
|
-
h("span", { className: "bs-metricLabel" }, translate("capabilitiesLabel")),
|
|
1811
|
-
h("span", { className: "bs-metricValue", role: "status" }, capabilities.status === "ready" ? translate("ready") : capabilities.status === "loading" ? translate("loading") : translate("failed"))
|
|
1812
|
-
),
|
|
1813
|
-
h(
|
|
1814
|
-
"div",
|
|
1815
|
-
{ className: "bs-metric" },
|
|
1816
|
-
h("span", { className: "bs-metricLabel" }, translate("routesLabel")),
|
|
1817
|
-
h("span", { className: "bs-metricValue", role: "status" }, routesState.status === "loading" ? translate("loading") : allowed === null ? translate("failed") : !allowed.enabled ? translate("inactive") : translate("modelCount", { count: allowed.routes.length }))
|
|
1818
|
-
)
|
|
1618
|
+
{ className: "bs-metric" },
|
|
1619
|
+
h("span", { className: "bs-metricLabel" }, translate("capabilitiesLabel")),
|
|
1620
|
+
h("span", { className: "bs-metricValue", role: "status" }, capabilities.status === "ready" ? translate("ready") : capabilities.status === "loading" ? translate("loading") : translate("failed"))
|
|
1819
1621
|
),
|
|
1820
|
-
|
|
1622
|
+
h(
|
|
1821
1623
|
"div",
|
|
1822
|
-
{
|
|
1823
|
-
h("span",
|
|
1824
|
-
h("
|
|
1825
|
-
)
|
|
1624
|
+
{ className: "bs-metric" },
|
|
1625
|
+
h("span", { className: "bs-metricLabel" }, translate("routesLabel")),
|
|
1626
|
+
h("span", { className: "bs-metricValue", role: "status" }, routesState.status === "loading" ? translate("loading") : allowed === null ? translate("failed") : !allowed.enabled ? translate("inactive") : translate("modelCount", { count: allowed.routes.length }))
|
|
1627
|
+
)
|
|
1826
1628
|
),
|
|
1629
|
+
...BACKENDS.map((spec) => h(
|
|
1630
|
+
"div",
|
|
1631
|
+
{ key: spec.cli, className: "bs-connectionRow", "data-backend": spec.cli },
|
|
1632
|
+
h("span", null, spec.cli === "codex" ? "Codex" : "Claude"),
|
|
1633
|
+
h("p", { className: "bs-hint bs-mono", role: "status" }, detectionOf(capabilities, spec, host.subagents[spec.cli], translate))
|
|
1634
|
+
))
|
|
1635
|
+
),
|
|
1636
|
+
h(
|
|
1637
|
+
"section",
|
|
1638
|
+
{ className: "bs-section", id: "bs-section-trusted", "aria-label": translate("trustedHostsAdvanced") },
|
|
1827
1639
|
h(
|
|
1828
|
-
|
|
1829
|
-
{
|
|
1640
|
+
Advanced,
|
|
1641
|
+
{ label: translate("trustedHostsAdvanced"), summary: currentLive.trustedHosts.length ? translate("trustedCount", { count: currentLive.trustedHosts.length }) : translate("trustedDefault") },
|
|
1830
1642
|
h(
|
|
1831
|
-
|
|
1832
|
-
{
|
|
1833
|
-
h(
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
t: translate,
|
|
1841
|
-
onChange: (trustedHosts) => edit((current) => ({ ...current, trustedHosts }))
|
|
1842
|
-
})
|
|
1843
|
-
)
|
|
1643
|
+
Field,
|
|
1644
|
+
{ id: "bs-trusted-hosts", label: translate("trustedHostsLabel"), hint: translate("trustedHostsHint") },
|
|
1645
|
+
h(HostList, {
|
|
1646
|
+
key: generation,
|
|
1647
|
+
hosts: currentLive.trustedHosts,
|
|
1648
|
+
disabled: !writable || busy,
|
|
1649
|
+
t: translate,
|
|
1650
|
+
onChange: (trustedHosts) => edit((current) => ({ ...current, trustedHosts }))
|
|
1651
|
+
})
|
|
1844
1652
|
)
|
|
1845
1653
|
)
|
|
1846
1654
|
),
|
|
1847
|
-
notice !== null || invalid !== null ? h(
|
|
1848
|
-
dirty ? h(
|
|
1655
|
+
dirty || notice !== null || invalid !== null ? h(
|
|
1849
1656
|
"div",
|
|
1850
1657
|
{ className: "bs-footer" },
|
|
1851
|
-
h(
|
|
1658
|
+
h(
|
|
1659
|
+
"span",
|
|
1660
|
+
{ className: "bs-status", "data-tone": notice?.tone, role: notice?.tone === "error" ? "alert" : "status" },
|
|
1661
|
+
notice !== null ? notice.text : invalid !== null ? h(
|
|
1662
|
+
"a",
|
|
1663
|
+
{ className: "bs-errorLink", href: "#bs-section-" + invalidSection },
|
|
1664
|
+
translate(invalid.key, { backend: invalid.titleKey ? translate(invalid.titleKey) : "" })
|
|
1665
|
+
) : translate("changeCount", { count: changeCount })
|
|
1666
|
+
),
|
|
1852
1667
|
h(
|
|
1853
1668
|
"button",
|
|
1854
|
-
{ type: "button", className: "bs-button", "data-variant": "outline", disabled: busy, onClick: reset },
|
|
1669
|
+
{ type: "button", className: "bs-button", "data-variant": "outline", hidden: !dirty, disabled: busy, onClick: reset },
|
|
1855
1670
|
translate(discardFor === dirtyKey ? "resetConfirm" : "reset")
|
|
1856
1671
|
),
|
|
1857
1672
|
h(
|
|
@@ -1860,6 +1675,7 @@ function BetterSubagentConfigPage({ form, t: translate }) {
|
|
|
1860
1675
|
type: "button",
|
|
1861
1676
|
className: "bs-button",
|
|
1862
1677
|
"data-variant": "primary",
|
|
1678
|
+
hidden: !dirty,
|
|
1863
1679
|
disabled: !writable || busy || invalid !== null,
|
|
1864
1680
|
"aria-busy": busy,
|
|
1865
1681
|
onClick: () => void save()
|
package/lib/subagents.js
CHANGED
|
@@ -218,10 +218,8 @@ export function installCliRouting(ctx, config, sessions) {
|
|
|
218
218
|
return next();
|
|
219
219
|
if (!['subagent', 'list_subagent_models'].includes(exec.name))
|
|
220
220
|
return next();
|
|
221
|
-
//
|
|
222
|
-
//
|
|
223
|
-
if (!ctx.tools.executable(exec.name, exec.agent, exec.toolSet))
|
|
224
|
-
return next();
|
|
221
|
+
// alpha.3 resolves the registered definition before this wrapper runs, so an
|
|
222
|
+
// unadmitted call never reaches here; creating a CLI child is admitted.
|
|
225
223
|
if (exec.name === 'subagent' && cliName(args.provider)) {
|
|
226
224
|
const signal = AbortSignal.any([exec.signal, lifetime.signal]);
|
|
227
225
|
const creation = (async () => {
|
package/lib/subagents.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subagents.js","sourceRoot":"","sources":["../src/subagents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAYH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,gBAAgB,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACxG,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAMpF,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAc,CAAA;AACtD,MAAM,OAAO,GAAG,CAAC,QAAiB,EAAuB,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAmB,CAAC,CAAC,CAAC,CAAC,QAAmB,CAAC,CAAC,CAAC,SAAS,CAAA;AACrI,MAAM,aAAa,GAAG,CAAC,QAAiB,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,QAAwC,CAAC,CAAA;AACzH,MAAM,OAAO,GAAG,CAAC,KAAoC,EAAwB,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAA;AAExH;;;;;;GAMG;AACH,SAAS,cAAc,CAAC,GAAY;IAClC,IAA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Q,EAAE,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,kBAAkB,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;QACjH,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,OAAO,CAAC,CAAA;QAC/C,MAAM,QAAQ,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAA;QACzF,IAAI,WAAW,GAAG,KAAK,IAAI,EAAE,GAAE,CAAC,CAAA;QAChC,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,EAAE;YAC9B,MAAM,WAAW,EAAE,CAAA;YACnB,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAA;YAC/D,MAAM,QAAQ,CAAC,KAAK,EAAE,CAAA;QACxB,CAAC,CAAC,CAAA;QACF,yEAAyE;QACzE,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,OAAgC,CAAC,CAAC,CAAA;QACnI,WAAW,GAAG,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAA;IAC5D,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["/**\n * CLI subagent routing bridge: extends the existing `subagent` tool with the\n * external `codex`/`claude` providers, registers the managed llm adapters and\n * owns the durable identity store. It does NOT register spawn/fork tools or a\n * second subagent registry: CLI children are native spawn children using the\n * synthetic `apollo-cli-*` route.\n *\n * Prompt sections (delegation/tiers/CLI catalog/guard wording) live in\n * `src/prompt.js`, registered per agent; this module only contributes the\n * catalog text it can render from live configuration.\n */\n\nimport type { Context } from '@deepseek-ai/cordis'\nimport type { Agent } from '@deepseek-ai/dsh-agent'\nimport type { LlmAdapter, ReasoningEffortId } from '@deepseek-ai/dsh-llm'\nimport type { SessionId } from '@deepseek-ai/dsh-session'\nimport type { SubagentActivation } from '@deepseek-ai/dsh-subagent'\nimport type { ToolDispatchExecution, ToolExecution, ToolExecutionSuccess } from '@deepseek-ai/dsh-tools'\nimport type {} from '@deepseek-ai/dsh-subprocess'\nimport type {} from '@deepseek-ai/dsh-working-directory'\nimport type { CliSessions } from './cli-sessions.js'\n\nimport { randomUUID } from 'node:crypto'\nimport { homedir } from 'node:os'\nimport { join, isAbsolute, resolve } from 'node:path'\nimport { normalizeConfig } from './config.js'\nimport { CLI_DISPLAY_NAMES, CLI_ROUTES, createCliAdapter, enabledIn, selectCli } from './cli-adapter.js'\nimport { openCliSessions } from './cli-sessions.js'\nimport { CLI_MIN_LABELS, assertCliVersion, probeCliVersion } from './cli/version.js'\n\ntype CliName = keyof typeof CLI_ROUTES\ntype CliArguments = { provider?: unknown; model?: unknown; reasoning_effort?: unknown; cwd?: unknown; prompt?: unknown; description?: unknown; run_in_background?: unknown; agent_preset?: unknown }\ntype Unpublished = { parent?: Agent; id: SessionId; name: string; activation: SubagentActivation; cleanup?: Promise<void> }\n\nconst CLI_NAMES = Object.keys(CLI_ROUTES) as CliName[]\nconst cliName = (provider: unknown): CliName | undefined => CLI_NAMES.includes(provider as CliName) ? provider as CliName : undefined\nconst internalRoute = (provider: unknown) => Object.values(CLI_ROUTES).includes(provider as (typeof CLI_ROUTES)[CliName])\nconst success = (value: ToolExecutionSuccess['value']): ToolExecutionSuccess => ({ isError: false, value, content: [] })\n\n/**\n * Read the optional version-probe seam without requiring an inject declaration.\n * The real host context throws on a bare unknown property; tests may expose it\n * as a plain function.\n * @param ctx - runtime context.\n * @returns a `(executable, options) => Promise<string>` probe.\n */\nfunction versionProbeOf(ctx: Context) {\n try {\n const probe = ctx.get?.('cliVersionProbe')\n if (typeof probe === 'function') return probe\n } catch { /* optional service not visible */ }\n try {\n if (typeof ctx.cliVersionProbe === 'function') return ctx.cliVersionProbe\n } catch { /* property access requires inject in this composition */ }\n return probeCliVersion\n}\n\nexport function cliCatalog(config: unknown, request: Pick<CliArguments, 'provider' | 'model'> = {}) {\n const providers = CLI_NAMES.filter((cli) => normalizeConfig(config).subagents[cli].enabled)\n if (request.provider === undefined) return providers.map((cli) => `${cli} — ${CLI_DISPLAY_NAMES[cli]} CLI (background continuable subagents)`).join('\\n')\n const cli = cliName(request.provider)\n if (!cli) return ''\n const backend = normalizeConfig(config).subagents[cli]\n if (!backend.enabled) throw new Error(`Better Subagent ${cli} backend is disabled`)\n if (request.model === undefined) return backend.models.map((model) => `${cli}/${model.id}${model.id === backend.defaultModel ? ' (default)' : ''}`).join('\\n') || '(no allowed models)'\n const model = backend.models.find((item) => item.id === request.model)\n if (!model) throw new Error(`Better Subagent ${cli} model \"${request.model}\" is not allowed`)\n return `${cli}/${model.id}\\nReasoning efforts:\\n${model.efforts.map((effort) => `${effort}${effort === model.defaultEffort ? ' (default)' : ''}`).join('\\n')}`\n}\n\n/**\n * Resolve the child's initial absolute directory from the parent's effective one.\n *\n * The Session header keeps the original project directory, so it can be stale\n * after a working-directory change; the working-directory service is the only\n * authority for the parent's current directory. An absolute explicit `cwd`\n * needs no such lookup, a relative one resolves against that current directory,\n * and omission inherits it. Resolving here keeps the KV record and the\n * manager's pinned initial directory identical.\n * @param {object} ctx - runtime owning the working-directory service.\n * @param {object} parent - calling Agent whose directory is inherited.\n * @param {unknown} requested - explicit tool `cwd`, already schema-validated upstream.\n * @param {AbortSignal} signal - cancellation for the directory inspection.\n * @returns {Promise<string>} absolute child directory.\n */\nasync function childCwd(ctx: Context, parent: Agent, requested: unknown, signal: AbortSignal) {\n if (requested !== undefined && typeof requested !== 'string') throw new Error('cwd must be a string')\n signal.throwIfAborted()\n if (requested !== undefined && isAbsolute(requested)) return requested\n const current = await ctx.workingDirectory.ensure(parent, signal)\n signal.throwIfAborted()\n if (!current || !isAbsolute(current)) throw new Error('Better Subagent CLI subagent requires an absolute session working directory')\n return requested === undefined ? current : resolve(current, requested)\n}\n\nexport async function startCliSubagent(ctx: Context, config: unknown, sessions: CliSessions, args: CliArguments, exec: Pick<ToolDispatchExecution, 'agent' | 'signal'>) {\n const cli = cliName(args.provider)\n if (!cli) throw new Error('Unknown Better Subagent CLI provider')\n const parent = exec.agent\n if (!parent) throw new Error('Better Subagent subagent requires a calling Agent')\n if (!enabledIn(config, parent)) throw new Error('Better Subagent CLI subagents are disabled for this preset')\n if (args.run_in_background !== undefined) throw new Error('run_in_background was removed for CLI subagents; they always run in the background and are continued with send_message')\n if (args.agent_preset !== undefined) throw new Error('agent_preset is not supported for CLI subagents yet')\n if (typeof args.prompt !== 'string' || typeof args.description !== 'string') throw new Error('subagent requires a prompt and description')\n const selected = selectCli(config, cli, args.model as string | undefined, args.reasoning_effort as string | undefined)\n const cwd = await childCwd(ctx, parent, args.cwd, exec.signal)\n let executable\n try {\n const command = selected.executable.startsWith('~/') ? join(homedir(), selected.executable.slice(2)) : selected.executable\n executable = await ctx.subprocess.resolveExecutable(command, undefined, exec.signal)\n } catch (error) {\n exec.signal.throwIfAborted()\n throw new Error(`Better Subagent ${cli} executable is unavailable; install ${cli} ${CLI_MIN_LABELS[cli]} or newer, make sure it is on PATH, or set its absolute path in Plugins → Better Subagent`, { cause: error })\n }\n // Version preflight before any durable identity exists: an installed but\n // incompatible CLI must fail with an actionable diagnostic, not fail later\n // mid-turn or fall back to another backend.\n const probe = versionProbeOf(ctx)\n let versionOutput\n try {\n versionOutput = await probe(executable, { signal: exec.signal })\n } catch (error) {\n exec.signal.throwIfAborted()\n throw new Error(`Better Subagent ${cli} version check failed (${executable}); install ${cli} ${CLI_MIN_LABELS[cli]} or newer and make sure \\`${cli} --version\\` works, or set its absolute path in Plugins → Better Subagent`, { cause: error })\n }\n exec.signal.throwIfAborted()\n assertCliVersion(cli, versionOutput, executable)\n const id = randomUUID() as SessionId\n const record = {\n version: 1 as const, id, parentId: parent.id, cli, cwd,\n executable, profile: cli === 'codex' ? selected.profile : '',\n cliHome: cli === 'codex' ? process.env.CODEX_HOME ?? join(homedir(), '.codex')\n : process.env.CLAUDE_CONFIG_DIR ?? join(homedir(), '.claude'),\n // Explicit CLAUDE_CONFIG_DIR changes config and keychain lookup, even for ~/.claude.\n ...(cli === 'claude' && process.env.CLAUDE_CONFIG_DIR === undefined ? { claudeDefaultHome: true } : {}),\n model: selected.model, effort: selected.effort, delivered: [], started: false,\n }\n await sessions.put(record)\n let created: SubagentActivation | undefined\n try {\n exec.signal.throwIfAborted()\n const maxDepth = ctx.subagents.resolveMaxDepth()\n created = await ctx.subagents.startActivation({\n provider: 'spawn', label: args.description, childId: id, signal: exec.signal,\n delivery: 'parent',\n parent, prompt: [{ type: 'text', text: args.prompt }], cwd,\n agentOptions: { provider: CLI_ROUTES[cli], model: selected.model, reasoningEffort: selected.effort as ReasoningEffortId },\n ...(maxDepth === undefined ? {} : { maxDepth }),\n })\n exec.signal.throwIfAborted()\n // rc.2's native subagent tool returns the tree name, not the durable id.\n return { kind: 'activation', name: created.name ?? created.childId, childId: created.childId, activation: created }\n } catch (error) {\n // rc.2 rolls back pre-admission failures in the manager. A published\n // activation still needs explicit disposal for the post-admission abort race.\n if (created !== undefined) {\n try { await created.dispose() } catch (disposeError) {\n ctx.logger?.warn?.(`Better Subagent could not dispose canceled CLI child ${id}: ${(disposeError as Error).message}`)\n }\n }\n await sessions.delete(id)\n throw error\n }\n}\n\n/** Host-level interception extends existing tools without replacing registrations. */\nexport function installCliRouting(ctx: Context, config: unknown, sessions: CliSessions) {\n const unpublished = new Map<ToolExecution['token'] | ToolExecution, Unpublished>()\n const cleanups = new Set<Promise<void>>()\n const creating = new Set<Promise<ToolExecutionSuccess>>()\n const lifetime = new AbortController()\n const reclaim = (entry: Unpublished) => {\n if (entry.cleanup) return entry.cleanup\n const task = (async () => {\n try { await entry.activation?.dispose() } finally { await sessions.delete(entry.id) }\n })()\n entry.cleanup = task\n cleanups.add(task)\n task.catch((error) => ctx.logger?.warn?.(`Better Subagent could not reclaim unreported CLI child ${entry.id}: ${error.message}`))\n .finally(() => cleanups.delete(task))\n return task\n }\n ctx.on('tools/result', (exec, result) => {\n const key = exec.token ?? exec\n const entry = unpublished.get(key)\n if (!entry) return\n unpublished.delete(key)\n if (!result.isError && (result.value as { kind?: unknown } | null)?.kind === 'activation' && (result.value as { name?: unknown }).name === entry.name) return\n void reclaim(entry)\n })\n ctx.tools.guard((exec) => {\n const args = (exec.arguments ?? {}) as CliArguments\n if (!['subagent', 'subagent_fork'].includes(exec.name)) return\n if (internalRoute(args.provider)) return 'Use provider=\"codex\" or provider=\"claude\" with subagent; internal CLI routes are reserved'\n const selected = cliName(args.provider)\n if (selected && !enabledIn(config, exec.agent)) return 'Better Subagent CLI subagents are disabled for this preset'\n if (exec.name === 'subagent_fork' && (selected || (args.provider === undefined && internalRoute(exec.agent?.options.provider)))) {\n return 'Codex/Claude support background subagent creation only; subagent_fork cannot create a CLI child'\n }\n })\n ctx.on('tools/execute', async (exec, next) => {\n const args = (exec.arguments ?? {}) as CliArguments\n if (!enabledIn(config, exec.agent)) return next()\n if (!['subagent', 'list_subagent_models'].includes(exec.name)) return next()\n // Around-dispatch runs before the native lookup: do not create a CLI child\n // (or publish its catalog) when this step did not admit the original tool.\n if (!ctx.tools.executable(exec.name, exec.agent, exec.toolSet)) return next()\n if (exec.name === 'subagent' && cliName(args.provider)) {\n const signal = AbortSignal.any([exec.signal, lifetime.signal])\n const creation = (async () => {\n const created = await startCliSubagent(ctx, config, sessions, args, { ...exec, signal })\n const { activation, childId, ...value } = created\n unpublished.set(exec.token ?? exec, { parent: exec.agent, id: childId, name: value.name, activation })\n return success(value)\n })()\n creating.add(creation)\n try { return await creation } finally { creating.delete(creation) }\n }\n if (exec.name !== 'list_subagent_models') return next()\n if (cliName(args.provider)) return success(cliCatalog(config, args))\n if (args.provider !== undefined || args.model !== undefined) return next()\n const base = await next()\n const extra = cliCatalog(config)\n if (base.isError || !extra) return base\n return success([base.value, extra].filter(Boolean).join('\\n'))\n })\n return async () => {\n lifetime.abort(new Error('Better Subagent CLI routing unloaded'))\n await Promise.allSettled([...creating])\n await Promise.allSettled([...unpublished.values()].map(reclaim))\n unpublished.clear()\n await Promise.allSettled([...cleanups])\n }\n}\n\nexport function mountSubagents(ctx: Context, config: unknown) {\n ctx.inject(['tools', 'subagents', 'agents', 'llm', 'storage', 'subprocess', 'workingDirectory'], async (runtime) => {\n const sessions = await openCliSessions(runtime)\n const adapters = CLI_NAMES.map((cli) => createCliAdapter(runtime, config, sessions, cli))\n let stopRouting = async () => {}\n runtime.effect(() => async () => {\n await stopRouting()\n await Promise.all(adapters.map((adapter) => adapter.dispose()))\n await sessions.close()\n })\n // Existing CLI adapters predate the unused imageRequestTarget host slot.\n adapters.forEach((adapter, index) => runtime.llm.registerAdapter([CLI_ROUTES[CLI_NAMES[index]]], adapter as unknown as LlmAdapter))\n stopRouting = installCliRouting(runtime, config, sessions)\n })\n}\n"]}
|
|
1
|
+
{"version":3,"file":"subagents.js","sourceRoot":"","sources":["../src/subagents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAYH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,gBAAgB,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACxG,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAA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,CAAC,EAAE,OAAgC,CAAC,CAAC,CAAA;QACnI,WAAW,GAAG,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAA;IAC5D,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["/**\n * CLI subagent routing bridge: extends the existing `subagent` tool with the\n * external `codex`/`claude` providers, registers the managed llm adapters and\n * owns the durable identity store. It does NOT register spawn/fork tools or a\n * second subagent registry: CLI children are native spawn children using the\n * synthetic `apollo-cli-*` route.\n *\n * Prompt sections (delegation/tiers/CLI catalog/guard wording) live in\n * `src/prompt.js`, registered per agent; this module only contributes the\n * catalog text it can render from live configuration.\n */\n\nimport type { Context } from '@deepseek-ai/cordis'\nimport type { Agent } from '@deepseek-ai/dsh-agent'\nimport type { LlmAdapter, ReasoningEffortId } from '@deepseek-ai/dsh-llm'\nimport type { SessionId } from '@deepseek-ai/dsh-session'\nimport type { SubagentActivation } from '@deepseek-ai/dsh-subagent'\nimport type { ToolDispatchExecution, ToolExecution, ToolExecutionSuccess } from '@deepseek-ai/dsh-tools'\nimport type {} from '@deepseek-ai/dsh-subprocess'\nimport type {} from '@deepseek-ai/dsh-working-directory'\nimport type { CliSessions } from './cli-sessions.js'\n\nimport { randomUUID } from 'node:crypto'\nimport { homedir } from 'node:os'\nimport { join, isAbsolute, resolve } from 'node:path'\nimport { normalizeConfig } from './config.js'\nimport { CLI_DISPLAY_NAMES, CLI_ROUTES, createCliAdapter, enabledIn, selectCli } from './cli-adapter.js'\nimport { openCliSessions } from './cli-sessions.js'\nimport { CLI_MIN_LABELS, assertCliVersion, probeCliVersion } from './cli/version.js'\n\ntype CliName = keyof typeof CLI_ROUTES\ntype CliArguments = { provider?: unknown; model?: unknown; reasoning_effort?: unknown; cwd?: unknown; prompt?: unknown; description?: unknown; run_in_background?: unknown; agent_preset?: unknown }\ntype Unpublished = { parent?: Agent; id: SessionId; name: string; activation: SubagentActivation; cleanup?: Promise<void> }\n\nconst CLI_NAMES = Object.keys(CLI_ROUTES) as CliName[]\nconst cliName = (provider: unknown): CliName | undefined => CLI_NAMES.includes(provider as CliName) ? provider as CliName : undefined\nconst internalRoute = (provider: unknown) => Object.values(CLI_ROUTES).includes(provider as (typeof CLI_ROUTES)[CliName])\nconst success = (value: ToolExecutionSuccess['value']): ToolExecutionSuccess => ({ isError: false, value, content: [] })\n\n/**\n * Read the optional version-probe seam without requiring an inject declaration.\n * The real host context throws on a bare unknown property; tests may expose it\n * as a plain function.\n * @param ctx - runtime context.\n * @returns a `(executable, options) => Promise<string>` probe.\n */\nfunction versionProbeOf(ctx: Context) {\n try {\n const probe = ctx.get?.('cliVersionProbe')\n if (typeof probe === 'function') return probe\n } catch { /* optional service not visible */ }\n try {\n if (typeof ctx.cliVersionProbe === 'function') return ctx.cliVersionProbe\n } catch { /* property access requires inject in this composition */ }\n return probeCliVersion\n}\n\nexport function cliCatalog(config: unknown, request: Pick<CliArguments, 'provider' | 'model'> = {}) {\n const providers = CLI_NAMES.filter((cli) => normalizeConfig(config).subagents[cli].enabled)\n if (request.provider === undefined) return providers.map((cli) => `${cli} — ${CLI_DISPLAY_NAMES[cli]} CLI (background continuable subagents)`).join('\\n')\n const cli = cliName(request.provider)\n if (!cli) return ''\n const backend = normalizeConfig(config).subagents[cli]\n if (!backend.enabled) throw new Error(`Better Subagent ${cli} backend is disabled`)\n if (request.model === undefined) return backend.models.map((model) => `${cli}/${model.id}${model.id === backend.defaultModel ? ' (default)' : ''}`).join('\\n') || '(no allowed models)'\n const model = backend.models.find((item) => item.id === request.model)\n if (!model) throw new Error(`Better Subagent ${cli} model \"${request.model}\" is not allowed`)\n return `${cli}/${model.id}\\nReasoning efforts:\\n${model.efforts.map((effort) => `${effort}${effort === model.defaultEffort ? ' (default)' : ''}`).join('\\n')}`\n}\n\n/**\n * Resolve the child's initial absolute directory from the parent's effective one.\n *\n * The Session header keeps the original project directory, so it can be stale\n * after a working-directory change; the working-directory service is the only\n * authority for the parent's current directory. An absolute explicit `cwd`\n * needs no such lookup, a relative one resolves against that current directory,\n * and omission inherits it. Resolving here keeps the KV record and the\n * manager's pinned initial directory identical.\n * @param {object} ctx - runtime owning the working-directory service.\n * @param {object} parent - calling Agent whose directory is inherited.\n * @param {unknown} requested - explicit tool `cwd`, already schema-validated upstream.\n * @param {AbortSignal} signal - cancellation for the directory inspection.\n * @returns {Promise<string>} absolute child directory.\n */\nasync function childCwd(ctx: Context, parent: Agent, requested: unknown, signal: AbortSignal) {\n if (requested !== undefined && typeof requested !== 'string') throw new Error('cwd must be a string')\n signal.throwIfAborted()\n if (requested !== undefined && isAbsolute(requested)) return requested\n const current = await ctx.workingDirectory.ensure(parent, signal)\n signal.throwIfAborted()\n if (!current || !isAbsolute(current)) throw new Error('Better Subagent CLI subagent requires an absolute session working directory')\n return requested === undefined ? current : resolve(current, requested)\n}\n\nexport async function startCliSubagent(ctx: Context, config: unknown, sessions: CliSessions, args: CliArguments, exec: Pick<ToolDispatchExecution, 'agent' | 'signal'>) {\n const cli = cliName(args.provider)\n if (!cli) throw new Error('Unknown Better Subagent CLI provider')\n const parent = exec.agent\n if (!parent) throw new Error('Better Subagent subagent requires a calling Agent')\n if (!enabledIn(config, parent)) throw new Error('Better Subagent CLI subagents are disabled for this preset')\n if (args.run_in_background !== undefined) throw new Error('run_in_background was removed for CLI subagents; they always run in the background and are continued with send_message')\n if (args.agent_preset !== undefined) throw new Error('agent_preset is not supported for CLI subagents yet')\n if (typeof args.prompt !== 'string' || typeof args.description !== 'string') throw new Error('subagent requires a prompt and description')\n const selected = selectCli(config, cli, args.model as string | undefined, args.reasoning_effort as string | undefined)\n const cwd = await childCwd(ctx, parent, args.cwd, exec.signal)\n let executable\n try {\n const command = selected.executable.startsWith('~/') ? join(homedir(), selected.executable.slice(2)) : selected.executable\n executable = await ctx.subprocess.resolveExecutable(command, undefined, exec.signal)\n } catch (error) {\n exec.signal.throwIfAborted()\n throw new Error(`Better Subagent ${cli} executable is unavailable; install ${cli} ${CLI_MIN_LABELS[cli]} or newer, make sure it is on PATH, or set its absolute path in Plugins → Better Subagent`, { cause: error })\n }\n // Version preflight before any durable identity exists: an installed but\n // incompatible CLI must fail with an actionable diagnostic, not fail later\n // mid-turn or fall back to another backend.\n const probe = versionProbeOf(ctx)\n let versionOutput\n try {\n versionOutput = await probe(executable, { signal: exec.signal })\n } catch (error) {\n exec.signal.throwIfAborted()\n throw new Error(`Better Subagent ${cli} version check failed (${executable}); install ${cli} ${CLI_MIN_LABELS[cli]} or newer and make sure \\`${cli} --version\\` works, or set its absolute path in Plugins → Better Subagent`, { cause: error })\n }\n exec.signal.throwIfAborted()\n assertCliVersion(cli, versionOutput, executable)\n const id = randomUUID() as SessionId\n const record = {\n version: 1 as const, id, parentId: parent.id, cli, cwd,\n executable, profile: cli === 'codex' ? selected.profile : '',\n cliHome: cli === 'codex' ? process.env.CODEX_HOME ?? join(homedir(), '.codex')\n : process.env.CLAUDE_CONFIG_DIR ?? join(homedir(), '.claude'),\n // Explicit CLAUDE_CONFIG_DIR changes config and keychain lookup, even for ~/.claude.\n ...(cli === 'claude' && process.env.CLAUDE_CONFIG_DIR === undefined ? { claudeDefaultHome: true } : {}),\n model: selected.model, effort: selected.effort, delivered: [], started: false,\n }\n await sessions.put(record)\n let created: SubagentActivation | undefined\n try {\n exec.signal.throwIfAborted()\n const maxDepth = ctx.subagents.resolveMaxDepth()\n created = await ctx.subagents.startActivation({\n provider: 'spawn', label: args.description, childId: id, signal: exec.signal,\n delivery: 'parent',\n parent, prompt: [{ type: 'text', text: args.prompt }], cwd,\n agentOptions: { provider: CLI_ROUTES[cli], model: selected.model, reasoningEffort: selected.effort as ReasoningEffortId },\n ...(maxDepth === undefined ? {} : { maxDepth }),\n })\n exec.signal.throwIfAborted()\n // rc.2's native subagent tool returns the tree name, not the durable id.\n return { kind: 'activation', name: created.name ?? created.childId, childId: created.childId, activation: created }\n } catch (error) {\n // rc.2 rolls back pre-admission failures in the manager. A published\n // activation still needs explicit disposal for the post-admission abort race.\n if (created !== undefined) {\n try { await created.dispose() } catch (disposeError) {\n ctx.logger?.warn?.(`Better Subagent could not dispose canceled CLI child ${id}: ${(disposeError as Error).message}`)\n }\n }\n await sessions.delete(id)\n throw error\n }\n}\n\n/** Host-level interception extends existing tools without replacing registrations. */\nexport function installCliRouting(ctx: Context, config: unknown, sessions: CliSessions) {\n const unpublished = new Map<ToolExecution['token'] | ToolExecution, Unpublished>()\n const cleanups = new Set<Promise<void>>()\n const creating = new Set<Promise<ToolExecutionSuccess>>()\n const lifetime = new AbortController()\n const reclaim = (entry: Unpublished) => {\n if (entry.cleanup) return entry.cleanup\n const task = (async () => {\n try { await entry.activation?.dispose() } finally { await sessions.delete(entry.id) }\n })()\n entry.cleanup = task\n cleanups.add(task)\n task.catch((error) => ctx.logger?.warn?.(`Better Subagent could not reclaim unreported CLI child ${entry.id}: ${error.message}`))\n .finally(() => cleanups.delete(task))\n return task\n }\n ctx.on('tools/result', (exec, result) => {\n const key = exec.token ?? exec\n const entry = unpublished.get(key)\n if (!entry) return\n unpublished.delete(key)\n if (!result.isError && (result.value as { kind?: unknown } | null)?.kind === 'activation' && (result.value as { name?: unknown }).name === entry.name) return\n void reclaim(entry)\n })\n ctx.tools.guard((exec) => {\n const args = (exec.arguments ?? {}) as CliArguments\n if (!['subagent', 'subagent_fork'].includes(exec.name)) return\n if (internalRoute(args.provider)) return 'Use provider=\"codex\" or provider=\"claude\" with subagent; internal CLI routes are reserved'\n const selected = cliName(args.provider)\n if (selected && !enabledIn(config, exec.agent)) return 'Better Subagent CLI subagents are disabled for this preset'\n if (exec.name === 'subagent_fork' && (selected || (args.provider === undefined && internalRoute(exec.agent?.options.provider)))) {\n return 'Codex/Claude support background subagent creation only; subagent_fork cannot create a CLI child'\n }\n })\n ctx.on('tools/execute', async (exec, next) => {\n const args = (exec.arguments ?? {}) as CliArguments\n if (!enabledIn(config, exec.agent)) return next()\n if (!['subagent', 'list_subagent_models'].includes(exec.name)) return next()\n // alpha.3 resolves the registered definition before this wrapper runs, so an\n // unadmitted call never reaches here; creating a CLI child is admitted.\n if (exec.name === 'subagent' && cliName(args.provider)) {\n const signal = AbortSignal.any([exec.signal, lifetime.signal])\n const creation = (async () => {\n const created = await startCliSubagent(ctx, config, sessions, args, { ...exec, signal })\n const { activation, childId, ...value } = created\n unpublished.set(exec.token ?? exec, { parent: exec.agent, id: childId, name: value.name, activation })\n return success(value)\n })()\n creating.add(creation)\n try { return await creation } finally { creating.delete(creation) }\n }\n if (exec.name !== 'list_subagent_models') return next()\n if (cliName(args.provider)) return success(cliCatalog(config, args))\n if (args.provider !== undefined || args.model !== undefined) return next()\n const base = await next()\n const extra = cliCatalog(config)\n if (base.isError || !extra) return base\n return success([base.value, extra].filter(Boolean).join('\\n'))\n })\n return async () => {\n lifetime.abort(new Error('Better Subagent CLI routing unloaded'))\n await Promise.allSettled([...creating])\n await Promise.allSettled([...unpublished.values()].map(reclaim))\n unpublished.clear()\n await Promise.allSettled([...cleanups])\n }\n}\n\nexport function mountSubagents(ctx: Context, config: unknown) {\n ctx.inject(['tools', 'subagents', 'agents', 'llm', 'storage', 'subprocess', 'workingDirectory'], async (runtime) => {\n const sessions = await openCliSessions(runtime)\n const adapters = CLI_NAMES.map((cli) => createCliAdapter(runtime, config, sessions, cli))\n let stopRouting = async () => {}\n runtime.effect(() => async () => {\n await stopRouting()\n await Promise.all(adapters.map((adapter) => adapter.dispose()))\n await sessions.close()\n })\n // Existing CLI adapters predate the unused imageRequestTarget host slot.\n adapters.forEach((adapter, index) => runtime.llm.registerAdapter([CLI_ROUTES[CLI_NAMES[index]]], adapter as unknown as LlmAdapter))\n stopRouting = installCliRouting(runtime, config, sessions)\n })\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oh-my-dsh/dsh-better-subagent",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.7-alpha.1",
|
|
4
4
|
"description": "Standalone DSH plugin: Codex/Claude continuable CLI subagents, wait_subagent, child exit guard and model tiers. TypeScript sources compiled to ESM.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"engines": {
|
|
22
22
|
"node": "^24.22.3 || >=26.13.1",
|
|
23
|
-
"dsh": ">=0.2.3-alpha.
|
|
23
|
+
"dsh": ">=0.2.3-alpha.3 <0.3.0"
|
|
24
24
|
},
|
|
25
25
|
"scripts": {
|
|
26
26
|
"build": "tsc -p tsconfig.build.json && node scripts/build-client.mjs",
|
|
@@ -55,44 +55,44 @@
|
|
|
55
55
|
"access": "public"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@deepseek-ai/schemastery": "~3.20.0-alpha.
|
|
59
|
-
"dsh-better-ptc": "0.2.
|
|
58
|
+
"@deepseek-ai/schemastery": "~3.20.0-alpha.2",
|
|
59
|
+
"dsh-better-ptc": "0.2.4-alpha.1"
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
62
|
-
"@deepseek-ai/cordis": "~4.2.0-alpha.
|
|
63
|
-
"@deepseek-ai/dsh-agent": ">=0.2.3-alpha.
|
|
64
|
-
"@deepseek-ai/dsh-agent-preset-registry": ">=0.2.3-alpha.
|
|
65
|
-
"@deepseek-ai/dsh-llm": ">=0.2.3-alpha.
|
|
66
|
-
"@deepseek-ai/dsh-session": ">=0.2.3-alpha.
|
|
67
|
-
"@deepseek-ai/dsh-session-projection": ">=0.2.3-alpha.
|
|
68
|
-
"@deepseek-ai/dsh-session-query": ">=0.2.3-alpha.
|
|
69
|
-
"@deepseek-ai/dsh-storage": ">=0.2.3-alpha.
|
|
70
|
-
"@deepseek-ai/dsh-storage-json": ">=0.2.3-alpha.
|
|
71
|
-
"@deepseek-ai/dsh-subagent": ">=0.2.3-alpha.
|
|
72
|
-
"@deepseek-ai/dsh-subprocess": ">=0.2.3-alpha.
|
|
73
|
-
"@deepseek-ai/dsh-system-prompt": ">=0.2.3-alpha.
|
|
74
|
-
"@deepseek-ai/dsh-tools": ">=0.2.3-alpha.
|
|
75
|
-
"@deepseek-ai/dsh-working-directory": ">=0.2.3-alpha.
|
|
62
|
+
"@deepseek-ai/cordis": "~4.2.0-alpha.2",
|
|
63
|
+
"@deepseek-ai/dsh-agent": ">=0.2.3-alpha.3 <0.3.0",
|
|
64
|
+
"@deepseek-ai/dsh-agent-preset-registry": ">=0.2.3-alpha.3 <0.3.0",
|
|
65
|
+
"@deepseek-ai/dsh-llm": ">=0.2.3-alpha.3 <0.3.0",
|
|
66
|
+
"@deepseek-ai/dsh-session": ">=0.2.3-alpha.3 <0.3.0",
|
|
67
|
+
"@deepseek-ai/dsh-session-projection": ">=0.2.3-alpha.3 <0.3.0",
|
|
68
|
+
"@deepseek-ai/dsh-session-query": ">=0.2.3-alpha.3 <0.3.0",
|
|
69
|
+
"@deepseek-ai/dsh-storage": ">=0.2.3-alpha.3 <0.3.0",
|
|
70
|
+
"@deepseek-ai/dsh-storage-json": ">=0.2.3-alpha.3 <0.3.0",
|
|
71
|
+
"@deepseek-ai/dsh-subagent": ">=0.2.3-alpha.3 <0.3.0",
|
|
72
|
+
"@deepseek-ai/dsh-subprocess": ">=0.2.3-alpha.3 <0.3.0",
|
|
73
|
+
"@deepseek-ai/dsh-system-prompt": ">=0.2.3-alpha.3 <0.3.0",
|
|
74
|
+
"@deepseek-ai/dsh-tools": ">=0.2.3-alpha.3 <0.3.0",
|
|
75
|
+
"@deepseek-ai/dsh-working-directory": ">=0.2.3-alpha.3 <0.3.0",
|
|
76
76
|
"react": "^18.2.0"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
|
-
"@deepseek-ai/cordis": "4.2.0-alpha.
|
|
80
|
-
"@deepseek-ai/dsh-agent": "0.2.3-alpha.
|
|
81
|
-
"@deepseek-ai/dsh-agent-preset-registry": "0.2.3-alpha.
|
|
82
|
-
"@deepseek-ai/dsh-config-editor": "0.2.3-alpha.
|
|
83
|
-
"@deepseek-ai/dsh-host-webserver": "0.2.3-alpha.
|
|
84
|
-
"@deepseek-ai/dsh-llm": "0.2.3-alpha.
|
|
85
|
-
"@deepseek-ai/dsh-session": "0.2.3-alpha.
|
|
86
|
-
"@deepseek-ai/dsh-session-projection": "0.2.3-alpha.
|
|
87
|
-
"@deepseek-ai/dsh-session-query": "0.2.3-alpha.
|
|
88
|
-
"@deepseek-ai/dsh-settings": "0.2.3-alpha.
|
|
89
|
-
"@deepseek-ai/dsh-storage": "0.2.3-alpha.
|
|
90
|
-
"@deepseek-ai/dsh-storage-json": "0.2.3-alpha.
|
|
91
|
-
"@deepseek-ai/dsh-subagent": "0.2.3-alpha.
|
|
92
|
-
"@deepseek-ai/dsh-subprocess": "0.2.3-alpha.
|
|
93
|
-
"@deepseek-ai/dsh-system-prompt": "0.2.3-alpha.
|
|
94
|
-
"@deepseek-ai/dsh-tools": "0.2.3-alpha.
|
|
95
|
-
"@deepseek-ai/dsh-working-directory": "0.2.3-alpha.
|
|
79
|
+
"@deepseek-ai/cordis": "4.2.0-alpha.2",
|
|
80
|
+
"@deepseek-ai/dsh-agent": "0.2.3-alpha.3",
|
|
81
|
+
"@deepseek-ai/dsh-agent-preset-registry": "0.2.3-alpha.3",
|
|
82
|
+
"@deepseek-ai/dsh-config-editor": "0.2.3-alpha.3",
|
|
83
|
+
"@deepseek-ai/dsh-host-webserver": "0.2.3-alpha.3",
|
|
84
|
+
"@deepseek-ai/dsh-llm": "0.2.3-alpha.3",
|
|
85
|
+
"@deepseek-ai/dsh-session": "0.2.3-alpha.3",
|
|
86
|
+
"@deepseek-ai/dsh-session-projection": "0.2.3-alpha.3",
|
|
87
|
+
"@deepseek-ai/dsh-session-query": "0.2.3-alpha.3",
|
|
88
|
+
"@deepseek-ai/dsh-settings": "0.2.3-alpha.3",
|
|
89
|
+
"@deepseek-ai/dsh-storage": "0.2.3-alpha.3",
|
|
90
|
+
"@deepseek-ai/dsh-storage-json": "0.2.3-alpha.3",
|
|
91
|
+
"@deepseek-ai/dsh-subagent": "0.2.3-alpha.3",
|
|
92
|
+
"@deepseek-ai/dsh-subprocess": "0.2.3-alpha.3",
|
|
93
|
+
"@deepseek-ai/dsh-system-prompt": "0.2.3-alpha.3",
|
|
94
|
+
"@deepseek-ai/dsh-tools": "0.2.3-alpha.3",
|
|
95
|
+
"@deepseek-ai/dsh-working-directory": "0.2.3-alpha.3",
|
|
96
96
|
"@types/node": "24.19.2",
|
|
97
97
|
"@types/react": "18.3.31",
|
|
98
98
|
"esbuild": "0.25.0",
|