dsh-agent-toolkit 0.2.6 → 0.2.7

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
@@ -68,14 +68,14 @@ window.__ModuleLoader__.load({
68
68
  }
69
69
  var delegate_card_module_css_default = {
70
70
  "summary": "_8wQUq_summary",
71
- "prompt": "_8wQUq_prompt",
71
+ "body": "_8wQUq_body",
72
72
  "row": "_8wQUq_row",
73
- "childLink": "_8wQUq_childLink",
74
- "root": "_8wQUq_root",
75
- "result": "_8wQUq_result",
76
73
  "chip": "_8wQUq_chip",
74
+ "prompt": "_8wQUq_prompt",
75
+ "result": "_8wQUq_result",
77
76
  "visuallyHidden": "_8wQUq_visuallyHidden",
78
- "body": "_8wQUq_body"
77
+ "root": "_8wQUq_root",
78
+ "childLink": "_8wQUq_childLink"
79
79
  };
80
80
  //#endregion
81
81
  //#region src/client/delegate/delegate-card.tsx
@@ -311,8 +311,8 @@ window.__ModuleLoader__.load({
311
311
  document.head.appendChild(tag);
312
312
  }
313
313
  var entry_module_css_default$1 = {
314
- "trigger": "VJWWsa_trigger",
315
- "rail": "VJWWsa_rail"
314
+ "rail": "VJWWsa_rail",
315
+ "trigger": "VJWWsa_trigger"
316
316
  };
317
317
  //#endregion
318
318
  //#region src/client/shared/entry.tsx
@@ -411,33 +411,33 @@ window.__ModuleLoader__.load({
411
411
  document.head.appendChild(tag);
412
412
  }
413
413
  var agents_module_css_default = {
414
- "hint": "KsfSLW_hint",
415
- "listPane": "KsfSLW_listPane",
416
- "agentRow": "KsfSLW_agentRow",
417
- "agentRowActive": "KsfSLW_agentRowActive",
418
- "createButton": "KsfSLW_createButton",
414
+ "readonlyId": "KsfSLW_readonlyId",
415
+ "split": "KsfSLW_split",
416
+ "toolGroupSet": "KsfSLW_toolGroupSet",
419
417
  "editorPane": "KsfSLW_editorPane",
420
- "editor": "KsfSLW_editor",
421
- "blockTitle": "KsfSLW_blockTitle",
422
418
  "toolGrid": "KsfSLW_toolGrid",
423
- "split": "KsfSLW_split",
424
- "actions": "KsfSLW_actions",
419
+ "hint": "KsfSLW_hint",
425
420
  "dangerButton": "KsfSLW_dangerButton",
426
- "toolGroupTitle": "KsfSLW_toolGroupTitle",
427
- "toolCheck": "KsfSLW_toolCheck",
428
- "readonlyId": "KsfSLW_readonlyId",
421
+ "actions": "KsfSLW_actions",
429
422
  "select": "KsfSLW_select",
423
+ "agentRowActive": "KsfSLW_agentRowActive",
424
+ "toolCheck": "KsfSLW_toolCheck",
425
+ "block": "KsfSLW_block",
426
+ "editor": "KsfSLW_editor",
427
+ "dialog": "KsfSLW_dialog",
430
428
  "toolMode": "KsfSLW_toolMode",
431
- "field": "KsfSLW_field",
432
- "toolGroupSet": "KsfSLW_toolGroupSet",
433
- "error": "KsfSLW_error",
434
- "agentDesc": "KsfSLW_agentDesc",
429
+ "agentRow": "KsfSLW_agentRow",
430
+ "blockTitle": "KsfSLW_blockTitle",
431
+ "input": "KsfSLW_input",
432
+ "textarea": "KsfSLW_textarea",
435
433
  "agentName": "KsfSLW_agentName",
436
434
  "builtinBadge": "KsfSLW_builtinBadge",
437
- "textarea": "KsfSLW_textarea",
438
- "dialog": "KsfSLW_dialog",
439
- "block": "KsfSLW_block",
440
- "input": "KsfSLW_input"
435
+ "toolGroupTitle": "KsfSLW_toolGroupTitle",
436
+ "error": "KsfSLW_error",
437
+ "agentDesc": "KsfSLW_agentDesc",
438
+ "listPane": "KsfSLW_listPane",
439
+ "field": "KsfSLW_field",
440
+ "createButton": "KsfSLW_createButton"
441
441
  };
442
442
  //#endregion
443
443
  //#region src/client/agents/AgentEditor.tsx
@@ -951,24 +951,24 @@ window.__ModuleLoader__.load({
951
951
  document.head.appendChild(tag);
952
952
  }
953
953
  var prompt_module_css_default = {
954
- "tab": "VZk1fa_tab",
955
- "field": "VZk1fa_field",
956
- "textarea": "VZk1fa_textarea",
957
- "error": "VZk1fa_error",
958
- "layerRowActive": "VZk1fa_layerRowActive",
959
- "layerOrder": "VZk1fa_layerOrder",
960
- "listPane": "VZk1fa_listPane",
961
954
  "dialog": "VZk1fa_dialog",
962
- "editorPane": "VZk1fa_editorPane",
963
955
  "editor": "VZk1fa_editor",
956
+ "editorPane": "VZk1fa_editorPane",
957
+ "listPane": "VZk1fa_listPane",
958
+ "layerOrder": "VZk1fa_layerOrder",
959
+ "tabs": "VZk1fa_tabs",
960
+ "textarea": "VZk1fa_textarea",
961
+ "layerName": "VZk1fa_layerName",
962
+ "field": "VZk1fa_field",
964
963
  "split": "VZk1fa_split",
965
- "actions": "VZk1fa_actions",
966
964
  "layerRow": "VZk1fa_layerRow",
967
- "readonlyTag": "VZk1fa_readonlyTag",
965
+ "layerRowActive": "VZk1fa_layerRowActive",
966
+ "actions": "VZk1fa_actions",
967
+ "hint": "VZk1fa_hint",
968
968
  "tabActive": "VZk1fa_tabActive",
969
- "layerName": "VZk1fa_layerName",
970
- "tabs": "VZk1fa_tabs",
971
- "hint": "VZk1fa_hint"
969
+ "error": "VZk1fa_error",
970
+ "tab": "VZk1fa_tab",
971
+ "readonlyTag": "VZk1fa_readonlyTag"
972
972
  };
973
973
  //#endregion
974
974
  //#region src/client/prompt/PromptLayersModal.tsx
@@ -1452,13 +1452,13 @@ window.__ModuleLoader__.load({
1452
1452
  document.head.appendChild(tag);
1453
1453
  }
1454
1454
  var chart_module_css_default = {
1455
- "chartTheme": "_8LXSJW_chartTheme",
1456
1455
  "tooltipTotal": "_8LXSJW_tooltipTotal",
1457
1456
  "legend": "_8LXSJW_legend",
1458
- "tooltipTitle": "_8LXSJW_tooltipTitle",
1459
1457
  "swatchFresh": "_8LXSJW_swatchFresh",
1460
- "swatchCached": "_8LXSJW_swatchCached",
1461
- "tooltip": "_8LXSJW_tooltip"
1458
+ "tooltipTitle": "_8LXSJW_tooltipTitle",
1459
+ "tooltip": "_8LXSJW_tooltip",
1460
+ "chartTheme": "_8LXSJW_chartTheme",
1461
+ "swatchCached": "_8LXSJW_swatchCached"
1462
1462
  };
1463
1463
  //#endregion
1464
1464
  //#region \0dsh-css:D:\work\github\dsh\dsh-agent-toolkit\packages\usage\src\client\usage\ActivityHeatmap.module.css.mjs
@@ -1472,14 +1472,14 @@ window.__ModuleLoader__.load({
1472
1472
  document.head.appendChild(tag);
1473
1473
  }
1474
1474
  var ActivityHeatmap_module_css_default = {
1475
- "level3": "hjrYrq_level3",
1476
1475
  "level2": "hjrYrq_level2",
1477
- "level0": "hjrYrq_level0",
1478
1476
  "grid": "hjrYrq_grid",
1477
+ "level3": "hjrYrq_level3",
1478
+ "months": "hjrYrq_months",
1479
1479
  "level4": "hjrYrq_level4",
1480
- "level1": "hjrYrq_level1",
1481
1480
  "week": "hjrYrq_week",
1482
- "months": "hjrYrq_months"
1481
+ "level0": "hjrYrq_level0",
1482
+ "level1": "hjrYrq_level1"
1483
1483
  };
1484
1484
  //#endregion
1485
1485
  //#region ../usage/src/client/usage/ActivityHeatmap.tsx
@@ -52516,19 +52516,19 @@ ${te.current.stack}
52516
52516
  document.head.appendChild(tag);
52517
52517
  }
52518
52518
  var UsageModal_module_css_default = {
52519
- "compaction": "MODeXa_compaction",
52520
- "dateLabel": "MODeXa_dateLabel",
52521
- "tab": "MODeXa_tab",
52522
- "total": "MODeXa_total",
52519
+ "dialog": "MODeXa_dialog",
52523
52520
  "tabActive": "MODeXa_tabActive",
52524
- "pagerButton": "MODeXa_pagerButton",
52525
- "pager": "MODeXa_pager",
52526
52521
  "rowName": "MODeXa_rowName",
52527
- "dialog": "MODeXa_dialog",
52522
+ "tab": "MODeXa_tab",
52523
+ "pagerButton": "MODeXa_pagerButton",
52528
52524
  "sectionTitle": "MODeXa_sectionTitle",
52525
+ "rowCalls": "MODeXa_rowCalls",
52526
+ "total": "MODeXa_total",
52527
+ "compaction": "MODeXa_compaction",
52528
+ "dateLabel": "MODeXa_dateLabel",
52529
+ "pager": "MODeXa_pager",
52529
52530
  "tabs": "MODeXa_tabs",
52530
- "row": "MODeXa_row",
52531
- "rowCalls": "MODeXa_rowCalls"
52531
+ "row": "MODeXa_row"
52532
52532
  };
52533
52533
  //#endregion
52534
52534
  //#region ../usage/src/client/usage/UsageModal.tsx
@@ -55153,29 +55153,29 @@ ${te.current.stack}
55153
55153
  document.head.appendChild(tag);
55154
55154
  }
55155
55155
  var bots_module_css_default = {
55156
- "formActions": "vTbXga_formActions",
55157
- "steps": "vTbXga_steps",
55158
- "tab": "vTbXga_tab",
55159
- "error": "vTbXga_error",
55160
- "tabs": "vTbXga_tabs",
55161
- "dialog": "vTbXga_dialog",
55162
- "step": "vTbXga_step",
55163
- "scanSection": "vTbXga_scanSection",
55156
+ "hint": "vTbXga_hint",
55157
+ "group": "vTbXga_group",
55164
55158
  "textarea": "vTbXga_textarea",
55165
- "createButton": "vTbXga_createButton",
55159
+ "field": "vTbXga_field",
55166
55160
  "groupTitle": "vTbXga_groupTitle",
55167
- "stepSeparator": "vTbXga_stepSeparator",
55168
- "status": "vTbXga_status",
55169
- "hint": "vTbXga_hint",
55170
55161
  "botRow": "vTbXga_botRow",
55171
- "channelBadge": "vTbXga_channelBadge",
55172
- "group": "vTbXga_group",
55173
- "tabActive": "vTbXga_tabActive",
55174
55162
  "stepActive": "vTbXga_stepActive",
55163
+ "tab": "vTbXga_tab",
55164
+ "dialog": "vTbXga_dialog",
55165
+ "createButton": "vTbXga_createButton",
55166
+ "step": "vTbXga_step",
55167
+ "scanSection": "vTbXga_scanSection",
55175
55168
  "botName": "vTbXga_botName",
55176
55169
  "select": "vTbXga_select",
55177
55170
  "input": "vTbXga_input",
55178
- "field": "vTbXga_field"
55171
+ "error": "vTbXga_error",
55172
+ "tabs": "vTbXga_tabs",
55173
+ "formActions": "vTbXga_formActions",
55174
+ "status": "vTbXga_status",
55175
+ "steps": "vTbXga_steps",
55176
+ "stepSeparator": "vTbXga_stepSeparator",
55177
+ "channelBadge": "vTbXga_channelBadge",
55178
+ "tabActive": "vTbXga_tabActive"
55179
55179
  };
55180
55180
  //#endregion
55181
55181
  //#region src/client/bots/BotForm.tsx
@@ -55195,11 +55195,12 @@ ${te.current.stack}
55195
55195
  const [providersLoaded, setProvidersLoaded] = (0, react.useState)(false);
55196
55196
  const [models, setModels] = (0, react.useState)([]);
55197
55197
  const [tab, setTab] = (0, react.useState)("scan");
55198
- const [appId, setAppId] = (0, react.useState)(bot?.feishu.appId ?? "");
55198
+ const [appId, setAppId] = (0, react.useState)(bot?.feishu?.appId ?? "");
55199
55199
  const [appSecret, setAppSecret] = (0, react.useState)("");
55200
55200
  const [scan, setScan] = (0, react.useState)({ status: "idle" });
55201
55201
  const [error, setError] = (0, react.useState)(null);
55202
55202
  const [saving, setSaving] = (0, react.useState)(false);
55203
+ const [confirmUnbind, setConfirmUnbind] = (0, react.useState)(false);
55203
55204
  const canvasRef = (0, react.useRef)(null);
55204
55205
  const pollTimer = (0, react.useRef)(void 0);
55205
55206
  (0, react.useEffect)(() => {
@@ -55304,22 +55305,23 @@ ${te.current.stack}
55304
55305
  });
55305
55306
  }
55306
55307
  }
55308
+ const bindable = bot === void 0 || bot.feishu === void 0;
55307
55309
  (0, react.useEffect)(() => {
55308
- if (step === 2 && !editing && scan.status === "idle") beginScan();
55310
+ if (step === 2 && bindable && scan.status === "idle") beginScan();
55309
55311
  }, [
55310
55312
  step,
55311
55313
  scan.status,
55312
- editing
55314
+ bindable
55313
55315
  ]);
55314
55316
  async function save() {
55315
55317
  setError(null);
55316
- const feishu = editing ? void 0 : tab === "scan" ? scan.status === "done" ? {
55318
+ const feishu = bindable ? tab === "scan" ? scan.status === "done" ? {
55317
55319
  appId: scan.appId,
55318
55320
  appSecretRef: scan.credentialRef
55319
55321
  } : void 0 : appId.trim().length > 0 && appSecret.trim().length > 0 ? {
55320
55322
  appId: appId.trim(),
55321
55323
  appSecret: appSecret.trim()
55322
- } : void 0;
55324
+ } : void 0 : void 0;
55323
55325
  if (!editing && feishu === void 0) {
55324
55326
  setError("请填写 App ID 与 App Secret,或先完成扫码创建");
55325
55327
  return;
@@ -55344,7 +55346,8 @@ ${te.current.stack}
55344
55346
  name: name.trim(),
55345
55347
  project: project.trim(),
55346
55348
  ...editing ? { agentRef: agentRef === "main" ? null : agentRef } : agentRef !== "main" ? { agentRef } : {},
55347
- agentOptions
55349
+ agentOptions,
55350
+ ...feishu !== void 0 ? { feishu } : {}
55348
55351
  };
55349
55352
  if (editing) await updateBot(bot.id, payload);
55350
55353
  else await createBot({
@@ -55358,6 +55361,33 @@ ${te.current.stack}
55358
55361
  setSaving(false);
55359
55362
  }
55360
55363
  }
55364
+ /** 解绑渠道:两段确认后立即 PUT feishu:null(不经保存),成功回列表刷新。 */
55365
+ async function unbind() {
55366
+ if (!confirmUnbind) {
55367
+ setConfirmUnbind(true);
55368
+ return;
55369
+ }
55370
+ setError(null);
55371
+ setSaving(true);
55372
+ try {
55373
+ await updateBot(bot.id, { feishu: null });
55374
+ onSaved();
55375
+ } catch (e) {
55376
+ setError(e instanceof Error ? e.message : String(e));
55377
+ } finally {
55378
+ setSaving(false);
55379
+ }
55380
+ }
55381
+ /** 离开第二步:解除解绑确认态,避免回到第二步后单次误触直接销毁凭据。 */
55382
+ function back() {
55383
+ setConfirmUnbind(false);
55384
+ setError(null);
55385
+ setStep(1);
55386
+ }
55387
+ function cancel() {
55388
+ setConfirmUnbind(false);
55389
+ onCancel();
55390
+ }
55361
55391
  const showModelSelect = provider.trim().length > 0 && models.length > 0;
55362
55392
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [
55363
55393
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -55482,7 +55512,7 @@ ${te.current.stack}
55482
55512
  className: bots_module_css_default.formActions,
55483
55513
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
55484
55514
  variant: "outline",
55485
- onClick: onCancel,
55515
+ onClick: cancel,
55486
55516
  children: "取消"
55487
55517
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
55488
55518
  variant: "primary",
@@ -55492,7 +55522,7 @@ ${te.current.stack}
55492
55522
  })
55493
55523
  ] }),
55494
55524
  step === 2 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
55495
- !editing && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
55525
+ bindable && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
55496
55526
  className: bots_module_css_default.scanSection,
55497
55527
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
55498
55528
  role: "tablist",
@@ -55586,10 +55616,20 @@ ${te.current.stack}
55586
55616
  })
55587
55617
  ] })]
55588
55618
  }),
55589
- editing && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", { children: [
55590
- "当前应用:",
55591
- bot.feishu.appId,
55592
- "(如需换绑请删除后重建)"
55619
+ editing && bot.feishu !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
55620
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", { children: ["当前应用:", bot.feishu.appId] }),
55621
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
55622
+ variant: "outline",
55623
+ disabled: saving,
55624
+ onClick: () => {
55625
+ unbind();
55626
+ },
55627
+ children: confirmUnbind ? "确认解绑?" : "解绑"
55628
+ }),
55629
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
55630
+ className: bots_module_css_default.hint,
55631
+ children: "解绑后密钥立即删除,历史会话保留;重新绑定同一应用可继续原会话。"
55632
+ })
55593
55633
  ] }),
55594
55634
  error !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
55595
55635
  role: "alert",
@@ -55601,15 +55641,12 @@ ${te.current.stack}
55601
55641
  children: [
55602
55642
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
55603
55643
  variant: "outline",
55604
- onClick: () => {
55605
- setError(null);
55606
- setStep(1);
55607
- },
55644
+ onClick: back,
55608
55645
  children: "上一步"
55609
55646
  }),
55610
55647
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
55611
55648
  variant: "outline",
55612
- onClick: onCancel,
55649
+ onClick: cancel,
55613
55650
  children: "取消"
55614
55651
  }),
55615
55652
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
@@ -55634,7 +55671,8 @@ ${te.current.stack}
55634
55671
  reconnecting: "重连中",
55635
55672
  idle: "空闲",
55636
55673
  failed: "连接失败",
55637
- "not-running": "未运行"
55674
+ "not-running": "未运行",
55675
+ unbound: "未绑定"
55638
55676
  };
55639
55677
  /** 连接状态 → StateDot 四色语义:正常绿 / 过渡蓝跑马 / 非故障停止琥珀 / 故障红。 */
55640
55678
  const STATUS_DOT = {
@@ -55643,7 +55681,8 @@ ${te.current.stack}
55643
55681
  reconnecting: "ongoing",
55644
55682
  idle: "warning",
55645
55683
  failed: "error",
55646
- "not-running": "warning"
55684
+ "not-running": "warning",
55685
+ unbound: "warning"
55647
55686
  };
55648
55687
  function BotsModal({ open, onClose, useWorkspaces, onEdit, onCreate }) {
55649
55688
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Modal, {
@@ -55692,7 +55731,7 @@ ${te.current.stack}
55692
55731
  className: bots_module_css_default.botName,
55693
55732
  children: bot.name
55694
55733
  }),
55695
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Pill, {
55734
+ bot.feishu !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Pill, {
55696
55735
  className: bots_module_css_default.channelBadge,
55697
55736
  children: "飞书"
55698
55737
  }),