dsh-nova-lewis 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.cn.md +5 -5
- package/README.md +8 -8
- package/dist/client.js +109 -32
- package/host/children.mjs +4 -1
- package/host/client.mjs +33 -10
- package/host/composer.css +3 -1
- package/host/exact-composer-text.mjs +31 -0
- package/host/index.mjs +85 -39
- package/host/models.mjs +118 -41
- package/host/plan-view.mjs +0 -15
- package/host/planning-directory.mjs +84 -0
- package/host/roll-call.mjs +78 -0
- package/host/selection.mjs +27 -4
- package/package.json +5 -5
- package/src/context.mjs +5 -1
- package/src/easter-egg.mjs +86 -0
- package/src/engine-plan.mjs +3 -3
- package/src/engine.mjs +171 -44
- package/src/role-routing.mjs +18 -3
package/README.cn.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
`dsh-nova-lewis` · v0.2.
|
|
1
|
+
`dsh-nova-lewis` · v0.2.2 · [npm](https://www.npmjs.com/package/dsh-nova-lewis)
|
|
2
2
|
|
|
3
|
-
[English](https://www.npmjs.com/package/dsh-nova-lewis/v/0.2.
|
|
3
|
+
[English](https://www.npmjs.com/package/dsh-nova-lewis/v/0.2.2) | 简体中文
|
|
4
4
|
|
|
5
5
|
# ds-nova · 附魔台多模型协作
|
|
6
6
|
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
2. 在各个 API 连接下勾选具体型号。同一连接下可以勾选多个型号。只有一个型号时,它也可以分步完成能力范围内的工作。
|
|
17
17
|
3. 选择 **确认后执行** 或 **直接执行**,然后照常发送任务。前一种方式会先生成计划,你可以查看分工、改派负责人,再点 **确认并开始**。
|
|
18
18
|
|
|
19
|
-

|
|
20
20
|
|
|
21
21
|
可以直接把这个订单迁移任务发到聊天框。
|
|
22
22
|
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
|
|
29
29
|
下面的本机演示使用同一个 API 连接。A 整理字段映射,B 据此分析兼容读取,C 需要 A 和 B 的成果才能评估回滚。
|
|
30
30
|
|
|
31
|
-

|
|
32
32
|
|
|
33
33
|
- **任务资料** 在协作设置中添加验收条款等原文,发送时在 **本次资料** 中勾选。复核模型可以按行引用这些条款。
|
|
34
34
|
- **分工建议** 在 **模型与分工** 中查看哪些已选型号适合统筹、起草工作提示词或执行复核,以及这些建议的依据。
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
- **两种更新** 在 **更新与作者** 检查插件软件版本。在线模型推荐资料有独立版本,在 **模型预设 → 检查开发者更新** 查看哪些型号的分工建议有变化,选择 **应用更新** 即可使用新资料。
|
|
37
37
|
- **作者与数据共享** 在 **更新与作者** 查看作者信息。数据共享默认关闭,只有阅读说明并明确同意后才会开启,共享记录只归在 DS Nova 名下。你可以随时在同一窗口停止共享并请求删除记录。
|
|
38
38
|
|
|
39
|
-

|
|
40
40
|
|
|
41
41
|
## 作者
|
|
42
42
|
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
`dsh-nova-lewis` · v0.2.
|
|
1
|
+
`dsh-nova-lewis` · v0.2.2 · [npm](https://www.npmjs.com/package/dsh-nova-lewis)
|
|
2
2
|
|
|
3
|
-
[English](#english) | [简体中文](#简体中文) · [中文版 Markdown 文件](https://cdn.jsdelivr.net/npm/dsh-nova-lewis@0.2.
|
|
3
|
+
[English](#english) | [简体中文](#简体中文) · [中文版 Markdown 文件](https://cdn.jsdelivr.net/npm/dsh-nova-lewis@0.2.2/README.cn.md)
|
|
4
4
|
|
|
5
5
|
# ds-nova · Multi-model collaboration for DeepSeek Harness
|
|
6
6
|
|
|
@@ -18,7 +18,7 @@ In DeepSeek Harness 0.2.2-rc.5, open **Plugins → Add Plugin**, enter `dsh-nova
|
|
|
18
18
|
2. Select individual models under their API connections. You can select several models from one connection. If you have one model, it can handle successive steps within its capabilities.
|
|
19
19
|
3. Choose **确认后执行** (Review the plan first) or **直接执行** (Start directly), then send your task. With the first option, you can inspect the plan and reassign a step before clicking **确认并开始** (Confirm and start).
|
|
20
20
|
|
|
21
|
-

|
|
22
22
|
|
|
23
23
|
Try this order migration task in chat.
|
|
24
24
|
|
|
@@ -30,7 +30,7 @@ Open **协作导图** (Task graph) from the collaboration menu. The canvas conne
|
|
|
30
30
|
|
|
31
31
|
In this local demonstration, all three models use one API connection. Step A maps the fields. Step B uses that mapping to assess read compatibility. Step C needs both results to evaluate rollback.
|
|
32
32
|
|
|
33
|
-

|
|
34
34
|
|
|
35
35
|
- **Task materials.** Add a source such as acceptance criteria in collaboration settings. Select it under **本次资料** when sending the task so the reviewer can cite the original lines.
|
|
36
36
|
- **Assignment guidance.** Under **模型与分工**, see which selected models are suited to coordination, drafting work instructions, or reviewing a result, along with the evidence for those suggestions.
|
|
@@ -38,7 +38,7 @@ In this local demonstration, all three models use one API connection. Step A map
|
|
|
38
38
|
- **Software and model updates.** Check the software version under **更新与作者**. Model recommendations have their own version. Open **模型预设 → 检查开发者更新** to see which model profiles have changed, then choose **应用更新** to apply the new guidance to your installed plugin.
|
|
39
39
|
- **Author and data sharing.** Open **更新与作者** to view author information. Data sharing is off by default and requires your explicit consent. Shared records are attributed only to DS Nova. You can stop sharing and request deletion in the same window at any time.
|
|
40
40
|
|
|
41
|
-

|
|
42
42
|
|
|
43
43
|
### Author
|
|
44
44
|
|
|
@@ -58,7 +58,7 @@ Zhou Yichen (FerrariLewis) created the DSH LEWIS ENCHANTMENT series. Its startup
|
|
|
58
58
|
2. 在各个 API 连接下勾选具体型号。同一连接下可以勾选多个型号。只有一个型号时,它也可以分步完成能力范围内的工作。
|
|
59
59
|
3. 选择 **确认后执行** 或 **直接执行**,然后照常发送任务。前一种方式会先生成计划,你可以查看分工、改派负责人,再点 **确认并开始**。
|
|
60
60
|
|
|
61
|
-

|
|
62
62
|
|
|
63
63
|
可以直接把这个订单迁移任务发到聊天框。
|
|
64
64
|
|
|
@@ -70,7 +70,7 @@ Zhou Yichen (FerrariLewis) created the DSH LEWIS ENCHANTMENT series. Its startup
|
|
|
70
70
|
|
|
71
71
|
下面的本机演示使用同一个 API 连接。A 整理字段映射,B 据此分析兼容读取,C 需要 A 和 B 的成果才能评估回滚。
|
|
72
72
|
|
|
73
|
-

|
|
74
74
|
|
|
75
75
|
- **任务资料** 在协作设置中添加验收条款等原文,发送时在 **本次资料** 中勾选。复核模型可以按行引用这些条款。
|
|
76
76
|
- **分工建议** 在 **模型与分工** 中查看哪些已选型号适合统筹、起草工作提示词或执行复核,以及这些建议的依据。
|
|
@@ -78,7 +78,7 @@ Zhou Yichen (FerrariLewis) created the DSH LEWIS ENCHANTMENT series. Its startup
|
|
|
78
78
|
- **两种更新** 在 **更新与作者** 检查插件软件版本。在线模型推荐资料有独立版本,在 **模型预设 → 检查开发者更新** 查看哪些型号的分工建议有变化,选择 **应用更新** 即可使用新资料。
|
|
79
79
|
- **作者与数据共享** 在 **更新与作者** 查看作者信息。数据共享默认关闭,只有阅读说明并明确同意后才会开启,共享记录只归在 DS Nova 名下。你可以随时在同一窗口停止共享并请求删除记录。
|
|
80
80
|
|
|
81
|
-

|
|
82
82
|
|
|
83
83
|
### 作者
|
|
84
84
|
|
package/dist/client.js
CHANGED
|
@@ -2127,7 +2127,7 @@ function updateView(update, { locale = "zh-CN", nativeManager = false } = {}) {
|
|
|
2127
2127
|
const available = update.kind === "available";
|
|
2128
2128
|
const published = available && (update.channel === "npm" || update.channel === "official");
|
|
2129
2129
|
const actions = available ? button2("close", "稍后再说") + (published ? button2("release", nativeManager ? "打开插件管理" : "查看 npm 包", { css: primary }) : button2("install", "更新到 " + esc(update.latestVersion), { css: primary, disabled: true, extra: ' title="当前本地示例仅支持检查更新"' })) : button2("close", preview ? "关闭预览" : "知道了", { css: primary });
|
|
2130
|
-
return '<div class="bs-startup-update-card">' + closeButton("关闭更新提示") + '<div class="bs-startup-update-glyph" aria-hidden="true">' + (current ? "✓" : failed ? "!" : "✧") + '</div><p class="bs-startup-update-brand">' + brand + (preview ? "<span> · 更新提醒外观预览</span>" : "") + '</p><h2 id="bs-startup-update-title">' + title + '</h2><p id="bs-startup-update-description" class="bs-startup-update-copy">' + esc(description) + "</p>" + (failed || unpublished ? "" : versions(update, current)) + (failed || unpublished || current ? "" : '<div class="bs-release-notes" aria-label="本次更新"><h3>本次更新</h3>' + (notes
|
|
2130
|
+
return '<div class="bs-startup-update-card">' + closeButton("关闭更新提示") + '<div class="bs-startup-update-glyph" aria-hidden="true">' + (current ? "✓" : failed ? "!" : "✧") + '</div><p class="bs-startup-update-brand">' + brand + (preview ? "<span> · 更新提醒外观预览</span>" : "") + '</p><h2 id="bs-startup-update-title">' + title + '</h2><p id="bs-startup-update-description" class="bs-startup-update-copy">' + esc(description) + "</p>" + (failed || unpublished ? "" : versions(update, current)) + (failed || unpublished || current || !notes && !preview ? "" : '<div class="bs-release-notes" aria-label="本次更新"><h3>本次更新</h3>' + (notes ? "<p>" + esc(notes) + "</p>" : '<p class="bs-release-notes-empty">更新说明待作者填写(仅本地预览)</p>') + "</div>") + (published ? '<p class="bs-startup-update-copy">在 DSH 插件管理的「版本」中选择 v' + esc(update.latestVersion) + " 并确认更新。首次按包名安装时,可在「添加插件」输入 <code>dsh-nova-lewis@" + esc(update.latestVersion) + "</code>。</p>" : "") + (failed || unpublished || current ? "" : '<p class="bs-startup-update-restart">更新完成后,请完全退出并重新打开 Harness,以应用新版本。</p><p class="bs-startup-update-retain">你的协作设置、任务资料和运行记录都会保留</p>') + '<div class="bs-startup-update-actions">' + actions + "</div></div>";
|
|
2131
2131
|
}
|
|
2132
2132
|
function sharingNotice(local) {
|
|
2133
2133
|
const account = local ? "" : "<li>已登录 DeepSeek 的昵称与账户标识。账户标识传至接收服务后用服务端密钥 HMAC 去重,原始标识不落盘。</li>";
|
|
@@ -2619,9 +2619,11 @@ function notices(s) {
|
|
|
2619
2619
|
const unknown = [...run.operations || [], ...run.attempts || []].filter(
|
|
2620
2620
|
(a) => a.status === "unknown" && !a.parentId
|
|
2621
2621
|
);
|
|
2622
|
+
const unavailable = run.settings?.unavailableRouteIds;
|
|
2623
|
+
const skipped = unavailable?.length ? "<p>" + esc("本次跳过暂不可用的已选型号:" + unavailable.join("、")) + "。</p>" : "";
|
|
2622
2624
|
if (!unknown.length && !tickets.length && !run.error && !run.reason)
|
|
2623
|
-
return
|
|
2624
|
-
return '<details class="tickets" open><summary>' + icon("alert", 15) + "待我处理 <b>" + num(tickets.length || 1) + "</b></summary>" + (run.error || run.reason ? txt(run.error || run.reason) : "") + unknown.map(
|
|
2625
|
+
return skipped;
|
|
2626
|
+
return skipped + '<details class="tickets" open><summary>' + icon("alert", 15) + "待我处理 <b>" + num(tickets.length || 1) + "</b></summary>" + (run.error || run.reason ? txt(run.error || run.reason) : "") + unknown.map(
|
|
2625
2627
|
(a) => button(
|
|
2626
2628
|
"reconcile",
|
|
2627
2629
|
"核对未确认请求 · " + (run.nodes?.find((n) => n.id === a.nodeId)?.title || "统筹规划"),
|
|
@@ -2693,13 +2695,15 @@ function resources(s, v) {
|
|
|
2693
2695
|
if (!grouped.has(key)) grouped.set(key, { providerId: key, label: r.apiLabel || key, models: [] });
|
|
2694
2696
|
grouped.get(key).models.push({ ...r, available: r.enabled !== false });
|
|
2695
2697
|
}
|
|
2696
|
-
const
|
|
2698
|
+
const connections = s.connections || [...grouped.values()];
|
|
2699
|
+
const hasLevels = connections.some((connection) => connection.models.some((model) => model.reasoningLevels?.length));
|
|
2700
|
+
const list3 = connections.map((connection) => '<section class="connection-models" data-connection-id="' + esc(connection.providerId) + '"><div class="bs-section-title"><h3>' + esc(connection.label || connection.providerId) + "</h3>" + (connection.label && connection.providerId !== connection.label ? "<span>" + esc(connection.providerId) + "</span>" : "") + "</div>" + connection.models.map((model) => {
|
|
2697
2701
|
const r = routes.find((item) => item.id === model.id), available = model.available !== false && r?.enabled !== false;
|
|
2698
2702
|
const modelId = model.modelId || model.id, label = model.label || modelId;
|
|
2699
|
-
return '<div class="resource-row bs-field" data-route-id="' + esc(model.id) + '"><span class="resource-icon">' + icon(r?.local ? "terminal" : "chip", 20) + '</span><div class="grow"><b>' + esc(label) + "</b>" + (label !== modelId ? "<small>" + esc(modelId) + "</small>" : "") + (r ? '<div class="chips">' + caps(r) + "</div>" : "") + '</div><div class="r-meta"><b>' + esc(available ? "可用" : "暂不可用") + "</b>" + (r?.window || r?.contextWindow ? "<small>" + num(r.window || r.contextWindow) + " Token 窗口</small>" : "") + "</div></div>";
|
|
2703
|
+
return '<div class="resource-row bs-field" data-route-id="' + esc(model.id) + '"><span class="resource-icon">' + icon(r?.local ? "terminal" : "chip", 20) + '</span><div class="grow"><b>' + esc(label) + "</b>" + (label !== modelId ? "<small>" + esc(modelId) + "</small>" : "") + (model.reasoningLevels?.length ? "<small>可选推理等级 · " + esc(model.reasoningLevels.join(" / ")) + "</small>" : "") + (r ? '<div class="chips">' + caps(r) + "</div>" : "") + '</div><div class="r-meta"><b>' + esc(available ? "可用" : "暂不可用") + "</b>" + (r?.window || r?.contextWindow ? "<small>" + num(r.window || r.contextWindow) + " Token 窗口</small>" : "") + "</div></div>";
|
|
2700
2704
|
}).join("") + "</section>").join("");
|
|
2701
2705
|
const tabs = [["connected", "已配置模型"], ["recommend", "分工建议"]];
|
|
2702
|
-
return '<section class="bs-preferences settings-panel" data-page="routes"><div class="bs-toolbar"><h2>模型与分工</h2>' + iconButton("refreshRoutes", "刷新模型目录", "cache") + "</div>" + tabBar("route-pages", "模型资料与分工", tabs, v.routeTab, "routeTab") + tabPanel("route-pages", v.routeTab, v.routeTab === "recommend" ? recommendation(s, v) : '<div class="resource-list"><p class="bodycopy"
|
|
2706
|
+
return '<section class="bs-preferences settings-panel" data-page="routes"><div class="bs-toolbar"><h2>模型与分工</h2>' + iconButton("refreshRoutes", "刷新模型目录", "cache") + "</div>" + tabBar("route-pages", "模型资料与分工", tabs, v.routeTab, "routeTab") + tabPanel("route-pages", v.routeTab, v.routeTab === "recommend" ? recommendation(s, v) : '<div class="resource-list"><p class="bodycopy">在输入框旁的「协作」中勾选本次使用的型号' + (hasLevels ? ",再选择推理等级" : "") + "。</p>" + (list3 || '<p class="bodycopy">当前 DSH 目录没有可用模型。</p>') + "</div>") + "</section>";
|
|
2703
2707
|
}
|
|
2704
2708
|
var budgetFields = [
|
|
2705
2709
|
["concurrency", "同时执行的节点数", 2],
|
|
@@ -3385,6 +3389,11 @@ function mountWorkbench(container, bridge, options = {}) {
|
|
|
3385
3389
|
const run = s.run;
|
|
3386
3390
|
if (!run)
|
|
3387
3391
|
return '<div data-graph class="bs-preferences bs-ending-settings">' + renderGraph(s, v) + "</div>";
|
|
3392
|
+
const switchRun = s.runs?.length > 1 ? '<div class="bs-author-entry">' + button("runs", "切换运行(" + num(s.runs.length) + ")", null, "") + "</div>" : "";
|
|
3393
|
+
if (run.settings?.easterEgg) {
|
|
3394
|
+
const answered = run.nodes.filter((n) => n.status === "done").length;
|
|
3395
|
+
return '<div data-graph class="bs-preferences bs-ending-settings"><div class="bs-field bs-ending-header"><h2>型号点名</h2>' + badge(run.status) + "</div><p>" + num(answered) + " / " + num(run.nodes.length) + " 个型号已回应</p>" + (run.status === "running" ? iconButton("cancelDialog", "取消本次点名", "stop") : "") + (run.status === "paused" ? button("resume", "继续点名", "play", "btn primary") : "") + (run.status === "blocked" ? notices(s) : "") + "</div>" + usageSummary(s) + switchRun;
|
|
3396
|
+
}
|
|
3388
3397
|
const active = run.nodes?.filter((n) => n.status === "running") || [];
|
|
3389
3398
|
const activities = active.length ? '<div class="activities">' + active.map(
|
|
3390
3399
|
(n) => button(
|
|
@@ -3398,7 +3407,7 @@ function mountWorkbench(container, bridge, options = {}) {
|
|
|
3398
3407
|
const planning = !run.planVersion || run.status === "awaiting_confirmation";
|
|
3399
3408
|
const diagram = renderGraph(s, v);
|
|
3400
3409
|
const progress = runSummary(s);
|
|
3401
|
-
return '<div data-graph class="bs-preferences bs-ending-settings"><div class="bs-field bs-ending-header"><h2>协作导图</h2><span>' + (planning ? "统筹规划" : "执行进度") + '</span></div><div class="bs-animation-content"><div class="bs-section-title"><h2>' + esc(run.task) + "</h2><span>" + esc(s.mode === "demo" ? "离线演示 · " : "") + "计划 v" + esc(run.planVersion) + " · " + badge(run.status) + '</span></div><div class="run-controls bs-update-actions">' + controls(run) + "</div>" + notices(s) + (planning ? diagram + progress : progress + activities + diagram) + "</div></div>" + inspector(s, v) + usageSummary(s) + history(s) +
|
|
3410
|
+
return '<div data-graph class="bs-preferences bs-ending-settings"><div class="bs-field bs-ending-header"><h2>协作导图</h2><span>' + (planning ? "统筹规划" : "执行进度") + '</span></div><div class="bs-animation-content"><div class="bs-section-title"><h2>' + esc(run.task) + "</h2><span>" + esc(s.mode === "demo" ? "离线演示 · " : "") + "计划 v" + esc(run.planVersion) + " · " + badge(run.status) + '</span></div><div class="run-controls bs-update-actions">' + controls(run) + "</div>" + notices(s) + (planning ? diagram + progress : progress + activities + diagram) + "</div></div>" + inspector(s, v) + usageSummary(s) + history(s) + switchRun;
|
|
3402
3411
|
}
|
|
3403
3412
|
function workspace() {
|
|
3404
3413
|
if (v.view === "graph") return runPanel();
|
|
@@ -4760,7 +4769,11 @@ function useEnchantAppearance() {
|
|
|
4760
4769
|
// host/selection.mjs
|
|
4761
4770
|
function toggleParticipant(preference, routeId, checked) {
|
|
4762
4771
|
const routeIds = checked ? [.../* @__PURE__ */ new Set([...preference.routeIds, routeId])] : preference.routeIds.filter((id2) => id2 !== routeId);
|
|
4763
|
-
return {
|
|
4772
|
+
return {
|
|
4773
|
+
routeIds,
|
|
4774
|
+
enabled: routeIds.length > 0 && preference.enabled === true,
|
|
4775
|
+
...preference.reasoningLevels && { reasoningLevels: preference.reasoningLevels }
|
|
4776
|
+
};
|
|
4764
4777
|
}
|
|
4765
4778
|
|
|
4766
4779
|
// host/plan-view.mjs
|
|
@@ -4780,8 +4793,37 @@ function composerPlacement(anchor, viewport, frameTop = 0) {
|
|
|
4780
4793
|
return { width, left, maxHeight: Math.min(540, openAbove ? above : below), ...openAbove ? { bottom: viewport.layoutHeight - aboveEdge } : { top: belowEdge } };
|
|
4781
4794
|
}
|
|
4782
4795
|
|
|
4796
|
+
// host/exact-composer-text.mjs
|
|
4797
|
+
var PRESENCE_TRIGGER = "在嘛?";
|
|
4798
|
+
function preserveExactComposerText(conversation, sessions, collaborationEnabled) {
|
|
4799
|
+
const send = conversation.sendSession;
|
|
4800
|
+
if (typeof send !== "function") return;
|
|
4801
|
+
const previous = Object.getOwnPropertyDescriptor(conversation, "sendSession");
|
|
4802
|
+
let active = true;
|
|
4803
|
+
function sendWithOriginalText(session, text, attachments, ...rest) {
|
|
4804
|
+
if (active && text === PRESENCE_TRIGGER && attachments.length === 0) {
|
|
4805
|
+
const binding = sessions.binding(session.sessionId);
|
|
4806
|
+
if (binding?.session === session) {
|
|
4807
|
+
const draft = conversation.input.for(binding.ctx).state.getSnapshot();
|
|
4808
|
+
const original = draft.draft;
|
|
4809
|
+
if (!draft.occurrences.length && original !== text && original.trim() === text) {
|
|
4810
|
+
return collaborationEnabled(session.sessionId).then((enabled) => send.call(this, session, active && enabled ? original : text, attachments, ...rest));
|
|
4811
|
+
}
|
|
4812
|
+
}
|
|
4813
|
+
}
|
|
4814
|
+
return send.call(this, session, text, attachments, ...rest);
|
|
4815
|
+
}
|
|
4816
|
+
conversation.sendSession = sendWithOriginalText;
|
|
4817
|
+
return () => {
|
|
4818
|
+
active = false;
|
|
4819
|
+
if (conversation.sendSession !== sendWithOriginalText) return;
|
|
4820
|
+
if (previous) Object.defineProperty(conversation, "sendSession", previous);
|
|
4821
|
+
else delete conversation.sendSession;
|
|
4822
|
+
};
|
|
4823
|
+
}
|
|
4824
|
+
|
|
4783
4825
|
// host/composer.css
|
|
4784
|
-
var composer_default = ".bs-studio.composer-menu {\n width:100%;\n max-width:none;\n container-type:inline-size;\n display:flex;\n flex-direction:column;\n max-height:var(--composer-max-height);\n padding:0;\n margin:0;\n box-sizing:border-box;\n}\n.composer-main {\n min-height:0;\n padding:12px min(5%,18px) 4px;\n overflow-y:auto;\n overflow-x:hidden;\n overscroll-behavior:contain;\n}\n.composer-menu fieldset { min-width:0; margin:0; padding:10px 0 6px; border:0; }\n.composer-menu legend {\n float:left;\n width:100%;\n padding:4px 4px 6px;\n color:var(--bs-muted);\n font-size:.88em;\n font-weight:600;\n overflow-wrap:anywhere;\n}\n.composer-menu
|
|
4826
|
+
var composer_default = ".bs-studio.composer-menu {\n width:100%;\n max-width:none;\n container-type:inline-size;\n display:flex;\n flex-direction:column;\n max-height:var(--composer-max-height);\n padding:0;\n margin:0;\n box-sizing:border-box;\n}\n.composer-main {\n min-height:0;\n padding:12px min(5%,18px) 4px;\n overflow-y:auto;\n overflow-x:hidden;\n overscroll-behavior:contain;\n}\n.composer-menu fieldset { min-width:0; margin:0; padding:10px 0 6px; border:0; }\n.composer-menu legend {\n float:left;\n width:100%;\n padding:4px 4px 6px;\n color:var(--bs-muted);\n font-size:.88em;\n font-weight:600;\n overflow-wrap:anywhere;\n}\n.composer-menu .composer-model:first-of-type { clear:both; }\n.composer-menu .bs-field {\n display:grid;\n grid-template-columns:minmax(0,1fr) auto;\n gap:10px;\n align-items:center;\n padding:10px 4px;\n}\n.composer-menu .bs-field strong,.composer-menu .bs-field small,.composer-menu .bs-field > span:first-child {\n min-width:0;\n line-height:1.4;\n white-space:normal;\n overflow-wrap:anywhere;\n}\n.composer-menu .bs-toggle-row input { right:4px; }\n.composer-menu .bs-field .model-id { font-family:var(--dsw-font-mono,monospace); }\n.composer-menu .composer-reasoning { padding:0 4px 10px 12px; }\n.composer-menu .composer-reasoning > span:first-child { color:var(--bs-muted); }\n.composer-menu .composer-materials { border-top:1px solid var(--bs-border); margin-top:6px; padding:7px 0; }\n.composer-menu .composer-materials summary { cursor:pointer; display:list-item; list-style-position:inside; padding:8px 4px; }\n.composer-menu .composer-materials .bs-clip-actions { padding:4px 4px 7px; }\n.composer-menu .composer-actions {\n display:grid;\n flex:none;\n grid-template-columns:repeat(auto-fit,minmax(min(76px,100%),1fr));\n gap:6px;\n margin:0 min(5%,18px);\n padding:9px 0 12px;\n border-top:1px solid var(--bs-border);\n}\n.composer-menu .composer-actions button { min-width:0; padding:7px 5px; white-space:normal; overflow-wrap:anywhere; }\n.composer-menu p { margin:6px 4px; overflow-wrap:anywhere; }\n";
|
|
4785
4827
|
|
|
4786
4828
|
// host/client.mjs
|
|
4787
4829
|
var h = import_react2.default.createElement;
|
|
@@ -4973,9 +5015,9 @@ function SessionSettings({ ctx }) {
|
|
|
4973
5015
|
(0, import_react2.useEffect)(() => source?.subscribe?.(() => setSession(source.getSnapshot())), [source]);
|
|
4974
5016
|
return h(Workbench, { key: revision, ctx, sessionId: session || n.sessionId, initialView: n.view, surface: "settings" });
|
|
4975
5017
|
}
|
|
4976
|
-
function
|
|
5018
|
+
function ComposerChoice({ label, accessibleLabel = label, options, value, disabled, onChange, className = "" }) {
|
|
4977
5019
|
const root = (0, import_react2.useRef)(null), control = (0, import_react2.useRef)(null), latest = (0, import_react2.useRef)(null);
|
|
4978
|
-
latest.current = { label:
|
|
5020
|
+
latest.current = { label: accessibleLabel, options, value, disabled, onChange };
|
|
4979
5021
|
(0, import_react2.useEffect)(() => {
|
|
4980
5022
|
control.current = mountChoice(root.current, latest.current);
|
|
4981
5023
|
return () => {
|
|
@@ -4985,8 +5027,50 @@ function PolicyChoice({ value, disabled, onChange }) {
|
|
|
4985
5027
|
}, []);
|
|
4986
5028
|
(0, import_react2.useEffect)(() => {
|
|
4987
5029
|
control.current?.update(latest.current);
|
|
4988
|
-
}
|
|
4989
|
-
return h("div", { className: "bs-field" }, h("span", null,
|
|
5030
|
+
});
|
|
5031
|
+
return h("div", { className: "bs-field " + className }, h("span", null, label), h("span", { ref: root }));
|
|
5032
|
+
}
|
|
5033
|
+
function Participant({ model, providerId, pref, busy, change }) {
|
|
5034
|
+
const checked = pref.routeIds.includes(model.id);
|
|
5035
|
+
const levels = model.reasoningLevels || [];
|
|
5036
|
+
const selected = pref.reasoningLevels?.[model.id];
|
|
5037
|
+
function setLevel(value) {
|
|
5038
|
+
const reasoningLevels = { ...pref.reasoningLevels };
|
|
5039
|
+
if (value) reasoningLevels[model.id] = value;
|
|
5040
|
+
else delete reasoningLevels[model.id];
|
|
5041
|
+
return change("composer", { enabled: pref.enabled, routeIds: pref.routeIds, reasoningLevels });
|
|
5042
|
+
}
|
|
5043
|
+
return h(
|
|
5044
|
+
"div",
|
|
5045
|
+
{ className: "composer-model" },
|
|
5046
|
+
h(
|
|
5047
|
+
"label",
|
|
5048
|
+
{ className: "bs-field bs-toggle-row" },
|
|
5049
|
+
h(
|
|
5050
|
+
"span",
|
|
5051
|
+
null,
|
|
5052
|
+
h("strong", { className: model.label === model.modelId ? "model-id" : void 0 }, model.label),
|
|
5053
|
+
model.label !== model.modelId && h("small", { className: "model-id" }, model.modelId),
|
|
5054
|
+
!model.available && h("small", null, "当前不可用")
|
|
5055
|
+
),
|
|
5056
|
+
h("input", {
|
|
5057
|
+
type: "checkbox",
|
|
5058
|
+
disabled: busy || !model.available && !checked,
|
|
5059
|
+
checked,
|
|
5060
|
+
onChange: (e) => change("composer", toggleParticipant(pref, model.id, e.target.checked))
|
|
5061
|
+
}),
|
|
5062
|
+
h("span", { className: "bs-switch", "aria-hidden": true })
|
|
5063
|
+
),
|
|
5064
|
+
checked && model.available && levels.length > 0 && h(ComposerChoice, {
|
|
5065
|
+
className: "composer-reasoning",
|
|
5066
|
+
label: "推理等级",
|
|
5067
|
+
accessibleLabel: providerId + " / " + model.modelId + " 的推理等级",
|
|
5068
|
+
value: levels.includes(selected) ? selected : "",
|
|
5069
|
+
disabled: busy,
|
|
5070
|
+
options: [{ value: "", label: "DSH 默认" }, ...levels.map((level) => ({ value: level, label: level }))],
|
|
5071
|
+
onChange: setLevel
|
|
5072
|
+
})
|
|
5073
|
+
);
|
|
4990
5074
|
}
|
|
4991
5075
|
function TabBody({ ctx, sessionId, defaultView, useTabInfo }) {
|
|
4992
5076
|
const { tab } = useTabInfo();
|
|
@@ -5151,29 +5235,12 @@ function Composer({ ctx, sessionId }) {
|
|
|
5151
5235
|
disabled: busy,
|
|
5152
5236
|
onChange: (e) => change("composer", { enabled: e.target.checked, routeIds: pref.routeIds })
|
|
5153
5237
|
}), h("span", { className: "bs-switch", "aria-hidden": true })),
|
|
5154
|
-
h(
|
|
5238
|
+
h(ComposerChoice, { label: "开工方式", options: POLICY_OPTIONS, value: pref.policy || "manual", disabled: busy || !state, onChange: (policy) => change("settings", { policy }) }),
|
|
5155
5239
|
...(state?.connections || []).map((group) => h(
|
|
5156
5240
|
"fieldset",
|
|
5157
5241
|
{ key: group.providerId },
|
|
5158
5242
|
h("legend", { title: group.providerId }, group.label + (group.label !== group.providerId && state.connections.filter((g) => g.label === group.label).length > 1 ? " · " + group.providerId : "")),
|
|
5159
|
-
...group.models.map((model) => h(
|
|
5160
|
-
"label",
|
|
5161
|
-
{ key: model.id, className: "bs-field bs-toggle-row" },
|
|
5162
|
-
h(
|
|
5163
|
-
"span",
|
|
5164
|
-
null,
|
|
5165
|
-
h("strong", { className: model.label === model.modelId ? "model-id" : void 0 }, model.label),
|
|
5166
|
-
model.label !== model.modelId && h("small", { className: "model-id" }, model.modelId),
|
|
5167
|
-
!model.available && h("small", null, "当前不可用")
|
|
5168
|
-
),
|
|
5169
|
-
h("input", {
|
|
5170
|
-
type: "checkbox",
|
|
5171
|
-
disabled: busy || !model.available && !pref.routeIds.includes(model.id),
|
|
5172
|
-
checked: pref.routeIds.includes(model.id),
|
|
5173
|
-
onChange: (e) => change("composer", toggleParticipant(pref, model.id, e.target.checked))
|
|
5174
|
-
}),
|
|
5175
|
-
h("span", { className: "bs-switch", "aria-hidden": true })
|
|
5176
|
-
))
|
|
5243
|
+
...group.models.map((model) => h(Participant, { key: model.id, model, providerId: group.providerId, pref, busy, change }))
|
|
5177
5244
|
)),
|
|
5178
5245
|
...pref.routeIds.filter((selected) => !(state?.connections || []).some((group) => group.models.some((m) => m.id === selected))).map((selected) => h(
|
|
5179
5246
|
"label",
|
|
@@ -5233,6 +5300,16 @@ function Composer({ ctx, sessionId }) {
|
|
|
5233
5300
|
), pop);
|
|
5234
5301
|
}
|
|
5235
5302
|
function apply(ctx) {
|
|
5303
|
+
ctx.inject?.(["conversation", "sessions"], (ready) => ready.effect(() => preserveExactComposerText(ready.conversation, ready.sessions, async (sessionId) => {
|
|
5304
|
+
const bridge = hostBridge(ctx, sessionId, true);
|
|
5305
|
+
try {
|
|
5306
|
+
return (await bridge.getState()).composer?.enabled === true;
|
|
5307
|
+
} catch {
|
|
5308
|
+
return true;
|
|
5309
|
+
} finally {
|
|
5310
|
+
bridge.dispose();
|
|
5311
|
+
}
|
|
5312
|
+
}), "collaboration exact composer text"));
|
|
5236
5313
|
ctx.inject?.(["pluginNavigation"], (ready) => ready.effect(() => {
|
|
5237
5314
|
const manager = ready.pluginNavigation;
|
|
5238
5315
|
pluginManagers.set(ctx, manager);
|
package/host/children.mjs
CHANGED
|
@@ -5,6 +5,7 @@ import path from 'node:path'
|
|
|
5
5
|
import { mkdtemp, writeFile, rm } from 'node:fs/promises'
|
|
6
6
|
import { realpathSync, existsSync } from 'node:fs'
|
|
7
7
|
import { childReceipt, visibleText } from './models.mjs'
|
|
8
|
+
import {reasoningOptions} from './selection.mjs'
|
|
8
9
|
|
|
9
10
|
const preflightError = message => Object.assign(Error(message), {dispatched:false})
|
|
10
11
|
const shellName = process.platform === 'win32' ? 'powershell' : 'bash'
|
|
@@ -116,7 +117,9 @@ export function createChildren(ctx, config = {}) {
|
|
|
116
117
|
children.set(childId,child)
|
|
117
118
|
const maxTokens = Math.min(1024,args.route.maxOutput || 1024,args.maxAttemptTokens == null ? Infinity : Math.max(64,Math.floor(args.maxAttemptTokens/4)))
|
|
118
119
|
activation = await get('subagents').startActivation({provider:'spawn',agentPreset:presetId,label:args.node.title,parent,childId,cwd,
|
|
119
|
-
signal:args.signal,delivery:'caller',agentOptions:{provider:args.route.providerId,model:args.route.modelId,maxTokens
|
|
120
|
+
signal:args.signal,delivery:'caller',agentOptions:{provider:args.route.providerId,model:args.route.modelId,maxTokens,
|
|
121
|
+
// DSH merges same-route parent options into children. Clear any inherited effort when using the model default.
|
|
122
|
+
reasoningEffort:reasoningOptions(args).reasoningEffort},
|
|
120
123
|
prompt:[{type:'text',text:messages.map(m=>m.content).join('\n\n')+sourceIndex}]})
|
|
121
124
|
cancel = ()=>{activation.dispose().catch(()=>{})}
|
|
122
125
|
args.signal.addEventListener('abort',cancel,{once:true})
|
package/host/client.mjs
CHANGED
|
@@ -13,6 +13,7 @@ import {toggleParticipant} from './selection.mjs'
|
|
|
13
13
|
import {isNewVisiblePlan} from './plan-view.mjs'
|
|
14
14
|
import {mountChoice,POLICY_OPTIONS} from '../ui/choices.mjs'
|
|
15
15
|
import {composerPlacement} from './composer-layout.mjs'
|
|
16
|
+
import {preserveExactComposerText} from './exact-composer-text.mjs'
|
|
16
17
|
import composerCSS from './composer.css'
|
|
17
18
|
|
|
18
19
|
// Keep DSH's persisted sidebar tabs, series shortcuts and settings target valid across the package rename.
|
|
@@ -150,15 +151,35 @@ function SessionSettings({ctx}){
|
|
|
150
151
|
useEffect(()=>source?.subscribe?.(()=>setSession(source.getSnapshot())),[source])
|
|
151
152
|
return h(Workbench,{key:revision,ctx,sessionId:session || n.sessionId,initialView:n.view,surface:'settings'})
|
|
152
153
|
}
|
|
153
|
-
function
|
|
154
|
+
function ComposerChoice({label,accessibleLabel=label,options,value,disabled,onChange,className=''}) {
|
|
154
155
|
const root=useRef(null),control=useRef(null),latest=useRef(null)
|
|
155
|
-
latest.current={label:
|
|
156
|
+
latest.current={label:accessibleLabel,options,value,disabled,onChange}
|
|
156
157
|
useEffect(()=>{
|
|
157
158
|
control.current=mountChoice(root.current,latest.current)
|
|
158
159
|
return ()=>{control.current.dispose();control.current=null}
|
|
159
160
|
},[])
|
|
160
|
-
useEffect(()=>{control.current?.update(latest.current)}
|
|
161
|
-
return h('div',{className:'bs-field'},h('span',null,
|
|
161
|
+
useEffect(()=>{control.current?.update(latest.current)})
|
|
162
|
+
return h('div',{className:'bs-field '+className},h('span',null,label),h('span',{ref:root}))
|
|
163
|
+
}
|
|
164
|
+
function Participant({model,providerId,pref,busy,change}) {
|
|
165
|
+
const checked=pref.routeIds.includes(model.id)
|
|
166
|
+
const levels=model.reasoningLevels || []
|
|
167
|
+
const selected=pref.reasoningLevels?.[model.id]
|
|
168
|
+
function setLevel(value){
|
|
169
|
+
const reasoningLevels={...pref.reasoningLevels}
|
|
170
|
+
if(value)reasoningLevels[model.id]=value
|
|
171
|
+
else delete reasoningLevels[model.id]
|
|
172
|
+
return change('composer',{enabled:pref.enabled,routeIds:pref.routeIds,reasoningLevels})
|
|
173
|
+
}
|
|
174
|
+
return h('div',{className:'composer-model'},
|
|
175
|
+
h('label',{className:'bs-field bs-toggle-row'},
|
|
176
|
+
h('span',null,h('strong',{className:model.label===model.modelId?'model-id':undefined},model.label),
|
|
177
|
+
model.label!==model.modelId&&h('small',{className:'model-id'},model.modelId),!model.available&&h('small',null,'当前不可用')),
|
|
178
|
+
h('input',{type:'checkbox',disabled:busy || !model.available && !checked,checked,
|
|
179
|
+
onChange:e=>change('composer',toggleParticipant(pref,model.id,e.target.checked))}),h('span',{className:'bs-switch','aria-hidden':true})),
|
|
180
|
+
checked && model.available && levels.length>0 && h(ComposerChoice,{className:'composer-reasoning',label:'推理等级',
|
|
181
|
+
accessibleLabel:providerId+' / '+model.modelId+' 的推理等级',value:levels.includes(selected)?selected:'',disabled:busy,
|
|
182
|
+
options:[{value:'',label:'DSH 默认'},...levels.map(level=>({value:level,label:level}))],onChange:setLevel}))
|
|
162
183
|
}
|
|
163
184
|
function TabBody({ctx,sessionId,defaultView,useTabInfo}) {
|
|
164
185
|
const {tab}=useTabInfo()
|
|
@@ -244,14 +265,10 @@ function Composer({ctx,sessionId}){
|
|
|
244
265
|
h(SeriesSurface,{menu:true},h('div',{className:'composer-main'},
|
|
245
266
|
h('label',{className:'bs-field bs-toggle-row'},h('span',null,'在本会话启用协作'),h('input',{type:'checkbox',checked:pref.enabled,disabled:busy,
|
|
246
267
|
onChange:e=>change('composer',{enabled:e.target.checked,routeIds:pref.routeIds})}),h('span',{className:'bs-switch','aria-hidden':true})),
|
|
247
|
-
h(
|
|
268
|
+
h(ComposerChoice,{label:'开工方式',options:POLICY_OPTIONS,value:pref.policy || 'manual',disabled:busy||!state,onChange:policy=>change('settings',{policy})}),
|
|
248
269
|
...(state?.connections || []).map(group=>h('fieldset',{key:group.providerId},
|
|
249
270
|
h('legend',{title:group.providerId},group.label+(group.label!==group.providerId && state.connections.filter(g=>g.label===group.label).length>1?' · '+group.providerId:'')),
|
|
250
|
-
...group.models.map(model=>h(
|
|
251
|
-
h('span',null,h('strong',{className:model.label===model.modelId?'model-id':undefined},model.label),
|
|
252
|
-
model.label!==model.modelId&&h('small',{className:'model-id'},model.modelId),!model.available&&h('small',null,'当前不可用')),
|
|
253
|
-
h('input',{type:'checkbox',disabled:busy || !model.available && !pref.routeIds.includes(model.id),checked:pref.routeIds.includes(model.id),
|
|
254
|
-
onChange:e=>change('composer',toggleParticipant(pref,model.id,e.target.checked))}),h('span',{className:'bs-switch','aria-hidden':true}))))),
|
|
271
|
+
...group.models.map(model=>h(Participant,{key:model.id,model,providerId:group.providerId,pref,busy,change})))),
|
|
255
272
|
...pref.routeIds.filter(selected=>!(state?.connections || []).some(group=>group.models.some(m=>m.id===selected))).map(selected=>
|
|
256
273
|
h('label',{key:selected,className:'bs-field bs-toggle-row'},h('span',null,selected+' · 已从目录移除'),
|
|
257
274
|
h('input',{type:'checkbox',checked:true,disabled:busy,onChange:()=>change('composer',toggleParticipant(pref,selected,false))}),
|
|
@@ -275,6 +292,12 @@ function Composer({ctx,sessionId}){
|
|
|
275
292
|
title:reason || '本会话的协作开关、模型与进度','aria-expanded':opened,'aria-haspopup':'dialog',onClick:()=>setOpened(!opened)},'协作'+(hint?' · '+hint:''))),pop)
|
|
276
293
|
}
|
|
277
294
|
export function apply(ctx){
|
|
295
|
+
ctx.inject?.(['conversation','sessions'],ready=>ready.effect(()=>preserveExactComposerText(ready.conversation,ready.sessions,async sessionId=>{
|
|
296
|
+
const bridge=hostBridge(ctx,sessionId,true)
|
|
297
|
+
try{return (await bridge.getState()).composer?.enabled===true}
|
|
298
|
+
// A transient settings error must not turn a padded ordinary message into a roll call.
|
|
299
|
+
catch{return true}finally{bridge.dispose()}
|
|
300
|
+
}),'collaboration exact composer text'))
|
|
278
301
|
ctx.inject?.(['pluginNavigation'],ready=>ready.effect(()=>{
|
|
279
302
|
const manager=ready.pluginNavigation
|
|
280
303
|
pluginManagers.set(ctx,manager)
|
package/host/composer.css
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
font-weight:600;
|
|
27
27
|
overflow-wrap:anywhere;
|
|
28
28
|
}
|
|
29
|
-
.composer-menu
|
|
29
|
+
.composer-menu .composer-model:first-of-type { clear:both; }
|
|
30
30
|
.composer-menu .bs-field {
|
|
31
31
|
display:grid;
|
|
32
32
|
grid-template-columns:minmax(0,1fr) auto;
|
|
@@ -42,6 +42,8 @@
|
|
|
42
42
|
}
|
|
43
43
|
.composer-menu .bs-toggle-row input { right:4px; }
|
|
44
44
|
.composer-menu .bs-field .model-id { font-family:var(--dsw-font-mono,monospace); }
|
|
45
|
+
.composer-menu .composer-reasoning { padding:0 4px 10px 12px; }
|
|
46
|
+
.composer-menu .composer-reasoning > span:first-child { color:var(--bs-muted); }
|
|
45
47
|
.composer-menu .composer-materials { border-top:1px solid var(--bs-border); margin-top:6px; padding:7px 0; }
|
|
46
48
|
.composer-menu .composer-materials summary { cursor:pointer; display:list-item; list-style-position:inside; padding:8px 4px; }
|
|
47
49
|
.composer-menu .composer-materials .bs-clip-actions { padding:4px 4px 7px; }
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export const PRESENCE_TRIGGER = '在嘛?'
|
|
2
|
+
|
|
3
|
+
// DSH rc.5 trims both ends of ordinary drafts before handing them to the send
|
|
4
|
+
// service. At that handoff the session's input store still contains the draft.
|
|
5
|
+
export function preserveExactComposerText(conversation, sessions, collaborationEnabled) {
|
|
6
|
+
const send = conversation.sendSession
|
|
7
|
+
if (typeof send !== 'function') return
|
|
8
|
+
const previous = Object.getOwnPropertyDescriptor(conversation, 'sendSession')
|
|
9
|
+
let active = true
|
|
10
|
+
function sendWithOriginalText(session, text, attachments, ...rest) {
|
|
11
|
+
if (active && text === PRESENCE_TRIGGER && attachments.length === 0) {
|
|
12
|
+
const binding = sessions.binding(session.sessionId)
|
|
13
|
+
if (binding?.session === session) {
|
|
14
|
+
const draft = conversation.input.for(binding.ctx).state.getSnapshot()
|
|
15
|
+
const original = draft.draft
|
|
16
|
+
if (!draft.occurrences.length && original !== text && original.trim() === text) {
|
|
17
|
+
return collaborationEnabled(session.sessionId).then(enabled =>
|
|
18
|
+
send.call(this, session, active && enabled ? original : text, attachments, ...rest))
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return send.call(this, session, text, attachments, ...rest)
|
|
23
|
+
}
|
|
24
|
+
conversation.sendSession = sendWithOriginalText
|
|
25
|
+
return () => {
|
|
26
|
+
active = false
|
|
27
|
+
if (conversation.sendSession !== sendWithOriginalText) return
|
|
28
|
+
if (previous) Object.defineProperty(conversation, 'sendSession', previous)
|
|
29
|
+
else delete conversation.sendSession
|
|
30
|
+
}
|
|
31
|
+
}
|