@authinex/dsh-plugin 0.3.8 → 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,64 +28,11 @@ __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");
34
-
35
- // src/account-wire.ts
36
- function textOf(data, fallback) {
37
- const message = typeof data.message === "string" ? data.message.trim() : "";
38
- if (message) return message;
39
- const detail = typeof data.detail === "string" ? data.detail.trim() : "";
40
- if (detail) return detail;
41
- return fallback;
42
- }
43
-
44
- // src/account-options.ts
45
- var CURRENT_PREFIX = "当前值 ";
46
- function withCurrent(rows, value, items, label = "") {
47
- if (value && !items.some((item) => item.uuid === value)) {
48
- const named = label.trim();
49
- rows.push({ uuid: value, name: named && !named.startsWith(CURRENT_PREFIX) ? named : `${CURRENT_PREFIX}${value}` });
50
- }
51
- return rows;
52
- }
53
- function optionLabel(items, uuid) {
54
- if (!uuid) return "";
55
- const row = items.find((item) => item.uuid === uuid);
56
- if (!row || row.name.startsWith(CURRENT_PREFIX)) return "";
57
- return row.name;
58
- }
59
- function pickedName(items, uuid, previousId, previousName) {
60
- return optionLabel(items, uuid) || (uuid && uuid === previousId ? previousName : "");
61
- }
62
- function onesSelectRows(input) {
63
- const { field, draft, projects, types, busy } = input;
64
- const value = draft[field.name] ?? "";
65
- const project = draft.defaultProjectUuid ?? "";
66
- const label = field.name === "defaultIssueTypeId" ? draft.defaultIssueTypeName ?? "" : draft.defaultProjectName ?? "";
67
- if (field.name !== "defaultIssueTypeId") {
68
- const rows2 = [{
69
- uuid: "",
70
- name: busy === "projects" ? "正在拉取项目…" : "— 请选择项目 —"
71
- }];
72
- for (const item of projects.items) rows2.push(item);
73
- return { disabled: busy === "projects", rows: withCurrent(rows2, value, projects.items, label) };
74
- }
75
- if (!project) return { disabled: true, rows: [{ uuid: "", name: "先选择默认项目" }] };
76
- if (busy === "types" || types.forProject !== project) {
77
- return { disabled: true, rows: [{ uuid: "", name: "正在拉取工单类型…" }] };
78
- }
79
- if (types.message) {
80
- const rows2 = [{ uuid: "", name: types.message }];
81
- return { disabled: false, rows: withCurrent(rows2, value, types.items, label) };
82
- }
83
- const rows = [{ uuid: "", name: "— 请选择工单类型 —" }];
84
- for (const item of types.items) rows.push(item);
85
- return { disabled: false, rows: withCurrent(rows, value, types.items, label) };
86
- }
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");
87
34
 
88
- // src/endpoint.ts
35
+ // src/session/endpoint.ts
89
36
  function checkEndpoint(raw) {
90
37
  const text = String(raw || "").trim();
91
38
  if (text === "") return "请填写访问地址";
@@ -101,7 +48,7 @@ function checkEndpoint(raw) {
101
48
  return "";
102
49
  }
103
50
 
104
- // src/key.ts
51
+ // src/session/key.ts
105
52
  var CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
106
53
  function foldChar(ch) {
107
54
  if (ch === "O") return "0";
@@ -135,7 +82,101 @@ function parseKey(raw) {
135
82
  };
136
83
  }
137
84
 
138
- // src/platform-icon.tsx
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");
119
+
120
+ // src/accounts/account-wire.ts
121
+ function textOf(data, fallback) {
122
+ const message = typeof data.message === "string" ? data.message.trim() : "";
123
+ if (message) return message;
124
+ const detail = typeof data.detail === "string" ? data.detail.trim() : "";
125
+ if (detail) return detail;
126
+ return fallback;
127
+ }
128
+
129
+ // src/accounts/account-options.ts
130
+ var CURRENT_PREFIX = "当前值 ";
131
+ var NAME_KEY = {
132
+ defaultProjectUuid: "defaultProjectName",
133
+ defaultIssueTypeId: "defaultIssueTypeName",
134
+ planIssueTypeId: "planIssueTypeName"
135
+ };
136
+ function withCurrent(rows, value, items, label = "") {
137
+ if (value && !items.some((item) => item.uuid === value)) {
138
+ const named = label.trim();
139
+ rows.push({ uuid: value, name: named && !named.startsWith(CURRENT_PREFIX) ? named : `${CURRENT_PREFIX}${value}` });
140
+ }
141
+ return rows;
142
+ }
143
+ function optionLabel(items, uuid) {
144
+ if (!uuid) return "";
145
+ const row = items.find((item) => item.uuid === uuid);
146
+ if (!row || row.name.startsWith(CURRENT_PREFIX)) return "";
147
+ return row.name;
148
+ }
149
+ function pickedName(items, uuid, previousId, previousName) {
150
+ return optionLabel(items, uuid) || (uuid && uuid === previousId ? previousName : "");
151
+ }
152
+ function onesSelectRows(input) {
153
+ const { field, draft, projects, types, busy } = input;
154
+ const value = draft[field.name] ?? "";
155
+ const project = draft.defaultProjectUuid ?? "";
156
+ const label = draft[NAME_KEY[field.name] ?? ""] ?? "";
157
+ if (field.name === "defaultProjectUuid") {
158
+ const rows2 = [{
159
+ uuid: "",
160
+ name: busy === "projects" ? "正在拉取项目…" : "— 请选择项目 —"
161
+ }];
162
+ for (const item of projects.items) rows2.push(item);
163
+ return { disabled: busy === "projects", rows: withCurrent(rows2, value, projects.items, label) };
164
+ }
165
+ if (!project) return { disabled: true, rows: [{ uuid: "", name: "先选择默认项目" }] };
166
+ if (busy === "types" || types.forProject !== project) {
167
+ const rows2 = [{ uuid: "", name: "正在拉取工单类型…" }];
168
+ return { disabled: true, rows: withCurrent(rows2, value, [], label) };
169
+ }
170
+ if (types.message) {
171
+ const rows2 = [{ uuid: "", name: types.message }];
172
+ return { disabled: false, rows: withCurrent(rows2, value, types.items, label) };
173
+ }
174
+ const rows = [{ uuid: "", name: "— 请选择工单类型 —" }];
175
+ for (const item of types.items) rows.push(item);
176
+ return { disabled: false, rows: withCurrent(rows, value, types.items, label) };
177
+ }
178
+
179
+ // src/accounts/platform-icon.tsx
139
180
  var import_jsx_runtime = require("react/jsx-runtime");
140
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";
141
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";
@@ -159,11 +200,7 @@ function PlatformIcon({ id }) {
159
200
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { className: "axds-logo", src, alt: "", width: 16, height: 16 });
160
201
  }
161
202
 
162
- // src/skill-import.tsx
163
- var import_react = require("react");
164
- var import_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
165
-
166
- // src/phrases.ts
203
+ // src/shared/phrases.ts
167
204
  var PHRASES = {
168
205
  unbound: "填写访问地址和密钥完成绑定",
169
206
  binding: "正在验证密钥",
@@ -181,7 +218,7 @@ function phrase(phase) {
181
218
  return PHRASES.unbound;
182
219
  }
183
220
 
184
- // src/tools.ts
221
+ // src/tools/tools.ts
185
222
  var TOOLS = {
186
223
  search_kb: {
187
224
  title: "咨询问题",
@@ -202,10 +239,12 @@ var TOOLS = {
202
239
  title: "查询工单",
203
240
  timeoutMs: 3e4,
204
241
  description: `按单号查 ONES、氚云或 PMO。没有可用账号的那一家不要编造单号。
242
+ 13 位氚云流水号查氚云原单;要查 ONES 上同步过去的缺陷,system 填 ones,或把流水号放进 h3yunSeqNo。不要把它当成 ONES 编号。
205
243
  已知单号才用它;按条件筛用 search_tickets。${DATA_NOT_INSTRUCTION}`,
206
244
  parameters: {
207
- number: { type: "string", description: "工单号" },
245
+ number: { type: "string", description: "工单号。13 位氚云流水号配 system=ones 时查 ONES 同步缺陷。" },
208
246
  system: { type: "string", description: "ones、h3yun 或 pmo" },
247
+ h3yunSeqNo: { type: "string", description: "氚云工单流水号。只查 ONES 上这个字段,不查氚云原单。" },
209
248
  keyword: { type: "string", description: "没有单号时按标题筛" }
210
249
  }
211
250
  },
@@ -276,19 +315,27 @@ var TOOLS = {
276
315
  },
277
316
  create_ticket: {
278
317
  title: "创建工单",
279
- timeoutMs: 6e4,
280
- description: `起草 ONES、氚云或 PMO 工单。必须先让用户在确认卡上点创建,取消后不要用同一草稿再提。${DATA_NOT_INSTRUCTION}`,
318
+ // 建单本身要跑一串 ONES 往返(登录、字段字典、add3);带附件还要再申请上传、
319
+ // 传完回写 <figure>,60 秒装不下,超时会让单子看起来"没建成",人就会重提。
320
+ timeoutMs: 18e4,
321
+ description: `起草 ONES、氚云或 PMO 工单。提交用的是已经保存的个人账号,不要向用户要邮箱、密码或 Token。用户说了版本就把原话放进 version,ONES 写入「发现版本-云枢」,没说就留空。用户附了图片或文件时,把对话里给出的只读路径放进 attachments,一行一个。必须先让用户在确认卡上点创建,取消后不要用同一草稿再提。${DATA_NOT_INSTRUCTION}`,
281
322
  parameters: {
282
323
  system: { type: "string", required: true, description: "ones、h3yun 或 pmo" },
283
324
  title: { type: "string", required: true, description: "标题" },
284
325
  description: { type: "string", required: true, description: "描述" },
285
- version: { type: "string", description: "产品版本" },
286
- customer: { type: "string", description: "客户" }
326
+ version: { type: "string", description: "ONES「发现版本-云枢」。用户说了才填,按原话,如 AI-Platform-v2.1。没说留空。" },
327
+ attachments: { type: "string", description: "对话里图片或文件的只读路径,一行一个。没有就留空,不要编路径。" },
328
+ customer: { type: "string", description: "客户。PMO 要客户全称。" },
329
+ ticketType: { type: "string", description: "氚云工单类型:需求、缺陷或咨询。没说留空。" },
330
+ serviceType: { type: "string", description: "PMO 服务单类型。没说留空,系统按问题单。" },
331
+ product: { type: "string", description: "PMO 产品类型,如云枢。没说留空。" },
332
+ issueType: { type: "string", description: "PMO 问题类型:产品问题、技术问题或其他问题。没说留空。" },
333
+ priority: { type: "string", description: "优先级。PMO 用高、中、底。没说留空。" }
287
334
  }
288
335
  }
289
336
  };
290
337
 
291
- // src/work-context.ts
338
+ // src/work/work-context.ts
292
339
  var PRODUCT_KINDS = [
293
340
  { id: "yunshu", label: "云枢" },
294
341
  { id: "report", label: "报表" },
@@ -317,10 +364,8 @@ function parseReceiptText(text) {
317
364
  return { fields, note: lines.slice(1).join("\n") };
318
365
  }
319
366
 
320
- // src/view.ts
367
+ // src/shared/view.ts
321
368
  var PACKAGE_NAME = "@authinex/dsh-plugin";
322
- var ROW_ID = "authinex-host";
323
- var ROW_KEY = `${PACKAGE_NAME}#${ROW_ID}`;
324
369
  var SKILL_HOT_MIN = 5;
325
370
  function skillUseCount(row) {
326
371
  const n = Number(row.usage?.count);
@@ -366,7 +411,8 @@ var ACCOUNT_FIELDS = {
366
411
  { name: "baseUrl", title: "地址(可空)" },
367
412
  { name: "token", title: "密码或 API Token", type: "password" },
368
413
  { name: "defaultProjectUuid", title: "默认项目" },
369
- { name: "defaultIssueTypeId", title: "缺陷工单类型" }
414
+ { name: "defaultIssueTypeId", title: "缺陷工单类型" },
415
+ { name: "planIssueTypeId", title: "规划项工单类型" }
370
416
  ],
371
417
  h3yun: [
372
418
  { name: "username", title: "手机号" },
@@ -463,7 +509,8 @@ function viewModel(state) {
463
509
  fields: accountFields(id, row),
464
510
  extras: id === "ones" ? {
465
511
  defaultProjectName: fieldValue(row, "defaultProjectName"),
466
- defaultIssueTypeName: fieldValue(row, "defaultIssueTypeName")
512
+ defaultIssueTypeName: fieldValue(row, "defaultIssueTypeName"),
513
+ planIssueTypeName: fieldValue(row, "planIssueTypeName")
467
514
  } : {}
468
515
  };
469
516
  }) : [];
@@ -540,78 +587,407 @@ function pageCount(total, pageSize = SKILL_PAGE_SIZE) {
540
587
  return Math.max(1, Math.ceil(total / pageSize));
541
588
  }
542
589
 
543
- // src/skill-import.tsx
590
+ // src/accounts/panel-accounts.tsx
544
591
  var import_jsx_runtime2 = require("react/jsx-runtime");
545
- var MAX_CHARS = 2e4;
546
- function SkillImport({
547
- disabled,
548
- onSubmit
549
- }) {
550
- const fileRef = (0, import_react.useRef)(null);
551
- const [open, setOpen] = (0, import_react.useState)(false);
552
- const [name, setName] = (0, import_react.useState)("");
553
- const [kind, setKind] = (0, import_react.useState)("general");
554
- const [markdown, setMarkdown] = (0, import_react.useState)("");
555
- const [localError, setLocalError] = (0, import_react.useState)("");
556
- const pickFile = () => {
557
- fileRef.current?.click();
558
- };
559
- const onFile = (file) => {
560
- if (!file) return;
561
- if (file.size > MAX_CHARS * 4) {
562
- setLocalError("这个文件太大,请控制在两万字以内");
563
- 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);
564
639
  }
565
- const reader = new FileReader();
566
- reader.onload = () => {
567
- const text = String(reader.result || "");
568
- if (text.length > MAX_CHARS) {
569
- setLocalError("这篇超过两万字,缩短后再提交");
570
- return;
571
- }
572
- setMarkdown(text);
573
- setLocalError("");
574
- if (!name.trim()) {
575
- const heading = text.split("\n").find((line) => line.startsWith("# "));
576
- if (heading) setName(heading.replace(/^#\s+/, "").trim().slice(0, 200));
577
- }
578
- };
579
- reader.onerror = () => {
580
- setLocalError("没有读到这个文件");
581
- };
582
- reader.readAsText(file);
583
- };
584
- const onForm = (event) => {
585
- event.preventDefault();
586
- const text = markdown.trim();
587
- if (!text) {
588
- 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);
589
646
  return;
590
647
  }
591
- if (text.length > MAX_CHARS) {
592
- 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("");
593
675
  return;
594
676
  }
595
- setLocalError("");
596
- void onSubmit({ markdown: text, name: name.trim(), skillKind: kind }).then((ok) => {
597
- if (!ok) return;
598
- setName("");
599
- setKind("general");
600
- setMarkdown("");
601
- setOpen(false);
602
- });
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
+ }
603
687
  };
604
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "axds-import", children: [
605
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "axds-actions", children: [
606
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "axds-muted", children: "提交后先待审核,通过后其他用户才能装和使用" }),
607
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives.Button, { size: "sm", variant: "outline", disabled, onClick: () => {
608
- setOpen((value) => !value);
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);
609
985
  }, children: open ? "收起" : "导入个人技能" })
610
986
  ] }),
611
- open ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("form", { className: "axds-import-form", onSubmit: onForm, children: [
612
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "axds-field", children: [
613
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "技能名(可空,空则用正文标题)" }),
614
- /* @__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)(
615
991
  "input",
616
992
  {
617
993
  className: "axds-plain",
@@ -626,9 +1002,9 @@ function SkillImport({
626
1002
  }
627
1003
  )
628
1004
  ] }),
629
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "axds-field", children: [
630
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "用途" }),
631
- /* @__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)(
632
1008
  "select",
633
1009
  {
634
1010
  className: "axds-select",
@@ -637,13 +1013,13 @@ function SkillImport({
637
1013
  onChange: (event) => {
638
1014
  setKind(event.target.value);
639
1015
  },
640
- 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))
641
1017
  }
642
1018
  )
643
1019
  ] }),
644
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "axds-field", children: [
645
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "SKILL.md" }),
646
- /* @__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)(
647
1023
  "textarea",
648
1024
  {
649
1025
  className: "axds-textarea",
@@ -658,7 +1034,7 @@ function SkillImport({
658
1034
  }
659
1035
  )
660
1036
  ] }),
661
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1037
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
662
1038
  "input",
663
1039
  {
664
1040
  ref: fileRef,
@@ -671,39 +1047,300 @@ function SkillImport({
671
1047
  }
672
1048
  }
673
1049
  ),
674
- localError ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "axds-error", role: "status", children: localError }) : null,
675
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "axds-actions", children: [
676
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives.Button, { size: "sm", variant: "ghost", type: "button", disabled, onClick: pickFile, children: "选择文件" }),
677
- /* @__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: "提交审核" })
678
1054
  ] })
679
1055
  ] }) : null
680
1056
  ] });
681
1057
  }
682
1058
 
683
- // src/work-context-card.tsx
684
- var import_react2 = require("react");
685
- var import_dsh_client_ui_primitives2 = require("@deepseek-ai/dsh-client-ui-primitives");
686
- 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");
687
1324
  function WorkContextCard(props) {
688
- const [productKind, setProductKind] = (0, import_react2.useState)(props.value.productKind);
689
- const [version, setVersion] = (0, import_react2.useState)(props.value.version);
690
- const [customer, setCustomer] = (0, import_react2.useState)(props.value.customer);
691
- (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)(() => {
692
1329
  setProductKind(props.value.productKind);
693
1330
  setVersion(props.value.version);
694
1331
  setCustomer(props.value.customer);
695
1332
  }, [props.value.productKind, props.value.version, props.value.customer]);
696
1333
  const shownKind = labelOf(productKind);
697
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "axds-card", children: [
698
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "axds-between", children: [
699
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "axds-title", children: "工作上下文" }),
700
- /* @__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: "没填的版本和产品线,调用工具时补上" })
701
1338
  ] }),
702
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "axds-fields", children: [
703
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "axds-field", children: [
704
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: "产品线" }),
705
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
706
- 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,
707
1344
  {
708
1345
  className: "axds-input",
709
1346
  value: shownKind,
@@ -716,10 +1353,10 @@ function WorkContextCard(props) {
716
1353
  }
717
1354
  )
718
1355
  ] }),
719
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "axds-field", children: [
720
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: "版本" }),
721
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
722
- 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,
723
1360
  {
724
1361
  className: "axds-input",
725
1362
  value: version,
@@ -733,10 +1370,10 @@ function WorkContextCard(props) {
733
1370
  }
734
1371
  )
735
1372
  ] }),
736
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "axds-field", children: [
737
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: "客户" }),
738
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
739
- 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,
740
1377
  {
741
1378
  className: "axds-input",
742
1379
  value: customer,
@@ -751,11 +1388,11 @@ function WorkContextCard(props) {
751
1388
  )
752
1389
  ] })
753
1390
  ] }),
754
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "axds-actions", children: [
755
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "axds-muted", children: "也可以在对话里用 /ax-context 云枢 8.7 某客户 要问的问题" }),
756
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives2.Button, { size: "sm", variant: "ghost", disabled: props.disabled, onClick: props.onClear, children: "清空" }),
757
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
758
- 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,
759
1396
  {
760
1397
  size: "sm",
761
1398
  variant: "primary",
@@ -770,179 +1407,63 @@ function WorkContextCard(props) {
770
1407
  ] });
771
1408
  }
772
1409
 
773
- // src/panel.tsx
774
- var import_jsx_runtime4 = require("react/jsx-runtime");
775
- var HEADERS = { "x-authinex-ds": "1" };
776
- async function api(path, init) {
777
- const response = await fetch(path, {
778
- method: init?.method || "GET",
779
- headers: init?.body === void 0 ? HEADERS : { ...HEADERS, "content-type": "application/json" },
780
- body: init?.body === void 0 ? void 0 : JSON.stringify(init.body)
781
- });
782
- const text = await response.text();
783
- if (!text) return {};
784
- try {
785
- return JSON.parse(text);
786
- } catch {
787
- return {};
788
- }
789
- }
790
- function dwell(ms = 450) {
791
- return new Promise((resolve) => setTimeout(resolve, ms));
792
- }
793
- function tagTone(state) {
794
- if (state === "ready") return "success";
795
- if (state === "read_only") return "info";
796
- if (state === "disabled") return "neutral";
797
- return "outline";
798
- }
799
- function draftOf(account) {
800
- const draft = { ...account.extras };
801
- for (const field of account.fields) draft[field.name] = field.value;
802
- return draft;
803
- }
804
- function saveTextFile(name, text) {
805
- const blob = new Blob([text], { type: "text/markdown;charset=utf-8" });
806
- const url = URL.createObjectURL(blob);
807
- const anchor = document.createElement("a");
808
- anchor.href = url;
809
- anchor.download = name;
810
- document.body.appendChild(anchor);
811
- anchor.click();
812
- anchor.remove();
813
- setTimeout(() => URL.revokeObjectURL(url), 0);
814
- }
815
- var SKILL_EMPTY = {
816
- items: [],
817
- total: 0,
818
- page: 1,
819
- pageSize: SKILL_PAGE_SIZE,
820
- q: "",
821
- status: "approved",
822
- message: "",
823
- loaded: false
824
- };
1410
+ // src/panel/panel.tsx
1411
+ var import_jsx_runtime6 = require("react/jsx-runtime");
825
1412
  function AuthinexPanel() {
826
- const [state, setState] = (0, import_react3.useState)(null);
827
- const [loaded, setLoaded] = (0, import_react3.useState)(false);
828
- const [busy, setBusy] = (0, import_react3.useState)("");
829
- const [notice, setNotice] = (0, import_react3.useState)("");
830
- const [localError, setLocalError] = (0, import_react3.useState)("");
831
- const [endpoint, setEndpoint] = (0, import_react3.useState)("");
832
- const [key, setKey] = (0, import_react3.useState)("");
833
- const [open, setOpen] = (0, import_react3.useState)("");
834
- const [drafts, setDrafts] = (0, import_react3.useState)({});
835
- const [confirmUnbind, setConfirmUnbind] = (0, import_react3.useState)(false);
836
- const [confirmUpdate, setConfirmUpdate] = (0, import_react3.useState)(false);
837
- const [restart, setRestart] = (0, import_react3.useState)(false);
838
- const [feedback, setFeedback] = (0, import_react3.useState)("");
839
- const [tab, setTab] = (0, import_react3.useState)("overview");
840
- const [accountsOpen, setAccountsOpen] = (0, import_react3.useState)(false);
841
- const [skillView, setSkillView] = (0, import_react3.useState)(SKILL_EMPTY);
842
- const [skillDraftQ, setSkillDraftQ] = (0, import_react3.useState)("");
843
- const [skillOpen, setSkillOpen] = (0, import_react3.useState)(0);
844
- const [skillBusy, setSkillBusy] = (0, import_react3.useState)("");
845
- const [skillNotice, setSkillNotice] = (0, import_react3.useState)("");
846
- const [skillFeedback, setSkillFeedback] = (0, import_react3.useState)("");
847
- const [accountMsg, setAccountMsg] = (0, import_react3.useState)({});
848
- const [onesProjects, setOnesProjects] = (0, import_react3.useState)({ items: [], message: "", loaded: false });
849
- const [onesTypes, setOnesTypes] = (0, import_react3.useState)({ items: [], message: "", forProject: "" });
850
- const [optionsBusy, setOptionsBusy] = (0, import_react3.useState)("");
851
- const projectTicket = (0, import_react3.useRef)(0);
852
- const typeTicket = (0, import_react3.useRef)(0);
853
- const model = (0, import_react3.useMemo)(() => viewModel(state || void 0), [state]);
854
- 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) => {
855
1428
  setState(next);
856
1429
  }, []);
857
- const read = (0, import_react3.useCallback)(async () => {
1430
+ const read = (0, import_react5.useCallback)(async () => {
858
1431
  try {
859
1432
  applyState(await api("/authinex-ds/state"));
860
1433
  return true;
861
1434
  } catch {
862
1435
  setState({ phase: "unreachable" });
863
- return false;
864
- } finally {
865
- setLoaded(true);
866
- }
867
- }, [applyState]);
868
- (0, import_react3.useEffect)(() => {
869
- void read();
870
- }, [read]);
871
- (0, import_react3.useEffect)(() => {
872
- if (model.endpoint) setEndpoint((prev) => prev || model.endpoint);
873
- }, [model.endpoint]);
874
- const run = (0, import_react3.useCallback)(async (label, work) => {
875
- setBusy(label);
876
- setNotice("");
877
- setLocalError("");
878
- setFeedback("");
879
- try {
880
- await work();
881
- } catch {
882
- setState({ phase: "unreachable" });
883
- if (label === "refresh") setNotice("没有刷新到");
884
- if (label === "update") setNotice("没有查到更新");
885
- if (label === "refresh" || label === "update") setFeedback("error");
886
- } finally {
887
- setBusy("");
888
- }
889
- }, []);
890
- const loadOnesProjects = (0, import_react3.useCallback)(async (form) => {
891
- const ticket = ++projectTicket.current;
892
- setOnesProjects((prev) => ({ ...prev, message: "" }));
893
- setOptionsBusy("projects");
894
- try {
895
- const body = await api("/authinex-ds/accounts/options", {
896
- method: "POST",
897
- body: { provider: "ones", kind: "projects", form }
898
- });
899
- if (ticket !== projectTicket.current) return;
900
- const ok = body.ok === true;
901
- const items = Array.isArray(body.projects) ? body.projects : [];
902
- const reason = textOf(body, "");
903
- setOnesProjects({
904
- items,
905
- message: ok ? items.length ? "" : reason || "这个账号下没有可选项目" : reason || "没有拉到项目",
906
- loaded: true
907
- });
908
- } catch {
909
- if (ticket !== projectTicket.current) return;
910
- setOnesProjects({ items: [], message: "没有拉到项目", loaded: true });
911
- } finally {
912
- if (ticket === projectTicket.current) setOptionsBusy((prev) => prev === "projects" ? "" : prev);
913
- }
914
- }, []);
915
- const loadOnesTypes = (0, import_react3.useCallback)(async (project, form) => {
916
- if (!project) {
917
- typeTicket.current += 1;
918
- setOnesTypes({ items: [], message: "", forProject: "" });
919
- setOptionsBusy((prev) => prev === "types" ? "" : prev);
920
- return;
1436
+ return false;
1437
+ } finally {
1438
+ setLoaded(true);
921
1439
  }
922
- const ticket = ++typeTicket.current;
923
- setOnesTypes({ items: [], message: "", forProject: "" });
924
- 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("");
925
1452
  try {
926
- const body = await api("/authinex-ds/accounts/options", {
927
- method: "POST",
928
- body: { provider: "ones", kind: "issueTypes", project, form }
929
- });
930
- if (ticket !== typeTicket.current) return;
931
- const ok = body.ok === true;
932
- const items = Array.isArray(body.issueTypes) ? body.issueTypes : [];
933
- const reason = textOf(body, "");
934
- setOnesTypes({
935
- items,
936
- message: ok ? items.length ? "" : reason || "这个项目下没有工单类型" : reason || "没有拉到工单类型",
937
- forProject: project
938
- });
1453
+ await work();
939
1454
  } catch {
940
- if (ticket !== typeTicket.current) return;
941
- 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");
942
1459
  } finally {
943
- if (ticket === typeTicket.current) setOptionsBusy((prev) => prev === "types" ? "" : prev);
1460
+ setBusy("");
944
1461
  }
945
1462
  }, []);
1463
+ const notify = (0, import_react5.useCallback)((text, tone) => {
1464
+ setNotice(text);
1465
+ if (tone) setFeedback(tone);
1466
+ }, []);
946
1467
  const onBind = (event) => {
947
1468
  event.preventDefault();
948
1469
  const url = endpoint.trim();
@@ -987,167 +1508,10 @@ function AuthinexPanel() {
987
1508
  void run("unbind", async () => {
988
1509
  const body = await api("/authinex-ds/unbind", { method: "POST" });
989
1510
  applyState(body);
990
- setOpen("");
991
- setDrafts({});
992
1511
  setEndpoint("");
993
- setSkillView(SKILL_EMPTY);
994
- setAccountMsg({});
995
- setOnesProjects({ items: [], message: "", loaded: false });
996
- setOnesTypes({ items: [], message: "", forProject: "" });
997
1512
  setNotice("已解除绑定,地址和密钥都清掉了");
998
1513
  });
999
1514
  };
1000
- const toggleAccount = (account) => {
1001
- if (open === account.id) {
1002
- setOpen("");
1003
- return;
1004
- }
1005
- setOpen(account.id);
1006
- setDrafts((prev) => prev[account.id] ? prev : { ...prev, [account.id]: draftOf(account) });
1007
- if (account.id === "ones") {
1008
- setOnesTypes({ items: [], message: "", forProject: "" });
1009
- const form = drafts.ones || draftOf(account);
1010
- void (async () => {
1011
- await loadOnesProjects(form);
1012
- if (form.defaultProjectUuid) await loadOnesTypes(form.defaultProjectUuid, form);
1013
- })();
1014
- }
1015
- };
1016
- const setField = (account, name, value) => {
1017
- setDrafts((prev) => ({
1018
- ...prev,
1019
- [account.id]: { ...prev[account.id] || draftOf(account), [name]: value }
1020
- }));
1021
- };
1022
- const onOnesSelect = (account, name, value) => {
1023
- const base = { ...drafts[account.id] || draftOf(account) };
1024
- if (name === "defaultProjectUuid") {
1025
- const previousId = base.defaultProjectUuid || "";
1026
- const previousName = base.defaultProjectName || "";
1027
- base.defaultProjectUuid = value;
1028
- base.defaultProjectName = pickedName(onesProjects.items, value, previousId, previousName);
1029
- if (value !== previousId) {
1030
- base.defaultIssueTypeId = "";
1031
- base.defaultIssueTypeName = "";
1032
- }
1033
- } else if (name === "defaultIssueTypeId") {
1034
- const previousId = base.defaultIssueTypeId || "";
1035
- const previousName = base.defaultIssueTypeName || "";
1036
- base.defaultIssueTypeId = value;
1037
- base.defaultIssueTypeName = pickedName(onesTypes.items, value, previousId, previousName);
1038
- } else {
1039
- base[name] = value;
1040
- }
1041
- setDrafts((prev) => ({ ...prev, [account.id]: base }));
1042
- if (name === "defaultProjectUuid") void loadOnesTypes(value, base);
1043
- };
1044
- const onFetchOnes = (account) => {
1045
- const form = drafts[account.id] || draftOf(account);
1046
- void (async () => {
1047
- await loadOnesProjects(form);
1048
- if ((form.defaultProjectUuid || "").trim()) await loadOnesTypes(form.defaultProjectUuid, form);
1049
- })();
1050
- };
1051
- const onToggleEnabled = (account, next) => {
1052
- void run(`enabled:${account.id}`, async () => {
1053
- const body = await api("/authinex-ds/accounts/enabled", {
1054
- method: "POST",
1055
- body: { provider: account.id, enabled: next }
1056
- });
1057
- if (body.state) applyState(body.state);
1058
- setNotice(`${account.label}:${String(body.message || (next ? "已启用" : "已停用"))}`);
1059
- });
1060
- };
1061
- const onTest = (account) => {
1062
- const form = drafts[account.id] || draftOf(account);
1063
- setAccountMsg((prev) => ({ ...prev, [account.id]: { text: `${account.label}:正在测试连接…`, tone: "pending" } }));
1064
- void run(`test:${account.id}`, async () => {
1065
- let body;
1066
- try {
1067
- body = await api("/authinex-ds/accounts/test", {
1068
- method: "POST",
1069
- body: { provider: account.id, form }
1070
- });
1071
- } catch {
1072
- const text2 = `${account.label}:没有连上,稍后再试`;
1073
- setAccountMsg((prev) => ({ ...prev, [account.id]: { text: text2, tone: "error" } }));
1074
- setNotice(text2);
1075
- setFeedback("error");
1076
- return;
1077
- }
1078
- const ok = Boolean(body.ok);
1079
- const text = `${account.label}:${String(body.message || (ok ? "连接正常" : "连接失败"))}`;
1080
- setAccountMsg((prev) => ({ ...prev, [account.id]: { text, tone: ok ? "ok" : "error" } }));
1081
- setNotice(text);
1082
- setFeedback(ok ? "ok" : "error");
1083
- if (ok && account.id === "ones") {
1084
- await loadOnesProjects(form);
1085
- if ((form.defaultProjectUuid || "").trim()) await loadOnesTypes(form.defaultProjectUuid, form);
1086
- }
1087
- });
1088
- };
1089
- const onSave = (account) => {
1090
- const form = drafts[account.id] || draftOf(account);
1091
- setAccountMsg((prev) => ({ ...prev, [account.id]: { text: `${account.label}:正在保存…`, tone: "pending" } }));
1092
- void run(`save:${account.id}`, async () => {
1093
- let body;
1094
- try {
1095
- body = await api("/authinex-ds/accounts", {
1096
- method: "PATCH",
1097
- body: { provider: account.id, form }
1098
- });
1099
- } catch {
1100
- const text2 = `${account.label}:没有保存`;
1101
- setAccountMsg((prev) => ({ ...prev, [account.id]: { text: text2, tone: "error" } }));
1102
- setNotice(text2);
1103
- setFeedback("error");
1104
- return;
1105
- }
1106
- if (body.state) applyState(body.state);
1107
- const ok = Boolean(body.ok);
1108
- const text = ok ? `${account.label}:已保存,个人设置和 AuthineX 已是这一份` : `${account.label}:${String(body.message || "没有保存")}`;
1109
- setAccountMsg((prev) => ({ ...prev, [account.id]: { text, tone: ok ? "ok" : "error" } }));
1110
- setNotice(text);
1111
- setFeedback(ok ? "ok" : "error");
1112
- if (ok) {
1113
- setDrafts((prev) => {
1114
- const next = { ...prev };
1115
- delete next[account.id];
1116
- return next;
1117
- });
1118
- setOpen("");
1119
- }
1120
- });
1121
- };
1122
- const loadSkills = (0, import_react3.useCallback)(async (page = 1, q = "", status = "approved") => {
1123
- setSkillBusy("list");
1124
- setSkillFeedback("");
1125
- setSkillNotice("");
1126
- try {
1127
- const [body] = await Promise.all([
1128
- api("/authinex-ds/skills", { method: "POST", body: { q, page, pageSize: SKILL_PAGE_SIZE, status } }),
1129
- dwell(300)
1130
- ]);
1131
- const items = Array.isArray(body.items) ? body.items : [];
1132
- setSkillView({
1133
- items,
1134
- total: Number(body.total || 0),
1135
- page: Number(body.page || page),
1136
- pageSize: Number(body.pageSize || SKILL_PAGE_SIZE),
1137
- q: String(body.q || q),
1138
- status: String(body.status || status),
1139
- message: String(body.message || ""),
1140
- loaded: true
1141
- });
1142
- setSkillOpen(0);
1143
- if (body.message) setSkillFeedback("warn");
1144
- } catch {
1145
- setSkillView((prev) => ({ ...prev, message: "没有取到技能列表", loaded: true }));
1146
- setSkillFeedback("error");
1147
- } finally {
1148
- setSkillBusy("");
1149
- }
1150
- }, []);
1151
1515
  const onRefresh = () => {
1152
1516
  void run("refresh", async () => {
1153
1517
  const [ok] = await Promise.all([read(), dwell()]);
@@ -1158,7 +1522,7 @@ function AuthinexPanel() {
1158
1522
  }
1159
1523
  setFeedback("ok");
1160
1524
  setNotice("已刷新");
1161
- if (skillView.loaded) void loadSkills(skillView.page, skillView.q, skillView.status);
1525
+ setSkillRefresh((value) => value + 1);
1162
1526
  });
1163
1527
  };
1164
1528
  const onSaveContext = (value) => {
@@ -1198,124 +1562,43 @@ function AuthinexPanel() {
1198
1562
  if (body.ok) setRestart(true);
1199
1563
  });
1200
1564
  };
1201
- const onImportSkill = async (input) => {
1202
- setSkillBusy("import");
1203
- setSkillNotice("");
1204
- setSkillFeedback("");
1205
- try {
1206
- const body = await api("/authinex-ds/skills/import", { method: "POST", body: input });
1207
- if (!body.ok) {
1208
- setSkillFeedback("error");
1209
- setSkillNotice(String(body.message || "没有提交成功"));
1210
- return false;
1211
- }
1212
- await loadSkills(1, "", "candidate");
1213
- setSkillFeedback("ok");
1214
- setSkillNotice(String(body.message || "已提交审核,通过后其他用户才能使用"));
1215
- return true;
1216
- } catch {
1217
- setSkillFeedback("error");
1218
- setSkillNotice("没有提交成功");
1219
- return false;
1220
- } finally {
1221
- setSkillBusy("");
1222
- }
1223
- };
1224
- const onSearchSkills = (event) => {
1225
- event?.preventDefault();
1226
- void loadSkills(1, skillDraftQ.trim(), skillView.status);
1227
- };
1228
- const onPageSkills = (next) => {
1229
- void loadSkills(next, skillView.q, skillView.status);
1230
- };
1231
- const onStatusSkills = (status) => {
1232
- void loadSkills(1, skillDraftQ.trim(), status);
1233
- };
1234
- const onDownloadSkill = (row) => {
1235
- setSkillBusy(`download:${row.id}`);
1236
- setSkillNotice("");
1237
- void (async () => {
1238
- try {
1239
- const body = await api("/authinex-ds/skills/export", { method: "POST", body: { id: row.id } });
1240
- if (!body.ok) {
1241
- setSkillNotice(String(body.message || "没有取到这篇技能"));
1242
- setSkillFeedback("error");
1243
- return;
1244
- }
1245
- const slug = String(body.slug || skillSlug(row.id));
1246
- saveTextFile(`${slug}-SKILL.md`, String(body.markdown || ""));
1247
- setSkillNotice(`已下载 ${slug}-SKILL.md`);
1248
- setSkillFeedback("ok");
1249
- } catch {
1250
- setSkillNotice("没有取到这篇技能");
1251
- setSkillFeedback("error");
1252
- } finally {
1253
- setSkillBusy("");
1254
- }
1255
- })();
1256
- };
1257
- const onInstallSkill = (row) => {
1258
- setSkillBusy(`install:${row.id}`);
1259
- setSkillNotice("");
1260
- void (async () => {
1261
- try {
1262
- const body = await api("/authinex-ds/skills/install", { method: "POST", body: { id: row.id } });
1263
- if (body.state) applyState(body.state);
1264
- setSkillNotice(String(body.message || (body.ok ? "已装到本机" : "没有装上")));
1265
- setSkillFeedback(body.ok ? "ok" : "error");
1266
- } catch {
1267
- setSkillNotice("没有装上");
1268
- setSkillFeedback("error");
1269
- } finally {
1270
- setSkillBusy("");
1271
- }
1272
- })();
1273
- };
1274
- (0, import_react3.useEffect)(() => {
1275
- if (tab !== "skills" || skillView.loaded || model.user === null) return;
1276
- void loadSkills(1, skillView.q, skillView.status);
1277
- }, [tab, skillView.loaded, skillView.q, skillView.status, model.user, loadSkills]);
1278
1565
  const showForm = loaded && (model.phase === "unbound" || model.phase === "invalid" || model.phase === "revoked");
1279
1566
  const message = localError || notice || model.message;
1280
1567
  const messageError = localError !== "" || model.phase === "invalid" || model.phase === "revoked" || model.phase === "unreachable";
1281
1568
  const disabled = busy !== "";
1282
1569
  const pending = busy === "refresh" ? "正在刷新…" : busy === "update" ? "正在检查更新…" : busy.startsWith("test:") ? "正在测试连接…" : busy.startsWith("save:") ? "正在保存…" : "";
1283
1570
  const messageClass = feedback === "ok" ? "axds-ok" : feedback === "warn" ? "axds-notice" : messageError || feedback === "error" ? "axds-error" : "axds-muted";
1284
- const skillPending = skillBusy === "list" ? "正在取技能列表…" : "";
1285
1571
  const installed = model.installedSkills;
1286
- const accountsReady = model.accounts.filter((account) => account.state !== "unconfigured").length;
1287
- const accountsSummary = model.accounts.length ? `${accountsReady}/${model.accounts.length} 家已配置` : "读取账号状态中";
1288
- const totalPages = pageCount(skillView.total, skillView.pageSize);
1289
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("section", { className: "axds", "aria-label": "AuthineX 助手", children: [
1290
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("header", { className: "axds-head", children: [
1291
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.StateDot, { state: model.tone }),
1292
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-head-text", children: [
1293
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "axds-title", children: "AuthineX 助手" }),
1294
- /* @__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 : "正在读取状态…" })
1295
1578
  ] }),
1296
- /* @__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" ? "刷新中" : "刷新" }) })
1297
1580
  ] }),
1298
- 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: [
1299
1582
  "请等待 ",
1300
1583
  model.retryAfterSec,
1301
1584
  " 秒后再试。"
1302
1585
  ] }) : null,
1303
- 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: [
1304
1587
  "当前版本 ",
1305
1588
  model.version,
1306
1589
  ",最低要求 ",
1307
1590
  model.minVersion,
1308
1591
  "。请先更新插件。"
1309
1592
  ] }) : null,
1310
- pending ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { className: "axds-pending", role: "status", children: [
1311
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-spin", "aria-hidden": "true" }),
1312
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: pending })
1313
- ] }, "pending") : message ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: messageClass, role: "status", children: message }, message) : null,
1314
- showForm ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("form", { className: "axds-card", onSubmit: onBind, children: [
1315
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "axds-field", children: [
1316
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "访问地址" }),
1317
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1318
- 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,
1319
1602
  {
1320
1603
  className: "axds-input",
1321
1604
  value: endpoint,
@@ -1329,10 +1612,10 @@ function AuthinexPanel() {
1329
1612
  }
1330
1613
  )
1331
1614
  ] }),
1332
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "axds-field", children: [
1333
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "密钥" }),
1334
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1335
- 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,
1336
1619
  {
1337
1620
  className: "axds-input",
1338
1621
  value: key,
@@ -1346,30 +1629,31 @@ function AuthinexPanel() {
1346
1629
  }
1347
1630
  )
1348
1631
  ] }),
1349
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-actions", children: [
1350
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-muted", children: "地址和密钥都由你填;插件本身不带任何地址或密钥。" }),
1351
- /* @__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: "绑定" })
1352
1635
  ] }),
1353
- model.endpoint ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-actions", children: [
1354
- /* @__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: [
1355
1638
  "本机还记着上次的地址 ",
1356
1639
  model.endpoint
1357
1640
  ] }),
1358
- /* @__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: () => {
1359
1642
  setConfirmUnbind(true);
1360
1643
  }, children: "解除绑定" })
1361
- ] }) : null
1644
+ ] }) : null,
1645
+ model.phase === "invalid" && model.endpoint ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "axds-muted", children: "升级不会作废这把密钥。把原来的密钥再贴一次,就会接回这台机器。" }) : null
1362
1646
  ] }) : null,
1363
- model.user ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
1364
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-row", children: [
1365
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: model.user.displayName }),
1366
- 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: [
1367
1651
  "· ",
1368
1652
  model.endpoint
1369
1653
  ] }) : null
1370
1654
  ] }),
1371
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-tabs", role: "tablist", "aria-label": "配置分区", children: [
1372
- /* @__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)(
1373
1657
  "button",
1374
1658
  {
1375
1659
  type: "button",
@@ -1380,7 +1664,7 @@ function AuthinexPanel() {
1380
1664
  children: "概览"
1381
1665
  }
1382
1666
  ),
1383
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1667
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
1384
1668
  "button",
1385
1669
  {
1386
1670
  type: "button",
@@ -1390,23 +1674,23 @@ function AuthinexPanel() {
1390
1674
  onClick: () => setTab("skills"),
1391
1675
  children: [
1392
1676
  "技能",
1393
- 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
1394
1678
  ]
1395
1679
  }
1396
1680
  )
1397
1681
  ] }),
1398
- tab === "overview" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
1399
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-card", children: [
1400
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-between", children: [
1401
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-title", children: "可用功能" }),
1402
- /* @__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: [
1403
1687
  model.tools.length,
1404
1688
  " 个工具"
1405
1689
  ] })
1406
1690
  ] }),
1407
- 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: "当前角色没有可用工具。权限由运营台角色决定。" })
1408
1692
  ] }),
1409
- model.user ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1693
+ model.user ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1410
1694
  WorkContextCard,
1411
1695
  {
1412
1696
  value: model.workContext,
@@ -1414,137 +1698,34 @@ function AuthinexPanel() {
1414
1698
  onSave: onSaveContext,
1415
1699
  onClear: onClearContext
1416
1700
  }
1417
- ) : null,
1418
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-card", children: [
1419
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1420
- "button",
1421
- {
1422
- type: "button",
1423
- className: "axds-collapse",
1424
- "aria-expanded": accountsOpen,
1425
- onClick: () => setAccountsOpen((value) => !value),
1426
- children: [
1427
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: `axds-caret${accountsOpen ? " on" : ""}`, "aria-hidden": "true" }),
1428
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-title", children: "集成账号" }),
1429
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-muted", children: accountsSummary }),
1430
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-push" }),
1431
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-muted", children: "与 AuthineX、运营台个人设置同一份" })
1432
- ]
1433
- }
1434
- ),
1435
- accountsOpen ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "axds-accounts", children: model.accounts.map((account) => {
1436
- const editing = open === account.id;
1437
- const draft = drafts[account.id] || draftOf(account);
1438
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-account", children: [
1439
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-account-head", children: [
1440
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.StateDot, { state: accountTone(account.state) }),
1441
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(PlatformIcon, { id: account.id }),
1442
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-account-name", children: account.label }),
1443
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Tag, { tone: tagTone(account.state), children: account.status }),
1444
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-push" }),
1445
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1446
- import_dsh_client_ui_primitives3.Switch,
1447
- {
1448
- checked: account.enabled,
1449
- label: `${account.label} 启用`,
1450
- disabled,
1451
- onChange: (next) => {
1452
- onToggleEnabled(account, next);
1453
- }
1454
- }
1455
- ),
1456
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { size: "sm", variant: "ghost", disabled, onClick: () => {
1457
- toggleAccount(account);
1458
- }, children: editing ? "收起" : "配置" })
1459
- ] }),
1460
- account.hint ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "axds-notice", children: account.hint }) : null,
1461
- account.username ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { className: "axds-muted", children: [
1462
- account.username,
1463
- account.hasToken ? " · 已有凭据" : ""
1464
- ] }) : null,
1465
- editing ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
1466
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "axds-fields", children: account.fields.map((field) => {
1467
- const onesSelect = account.id === "ones" && (field.name === "defaultProjectUuid" || field.name === "defaultIssueTypeId") ? onesSelectRows({
1468
- field,
1469
- draft,
1470
- projects: onesProjects,
1471
- types: onesTypes,
1472
- busy: optionsBusy
1473
- }) : null;
1474
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "axds-field", children: [
1475
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: field.title }),
1476
- onesSelect ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1477
- "select",
1478
- {
1479
- className: "axds-select",
1480
- value: draft[field.name] ?? "",
1481
- disabled: disabled || optionsBusy !== "" || onesSelect.disabled,
1482
- onChange: (event) => {
1483
- onOnesSelect(account, field.name, event.target.value);
1484
- },
1485
- children: onesSelect.rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: row.uuid, children: row.name }, `${row.uuid}:${row.name}`))
1486
- }
1487
- ) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1488
- import_dsh_client_ui_primitives3.Input,
1489
- {
1490
- className: "axds-input",
1491
- type: field.type,
1492
- value: draft[field.name] ?? "",
1493
- placeholder: field.placeholder,
1494
- autoComplete: "off",
1495
- spellCheck: false,
1496
- onChange: (event) => {
1497
- setField(account, field.name, event.target.value);
1498
- }
1499
- }
1500
- )
1501
- ] }, field.name);
1502
- }) }),
1503
- account.id === "ones" && onesProjects.message ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { className: "axds-error", children: [
1504
- "项目:",
1505
- onesProjects.message
1506
- ] }) : null,
1507
- account.id === "ones" && onesTypes.message ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { className: "axds-error", children: [
1508
- "工单类型:",
1509
- onesTypes.message
1510
- ] }) : null,
1511
- editing && accountMsg[account.id] ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1512
- "p",
1513
- {
1514
- className: accountMsg[account.id].tone === "ok" ? "axds-ok" : accountMsg[account.id].tone === "error" ? "axds-error" : "axds-notice",
1515
- role: "status",
1516
- children: accountMsg[account.id].text
1517
- }
1518
- ) : null,
1519
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-actions", children: [
1520
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-muted", children: "保存前会先做一次连接测试,并写入个人设置" }),
1521
- account.id === "ones" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { size: "sm", disabled: disabled || optionsBusy !== "", onClick: () => {
1522
- onFetchOnes(account);
1523
- }, children: optionsBusy ? "获取中" : "获取类型" }) : null,
1524
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { size: "sm", disabled, onClick: () => {
1525
- onTest(account);
1526
- }, children: busy === `test:${account.id}` ? "测试中" : "测试连接" }),
1527
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { size: "sm", variant: "primary", disabled, onClick: () => {
1528
- onSave(account);
1529
- }, children: busy === `save:${account.id}` ? "保存中" : "保存" })
1530
- ] })
1531
- ] }) : null
1532
- ] }, account.id);
1533
- }) }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-muted", children: "展开才显示各平台账号和开关;收起不影响查单建单。" })
1534
- ] }),
1535
- model.update?.version ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-card", children: [
1536
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-between", children: [
1537
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-title", children: model.update.available ? `新版本 ${model.update.version}` : `已是最新(${model.update.version})` }),
1538
- /* @__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 ? "可更新" : "最新" })
1539
1720
  ] }),
1540
- model.update.notes ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "axds-muted", children: model.update.notes }) : null,
1541
- 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: [
1542
1723
  "校验值 ",
1543
1724
  model.update.sha
1544
1725
  ] }) : null,
1545
- model.update.available ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-actions", children: [
1546
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-muted", children: "更新由 DeepSeek 自己的安装器完成,装完要重启智能问答" }),
1547
- /* @__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: () => {
1548
1729
  setConfirmUpdate(true);
1549
1730
  }, children: [
1550
1731
  "更新到 ",
@@ -1552,23 +1733,23 @@ function AuthinexPanel() {
1552
1733
  ] })
1553
1734
  ] }) : null
1554
1735
  ] }) : null,
1555
- confirmUpdate ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-confirm", children: [
1556
- /* @__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: [
1557
1738
  "现在更新到 ",
1558
1739
  model.update?.version,
1559
1740
  "?装完需要重启智能问答。"
1560
1741
  ] }),
1561
- /* @__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: () => {
1562
1743
  setConfirmUpdate(false);
1563
1744
  }, children: "取消" }),
1564
- /* @__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: "确认更新" })
1565
1746
  ] }) : null,
1566
- restart ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "axds-notice", children: "已装好,重启智能问答后新版本才生效。" }) : null,
1567
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-card", children: [
1568
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "axds-field", children: [
1569
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "新密钥" }),
1570
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1571
- 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,
1572
1753
  {
1573
1754
  className: "axds-input",
1574
1755
  value: key,
@@ -1582,270 +1763,99 @@ function AuthinexPanel() {
1582
1763
  }
1583
1764
  )
1584
1765
  ] }),
1585
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-actions", children: [
1586
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-muted", children: "贴一把新密钥会重新兑换,运营台才会变成已绑定" }),
1587
- /* @__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: "绑定这把密钥" })
1588
1769
  ] })
1589
1770
  ] }),
1590
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-row", children: [
1591
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { size: "sm", disabled, onClick: onCheckUpdate, children: busy === "update" ? "检查中" : "检查更新" }),
1592
- /* @__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 上的版本号" })
1593
1774
  ] })
1594
1775
  ] }) : null,
1595
- tab === "skills" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-card", children: [
1596
- model.user && model.skillsOnline ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "axds-muted", children: "技能已由插件在线提供,无需安装" }) : null,
1597
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-between", children: [
1598
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-title", children: "技能" }),
1599
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-muted", children: skillView.loaded ? `共 ${skillView.total} 个 · 按使用频次从高到低 · 本机已装 ${installed.length} 个` : "来自 AgentHub 技能库,按使用频次从高到低" })
1600
- ] }),
1601
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SkillImport, { disabled: disabled || skillBusy !== "", onSubmit: onImportSkill }),
1602
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("form", { className: "axds-skill-search", onSubmit: onSearchSkills, children: [
1603
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1604
- import_dsh_client_ui_primitives3.Input,
1605
- {
1606
- className: "axds-input",
1607
- value: skillDraftQ,
1608
- placeholder: "搜技能名、适用场景,或填编号(2470 / skill-2470)",
1609
- autoComplete: "off",
1610
- spellCheck: false,
1611
- onChange: (event) => {
1612
- setSkillDraftQ(event.target.value);
1613
- }
1614
- }
1615
- ),
1616
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { size: "sm", variant: "primary", type: "submit", disabled: skillBusy !== "", children: "检索" }),
1617
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1618
- import_dsh_client_ui_primitives3.Button,
1619
- {
1620
- size: "sm",
1621
- variant: "ghost",
1622
- type: "button",
1623
- disabled: skillBusy !== "",
1624
- onClick: () => {
1625
- setSkillDraftQ("");
1626
- void loadSkills(1, "", skillView.status);
1627
- },
1628
- children: "清空"
1629
- }
1630
- )
1631
- ] }),
1632
- /* @__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)(
1633
- "button",
1634
- {
1635
- type: "button",
1636
- className: `axds-chip${skillView.status === option.value ? " on" : ""}`,
1637
- "aria-pressed": skillView.status === option.value,
1638
- disabled: skillBusy !== "",
1639
- onClick: () => {
1640
- onStatusSkills(option.value);
1641
- },
1642
- children: option.label
1643
- },
1644
- option.value || "all"
1645
- )) }),
1646
- skillPending ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { className: "axds-pending", role: "status", children: [
1647
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-spin", "aria-hidden": "true" }),
1648
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: skillPending })
1649
- ] }) : null,
1650
- skillNotice ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1651
- "p",
1652
- {
1653
- className: skillFeedback === "ok" ? "axds-ok" : skillFeedback === "error" ? "axds-error" : "axds-notice",
1654
- role: "status",
1655
- children: skillNotice
1656
- }
1657
- ) : null,
1658
- !skillPending && skillView.message ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: skillView.items.length ? "axds-notice" : "axds-muted", role: "status", children: skillView.message }) : null,
1659
- skillView.loaded && skillView.items.length === 0 && !skillPending ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "axds-muted", children: skillView.q ? `没有搜到「${skillView.q}」` : "这个状态下还没有技能" }) : null,
1660
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "axds-skills", children: skillView.items.map((row) => {
1661
- const expanded = skillOpen === row.id;
1662
- const done = skillInstalled(row, installed);
1663
- const status = row.status || "approved";
1664
- const hot = skillIsHot(row);
1665
- const uses = skillUseText(row);
1666
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: `axds-skill${expanded ? " on" : ""}${hot ? " hot" : ""}`, children: [
1667
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1668
- "button",
1669
- {
1670
- type: "button",
1671
- className: "axds-skill-head",
1672
- "aria-expanded": expanded,
1673
- onClick: () => setSkillOpen((prev) => prev === row.id ? 0 : row.id),
1674
- children: [
1675
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: `axds-caret${expanded ? " on" : ""}`, "aria-hidden": "true" }),
1676
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-skill-name", children: row.name || skillSlug(row.id) }),
1677
- 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,
1678
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-push" }),
1679
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: `axds-skill-uses${hot ? " hot" : uses === "未使用" ? " idle" : ""}`, children: uses }),
1680
- done ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Tag, { tone: "success", children: "已装" }) : null,
1681
- skillUploaderText(row) ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Tag, { tone: "info", children: skillUploaderText(row) }) : null,
1682
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Tag, { tone: "quiet", children: skillKindText(row.skillKind) }),
1683
- 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
1684
- ]
1685
- }
1686
- ),
1687
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "axds-skill-desc", children: row.triggerDesc || "没有写适用场景" }),
1688
- expanded ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-skill-body", children: [
1689
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("dl", { className: "axds-kv", children: [
1690
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
1691
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dt", { children: "编号" }),
1692
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dd", { children: skillSlug(row.id) })
1693
- ] }),
1694
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
1695
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dt", { children: "使用频次" }),
1696
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dd", { children: uses })
1697
- ] }),
1698
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
1699
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dt", { children: "适用范围" }),
1700
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dd", { children: skillScopeText(row) })
1701
- ] }),
1702
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-kv-when", children: [
1703
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dt", { children: "更新时间" }),
1704
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dd", { children: formatUpdatedAt(row.updatedAt) })
1705
- ] }),
1706
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
1707
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dt", { children: "来源" }),
1708
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dd", { children: row.sourceKind || "—" })
1709
- ] })
1710
- ] }),
1711
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-actions", children: [
1712
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1713
- import_dsh_client_ui_primitives3.Button,
1714
- {
1715
- size: "sm",
1716
- variant: "ghost",
1717
- disabled: skillBusy !== "",
1718
- onClick: () => {
1719
- onDownloadSkill(row);
1720
- },
1721
- children: skillBusy === `download:${row.id}` ? "下载中…" : "下载 SKILL.md"
1722
- }
1723
- ),
1724
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1725
- import_dsh_client_ui_primitives3.Button,
1726
- {
1727
- size: "sm",
1728
- variant: "primary",
1729
- disabled: skillBusy !== "" || status !== "approved",
1730
- title: status === "approved" ? "" : "审核通过后才能装到本机",
1731
- onClick: () => {
1732
- onInstallSkill(row);
1733
- },
1734
- children: skillBusy === `install:${row.id}` ? "安装中…" : done ? "重新安装" : "装到本机"
1735
- }
1736
- )
1737
- ] })
1738
- ] }) : null
1739
- ] }, row.id);
1740
- }) }),
1741
- skillView.total > 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-pager", children: [
1742
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "axds-muted", children: [
1743
- "第 ",
1744
- skillView.page,
1745
- " / ",
1746
- totalPages,
1747
- " 页 · 共 ",
1748
- skillView.total,
1749
- " 个"
1750
- ] }),
1751
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-push" }),
1752
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1753
- import_dsh_client_ui_primitives3.Button,
1754
- {
1755
- size: "sm",
1756
- variant: "outline",
1757
- disabled: skillBusy !== "" || skillView.page <= 1,
1758
- onClick: () => {
1759
- onPageSkills(skillView.page - 1);
1760
- },
1761
- children: "上一页"
1762
- }
1763
- ),
1764
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1765
- import_dsh_client_ui_primitives3.Button,
1766
- {
1767
- size: "sm",
1768
- variant: "outline",
1769
- disabled: skillBusy !== "" || skillView.page >= totalPages,
1770
- onClick: () => {
1771
- onPageSkills(skillView.page + 1);
1772
- },
1773
- children: "下一页"
1774
- }
1775
- )
1776
- ] }) : null,
1777
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "axds-muted", children: "装到本机技能目录 ~/.dsh/skills/<编号>/SKILL.md,只写这个目录、不动工作区;新会话才会读到。" })
1778
- ] }) : null,
1779
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-row", children: [
1780
- /* @__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: () => {
1781
1791
  setConfirmUnbind(true);
1782
1792
  }, children: "解除绑定" }),
1783
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-muted", children: "解除后地址和密钥都会清掉,要重新填" })
1793
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "axds-muted", children: "解除后地址和密钥都会清掉,要重新填" })
1784
1794
  ] })
1785
1795
  ] }) : null,
1786
- confirmUnbind ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-confirm", children: [
1787
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "确认解除这台设备的绑定?" }),
1788
- /* @__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: () => {
1789
1799
  setConfirmUnbind(false);
1790
1800
  }, children: "取消" }),
1791
- /* @__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: "确认解除" })
1792
1802
  ] }) : null,
1793
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("footer", { className: "axds-foot", children: [
1794
- /* @__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: [
1795
1805
  "v",
1796
1806
  model.version || "0.1.0"
1797
1807
  ] }),
1798
- model.endpoint ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
1799
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "·" }),
1800
- /* @__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 })
1801
1811
  ] }) : null
1802
1812
  ] })
1803
1813
  ] });
1804
1814
  }
1805
1815
 
1806
- // src/command-card.tsx
1807
- var import_jsx_runtime5 = require("react/jsx-runtime");
1816
+ // src/work/command-card.tsx
1817
+ var import_jsx_runtime7 = require("react/jsx-runtime");
1808
1818
  function AxContextCommandCard(props) {
1809
1819
  const outcome = props.node?.outcome;
1810
1820
  if (!outcome) {
1811
- 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: [
1812
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "axds-cmd-title", children: "工作上下文" }),
1813
- /* @__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: "正在设置…" })
1814
1824
  ] }) });
1815
1825
  }
1816
1826
  if (outcome.kind === "error") {
1817
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "axds-cmd", "data-state": "error", children: [
1818
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "axds-cmd-head", children: [
1819
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "axds-cmd-title", children: "工作上下文" }),
1820
- /* @__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: "没设成" })
1821
1831
  ] }),
1822
- /* @__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 })
1823
1833
  ] });
1824
1834
  }
1825
1835
  const receipt = parseReceiptText(outcome.text || "");
1826
1836
  if (!receipt) {
1827
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "axds-cmd", "data-state": "ok", children: [
1828
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "axds-cmd-head", children: [
1829
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "axds-cmd-title", children: "工作上下文" }),
1830
- /* @__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: "已生效" })
1831
1841
  ] }),
1832
- /* @__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 })
1833
1843
  ] });
1834
1844
  }
1835
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "axds-cmd", "data-state": "ok", children: [
1836
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "axds-cmd-head", children: [
1837
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "axds-cmd-title", children: "工作上下文" }),
1838
- /* @__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: "已生效" })
1839
1849
  ] }),
1840
- /* @__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: [
1841
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: field.label }),
1842
- /* @__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 })
1843
1853
  ] }, `${field.label}:${field.value}`)) }),
1844
- 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
1845
1855
  ] });
1846
1856
  }
1847
1857
 
1848
- // src/styles.ts
1858
+ // src/client/styles.ts
1849
1859
  var CSS = `
1850
1860
  .axds{display:flex;flex-direction:column;gap:12px;color:var(--dsw-alias-label-primary);font-size:13px;line-height:1.5}
1851
1861
  .axds-head{display:flex;align-items:center;gap:8px}
@@ -1968,7 +1978,7 @@ function installClientStyles() {
1968
1978
  };
1969
1979
  }
1970
1980
 
1971
- // src/client.tsx
1981
+ // src/client/client.tsx
1972
1982
  var CLIENT_ID = PACKAGE_NAME;
1973
1983
  function install() {
1974
1984
  return {
@@ -1981,7 +1991,6 @@ function install() {
1981
1991
  ctx.slots.inject(slot, () => ctx.slots.register({ name: slot, key }, AuthinexPanel));
1982
1992
  };
1983
1993
  contribute("plugins.bundle.config", PACKAGE_NAME);
1984
- contribute("plugins.row.config", ROW_KEY);
1985
1994
  try {
1986
1995
  ctx.slots.inject("conversation.chat.commandview", () => ctx.slots.register(
1987
1996
  { name: "conversation.chat.commandview", key: "ax-context" },