@authinex/dsh-plugin 0.3.9 → 0.3.10

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: "咨询问题",
@@ -304,7 +335,7 @@ var TOOLS = {
304
335
  }
305
336
  };
306
337
 
307
- // src/work-context.ts
338
+ // src/work/work-context.ts
308
339
  var PRODUCT_KINDS = [
309
340
  { id: "yunshu", label: "云枢" },
310
341
  { id: "report", label: "报表" },
@@ -333,10 +364,8 @@ function parseReceiptText(text) {
333
364
  return { fields, note: lines.slice(1).join("\n") };
334
365
  }
335
366
 
336
- // src/view.ts
367
+ // src/shared/view.ts
337
368
  var PACKAGE_NAME = "@authinex/dsh-plugin";
338
- var ROW_ID = "authinex-host";
339
- var ROW_KEY = `${PACKAGE_NAME}#${ROW_ID}`;
340
369
  var SKILL_HOT_MIN = 5;
341
370
  function skillUseCount(row) {
342
371
  const n = Number(row.usage?.count);
@@ -558,78 +587,407 @@ function pageCount(total, pageSize = SKILL_PAGE_SIZE) {
558
587
  return Math.max(1, Math.ceil(total / pageSize));
559
588
  }
560
589
 
561
- // src/skill-import.tsx
590
+ // src/accounts/panel-accounts.tsx
562
591
  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;
592
+ function tagTone(state) {
593
+ if (state === "ready") return "success";
594
+ if (state === "read_only") return "info";
595
+ if (state === "disabled") return "neutral";
596
+ return "outline";
597
+ }
598
+ function draftOf(account) {
599
+ const draft = { ...account.extras };
600
+ for (const field of account.fields) draft[field.name] = field.value;
601
+ return draft;
602
+ }
603
+ function AccountsCard(props) {
604
+ const { accounts, disabled, busy, run, applyState, notify } = props;
605
+ const [accountsOpen, setAccountsOpen] = (0, import_react.useState)(false);
606
+ const [open, setOpen] = (0, import_react.useState)("");
607
+ const [drafts, setDrafts] = (0, import_react.useState)({});
608
+ const [accountMsg, setAccountMsg] = (0, import_react.useState)({});
609
+ const [onesProjects, setOnesProjects] = (0, import_react.useState)({ items: [], message: "", loaded: false });
610
+ const [onesTypes, setOnesTypes] = (0, import_react.useState)({ items: [], message: "", forProject: "" });
611
+ const [optionsBusy, setOptionsBusy] = (0, import_react.useState)("");
612
+ const projectTicket = (0, import_react.useRef)(0);
613
+ const typeTicket = (0, import_react.useRef)(0);
614
+ const accountsReady = accounts.filter((account) => account.state !== "unconfigured").length;
615
+ const accountsSummary = accounts.length ? `${accountsReady}/${accounts.length} 家已配置` : "读取账号状态中";
616
+ const loadOnesProjects = (0, import_react.useCallback)(async (form) => {
617
+ const ticket = ++projectTicket.current;
618
+ setOnesProjects((prev) => ({ ...prev, message: "" }));
619
+ setOptionsBusy("projects");
620
+ try {
621
+ const body = await api("/authinex-ds/accounts/options", {
622
+ method: "POST",
623
+ body: { provider: "ones", kind: "projects", form }
624
+ });
625
+ if (ticket !== projectTicket.current) return;
626
+ const ok = body.ok === true;
627
+ const items = Array.isArray(body.projects) ? body.projects : [];
628
+ const reason = textOf(body, "");
629
+ setOnesProjects({
630
+ items,
631
+ message: ok ? items.length ? "" : reason || "这个账号下没有可选项目" : reason || "没有拉到项目",
632
+ loaded: true
633
+ });
634
+ } catch {
635
+ if (ticket !== projectTicket.current) return;
636
+ setOnesProjects({ items: [], message: "没有拉到项目", loaded: true });
637
+ } finally {
638
+ if (ticket === projectTicket.current) setOptionsBusy((prev) => prev === "projects" ? "" : prev);
582
639
  }
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");
640
+ }, []);
641
+ const loadOnesTypes = (0, import_react.useCallback)(async (project, form) => {
642
+ if (!project) {
643
+ typeTicket.current += 1;
644
+ setOnesTypes({ items: [], message: "", forProject: "" });
645
+ setOptionsBusy((prev) => prev === "types" ? "" : prev);
607
646
  return;
608
647
  }
609
- if (text.length > MAX_CHARS) {
610
- setLocalError("这篇超过两万字,缩短后再提交");
648
+ const ticket = ++typeTicket.current;
649
+ setOnesTypes({ items: [], message: "", forProject: "" });
650
+ setOptionsBusy("types");
651
+ try {
652
+ const body = await api("/authinex-ds/accounts/options", {
653
+ method: "POST",
654
+ body: { provider: "ones", kind: "issueTypes", project, form }
655
+ });
656
+ if (ticket !== typeTicket.current) return;
657
+ const ok = body.ok === true;
658
+ const items = Array.isArray(body.issueTypes) ? body.issueTypes : [];
659
+ const reason = textOf(body, "");
660
+ setOnesTypes({
661
+ items,
662
+ message: ok ? items.length ? "" : reason || "这个项目下没有工单类型" : reason || "没有拉到工单类型",
663
+ forProject: project
664
+ });
665
+ } catch {
666
+ if (ticket !== typeTicket.current) return;
667
+ setOnesTypes({ items: [], message: "没有拉到工单类型", forProject: project });
668
+ } finally {
669
+ if (ticket === typeTicket.current) setOptionsBusy((prev) => prev === "types" ? "" : prev);
670
+ }
671
+ }, []);
672
+ const toggleAccount = (account) => {
673
+ if (open === account.id) {
674
+ setOpen("");
611
675
  return;
612
676
  }
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
- });
677
+ setOpen(account.id);
678
+ setDrafts((prev) => prev[account.id] ? prev : { ...prev, [account.id]: draftOf(account) });
679
+ if (account.id === "ones") {
680
+ setOnesTypes({ items: [], message: "", forProject: "" });
681
+ const form = drafts.ones || draftOf(account);
682
+ void (async () => {
683
+ await loadOnesProjects(form);
684
+ if (form.defaultProjectUuid) await loadOnesTypes(form.defaultProjectUuid, form);
685
+ })();
686
+ }
621
687
  };
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 ? "收起" : "导入个人技能" })
688
+ const setField = (account, name, value) => {
689
+ setDrafts((prev) => ({
690
+ ...prev,
691
+ [account.id]: { ...prev[account.id] || draftOf(account), [name]: value }
692
+ }));
693
+ };
694
+ const onOnesSelect = (account, name, value) => {
695
+ const base = { ...drafts[account.id] || draftOf(account) };
696
+ if (name === "defaultProjectUuid") {
697
+ const previousId = base.defaultProjectUuid || "";
698
+ const previousName = base.defaultProjectName || "";
699
+ base.defaultProjectUuid = value;
700
+ base.defaultProjectName = pickedName(onesProjects.items, value, previousId, previousName);
701
+ if (value !== previousId) {
702
+ base.defaultIssueTypeId = "";
703
+ base.defaultIssueTypeName = "";
704
+ base.planIssueTypeId = "";
705
+ base.planIssueTypeName = "";
706
+ }
707
+ } else if (name === "defaultIssueTypeId" || name === "planIssueTypeId") {
708
+ const nameKey = name === "planIssueTypeId" ? "planIssueTypeName" : "defaultIssueTypeName";
709
+ const previousId = base[name] || "";
710
+ const previousName = base[nameKey] || "";
711
+ base[name] = value;
712
+ base[nameKey] = pickedName(onesTypes.items, value, previousId, previousName);
713
+ } else {
714
+ base[name] = value;
715
+ }
716
+ setDrafts((prev) => ({ ...prev, [account.id]: base }));
717
+ if (name === "defaultProjectUuid") void loadOnesTypes(value, base);
718
+ };
719
+ const onFetchOnes = (account) => {
720
+ const form = drafts[account.id] || draftOf(account);
721
+ void (async () => {
722
+ await loadOnesProjects(form);
723
+ if ((form.defaultProjectUuid || "").trim()) await loadOnesTypes(form.defaultProjectUuid, form);
724
+ })();
725
+ };
726
+ const onToggleEnabled = (account, next) => {
727
+ void run(`enabled:${account.id}`, async () => {
728
+ const body = await api("/authinex-ds/accounts/enabled", {
729
+ method: "POST",
730
+ body: { provider: account.id, enabled: next }
731
+ });
732
+ if (body.state) applyState(body.state);
733
+ notify(`${account.label}:${String(body.message || (next ? "已启用" : "已停用"))}`);
734
+ });
735
+ };
736
+ const onTest = (account) => {
737
+ const form = drafts[account.id] || draftOf(account);
738
+ setAccountMsg((prev) => ({ ...prev, [account.id]: { text: `${account.label}:正在测试连接…`, tone: "pending" } }));
739
+ void run(`test:${account.id}`, async () => {
740
+ let body;
741
+ try {
742
+ body = await api("/authinex-ds/accounts/test", {
743
+ method: "POST",
744
+ body: { provider: account.id, form }
745
+ });
746
+ } catch {
747
+ const text2 = `${account.label}:没有连上,稍后再试`;
748
+ setAccountMsg((prev) => ({ ...prev, [account.id]: { text: text2, tone: "error" } }));
749
+ notify(text2, "error");
750
+ return;
751
+ }
752
+ const ok = Boolean(body.ok);
753
+ const text = `${account.label}:${String(body.message || (ok ? "连接正常" : "连接失败"))}`;
754
+ setAccountMsg((prev) => ({ ...prev, [account.id]: { text, tone: ok ? "ok" : "error" } }));
755
+ notify(text, ok ? "ok" : "error");
756
+ if (ok && account.id === "ones") {
757
+ await loadOnesProjects(form);
758
+ if ((form.defaultProjectUuid || "").trim()) await loadOnesTypes(form.defaultProjectUuid, form);
759
+ }
760
+ });
761
+ };
762
+ const onSave = (account) => {
763
+ const form = drafts[account.id] || draftOf(account);
764
+ setAccountMsg((prev) => ({ ...prev, [account.id]: { text: `${account.label}:正在保存…`, tone: "pending" } }));
765
+ void run(`save:${account.id}`, async () => {
766
+ let body;
767
+ try {
768
+ body = await api("/authinex-ds/accounts", {
769
+ method: "PATCH",
770
+ body: { provider: account.id, form }
771
+ });
772
+ } catch {
773
+ const text2 = `${account.label}:没有保存`;
774
+ setAccountMsg((prev) => ({ ...prev, [account.id]: { text: text2, tone: "error" } }));
775
+ notify(text2, "error");
776
+ return;
777
+ }
778
+ if (body.state) applyState(body.state);
779
+ const ok = Boolean(body.ok);
780
+ const text = ok ? `${account.label}:已保存,个人设置和 AuthineX 已是这一份` : `${account.label}:${String(body.message || "没有保存")}`;
781
+ setAccountMsg((prev) => ({ ...prev, [account.id]: { text, tone: ok ? "ok" : "error" } }));
782
+ notify(text, ok ? "ok" : "error");
783
+ if (ok) {
784
+ setDrafts((prev) => {
785
+ const next = { ...prev };
786
+ delete next[account.id];
787
+ return next;
788
+ });
789
+ setOpen("");
790
+ }
791
+ });
792
+ };
793
+ if (!props.active) return null;
794
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "axds-card", children: [
795
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
796
+ "button",
797
+ {
798
+ type: "button",
799
+ className: "axds-collapse",
800
+ "aria-expanded": accountsOpen,
801
+ onClick: () => setAccountsOpen((value) => !value),
802
+ children: [
803
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: `axds-caret${accountsOpen ? " on" : ""}`, "aria-hidden": "true" }),
804
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "axds-title", children: "集成账号" }),
805
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "axds-muted", children: accountsSummary }),
806
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "axds-push" }),
807
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "axds-muted", children: "与 AuthineX、运营台个人设置同一份" })
808
+ ]
809
+ }
810
+ ),
811
+ accountsOpen ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "axds-accounts", children: accounts.map((account) => {
812
+ const editing = open === account.id;
813
+ const draft = drafts[account.id] || draftOf(account);
814
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "axds-account", children: [
815
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "axds-account-head", children: [
816
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives.StateDot, { state: accountTone(account.state) }),
817
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(PlatformIcon, { id: account.id }),
818
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "axds-account-name", children: account.label }),
819
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives.Tag, { tone: tagTone(account.state), children: account.status }),
820
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "axds-push" }),
821
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
822
+ import_dsh_client_ui_primitives.Switch,
823
+ {
824
+ checked: account.enabled,
825
+ label: `${account.label} 启用`,
826
+ disabled,
827
+ onChange: (next) => {
828
+ onToggleEnabled(account, next);
829
+ }
830
+ }
831
+ ),
832
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives.Button, { size: "sm", variant: "ghost", disabled, onClick: () => {
833
+ toggleAccount(account);
834
+ }, children: editing ? "收起" : "配置" })
835
+ ] }),
836
+ account.hint ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "axds-notice", children: account.hint }) : null,
837
+ account.username ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("p", { className: "axds-muted", children: [
838
+ account.username,
839
+ account.hasToken ? " · 已有凭据" : ""
840
+ ] }) : null,
841
+ editing ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
842
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "axds-fields", children: account.fields.map((field) => {
843
+ const onesSelect = account.id === "ones" && (field.name === "defaultProjectUuid" || field.name === "defaultIssueTypeId" || field.name === "planIssueTypeId") ? onesSelectRows({
844
+ field,
845
+ draft,
846
+ projects: onesProjects,
847
+ types: onesTypes,
848
+ busy: optionsBusy
849
+ }) : null;
850
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "axds-field", children: [
851
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: field.title }),
852
+ onesSelect ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
853
+ "select",
854
+ {
855
+ className: "axds-select",
856
+ value: draft[field.name] ?? "",
857
+ disabled: disabled || optionsBusy !== "" || onesSelect.disabled,
858
+ onChange: (event) => {
859
+ onOnesSelect(account, field.name, event.target.value);
860
+ },
861
+ children: onesSelect.rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: row.uuid, children: row.name }, `${row.uuid}:${row.name}`))
862
+ }
863
+ ) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
864
+ import_dsh_client_ui_primitives.Input,
865
+ {
866
+ className: "axds-input",
867
+ type: field.type,
868
+ value: draft[field.name] ?? "",
869
+ placeholder: field.placeholder,
870
+ autoComplete: "off",
871
+ spellCheck: false,
872
+ onChange: (event) => {
873
+ setField(account, field.name, event.target.value);
874
+ }
875
+ }
876
+ )
877
+ ] }, field.name);
878
+ }) }),
879
+ account.id === "ones" && onesProjects.message ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("p", { className: "axds-error", children: [
880
+ "项目:",
881
+ onesProjects.message
882
+ ] }) : null,
883
+ account.id === "ones" && onesTypes.message ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("p", { className: "axds-error", children: [
884
+ "工单类型:",
885
+ onesTypes.message
886
+ ] }) : null,
887
+ editing && accountMsg[account.id] ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
888
+ "p",
889
+ {
890
+ className: accountMsg[account.id].tone === "ok" ? "axds-ok" : accountMsg[account.id].tone === "error" ? "axds-error" : "axds-notice",
891
+ role: "status",
892
+ children: accountMsg[account.id].text
893
+ }
894
+ ) : null,
895
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "axds-actions", children: [
896
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "axds-muted", children: "保存前会先做一次连接测试,并写入个人设置" }),
897
+ account.id === "ones" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives.Button, { size: "sm", disabled: disabled || optionsBusy !== "", onClick: () => {
898
+ onFetchOnes(account);
899
+ }, children: optionsBusy ? "获取中" : "获取类型" }) : null,
900
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives.Button, { size: "sm", disabled, onClick: () => {
901
+ onTest(account);
902
+ }, children: busy === `test:${account.id}` ? "测试中" : "测试连接" }),
903
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives.Button, { size: "sm", variant: "primary", disabled, onClick: () => {
904
+ onSave(account);
905
+ }, children: busy === `save:${account.id}` ? "保存中" : "保存" })
906
+ ] })
907
+ ] }) : null
908
+ ] }, account.id);
909
+ }) }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "axds-muted", children: "展开才显示各平台账号和开关;收起不影响查单建单。" })
910
+ ] });
911
+ }
912
+
913
+ // src/skills/panel-skills.tsx
914
+ var import_react3 = require("react");
915
+ var import_dsh_client_ui_primitives3 = require("@deepseek-ai/dsh-client-ui-primitives");
916
+
917
+ // src/skills/skill-import.tsx
918
+ var import_react2 = require("react");
919
+ var import_dsh_client_ui_primitives2 = require("@deepseek-ai/dsh-client-ui-primitives");
920
+ var import_jsx_runtime3 = require("react/jsx-runtime");
921
+ var MAX_CHARS = 2e4;
922
+ function SkillImport({
923
+ disabled,
924
+ onSubmit
925
+ }) {
926
+ const fileRef = (0, import_react2.useRef)(null);
927
+ const [open, setOpen] = (0, import_react2.useState)(false);
928
+ const [name, setName] = (0, import_react2.useState)("");
929
+ const [kind, setKind] = (0, import_react2.useState)("general");
930
+ const [markdown, setMarkdown] = (0, import_react2.useState)("");
931
+ const [localError, setLocalError] = (0, import_react2.useState)("");
932
+ const pickFile = () => {
933
+ fileRef.current?.click();
934
+ };
935
+ const onFile = (file) => {
936
+ if (!file) return;
937
+ if (file.size > MAX_CHARS * 4) {
938
+ setLocalError("这个文件太大,请控制在两万字以内");
939
+ return;
940
+ }
941
+ const reader = new FileReader();
942
+ reader.onload = () => {
943
+ const text = String(reader.result || "");
944
+ if (text.length > MAX_CHARS) {
945
+ setLocalError("这篇超过两万字,缩短后再提交");
946
+ return;
947
+ }
948
+ setMarkdown(text);
949
+ setLocalError("");
950
+ if (!name.trim()) {
951
+ const heading = text.split("\n").find((line) => line.startsWith("# "));
952
+ if (heading) setName(heading.replace(/^#\s+/, "").trim().slice(0, 200));
953
+ }
954
+ };
955
+ reader.onerror = () => {
956
+ setLocalError("没有读到这个文件");
957
+ };
958
+ reader.readAsText(file);
959
+ };
960
+ const onForm = (event) => {
961
+ event.preventDefault();
962
+ const text = markdown.trim();
963
+ if (!text) {
964
+ setLocalError("先贴上或选择一篇 SKILL.md");
965
+ return;
966
+ }
967
+ if (text.length > MAX_CHARS) {
968
+ setLocalError("这篇超过两万字,缩短后再提交");
969
+ return;
970
+ }
971
+ setLocalError("");
972
+ void onSubmit({ markdown: text, name: name.trim(), skillKind: kind }).then((ok) => {
973
+ if (!ok) return;
974
+ setName("");
975
+ setKind("general");
976
+ setMarkdown("");
977
+ setOpen(false);
978
+ });
979
+ };
980
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "axds-import", children: [
981
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "axds-actions", children: [
982
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "axds-muted", children: "提交后先待审核,通过后其他用户才能装和使用" }),
983
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives2.Button, { size: "sm", variant: "outline", disabled, onClick: () => {
984
+ setOpen((value) => !value);
985
+ }, children: open ? "收起" : "导入个人技能" })
628
986
  ] }),
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)(
987
+ open ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("form", { className: "axds-import-form", onSubmit: onForm, children: [
988
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "axds-field", children: [
989
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: "技能名(可空,空则用正文标题)" }),
990
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
633
991
  "input",
634
992
  {
635
993
  className: "axds-plain",
@@ -644,9 +1002,9 @@ function SkillImport({
644
1002
  }
645
1003
  )
646
1004
  ] }),
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)(
1005
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "axds-field", children: [
1006
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: "用途" }),
1007
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
650
1008
  "select",
651
1009
  {
652
1010
  className: "axds-select",
@@ -655,13 +1013,13 @@ function SkillImport({
655
1013
  onChange: (event) => {
656
1014
  setKind(event.target.value);
657
1015
  },
658
- children: Object.entries(SKILL_KINDS).map(([value, label]) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value, children: label }, value))
1016
+ children: Object.entries(SKILL_KINDS).map(([value, label]) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value, children: label }, value))
659
1017
  }
660
1018
  )
661
1019
  ] }),
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)(
1020
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "axds-field", children: [
1021
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: "SKILL.md" }),
1022
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
665
1023
  "textarea",
666
1024
  {
667
1025
  className: "axds-textarea",
@@ -676,7 +1034,7 @@ function SkillImport({
676
1034
  }
677
1035
  )
678
1036
  ] }),
679
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1037
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
680
1038
  "input",
681
1039
  {
682
1040
  ref: fileRef,
@@ -689,39 +1047,300 @@ function SkillImport({
689
1047
  }
690
1048
  }
691
1049
  ),
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: "提交审核" })
1050
+ localError ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "axds-error", role: "status", children: localError }) : null,
1051
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "axds-actions", children: [
1052
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives2.Button, { size: "sm", variant: "ghost", type: "button", disabled, onClick: pickFile, children: "选择文件" }),
1053
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives2.Button, { size: "sm", variant: "primary", type: "submit", disabled, children: "提交审核" })
696
1054
  ] })
697
1055
  ] }) : null
698
1056
  ] });
699
1057
  }
700
1058
 
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");
1059
+ // src/skills/panel-skills.tsx
1060
+ var import_jsx_runtime4 = require("react/jsx-runtime");
1061
+ var EMPTY = {
1062
+ items: [],
1063
+ total: 0,
1064
+ page: 1,
1065
+ pageSize: SKILL_PAGE_SIZE,
1066
+ q: "",
1067
+ status: "",
1068
+ message: "",
1069
+ loaded: false
1070
+ };
1071
+ function SkillsTab(props) {
1072
+ const [view, setView] = (0, import_react3.useState)(EMPTY);
1073
+ const [draftQ, setDraftQ] = (0, import_react3.useState)("");
1074
+ const [open, setOpen] = (0, import_react3.useState)(0);
1075
+ const [busy, setBusy] = (0, import_react3.useState)("");
1076
+ const [notice, setNotice] = (0, import_react3.useState)("");
1077
+ const [feedback, setFeedback] = (0, import_react3.useState)("");
1078
+ const load = (0, import_react3.useCallback)(async (page = 1, q = "", status = "approved") => {
1079
+ setBusy("list");
1080
+ setFeedback("");
1081
+ setNotice("");
1082
+ try {
1083
+ const [body] = await Promise.all([
1084
+ api("/authinex-ds/skills", { method: "POST", body: { q, page, pageSize: SKILL_PAGE_SIZE, status } }),
1085
+ dwell(300)
1086
+ ]);
1087
+ const items = Array.isArray(body.items) ? body.items : [];
1088
+ setView({
1089
+ items,
1090
+ total: Number(body.total || 0),
1091
+ page: Number(body.page || page),
1092
+ pageSize: Number(body.pageSize || SKILL_PAGE_SIZE),
1093
+ q: String(body.q || q),
1094
+ status: String(body.status || status),
1095
+ message: String(body.message || ""),
1096
+ loaded: true
1097
+ });
1098
+ setOpen(0);
1099
+ if (body.message) setFeedback("warn");
1100
+ } catch {
1101
+ setView((prev) => ({ ...prev, message: "没有取到技能列表", loaded: true }));
1102
+ setFeedback("error");
1103
+ } finally {
1104
+ setBusy("");
1105
+ }
1106
+ }, []);
1107
+ (0, import_react3.useEffect)(() => {
1108
+ if (!props.active || view.loaded || !props.userReady) return;
1109
+ void load(1, view.q, view.status);
1110
+ }, [props.active, props.userReady, view.loaded, view.q, view.status, load]);
1111
+ const viewRef = (0, import_react3.useRef)(view);
1112
+ viewRef.current = view;
1113
+ (0, import_react3.useEffect)(() => {
1114
+ if (props.refreshKey === 0 || !viewRef.current.loaded) return;
1115
+ const current = viewRef.current;
1116
+ void load(current.page, current.q, current.status);
1117
+ }, [props.refreshKey, load]);
1118
+ if (!props.active) return null;
1119
+ const pending = busy === "list" ? "正在取技能列表…" : "";
1120
+ const pages = pageCount(view.total, view.pageSize);
1121
+ const onImport = async (input) => {
1122
+ setBusy("import");
1123
+ setNotice("");
1124
+ setFeedback("");
1125
+ try {
1126
+ const body = await api("/authinex-ds/skills/import", { method: "POST", body: input });
1127
+ if (!body.ok) {
1128
+ setFeedback("error");
1129
+ setNotice(String(body.message || "没有提交成功"));
1130
+ return false;
1131
+ }
1132
+ await load(1, "", "candidate");
1133
+ setFeedback("ok");
1134
+ setNotice(String(body.message || "已提交审核,通过后其他用户才能使用"));
1135
+ return true;
1136
+ } catch {
1137
+ setFeedback("error");
1138
+ setNotice("没有提交成功");
1139
+ return false;
1140
+ } finally {
1141
+ setBusy("");
1142
+ }
1143
+ };
1144
+ const download = (row) => {
1145
+ setBusy(`download:${row.id}`);
1146
+ setNotice("");
1147
+ void (async () => {
1148
+ try {
1149
+ const body = await api("/authinex-ds/skills/export", { method: "POST", body: { id: row.id } });
1150
+ if (!body.ok) {
1151
+ setNotice(String(body.message || "没有取到这篇技能"));
1152
+ setFeedback("error");
1153
+ return;
1154
+ }
1155
+ const slug = String(body.slug || skillSlug(row.id));
1156
+ saveTextFile(`${slug}-SKILL.md`, String(body.markdown || ""));
1157
+ setNotice(`已下载 ${slug}-SKILL.md`);
1158
+ setFeedback("ok");
1159
+ } catch {
1160
+ setNotice("没有取到这篇技能");
1161
+ setFeedback("error");
1162
+ } finally {
1163
+ setBusy("");
1164
+ }
1165
+ })();
1166
+ };
1167
+ const install2 = (row) => {
1168
+ setBusy(`install:${row.id}`);
1169
+ setNotice("");
1170
+ void (async () => {
1171
+ try {
1172
+ const body = await api("/authinex-ds/skills/install", { method: "POST", body: { id: row.id } });
1173
+ if (body.state) props.applyState(body.state);
1174
+ setNotice(String(body.message || (body.ok ? "已装到本机" : "没有装上")));
1175
+ setFeedback(body.ok ? "ok" : "error");
1176
+ } catch {
1177
+ setNotice("没有装上");
1178
+ setFeedback("error");
1179
+ } finally {
1180
+ setBusy("");
1181
+ }
1182
+ })();
1183
+ };
1184
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-card", children: [
1185
+ props.userReady && props.skillsOnline ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "axds-muted", children: "技能已由插件在线提供,无需安装" }) : null,
1186
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-between", children: [
1187
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-title", children: "技能" }),
1188
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-muted", children: view.loaded ? `共 ${view.total} 个 · 按使用频次从高到低 · 本机已装 ${props.installed.length} 个` : "来自 AgentHub 技能库,按使用频次从高到低" })
1189
+ ] }),
1190
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SkillImport, { disabled: props.disabled || busy !== "", onSubmit: onImport }),
1191
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("form", { className: "axds-skill-search", onSubmit: (event) => {
1192
+ event.preventDefault();
1193
+ void load(1, draftQ.trim(), view.status);
1194
+ }, children: [
1195
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1196
+ import_dsh_client_ui_primitives3.Input,
1197
+ {
1198
+ className: "axds-input",
1199
+ value: draftQ,
1200
+ placeholder: "搜技能名、适用场景,或填编号(2470 / skill-2470)",
1201
+ autoComplete: "off",
1202
+ spellCheck: false,
1203
+ onChange: (event) => {
1204
+ setDraftQ(event.target.value);
1205
+ }
1206
+ }
1207
+ ),
1208
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { size: "sm", variant: "primary", type: "submit", disabled: busy !== "", children: "检索" }),
1209
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { size: "sm", variant: "ghost", type: "button", disabled: busy !== "", onClick: () => {
1210
+ setDraftQ("");
1211
+ void load(1, "", view.status);
1212
+ }, children: "清空" })
1213
+ ] }),
1214
+ /* @__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)(
1215
+ "button",
1216
+ {
1217
+ type: "button",
1218
+ className: `axds-chip${view.status === option.value ? " on" : ""}`,
1219
+ "aria-pressed": view.status === option.value,
1220
+ disabled: busy !== "",
1221
+ onClick: () => {
1222
+ void load(1, draftQ.trim(), option.value);
1223
+ },
1224
+ children: option.label
1225
+ },
1226
+ option.value || "all"
1227
+ )) }),
1228
+ pending ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { className: "axds-pending", role: "status", children: [
1229
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-spin", "aria-hidden": "true" }),
1230
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: pending })
1231
+ ] }) : null,
1232
+ notice ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: feedback === "ok" ? "axds-ok" : feedback === "error" ? "axds-error" : "axds-notice", role: "status", children: notice }) : null,
1233
+ !pending && view.message ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: view.items.length ? "axds-notice" : "axds-muted", role: "status", children: view.message }) : null,
1234
+ view.loaded && view.items.length === 0 && !pending ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "axds-muted", children: view.q ? `没有搜到「${view.q}」` : "这个状态下还没有技能" }) : null,
1235
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "axds-skills", children: view.items.map((row) => {
1236
+ const expanded = open === row.id;
1237
+ const done = skillInstalled(row, props.installed);
1238
+ const status = row.status || "approved";
1239
+ const hot = skillIsHot(row);
1240
+ const uses = skillUseText(row);
1241
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: `axds-skill${expanded ? " on" : ""}${hot ? " hot" : ""}`, children: [
1242
+ /* @__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: [
1243
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: `axds-caret${expanded ? " on" : ""}`, "aria-hidden": "true" }),
1244
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-skill-name", children: row.name || skillSlug(row.id) }),
1245
+ 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,
1246
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-push" }),
1247
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: `axds-skill-uses${hot ? " hot" : uses === "未使用" ? " idle" : ""}`, children: uses }),
1248
+ done ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Tag, { tone: "success", children: "已装" }) : null,
1249
+ skillUploaderText(row) ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Tag, { tone: "info", children: skillUploaderText(row) }) : null,
1250
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Tag, { tone: "quiet", children: skillKindText(row.skillKind) }),
1251
+ 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
1252
+ ] }),
1253
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "axds-skill-desc", children: row.triggerDesc || "没有写适用场景" }),
1254
+ expanded ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-skill-body", children: [
1255
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("dl", { className: "axds-kv", children: [
1256
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
1257
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dt", { children: "编号" }),
1258
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dd", { children: skillSlug(row.id) })
1259
+ ] }),
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: uses })
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: skillScopeText(row) })
1267
+ ] }),
1268
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-kv-when", children: [
1269
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dt", { children: "更新时间" }),
1270
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dd", { children: formatUpdatedAt(row.updatedAt) })
1271
+ ] }),
1272
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
1273
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dt", { children: "来源" }),
1274
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dd", { children: row.sourceKind || "—" })
1275
+ ] })
1276
+ ] }),
1277
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-actions", children: [
1278
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { size: "sm", variant: "ghost", disabled: busy !== "", onClick: () => {
1279
+ download(row);
1280
+ }, children: busy === `download:${row.id}` ? "下载中…" : "下载 SKILL.md" }),
1281
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1282
+ import_dsh_client_ui_primitives3.Button,
1283
+ {
1284
+ size: "sm",
1285
+ variant: "primary",
1286
+ disabled: busy !== "" || status !== "approved",
1287
+ title: status === "approved" ? "" : "审核通过后才能装到本机",
1288
+ onClick: () => {
1289
+ install2(row);
1290
+ },
1291
+ children: busy === `install:${row.id}` ? "安装中…" : done ? "重新安装" : "装到本机"
1292
+ }
1293
+ )
1294
+ ] })
1295
+ ] }) : null
1296
+ ] }, row.id);
1297
+ }) }),
1298
+ view.total > 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-pager", children: [
1299
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "axds-muted", children: [
1300
+ "第 ",
1301
+ view.page,
1302
+ " / ",
1303
+ pages,
1304
+ " 页 · 共 ",
1305
+ view.total,
1306
+ " 个"
1307
+ ] }),
1308
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-push" }),
1309
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { size: "sm", variant: "outline", disabled: busy !== "" || view.page <= 1, onClick: () => {
1310
+ void load(view.page - 1, view.q, view.status);
1311
+ }, children: "上一页" }),
1312
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { size: "sm", variant: "outline", disabled: busy !== "" || view.page >= pages, onClick: () => {
1313
+ void load(view.page + 1, view.q, view.status);
1314
+ }, children: "下一页" })
1315
+ ] }) : null,
1316
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "axds-muted", children: "装到本机技能目录 ~/.dsh/skills/<编号>/SKILL.md,只写这个目录、不动工作区;新会话才会读到。" })
1317
+ ] });
1318
+ }
1319
+
1320
+ // src/work/work-context-card.tsx
1321
+ var import_react4 = require("react");
1322
+ var import_dsh_client_ui_primitives4 = require("@deepseek-ai/dsh-client-ui-primitives");
1323
+ var import_jsx_runtime5 = require("react/jsx-runtime");
705
1324
  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)(() => {
1325
+ const [productKind, setProductKind] = (0, import_react4.useState)(props.value.productKind);
1326
+ const [version, setVersion] = (0, import_react4.useState)(props.value.version);
1327
+ const [customer, setCustomer] = (0, import_react4.useState)(props.value.customer);
1328
+ (0, import_react4.useEffect)(() => {
710
1329
  setProductKind(props.value.productKind);
711
1330
  setVersion(props.value.version);
712
1331
  setCustomer(props.value.customer);
713
1332
  }, [props.value.productKind, props.value.version, props.value.customer]);
714
1333
  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: "没填的版本和产品线,调用工具时补上" })
1334
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "axds-card", children: [
1335
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "axds-between", children: [
1336
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "axds-title", children: "工作上下文" }),
1337
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "axds-muted", children: "没填的版本和产品线,调用工具时补上" })
719
1338
  ] }),
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,
1339
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "axds-fields", children: [
1340
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "axds-field", children: [
1341
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "产品线" }),
1342
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1343
+ import_dsh_client_ui_primitives4.Input,
725
1344
  {
726
1345
  className: "axds-input",
727
1346
  value: shownKind,
@@ -734,10 +1353,10 @@ function WorkContextCard(props) {
734
1353
  }
735
1354
  )
736
1355
  ] }),
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,
1356
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "axds-field", children: [
1357
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "版本" }),
1358
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1359
+ import_dsh_client_ui_primitives4.Input,
741
1360
  {
742
1361
  className: "axds-input",
743
1362
  value: version,
@@ -751,10 +1370,10 @@ function WorkContextCard(props) {
751
1370
  }
752
1371
  )
753
1372
  ] }),
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,
1373
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "axds-field", children: [
1374
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "客户" }),
1375
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1376
+ import_dsh_client_ui_primitives4.Input,
758
1377
  {
759
1378
  className: "axds-input",
760
1379
  value: customer,
@@ -769,11 +1388,11 @@ function WorkContextCard(props) {
769
1388
  )
770
1389
  ] })
771
1390
  ] }),
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,
1391
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "axds-actions", children: [
1392
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "axds-muted", children: "也可以在对话里用 /ax-context 云枢 8.7 某客户 要问的问题" }),
1393
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dsh_client_ui_primitives4.Button, { size: "sm", variant: "ghost", disabled: props.disabled, onClick: props.onClear, children: "清空" }),
1394
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1395
+ import_dsh_client_ui_primitives4.Button,
777
1396
  {
778
1397
  size: "sm",
779
1398
  variant: "primary",
@@ -788,91 +1407,27 @@ function WorkContextCard(props) {
788
1407
  ] });
789
1408
  }
790
1409
 
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
- };
1410
+ // src/panel/panel.tsx
1411
+ var import_jsx_runtime6 = require("react/jsx-runtime");
843
1412
  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) => {
1413
+ const [state, setState] = (0, import_react5.useState)(null);
1414
+ const [loaded, setLoaded] = (0, import_react5.useState)(false);
1415
+ const [busy, setBusy] = (0, import_react5.useState)("");
1416
+ const [notice, setNotice] = (0, import_react5.useState)("");
1417
+ const [localError, setLocalError] = (0, import_react5.useState)("");
1418
+ const [endpoint, setEndpoint] = (0, import_react5.useState)("");
1419
+ const [key, setKey] = (0, import_react5.useState)("");
1420
+ const [confirmUnbind, setConfirmUnbind] = (0, import_react5.useState)(false);
1421
+ const [confirmUpdate, setConfirmUpdate] = (0, import_react5.useState)(false);
1422
+ const [restart, setRestart] = (0, import_react5.useState)(false);
1423
+ const [feedback, setFeedback] = (0, import_react5.useState)("");
1424
+ const [tab, setTab] = (0, import_react5.useState)("overview");
1425
+ const [skillRefresh, setSkillRefresh] = (0, import_react5.useState)(0);
1426
+ const model = (0, import_react5.useMemo)(() => viewModel(state || void 0), [state]);
1427
+ const applyState = (0, import_react5.useCallback)((next) => {
873
1428
  setState(next);
874
1429
  }, []);
875
- const read = (0, import_react3.useCallback)(async () => {
1430
+ const read = (0, import_react5.useCallback)(async () => {
876
1431
  try {
877
1432
  applyState(await api("/authinex-ds/state"));
878
1433
  return true;
@@ -882,85 +1437,33 @@ function AuthinexPanel() {
882
1437
  } finally {
883
1438
  setLoaded(true);
884
1439
  }
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");
1440
+ }, [applyState]);
1441
+ (0, import_react5.useEffect)(() => {
1442
+ void read();
1443
+ }, [read]);
1444
+ (0, import_react5.useEffect)(() => {
1445
+ if (model.endpoint) setEndpoint((prev) => prev || model.endpoint);
1446
+ }, [model.endpoint]);
1447
+ const run = (0, import_react5.useCallback)(async (label, work) => {
1448
+ setBusy(label);
1449
+ setNotice("");
1450
+ setLocalError("");
1451
+ setFeedback("");
943
1452
  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
- });
1453
+ await work();
957
1454
  } catch {
958
- if (ticket !== typeTicket.current) return;
959
- setOnesTypes({ items: [], message: "没有拉到工单类型", forProject: project });
1455
+ setState({ phase: "unreachable" });
1456
+ if (label === "refresh") setNotice("没有刷新到");
1457
+ if (label === "update") setNotice("没有查到更新");
1458
+ if (label === "refresh" || label === "update") setFeedback("error");
960
1459
  } finally {
961
- if (ticket === typeTicket.current) setOptionsBusy((prev) => prev === "types" ? "" : prev);
1460
+ setBusy("");
962
1461
  }
963
1462
  }, []);
1463
+ const notify = (0, import_react5.useCallback)((text, tone) => {
1464
+ setNotice(text);
1465
+ if (tone) setFeedback(tone);
1466
+ }, []);
964
1467
  const onBind = (event) => {
965
1468
  event.preventDefault();
966
1469
  const url = endpoint.trim();
@@ -1005,170 +1508,10 @@ function AuthinexPanel() {
1005
1508
  void run("unbind", async () => {
1006
1509
  const body = await api("/authinex-ds/unbind", { method: "POST" });
1007
1510
  applyState(body);
1008
- setOpen("");
1009
- setDrafts({});
1010
1511
  setEndpoint("");
1011
- setSkillView(SKILL_EMPTY);
1012
- setAccountMsg({});
1013
- setOnesProjects({ items: [], message: "", loaded: false });
1014
- setOnesTypes({ items: [], message: "", forProject: "" });
1015
1512
  setNotice("已解除绑定,地址和密钥都清掉了");
1016
1513
  });
1017
1514
  };
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
1515
  const onRefresh = () => {
1173
1516
  void run("refresh", async () => {
1174
1517
  const [ok] = await Promise.all([read(), dwell()]);
@@ -1179,7 +1522,7 @@ function AuthinexPanel() {
1179
1522
  }
1180
1523
  setFeedback("ok");
1181
1524
  setNotice("已刷新");
1182
- if (skillView.loaded) void loadSkills(skillView.page, skillView.q, skillView.status);
1525
+ setSkillRefresh((value) => value + 1);
1183
1526
  });
1184
1527
  };
1185
1528
  const onSaveContext = (value) => {
@@ -1219,124 +1562,43 @@ function AuthinexPanel() {
1219
1562
  if (body.ok) setRestart(true);
1220
1563
  });
1221
1564
  };
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
1565
  const showForm = loaded && (model.phase === "unbound" || model.phase === "invalid" || model.phase === "revoked");
1300
1566
  const message = localError || notice || model.message;
1301
1567
  const messageError = localError !== "" || model.phase === "invalid" || model.phase === "revoked" || model.phase === "unreachable";
1302
1568
  const disabled = busy !== "";
1303
1569
  const pending = busy === "refresh" ? "正在刷新…" : busy === "update" ? "正在检查更新…" : busy.startsWith("test:") ? "正在测试连接…" : busy.startsWith("save:") ? "正在保存…" : "";
1304
1570
  const messageClass = feedback === "ok" ? "axds-ok" : feedback === "warn" ? "axds-notice" : messageError || feedback === "error" ? "axds-error" : "axds-muted";
1305
- const skillPending = skillBusy === "list" ? "正在取技能列表…" : "";
1306
1571
  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 : "正在读取状态…" })
1572
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("section", { className: "axds", "aria-label": "AuthineX 助手", children: [
1573
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("header", { className: "axds-head", children: [
1574
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives5.StateDot, { state: model.tone }),
1575
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "axds-head-text", children: [
1576
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "axds-title", children: "AuthineX 助手" }),
1577
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "axds-sub", children: loaded ? model.headline : "正在读取状态…" })
1316
1578
  ] }),
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" ? "刷新中" : "刷新" }) })
1579
+ /* @__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
1580
  ] }),
1319
- model.retryAfterSec > 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { className: "axds-notice", children: [
1581
+ model.retryAfterSec > 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("p", { className: "axds-notice", children: [
1320
1582
  "请等待 ",
1321
1583
  model.retryAfterSec,
1322
1584
  " 秒后再试。"
1323
1585
  ] }) : null,
1324
- model.phase === "upgrade" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { className: "axds-error", children: [
1586
+ model.phase === "upgrade" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("p", { className: "axds-error", children: [
1325
1587
  "当前版本 ",
1326
1588
  model.version,
1327
1589
  ",最低要求 ",
1328
1590
  model.minVersion,
1329
1591
  "。请先更新插件。"
1330
1592
  ] }) : 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,
1593
+ pending ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("p", { className: "axds-pending", role: "status", children: [
1594
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "axds-spin", "aria-hidden": "true" }),
1595
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: pending })
1596
+ ] }, "pending") : message ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: messageClass, role: "status", children: message }, message) : null,
1597
+ showForm ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("form", { className: "axds-card", onSubmit: onBind, children: [
1598
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "axds-field", children: [
1599
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "访问地址" }),
1600
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1601
+ import_dsh_client_ui_primitives5.Input,
1340
1602
  {
1341
1603
  className: "axds-input",
1342
1604
  value: endpoint,
@@ -1350,10 +1612,10 @@ function AuthinexPanel() {
1350
1612
  }
1351
1613
  )
1352
1614
  ] }),
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,
1615
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "axds-field", children: [
1616
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "密钥" }),
1617
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1618
+ import_dsh_client_ui_primitives5.Input,
1357
1619
  {
1358
1620
  className: "axds-input",
1359
1621
  value: key,
@@ -1367,31 +1629,31 @@ function AuthinexPanel() {
1367
1629
  }
1368
1630
  )
1369
1631
  ] }),
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: "绑定" })
1632
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "axds-actions", children: [
1633
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "axds-muted", children: "地址和密钥都由你填;插件本身不带任何地址或密钥。" }),
1634
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives5.Button, { type: "submit", variant: "primary", size: "md", disabled: disabled || key.trim() === "", children: "绑定" })
1373
1635
  ] }),
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: [
1636
+ model.endpoint ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "axds-actions", children: [
1637
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "axds-muted", children: [
1376
1638
  "本机还记着上次的地址 ",
1377
1639
  model.endpoint
1378
1640
  ] }),
1379
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { size: "sm", variant: "outline", disabled, onClick: () => {
1641
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives5.Button, { size: "sm", variant: "outline", disabled, onClick: () => {
1380
1642
  setConfirmUnbind(true);
1381
1643
  }, children: "解除绑定" })
1382
1644
  ] }) : null,
1383
- model.phase === "invalid" && model.endpoint ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "axds-muted", children: "升级不会作废这把密钥。把原来的密钥再贴一次,就会接回这台机器。" }) : null
1645
+ model.phase === "invalid" && model.endpoint ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "axds-muted", children: "升级不会作废这把密钥。把原来的密钥再贴一次,就会接回这台机器。" }) : null
1384
1646
  ] }) : 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: [
1647
+ model.user ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
1648
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "axds-row", children: [
1649
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: model.user.displayName }),
1650
+ model.endpoint ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "axds-muted", children: [
1389
1651
  "· ",
1390
1652
  model.endpoint
1391
1653
  ] }) : null
1392
1654
  ] }),
1393
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-tabs", role: "tablist", "aria-label": "配置分区", children: [
1394
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1655
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "axds-tabs", role: "tablist", "aria-label": "配置分区", children: [
1656
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1395
1657
  "button",
1396
1658
  {
1397
1659
  type: "button",
@@ -1402,7 +1664,7 @@ function AuthinexPanel() {
1402
1664
  children: "概览"
1403
1665
  }
1404
1666
  ),
1405
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1667
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
1406
1668
  "button",
1407
1669
  {
1408
1670
  type: "button",
@@ -1412,23 +1674,23 @@ function AuthinexPanel() {
1412
1674
  onClick: () => setTab("skills"),
1413
1675
  children: [
1414
1676
  "技能",
1415
- installed.length ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-tab-badge", children: installed.length }) : null
1677
+ installed.length ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "axds-tab-badge", children: installed.length }) : null
1416
1678
  ]
1417
1679
  }
1418
1680
  )
1419
1681
  ] }),
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: [
1682
+ tab === "overview" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
1683
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "axds-card", children: [
1684
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "axds-between", children: [
1685
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "axds-title", children: "可用功能" }),
1686
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "axds-muted", children: [
1425
1687
  model.tools.length,
1426
1688
  " 个工具"
1427
1689
  ] })
1428
1690
  ] }),
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: "当前角色没有可用工具。权限由运营台角色决定。" })
1691
+ 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
1692
  ] }),
1431
- model.user ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1693
+ model.user ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1432
1694
  WorkContextCard,
1433
1695
  {
1434
1696
  value: model.workContext,
@@ -1436,137 +1698,34 @@ function AuthinexPanel() {
1436
1698
  onSave: onSaveContext,
1437
1699
  onClear: onClearContext
1438
1700
  }
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 ? "可更新" : "最新" })
1701
+ ) : null
1702
+ ] }) : null,
1703
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1704
+ AccountsCard,
1705
+ {
1706
+ active: tab === "overview",
1707
+ accounts: model.accounts,
1708
+ disabled,
1709
+ busy,
1710
+ run,
1711
+ applyState,
1712
+ notify
1713
+ }
1714
+ ),
1715
+ tab === "overview" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
1716
+ model.update?.version ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "axds-card", children: [
1717
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "axds-between", children: [
1718
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "axds-title", children: model.update.available ? `新版本 ${model.update.version}` : `已是最新(${model.update.version})` }),
1719
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives5.Tag, { tone: model.update.available ? "info" : "success", children: model.update.available ? "可更新" : "最新" })
1561
1720
  ] }),
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: [
1721
+ model.update.notes ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "axds-muted", children: model.update.notes }) : null,
1722
+ model.update.sha ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("p", { className: "axds-muted", children: [
1564
1723
  "校验值 ",
1565
1724
  model.update.sha
1566
1725
  ] }) : 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: () => {
1726
+ model.update.available ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "axds-actions", children: [
1727
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "axds-muted", children: "更新由 DeepSeek 自己的安装器完成,装完要重启智能问答" }),
1728
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_dsh_client_ui_primitives5.Button, { size: "sm", variant: "primary", disabled, onClick: () => {
1570
1729
  setConfirmUpdate(true);
1571
1730
  }, children: [
1572
1731
  "更新到 ",
@@ -1574,23 +1733,23 @@ function AuthinexPanel() {
1574
1733
  ] })
1575
1734
  ] }) : null
1576
1735
  ] }) : null,
1577
- confirmUpdate ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-confirm", children: [
1578
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { children: [
1736
+ confirmUpdate ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "axds-confirm", children: [
1737
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { children: [
1579
1738
  "现在更新到 ",
1580
1739
  model.update?.version,
1581
1740
  "?装完需要重启智能问答。"
1582
1741
  ] }),
1583
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { size: "sm", variant: "outline", onClick: () => {
1742
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives5.Button, { size: "sm", variant: "outline", onClick: () => {
1584
1743
  setConfirmUpdate(false);
1585
1744
  }, children: "取消" }),
1586
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { size: "sm", variant: "primary", disabled, onClick: onApplyUpdate, children: "确认更新" })
1745
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives5.Button, { size: "sm", variant: "primary", disabled, onClick: onApplyUpdate, children: "确认更新" })
1587
1746
  ] }) : 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,
1747
+ restart ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "axds-notice", children: "已装好,重启智能问答后新版本才生效。" }) : null,
1748
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "axds-card", children: [
1749
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "axds-field", children: [
1750
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "新密钥" }),
1751
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1752
+ import_dsh_client_ui_primitives5.Input,
1594
1753
  {
1595
1754
  className: "axds-input",
1596
1755
  value: key,
@@ -1604,270 +1763,99 @@ function AuthinexPanel() {
1604
1763
  }
1605
1764
  )
1606
1765
  ] }),
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: "绑定这把密钥" })
1766
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "axds-actions", children: [
1767
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "axds-muted", children: "贴一把新密钥会重新兑换,运营台才会变成已绑定" }),
1768
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives5.Button, { size: "sm", variant: "primary", disabled: disabled || key.trim() === "", onClick: onRebind, children: "绑定这把密钥" })
1610
1769
  ] })
1611
1770
  ] }),
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 上的版本号" })
1771
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "axds-row", children: [
1772
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives5.Button, { size: "sm", disabled, onClick: onCheckUpdate, children: busy === "update" ? "检查中" : "检查更新" }),
1773
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "axds-muted", children: "服务端有更新清单就走清单,没有就比 npm 上的版本号" })
1615
1774
  ] })
1616
1775
  ] }) : 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: () => {
1776
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1777
+ SkillsTab,
1778
+ {
1779
+ active: tab === "skills",
1780
+ disabled,
1781
+ userReady: model.user !== null,
1782
+ skillsOnline: model.skillsOnline,
1783
+ installed,
1784
+ refreshKey: skillRefresh,
1785
+ applyState
1786
+ },
1787
+ model.user ? "signed-in" : "signed-out"
1788
+ ),
1789
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "axds-row", children: [
1790
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives5.Button, { size: "sm", variant: "outline", disabled, onClick: () => {
1803
1791
  setConfirmUnbind(true);
1804
1792
  }, children: "解除绑定" }),
1805
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-muted", children: "解除后地址和密钥都会清掉,要重新填" })
1793
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "axds-muted", children: "解除后地址和密钥都会清掉,要重新填" })
1806
1794
  ] })
1807
1795
  ] }) : 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: () => {
1796
+ confirmUnbind ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "axds-confirm", children: [
1797
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "确认解除这台设备的绑定?" }),
1798
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives5.Button, { size: "sm", variant: "outline", onClick: () => {
1811
1799
  setConfirmUnbind(false);
1812
1800
  }, children: "取消" }),
1813
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { size: "sm", variant: "primary", disabled, onClick: onUnbind, children: "确认解除" })
1801
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives5.Button, { size: "sm", variant: "primary", disabled, onClick: onUnbind, children: "确认解除" })
1814
1802
  ] }) : null,
1815
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("footer", { className: "axds-foot", children: [
1816
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { children: [
1803
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("footer", { className: "axds-foot", children: [
1804
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { children: [
1817
1805
  "v",
1818
1806
  model.version || "0.1.0"
1819
1807
  ] }),
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 })
1808
+ model.endpoint ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
1809
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "·" }),
1810
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: model.endpoint })
1823
1811
  ] }) : null
1824
1812
  ] })
1825
1813
  ] });
1826
1814
  }
1827
1815
 
1828
- // src/command-card.tsx
1829
- var import_jsx_runtime5 = require("react/jsx-runtime");
1816
+ // src/work/command-card.tsx
1817
+ var import_jsx_runtime7 = require("react/jsx-runtime");
1830
1818
  function AxContextCommandCard(props) {
1831
1819
  const outcome = props.node?.outcome;
1832
1820
  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: "正在设置…" })
1821
+ 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: [
1822
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "axds-cmd-title", children: "工作上下文" }),
1823
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "axds-muted", children: "正在设置…" })
1836
1824
  ] }) });
1837
1825
  }
1838
1826
  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: "没设成" })
1827
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "axds-cmd", "data-state": "error", children: [
1828
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "axds-cmd-head", children: [
1829
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "axds-cmd-title", children: "工作上下文" }),
1830
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "axds-cmd-mark", "data-mark": "bad", children: "没设成" })
1843
1831
  ] }),
1844
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "axds-cmd-note axds-error", children: outcome.text })
1832
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "axds-cmd-note axds-error", children: outcome.text })
1845
1833
  ] });
1846
1834
  }
1847
1835
  const receipt = parseReceiptText(outcome.text || "");
1848
1836
  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: "已生效" })
1837
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "axds-cmd", "data-state": "ok", children: [
1838
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "axds-cmd-head", children: [
1839
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "axds-cmd-title", children: "工作上下文" }),
1840
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "axds-cmd-mark", "data-mark": "ok", children: "已生效" })
1853
1841
  ] }),
1854
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "axds-cmd-note axds-muted", children: outcome.text })
1842
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "axds-cmd-note axds-muted", children: outcome.text })
1855
1843
  ] });
1856
1844
  }
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: "已生效" })
1845
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "axds-cmd", "data-state": "ok", children: [
1846
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "axds-cmd-head", children: [
1847
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "axds-cmd-title", children: "工作上下文" }),
1848
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "axds-cmd-mark", "data-mark": "ok", children: "已生效" })
1861
1849
  ] }),
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 })
1850
+ /* @__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: [
1851
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: field.label }),
1852
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("b", { children: field.value })
1865
1853
  ] }, `${field.label}:${field.value}`)) }),
1866
- receipt.note ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "axds-cmd-note axds-muted", children: receipt.note }) : null
1854
+ receipt.note ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "axds-cmd-note axds-muted", children: receipt.note }) : null
1867
1855
  ] });
1868
1856
  }
1869
1857
 
1870
- // src/styles.ts
1858
+ // src/client/styles.ts
1871
1859
  var CSS = `
1872
1860
  .axds{display:flex;flex-direction:column;gap:12px;color:var(--dsw-alias-label-primary);font-size:13px;line-height:1.5}
1873
1861
  .axds-head{display:flex;align-items:center;gap:8px}
@@ -1990,7 +1978,7 @@ function installClientStyles() {
1990
1978
  };
1991
1979
  }
1992
1980
 
1993
- // src/client.tsx
1981
+ // src/client/client.tsx
1994
1982
  var CLIENT_ID = PACKAGE_NAME;
1995
1983
  function install() {
1996
1984
  return {
@@ -2003,7 +1991,6 @@ function install() {
2003
1991
  ctx.slots.inject(slot, () => ctx.slots.register({ name: slot, key }, AuthinexPanel));
2004
1992
  };
2005
1993
  contribute("plugins.bundle.config", PACKAGE_NAME);
2006
- contribute("plugins.row.config", ROW_KEY);
2007
1994
  try {
2008
1995
  ctx.slots.inject("conversation.chat.commandview", () => ctx.slots.register(
2009
1996
  { name: "conversation.chat.commandview", key: "ax-context" },