dsh-agent-toolkit 0.2.7 → 0.2.9

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
@@ -57,25 +57,25 @@ window.__ModuleLoader__.load({
57
57
  }
58
58
  //#endregion
59
59
  //#region \0dsh-css:D:\work\github\dsh\dsh-agent-toolkit\packages\toolkit\src\client\delegate\delegate-card.module.css.mjs
60
- const css$9 = "._8wQUq_root{margin:4px 0 4px 4px}._8wQUq_row{cursor:pointer;user-select:none;align-items:center;gap:6px;height:24px;display:flex}._8wQUq_row:hover{background:var(--dsw-alias-interactive-bg-hover-solid)}._8wQUq_chip{font:var(--dsw-font-xs-13);color:var(--dsw-alias-state-business-primary);border:1px solid var(--dsw-alias-border-l2);border-radius:6px;flex:none;padding:0 6px}._8wQUq_summary{text-overflow:ellipsis;white-space:nowrap;font:var(--dsw-font-xs-13);color:var(--dsw-alias-label-tertiary);flex:auto;overflow:hidden}._8wQUq_body{border-left:1px solid var(--dsw-alias-border-l1);max-height:260px;margin:4px 0 4px 16px;padding-left:8px;overflow-y:auto}._8wQUq_prompt{white-space:pre-wrap;word-break:break-word;font:var(--dsw-font-markdown-code-block-small);color:var(--dsw-alias-label-secondary);margin:0 0 6px}._8wQUq_result{color:var(--dsw-alias-label-primary)}._8wQUq_childLink{cursor:pointer;font:var(--dsw-font-xs-13);color:var(--dsw-alias-state-business-primary);border:1px solid var(--dsw-alias-border-l2);background:0 0;border-radius:999px;margin-top:6px;padding:2px 10px}._8wQUq_childLink:hover{background:var(--dsw-alias-interactive-bg-hover-solid)}._8wQUq_visuallyHidden{clip:rect(0 0 0 0);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}._8wQUq_root[data-state=error] ._8wQUq_summary{color:var(--dsw-alias-state-error-primary)}";
61
- const tagId$9 = "dsh-agent-toolkit/delegate-card.module.css-c939fc26";
62
- if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$9) + "]") === null) {
60
+ const css$10 = "._8wQUq_root{margin:4px 0 4px 4px}._8wQUq_row{cursor:pointer;user-select:none;align-items:center;gap:6px;height:24px;display:flex}._8wQUq_row:hover{background:var(--dsw-alias-interactive-bg-hover-solid)}._8wQUq_chip{font:var(--dsw-font-xs-13);color:var(--dsw-alias-state-business-primary);border:1px solid var(--dsw-alias-border-l2);border-radius:6px;flex:none;padding:0 6px}._8wQUq_summary{text-overflow:ellipsis;white-space:nowrap;font:var(--dsw-font-xs-13);color:var(--dsw-alias-label-tertiary);flex:auto;overflow:hidden}._8wQUq_body{border-left:1px solid var(--dsw-alias-border-l1);max-height:260px;margin:4px 0 4px 16px;padding-left:8px;overflow-y:auto}._8wQUq_prompt{white-space:pre-wrap;word-break:break-word;font:var(--dsw-font-markdown-code-block-small);color:var(--dsw-alias-label-secondary);margin:0 0 6px}._8wQUq_result{color:var(--dsw-alias-label-primary)}._8wQUq_childLink{cursor:pointer;font:var(--dsw-font-xs-13);color:var(--dsw-alias-state-business-primary);border:1px solid var(--dsw-alias-border-l2);background:0 0;border-radius:999px;margin-top:6px;padding:2px 10px}._8wQUq_childLink:hover{background:var(--dsw-alias-interactive-bg-hover-solid)}._8wQUq_visuallyHidden{clip:rect(0 0 0 0);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}._8wQUq_root[data-state=error] ._8wQUq_summary{color:var(--dsw-alias-state-error-primary)}";
61
+ const tagId$10 = "dsh-agent-toolkit/delegate-card.module.css-c939fc26";
62
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$10) + "]") === null) {
63
63
  const tag = document.createElement("style");
64
64
  tag.dataset.plugin = "dsh-agent-toolkit";
65
- tag.dataset.pluginCss = tagId$9;
66
- tag.textContent = css$9;
65
+ tag.dataset.pluginCss = tagId$10;
66
+ tag.textContent = css$10;
67
67
  document.head.appendChild(tag);
68
68
  }
69
69
  var delegate_card_module_css_default = {
70
- "summary": "_8wQUq_summary",
71
- "body": "_8wQUq_body",
72
- "row": "_8wQUq_row",
73
70
  "chip": "_8wQUq_chip",
74
- "prompt": "_8wQUq_prompt",
71
+ "row": "_8wQUq_row",
75
72
  "result": "_8wQUq_result",
73
+ "childLink": "_8wQUq_childLink",
74
+ "body": "_8wQUq_body",
75
+ "summary": "_8wQUq_summary",
76
76
  "visuallyHidden": "_8wQUq_visuallyHidden",
77
- "root": "_8wQUq_root",
78
- "childLink": "_8wQUq_childLink"
77
+ "prompt": "_8wQUq_prompt",
78
+ "root": "_8wQUq_root"
79
79
  };
80
80
  //#endregion
81
81
  //#region src/client/delegate/delegate-card.tsx
@@ -200,15 +200,15 @@ window.__ModuleLoader__.load({
200
200
  //#endregion
201
201
  //#region src/client/delegate/locales.ts
202
202
  /** agent-team 浏览器半文案:zh 为真源,en 键集严格一致。 */
203
- const NS = "agent-team";
204
- const zh = {
203
+ const NS$1 = "agent-team";
204
+ const zh$1 = {
205
205
  "card.viewChild": "查看子对话",
206
206
  "card.running": "成员执行中",
207
207
  "card.failed": "委派失败",
208
208
  "card.modelAria": "子 Agent 使用模型 {route}",
209
209
  "header.modelAria": "子会话模型 {route}"
210
210
  };
211
- const en = {
211
+ const en$1 = {
212
212
  "card.viewChild": "View sub-conversation",
213
213
  "card.running": "Member running",
214
214
  "card.failed": "Delegation failed",
@@ -222,9 +222,9 @@ window.__ModuleLoader__.load({
222
222
  * 改名后卡片不生效(落 generic 兜底)。
223
223
  */
224
224
  function setupDelegateClient(ctx) {
225
- ctx.effect(() => ctx.locale.register(NS, {
226
- zh,
227
- en
225
+ ctx.effect(() => ctx.locale.register(NS$1, {
226
+ zh: zh$1,
227
+ en: en$1
228
228
  }), "dsh-agent-toolkit: dictionaries");
229
229
  const sessions = ctx.sessions;
230
230
  const injected = { openChild(address) {
@@ -233,19 +233,19 @@ window.__ModuleLoader__.load({
233
233
  ctx.slots.inject("tool.call.toolview", () => ctx.slots.register({
234
234
  name: "tool.call.toolview",
235
235
  key: "team_delegate",
236
- locale: NS,
236
+ locale: NS$1,
237
237
  inject: () => injected
238
238
  }, DelegateCard));
239
239
  }
240
240
  //#endregion
241
241
  //#region \0dsh-css:D:\work\github\dsh\dsh-agent-toolkit\packages\toolkit\src\client\subagent-model\subagent-model.module.css.mjs
242
- const css$8 = ".LlymwG_chip{font:var(--dsw-font-xs-13);color:var(--dsw-alias-label-tertiary);border:1px solid var(--dsw-alias-border-l2);white-space:nowrap;border-radius:6px;flex:none;padding:0 6px}";
243
- const tagId$8 = "dsh-agent-toolkit/subagent-model.module.css-258be5cf";
244
- if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$8) + "]") === null) {
242
+ const css$9 = ".LlymwG_chip{font:var(--dsw-font-xs-13);color:var(--dsw-alias-label-tertiary);border:1px solid var(--dsw-alias-border-l2);white-space:nowrap;border-radius:6px;flex:none;padding:0 6px}";
243
+ const tagId$9 = "dsh-agent-toolkit/subagent-model.module.css-258be5cf";
244
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$9) + "]") === null) {
245
245
  const tag = document.createElement("style");
246
246
  tag.dataset.plugin = "dsh-agent-toolkit";
247
- tag.dataset.pluginCss = tagId$8;
248
- tag.textContent = css$8;
247
+ tag.dataset.pluginCss = tagId$9;
248
+ tag.textContent = css$9;
249
249
  document.head.appendChild(tag);
250
250
  }
251
251
  var subagent_model_module_css_default = { "chip": "LlymwG_chip" };
@@ -281,7 +281,7 @@ window.__ModuleLoader__.load({
281
281
  name: "conversation.session.header.utilities",
282
282
  id: "subagent-model",
283
283
  order: 10,
284
- locale: NS
284
+ locale: NS$1
285
285
  }, SubagentModelChip));
286
286
  }
287
287
  //#endregion
@@ -301,18 +301,18 @@ window.__ModuleLoader__.load({
301
301
  }
302
302
  //#endregion
303
303
  //#region \0dsh-css:D:\work\github\dsh\dsh-agent-toolkit\packages\toolkit\src\client\shared\entry.module.css.mjs
304
- const css$7 = ".VJWWsa_trigger{box-sizing:border-box;cursor:pointer;width:auto;height:42px;color:var(--dsw-alias-label-primary);background:0 0;border:none;border-radius:12px;flex:none;align-items:center;gap:8px;margin:4px 0;padding:0 8px;font-family:inherit;font-size:14px;line-height:22px;display:flex;overflow:hidden}.VJWWsa_trigger:hover{background:var(--dsw-alias-interactive-bg-hover)}.VJWWsa_trigger.VJWWsa_rail{border-radius:50%;justify-content:center;gap:0;width:36px;height:36px;margin:8px 0 10px;padding:0}";
305
- const tagId$7 = "dsh-agent-toolkit/entry.module.css-535aa644";
306
- if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$7) + "]") === null) {
304
+ const css$8 = ".VJWWsa_trigger{box-sizing:border-box;cursor:pointer;width:auto;height:42px;color:var(--dsw-alias-label-primary);background:0 0;border:none;border-radius:12px;flex:none;align-items:center;gap:8px;margin:4px 0;padding:0 8px;font-family:inherit;font-size:14px;line-height:22px;display:flex;overflow:hidden}.VJWWsa_trigger:hover{background:var(--dsw-alias-interactive-bg-hover)}.VJWWsa_trigger.VJWWsa_rail{border-radius:50%;justify-content:center;gap:0;width:36px;height:36px;margin:8px 0 10px;padding:0}";
305
+ const tagId$8 = "dsh-agent-toolkit/entry.module.css-535aa644";
306
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$8) + "]") === null) {
307
307
  const tag = document.createElement("style");
308
308
  tag.dataset.plugin = "dsh-agent-toolkit";
309
- tag.dataset.pluginCss = tagId$7;
310
- tag.textContent = css$7;
309
+ tag.dataset.pluginCss = tagId$8;
310
+ tag.textContent = css$8;
311
311
  document.head.appendChild(tag);
312
312
  }
313
313
  var entry_module_css_default$1 = {
314
- "rail": "VJWWsa_rail",
315
- "trigger": "VJWWsa_trigger"
314
+ "trigger": "VJWWsa_trigger",
315
+ "rail": "VJWWsa_rail"
316
316
  };
317
317
  //#endregion
318
318
  //#region src/client/shared/entry.tsx
@@ -377,7 +377,7 @@ window.__ModuleLoader__.load({
377
377
  }
378
378
  //#endregion
379
379
  //#region src/client/agents/api.ts
380
- async function request$2(input, init) {
380
+ async function request$3(input, init) {
381
381
  const res = init === void 0 ? await fetch(input) : await fetch(input, {
382
382
  ...init,
383
383
  headers: { "content-type": "application/json" }
@@ -389,55 +389,55 @@ window.__ModuleLoader__.load({
389
389
  return res.json();
390
390
  }
391
391
  /** GET /agents → AgentRecord[](裸数组;与 Task 13 bots 的 fetchAgents 同源契约)。 */
392
- const fetchAgents$1 = () => request$2("/dsh-agent-toolkit/api/agents");
393
- const fetchProviders$1 = () => request$2("/dsh-agent-toolkit/api/providers");
394
- const fetchModels$1 = (provider) => request$2(`/dsh-agent-toolkit/api/providers/${encodeURIComponent(provider)}/models`);
395
- const fetchTools = () => request$2("/dsh-agent-toolkit/api/tools");
392
+ const fetchAgents$2 = () => request$3("/dsh-agent-toolkit/api/agents");
393
+ const fetchProviders$1 = () => request$3("/dsh-agent-toolkit/api/providers");
394
+ const fetchModels$1 = (provider) => request$3(`/dsh-agent-toolkit/api/providers/${encodeURIComponent(provider)}/models`);
395
+ const fetchTools = () => request$3("/dsh-agent-toolkit/api/tools");
396
396
  /** PUT /agents/:id(upsert:全量替换记录)。 */
397
- const saveAgent = (record) => request$2(`/dsh-agent-toolkit/api/agents/${encodeURIComponent(record.id)}`, {
397
+ const saveAgent = (record) => request$3(`/dsh-agent-toolkit/api/agents/${encodeURIComponent(record.id)}`, {
398
398
  method: "PUT",
399
399
  body: JSON.stringify(record)
400
400
  });
401
- const deleteAgent = (id) => request$2(`/dsh-agent-toolkit/api/agents/${encodeURIComponent(id)}`, { method: "DELETE" });
401
+ const deleteAgent = (id) => request$3(`/dsh-agent-toolkit/api/agents/${encodeURIComponent(id)}`, { method: "DELETE" });
402
402
  //#endregion
403
403
  //#region \0dsh-css:D:\work\github\dsh\dsh-agent-toolkit\packages\toolkit\src\client\agents\agents.module.css.mjs
404
- const css$6 = ".KsfSLW_dialog{width:860px}.KsfSLW_split{gap:16px;min-height:420px;display:flex}.KsfSLW_listPane{flex-direction:column;flex:none;gap:4px;width:240px;display:flex}.KsfSLW_agentRow{border:1px solid var(--dsw-alias-border-l2);cursor:pointer;width:100%;font:inherit;color:inherit;text-align:left;background:0 0;border-radius:6px;flex-direction:column;gap:2px;padding:8px 10px;display:flex}.KsfSLW_agentRow:hover{background:var(--dsw-alias-interactive-bg-hover)}.KsfSLW_agentRowActive{border-color:var(--dsw-alias-brand-primary);background:var(--dsw-alias-interactive-bg-hover)}.KsfSLW_agentName{align-items:center;gap:6px;font-size:14px;line-height:22px;display:flex}.KsfSLW_agentDesc{color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;font-size:12px;line-height:18px;overflow:hidden}.KsfSLW_builtinBadge{flex:none;align-self:flex-start}.KsfSLW_createButton{margin-top:8px}.KsfSLW_editorPane{flex:1;min-width:0;max-height:70vh;overflow-y:auto}.KsfSLW_editor{flex-direction:column;gap:16px;display:flex}.KsfSLW_block{flex-direction:column;gap:8px;display:flex}.KsfSLW_blockTitle{margin:0;font-size:14px;font-weight:600;line-height:22px}.KsfSLW_field{color:var(--dsw-alias-label-secondary);flex-direction:column;gap:6px;font-size:13px;line-height:20px;display:flex}.KsfSLW_input{box-sizing:border-box;width:100%}.KsfSLW_readonlyId{color:var(--dsw-alias-label-secondary);margin:0;font-size:13px;line-height:20px}.KsfSLW_select,.KsfSLW_textarea{box-sizing:border-box;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);width:100%;color:var(--dsw-alias-label-primary);font:inherit;border-radius:12px;font-size:14px;line-height:22px}.KsfSLW_select{height:32px;padding:0 8px}.KsfSLW_textarea{resize:vertical;padding:4px 8px}.KsfSLW_select:focus,.KsfSLW_textarea:focus{border-color:var(--dsw-alias-brand-primary);outline:none}.KsfSLW_toolMode{gap:8px;display:flex}.KsfSLW_toolGroupSet{border:none;flex-direction:column;gap:4px;min-width:0;margin:0;padding:0;display:flex}.KsfSLW_toolGroupSet:disabled{opacity:.55}.KsfSLW_toolGrid{flex-wrap:wrap;gap:8px;display:flex}.KsfSLW_toolGroupTitle{color:var(--dsw-alias-label-tertiary);margin:4px 0 0;font-size:12px;line-height:18px}.KsfSLW_toolCheck{border:1px solid var(--dsw-alias-border-l2);cursor:pointer;border-radius:6px;align-items:center;gap:6px;padding:4px 8px;font-size:13px;line-height:20px;display:inline-flex}.KsfSLW_hint{color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px;line-height:18px}.KsfSLW_error{color:var(--dsw-alias-state-error-primary);margin:0;font-size:12px;line-height:18px}.KsfSLW_actions{background:var(--dsw-alias-bg-layer-1);justify-content:flex-end;gap:8px;margin-top:4px;padding:8px 0;display:flex;position:sticky;bottom:0}.KsfSLW_dangerButton{color:var(--dsw-alias-state-error-primary)}";
405
- const tagId$6 = "dsh-agent-toolkit/agents.module.css-36f6ae02";
406
- if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$6) + "]") === null) {
404
+ const css$7 = ".KsfSLW_dialog{width:860px}.KsfSLW_split{gap:16px;min-height:420px;display:flex}.KsfSLW_listPane{flex-direction:column;flex:none;gap:4px;width:240px;display:flex}.KsfSLW_agentRow{border:1px solid var(--dsw-alias-border-l2);cursor:pointer;width:100%;font:inherit;color:inherit;text-align:left;background:0 0;border-radius:6px;flex-direction:column;gap:2px;padding:8px 10px;display:flex}.KsfSLW_agentRow:hover{background:var(--dsw-alias-interactive-bg-hover)}.KsfSLW_agentRowActive{border-color:var(--dsw-alias-brand-primary);background:var(--dsw-alias-interactive-bg-hover)}.KsfSLW_agentName{align-items:center;gap:6px;font-size:14px;line-height:22px;display:flex}.KsfSLW_agentDesc{color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;font-size:12px;line-height:18px;overflow:hidden}.KsfSLW_builtinBadge{flex:none;align-self:flex-start}.KsfSLW_createButton{margin-top:8px}.KsfSLW_editorPane{flex:1;min-width:0;max-height:70vh;overflow-y:auto}.KsfSLW_editor{flex-direction:column;gap:16px;display:flex}.KsfSLW_block{flex-direction:column;gap:8px;display:flex}.KsfSLW_blockTitle{margin:0;font-size:14px;font-weight:600;line-height:22px}.KsfSLW_field{color:var(--dsw-alias-label-secondary);flex-direction:column;gap:6px;font-size:13px;line-height:20px;display:flex}.KsfSLW_input{box-sizing:border-box;width:100%}.KsfSLW_readonlyId{color:var(--dsw-alias-label-secondary);margin:0;font-size:13px;line-height:20px}.KsfSLW_select,.KsfSLW_textarea{box-sizing:border-box;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);width:100%;color:var(--dsw-alias-label-primary);font:inherit;border-radius:12px;font-size:14px;line-height:22px}.KsfSLW_select{height:32px;padding:0 8px}.KsfSLW_textarea{resize:vertical;padding:4px 8px}.KsfSLW_select:focus,.KsfSLW_textarea:focus{border-color:var(--dsw-alias-brand-primary);outline:none}.KsfSLW_toolMode{gap:8px;display:flex}.KsfSLW_toolGroupSet{border:none;flex-direction:column;gap:4px;min-width:0;margin:0;padding:0;display:flex}.KsfSLW_toolGroupSet:disabled{opacity:.55}.KsfSLW_toolGrid{flex-wrap:wrap;gap:8px;display:flex}.KsfSLW_toolGroupTitle{color:var(--dsw-alias-label-tertiary);margin:4px 0 0;font-size:12px;line-height:18px}.KsfSLW_toolCheck{border:1px solid var(--dsw-alias-border-l2);cursor:pointer;border-radius:6px;align-items:center;gap:6px;padding:4px 8px;font-size:13px;line-height:20px;display:inline-flex}.KsfSLW_hint{color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px;line-height:18px}.KsfSLW_error{color:var(--dsw-alias-state-error-primary);margin:0;font-size:12px;line-height:18px}.KsfSLW_actions{background:var(--dsw-alias-bg-layer-1);justify-content:flex-end;gap:8px;margin-top:4px;padding:8px 0;display:flex;position:sticky;bottom:0}.KsfSLW_dangerButton{color:var(--dsw-alias-state-error-primary)}";
405
+ const tagId$7 = "dsh-agent-toolkit/agents.module.css-36f6ae02";
406
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$7) + "]") === null) {
407
407
  const tag = document.createElement("style");
408
408
  tag.dataset.plugin = "dsh-agent-toolkit";
409
- tag.dataset.pluginCss = tagId$6;
410
- tag.textContent = css$6;
409
+ tag.dataset.pluginCss = tagId$7;
410
+ tag.textContent = css$7;
411
411
  document.head.appendChild(tag);
412
412
  }
413
413
  var agents_module_css_default = {
414
- "readonlyId": "KsfSLW_readonlyId",
415
- "split": "KsfSLW_split",
416
- "toolGroupSet": "KsfSLW_toolGroupSet",
417
- "editorPane": "KsfSLW_editorPane",
418
- "toolGrid": "KsfSLW_toolGrid",
414
+ "toolCheck": "KsfSLW_toolCheck",
419
415
  "hint": "KsfSLW_hint",
420
- "dangerButton": "KsfSLW_dangerButton",
421
- "actions": "KsfSLW_actions",
422
416
  "select": "KsfSLW_select",
423
- "agentRowActive": "KsfSLW_agentRowActive",
424
- "toolCheck": "KsfSLW_toolCheck",
417
+ "readonlyId": "KsfSLW_readonlyId",
418
+ "dialog": "KsfSLW_dialog",
419
+ "toolGrid": "KsfSLW_toolGrid",
420
+ "agentName": "KsfSLW_agentName",
425
421
  "block": "KsfSLW_block",
426
422
  "editor": "KsfSLW_editor",
427
- "dialog": "KsfSLW_dialog",
428
- "toolMode": "KsfSLW_toolMode",
429
- "agentRow": "KsfSLW_agentRow",
430
423
  "blockTitle": "KsfSLW_blockTitle",
424
+ "split": "KsfSLW_split",
425
+ "listPane": "KsfSLW_listPane",
431
426
  "input": "KsfSLW_input",
432
- "textarea": "KsfSLW_textarea",
433
- "agentName": "KsfSLW_agentName",
434
- "builtinBadge": "KsfSLW_builtinBadge",
435
- "toolGroupTitle": "KsfSLW_toolGroupTitle",
427
+ "toolMode": "KsfSLW_toolMode",
436
428
  "error": "KsfSLW_error",
437
- "agentDesc": "KsfSLW_agentDesc",
438
- "listPane": "KsfSLW_listPane",
429
+ "builtinBadge": "KsfSLW_builtinBadge",
430
+ "textarea": "KsfSLW_textarea",
431
+ "toolGroupSet": "KsfSLW_toolGroupSet",
432
+ "actions": "KsfSLW_actions",
433
+ "dangerButton": "KsfSLW_dangerButton",
434
+ "agentRowActive": "KsfSLW_agentRowActive",
435
+ "agentRow": "KsfSLW_agentRow",
439
436
  "field": "KsfSLW_field",
440
- "createButton": "KsfSLW_createButton"
437
+ "editorPane": "KsfSLW_editorPane",
438
+ "agentDesc": "KsfSLW_agentDesc",
439
+ "createButton": "KsfSLW_createButton",
440
+ "toolGroupTitle": "KsfSLW_toolGroupTitle"
441
441
  };
442
442
  //#endregion
443
443
  //#region src/client/agents/AgentEditor.tsx
@@ -457,8 +457,9 @@ window.__ModuleLoader__.load({
457
457
  const [models, setModels] = (0, react.useState)([]);
458
458
  const [tools, setTools] = (0, react.useState)(agent?.tools?.allow ?? []);
459
459
  const [toolsMode, setToolsMode] = (0, react.useState)(agent === void 0 || agent.tools !== void 0 ? "custom" : "unrestricted");
460
+ const [visibleInTeam, setVisibleInTeam] = (0, react.useState)(agent?.visibleInTeam !== false);
460
461
  const [catalog, setCatalog] = (0, react.useState)({
461
- native: [],
462
+ preset: [],
462
463
  global: []
463
464
  });
464
465
  const [catalogLoaded, setCatalogLoaded] = (0, react.useState)(false);
@@ -473,7 +474,7 @@ window.__ModuleLoader__.load({
473
474
  if (stale) return;
474
475
  setCatalog(c);
475
476
  setCatalogLoaded(true);
476
- if (creating) setTools([...c.native, ...c.global]);
477
+ if (creating) setTools([...c.preset, ...c.global]);
477
478
  }).catch(() => void 0);
478
479
  return () => {
479
480
  stale = true;
@@ -525,7 +526,8 @@ window.__ModuleLoader__.load({
525
526
  provider: provider.trim(),
526
527
  model: model.trim()
527
528
  } } : {},
528
- ...toolsMode === "custom" && tools.length > 0 ? { tools: { allow: tools } } : {}
529
+ ...toolsMode === "custom" && tools.length > 0 ? { tools: { allow: tools } } : {},
530
+ ...visibleInTeam ? {} : { visibleInTeam: false }
529
531
  };
530
532
  setSaving(true);
531
533
  try {
@@ -598,6 +600,17 @@ window.__ModuleLoader__.load({
598
600
  "aria-label": "描述",
599
601
  rows: 2
600
602
  })]
603
+ }),
604
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
605
+ className: agents_module_css_default.toolCheck,
606
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
607
+ type: "checkbox",
608
+ checked: visibleInTeam,
609
+ "aria-label": "在 Agent 团队中可见",
610
+ onChange: (e) => {
611
+ setVisibleInTeam(e.target.checked);
612
+ }
613
+ }), "在 Agent 团队中可见"]
601
614
  })
602
615
  ]
603
616
  }),
@@ -698,7 +711,7 @@ window.__ModuleLoader__.load({
698
711
  }), "自定义白名单"]
699
712
  })]
700
713
  }),
701
- catalog.native.length === 0 && catalog.global.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
714
+ catalog.preset.length === 0 && catalog.global.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
702
715
  className: agents_module_css_default.hint,
703
716
  children: "暂无可用工具"
704
717
  }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("fieldset", {
@@ -707,11 +720,11 @@ window.__ModuleLoader__.load({
707
720
  children: [
708
721
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
709
722
  className: agents_module_css_default.toolGroupTitle,
710
- children: "原生工具"
723
+ children: "团队 preset 工具"
711
724
  }),
712
725
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
713
726
  className: agents_module_css_default.toolGrid,
714
- children: catalog.native.map((t) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
727
+ children: catalog.preset.map((t) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
715
728
  className: agents_module_css_default.toolCheck,
716
729
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
717
730
  type: "checkbox",
@@ -726,7 +739,7 @@ window.__ModuleLoader__.load({
726
739
  }),
727
740
  catalog.global.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
728
741
  className: agents_module_css_default.toolGroupTitle,
729
- children: "扩展工具"
742
+ children: "全局工具"
730
743
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
731
744
  className: agents_module_css_default.toolGrid,
732
745
  children: catalog.global.map((t) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
@@ -804,7 +817,7 @@ window.__ModuleLoader__.load({
804
817
  }
805
818
  function AgentsModalBody({ onEdit, onCreate, onDelete }) {
806
819
  /** 打开即拉取(body 随 open 全新挂载,天然复位);保存后 reload 重拉。 */
807
- const { state, reload } = useLoadState$1(fetchAgents$1, []);
820
+ const { state, reload } = useLoadState$1(fetchAgents$2, []);
808
821
  const [selectedId, setSelectedId] = (0, react.useState)("");
809
822
  const [creating, setCreating] = (0, react.useState)(false);
810
823
  const visible = (state.kind === "ok" ? state.data : []).filter((a) => a.id !== "main");
@@ -866,6 +879,10 @@ window.__ModuleLoader__.load({
866
879
  className: agents_module_css_default.builtinBadge,
867
880
  children: "内置"
868
881
  }),
882
+ agent.visibleInTeam === false && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Pill, {
883
+ className: agents_module_css_default.builtinBadge,
884
+ children: "团队不可见"
885
+ }),
869
886
  agent.description !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
870
887
  className: agents_module_css_default.agentDesc,
871
888
  children: agent.description
@@ -897,7 +914,7 @@ window.__ModuleLoader__.load({
897
914
  }
898
915
  //#endregion
899
916
  //#region src/client/agents/entry.tsx
900
- const SidebarEntry$3 = createSidebarEntry$1({
917
+ const SidebarEntry$4 = createSidebarEntry$1({
901
918
  id: "dsh-agent-toolkit:agents",
902
919
  order: -1,
903
920
  icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconUserOutline16, { size: 18 }),
@@ -906,7 +923,7 @@ window.__ModuleLoader__.load({
906
923
  });
907
924
  /** 槽注册要求完整 composed props(含运行时 share useSessions/useWorkspaces);实现只消费 wide。 */
908
925
  function AgentsEntry(props) {
909
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SidebarEntry$3, { wide: props.wide });
926
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SidebarEntry$4, { wide: props.wide });
910
927
  }
911
928
  //#endregion
912
929
  //#region src/client/agents/index.ts
@@ -919,7 +936,7 @@ window.__ModuleLoader__.load({
919
936
  }
920
937
  //#endregion
921
938
  //#region src/client/prompt/api.ts
922
- async function request$1(input, init) {
939
+ async function request$2(input, init) {
923
940
  const res = init === void 0 ? await fetch(input) : await fetch(input, {
924
941
  ...init,
925
942
  headers: { "content-type": "application/json" }
@@ -930,45 +947,45 @@ window.__ModuleLoader__.load({
930
947
  }
931
948
  return res.json();
932
949
  }
933
- const fetchPromptLayers = () => request$1("/dsh-agent-toolkit/api/prompt-layers");
934
- const saveLayers = (layers, identityOverride) => request$1("/dsh-agent-toolkit/api/prompt-layers", {
950
+ const fetchPromptLayers = () => request$2("/dsh-agent-toolkit/api/prompt-layers");
951
+ const saveLayers = (layers, identityOverride) => request$2("/dsh-agent-toolkit/api/prompt-layers", {
935
952
  method: "PUT",
936
953
  body: JSON.stringify({
937
954
  layers,
938
955
  identityOverride
939
956
  })
940
957
  });
941
- const resetLayers = () => request$1("/dsh-agent-toolkit/api/prompt-layers/reset", { method: "POST" });
958
+ const resetLayers = () => request$2("/dsh-agent-toolkit/api/prompt-layers/reset", { method: "POST" });
942
959
  //#endregion
943
960
  //#region \0dsh-css:D:\work\github\dsh\dsh-agent-toolkit\packages\toolkit\src\client\prompt\prompt.module.css.mjs
944
- const css$5 = ".VZk1fa_dialog{width:720px}.VZk1fa_split{gap:16px;height:70vh;min-height:420px;display:flex}.VZk1fa_listPane{flex-direction:column;flex:none;gap:4px;width:200px;display:flex}.VZk1fa_layerRow{border:1px solid var(--dsw-alias-border-l2);cursor:pointer;width:100%;font:inherit;color:inherit;text-align:left;background:0 0;border-radius:6px;flex-direction:column;gap:2px;padding:8px 10px;display:flex}.VZk1fa_layerRow:hover{background:var(--dsw-alias-interactive-bg-hover)}.VZk1fa_layerRowActive{border-color:var(--dsw-alias-brand-primary);background:var(--dsw-alias-interactive-bg-hover)}.VZk1fa_layerName{font-size:14px;line-height:22px}.VZk1fa_layerOrder{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px}.VZk1fa_readonlyTag{border:1px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-tertiary);border-radius:4px;margin-left:6px;padding:0 4px;font-size:11px;line-height:16px}.VZk1fa_editorPane{flex:1;min-width:0;height:100%;overflow-y:auto}.VZk1fa_editor{flex-direction:column;gap:16px;height:100%;display:flex}.VZk1fa_field{flex-direction:column;flex:1;gap:6px;min-height:0;font-size:13px;display:flex}.VZk1fa_textarea{box-sizing:border-box;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-elevated,transparent);width:100%;min-height:0;font:inherit;color:inherit;resize:none;border-radius:6px;flex:1;padding:8px}.VZk1fa_actions{align-items:center;gap:8px;margin-top:8px;display:flex}.VZk1fa_hint{color:var(--dsw-alias-label-tertiary);font-size:13px}.VZk1fa_error{color:var(--dsw-alias-status-danger,red);font-size:13px}.VZk1fa_tabs{background:var(--dsw-alias-bg-skeleton);border-radius:8px;flex-wrap:wrap;gap:2px;padding:2px;display:flex}.VZk1fa_tab{cursor:pointer;height:28px;color:var(--dsw-alias-label-secondary);background:0 0;border:none;border-radius:6px;align-items:center;padding:0 12px;font-family:inherit;font-size:12px;line-height:18px;display:inline-flex}.VZk1fa_tab:hover{background:var(--dsw-alias-interactive-bg-hover)}.VZk1fa_tabActive{background:var(--dsw-alias-bg-overlay);color:var(--dsw-alias-label-primary)}.VZk1fa_tabActive:hover{background:var(--dsw-alias-bg-overlay)}";
945
- const tagId$5 = "dsh-agent-toolkit/prompt.module.css-6f2e98f4";
946
- if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$5) + "]") === null) {
961
+ const css$6 = ".VZk1fa_dialog{width:720px}.VZk1fa_split{gap:16px;height:70vh;min-height:420px;display:flex}.VZk1fa_listPane{flex-direction:column;flex:none;gap:4px;width:200px;display:flex}.VZk1fa_layerRow{border:1px solid var(--dsw-alias-border-l2);cursor:pointer;width:100%;font:inherit;color:inherit;text-align:left;background:0 0;border-radius:6px;flex-direction:column;gap:2px;padding:8px 10px;display:flex}.VZk1fa_layerRow:hover{background:var(--dsw-alias-interactive-bg-hover)}.VZk1fa_layerRowActive{border-color:var(--dsw-alias-brand-primary);background:var(--dsw-alias-interactive-bg-hover)}.VZk1fa_layerName{font-size:14px;line-height:22px}.VZk1fa_layerOrder{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px}.VZk1fa_readonlyTag{border:1px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-tertiary);border-radius:4px;margin-left:6px;padding:0 4px;font-size:11px;line-height:16px}.VZk1fa_editorPane{flex:1;min-width:0;height:100%;overflow-y:auto}.VZk1fa_editor{flex-direction:column;gap:16px;height:100%;display:flex}.VZk1fa_field{flex-direction:column;flex:1;gap:6px;min-height:0;font-size:13px;display:flex}.VZk1fa_textarea{box-sizing:border-box;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-elevated,transparent);width:100%;min-height:0;font:inherit;color:inherit;resize:none;border-radius:6px;flex:1;padding:8px}.VZk1fa_actions{align-items:center;gap:8px;margin-top:8px;display:flex}.VZk1fa_hint{color:var(--dsw-alias-label-tertiary);font-size:13px}.VZk1fa_error{color:var(--dsw-alias-status-danger,red);font-size:13px}.VZk1fa_tabs{background:var(--dsw-alias-bg-skeleton);border-radius:8px;flex-wrap:wrap;gap:2px;padding:2px;display:flex}.VZk1fa_tab{cursor:pointer;height:28px;color:var(--dsw-alias-label-secondary);background:0 0;border:none;border-radius:6px;align-items:center;padding:0 12px;font-family:inherit;font-size:12px;line-height:18px;display:inline-flex}.VZk1fa_tab:hover{background:var(--dsw-alias-interactive-bg-hover)}.VZk1fa_tabActive{background:var(--dsw-alias-bg-overlay);color:var(--dsw-alias-label-primary)}.VZk1fa_tabActive:hover{background:var(--dsw-alias-bg-overlay)}";
962
+ const tagId$6 = "dsh-agent-toolkit/prompt.module.css-6f2e98f4";
963
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$6) + "]") === null) {
947
964
  const tag = document.createElement("style");
948
965
  tag.dataset.plugin = "dsh-agent-toolkit";
949
- tag.dataset.pluginCss = tagId$5;
950
- tag.textContent = css$5;
966
+ tag.dataset.pluginCss = tagId$6;
967
+ tag.textContent = css$6;
951
968
  document.head.appendChild(tag);
952
969
  }
953
970
  var prompt_module_css_default = {
954
- "dialog": "VZk1fa_dialog",
955
- "editor": "VZk1fa_editor",
971
+ "tab": "VZk1fa_tab",
972
+ "error": "VZk1fa_error",
973
+ "layerName": "VZk1fa_layerName",
974
+ "readonlyTag": "VZk1fa_readonlyTag",
975
+ "textarea": "VZk1fa_textarea",
976
+ "tabs": "VZk1fa_tabs",
956
977
  "editorPane": "VZk1fa_editorPane",
957
- "listPane": "VZk1fa_listPane",
978
+ "layerRowActive": "VZk1fa_layerRowActive",
979
+ "editor": "VZk1fa_editor",
958
980
  "layerOrder": "VZk1fa_layerOrder",
959
- "tabs": "VZk1fa_tabs",
960
- "textarea": "VZk1fa_textarea",
961
- "layerName": "VZk1fa_layerName",
962
- "field": "VZk1fa_field",
963
981
  "split": "VZk1fa_split",
964
982
  "layerRow": "VZk1fa_layerRow",
965
- "layerRowActive": "VZk1fa_layerRowActive",
983
+ "field": "VZk1fa_field",
966
984
  "actions": "VZk1fa_actions",
967
985
  "hint": "VZk1fa_hint",
968
986
  "tabActive": "VZk1fa_tabActive",
969
- "error": "VZk1fa_error",
970
- "tab": "VZk1fa_tab",
971
- "readonlyTag": "VZk1fa_readonlyTag"
987
+ "dialog": "VZk1fa_dialog",
988
+ "listPane": "VZk1fa_listPane"
972
989
  };
973
990
  //#endregion
974
991
  //#region src/client/prompt/PromptLayersModal.tsx
@@ -1279,7 +1296,7 @@ window.__ModuleLoader__.load({
1279
1296
  }
1280
1297
  //#endregion
1281
1298
  //#region src/client/prompt/entry.tsx
1282
- const SidebarEntry$2 = createSidebarEntry$1({
1299
+ const SidebarEntry$3 = createSidebarEntry$1({
1283
1300
  id: "dsh-agent-toolkit:prompt-layers",
1284
1301
  order: 0,
1285
1302
  icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconListPenOutline16, { size: 18 }),
@@ -1287,7 +1304,7 @@ window.__ModuleLoader__.load({
1287
1304
  renderModal: (p) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PromptLayersModal, { ...p })
1288
1305
  });
1289
1306
  function PromptLayersEntry(props) {
1290
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SidebarEntry$2, { wide: props.wide });
1307
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SidebarEntry$3, { wide: props.wide });
1291
1308
  }
1292
1309
  //#endregion
1293
1310
  //#region src/client/prompt/index.ts
@@ -1300,13 +1317,13 @@ window.__ModuleLoader__.load({
1300
1317
  }
1301
1318
  //#endregion
1302
1319
  //#region \0dsh-css:D:\work\github\dsh\dsh-agent-toolkit\packages\usage\src\client\shared\entry.module.css.mjs
1303
- const css$4 = ".QVHFVG_trigger{box-sizing:border-box;cursor:pointer;width:auto;height:42px;color:var(--dsw-alias-label-primary);background:0 0;border:none;border-radius:12px;flex:none;align-items:center;gap:8px;margin:4px 0;padding:0 8px;font-family:inherit;font-size:14px;line-height:22px;display:flex;overflow:hidden}.QVHFVG_trigger:hover{background:var(--dsw-alias-interactive-bg-hover)}.QVHFVG_trigger.QVHFVG_rail{border-radius:50%;justify-content:center;gap:0;width:36px;height:36px;margin:8px 0 10px;padding:0}";
1304
- const tagId$4 = "dsh-agent-toolkit/entry.module.css-27285725";
1305
- if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$4) + "]") === null) {
1320
+ const css$5 = ".QVHFVG_trigger{box-sizing:border-box;cursor:pointer;width:auto;height:42px;color:var(--dsw-alias-label-primary);background:0 0;border:none;border-radius:12px;flex:none;align-items:center;gap:8px;margin:4px 0;padding:0 8px;font-family:inherit;font-size:14px;line-height:22px;display:flex;overflow:hidden}.QVHFVG_trigger:hover{background:var(--dsw-alias-interactive-bg-hover)}.QVHFVG_trigger.QVHFVG_rail{border-radius:50%;justify-content:center;gap:0;width:36px;height:36px;margin:8px 0 10px;padding:0}";
1321
+ const tagId$5 = "dsh-agent-toolkit/entry.module.css-27285725";
1322
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$5) + "]") === null) {
1306
1323
  const tag = document.createElement("style");
1307
1324
  tag.dataset.plugin = "dsh-agent-toolkit";
1308
- tag.dataset.pluginCss = tagId$4;
1309
- tag.textContent = css$4;
1325
+ tag.dataset.pluginCss = tagId$5;
1326
+ tag.textContent = css$5;
1310
1327
  document.head.appendChild(tag);
1311
1328
  }
1312
1329
  var entry_module_css_default = {
@@ -1442,44 +1459,44 @@ window.__ModuleLoader__.load({
1442
1459
  }
1443
1460
  //#endregion
1444
1461
  //#region \0dsh-css:D:\work\github\dsh\dsh-agent-toolkit\packages\usage\src\client\usage\chart.module.css.mjs
1445
- const css$3 = "._8LXSJW_chartTheme{--chart-1:var(--dsw-alias-state-business-primary);--chart-2:var(--dsw-alias-state-business-tertiary);--chart-label:var(--dsw-alias-label-tertiary);--chart-empty:var(--dsw-alias-bg-skeleton)}._8LXSJW_tooltip{background:var(--dsw-alias-bg-overlay);color:var(--dsw-alias-label-primary);border-radius:8px;padding:6px 10px;font-size:12px;line-height:18px;box-shadow:0 2px 8px #00000026}._8LXSJW_tooltipTitle{color:var(--dsw-alias-label-secondary)}._8LXSJW_tooltipTotal{margin-top:2px;font-weight:600}._8LXSJW_legend{color:var(--dsw-alias-label-secondary);justify-content:center;gap:16px;margin-top:4px;font-size:12px;line-height:18px;display:flex}._8LXSJW_legend i{border-radius:2px;width:8px;height:8px;margin-right:4px;display:inline-block}._8LXSJW_swatchFresh{background:var(--chart-1)}._8LXSJW_swatchCached{background:var(--chart-2)}";
1446
- const tagId$3 = "dsh-agent-toolkit/chart.module.css-a305f9e5";
1447
- if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$3) + "]") === null) {
1462
+ const css$4 = "._8LXSJW_chartTheme{--chart-1:var(--dsw-alias-state-business-primary);--chart-2:var(--dsw-alias-state-business-tertiary);--chart-label:var(--dsw-alias-label-tertiary);--chart-empty:var(--dsw-alias-bg-skeleton)}._8LXSJW_tooltip{background:var(--dsw-alias-bg-overlay);color:var(--dsw-alias-label-primary);border-radius:8px;padding:6px 10px;font-size:12px;line-height:18px;box-shadow:0 2px 8px #00000026}._8LXSJW_tooltipTitle{color:var(--dsw-alias-label-secondary)}._8LXSJW_tooltipTotal{margin-top:2px;font-weight:600}._8LXSJW_legend{color:var(--dsw-alias-label-secondary);justify-content:center;gap:16px;margin-top:4px;font-size:12px;line-height:18px;display:flex}._8LXSJW_legend i{border-radius:2px;width:8px;height:8px;margin-right:4px;display:inline-block}._8LXSJW_swatchFresh{background:var(--chart-1)}._8LXSJW_swatchCached{background:var(--chart-2)}";
1463
+ const tagId$4 = "dsh-agent-toolkit/chart.module.css-a305f9e5";
1464
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$4) + "]") === null) {
1448
1465
  const tag = document.createElement("style");
1449
1466
  tag.dataset.plugin = "dsh-agent-toolkit";
1450
- tag.dataset.pluginCss = tagId$3;
1451
- tag.textContent = css$3;
1467
+ tag.dataset.pluginCss = tagId$4;
1468
+ tag.textContent = css$4;
1452
1469
  document.head.appendChild(tag);
1453
1470
  }
1454
1471
  var chart_module_css_default = {
1455
- "tooltipTotal": "_8LXSJW_tooltipTotal",
1456
1472
  "legend": "_8LXSJW_legend",
1457
- "swatchFresh": "_8LXSJW_swatchFresh",
1458
- "tooltipTitle": "_8LXSJW_tooltipTitle",
1459
1473
  "tooltip": "_8LXSJW_tooltip",
1474
+ "swatchCached": "_8LXSJW_swatchCached",
1475
+ "tooltipTitle": "_8LXSJW_tooltipTitle",
1476
+ "swatchFresh": "_8LXSJW_swatchFresh",
1460
1477
  "chartTheme": "_8LXSJW_chartTheme",
1461
- "swatchCached": "_8LXSJW_swatchCached"
1478
+ "tooltipTotal": "_8LXSJW_tooltipTotal"
1462
1479
  };
1463
1480
  //#endregion
1464
1481
  //#region \0dsh-css:D:\work\github\dsh\dsh-agent-toolkit\packages\usage\src\client\usage\ActivityHeatmap.module.css.mjs
1465
- const css$2 = ".hjrYrq_months{color:var(--dsw-alias-label-tertiary);grid-template-columns:repeat(13,1fr);gap:3px;margin-bottom:4px;font-size:11px;line-height:16px;display:grid}.hjrYrq_grid{grid-template-columns:repeat(13,1fr);gap:3px;display:grid}.hjrYrq_week{grid-template-rows:repeat(7,1fr);gap:3px;display:grid}.hjrYrq_week>div{aspect-ratio:1;border-radius:2px;width:100%}.hjrYrq_week>div[aria-disabled=true]{opacity:.35}.hjrYrq_week>.hjrYrq_level0{background:var(--chart-empty)}.hjrYrq_week>.hjrYrq_level1{background:color-mix(in srgb, var(--chart-1) 25%, transparent)}.hjrYrq_week>.hjrYrq_level2{background:color-mix(in srgb, var(--chart-1) 50%, transparent)}.hjrYrq_week>.hjrYrq_level3{background:color-mix(in srgb, var(--chart-1) 75%, transparent)}.hjrYrq_week>.hjrYrq_level4{background:var(--chart-1)}";
1466
- const tagId$2 = "dsh-agent-toolkit/ActivityHeatmap.module.css-aab58cb9";
1467
- if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$2) + "]") === null) {
1482
+ const css$3 = ".hjrYrq_months{color:var(--dsw-alias-label-tertiary);grid-template-columns:repeat(13,1fr);gap:3px;margin-bottom:4px;font-size:11px;line-height:16px;display:grid}.hjrYrq_grid{grid-template-columns:repeat(13,1fr);gap:3px;display:grid}.hjrYrq_week{grid-template-rows:repeat(7,1fr);gap:3px;display:grid}.hjrYrq_week>div{aspect-ratio:1;border-radius:2px;width:100%}.hjrYrq_week>div[aria-disabled=true]{opacity:.35}.hjrYrq_week>.hjrYrq_level0{background:var(--chart-empty)}.hjrYrq_week>.hjrYrq_level1{background:color-mix(in srgb, var(--chart-1) 25%, transparent)}.hjrYrq_week>.hjrYrq_level2{background:color-mix(in srgb, var(--chart-1) 50%, transparent)}.hjrYrq_week>.hjrYrq_level3{background:color-mix(in srgb, var(--chart-1) 75%, transparent)}.hjrYrq_week>.hjrYrq_level4{background:var(--chart-1)}";
1483
+ const tagId$3 = "dsh-agent-toolkit/ActivityHeatmap.module.css-aab58cb9";
1484
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$3) + "]") === null) {
1468
1485
  const tag = document.createElement("style");
1469
1486
  tag.dataset.plugin = "dsh-agent-toolkit";
1470
- tag.dataset.pluginCss = tagId$2;
1471
- tag.textContent = css$2;
1487
+ tag.dataset.pluginCss = tagId$3;
1488
+ tag.textContent = css$3;
1472
1489
  document.head.appendChild(tag);
1473
1490
  }
1474
1491
  var ActivityHeatmap_module_css_default = {
1475
- "level2": "hjrYrq_level2",
1492
+ "week": "hjrYrq_week",
1476
1493
  "grid": "hjrYrq_grid",
1477
- "level3": "hjrYrq_level3",
1478
1494
  "months": "hjrYrq_months",
1479
- "level4": "hjrYrq_level4",
1480
- "week": "hjrYrq_week",
1495
+ "level2": "hjrYrq_level2",
1496
+ "level1": "hjrYrq_level1",
1497
+ "level3": "hjrYrq_level3",
1481
1498
  "level0": "hjrYrq_level0",
1482
- "level1": "hjrYrq_level1"
1499
+ "level4": "hjrYrq_level4"
1483
1500
  };
1484
1501
  //#endregion
1485
1502
  //#region ../usage/src/client/usage/ActivityHeatmap.tsx
@@ -8842,8 +8859,8 @@ window.__ModuleLoader__.load({
8842
8859
  function isPlainObject(value) {
8843
8860
  if (!value || !isObjectish(value)) return false;
8844
8861
  const proto = getPrototypeOf(value);
8845
- if (proto === null || proto === O[PROTOTYPE]) return true;
8846
- const Ctor = O.hasOwnProperty.call(proto, CONSTRUCTOR) && proto[CONSTRUCTOR];
8862
+ if (proto === null || proto === O$1[PROTOTYPE]) return true;
8863
+ const Ctor = O$1.hasOwnProperty.call(proto, CONSTRUCTOR) && proto[CONSTRUCTOR];
8847
8864
  if (Ctor === Object) return true;
8848
8865
  if (!isFunction(Ctor)) return false;
8849
8866
  let ctorString = cachedCtorStrings.get(Ctor);
@@ -8858,7 +8875,7 @@ window.__ModuleLoader__.load({
8858
8875
  return value[DRAFT_STATE].base_;
8859
8876
  }
8860
8877
  function each(obj, iter, strict = true) {
8861
- if (getArchtype(obj) === 0) (strict ? Reflect.ownKeys(obj) : O.keys(obj)).forEach((key) => {
8878
+ if (getArchtype(obj) === 0) (strict ? Reflect.ownKeys(obj) : O$1.keys(obj)).forEach((key) => {
8862
8879
  iter(key, obj[key], obj);
8863
8880
  });
8864
8881
  else obj.forEach((entry, index) => iter(index, entry, obj));
@@ -8881,7 +8898,7 @@ window.__ModuleLoader__.load({
8881
8898
  if (isArray(base)) return Array[PROTOTYPE].slice.call(base);
8882
8899
  const isPlain = isPlainObject(base);
8883
8900
  if (strict === true || strict === "class_only" && !isPlain) {
8884
- const descriptors = O.getOwnPropertyDescriptors(base);
8901
+ const descriptors = O$1.getOwnPropertyDescriptors(base);
8885
8902
  delete descriptors[DRAFT_STATE];
8886
8903
  let keys = Reflect.ownKeys(descriptors);
8887
8904
  for (let i = 0; i < keys.length; i++) {
@@ -8898,23 +8915,23 @@ window.__ModuleLoader__.load({
8898
8915
  [VALUE]: base[key]
8899
8916
  };
8900
8917
  }
8901
- return O.create(getPrototypeOf(base), descriptors);
8918
+ return O$1.create(getPrototypeOf(base), descriptors);
8902
8919
  } else {
8903
8920
  const proto = getPrototypeOf(base);
8904
8921
  if (proto !== null && isPlain) return { ...base };
8905
- const obj = O.create(proto);
8906
- return O.assign(obj, base);
8922
+ const obj = O$1.create(proto);
8923
+ return O$1.assign(obj, base);
8907
8924
  }
8908
8925
  }
8909
8926
  function freeze$1(obj, deep = false) {
8910
8927
  if (isFrozen(obj) || isDraft$1(obj) || !isDraftable$1(obj)) return obj;
8911
- if (getArchtype(obj) > 1) O.defineProperties(obj, {
8928
+ if (getArchtype(obj) > 1) O$1.defineProperties(obj, {
8912
8929
  set: dontMutateMethodOverride,
8913
8930
  add: dontMutateMethodOverride,
8914
8931
  clear: dontMutateMethodOverride,
8915
8932
  delete: dontMutateMethodOverride
8916
8933
  });
8917
- O.freeze(obj);
8934
+ O$1.freeze(obj);
8918
8935
  if (deep) each(obj, (_key, value) => {
8919
8936
  freeze$1(value, true);
8920
8937
  }, false);
@@ -8925,7 +8942,7 @@ window.__ModuleLoader__.load({
8925
8942
  }
8926
8943
  function isFrozen(obj) {
8927
8944
  if (obj === null || !isObjectish(obj)) return true;
8928
- return O.isFrozen(obj);
8945
+ return O$1.isFrozen(obj);
8929
8946
  }
8930
8947
  function getPlugin(pluginKey) {
8931
8948
  const plugin = plugins[pluginKey];
@@ -9158,13 +9175,13 @@ window.__ModuleLoader__.load({
9158
9175
  if (state) state.finalized_ = false;
9159
9176
  return copy;
9160
9177
  }
9161
- var NOTHING, DRAFTABLE, DRAFT_STATE, O, getPrototypeOf, CONSTRUCTOR, PROTOTYPE, CONFIGURABLE, ENUMERABLE, WRITABLE, VALUE, isDraft$1, objectCtorString, cachedCtorStrings, has, get, set, isArray, isMap, isSet, isObjectish, isFunction, isBoolean$1, latest, getFinalValue, dontMutateMethodOverride, PluginMapSet, PluginPatches, PluginArrayMethods, plugins, isPluginLoaded, currentScope, getCurrentScope, createScope, enterScope, isSameScope, EMPTY_LOCATIONS_RESULT, objectTraps, arrayTraps, Immer2, _globalIterator, immer, produce$1;
9178
+ var NOTHING, DRAFTABLE, DRAFT_STATE, O$1, getPrototypeOf, CONSTRUCTOR, PROTOTYPE, CONFIGURABLE, ENUMERABLE, WRITABLE, VALUE, isDraft$1, objectCtorString, cachedCtorStrings, has, get, set, isArray, isMap, isSet, isObjectish, isFunction, isBoolean$1, latest, getFinalValue, dontMutateMethodOverride, PluginMapSet, PluginPatches, PluginArrayMethods, plugins, isPluginLoaded, currentScope, getCurrentScope, createScope, enterScope, isSameScope, EMPTY_LOCATIONS_RESULT, objectTraps, arrayTraps, Immer2, _globalIterator, immer, produce$1;
9162
9179
  var init_immer = __esmMin((() => {
9163
9180
  NOTHING = Symbol.for("immer-nothing");
9164
9181
  DRAFTABLE = Symbol.for("immer-draftable");
9165
9182
  DRAFT_STATE = Symbol.for("immer-state");
9166
- O = Object;
9167
- getPrototypeOf = O.getPrototypeOf;
9183
+ O$1 = Object;
9184
+ getPrototypeOf = O$1.getPrototypeOf;
9168
9185
  CONSTRUCTOR = "constructor";
9169
9186
  PROTOTYPE = "prototype";
9170
9187
  CONFIGURABLE = "configurable";
@@ -9172,9 +9189,9 @@ window.__ModuleLoader__.load({
9172
9189
  WRITABLE = "writable";
9173
9190
  VALUE = "value";
9174
9191
  isDraft$1 = (value) => !!value && !!value[DRAFT_STATE];
9175
- objectCtorString = O[PROTOTYPE][CONSTRUCTOR].toString();
9192
+ objectCtorString = O$1[PROTOTYPE][CONSTRUCTOR].toString();
9176
9193
  cachedCtorStrings = /* @__PURE__ */ new WeakMap();
9177
- has = (thing, prop, type = getArchtype(thing)) => type === 2 ? thing.has(prop) : O[PROTOTYPE].hasOwnProperty.call(thing, prop);
9194
+ has = (thing, prop, type = getArchtype(thing)) => type === 2 ? thing.has(prop) : O$1[PROTOTYPE].hasOwnProperty.call(thing, prop);
9178
9195
  get = (thing, prop, type = getArchtype(thing)) => type === 2 ? thing.get(prop) : thing[prop];
9179
9196
  set = (thing, propOrOldValue, value, type = getArchtype(thing)) => {
9180
9197
  if (type === 2) thing.set(propOrOldValue, value);
@@ -14053,8 +14070,8 @@ window.__ModuleLoader__.load({
14053
14070
  useStore: () => G
14054
14071
  });
14055
14072
  module.exports = Ye(Ft);
14056
- var p = $e(require("react"));
14057
- var He = p.version.startsWith("19");
14073
+ var p$1 = $e(require("react"));
14074
+ var He = p$1.version.startsWith("19");
14058
14075
  var Be = Symbol.for(He ? "react.transitional.element" : "react.element");
14059
14076
  var ze = Symbol.for("react.portal");
14060
14077
  var Ke = Symbol.for("react.fragment");
@@ -14264,7 +14281,7 @@ window.__ModuleLoader__.load({
14264
14281
  var ct = at();
14265
14282
  var it = () => typeof navigator < "u" && navigator.product === "ReactNative";
14266
14283
  var ut = it();
14267
- var Pt = () => ct || ut ? p.useLayoutEffect : p.useEffect;
14284
+ var Pt = () => ct || ut ? p$1.useLayoutEffect : p$1.useEffect;
14268
14285
  var A = Pt();
14269
14286
  function Oe(e, t) {
14270
14287
  return e === t ? e !== 0 || t !== 0 || 1 / e === 1 / t : e !== e && t !== t;
@@ -14351,9 +14368,9 @@ window.__ModuleLoader__.load({
14351
14368
  var wt = Symbol.for("react-redux-context");
14352
14369
  var xt = typeof globalThis < "u" ? globalThis : {};
14353
14370
  function Ct() {
14354
- if (!p.createContext) return {};
14355
- let e = xt[wt] ??= /* @__PURE__ */ new Map(), t = e.get(p.createContext);
14356
- return t || (t = p.createContext(null), e.set(p.createContext, t)), t;
14371
+ if (!p$1.createContext) return {};
14372
+ let e = xt[wt] ??= /* @__PURE__ */ new Map(), t = e.get(p$1.createContext);
14373
+ return t || (t = p$1.createContext(null), e.set(p$1.createContext, t)), t;
14357
14374
  }
14358
14375
  var f = Ct();
14359
14376
  var Ot = [null, null];
@@ -14399,17 +14416,17 @@ window.__ModuleLoader__.load({
14399
14416
  areMergedPropsEqual: u
14400
14417
  };
14401
14418
  function C(O) {
14402
- let [E, J, b] = p.useMemo(() => {
14419
+ let [E, J, b] = p$1.useMemo(() => {
14403
14420
  let { reactReduxForwardedRef: h, ...k } = O;
14404
14421
  return [
14405
14422
  O.context,
14406
14423
  h,
14407
14424
  k
14408
14425
  ];
14409
- }, [O]), _ = p.useMemo(() => {
14426
+ }, [O]), _ = p$1.useMemo(() => {
14410
14427
  let h = l;
14411
14428
  return E?.Consumer, h;
14412
- }, [E, l]), D = p.useContext(_), I = !!O.store && !!O.store.getState && !!O.store.dispatch, _e = !!D && !!D.store, g = I ? O.store : D.store, ce = _e ? D.getServerState : g.getState, X = p.useMemo(() => ne(g.dispatch, y), [g]), [V, ie] = p.useMemo(() => {
14429
+ }, [E, l]), D = p$1.useContext(_), I = !!O.store && !!O.store.getState && !!O.store.dispatch, _e = !!D && !!D.store, g = I ? O.store : D.store, ce = _e ? D.getServerState : g.getState, X = p$1.useMemo(() => ne(g.dispatch, y), [g]), [V, ie] = p$1.useMemo(() => {
14413
14430
  if (!m) return Ot;
14414
14431
  let h = z(g, I ? void 0 : D.subscription);
14415
14432
  return [h, h.notifyNestedSubs.bind(h)];
@@ -14417,18 +14434,18 @@ window.__ModuleLoader__.load({
14417
14434
  g,
14418
14435
  I,
14419
14436
  D
14420
- ]), ue = p.useMemo(() => I ? D : {
14437
+ ]), ue = p$1.useMemo(() => I ? D : {
14421
14438
  ...D,
14422
14439
  subscription: V
14423
14440
  }, [
14424
14441
  I,
14425
14442
  D,
14426
14443
  V
14427
- ]), Z = p.useRef(void 0), Q = p.useRef(b), W = p.useRef(void 0), Pe = p.useRef(!1), ee = p.useRef(!1), te = p.useRef(void 0);
14444
+ ]), Z = p$1.useRef(void 0), Q = p$1.useRef(b), W = p$1.useRef(void 0), Pe = p$1.useRef(!1), ee = p$1.useRef(!1), te = p$1.useRef(void 0);
14428
14445
  A(() => (ee.current = !0, () => {
14429
14446
  ee.current = !1;
14430
14447
  }), []);
14431
- let le = p.useMemo(() => () => W.current && b === Q.current ? W.current : X(g.getState(), b), [g, b]), Ie = p.useMemo(() => (k) => V ? gt(m, g, V, X, Q, Z, Pe, ee, W, ie, k) : () => {}, [V]);
14448
+ let le = p$1.useMemo(() => () => W.current && b === Q.current ? W.current : X(g.getState(), b), [g, b]), Ie = p$1.useMemo(() => (k) => V ? gt(m, g, V, X, Q, Z, Pe, ee, W, ie, k) : () => {}, [V]);
14432
14449
  Dt(bt, [
14433
14450
  Q,
14434
14451
  Z,
@@ -14439,7 +14456,7 @@ window.__ModuleLoader__.load({
14439
14456
  ]);
14440
14457
  let $;
14441
14458
  try {
14442
- $ = p.useSyncExternalStore(Ie, le, ce ? () => X(ce(), b) : le);
14459
+ $ = p$1.useSyncExternalStore(Ie, le, ce ? () => X(ce(), b) : le);
14443
14460
  } catch (h) {
14444
14461
  throw te.current && (h.message += `
14445
14462
  The error may be correlated with this previous error:
@@ -14450,7 +14467,7 @@ ${te.current.stack}
14450
14467
  A(() => {
14451
14468
  te.current = void 0, W.current = void 0, Z.current = $;
14452
14469
  });
14453
- let oe = p.useMemo(() => p.createElement(T, {
14470
+ let oe = p$1.useMemo(() => p$1.createElement(T, {
14454
14471
  ...$,
14455
14472
  ref: J
14456
14473
  }), [
@@ -14458,16 +14475,16 @@ ${te.current.stack}
14458
14475
  T,
14459
14476
  $
14460
14477
  ]);
14461
- return p.useMemo(() => m ? p.createElement(_.Provider, { value: ue }, oe) : oe, [
14478
+ return p$1.useMemo(() => m ? p$1.createElement(_.Provider, { value: ue }, oe) : oe, [
14462
14479
  _,
14463
14480
  oe,
14464
14481
  ue
14465
14482
  ]);
14466
14483
  }
14467
- let N = p.memo(C);
14484
+ let N = p$1.memo(C);
14468
14485
  if (N.WrappedComponent = T, N.displayName = C.displayName = S, a) {
14469
- let E = p.forwardRef(function(b, _) {
14470
- return p.createElement(N, {
14486
+ let E = p$1.forwardRef(function(b, _) {
14487
+ return p$1.createElement(N, {
14471
14488
  ...b,
14472
14489
  reactReduxForwardedRef: _
14473
14490
  });
@@ -14480,25 +14497,25 @@ ${te.current.stack}
14480
14497
  var Ee = Re;
14481
14498
  var ke = Re;
14482
14499
  function Rt(e) {
14483
- let { children: t, context: o, serverState: n, store: r } = e, s = p.useMemo(() => {
14500
+ let { children: t, context: o, serverState: n, store: r } = e, s = p$1.useMemo(() => {
14484
14501
  let a = z(r);
14485
14502
  return {
14486
14503
  store: r,
14487
14504
  subscription: a,
14488
14505
  getServerState: n ? () => n : void 0
14489
14506
  };
14490
- }, [r, n]), i = p.useMemo(() => r.getState(), [r]);
14507
+ }, [r, n]), i = p$1.useMemo(() => r.getState(), [r]);
14491
14508
  return A(() => {
14492
14509
  let { subscription: a } = s;
14493
14510
  return a.onStateChange = a.notifyNestedSubs, a.trySubscribe(), i !== r.getState() && a.notifyNestedSubs(), () => {
14494
14511
  a.tryUnsubscribe(), a.onStateChange = void 0;
14495
14512
  };
14496
- }, [s, i]), p.createElement((o || f).Provider, { value: s }, t);
14513
+ }, [s, i]), p$1.createElement((o || f).Provider, { value: s }, t);
14497
14514
  }
14498
14515
  var Fe = Rt;
14499
14516
  function L(e = f) {
14500
14517
  return function() {
14501
- return p.useContext(e);
14518
+ return p$1.useContext(e);
14502
14519
  };
14503
14520
  }
14504
14521
  var K = L();
@@ -14520,11 +14537,11 @@ ${te.current.stack}
14520
14537
  function ae(e = f) {
14521
14538
  let t = e === f ? K : L(e), o = (n, r = {}) => {
14522
14539
  let { equalityFn: s = Et } = typeof r == "function" ? { equalityFn: r } : r, { store: u, subscription: a, getServerState: c } = t();
14523
- p.useRef(!0);
14524
- let P = p.useCallback({ [n.name](x) {
14540
+ p$1.useRef(!0);
14541
+ let P = p$1.useCallback({ [n.name](x) {
14525
14542
  return n(x);
14526
14543
  } }[n.name], [n]), d = (0, ve.useSyncExternalStoreWithSelector)(a.addNestedSub, u.getState, c || u.getState, P, s);
14527
- return p.useDebugValue(d), d;
14544
+ return p$1.useDebugValue(d), d;
14528
14545
  };
14529
14546
  return Object.assign(o, { withTypes: () => o }), o;
14530
14547
  }
@@ -52506,29 +52523,29 @@ ${te.current.stack}
52506
52523
  }
52507
52524
  //#endregion
52508
52525
  //#region \0dsh-css:D:\work\github\dsh\dsh-agent-toolkit\packages\usage\src\client\usage\UsageModal.module.css.mjs
52509
- const css$1 = ".MODeXa_dialog.MODeXa_dialog{width:min(720px,100%)}.MODeXa_pager{justify-content:flex-start;align-items:center;gap:8px;display:flex}.MODeXa_pagerButton{cursor:pointer;width:28px;height:28px;color:var(--dsw-alias-label-primary);background:0 0;border:none;border-radius:8px;justify-content:center;align-items:center;font-family:inherit;font-size:14px;line-height:20px;display:inline-flex}.MODeXa_pagerButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.MODeXa_pagerButton:disabled{color:var(--dsw-alias-label-dimmed);cursor:default}.MODeXa_tabs{background:var(--dsw-alias-bg-skeleton);border-radius:8px;gap:2px;margin-bottom:8px;padding:2px;display:inline-flex}.MODeXa_tab{cursor:pointer;height:28px;color:var(--dsw-alias-label-secondary);background:0 0;border:none;border-radius:6px;align-items:center;padding:0 12px;font-family:inherit;font-size:12px;line-height:18px;display:inline-flex}.MODeXa_tab:hover{background:var(--dsw-alias-interactive-bg-hover)}.MODeXa_tabActive{background:var(--dsw-alias-bg-overlay);color:var(--dsw-alias-label-primary)}.MODeXa_tabActive:hover{background:var(--dsw-alias-bg-overlay)}.MODeXa_dateLabel{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-primary);font-size:14px;line-height:22px}.MODeXa_total{color:var(--dsw-alias-label-primary);margin-top:12px;font-size:14px;font-weight:600;line-height:22px}.MODeXa_sectionTitle{color:var(--dsw-alias-label-secondary);margin:12px 0 4px;font-size:12px;line-height:18px}.MODeXa_row{color:var(--dsw-alias-label-primary);justify-content:space-between;gap:12px;font-size:12px;line-height:18px;display:flex}.MODeXa_rowName{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}.MODeXa_rowCalls{color:var(--dsw-alias-label-tertiary)}.MODeXa_compaction{color:var(--dsw-alias-label-secondary);margin-top:8px;font-size:12px;line-height:18px}";
52510
- const tagId$1 = "dsh-agent-toolkit/UsageModal.module.css-3b7b09e9";
52511
- if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$1) + "]") === null) {
52526
+ const css$2 = ".MODeXa_dialog.MODeXa_dialog{width:min(720px,100%)}.MODeXa_pager{justify-content:flex-start;align-items:center;gap:8px;display:flex}.MODeXa_pagerButton{cursor:pointer;width:28px;height:28px;color:var(--dsw-alias-label-primary);background:0 0;border:none;border-radius:8px;justify-content:center;align-items:center;font-family:inherit;font-size:14px;line-height:20px;display:inline-flex}.MODeXa_pagerButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.MODeXa_pagerButton:disabled{color:var(--dsw-alias-label-dimmed);cursor:default}.MODeXa_tabs{background:var(--dsw-alias-bg-skeleton);border-radius:8px;gap:2px;margin-bottom:8px;padding:2px;display:inline-flex}.MODeXa_tab{cursor:pointer;height:28px;color:var(--dsw-alias-label-secondary);background:0 0;border:none;border-radius:6px;align-items:center;padding:0 12px;font-family:inherit;font-size:12px;line-height:18px;display:inline-flex}.MODeXa_tab:hover{background:var(--dsw-alias-interactive-bg-hover)}.MODeXa_tabActive{background:var(--dsw-alias-bg-overlay);color:var(--dsw-alias-label-primary)}.MODeXa_tabActive:hover{background:var(--dsw-alias-bg-overlay)}.MODeXa_dateLabel{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-primary);font-size:14px;line-height:22px}.MODeXa_total{color:var(--dsw-alias-label-primary);margin-top:12px;font-size:14px;font-weight:600;line-height:22px}.MODeXa_sectionTitle{color:var(--dsw-alias-label-secondary);margin:12px 0 4px;font-size:12px;line-height:18px}.MODeXa_row{color:var(--dsw-alias-label-primary);justify-content:space-between;gap:12px;font-size:12px;line-height:18px;display:flex}.MODeXa_rowName{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}.MODeXa_rowCalls{color:var(--dsw-alias-label-tertiary)}.MODeXa_compaction{color:var(--dsw-alias-label-secondary);margin-top:8px;font-size:12px;line-height:18px}";
52527
+ const tagId$2 = "dsh-agent-toolkit/UsageModal.module.css-3b7b09e9";
52528
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$2) + "]") === null) {
52512
52529
  const tag = document.createElement("style");
52513
52530
  tag.dataset.plugin = "dsh-agent-toolkit";
52514
- tag.dataset.pluginCss = tagId$1;
52515
- tag.textContent = css$1;
52531
+ tag.dataset.pluginCss = tagId$2;
52532
+ tag.textContent = css$2;
52516
52533
  document.head.appendChild(tag);
52517
52534
  }
52518
52535
  var UsageModal_module_css_default = {
52519
- "dialog": "MODeXa_dialog",
52520
- "tabActive": "MODeXa_tabActive",
52521
- "rowName": "MODeXa_rowName",
52522
- "tab": "MODeXa_tab",
52523
52536
  "pagerButton": "MODeXa_pagerButton",
52524
- "sectionTitle": "MODeXa_sectionTitle",
52525
- "rowCalls": "MODeXa_rowCalls",
52537
+ "pager": "MODeXa_pager",
52526
52538
  "total": "MODeXa_total",
52527
- "compaction": "MODeXa_compaction",
52528
52539
  "dateLabel": "MODeXa_dateLabel",
52529
- "pager": "MODeXa_pager",
52530
- "tabs": "MODeXa_tabs",
52531
- "row": "MODeXa_row"
52540
+ "tab": "MODeXa_tab",
52541
+ "row": "MODeXa_row",
52542
+ "rowName": "MODeXa_rowName",
52543
+ "dialog": "MODeXa_dialog",
52544
+ "sectionTitle": "MODeXa_sectionTitle",
52545
+ "compaction": "MODeXa_compaction",
52546
+ "rowCalls": "MODeXa_rowCalls",
52547
+ "tabActive": "MODeXa_tabActive",
52548
+ "tabs": "MODeXa_tabs"
52532
52549
  };
52533
52550
  //#endregion
52534
52551
  //#region ../usage/src/client/usage/UsageModal.tsx
@@ -52688,7 +52705,7 @@ ${te.current.stack}
52688
52705
  }
52689
52706
  //#endregion
52690
52707
  //#region ../usage/src/client/usage/entry.tsx
52691
- const SidebarEntry$1 = createSidebarEntry({
52708
+ const SidebarEntry$2 = createSidebarEntry({
52692
52709
  id: "dsh-agent-toolkit:usage",
52693
52710
  order: 0,
52694
52711
  icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconDataOutline16, { size: 18 }),
@@ -52697,7 +52714,7 @@ ${te.current.stack}
52697
52714
  });
52698
52715
  /** 槽注册要求完整 composed props(含运行时 share useSessions/useWorkspaces);实现只消费 wide。 */
52699
52716
  function UsageEntry(props) {
52700
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SidebarEntry$1, { wide: props.wide });
52717
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SidebarEntry$2, { wide: props.wide });
52701
52718
  }
52702
52719
  //#endregion
52703
52720
  //#region ../usage/src/client/usage/index.ts
@@ -52710,7 +52727,7 @@ ${te.current.stack}
52710
52727
  }
52711
52728
  //#endregion
52712
52729
  //#region src/client/bots/api.ts
52713
- async function request(input, init) {
52730
+ async function request$1(input, init) {
52714
52731
  const res = init === void 0 ? await fetch(input) : await fetch(input, {
52715
52732
  ...init,
52716
52733
  headers: { "content-type": "application/json" }
@@ -52721,24 +52738,27 @@ ${te.current.stack}
52721
52738
  }
52722
52739
  return res.json();
52723
52740
  }
52724
- const fetchBots = () => request("/dsh-agent-toolkit/api/bots/bots").then((r) => r.bots);
52725
- const fetchProviders = () => request("/dsh-agent-toolkit/api/bots/providers").then((r) => r.providers);
52726
- const fetchAgents = () => request("/dsh-agent-toolkit/api/agents");
52727
- const fetchModels = (provider) => request(`/dsh-agent-toolkit/api/bots/models?provider=${encodeURIComponent(provider)}`).then((r) => r.models);
52741
+ const fetchBots = () => request$1("/dsh-agent-toolkit/api/bots/bots").then((r) => r.bots);
52742
+ const fetchProviders = () => request$1("/dsh-agent-toolkit/api/bots/providers").then((r) => r.providers);
52743
+ const fetchAgents$1 = () => request$1("/dsh-agent-toolkit/api/agents");
52744
+ const fetchModels = (provider) => request$1(`/dsh-agent-toolkit/api/bots/models?provider=${encodeURIComponent(provider)}`).then((r) => r.models);
52728
52745
  function createBot(input) {
52729
- return request("/dsh-agent-toolkit/api/bots/bots", {
52746
+ return request$1("/dsh-agent-toolkit/api/bots/bots", {
52730
52747
  method: "POST",
52731
52748
  body: JSON.stringify(input)
52732
52749
  });
52733
52750
  }
52734
52751
  function updateBot(id, input) {
52735
- return request(`/dsh-agent-toolkit/api/bots/bots?id=${encodeURIComponent(id)}`, {
52752
+ return request$1(`/dsh-agent-toolkit/api/bots/bots?id=${encodeURIComponent(id)}`, {
52736
52753
  method: "PUT",
52737
52754
  body: JSON.stringify(input)
52738
52755
  });
52739
52756
  }
52740
- const startRegisterApp = () => request("/dsh-agent-toolkit/api/bots/register-app", { method: "POST" });
52741
- const pollRegisterApp = (id) => request(`/dsh-agent-toolkit/api/bots/register-app/status?id=${encodeURIComponent(id)}`).then((r) => r.state);
52757
+ function deleteBot(id) {
52758
+ return request$1(`/dsh-agent-toolkit/api/bots/bots?id=${encodeURIComponent(id)}`, { method: "DELETE" });
52759
+ }
52760
+ const startRegisterApp = () => request$1("/dsh-agent-toolkit/api/bots/register-app", { method: "POST" });
52761
+ const pollRegisterApp = (id) => request$1(`/dsh-agent-toolkit/api/bots/register-app/status?id=${encodeURIComponent(id)}`).then((r) => r.state);
52742
52762
  //#endregion
52743
52763
  //#region ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/can-promise.js
52744
52764
  var require_can_promise = /* @__PURE__ */ __commonJSMin(((exports, module) => {
@@ -55143,39 +55163,41 @@ ${te.current.stack}
55143
55163
  return SvgRenderer.render(data, opts);
55144
55164
  });
55145
55165
  })))();
55146
- const css = ".vTbXga_dialog{width:560px}.vTbXga_group{margin-bottom:12px}.vTbXga_groupTitle{opacity:.6;word-break:break-all;margin:0 0 4px;font-size:12px}.vTbXga_botRow{border:1px solid var(--dsw-alias-border-l2);cursor:pointer;width:100%;font:inherit;color:inherit;text-align:left;background:0 0;border-radius:6px;align-items:center;gap:8px;margin-bottom:4px;padding:8px 10px;display:flex}.vTbXga_botRow:hover{background:var(--dsw-alias-interactive-bg-hover)}.vTbXga_botName{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}.vTbXga_channelBadge{flex:none}.vTbXga_status{color:var(--dsw-alias-label-tertiary);flex:none;align-items:center;gap:6px;font-size:12px;line-height:18px;display:inline-flex}.vTbXga_createButton{margin-top:8px}.vTbXga_field{color:var(--dsw-alias-label-secondary);flex-direction:column;gap:6px;margin:0 0 12px;font-size:13px;line-height:20px;display:flex}.vTbXga_input{box-sizing:border-box;width:100%}.vTbXga_select,.vTbXga_textarea{box-sizing:border-box;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);width:100%;color:var(--dsw-alias-label-primary);font:inherit;border-radius:12px;font-size:14px;line-height:22px}.vTbXga_select{height:32px;padding:0 8px}.vTbXga_textarea{resize:vertical;padding:4px 8px}.vTbXga_select:focus,.vTbXga_textarea:focus{border-color:var(--dsw-alias-brand-primary);outline:none}.vTbXga_steps{color:var(--dsw-alias-label-tertiary);align-items:center;gap:6px;margin:0 0 16px;font-size:13px;line-height:20px;display:flex}.vTbXga_step{color:var(--dsw-alias-label-tertiary)}.vTbXga_stepActive{color:var(--dsw-alias-label-primary);font-weight:600}.vTbXga_stepSeparator{color:var(--dsw-alias-label-tertiary)}.vTbXga_tabs{background:var(--dsw-alias-bg-layer-2);border-radius:12px;gap:2px;margin-bottom:12px;padding:3px;display:inline-flex}.vTbXga_tab{height:28px;color:var(--dsw-alias-label-secondary);font:inherit;cursor:pointer;background:0 0;border:none;border-radius:9px;padding:0 12px;font-size:13px;line-height:28px}.vTbXga_tabActive{background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary)}.vTbXga_scanSection{margin:0 0 12px}.vTbXga_error{color:var(--dsw-alias-state-error-primary);margin:0 0 12px;font-size:12px;line-height:18px}.vTbXga_hint{color:var(--dsw-alias-label-tertiary);margin:0 0 12px;font-size:12px;line-height:18px}.vTbXga_formActions{justify-content:flex-end;gap:8px;margin-top:4px;display:flex}";
55147
- const tagId = "dsh-agent-toolkit/bots.module.css-2ed59f26";
55148
- if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
55166
+ const css$1 = ".vTbXga_dialog{width:560px}.vTbXga_group{margin-bottom:12px}.vTbXga_groupTitle{opacity:.6;word-break:break-all;margin:0 0 4px;font-size:12px}.vTbXga_botRow{border:1px solid var(--dsw-alias-border-l2);border-radius:6px;align-items:center;gap:8px;width:100%;margin-bottom:4px;padding:8px 10px;display:flex}.vTbXga_botRow:hover{background:var(--dsw-alias-interactive-bg-hover)}.vTbXga_botMain{cursor:pointer;min-width:0;font:inherit;color:inherit;text-align:left;background:0 0;border:none;flex:1;align-items:center;gap:8px;padding:0;display:flex}.vTbXga_botDelete{cursor:pointer;font:inherit;color:var(--dsw-alias-label-tertiary);background:0 0;border:none;border-radius:4px;flex:none;padding:2px 8px;font-size:12px;line-height:18px}.vTbXga_botDelete:hover{color:var(--dsw-alias-state-error-primary)}.vTbXga_botName{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}.vTbXga_channelBadge{flex:none}.vTbXga_status{color:var(--dsw-alias-label-tertiary);flex:none;align-items:center;gap:6px;font-size:12px;line-height:18px;display:inline-flex}.vTbXga_createButton{margin-top:8px}.vTbXga_field{color:var(--dsw-alias-label-secondary);flex-direction:column;gap:6px;margin:0 0 12px;font-size:13px;line-height:20px;display:flex}.vTbXga_input{box-sizing:border-box;width:100%}.vTbXga_select,.vTbXga_textarea{box-sizing:border-box;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);width:100%;color:var(--dsw-alias-label-primary);font:inherit;border-radius:12px;font-size:14px;line-height:22px}.vTbXga_select{height:32px;padding:0 8px}.vTbXga_textarea{resize:vertical;padding:4px 8px}.vTbXga_select:focus,.vTbXga_textarea:focus{border-color:var(--dsw-alias-brand-primary);outline:none}.vTbXga_steps{color:var(--dsw-alias-label-tertiary);align-items:center;gap:6px;margin:0 0 16px;font-size:13px;line-height:20px;display:flex}.vTbXga_step{color:var(--dsw-alias-label-tertiary)}.vTbXga_stepActive{color:var(--dsw-alias-label-primary);font-weight:600}.vTbXga_stepSeparator{color:var(--dsw-alias-label-tertiary)}.vTbXga_tabs{background:var(--dsw-alias-bg-layer-2);border-radius:12px;gap:2px;margin-bottom:12px;padding:3px;display:inline-flex}.vTbXga_tab{height:28px;color:var(--dsw-alias-label-secondary);font:inherit;cursor:pointer;background:0 0;border:none;border-radius:9px;padding:0 12px;font-size:13px;line-height:28px}.vTbXga_tabActive{background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary)}.vTbXga_scanSection{margin:0 0 12px}.vTbXga_error{color:var(--dsw-alias-state-error-primary);margin:0 0 12px;font-size:12px;line-height:18px}.vTbXga_hint{color:var(--dsw-alias-label-tertiary);margin:0 0 12px;font-size:12px;line-height:18px}.vTbXga_formActions{justify-content:flex-end;gap:8px;margin-top:4px;display:flex}";
55167
+ const tagId$1 = "dsh-agent-toolkit/bots.module.css-2ed59f26";
55168
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$1) + "]") === null) {
55149
55169
  const tag = document.createElement("style");
55150
55170
  tag.dataset.plugin = "dsh-agent-toolkit";
55151
- tag.dataset.pluginCss = tagId;
55152
- tag.textContent = css;
55171
+ tag.dataset.pluginCss = tagId$1;
55172
+ tag.textContent = css$1;
55153
55173
  document.head.appendChild(tag);
55154
55174
  }
55155
55175
  var bots_module_css_default = {
55156
- "hint": "vTbXga_hint",
55157
- "group": "vTbXga_group",
55158
- "textarea": "vTbXga_textarea",
55159
- "field": "vTbXga_field",
55160
- "groupTitle": "vTbXga_groupTitle",
55161
- "botRow": "vTbXga_botRow",
55162
- "stepActive": "vTbXga_stepActive",
55176
+ "steps": "vTbXga_steps",
55163
55177
  "tab": "vTbXga_tab",
55178
+ "scanSection": "vTbXga_scanSection",
55164
55179
  "dialog": "vTbXga_dialog",
55165
- "createButton": "vTbXga_createButton",
55180
+ "textarea": "vTbXga_textarea",
55181
+ "groupTitle": "vTbXga_groupTitle",
55166
55182
  "step": "vTbXga_step",
55167
- "scanSection": "vTbXga_scanSection",
55183
+ "createButton": "vTbXga_createButton",
55184
+ "botRow": "vTbXga_botRow",
55185
+ "status": "vTbXga_status",
55168
55186
  "botName": "vTbXga_botName",
55169
- "select": "vTbXga_select",
55187
+ "botDelete": "vTbXga_botDelete",
55188
+ "channelBadge": "vTbXga_channelBadge",
55170
55189
  "input": "vTbXga_input",
55190
+ "stepSeparator": "vTbXga_stepSeparator",
55191
+ "select": "vTbXga_select",
55192
+ "tabActive": "vTbXga_tabActive",
55171
55193
  "error": "vTbXga_error",
55172
- "tabs": "vTbXga_tabs",
55194
+ "stepActive": "vTbXga_stepActive",
55195
+ "field": "vTbXga_field",
55173
55196
  "formActions": "vTbXga_formActions",
55174
- "status": "vTbXga_status",
55175
- "steps": "vTbXga_steps",
55176
- "stepSeparator": "vTbXga_stepSeparator",
55177
- "channelBadge": "vTbXga_channelBadge",
55178
- "tabActive": "vTbXga_tabActive"
55197
+ "group": "vTbXga_group",
55198
+ "botMain": "vTbXga_botMain",
55199
+ "hint": "vTbXga_hint",
55200
+ "tabs": "vTbXga_tabs"
55179
55201
  };
55180
55202
  //#endregion
55181
55203
  //#region src/client/bots/BotForm.tsx
@@ -55205,7 +55227,7 @@ ${te.current.stack}
55205
55227
  const pollTimer = (0, react.useRef)(void 0);
55206
55228
  (0, react.useEffect)(() => {
55207
55229
  let stale = false;
55208
- fetchAgents().then((as) => {
55230
+ fetchAgents$1().then((as) => {
55209
55231
  if (stale) return;
55210
55232
  setAgents(as);
55211
55233
  setAgentRef((current) => {
@@ -55326,28 +55348,31 @@ ${te.current.stack}
55326
55348
  setError("请填写 App ID 与 App Secret,或先完成扫码创建");
55327
55349
  return;
55328
55350
  }
55329
- const providerValue = provider.trim();
55330
- const modelValue = model.trim();
55331
- if (providerValue.length === 0) {
55332
- setError("请选择 Provider");
55333
- return;
55334
- }
55335
- if (modelValue.length === 0) {
55336
- setError("请选择或填写模型");
55337
- return;
55338
- }
55339
- const agentOptions = {
55340
- provider: providerValue,
55341
- model: modelValue
55342
- };
55351
+ let agentOptions;
55352
+ if (agentRef === "main") {
55353
+ const providerValue = provider.trim();
55354
+ const modelValue = model.trim();
55355
+ if (providerValue.length === 0) {
55356
+ setError("请选择 Provider");
55357
+ return;
55358
+ }
55359
+ if (modelValue.length === 0) {
55360
+ setError("请选择或填写模型");
55361
+ return;
55362
+ }
55363
+ agentOptions = {
55364
+ provider: providerValue,
55365
+ model: modelValue
55366
+ };
55367
+ } else if (editing) agentOptions = null;
55343
55368
  setSaving(true);
55344
55369
  try {
55345
55370
  const payload = {
55346
55371
  name: name.trim(),
55347
55372
  project: project.trim(),
55348
55373
  ...editing ? { agentRef: agentRef === "main" ? null : agentRef } : agentRef !== "main" ? { agentRef } : {},
55349
- agentOptions,
55350
- ...feishu !== void 0 ? { feishu } : {}
55374
+ ...feishu !== void 0 ? { feishu } : {},
55375
+ ...agentOptions !== void 0 ? { agentOptions } : {}
55351
55376
  };
55352
55377
  if (editing) await updateBot(bot.id, payload);
55353
55378
  else await createBot({
@@ -55458,51 +55483,53 @@ ${te.current.stack}
55458
55483
  }, a.id))]
55459
55484
  })]
55460
55485
  }),
55461
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
55462
- className: bots_module_css_default.field,
55463
- children: ["Provider", /* @__PURE__ */ (0, react_jsx_runtime.jsx)("select", {
55464
- className: bots_module_css_default.select,
55465
- value: provider,
55466
- "aria-label": "Provider",
55467
- disabled: providers.length === 0,
55468
- onChange: (e) => {
55469
- setProvider(e.target.value);
55470
- setModel("");
55471
- setModels([]);
55472
- },
55473
- children: providers.map((p) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
55474
- value: p.id,
55475
- children: p.name
55476
- }, p.id))
55477
- })]
55478
- }),
55479
- providersLoaded && providers.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
55480
- role: "alert",
55481
- className: bots_module_css_default.error,
55482
- children: "未发现可用 Provider"
55483
- }),
55484
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
55485
- className: bots_module_css_default.field,
55486
- children: ["模型", showModelSelect ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("select", {
55487
- className: bots_module_css_default.select,
55488
- value: model,
55489
- "aria-label": "模型",
55490
- onChange: (e) => {
55491
- setModel(e.target.value);
55492
- },
55493
- children: models.map((m) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
55494
- value: m.id,
55495
- children: m.name
55496
- }, m.id))
55497
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Input, {
55498
- value: model,
55499
- onChange: (e) => {
55500
- setModel(e.target.value);
55501
- },
55502
- "aria-label": "模型",
55503
- className: bots_module_css_default.input
55504
- })]
55505
- }),
55486
+ agentRef === "main" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
55487
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
55488
+ className: bots_module_css_default.field,
55489
+ children: ["Provider", /* @__PURE__ */ (0, react_jsx_runtime.jsx)("select", {
55490
+ className: bots_module_css_default.select,
55491
+ value: provider,
55492
+ "aria-label": "Provider",
55493
+ disabled: providers.length === 0,
55494
+ onChange: (e) => {
55495
+ setProvider(e.target.value);
55496
+ setModel("");
55497
+ setModels([]);
55498
+ },
55499
+ children: providers.map((p) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
55500
+ value: p.id,
55501
+ children: p.name
55502
+ }, p.id))
55503
+ })]
55504
+ }),
55505
+ providersLoaded && providers.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
55506
+ role: "alert",
55507
+ className: bots_module_css_default.error,
55508
+ children: "未发现可用 Provider"
55509
+ }),
55510
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
55511
+ className: bots_module_css_default.field,
55512
+ children: ["模型", showModelSelect ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("select", {
55513
+ className: bots_module_css_default.select,
55514
+ value: model,
55515
+ "aria-label": "模型",
55516
+ onChange: (e) => {
55517
+ setModel(e.target.value);
55518
+ },
55519
+ children: models.map((m) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
55520
+ value: m.id,
55521
+ children: m.name
55522
+ }, m.id))
55523
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Input, {
55524
+ value: model,
55525
+ onChange: (e) => {
55526
+ setModel(e.target.value);
55527
+ },
55528
+ "aria-label": "模型",
55529
+ className: bots_module_css_default.input
55530
+ })]
55531
+ })
55532
+ ] }),
55506
55533
  error !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
55507
55534
  role: "alert",
55508
55535
  className: bots_module_css_default.error,
@@ -55702,6 +55729,27 @@ ${te.current.stack}
55702
55729
  const [view, setView] = (0, react.useState)("list");
55703
55730
  /** 打开即拉取(body 随 open 全新挂载,天然复位);保存后 reload 重拉。 */
55704
55731
  const { state, reload } = useLoadState$1(() => fetchBots(), []);
55732
+ /** 两段确认:记录待删行 id;点其它行转移,执行后清空。 */
55733
+ const [confirmDeleteId, setConfirmDeleteId] = (0, react.useState)(null);
55734
+ const [deletingId, setDeletingId] = (0, react.useState)(null);
55735
+ const [deleteError, setDeleteError] = (0, react.useState)(null);
55736
+ async function remove(bot) {
55737
+ if (confirmDeleteId !== bot.id) {
55738
+ setConfirmDeleteId(bot.id);
55739
+ setDeleteError(null);
55740
+ return;
55741
+ }
55742
+ setDeletingId(bot.id);
55743
+ try {
55744
+ await deleteBot(bot.id);
55745
+ setConfirmDeleteId(null);
55746
+ reload();
55747
+ } catch (e) {
55748
+ setDeleteError(`删除失败:${e instanceof Error ? e.message : String(e)}`);
55749
+ } finally {
55750
+ setDeletingId(null);
55751
+ }
55752
+ }
55705
55753
  const groups = /* @__PURE__ */ new Map();
55706
55754
  if (state.kind === "ok") for (const bot of state.data) {
55707
55755
  const list = groups.get(bot.project) ?? [];
@@ -55717,38 +55765,56 @@ ${te.current.stack}
55717
55765
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
55718
55766
  className: bots_module_css_default.groupTitle,
55719
55767
  children: project
55720
- }), bots.map((bot) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
55721
- type: "button",
55768
+ }), bots.map((bot) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
55722
55769
  className: bots_module_css_default.botRow,
55723
- onClick: () => {
55724
- onEdit !== void 0 ? onEdit(bot) : setView({
55725
- mode: "edit",
55726
- bot
55727
- });
55728
- },
55729
- children: [
55730
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
55731
- className: bots_module_css_default.botName,
55732
- children: bot.name
55733
- }),
55734
- bot.feishu !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Pill, {
55735
- className: bots_module_css_default.channelBadge,
55736
- children: "飞书"
55737
- }),
55738
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
55739
- className: bots_module_css_default.status,
55740
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.StateDot, {
55741
- state: STATUS_DOT[bot.status] ?? "warning",
55742
- size: 8
55743
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: STATUS_LABEL[bot.status] ?? bot.status })]
55744
- })
55745
- ]
55770
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
55771
+ type: "button",
55772
+ className: bots_module_css_default.botMain,
55773
+ onClick: () => {
55774
+ setConfirmDeleteId(null);
55775
+ onEdit !== void 0 ? onEdit(bot) : setView({
55776
+ mode: "edit",
55777
+ bot
55778
+ });
55779
+ },
55780
+ children: [
55781
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
55782
+ className: bots_module_css_default.botName,
55783
+ children: bot.name
55784
+ }),
55785
+ bot.feishu !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Pill, {
55786
+ className: bots_module_css_default.channelBadge,
55787
+ children: "飞书"
55788
+ }),
55789
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
55790
+ className: bots_module_css_default.status,
55791
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.StateDot, {
55792
+ state: STATUS_DOT[bot.status] ?? "warning",
55793
+ size: 8
55794
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: STATUS_LABEL[bot.status] ?? bot.status })]
55795
+ })
55796
+ ]
55797
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
55798
+ type: "button",
55799
+ className: bots_module_css_default.botDelete,
55800
+ disabled: deletingId !== null,
55801
+ onClick: () => {
55802
+ remove(bot);
55803
+ },
55804
+ children: confirmDeleteId === bot.id ? "确认删除?" : "删除"
55805
+ })]
55746
55806
  }, bot.id))]
55747
55807
  }, project)),
55808
+ deleteError !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
55809
+ role: "alert",
55810
+ className: bots_module_css_default.error,
55811
+ children: deleteError
55812
+ }),
55748
55813
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
55749
55814
  variant: "primary",
55750
55815
  className: bots_module_css_default.createButton,
55751
55816
  onClick: () => {
55817
+ setConfirmDeleteId(null);
55752
55818
  onCreate !== void 0 ? onCreate() : setView({ mode: "create" });
55753
55819
  },
55754
55820
  children: "新建机器人"
@@ -55767,7 +55833,7 @@ ${te.current.stack}
55767
55833
  }
55768
55834
  //#endregion
55769
55835
  //#region src/client/bots/entry.tsx
55770
- const SidebarEntry = createSidebarEntry$1({
55836
+ const SidebarEntry$1 = createSidebarEntry$1({
55771
55837
  id: "dsh-agent-toolkit:bots",
55772
55838
  order: 1,
55773
55839
  icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconAgentPresetOutline16, { size: 18 }),
@@ -55776,7 +55842,7 @@ ${te.current.stack}
55776
55842
  });
55777
55843
  /** 槽注册要求完整 composed props(含运行时 share useSessions/useWorkspaces);实现只消费 wide + useWorkspaces。 */
55778
55844
  function BotsEntry(props) {
55779
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SidebarEntry, {
55845
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SidebarEntry$1, {
55780
55846
  wide: props.wide,
55781
55847
  useWorkspaces: props.useWorkspaces
55782
55848
  });
@@ -55791,6 +55857,1453 @@ ${te.current.stack}
55791
55857
  }, BotsEntry));
55792
55858
  }
55793
55859
  //#endregion
55860
+ //#region src/client/schedule/api.ts
55861
+ async function request(input, init) {
55862
+ const res = init === void 0 ? await fetch(input) : await fetch(input, {
55863
+ ...init,
55864
+ headers: { "content-type": "application/json" }
55865
+ });
55866
+ if (!res.ok) {
55867
+ const body = await res.text().catch(() => "");
55868
+ throw new Error(body || `HTTP ${res.status}`);
55869
+ }
55870
+ return res.json();
55871
+ }
55872
+ const BASE = "/dsh-agent-toolkit/api/cron";
55873
+ const fetchTasks = () => request(`${BASE}/tasks`).then((r) => r.tasks);
55874
+ const createTask = (input) => request(`${BASE}/tasks`, {
55875
+ method: "POST",
55876
+ body: JSON.stringify(input)
55877
+ });
55878
+ const updateTask = (id, patch) => request(`${BASE}/tasks/${encodeURIComponent(id)}`, {
55879
+ method: "PUT",
55880
+ body: JSON.stringify(patch)
55881
+ });
55882
+ const deleteTask = (id) => request(`${BASE}/tasks/${encodeURIComponent(id)}`, { method: "DELETE" });
55883
+ const triggerTask = (id) => request(`${BASE}/tasks/${encodeURIComponent(id)}/trigger`, {
55884
+ method: "POST",
55885
+ body: "{}"
55886
+ });
55887
+ const fetchRuns = (id) => request(`${BASE}/tasks/${encodeURIComponent(id)}/runs`).then((r) => r.runs);
55888
+ const fetchProjects = () => request(`${BASE}/projects`).then((r) => r.projects);
55889
+ const fetchAgents = () => request("/dsh-agent-toolkit/api/agents");
55890
+ //#endregion
55891
+ //#region \0dsh-css:D:\work\github\dsh\dsh-agent-toolkit\packages\toolkit\src\client\schedule\schedule.module.css.mjs
55892
+ const css = "._22qt-W_dialog{width:640px}._22qt-W_row{border:1px solid var(--dsw-alias-border-l2);border-radius:6px;align-items:center;gap:8px;width:100%;margin-bottom:4px;padding:8px 10px;display:flex}._22qt-W_row:hover{background:var(--dsw-alias-interactive-bg-hover)}._22qt-W_enabled{width:16px;height:16px;accent-color:var(--dsw-alias-brand-primary);cursor:pointer;flex:none}._22qt-W_main{cursor:pointer;min-width:0;font:inherit;color:inherit;text-align:left;background:0 0;border:none;flex-direction:column;flex:1;gap:2px;padding:0;display:flex}._22qt-W_name{font-weight:600}._22qt-W_meta{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px}._22qt-W_badge{flex:none}._22qt-W_action{cursor:pointer;font:inherit;color:var(--dsw-alias-label-tertiary);background:0 0;border:none;border-radius:4px;flex:none;padding:2px 8px;font-size:12px;line-height:18px}._22qt-W_action:hover{color:var(--dsw-alias-label-primary)}._22qt-W_actionDanger:hover{color:var(--dsw-alias-state-error-primary)}._22qt-W_runs{margin:4px 0 8px 16px;font-size:12px}._22qt-W_runRow{align-items:center;gap:8px;padding:2px 0;display:flex}._22qt-W_runError{color:var(--dsw-alias-state-error-primary)}._22qt-W_createButton{margin-top:8px}._22qt-W_field{color:var(--dsw-alias-label-secondary);flex-direction:column;gap:6px;margin:0 0 12px;font-size:13px;line-height:20px;display:flex}._22qt-W_input{box-sizing:border-box;width:100%}._22qt-W_select,._22qt-W_textarea{box-sizing:border-box;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);width:100%;color:var(--dsw-alias-label-primary);font:inherit;border-radius:12px;font-size:14px;line-height:22px}._22qt-W_select{height:32px;padding:0 8px}._22qt-W_textarea{resize:vertical;padding:4px 8px}._22qt-W_select:focus,._22qt-W_textarea:focus{border-color:var(--dsw-alias-brand-primary);outline:none}._22qt-W_radioGroup{border:none;padding:0}._22qt-W_option{color:var(--dsw-alias-label-primary);align-items:center;gap:6px;font-size:13px;line-height:20px;display:flex}._22qt-W_radio,._22qt-W_checkbox{width:16px;height:16px;accent-color:var(--dsw-alias-brand-primary);cursor:pointer;flex:none}._22qt-W_error{color:var(--dsw-alias-state-error-primary);margin:0 0 12px;font-size:12px;line-height:18px}._22qt-W_formActions{justify-content:flex-end;gap:8px;margin-top:4px;display:flex}";
55893
+ const tagId = "dsh-agent-toolkit/schedule.module.css-a938255d";
55894
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
55895
+ const tag = document.createElement("style");
55896
+ tag.dataset.plugin = "dsh-agent-toolkit";
55897
+ tag.dataset.pluginCss = tagId;
55898
+ tag.textContent = css;
55899
+ document.head.appendChild(tag);
55900
+ }
55901
+ var schedule_module_css_default = {
55902
+ "runs": "_22qt-W_runs",
55903
+ "field": "_22qt-W_field",
55904
+ "runRow": "_22qt-W_runRow",
55905
+ "name": "_22qt-W_name",
55906
+ "dialog": "_22qt-W_dialog",
55907
+ "textarea": "_22qt-W_textarea",
55908
+ "option": "_22qt-W_option",
55909
+ "radio": "_22qt-W_radio",
55910
+ "actionDanger": "_22qt-W_actionDanger",
55911
+ "action": "_22qt-W_action",
55912
+ "select": "_22qt-W_select",
55913
+ "checkbox": "_22qt-W_checkbox",
55914
+ "input": "_22qt-W_input",
55915
+ "meta": "_22qt-W_meta",
55916
+ "formActions": "_22qt-W_formActions",
55917
+ "row": "_22qt-W_row",
55918
+ "error": "_22qt-W_error",
55919
+ "main": "_22qt-W_main",
55920
+ "badge": "_22qt-W_badge",
55921
+ "radioGroup": "_22qt-W_radioGroup",
55922
+ "enabled": "_22qt-W_enabled",
55923
+ "createButton": "_22qt-W_createButton",
55924
+ "runError": "_22qt-W_runError"
55925
+ };
55926
+ //#endregion
55927
+ //#region src/client/schedule/ScheduleModal.tsx
55928
+ /** 定时任务管理模态框:任务列表(行内开关/编辑/删除两段确认/立即触发)+ 运行历史展开。 */
55929
+ /** 调度规则摘要(列表行内一行)。 */
55930
+ function scheduleSummary(task) {
55931
+ switch (task.schedule.kind) {
55932
+ case "cron": return `cron: ${task.schedule.expr}${task.schedule.timeZone !== void 0 ? ` (${task.schedule.timeZone})` : ""}`;
55933
+ case "at": return `at: ${new Date(task.schedule.at).toLocaleString()}`;
55934
+ case "every": return `every ${task.schedule.seconds}s`;
55935
+ }
55936
+ }
55937
+ const RUN_STATUS_KEY = {
55938
+ ok: "run.ok",
55939
+ error: "run.error",
55940
+ running: "run.running",
55941
+ "skipped-overlap": "run.skipped-overlap"
55942
+ };
55943
+ function ScheduleModal(props) {
55944
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Modal, {
55945
+ open: props.open,
55946
+ onClose: props.onClose,
55947
+ title: props.t("modal.title"),
55948
+ closeLabel: props.t("modal.close"),
55949
+ className: schedule_module_css_default.dialog,
55950
+ children: props.open && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScheduleModalBody, { ...props })
55951
+ });
55952
+ }
55953
+ function ScheduleModalBody({ onClose: _onClose, ...props }) {
55954
+ const { t, openSession } = props;
55955
+ const [view, setView] = (0, react.useState)("list");
55956
+ const { state, reload } = useLoadState$1(() => fetchTasks(), []);
55957
+ const [confirmDeleteId, setConfirmDeleteId] = (0, react.useState)(null);
55958
+ const [error, setError] = (0, react.useState)(null);
55959
+ const [expandedId, setExpandedId] = (0, react.useState)(null);
55960
+ async function remove(task) {
55961
+ if (confirmDeleteId !== task.id) {
55962
+ setConfirmDeleteId(task.id);
55963
+ setError(null);
55964
+ return;
55965
+ }
55966
+ try {
55967
+ await deleteTask(task.id);
55968
+ setConfirmDeleteId(null);
55969
+ reload();
55970
+ } catch (e) {
55971
+ setError(t("list.deleteFailed", { message: e instanceof Error ? e.message : String(e) }));
55972
+ }
55973
+ }
55974
+ async function toggleEnabled(task) {
55975
+ try {
55976
+ await updateTask(task.id, { enabled: !task.enabled });
55977
+ reload();
55978
+ } catch (e) {
55979
+ setError(e instanceof Error ? e.message : String(e));
55980
+ }
55981
+ }
55982
+ async function trigger(task) {
55983
+ try {
55984
+ await triggerTask(task.id);
55985
+ reload();
55986
+ } catch (e) {
55987
+ setError(t("list.triggerFailed", { message: e instanceof Error ? e.message : String(e) }));
55988
+ }
55989
+ }
55990
+ if (view !== "list" && props.renderForm !== void 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: props.renderForm(view.mode === "edit" ? view.task : void 0, () => {
55991
+ reload();
55992
+ setView("list");
55993
+ }, () => {
55994
+ setView("list");
55995
+ }) });
55996
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
55997
+ state.kind === "loading" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("list.loading") }),
55998
+ state.kind === "error" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("list.error") }),
55999
+ state.kind === "ok" && state.data.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("list.empty") }),
56000
+ state.kind === "ok" && state.data.map((task) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
56001
+ className: schedule_module_css_default.row,
56002
+ children: [
56003
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
56004
+ type: "checkbox",
56005
+ className: schedule_module_css_default.enabled,
56006
+ "aria-label": task.name,
56007
+ checked: task.enabled,
56008
+ onChange: () => {
56009
+ toggleEnabled(task);
56010
+ }
56011
+ }),
56012
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
56013
+ type: "button",
56014
+ className: schedule_module_css_default.main,
56015
+ onClick: () => {
56016
+ setConfirmDeleteId(null);
56017
+ props.onEdit !== void 0 ? props.onEdit(task) : setView({
56018
+ mode: "edit",
56019
+ task
56020
+ });
56021
+ },
56022
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
56023
+ className: schedule_module_css_default.name,
56024
+ children: task.name
56025
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
56026
+ className: schedule_module_css_default.meta,
56027
+ children: [
56028
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: scheduleSummary(task) }),
56029
+ " · ",
56030
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: task.target.kind === "main" ? t("list.targetMain") : t("list.targetRole", { roleId: task.target.roleId }) }),
56031
+ " · ",
56032
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: task.enabled && task.nextRunAt !== null ? t("list.nextRun", { time: new Date(task.nextRunAt).toLocaleString() }) : t("list.noNextRun") })
56033
+ ]
56034
+ })]
56035
+ }),
56036
+ task.lastRun !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Pill, {
56037
+ className: schedule_module_css_default.badge,
56038
+ children: t(RUN_STATUS_KEY[task.lastRun.status])
56039
+ }),
56040
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
56041
+ type: "button",
56042
+ className: schedule_module_css_default.action,
56043
+ onClick: () => {
56044
+ setExpandedId(expandedId === task.id ? null : task.id);
56045
+ },
56046
+ children: t("list.history")
56047
+ }),
56048
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
56049
+ type: "button",
56050
+ className: schedule_module_css_default.action,
56051
+ onClick: () => {
56052
+ trigger(task);
56053
+ },
56054
+ children: t("list.trigger")
56055
+ }),
56056
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
56057
+ type: "button",
56058
+ className: clsx(schedule_module_css_default.action, schedule_module_css_default.actionDanger),
56059
+ onClick: () => {
56060
+ remove(task);
56061
+ },
56062
+ children: confirmDeleteId === task.id ? t("list.confirmDelete") : t("list.delete")
56063
+ })
56064
+ ]
56065
+ }), expandedId === task.id && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RunHistory, {
56066
+ taskId: task.id,
56067
+ openSession,
56068
+ t
56069
+ })] }, task.id)),
56070
+ error !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
56071
+ role: "alert",
56072
+ className: schedule_module_css_default.error,
56073
+ children: error
56074
+ }),
56075
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
56076
+ variant: "primary",
56077
+ className: schedule_module_css_default.createButton,
56078
+ onClick: () => {
56079
+ setConfirmDeleteId(null);
56080
+ props.onCreate !== void 0 ? props.onCreate() : setView({ mode: "create" });
56081
+ },
56082
+ children: t("list.create")
56083
+ })
56084
+ ] });
56085
+ }
56086
+ function RunHistory({ taskId, openSession, t }) {
56087
+ const { state } = useLoadState$1(() => fetchRuns(taskId), [taskId]);
56088
+ if (state.kind !== "ok") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
56089
+ className: schedule_module_css_default.runs,
56090
+ children: t("list.loading")
56091
+ });
56092
+ if (state.data.length === 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
56093
+ className: schedule_module_css_default.runs,
56094
+ children: t("list.historyEmpty")
56095
+ });
56096
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
56097
+ className: schedule_module_css_default.runs,
56098
+ children: state.data.map((run) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
56099
+ className: schedule_module_css_default.runRow,
56100
+ children: [
56101
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: new Date(run.triggeredAt).toLocaleString() }),
56102
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Pill, { children: t(RUN_STATUS_KEY[run.status]) }),
56103
+ run.finishedAt !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [Math.max(0, Math.round((Date.parse(run.finishedAt) - Date.parse(run.triggeredAt)) / 1e3)), "s"] }),
56104
+ run.error !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
56105
+ className: schedule_module_css_default.runError,
56106
+ children: run.error
56107
+ }),
56108
+ run.sessionId !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
56109
+ type: "button",
56110
+ className: schedule_module_css_default.action,
56111
+ onClick: () => {
56112
+ openSession(run.sessionId);
56113
+ },
56114
+ children: t("run.openSession")
56115
+ })
56116
+ ]
56117
+ }, run.id))
56118
+ });
56119
+ }
56120
+ //#endregion
56121
+ //#region src/client/schedule/entry.tsx
56122
+ const SidebarEntry = createSidebarEntry$1({
56123
+ id: "dsh-agent-toolkit:schedule",
56124
+ order: 2,
56125
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
56126
+ width: "18",
56127
+ height: "18",
56128
+ viewBox: "0 0 16 16",
56129
+ fill: "none",
56130
+ "aria-hidden": "true",
56131
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
56132
+ cx: "8",
56133
+ cy: "8",
56134
+ r: "6.5",
56135
+ stroke: "currentColor"
56136
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
56137
+ d: "M8 4.5V8L10.5 9.5",
56138
+ stroke: "currentColor",
56139
+ strokeLinecap: "round"
56140
+ })]
56141
+ }),
56142
+ title: "定时任务",
56143
+ renderModal: (p) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScheduleModal, { ...p })
56144
+ });
56145
+ function ScheduleEntry(props) {
56146
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SidebarEntry, {
56147
+ wide: props.wide,
56148
+ t: props.t,
56149
+ openSession: props.openSession,
56150
+ renderForm: props.renderForm
56151
+ });
56152
+ }
56153
+ //#endregion
56154
+ //#region ../../node_modules/.pnpm/croner@10.0.1/node_modules/croner/dist/croner.js
56155
+ function T(s) {
56156
+ return Date.UTC(s.y, s.m - 1, s.d, s.h, s.i, s.s);
56157
+ }
56158
+ function D(s, e) {
56159
+ return s.y === e.y && s.m === e.m && s.d === e.d && s.h === e.h && s.i === e.i && s.s === e.s;
56160
+ }
56161
+ function A(s, e) {
56162
+ let t = new Date(Date.parse(s));
56163
+ if (isNaN(t)) throw new Error("Invalid ISO8601 passed to timezone parser.");
56164
+ let r = s.substring(9);
56165
+ return r.includes("Z") || r.includes("+") || r.includes("-") ? b(t.getUTCFullYear(), t.getUTCMonth() + 1, t.getUTCDate(), t.getUTCHours(), t.getUTCMinutes(), t.getUTCSeconds(), "Etc/UTC") : b(t.getFullYear(), t.getMonth() + 1, t.getDate(), t.getHours(), t.getMinutes(), t.getSeconds(), e);
56166
+ }
56167
+ function v(s, e, t) {
56168
+ return k(A(s, e), t);
56169
+ }
56170
+ function k(s, e) {
56171
+ let t = new Date(T(s)), r = g(t, s.tz), a = T(s) - T(r), o = new Date(t.getTime() + a), h = g(o, s.tz);
56172
+ if (D(h, s)) {
56173
+ let u = /* @__PURE__ */ new Date(o.getTime() - 36e5);
56174
+ return D(g(u, s.tz), s) ? u : o;
56175
+ }
56176
+ let l = new Date(o.getTime() + T(s) - T(h));
56177
+ if (D(g(l, s.tz), s)) return l;
56178
+ if (e) throw new Error("Invalid date passed to fromTZ()");
56179
+ return o.getTime() > l.getTime() ? o : l;
56180
+ }
56181
+ function g(s, e) {
56182
+ let t, r;
56183
+ try {
56184
+ t = new Intl.DateTimeFormat("en-US", {
56185
+ timeZone: e,
56186
+ year: "numeric",
56187
+ month: "numeric",
56188
+ day: "numeric",
56189
+ hour: "numeric",
56190
+ minute: "numeric",
56191
+ second: "numeric",
56192
+ hour12: !1
56193
+ }), r = t.formatToParts(s);
56194
+ } catch (i) {
56195
+ let a = i instanceof Error ? i.message : String(i);
56196
+ throw new RangeError(`toTZ: Invalid timezone '${e}' or date. Please provide a valid IANA timezone (e.g., 'America/New_York', 'Europe/Stockholm'). Original error: ${a}`);
56197
+ }
56198
+ let n = {
56199
+ year: 0,
56200
+ month: 0,
56201
+ day: 0,
56202
+ hour: 0,
56203
+ minute: 0,
56204
+ second: 0
56205
+ };
56206
+ for (let i of r) (i.type === "year" || i.type === "month" || i.type === "day" || i.type === "hour" || i.type === "minute" || i.type === "second") && (n[i.type] = parseInt(i.value, 10));
56207
+ if (isNaN(n.year) || isNaN(n.month) || isNaN(n.day) || isNaN(n.hour) || isNaN(n.minute) || isNaN(n.second)) throw new Error(`toTZ: Failed to parse all date components from timezone '${e}'. This may indicate an invalid date or timezone configuration. Parsed components: ${JSON.stringify(n)}`);
56208
+ return n.hour === 24 && (n.hour = 0), {
56209
+ y: n.year,
56210
+ m: n.month,
56211
+ d: n.day,
56212
+ h: n.hour,
56213
+ i: n.minute,
56214
+ s: n.second,
56215
+ tz: e
56216
+ };
56217
+ }
56218
+ function b(s, e, t, r, n, i, a) {
56219
+ return {
56220
+ y: s,
56221
+ m: e,
56222
+ d: t,
56223
+ h: r,
56224
+ i: n,
56225
+ s: i,
56226
+ tz: a
56227
+ };
56228
+ }
56229
+ var O = [
56230
+ 1,
56231
+ 2,
56232
+ 4,
56233
+ 8,
56234
+ 16
56235
+ ];
56236
+ var C = class {
56237
+ pattern;
56238
+ timezone;
56239
+ mode;
56240
+ alternativeWeekdays;
56241
+ sloppyRanges;
56242
+ second;
56243
+ minute;
56244
+ hour;
56245
+ day;
56246
+ month;
56247
+ dayOfWeek;
56248
+ year;
56249
+ lastDayOfMonth;
56250
+ lastWeekday;
56251
+ nearestWeekdays;
56252
+ starDOM;
56253
+ starDOW;
56254
+ starYear;
56255
+ useAndLogic;
56256
+ constructor(e, t, r) {
56257
+ this.pattern = e, this.timezone = t, this.mode = r?.mode ?? "auto", this.alternativeWeekdays = r?.alternativeWeekdays ?? !1, this.sloppyRanges = r?.sloppyRanges ?? !1, this.second = Array(60).fill(0), this.minute = Array(60).fill(0), this.hour = Array(24).fill(0), this.day = Array(31).fill(0), this.month = Array(12).fill(0), this.dayOfWeek = Array(7).fill(0), this.year = Array(1e4).fill(0), this.lastDayOfMonth = !1, this.lastWeekday = !1, this.nearestWeekdays = Array(31).fill(0), this.starDOM = !1, this.starDOW = !1, this.starYear = !1, this.useAndLogic = !1, this.parse();
56258
+ }
56259
+ parse() {
56260
+ if (!(typeof this.pattern == "string" || this.pattern instanceof String)) throw new TypeError("CronPattern: Pattern has to be of type string.");
56261
+ this.pattern.indexOf("@") >= 0 && (this.pattern = this.handleNicknames(this.pattern).trim());
56262
+ let e = this.pattern.match(/\S+/g) || [""], t = e.length;
56263
+ if (e.length < 5 || e.length > 7) throw new TypeError("CronPattern: invalid configuration format ('" + this.pattern + "'), exactly five, six, or seven space separated parts are required.");
56264
+ if (this.mode !== "auto") {
56265
+ let n;
56266
+ switch (this.mode) {
56267
+ case "5-part":
56268
+ n = 5;
56269
+ break;
56270
+ case "6-part":
56271
+ n = 6;
56272
+ break;
56273
+ case "7-part":
56274
+ n = 7;
56275
+ break;
56276
+ case "5-or-6-parts":
56277
+ n = [5, 6];
56278
+ break;
56279
+ case "6-or-7-parts":
56280
+ n = [6, 7];
56281
+ break;
56282
+ default: n = 0;
56283
+ }
56284
+ if (!(Array.isArray(n) ? n.includes(t) : t === n)) {
56285
+ let a = Array.isArray(n) ? n.join(" or ") : n.toString();
56286
+ throw new TypeError(`CronPattern: mode '${this.mode}' requires exactly ${a} parts, but pattern '${this.pattern}' has ${t} parts.`);
56287
+ }
56288
+ }
56289
+ if (e.length === 5 && e.unshift("0"), e.length === 6 && e.push("*"), e[3].toUpperCase() === "LW" ? (this.lastWeekday = !0, e[3] = "") : e[3].toUpperCase().indexOf("L") >= 0 && (e[3] = e[3].replace(/L/gi, ""), this.lastDayOfMonth = !0), e[3] == "*" && (this.starDOM = !0), e[6] == "*" && (this.starYear = !0), e[4].length >= 3 && (e[4] = this.replaceAlphaMonths(e[4])), e[5].length >= 3 && (e[5] = this.alternativeWeekdays ? this.replaceAlphaDaysQuartz(e[5]) : this.replaceAlphaDays(e[5])), e[5].startsWith("+") && (this.useAndLogic = !0, e[5] = e[5].substring(1), e[5] === "")) throw new TypeError("CronPattern: Day-of-week field cannot be empty after '+' modifier.");
56290
+ switch (e[5] == "*" && (this.starDOW = !0), this.pattern.indexOf("?") >= 0 && (e[0] = e[0].replace(/\?/g, "*"), e[1] = e[1].replace(/\?/g, "*"), e[2] = e[2].replace(/\?/g, "*"), e[3] = e[3].replace(/\?/g, "*"), e[4] = e[4].replace(/\?/g, "*"), e[5] = e[5].replace(/\?/g, "*"), e[6] && (e[6] = e[6].replace(/\?/g, "*"))), this.mode) {
56291
+ case "5-part":
56292
+ e[0] = "0", e[6] = "*";
56293
+ break;
56294
+ case "6-part":
56295
+ e[6] = "*";
56296
+ break;
56297
+ case "5-or-6-parts": e[6] = "*";
56298
+ }
56299
+ this.throwAtIllegalCharacters(e), this.partToArray("second", e[0], 0, 1), this.partToArray("minute", e[1], 0, 1), this.partToArray("hour", e[2], 0, 1), this.partToArray("day", e[3], -1, 1), this.partToArray("month", e[4], -1, 1);
56300
+ let r = this.alternativeWeekdays ? -1 : 0;
56301
+ this.partToArray("dayOfWeek", e[5], r, 63), this.partToArray("year", e[6], 0, 1), !this.alternativeWeekdays && this.dayOfWeek[7] && (this.dayOfWeek[0] = this.dayOfWeek[7]);
56302
+ }
56303
+ partToArray(e, t, r, n) {
56304
+ let i = this[e], a = e === "day" && this.lastDayOfMonth, o = e === "day" && this.lastWeekday;
56305
+ if (t === "" && !a && !o) throw new TypeError("CronPattern: configuration entry " + e + " (" + t + ") is empty, check for trailing spaces.");
56306
+ if (t === "*") return i.fill(n);
56307
+ let h = t.split(",");
56308
+ if (h.length > 1) for (let l = 0; l < h.length; l++) this.partToArray(e, h[l], r, n);
56309
+ else t.indexOf("-") !== -1 && t.indexOf("/") !== -1 ? this.handleRangeWithStepping(t, e, r, n) : t.indexOf("-") !== -1 ? this.handleRange(t, e, r, n) : t.indexOf("/") !== -1 ? this.handleStepping(t, e, r, n) : t !== "" && this.handleNumber(t, e, r, n);
56310
+ }
56311
+ throwAtIllegalCharacters(e) {
56312
+ for (let t = 0; t < e.length; t++) if ((t === 3 ? /[^/*0-9,\-WwLl]+/ : t === 5 ? /[^/*0-9,\-#Ll]+/ : /[^/*0-9,\-]+/).test(e[t])) throw new TypeError("CronPattern: configuration entry " + t + " (" + e[t] + ") contains illegal characters.");
56313
+ }
56314
+ handleNumber(e, t, r, n) {
56315
+ let i = this.extractNth(e, t), a = e.toUpperCase().includes("W");
56316
+ if (t !== "day" && a) throw new TypeError("CronPattern: Nearest weekday modifier (W) only allowed in day-of-month.");
56317
+ a && (t = "nearestWeekdays");
56318
+ let o = parseInt(i[0], 10) + r;
56319
+ if (isNaN(o)) throw new TypeError("CronPattern: " + t + " is not a number: '" + e + "'");
56320
+ this.setPart(t, o, i[1] || n);
56321
+ }
56322
+ setPart(e, t, r) {
56323
+ if (!Object.prototype.hasOwnProperty.call(this, e)) throw new TypeError("CronPattern: Invalid part specified: " + e);
56324
+ if (e === "dayOfWeek") {
56325
+ if (t === 7 && (t = 0), t < 0 || t > 6) throw new RangeError("CronPattern: Invalid value for dayOfWeek: " + t);
56326
+ this.setNthWeekdayOfMonth(t, r);
56327
+ return;
56328
+ }
56329
+ if (e === "second" || e === "minute") {
56330
+ if (t < 0 || t >= 60) throw new RangeError("CronPattern: Invalid value for " + e + ": " + t);
56331
+ } else if (e === "hour") {
56332
+ if (t < 0 || t >= 24) throw new RangeError("CronPattern: Invalid value for " + e + ": " + t);
56333
+ } else if (e === "day" || e === "nearestWeekdays") {
56334
+ if (t < 0 || t >= 31) throw new RangeError("CronPattern: Invalid value for " + e + ": " + t);
56335
+ } else if (e === "month") {
56336
+ if (t < 0 || t >= 12) throw new RangeError("CronPattern: Invalid value for " + e + ": " + t);
56337
+ } else if (e === "year" && (t < 1 || t >= 1e4)) throw new RangeError("CronPattern: Invalid value for " + e + ": " + t + " (supported range: 1-9999)");
56338
+ this[e][t] = r;
56339
+ }
56340
+ validateNotNaN(e, t) {
56341
+ if (isNaN(e)) throw new TypeError(t);
56342
+ }
56343
+ validateRange(e, t, r, n, i) {
56344
+ if (e > t) throw new TypeError("CronPattern: From value is larger than to value: '" + i + "'");
56345
+ if (r !== void 0) {
56346
+ if (r === 0) throw new TypeError("CronPattern: Syntax error, illegal stepping: 0");
56347
+ if (r > this[n].length) throw new TypeError("CronPattern: Syntax error, steps cannot be greater than maximum value of part (" + this[n].length + ")");
56348
+ }
56349
+ }
56350
+ handleRangeWithStepping(e, t, r, n) {
56351
+ if (e.toUpperCase().includes("W")) throw new TypeError("CronPattern: Syntax error, W is not allowed in ranges with stepping.");
56352
+ let i = this.extractNth(e, t), a = i[0].match(/^(\d+)-(\d+)\/(\d+)$/);
56353
+ if (a === null) throw new TypeError("CronPattern: Syntax error, illegal range with stepping: '" + e + "'");
56354
+ let [, o, h, l] = a, y = parseInt(o, 10) + r, u = parseInt(h, 10) + r, d = parseInt(l, 10);
56355
+ this.validateNotNaN(y, "CronPattern: Syntax error, illegal lower range (NaN)"), this.validateNotNaN(u, "CronPattern: Syntax error, illegal upper range (NaN)"), this.validateNotNaN(d, "CronPattern: Syntax error, illegal stepping: (NaN)"), this.validateRange(y, u, d, t, e);
56356
+ for (let c = y; c <= u; c += d) this.setPart(t, c, i[1] || n);
56357
+ }
56358
+ extractNth(e, t) {
56359
+ let r = e, n;
56360
+ if (r.includes("#")) {
56361
+ if (t !== "dayOfWeek") throw new Error("CronPattern: nth (#) only allowed in day-of-week field");
56362
+ n = r.split("#")[1], r = r.split("#")[0];
56363
+ } else if (r.toUpperCase().endsWith("L")) {
56364
+ if (t !== "dayOfWeek") throw new Error("CronPattern: L modifier only allowed in day-of-week field (use L alone for day-of-month)");
56365
+ n = "L", r = r.slice(0, -1);
56366
+ }
56367
+ return [r, n];
56368
+ }
56369
+ handleRange(e, t, r, n) {
56370
+ if (e.toUpperCase().includes("W")) throw new TypeError("CronPattern: Syntax error, W is not allowed in a range.");
56371
+ let i = this.extractNth(e, t), a = i[0].split("-");
56372
+ if (a.length !== 2) throw new TypeError("CronPattern: Syntax error, illegal range: '" + e + "'");
56373
+ let o = parseInt(a[0], 10) + r, h = parseInt(a[1], 10) + r;
56374
+ this.validateNotNaN(o, "CronPattern: Syntax error, illegal lower range (NaN)"), this.validateNotNaN(h, "CronPattern: Syntax error, illegal upper range (NaN)"), this.validateRange(o, h, void 0, t, e);
56375
+ for (let l = o; l <= h; l++) this.setPart(t, l, i[1] || n);
56376
+ }
56377
+ handleStepping(e, t, r, n) {
56378
+ if (e.toUpperCase().includes("W")) throw new TypeError("CronPattern: Syntax error, W is not allowed in parts with stepping.");
56379
+ let i = this.extractNth(e, t), a = i[0].split("/");
56380
+ if (a.length !== 2) throw new TypeError("CronPattern: Syntax error, illegal stepping: '" + e + "'");
56381
+ if (this.sloppyRanges) a[0] === "" && (a[0] = "*");
56382
+ else {
56383
+ if (a[0] === "") throw new TypeError("CronPattern: Syntax error, stepping with missing prefix ('" + e + "') is not allowed. Use wildcard (*/step) or range (min-max/step) instead.");
56384
+ if (a[0] !== "*") throw new TypeError("CronPattern: Syntax error, stepping with numeric prefix ('" + e + "') is not allowed. Use wildcard (*/step) or range (min-max/step) instead.");
56385
+ }
56386
+ let o = 0;
56387
+ a[0] !== "*" && (o = parseInt(a[0], 10) + r);
56388
+ let h = parseInt(a[1], 10);
56389
+ this.validateNotNaN(h, "CronPattern: Syntax error, illegal stepping: (NaN)"), this.validateRange(0, this[t].length - 1, h, t, e);
56390
+ for (let l = o; l < this[t].length; l += h) this.setPart(t, l, i[1] || n);
56391
+ }
56392
+ replaceAlphaDays(e) {
56393
+ return e.replace(/-sun/gi, "-7").replace(/sun/gi, "0").replace(/mon/gi, "1").replace(/tue/gi, "2").replace(/wed/gi, "3").replace(/thu/gi, "4").replace(/fri/gi, "5").replace(/sat/gi, "6");
56394
+ }
56395
+ replaceAlphaDaysQuartz(e) {
56396
+ return e.replace(/sun/gi, "1").replace(/mon/gi, "2").replace(/tue/gi, "3").replace(/wed/gi, "4").replace(/thu/gi, "5").replace(/fri/gi, "6").replace(/sat/gi, "7");
56397
+ }
56398
+ replaceAlphaMonths(e) {
56399
+ return e.replace(/jan/gi, "1").replace(/feb/gi, "2").replace(/mar/gi, "3").replace(/apr/gi, "4").replace(/may/gi, "5").replace(/jun/gi, "6").replace(/jul/gi, "7").replace(/aug/gi, "8").replace(/sep/gi, "9").replace(/oct/gi, "10").replace(/nov/gi, "11").replace(/dec/gi, "12");
56400
+ }
56401
+ handleNicknames(e) {
56402
+ let t = e.trim().toLowerCase();
56403
+ if (t === "@yearly" || t === "@annually") return "0 0 1 1 *";
56404
+ if (t === "@monthly") return "0 0 1 * *";
56405
+ if (t === "@weekly") return "0 0 * * 0";
56406
+ if (t === "@daily" || t === "@midnight") return "0 0 * * *";
56407
+ if (t === "@hourly") return "0 * * * *";
56408
+ if (t === "@reboot") throw new TypeError("CronPattern: @reboot is not supported in this environment. This is an event-based trigger that requires system startup detection.");
56409
+ return e;
56410
+ }
56411
+ setNthWeekdayOfMonth(e, t) {
56412
+ if (typeof t != "number" && t.toUpperCase() === "L") this.dayOfWeek[e] = this.dayOfWeek[e] | 32;
56413
+ else if (t === 63) this.dayOfWeek[e] = 63;
56414
+ else if (t < 6 && t > 0) this.dayOfWeek[e] = this.dayOfWeek[e] | O[t - 1];
56415
+ else throw new TypeError(`CronPattern: nth weekday out of range, should be 1-5 or L. Value: ${t}, Type: ${typeof t}`);
56416
+ }
56417
+ };
56418
+ var P = [
56419
+ 31,
56420
+ 28,
56421
+ 31,
56422
+ 30,
56423
+ 31,
56424
+ 30,
56425
+ 31,
56426
+ 31,
56427
+ 30,
56428
+ 31,
56429
+ 30,
56430
+ 31
56431
+ ];
56432
+ var f = [
56433
+ [
56434
+ "month",
56435
+ "year",
56436
+ 0
56437
+ ],
56438
+ [
56439
+ "day",
56440
+ "month",
56441
+ -1
56442
+ ],
56443
+ [
56444
+ "hour",
56445
+ "day",
56446
+ 0
56447
+ ],
56448
+ [
56449
+ "minute",
56450
+ "hour",
56451
+ 0
56452
+ ],
56453
+ [
56454
+ "second",
56455
+ "minute",
56456
+ 0
56457
+ ]
56458
+ ];
56459
+ var m = class s {
56460
+ tz;
56461
+ ms;
56462
+ second;
56463
+ minute;
56464
+ hour;
56465
+ day;
56466
+ month;
56467
+ year;
56468
+ constructor(e, t) {
56469
+ if (this.tz = t, e && e instanceof Date) if (!isNaN(e)) this.fromDate(e);
56470
+ else throw new TypeError("CronDate: Invalid date passed to CronDate constructor");
56471
+ else if (e == null) this.fromDate(/* @__PURE__ */ new Date());
56472
+ else if (e && typeof e == "string") this.fromString(e);
56473
+ else if (e instanceof s) this.fromCronDate(e);
56474
+ else throw new TypeError("CronDate: Invalid type (" + typeof e + ") passed to CronDate constructor");
56475
+ }
56476
+ getLastDayOfMonth(e, t) {
56477
+ return t !== 1 ? P[t] : new Date(Date.UTC(e, t + 1, 0)).getUTCDate();
56478
+ }
56479
+ getLastWeekday(e, t) {
56480
+ let r = this.getLastDayOfMonth(e, t), i = new Date(Date.UTC(e, t, r)).getUTCDay();
56481
+ return i === 0 ? r - 2 : i === 6 ? r - 1 : r;
56482
+ }
56483
+ getNearestWeekday(e, t, r) {
56484
+ let n = this.getLastDayOfMonth(e, t);
56485
+ if (r > n) return -1;
56486
+ let a = new Date(Date.UTC(e, t, r)).getUTCDay();
56487
+ return a === 0 ? r === n ? r - 2 : r + 1 : a === 6 ? r === 1 ? r + 2 : r - 1 : r;
56488
+ }
56489
+ isNthWeekdayOfMonth(e, t, r, n) {
56490
+ let a = new Date(Date.UTC(e, t, r)).getUTCDay(), o = 0;
56491
+ for (let h = 1; h <= r; h++) new Date(Date.UTC(e, t, h)).getUTCDay() === a && o++;
56492
+ if (n & 63 && O[o - 1] & n) return !0;
56493
+ if (n & 32) {
56494
+ let h = this.getLastDayOfMonth(e, t);
56495
+ for (let l = r + 1; l <= h; l++) if (new Date(Date.UTC(e, t, l)).getUTCDay() === a) return !1;
56496
+ return !0;
56497
+ }
56498
+ return !1;
56499
+ }
56500
+ fromDate(e) {
56501
+ if (this.tz !== void 0) if (typeof this.tz == "number") this.ms = e.getUTCMilliseconds(), this.second = e.getUTCSeconds(), this.minute = e.getUTCMinutes() + this.tz, this.hour = e.getUTCHours(), this.day = e.getUTCDate(), this.month = e.getUTCMonth(), this.year = e.getUTCFullYear(), this.apply();
56502
+ else try {
56503
+ let t = g(e, this.tz);
56504
+ this.ms = e.getMilliseconds(), this.second = t.s, this.minute = t.i, this.hour = t.h, this.day = t.d, this.month = t.m - 1, this.year = t.y;
56505
+ } catch (t) {
56506
+ let r = t instanceof Error ? t.message : String(t);
56507
+ throw new TypeError(`CronDate: Failed to convert date to timezone '${this.tz}'. This may happen with invalid timezone names or dates. Original error: ${r}`);
56508
+ }
56509
+ else this.ms = e.getMilliseconds(), this.second = e.getSeconds(), this.minute = e.getMinutes(), this.hour = e.getHours(), this.day = e.getDate(), this.month = e.getMonth(), this.year = e.getFullYear();
56510
+ }
56511
+ fromCronDate(e) {
56512
+ this.tz = e.tz, this.year = e.year, this.month = e.month, this.day = e.day, this.hour = e.hour, this.minute = e.minute, this.second = e.second, this.ms = e.ms;
56513
+ }
56514
+ apply() {
56515
+ if (this.month > 11 || this.month < 0 || this.day > P[this.month] || this.day < 1 || this.hour > 59 || this.minute > 59 || this.second > 59 || this.hour < 0 || this.minute < 0 || this.second < 0) {
56516
+ let e = new Date(Date.UTC(this.year, this.month, this.day, this.hour, this.minute, this.second, this.ms));
56517
+ return this.ms = e.getUTCMilliseconds(), this.second = e.getUTCSeconds(), this.minute = e.getUTCMinutes(), this.hour = e.getUTCHours(), this.day = e.getUTCDate(), this.month = e.getUTCMonth(), this.year = e.getUTCFullYear(), !0;
56518
+ } else return !1;
56519
+ }
56520
+ fromString(e) {
56521
+ if (typeof this.tz == "number") {
56522
+ let t = v(e);
56523
+ this.ms = t.getUTCMilliseconds(), this.second = t.getUTCSeconds(), this.minute = t.getUTCMinutes(), this.hour = t.getUTCHours(), this.day = t.getUTCDate(), this.month = t.getUTCMonth(), this.year = t.getUTCFullYear(), this.apply();
56524
+ } else return this.fromDate(v(e, this.tz));
56525
+ }
56526
+ findNext(e, t, r, n) {
56527
+ return this._findMatch(e, t, r, n, 1);
56528
+ }
56529
+ _findMatch(e, t, r, n, i) {
56530
+ let a = this[t], o;
56531
+ r.lastDayOfMonth && (o = this.getLastDayOfMonth(this.year, this.month));
56532
+ let h = !r.starDOW && t == "day" ? new Date(Date.UTC(this.year, this.month, 1, 0, 0, 0, 0)).getUTCDay() : void 0, l = this[t] + n, y = i === 1 ? (u) => u < r[t].length : (u) => u >= 0;
56533
+ for (let u = l; y(u); u += i) {
56534
+ let d = r[t][u];
56535
+ if (t === "day" && !d) {
56536
+ for (let c = 0; c < r.nearestWeekdays.length; c++) if (r.nearestWeekdays[c]) {
56537
+ let M = this.getNearestWeekday(this.year, this.month, c - n);
56538
+ if (M === -1) continue;
56539
+ if (M === u - n) {
56540
+ d = 1;
56541
+ break;
56542
+ }
56543
+ }
56544
+ }
56545
+ if (t === "day" && r.lastWeekday) {
56546
+ let c = this.getLastWeekday(this.year, this.month);
56547
+ u - n === c && (d = 1);
56548
+ }
56549
+ if (t === "day" && r.lastDayOfMonth && u - n == o && (d = 1), t === "day" && !r.starDOW) {
56550
+ let c = r.dayOfWeek[(h + (u - n - 1)) % 7];
56551
+ if (c && c & 63) c = this.isNthWeekdayOfMonth(this.year, this.month, u - n, c) ? 1 : 0;
56552
+ else if (c) throw new Error(`CronDate: Invalid value for dayOfWeek encountered. ${c}`);
56553
+ r.useAndLogic ? d = d && c : !e.domAndDow && !r.starDOM ? d = d || c : d = d && c;
56554
+ }
56555
+ if (d) return this[t] = u - n, a !== this[t] ? 2 : 1;
56556
+ }
56557
+ return 3;
56558
+ }
56559
+ recurse(e, t, r) {
56560
+ if (r === 0 && !e.starYear) {
56561
+ if (this.year >= 0 && this.year < e.year.length && e.year[this.year] === 0) {
56562
+ let i = -1;
56563
+ for (let a = this.year + 1; a < e.year.length && a < 1e4; a++) if (e.year[a] === 1) {
56564
+ i = a;
56565
+ break;
56566
+ }
56567
+ if (i === -1) return null;
56568
+ this.year = i, this.month = 0, this.day = 1, this.hour = 0, this.minute = 0, this.second = 0, this.ms = 0;
56569
+ }
56570
+ if (this.year >= 1e4) return null;
56571
+ }
56572
+ let n = this.findNext(t, f[r][0], e, f[r][2]);
56573
+ if (n > 1) {
56574
+ let i = r + 1;
56575
+ for (; i < f.length;) this[f[i][0]] = -f[i][2], i++;
56576
+ if (n === 3) {
56577
+ if (this[f[r][1]]++, this[f[r][0]] = -f[r][2], this.apply(), r === 0 && !e.starYear) {
56578
+ for (; this.year >= 0 && this.year < e.year.length && e.year[this.year] === 0 && this.year < 1e4;) this.year++;
56579
+ if (this.year >= 1e4 || this.year >= e.year.length) return null;
56580
+ }
56581
+ return this.recurse(e, t, 0);
56582
+ } else if (this.apply()) return this.recurse(e, t, r - 1);
56583
+ }
56584
+ return r += 1, r >= f.length ? this : (e.starYear ? this.year >= 3e3 : this.year >= 1e4) ? null : this.recurse(e, t, r);
56585
+ }
56586
+ increment(e, t, r) {
56587
+ return this.second += t.interval !== void 0 && t.interval > 1 && r ? t.interval : 1, this.ms = 0, this.apply(), this.recurse(e, t, 0);
56588
+ }
56589
+ decrement(e, t) {
56590
+ return this.second -= t.interval !== void 0 && t.interval > 1 ? t.interval : 1, this.ms = 0, this.apply(), this.recurseBackward(e, t, 0, 0);
56591
+ }
56592
+ recurseBackward(e, t, r, n = 0) {
56593
+ if (n > 1e4) return null;
56594
+ if (r === 0 && !e.starYear) {
56595
+ if (this.year >= 0 && this.year < e.year.length && e.year[this.year] === 0) {
56596
+ let a = -1;
56597
+ for (let o = this.year - 1; o >= 0; o--) if (e.year[o] === 1) {
56598
+ a = o;
56599
+ break;
56600
+ }
56601
+ if (a === -1) return null;
56602
+ this.year = a, this.month = 11, this.day = 31, this.hour = 23, this.minute = 59, this.second = 59, this.ms = 0;
56603
+ }
56604
+ if (this.year < 0) return null;
56605
+ }
56606
+ let i = this.findPrevious(t, f[r][0], e, f[r][2]);
56607
+ if (i > 1) {
56608
+ let a = r + 1;
56609
+ for (; a < f.length;) {
56610
+ let o = f[a][0], h = f[a][2], l = this.getMaxPatternValue(o, e, h);
56611
+ this[o] = l, a++;
56612
+ }
56613
+ if (i === 3) {
56614
+ if (this[f[r][1]]--, r === 0) {
56615
+ let y = this.getLastDayOfMonth(this.year, this.month);
56616
+ this.day > y && (this.day = y);
56617
+ }
56618
+ if (r === 1) if (this.day <= 0) this.day = 1;
56619
+ else {
56620
+ let y = this.year, u = this.month;
56621
+ for (; u < 0;) u += 12, y--;
56622
+ for (; u > 11;) u -= 12, y++;
56623
+ let d = u !== 1 ? P[u] : new Date(Date.UTC(y, u + 1, 0)).getUTCDate();
56624
+ this.day > d && (this.day = d);
56625
+ }
56626
+ this.apply();
56627
+ let o = f[r][0], h = f[r][2], l = this.getMaxPatternValue(o, e, h);
56628
+ if (o === "day") {
56629
+ let y = this.getLastDayOfMonth(this.year, this.month);
56630
+ this[o] = Math.min(l, y);
56631
+ } else this[o] = l;
56632
+ if (this.apply(), r === 0) {
56633
+ let y = f[1][2], u = this.getMaxPatternValue("day", e, y), d = this.getLastDayOfMonth(this.year, this.month), c = Math.min(u, d);
56634
+ c !== this.day && (this.day = c, this.hour = this.getMaxPatternValue("hour", e, f[2][2]), this.minute = this.getMaxPatternValue("minute", e, f[3][2]), this.second = this.getMaxPatternValue("second", e, f[4][2]));
56635
+ }
56636
+ if (r === 0 && !e.starYear) {
56637
+ for (; this.year >= 0 && this.year < e.year.length && e.year[this.year] === 0;) this.year--;
56638
+ if (this.year < 0) return null;
56639
+ }
56640
+ return this.recurseBackward(e, t, 0, n + 1);
56641
+ } else if (this.apply()) return this.recurseBackward(e, t, r - 1, n + 1);
56642
+ }
56643
+ return r += 1, r >= f.length ? this : this.year < 0 ? null : this.recurseBackward(e, t, r, n + 1);
56644
+ }
56645
+ getMaxPatternValue(e, t, r) {
56646
+ if (e === "day" && t.lastDayOfMonth) return this.getLastDayOfMonth(this.year, this.month);
56647
+ if (e === "day" && !t.starDOW) return this.getLastDayOfMonth(this.year, this.month);
56648
+ for (let n = t[e].length - 1; n >= 0; n--) if (t[e][n]) return n - r;
56649
+ return t[e].length - 1 - r;
56650
+ }
56651
+ findPrevious(e, t, r, n) {
56652
+ return this._findMatch(e, t, r, n, -1);
56653
+ }
56654
+ getDate(e) {
56655
+ return e || this.tz === void 0 ? new Date(this.year, this.month, this.day, this.hour, this.minute, this.second, this.ms) : typeof this.tz == "number" ? new Date(Date.UTC(this.year, this.month, this.day, this.hour, this.minute - this.tz, this.second, this.ms)) : k(b(this.year, this.month + 1, this.day, this.hour, this.minute, this.second, this.tz), !1);
56656
+ }
56657
+ getTime() {
56658
+ return this.getDate(!1).getTime();
56659
+ }
56660
+ match(e, t) {
56661
+ if (!e.starYear && (this.year < 0 || this.year >= e.year.length || e.year[this.year] === 0)) return !1;
56662
+ for (let r = 0; r < f.length; r++) {
56663
+ let n = f[r][0], i = f[r][2], a = this[n];
56664
+ if (a + i < 0 || a + i >= e[n].length) return !1;
56665
+ let o = e[n][a + i];
56666
+ if (n === "day") {
56667
+ if (!o) {
56668
+ for (let h = 0; h < e.nearestWeekdays.length; h++) if (e.nearestWeekdays[h]) {
56669
+ let l = this.getNearestWeekday(this.year, this.month, h - i);
56670
+ if (l !== -1 && l === a) {
56671
+ o = 1;
56672
+ break;
56673
+ }
56674
+ }
56675
+ }
56676
+ if (e.lastWeekday) a === this.getLastWeekday(this.year, this.month) && (o = 1);
56677
+ if (e.lastDayOfMonth) a === this.getLastDayOfMonth(this.year, this.month) && (o = 1);
56678
+ if (!e.starDOW) {
56679
+ let h = new Date(Date.UTC(this.year, this.month, 1, 0, 0, 0, 0)).getUTCDay(), l = e.dayOfWeek[(h + (a - 1)) % 7];
56680
+ l && l & 63 && (l = this.isNthWeekdayOfMonth(this.year, this.month, a, l) ? 1 : 0), e.useAndLogic ? o = o && l : !t.domAndDow && !e.starDOM ? o = o || l : o = o && l;
56681
+ }
56682
+ }
56683
+ if (!o) return !1;
56684
+ }
56685
+ return !0;
56686
+ }
56687
+ };
56688
+ function R(s) {
56689
+ if (s === void 0 && (s = {}), delete s.name, s.legacyMode !== void 0 && s.domAndDow === void 0 ? s.domAndDow = !s.legacyMode : s.domAndDow === void 0 && (s.domAndDow = !1), s.legacyMode = !s.domAndDow, s.paused = s.paused === void 0 ? !1 : s.paused, s.maxRuns = s.maxRuns === void 0 ? 1 / 0 : s.maxRuns, s.catch = s.catch === void 0 ? !1 : s.catch, s.interval = s.interval === void 0 ? 0 : parseInt(s.interval.toString(), 10), s.utcOffset = s.utcOffset === void 0 ? void 0 : parseInt(s.utcOffset.toString(), 10), s.dayOffset = s.dayOffset === void 0 ? 0 : parseInt(s.dayOffset.toString(), 10), s.unref = s.unref === void 0 ? !1 : s.unref, s.mode = s.mode === void 0 ? "auto" : s.mode, s.alternativeWeekdays = s.alternativeWeekdays === void 0 ? !1 : s.alternativeWeekdays, s.sloppyRanges = s.sloppyRanges === void 0 ? !1 : s.sloppyRanges, ![
56690
+ "auto",
56691
+ "5-part",
56692
+ "6-part",
56693
+ "7-part",
56694
+ "5-or-6-parts",
56695
+ "6-or-7-parts"
56696
+ ].includes(s.mode)) throw new Error("CronOptions: mode must be one of 'auto', '5-part', '6-part', '7-part', '5-or-6-parts', or '6-or-7-parts'.");
56697
+ if (s.startAt && (s.startAt = new m(s.startAt, s.timezone)), s.stopAt && (s.stopAt = new m(s.stopAt, s.timezone)), s.interval !== null) {
56698
+ if (isNaN(s.interval)) throw new Error("CronOptions: Supplied value for interval is not a number");
56699
+ if (s.interval < 0) throw new Error("CronOptions: Supplied value for interval can not be negative");
56700
+ }
56701
+ if (s.utcOffset !== void 0) {
56702
+ if (isNaN(s.utcOffset)) throw new Error("CronOptions: Invalid value passed for utcOffset, should be number representing minutes offset from UTC.");
56703
+ if (s.utcOffset < -870 || s.utcOffset > 870) throw new Error("CronOptions: utcOffset out of bounds.");
56704
+ if (s.utcOffset !== void 0 && s.timezone) throw new Error("CronOptions: Combining 'utcOffset' with 'timezone' is not allowed.");
56705
+ }
56706
+ if (s.unref !== !0 && s.unref !== !1) throw new Error("CronOptions: Unref should be either true, false or undefined(false).");
56707
+ if (s.dayOffset !== void 0 && s.dayOffset !== 0 && isNaN(s.dayOffset)) throw new Error("CronOptions: Invalid value passed for dayOffset, should be a number representing days to offset.");
56708
+ return s;
56709
+ }
56710
+ function p(s) {
56711
+ return Object.prototype.toString.call(s) === "[object Function]" || typeof s == "function" || s instanceof Function;
56712
+ }
56713
+ function _(s) {
56714
+ return p(s);
56715
+ }
56716
+ function x(s) {
56717
+ typeof Deno < "u" && typeof Deno.unrefTimer < "u" ? Deno.unrefTimer(s) : s && typeof s.unref < "u" && s.unref();
56718
+ }
56719
+ var W = 3e4;
56720
+ var w = [];
56721
+ var E = class {
56722
+ name;
56723
+ options;
56724
+ _states;
56725
+ fn;
56726
+ getTz() {
56727
+ return this.options.timezone || this.options.utcOffset;
56728
+ }
56729
+ applyDayOffset(e) {
56730
+ if (this.options.dayOffset !== void 0 && this.options.dayOffset !== 0) {
56731
+ let t = this.options.dayOffset * 24 * 60 * 60 * 1e3;
56732
+ return new Date(e.getTime() + t);
56733
+ }
56734
+ return e;
56735
+ }
56736
+ constructor(e, t, r) {
56737
+ let n, i;
56738
+ if (p(t)) i = t;
56739
+ else if (typeof t == "object") n = t;
56740
+ else if (t !== void 0) throw new Error("Cron: Invalid argument passed for optionsIn. Should be one of function, or object (options).");
56741
+ if (p(r)) i = r;
56742
+ else if (typeof r == "object") n = r;
56743
+ else if (r !== void 0) throw new Error("Cron: Invalid argument passed for funcIn. Should be one of function, or object (options).");
56744
+ if (this.name = n?.name, this.options = R(n), this._states = {
56745
+ kill: !1,
56746
+ blocking: !1,
56747
+ previousRun: void 0,
56748
+ currentRun: void 0,
56749
+ once: void 0,
56750
+ currentTimeout: void 0,
56751
+ maxRuns: n ? n.maxRuns : void 0,
56752
+ paused: n ? n.paused : !1,
56753
+ pattern: new C("* * * * *", void 0, { mode: "auto" })
56754
+ }, e && (e instanceof Date || typeof e == "string" && e.indexOf(":") > 0) ? this._states.once = new m(e, this.getTz()) : this._states.pattern = new C(e, this.options.timezone, {
56755
+ mode: this.options.mode,
56756
+ alternativeWeekdays: this.options.alternativeWeekdays,
56757
+ sloppyRanges: this.options.sloppyRanges
56758
+ }), this.name) {
56759
+ if (w.find((o) => o.name === this.name)) throw new Error("Cron: Tried to initialize new named job '" + this.name + "', but name already taken.");
56760
+ w.push(this);
56761
+ }
56762
+ return i !== void 0 && _(i) && (this.fn = i, this.schedule()), this;
56763
+ }
56764
+ nextRun(e) {
56765
+ let t = this._next(e);
56766
+ return t ? this.applyDayOffset(t.getDate(!1)) : null;
56767
+ }
56768
+ nextRuns(e, t) {
56769
+ this._states.maxRuns !== void 0 && e > this._states.maxRuns && (e = this._states.maxRuns);
56770
+ let r = t || this._states.currentRun || void 0;
56771
+ return this._enumerateRuns(e, r, "next");
56772
+ }
56773
+ previousRuns(e, t) {
56774
+ return this._enumerateRuns(e, t || void 0, "previous");
56775
+ }
56776
+ _enumerateRuns(e, t, r) {
56777
+ let n = [], i = t ? new m(t, this.getTz()) : null, a = r === "next" ? this._next : this._previous;
56778
+ for (; e--;) {
56779
+ let o = a.call(this, i);
56780
+ if (!o) break;
56781
+ let h = o.getDate(!1);
56782
+ n.push(this.applyDayOffset(h)), i = o;
56783
+ }
56784
+ return n;
56785
+ }
56786
+ match(e) {
56787
+ if (this._states.once) {
56788
+ let r = new m(e, this.getTz());
56789
+ r.ms = 0;
56790
+ let n = new m(this._states.once, this.getTz());
56791
+ return n.ms = 0, r.getTime() === n.getTime();
56792
+ }
56793
+ let t = new m(e, this.getTz());
56794
+ return t.ms = 0, t.match(this._states.pattern, this.options);
56795
+ }
56796
+ getPattern() {
56797
+ if (!this._states.once) return this._states.pattern ? this._states.pattern.pattern : void 0;
56798
+ }
56799
+ getOnce() {
56800
+ return this._states.once ? this._states.once.getDate() : null;
56801
+ }
56802
+ isRunning() {
56803
+ let e = this.nextRun(this._states.currentRun), t = !this._states.paused, r = this.fn !== void 0, n = !this._states.kill;
56804
+ return t && r && n && e !== null;
56805
+ }
56806
+ isStopped() {
56807
+ return this._states.kill;
56808
+ }
56809
+ isBusy() {
56810
+ return this._states.blocking;
56811
+ }
56812
+ currentRun() {
56813
+ return this._states.currentRun ? this._states.currentRun.getDate() : null;
56814
+ }
56815
+ previousRun() {
56816
+ return this._states.previousRun ? this._states.previousRun.getDate() : null;
56817
+ }
56818
+ msToNext(e) {
56819
+ let t = this._next(e);
56820
+ return t ? e instanceof m || e instanceof Date ? t.getTime() - e.getTime() : t.getTime() - new m(e).getTime() : null;
56821
+ }
56822
+ stop() {
56823
+ this._states.kill = !0, this._states.currentTimeout && clearTimeout(this._states.currentTimeout);
56824
+ let e = w.indexOf(this);
56825
+ e >= 0 && w.splice(e, 1);
56826
+ }
56827
+ pause() {
56828
+ return this._states.paused = !0, !this._states.kill;
56829
+ }
56830
+ resume() {
56831
+ return this._states.paused = !1, !this._states.kill;
56832
+ }
56833
+ schedule(e) {
56834
+ if (e && this.fn) throw new Error("Cron: It is not allowed to schedule two functions using the same Croner instance.");
56835
+ e && (this.fn = e);
56836
+ let t = this.msToNext(), r = this.nextRun(this._states.currentRun);
56837
+ return t == null || isNaN(t) || r === null ? this : (t > W && (t = W), this._states.currentTimeout = setTimeout(() => this._checkTrigger(r), t), this._states.currentTimeout && this.options.unref && x(this._states.currentTimeout), this);
56838
+ }
56839
+ async _trigger(e) {
56840
+ this._states.blocking = !0, this._states.currentRun = new m(void 0, this.getTz());
56841
+ try {
56842
+ if (this.options.catch) try {
56843
+ this.fn !== void 0 && await this.fn(this, this.options.context);
56844
+ } catch (t) {
56845
+ if (p(this.options.catch)) try {
56846
+ this.options.catch(t, this);
56847
+ } catch {}
56848
+ }
56849
+ else this.fn !== void 0 && await this.fn(this, this.options.context);
56850
+ } finally {
56851
+ this._states.previousRun = new m(e, this.getTz()), this._states.blocking = !1;
56852
+ }
56853
+ }
56854
+ async trigger() {
56855
+ await this._trigger();
56856
+ }
56857
+ runsLeft() {
56858
+ return this._states.maxRuns;
56859
+ }
56860
+ _checkTrigger(e) {
56861
+ let t = /* @__PURE__ */ new Date(), r = !this._states.paused && t.getTime() >= e.getTime(), n = this._states.blocking && this.options.protect;
56862
+ r && !n ? (this._states.maxRuns !== void 0 && this._states.maxRuns--, this._trigger()) : r && n && p(this.options.protect) && setTimeout(() => this.options.protect(this), 0), this.schedule();
56863
+ }
56864
+ _next(e) {
56865
+ let t = !!(e || this._states.currentRun), r = !1;
56866
+ !e && this.options.startAt && this.options.interval && ([e, t] = this._calculatePreviousRun(e, t), r = !e), e = new m(e, this.getTz()), this.options.startAt && e && e.getTime() < this.options.startAt.getTime() && (e = this.options.startAt);
56867
+ let n = this._states.once || new m(e, this.getTz());
56868
+ return !r && n !== this._states.once && (n = n.increment(this._states.pattern, this.options, t)), this._states.once && this._states.once.getTime() <= e.getTime() || n === null || this._states.maxRuns !== void 0 && this._states.maxRuns <= 0 || this._states.kill || this.options.stopAt && n.getTime() >= this.options.stopAt.getTime() ? null : n;
56869
+ }
56870
+ _previous(e) {
56871
+ let t = new m(e, this.getTz());
56872
+ this.options.stopAt && t.getTime() > this.options.stopAt.getTime() && (t = this.options.stopAt);
56873
+ let r = new m(t, this.getTz());
56874
+ return this._states.once ? this._states.once.getTime() < t.getTime() ? this._states.once : null : (r = r.decrement(this._states.pattern, this.options), r === null || this.options.startAt && r.getTime() < this.options.startAt.getTime() ? null : r);
56875
+ }
56876
+ _calculatePreviousRun(e, t) {
56877
+ let r = new m(void 0, this.getTz()), n = e;
56878
+ if (this.options.startAt.getTime() <= r.getTime()) {
56879
+ n = this.options.startAt;
56880
+ let i = n.getTime() + this.options.interval * 1e3;
56881
+ for (; i <= r.getTime();) n = new m(n, this.getTz()).increment(this._states.pattern, this.options, !0), i = n.getTime() + this.options.interval * 1e3;
56882
+ t = !0;
56883
+ }
56884
+ return n === null && (n = void 0), [n, t];
56885
+ }
56886
+ };
56887
+ //#endregion
56888
+ //#region src/client/schedule/TaskForm.tsx
56889
+ /** 定时任务创建/编辑表单:名称/提示词/项目下拉/目标 radio/调度三选一(cron 预览经内联 croner 计算)/catchup/enabled。 */
56890
+ /** cron 未来 3 次触发预览(内联 croner;非法表达式返回空数组)。 */
56891
+ function previewCron(expr, timeZone) {
56892
+ if (expr.trim().split(/\s+/).length !== 5) return [];
56893
+ try {
56894
+ return new E(expr, {
56895
+ paused: true,
56896
+ ...timeZone !== "" ? { timezone: timeZone } : {}
56897
+ }).nextRuns(3).map((d) => d.getTime());
56898
+ } catch {
56899
+ return [];
56900
+ }
56901
+ }
56902
+ function TaskForm({ draft, t, onSaved, onCancel }) {
56903
+ const [name, setName] = (0, react.useState)(draft?.name ?? "");
56904
+ const [prompt, setPrompt] = (0, react.useState)(draft?.prompt ?? "");
56905
+ const [cwd, setCwd] = (0, react.useState)(draft?.cwd ?? "");
56906
+ const [targetKind, setTargetKind] = (0, react.useState)(draft?.target.kind ?? "main");
56907
+ const [roleId, setRoleId] = (0, react.useState)(draft?.target.kind === "role" ? draft.target.roleId : "");
56908
+ const [scheduleKind, setScheduleKind] = (0, react.useState)(draft?.schedule.kind ?? "cron");
56909
+ const [cronExpr, setCronExpr] = (0, react.useState)(draft?.schedule.kind === "cron" ? draft.schedule.expr : "0 9 * * *");
56910
+ const [timeZone, setTimeZone] = (0, react.useState)(draft?.schedule.kind === "cron" ? draft.schedule.timeZone ?? "" : "");
56911
+ const [atTime, setAtTime] = (0, react.useState)(draft?.schedule.kind === "at" ? draft.schedule.at.slice(0, 16) : "");
56912
+ const [everySeconds, setEverySeconds] = (0, react.useState)(draft?.schedule.kind === "every" ? String(draft.schedule.seconds) : "3600");
56913
+ const [catchup, setCatchup] = (0, react.useState)(draft?.catchup ?? true);
56914
+ const [enabled, setEnabled] = (0, react.useState)(draft?.enabled ?? true);
56915
+ const [error, setError] = (0, react.useState)(null);
56916
+ const { state: projectsState } = useLoadState$1(() => fetchProjects(), []);
56917
+ const { state: agentsState } = useLoadState$1(() => fetchAgents(), []);
56918
+ const projects = projectsState.kind === "ok" ? projectsState.data : [];
56919
+ const roles = (agentsState.kind === "ok" ? agentsState.data : []).filter((a) => a.id !== "main");
56920
+ (0, react.useEffect)(() => {
56921
+ if (cwd === "" && projects.length > 0) setCwd(projects[0]);
56922
+ }, [projects, cwd]);
56923
+ const preview = (0, react.useMemo)(() => scheduleKind === "cron" ? previewCron(cronExpr, timeZone) : [], [
56924
+ scheduleKind,
56925
+ cronExpr,
56926
+ timeZone
56927
+ ]);
56928
+ function buildInput() {
56929
+ const schedule = scheduleKind === "cron" ? {
56930
+ kind: "cron",
56931
+ expr: cronExpr,
56932
+ ...timeZone !== "" ? { timeZone } : {}
56933
+ } : scheduleKind === "at" ? {
56934
+ kind: "at",
56935
+ at: new Date(atTime).toISOString()
56936
+ } : {
56937
+ kind: "every",
56938
+ seconds: Number(everySeconds)
56939
+ };
56940
+ return {
56941
+ name,
56942
+ prompt,
56943
+ cwd,
56944
+ schedule,
56945
+ target: targetKind === "role" ? {
56946
+ kind: "role",
56947
+ roleId
56948
+ } : { kind: "main" },
56949
+ catchup,
56950
+ enabled
56951
+ };
56952
+ }
56953
+ async function save() {
56954
+ setError(null);
56955
+ try {
56956
+ const input = buildInput();
56957
+ if (draft === void 0) await createTask(input);
56958
+ else await updateTask(draft.id, input);
56959
+ onSaved();
56960
+ } catch (e) {
56961
+ setError(t("form.saveFailed", { message: e instanceof Error ? e.message : String(e) }));
56962
+ }
56963
+ }
56964
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
56965
+ onSubmit: (e) => {
56966
+ e.preventDefault();
56967
+ save();
56968
+ },
56969
+ children: [
56970
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
56971
+ className: schedule_module_css_default.field,
56972
+ children: [t("form.name"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Input, {
56973
+ value: name,
56974
+ onChange: (e) => {
56975
+ setName(e.target.value);
56976
+ },
56977
+ required: true,
56978
+ "aria-label": t("form.name"),
56979
+ className: schedule_module_css_default.input
56980
+ })]
56981
+ }),
56982
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
56983
+ className: schedule_module_css_default.field,
56984
+ children: [t("form.prompt"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
56985
+ value: prompt,
56986
+ onChange: (e) => {
56987
+ setPrompt(e.target.value);
56988
+ },
56989
+ rows: 5,
56990
+ required: true,
56991
+ className: schedule_module_css_default.textarea
56992
+ })]
56993
+ }),
56994
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
56995
+ className: schedule_module_css_default.field,
56996
+ children: [t("form.project"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("select", {
56997
+ value: cwd,
56998
+ onChange: (e) => {
56999
+ setCwd(e.target.value);
57000
+ },
57001
+ className: schedule_module_css_default.select,
57002
+ children: projects.map((p) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
57003
+ value: p,
57004
+ children: p
57005
+ }, p))
57006
+ })]
57007
+ }),
57008
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("fieldset", {
57009
+ className: clsx(schedule_module_css_default.field, schedule_module_css_default.radioGroup),
57010
+ children: [
57011
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("legend", { children: t("form.target") }),
57012
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
57013
+ className: schedule_module_css_default.option,
57014
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
57015
+ type: "radio",
57016
+ className: schedule_module_css_default.radio,
57017
+ name: "target",
57018
+ checked: targetKind === "main",
57019
+ onChange: () => {
57020
+ setTargetKind("main");
57021
+ }
57022
+ }), t("form.targetMain")]
57023
+ }),
57024
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
57025
+ className: schedule_module_css_default.option,
57026
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
57027
+ type: "radio",
57028
+ className: schedule_module_css_default.radio,
57029
+ name: "target",
57030
+ checked: targetKind === "role",
57031
+ onChange: () => {
57032
+ setTargetKind("role");
57033
+ }
57034
+ }), t("form.targetRole")]
57035
+ }),
57036
+ targetKind === "role" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("select", {
57037
+ "aria-label": t("form.targetRole"),
57038
+ className: schedule_module_css_default.select,
57039
+ value: roleId,
57040
+ onChange: (e) => {
57041
+ setRoleId(e.target.value);
57042
+ },
57043
+ children: roles.map((r) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
57044
+ value: r.id,
57045
+ children: r.name
57046
+ }, r.id))
57047
+ })
57048
+ ]
57049
+ }),
57050
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("fieldset", {
57051
+ className: clsx(schedule_module_css_default.field, schedule_module_css_default.radioGroup),
57052
+ children: [
57053
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("legend", { children: t("form.schedule") }),
57054
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
57055
+ className: schedule_module_css_default.option,
57056
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
57057
+ type: "radio",
57058
+ className: schedule_module_css_default.radio,
57059
+ name: "schedule",
57060
+ checked: scheduleKind === "cron",
57061
+ onChange: () => {
57062
+ setScheduleKind("cron");
57063
+ }
57064
+ }), t("form.scheduleCron")]
57065
+ }),
57066
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
57067
+ className: schedule_module_css_default.option,
57068
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
57069
+ type: "radio",
57070
+ className: schedule_module_css_default.radio,
57071
+ name: "schedule",
57072
+ checked: scheduleKind === "at",
57073
+ onChange: () => {
57074
+ setScheduleKind("at");
57075
+ }
57076
+ }), t("form.scheduleAt")]
57077
+ }),
57078
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
57079
+ className: schedule_module_css_default.option,
57080
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
57081
+ type: "radio",
57082
+ className: schedule_module_css_default.radio,
57083
+ name: "schedule",
57084
+ checked: scheduleKind === "every",
57085
+ onChange: () => {
57086
+ setScheduleKind("every");
57087
+ }
57088
+ }), t("form.scheduleEvery")]
57089
+ }),
57090
+ scheduleKind === "cron" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
57091
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
57092
+ className: schedule_module_css_default.field,
57093
+ children: [t("form.cronExpr"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Input, {
57094
+ value: cronExpr,
57095
+ onChange: (e) => {
57096
+ setCronExpr(e.target.value);
57097
+ },
57098
+ className: schedule_module_css_default.input
57099
+ })]
57100
+ }),
57101
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
57102
+ className: schedule_module_css_default.field,
57103
+ children: [t("form.timeZone"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Input, {
57104
+ value: timeZone,
57105
+ onChange: (e) => {
57106
+ setTimeZone(e.target.value);
57107
+ },
57108
+ placeholder: "Asia/Shanghai",
57109
+ className: schedule_module_css_default.input
57110
+ })]
57111
+ }),
57112
+ preview.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
57113
+ "data-testid": "cron-preview",
57114
+ children: [t("form.preview"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", { children: preview.map((ms) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", { children: new Date(ms).toLocaleString() }, ms)) })]
57115
+ })
57116
+ ] }),
57117
+ scheduleKind === "at" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
57118
+ className: schedule_module_css_default.field,
57119
+ children: [t("form.atTime"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Input, {
57120
+ type: "datetime-local",
57121
+ value: atTime,
57122
+ onChange: (e) => {
57123
+ setAtTime(e.target.value);
57124
+ },
57125
+ className: schedule_module_css_default.input
57126
+ })]
57127
+ }),
57128
+ scheduleKind === "every" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
57129
+ className: schedule_module_css_default.field,
57130
+ children: [t("form.everySeconds"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Input, {
57131
+ type: "number",
57132
+ min: 60,
57133
+ value: everySeconds,
57134
+ onChange: (e) => {
57135
+ setEverySeconds(e.target.value);
57136
+ },
57137
+ className: schedule_module_css_default.input
57138
+ })]
57139
+ })
57140
+ ]
57141
+ }),
57142
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
57143
+ className: schedule_module_css_default.option,
57144
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
57145
+ type: "checkbox",
57146
+ className: schedule_module_css_default.checkbox,
57147
+ checked: catchup,
57148
+ onChange: (e) => {
57149
+ setCatchup(e.target.checked);
57150
+ }
57151
+ }), t("form.catchup")]
57152
+ }),
57153
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
57154
+ className: schedule_module_css_default.option,
57155
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
57156
+ type: "checkbox",
57157
+ className: schedule_module_css_default.checkbox,
57158
+ checked: enabled,
57159
+ onChange: (e) => {
57160
+ setEnabled(e.target.checked);
57161
+ }
57162
+ }), t("form.enabled")]
57163
+ }),
57164
+ error !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
57165
+ role: "alert",
57166
+ className: schedule_module_css_default.error,
57167
+ children: error
57168
+ }),
57169
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
57170
+ className: schedule_module_css_default.formActions,
57171
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
57172
+ variant: "outline",
57173
+ type: "button",
57174
+ onClick: onCancel,
57175
+ children: t("form.cancel")
57176
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
57177
+ variant: "primary",
57178
+ type: "submit",
57179
+ children: t("form.save")
57180
+ })]
57181
+ })
57182
+ ]
57183
+ });
57184
+ }
57185
+ //#endregion
57186
+ //#region src/client/schedule/locales.ts
57187
+ /** schedule 浏览器半文案:zh 为真源,en 键集严格一致。 */
57188
+ const NS = "agent-schedule";
57189
+ const zh = {
57190
+ "modal.title": "定时任务",
57191
+ "modal.close": "关闭",
57192
+ "list.loading": "加载中…",
57193
+ "list.error": "加载失败,请重试",
57194
+ "list.empty": "还没有定时任务,点击「新建任务」开始。",
57195
+ "list.create": "新建任务",
57196
+ "list.edit": "编辑",
57197
+ "list.delete": "删除",
57198
+ "list.confirmDelete": "确认删除?",
57199
+ "list.deleteFailed": "删除失败:{message}",
57200
+ "list.trigger": "立即触发",
57201
+ "list.triggerFailed": "触发失败:{message}",
57202
+ "list.targetMain": "主 Agent",
57203
+ "list.targetRole": "角色 {roleId}",
57204
+ "list.nextRun": "下次触发 {time}",
57205
+ "list.noNextRun": "已停用",
57206
+ "list.history": "运行历史",
57207
+ "list.historyEmpty": "暂无运行记录",
57208
+ "run.ok": "成功",
57209
+ "run.error": "失败",
57210
+ "run.running": "运行中",
57211
+ "run.skipped-overlap": "跳过(上次未结束)",
57212
+ "run.openSession": "查看会话",
57213
+ "form.name": "名称",
57214
+ "form.prompt": "提示词",
57215
+ "form.project": "项目",
57216
+ "form.target": "目标",
57217
+ "form.targetMain": "主 Agent",
57218
+ "form.targetRole": "角色",
57219
+ "form.schedule": "调度",
57220
+ "form.scheduleCron": "cron 表达式",
57221
+ "form.scheduleAt": "一次性时间",
57222
+ "form.scheduleEvery": "固定间隔",
57223
+ "form.cronExpr": "表达式(分 时 日 月 周)",
57224
+ "form.timeZone": "时区(可选,IANA)",
57225
+ "form.atTime": "触发时间",
57226
+ "form.everySeconds": "间隔秒数(≥60)",
57227
+ "form.preview": "未来 3 次触发",
57228
+ "form.catchup": "停机补跑(重启后补跑一次漏掉的触发)",
57229
+ "form.enabled": "启用",
57230
+ "form.save": "保存",
57231
+ "form.cancel": "取消",
57232
+ "form.saveFailed": "保存失败:{message}"
57233
+ };
57234
+ const en = {
57235
+ "modal.title": "Scheduled tasks",
57236
+ "modal.close": "Close",
57237
+ "list.loading": "Loading…",
57238
+ "list.error": "Failed to load, please retry",
57239
+ "list.empty": "No scheduled tasks yet. Click \"New task\" to start.",
57240
+ "list.create": "New task",
57241
+ "list.edit": "Edit",
57242
+ "list.delete": "Delete",
57243
+ "list.confirmDelete": "Confirm delete?",
57244
+ "list.deleteFailed": "Delete failed: {message}",
57245
+ "list.trigger": "Run now",
57246
+ "list.triggerFailed": "Trigger failed: {message}",
57247
+ "list.targetMain": "Main agent",
57248
+ "list.targetRole": "Role {roleId}",
57249
+ "list.nextRun": "Next run {time}",
57250
+ "list.noNextRun": "Disabled",
57251
+ "list.history": "Run history",
57252
+ "list.historyEmpty": "No runs yet",
57253
+ "run.ok": "OK",
57254
+ "run.error": "Error",
57255
+ "run.running": "Running",
57256
+ "run.skipped-overlap": "Skipped (overlap)",
57257
+ "run.openSession": "Open session",
57258
+ "form.name": "Name",
57259
+ "form.prompt": "Prompt",
57260
+ "form.project": "Project",
57261
+ "form.target": "Target",
57262
+ "form.targetMain": "Main agent",
57263
+ "form.targetRole": "Role",
57264
+ "form.schedule": "Schedule",
57265
+ "form.scheduleCron": "Cron expression",
57266
+ "form.scheduleAt": "One-shot time",
57267
+ "form.scheduleEvery": "Fixed interval",
57268
+ "form.cronExpr": "Expression (minute hour day month weekday)",
57269
+ "form.timeZone": "Time zone (optional, IANA)",
57270
+ "form.atTime": "Run at",
57271
+ "form.everySeconds": "Interval seconds (>= 60)",
57272
+ "form.preview": "Next 3 runs",
57273
+ "form.catchup": "Catch up missed runs after restart",
57274
+ "form.enabled": "Enabled",
57275
+ "form.save": "Save",
57276
+ "form.cancel": "Cancel",
57277
+ "form.saveFailed": "Save failed: {message}"
57278
+ };
57279
+ //#endregion
57280
+ //#region src/client/schedule/index.ts
57281
+ function setupScheduleClient(ctx) {
57282
+ ctx.effect(() => ctx.locale.register(NS, {
57283
+ zh,
57284
+ en
57285
+ }), "dsh-agent-toolkit: schedule dictionaries");
57286
+ const sessions = ctx.sessions;
57287
+ const openSession = (sessionId) => {
57288
+ sessions.open(sessionId);
57289
+ };
57290
+ ctx.slots.inject("sidebar.footer.action", () => ctx.slots.register({
57291
+ name: "sidebar.footer.action",
57292
+ id: "dsh-agent-toolkit:schedule",
57293
+ order: 2,
57294
+ locale: NS
57295
+ }, (props) => ScheduleEntry({
57296
+ ...props,
57297
+ openSession,
57298
+ renderForm: (draft, onSaved, onCancel) => (0, react.createElement)(TaskForm, {
57299
+ draft,
57300
+ t: props.t,
57301
+ onSaved,
57302
+ onCancel
57303
+ })
57304
+ })));
57305
+ }
57306
+ //#endregion
55794
57307
  //#region src/client/index.ts
55795
57308
  const inject = [
55796
57309
  "sessions",
@@ -55808,6 +57321,7 @@ ${te.current.stack}
55808
57321
  console.warn("[dsh-agent-toolkit] 侧边栏「Token 用量」入口已由独立包 @dsh-agent-toolkit/token-usage 注册,本包停用用量面板", error);
55809
57322
  }
55810
57323
  setupBotsClient(ctx);
57324
+ setupScheduleClient(ctx);
55811
57325
  }
55812
57326
  //#endregion
55813
57327
  exports.apply = apply;