@authinex/dsh-plugin 0.3.9 → 0.3.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/client.js CHANGED
@@ -19,7 +19,7 @@ var __copyProps = (to, from, except, desc) => {
19
19
  };
20
20
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
21
 
22
- // src/client.tsx
22
+ // src/client/client.tsx
23
23
  var client_exports = {};
24
24
  __export(client_exports, {
25
25
  CLIENT_ID: () => CLIENT_ID,
@@ -28,11 +28,96 @@ __export(client_exports, {
28
28
  });
29
29
  module.exports = __toCommonJS(client_exports);
30
30
 
31
- // src/panel.tsx
32
- var import_react3 = require("react");
33
- var import_dsh_client_ui_primitives3 = require("@deepseek-ai/dsh-client-ui-primitives");
31
+ // src/panel/panel.tsx
32
+ var import_react5 = require("react");
33
+ var import_dsh_client_ui_primitives5 = require("@deepseek-ai/dsh-client-ui-primitives");
34
+
35
+ // src/session/endpoint.ts
36
+ function checkEndpoint(raw) {
37
+ const text = String(raw || "").trim();
38
+ if (text === "") return "请填写访问地址";
39
+ let url;
40
+ try {
41
+ url = new URL(text);
42
+ } catch {
43
+ return "地址不合法,需要一个完整的 http(s) 地址";
44
+ }
45
+ if (url.username || url.password) return "地址不能带账号密码";
46
+ if (url.protocol !== "https:" && url.protocol !== "http:") return "只允许 http 或 https";
47
+ if (!url.hostname) return "地址不合法,需要一个完整的 http(s) 地址";
48
+ return "";
49
+ }
50
+
51
+ // src/session/key.ts
52
+ var CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
53
+ function foldChar(ch) {
54
+ if (ch === "O") return "0";
55
+ if (ch === "I" || ch === "L") return "1";
56
+ if (ch === "U") return "V";
57
+ return ch;
58
+ }
59
+ function checksum(body) {
60
+ let total = 0;
61
+ for (const ch of body) total += CROCKFORD.indexOf(ch);
62
+ return CROCKFORD[total % CROCKFORD.length] ?? "";
63
+ }
64
+ function parseKey(raw) {
65
+ if (typeof raw !== "string") return null;
66
+ const chars = [...raw.trim()].filter((ch) => ch !== "-" && !/\s/.test(ch));
67
+ if (chars.length !== 16) return null;
68
+ const prefix = chars.slice(0, 4).join("").toUpperCase();
69
+ if (prefix !== "AUDS") return null;
70
+ const mark = (chars[4] ?? "").toUpperCase();
71
+ const env = mark === "T" ? "test" : mark === "P" ? "prod" : "";
72
+ if (!env) return null;
73
+ const folded = chars.slice(5).map((ch) => foldChar(ch.toUpperCase())).join("");
74
+ if ([...folded].some((ch) => !CROCKFORD.includes(ch))) return null;
75
+ const body = folded.slice(0, -1);
76
+ if (checksum(body) !== folded.at(-1)) return null;
77
+ const grouped = folded.match(/.{1,4}/g)?.join("-") ?? folded;
78
+ return {
79
+ env,
80
+ canonical: `auds-${mark.toLowerCase()}-${grouped}`,
81
+ compact: `AUDS${mark}${folded}`
82
+ };
83
+ }
84
+
85
+ // src/panel/panel-api.ts
86
+ async function api(path, init) {
87
+ const headers = { "x-authinex-ds": "1" };
88
+ const response = await fetch(path, {
89
+ method: init?.method || "GET",
90
+ headers: init?.body === void 0 ? headers : { ...headers, "content-type": "application/json" },
91
+ body: init?.body === void 0 ? void 0 : JSON.stringify(init.body)
92
+ });
93
+ const text = await response.text();
94
+ if (!text) return {};
95
+ try {
96
+ return JSON.parse(text);
97
+ } catch {
98
+ return {};
99
+ }
100
+ }
101
+ function dwell(ms = 450) {
102
+ return new Promise((resolve) => setTimeout(resolve, ms));
103
+ }
104
+ function saveTextFile(name, text) {
105
+ const blob = new Blob([text], { type: "text/markdown;charset=utf-8" });
106
+ const url = URL.createObjectURL(blob);
107
+ const anchor = document.createElement("a");
108
+ anchor.href = url;
109
+ anchor.download = name;
110
+ document.body.appendChild(anchor);
111
+ anchor.click();
112
+ anchor.remove();
113
+ setTimeout(() => URL.revokeObjectURL(url), 0);
114
+ }
115
+
116
+ // src/accounts/panel-accounts.tsx
117
+ var import_react = require("react");
118
+ var import_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
34
119
 
35
- // src/account-wire.ts
120
+ // src/accounts/account-wire.ts
36
121
  function textOf(data, fallback) {
37
122
  const message = typeof data.message === "string" ? data.message.trim() : "";
38
123
  if (message) return message;
@@ -41,7 +126,7 @@ function textOf(data, fallback) {
41
126
  return fallback;
42
127
  }
43
128
 
44
- // src/account-options.ts
129
+ // src/accounts/account-options.ts
45
130
  var CURRENT_PREFIX = "当前值 ";
46
131
  var NAME_KEY = {
47
132
  defaultProjectUuid: "defaultProjectName",
@@ -91,57 +176,7 @@ function onesSelectRows(input) {
91
176
  return { disabled: false, rows: withCurrent(rows, value, types.items, label) };
92
177
  }
93
178
 
94
- // src/endpoint.ts
95
- function checkEndpoint(raw) {
96
- const text = String(raw || "").trim();
97
- if (text === "") return "请填写访问地址";
98
- let url;
99
- try {
100
- url = new URL(text);
101
- } catch {
102
- return "地址不合法,需要一个完整的 http(s) 地址";
103
- }
104
- if (url.username || url.password) return "地址不能带账号密码";
105
- if (url.protocol !== "https:" && url.protocol !== "http:") return "只允许 http 或 https";
106
- if (!url.hostname) return "地址不合法,需要一个完整的 http(s) 地址";
107
- return "";
108
- }
109
-
110
- // src/key.ts
111
- var CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
112
- function foldChar(ch) {
113
- if (ch === "O") return "0";
114
- if (ch === "I" || ch === "L") return "1";
115
- if (ch === "U") return "V";
116
- return ch;
117
- }
118
- function checksum(body) {
119
- let total = 0;
120
- for (const ch of body) total += CROCKFORD.indexOf(ch);
121
- return CROCKFORD[total % CROCKFORD.length] ?? "";
122
- }
123
- function parseKey(raw) {
124
- if (typeof raw !== "string") return null;
125
- const chars = [...raw.trim()].filter((ch) => ch !== "-" && !/\s/.test(ch));
126
- if (chars.length !== 16) return null;
127
- const prefix = chars.slice(0, 4).join("").toUpperCase();
128
- if (prefix !== "AUDS") return null;
129
- const mark = (chars[4] ?? "").toUpperCase();
130
- const env = mark === "T" ? "test" : mark === "P" ? "prod" : "";
131
- if (!env) return null;
132
- const folded = chars.slice(5).map((ch) => foldChar(ch.toUpperCase())).join("");
133
- if ([...folded].some((ch) => !CROCKFORD.includes(ch))) return null;
134
- const body = folded.slice(0, -1);
135
- if (checksum(body) !== folded.at(-1)) return null;
136
- const grouped = folded.match(/.{1,4}/g)?.join("-") ?? folded;
137
- return {
138
- env,
139
- canonical: `auds-${mark.toLowerCase()}-${grouped}`,
140
- compact: `AUDS${mark}${folded}`
141
- };
142
- }
143
-
144
- // src/platform-icon.tsx
179
+ // src/accounts/platform-icon.tsx
145
180
  var import_jsx_runtime = require("react/jsx-runtime");
146
181
  var ONES = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAACc0lEQVR4AcWXA5AcQRSGN0b3xrZt2zZLqX6zio1SbNu2rbJi2/36fLHtZJM+z97c9hymrqumMPq/1v+/tiWl5YTAYoSJUQTwJGF4izJ8QTTRz2Z1oxo2o4yfJ4x7fa9sTDDLhHN5RBEKeMhA2HqA7FpAbcL4UwNR6wGyQUBHAvhFIW4NANVEZcr4J4WwNQA5HME5KCAqRK0DoICrFYLWAWR3YSkC/GeqARAmtinErAMoMjo8C2H4NdUA7A7RVSFkLQBluC51AQBPmxGjjB+RPkEYXjICIA5sKzuT3SlqJRYAFcKfsjmxfsyUaQGNY577pCEFviHyG9xZwhGc2RyACeeTAPpvcBll/BHxBOXX7SbANjHfAV7O6wguoAQwNfwg1qv+oweIuUKyucNzKQAMtqA0JV0giW3mAPic+PC4W7UL7hv0eqN9wNM8FHASAb49jyuskKkIB/we/1/4Vy5efwB79L3HP3ZXUHkzPc7jemW3Q2A5ynCCXzMDXJCwEWk4zheAMpzh9XrTGPbUE1KSAu6iDN+a9gzAG37mLaia0Uf/wQYY1AtDjYoV9SLmb1SL56rB4pmuq5QcAR2S6phybfjPAxDd43wQRAGXZx8cmjP6ed4hLykB/izpADzYL4Ccb2kcCQ49E30VIqoROKEuyVy8OmH8BwUxKx4AiCnJAbBrwm02GQcRxn9RwAtxvVz6QTKG/5mcQvP1AfBFUYHSS7dGktp74FpSInpSXPOQo0EZisRvP1xtS2rzzXUZw9KkTItruKTvfm+6lD6o9qbAXyt6jXZHQA+bVU1mPAGcG3Vi/iHrCQp4TyamXCstpnrTq/7xD0GONPVxu0XiAAAAAElFTkSuQmCC";
147
182
  var H3YUN = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAIKADAAQAAAABAAAAIAAAAACshmLzAAAEdElEQVRYCe1VTW9UZRR+5nbodD46bXFghkJpoUptihGNGDFERZfGjdEt/AIT3YkbFybGnfoLjO7UuNQdooSAsSVYirGlgw6lUNpCp+3MtNN2PnyeO/cO997pzWBrwIUnee/7dd7zPOe85z038M656kKpgi48AtlhYMF4VODyd6OCnUGn4wHHpOoY/xtDP9t1AlI4sQ8Y6AQyOeDiHaBYBpwHt0JEjoRbgGMpoLcdmFgEzk4DtoN1AjJuEG2Q2aD23G5gtbQVyMYzEaIk2mrrk0vu/ToBMRqZAw7EgaGdwJ6IW3G7s/UKMHavhmF7L5t1AposrgHfpoErvIbHyDhoaHX7wkTH3WIt/EvEcIqLgDayVLzA+xf4du/fBpLHIiF/Ah6jDQSkwJxBlaf2xoDYDtvM1vr8BjCdp00PsG2tgYC9If23+oFDvA7nndn7D9LLxjVm/eej/jZ8CQhAz1BN0finJASu1uwl+RIQ4HfX+Yal4UB3DLnRKAJ1yqoccC54xr4EpDe7AlR4WgbUZFx3qaaa0WK9kjITTHplq9m60peemp80ENBhhVzSxt2OViDOpl4JqbUQgVuZqWqSdXqptkYiRRavHBNveR1YYlOvNYkS3MvFRUAKcYKoZPaxICXD98FFImQB1sz5f9dIxgZXP8dIqrzfYMtxbvlnGggqPG00LMAjCfYE7wgBURJRhCvlMtY3SigWSlhYXcPi8gpy+RUsF1aRz6+aRmKxMOLRMNpjEXR2RBEJt9KRIBKxIIyWFjAwKDAqKkIicvkuySzXEjzwTbpaFXAP37zpIeO/nFvBzFwW6cwMfr82hYn0LYxfv4XMzVkU19ZR5YVXqFfRxVMMemEwfAH24VAr+vYn8WT/Xgz078PQwH483pdCalcX4u2s79RThKZYG0ZJJEBDVd1LYaWIsfEbuHz1TwyPTuKXS+OY/GsGJXrfUL6E6nybMqD78wp1gozEEwe78cKzA3j+yCE8M3QAhwf7EA2HaomdXcxXz14Yw/dnhnF++A9M0tNKiaCGQU9S6GJIZ+cXcfsO/yQOkGikDX09/GVSMjfnTAfq+ATu3pNAMtGJ7FIemSnW9koFRpBkGJnjRwfx+mtHceLFpxB46c3T1Yn0NObns7WQWm9LYf3ys/fw8rHD+OLrM/jwk6/4g7CykMZeOf40Pn7/pIn5Afd+Os9yR9Km8F1+dPokTr39Kn6+eBWn3v20fl3gnmzv2t1lXlHwHL03hYvegt1LD3u6E7w/1WNH7nLYzsQ72Js0j2rsSm2aShFAZ2XDJXRQSTk7mzUb03STu7NO2EnmMmBNmDr1Zee4vmgNfG1YuFbMvMce3vx/Av/tCPin54PnSDMbrp+R12zV9ba8u5zffwjuTcd6Mxu+BPTKVCHzhSJGrqRdVVAVcfr2Pfzw4yUTWGNnldTiCMt5d7ILv/426SohbqY8hu43HHzd2wECqfqKzGZvXT8giX5MXml21tb3jYAUBLqJbfvspsD2ZrOztp7RFmpdsCcPuxf232EPoUPcHT9mAAAAAElFTkSuQmCC";
@@ -165,11 +200,7 @@ function PlatformIcon({ id }) {
165
200
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { className: "axds-logo", src, alt: "", width: 16, height: 16 });
166
201
  }
167
202
 
168
- // src/skill-import.tsx
169
- var import_react = require("react");
170
- var import_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
171
-
172
- // src/phrases.ts
203
+ // src/shared/phrases.ts
173
204
  var PHRASES = {
174
205
  unbound: "填写访问地址和密钥完成绑定",
175
206
  binding: "正在验证密钥",
@@ -187,7 +218,7 @@ function phrase(phase) {
187
218
  return PHRASES.unbound;
188
219
  }
189
220
 
190
- // src/tools.ts
221
+ // src/tools/tools.ts
191
222
  var TOOLS = {
192
223
  search_kb: {
193
224
  title: "咨询问题",
@@ -255,23 +286,25 @@ var TOOLS = {
255
286
  ask_assistant: {
256
287
  title: "问智能助手",
257
288
  timeoutMs: 9e4,
258
- description: `把问题交给智能助手,只要同步回答。不要传 deep。
259
- 它是兜底:先试 search_kb / search_code 这些单点工具,更便宜也更快。${DATA_NOT_INSTRUCTION}`,
289
+ description: `把问题交给线上客服 Agent。后台执行,结果自动回到对话,不必调用查任务进度。
290
+ 先试 search_kb / search_code。跨来源仍对不上再用它,并在 brief 写已知依据。不要传 deep。${DATA_NOT_INSTRUCTION}`,
260
291
  parameters: {
261
292
  question: { type: "string", required: true, description: "完整问句" },
262
- version: { type: "string", description: "产品版本,可空" }
293
+ version: { type: "string", description: "产品版本,可空" },
294
+ brief: { type: "string", description: "已知依据、试过的检索、要补的部分。不要贴整段对话" }
263
295
  }
264
296
  },
265
297
  locate_online: {
266
298
  title: "线上源码定位",
267
299
  timeoutMs: 7e4,
268
- description: `按版本读线上源码做只读定位。45 秒内给出结论,或交回进度和 taskId。
300
+ description: `按版本读线上源码做只读定位。后台执行,结果自动回到对话,不必调用查任务进度。
269
301
  结论按「根因 / 文件 / 证据 / 置信度 / 反证 / 过程」分块,引用时保留行号。
270
302
  问「怎么配」「支持不支持」不要用它,用 search_kb 或 product_features。${DATA_NOT_INSTRUCTION}`,
271
303
  parameters: {
272
304
  question: { type: "string", required: true, description: "要定位的现象" },
273
305
  version: { type: "string", description: "产品版本或分支" },
274
- side: { type: "string", description: "frontend 或 backend,可空" }
306
+ side: { type: "string", description: "frontend 或 backend,可空" },
307
+ brief: { type: "string", description: "本机已查到的路径和单号。不要贴整段对话" }
275
308
  }
276
309
  },
277
310
  task_status: {
@@ -304,7 +337,7 @@ var TOOLS = {
304
337
  }
305
338
  };
306
339
 
307
- // src/work-context.ts
340
+ // src/work/work-context.ts
308
341
  var PRODUCT_KINDS = [
309
342
  { id: "yunshu", label: "云枢" },
310
343
  { id: "report", label: "报表" },
@@ -315,6 +348,8 @@ function labelOf(kind) {
315
348
  const found = PRODUCT_KINDS.find((item) => item.id === kind);
316
349
  return found ? found.label : kind;
317
350
  }
351
+ var HOWTO = "用法:/ax-context 云枢 8.7 某客户 要问的问题,或 /ax-context 清空";
352
+ var USAGE = `没看懂。${HOWTO}`;
318
353
  function parseReceiptText(text) {
319
354
  const lines = String(text || "").split("\n").map((line) => line.trim()).filter(Boolean);
320
355
  const first = lines[0] || "";
@@ -333,10 +368,8 @@ function parseReceiptText(text) {
333
368
  return { fields, note: lines.slice(1).join("\n") };
334
369
  }
335
370
 
336
- // src/view.ts
371
+ // src/shared/view.ts
337
372
  var PACKAGE_NAME = "@authinex/dsh-plugin";
338
- var ROW_ID = "authinex-host";
339
- var ROW_KEY = `${PACKAGE_NAME}#${ROW_ID}`;
340
373
  var SKILL_HOT_MIN = 5;
341
374
  function skillUseCount(row) {
342
375
  const n = Number(row.usage?.count);
@@ -558,78 +591,407 @@ function pageCount(total, pageSize = SKILL_PAGE_SIZE) {
558
591
  return Math.max(1, Math.ceil(total / pageSize));
559
592
  }
560
593
 
561
- // src/skill-import.tsx
594
+ // src/accounts/panel-accounts.tsx
562
595
  var import_jsx_runtime2 = require("react/jsx-runtime");
563
- var MAX_CHARS = 2e4;
564
- function SkillImport({
565
- disabled,
566
- onSubmit
567
- }) {
568
- const fileRef = (0, import_react.useRef)(null);
569
- const [open, setOpen] = (0, import_react.useState)(false);
570
- const [name, setName] = (0, import_react.useState)("");
571
- const [kind, setKind] = (0, import_react.useState)("general");
572
- const [markdown, setMarkdown] = (0, import_react.useState)("");
573
- const [localError, setLocalError] = (0, import_react.useState)("");
574
- const pickFile = () => {
575
- fileRef.current?.click();
576
- };
577
- const onFile = (file) => {
578
- if (!file) return;
579
- if (file.size > MAX_CHARS * 4) {
580
- setLocalError("这个文件太大,请控制在两万字以内");
581
- return;
596
+ function tagTone(state) {
597
+ if (state === "ready") return "success";
598
+ if (state === "read_only") return "info";
599
+ if (state === "disabled") return "neutral";
600
+ return "outline";
601
+ }
602
+ function draftOf(account) {
603
+ const draft = { ...account.extras };
604
+ for (const field of account.fields) draft[field.name] = field.value;
605
+ return draft;
606
+ }
607
+ function AccountsCard(props) {
608
+ const { accounts, disabled, busy, run, applyState, notify } = props;
609
+ const [accountsOpen, setAccountsOpen] = (0, import_react.useState)(false);
610
+ const [open, setOpen] = (0, import_react.useState)("");
611
+ const [drafts, setDrafts] = (0, import_react.useState)({});
612
+ const [accountMsg, setAccountMsg] = (0, import_react.useState)({});
613
+ const [onesProjects, setOnesProjects] = (0, import_react.useState)({ items: [], message: "", loaded: false });
614
+ const [onesTypes, setOnesTypes] = (0, import_react.useState)({ items: [], message: "", forProject: "" });
615
+ const [optionsBusy, setOptionsBusy] = (0, import_react.useState)("");
616
+ const projectTicket = (0, import_react.useRef)(0);
617
+ const typeTicket = (0, import_react.useRef)(0);
618
+ const accountsReady = accounts.filter((account) => account.state !== "unconfigured").length;
619
+ const accountsSummary = accounts.length ? `${accountsReady}/${accounts.length} 家已配置` : "读取账号状态中";
620
+ const loadOnesProjects = (0, import_react.useCallback)(async (form) => {
621
+ const ticket = ++projectTicket.current;
622
+ setOnesProjects((prev) => ({ ...prev, message: "" }));
623
+ setOptionsBusy("projects");
624
+ try {
625
+ const body = await api("/authinex-ds/accounts/options", {
626
+ method: "POST",
627
+ body: { provider: "ones", kind: "projects", form }
628
+ });
629
+ if (ticket !== projectTicket.current) return;
630
+ const ok = body.ok === true;
631
+ const items = Array.isArray(body.projects) ? body.projects : [];
632
+ const reason = textOf(body, "");
633
+ setOnesProjects({
634
+ items,
635
+ message: ok ? items.length ? "" : reason || "这个账号下没有可选项目" : reason || "没有拉到项目",
636
+ loaded: true
637
+ });
638
+ } catch {
639
+ if (ticket !== projectTicket.current) return;
640
+ setOnesProjects({ items: [], message: "没有拉到项目", loaded: true });
641
+ } finally {
642
+ if (ticket === projectTicket.current) setOptionsBusy((prev) => prev === "projects" ? "" : prev);
582
643
  }
583
- const reader = new FileReader();
584
- reader.onload = () => {
585
- const text = String(reader.result || "");
586
- if (text.length > MAX_CHARS) {
587
- setLocalError("这篇超过两万字,缩短后再提交");
588
- return;
589
- }
590
- setMarkdown(text);
591
- setLocalError("");
592
- if (!name.trim()) {
593
- const heading = text.split("\n").find((line) => line.startsWith("# "));
594
- if (heading) setName(heading.replace(/^#\s+/, "").trim().slice(0, 200));
595
- }
596
- };
597
- reader.onerror = () => {
598
- setLocalError("没有读到这个文件");
599
- };
600
- reader.readAsText(file);
601
- };
602
- const onForm = (event) => {
603
- event.preventDefault();
604
- const text = markdown.trim();
605
- if (!text) {
606
- setLocalError("先贴上或选择一篇 SKILL.md");
644
+ }, []);
645
+ const loadOnesTypes = (0, import_react.useCallback)(async (project, form) => {
646
+ if (!project) {
647
+ typeTicket.current += 1;
648
+ setOnesTypes({ items: [], message: "", forProject: "" });
649
+ setOptionsBusy((prev) => prev === "types" ? "" : prev);
607
650
  return;
608
651
  }
609
- if (text.length > MAX_CHARS) {
610
- setLocalError("这篇超过两万字,缩短后再提交");
652
+ const ticket = ++typeTicket.current;
653
+ setOnesTypes({ items: [], message: "", forProject: "" });
654
+ setOptionsBusy("types");
655
+ try {
656
+ const body = await api("/authinex-ds/accounts/options", {
657
+ method: "POST",
658
+ body: { provider: "ones", kind: "issueTypes", project, form }
659
+ });
660
+ if (ticket !== typeTicket.current) return;
661
+ const ok = body.ok === true;
662
+ const items = Array.isArray(body.issueTypes) ? body.issueTypes : [];
663
+ const reason = textOf(body, "");
664
+ setOnesTypes({
665
+ items,
666
+ message: ok ? items.length ? "" : reason || "这个项目下没有工单类型" : reason || "没有拉到工单类型",
667
+ forProject: project
668
+ });
669
+ } catch {
670
+ if (ticket !== typeTicket.current) return;
671
+ setOnesTypes({ items: [], message: "没有拉到工单类型", forProject: project });
672
+ } finally {
673
+ if (ticket === typeTicket.current) setOptionsBusy((prev) => prev === "types" ? "" : prev);
674
+ }
675
+ }, []);
676
+ const toggleAccount = (account) => {
677
+ if (open === account.id) {
678
+ setOpen("");
611
679
  return;
612
680
  }
613
- setLocalError("");
614
- void onSubmit({ markdown: text, name: name.trim(), skillKind: kind }).then((ok) => {
615
- if (!ok) return;
616
- setName("");
617
- setKind("general");
618
- setMarkdown("");
619
- setOpen(false);
620
- });
681
+ setOpen(account.id);
682
+ setDrafts((prev) => prev[account.id] ? prev : { ...prev, [account.id]: draftOf(account) });
683
+ if (account.id === "ones") {
684
+ setOnesTypes({ items: [], message: "", forProject: "" });
685
+ const form = drafts.ones || draftOf(account);
686
+ void (async () => {
687
+ await loadOnesProjects(form);
688
+ if (form.defaultProjectUuid) await loadOnesTypes(form.defaultProjectUuid, form);
689
+ })();
690
+ }
621
691
  };
622
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "axds-import", children: [
623
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "axds-actions", children: [
624
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "axds-muted", children: "提交后先待审核,通过后其他用户才能装和使用" }),
625
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives.Button, { size: "sm", variant: "outline", disabled, onClick: () => {
626
- setOpen((value) => !value);
627
- }, children: open ? "收起" : "导入个人技能" })
692
+ const setField = (account, name, value) => {
693
+ setDrafts((prev) => ({
694
+ ...prev,
695
+ [account.id]: { ...prev[account.id] || draftOf(account), [name]: value }
696
+ }));
697
+ };
698
+ const onOnesSelect = (account, name, value) => {
699
+ const base = { ...drafts[account.id] || draftOf(account) };
700
+ if (name === "defaultProjectUuid") {
701
+ const previousId = base.defaultProjectUuid || "";
702
+ const previousName = base.defaultProjectName || "";
703
+ base.defaultProjectUuid = value;
704
+ base.defaultProjectName = pickedName(onesProjects.items, value, previousId, previousName);
705
+ if (value !== previousId) {
706
+ base.defaultIssueTypeId = "";
707
+ base.defaultIssueTypeName = "";
708
+ base.planIssueTypeId = "";
709
+ base.planIssueTypeName = "";
710
+ }
711
+ } else if (name === "defaultIssueTypeId" || name === "planIssueTypeId") {
712
+ const nameKey = name === "planIssueTypeId" ? "planIssueTypeName" : "defaultIssueTypeName";
713
+ const previousId = base[name] || "";
714
+ const previousName = base[nameKey] || "";
715
+ base[name] = value;
716
+ base[nameKey] = pickedName(onesTypes.items, value, previousId, previousName);
717
+ } else {
718
+ base[name] = value;
719
+ }
720
+ setDrafts((prev) => ({ ...prev, [account.id]: base }));
721
+ if (name === "defaultProjectUuid") void loadOnesTypes(value, base);
722
+ };
723
+ const onFetchOnes = (account) => {
724
+ const form = drafts[account.id] || draftOf(account);
725
+ void (async () => {
726
+ await loadOnesProjects(form);
727
+ if ((form.defaultProjectUuid || "").trim()) await loadOnesTypes(form.defaultProjectUuid, form);
728
+ })();
729
+ };
730
+ const onToggleEnabled = (account, next) => {
731
+ void run(`enabled:${account.id}`, async () => {
732
+ const body = await api("/authinex-ds/accounts/enabled", {
733
+ method: "POST",
734
+ body: { provider: account.id, enabled: next }
735
+ });
736
+ if (body.state) applyState(body.state);
737
+ notify(`${account.label}:${String(body.message || (next ? "已启用" : "已停用"))}`);
738
+ });
739
+ };
740
+ const onTest = (account) => {
741
+ const form = drafts[account.id] || draftOf(account);
742
+ setAccountMsg((prev) => ({ ...prev, [account.id]: { text: `${account.label}:正在测试连接…`, tone: "pending" } }));
743
+ void run(`test:${account.id}`, async () => {
744
+ let body;
745
+ try {
746
+ body = await api("/authinex-ds/accounts/test", {
747
+ method: "POST",
748
+ body: { provider: account.id, form }
749
+ });
750
+ } catch {
751
+ const text2 = `${account.label}:没有连上,稍后再试`;
752
+ setAccountMsg((prev) => ({ ...prev, [account.id]: { text: text2, tone: "error" } }));
753
+ notify(text2, "error");
754
+ return;
755
+ }
756
+ const ok = Boolean(body.ok);
757
+ const text = `${account.label}:${String(body.message || (ok ? "连接正常" : "连接失败"))}`;
758
+ setAccountMsg((prev) => ({ ...prev, [account.id]: { text, tone: ok ? "ok" : "error" } }));
759
+ notify(text, ok ? "ok" : "error");
760
+ if (ok && account.id === "ones") {
761
+ await loadOnesProjects(form);
762
+ if ((form.defaultProjectUuid || "").trim()) await loadOnesTypes(form.defaultProjectUuid, form);
763
+ }
764
+ });
765
+ };
766
+ const onSave = (account) => {
767
+ const form = drafts[account.id] || draftOf(account);
768
+ setAccountMsg((prev) => ({ ...prev, [account.id]: { text: `${account.label}:正在保存…`, tone: "pending" } }));
769
+ void run(`save:${account.id}`, async () => {
770
+ let body;
771
+ try {
772
+ body = await api("/authinex-ds/accounts", {
773
+ method: "PATCH",
774
+ body: { provider: account.id, form }
775
+ });
776
+ } catch {
777
+ const text2 = `${account.label}:没有保存`;
778
+ setAccountMsg((prev) => ({ ...prev, [account.id]: { text: text2, tone: "error" } }));
779
+ notify(text2, "error");
780
+ return;
781
+ }
782
+ if (body.state) applyState(body.state);
783
+ const ok = Boolean(body.ok);
784
+ const text = ok ? `${account.label}:已保存,个人设置和 AuthineX 已是这一份` : `${account.label}:${String(body.message || "没有保存")}`;
785
+ setAccountMsg((prev) => ({ ...prev, [account.id]: { text, tone: ok ? "ok" : "error" } }));
786
+ notify(text, ok ? "ok" : "error");
787
+ if (ok) {
788
+ setDrafts((prev) => {
789
+ const next = { ...prev };
790
+ delete next[account.id];
791
+ return next;
792
+ });
793
+ setOpen("");
794
+ }
795
+ });
796
+ };
797
+ if (!props.active) return null;
798
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "axds-card", children: [
799
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
800
+ "button",
801
+ {
802
+ type: "button",
803
+ className: "axds-collapse",
804
+ "aria-expanded": accountsOpen,
805
+ onClick: () => setAccountsOpen((value) => !value),
806
+ children: [
807
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: `axds-caret${accountsOpen ? " on" : ""}`, "aria-hidden": "true" }),
808
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "axds-title", children: "集成账号" }),
809
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "axds-muted", children: accountsSummary }),
810
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "axds-push" }),
811
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "axds-muted", children: "与 AuthineX、运营台个人设置同一份" })
812
+ ]
813
+ }
814
+ ),
815
+ accountsOpen ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "axds-accounts", children: accounts.map((account) => {
816
+ const editing = open === account.id;
817
+ const draft = drafts[account.id] || draftOf(account);
818
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "axds-account", children: [
819
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "axds-account-head", children: [
820
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives.StateDot, { state: accountTone(account.state) }),
821
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(PlatformIcon, { id: account.id }),
822
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "axds-account-name", children: account.label }),
823
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives.Tag, { tone: tagTone(account.state), children: account.status }),
824
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "axds-push" }),
825
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
826
+ import_dsh_client_ui_primitives.Switch,
827
+ {
828
+ checked: account.enabled,
829
+ label: `${account.label} 启用`,
830
+ disabled,
831
+ onChange: (next) => {
832
+ onToggleEnabled(account, next);
833
+ }
834
+ }
835
+ ),
836
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives.Button, { size: "sm", variant: "ghost", disabled, onClick: () => {
837
+ toggleAccount(account);
838
+ }, children: editing ? "收起" : "配置" })
839
+ ] }),
840
+ account.hint ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "axds-notice", children: account.hint }) : null,
841
+ account.username ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("p", { className: "axds-muted", children: [
842
+ account.username,
843
+ account.hasToken ? " · 已有凭据" : ""
844
+ ] }) : null,
845
+ editing ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
846
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "axds-fields", children: account.fields.map((field) => {
847
+ const onesSelect = account.id === "ones" && (field.name === "defaultProjectUuid" || field.name === "defaultIssueTypeId" || field.name === "planIssueTypeId") ? onesSelectRows({
848
+ field,
849
+ draft,
850
+ projects: onesProjects,
851
+ types: onesTypes,
852
+ busy: optionsBusy
853
+ }) : null;
854
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "axds-field", children: [
855
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: field.title }),
856
+ onesSelect ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
857
+ "select",
858
+ {
859
+ className: "axds-select",
860
+ value: draft[field.name] ?? "",
861
+ disabled: disabled || optionsBusy !== "" || onesSelect.disabled,
862
+ onChange: (event) => {
863
+ onOnesSelect(account, field.name, event.target.value);
864
+ },
865
+ children: onesSelect.rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: row.uuid, children: row.name }, `${row.uuid}:${row.name}`))
866
+ }
867
+ ) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
868
+ import_dsh_client_ui_primitives.Input,
869
+ {
870
+ className: "axds-input",
871
+ type: field.type,
872
+ value: draft[field.name] ?? "",
873
+ placeholder: field.placeholder,
874
+ autoComplete: "off",
875
+ spellCheck: false,
876
+ onChange: (event) => {
877
+ setField(account, field.name, event.target.value);
878
+ }
879
+ }
880
+ )
881
+ ] }, field.name);
882
+ }) }),
883
+ account.id === "ones" && onesProjects.message ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("p", { className: "axds-error", children: [
884
+ "项目:",
885
+ onesProjects.message
886
+ ] }) : null,
887
+ account.id === "ones" && onesTypes.message ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("p", { className: "axds-error", children: [
888
+ "工单类型:",
889
+ onesTypes.message
890
+ ] }) : null,
891
+ editing && accountMsg[account.id] ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
892
+ "p",
893
+ {
894
+ className: accountMsg[account.id].tone === "ok" ? "axds-ok" : accountMsg[account.id].tone === "error" ? "axds-error" : "axds-notice",
895
+ role: "status",
896
+ children: accountMsg[account.id].text
897
+ }
898
+ ) : null,
899
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "axds-actions", children: [
900
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "axds-muted", children: "保存前会先做一次连接测试,并写入个人设置" }),
901
+ account.id === "ones" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives.Button, { size: "sm", disabled: disabled || optionsBusy !== "", onClick: () => {
902
+ onFetchOnes(account);
903
+ }, children: optionsBusy ? "获取中" : "获取类型" }) : null,
904
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives.Button, { size: "sm", disabled, onClick: () => {
905
+ onTest(account);
906
+ }, children: busy === `test:${account.id}` ? "测试中" : "测试连接" }),
907
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives.Button, { size: "sm", variant: "primary", disabled, onClick: () => {
908
+ onSave(account);
909
+ }, children: busy === `save:${account.id}` ? "保存中" : "保存" })
910
+ ] })
911
+ ] }) : null
912
+ ] }, account.id);
913
+ }) }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "axds-muted", children: "展开才显示各平台账号和开关;收起不影响查单建单。" })
914
+ ] });
915
+ }
916
+
917
+ // src/skills/panel-skills.tsx
918
+ var import_react3 = require("react");
919
+ var import_dsh_client_ui_primitives3 = require("@deepseek-ai/dsh-client-ui-primitives");
920
+
921
+ // src/skills/skill-import.tsx
922
+ var import_react2 = require("react");
923
+ var import_dsh_client_ui_primitives2 = require("@deepseek-ai/dsh-client-ui-primitives");
924
+ var import_jsx_runtime3 = require("react/jsx-runtime");
925
+ var MAX_CHARS = 2e4;
926
+ function SkillImport({
927
+ disabled,
928
+ onSubmit
929
+ }) {
930
+ const fileRef = (0, import_react2.useRef)(null);
931
+ const [open, setOpen] = (0, import_react2.useState)(false);
932
+ const [name, setName] = (0, import_react2.useState)("");
933
+ const [kind, setKind] = (0, import_react2.useState)("general");
934
+ const [markdown, setMarkdown] = (0, import_react2.useState)("");
935
+ const [localError, setLocalError] = (0, import_react2.useState)("");
936
+ const pickFile = () => {
937
+ fileRef.current?.click();
938
+ };
939
+ const onFile = (file) => {
940
+ if (!file) return;
941
+ if (file.size > MAX_CHARS * 4) {
942
+ setLocalError("这个文件太大,请控制在两万字以内");
943
+ return;
944
+ }
945
+ const reader = new FileReader();
946
+ reader.onload = () => {
947
+ const text = String(reader.result || "");
948
+ if (text.length > MAX_CHARS) {
949
+ setLocalError("这篇超过两万字,缩短后再提交");
950
+ return;
951
+ }
952
+ setMarkdown(text);
953
+ setLocalError("");
954
+ if (!name.trim()) {
955
+ const heading = text.split("\n").find((line) => line.startsWith("# "));
956
+ if (heading) setName(heading.replace(/^#\s+/, "").trim().slice(0, 200));
957
+ }
958
+ };
959
+ reader.onerror = () => {
960
+ setLocalError("没有读到这个文件");
961
+ };
962
+ reader.readAsText(file);
963
+ };
964
+ const onForm = (event) => {
965
+ event.preventDefault();
966
+ const text = markdown.trim();
967
+ if (!text) {
968
+ setLocalError("先贴上或选择一篇 SKILL.md");
969
+ return;
970
+ }
971
+ if (text.length > MAX_CHARS) {
972
+ setLocalError("这篇超过两万字,缩短后再提交");
973
+ return;
974
+ }
975
+ setLocalError("");
976
+ void onSubmit({ markdown: text, name: name.trim(), skillKind: kind }).then((ok) => {
977
+ if (!ok) return;
978
+ setName("");
979
+ setKind("general");
980
+ setMarkdown("");
981
+ setOpen(false);
982
+ });
983
+ };
984
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "axds-import", children: [
985
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "axds-actions", children: [
986
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "axds-muted", children: "提交后先待审核,通过后其他用户才能装和使用" }),
987
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives2.Button, { size: "sm", variant: "outline", disabled, onClick: () => {
988
+ setOpen((value) => !value);
989
+ }, children: open ? "收起" : "导入个人技能" })
628
990
  ] }),
629
- open ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("form", { className: "axds-import-form", onSubmit: onForm, children: [
630
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "axds-field", children: [
631
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "技能名(可空,空则用正文标题)" }),
632
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
991
+ open ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("form", { className: "axds-import-form", onSubmit: onForm, children: [
992
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "axds-field", children: [
993
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: "技能名(可空,空则用正文标题)" }),
994
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
633
995
  "input",
634
996
  {
635
997
  className: "axds-plain",
@@ -644,9 +1006,9 @@ function SkillImport({
644
1006
  }
645
1007
  )
646
1008
  ] }),
647
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "axds-field", children: [
648
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "用途" }),
649
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1009
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "axds-field", children: [
1010
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: "用途" }),
1011
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
650
1012
  "select",
651
1013
  {
652
1014
  className: "axds-select",
@@ -655,13 +1017,13 @@ function SkillImport({
655
1017
  onChange: (event) => {
656
1018
  setKind(event.target.value);
657
1019
  },
658
- children: Object.entries(SKILL_KINDS).map(([value, label]) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value, children: label }, value))
1020
+ children: Object.entries(SKILL_KINDS).map(([value, label]) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value, children: label }, value))
659
1021
  }
660
1022
  )
661
1023
  ] }),
662
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "axds-field", children: [
663
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "SKILL.md" }),
664
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1024
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "axds-field", children: [
1025
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: "SKILL.md" }),
1026
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
665
1027
  "textarea",
666
1028
  {
667
1029
  className: "axds-textarea",
@@ -676,7 +1038,7 @@ function SkillImport({
676
1038
  }
677
1039
  )
678
1040
  ] }),
679
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1041
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
680
1042
  "input",
681
1043
  {
682
1044
  ref: fileRef,
@@ -689,39 +1051,300 @@ function SkillImport({
689
1051
  }
690
1052
  }
691
1053
  ),
692
- localError ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "axds-error", role: "status", children: localError }) : null,
693
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "axds-actions", children: [
694
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives.Button, { size: "sm", variant: "ghost", type: "button", disabled, onClick: pickFile, children: "选择文件" }),
695
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives.Button, { size: "sm", variant: "primary", type: "submit", disabled, children: "提交审核" })
1054
+ localError ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "axds-error", role: "status", children: localError }) : null,
1055
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "axds-actions", children: [
1056
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives2.Button, { size: "sm", variant: "ghost", type: "button", disabled, onClick: pickFile, children: "选择文件" }),
1057
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives2.Button, { size: "sm", variant: "primary", type: "submit", disabled, children: "提交审核" })
696
1058
  ] })
697
1059
  ] }) : null
698
1060
  ] });
699
1061
  }
700
1062
 
701
- // src/work-context-card.tsx
702
- var import_react2 = require("react");
703
- var import_dsh_client_ui_primitives2 = require("@deepseek-ai/dsh-client-ui-primitives");
704
- var import_jsx_runtime3 = require("react/jsx-runtime");
1063
+ // src/skills/panel-skills.tsx
1064
+ var import_jsx_runtime4 = require("react/jsx-runtime");
1065
+ var EMPTY = {
1066
+ items: [],
1067
+ total: 0,
1068
+ page: 1,
1069
+ pageSize: SKILL_PAGE_SIZE,
1070
+ q: "",
1071
+ status: "",
1072
+ message: "",
1073
+ loaded: false
1074
+ };
1075
+ function SkillsTab(props) {
1076
+ const [view, setView] = (0, import_react3.useState)(EMPTY);
1077
+ const [draftQ, setDraftQ] = (0, import_react3.useState)("");
1078
+ const [open, setOpen] = (0, import_react3.useState)(0);
1079
+ const [busy, setBusy] = (0, import_react3.useState)("");
1080
+ const [notice, setNotice] = (0, import_react3.useState)("");
1081
+ const [feedback, setFeedback] = (0, import_react3.useState)("");
1082
+ const load = (0, import_react3.useCallback)(async (page = 1, q = "", status = "approved") => {
1083
+ setBusy("list");
1084
+ setFeedback("");
1085
+ setNotice("");
1086
+ try {
1087
+ const [body] = await Promise.all([
1088
+ api("/authinex-ds/skills", { method: "POST", body: { q, page, pageSize: SKILL_PAGE_SIZE, status } }),
1089
+ dwell(300)
1090
+ ]);
1091
+ const items = Array.isArray(body.items) ? body.items : [];
1092
+ setView({
1093
+ items,
1094
+ total: Number(body.total || 0),
1095
+ page: Number(body.page || page),
1096
+ pageSize: Number(body.pageSize || SKILL_PAGE_SIZE),
1097
+ q: String(body.q || q),
1098
+ status: String(body.status || status),
1099
+ message: String(body.message || ""),
1100
+ loaded: true
1101
+ });
1102
+ setOpen(0);
1103
+ if (body.message) setFeedback("warn");
1104
+ } catch {
1105
+ setView((prev) => ({ ...prev, message: "没有取到技能列表", loaded: true }));
1106
+ setFeedback("error");
1107
+ } finally {
1108
+ setBusy("");
1109
+ }
1110
+ }, []);
1111
+ (0, import_react3.useEffect)(() => {
1112
+ if (!props.active || view.loaded || !props.userReady) return;
1113
+ void load(1, view.q, view.status);
1114
+ }, [props.active, props.userReady, view.loaded, view.q, view.status, load]);
1115
+ const viewRef = (0, import_react3.useRef)(view);
1116
+ viewRef.current = view;
1117
+ (0, import_react3.useEffect)(() => {
1118
+ if (props.refreshKey === 0 || !viewRef.current.loaded) return;
1119
+ const current = viewRef.current;
1120
+ void load(current.page, current.q, current.status);
1121
+ }, [props.refreshKey, load]);
1122
+ if (!props.active) return null;
1123
+ const pending = busy === "list" ? "正在取技能列表…" : "";
1124
+ const pages = pageCount(view.total, view.pageSize);
1125
+ const onImport = async (input) => {
1126
+ setBusy("import");
1127
+ setNotice("");
1128
+ setFeedback("");
1129
+ try {
1130
+ const body = await api("/authinex-ds/skills/import", { method: "POST", body: input });
1131
+ if (!body.ok) {
1132
+ setFeedback("error");
1133
+ setNotice(String(body.message || "没有提交成功"));
1134
+ return false;
1135
+ }
1136
+ await load(1, "", "candidate");
1137
+ setFeedback("ok");
1138
+ setNotice(String(body.message || "已提交审核,通过后其他用户才能使用"));
1139
+ return true;
1140
+ } catch {
1141
+ setFeedback("error");
1142
+ setNotice("没有提交成功");
1143
+ return false;
1144
+ } finally {
1145
+ setBusy("");
1146
+ }
1147
+ };
1148
+ const download = (row) => {
1149
+ setBusy(`download:${row.id}`);
1150
+ setNotice("");
1151
+ void (async () => {
1152
+ try {
1153
+ const body = await api("/authinex-ds/skills/export", { method: "POST", body: { id: row.id } });
1154
+ if (!body.ok) {
1155
+ setNotice(String(body.message || "没有取到这篇技能"));
1156
+ setFeedback("error");
1157
+ return;
1158
+ }
1159
+ const slug = String(body.slug || skillSlug(row.id));
1160
+ saveTextFile(`${slug}-SKILL.md`, String(body.markdown || ""));
1161
+ setNotice(`已下载 ${slug}-SKILL.md`);
1162
+ setFeedback("ok");
1163
+ } catch {
1164
+ setNotice("没有取到这篇技能");
1165
+ setFeedback("error");
1166
+ } finally {
1167
+ setBusy("");
1168
+ }
1169
+ })();
1170
+ };
1171
+ const install2 = (row) => {
1172
+ setBusy(`install:${row.id}`);
1173
+ setNotice("");
1174
+ void (async () => {
1175
+ try {
1176
+ const body = await api("/authinex-ds/skills/install", { method: "POST", body: { id: row.id } });
1177
+ if (body.state) props.applyState(body.state);
1178
+ setNotice(String(body.message || (body.ok ? "已装到本机" : "没有装上")));
1179
+ setFeedback(body.ok ? "ok" : "error");
1180
+ } catch {
1181
+ setNotice("没有装上");
1182
+ setFeedback("error");
1183
+ } finally {
1184
+ setBusy("");
1185
+ }
1186
+ })();
1187
+ };
1188
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-card", children: [
1189
+ props.userReady && props.skillsOnline ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "axds-muted", children: "技能已由插件在线提供,无需安装" }) : null,
1190
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-between", children: [
1191
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-title", children: "技能" }),
1192
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-muted", children: view.loaded ? `共 ${view.total} 个 · 按使用频次从高到低 · 本机已装 ${props.installed.length} 个` : "来自 AgentHub 技能库,按使用频次从高到低" })
1193
+ ] }),
1194
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SkillImport, { disabled: props.disabled || busy !== "", onSubmit: onImport }),
1195
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("form", { className: "axds-skill-search", onSubmit: (event) => {
1196
+ event.preventDefault();
1197
+ void load(1, draftQ.trim(), view.status);
1198
+ }, children: [
1199
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1200
+ import_dsh_client_ui_primitives3.Input,
1201
+ {
1202
+ className: "axds-input",
1203
+ value: draftQ,
1204
+ placeholder: "搜技能名、适用场景,或填编号(2470 / skill-2470)",
1205
+ autoComplete: "off",
1206
+ spellCheck: false,
1207
+ onChange: (event) => {
1208
+ setDraftQ(event.target.value);
1209
+ }
1210
+ }
1211
+ ),
1212
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { size: "sm", variant: "primary", type: "submit", disabled: busy !== "", children: "检索" }),
1213
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { size: "sm", variant: "ghost", type: "button", disabled: busy !== "", onClick: () => {
1214
+ setDraftQ("");
1215
+ void load(1, "", view.status);
1216
+ }, children: "清空" })
1217
+ ] }),
1218
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "axds-skill-filter", role: "group", "aria-label": "技能状态", children: SKILL_FILTERS.map((option) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1219
+ "button",
1220
+ {
1221
+ type: "button",
1222
+ className: `axds-chip${view.status === option.value ? " on" : ""}`,
1223
+ "aria-pressed": view.status === option.value,
1224
+ disabled: busy !== "",
1225
+ onClick: () => {
1226
+ void load(1, draftQ.trim(), option.value);
1227
+ },
1228
+ children: option.label
1229
+ },
1230
+ option.value || "all"
1231
+ )) }),
1232
+ pending ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { className: "axds-pending", role: "status", children: [
1233
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-spin", "aria-hidden": "true" }),
1234
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: pending })
1235
+ ] }) : null,
1236
+ notice ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: feedback === "ok" ? "axds-ok" : feedback === "error" ? "axds-error" : "axds-notice", role: "status", children: notice }) : null,
1237
+ !pending && view.message ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: view.items.length ? "axds-notice" : "axds-muted", role: "status", children: view.message }) : null,
1238
+ view.loaded && view.items.length === 0 && !pending ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "axds-muted", children: view.q ? `没有搜到「${view.q}」` : "这个状态下还没有技能" }) : null,
1239
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "axds-skills", children: view.items.map((row) => {
1240
+ const expanded = open === row.id;
1241
+ const done = skillInstalled(row, props.installed);
1242
+ const status = row.status || "approved";
1243
+ const hot = skillIsHot(row);
1244
+ const uses = skillUseText(row);
1245
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: `axds-skill${expanded ? " on" : ""}${hot ? " hot" : ""}`, children: [
1246
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("button", { type: "button", className: "axds-skill-head", "aria-expanded": expanded, onClick: () => setOpen((prev) => prev === row.id ? 0 : row.id), children: [
1247
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: `axds-caret${expanded ? " on" : ""}`, "aria-hidden": "true" }),
1248
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-skill-name", children: row.name || skillSlug(row.id) }),
1249
+ hot ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { title: `召回满 ${SKILL_HOT_MIN} 次,属于高频技能`, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Tag, { tone: "warning", children: "高频" }) }) : null,
1250
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-push" }),
1251
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: `axds-skill-uses${hot ? " hot" : uses === "未使用" ? " idle" : ""}`, children: uses }),
1252
+ done ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Tag, { tone: "success", children: "已装" }) : null,
1253
+ skillUploaderText(row) ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Tag, { tone: "info", children: skillUploaderText(row) }) : null,
1254
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Tag, { tone: "quiet", children: skillKindText(row.skillKind) }),
1255
+ status !== "approved" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Tag, { tone: skillStatusTone(status) === "success" ? "success" : "warning", children: SKILL_STATUS[status] || status }) : null
1256
+ ] }),
1257
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "axds-skill-desc", children: row.triggerDesc || "没有写适用场景" }),
1258
+ expanded ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-skill-body", children: [
1259
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("dl", { className: "axds-kv", children: [
1260
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
1261
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dt", { children: "编号" }),
1262
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dd", { children: skillSlug(row.id) })
1263
+ ] }),
1264
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
1265
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dt", { children: "使用频次" }),
1266
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dd", { children: uses })
1267
+ ] }),
1268
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
1269
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dt", { children: "适用范围" }),
1270
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dd", { children: skillScopeText(row) })
1271
+ ] }),
1272
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-kv-when", children: [
1273
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dt", { children: "更新时间" }),
1274
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dd", { children: formatUpdatedAt(row.updatedAt) })
1275
+ ] }),
1276
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
1277
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dt", { children: "来源" }),
1278
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dd", { children: row.sourceKind || "—" })
1279
+ ] })
1280
+ ] }),
1281
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-actions", children: [
1282
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { size: "sm", variant: "ghost", disabled: busy !== "", onClick: () => {
1283
+ download(row);
1284
+ }, children: busy === `download:${row.id}` ? "下载中…" : "下载 SKILL.md" }),
1285
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1286
+ import_dsh_client_ui_primitives3.Button,
1287
+ {
1288
+ size: "sm",
1289
+ variant: "primary",
1290
+ disabled: busy !== "" || status !== "approved",
1291
+ title: status === "approved" ? "" : "审核通过后才能装到本机",
1292
+ onClick: () => {
1293
+ install2(row);
1294
+ },
1295
+ children: busy === `install:${row.id}` ? "安装中…" : done ? "重新安装" : "装到本机"
1296
+ }
1297
+ )
1298
+ ] })
1299
+ ] }) : null
1300
+ ] }, row.id);
1301
+ }) }),
1302
+ view.total > 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-pager", children: [
1303
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "axds-muted", children: [
1304
+ "第 ",
1305
+ view.page,
1306
+ " / ",
1307
+ pages,
1308
+ " 页 · 共 ",
1309
+ view.total,
1310
+ " 个"
1311
+ ] }),
1312
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-push" }),
1313
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { size: "sm", variant: "outline", disabled: busy !== "" || view.page <= 1, onClick: () => {
1314
+ void load(view.page - 1, view.q, view.status);
1315
+ }, children: "上一页" }),
1316
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { size: "sm", variant: "outline", disabled: busy !== "" || view.page >= pages, onClick: () => {
1317
+ void load(view.page + 1, view.q, view.status);
1318
+ }, children: "下一页" })
1319
+ ] }) : null,
1320
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "axds-muted", children: "装到本机技能目录 ~/.dsh/skills/<编号>/SKILL.md,只写这个目录、不动工作区;新会话才会读到。" })
1321
+ ] });
1322
+ }
1323
+
1324
+ // src/work/work-context-card.tsx
1325
+ var import_react4 = require("react");
1326
+ var import_dsh_client_ui_primitives4 = require("@deepseek-ai/dsh-client-ui-primitives");
1327
+ var import_jsx_runtime5 = require("react/jsx-runtime");
705
1328
  function WorkContextCard(props) {
706
- const [productKind, setProductKind] = (0, import_react2.useState)(props.value.productKind);
707
- const [version, setVersion] = (0, import_react2.useState)(props.value.version);
708
- const [customer, setCustomer] = (0, import_react2.useState)(props.value.customer);
709
- (0, import_react2.useEffect)(() => {
1329
+ const [productKind, setProductKind] = (0, import_react4.useState)(props.value.productKind);
1330
+ const [version, setVersion] = (0, import_react4.useState)(props.value.version);
1331
+ const [customer, setCustomer] = (0, import_react4.useState)(props.value.customer);
1332
+ (0, import_react4.useEffect)(() => {
710
1333
  setProductKind(props.value.productKind);
711
1334
  setVersion(props.value.version);
712
1335
  setCustomer(props.value.customer);
713
1336
  }, [props.value.productKind, props.value.version, props.value.customer]);
714
1337
  const shownKind = labelOf(productKind);
715
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "axds-card", children: [
716
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "axds-between", children: [
717
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "axds-title", children: "工作上下文" }),
718
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "axds-muted", children: "没填的版本和产品线,调用工具时补上" })
1338
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "axds-card", children: [
1339
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "axds-between", children: [
1340
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "axds-title", children: "工作上下文" }),
1341
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "axds-muted", children: "没填的版本和产品线,调用工具时补上" })
719
1342
  ] }),
720
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "axds-fields", children: [
721
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "axds-field", children: [
722
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: "产品线" }),
723
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
724
- import_dsh_client_ui_primitives2.Input,
1343
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "axds-fields", children: [
1344
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "axds-field", children: [
1345
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "产品线" }),
1346
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1347
+ import_dsh_client_ui_primitives4.Input,
725
1348
  {
726
1349
  className: "axds-input",
727
1350
  value: shownKind,
@@ -734,10 +1357,10 @@ function WorkContextCard(props) {
734
1357
  }
735
1358
  )
736
1359
  ] }),
737
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "axds-field", children: [
738
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: "版本" }),
739
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
740
- import_dsh_client_ui_primitives2.Input,
1360
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "axds-field", children: [
1361
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "版本" }),
1362
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1363
+ import_dsh_client_ui_primitives4.Input,
741
1364
  {
742
1365
  className: "axds-input",
743
1366
  value: version,
@@ -751,10 +1374,10 @@ function WorkContextCard(props) {
751
1374
  }
752
1375
  )
753
1376
  ] }),
754
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "axds-field", children: [
755
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: "客户" }),
756
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
757
- import_dsh_client_ui_primitives2.Input,
1377
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "axds-field", children: [
1378
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "客户" }),
1379
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1380
+ import_dsh_client_ui_primitives4.Input,
758
1381
  {
759
1382
  className: "axds-input",
760
1383
  value: customer,
@@ -769,11 +1392,11 @@ function WorkContextCard(props) {
769
1392
  )
770
1393
  ] })
771
1394
  ] }),
772
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "axds-actions", children: [
773
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "axds-muted", children: "也可以在对话里用 /ax-context 云枢 8.7 某客户 要问的问题" }),
774
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives2.Button, { size: "sm", variant: "ghost", disabled: props.disabled, onClick: props.onClear, children: "清空" }),
775
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
776
- import_dsh_client_ui_primitives2.Button,
1395
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "axds-actions", children: [
1396
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "axds-muted", children: "也可以在对话里用 /ax-context 云枢 8.7 某客户 要问的问题" }),
1397
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dsh_client_ui_primitives4.Button, { size: "sm", variant: "ghost", disabled: props.disabled, onClick: props.onClear, children: "清空" }),
1398
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1399
+ import_dsh_client_ui_primitives4.Button,
777
1400
  {
778
1401
  size: "sm",
779
1402
  variant: "primary",
@@ -788,91 +1411,27 @@ function WorkContextCard(props) {
788
1411
  ] });
789
1412
  }
790
1413
 
791
- // src/panel.tsx
792
- var import_jsx_runtime4 = require("react/jsx-runtime");
793
- var HEADERS = { "x-authinex-ds": "1" };
794
- async function api(path, init) {
795
- const response = await fetch(path, {
796
- method: init?.method || "GET",
797
- headers: init?.body === void 0 ? HEADERS : { ...HEADERS, "content-type": "application/json" },
798
- body: init?.body === void 0 ? void 0 : JSON.stringify(init.body)
799
- });
800
- const text = await response.text();
801
- if (!text) return {};
802
- try {
803
- return JSON.parse(text);
804
- } catch {
805
- return {};
806
- }
807
- }
808
- function dwell(ms = 450) {
809
- return new Promise((resolve) => setTimeout(resolve, ms));
810
- }
811
- function tagTone(state) {
812
- if (state === "ready") return "success";
813
- if (state === "read_only") return "info";
814
- if (state === "disabled") return "neutral";
815
- return "outline";
816
- }
817
- function draftOf(account) {
818
- const draft = { ...account.extras };
819
- for (const field of account.fields) draft[field.name] = field.value;
820
- return draft;
821
- }
822
- function saveTextFile(name, text) {
823
- const blob = new Blob([text], { type: "text/markdown;charset=utf-8" });
824
- const url = URL.createObjectURL(blob);
825
- const anchor = document.createElement("a");
826
- anchor.href = url;
827
- anchor.download = name;
828
- document.body.appendChild(anchor);
829
- anchor.click();
830
- anchor.remove();
831
- setTimeout(() => URL.revokeObjectURL(url), 0);
832
- }
833
- var SKILL_EMPTY = {
834
- items: [],
835
- total: 0,
836
- page: 1,
837
- pageSize: SKILL_PAGE_SIZE,
838
- q: "",
839
- status: "approved",
840
- message: "",
841
- loaded: false
842
- };
1414
+ // src/panel/panel.tsx
1415
+ var import_jsx_runtime6 = require("react/jsx-runtime");
843
1416
  function AuthinexPanel() {
844
- const [state, setState] = (0, import_react3.useState)(null);
845
- const [loaded, setLoaded] = (0, import_react3.useState)(false);
846
- const [busy, setBusy] = (0, import_react3.useState)("");
847
- const [notice, setNotice] = (0, import_react3.useState)("");
848
- const [localError, setLocalError] = (0, import_react3.useState)("");
849
- const [endpoint, setEndpoint] = (0, import_react3.useState)("");
850
- const [key, setKey] = (0, import_react3.useState)("");
851
- const [open, setOpen] = (0, import_react3.useState)("");
852
- const [drafts, setDrafts] = (0, import_react3.useState)({});
853
- const [confirmUnbind, setConfirmUnbind] = (0, import_react3.useState)(false);
854
- const [confirmUpdate, setConfirmUpdate] = (0, import_react3.useState)(false);
855
- const [restart, setRestart] = (0, import_react3.useState)(false);
856
- const [feedback, setFeedback] = (0, import_react3.useState)("");
857
- const [tab, setTab] = (0, import_react3.useState)("overview");
858
- const [accountsOpen, setAccountsOpen] = (0, import_react3.useState)(false);
859
- const [skillView, setSkillView] = (0, import_react3.useState)(SKILL_EMPTY);
860
- const [skillDraftQ, setSkillDraftQ] = (0, import_react3.useState)("");
861
- const [skillOpen, setSkillOpen] = (0, import_react3.useState)(0);
862
- const [skillBusy, setSkillBusy] = (0, import_react3.useState)("");
863
- const [skillNotice, setSkillNotice] = (0, import_react3.useState)("");
864
- const [skillFeedback, setSkillFeedback] = (0, import_react3.useState)("");
865
- const [accountMsg, setAccountMsg] = (0, import_react3.useState)({});
866
- const [onesProjects, setOnesProjects] = (0, import_react3.useState)({ items: [], message: "", loaded: false });
867
- const [onesTypes, setOnesTypes] = (0, import_react3.useState)({ items: [], message: "", forProject: "" });
868
- const [optionsBusy, setOptionsBusy] = (0, import_react3.useState)("");
869
- const projectTicket = (0, import_react3.useRef)(0);
870
- const typeTicket = (0, import_react3.useRef)(0);
871
- const model = (0, import_react3.useMemo)(() => viewModel(state || void 0), [state]);
872
- const applyState = (0, import_react3.useCallback)((next) => {
1417
+ const [state, setState] = (0, import_react5.useState)(null);
1418
+ const [loaded, setLoaded] = (0, import_react5.useState)(false);
1419
+ const [busy, setBusy] = (0, import_react5.useState)("");
1420
+ const [notice, setNotice] = (0, import_react5.useState)("");
1421
+ const [localError, setLocalError] = (0, import_react5.useState)("");
1422
+ const [endpoint, setEndpoint] = (0, import_react5.useState)("");
1423
+ const [key, setKey] = (0, import_react5.useState)("");
1424
+ const [confirmUnbind, setConfirmUnbind] = (0, import_react5.useState)(false);
1425
+ const [confirmUpdate, setConfirmUpdate] = (0, import_react5.useState)(false);
1426
+ const [restart, setRestart] = (0, import_react5.useState)(false);
1427
+ const [feedback, setFeedback] = (0, import_react5.useState)("");
1428
+ const [tab, setTab] = (0, import_react5.useState)("overview");
1429
+ const [skillRefresh, setSkillRefresh] = (0, import_react5.useState)(0);
1430
+ const model = (0, import_react5.useMemo)(() => viewModel(state || void 0), [state]);
1431
+ const applyState = (0, import_react5.useCallback)((next) => {
873
1432
  setState(next);
874
1433
  }, []);
875
- const read = (0, import_react3.useCallback)(async () => {
1434
+ const read = (0, import_react5.useCallback)(async () => {
876
1435
  try {
877
1436
  applyState(await api("/authinex-ds/state"));
878
1437
  return true;
@@ -882,85 +1441,33 @@ function AuthinexPanel() {
882
1441
  } finally {
883
1442
  setLoaded(true);
884
1443
  }
885
- }, [applyState]);
886
- (0, import_react3.useEffect)(() => {
887
- void read();
888
- }, [read]);
889
- (0, import_react3.useEffect)(() => {
890
- if (model.endpoint) setEndpoint((prev) => prev || model.endpoint);
891
- }, [model.endpoint]);
892
- const run = (0, import_react3.useCallback)(async (label, work) => {
893
- setBusy(label);
894
- setNotice("");
895
- setLocalError("");
896
- setFeedback("");
897
- try {
898
- await work();
899
- } catch {
900
- setState({ phase: "unreachable" });
901
- if (label === "refresh") setNotice("没有刷新到");
902
- if (label === "update") setNotice("没有查到更新");
903
- if (label === "refresh" || label === "update") setFeedback("error");
904
- } finally {
905
- setBusy("");
906
- }
907
- }, []);
908
- const loadOnesProjects = (0, import_react3.useCallback)(async (form) => {
909
- const ticket = ++projectTicket.current;
910
- setOnesProjects((prev) => ({ ...prev, message: "" }));
911
- setOptionsBusy("projects");
912
- try {
913
- const body = await api("/authinex-ds/accounts/options", {
914
- method: "POST",
915
- body: { provider: "ones", kind: "projects", form }
916
- });
917
- if (ticket !== projectTicket.current) return;
918
- const ok = body.ok === true;
919
- const items = Array.isArray(body.projects) ? body.projects : [];
920
- const reason = textOf(body, "");
921
- setOnesProjects({
922
- items,
923
- message: ok ? items.length ? "" : reason || "这个账号下没有可选项目" : reason || "没有拉到项目",
924
- loaded: true
925
- });
926
- } catch {
927
- if (ticket !== projectTicket.current) return;
928
- setOnesProjects({ items: [], message: "没有拉到项目", loaded: true });
929
- } finally {
930
- if (ticket === projectTicket.current) setOptionsBusy((prev) => prev === "projects" ? "" : prev);
931
- }
932
- }, []);
933
- const loadOnesTypes = (0, import_react3.useCallback)(async (project, form) => {
934
- if (!project) {
935
- typeTicket.current += 1;
936
- setOnesTypes({ items: [], message: "", forProject: "" });
937
- setOptionsBusy((prev) => prev === "types" ? "" : prev);
938
- return;
939
- }
940
- const ticket = ++typeTicket.current;
941
- setOnesTypes({ items: [], message: "", forProject: "" });
942
- setOptionsBusy("types");
1444
+ }, [applyState]);
1445
+ (0, import_react5.useEffect)(() => {
1446
+ void read();
1447
+ }, [read]);
1448
+ (0, import_react5.useEffect)(() => {
1449
+ if (model.endpoint) setEndpoint((prev) => prev || model.endpoint);
1450
+ }, [model.endpoint]);
1451
+ const run = (0, import_react5.useCallback)(async (label, work) => {
1452
+ setBusy(label);
1453
+ setNotice("");
1454
+ setLocalError("");
1455
+ setFeedback("");
943
1456
  try {
944
- const body = await api("/authinex-ds/accounts/options", {
945
- method: "POST",
946
- body: { provider: "ones", kind: "issueTypes", project, form }
947
- });
948
- if (ticket !== typeTicket.current) return;
949
- const ok = body.ok === true;
950
- const items = Array.isArray(body.issueTypes) ? body.issueTypes : [];
951
- const reason = textOf(body, "");
952
- setOnesTypes({
953
- items,
954
- message: ok ? items.length ? "" : reason || "这个项目下没有工单类型" : reason || "没有拉到工单类型",
955
- forProject: project
956
- });
1457
+ await work();
957
1458
  } catch {
958
- if (ticket !== typeTicket.current) return;
959
- setOnesTypes({ items: [], message: "没有拉到工单类型", forProject: project });
1459
+ setState({ phase: "unreachable" });
1460
+ if (label === "refresh") setNotice("没有刷新到");
1461
+ if (label === "update") setNotice("没有查到更新");
1462
+ if (label === "refresh" || label === "update") setFeedback("error");
960
1463
  } finally {
961
- if (ticket === typeTicket.current) setOptionsBusy((prev) => prev === "types" ? "" : prev);
1464
+ setBusy("");
962
1465
  }
963
1466
  }, []);
1467
+ const notify = (0, import_react5.useCallback)((text, tone) => {
1468
+ setNotice(text);
1469
+ if (tone) setFeedback(tone);
1470
+ }, []);
964
1471
  const onBind = (event) => {
965
1472
  event.preventDefault();
966
1473
  const url = endpoint.trim();
@@ -1005,170 +1512,10 @@ function AuthinexPanel() {
1005
1512
  void run("unbind", async () => {
1006
1513
  const body = await api("/authinex-ds/unbind", { method: "POST" });
1007
1514
  applyState(body);
1008
- setOpen("");
1009
- setDrafts({});
1010
1515
  setEndpoint("");
1011
- setSkillView(SKILL_EMPTY);
1012
- setAccountMsg({});
1013
- setOnesProjects({ items: [], message: "", loaded: false });
1014
- setOnesTypes({ items: [], message: "", forProject: "" });
1015
1516
  setNotice("已解除绑定,地址和密钥都清掉了");
1016
1517
  });
1017
1518
  };
1018
- const toggleAccount = (account) => {
1019
- if (open === account.id) {
1020
- setOpen("");
1021
- return;
1022
- }
1023
- setOpen(account.id);
1024
- setDrafts((prev) => prev[account.id] ? prev : { ...prev, [account.id]: draftOf(account) });
1025
- if (account.id === "ones") {
1026
- setOnesTypes({ items: [], message: "", forProject: "" });
1027
- const form = drafts.ones || draftOf(account);
1028
- void (async () => {
1029
- await loadOnesProjects(form);
1030
- if (form.defaultProjectUuid) await loadOnesTypes(form.defaultProjectUuid, form);
1031
- })();
1032
- }
1033
- };
1034
- const setField = (account, name, value) => {
1035
- setDrafts((prev) => ({
1036
- ...prev,
1037
- [account.id]: { ...prev[account.id] || draftOf(account), [name]: value }
1038
- }));
1039
- };
1040
- const onOnesSelect = (account, name, value) => {
1041
- const base = { ...drafts[account.id] || draftOf(account) };
1042
- if (name === "defaultProjectUuid") {
1043
- const previousId = base.defaultProjectUuid || "";
1044
- const previousName = base.defaultProjectName || "";
1045
- base.defaultProjectUuid = value;
1046
- base.defaultProjectName = pickedName(onesProjects.items, value, previousId, previousName);
1047
- if (value !== previousId) {
1048
- base.defaultIssueTypeId = "";
1049
- base.defaultIssueTypeName = "";
1050
- base.planIssueTypeId = "";
1051
- base.planIssueTypeName = "";
1052
- }
1053
- } else if (name === "defaultIssueTypeId" || name === "planIssueTypeId") {
1054
- const nameKey = name === "planIssueTypeId" ? "planIssueTypeName" : "defaultIssueTypeName";
1055
- const previousId = base[name] || "";
1056
- const previousName = base[nameKey] || "";
1057
- base[name] = value;
1058
- base[nameKey] = pickedName(onesTypes.items, value, previousId, previousName);
1059
- } else {
1060
- base[name] = value;
1061
- }
1062
- setDrafts((prev) => ({ ...prev, [account.id]: base }));
1063
- if (name === "defaultProjectUuid") void loadOnesTypes(value, base);
1064
- };
1065
- const onFetchOnes = (account) => {
1066
- const form = drafts[account.id] || draftOf(account);
1067
- void (async () => {
1068
- await loadOnesProjects(form);
1069
- if ((form.defaultProjectUuid || "").trim()) await loadOnesTypes(form.defaultProjectUuid, form);
1070
- })();
1071
- };
1072
- const onToggleEnabled = (account, next) => {
1073
- void run(`enabled:${account.id}`, async () => {
1074
- const body = await api("/authinex-ds/accounts/enabled", {
1075
- method: "POST",
1076
- body: { provider: account.id, enabled: next }
1077
- });
1078
- if (body.state) applyState(body.state);
1079
- setNotice(`${account.label}:${String(body.message || (next ? "已启用" : "已停用"))}`);
1080
- });
1081
- };
1082
- const onTest = (account) => {
1083
- const form = drafts[account.id] || draftOf(account);
1084
- setAccountMsg((prev) => ({ ...prev, [account.id]: { text: `${account.label}:正在测试连接…`, tone: "pending" } }));
1085
- void run(`test:${account.id}`, async () => {
1086
- let body;
1087
- try {
1088
- body = await api("/authinex-ds/accounts/test", {
1089
- method: "POST",
1090
- body: { provider: account.id, form }
1091
- });
1092
- } catch {
1093
- const text2 = `${account.label}:没有连上,稍后再试`;
1094
- setAccountMsg((prev) => ({ ...prev, [account.id]: { text: text2, tone: "error" } }));
1095
- setNotice(text2);
1096
- setFeedback("error");
1097
- return;
1098
- }
1099
- const ok = Boolean(body.ok);
1100
- const text = `${account.label}:${String(body.message || (ok ? "连接正常" : "连接失败"))}`;
1101
- setAccountMsg((prev) => ({ ...prev, [account.id]: { text, tone: ok ? "ok" : "error" } }));
1102
- setNotice(text);
1103
- setFeedback(ok ? "ok" : "error");
1104
- if (ok && account.id === "ones") {
1105
- await loadOnesProjects(form);
1106
- if ((form.defaultProjectUuid || "").trim()) await loadOnesTypes(form.defaultProjectUuid, form);
1107
- }
1108
- });
1109
- };
1110
- const onSave = (account) => {
1111
- const form = drafts[account.id] || draftOf(account);
1112
- setAccountMsg((prev) => ({ ...prev, [account.id]: { text: `${account.label}:正在保存…`, tone: "pending" } }));
1113
- void run(`save:${account.id}`, async () => {
1114
- let body;
1115
- try {
1116
- body = await api("/authinex-ds/accounts", {
1117
- method: "PATCH",
1118
- body: { provider: account.id, form }
1119
- });
1120
- } catch {
1121
- const text2 = `${account.label}:没有保存`;
1122
- setAccountMsg((prev) => ({ ...prev, [account.id]: { text: text2, tone: "error" } }));
1123
- setNotice(text2);
1124
- setFeedback("error");
1125
- return;
1126
- }
1127
- if (body.state) applyState(body.state);
1128
- const ok = Boolean(body.ok);
1129
- const text = ok ? `${account.label}:已保存,个人设置和 AuthineX 已是这一份` : `${account.label}:${String(body.message || "没有保存")}`;
1130
- setAccountMsg((prev) => ({ ...prev, [account.id]: { text, tone: ok ? "ok" : "error" } }));
1131
- setNotice(text);
1132
- setFeedback(ok ? "ok" : "error");
1133
- if (ok) {
1134
- setDrafts((prev) => {
1135
- const next = { ...prev };
1136
- delete next[account.id];
1137
- return next;
1138
- });
1139
- setOpen("");
1140
- }
1141
- });
1142
- };
1143
- const loadSkills = (0, import_react3.useCallback)(async (page = 1, q = "", status = "approved") => {
1144
- setSkillBusy("list");
1145
- setSkillFeedback("");
1146
- setSkillNotice("");
1147
- try {
1148
- const [body] = await Promise.all([
1149
- api("/authinex-ds/skills", { method: "POST", body: { q, page, pageSize: SKILL_PAGE_SIZE, status } }),
1150
- dwell(300)
1151
- ]);
1152
- const items = Array.isArray(body.items) ? body.items : [];
1153
- setSkillView({
1154
- items,
1155
- total: Number(body.total || 0),
1156
- page: Number(body.page || page),
1157
- pageSize: Number(body.pageSize || SKILL_PAGE_SIZE),
1158
- q: String(body.q || q),
1159
- status: String(body.status || status),
1160
- message: String(body.message || ""),
1161
- loaded: true
1162
- });
1163
- setSkillOpen(0);
1164
- if (body.message) setSkillFeedback("warn");
1165
- } catch {
1166
- setSkillView((prev) => ({ ...prev, message: "没有取到技能列表", loaded: true }));
1167
- setSkillFeedback("error");
1168
- } finally {
1169
- setSkillBusy("");
1170
- }
1171
- }, []);
1172
1519
  const onRefresh = () => {
1173
1520
  void run("refresh", async () => {
1174
1521
  const [ok] = await Promise.all([read(), dwell()]);
@@ -1179,7 +1526,7 @@ function AuthinexPanel() {
1179
1526
  }
1180
1527
  setFeedback("ok");
1181
1528
  setNotice("已刷新");
1182
- if (skillView.loaded) void loadSkills(skillView.page, skillView.q, skillView.status);
1529
+ setSkillRefresh((value) => value + 1);
1183
1530
  });
1184
1531
  };
1185
1532
  const onSaveContext = (value) => {
@@ -1219,124 +1566,43 @@ function AuthinexPanel() {
1219
1566
  if (body.ok) setRestart(true);
1220
1567
  });
1221
1568
  };
1222
- const onImportSkill = async (input) => {
1223
- setSkillBusy("import");
1224
- setSkillNotice("");
1225
- setSkillFeedback("");
1226
- try {
1227
- const body = await api("/authinex-ds/skills/import", { method: "POST", body: input });
1228
- if (!body.ok) {
1229
- setSkillFeedback("error");
1230
- setSkillNotice(String(body.message || "没有提交成功"));
1231
- return false;
1232
- }
1233
- await loadSkills(1, "", "candidate");
1234
- setSkillFeedback("ok");
1235
- setSkillNotice(String(body.message || "已提交审核,通过后其他用户才能使用"));
1236
- return true;
1237
- } catch {
1238
- setSkillFeedback("error");
1239
- setSkillNotice("没有提交成功");
1240
- return false;
1241
- } finally {
1242
- setSkillBusy("");
1243
- }
1244
- };
1245
- const onSearchSkills = (event) => {
1246
- event?.preventDefault();
1247
- void loadSkills(1, skillDraftQ.trim(), skillView.status);
1248
- };
1249
- const onPageSkills = (next) => {
1250
- void loadSkills(next, skillView.q, skillView.status);
1251
- };
1252
- const onStatusSkills = (status) => {
1253
- void loadSkills(1, skillDraftQ.trim(), status);
1254
- };
1255
- const onDownloadSkill = (row) => {
1256
- setSkillBusy(`download:${row.id}`);
1257
- setSkillNotice("");
1258
- void (async () => {
1259
- try {
1260
- const body = await api("/authinex-ds/skills/export", { method: "POST", body: { id: row.id } });
1261
- if (!body.ok) {
1262
- setSkillNotice(String(body.message || "没有取到这篇技能"));
1263
- setSkillFeedback("error");
1264
- return;
1265
- }
1266
- const slug = String(body.slug || skillSlug(row.id));
1267
- saveTextFile(`${slug}-SKILL.md`, String(body.markdown || ""));
1268
- setSkillNotice(`已下载 ${slug}-SKILL.md`);
1269
- setSkillFeedback("ok");
1270
- } catch {
1271
- setSkillNotice("没有取到这篇技能");
1272
- setSkillFeedback("error");
1273
- } finally {
1274
- setSkillBusy("");
1275
- }
1276
- })();
1277
- };
1278
- const onInstallSkill = (row) => {
1279
- setSkillBusy(`install:${row.id}`);
1280
- setSkillNotice("");
1281
- void (async () => {
1282
- try {
1283
- const body = await api("/authinex-ds/skills/install", { method: "POST", body: { id: row.id } });
1284
- if (body.state) applyState(body.state);
1285
- setSkillNotice(String(body.message || (body.ok ? "已装到本机" : "没有装上")));
1286
- setSkillFeedback(body.ok ? "ok" : "error");
1287
- } catch {
1288
- setSkillNotice("没有装上");
1289
- setSkillFeedback("error");
1290
- } finally {
1291
- setSkillBusy("");
1292
- }
1293
- })();
1294
- };
1295
- (0, import_react3.useEffect)(() => {
1296
- if (tab !== "skills" || skillView.loaded || model.user === null) return;
1297
- void loadSkills(1, skillView.q, skillView.status);
1298
- }, [tab, skillView.loaded, skillView.q, skillView.status, model.user, loadSkills]);
1299
1569
  const showForm = loaded && (model.phase === "unbound" || model.phase === "invalid" || model.phase === "revoked");
1300
1570
  const message = localError || notice || model.message;
1301
1571
  const messageError = localError !== "" || model.phase === "invalid" || model.phase === "revoked" || model.phase === "unreachable";
1302
1572
  const disabled = busy !== "";
1303
1573
  const pending = busy === "refresh" ? "正在刷新…" : busy === "update" ? "正在检查更新…" : busy.startsWith("test:") ? "正在测试连接…" : busy.startsWith("save:") ? "正在保存…" : "";
1304
1574
  const messageClass = feedback === "ok" ? "axds-ok" : feedback === "warn" ? "axds-notice" : messageError || feedback === "error" ? "axds-error" : "axds-muted";
1305
- const skillPending = skillBusy === "list" ? "正在取技能列表…" : "";
1306
1575
  const installed = model.installedSkills;
1307
- const accountsReady = model.accounts.filter((account) => account.state !== "unconfigured").length;
1308
- const accountsSummary = model.accounts.length ? `${accountsReady}/${model.accounts.length} 家已配置` : "读取账号状态中";
1309
- const totalPages = pageCount(skillView.total, skillView.pageSize);
1310
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("section", { className: "axds", "aria-label": "AuthineX 助手", children: [
1311
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("header", { className: "axds-head", children: [
1312
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.StateDot, { state: model.tone }),
1313
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-head-text", children: [
1314
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "axds-title", children: "AuthineX 助手" }),
1315
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "axds-sub", children: loaded ? model.headline : "正在读取状态…" })
1576
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("section", { className: "axds", "aria-label": "AuthineX 助手", children: [
1577
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("header", { className: "axds-head", children: [
1578
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives5.StateDot, { state: model.tone }),
1579
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "axds-head-text", children: [
1580
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "axds-title", children: "AuthineX 助手" }),
1581
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "axds-sub", children: loaded ? model.headline : "正在读取状态…" })
1316
1582
  ] }),
1317
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "axds-head-actions", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { size: "sm", disabled, onClick: onRefresh, children: busy === "refresh" ? "刷新中" : "刷新" }) })
1583
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "axds-head-actions", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives5.Button, { size: "sm", disabled, onClick: onRefresh, children: busy === "refresh" ? "刷新中" : "刷新" }) })
1318
1584
  ] }),
1319
- model.retryAfterSec > 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { className: "axds-notice", children: [
1585
+ model.retryAfterSec > 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("p", { className: "axds-notice", children: [
1320
1586
  "请等待 ",
1321
1587
  model.retryAfterSec,
1322
1588
  " 秒后再试。"
1323
1589
  ] }) : null,
1324
- model.phase === "upgrade" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { className: "axds-error", children: [
1590
+ model.phase === "upgrade" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("p", { className: "axds-error", children: [
1325
1591
  "当前版本 ",
1326
1592
  model.version,
1327
1593
  ",最低要求 ",
1328
1594
  model.minVersion,
1329
1595
  "。请先更新插件。"
1330
1596
  ] }) : null,
1331
- pending ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { className: "axds-pending", role: "status", children: [
1332
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-spin", "aria-hidden": "true" }),
1333
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: pending })
1334
- ] }, "pending") : message ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: messageClass, role: "status", children: message }, message) : null,
1335
- showForm ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("form", { className: "axds-card", onSubmit: onBind, children: [
1336
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "axds-field", children: [
1337
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "访问地址" }),
1338
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1339
- import_dsh_client_ui_primitives3.Input,
1597
+ pending ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("p", { className: "axds-pending", role: "status", children: [
1598
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "axds-spin", "aria-hidden": "true" }),
1599
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: pending })
1600
+ ] }, "pending") : message ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: messageClass, role: "status", children: message }, message) : null,
1601
+ showForm ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("form", { className: "axds-card", onSubmit: onBind, children: [
1602
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "axds-field", children: [
1603
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "访问地址" }),
1604
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1605
+ import_dsh_client_ui_primitives5.Input,
1340
1606
  {
1341
1607
  className: "axds-input",
1342
1608
  value: endpoint,
@@ -1350,10 +1616,10 @@ function AuthinexPanel() {
1350
1616
  }
1351
1617
  )
1352
1618
  ] }),
1353
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "axds-field", children: [
1354
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "密钥" }),
1355
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1356
- import_dsh_client_ui_primitives3.Input,
1619
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "axds-field", children: [
1620
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "密钥" }),
1621
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1622
+ import_dsh_client_ui_primitives5.Input,
1357
1623
  {
1358
1624
  className: "axds-input",
1359
1625
  value: key,
@@ -1367,31 +1633,31 @@ function AuthinexPanel() {
1367
1633
  }
1368
1634
  )
1369
1635
  ] }),
1370
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-actions", children: [
1371
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-muted", children: "地址和密钥都由你填;插件本身不带任何地址或密钥。" }),
1372
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { type: "submit", variant: "primary", size: "md", disabled: disabled || key.trim() === "", children: "绑定" })
1636
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "axds-actions", children: [
1637
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "axds-muted", children: "地址和密钥都由你填;插件本身不带任何地址或密钥。" }),
1638
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives5.Button, { type: "submit", variant: "primary", size: "md", disabled: disabled || key.trim() === "", children: "绑定" })
1373
1639
  ] }),
1374
- model.endpoint ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-actions", children: [
1375
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "axds-muted", children: [
1640
+ model.endpoint ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "axds-actions", children: [
1641
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "axds-muted", children: [
1376
1642
  "本机还记着上次的地址 ",
1377
1643
  model.endpoint
1378
1644
  ] }),
1379
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { size: "sm", variant: "outline", disabled, onClick: () => {
1645
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives5.Button, { size: "sm", variant: "outline", disabled, onClick: () => {
1380
1646
  setConfirmUnbind(true);
1381
1647
  }, children: "解除绑定" })
1382
1648
  ] }) : null,
1383
- model.phase === "invalid" && model.endpoint ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "axds-muted", children: "升级不会作废这把密钥。把原来的密钥再贴一次,就会接回这台机器。" }) : null
1649
+ model.phase === "invalid" && model.endpoint ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "axds-muted", children: "升级不会作废这把密钥。把原来的密钥再贴一次,就会接回这台机器。" }) : null
1384
1650
  ] }) : null,
1385
- model.user ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
1386
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-row", children: [
1387
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: model.user.displayName }),
1388
- model.endpoint ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "axds-muted", children: [
1651
+ model.user ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
1652
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "axds-row", children: [
1653
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: model.user.displayName }),
1654
+ model.endpoint ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "axds-muted", children: [
1389
1655
  "· ",
1390
1656
  model.endpoint
1391
1657
  ] }) : null
1392
1658
  ] }),
1393
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-tabs", role: "tablist", "aria-label": "配置分区", children: [
1394
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1659
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "axds-tabs", role: "tablist", "aria-label": "配置分区", children: [
1660
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1395
1661
  "button",
1396
1662
  {
1397
1663
  type: "button",
@@ -1402,7 +1668,7 @@ function AuthinexPanel() {
1402
1668
  children: "概览"
1403
1669
  }
1404
1670
  ),
1405
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1671
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
1406
1672
  "button",
1407
1673
  {
1408
1674
  type: "button",
@@ -1412,23 +1678,23 @@ function AuthinexPanel() {
1412
1678
  onClick: () => setTab("skills"),
1413
1679
  children: [
1414
1680
  "技能",
1415
- installed.length ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-tab-badge", children: installed.length }) : null
1681
+ installed.length ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "axds-tab-badge", children: installed.length }) : null
1416
1682
  ]
1417
1683
  }
1418
1684
  )
1419
1685
  ] }),
1420
- tab === "overview" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
1421
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-card", children: [
1422
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-between", children: [
1423
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-title", children: "可用功能" }),
1424
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "axds-muted", children: [
1686
+ tab === "overview" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
1687
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "axds-card", children: [
1688
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "axds-between", children: [
1689
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "axds-title", children: "可用功能" }),
1690
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "axds-muted", children: [
1425
1691
  model.tools.length,
1426
1692
  " 个工具"
1427
1693
  ] })
1428
1694
  ] }),
1429
- model.tools.length ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "axds-tags", children: model.toolNames.map((name) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Tag, { tone: "neutral", children: name }, name)) }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "axds-muted", children: "当前角色没有可用工具。权限由运营台角色决定。" })
1695
+ model.tools.length ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "axds-tags", children: model.toolNames.map((name) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives5.Tag, { tone: "neutral", children: name }, name)) }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "axds-muted", children: "当前角色没有可用工具。权限由运营台角色决定。" })
1430
1696
  ] }),
1431
- model.user ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1697
+ model.user ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1432
1698
  WorkContextCard,
1433
1699
  {
1434
1700
  value: model.workContext,
@@ -1436,137 +1702,34 @@ function AuthinexPanel() {
1436
1702
  onSave: onSaveContext,
1437
1703
  onClear: onClearContext
1438
1704
  }
1439
- ) : null,
1440
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-card", children: [
1441
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1442
- "button",
1443
- {
1444
- type: "button",
1445
- className: "axds-collapse",
1446
- "aria-expanded": accountsOpen,
1447
- onClick: () => setAccountsOpen((value) => !value),
1448
- children: [
1449
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: `axds-caret${accountsOpen ? " on" : ""}`, "aria-hidden": "true" }),
1450
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-title", children: "集成账号" }),
1451
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-muted", children: accountsSummary }),
1452
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-push" }),
1453
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-muted", children: "与 AuthineX、运营台个人设置同一份" })
1454
- ]
1455
- }
1456
- ),
1457
- accountsOpen ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "axds-accounts", children: model.accounts.map((account) => {
1458
- const editing = open === account.id;
1459
- const draft = drafts[account.id] || draftOf(account);
1460
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-account", children: [
1461
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-account-head", children: [
1462
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.StateDot, { state: accountTone(account.state) }),
1463
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(PlatformIcon, { id: account.id }),
1464
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-account-name", children: account.label }),
1465
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Tag, { tone: tagTone(account.state), children: account.status }),
1466
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-push" }),
1467
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1468
- import_dsh_client_ui_primitives3.Switch,
1469
- {
1470
- checked: account.enabled,
1471
- label: `${account.label} 启用`,
1472
- disabled,
1473
- onChange: (next) => {
1474
- onToggleEnabled(account, next);
1475
- }
1476
- }
1477
- ),
1478
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { size: "sm", variant: "ghost", disabled, onClick: () => {
1479
- toggleAccount(account);
1480
- }, children: editing ? "收起" : "配置" })
1481
- ] }),
1482
- account.hint ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "axds-notice", children: account.hint }) : null,
1483
- account.username ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { className: "axds-muted", children: [
1484
- account.username,
1485
- account.hasToken ? " · 已有凭据" : ""
1486
- ] }) : null,
1487
- editing ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
1488
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "axds-fields", children: account.fields.map((field) => {
1489
- const onesSelect = account.id === "ones" && (field.name === "defaultProjectUuid" || field.name === "defaultIssueTypeId" || field.name === "planIssueTypeId") ? onesSelectRows({
1490
- field,
1491
- draft,
1492
- projects: onesProjects,
1493
- types: onesTypes,
1494
- busy: optionsBusy
1495
- }) : null;
1496
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "axds-field", children: [
1497
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: field.title }),
1498
- onesSelect ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1499
- "select",
1500
- {
1501
- className: "axds-select",
1502
- value: draft[field.name] ?? "",
1503
- disabled: disabled || optionsBusy !== "" || onesSelect.disabled,
1504
- onChange: (event) => {
1505
- onOnesSelect(account, field.name, event.target.value);
1506
- },
1507
- children: onesSelect.rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: row.uuid, children: row.name }, `${row.uuid}:${row.name}`))
1508
- }
1509
- ) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1510
- import_dsh_client_ui_primitives3.Input,
1511
- {
1512
- className: "axds-input",
1513
- type: field.type,
1514
- value: draft[field.name] ?? "",
1515
- placeholder: field.placeholder,
1516
- autoComplete: "off",
1517
- spellCheck: false,
1518
- onChange: (event) => {
1519
- setField(account, field.name, event.target.value);
1520
- }
1521
- }
1522
- )
1523
- ] }, field.name);
1524
- }) }),
1525
- account.id === "ones" && onesProjects.message ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { className: "axds-error", children: [
1526
- "项目:",
1527
- onesProjects.message
1528
- ] }) : null,
1529
- account.id === "ones" && onesTypes.message ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { className: "axds-error", children: [
1530
- "工单类型:",
1531
- onesTypes.message
1532
- ] }) : null,
1533
- editing && accountMsg[account.id] ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1534
- "p",
1535
- {
1536
- className: accountMsg[account.id].tone === "ok" ? "axds-ok" : accountMsg[account.id].tone === "error" ? "axds-error" : "axds-notice",
1537
- role: "status",
1538
- children: accountMsg[account.id].text
1539
- }
1540
- ) : null,
1541
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-actions", children: [
1542
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-muted", children: "保存前会先做一次连接测试,并写入个人设置" }),
1543
- account.id === "ones" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { size: "sm", disabled: disabled || optionsBusy !== "", onClick: () => {
1544
- onFetchOnes(account);
1545
- }, children: optionsBusy ? "获取中" : "获取类型" }) : null,
1546
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { size: "sm", disabled, onClick: () => {
1547
- onTest(account);
1548
- }, children: busy === `test:${account.id}` ? "测试中" : "测试连接" }),
1549
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { size: "sm", variant: "primary", disabled, onClick: () => {
1550
- onSave(account);
1551
- }, children: busy === `save:${account.id}` ? "保存中" : "保存" })
1552
- ] })
1553
- ] }) : null
1554
- ] }, account.id);
1555
- }) }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-muted", children: "展开才显示各平台账号和开关;收起不影响查单建单。" })
1556
- ] }),
1557
- model.update?.version ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-card", children: [
1558
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-between", children: [
1559
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-title", children: model.update.available ? `新版本 ${model.update.version}` : `已是最新(${model.update.version})` }),
1560
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Tag, { tone: model.update.available ? "info" : "success", children: model.update.available ? "可更新" : "最新" })
1705
+ ) : null
1706
+ ] }) : null,
1707
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1708
+ AccountsCard,
1709
+ {
1710
+ active: tab === "overview",
1711
+ accounts: model.accounts,
1712
+ disabled,
1713
+ busy,
1714
+ run,
1715
+ applyState,
1716
+ notify
1717
+ }
1718
+ ),
1719
+ tab === "overview" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
1720
+ model.update?.version ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "axds-card", children: [
1721
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "axds-between", children: [
1722
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "axds-title", children: model.update.available ? `新版本 ${model.update.version}` : `已是最新(${model.update.version})` }),
1723
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives5.Tag, { tone: model.update.available ? "info" : "success", children: model.update.available ? "可更新" : "最新" })
1561
1724
  ] }),
1562
- model.update.notes ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "axds-muted", children: model.update.notes }) : null,
1563
- model.update.sha ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { className: "axds-muted", children: [
1725
+ model.update.notes ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "axds-muted", children: model.update.notes }) : null,
1726
+ model.update.sha ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("p", { className: "axds-muted", children: [
1564
1727
  "校验值 ",
1565
1728
  model.update.sha
1566
1729
  ] }) : null,
1567
- model.update.available ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-actions", children: [
1568
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-muted", children: "更新由 DeepSeek 自己的安装器完成,装完要重启智能问答" }),
1569
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_dsh_client_ui_primitives3.Button, { size: "sm", variant: "primary", disabled, onClick: () => {
1730
+ model.update.available ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "axds-actions", children: [
1731
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "axds-muted", children: "更新由 DeepSeek 自己的安装器完成,装完要重启智能问答" }),
1732
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_dsh_client_ui_primitives5.Button, { size: "sm", variant: "primary", disabled, onClick: () => {
1570
1733
  setConfirmUpdate(true);
1571
1734
  }, children: [
1572
1735
  "更新到 ",
@@ -1574,23 +1737,23 @@ function AuthinexPanel() {
1574
1737
  ] })
1575
1738
  ] }) : null
1576
1739
  ] }) : null,
1577
- confirmUpdate ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-confirm", children: [
1578
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { children: [
1740
+ confirmUpdate ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "axds-confirm", children: [
1741
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { children: [
1579
1742
  "现在更新到 ",
1580
1743
  model.update?.version,
1581
1744
  "?装完需要重启智能问答。"
1582
1745
  ] }),
1583
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { size: "sm", variant: "outline", onClick: () => {
1746
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives5.Button, { size: "sm", variant: "outline", onClick: () => {
1584
1747
  setConfirmUpdate(false);
1585
1748
  }, children: "取消" }),
1586
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { size: "sm", variant: "primary", disabled, onClick: onApplyUpdate, children: "确认更新" })
1749
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives5.Button, { size: "sm", variant: "primary", disabled, onClick: onApplyUpdate, children: "确认更新" })
1587
1750
  ] }) : null,
1588
- restart ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "axds-notice", children: "已装好,重启智能问答后新版本才生效。" }) : null,
1589
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-card", children: [
1590
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "axds-field", children: [
1591
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "新密钥" }),
1592
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1593
- import_dsh_client_ui_primitives3.Input,
1751
+ restart ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "axds-notice", children: "已装好,重启智能问答后新版本才生效。" }) : null,
1752
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "axds-card", children: [
1753
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "axds-field", children: [
1754
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "新密钥" }),
1755
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1756
+ import_dsh_client_ui_primitives5.Input,
1594
1757
  {
1595
1758
  className: "axds-input",
1596
1759
  value: key,
@@ -1604,270 +1767,99 @@ function AuthinexPanel() {
1604
1767
  }
1605
1768
  )
1606
1769
  ] }),
1607
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-actions", children: [
1608
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-muted", children: "贴一把新密钥会重新兑换,运营台才会变成已绑定" }),
1609
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { size: "sm", variant: "primary", disabled: disabled || key.trim() === "", onClick: onRebind, children: "绑定这把密钥" })
1770
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "axds-actions", children: [
1771
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "axds-muted", children: "贴一把新密钥会重新兑换,运营台才会变成已绑定" }),
1772
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives5.Button, { size: "sm", variant: "primary", disabled: disabled || key.trim() === "", onClick: onRebind, children: "绑定这把密钥" })
1610
1773
  ] })
1611
1774
  ] }),
1612
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-row", children: [
1613
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { size: "sm", disabled, onClick: onCheckUpdate, children: busy === "update" ? "检查中" : "检查更新" }),
1614
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-muted", children: "服务端有更新清单就走清单,没有就比 npm 上的版本号" })
1775
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "axds-row", children: [
1776
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives5.Button, { size: "sm", disabled, onClick: onCheckUpdate, children: busy === "update" ? "检查中" : "检查更新" }),
1777
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "axds-muted", children: "服务端有更新清单就走清单,没有就比 npm 上的版本号" })
1615
1778
  ] })
1616
1779
  ] }) : null,
1617
- tab === "skills" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-card", children: [
1618
- model.user && model.skillsOnline ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "axds-muted", children: "技能已由插件在线提供,无需安装" }) : null,
1619
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-between", children: [
1620
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-title", children: "技能" }),
1621
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-muted", children: skillView.loaded ? `共 ${skillView.total} 个 · 按使用频次从高到低 · 本机已装 ${installed.length} 个` : "来自 AgentHub 技能库,按使用频次从高到低" })
1622
- ] }),
1623
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SkillImport, { disabled: disabled || skillBusy !== "", onSubmit: onImportSkill }),
1624
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("form", { className: "axds-skill-search", onSubmit: onSearchSkills, children: [
1625
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1626
- import_dsh_client_ui_primitives3.Input,
1627
- {
1628
- className: "axds-input",
1629
- value: skillDraftQ,
1630
- placeholder: "搜技能名、适用场景,或填编号(2470 / skill-2470)",
1631
- autoComplete: "off",
1632
- spellCheck: false,
1633
- onChange: (event) => {
1634
- setSkillDraftQ(event.target.value);
1635
- }
1636
- }
1637
- ),
1638
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { size: "sm", variant: "primary", type: "submit", disabled: skillBusy !== "", children: "检索" }),
1639
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1640
- import_dsh_client_ui_primitives3.Button,
1641
- {
1642
- size: "sm",
1643
- variant: "ghost",
1644
- type: "button",
1645
- disabled: skillBusy !== "",
1646
- onClick: () => {
1647
- setSkillDraftQ("");
1648
- void loadSkills(1, "", skillView.status);
1649
- },
1650
- children: "清空"
1651
- }
1652
- )
1653
- ] }),
1654
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "axds-skill-filter", role: "group", "aria-label": "技能状态", children: SKILL_FILTERS.map((option) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1655
- "button",
1656
- {
1657
- type: "button",
1658
- className: `axds-chip${skillView.status === option.value ? " on" : ""}`,
1659
- "aria-pressed": skillView.status === option.value,
1660
- disabled: skillBusy !== "",
1661
- onClick: () => {
1662
- onStatusSkills(option.value);
1663
- },
1664
- children: option.label
1665
- },
1666
- option.value || "all"
1667
- )) }),
1668
- skillPending ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { className: "axds-pending", role: "status", children: [
1669
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-spin", "aria-hidden": "true" }),
1670
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: skillPending })
1671
- ] }) : null,
1672
- skillNotice ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1673
- "p",
1674
- {
1675
- className: skillFeedback === "ok" ? "axds-ok" : skillFeedback === "error" ? "axds-error" : "axds-notice",
1676
- role: "status",
1677
- children: skillNotice
1678
- }
1679
- ) : null,
1680
- !skillPending && skillView.message ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: skillView.items.length ? "axds-notice" : "axds-muted", role: "status", children: skillView.message }) : null,
1681
- skillView.loaded && skillView.items.length === 0 && !skillPending ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "axds-muted", children: skillView.q ? `没有搜到「${skillView.q}」` : "这个状态下还没有技能" }) : null,
1682
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "axds-skills", children: skillView.items.map((row) => {
1683
- const expanded = skillOpen === row.id;
1684
- const done = skillInstalled(row, installed);
1685
- const status = row.status || "approved";
1686
- const hot = skillIsHot(row);
1687
- const uses = skillUseText(row);
1688
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: `axds-skill${expanded ? " on" : ""}${hot ? " hot" : ""}`, children: [
1689
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1690
- "button",
1691
- {
1692
- type: "button",
1693
- className: "axds-skill-head",
1694
- "aria-expanded": expanded,
1695
- onClick: () => setSkillOpen((prev) => prev === row.id ? 0 : row.id),
1696
- children: [
1697
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: `axds-caret${expanded ? " on" : ""}`, "aria-hidden": "true" }),
1698
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-skill-name", children: row.name || skillSlug(row.id) }),
1699
- hot ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { title: `召回满 ${SKILL_HOT_MIN} 次,属于高频技能`, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Tag, { tone: "warning", children: "高频" }) }) : null,
1700
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-push" }),
1701
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: `axds-skill-uses${hot ? " hot" : uses === "未使用" ? " idle" : ""}`, children: uses }),
1702
- done ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Tag, { tone: "success", children: "已装" }) : null,
1703
- skillUploaderText(row) ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Tag, { tone: "info", children: skillUploaderText(row) }) : null,
1704
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Tag, { tone: "quiet", children: skillKindText(row.skillKind) }),
1705
- status !== "approved" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Tag, { tone: skillStatusTone(status) === "success" ? "success" : "warning", children: SKILL_STATUS[status] || status }) : null
1706
- ]
1707
- }
1708
- ),
1709
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "axds-skill-desc", children: row.triggerDesc || "没有写适用场景" }),
1710
- expanded ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-skill-body", children: [
1711
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("dl", { className: "axds-kv", children: [
1712
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
1713
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dt", { children: "编号" }),
1714
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dd", { children: skillSlug(row.id) })
1715
- ] }),
1716
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
1717
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dt", { children: "使用频次" }),
1718
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dd", { children: uses })
1719
- ] }),
1720
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
1721
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dt", { children: "适用范围" }),
1722
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dd", { children: skillScopeText(row) })
1723
- ] }),
1724
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-kv-when", children: [
1725
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dt", { children: "更新时间" }),
1726
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dd", { children: formatUpdatedAt(row.updatedAt) })
1727
- ] }),
1728
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
1729
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dt", { children: "来源" }),
1730
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dd", { children: row.sourceKind || "—" })
1731
- ] })
1732
- ] }),
1733
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-actions", children: [
1734
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1735
- import_dsh_client_ui_primitives3.Button,
1736
- {
1737
- size: "sm",
1738
- variant: "ghost",
1739
- disabled: skillBusy !== "",
1740
- onClick: () => {
1741
- onDownloadSkill(row);
1742
- },
1743
- children: skillBusy === `download:${row.id}` ? "下载中…" : "下载 SKILL.md"
1744
- }
1745
- ),
1746
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1747
- import_dsh_client_ui_primitives3.Button,
1748
- {
1749
- size: "sm",
1750
- variant: "primary",
1751
- disabled: skillBusy !== "" || status !== "approved",
1752
- title: status === "approved" ? "" : "审核通过后才能装到本机",
1753
- onClick: () => {
1754
- onInstallSkill(row);
1755
- },
1756
- children: skillBusy === `install:${row.id}` ? "安装中…" : done ? "重新安装" : "装到本机"
1757
- }
1758
- )
1759
- ] })
1760
- ] }) : null
1761
- ] }, row.id);
1762
- }) }),
1763
- skillView.total > 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-pager", children: [
1764
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "axds-muted", children: [
1765
- "第 ",
1766
- skillView.page,
1767
- " / ",
1768
- totalPages,
1769
- " 页 · 共 ",
1770
- skillView.total,
1771
- " 个"
1772
- ] }),
1773
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-push" }),
1774
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1775
- import_dsh_client_ui_primitives3.Button,
1776
- {
1777
- size: "sm",
1778
- variant: "outline",
1779
- disabled: skillBusy !== "" || skillView.page <= 1,
1780
- onClick: () => {
1781
- onPageSkills(skillView.page - 1);
1782
- },
1783
- children: "上一页"
1784
- }
1785
- ),
1786
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1787
- import_dsh_client_ui_primitives3.Button,
1788
- {
1789
- size: "sm",
1790
- variant: "outline",
1791
- disabled: skillBusy !== "" || skillView.page >= totalPages,
1792
- onClick: () => {
1793
- onPageSkills(skillView.page + 1);
1794
- },
1795
- children: "下一页"
1796
- }
1797
- )
1798
- ] }) : null,
1799
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "axds-muted", children: "装到本机技能目录 ~/.dsh/skills/<编号>/SKILL.md,只写这个目录、不动工作区;新会话才会读到。" })
1800
- ] }) : null,
1801
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-row", children: [
1802
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { size: "sm", variant: "outline", disabled, onClick: () => {
1780
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1781
+ SkillsTab,
1782
+ {
1783
+ active: tab === "skills",
1784
+ disabled,
1785
+ userReady: model.user !== null,
1786
+ skillsOnline: model.skillsOnline,
1787
+ installed,
1788
+ refreshKey: skillRefresh,
1789
+ applyState
1790
+ },
1791
+ model.user ? "signed-in" : "signed-out"
1792
+ ),
1793
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "axds-row", children: [
1794
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives5.Button, { size: "sm", variant: "outline", disabled, onClick: () => {
1803
1795
  setConfirmUnbind(true);
1804
1796
  }, children: "解除绑定" }),
1805
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-muted", children: "解除后地址和密钥都会清掉,要重新填" })
1797
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "axds-muted", children: "解除后地址和密钥都会清掉,要重新填" })
1806
1798
  ] })
1807
1799
  ] }) : null,
1808
- confirmUnbind ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-confirm", children: [
1809
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "确认解除这台设备的绑定?" }),
1810
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { size: "sm", variant: "outline", onClick: () => {
1800
+ confirmUnbind ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "axds-confirm", children: [
1801
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "确认解除这台设备的绑定?" }),
1802
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives5.Button, { size: "sm", variant: "outline", onClick: () => {
1811
1803
  setConfirmUnbind(false);
1812
1804
  }, children: "取消" }),
1813
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { size: "sm", variant: "primary", disabled, onClick: onUnbind, children: "确认解除" })
1805
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives5.Button, { size: "sm", variant: "primary", disabled, onClick: onUnbind, children: "确认解除" })
1814
1806
  ] }) : null,
1815
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("footer", { className: "axds-foot", children: [
1816
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { children: [
1807
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("footer", { className: "axds-foot", children: [
1808
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { children: [
1817
1809
  "v",
1818
1810
  model.version || "0.1.0"
1819
1811
  ] }),
1820
- model.endpoint ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
1821
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "·" }),
1822
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: model.endpoint })
1812
+ model.endpoint ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
1813
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "·" }),
1814
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: model.endpoint })
1823
1815
  ] }) : null
1824
1816
  ] })
1825
1817
  ] });
1826
1818
  }
1827
1819
 
1828
- // src/command-card.tsx
1829
- var import_jsx_runtime5 = require("react/jsx-runtime");
1820
+ // src/work/command-card.tsx
1821
+ var import_jsx_runtime7 = require("react/jsx-runtime");
1830
1822
  function AxContextCommandCard(props) {
1831
1823
  const outcome = props.node?.outcome;
1832
1824
  if (!outcome) {
1833
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "axds-cmd", "data-state": "running", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "axds-cmd-head", children: [
1834
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "axds-cmd-title", children: "工作上下文" }),
1835
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "axds-muted", children: "正在设置…" })
1825
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "axds-cmd", "data-state": "running", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "axds-cmd-head", children: [
1826
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "axds-cmd-title", children: "工作上下文" }),
1827
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "axds-muted", children: "正在设置…" })
1836
1828
  ] }) });
1837
1829
  }
1838
1830
  if (outcome.kind === "error") {
1839
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "axds-cmd", "data-state": "error", children: [
1840
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "axds-cmd-head", children: [
1841
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "axds-cmd-title", children: "工作上下文" }),
1842
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "axds-cmd-mark", "data-mark": "bad", children: "没设成" })
1831
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "axds-cmd", "data-state": "error", children: [
1832
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "axds-cmd-head", children: [
1833
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "axds-cmd-title", children: "工作上下文" }),
1834
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "axds-cmd-mark", "data-mark": "bad", children: "没设成" })
1843
1835
  ] }),
1844
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "axds-cmd-note axds-error", children: outcome.text })
1836
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "axds-cmd-note axds-error", children: outcome.text })
1845
1837
  ] });
1846
1838
  }
1847
1839
  const receipt = parseReceiptText(outcome.text || "");
1848
1840
  if (!receipt) {
1849
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "axds-cmd", "data-state": "ok", children: [
1850
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "axds-cmd-head", children: [
1851
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "axds-cmd-title", children: "工作上下文" }),
1852
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "axds-cmd-mark", "data-mark": "ok", children: "已生效" })
1841
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "axds-cmd", "data-state": "ok", children: [
1842
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "axds-cmd-head", children: [
1843
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "axds-cmd-title", children: "工作上下文" }),
1844
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "axds-cmd-mark", "data-mark": "ok", children: "已生效" })
1853
1845
  ] }),
1854
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "axds-cmd-note axds-muted", children: outcome.text })
1846
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "axds-cmd-note axds-muted", children: outcome.text })
1855
1847
  ] });
1856
1848
  }
1857
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "axds-cmd", "data-state": "ok", children: [
1858
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "axds-cmd-head", children: [
1859
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "axds-cmd-title", children: "工作上下文" }),
1860
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "axds-cmd-mark", "data-mark": "ok", children: "已生效" })
1849
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "axds-cmd", "data-state": "ok", children: [
1850
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "axds-cmd-head", children: [
1851
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "axds-cmd-title", children: "工作上下文" }),
1852
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "axds-cmd-mark", "data-mark": "ok", children: "已生效" })
1861
1853
  ] }),
1862
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "axds-cmd-fields", children: receipt.fields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "axds-cmd-field", children: [
1863
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: field.label }),
1864
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("b", { children: field.value })
1854
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "axds-cmd-fields", children: receipt.fields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "axds-cmd-field", children: [
1855
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: field.label }),
1856
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("b", { children: field.value })
1865
1857
  ] }, `${field.label}:${field.value}`)) }),
1866
- receipt.note ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "axds-cmd-note axds-muted", children: receipt.note }) : null
1858
+ receipt.note ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "axds-cmd-note axds-muted", children: receipt.note }) : null
1867
1859
  ] });
1868
1860
  }
1869
1861
 
1870
- // src/styles.ts
1862
+ // src/client/styles.ts
1871
1863
  var CSS = `
1872
1864
  .axds{display:flex;flex-direction:column;gap:12px;color:var(--dsw-alias-label-primary);font-size:13px;line-height:1.5}
1873
1865
  .axds-head{display:flex;align-items:center;gap:8px}
@@ -1990,7 +1982,7 @@ function installClientStyles() {
1990
1982
  };
1991
1983
  }
1992
1984
 
1993
- // src/client.tsx
1985
+ // src/client/client.tsx
1994
1986
  var CLIENT_ID = PACKAGE_NAME;
1995
1987
  function install() {
1996
1988
  return {
@@ -2003,7 +1995,6 @@ function install() {
2003
1995
  ctx.slots.inject(slot, () => ctx.slots.register({ name: slot, key }, AuthinexPanel));
2004
1996
  };
2005
1997
  contribute("plugins.bundle.config", PACKAGE_NAME);
2006
- contribute("plugins.row.config", ROW_KEY);
2007
1998
  try {
2008
1999
  ctx.slots.inject("conversation.chat.commandview", () => ctx.slots.register(
2009
2000
  { name: "conversation.chat.commandview", key: "ax-context" },