@authinex/dsh-plugin 0.1.4 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/README.md +32 -7
  2. package/lib/client.js +942 -181
  3. package/lib/index.js +1315 -165
  4. package/package.json +1 -1
package/lib/client.js CHANGED
@@ -29,8 +29,8 @@ __export(client_exports, {
29
29
  module.exports = __toCommonJS(client_exports);
30
30
 
31
31
  // src/panel.tsx
32
- var import_react = require("react");
33
- var import_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
32
+ var import_react3 = require("react");
33
+ var import_dsh_client_ui_primitives3 = require("@deepseek-ai/dsh-client-ui-primitives");
34
34
 
35
35
  // src/endpoint.ts
36
36
  function checkEndpoint(raw) {
@@ -82,6 +82,34 @@ function parseKey(raw) {
82
82
  };
83
83
  }
84
84
 
85
+ // src/platform-icon.tsx
86
+ var import_jsx_runtime = require("react/jsx-runtime");
87
+ 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";
88
+ 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";
89
+ var PMO = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAIKADAAQAAAABAAAAIAAAAACshmLzAAABJ0lEQVRYCe1Uu24CMRAcc+bxCanzGVcAf0ARceQjovxNfoK0qZGo0lMiIcpI9CiBezi7Ec1J9p641UEKr+TiPJ6b0Xi9Bl3Wh1ujjzHysEgvDN0GiQZiAndPwHbc65aeoVgWzy4VT7QFSzj8YEsGCmkOGCyca6vRyKuQ4t18Sue67YEERhJnrFsDTerRwH9IwCIRLqokrBBw7iBlF1kSePFKGFR4xBQPyLwmWPiL1l5nwmJp3rwGeHPlSnpIGU6eEzxDeYLsaClSkEfxEQOMSCB0DRVhylJ4Vypf6NHA3ROQm9DAYhi4a2bK7ACxvi3/osQK33jF+e/B1ZlD2jtgQibmdeC6L9nAzGzod7z89eRySmgOnpgtS9cDluaEsnQGlOJMjwZiAr+yay/qLc22yQAAAABJRU5ErkJggg==";
90
+ var RASTER = { ones: ONES, h3yun: H3YUN, pmo: PMO };
91
+ function GitlabMark() {
92
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", { className: "axds-logo", viewBox: "0 0 24 24", width: "16", height: "16", "aria-hidden": "true", children: [
93
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { fill: "#e24329", d: "M12 21.4 16.1 8.7H7.9z" }),
94
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { fill: "#fc6d26", d: "M12 21.4 7.9 8.7H2.4z" }),
95
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { fill: "#fca326", d: "M2.4 8.7 1.2 12.3c-.2.6.1 1.2.6 1.4L12 21.4z" }),
96
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { fill: "#fc6d26", d: "M2.4 8.7h5.5L5.7 3c-.2-.6-1-.6-1.2 0z" }),
97
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { fill: "#e24329", d: "M12 21.4 16.1 8.7h5.5z" }),
98
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { fill: "#fca326", d: "M21.6 8.7 22.8 12.3c.2.6-.1 1.2-.6 1.4L12 21.4z" }),
99
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { fill: "#fc6d26", d: "M21.6 8.7h-5.5L18.3 3c.2-.6 1-.6 1.2 0z" })
100
+ ] });
101
+ }
102
+ function PlatformIcon({ id }) {
103
+ if (id === "gitlab") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(GitlabMark, {});
104
+ const src = RASTER[id];
105
+ if (!src) return null;
106
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { className: "axds-logo", src, alt: "", width: 16, height: 16 });
107
+ }
108
+
109
+ // src/skill-import.tsx
110
+ var import_react = require("react");
111
+ var import_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
112
+
85
113
  // src/phrases.ts
86
114
  var PHRASES = {
87
115
  unbound: "填写访问地址和密钥完成绑定",
@@ -188,11 +216,28 @@ var TOOLS = {
188
216
  }
189
217
  };
190
218
 
219
+ // src/work-context.ts
220
+ var PRODUCT_KINDS = [
221
+ { id: "yunshu", label: "云枢" },
222
+ { id: "report", label: "报表" },
223
+ { id: "print", label: "打印" }
224
+ ];
225
+ var EMPTY_WORK = { productKind: "", version: "", customer: "" };
226
+ function labelOf(kind) {
227
+ const found = PRODUCT_KINDS.find((item) => item.id === kind);
228
+ return found ? found.label : kind;
229
+ }
230
+
191
231
  // src/view.ts
192
232
  var PACKAGE_NAME = "@authinex/dsh-plugin";
193
233
  var ROW_ID = "authinex-ds-plugin";
194
234
  var ROW_KEY = `${PACKAGE_NAME}#${ROW_ID}`;
195
235
  var ACCOUNT_FIELDS = {
236
+ gitlab: [
237
+ { name: "username", title: "账号" },
238
+ { name: "baseUrl", title: "地址(可空)" },
239
+ { name: "token", title: "Token", type: "password" }
240
+ ],
196
241
  ones: [
197
242
  { name: "username", title: "登录邮箱" },
198
243
  { name: "teamUuid", title: "Team UUID" },
@@ -216,7 +261,12 @@ var ACCOUNT_FIELDS = {
216
261
  { name: "isTenant", title: "是否多租户(true / false)" }
217
262
  ]
218
263
  };
219
- var ACCOUNT_LABELS = { ones: "ONES", h3yun: "氚云", pmo: "PMO" };
264
+ var ACCOUNT_LABELS = {
265
+ gitlab: "GitLab",
266
+ ones: "ONES",
267
+ h3yun: "氚云",
268
+ pmo: "PMO"
269
+ };
220
270
  function maskMobile(raw) {
221
271
  const digits = String(raw || "").replace(/[\s-]/g, "");
222
272
  if (!digits) return "";
@@ -292,6 +342,13 @@ function viewModel(state) {
292
342
  };
293
343
  }) : [];
294
344
  const toolNames = showIdentity && !state?.upgradeRequired ? state?.tools || [] : [];
345
+ const titles = state?.toolTitles || {};
346
+ const stored = showIdentity ? state?.workContext : void 0;
347
+ const workContext = {
348
+ productKind: stored?.productKind === "yunshu" || stored?.productKind === "report" || stored?.productKind === "print" ? stored.productKind : "",
349
+ version: String(stored?.version || "").slice(0, 32),
350
+ customer: String(stored?.customer || "").slice(0, 60)
351
+ };
295
352
  return {
296
353
  phase,
297
354
  headline: phrase(phase),
@@ -303,16 +360,292 @@ function viewModel(state) {
303
360
  upgradeRequired: Boolean(state?.upgradeRequired),
304
361
  user: showIdentity ? state?.user || null : null,
305
362
  tools: toolNames,
306
- toolNames: toolNames.map((name) => TOOLS[name]?.title || name),
363
+ toolNames: toolNames.map((name) => titles[name] || TOOLS[name]?.title || name),
307
364
  accounts,
308
365
  update: state?.update || null,
309
366
  updateMessage: String(state?.updateMessage || ""),
310
- retryAfterSec: Number(state?.retryAfterSec || 0)
367
+ retryAfterSec: Number(state?.retryAfterSec || 0),
368
+ installedSkills: Array.isArray(state?.installedSkills) ? state.installedSkills : [],
369
+ workContext: showIdentity ? workContext : EMPTY_WORK,
370
+ skillsOnline: Boolean(state?.skillsOnline)
311
371
  };
312
372
  }
373
+ var SKILL_PAGE_SIZE = 8;
374
+ var SKILL_KINDS = {
375
+ clarify: "产品澄清",
376
+ locate: "问题定位",
377
+ extension: "二开",
378
+ general: "通用"
379
+ };
380
+ var SKILL_STATUS = {
381
+ approved: "平台技能",
382
+ candidate: "待审核",
383
+ deprecated: "已下线"
384
+ };
385
+ var SKILL_FILTERS = [
386
+ { value: "approved", label: "平台技能" },
387
+ { value: "candidate", label: "待审核" },
388
+ { value: "", label: "全部" }
389
+ ];
390
+ function skillKindText(kind) {
391
+ return SKILL_KINDS[kind] || kind || "通用";
392
+ }
393
+ function skillSlug(id) {
394
+ return `skill-${id}`;
395
+ }
396
+ function skillInstalled(row, installed) {
397
+ return installed.includes(skillSlug(row.id));
398
+ }
399
+ function skillUploaderText(row) {
400
+ const name = String(row.uploaderName || "").trim();
401
+ return name ? `${name} 上传` : "";
402
+ }
403
+ function skillScopeText(row) {
404
+ const parts = [row.productKind, row.productVersion].filter((part) => String(part || "").trim());
405
+ return parts.length ? parts.join(" · ") : "通用";
406
+ }
407
+ function skillStatusTone(status) {
408
+ if (status === "approved" || !status) return "success";
409
+ if (status === "candidate") return "warning";
410
+ return "neutral";
411
+ }
412
+ function pageCount(total, pageSize = SKILL_PAGE_SIZE) {
413
+ if (!Number.isFinite(total) || total <= 0) return 1;
414
+ return Math.max(1, Math.ceil(total / pageSize));
415
+ }
416
+
417
+ // src/skill-import.tsx
418
+ var import_jsx_runtime2 = require("react/jsx-runtime");
419
+ var MAX_CHARS = 2e4;
420
+ function SkillImport({
421
+ disabled,
422
+ onSubmit
423
+ }) {
424
+ const fileRef = (0, import_react.useRef)(null);
425
+ const [open, setOpen] = (0, import_react.useState)(false);
426
+ const [name, setName] = (0, import_react.useState)("");
427
+ const [kind, setKind] = (0, import_react.useState)("general");
428
+ const [markdown, setMarkdown] = (0, import_react.useState)("");
429
+ const [localError, setLocalError] = (0, import_react.useState)("");
430
+ const pickFile = () => {
431
+ fileRef.current?.click();
432
+ };
433
+ const onFile = (file) => {
434
+ if (!file) return;
435
+ if (file.size > MAX_CHARS * 4) {
436
+ setLocalError("这个文件太大,请控制在两万字以内");
437
+ return;
438
+ }
439
+ const reader = new FileReader();
440
+ reader.onload = () => {
441
+ const text = String(reader.result || "");
442
+ if (text.length > MAX_CHARS) {
443
+ setLocalError("这篇超过两万字,缩短后再提交");
444
+ return;
445
+ }
446
+ setMarkdown(text);
447
+ setLocalError("");
448
+ if (!name.trim()) {
449
+ const heading = text.split("\n").find((line) => line.startsWith("# "));
450
+ if (heading) setName(heading.replace(/^#\s+/, "").trim().slice(0, 200));
451
+ }
452
+ };
453
+ reader.onerror = () => {
454
+ setLocalError("没有读到这个文件");
455
+ };
456
+ reader.readAsText(file);
457
+ };
458
+ const onForm = (event) => {
459
+ event.preventDefault();
460
+ const text = markdown.trim();
461
+ if (!text) {
462
+ setLocalError("先贴上或选择一篇 SKILL.md");
463
+ return;
464
+ }
465
+ if (text.length > MAX_CHARS) {
466
+ setLocalError("这篇超过两万字,缩短后再提交");
467
+ return;
468
+ }
469
+ setLocalError("");
470
+ void onSubmit({ markdown: text, name: name.trim(), skillKind: kind }).then((ok) => {
471
+ if (!ok) return;
472
+ setName("");
473
+ setKind("general");
474
+ setMarkdown("");
475
+ setOpen(false);
476
+ });
477
+ };
478
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "axds-import", children: [
479
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "axds-actions", children: [
480
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "axds-muted", children: "提交后先待审核,通过后其他用户才能装和使用" }),
481
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives.Button, { size: "sm", variant: "outline", disabled, onClick: () => {
482
+ setOpen((value) => !value);
483
+ }, children: open ? "收起" : "导入个人技能" })
484
+ ] }),
485
+ open ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("form", { className: "axds-import-form", onSubmit: onForm, children: [
486
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "axds-field", children: [
487
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "技能名(可空,空则用正文标题)" }),
488
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
489
+ "input",
490
+ {
491
+ className: "axds-plain",
492
+ value: name,
493
+ maxLength: 200,
494
+ autoComplete: "off",
495
+ spellCheck: false,
496
+ disabled,
497
+ onChange: (event) => {
498
+ setName(event.target.value);
499
+ }
500
+ }
501
+ )
502
+ ] }),
503
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "axds-field", children: [
504
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "用途" }),
505
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
506
+ "select",
507
+ {
508
+ className: "axds-select",
509
+ value: kind,
510
+ disabled,
511
+ onChange: (event) => {
512
+ setKind(event.target.value);
513
+ },
514
+ children: Object.entries(SKILL_KINDS).map(([value, label]) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value, children: label }, value))
515
+ }
516
+ )
517
+ ] }),
518
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "axds-field", children: [
519
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "SKILL.md" }),
520
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
521
+ "textarea",
522
+ {
523
+ className: "axds-textarea",
524
+ value: markdown,
525
+ spellCheck: false,
526
+ disabled,
527
+ placeholder: "# 技能名\n\n什么情况下用这篇技能,以及具体步骤。",
528
+ onChange: (event) => {
529
+ setMarkdown(event.target.value);
530
+ setLocalError("");
531
+ }
532
+ }
533
+ )
534
+ ] }),
535
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
536
+ "input",
537
+ {
538
+ ref: fileRef,
539
+ className: "axds-file",
540
+ type: "file",
541
+ accept: ".md,text/markdown,text/plain",
542
+ onChange: (event) => {
543
+ onFile(event.target.files?.[0]);
544
+ event.target.value = "";
545
+ }
546
+ }
547
+ ),
548
+ localError ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "axds-error", role: "status", children: localError }) : null,
549
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "axds-actions", children: [
550
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives.Button, { size: "sm", variant: "ghost", type: "button", disabled, onClick: pickFile, children: "选择文件" }),
551
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives.Button, { size: "sm", variant: "primary", type: "submit", disabled, children: "提交审核" })
552
+ ] })
553
+ ] }) : null
554
+ ] });
555
+ }
556
+
557
+ // src/work-context-card.tsx
558
+ var import_react2 = require("react");
559
+ var import_dsh_client_ui_primitives2 = require("@deepseek-ai/dsh-client-ui-primitives");
560
+ var import_jsx_runtime3 = require("react/jsx-runtime");
561
+ function WorkContextCard(props) {
562
+ const [productKind, setProductKind] = (0, import_react2.useState)(props.value.productKind);
563
+ const [version, setVersion] = (0, import_react2.useState)(props.value.version);
564
+ const [customer, setCustomer] = (0, import_react2.useState)(props.value.customer);
565
+ (0, import_react2.useEffect)(() => {
566
+ setProductKind(props.value.productKind);
567
+ setVersion(props.value.version);
568
+ setCustomer(props.value.customer);
569
+ }, [props.value.productKind, props.value.version, props.value.customer]);
570
+ const shownKind = labelOf(productKind);
571
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "axds-card", children: [
572
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "axds-between", children: [
573
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "axds-title", children: "工作上下文" }),
574
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "axds-muted", children: "没填的版本和产品线,调用工具时补上" })
575
+ ] }),
576
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "axds-fields", children: [
577
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "axds-field", children: [
578
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: "产品线" }),
579
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
580
+ import_dsh_client_ui_primitives2.Input,
581
+ {
582
+ className: "axds-input",
583
+ value: shownKind,
584
+ placeholder: "云枢、报表或打印,可空",
585
+ autoComplete: "off",
586
+ spellCheck: false,
587
+ onChange: (event) => {
588
+ setProductKind(event.target.value);
589
+ }
590
+ }
591
+ )
592
+ ] }),
593
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "axds-field", children: [
594
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: "版本" }),
595
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
596
+ import_dsh_client_ui_primitives2.Input,
597
+ {
598
+ className: "axds-input",
599
+ value: version,
600
+ placeholder: "如 8.7",
601
+ maxLength: 32,
602
+ autoComplete: "off",
603
+ spellCheck: false,
604
+ onChange: (event) => {
605
+ setVersion(event.target.value);
606
+ }
607
+ }
608
+ )
609
+ ] }),
610
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "axds-field", children: [
611
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: "客户" }),
612
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
613
+ import_dsh_client_ui_primitives2.Input,
614
+ {
615
+ className: "axds-input",
616
+ value: customer,
617
+ placeholder: "可空",
618
+ maxLength: 60,
619
+ autoComplete: "off",
620
+ spellCheck: false,
621
+ onChange: (event) => {
622
+ setCustomer(event.target.value);
623
+ }
624
+ }
625
+ )
626
+ ] })
627
+ ] }),
628
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "axds-actions", children: [
629
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "axds-muted", children: "也可以在对话里用 /ax-context" }),
630
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives2.Button, { size: "sm", variant: "ghost", disabled: props.disabled, onClick: props.onClear, children: "清空" }),
631
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
632
+ import_dsh_client_ui_primitives2.Button,
633
+ {
634
+ size: "sm",
635
+ variant: "primary",
636
+ disabled: props.disabled,
637
+ onClick: () => {
638
+ props.onSave({ productKind, version, customer });
639
+ },
640
+ children: "保存"
641
+ }
642
+ )
643
+ ] })
644
+ ] });
645
+ }
313
646
 
314
647
  // src/panel.tsx
315
- var import_jsx_runtime = require("react/jsx-runtime");
648
+ var import_jsx_runtime4 = require("react/jsx-runtime");
316
649
  var HEADERS = { "x-authinex-ds": "1" };
317
650
  async function api(path, init) {
318
651
  const response = await fetch(path, {
@@ -342,25 +675,54 @@ function draftOf(account) {
342
675
  for (const field of account.fields) draft[field.name] = field.value;
343
676
  return draft;
344
677
  }
678
+ function saveTextFile(name, text) {
679
+ const blob = new Blob([text], { type: "text/markdown;charset=utf-8" });
680
+ const url = URL.createObjectURL(blob);
681
+ const anchor = document.createElement("a");
682
+ anchor.href = url;
683
+ anchor.download = name;
684
+ document.body.appendChild(anchor);
685
+ anchor.click();
686
+ anchor.remove();
687
+ setTimeout(() => URL.revokeObjectURL(url), 0);
688
+ }
689
+ var SKILL_EMPTY = {
690
+ items: [],
691
+ total: 0,
692
+ page: 1,
693
+ pageSize: SKILL_PAGE_SIZE,
694
+ q: "",
695
+ status: "approved",
696
+ message: "",
697
+ loaded: false
698
+ };
345
699
  function AuthinexPanel() {
346
- const [state, setState] = (0, import_react.useState)(null);
347
- const [loaded, setLoaded] = (0, import_react.useState)(false);
348
- const [busy, setBusy] = (0, import_react.useState)("");
349
- const [notice, setNotice] = (0, import_react.useState)("");
350
- const [localError, setLocalError] = (0, import_react.useState)("");
351
- const [endpoint, setEndpoint] = (0, import_react.useState)("");
352
- const [key, setKey] = (0, import_react.useState)("");
353
- const [open, setOpen] = (0, import_react.useState)("");
354
- const [drafts, setDrafts] = (0, import_react.useState)({});
355
- const [confirmUnbind, setConfirmUnbind] = (0, import_react.useState)(false);
356
- const [confirmUpdate, setConfirmUpdate] = (0, import_react.useState)(false);
357
- const [restart, setRestart] = (0, import_react.useState)(false);
358
- const [feedback, setFeedback] = (0, import_react.useState)("");
359
- const model = (0, import_react.useMemo)(() => viewModel(state || void 0), [state]);
360
- const applyState = (0, import_react.useCallback)((next) => {
700
+ const [state, setState] = (0, import_react3.useState)(null);
701
+ const [loaded, setLoaded] = (0, import_react3.useState)(false);
702
+ const [busy, setBusy] = (0, import_react3.useState)("");
703
+ const [notice, setNotice] = (0, import_react3.useState)("");
704
+ const [localError, setLocalError] = (0, import_react3.useState)("");
705
+ const [endpoint, setEndpoint] = (0, import_react3.useState)("");
706
+ const [key, setKey] = (0, import_react3.useState)("");
707
+ const [open, setOpen] = (0, import_react3.useState)("");
708
+ const [drafts, setDrafts] = (0, import_react3.useState)({});
709
+ const [confirmUnbind, setConfirmUnbind] = (0, import_react3.useState)(false);
710
+ const [confirmUpdate, setConfirmUpdate] = (0, import_react3.useState)(false);
711
+ const [restart, setRestart] = (0, import_react3.useState)(false);
712
+ const [feedback, setFeedback] = (0, import_react3.useState)("");
713
+ const [tab, setTab] = (0, import_react3.useState)("overview");
714
+ const [accountsOpen, setAccountsOpen] = (0, import_react3.useState)(false);
715
+ const [skillView, setSkillView] = (0, import_react3.useState)(SKILL_EMPTY);
716
+ const [skillDraftQ, setSkillDraftQ] = (0, import_react3.useState)("");
717
+ const [skillOpen, setSkillOpen] = (0, import_react3.useState)(0);
718
+ const [skillBusy, setSkillBusy] = (0, import_react3.useState)("");
719
+ const [skillNotice, setSkillNotice] = (0, import_react3.useState)("");
720
+ const [skillFeedback, setSkillFeedback] = (0, import_react3.useState)("");
721
+ const model = (0, import_react3.useMemo)(() => viewModel(state || void 0), [state]);
722
+ const applyState = (0, import_react3.useCallback)((next) => {
361
723
  setState(next);
362
724
  }, []);
363
- const read = (0, import_react.useCallback)(async () => {
725
+ const read = (0, import_react3.useCallback)(async () => {
364
726
  try {
365
727
  applyState(await api("/authinex-ds/state"));
366
728
  return true;
@@ -371,13 +733,13 @@ function AuthinexPanel() {
371
733
  setLoaded(true);
372
734
  }
373
735
  }, [applyState]);
374
- (0, import_react.useEffect)(() => {
736
+ (0, import_react3.useEffect)(() => {
375
737
  void read();
376
738
  }, [read]);
377
- (0, import_react.useEffect)(() => {
739
+ (0, import_react3.useEffect)(() => {
378
740
  if (model.endpoint) setEndpoint((prev) => prev || model.endpoint);
379
741
  }, [model.endpoint]);
380
- const run = (0, import_react.useCallback)(async (label, work) => {
742
+ const run = (0, import_react3.useCallback)(async (label, work) => {
381
743
  setBusy(label);
382
744
  setNotice("");
383
745
  setLocalError("");
@@ -440,6 +802,7 @@ function AuthinexPanel() {
440
802
  setOpen("");
441
803
  setDrafts({});
442
804
  setEndpoint("");
805
+ setSkillView(SKILL_EMPTY);
443
806
  setNotice("已解除绑定,地址和密钥都清掉了");
444
807
  });
445
808
  };
@@ -494,6 +857,35 @@ function AuthinexPanel() {
494
857
  }
495
858
  });
496
859
  };
860
+ const loadSkills = (0, import_react3.useCallback)(async (page = 1, q = "", status = "approved") => {
861
+ setSkillBusy("list");
862
+ setSkillFeedback("");
863
+ setSkillNotice("");
864
+ try {
865
+ const [body] = await Promise.all([
866
+ api("/authinex-ds/skills", { method: "POST", body: { q, page, pageSize: SKILL_PAGE_SIZE, status } }),
867
+ dwell(300)
868
+ ]);
869
+ const items = Array.isArray(body.items) ? body.items : [];
870
+ setSkillView({
871
+ items,
872
+ total: Number(body.total || 0),
873
+ page: Number(body.page || page),
874
+ pageSize: Number(body.pageSize || SKILL_PAGE_SIZE),
875
+ q: String(body.q || q),
876
+ status: String(body.status || status),
877
+ message: String(body.message || ""),
878
+ loaded: true
879
+ });
880
+ setSkillOpen(0);
881
+ if (body.message) setSkillFeedback("warn");
882
+ } catch {
883
+ setSkillView((prev) => ({ ...prev, message: "没有取到技能列表", loaded: true }));
884
+ setSkillFeedback("error");
885
+ } finally {
886
+ setSkillBusy("");
887
+ }
888
+ }, []);
497
889
  const onRefresh = () => {
498
890
  void run("refresh", async () => {
499
891
  const [ok] = await Promise.all([read(), dwell()]);
@@ -504,6 +896,23 @@ function AuthinexPanel() {
504
896
  }
505
897
  setFeedback("ok");
506
898
  setNotice("已刷新");
899
+ if (skillView.loaded) void loadSkills(skillView.page, skillView.q, skillView.status);
900
+ });
901
+ };
902
+ const onSaveContext = (value) => {
903
+ void run("context", async () => {
904
+ const body = await api("/authinex-ds/context", { method: "POST", body: value });
905
+ if (body.state) applyState(body.state);
906
+ setNotice(String(body.message || (body.ok ? "已保存工作上下文" : "没有保存")));
907
+ setFeedback(body.ok ? "ok" : "error");
908
+ });
909
+ };
910
+ const onClearContext = () => {
911
+ void run("context", async () => {
912
+ const body = await api("/authinex-ds/context", { method: "POST", body: { clear: true } });
913
+ if (body.state) applyState(body.state);
914
+ setNotice(String(body.message || "已清空"));
915
+ setFeedback(body.ok ? "ok" : "error");
507
916
  });
508
917
  };
509
918
  const onCheckUpdate = () => {
@@ -527,42 +936,124 @@ function AuthinexPanel() {
527
936
  if (body.ok) setRestart(true);
528
937
  });
529
938
  };
939
+ const onImportSkill = async (input) => {
940
+ setSkillBusy("import");
941
+ setSkillNotice("");
942
+ setSkillFeedback("");
943
+ try {
944
+ const body = await api("/authinex-ds/skills/import", { method: "POST", body: input });
945
+ if (!body.ok) {
946
+ setSkillFeedback("error");
947
+ setSkillNotice(String(body.message || "没有提交成功"));
948
+ return false;
949
+ }
950
+ await loadSkills(1, "", "candidate");
951
+ setSkillFeedback("ok");
952
+ setSkillNotice(String(body.message || "已提交审核,通过后其他用户才能使用"));
953
+ return true;
954
+ } catch {
955
+ setSkillFeedback("error");
956
+ setSkillNotice("没有提交成功");
957
+ return false;
958
+ } finally {
959
+ setSkillBusy("");
960
+ }
961
+ };
962
+ const onSearchSkills = (event) => {
963
+ event?.preventDefault();
964
+ void loadSkills(1, skillDraftQ.trim(), skillView.status);
965
+ };
966
+ const onPageSkills = (next) => {
967
+ void loadSkills(next, skillView.q, skillView.status);
968
+ };
969
+ const onStatusSkills = (status) => {
970
+ void loadSkills(1, skillDraftQ.trim(), status);
971
+ };
972
+ const onDownloadSkill = (row) => {
973
+ setSkillBusy(`download:${row.id}`);
974
+ setSkillNotice("");
975
+ void (async () => {
976
+ try {
977
+ const body = await api("/authinex-ds/skills/export", { method: "POST", body: { id: row.id } });
978
+ if (!body.ok) {
979
+ setSkillNotice(String(body.message || "没有取到这篇技能"));
980
+ setSkillFeedback("error");
981
+ return;
982
+ }
983
+ const slug = String(body.slug || skillSlug(row.id));
984
+ saveTextFile(`${slug}-SKILL.md`, String(body.markdown || ""));
985
+ setSkillNotice(`已下载 ${slug}-SKILL.md`);
986
+ setSkillFeedback("ok");
987
+ } catch {
988
+ setSkillNotice("没有取到这篇技能");
989
+ setSkillFeedback("error");
990
+ } finally {
991
+ setSkillBusy("");
992
+ }
993
+ })();
994
+ };
995
+ const onInstallSkill = (row) => {
996
+ setSkillBusy(`install:${row.id}`);
997
+ setSkillNotice("");
998
+ void (async () => {
999
+ try {
1000
+ const body = await api("/authinex-ds/skills/install", { method: "POST", body: { id: row.id } });
1001
+ if (body.state) applyState(body.state);
1002
+ setSkillNotice(String(body.message || (body.ok ? "已装到本机" : "没有装上")));
1003
+ setSkillFeedback(body.ok ? "ok" : "error");
1004
+ } catch {
1005
+ setSkillNotice("没有装上");
1006
+ setSkillFeedback("error");
1007
+ } finally {
1008
+ setSkillBusy("");
1009
+ }
1010
+ })();
1011
+ };
1012
+ (0, import_react3.useEffect)(() => {
1013
+ if (tab !== "skills" || skillView.loaded || model.user === null) return;
1014
+ void loadSkills(1, skillView.q, skillView.status);
1015
+ }, [tab, skillView.loaded, skillView.q, skillView.status, model.user, loadSkills]);
530
1016
  const showForm = loaded && model.user === null;
531
1017
  const message = localError || notice || model.message;
532
1018
  const messageError = localError !== "" || model.phase === "invalid" || model.phase === "revoked" || model.phase === "unreachable";
533
1019
  const disabled = busy !== "";
534
1020
  const pending = busy === "refresh" ? "正在刷新…" : busy === "update" ? "正在检查更新…" : "";
535
1021
  const messageClass = feedback === "ok" ? "axds-ok" : feedback === "warn" ? "axds-notice" : messageError || feedback === "error" ? "axds-error" : "axds-muted";
536
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "axds", "aria-label": "AuthineX 助手", children: [
537
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("header", { className: "axds-head", children: [
538
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.StateDot, { state: model.tone }),
539
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "axds-head-text", children: [
540
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "axds-title", children: "AuthineX 助手" }),
541
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "axds-sub", children: loaded ? model.headline : "正在读取状态…" })
1022
+ const skillPending = skillBusy === "list" ? "正在取技能列表…" : "";
1023
+ const installed = model.installedSkills;
1024
+ const accountsReady = model.accounts.filter((account) => account.state !== "unconfigured").length;
1025
+ const accountsSummary = model.accounts.length ? `${accountsReady}/${model.accounts.length} 家已配置` : "读取账号状态中";
1026
+ const totalPages = pageCount(skillView.total, skillView.pageSize);
1027
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("section", { className: "axds", "aria-label": "AuthineX 助手", children: [
1028
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("header", { className: "axds-head", children: [
1029
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.StateDot, { state: model.tone }),
1030
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-head-text", children: [
1031
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "axds-title", children: "AuthineX 助手" }),
1032
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "axds-sub", children: loaded ? model.headline : "正在读取状态…" })
542
1033
  ] }),
543
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "axds-head-actions", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { size: "sm", disabled, onClick: onRefresh, children: busy === "refresh" ? "刷新中" : "刷新" }) })
1034
+ /* @__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" ? "刷新中" : "刷新" }) })
544
1035
  ] }),
545
- model.retryAfterSec > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "axds-notice", children: [
1036
+ model.retryAfterSec > 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { className: "axds-notice", children: [
546
1037
  "请等待 ",
547
1038
  model.retryAfterSec,
548
1039
  " 秒后再试。"
549
1040
  ] }) : null,
550
- model.phase === "upgrade" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "axds-error", children: [
1041
+ model.phase === "upgrade" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { className: "axds-error", children: [
551
1042
  "当前版本 ",
552
1043
  model.version,
553
1044
  ",最低要求 ",
554
1045
  model.minVersion,
555
1046
  "。请先更新插件。"
556
1047
  ] }) : null,
557
- pending ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "axds-pending", role: "status", children: [
558
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "axds-spin", "aria-hidden": "true" }),
559
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: pending })
560
- ] }, "pending") : message ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: messageClass, role: "status", children: message }, message) : null,
561
- showForm ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("form", { className: "axds-card", onSubmit: onBind, children: [
562
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "axds-field", children: [
563
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "访问地址" }),
564
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
565
- import_dsh_client_ui_primitives.Input,
1048
+ pending ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { className: "axds-pending", role: "status", children: [
1049
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-spin", "aria-hidden": "true" }),
1050
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: pending })
1051
+ ] }, "pending") : message ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: messageClass, role: "status", children: message }, message) : null,
1052
+ showForm ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("form", { className: "axds-card", onSubmit: onBind, children: [
1053
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "axds-field", children: [
1054
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "访问地址" }),
1055
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1056
+ import_dsh_client_ui_primitives3.Input,
566
1057
  {
567
1058
  className: "axds-input",
568
1059
  value: endpoint,
@@ -576,10 +1067,10 @@ function AuthinexPanel() {
576
1067
  }
577
1068
  )
578
1069
  ] }),
579
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "axds-field", children: [
580
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "密钥" }),
581
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
582
- import_dsh_client_ui_primitives.Input,
1070
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "axds-field", children: [
1071
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "密钥" }),
1072
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1073
+ import_dsh_client_ui_primitives3.Input,
583
1074
  {
584
1075
  className: "axds-input",
585
1076
  value: key,
@@ -593,181 +1084,411 @@ function AuthinexPanel() {
593
1084
  }
594
1085
  )
595
1086
  ] }),
596
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "axds-actions", children: [
597
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "axds-muted", children: "地址和密钥都由你填;插件本身不带任何地址或密钥。" }),
598
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { type: "submit", variant: "primary", size: "md", disabled: disabled || key.trim() === "", children: "绑定" })
1087
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-actions", children: [
1088
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-muted", children: "地址和密钥都由你填;插件本身不带任何地址或密钥。" }),
1089
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { type: "submit", variant: "primary", size: "md", disabled: disabled || key.trim() === "", children: "绑定" })
599
1090
  ] }),
600
- model.endpoint ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "axds-actions", children: [
601
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "axds-muted", children: [
1091
+ model.endpoint ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-actions", children: [
1092
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "axds-muted", children: [
602
1093
  "本机还记着上次的地址 ",
603
1094
  model.endpoint
604
1095
  ] }),
605
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { size: "sm", variant: "outline", disabled, onClick: () => {
1096
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { size: "sm", variant: "outline", disabled, onClick: () => {
606
1097
  setConfirmUnbind(true);
607
1098
  }, children: "解除绑定" })
608
1099
  ] }) : null
609
1100
  ] }) : null,
610
- model.user ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
611
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "axds-row", children: [
612
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: model.user.displayName }),
613
- model.endpoint ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "axds-muted", children: [
1101
+ model.user ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
1102
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-row", children: [
1103
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: model.user.displayName }),
1104
+ model.endpoint ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "axds-muted", children: [
614
1105
  "· ",
615
1106
  model.endpoint
616
1107
  ] }) : null
617
1108
  ] }),
618
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "axds-card", children: [
619
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "axds-between", children: [
620
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "axds-title", children: "可用功能" }),
621
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "axds-muted", children: [
622
- model.tools.length,
623
- " 个工具"
624
- ] })
625
- ] }),
626
- model.tools.length ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "axds-tags", children: model.toolNames.map((name) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Tag, { tone: "neutral", children: name }, name)) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "axds-muted", children: "当前角色没有可用工具。权限由运营台角色决定。" })
1109
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-tabs", role: "tablist", "aria-label": "配置分区", children: [
1110
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1111
+ "button",
1112
+ {
1113
+ type: "button",
1114
+ role: "tab",
1115
+ "aria-selected": tab === "overview",
1116
+ className: `axds-tab${tab === "overview" ? " on" : ""}`,
1117
+ onClick: () => setTab("overview"),
1118
+ children: "概览"
1119
+ }
1120
+ ),
1121
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1122
+ "button",
1123
+ {
1124
+ type: "button",
1125
+ role: "tab",
1126
+ "aria-selected": tab === "skills",
1127
+ className: `axds-tab${tab === "skills" ? " on" : ""}`,
1128
+ onClick: () => setTab("skills"),
1129
+ children: [
1130
+ "技能",
1131
+ installed.length ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-tab-badge", children: installed.length }) : null
1132
+ ]
1133
+ }
1134
+ )
627
1135
  ] }),
628
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "axds-card", children: [
629
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "axds-between", children: [
630
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "axds-title", children: "工单账号" }),
631
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "axds-muted", children: "与 AuthineX、运营台个人设置同一份" })
1136
+ tab === "overview" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
1137
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-card", children: [
1138
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-between", children: [
1139
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-title", children: "可用功能" }),
1140
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "axds-muted", children: [
1141
+ model.tools.length,
1142
+ " 个工具"
1143
+ ] })
1144
+ ] }),
1145
+ 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: "当前角色没有可用工具。权限由运营台角色决定。" })
632
1146
  ] }),
633
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "axds-accounts", children: model.accounts.map((account) => {
634
- const editing = open === account.id;
635
- const draft = drafts[account.id] || draftOf(account);
636
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "axds-account", children: [
637
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "axds-account-head", children: [
638
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.StateDot, { state: accountTone(account.state) }),
639
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "axds-account-name", children: account.label }),
640
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Tag, { tone: tagTone(account.state), children: account.status }),
641
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "axds-push" }),
642
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
643
- import_dsh_client_ui_primitives.Switch,
644
- {
645
- checked: account.enabled,
646
- label: `${account.label} 启用`,
647
- disabled,
648
- onChange: (next) => {
649
- onToggleEnabled(account, next);
650
- }
651
- }
652
- ),
653
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { size: "sm", variant: "ghost", disabled, onClick: () => {
654
- toggleAccount(account);
655
- }, children: editing ? "收起" : "配置" })
656
- ] }),
657
- account.hint ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "axds-notice", children: account.hint }) : null,
658
- account.username ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "axds-muted", children: [
659
- account.username,
660
- account.hasToken ? " · 已有凭据" : ""
661
- ] }) : null,
662
- editing ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
663
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "axds-fields", children: account.fields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "axds-field", children: [
664
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: field.title }),
665
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
666
- import_dsh_client_ui_primitives.Input,
1147
+ model.user ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1148
+ WorkContextCard,
1149
+ {
1150
+ value: model.workContext,
1151
+ disabled,
1152
+ onSave: onSaveContext,
1153
+ onClear: onClearContext
1154
+ }
1155
+ ) : null,
1156
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-card", children: [
1157
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1158
+ "button",
1159
+ {
1160
+ type: "button",
1161
+ className: "axds-collapse",
1162
+ "aria-expanded": accountsOpen,
1163
+ onClick: () => setAccountsOpen((value) => !value),
1164
+ children: [
1165
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: `axds-caret${accountsOpen ? " on" : ""}`, "aria-hidden": "true" }),
1166
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-title", children: "集成账号" }),
1167
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-muted", children: accountsSummary }),
1168
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-push" }),
1169
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-muted", children: "与 AuthineX、运营台个人设置同一份" })
1170
+ ]
1171
+ }
1172
+ ),
1173
+ accountsOpen ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "axds-accounts", children: model.accounts.map((account) => {
1174
+ const editing = open === account.id;
1175
+ const draft = drafts[account.id] || draftOf(account);
1176
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-account", children: [
1177
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-account-head", children: [
1178
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.StateDot, { state: accountTone(account.state) }),
1179
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(PlatformIcon, { id: account.id }),
1180
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-account-name", children: account.label }),
1181
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Tag, { tone: tagTone(account.state), children: account.status }),
1182
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-push" }),
1183
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1184
+ import_dsh_client_ui_primitives3.Switch,
667
1185
  {
668
- className: "axds-input",
669
- type: field.type,
670
- value: draft[field.name] ?? "",
671
- placeholder: field.placeholder,
672
- autoComplete: "off",
673
- spellCheck: false,
674
- onChange: (event) => {
675
- setField(account, field.name, event.target.value);
1186
+ checked: account.enabled,
1187
+ label: `${account.label} 启用`,
1188
+ disabled,
1189
+ onChange: (next) => {
1190
+ onToggleEnabled(account, next);
676
1191
  }
677
1192
  }
678
- )
679
- ] }, field.name)) }),
680
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "axds-actions", children: [
681
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "axds-muted", children: "保存前会先做一次连接测试" }),
682
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { size: "sm", disabled, onClick: () => {
683
- onTest(account);
684
- }, children: "测试连接" }),
685
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { size: "sm", variant: "primary", disabled, onClick: () => {
686
- onSave(account);
687
- }, children: "保存" })
688
- ] })
689
- ] }) : null
690
- ] }, account.id);
691
- }) })
692
- ] }),
693
- model.update?.version ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "axds-card", children: [
694
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "axds-between", children: [
695
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "axds-title", children: model.update.available ? `新版本 ${model.update.version}` : `已是最新(${model.update.version})` }),
696
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Tag, { tone: model.update.available ? "info" : "success", children: model.update.available ? "可更新" : "最新" })
1193
+ ),
1194
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { size: "sm", variant: "ghost", disabled, onClick: () => {
1195
+ toggleAccount(account);
1196
+ }, children: editing ? "收起" : "配置" })
1197
+ ] }),
1198
+ account.hint ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "axds-notice", children: account.hint }) : null,
1199
+ account.username ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { className: "axds-muted", children: [
1200
+ account.username,
1201
+ account.hasToken ? " · 已有凭据" : ""
1202
+ ] }) : null,
1203
+ editing ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
1204
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "axds-fields", children: account.fields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "axds-field", children: [
1205
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: field.title }),
1206
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1207
+ import_dsh_client_ui_primitives3.Input,
1208
+ {
1209
+ className: "axds-input",
1210
+ type: field.type,
1211
+ value: draft[field.name] ?? "",
1212
+ placeholder: field.placeholder,
1213
+ autoComplete: "off",
1214
+ spellCheck: false,
1215
+ onChange: (event) => {
1216
+ setField(account, field.name, event.target.value);
1217
+ }
1218
+ }
1219
+ )
1220
+ ] }, field.name)) }),
1221
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-actions", children: [
1222
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-muted", children: "保存前会先做一次连接测试" }),
1223
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { size: "sm", disabled, onClick: () => {
1224
+ onTest(account);
1225
+ }, children: "测试连接" }),
1226
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { size: "sm", variant: "primary", disabled, onClick: () => {
1227
+ onSave(account);
1228
+ }, children: "保存" })
1229
+ ] })
1230
+ ] }) : null
1231
+ ] }, account.id);
1232
+ }) }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-muted", children: "展开才显示各平台账号和开关;收起不影响查单建单。" })
697
1233
  ] }),
698
- model.update.notes ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "axds-muted", children: model.update.notes }) : null,
699
- model.update.sha ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "axds-muted", children: [
700
- "校验值 ",
701
- model.update.sha
1234
+ model.update?.version ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-card", children: [
1235
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-between", children: [
1236
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-title", children: model.update.available ? `新版本 ${model.update.version}` : `已是最新(${model.update.version})` }),
1237
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Tag, { tone: model.update.available ? "info" : "success", children: model.update.available ? "可更新" : "最新" })
1238
+ ] }),
1239
+ model.update.notes ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "axds-muted", children: model.update.notes }) : null,
1240
+ model.update.sha ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { className: "axds-muted", children: [
1241
+ "校验值 ",
1242
+ model.update.sha
1243
+ ] }) : null,
1244
+ model.update.available ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-actions", children: [
1245
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-muted", children: "更新由 DeepSeek 自己的安装器完成,装完要重启智能问答" }),
1246
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_dsh_client_ui_primitives3.Button, { size: "sm", variant: "primary", disabled, onClick: () => {
1247
+ setConfirmUpdate(true);
1248
+ }, children: [
1249
+ "更新到 ",
1250
+ model.update.version
1251
+ ] })
1252
+ ] }) : null
1253
+ ] }) : null,
1254
+ confirmUpdate ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-confirm", children: [
1255
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { children: [
1256
+ "现在更新到 ",
1257
+ model.update?.version,
1258
+ "?装完需要重启智能问答。"
1259
+ ] }),
1260
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { size: "sm", variant: "outline", onClick: () => {
1261
+ setConfirmUpdate(false);
1262
+ }, children: "取消" }),
1263
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { size: "sm", variant: "primary", disabled, onClick: onApplyUpdate, children: "确认更新" })
702
1264
  ] }) : null,
703
- model.update.available ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "axds-actions", children: [
704
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "axds-muted", children: "更新由 DeepSeek 自己的安装器完成,装完要重启智能问答" }),
705
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_dsh_client_ui_primitives.Button, { size: "sm", variant: "primary", disabled, onClick: () => {
706
- setConfirmUpdate(true);
707
- }, children: [
708
- "更新到 ",
709
- model.update.version
1265
+ restart ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "axds-notice", children: "已装好,重启智能问答后新版本才生效。" }) : null,
1266
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-card", children: [
1267
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "axds-field", children: [
1268
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "新密钥" }),
1269
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1270
+ import_dsh_client_ui_primitives3.Input,
1271
+ {
1272
+ className: "axds-input",
1273
+ value: key,
1274
+ placeholder: "auds-p-XXXX-XXXX-XXX",
1275
+ autoComplete: "off",
1276
+ spellCheck: false,
1277
+ onChange: (event) => {
1278
+ setKey(event.target.value);
1279
+ setLocalError("");
1280
+ }
1281
+ }
1282
+ )
1283
+ ] }),
1284
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-actions", children: [
1285
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-muted", children: "贴一把新密钥会重新兑换,运营台才会变成已绑定" }),
1286
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { size: "sm", variant: "primary", disabled: disabled || key.trim() === "", onClick: onRebind, children: "绑定这把密钥" })
710
1287
  ] })
711
- ] }) : null
712
- ] }) : null,
713
- confirmUpdate ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "axds-confirm", children: [
714
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
715
- "现在更新到 ",
716
- model.update?.version,
717
- "?装完需要重启智能问答。"
718
1288
  ] }),
719
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { size: "sm", variant: "outline", onClick: () => {
720
- setConfirmUpdate(false);
721
- }, children: "取消" }),
722
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { size: "sm", variant: "primary", disabled, onClick: onApplyUpdate, children: "确认更新" })
1289
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-row", children: [
1290
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { size: "sm", disabled, onClick: onCheckUpdate, children: busy === "update" ? "检查中" : "检查更新" }),
1291
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-muted", children: "服务端有更新清单就走清单,没有就比 npm 上的版本号" })
1292
+ ] })
723
1293
  ] }) : null,
724
- restart ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "axds-notice", children: "已装好,重启智能问答后新版本才生效。" }) : null,
725
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "axds-card", children: [
726
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "axds-field", children: [
727
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "新密钥" }),
728
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
729
- import_dsh_client_ui_primitives.Input,
1294
+ tab === "skills" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-card", children: [
1295
+ model.user && model.skillsOnline ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "axds-muted", children: "技能已由插件在线提供,无需安装" }) : null,
1296
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-between", children: [
1297
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-title", children: "技能" }),
1298
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-muted", children: skillView.loaded ? `共 ${skillView.total} 个 · 本机已装 ${installed.length} 个` : "来自 AgentHub 技能库" })
1299
+ ] }),
1300
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SkillImport, { disabled: disabled || skillBusy !== "", onSubmit: onImportSkill }),
1301
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("form", { className: "axds-skill-search", onSubmit: onSearchSkills, children: [
1302
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1303
+ import_dsh_client_ui_primitives3.Input,
730
1304
  {
731
1305
  className: "axds-input",
732
- value: key,
733
- placeholder: "auds-p-XXXX-XXXX-XXX",
1306
+ value: skillDraftQ,
1307
+ placeholder: "搜技能名、适用场景,或填编号(2470 / skill-2470)",
734
1308
  autoComplete: "off",
735
1309
  spellCheck: false,
736
1310
  onChange: (event) => {
737
- setKey(event.target.value);
738
- setLocalError("");
1311
+ setSkillDraftQ(event.target.value);
739
1312
  }
740
1313
  }
1314
+ ),
1315
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { size: "sm", variant: "primary", type: "submit", disabled: skillBusy !== "", children: "检索" }),
1316
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1317
+ import_dsh_client_ui_primitives3.Button,
1318
+ {
1319
+ size: "sm",
1320
+ variant: "ghost",
1321
+ type: "button",
1322
+ disabled: skillBusy !== "",
1323
+ onClick: () => {
1324
+ setSkillDraftQ("");
1325
+ void loadSkills(1, "", skillView.status);
1326
+ },
1327
+ children: "清空"
1328
+ }
741
1329
  )
742
1330
  ] }),
743
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "axds-actions", children: [
744
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "axds-muted", children: "贴一把新密钥会重新兑换,运营台才会变成已绑定" }),
745
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { size: "sm", variant: "primary", disabled: disabled || key.trim() === "", onClick: onRebind, children: "绑定这把密钥" })
746
- ] })
747
- ] }),
748
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "axds-row", children: [
749
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { size: "sm", disabled, onClick: onCheckUpdate, children: busy === "update" ? "检查中" : "检查更新" }),
750
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { size: "sm", variant: "outline", disabled, onClick: () => {
1331
+ /* @__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)(
1332
+ "button",
1333
+ {
1334
+ type: "button",
1335
+ className: `axds-chip${skillView.status === option.value ? " on" : ""}`,
1336
+ "aria-pressed": skillView.status === option.value,
1337
+ disabled: skillBusy !== "",
1338
+ onClick: () => {
1339
+ onStatusSkills(option.value);
1340
+ },
1341
+ children: option.label
1342
+ },
1343
+ option.value || "all"
1344
+ )) }),
1345
+ skillPending ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { className: "axds-pending", role: "status", children: [
1346
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-spin", "aria-hidden": "true" }),
1347
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: skillPending })
1348
+ ] }) : null,
1349
+ skillNotice ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1350
+ "p",
1351
+ {
1352
+ className: skillFeedback === "ok" ? "axds-ok" : skillFeedback === "error" ? "axds-error" : "axds-notice",
1353
+ role: "status",
1354
+ children: skillNotice
1355
+ }
1356
+ ) : null,
1357
+ !skillPending && skillView.message ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: skillView.items.length ? "axds-notice" : "axds-muted", role: "status", children: skillView.message }) : null,
1358
+ skillView.loaded && skillView.items.length === 0 && !skillPending ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "axds-muted", children: skillView.q ? `没有搜到「${skillView.q}」` : "这个状态下还没有技能" }) : null,
1359
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "axds-skills", children: skillView.items.map((row) => {
1360
+ const expanded = skillOpen === row.id;
1361
+ const done = skillInstalled(row, installed);
1362
+ const status = row.status || "approved";
1363
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: `axds-skill${expanded ? " on" : ""}`, children: [
1364
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1365
+ "button",
1366
+ {
1367
+ type: "button",
1368
+ className: "axds-skill-head",
1369
+ "aria-expanded": expanded,
1370
+ onClick: () => setSkillOpen((prev) => prev === row.id ? 0 : row.id),
1371
+ children: [
1372
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: `axds-caret${expanded ? " on" : ""}`, "aria-hidden": "true" }),
1373
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-skill-name", children: row.name || skillSlug(row.id) }),
1374
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-push" }),
1375
+ done ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Tag, { tone: "success", children: "已装" }) : null,
1376
+ skillUploaderText(row) ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Tag, { tone: "info", children: skillUploaderText(row) }) : null,
1377
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Tag, { tone: "quiet", children: skillKindText(row.skillKind) }),
1378
+ 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
1379
+ ]
1380
+ }
1381
+ ),
1382
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "axds-skill-desc", children: row.triggerDesc || "没有写适用场景" }),
1383
+ expanded ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-skill-body", children: [
1384
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("dl", { className: "axds-kv", children: [
1385
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
1386
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dt", { children: "编号" }),
1387
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dd", { children: skillSlug(row.id) })
1388
+ ] }),
1389
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
1390
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dt", { children: "适用范围" }),
1391
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dd", { children: skillScopeText(row) })
1392
+ ] }),
1393
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
1394
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dt", { children: "更新时间" }),
1395
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dd", { children: row.updatedAt || "—" })
1396
+ ] }),
1397
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
1398
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dt", { children: "来源" }),
1399
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dd", { children: row.sourceKind || "—" })
1400
+ ] })
1401
+ ] }),
1402
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-actions", children: [
1403
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1404
+ import_dsh_client_ui_primitives3.Button,
1405
+ {
1406
+ size: "sm",
1407
+ variant: "ghost",
1408
+ disabled: skillBusy !== "",
1409
+ onClick: () => {
1410
+ onDownloadSkill(row);
1411
+ },
1412
+ children: skillBusy === `download:${row.id}` ? "下载中…" : "下载 SKILL.md"
1413
+ }
1414
+ ),
1415
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1416
+ import_dsh_client_ui_primitives3.Button,
1417
+ {
1418
+ size: "sm",
1419
+ variant: "primary",
1420
+ disabled: skillBusy !== "" || status !== "approved",
1421
+ title: status === "approved" ? "" : "审核通过后才能装到本机",
1422
+ onClick: () => {
1423
+ onInstallSkill(row);
1424
+ },
1425
+ children: skillBusy === `install:${row.id}` ? "安装中…" : done ? "重新安装" : "装到本机"
1426
+ }
1427
+ )
1428
+ ] })
1429
+ ] }) : null
1430
+ ] }, row.id);
1431
+ }) }),
1432
+ skillView.total > 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-pager", children: [
1433
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "axds-muted", children: [
1434
+ "第 ",
1435
+ skillView.page,
1436
+ " / ",
1437
+ totalPages,
1438
+ " 页 · 共 ",
1439
+ skillView.total,
1440
+ " 个"
1441
+ ] }),
1442
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-push" }),
1443
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1444
+ import_dsh_client_ui_primitives3.Button,
1445
+ {
1446
+ size: "sm",
1447
+ variant: "outline",
1448
+ disabled: skillBusy !== "" || skillView.page <= 1,
1449
+ onClick: () => {
1450
+ onPageSkills(skillView.page - 1);
1451
+ },
1452
+ children: "上一页"
1453
+ }
1454
+ ),
1455
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1456
+ import_dsh_client_ui_primitives3.Button,
1457
+ {
1458
+ size: "sm",
1459
+ variant: "outline",
1460
+ disabled: skillBusy !== "" || skillView.page >= totalPages,
1461
+ onClick: () => {
1462
+ onPageSkills(skillView.page + 1);
1463
+ },
1464
+ children: "下一页"
1465
+ }
1466
+ )
1467
+ ] }) : null,
1468
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "axds-muted", children: "装到本机技能目录 ~/.dsh/skills/<编号>/SKILL.md,只写这个目录、不动工作区;新会话才会读到。" })
1469
+ ] }) : null,
1470
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-row", children: [
1471
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { size: "sm", variant: "outline", disabled, onClick: () => {
751
1472
  setConfirmUnbind(true);
752
1473
  }, children: "解除绑定" }),
753
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "axds-muted", children: "解除后地址和密钥都会清掉,要重新填" })
1474
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "axds-muted", children: "解除后地址和密钥都会清掉,要重新填" })
754
1475
  ] })
755
1476
  ] }) : null,
756
- confirmUnbind ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "axds-confirm", children: [
757
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "确认解除这台设备的绑定?" }),
758
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { size: "sm", variant: "outline", onClick: () => {
1477
+ confirmUnbind ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "axds-confirm", children: [
1478
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "确认解除这台设备的绑定?" }),
1479
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { size: "sm", variant: "outline", onClick: () => {
759
1480
  setConfirmUnbind(false);
760
1481
  }, children: "取消" }),
761
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { size: "sm", variant: "primary", disabled, onClick: onUnbind, children: "确认解除" })
1482
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { size: "sm", variant: "primary", disabled, onClick: onUnbind, children: "确认解除" })
762
1483
  ] }) : null,
763
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("footer", { className: "axds-foot", children: [
764
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
1484
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("footer", { className: "axds-foot", children: [
1485
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { children: [
765
1486
  "v",
766
1487
  model.version || "0.1.0"
767
1488
  ] }),
768
- model.endpoint ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
769
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "·" }),
770
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: model.endpoint })
1489
+ model.endpoint ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
1490
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "·" }),
1491
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: model.endpoint })
771
1492
  ] }) : null
772
1493
  ] })
773
1494
  ] });
@@ -803,6 +1524,7 @@ var CSS = `
803
1524
  .axds-accounts{display:flex;flex-direction:column;gap:8px}
804
1525
  .axds-account{border:0.5px solid var(--dsw-alias-border-l1);border-radius:10px;padding:10px;display:flex;flex-direction:column;gap:8px}
805
1526
  .axds-account-head{display:flex;align-items:center;gap:8px}
1527
+ .axds-logo{width:16px;height:16px;flex:none;border-radius:3px;object-fit:contain;display:block}
806
1528
  .axds-account-name{font-weight:600}
807
1529
  .axds-account-head .axds-push{margin-left:auto}
808
1530
  .axds-fields{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:8px}
@@ -813,6 +1535,45 @@ var CSS = `
813
1535
  .axds-foot{display:flex;gap:8px;align-items:center;color:var(--dsw-alias-label-tertiary);font-size:11px}
814
1536
  .axds-confirm{display:flex;gap:8px;align-items:center;flex-wrap:wrap;padding:8px 10px;border-radius:8px;background:var(--dsw-alias-bg-layer-1)}
815
1537
  .axds-confirm span{margin-right:auto;font-size:12px;color:var(--dsw-alias-label-secondary)}
1538
+ .axds-push{margin-left:auto}
1539
+ /* 页签:概览 / 技能。按钮自己就是页签,不引入额外组件。 */
1540
+ .axds-tabs{display:flex;gap:4px;padding:3px;border-radius:10px;background:var(--dsw-alias-bg-layer-1);align-self:flex-start}
1541
+ .axds-tab{display:inline-flex;align-items:center;gap:6px;border:0;background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:13px;padding:5px 14px;border-radius:8px;cursor:pointer;transition:background .15s ease,color .15s ease}
1542
+ .axds-tab:hover{color:var(--dsw-alias-label-primary)}
1543
+ .axds-tab.on{background:var(--dsw-alias-settings-card-fill);color:var(--dsw-alias-label-primary);font-weight:600;box-shadow:0 1px 2px rgb(0 0 0 / 6%)}
1544
+ .axds-tab-badge{min-width:16px;height:16px;line-height:16px;padding:0 4px;border-radius:8px;background:var(--dsw-alias-state-success-primary);color:#fff;font-size:10px;text-align:center}
1545
+ /* 折叠标题:整行可点,箭头只做指示。 */
1546
+ .axds-collapse{display:flex;align-items:center;gap:8px;width:100%;border:0;background:transparent;padding:0;font:inherit;color:inherit;cursor:pointer;text-align:left}
1547
+ .axds-collapse:hover .axds-title{color:var(--dsw-alias-label-primary)}
1548
+ .axds-caret{display:inline-block;width:0;height:0;flex:none;border-left:5px solid var(--dsw-alias-label-tertiary);border-top:4px solid transparent;border-bottom:4px solid transparent;transition:transform .15s ease}
1549
+ .axds-caret.on{transform:rotate(90deg)}
1550
+ @media (prefers-reduced-motion:reduce){.axds-caret,.axds-tab{transition:none}}
1551
+ /* 技能页 */
1552
+ .axds-skill-search{display:flex;gap:8px;align-items:center}
1553
+ .axds-skill-search .axds-input{flex:1}
1554
+ .axds-skill-filter{display:flex;gap:6px;flex-wrap:wrap}
1555
+ .axds-chip{border:0.5px solid var(--dsw-alias-border-l1);background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:12px;padding:3px 10px;border-radius:999px;cursor:pointer}
1556
+ .axds-chip:hover{color:var(--dsw-alias-label-primary)}
1557
+ .axds-chip.on{border-color:transparent;background:var(--dsw-alias-label-primary);color:var(--dsw-alias-settings-card-fill);font-weight:600}
1558
+ .axds-chip:disabled{opacity:.55;cursor:default}
1559
+ .axds-skills{display:flex;flex-direction:column;gap:8px}
1560
+ .axds-skill{border:0.5px solid var(--dsw-alias-border-l1);border-radius:10px;padding:8px 10px;display:flex;flex-direction:column;gap:4px}
1561
+ .axds-skill.on{border-color:var(--dsw-alias-label-tertiary)}
1562
+ .axds-skill-head{display:flex;align-items:center;gap:8px;width:100%;border:0;background:transparent;padding:0;font:inherit;color:inherit;cursor:pointer;text-align:left}
1563
+ .axds-skill-name{font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}
1564
+ .axds-skill-desc{margin:0;color:var(--dsw-alias-label-tertiary);font-size:12px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
1565
+ .axds-skill-body{display:flex;flex-direction:column;gap:8px;padding-top:6px}
1566
+ .axds-kv{margin:0;display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:6px 12px;font-size:12px}
1567
+ .axds-kv>div{display:flex;gap:6px;min-width:0}
1568
+ .axds-kv dt{color:var(--dsw-alias-label-tertiary);flex:none}
1569
+ .axds-kv dd{margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
1570
+ .axds-pager{display:flex;align-items:center;gap:8px}
1571
+ .axds-import{display:flex;flex-direction:column;gap:8px}
1572
+ .axds-import-form{display:flex;flex-direction:column;gap:8px}
1573
+ .axds-plain,.axds-select,.axds-textarea{width:100%;box-sizing:border-box;border:0.5px solid var(--dsw-alias-border-l1);border-radius:8px;background:transparent;color:inherit;font:inherit;font-size:13px}
1574
+ .axds-plain,.axds-select{height:32px;padding:0 8px}
1575
+ .axds-textarea{min-height:96px;resize:vertical;padding:8px;line-height:1.5}
1576
+ .axds-file{display:none}
816
1577
  `;
817
1578
  var mounted = 0;
818
1579
  function installClientStyles() {