dsh-taskflow 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +79 -35
- package/LICENSE +201 -201
- package/NOTICE +6 -1
- package/README.md +335 -139
- package/README_en.md +102 -139
- package/client.js +816 -71
- package/docs/DETAIL.md +32 -5
- package/docs/DETAIL.zh-CN.md +13 -3
- package/licenses/Marked-MIT.txt +44 -0
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +6 -3
- package/src/application/task-runtime.mjs +123 -114
- package/src/domain/task-service.mjs +247 -178
- package/src/domain/tool-view.mjs +11 -0
- package/src/server/config.mjs +1 -1
- package/src/server/index.mjs +18 -8
- package/src/server/inline-sessions.mjs +154 -0
- package/src/server/planning-check.mjs +105 -0
- package/src/server/prompts.mjs +12 -8
- package/src/server/quick-replies.mjs +88 -0
- package/src/server/rpc.mjs +45 -22
- package/src/server/session-context.mjs +11 -5
- package/src/server/task-actions.mjs +63 -0
- package/src/server/tool-schemas.mjs +33 -0
- package/src/server/tool-views.mjs +36 -8
- package/src/server/tools.mjs +20 -14
package/client.js
CHANGED
|
@@ -50,27 +50,77 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
50
50
|
));
|
|
51
51
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
52
52
|
|
|
53
|
-
// src/client/index.jsx
|
|
54
|
-
var
|
|
55
|
-
__export(
|
|
53
|
+
// taskflow-source:src/client/index.jsx
|
|
54
|
+
var client_exports = {};
|
|
55
|
+
__export(client_exports, {
|
|
56
56
|
apply: () => apply,
|
|
57
57
|
createApi: () => createApi,
|
|
58
58
|
inject: () => inject
|
|
59
59
|
});
|
|
60
|
-
module.exports = __toCommonJS(
|
|
61
|
-
var
|
|
62
|
-
var
|
|
60
|
+
module.exports = __toCommonJS(client_exports);
|
|
61
|
+
var import_react13 = __toESM(require("react"));
|
|
62
|
+
var import_react_dom4 = require("react-dom");
|
|
63
63
|
|
|
64
|
-
// src/client/components/task-panel.jsx
|
|
65
|
-
var
|
|
64
|
+
// taskflow-source:src/client/components/task-panel.jsx
|
|
65
|
+
var import_react5 = __toESM(require("react"));
|
|
66
66
|
|
|
67
|
-
// src/client/model.mjs
|
|
68
|
-
var STATUS = { pending: "待执行", queued: "排队中", running: "
|
|
67
|
+
// taskflow-source:src/client/model.mjs
|
|
68
|
+
var STATUS = { pending: "待执行", queued: "排队中", running: "进行中", awaiting_children: "等待下级", paused: "已暂停", blocked: "受阻", failed: "失败", completed: "已完成", cancelled: "已取消" };
|
|
69
69
|
var TOOL_NAMES = { browser: "浏览器", editor: "编辑器", terminal: "终端", plugin: "插件", orchestration: "编排" };
|
|
70
|
+
function taskOwner(plan, task) {
|
|
71
|
+
const parent = plan.tasks[task.parentId];
|
|
72
|
+
return parent ? parent.mode === "delegate" && parent.executionSessionId ? parent.executionSessionId : taskOwner(plan, parent) : plan.rootSessionId;
|
|
73
|
+
}
|
|
74
|
+
function taskTarget(plan, task) {
|
|
75
|
+
if (task.mode === "delegate" && task.executionSessionId && task.executionCreated !== false) return { parentSessionId: task.executionParentSessionId || taskOwner(plan, task), childSessionId: task.executionSessionId, mode: "unknown" };
|
|
76
|
+
if (task.recordSession?.created) return { parentSessionId: task.recordSession.parentSessionId, childSessionId: task.recordSession.id, mode: "one-shot" };
|
|
77
|
+
const owner = taskOwner(plan, task);
|
|
78
|
+
const parent = Object.values(plan.tasks).find((t) => t.mode === "delegate" && t.executionSessionId === owner);
|
|
79
|
+
return parent ? taskTarget(plan, parent) : owner;
|
|
80
|
+
}
|
|
81
|
+
function executionTarget(plan, task) {
|
|
82
|
+
const sid = task.executionSessionId || taskOwner(plan, task);
|
|
83
|
+
const parent = Object.values(plan.tasks).find((t) => t.mode === "delegate" && t.executionSessionId === sid);
|
|
84
|
+
return parent ? taskTarget(plan, parent) : sid;
|
|
85
|
+
}
|
|
86
|
+
function sessionTree(plan) {
|
|
87
|
+
if (!plan) return [];
|
|
88
|
+
const nodes = Object.values(plan.tasks).flatMap((t) => [
|
|
89
|
+
...(t.sessionHistory ?? []).map((h) => ({ ...t, title: `${t.title}(历史执行)`, status: h.status, executionSessionId: h.sessionId, target: { parentSessionId: h.parentSessionId, childSessionId: h.sessionId, mode: "unknown" }, children: [] })),
|
|
90
|
+
...t.mode === "delegate" && t.executionSessionId && t.executionCreated !== false ? [{ ...t, target: taskTarget(plan, t), children: [] }] : [],
|
|
91
|
+
...[...t.recordHistory ?? [], ...t.recordSession ? [t.recordSession] : []].filter((r) => r.created && t.attempts > 0).map((r) => ({ ...t, title: r === t.recordSession && t.mode === "inline" ? t.title : `${t.title}(历史执行记录)`, status: r === t.recordSession && t.mode === "inline" ? t.status : r.status || t.report?.status || "paused", executionSessionId: r.id, target: { parentSessionId: r.parentSessionId, childSessionId: r.id, mode: "one-shot" }, children: [] }))
|
|
92
|
+
]);
|
|
93
|
+
const bySession = new Map(nodes.map((t) => [t.executionSessionId, t])), roots = [];
|
|
94
|
+
for (const t of nodes) {
|
|
95
|
+
const parent = bySession.get(t.target.parentSessionId);
|
|
96
|
+
(parent && parent !== t ? parent.children : roots).push(t);
|
|
97
|
+
}
|
|
98
|
+
return roots;
|
|
99
|
+
}
|
|
100
|
+
function sessionPath(plan, sessionId) {
|
|
101
|
+
if (!plan) return [];
|
|
102
|
+
const root = { sessionId: plan.rootSessionId, title: plan.title, target: plan.rootSessionId };
|
|
103
|
+
const find = (nodes, path) => {
|
|
104
|
+
for (const t of nodes) {
|
|
105
|
+
const next = [...path, { sessionId: t.executionSessionId, title: `${t.id} ${t.title}`, target: t.target }];
|
|
106
|
+
if (t.executionSessionId === sessionId) return next;
|
|
107
|
+
const found = find(t.children, next);
|
|
108
|
+
if (found) return found;
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
return sessionId === root.sessionId ? [root] : find(sessionTree(plan), [root]) ?? [];
|
|
112
|
+
}
|
|
113
|
+
function executionLabel(plan, task, sessionId) {
|
|
114
|
+
if (task.mode === "delegate") return task.executionSessionId && task.executionCreated !== false ? "独立子会话" : "按需委派";
|
|
115
|
+
const owner = taskOwner(plan, task);
|
|
116
|
+
if (owner === sessionId) return "本会话内执行";
|
|
117
|
+
const parent = Object.values(plan.tasks).find((t) => t.mode === "delegate" && t.executionSessionId === owner);
|
|
118
|
+
return parent ? `在 ${parent.id} 会话内执行` : "在主会话内执行";
|
|
119
|
+
}
|
|
70
120
|
function visibleTree(plan, { filter = "all", scope = "global", sessionId } = {}) {
|
|
71
121
|
if (!plan) return [];
|
|
72
122
|
const all = Object.values(plan.tasks), kept = /* @__PURE__ */ new Set();
|
|
73
|
-
const matches = (t) => (filter === "all" || (filter === "active" ? !["completed", "cancelled"].includes(t.status) : t.status === filter)) && (scope === "global" || t.executionSessionId === sessionId || (t.parentId ? plan.tasks[t.parentId].executionSessionId : plan.rootSessionId) === sessionId);
|
|
123
|
+
const matches = (t) => (filter === "all" || (filter === "active" ? !["completed", "cancelled"].includes(t.status) : t.status === filter)) && (scope === "global" || t.executionSessionId === sessionId || t.recordSession?.id === sessionId || t.recordHistory?.some((r) => r.id === sessionId) || (t.parentId ? plan.tasks[t.parentId].executionSessionId : plan.rootSessionId) === sessionId);
|
|
74
124
|
for (const t of all.filter(matches)) {
|
|
75
125
|
for (let x = t; x; x = plan.tasks[x.parentId]) {
|
|
76
126
|
if (kept.has(x.id)) break;
|
|
@@ -86,23 +136,29 @@ function progress(plan) {
|
|
|
86
136
|
return { done, total: roots.length, percent: roots.length ? Math.round(done / roots.length * 100) : 0 };
|
|
87
137
|
}
|
|
88
138
|
|
|
89
|
-
// src/client/
|
|
90
|
-
var import_react = __toESM(require("react")
|
|
139
|
+
// taskflow-source:src/client/components/task-icon.jsx
|
|
140
|
+
var import_react = __toESM(require("react"));
|
|
141
|
+
function TaskIcon(props) {
|
|
142
|
+
return /* @__PURE__ */ import_react.default.createElement("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", ...props }, /* @__PURE__ */ import_react.default.createElement("rect", { x: "3", y: "3", width: "4", height: "4", rx: "1" }), /* @__PURE__ */ import_react.default.createElement("rect", { x: "3", y: "10", width: "4", height: "4", rx: "1" }), /* @__PURE__ */ import_react.default.createElement("rect", { x: "3", y: "17", width: "4", height: "4", rx: "1" }), /* @__PURE__ */ import_react.default.createElement("path", { d: "M11 5h10M11 12h10M11 19h10" }));
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// taskflow-source:src/client/generated/icons.jsx
|
|
146
|
+
var import_react2 = __toESM(require("react"));
|
|
91
147
|
var paths = { layers: "m12 3 9 5-9 5-9-5 9-5zm-9 9 9 5 9-5M3 16l9 5 9-5", chat: "M21 11.5a8.4 8.4 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.4 8.4 0 0 1-3.8-.9L3 21l1.9-5.7a8.4 8.4 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6A8.4 8.4 0 0 1 12.5 3h.5a8.5 8.5 0 0 1 8 8v.5z", check: "m5 12 4 4L19 6", chevron: "m9 5 7 7-7 7", arrow: "M5 12h14m-6-6 6 6-6 6", back: "M19 12H5m6-6-6 6 6 6", plus: "M12 5v14M5 12h14", search: "m21 21-4.3-4.3M19 10.5a8.5 8.5 0 1 1-17 0 8.5 8.5 0 0 1 17 0", browser: "M3 8h18M5 4h14a2 2 0 0 1 2 2v13a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2m1 2h.01M9 6h.01", code: "m8 6-6 6 6 6m8-12 6 6-6 6m-3-15-2 18", terminal: "m4 5 6 6-6 6m9 1h7", plugin: "M8 3v4H4v5h4v4h4v5h5v-5h4v-5h-4V7h-4V3H8z", settings: "M9 3h6l1 4 4 1 1 6-4 2-1 4H9l-1-4-4-1-1-6 4-2 2-4zm7 9a4 4 0 1 1-8 0 4 4 0 0 1 8 0", file: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8zm0 0v6h6M8 13h8m-8 4h6", branch: "M6 3v12a3 3 0 0 0 3 3h9M6 8h8a4 4 0 0 0 4-4m-9 14a3 3 0 1 1-6 0 3 3 0 0 1 6 0m12-15a3 3 0 1 1-6 0 3 3 0 0 1 6 0", clock: "M12 7v5l3 2m6-2a9 9 0 1 1-18 0 9 9 0 0 1 18 0", download: "M12 3v12m-5-5 5 5 5-5M4 16v4h16v-4", send: "m22 2-7 20-4-9-9-4 20-7zM22 2 11 13", close: "m6 6 12 12M6 18 18 6", upload: "M12 16V3M7 8l5-5 5 5M4 16v5h16v-5", refresh: "M20 7V3l-4 4a8 8 0 1 0 4 8M20 3h-5", lock: "M6 11h12v10H6zm3 0V7a3 3 0 0 1 6 0v4", expand: "M8 3H3v5m13-5h5v5M3 16v5h5m13-5v5h-5", eye: "M2 12s4-7 10-7 10 7 10 7-4 7-10 7S2 12 2 12zm13 0a3 3 0 1 1-6 0 3 3 0 0 1 6 0", book: "M12 5s-4-3-9-2v16c5-1 9 2 9 2s4-3 9-2V3c-5-1-9 2-9 2zm0 0v16", info: "M12 11v6m0-10h.01m9 5a9 9 0 1 1-18 0 9 9 0 0 1 18 0", dots: "M5 12h.01M12 12h.01M19 12h.01" };
|
|
92
148
|
paths.folder = "M3 7V5h6l2 2h10v13H3V7z";
|
|
93
149
|
paths.panel = "M3 4h18v16H3zm7 0v16";
|
|
94
150
|
paths.edit = "m16 3 5 5-12 12-6 1 1-6L16 3zm-3 3 5 5";
|
|
95
151
|
paths.moon = "M20 15a9 9 0 0 1-11-11 9 9 0 1 0 11 11";
|
|
96
152
|
function Icon({ name, ...props }) {
|
|
97
|
-
return /* @__PURE__ */
|
|
153
|
+
return /* @__PURE__ */ import_react2.default.createElement("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", ...props }, /* @__PURE__ */ import_react2.default.createElement("path", { d: paths[name] || paths.file }));
|
|
98
154
|
}
|
|
99
155
|
|
|
100
|
-
// src/client/components/task-dialog.jsx
|
|
101
|
-
var
|
|
156
|
+
// taskflow-source:src/client/components/task-dialog.jsx
|
|
157
|
+
var import_react3 = __toESM(require("react"));
|
|
102
158
|
var import_react_dom = require("react-dom");
|
|
103
159
|
function TaskDialog({ title, subtitle, children, actions, onClose, closeLabel = "关闭任务详情" }) {
|
|
104
|
-
const ref = (0,
|
|
105
|
-
(0,
|
|
160
|
+
const ref = (0, import_react3.useRef)(null);
|
|
161
|
+
(0, import_react3.useEffect)(() => {
|
|
106
162
|
const d = ref.current;
|
|
107
163
|
if (typeof d.showModal === "function") d.showModal();
|
|
108
164
|
else d.setAttribute("open", "");
|
|
@@ -110,7 +166,7 @@ function TaskDialog({ title, subtitle, children, actions, onClose, closeLabel =
|
|
|
110
166
|
if (d.open && typeof d.close === "function") d.close();
|
|
111
167
|
};
|
|
112
168
|
}, []);
|
|
113
|
-
return (0, import_react_dom.createPortal)(/* @__PURE__ */
|
|
169
|
+
return (0, import_react_dom.createPortal)(/* @__PURE__ */ import_react3.default.createElement("dialog", { ref, className: "tf-dialog", "aria-label": title, onCancel: (e) => {
|
|
114
170
|
e.preventDefault();
|
|
115
171
|
onClose();
|
|
116
172
|
}, onClick: (e) => {
|
|
@@ -118,23 +174,33 @@ function TaskDialog({ title, subtitle, children, actions, onClose, closeLabel =
|
|
|
118
174
|
const r = ref.current.getBoundingClientRect();
|
|
119
175
|
if (e.clientX < r.left || e.clientX > r.right || e.clientY < r.top || e.clientY > r.bottom) onClose();
|
|
120
176
|
}
|
|
121
|
-
} }, /* @__PURE__ */
|
|
177
|
+
} }, /* @__PURE__ */ import_react3.default.createElement("header", { className: "dialog-head" }, /* @__PURE__ */ import_react3.default.createElement("div", null, /* @__PURE__ */ import_react3.default.createElement("small", null, subtitle), /* @__PURE__ */ import_react3.default.createElement("h2", null, title)), /* @__PURE__ */ import_react3.default.createElement("button", { className: "iconbtn", "aria-label": closeLabel, onClick: onClose }, /* @__PURE__ */ import_react3.default.createElement(Icon, { name: "close" }))), /* @__PURE__ */ import_react3.default.createElement("div", { className: "dialog-body" }, children), actions && /* @__PURE__ */ import_react3.default.createElement("footer", { className: "dialog-actions" }, actions)), document.body);
|
|
122
178
|
}
|
|
123
179
|
|
|
124
|
-
// src/client/components/task-
|
|
180
|
+
// taskflow-source:src/client/components/task-spinner.jsx
|
|
181
|
+
var import_react4 = __toESM(require("react"));
|
|
182
|
+
function TaskSpinner({ label = "进行中" }) {
|
|
183
|
+
return /* @__PURE__ */ import_react4.default.createElement("svg", { className: "tf-task-spinner", viewBox: "0 0 24 24", role: "img", "aria-label": label }, /* @__PURE__ */ import_react4.default.createElement("circle", { cx: "12", cy: "12", r: "9", opacity: ".2" }), /* @__PURE__ */ import_react4.default.createElement("path", { d: "M12 3a9 9 0 0 1 9 9" }));
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// taskflow-source:src/client/components/task-panel.jsx
|
|
125
187
|
function TaskPanel({ view, sessionId, action, navigate, augment, onError }) {
|
|
126
|
-
const [filter, setFilter] = (0,
|
|
127
|
-
(0,
|
|
188
|
+
const [filter, setFilter] = (0, import_react5.useState)("all"), [scope, setScope] = (0, import_react5.useState)("global"), [collapsed, setCollapsed] = (0, import_react5.useState)(/* @__PURE__ */ new Set()), [detail, setDetail] = (0, import_react5.useState)(null), [busy, setBusy] = (0, import_react5.useState)(false), [error, setError] = (0, import_react5.useState)(""), [feedback, setFeedback] = (0, import_react5.useState)("");
|
|
189
|
+
(0, import_react5.useEffect)(() => {
|
|
128
190
|
setDetail(null);
|
|
129
191
|
setError("");
|
|
192
|
+
setFeedback("");
|
|
130
193
|
}, [sessionId]);
|
|
131
|
-
const p = view.plan, pr = progress(p);
|
|
194
|
+
const p = view.plan, pr = progress(p), path = sessionPath(p, sessionId);
|
|
132
195
|
const perform = async (type, data) => {
|
|
133
196
|
if (busy) return;
|
|
134
197
|
setBusy(true);
|
|
135
198
|
setError("");
|
|
199
|
+
setFeedback("");
|
|
136
200
|
try {
|
|
137
|
-
await action(type, data);
|
|
201
|
+
const result = await action(type, data);
|
|
202
|
+
if (result?.message) setFeedback(result.message);
|
|
203
|
+
if (type === "resume" && result?.accepted) setDetail(null);
|
|
138
204
|
} catch (e) {
|
|
139
205
|
setError(e.message);
|
|
140
206
|
onError?.(e);
|
|
@@ -142,37 +208,176 @@ function TaskPanel({ view, sessionId, action, navigate, augment, onError }) {
|
|
|
142
208
|
setBusy(false);
|
|
143
209
|
}
|
|
144
210
|
};
|
|
145
|
-
const prompt = (value) => {
|
|
146
|
-
|
|
147
|
-
|
|
211
|
+
const prompt = async (value) => {
|
|
212
|
+
try {
|
|
213
|
+
await augment(value);
|
|
214
|
+
setDetail(null);
|
|
215
|
+
} catch (e) {
|
|
216
|
+
setError(e.message);
|
|
217
|
+
}
|
|
148
218
|
};
|
|
149
|
-
const row = (t) => /* @__PURE__ */
|
|
150
|
-
const target =
|
|
151
|
-
if (target
|
|
219
|
+
const row = (t) => /* @__PURE__ */ import_react5.default.createElement("div", { className: "task-node", key: t.id }, /* @__PURE__ */ import_react5.default.createElement("div", { className: `tf-row task-row ${t.status} ${view.currentTaskId === t.id ? "focused" : ""}`, "data-task-id": t.id, "data-status": t.status }, /* @__PURE__ */ import_react5.default.createElement("div", { className: "task-line" }, /* @__PURE__ */ import_react5.default.createElement("span", { className: `task-box ${t.status}`, "aria-label": STATUS[t.status] }, t.status === "running" ? /* @__PURE__ */ import_react5.default.createElement(TaskSpinner, { label: `${t.id} 进行中` }) : t.status === "completed" ? /* @__PURE__ */ import_react5.default.createElement(Icon, { name: "check" }) : t.status === "cancelled" ? "−" : null), /* @__PURE__ */ import_react5.default.createElement("div", { className: "task-copy" }, /* @__PURE__ */ import_react5.default.createElement("button", { className: "tf-task task-title", onClick: () => {
|
|
220
|
+
const target = taskTarget(p, t);
|
|
221
|
+
if ((typeof target === "string" ? target : target.childSessionId) !== sessionId) navigate(target);
|
|
152
222
|
else void perform("focus", { taskId: t.id });
|
|
153
|
-
} }, t.title), /* @__PURE__ */
|
|
223
|
+
} }, t.title), /* @__PURE__ */ import_react5.default.createElement("div", { className: "task-meta" }, /* @__PURE__ */ import_react5.default.createElement("code", null, t.id), /* @__PURE__ */ import_react5.default.createElement("span", { title: t.executionReason }, "· ", executionLabel(p, t, sessionId)), t.version > 1 && /* @__PURE__ */ import_react5.default.createElement("span", null, "v", t.version), t.children.length > 0 && /* @__PURE__ */ import_react5.default.createElement("button", { className: "tf-fold", "aria-label": `${collapsed.has(t.id) ? "展开" : "折叠"} ${t.title}`, onClick: () => setCollapsed((old) => {
|
|
154
224
|
const n = new Set(old);
|
|
155
225
|
n.has(t.id) ? n.delete(t.id) : n.add(t.id);
|
|
156
226
|
return n;
|
|
157
|
-
}) }, /* @__PURE__ */
|
|
227
|
+
}) }, /* @__PURE__ */ import_react5.default.createElement(Icon, { name: "chevron", style: { transform: collapsed.has(t.id) ? "" : "rotate(90deg)" } })))), /* @__PURE__ */ import_react5.default.createElement("button", { className: "iconbtn", "aria-label": `查看 ${t.id} 详情`, onClick: () => setDetail(t.id) }, /* @__PURE__ */ import_react5.default.createElement(Icon, { name: "dots" }))), !["completed", "cancelled"].includes(t.status) && /* @__PURE__ */ import_react5.default.createElement("div", { className: "task-status" }, /* @__PURE__ */ import_react5.default.createElement("span", { className: `pill ${t.status === "running" ? "blue" : ""}` }, /* @__PURE__ */ import_react5.default.createElement("i", { className: `dot ${t.status}` }), STATUS[t.status]), ["pending", "paused", "blocked", "failed"].includes(t.status) && /* @__PURE__ */ import_react5.default.createElement("button", { className: "btn small outline", disabled: busy, onClick: () => void perform("resume", { taskId: t.id, version: t.version }) }, t.status === "pending" ? "开始" : "继续")), ["blocked", "failed"].includes(t.status) && /* @__PURE__ */ import_react5.default.createElement("p", { className: "tf-blocked-reason" }, /* @__PURE__ */ import_react5.default.createElement("strong", null, t.status === "blocked" ? "受阻原因:" : "失败原因:"), t.report?.summary || "尚未记录原因,请查看会话详情。"), t.recordError && /* @__PURE__ */ import_react5.default.createElement("p", { className: "tf-blocked-reason", role: "status" }, "子会话记录待同步:", t.recordError)), !collapsed.has(t.id) && t.children.length > 0 && /* @__PURE__ */ import_react5.default.createElement("div", { className: "child-tasks" }, t.children.map(row)));
|
|
158
228
|
const selected = p?.tasks[detail];
|
|
159
|
-
return /* @__PURE__ */
|
|
229
|
+
return /* @__PURE__ */ import_react5.default.createElement("section", { className: "tf-panel", "aria-label": "待办任务清单" }, /* @__PURE__ */ import_react5.default.createElement("header", { className: "plan-tabs" }, /* @__PURE__ */ import_react5.default.createElement("span", { className: "tab" }, /* @__PURE__ */ import_react5.default.createElement(TaskIcon, null), "待办任务清单"), /* @__PURE__ */ import_react5.default.createElement("span", { className: "pill", style: { fontSize: 10 } }, "持久计划"), /* @__PURE__ */ import_react5.default.createElement("button", { className: "iconbtn", "aria-label": "查看任务动态", onClick: () => setDetail("activity") }, /* @__PURE__ */ import_react5.default.createElement(Icon, { name: "dots" }))), view.loading ? /* @__PURE__ */ import_react5.default.createElement("p", { className: "empty" }, "正在加载任务…") : !p ? /* @__PURE__ */ import_react5.default.createElement("div", { className: "empty" }, /* @__PURE__ */ import_react5.default.createElement(Icon, { name: "check" }), /* @__PURE__ */ import_react5.default.createElement("p", null, "暂无任务计划"), /* @__PURE__ */ import_react5.default.createElement("p", null, "在会话中描述目标,模型将根据任务复杂度规划待办。")) : /* @__PURE__ */ import_react5.default.createElement(import_react5.default.Fragment, null, /* @__PURE__ */ import_react5.default.createElement("div", { className: "plan-heading" }, path.length > 1 && /* @__PURE__ */ import_react5.default.createElement("nav", { className: "tf-session-path", "aria-label": "会话层级" }, path.map((part, index) => /* @__PURE__ */ import_react5.default.createElement(import_react5.default.Fragment, { key: part.sessionId }, index > 0 && /* @__PURE__ */ import_react5.default.createElement("span", { "aria-hidden": "true" }, "/"), index === path.length - 1 ? /* @__PURE__ */ import_react5.default.createElement("span", { "aria-current": "page" }, part.title) : /* @__PURE__ */ import_react5.default.createElement("button", { onClick: () => navigate(part.target) }, part.title))), /* @__PURE__ */ import_react5.default.createElement("button", { onClick: () => navigate(path.at(-2).target) }, "返回父会话")), /* @__PURE__ */ import_react5.default.createElement("h2", null, p.title), /* @__PURE__ */ import_react5.default.createElement("div", { className: "progress-label" }, /* @__PURE__ */ import_react5.default.createElement("strong", null, pr.done, " / ", pr.total, " 项已完成"), /* @__PURE__ */ import_react5.default.createElement("span", null, "v", p.version, " · ", pr.percent, "%")), /* @__PURE__ */ import_react5.default.createElement("div", { className: "progress-track", role: "progressbar", "aria-label": "根任务完成进度", "aria-valuenow": pr.percent, "aria-valuemin": 0, "aria-valuemax": 100 }, /* @__PURE__ */ import_react5.default.createElement("span", { style: { width: `${pr.percent}%` } }))), /* @__PURE__ */ import_react5.default.createElement("div", { className: "plan-controls" }, /* @__PURE__ */ import_react5.default.createElement("div", { className: "segments" }, [["global", "全局计划"], ["local", "当前会话"]].map(([id, title]) => /* @__PURE__ */ import_react5.default.createElement("button", { key: id, className: scope === id ? "selected" : "", "aria-pressed": scope === id, onClick: () => setScope(id) }, title))), /* @__PURE__ */ import_react5.default.createElement("select", { "aria-label": "任务筛选", value: filter, onChange: (e) => setFilter(e.target.value) }, /* @__PURE__ */ import_react5.default.createElement("option", { value: "all" }, "全部事项"), /* @__PURE__ */ import_react5.default.createElement("option", { value: "active" }, "未完成"), /* @__PURE__ */ import_react5.default.createElement("option", { value: "completed" }, "已完成"), /* @__PURE__ */ import_react5.default.createElement("option", { value: "cancelled" }, "已取消"))), /* @__PURE__ */ import_react5.default.createElement("div", { className: "task-list" }, visibleTree(p, { filter, scope, sessionId }).map(row)), /* @__PURE__ */ import_react5.default.createElement("footer", { className: "plan-bottom" }, /* @__PURE__ */ import_react5.default.createElement("button", { className: "btn outline", onClick: () => void prompt(view.currentTaskId ? `在 ${view.currentTaskId} 下新增一个` : "新增一个待办事项:") }, /* @__PURE__ */ import_react5.default.createElement(Icon, { name: "plus" }), view.currentTaskId ? "在当前任务下增补" : "在主任务下增补"), /* @__PURE__ */ import_react5.default.createElement("p", null, "稳定 ID · 跨轮保留 · 刷新恢复"))), !p && view.planning && view.planning.phase !== "skipped" && /* @__PURE__ */ import_react5.default.createElement("p", { role: view.planning.phase === "blocked" ? "alert" : "status", className: view.planning.phase === "blocked" ? "tf-error" : "tf-planning" }, view.planning.message), feedback && /* @__PURE__ */ import_react5.default.createElement("p", { role: "status", className: "tf-feedback" }, feedback), (error || view.error) && /* @__PURE__ */ import_react5.default.createElement("p", { role: "alert", className: "tf-error" }, error || view.error), selected && /* @__PURE__ */ import_react5.default.createElement(TaskDialog, { title: selected.title, subtitle: `${selected.id} · 任务详情`, onClose: () => setDetail(null), actions: /* @__PURE__ */ import_react5.default.createElement(import_react5.default.Fragment, null, ["pending", "paused", "blocked", "failed"].includes(selected.status) && /* @__PURE__ */ import_react5.default.createElement("button", { className: "btn small primary", disabled: busy, onClick: () => void perform("resume", { taskId: selected.id, version: selected.version }) }, "继续执行"), selected.status !== "cancelled" && /* @__PURE__ */ import_react5.default.createElement(import_react5.default.Fragment, null, /* @__PURE__ */ import_react5.default.createElement("button", { className: "btn small outline", onClick: () => prompt(`在 ${selected.id} 下新增一个`) }, "增补下级事项"), /* @__PURE__ */ import_react5.default.createElement("button", { className: "btn small outline", onClick: () => prompt(`修改 ${selected.id} 的要求为:`) }, "修改要求")), !["cancelled", "completed"].includes(selected.status) && /* @__PURE__ */ import_react5.default.createElement("button", { className: "btn small danger", disabled: busy, onClick: () => void perform("cancel", { taskId: selected.id, version: selected.version }) }, "取消任务"), /* @__PURE__ */ import_react5.default.createElement("button", { className: "btn small", disabled: busy, onClick: () => void perform("reorder", { taskId: selected.id, direction: -1, expectedVersion: p.version }) }, "上移"), /* @__PURE__ */ import_react5.default.createElement("button", { className: "btn small", disabled: busy, onClick: () => void perform("reorder", { taskId: selected.id, direction: 1, expectedVersion: p.version }) }, "下移")) }, /* @__PURE__ */ import_react5.default.createElement("dl", { className: "detail-kv" }, /* @__PURE__ */ import_react5.default.createElement("dt", null, "状态"), /* @__PURE__ */ import_react5.default.createElement("dd", null, /* @__PURE__ */ import_react5.default.createElement("span", { className: "pill" }, STATUS[selected.status], " · v", selected.version)), /* @__PURE__ */ import_react5.default.createElement("dt", null, "执行方式"), /* @__PURE__ */ import_react5.default.createElement("dd", null, executionLabel(p, selected, sessionId)), /* @__PURE__ */ import_react5.default.createElement("dt", null, "执行说明"), /* @__PURE__ */ import_react5.default.createElement("dd", null, selected.executionReason || (selected.mode === "delegate" ? "按需创建真实子会话" : "在负责会话内执行"), selected.mode === "inline" && ";此事项在父会话执行,过程与结果保存到只读事项子会话。"), /* @__PURE__ */ import_react5.default.createElement("dt", null, "所属会话"), /* @__PURE__ */ import_react5.default.createElement("dd", null, /* @__PURE__ */ import_react5.default.createElement("button", { className: "btn small outline", onClick: () => navigate(taskTarget(p, selected)) }, selected.mode === "inline" && selected.recordSession?.created ? "查看事项子会话" : "打开执行会话")), /* @__PURE__ */ import_react5.default.createElement("dt", null, "父级事项"), /* @__PURE__ */ import_react5.default.createElement("dd", null, selected.parentId || "主任务"), /* @__PURE__ */ import_react5.default.createElement("dt", null, "任务要求"), /* @__PURE__ */ import_react5.default.createElement("dd", null, selected.instructions || selected.title), /* @__PURE__ */ import_react5.default.createElement("dt", null, "完成标准"), /* @__PURE__ */ import_react5.default.createElement("dd", null, selected.criteria || "按当前任务要求完成")), selected.report && /* @__PURE__ */ import_react5.default.createElement("div", { className: "notice" }, /* @__PURE__ */ import_react5.default.createElement("strong", null, selected.report.version === selected.version ? "执行结果" : `历史结果 v${selected.report.version}(当前要求已变化)`), /* @__PURE__ */ import_react5.default.createElement("p", null, selected.report.summary)), error && /* @__PURE__ */ import_react5.default.createElement("p", { className: "tf-error", role: "alert" }, error)), detail === "activity" && p && /* @__PURE__ */ import_react5.default.createElement(TaskDialog, { title: "任务动态", subtitle: `持久计划 · v${p.version}`, closeLabel: "关闭任务动态", onClose: () => setDetail(null) }, [...p.events].reverse().map((e) => /* @__PURE__ */ import_react5.default.createElement("article", { className: "history", key: e.id }, /* @__PURE__ */ import_react5.default.createElement("time", null, e.at.replace("T", " ").slice(0, 19), " · ", e.taskId), e.detail))));
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// taskflow-source:src/client/components/tool-panel.jsx
|
|
233
|
+
var import_react7 = __toESM(require("react"));
|
|
234
|
+
var import_react_dom2 = require("react-dom");
|
|
235
|
+
|
|
236
|
+
// taskflow-source:src/client/components/tool-document.jsx
|
|
237
|
+
var import_react6 = __toESM(require("react"));
|
|
238
|
+
function ToolDocument({ tool, file, sessionId, openers, foreground, custom = false }) {
|
|
239
|
+
const [loading, setLoading] = (0, import_react6.useState)(false), [error, setError] = (0, import_react6.useState)(""), [hasOpened, setHasOpened] = (0, import_react6.useState)(false);
|
|
240
|
+
const opened = (0, import_react6.useRef)(/* @__PURE__ */ new Set()), generation = (0, import_react6.useRef)(0), container = (0, import_react6.useRef)(null), preview = (0, import_react6.useRef)(null);
|
|
241
|
+
const target = file?.path || tool.url;
|
|
242
|
+
const open = async (automatic = false) => {
|
|
243
|
+
const current = ++generation.current;
|
|
244
|
+
setLoading(true);
|
|
245
|
+
setError("");
|
|
246
|
+
try {
|
|
247
|
+
preview.current?.dispose();
|
|
248
|
+
preview.current = null;
|
|
249
|
+
const result = await (file ? openers.openDocument(sessionId, file, { container: container.current }) : openers.openBrowser(sessionId, tool.url, { automatic }));
|
|
250
|
+
if (generation.current === current) {
|
|
251
|
+
preview.current = typeof result === "object" ? result : null;
|
|
252
|
+
setHasOpened(true);
|
|
253
|
+
} else result.dispose?.();
|
|
254
|
+
} catch (e) {
|
|
255
|
+
if (generation.current === current) setError(e.message);
|
|
256
|
+
} finally {
|
|
257
|
+
if (generation.current === current) setLoading(false);
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
(0, import_react6.useEffect)(() => {
|
|
261
|
+
setLoading(false);
|
|
262
|
+
setError("");
|
|
263
|
+
setHasOpened(false);
|
|
264
|
+
return () => {
|
|
265
|
+
generation.current++;
|
|
266
|
+
preview.current?.dispose();
|
|
267
|
+
preview.current = null;
|
|
268
|
+
opened.current.clear();
|
|
269
|
+
};
|
|
270
|
+
}, [sessionId, target, tool.id, foreground]);
|
|
271
|
+
(0, import_react6.useEffect)(() => {
|
|
272
|
+
const key = `${sessionId}:${tool.id}:${target}`;
|
|
273
|
+
if (!openers || !foreground || custom || !target || tool.phase !== "ready" || tool.autoOpen === false || opened.current.has(key)) return;
|
|
274
|
+
opened.current.add(key);
|
|
275
|
+
void open(true);
|
|
276
|
+
}, [sessionId, tool.id, tool.phase, tool.autoOpen, target, foreground, openers, custom]);
|
|
277
|
+
return /* @__PURE__ */ import_react6.default.createElement("div", { className: "tf-document-view" }, (error || tool.autoOpen === false && !hasOpened && !loading) && /* @__PURE__ */ import_react6.default.createElement("div", { className: "tf-document-actions" }, error && /* @__PURE__ */ import_react6.default.createElement("p", { role: "alert", className: "tf-error" }, error), /* @__PURE__ */ import_react6.default.createElement("button", { className: "btn small outline", disabled: !openers || !foreground || loading, onClick: () => void open() }, error ? "重试打开" : "打开预览")), loading && /* @__PURE__ */ import_react6.default.createElement("p", { role: "status", className: "tf-preview-loading" }, "正在打开预览…"), file ? /* @__PURE__ */ import_react6.default.createElement("div", { ref: container, className: "tf-document-preview-target", "aria-label": `${file.path} 文档预览` }) : /* @__PURE__ */ import_react6.default.createElement("div", { className: "notice" }, `网页操作由 ${tool.sourceTool || "浏览器工具"} 执行。浏览器视图打开相同地址;登录状态和页面进度由对应浏览器插件管理。`));
|
|
160
278
|
}
|
|
161
279
|
|
|
162
|
-
// src/client/components/tool-panel.jsx
|
|
163
|
-
var
|
|
164
|
-
|
|
165
|
-
const
|
|
280
|
+
// taskflow-source:src/client/components/tool-panel.jsx
|
|
281
|
+
var fit = (n, min, max) => Math.max(min, Math.min(n, Math.max(min, max)));
|
|
282
|
+
var bounds = (p) => {
|
|
283
|
+
const width = fit(p.width, Math.min(280, window.innerWidth - 16), window.innerWidth - 16);
|
|
284
|
+
const height = fit(p.height, Math.min(200, window.innerHeight - 16), window.innerHeight - 16);
|
|
285
|
+
return { ...p, width, height, x: fit(p.x, 8, window.innerWidth - width - 8), y: fit(p.y, 8, window.innerHeight - height - 8) };
|
|
286
|
+
};
|
|
287
|
+
var initial = (sessionId) => {
|
|
288
|
+
let saved;
|
|
289
|
+
try {
|
|
290
|
+
saved = JSON.parse(window.localStorage.getItem(`dsh-taskflow:tool-layout:${sessionId}`));
|
|
291
|
+
} catch {
|
|
292
|
+
}
|
|
293
|
+
const p = { floating: saved?.floating === true, dockWidth: 440, width: 560, height: 440, x: 48, y: 80 };
|
|
294
|
+
for (const key of ["dockWidth", "width", "height", "x", "y"]) if (Number.isFinite(saved?.[key])) p[key] = saved[key];
|
|
295
|
+
return bounds(p);
|
|
296
|
+
};
|
|
297
|
+
function ToolPanel({ tool, onClose, renderer, mount, sessionId, openers, foreground = true }) {
|
|
298
|
+
const [layout, setLayout] = (0, import_react7.useState)(() => initial(sessionId)), [dragging, setDragging] = (0, import_react7.useState)(false);
|
|
299
|
+
const stopDrag = (0, import_react7.useRef)(() => {
|
|
300
|
+
}), latest = (0, import_react7.useRef)(layout);
|
|
301
|
+
latest.current = layout;
|
|
302
|
+
(0, import_react7.useEffect)(() => {
|
|
303
|
+
const parent = mount?.parentElement;
|
|
304
|
+
if (!parent) return;
|
|
305
|
+
parent.classList.toggle("tf-tool-layout", !layout.floating);
|
|
306
|
+
mount.classList.toggle("tf-floating-mount", layout.floating);
|
|
307
|
+
const clamp2 = () => setLayout((old) => ({ ...bounds(old), dockWidth: fit(old.dockWidth, 240, (parent.getBoundingClientRect().width || 1e3) - 320) }));
|
|
308
|
+
clamp2();
|
|
309
|
+
window.addEventListener("resize", clamp2);
|
|
310
|
+
const observer = typeof window.ResizeObserver === "function" ? new window.ResizeObserver(clamp2) : null;
|
|
311
|
+
observer?.observe(parent);
|
|
312
|
+
return () => {
|
|
313
|
+
observer?.disconnect();
|
|
314
|
+
window.removeEventListener("resize", clamp2);
|
|
315
|
+
parent.classList.remove("tf-tool-layout");
|
|
316
|
+
parent.style.removeProperty("--tf-tool-width");
|
|
317
|
+
mount.classList.remove("tf-floating-mount");
|
|
318
|
+
};
|
|
319
|
+
}, [mount, layout.floating]);
|
|
320
|
+
(0, import_react7.useEffect)(() => {
|
|
321
|
+
mount?.parentElement?.style.setProperty("--tf-tool-width", `${layout.dockWidth}px`);
|
|
322
|
+
try {
|
|
323
|
+
window.localStorage.setItem(`dsh-taskflow:tool-layout:${sessionId}`, JSON.stringify(layout));
|
|
324
|
+
} catch {
|
|
325
|
+
}
|
|
326
|
+
}, [layout, mount, sessionId]);
|
|
327
|
+
(0, import_react7.useEffect)(() => () => stopDrag.current(), []);
|
|
328
|
+
const drag = (event, kind) => {
|
|
329
|
+
if (event.button !== 0 || kind === "move" && event.target.closest("button,a,input")) return;
|
|
330
|
+
event.preventDefault();
|
|
331
|
+
stopDrag.current();
|
|
332
|
+
const start = { ...latest.current }, x = event.clientX, y = event.clientY, pointerId = event.pointerId;
|
|
333
|
+
setDragging(true);
|
|
334
|
+
const move = (e) => {
|
|
335
|
+
if (e.pointerId !== pointerId) return;
|
|
336
|
+
const dx = e.clientX - x, dy = e.clientY - y;
|
|
337
|
+
if (kind === "move") setLayout(bounds({ ...start, x: start.x + dx, y: start.y + dy }));
|
|
338
|
+
else if (start.floating) setLayout(bounds({ ...start, width: start.width + dx, height: kind === "corner" ? start.height + dy : start.height }));
|
|
339
|
+
else setLayout({ ...start, dockWidth: fit(start.dockWidth + dx, 240, (mount?.parentElement?.getBoundingClientRect().width || 1e3) - 320) });
|
|
340
|
+
};
|
|
341
|
+
const end = () => {
|
|
342
|
+
window.removeEventListener("pointermove", move);
|
|
343
|
+
window.removeEventListener("pointerup", end);
|
|
344
|
+
window.removeEventListener("pointercancel", end);
|
|
345
|
+
window.removeEventListener("blur", end);
|
|
346
|
+
setDragging(false);
|
|
347
|
+
};
|
|
348
|
+
stopDrag.current = end;
|
|
349
|
+
window.addEventListener("pointermove", move);
|
|
350
|
+
window.addEventListener("pointerup", end);
|
|
351
|
+
window.addEventListener("pointercancel", end);
|
|
352
|
+
window.addEventListener("blur", end);
|
|
353
|
+
};
|
|
354
|
+
const keyboardResize = (e) => {
|
|
355
|
+
if (!["ArrowLeft", "ArrowRight", "Home", "End"].includes(e.key)) return;
|
|
356
|
+
e.preventDefault();
|
|
357
|
+
const delta = e.key === "ArrowLeft" ? -24 : 24;
|
|
358
|
+
setLayout((p) => p.floating ? bounds({ ...p, width: e.key === "Home" ? 280 : e.key === "End" ? window.innerWidth - 16 : p.width + delta }) : { ...p, dockWidth: fit(e.key === "Home" ? 240 : e.key === "End" ? Infinity : p.dockWidth + delta, 240, (mount?.parentElement?.getBoundingClientRect().width || 1e3) - 320) });
|
|
359
|
+
};
|
|
166
360
|
if (!tool?.open) return null;
|
|
167
|
-
|
|
361
|
+
const content = /* @__PURE__ */ import_react7.default.createElement("aside", { className: `tf-tool ${layout.floating ? "tf-tool-floating" : "tf-tool-docked"} ${dragging ? "tf-tool-dragging" : ""}`, style: layout.floating ? { left: layout.x, top: layout.y, width: layout.width, height: layout.height } : void 0, "aria-label": `${TOOL_NAMES[tool.kind]}工具视图` }, /* @__PURE__ */ import_react7.default.createElement("header", { className: "tool-header", onPointerDown: (e) => layout.floating && drag(e, "move") }, /* @__PURE__ */ import_react7.default.createElement(Icon, { name: tool.kind === "editor" ? "code" : tool.kind }), /* @__PURE__ */ import_react7.default.createElement("span", null, TOOL_NAMES[tool.kind]), /* @__PURE__ */ import_react7.default.createElement("span", { className: "binding" }, tool.taskId), /* @__PURE__ */ import_react7.default.createElement("button", { className: "iconbtn", "aria-label": layout.floating ? "停靠工具视图" : "悬浮工具视图", title: layout.floating ? "停靠到对话左侧" : "悬浮并拖动位置", onClick: () => {
|
|
362
|
+
stopDrag.current();
|
|
363
|
+
setLayout((p) => ({ ...bounds(p), floating: !p.floating }));
|
|
364
|
+
} }, /* @__PURE__ */ import_react7.default.createElement(Icon, { name: layout.floating ? "panel" : "expand" })), /* @__PURE__ */ import_react7.default.createElement("button", { className: "iconbtn", "aria-label": "收起工具视图", onClick: onClose }, /* @__PURE__ */ import_react7.default.createElement(Icon, { name: "close" }))), /* @__PURE__ */ import_react7.default.createElement("div", { className: `tool-content${tool.files?.length ? " tf-tool-documents" : ""}` }, tool.files?.length && tool.phase !== "running" && tool.phase !== "failed" ? tool.files.map((file) => /* @__PURE__ */ import_react7.default.createElement(ToolDocument, { key: file.path, tool, file, sessionId, openers, foreground })) : (() => {
|
|
365
|
+
const rendered = renderer?.(tool);
|
|
366
|
+
return /* @__PURE__ */ import_react7.default.createElement(import_react7.default.Fragment, null, tool.kind === "browser" && tool.url && tool.phase !== "running" && tool.phase !== "failed" && /* @__PURE__ */ import_react7.default.createElement(ToolDocument, { tool, sessionId, openers, foreground, custom: !!rendered }), rendered || (tool.kind !== "browser" || !tool.url || tool.phase === "running" || tool.phase === "failed" ? tool.kind === "terminal" ? /* @__PURE__ */ import_react7.default.createElement("pre", { className: "terminal" }, tool.content) : /* @__PURE__ */ import_react7.default.createElement("div", { className: "code-window" }, /* @__PURE__ */ import_react7.default.createElement("div", { className: "file-tab" }, tool.title), /* @__PURE__ */ import_react7.default.createElement("pre", null, tool.content)) : null));
|
|
367
|
+
})()), /* @__PURE__ */ import_react7.default.createElement("div", { className: "tf-tool-resizer", role: "separator", tabIndex: 0, "aria-label": "调整工具视图宽度", "aria-orientation": "vertical", "aria-valuemin": 240, "aria-valuemax": layout.floating ? window.innerWidth - 16 : Math.max(240, (mount?.parentElement?.getBoundingClientRect().width || 1e3) - 320), "aria-valuenow": Math.round(layout.floating ? layout.width : layout.dockWidth), onKeyDown: keyboardResize, onPointerDown: (e) => drag(e, "resize") }), layout.floating && /* @__PURE__ */ import_react7.default.createElement("div", { className: "tf-tool-corner", "aria-hidden": "true", onPointerDown: (e) => drag(e, "corner") }), dragging && /* @__PURE__ */ import_react7.default.createElement("div", { className: "tf-tool-drag-shield" }));
|
|
368
|
+
return layout.floating ? (0, import_react_dom2.createPortal)(content, document.body) : content;
|
|
168
369
|
}
|
|
169
370
|
|
|
170
|
-
// src/client/
|
|
171
|
-
var
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
371
|
+
// taskflow-source:src/client/components/session-tree.jsx
|
|
372
|
+
var import_react9 = __toESM(require("react"));
|
|
373
|
+
var import_react_dom3 = require("react-dom");
|
|
374
|
+
|
|
375
|
+
// taskflow-source:src/client/hooks/use-taskflow.mjs
|
|
376
|
+
var import_react8 = require("react");
|
|
377
|
+
function useTaskflow(api, sessionId, interval = 1200) {
|
|
378
|
+
const [state, setState] = (0, import_react8.useState)({ plan: null, loading: true });
|
|
379
|
+
const latest = (0, import_react8.useRef)(0);
|
|
380
|
+
(0, import_react8.useEffect)(() => {
|
|
176
381
|
let alive = true;
|
|
177
382
|
const generation = ++latest.current;
|
|
178
383
|
setState({ plan: null, loading: true });
|
|
@@ -190,22 +395,504 @@ function useTaskflow(api, sessionId) {
|
|
|
190
395
|
}
|
|
191
396
|
};
|
|
192
397
|
void load();
|
|
193
|
-
const timer = setInterval(load,
|
|
398
|
+
const timer = setInterval(load, interval);
|
|
194
399
|
return () => {
|
|
195
400
|
alive = false;
|
|
196
401
|
clearInterval(timer);
|
|
197
402
|
};
|
|
198
|
-
}, [api, sessionId]);
|
|
403
|
+
}, [api, sessionId, interval]);
|
|
199
404
|
return state;
|
|
200
405
|
}
|
|
201
406
|
|
|
202
|
-
// src/client/
|
|
203
|
-
|
|
407
|
+
// taskflow-source:src/client/components/session-tree.jsx
|
|
408
|
+
function SessionTree({ api, sessionId, currentSessionId, navigate }) {
|
|
409
|
+
const view = useTaskflow(api, sessionId), anchor = (0, import_react9.useRef)(null), [mount, setMount] = (0, import_react9.useState)(null), [opened, setOpened] = (0, import_react9.useState)(/* @__PURE__ */ new Set()), [expanded, setExpanded] = (0, import_react9.useState)(false), groupId = (0, import_react9.useId)();
|
|
410
|
+
const nodes = sessionTree(view.plan);
|
|
411
|
+
const isRoot = view.plan?.rootSessionId === sessionId && nodes.length > 0;
|
|
412
|
+
(0, import_react9.useEffect)(() => {
|
|
413
|
+
if (!isRoot) return;
|
|
414
|
+
const node = document.createElement("div");
|
|
415
|
+
node.className = "tf-session-tree-mount";
|
|
416
|
+
node.dataset.taskflowParentSession = sessionId;
|
|
417
|
+
const control = document.createElement("span");
|
|
418
|
+
control.className = "tf-session-toggle-mount";
|
|
419
|
+
const status = document.createElement("span");
|
|
420
|
+
status.className = "tf-session-root-status";
|
|
421
|
+
setMount({ tree: node, control, status });
|
|
422
|
+
let attachedRow;
|
|
423
|
+
const clickRow = (event) => {
|
|
424
|
+
if (!event.defaultPrevented && !event.target.closest('button, a, input, [role="menuitem"]')) setExpanded((value) => !value);
|
|
425
|
+
};
|
|
426
|
+
const keyRow = (event) => {
|
|
427
|
+
if (event.target === attachedRow && ["Enter", " "].includes(event.key) && !event.altKey && !event.ctrlKey && !event.metaKey && !event.shiftKey) setExpanded((value) => !value);
|
|
428
|
+
};
|
|
429
|
+
const detachRow = () => {
|
|
430
|
+
attachedRow?.removeEventListener("click", clickRow);
|
|
431
|
+
attachedRow?.removeEventListener("keydown", keyRow);
|
|
432
|
+
attachedRow?.classList.remove("tf-session-root");
|
|
433
|
+
attachedRow?.querySelectorAll(".tf-session-native-leading,.tf-session-native-trailing,.tf-session-native-title").forEach((e) => e.classList.remove("tf-session-native-leading", "tf-session-native-trailing", "tf-session-native-title"));
|
|
434
|
+
attachedRow = null;
|
|
435
|
+
};
|
|
436
|
+
const attach = () => {
|
|
437
|
+
const row = anchor.current?.closest("[data-row-key]");
|
|
438
|
+
if (!row?.isConnected || row.dataset.rowKey !== `session:${sessionId}`) {
|
|
439
|
+
node.remove();
|
|
440
|
+
control.remove();
|
|
441
|
+
status.remove();
|
|
442
|
+
detachRow();
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
if (attachedRow !== row) {
|
|
446
|
+
detachRow();
|
|
447
|
+
attachedRow = row;
|
|
448
|
+
row.classList.add("tf-session-root");
|
|
449
|
+
const trailing = [...row.children].find((e) => e.contains(anchor.current));
|
|
450
|
+
trailing?.classList.add("tf-session-native-trailing");
|
|
451
|
+
if (row.firstElementChild !== trailing) row.firstElementChild?.classList.add("tf-session-native-leading");
|
|
452
|
+
if (row.children[1] !== trailing) row.children[1]?.classList.add("tf-session-native-title");
|
|
453
|
+
row.addEventListener("click", clickRow);
|
|
454
|
+
row.addEventListener("keydown", keyRow);
|
|
455
|
+
}
|
|
456
|
+
if (row.nextElementSibling !== node) row.after(node);
|
|
457
|
+
if (row.firstElementChild !== control) row.prepend(control);
|
|
458
|
+
if (row.lastElementChild !== status) row.append(status);
|
|
459
|
+
};
|
|
460
|
+
const observer = new MutationObserver(attach);
|
|
461
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
|
462
|
+
attach();
|
|
463
|
+
return () => {
|
|
464
|
+
observer.disconnect();
|
|
465
|
+
detachRow();
|
|
466
|
+
node.remove();
|
|
467
|
+
control.remove();
|
|
468
|
+
status.remove();
|
|
469
|
+
setMount(null);
|
|
470
|
+
};
|
|
471
|
+
}, [sessionId, isRoot]);
|
|
472
|
+
const toggle = (id) => setOpened((old) => {
|
|
473
|
+
const next = new Set(old);
|
|
474
|
+
next.has(id) ? next.delete(id) : next.add(id);
|
|
475
|
+
return next;
|
|
476
|
+
});
|
|
477
|
+
const count = (tasks) => tasks.reduce((n, t) => n + 1 + count(t.children), 0);
|
|
478
|
+
const render = (tasks) => tasks.map((t) => /* @__PURE__ */ import_react9.default.createElement("div", { key: t.executionSessionId, className: "tf-session-node", "data-taskflow-session": t.executionSessionId }, /* @__PURE__ */ import_react9.default.createElement("div", { className: `session-row tf-session-line ${currentSessionId === t.executionSessionId ? "selected" : ""}`, onClick: () => {
|
|
479
|
+
navigate(t.target);
|
|
480
|
+
if (t.children.length) toggle(t.executionSessionId);
|
|
481
|
+
} }, t.children.length ? /* @__PURE__ */ import_react9.default.createElement("button", { className: "tf-session-arrow", "aria-label": `${opened.has(t.executionSessionId) ? "折叠" : "展开"}子会话 ${t.id}`, "aria-expanded": opened.has(t.executionSessionId), onClick: (event) => {
|
|
482
|
+
event.stopPropagation();
|
|
483
|
+
toggle(t.executionSessionId);
|
|
484
|
+
} }, /* @__PURE__ */ import_react9.default.createElement(Icon, { name: "chevron", style: { transform: opened.has(t.executionSessionId) ? "rotate(90deg)" : void 0 } })) : t.status === "running" ? /* @__PURE__ */ import_react9.default.createElement(TaskSpinner, { label: `${t.id} 进行中` }) : /* @__PURE__ */ import_react9.default.createElement(Icon, { name: "chat", "data-icon": "chat" }), /* @__PURE__ */ import_react9.default.createElement("button", { className: "tf-session-link", title: `${t.id} · ${STATUS[t.status]} · ${t.title}`, "aria-current": currentSessionId === t.executionSessionId ? "page" : void 0, "aria-expanded": t.children.length ? opened.has(t.executionSessionId) : void 0 }, t.children.length > 0 && t.status === "running" && /* @__PURE__ */ import_react9.default.createElement(TaskSpinner, { label: `${t.id} 进行中` }), /* @__PURE__ */ import_react9.default.createElement("span", { className: "title" }, t.id, " ", t.title), /* @__PURE__ */ import_react9.default.createElement("span", { className: `dot ${t.status}`, role: "img", "aria-label": STATUS[t.status] }))), opened.has(t.executionSessionId) && t.children.length > 0 && /* @__PURE__ */ import_react9.default.createElement("div", { className: "session-children", role: "group" }, render(t.children))));
|
|
485
|
+
const label = `“${view.plan?.title}”的 ${count(nodes)} 个子会话`;
|
|
486
|
+
const rootStatus = Object.values(view.plan?.tasks ?? {}).some((t) => t.status === "running") ? "running" : Object.values(view.plan?.tasks ?? {}).every((t) => ["completed", "cancelled"].includes(t.status)) ? "completed" : "pending";
|
|
487
|
+
return /* @__PURE__ */ import_react9.default.createElement(import_react9.default.Fragment, null, /* @__PURE__ */ import_react9.default.createElement("span", { ref: anchor, className: "tf-session-tree-anchor" }), mount && /* @__PURE__ */ import_react9.default.createElement(import_react9.default.Fragment, null, (0, import_react_dom3.createPortal)(/* @__PURE__ */ import_react9.default.createElement("span", { onClick: (e) => e.stopPropagation(), onKeyDown: (e) => e.stopPropagation() }, /* @__PURE__ */ import_react9.default.createElement("button", { type: "button", className: "tf-session-toggle", title: label, "aria-label": `${expanded ? "折叠" : "展开"}${label}`, "aria-expanded": expanded, "aria-controls": groupId, onClick: () => setExpanded((value) => !value) }, /* @__PURE__ */ import_react9.default.createElement(Icon, { name: "chevron", style: { transform: expanded ? "rotate(90deg)" : void 0 } }))), mount.control), (0, import_react_dom3.createPortal)(/* @__PURE__ */ import_react9.default.createElement("span", { className: `dot ${rootStatus}`, role: "img", "aria-label": STATUS[rootStatus] }), mount.status), (0, import_react_dom3.createPortal)(/* @__PURE__ */ import_react9.default.createElement("nav", { id: groupId, className: "tf-session-tree", "aria-label": label, hidden: !expanded, onClick: (e) => e.stopPropagation() }, /* @__PURE__ */ import_react9.default.createElement("div", { className: "session-children" }, render(nodes))), mount.tree)));
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
// taskflow-source:src/client/components/quick-replies.jsx
|
|
491
|
+
var import_react10 = __toESM(require("react"));
|
|
492
|
+
function QuickReplies({ api, sessionId, foreground = true, input, inputActions, focus }) {
|
|
493
|
+
const [view, setView] = (0, import_react10.useState)({ phase: "idle", items: [] }), [error, setError] = (0, import_react10.useState)("");
|
|
494
|
+
const request = (0, import_react10.useRef)(() => {
|
|
495
|
+
});
|
|
496
|
+
(0, import_react10.useEffect)(() => {
|
|
497
|
+
let alive = true, busy = false;
|
|
498
|
+
setView({ phase: foreground ? "loading" : "idle", items: [] });
|
|
499
|
+
setError("");
|
|
500
|
+
if (!foreground) return;
|
|
501
|
+
const load = async (refresh = false) => {
|
|
502
|
+
if (busy) return;
|
|
503
|
+
busy = true;
|
|
504
|
+
if (refresh) {
|
|
505
|
+
setView((previous) => ({ ...previous, phase: "loading" }));
|
|
506
|
+
setError("");
|
|
507
|
+
}
|
|
508
|
+
try {
|
|
509
|
+
const next = await api.action(sessionId, "quick-replies", { refresh });
|
|
510
|
+
if (alive) {
|
|
511
|
+
setView(next);
|
|
512
|
+
setError("");
|
|
513
|
+
}
|
|
514
|
+
} catch (e) {
|
|
515
|
+
if (alive) {
|
|
516
|
+
setView((previous) => ({ ...previous, phase: "unavailable" }));
|
|
517
|
+
setError(e.message === "不支持的操作" ? "当前后端尚未加载推荐功能,请重启 DSH。" : "推荐服务连接失败,请稍后重试;若刚更新插件,请重启 DSH。");
|
|
518
|
+
}
|
|
519
|
+
} finally {
|
|
520
|
+
busy = false;
|
|
521
|
+
}
|
|
522
|
+
};
|
|
523
|
+
request.current = load;
|
|
524
|
+
void load();
|
|
525
|
+
const timer = setInterval(load, 1200);
|
|
526
|
+
return () => {
|
|
527
|
+
alive = false;
|
|
528
|
+
clearInterval(timer);
|
|
529
|
+
request.current = () => {
|
|
530
|
+
};
|
|
531
|
+
};
|
|
532
|
+
}, [api, sessionId, foreground]);
|
|
533
|
+
const fill = (item) => {
|
|
534
|
+
try {
|
|
535
|
+
const draft = input?.draft ?? "";
|
|
536
|
+
if (input?.phase && input.phase !== "plain") throw new Error("请先完成当前输入操作,再选择推荐回复。");
|
|
537
|
+
if (inputActions?.insertText && Number.isInteger(input?.draftRev)) {
|
|
538
|
+
if (!inputActions.insertText(`${draft ? "\n" : ""}${item.text}`, { start: draft.length, end: draft.length, draftRev: input.draftRev })) throw new Error("草稿已变化,请重试。");
|
|
539
|
+
} else if (!draft && inputActions?.setDraft) inputActions.setDraft(item.text);
|
|
540
|
+
else throw new Error("请先保留现有草稿,再选择推荐回复。");
|
|
541
|
+
focus?.();
|
|
542
|
+
setError("");
|
|
543
|
+
} catch (e) {
|
|
544
|
+
setError(e.message);
|
|
545
|
+
}
|
|
546
|
+
};
|
|
547
|
+
if (!foreground || view.phase === "idle" && !error) return null;
|
|
548
|
+
return /* @__PURE__ */ import_react10.default.createElement("div", { className: "tf-quick-replies-wrap" }, /* @__PURE__ */ import_react10.default.createElement("nav", { className: "tf-quick-replies", "aria-label": "模型推荐回复" }, view.items?.map((item) => /* @__PURE__ */ import_react10.default.createElement("button", { type: "button", key: item.label, title: item.text, onClick: () => fill(item) }, item.label))), ["loading", "generating", "busy"].includes(view.phase) && /* @__PURE__ */ import_react10.default.createElement("span", { className: "tf-reply-status tf-reply-loading", role: "status", title: view.phase === "busy" ? "等待当前回复完成后生成推荐" : void 0 }, /* @__PURE__ */ import_react10.default.createElement("span", { "aria-hidden": "true" }, /* @__PURE__ */ import_react10.default.createElement(TaskSpinner, null)), /* @__PURE__ */ import_react10.default.createElement("span", null, "正在推荐中...")), (error || view.phase === "unavailable") && /* @__PURE__ */ import_react10.default.createElement("span", { className: "tf-reply-status", role: "status" }, error || view.message, /* @__PURE__ */ import_react10.default.createElement("button", { type: "button", onClick: () => void request.current(true) }, "重试")));
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
// taskflow-source:src/client/styles.css
|
|
552
|
+
var styles_default = `/* Host-only adaptations. Component declarations are synced from the PRD. */
|
|
553
|
+
.tf-panel,.tf-tool,.tf-dialog,.tf-session-root,.tf-session-tree,.tf-quick-replies-wrap{--ink:var(--dsw-alias-label-primary,#262626);--secondary:var(--dsw-alias-label-secondary,#666);--muted:var(--dsw-alias-label-tertiary,#999);--line:var(--dsw-alias-border-l2,#eee);--surface:var(--dsw-alias-bg-base,#fff);--hover:var(--dsw-alias-interactive-bg-hover,#f5f5f5);--blue:var(--dsw-alias-state-business-primary,#4d6bfe);--hairline:1px;box-sizing:border-box;color:var(--ink);font:14px var(--dsw-font-family,system-ui,sans-serif);-webkit-font-smoothing:antialiased}
|
|
554
|
+
.tf-panel *,.tf-tool *,.tf-dialog *{box-sizing:border-box}:where(.tf-panel,.tf-tool,.tf-dialog) button{font-family:inherit;color:inherit;cursor:pointer;border:0;background:none}:where(.tf-panel,.tf-tool,.tf-dialog) button:hover{background:var(--hover)}.tf-panel button:disabled,.tf-dialog button:disabled{opacity:.4;cursor:default}.tf-panel button:focus-visible,.tf-tool button:focus-visible,.tf-dialog button:focus-visible{outline:2px solid var(--blue);outline-offset:2px}.tf-panel svg,.tf-tool svg,.tf-dialog svg,.tf-entry svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round;vertical-align:middle;flex-shrink:0}
|
|
555
|
+
.tf-panel.tf-panel{height:100%;border:0;overflow:hidden}.tf-panel .tf-task{text-align:left;padding:0;display:block;width:100%;overflow-wrap:anywhere;border-radius:0}.tf-panel .tf-task:hover{background:none}.tf-fold{padding:0;display:inline-grid;place-items:center}.tf-panel .tf-fold svg{width:11px;height:11px}.tf-error{font-size:12px;color:#d33;overflow-wrap:anywhere;padding:8px 16px}.tf-dialog dd{white-space:pre-wrap}.tf-tool.tf-tool{height:100%;width:100%;max-width:none;min-width:0}.tf-tool iframe{display:block;border:0;width:100%;height:430px;background:white}.tf-tool .tool-header>span:first-of-type{white-space:nowrap}.tf-tool .tool-header .iconbtn{margin-left:0}
|
|
556
|
+
.tf-tool-layout{display:grid!important;grid-template-columns:minmax(240px,var(--tf-tool-width,440px)) minmax(320px,1fr)!important;grid-template-rows:auto minmax(0,1fr)!important}.tf-tool-layout>[data-conversation-content]{grid-column:2;grid-row:2;min-width:0}.tf-tool-layout>:not([data-conversation-content]):not(.tf-tool-mount){grid-column:1/-1}.tf-tool-mount{grid-column:1;grid-row:2;min-height:0;min-width:0}.tf-tool-layout.tf-tool-body{grid-template-rows:minmax(0,1fr)!important}.tf-tool-body>[data-conversation-content],.tf-tool-body>.tf-tool-mount{grid-row:1!important}.tf-entry-anchor:empty{display:none}.tf-header-entry-mount{display:inline-flex;align-items:center}.tf-entry{display:inline-flex;align-items:center;justify-content:center;gap:5px;min-width:32px;height:30px;padding:0 8px;border:0;border-radius:7px;background:transparent;color:inherit;font:inherit;font-size:12px;cursor:pointer;-webkit-app-region:no-drag}.tf-entry svg{width:17px;height:17px}.tf-entry:hover{background:rgba(77,107,254,.09)}.tf-entry:focus-visible{outline:2px solid #4d6bfe;outline-offset:2px}.tf-mobile-view{display:none}
|
|
557
|
+
@media(max-width:1250px){.tf-tool-layout{grid-template-columns:minmax(240px,var(--tf-tool-width,440px)) minmax(320px,1fr)!important}.tf-tool-layout .messages{padding:23px 16px}.tf-tool-layout .composer{padding:12px 14px 7px}.tf-tool-layout .suggestions{display:none}.tf-tool-layout .composer-controls .model{display:none}}
|
|
558
|
+
@media(max-width:1080px){.tf-tool-layout{grid-template-columns:minmax(0,1fr)!important}.tf-tool-layout>.tf-tool-mount{grid-row:2;grid-column:1;display:none}.tf-tool-layout>[data-conversation-content]{grid-row:2;grid-column:1}.tf-tool-layout.tf-tool-show-tool>.tf-tool-mount{display:block}.tf-tool-layout.tf-tool-show-tool>[data-conversation-content]{display:none}.tf-mobile-view{display:flex;gap:2px}.tf-mobile-view button{font:inherit;font-size:11px;border:0;padding:4px 6px;border-radius:6px;background:transparent;color:inherit;white-space:nowrap;cursor:pointer}.tf-mobile-view button[aria-pressed=true]{background:var(--dsw-alias-interactive-bg-hover,#f4f5f7)}}
|
|
559
|
+
|
|
560
|
+
|
|
561
|
+
@media(max-width:790px){.tf-tool-layout .tf-tool .tool-content{padding:18px 14px}}
|
|
562
|
+
|
|
563
|
+
@media(prefers-color-scheme:dark){.tf-entry:hover{background:rgba(125,149,255,.14)}.tf-entry:focus-visible{outline-color:#7d95ff}}
|
|
564
|
+
@media(max-width:480px){.tf-entry>span{display:none}}
|
|
565
|
+
|
|
566
|
+
.tf-planning{font-size:12px;color:var(--secondary);padding:8px 16px;overflow-wrap:anywhere}
|
|
567
|
+
|
|
568
|
+
/* Tool surface layout is user controlled; no host nodes are moved. */
|
|
569
|
+
.tf-tool-mount{position:relative}.tf-floating-mount{display:none!important}
|
|
570
|
+
.tf-tool.tf-tool-docked{position:relative;overflow:visible}
|
|
571
|
+
.tf-tool.tf-tool-floating{position:fixed;z-index:1200;border:1px solid var(--line);border-radius:12px;box-shadow:0 12px 48px #0003;overflow:visible;max-width:calc(100vw - 16px);max-height:calc(100vh - 16px);background:var(--surface)}
|
|
572
|
+
.tf-tool-floating>.tool-header{cursor:move;touch-action:none;border-radius:12px 12px 0 0}
|
|
573
|
+
.tf-tool-floating>.tool-footer{border-radius:0 0 12px 12px;background:var(--surface)}
|
|
574
|
+
.tf-tool .tf-tool-resizer{position:absolute;right:-4px;top:0;bottom:0;width:8px;cursor:col-resize;touch-action:none;z-index:3;border-radius:4px}
|
|
575
|
+
.tf-tool-resizer:hover,.tf-tool-resizer:focus-visible{background:var(--blue);outline:0;opacity:.6}
|
|
576
|
+
.tf-tool-corner{position:absolute;bottom:0;right:0;width:16px;height:16px;cursor:nwse-resize;touch-action:none;z-index:4;background:linear-gradient(135deg,transparent 60%,var(--muted) 61%,transparent 68%,var(--muted) 69%,transparent 77%);border-radius:0 0 8px}
|
|
577
|
+
.tf-tool-drag-shield{position:absolute;inset:38px 4px 0 0;z-index:2;cursor:inherit}.tf-tool-dragging{user-select:none}
|
|
578
|
+
.tf-tool-layout.tf-tool-show-tool:has(>.tf-floating-mount)>[data-conversation-content]{display:revert}
|
|
579
|
+
.tf-blocked-reason{margin:6px 0 0 26px;font-size:11px;line-height:1.6;color:var(--secondary);white-space:pre-wrap;overflow-wrap:anywhere;max-height:7em;overflow:auto}
|
|
580
|
+
.tf-feedback{font-size:12px;padding:8px 16px;color:var(--blue);overflow-wrap:anywhere}
|
|
581
|
+
.tf-session-tree-anchor:empty{display:none}.tf-session-tree-mount{width:100%;min-width:0;flex-shrink:0}
|
|
582
|
+
.tf-session-tree{padding:0 4px 0 calc(var(--dsh-workspace-indent,0px));min-width:0}.tf-session-tree[hidden]{display:none}
|
|
583
|
+
.tf-session-root.tf-session-root{border:0;box-sizing:border-box;cursor:pointer;padding-left:calc(9px + var(--dsh-workspace-indent,0px));line-height:20px}
|
|
584
|
+
.tf-session-root[aria-selected=true]{background:var(--hover)}
|
|
585
|
+
.tf-session-native-leading,.tf-session-native-trailing{display:none!important}.tf-session-native-title{font:inherit!important;flex:1}
|
|
586
|
+
.tf-session-root-status{display:inline-flex;align-items:center;flex:none}.tf-session-root-status .dot{width:5px;height:5px}
|
|
587
|
+
.tf-session-toggle-mount{display:inline-flex;align-items:center;flex:none}.tf-session-toggle{display:inline-grid;place-items:center;border:0;background:none;color:var(--muted);cursor:pointer;padding:0;width:16px;height:20px}
|
|
588
|
+
.tf-session-toggle svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}.tf-session-toggle:focus-visible{outline:2px solid var(--blue)}
|
|
589
|
+
.tf-session-path{display:flex;flex-wrap:wrap;align-items:center;gap:5px;font-size:11px;color:var(--secondary);margin-bottom:8px}
|
|
590
|
+
.tf-session-path button{font:inherit;color:var(--blue);border:0;background:none;cursor:pointer;padding:2px}.tf-session-path [aria-current]{overflow-wrap:anywhere}
|
|
591
|
+
.tf-session-line{box-sizing:border-box;color:var(--ink);cursor:pointer}.tf-session-line:hover{background:var(--hover)}
|
|
592
|
+
.tf-session-tree button{border:0;background:none;color:inherit;font:inherit;cursor:pointer;text-align:left;min-width:0}
|
|
593
|
+
.tf-session-tree button:focus-visible{outline:2px solid var(--blue);border-radius:4px}
|
|
594
|
+
.tf-session-line svg{fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round;flex-shrink:0}
|
|
595
|
+
.tf-session-arrow{display:grid;place-items:center;width:16px;flex:none;padding:0}.tf-session-link{display:flex;align-items:center;gap:6px;flex:1;padding:0;height:100%;overflow:hidden}.tf-session-link>span.title{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.tf-session-link .dot{width:5px;height:5px}
|
|
596
|
+
@media(max-width:1080px){.tf-tool-docked>.tf-tool-resizer{display:none}}
|
|
597
|
+
|
|
598
|
+
.tf-panel .task-box.running{border:0;background:none;box-shadow:none}.tf-task-spinner{animation:tf-task-spin .85s linear infinite;flex:none;fill:none;stroke:currentColor;stroke-width:2;color:var(--blue,#4d6bfe)}.tf-panel .task-box .tf-task-spinner{width:17px;height:17px}.tf-session-link .tf-task-spinner{width:13px;height:13px;opacity:1}
|
|
599
|
+
@keyframes tf-task-spin{to{transform:rotate(360deg)}}
|
|
600
|
+
@media(prefers-reduced-motion:reduce){.tf-task-spinner{animation:none}}
|
|
601
|
+
.tf-document-view{min-width:0}.tf-document-source{white-space:pre-wrap;overflow-wrap:anywhere;font:12px/1.7 ui-monospace,monospace}.tf-markdown-preview{font-size:14px;line-height:1.8;overflow-wrap:anywhere}.tf-markdown-preview h1{font-size:24px}.tf-markdown-preview h2{font-size:20px}.tf-markdown-preview h3{font-size:17px}.tf-markdown-preview h1,.tf-markdown-preview h2,.tf-markdown-preview h3{line-height:1.4;margin:1em 0 .5em}.tf-markdown-preview pre{white-space:pre;overflow:auto;padding:12px;background:var(--hover);border:1px solid var(--line);border-radius:8px;font:12px/1.7 ui-monospace,monospace}.tf-markdown-preview :not(pre)>code{padding:2px 4px;background:var(--hover);border-radius:4px;font-size:12px}.tf-markdown-preview blockquote{margin:12px 0;padding:0 12px;border-left:3px solid var(--line);color:var(--secondary)}.tf-markdown-preview a{color:var(--blue)}.tf-markdown-table{max-width:100%;overflow:auto}.tf-markdown-table table{width:100%;border-collapse:collapse;font-size:12px}.tf-markdown-table td,.tf-markdown-table th{padding:6px 8px;border:1px solid var(--line);text-align:left}.tf-markdown-preview input[type=checkbox]{pointer-events:none}.tf-markdown-image{font-size:12px;color:var(--secondary)}
|
|
204
602
|
|
|
205
|
-
|
|
206
|
-
var prototype_default = '/* Generated from docs/prototype/dsh-taskflow-prd.html.\n * Original DeepSeek UI styles: MIT; see licenses/DeepSeek-MIT.txt.\n * Run npm run build to resync. */\n:where(.tf-panel,.tf-tool,.tf-dialog) .iconbtn{display:inline-grid;place-items:center;width:28px;height:28px;border-radius:8px;color:var(--secondary);padding:0;flex-shrink:0}\n:where(.tf-panel,.tf-tool,.tf-dialog) .iconbtn svg{width:16px;height:16px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .btn{display:inline-flex;align-items:center;justify-content:center;gap:4px;min-height:36px;border:0;border-radius:12px;padding:0 14px;background:transparent;color:var(--ink);font-size:14px;line-height:22px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .btn.small{min-height:28px;height:auto;padding:4px 10px;border-radius:8px;font-size:12px;line-height:18px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .btn.outline{box-shadow:inset 0 0 0 var(--hairline) var(--dsw-alias-border-l3)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .btn.primary{background:var(--dsw-alias-button-primary-fill);color:var(--dsw-alias-label-primary-foreground)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .btn.primary:hover{background:var(--dsw-alias-button-primary-hover)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .btn.blue{color:var(--blue);background:var(--dsw-specific-bubble)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .btn.danger{color:var(--dsw-alias-state-danger-primary,#ec1313)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .btn svg{width:16px;height:16px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .subtle{color:var(--muted)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .pill{display:inline-flex;align-items:center;gap:5px;background:var(--hover);color:var(--secondary);font-size:11px;line-height:18px;padding:2px 7px;border-radius:6px;white-space:nowrap}\n:where(.tf-panel,.tf-tool,.tf-dialog) .pill.blue{color:var(--blue);background:var(--dsw-specific-bubble)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .pill.success{color:var(--dsw-alias-state-success-primary,#168349);background:var(--dsw-static-green-500-a08)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .dot{width:6px;height:6px;border-radius:50%;background:var(--muted);display:inline-block;flex-shrink:0}\n:where(.tf-panel,.tf-tool,.tf-dialog) .dot.running{background:var(--blue)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .dot.completed{background:var(--dsw-static-green-500)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .dot.awaiting_children{background:var(--dsw-static-amber-500)}\n.tf-tool{display:flex;flex-direction:column;flex:0 0 48%;max-width:650px;min-width:300px;min-height:0;border-right:1px solid var(--dsw-alias-border-l3);background:var(--surface);order:-1}\n:where(.tf-panel,.tf-tool,.tf-dialog) .tool-header{height:38px;flex-shrink:0;display:flex;align-items:center;gap:7px;padding:0 10px;font-size:12px;border-bottom:1px solid var(--line)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .tool-header svg{width:15px;height:15px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .tool-header .binding{font-size:11px;color:var(--muted);margin-left:auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n:where(.tf-panel,.tf-tool,.tf-dialog) .tool-context{height:38px;flex-shrink:0;display:flex;align-items:center;gap:6px;padding:0 12px;font-size:11px;color:var(--muted);border-bottom:1px solid var(--line)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .tool-content{flex:1;min-height:0;overflow:auto;padding:20px 16px;background:var(--dsw-specific-sidebar-fill);scrollbar-width:thin}\n:where(.tf-panel,.tf-tool,.tf-dialog) .tool-footer{padding:8px 12px;font-size:10px;color:var(--muted);border-top:1px solid var(--line);line-height:1.7}\n:where(.tf-panel,.tf-tool,.tf-dialog) .browser-window{border:1px solid var(--line);border-radius:12px;overflow:hidden;background:var(--surface)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .browser-toolbar{height:42px;display:flex;align-items:center;gap:5px;border-bottom:1px solid var(--line);padding:0 8px;background:var(--dsw-specific-sidebar-fill)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .browser-toolbar .iconbtn{width:22px;height:25px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .browser-toolbar .iconbtn svg{width:13px;height:13px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .address{border:1px solid var(--line);border-radius:8px;background:var(--surface);height:26px;display:flex;align-items:center;gap:5px;flex:1;min-width:0;padding:0 8px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .address svg{width:11px;height:11px;color:var(--muted)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .address input{font-size:10px;background:none;border:0;outline:0;min-width:0;width:100%;color:var(--secondary)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .code-window{border:1px solid var(--line);border-radius:8px;overflow:hidden;background:var(--surface)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .file-tab{background:var(--dsw-specific-sidebar-fill);padding:11px 12px;font-size:11px;border-bottom:1px solid var(--line)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .code-window pre{font:12px/2 Consolas,var(--dsw-font-family);white-space:pre-wrap;margin:0;padding:18px 14px;color:var(--secondary)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .terminal{background:var(--dsw-static-neutral-bluish-950);color:var(--dsw-static-neutral-bluish-100);padding:18px 15px;border-radius:8px;min-height:250px;font:11px/2 Consolas,var(--dsw-font-family);white-space:pre-wrap}\n:where(.tf-panel,.tf-tool,.tf-dialog) .plugin-card{border:1px solid var(--line);border-radius:12px;background:var(--surface);padding:18px;margin-bottom:15px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .plugin-card h3{font-size:15px;margin:12px 0;font-weight:500}\n:where(.tf-panel,.tf-tool,.tf-dialog) .plugin-card p{font-size:12px;line-height:1.9;color:var(--secondary)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .tool-caption{font-size:10px;line-height:1.8;color:var(--muted);margin:12px 0}\n.tf-panel{grid-column:3;grid-row:2;display:flex;flex-direction:column;min-width:0;min-height:0;background:var(--surface);border-left:1px solid var(--dsw-alias-border-l3)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .plan-tabs{display:flex;align-items:center;gap:7px;min-height:38px;height:38px;padding:0 10px;border-bottom:1px solid var(--line);font-size:12px;flex-shrink:0}\n:where(.tf-panel,.tf-tool,.tf-dialog) .plan-tabs .tab{display:flex;align-items:center;gap:5px;border-bottom:2px solid var(--ink);height:38px;padding:0 6px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .plan-tabs .tab svg{width:14px;height:14px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .plan-tabs .iconbtn{margin-left:auto}\n:where(.tf-panel,.tf-tool,.tf-dialog) .plan-heading{padding:16px 18px 14px;flex-shrink:0}\n:where(.tf-panel,.tf-tool,.tf-dialog) .plan-heading h2{font-size:15px;font-weight:500;line-height:1.5;margin:0 0 8px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .plan-heading p{font-size:12px;color:var(--muted);margin:0;line-height:1.8}\n:where(.tf-panel,.tf-tool,.tf-dialog) .progress-label{display:flex;align-items:center;justify-content:space-between;font-size:11px;color:var(--muted);margin-top:12px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .progress-label strong{font-weight:400;color:var(--secondary)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .progress-track{height:3px;background:var(--hover);border-radius:3px;overflow:hidden;margin-top:9px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .progress-track span{background:var(--blue);height:100%;display:block;transition:width .2s}\n:where(.tf-panel,.tf-tool,.tf-dialog) .plan-controls{padding:0 16px 12px;display:flex;align-items:center;gap:7px;border-bottom:1px solid var(--line);flex-shrink:0}\n:where(.tf-panel,.tf-tool,.tf-dialog) .segments{display:flex;flex:1;padding:3px;border-radius:8px;background:var(--hover)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .segments button{flex:1;padding:4px 5px;border-radius:6px;color:var(--muted);font-size:11px;white-space:nowrap}\n:where(.tf-panel,.tf-tool,.tf-dialog) .segments button.selected{background:var(--surface);color:var(--ink);box-shadow:0 1px 3px #00000008}\n:where(.tf-panel,.tf-tool,.tf-dialog) .plan-controls select{font-size:11px;width:72px;padding:6px 2px;border:0;background:transparent;color:var(--secondary);border-radius:6px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-list{overflow:auto;flex:1;min-height:0;padding:10px 10px 16px;scrollbar-width:thin}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-row{margin:2px 0;border-radius:8px;padding:11px 8px;cursor:pointer;border:1px solid transparent}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-row:hover{background:var(--hover)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-row.focused{background:var(--dsw-specific-bubble);border-color:var(--dsw-static-deepseek-100)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-row.cancelled{opacity:.55}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-row.context-only{background:transparent}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-row.context-only .task-title{color:var(--muted)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-line{display:flex;gap:8px;align-items:flex-start}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-box{width:15px;height:15px;display:grid;place-items:center;border:1px solid var(--dsw-alias-border-l4);border-radius:4px;flex-shrink:0;margin-top:3px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-box svg{width:11px;height:11px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-box.completed{background:var(--blue);border-color:var(--blue);color:var(--dsw-static-neutral-00)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-box.running{border-color:var(--blue)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-box.running:before{content:"";width:5px;height:5px;border-radius:50%;background:var(--blue)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-copy{flex:1;min-width:0}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-title{font-size:13px;line-height:1.7;font-weight:400}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-row.completed .task-title{color:var(--muted);text-decoration:line-through;text-decoration-color:var(--dsw-alias-border-l4)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-meta{font-size:10px;color:var(--muted);display:flex;align-items:center;gap:5px;margin-top:4px;flex-wrap:wrap}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-meta code{font:10px Consolas,var(--dsw-font-family)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-row .iconbtn{height:22px;width:20px;margin-right:-3px;color:var(--muted)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-row .iconbtn svg{width:14px;height:14px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-status{display:flex;align-items:center;gap:7px;margin:8px 0 0 23px;font-size:11px;color:var(--muted);flex-wrap:wrap}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-status .pill{font-size:10px;padding:1px 5px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-status .btn{font-size:10px;min-height:23px;padding:2px 7px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .child-tasks{border-left:1px solid var(--line);margin-left:15px;padding-left:5px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .plan-bottom{padding:12px 16px;border-top:1px solid var(--line);flex-shrink:0}\n:where(.tf-panel,.tf-tool,.tf-dialog) .plan-bottom .btn{width:100%;font-size:12px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .plan-bottom p{text-align:center;font-size:10px;color:var(--muted);margin:9px 0 0;line-height:1.8}\n:where(.tf-panel,.tf-tool,.tf-dialog) .empty{padding:35px 18px;color:var(--muted);font-size:13px;line-height:1.9;text-align:center}\n:where(.tf-panel,.tf-tool,.tf-dialog) .empty svg{width:24px;height:24px;margin-bottom:10px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .saved:before{content:"";width:5px;height:5px;border-radius:50%;background:var(--dsw-static-green-500);display:inline-block;vertical-align:2px;margin-right:5px}\n.tf-dialog{width:min(590px,calc(100vw - 28px));max-height:88dvh;padding:0;border:1px solid var(--line);border-radius:20px;background:var(--surface);color:var(--ink);box-shadow:0 10px 45px #00000020}\n.tf-dialog::backdrop{background:#00000040;backdrop-filter:blur(2px)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .dialog-head{padding:21px 24px 17px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--line);gap:12px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .dialog-head h2{font-size:17px;line-height:1.6;font-weight:500;margin:0}\n:where(.tf-panel,.tf-tool,.tf-dialog) .dialog-head small{display:block;font-size:10px;color:var(--muted);margin-bottom:5px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .dialog-body{padding:7px 24px 20px;max-height:calc(88dvh - 145px);overflow:auto;scrollbar-width:thin}\n:where(.tf-panel,.tf-tool,.tf-dialog) .dialog-actions{border-top:1px solid var(--line);display:flex;justify-content:flex-end;align-items:center;flex-wrap:wrap;gap:7px;padding:13px 24px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .notice{background:var(--hover);border-radius:12px;padding:12px 14px;margin:15px 0;font-size:12px;line-height:1.9;color:var(--secondary)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .notice.blue{background:var(--dsw-specific-bubble);color:var(--blue)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .notice.warn{background:var(--dsw-static-amber-100);color:#9a6c25}\nbody[data-ds-dark-theme] :where(.tf-panel,.tf-tool,.tf-dialog) .notice.warn{background:var(--dsw-static-amber-900);color:var(--dsw-static-amber-400)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .field{display:block;color:var(--secondary);font-size:12px;margin:17px 0}\n:where(.tf-panel,.tf-tool,.tf-dialog) .field input,:where(.tf-panel,.tf-tool,.tf-dialog) .field textarea,:where(.tf-panel,.tf-tool,.tf-dialog) .field select{display:block;width:100%;border:1px solid var(--dsw-alias-border-l3);border-radius:8px;background:var(--surface);color:var(--ink);font-size:13px;line-height:1.8;padding:8px 10px;margin-top:7px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .field textarea{resize:vertical;min-height:85px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .field small{display:block;color:var(--muted);font-size:11px;line-height:1.8;margin-top:6px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .detail-kv{display:grid;grid-template-columns:86px 1fr;gap:12px;font-size:12px;line-height:1.9;margin:21px 0}\n:where(.tf-panel,.tf-tool,.tf-dialog) .detail-kv dt{color:var(--muted)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .detail-kv dd{margin:0;overflow-wrap:anywhere}\n:where(.tf-panel,.tf-tool,.tf-dialog) .history{padding:12px 0;border-top:1px solid var(--line);font-size:12px;line-height:1.9}\n:where(.tf-panel,.tf-tool,.tf-dialog) .history time{display:block;font-size:10px;color:var(--muted);margin-bottom:4px}\n@media(min-width:1700px){.tf-tool{flex-basis:49%}\n}\n@media(max-width:1250px){:where(.tf-panel,.tf-tool,.tf-dialog) .tool-content{padding:14px 10px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-title{font-size:12px}\n}\n@media(max-width:1080px){:where(.tf-panel,.tf-tool,.tf-dialog) .plan-heading{padding:15px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .plan-controls{padding:0 12px 12px}\n}\n@media(max-width:790px){.tf-tool{min-width:0;max-width:none;flex:1}\n:where(.tf-panel,.tf-tool,.tf-dialog) .tool-header .binding{font-size:10px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .plan-heading{padding:20px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .plan-controls{padding:0 18px 14px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-list{padding:0 16px 16px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-title{font-size:13px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-meta{font-size:11px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-row{padding:12px 10px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .plan-bottom{padding:12px 20px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .dialog-head{padding:18px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .dialog-body{padding:5px 18px 20px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .dialog-actions{padding:12px 18px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .dialog-actions .btn{font-size:12px;padding:0 10px}\n}\n';
|
|
603
|
+
.tf-quick-replies-wrap{min-width:0;font:inherit}.tf-quick-replies:empty{display:none}.tf-quick-replies button{font-family:inherit;background:transparent;cursor:pointer;line-height:1.4}.tf-quick-replies button:hover{background:var(--hover);color:var(--ink)}.tf-quick-replies button:focus-visible{outline:2px solid var(--blue);outline-offset:2px}.tf-reply-status{display:block;font-size:11px;color:var(--secondary);margin-bottom:8px}.tf-reply-status button{border:0;background:none;color:var(--blue);font:inherit;cursor:pointer;margin-left:6px}
|
|
604
|
+
.tf-checklist-root{display:flex;flex:1;flex-direction:column;min-width:0;min-height:0;height:100%}
|
|
605
|
+
/* Keep the compact width local to the selected normal checklist. Fullscreen,
|
|
606
|
+
floating tabs, other plugins and the host's saved width remain untouched. */
|
|
607
|
+
:has(>[data-rightbar-col] [data-tf-compact-checklist]):not([data-rightbar-collapsed]):not([data-rightbar-fullscreen]){grid-template-columns:var(--tf-sidebar-track) minmax(400px,1fr) var(--tf-checklist-width,300px)!important}
|
|
608
|
+
[data-tf-compact-checklist][data-sidebar-right-panel="push"]{width:var(--tf-checklist-width,300px)!important;--dsh-sidebar-width:var(--tf-checklist-width,300px)!important}
|
|
609
|
+
:has(>[data-rightbar-col] [data-tf-compact-checklist])>[data-side="rightbar"]{display:none}
|
|
610
|
+
.tf-checklist-resizer{position:absolute;left:0;top:0;bottom:0;width:6px;z-index:30;pointer-events:auto;cursor:col-resize;touch-action:none}
|
|
611
|
+
.tf-checklist-resizer:hover,.tf-checklist-resizer:focus-visible{background:var(--dsw-alias-state-business-primary,#4d6bfe);opacity:.5;outline:0}
|
|
612
|
+
.tf-checklist-resize-shield{position:fixed;inset:0;z-index:1205;pointer-events:auto;cursor:col-resize;user-select:none;touch-action:none}
|
|
613
|
+
.tf-quick-replies-wrap{width:100%;max-width:780px;margin:0 auto;text-align:left}
|
|
614
|
+
.tf-reply-loading{display:flex;align-items:center;justify-content:flex-start;gap:5px;line-height:18px}
|
|
615
|
+
.tf-reply-loading>span:first-child{display:inline-flex;align-items:center}
|
|
616
|
+
.tf-reply-loading .tf-task-spinner{width:12px;height:12px;stroke-width:2}
|
|
617
|
+
.tf-tool .tool-content.tf-tool-documents{display:flex;flex-direction:column;gap:8px;padding:4px;overscroll-behavior:contain}
|
|
618
|
+
.tf-tool-documents>.tf-document-view{position:relative;display:flex;flex-direction:column;flex:0 0 max(300px,100%);min-height:0;min-width:0}
|
|
619
|
+
.tf-tool-documents>.tf-document-view:only-child{flex:1;overflow:hidden}
|
|
620
|
+
.tf-document-actions{display:flex;align-items:center;gap:8px;padding:8px;flex-shrink:0}.tf-document-actions .tf-error{margin:0;padding:0;flex:1}.tf-preview-loading{position:absolute;inset:8px auto auto 8px;margin:0;font-size:12px;z-index:1;color:var(--secondary)}
|
|
621
|
+
.tf-document-preview-target{flex:1;min-height:0;min-width:0;border:0;border-radius:4px;overflow:hidden}
|
|
622
|
+
.tf-host-preview.tf-host-preview{position:fixed!important;border:0!important;border-radius:8px!important;box-shadow:none!important;overflow:hidden!important}
|
|
623
|
+
.tf-host-preview [data-dockkit-float-grip],.tf-host-preview>[data-dockkit-float-resize]{display:none!important}
|
|
624
|
+
.tf-host-preview [data-textpreview-path]{display:none!important}
|
|
625
|
+
`;
|
|
626
|
+
|
|
627
|
+
// taskflow-source:src/client/generated/prototype.css
|
|
628
|
+
var prototype_default = '/* Generated from docs/prototype/dsh-taskflow-prd.html.\n * Original DeepSeek UI styles: MIT; see licenses/DeepSeek-MIT.txt.\n * Run npm run build to resync. */\n:where(.tf-panel,.tf-tool,.tf-dialog) .iconbtn{display:inline-grid;place-items:center;width:28px;height:28px;border-radius:8px;color:var(--secondary);padding:0;flex-shrink:0}\n:where(.tf-panel,.tf-tool,.tf-dialog) .iconbtn svg{width:16px;height:16px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .btn{display:inline-flex;align-items:center;justify-content:center;gap:4px;min-height:36px;border:0;border-radius:12px;padding:0 14px;background:transparent;color:var(--ink);font-size:14px;line-height:22px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .btn.small{min-height:28px;height:auto;padding:4px 10px;border-radius:8px;font-size:12px;line-height:18px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .btn.outline{box-shadow:inset 0 0 0 var(--hairline) var(--dsw-alias-border-l3)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .btn.primary{background:var(--dsw-alias-button-primary-fill);color:var(--dsw-alias-label-primary-foreground)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .btn.primary:hover{background:var(--dsw-alias-button-primary-hover)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .btn.blue{color:var(--blue);background:var(--dsw-specific-bubble)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .btn.danger{color:var(--dsw-alias-state-danger-primary,#ec1313)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .btn svg{width:16px;height:16px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .subtle{color:var(--muted)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .pill{display:inline-flex;align-items:center;gap:5px;background:var(--hover);color:var(--secondary);font-size:11px;line-height:18px;padding:2px 7px;border-radius:6px;white-space:nowrap}\n:where(.tf-panel,.tf-tool,.tf-dialog) .pill.blue{color:var(--blue);background:var(--dsw-specific-bubble)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .pill.success{color:var(--dsw-alias-state-success-primary,#168349);background:var(--dsw-static-green-500-a08)}\n:where(.tf-panel,.tf-tool,.tf-dialog,.tf-session-tree,.tf-session-root) .dot{width:6px;height:6px;border-radius:50%;background:var(--muted);display:inline-block;flex-shrink:0}\n:where(.tf-panel,.tf-tool,.tf-dialog,.tf-session-tree,.tf-session-root) .dot.running{background:var(--blue)}\n:where(.tf-panel,.tf-tool,.tf-dialog,.tf-session-tree,.tf-session-root) .dot.completed{background:var(--dsw-static-green-500)}\n:where(.tf-panel,.tf-tool,.tf-dialog,.tf-session-tree,.tf-session-root) .dot.awaiting_children{background:var(--dsw-static-amber-500)}\n:is(.tf-session-root,.tf-session-tree .session-row){display:flex;align-items:center;width:calc(100% - 6px);height:36px;border-radius:12px;text-align:left;margin:3px;gap:6px;padding:0 9px;font-size:13px;min-width:0}\n:is(.tf-session-root,.tf-session-tree .session-row).selected{background:var(--hover)}\n:is(.tf-session-root,.tf-session-tree .session-row) svg{width:16px;height:16px;color:var(--muted)}\n:is(.tf-session-root,.tf-session-tree .session-row) span.title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;flex:1}\n.tf-session-tree .session-children{padding-left:14px;position:relative;margin-left:8px}\n.tf-session-tree .session-children:before{content:"";position:absolute;left:6px;top:3px;bottom:3px;width:1px;background:var(--line)}\n:is(.tf-session-root,.tf-session-tree .session-row) .dot{width:5px;height:5px}\n.tf-quick-replies{display:flex;align-items:center;gap:7px;flex-wrap:wrap;max-width:780px;margin:0 auto 11px}\n.tf-quick-replies button{font-size:11px;color:var(--secondary);border:1px solid var(--line);border-radius:8px;padding:5px 8px}\n.tf-tool{display:flex;flex-direction:column;flex:0 0 48%;max-width:650px;min-width:300px;min-height:0;border-right:1px solid var(--dsw-alias-border-l3);background:var(--surface);order:-1}\n:where(.tf-panel,.tf-tool,.tf-dialog) .tool-header{height:38px;flex-shrink:0;display:flex;align-items:center;gap:7px;padding:0 10px;font-size:12px;border-bottom:1px solid var(--line)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .tool-header svg{width:15px;height:15px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .tool-header .binding{font-size:11px;color:var(--muted);margin-left:auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n:where(.tf-panel,.tf-tool,.tf-dialog) .tool-context{height:38px;flex-shrink:0;display:flex;align-items:center;gap:6px;padding:0 12px;font-size:11px;color:var(--muted);border-bottom:1px solid var(--line)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .tool-content{flex:1;min-height:0;overflow:auto;padding:20px 16px;background:var(--dsw-specific-sidebar-fill);scrollbar-width:thin}\n:where(.tf-panel,.tf-tool,.tf-dialog) .tool-footer{padding:8px 12px;font-size:10px;color:var(--muted);border-top:1px solid var(--line);line-height:1.7}\n:where(.tf-panel,.tf-tool,.tf-dialog) .browser-window{border:1px solid var(--line);border-radius:12px;overflow:hidden;background:var(--surface)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .browser-toolbar{height:42px;display:flex;align-items:center;gap:5px;border-bottom:1px solid var(--line);padding:0 8px;background:var(--dsw-specific-sidebar-fill)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .browser-toolbar .iconbtn{width:22px;height:25px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .browser-toolbar .iconbtn svg{width:13px;height:13px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .address{border:1px solid var(--line);border-radius:8px;background:var(--surface);height:26px;display:flex;align-items:center;gap:5px;flex:1;min-width:0;padding:0 8px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .address svg{width:11px;height:11px;color:var(--muted)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .address input{font-size:10px;background:none;border:0;outline:0;min-width:0;width:100%;color:var(--secondary)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .code-window{border:1px solid var(--line);border-radius:8px;overflow:hidden;background:var(--surface)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .file-tab{background:var(--dsw-specific-sidebar-fill);padding:11px 12px;font-size:11px;border-bottom:1px solid var(--line)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .code-window pre{font:12px/2 Consolas,var(--dsw-font-family);white-space:pre-wrap;margin:0;padding:18px 14px;color:var(--secondary)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .terminal{background:var(--dsw-static-neutral-bluish-950);color:var(--dsw-static-neutral-bluish-100);padding:18px 15px;border-radius:8px;min-height:250px;font:11px/2 Consolas,var(--dsw-font-family);white-space:pre-wrap}\n:where(.tf-panel,.tf-tool,.tf-dialog) .plugin-card{border:1px solid var(--line);border-radius:12px;background:var(--surface);padding:18px;margin-bottom:15px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .plugin-card h3{font-size:15px;margin:12px 0;font-weight:500}\n:where(.tf-panel,.tf-tool,.tf-dialog) .plugin-card p{font-size:12px;line-height:1.9;color:var(--secondary)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .tool-caption{font-size:10px;line-height:1.8;color:var(--muted);margin:12px 0}\n.tf-panel{grid-column:3;grid-row:2;display:flex;flex-direction:column;min-width:0;min-height:0;background:var(--surface);border-left:1px solid var(--dsw-alias-border-l3)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .plan-tabs{display:flex;align-items:center;gap:7px;min-height:38px;height:38px;padding:0 10px;border-bottom:1px solid var(--line);font-size:12px;flex-shrink:0}\n:where(.tf-panel,.tf-tool,.tf-dialog) .plan-tabs .tab{display:flex;align-items:center;gap:5px;border-bottom:2px solid var(--ink);height:38px;padding:0 6px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .plan-tabs .tab svg{width:14px;height:14px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .plan-tabs .iconbtn{margin-left:auto}\n:where(.tf-panel,.tf-tool,.tf-dialog) .plan-heading{padding:16px 18px 14px;flex-shrink:0}\n:where(.tf-panel,.tf-tool,.tf-dialog) .plan-heading h2{font-size:15px;font-weight:500;line-height:1.5;margin:0 0 8px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .plan-heading p{font-size:12px;color:var(--muted);margin:0;line-height:1.8}\n:where(.tf-panel,.tf-tool,.tf-dialog) .progress-label{display:flex;align-items:center;justify-content:space-between;font-size:11px;color:var(--muted);margin-top:12px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .progress-label strong{font-weight:400;color:var(--secondary)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .progress-track{height:3px;background:var(--hover);border-radius:3px;overflow:hidden;margin-top:9px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .progress-track span{background:var(--blue);height:100%;display:block;transition:width .2s}\n:where(.tf-panel,.tf-tool,.tf-dialog) .plan-controls{padding:0 16px 12px;display:flex;align-items:center;gap:7px;border-bottom:1px solid var(--line);flex-shrink:0}\n:where(.tf-panel,.tf-tool,.tf-dialog) .segments{display:flex;flex:1;padding:3px;border-radius:8px;background:var(--hover)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .segments button{flex:1;padding:4px 5px;border-radius:6px;color:var(--muted);font-size:11px;white-space:nowrap}\n:where(.tf-panel,.tf-tool,.tf-dialog) .segments button.selected{background:var(--surface);color:var(--ink);box-shadow:0 1px 3px #00000008}\n:where(.tf-panel,.tf-tool,.tf-dialog) .plan-controls select{font-size:11px;width:72px;padding:6px 2px;border:0;background:transparent;color:var(--secondary);border-radius:6px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-list{overflow:auto;flex:1;min-height:0;padding:10px 10px 16px;scrollbar-width:thin}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-row{margin:2px 0;border-radius:8px;padding:11px 8px;cursor:pointer;border:1px solid transparent}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-row:hover{background:var(--hover)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-row.focused{background:var(--dsw-specific-bubble);border-color:var(--dsw-static-deepseek-100)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-row.cancelled{opacity:.55}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-row.context-only{background:transparent}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-row.context-only .task-title{color:var(--muted)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-line{display:flex;gap:8px;align-items:flex-start}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-box{width:15px;height:15px;display:grid;place-items:center;border:1px solid var(--dsw-alias-border-l4);border-radius:4px;flex-shrink:0;margin-top:3px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-box svg{width:11px;height:11px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-box.completed{background:var(--blue);border-color:var(--blue);color:var(--dsw-static-neutral-00)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-box.running{border-color:var(--blue)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-box.running:before{content:"";width:5px;height:5px;border-radius:50%;background:var(--blue)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-copy{flex:1;min-width:0}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-title{font-size:13px;line-height:1.7;font-weight:400}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-row.completed .task-title{color:var(--muted);text-decoration:line-through;text-decoration-color:var(--dsw-alias-border-l4)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-meta{font-size:10px;color:var(--muted);display:flex;align-items:center;gap:5px;margin-top:4px;flex-wrap:wrap}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-meta code{font:10px Consolas,var(--dsw-font-family)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-row .iconbtn{height:22px;width:20px;margin-right:-3px;color:var(--muted)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-row .iconbtn svg{width:14px;height:14px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-status{display:flex;align-items:center;gap:7px;margin:8px 0 0 23px;font-size:11px;color:var(--muted);flex-wrap:wrap}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-status .pill{font-size:10px;padding:1px 5px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-status .btn{font-size:10px;min-height:23px;padding:2px 7px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .child-tasks{border-left:1px solid var(--line);margin-left:15px;padding-left:5px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .plan-bottom{padding:12px 16px;border-top:1px solid var(--line);flex-shrink:0}\n:where(.tf-panel,.tf-tool,.tf-dialog) .plan-bottom .btn{width:100%;font-size:12px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .plan-bottom p{text-align:center;font-size:10px;color:var(--muted);margin:9px 0 0;line-height:1.8}\n:where(.tf-panel,.tf-tool,.tf-dialog) .empty{padding:35px 18px;color:var(--muted);font-size:13px;line-height:1.9;text-align:center}\n:where(.tf-panel,.tf-tool,.tf-dialog) .empty svg{width:24px;height:24px;margin-bottom:10px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .saved:before{content:"";width:5px;height:5px;border-radius:50%;background:var(--dsw-static-green-500);display:inline-block;vertical-align:2px;margin-right:5px}\n.tf-dialog{width:min(590px,calc(100vw - 28px));max-height:88dvh;padding:0;border:1px solid var(--line);border-radius:20px;background:var(--surface);color:var(--ink);box-shadow:0 10px 45px #00000020}\n.tf-dialog::backdrop{background:#00000040;backdrop-filter:blur(2px)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .dialog-head{padding:21px 24px 17px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--line);gap:12px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .dialog-head h2{font-size:17px;line-height:1.6;font-weight:500;margin:0}\n:where(.tf-panel,.tf-tool,.tf-dialog) .dialog-head small{display:block;font-size:10px;color:var(--muted);margin-bottom:5px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .dialog-body{padding:7px 24px 20px;max-height:calc(88dvh - 145px);overflow:auto;scrollbar-width:thin}\n:where(.tf-panel,.tf-tool,.tf-dialog) .dialog-actions{border-top:1px solid var(--line);display:flex;justify-content:flex-end;align-items:center;flex-wrap:wrap;gap:7px;padding:13px 24px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .notice{background:var(--hover);border-radius:12px;padding:12px 14px;margin:15px 0;font-size:12px;line-height:1.9;color:var(--secondary)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .notice.blue{background:var(--dsw-specific-bubble);color:var(--blue)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .notice.warn{background:var(--dsw-static-amber-100);color:#9a6c25}\nbody[data-ds-dark-theme] :where(.tf-panel,.tf-tool,.tf-dialog) .notice.warn{background:var(--dsw-static-amber-900);color:var(--dsw-static-amber-400)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .field{display:block;color:var(--secondary);font-size:12px;margin:17px 0}\n:where(.tf-panel,.tf-tool,.tf-dialog) .field input,:where(.tf-panel,.tf-tool,.tf-dialog) .field textarea,:where(.tf-panel,.tf-tool,.tf-dialog) .field select{display:block;width:100%;border:1px solid var(--dsw-alias-border-l3);border-radius:8px;background:var(--surface);color:var(--ink);font-size:13px;line-height:1.8;padding:8px 10px;margin-top:7px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .field textarea{resize:vertical;min-height:85px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .field small{display:block;color:var(--muted);font-size:11px;line-height:1.8;margin-top:6px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .detail-kv{display:grid;grid-template-columns:86px 1fr;gap:12px;font-size:12px;line-height:1.9;margin:21px 0}\n:where(.tf-panel,.tf-tool,.tf-dialog) .detail-kv dt{color:var(--muted)}\n:where(.tf-panel,.tf-tool,.tf-dialog) .detail-kv dd{margin:0;overflow-wrap:anywhere}\n:where(.tf-panel,.tf-tool,.tf-dialog) .history{padding:12px 0;border-top:1px solid var(--line);font-size:12px;line-height:1.9}\n:where(.tf-panel,.tf-tool,.tf-dialog) .history time{display:block;font-size:10px;color:var(--muted);margin-bottom:4px}\n@media(min-width:1700px){.tf-tool{flex-basis:49%}\n}\n@media(max-width:1250px){:where(.tf-panel,.tf-tool,.tf-dialog) .tool-content{padding:14px 10px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-title{font-size:12px}\n}\n@media(max-width:1080px){:where(.tf-panel,.tf-tool,.tf-dialog) .plan-heading{padding:15px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .plan-controls{padding:0 12px 12px}\n}\n@media(max-width:790px){.tf-quick-replies{gap:5px}\n.tf-quick-replies button{font-size:10px;padding:4px 6px}\n.tf-tool{min-width:0;max-width:none;flex:1}\n:where(.tf-panel,.tf-tool,.tf-dialog) .tool-header .binding{font-size:10px}\n:is(.tf-session-root,.tf-session-tree .session-row){height:40px;font-size:14px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .plan-heading{padding:20px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .plan-controls{padding:0 18px 14px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-list{padding:0 16px 16px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-title{font-size:13px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-meta{font-size:11px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .task-row{padding:12px 10px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .plan-bottom{padding:12px 20px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .dialog-head{padding:18px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .dialog-body{padding:5px 18px 20px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .dialog-actions{padding:12px 18px}\n:where(.tf-panel,.tf-tool,.tf-dialog) .dialog-actions .btn{font-size:12px;padding:0 10px}\n}\n';
|
|
629
|
+
|
|
630
|
+
// taskflow-source:src/client/hooks/use-header-entry-target.mjs
|
|
631
|
+
var import_react11 = require("react");
|
|
632
|
+
function useHeaderEntryTarget(anchor) {
|
|
633
|
+
const [target, setTarget] = (0, import_react11.useState)(null);
|
|
634
|
+
(0, import_react11.useEffect)(() => {
|
|
635
|
+
const header = anchor.current?.closest("header");
|
|
636
|
+
if (!header) return;
|
|
637
|
+
const node = document.createElement("span");
|
|
638
|
+
node.className = "tf-header-entry-mount";
|
|
639
|
+
const attach = () => {
|
|
640
|
+
const progress2 = header.querySelector("[data-conversation-header-corner] [data-tp-entry]");
|
|
641
|
+
if (progress2?.parentElement) {
|
|
642
|
+
if (progress2.nextElementSibling !== node) progress2.after(node);
|
|
643
|
+
setTarget((current) => current === node ? current : node);
|
|
644
|
+
} else {
|
|
645
|
+
node.remove();
|
|
646
|
+
setTarget((current) => current === null ? current : null);
|
|
647
|
+
}
|
|
648
|
+
};
|
|
649
|
+
const observer = new MutationObserver(attach);
|
|
650
|
+
observer.observe(header, { childList: true, subtree: true });
|
|
651
|
+
attach();
|
|
652
|
+
return () => {
|
|
653
|
+
observer.disconnect();
|
|
654
|
+
node.remove();
|
|
655
|
+
};
|
|
656
|
+
}, [anchor]);
|
|
657
|
+
return target;
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
// taskflow-source:src/client/embedded-preview.mjs
|
|
661
|
+
function embedPreview({ sidebar, sessionId, tabId, container }) {
|
|
662
|
+
const doc = container.ownerDocument, win = doc.defaultView;
|
|
663
|
+
let frame, pane, host, hostLayer, disposed = false;
|
|
664
|
+
const previous = /* @__PURE__ */ new Map();
|
|
665
|
+
const set = (name, value) => {
|
|
666
|
+
if (!previous.has(name)) previous.set(name, [pane.style.getPropertyValue(name), pane.style.getPropertyPriority(name)]);
|
|
667
|
+
if (pane.style.getPropertyValue(name) !== value || pane.style.getPropertyPriority(name) !== "important") pane.style.setProperty(name, value, "important");
|
|
668
|
+
};
|
|
669
|
+
const restore = () => {
|
|
670
|
+
if (!pane) return;
|
|
671
|
+
pane.classList.remove("tf-host-preview");
|
|
672
|
+
for (const [name, [value, priority]] of previous) value ? pane.style.setProperty(name, value, priority) : pane.style.removeProperty(name);
|
|
673
|
+
if (host) {
|
|
674
|
+
const [value, priority] = hostLayer;
|
|
675
|
+
value ? host.style.setProperty("--dsh-dockkit-float-layer", value, priority) : host.style.removeProperty("--dsh-dockkit-float-layer");
|
|
676
|
+
}
|
|
677
|
+
previous.clear();
|
|
678
|
+
pane = void 0;
|
|
679
|
+
host = void 0;
|
|
680
|
+
};
|
|
681
|
+
const update = () => {
|
|
682
|
+
if (disposed) return;
|
|
683
|
+
if (!pane?.isConnected || !pane.hasAttribute("data-dockkit-float")) {
|
|
684
|
+
const body = [...doc.querySelectorAll("[data-sidebar-right-tab]")].find((node) => node.dataset.sidebarRightTab === tabId && node.closest("[data-dockkit-float]"));
|
|
685
|
+
const nextPane = body?.closest("[data-dockkit-float]");
|
|
686
|
+
if (pane !== nextPane) {
|
|
687
|
+
restore();
|
|
688
|
+
pane = nextPane;
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
if (pane) {
|
|
692
|
+
if (!host) {
|
|
693
|
+
host = pane.closest('[data-dockkit-host="float"]');
|
|
694
|
+
if (host) hostLayer = [host.style.getPropertyValue("--dsh-dockkit-float-layer"), host.style.getPropertyPriority("--dsh-dockkit-float-layer")];
|
|
695
|
+
}
|
|
696
|
+
pane.classList.add("tf-host-preview");
|
|
697
|
+
const rect = container.getBoundingClientRect(), scrollport = container.closest(".tool-content")?.getBoundingClientRect() ?? rect;
|
|
698
|
+
const top = Math.max(0, scrollport.top, rect.top), bottom = Math.min(win.innerHeight, scrollport.bottom, rect.bottom);
|
|
699
|
+
const left = Math.max(0, scrollport.left, rect.left), right = Math.min(win.innerWidth, scrollport.right, rect.right);
|
|
700
|
+
const visible = container.isConnected && sidebar.mounted.getSnapshot() === sessionId && rect.width > 0 && rect.height > 0 && bottom > top && right > left && win.getComputedStyle(container.closest(".tf-tool-mount") ?? container).display !== "none";
|
|
701
|
+
set("visibility", visible ? "visible" : "hidden");
|
|
702
|
+
set("left", `${rect.left}px`);
|
|
703
|
+
set("top", `${rect.top}px`);
|
|
704
|
+
set("width", `${rect.width}px`);
|
|
705
|
+
set("height", `${rect.height}px`);
|
|
706
|
+
set("min-width", "0px");
|
|
707
|
+
set("min-height", "0px");
|
|
708
|
+
set("max-width", "none");
|
|
709
|
+
set("max-height", "none");
|
|
710
|
+
set("transform", "none");
|
|
711
|
+
set("z-index", container.closest(".tf-tool-floating") ? "1201" : "30");
|
|
712
|
+
const layer = container.closest(".tf-tool-floating") ? "1201" : "60";
|
|
713
|
+
if (host && host.style.getPropertyValue("--dsh-dockkit-float-layer") !== layer) host.style.setProperty("--dsh-dockkit-float-layer", layer);
|
|
714
|
+
set("clip-path", `inset(${Math.max(0, top - rect.top)}px ${Math.max(0, rect.right - right)}px ${Math.max(0, rect.bottom - bottom)}px ${Math.max(0, left - rect.left)}px)`);
|
|
715
|
+
}
|
|
716
|
+
frame = win.requestAnimationFrame(update);
|
|
717
|
+
};
|
|
718
|
+
update();
|
|
719
|
+
return () => {
|
|
720
|
+
if (disposed) return;
|
|
721
|
+
disposed = true;
|
|
722
|
+
win.cancelAnimationFrame(frame);
|
|
723
|
+
restore();
|
|
724
|
+
sidebar.closeIn(sessionId, tabId);
|
|
725
|
+
};
|
|
726
|
+
}
|
|
207
727
|
|
|
208
|
-
// src/client/
|
|
728
|
+
// taskflow-source:src/client/tool-openers.mjs
|
|
729
|
+
function sessionFileAddress(sessionId, path) {
|
|
730
|
+
const encode = (s) => encodeURIComponent(s).replace(/%3A/gi, ":");
|
|
731
|
+
return `dsh-resource://file/session/${encode(sessionId)}/${path.replace(/\\/g, "/").replace(/^(?:\.\/)+/, "").split("/").map(encode).join("/")}`;
|
|
732
|
+
}
|
|
733
|
+
function createToolOpeners(ctx) {
|
|
734
|
+
const browserUrls = /* @__PURE__ */ new Map();
|
|
735
|
+
const get = (name) => ctx.get ? ctx.get(name) : ctx[name];
|
|
736
|
+
const foreground = (sid) => {
|
|
737
|
+
const sidebar = get("sidebarRight");
|
|
738
|
+
if (!sidebar?.mounted || sidebar.mounted.getSnapshot() !== sid) throw new Error("请先打开此任务会话,再打开工具产物");
|
|
739
|
+
return sidebar;
|
|
740
|
+
};
|
|
741
|
+
return {
|
|
742
|
+
async openDocument(sid, file, { container } = {}) {
|
|
743
|
+
const sidebar = foreground(sid), address = sessionFileAddress(sid, file.path), tabs = get("sidebarRightTabs");
|
|
744
|
+
let claim;
|
|
745
|
+
try {
|
|
746
|
+
claim = tabs?.claim(address);
|
|
747
|
+
} catch {
|
|
748
|
+
throw new Error("文档预览插件尚未就绪,请启用后重试");
|
|
749
|
+
}
|
|
750
|
+
if (!claim) throw new Error("文档预览插件尚未就绪,请启用后重试");
|
|
751
|
+
if (container) {
|
|
752
|
+
if (!sidebar.float || !sidebar.active || !sidebar.closeIn) throw new Error("当前宿主不支持工具区文档预览,请更新宿主");
|
|
753
|
+
const previous = sidebar.active(), expanded = sidebar.isExpanded();
|
|
754
|
+
const restorePanel = () => {
|
|
755
|
+
if (previous) sidebar.focus(previous.id);
|
|
756
|
+
if (!expanded && sidebar.isExpanded()) sidebar.toggleExpanded();
|
|
757
|
+
};
|
|
758
|
+
sidebar.openResource(address, { revealIfOpened: false });
|
|
759
|
+
const tab = sidebar.active();
|
|
760
|
+
if (!tab || tab.id === previous?.id || tab.contentId !== address) throw new Error("宿主未建立文档预览,请重试");
|
|
761
|
+
try {
|
|
762
|
+
sidebar.float(tab.id);
|
|
763
|
+
restorePanel();
|
|
764
|
+
return { message: "已在工具视图中打开", dispose: embedPreview({ sidebar, sessionId: sid, tabId: tab.id, container }) };
|
|
765
|
+
} catch (error) {
|
|
766
|
+
sidebar.closeIn(sid, tab.id);
|
|
767
|
+
restorePanel();
|
|
768
|
+
throw error;
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
await sidebar.openResource(address, { destination: "float" });
|
|
772
|
+
return "已交给文档插件打开";
|
|
773
|
+
},
|
|
774
|
+
async openBrowser(sid, url, { automatic = false } = {}) {
|
|
775
|
+
const sidebar = foreground(sid);
|
|
776
|
+
if (!get("sidebarRightTabs")?.get("browser")) throw new Error("浏览器插件尚未就绪,请启用后重试");
|
|
777
|
+
if (automatic && browserUrls.get(sid) === url) return "此地址已交给浏览器插件打开";
|
|
778
|
+
sidebar.openTab("browser", { params: { url } });
|
|
779
|
+
browserUrls.set(sid, url);
|
|
780
|
+
return "已交给浏览器插件打开";
|
|
781
|
+
}
|
|
782
|
+
};
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
// taskflow-source:src/client/hooks/use-compact-checklist.mjs
|
|
786
|
+
var import_react12 = require("react");
|
|
787
|
+
var MIN_WIDTH = 280;
|
|
788
|
+
var MAX_WIDTH = 720;
|
|
789
|
+
var STORAGE_KEY = "dsh-taskflow:checklist-width";
|
|
790
|
+
var clamp = (width, max) => Math.round(Math.max(MIN_WIDTH, Math.min(width, max)));
|
|
791
|
+
var savedWidth = () => {
|
|
792
|
+
try {
|
|
793
|
+
const width = JSON.parse(window.localStorage.getItem(STORAGE_KEY));
|
|
794
|
+
return Number.isFinite(width) ? clamp(width, MAX_WIDTH) : 300;
|
|
795
|
+
} catch {
|
|
796
|
+
return 300;
|
|
797
|
+
}
|
|
798
|
+
};
|
|
799
|
+
function useCompactChecklist(enabled) {
|
|
800
|
+
const anchor = (0, import_react12.useRef)(null), desired = (0, import_react12.useRef)(null), bridge = (0, import_react12.useRef)(null), stopDrag = (0, import_react12.useRef)(() => {
|
|
801
|
+
});
|
|
802
|
+
if (desired.current === null) desired.current = savedWidth();
|
|
803
|
+
const [panel, setPanel] = (0, import_react12.useState)(null), [size, setSize] = (0, import_react12.useState)({ width: 300, max: MAX_WIDTH }), [dragging, setDragging] = (0, import_react12.useState)(false);
|
|
804
|
+
const save = () => {
|
|
805
|
+
try {
|
|
806
|
+
window.localStorage.setItem(STORAGE_KEY, JSON.stringify(desired.current));
|
|
807
|
+
} catch {
|
|
808
|
+
}
|
|
809
|
+
};
|
|
810
|
+
(0, import_react12.useEffect)(() => {
|
|
811
|
+
if (!enabled) return;
|
|
812
|
+
const panel2 = anchor.current?.closest('[data-sidebar-right-panel="push"]');
|
|
813
|
+
const frame = panel2?.closest("[data-rightbar-col]")?.parentElement;
|
|
814
|
+
if (!frame || !/^\s*[\d.]+px\s/.test(frame.style.gridTemplateColumns)) return;
|
|
815
|
+
const sync = () => {
|
|
816
|
+
const first = frame.style.gridTemplateColumns.match(/^\s*([\d.]+px)\s/)?.[1];
|
|
817
|
+
if (!first) return;
|
|
818
|
+
const viewport = frame.getBoundingClientRect().width || window.innerWidth;
|
|
819
|
+
const max = Math.max(MIN_WIDTH, Math.floor(Math.min(MAX_WIDTH, viewport * 0.7, viewport - parseFloat(first) - 400)));
|
|
820
|
+
const width = clamp(desired.current, max);
|
|
821
|
+
for (const [name, value] of [["--tf-sidebar-track", first], ["--tf-checklist-width", `${width}px`]]) if (frame.style.getPropertyValue(name) !== value) frame.style.setProperty(name, value);
|
|
822
|
+
bridge.current = { sync, width, max };
|
|
823
|
+
setSize((previous) => previous.width === width && previous.max === max ? previous : { width, max });
|
|
824
|
+
};
|
|
825
|
+
sync();
|
|
826
|
+
panel2.dataset.tfCompactChecklist = "";
|
|
827
|
+
setPanel(panel2);
|
|
828
|
+
const observer = new MutationObserver(sync);
|
|
829
|
+
observer.observe(frame, { attributes: true, attributeFilter: ["style"] });
|
|
830
|
+
const resize = typeof window.ResizeObserver === "function" ? new window.ResizeObserver(sync) : null;
|
|
831
|
+
resize?.observe(frame);
|
|
832
|
+
window.addEventListener("resize", sync);
|
|
833
|
+
return () => {
|
|
834
|
+
stopDrag.current();
|
|
835
|
+
observer.disconnect();
|
|
836
|
+
resize?.disconnect();
|
|
837
|
+
window.removeEventListener("resize", sync);
|
|
838
|
+
bridge.current = null;
|
|
839
|
+
setPanel(null);
|
|
840
|
+
delete panel2.dataset.tfCompactChecklist;
|
|
841
|
+
if (!frame.querySelector("[data-tf-compact-checklist]")) {
|
|
842
|
+
frame.style.removeProperty("--tf-sidebar-track");
|
|
843
|
+
frame.style.removeProperty("--tf-checklist-width");
|
|
844
|
+
}
|
|
845
|
+
};
|
|
846
|
+
}, [enabled]);
|
|
847
|
+
const onPointerDown = (event) => {
|
|
848
|
+
if (event.button !== 0 || !bridge.current) return;
|
|
849
|
+
event.preventDefault();
|
|
850
|
+
stopDrag.current();
|
|
851
|
+
const startX = event.clientX, startWidth = bridge.current.width, pointerId = event.pointerId, handle = event.currentTarget;
|
|
852
|
+
const move = (e) => {
|
|
853
|
+
if (e.pointerId !== pointerId || !bridge.current) return;
|
|
854
|
+
desired.current = clamp(startWidth + startX - e.clientX, bridge.current.max);
|
|
855
|
+
bridge.current.sync();
|
|
856
|
+
};
|
|
857
|
+
const end = (e) => {
|
|
858
|
+
if (e?.pointerId !== void 0 && e.pointerId !== pointerId) return;
|
|
859
|
+
stopDrag.current = () => {
|
|
860
|
+
};
|
|
861
|
+
window.removeEventListener("pointermove", move, true);
|
|
862
|
+
window.removeEventListener("pointerup", up, true);
|
|
863
|
+
window.removeEventListener("pointercancel", end, true);
|
|
864
|
+
window.removeEventListener("blur", end);
|
|
865
|
+
handle.removeEventListener("lostpointercapture", end);
|
|
866
|
+
if (handle.hasPointerCapture?.(pointerId)) handle.releasePointerCapture(pointerId);
|
|
867
|
+
setDragging(false);
|
|
868
|
+
save();
|
|
869
|
+
};
|
|
870
|
+
const up = (e) => {
|
|
871
|
+
if (e.pointerId === pointerId) {
|
|
872
|
+
move(e);
|
|
873
|
+
end(e);
|
|
874
|
+
}
|
|
875
|
+
};
|
|
876
|
+
stopDrag.current = end;
|
|
877
|
+
setDragging(true);
|
|
878
|
+
window.addEventListener("pointermove", move, true);
|
|
879
|
+
window.addEventListener("pointerup", up, true);
|
|
880
|
+
window.addEventListener("pointercancel", end, true);
|
|
881
|
+
window.addEventListener("blur", end);
|
|
882
|
+
handle.addEventListener("lostpointercapture", end);
|
|
883
|
+
handle.setPointerCapture?.(pointerId);
|
|
884
|
+
};
|
|
885
|
+
const onKeyDown = (event) => {
|
|
886
|
+
if (!bridge.current || !["ArrowLeft", "ArrowRight", "Home", "End"].includes(event.key)) return;
|
|
887
|
+
event.preventDefault();
|
|
888
|
+
desired.current = clamp(event.key === "Home" ? MIN_WIDTH : event.key === "End" ? bridge.current.max : bridge.current.width + (event.key === "ArrowLeft" ? 24 : -24), bridge.current.max);
|
|
889
|
+
bridge.current.sync();
|
|
890
|
+
save();
|
|
891
|
+
};
|
|
892
|
+
return { anchor, panel, dragging, separator: { role: "separator", tabIndex: 0, "aria-label": "调整待办任务清单宽度", "aria-orientation": "vertical", "aria-valuemin": MIN_WIDTH, "aria-valuemax": size.max, "aria-valuenow": size.width, onPointerDown, onKeyDown } };
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
// taskflow-source:src/client/index.jsx
|
|
209
896
|
var inject = ["slots", "sessions", "connection"];
|
|
210
897
|
function createApi(connection) {
|
|
211
898
|
const call = async (method, data) => {
|
|
@@ -217,6 +904,11 @@ function createApi(connection) {
|
|
|
217
904
|
}
|
|
218
905
|
function apply(ctx) {
|
|
219
906
|
const api = createApi(ctx.connection), renderers = /* @__PURE__ */ new Map();
|
|
907
|
+
const panels = /* @__PURE__ */ new Map(), panelListeners = /* @__PURE__ */ new Set();
|
|
908
|
+
const updatePanel = (key, value) => {
|
|
909
|
+
value ? panels.set(key, value) : panels.delete(key);
|
|
910
|
+
panelListeners.forEach((fn) => fn());
|
|
911
|
+
};
|
|
220
912
|
ctx.provide("taskflowViews", { register(kind, component) {
|
|
221
913
|
renderers.set(kind, component);
|
|
222
914
|
return () => {
|
|
@@ -226,35 +918,79 @@ function apply(ctx) {
|
|
|
226
918
|
ctx.effect(() => {
|
|
227
919
|
const style = document.createElement("style");
|
|
228
920
|
style.dataset.dshTaskflow = "";
|
|
229
|
-
style.textContent =
|
|
921
|
+
style.textContent = prototype_default + "\n" + styles_default;
|
|
230
922
|
document.head.append(style);
|
|
231
923
|
return () => style.remove();
|
|
232
924
|
});
|
|
233
925
|
ctx.inject(["sidebarRightTabs", "sidebarRight", "uiWorkspace"], (scope) => {
|
|
234
|
-
|
|
926
|
+
const openers = createToolOpeners(scope);
|
|
927
|
+
scope.effect(() => scope.sidebarRightTabs.register({ id: "dsh-taskflow", kind: "taskflow", priority: "extension", keepMounted: true, title: () => "待办任务清单", guide: [{ id: "taskflow", order: 0, title: () => "待办任务清单", icon: TaskIcon, description: () => "持久层级待办" }] }));
|
|
235
928
|
const register = (slot, options, Component) => scope.effect(() => scope.slots.inject(slot, () => scope.slots.register({ name: slot, ...options }, Component)));
|
|
236
|
-
const augment = (props, value) => {
|
|
237
|
-
const
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
input.
|
|
242
|
-
|
|
929
|
+
const augment = async (props, value, target) => {
|
|
930
|
+
const sid = typeof target === "string" ? target : target?.childSessionId || props.sessionId;
|
|
931
|
+
if (target) scope.uiWorkspace.openSession(target);
|
|
932
|
+
const deadline = Date.now() + 2500;
|
|
933
|
+
do {
|
|
934
|
+
const binding = ctx.sessions.binding(sid), input = binding && ctx.conversation?.input?.for(binding.ctx);
|
|
935
|
+
if (input) {
|
|
936
|
+
input.setDraft(value);
|
|
937
|
+
input.focus();
|
|
938
|
+
return;
|
|
939
|
+
}
|
|
940
|
+
if (sid === props.sessionId && props.inputActions) {
|
|
941
|
+
props.inputActions.setDraft(value);
|
|
942
|
+
return;
|
|
943
|
+
}
|
|
944
|
+
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
945
|
+
} while (Date.now() < deadline);
|
|
946
|
+
throw new Error("负责会话尚未就绪,请返回父会话后增补事项");
|
|
243
947
|
};
|
|
244
948
|
function Panel(props) {
|
|
245
|
-
const view = useTaskflow(api, props.sessionId);
|
|
246
|
-
|
|
949
|
+
const view = useTaskflow(api, props.sessionId), tabInfo = props.useTabInfo?.(), key = (0, import_react13.useRef)(Symbol());
|
|
950
|
+
const visible = tabInfo?.tab.visible;
|
|
951
|
+
const compact = useCompactChecklist(visible === true && !tabInfo?.sidebar?.fullscreen && !tabInfo?.panel?.isFloating);
|
|
952
|
+
(0, import_react13.useEffect)(() => {
|
|
953
|
+
if (tabInfo) updatePanel(key.current, { sid: props.sessionId, visible });
|
|
954
|
+
return () => updatePanel(key.current);
|
|
955
|
+
}, [props.sessionId, visible]);
|
|
956
|
+
const recordTask = Object.values(view.plan?.tasks ?? {}).find((t) => t.recordSession?.id === props.sessionId || t.recordHistory?.some((r) => r.id === props.sessionId));
|
|
957
|
+
return /* @__PURE__ */ import_react13.default.createElement("div", { ref: compact.anchor, className: "tf-checklist-root" }, /* @__PURE__ */ import_react13.default.createElement(TaskPanel, { view, sessionId: props.sessionId, action: (type, data) => api.action(props.sessionId, type, data), navigate: (id) => scope.uiWorkspace.openSession(id), augment: (value) => augment(props, value, recordTask && executionTarget(view.plan, recordTask)) }), compact.panel && (0, import_react_dom4.createPortal)(/* @__PURE__ */ import_react13.default.createElement("div", { className: "tf-checklist-resizer", ...compact.separator }), compact.panel), compact.dragging && (0, import_react_dom4.createPortal)(/* @__PURE__ */ import_react13.default.createElement("div", { className: "tf-checklist-resize-shield" }), document.body));
|
|
247
958
|
}
|
|
248
959
|
register("sidebar.right.pane.tab", { key: "dsh-taskflow" }, Panel);
|
|
960
|
+
function Tree(props) {
|
|
961
|
+
const current = scope.sidebarRight.mounted;
|
|
962
|
+
const sid = (0, import_react13.useSyncExternalStore)(current ? (listener) => current.subscribe(listener) : () => () => {
|
|
963
|
+
}, current ? () => current.getSnapshot() : () => null);
|
|
964
|
+
return /* @__PURE__ */ import_react13.default.createElement(SessionTree, { api, sessionId: props.sessionId, currentSessionId: sid, navigate: (target) => scope.uiWorkspace.openSession(target) });
|
|
965
|
+
}
|
|
966
|
+
register("sidebar.session.row.trailing", { id: "taskflow-children", order: 10 }, Tree);
|
|
967
|
+
function Replies(props) {
|
|
968
|
+
const current = scope.sidebarRight.mounted;
|
|
969
|
+
const foreground = (0, import_react13.useSyncExternalStore)(current ? (listener) => current.subscribe(listener) : () => () => {
|
|
970
|
+
}, current ? () => current.getSnapshot() === props.sessionId : () => true);
|
|
971
|
+
return /* @__PURE__ */ import_react13.default.createElement(QuickReplies, { key: props.sessionId, api, ...props, foreground, focus: () => {
|
|
972
|
+
const binding = ctx.sessions.binding(props.sessionId);
|
|
973
|
+
if (binding) ctx.conversation?.input?.for(binding.ctx)?.focus();
|
|
974
|
+
} });
|
|
975
|
+
}
|
|
976
|
+
register("conversation.input.dock", { id: "taskflow-quick-replies", order: -10 }, Replies);
|
|
249
977
|
function SessionEntry(props) {
|
|
250
|
-
const
|
|
251
|
-
(0,
|
|
978
|
+
const entryAnchor = (0, import_react13.useRef)(null), entryTarget = useHeaderEntryTarget(entryAnchor);
|
|
979
|
+
const panelVisible = (0, import_react13.useSyncExternalStore)((fn) => {
|
|
980
|
+
panelListeners.add(fn);
|
|
981
|
+
return () => panelListeners.delete(fn);
|
|
982
|
+
}, () => [...panels.values()].some((p) => p.sid === props.sessionId && p.visible));
|
|
983
|
+
const current = scope.sidebarRight.mounted;
|
|
984
|
+
const foreground = (0, import_react13.useSyncExternalStore)(current ? (listener) => current.subscribe(listener) : () => () => {
|
|
985
|
+
}, current ? () => current.getSnapshot() === props.sessionId : () => true);
|
|
986
|
+
const view = useTaskflow(api, props.sessionId), [mount, setMount] = (0, import_react13.useState)(null), [showTool, setShowTool] = (0, import_react13.useState)(true), [, refreshEntry] = (0, import_react13.useState)(0), autoOpened = (0, import_react13.useRef)(false);
|
|
987
|
+
(0, import_react13.useEffect)(() => {
|
|
252
988
|
if (mount) mount.parentElement?.classList.toggle("tf-tool-show-tool", showTool);
|
|
253
989
|
}, [mount, showTool]);
|
|
254
|
-
(0,
|
|
990
|
+
(0, import_react13.useEffect)(() => {
|
|
255
991
|
if (view.tool?.open) setShowTool(true);
|
|
256
992
|
}, [view.tool?.open, props.sessionId]);
|
|
257
|
-
(0,
|
|
993
|
+
(0, import_react13.useEffect)(() => {
|
|
258
994
|
if (view.plan && !autoOpened.current) {
|
|
259
995
|
try {
|
|
260
996
|
scope.sidebarRight.openTab("taskflow");
|
|
@@ -263,10 +999,10 @@ function apply(ctx) {
|
|
|
263
999
|
}
|
|
264
1000
|
}
|
|
265
1001
|
}, [view.plan?.id, props.sessionId]);
|
|
266
|
-
(0,
|
|
1002
|
+
(0, import_react13.useEffect)(() => {
|
|
267
1003
|
autoOpened.current = false;
|
|
268
1004
|
}, [props.sessionId]);
|
|
269
|
-
(0,
|
|
1005
|
+
(0, import_react13.useEffect)(() => {
|
|
270
1006
|
if (!view.tool?.open) {
|
|
271
1007
|
setMount(null);
|
|
272
1008
|
return;
|
|
@@ -303,8 +1039,17 @@ function apply(ctx) {
|
|
|
303
1039
|
setMount(null);
|
|
304
1040
|
};
|
|
305
1041
|
}, [view.tool?.open, props.sessionId]);
|
|
306
|
-
const
|
|
307
|
-
|
|
1042
|
+
const renderer = (tool, file) => {
|
|
1043
|
+
const Renderer = renderers.get(file?.format) || renderers.get(tool.kind);
|
|
1044
|
+
return Renderer ? /* @__PURE__ */ import_react13.default.createElement(Renderer, { tool, file, sessionId: props.sessionId }) : null;
|
|
1045
|
+
};
|
|
1046
|
+
const expanded = scope.sidebarRight.isExpanded() && (panelVisible || scope.sidebarRight.active()?.kind === "taskflow");
|
|
1047
|
+
const entry = /* @__PURE__ */ import_react13.default.createElement("button", { type: "button", className: "tf-entry", title: expanded ? "收起待办任务清单" : "展开待办任务清单", "aria-label": "待办任务清单", "aria-expanded": expanded, onClick: () => {
|
|
1048
|
+
if (scope.sidebarRight.isExpanded() && (panelVisible || scope.sidebarRight.active()?.kind === "taskflow")) scope.sidebarRight.toggleExpanded();
|
|
1049
|
+
else scope.sidebarRight.openTab("taskflow");
|
|
1050
|
+
refreshEntry((n) => n + 1);
|
|
1051
|
+
} }, /* @__PURE__ */ import_react13.default.createElement(TaskIcon, null), /* @__PURE__ */ import_react13.default.createElement("span", null, "任务"));
|
|
1052
|
+
return /* @__PURE__ */ import_react13.default.createElement(import_react13.default.Fragment, null, /* @__PURE__ */ import_react13.default.createElement("span", { ref: entryAnchor, className: "tf-entry-anchor" }, entryTarget ? (0, import_react_dom4.createPortal)(entry, entryTarget) : entry), view.tool?.open && /* @__PURE__ */ import_react13.default.createElement("span", { className: "tf-mobile-view" }, /* @__PURE__ */ import_react13.default.createElement("button", { "aria-pressed": !showTool, onClick: () => setShowTool(false) }, "看对话"), /* @__PURE__ */ import_react13.default.createElement("button", { "aria-pressed": showTool, onClick: () => setShowTool(true) }, "看工具")), mount && (0, import_react_dom4.createPortal)(/* @__PURE__ */ import_react13.default.createElement(ToolPanel, { key: props.sessionId, sessionId: props.sessionId, mount, tool: view.tool, onClose: () => void api.action(props.sessionId, "close-view", {}), renderer, openers, foreground }), mount));
|
|
308
1053
|
}
|
|
309
1054
|
register("conversation.session.header.utilities", { id: "taskflow", order: -5 }, SessionEntry);
|
|
310
1055
|
});
|