dsh-agent-toolkit 0.2.8 → 0.3.0
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/README.md +1 -1
- package/lib/client.js +1693 -212
- package/lib/client.js.map +1 -1
- package/lib/index.d.ts +17 -2
- package/lib/index.js +1969 -291
- package/lib/index.js.map +1 -1
- package/package.json +13 -4
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$
|
|
61
|
-
const tagId$
|
|
62
|
-
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$
|
|
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$
|
|
66
|
-
tag.textContent = css$
|
|
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
70
|
"root": "_8wQUq_root",
|
|
71
|
-
"prompt": "_8wQUq_prompt",
|
|
72
|
-
"summary": "_8wQUq_summary",
|
|
73
|
-
"childLink": "_8wQUq_childLink",
|
|
74
71
|
"row": "_8wQUq_row",
|
|
75
|
-
"body": "_8wQUq_body",
|
|
76
|
-
"chip": "_8wQUq_chip",
|
|
77
72
|
"result": "_8wQUq_result",
|
|
78
|
-
"
|
|
73
|
+
"childLink": "_8wQUq_childLink",
|
|
74
|
+
"chip": "_8wQUq_chip",
|
|
75
|
+
"prompt": "_8wQUq_prompt",
|
|
76
|
+
"visuallyHidden": "_8wQUq_visuallyHidden",
|
|
77
|
+
"summary": "_8wQUq_summary",
|
|
78
|
+
"body": "_8wQUq_body"
|
|
79
79
|
};
|
|
80
80
|
//#endregion
|
|
81
81
|
//#region src/client/delegate/delegate-card.tsx
|
|
@@ -103,6 +103,13 @@ window.__ModuleLoader__.load({
|
|
|
103
103
|
const [expanded, setExpanded] = (0, react.useState)(false);
|
|
104
104
|
const role = args.role;
|
|
105
105
|
const [activeRoute, setActiveRoute] = (0, react.useState)(null);
|
|
106
|
+
const markdownLabels = (0, react.useMemo)(() => ({
|
|
107
|
+
code: {
|
|
108
|
+
copyLabel: t("card.copy"),
|
|
109
|
+
copiedLabel: t("card.copied")
|
|
110
|
+
},
|
|
111
|
+
footnotes: t("card.footnotes")
|
|
112
|
+
}), [t]);
|
|
106
113
|
(0, react.useEffect)(() => {
|
|
107
114
|
if (settled || role === void 0) return;
|
|
108
115
|
let cancelled = false;
|
|
@@ -178,7 +185,10 @@ window.__ModuleLoader__.load({
|
|
|
178
185
|
}),
|
|
179
186
|
settled && resultText(block) !== "" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
180
187
|
className: delegate_card_module_css_default.result,
|
|
181
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.MarkdownText, {
|
|
188
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.MarkdownText, {
|
|
189
|
+
text: resultText(block),
|
|
190
|
+
labels: markdownLabels
|
|
191
|
+
})
|
|
182
192
|
}),
|
|
183
193
|
settled && !isError && meta?.childSessionId !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
184
194
|
type: "button",
|
|
@@ -200,19 +210,25 @@ window.__ModuleLoader__.load({
|
|
|
200
210
|
//#endregion
|
|
201
211
|
//#region src/client/delegate/locales.ts
|
|
202
212
|
/** agent-team 浏览器半文案:zh 为真源,en 键集严格一致。 */
|
|
203
|
-
const NS = "agent-team";
|
|
204
|
-
const zh = {
|
|
213
|
+
const NS$1 = "agent-team";
|
|
214
|
+
const zh$1 = {
|
|
205
215
|
"card.viewChild": "查看子对话",
|
|
206
216
|
"card.running": "成员执行中",
|
|
207
217
|
"card.failed": "委派失败",
|
|
208
218
|
"card.modelAria": "子 Agent 使用模型 {route}",
|
|
219
|
+
"card.copy": "复制",
|
|
220
|
+
"card.copied": "已复制",
|
|
221
|
+
"card.footnotes": "脚注",
|
|
209
222
|
"header.modelAria": "子会话模型 {route}"
|
|
210
223
|
};
|
|
211
|
-
const en = {
|
|
224
|
+
const en$1 = {
|
|
212
225
|
"card.viewChild": "View sub-conversation",
|
|
213
226
|
"card.running": "Member running",
|
|
214
227
|
"card.failed": "Delegation failed",
|
|
215
228
|
"card.modelAria": "Subagent runs on {route}",
|
|
229
|
+
"card.copy": "Copy",
|
|
230
|
+
"card.copied": "Copied",
|
|
231
|
+
"card.footnotes": "Footnotes",
|
|
216
232
|
"header.modelAria": "Subagent session model {route}"
|
|
217
233
|
};
|
|
218
234
|
//#endregion
|
|
@@ -222,9 +238,9 @@ window.__ModuleLoader__.load({
|
|
|
222
238
|
* 改名后卡片不生效(落 generic 兜底)。
|
|
223
239
|
*/
|
|
224
240
|
function setupDelegateClient(ctx) {
|
|
225
|
-
ctx.effect(() => ctx.locale.register(NS, {
|
|
226
|
-
zh,
|
|
227
|
-
en
|
|
241
|
+
ctx.effect(() => ctx.locale.register(NS$1, {
|
|
242
|
+
zh: zh$1,
|
|
243
|
+
en: en$1
|
|
228
244
|
}), "dsh-agent-toolkit: dictionaries");
|
|
229
245
|
const sessions = ctx.sessions;
|
|
230
246
|
const injected = { openChild(address) {
|
|
@@ -233,19 +249,19 @@ window.__ModuleLoader__.load({
|
|
|
233
249
|
ctx.slots.inject("tool.call.toolview", () => ctx.slots.register({
|
|
234
250
|
name: "tool.call.toolview",
|
|
235
251
|
key: "team_delegate",
|
|
236
|
-
locale: NS,
|
|
252
|
+
locale: NS$1,
|
|
237
253
|
inject: () => injected
|
|
238
254
|
}, DelegateCard));
|
|
239
255
|
}
|
|
240
256
|
//#endregion
|
|
241
257
|
//#region \0dsh-css:D:\work\github\dsh\dsh-agent-toolkit\packages\toolkit\src\client\subagent-model\subagent-model.module.css.mjs
|
|
242
|
-
const css$
|
|
243
|
-
const tagId$
|
|
244
|
-
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$
|
|
258
|
+
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}";
|
|
259
|
+
const tagId$9 = "dsh-agent-toolkit/subagent-model.module.css-258be5cf";
|
|
260
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$9) + "]") === null) {
|
|
245
261
|
const tag = document.createElement("style");
|
|
246
262
|
tag.dataset.plugin = "dsh-agent-toolkit";
|
|
247
|
-
tag.dataset.pluginCss = tagId$
|
|
248
|
-
tag.textContent = css$
|
|
263
|
+
tag.dataset.pluginCss = tagId$9;
|
|
264
|
+
tag.textContent = css$9;
|
|
249
265
|
document.head.appendChild(tag);
|
|
250
266
|
}
|
|
251
267
|
var subagent_model_module_css_default = { "chip": "LlymwG_chip" };
|
|
@@ -281,7 +297,7 @@ window.__ModuleLoader__.load({
|
|
|
281
297
|
name: "conversation.session.header.utilities",
|
|
282
298
|
id: "subagent-model",
|
|
283
299
|
order: 10,
|
|
284
|
-
locale: NS
|
|
300
|
+
locale: NS$1
|
|
285
301
|
}, SubagentModelChip));
|
|
286
302
|
}
|
|
287
303
|
//#endregion
|
|
@@ -301,18 +317,18 @@ window.__ModuleLoader__.load({
|
|
|
301
317
|
}
|
|
302
318
|
//#endregion
|
|
303
319
|
//#region \0dsh-css:D:\work\github\dsh\dsh-agent-toolkit\packages\toolkit\src\client\shared\entry.module.css.mjs
|
|
304
|
-
const css$
|
|
305
|
-
const tagId$
|
|
306
|
-
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$
|
|
320
|
+
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}";
|
|
321
|
+
const tagId$8 = "dsh-agent-toolkit/entry.module.css-535aa644";
|
|
322
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$8) + "]") === null) {
|
|
307
323
|
const tag = document.createElement("style");
|
|
308
324
|
tag.dataset.plugin = "dsh-agent-toolkit";
|
|
309
|
-
tag.dataset.pluginCss = tagId$
|
|
310
|
-
tag.textContent = css$
|
|
325
|
+
tag.dataset.pluginCss = tagId$8;
|
|
326
|
+
tag.textContent = css$8;
|
|
311
327
|
document.head.appendChild(tag);
|
|
312
328
|
}
|
|
313
329
|
var entry_module_css_default$1 = {
|
|
314
|
-
"
|
|
315
|
-
"
|
|
330
|
+
"trigger": "VJWWsa_trigger",
|
|
331
|
+
"rail": "VJWWsa_rail"
|
|
316
332
|
};
|
|
317
333
|
//#endregion
|
|
318
334
|
//#region src/client/shared/entry.tsx
|
|
@@ -377,7 +393,7 @@ window.__ModuleLoader__.load({
|
|
|
377
393
|
}
|
|
378
394
|
//#endregion
|
|
379
395
|
//#region src/client/agents/api.ts
|
|
380
|
-
async function request$
|
|
396
|
+
async function request$3(input, init) {
|
|
381
397
|
const res = init === void 0 ? await fetch(input) : await fetch(input, {
|
|
382
398
|
...init,
|
|
383
399
|
headers: { "content-type": "application/json" }
|
|
@@ -389,55 +405,55 @@ window.__ModuleLoader__.load({
|
|
|
389
405
|
return res.json();
|
|
390
406
|
}
|
|
391
407
|
/** GET /agents → AgentRecord[](裸数组;与 Task 13 bots 的 fetchAgents 同源契约)。 */
|
|
392
|
-
const fetchAgents$
|
|
393
|
-
const fetchProviders$1 = () => request$
|
|
394
|
-
const fetchModels$1 = (provider) => request$
|
|
395
|
-
const fetchTools = () => request$
|
|
408
|
+
const fetchAgents$2 = () => request$3("/dsh-agent-toolkit/api/agents");
|
|
409
|
+
const fetchProviders$1 = () => request$3("/dsh-agent-toolkit/api/providers");
|
|
410
|
+
const fetchModels$1 = (provider) => request$3(`/dsh-agent-toolkit/api/providers/${encodeURIComponent(provider)}/models`);
|
|
411
|
+
const fetchTools = () => request$3("/dsh-agent-toolkit/api/tools");
|
|
396
412
|
/** PUT /agents/:id(upsert:全量替换记录)。 */
|
|
397
|
-
const saveAgent = (record) => request$
|
|
413
|
+
const saveAgent = (record) => request$3(`/dsh-agent-toolkit/api/agents/${encodeURIComponent(record.id)}`, {
|
|
398
414
|
method: "PUT",
|
|
399
415
|
body: JSON.stringify(record)
|
|
400
416
|
});
|
|
401
|
-
const deleteAgent = (id) => request$
|
|
417
|
+
const deleteAgent = (id) => request$3(`/dsh-agent-toolkit/api/agents/${encodeURIComponent(id)}`, { method: "DELETE" });
|
|
402
418
|
//#endregion
|
|
403
419
|
//#region \0dsh-css:D:\work\github\dsh\dsh-agent-toolkit\packages\toolkit\src\client\agents\agents.module.css.mjs
|
|
404
|
-
const css$
|
|
405
|
-
const tagId$
|
|
406
|
-
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$
|
|
420
|
+
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)}";
|
|
421
|
+
const tagId$7 = "dsh-agent-toolkit/agents.module.css-36f6ae02";
|
|
422
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$7) + "]") === null) {
|
|
407
423
|
const tag = document.createElement("style");
|
|
408
424
|
tag.dataset.plugin = "dsh-agent-toolkit";
|
|
409
|
-
tag.dataset.pluginCss = tagId$
|
|
410
|
-
tag.textContent = css$
|
|
425
|
+
tag.dataset.pluginCss = tagId$7;
|
|
426
|
+
tag.textContent = css$7;
|
|
411
427
|
document.head.appendChild(tag);
|
|
412
428
|
}
|
|
413
429
|
var agents_module_css_default = {
|
|
430
|
+
"hint": "KsfSLW_hint",
|
|
431
|
+
"agentRow": "KsfSLW_agentRow",
|
|
414
432
|
"block": "KsfSLW_block",
|
|
415
|
-
"
|
|
416
|
-
"
|
|
433
|
+
"blockTitle": "KsfSLW_blockTitle",
|
|
434
|
+
"toolGrid": "KsfSLW_toolGrid",
|
|
435
|
+
"createButton": "KsfSLW_createButton",
|
|
436
|
+
"builtinBadge": "KsfSLW_builtinBadge",
|
|
437
|
+
"error": "KsfSLW_error",
|
|
417
438
|
"select": "KsfSLW_select",
|
|
418
|
-
"
|
|
439
|
+
"agentDesc": "KsfSLW_agentDesc",
|
|
440
|
+
"editorPane": "KsfSLW_editorPane",
|
|
441
|
+
"editor": "KsfSLW_editor",
|
|
442
|
+
"field": "KsfSLW_field",
|
|
443
|
+
"split": "KsfSLW_split",
|
|
444
|
+
"listPane": "KsfSLW_listPane",
|
|
445
|
+
"input": "KsfSLW_input",
|
|
419
446
|
"toolMode": "KsfSLW_toolMode",
|
|
420
447
|
"toolGroupSet": "KsfSLW_toolGroupSet",
|
|
421
|
-
"toolGroupTitle": "KsfSLW_toolGroupTitle",
|
|
422
448
|
"dialog": "KsfSLW_dialog",
|
|
423
449
|
"toolCheck": "KsfSLW_toolCheck",
|
|
424
|
-
"error": "KsfSLW_error",
|
|
425
|
-
"dangerButton": "KsfSLW_dangerButton",
|
|
426
|
-
"hint": "KsfSLW_hint",
|
|
427
|
-
"readonlyId": "KsfSLW_readonlyId",
|
|
428
|
-
"builtinBadge": "KsfSLW_builtinBadge",
|
|
429
|
-
"agentName": "KsfSLW_agentName",
|
|
430
450
|
"actions": "KsfSLW_actions",
|
|
431
|
-
"
|
|
432
|
-
"
|
|
433
|
-
"toolGrid": "KsfSLW_toolGrid",
|
|
451
|
+
"readonlyId": "KsfSLW_readonlyId",
|
|
452
|
+
"toolGroupTitle": "KsfSLW_toolGroupTitle",
|
|
434
453
|
"agentRowActive": "KsfSLW_agentRowActive",
|
|
435
|
-
"
|
|
436
|
-
"
|
|
437
|
-
"
|
|
438
|
-
"blockTitle": "KsfSLW_blockTitle",
|
|
439
|
-
"createButton": "KsfSLW_createButton",
|
|
440
|
-
"editorPane": "KsfSLW_editorPane"
|
|
454
|
+
"dangerButton": "KsfSLW_dangerButton",
|
|
455
|
+
"agentName": "KsfSLW_agentName",
|
|
456
|
+
"textarea": "KsfSLW_textarea"
|
|
441
457
|
};
|
|
442
458
|
//#endregion
|
|
443
459
|
//#region src/client/agents/AgentEditor.tsx
|
|
@@ -457,8 +473,9 @@ window.__ModuleLoader__.load({
|
|
|
457
473
|
const [models, setModels] = (0, react.useState)([]);
|
|
458
474
|
const [tools, setTools] = (0, react.useState)(agent?.tools?.allow ?? []);
|
|
459
475
|
const [toolsMode, setToolsMode] = (0, react.useState)(agent === void 0 || agent.tools !== void 0 ? "custom" : "unrestricted");
|
|
476
|
+
const [visibleInTeam, setVisibleInTeam] = (0, react.useState)(agent?.visibleInTeam !== false);
|
|
460
477
|
const [catalog, setCatalog] = (0, react.useState)({
|
|
461
|
-
|
|
478
|
+
preset: [],
|
|
462
479
|
global: []
|
|
463
480
|
});
|
|
464
481
|
const [catalogLoaded, setCatalogLoaded] = (0, react.useState)(false);
|
|
@@ -473,7 +490,7 @@ window.__ModuleLoader__.load({
|
|
|
473
490
|
if (stale) return;
|
|
474
491
|
setCatalog(c);
|
|
475
492
|
setCatalogLoaded(true);
|
|
476
|
-
if (creating) setTools([...c.
|
|
493
|
+
if (creating) setTools([...c.preset, ...c.global]);
|
|
477
494
|
}).catch(() => void 0);
|
|
478
495
|
return () => {
|
|
479
496
|
stale = true;
|
|
@@ -525,7 +542,8 @@ window.__ModuleLoader__.load({
|
|
|
525
542
|
provider: provider.trim(),
|
|
526
543
|
model: model.trim()
|
|
527
544
|
} } : {},
|
|
528
|
-
...toolsMode === "custom" && tools.length > 0 ? { tools: { allow: tools } } : {}
|
|
545
|
+
...toolsMode === "custom" && tools.length > 0 ? { tools: { allow: tools } } : {},
|
|
546
|
+
...visibleInTeam ? {} : { visibleInTeam: false }
|
|
529
547
|
};
|
|
530
548
|
setSaving(true);
|
|
531
549
|
try {
|
|
@@ -598,6 +616,17 @@ window.__ModuleLoader__.load({
|
|
|
598
616
|
"aria-label": "描述",
|
|
599
617
|
rows: 2
|
|
600
618
|
})]
|
|
619
|
+
}),
|
|
620
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
621
|
+
className: agents_module_css_default.toolCheck,
|
|
622
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
623
|
+
type: "checkbox",
|
|
624
|
+
checked: visibleInTeam,
|
|
625
|
+
"aria-label": "在 Agent 团队中可见",
|
|
626
|
+
onChange: (e) => {
|
|
627
|
+
setVisibleInTeam(e.target.checked);
|
|
628
|
+
}
|
|
629
|
+
}), "在 Agent 团队中可见"]
|
|
601
630
|
})
|
|
602
631
|
]
|
|
603
632
|
}),
|
|
@@ -698,7 +727,7 @@ window.__ModuleLoader__.load({
|
|
|
698
727
|
}), "自定义白名单"]
|
|
699
728
|
})]
|
|
700
729
|
}),
|
|
701
|
-
catalog.
|
|
730
|
+
catalog.preset.length === 0 && catalog.global.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
702
731
|
className: agents_module_css_default.hint,
|
|
703
732
|
children: "暂无可用工具"
|
|
704
733
|
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("fieldset", {
|
|
@@ -707,11 +736,11 @@ window.__ModuleLoader__.load({
|
|
|
707
736
|
children: [
|
|
708
737
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
709
738
|
className: agents_module_css_default.toolGroupTitle,
|
|
710
|
-
children: "
|
|
739
|
+
children: "团队 preset 工具"
|
|
711
740
|
}),
|
|
712
741
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
713
742
|
className: agents_module_css_default.toolGrid,
|
|
714
|
-
children: catalog.
|
|
743
|
+
children: catalog.preset.map((t) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
715
744
|
className: agents_module_css_default.toolCheck,
|
|
716
745
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
717
746
|
type: "checkbox",
|
|
@@ -726,7 +755,7 @@ window.__ModuleLoader__.load({
|
|
|
726
755
|
}),
|
|
727
756
|
catalog.global.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
728
757
|
className: agents_module_css_default.toolGroupTitle,
|
|
729
|
-
children: "
|
|
758
|
+
children: "全局工具"
|
|
730
759
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
731
760
|
className: agents_module_css_default.toolGrid,
|
|
732
761
|
children: catalog.global.map((t) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
@@ -804,7 +833,7 @@ window.__ModuleLoader__.load({
|
|
|
804
833
|
}
|
|
805
834
|
function AgentsModalBody({ onEdit, onCreate, onDelete }) {
|
|
806
835
|
/** 打开即拉取(body 随 open 全新挂载,天然复位);保存后 reload 重拉。 */
|
|
807
|
-
const { state, reload } = useLoadState$1(fetchAgents$
|
|
836
|
+
const { state, reload } = useLoadState$1(fetchAgents$2, []);
|
|
808
837
|
const [selectedId, setSelectedId] = (0, react.useState)("");
|
|
809
838
|
const [creating, setCreating] = (0, react.useState)(false);
|
|
810
839
|
const visible = (state.kind === "ok" ? state.data : []).filter((a) => a.id !== "main");
|
|
@@ -866,6 +895,10 @@ window.__ModuleLoader__.load({
|
|
|
866
895
|
className: agents_module_css_default.builtinBadge,
|
|
867
896
|
children: "内置"
|
|
868
897
|
}),
|
|
898
|
+
agent.visibleInTeam === false && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Pill, {
|
|
899
|
+
className: agents_module_css_default.builtinBadge,
|
|
900
|
+
children: "团队不可见"
|
|
901
|
+
}),
|
|
869
902
|
agent.description !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
870
903
|
className: agents_module_css_default.agentDesc,
|
|
871
904
|
children: agent.description
|
|
@@ -897,7 +930,7 @@ window.__ModuleLoader__.load({
|
|
|
897
930
|
}
|
|
898
931
|
//#endregion
|
|
899
932
|
//#region src/client/agents/entry.tsx
|
|
900
|
-
const SidebarEntry$
|
|
933
|
+
const SidebarEntry$4 = createSidebarEntry$1({
|
|
901
934
|
id: "dsh-agent-toolkit:agents",
|
|
902
935
|
order: -1,
|
|
903
936
|
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconUserOutline16, { size: 18 }),
|
|
@@ -906,7 +939,7 @@ window.__ModuleLoader__.load({
|
|
|
906
939
|
});
|
|
907
940
|
/** 槽注册要求完整 composed props(含运行时 share useSessions/useWorkspaces);实现只消费 wide。 */
|
|
908
941
|
function AgentsEntry(props) {
|
|
909
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SidebarEntry$
|
|
942
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SidebarEntry$4, { wide: props.wide });
|
|
910
943
|
}
|
|
911
944
|
//#endregion
|
|
912
945
|
//#region src/client/agents/index.ts
|
|
@@ -919,7 +952,7 @@ window.__ModuleLoader__.load({
|
|
|
919
952
|
}
|
|
920
953
|
//#endregion
|
|
921
954
|
//#region src/client/prompt/api.ts
|
|
922
|
-
async function request$
|
|
955
|
+
async function request$2(input, init) {
|
|
923
956
|
const res = init === void 0 ? await fetch(input) : await fetch(input, {
|
|
924
957
|
...init,
|
|
925
958
|
headers: { "content-type": "application/json" }
|
|
@@ -930,45 +963,45 @@ window.__ModuleLoader__.load({
|
|
|
930
963
|
}
|
|
931
964
|
return res.json();
|
|
932
965
|
}
|
|
933
|
-
const fetchPromptLayers = () => request$
|
|
934
|
-
const saveLayers = (layers, identityOverride) => request$
|
|
966
|
+
const fetchPromptLayers = () => request$2("/dsh-agent-toolkit/api/prompt-layers");
|
|
967
|
+
const saveLayers = (layers, identityOverride) => request$2("/dsh-agent-toolkit/api/prompt-layers", {
|
|
935
968
|
method: "PUT",
|
|
936
969
|
body: JSON.stringify({
|
|
937
970
|
layers,
|
|
938
971
|
identityOverride
|
|
939
972
|
})
|
|
940
973
|
});
|
|
941
|
-
const resetLayers = () => request$
|
|
974
|
+
const resetLayers = () => request$2("/dsh-agent-toolkit/api/prompt-layers/reset", { method: "POST" });
|
|
942
975
|
//#endregion
|
|
943
976
|
//#region \0dsh-css:D:\work\github\dsh\dsh-agent-toolkit\packages\toolkit\src\client\prompt\prompt.module.css.mjs
|
|
944
|
-
const css$
|
|
945
|
-
const tagId$
|
|
946
|
-
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$
|
|
977
|
+
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)}";
|
|
978
|
+
const tagId$6 = "dsh-agent-toolkit/prompt.module.css-6f2e98f4";
|
|
979
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$6) + "]") === null) {
|
|
947
980
|
const tag = document.createElement("style");
|
|
948
981
|
tag.dataset.plugin = "dsh-agent-toolkit";
|
|
949
|
-
tag.dataset.pluginCss = tagId$
|
|
950
|
-
tag.textContent = css$
|
|
982
|
+
tag.dataset.pluginCss = tagId$6;
|
|
983
|
+
tag.textContent = css$6;
|
|
951
984
|
document.head.appendChild(tag);
|
|
952
985
|
}
|
|
953
986
|
var prompt_module_css_default = {
|
|
954
|
-
"layerName": "VZk1fa_layerName",
|
|
955
|
-
"field": "VZk1fa_field",
|
|
956
|
-
"editorPane": "VZk1fa_editorPane",
|
|
957
987
|
"split": "VZk1fa_split",
|
|
958
|
-
"
|
|
988
|
+
"readonlyTag": "VZk1fa_readonlyTag",
|
|
989
|
+
"layerName": "VZk1fa_layerName",
|
|
959
990
|
"hint": "VZk1fa_hint",
|
|
960
|
-
"tabs": "VZk1fa_tabs",
|
|
961
|
-
"listPane": "VZk1fa_listPane",
|
|
962
|
-
"tabActive": "VZk1fa_tabActive",
|
|
963
|
-
"layerRowActive": "VZk1fa_layerRowActive",
|
|
964
|
-
"actions": "VZk1fa_actions",
|
|
965
991
|
"editor": "VZk1fa_editor",
|
|
966
|
-
"layerOrder": "VZk1fa_layerOrder",
|
|
967
992
|
"dialog": "VZk1fa_dialog",
|
|
968
|
-
"
|
|
993
|
+
"field": "VZk1fa_field",
|
|
994
|
+
"layerRowActive": "VZk1fa_layerRowActive",
|
|
995
|
+
"layerOrder": "VZk1fa_layerOrder",
|
|
996
|
+
"listPane": "VZk1fa_listPane",
|
|
969
997
|
"error": "VZk1fa_error",
|
|
970
998
|
"layerRow": "VZk1fa_layerRow",
|
|
971
|
-
"
|
|
999
|
+
"actions": "VZk1fa_actions",
|
|
1000
|
+
"tabs": "VZk1fa_tabs",
|
|
1001
|
+
"tab": "VZk1fa_tab",
|
|
1002
|
+
"textarea": "VZk1fa_textarea",
|
|
1003
|
+
"tabActive": "VZk1fa_tabActive",
|
|
1004
|
+
"editorPane": "VZk1fa_editorPane"
|
|
972
1005
|
};
|
|
973
1006
|
//#endregion
|
|
974
1007
|
//#region src/client/prompt/PromptLayersModal.tsx
|
|
@@ -1279,7 +1312,7 @@ window.__ModuleLoader__.load({
|
|
|
1279
1312
|
}
|
|
1280
1313
|
//#endregion
|
|
1281
1314
|
//#region src/client/prompt/entry.tsx
|
|
1282
|
-
const SidebarEntry$
|
|
1315
|
+
const SidebarEntry$3 = createSidebarEntry$1({
|
|
1283
1316
|
id: "dsh-agent-toolkit:prompt-layers",
|
|
1284
1317
|
order: 0,
|
|
1285
1318
|
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconListPenOutline16, { size: 18 }),
|
|
@@ -1287,7 +1320,7 @@ window.__ModuleLoader__.load({
|
|
|
1287
1320
|
renderModal: (p) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PromptLayersModal, { ...p })
|
|
1288
1321
|
});
|
|
1289
1322
|
function PromptLayersEntry(props) {
|
|
1290
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SidebarEntry$
|
|
1323
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SidebarEntry$3, { wide: props.wide });
|
|
1291
1324
|
}
|
|
1292
1325
|
//#endregion
|
|
1293
1326
|
//#region src/client/prompt/index.ts
|
|
@@ -1300,18 +1333,18 @@ window.__ModuleLoader__.load({
|
|
|
1300
1333
|
}
|
|
1301
1334
|
//#endregion
|
|
1302
1335
|
//#region \0dsh-css:D:\work\github\dsh\dsh-agent-toolkit\packages\usage\src\client\shared\entry.module.css.mjs
|
|
1303
|
-
const css$
|
|
1304
|
-
const tagId$
|
|
1305
|
-
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$
|
|
1336
|
+
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}";
|
|
1337
|
+
const tagId$5 = "dsh-agent-toolkit/entry.module.css-27285725";
|
|
1338
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$5) + "]") === null) {
|
|
1306
1339
|
const tag = document.createElement("style");
|
|
1307
1340
|
tag.dataset.plugin = "dsh-agent-toolkit";
|
|
1308
|
-
tag.dataset.pluginCss = tagId$
|
|
1309
|
-
tag.textContent = css$
|
|
1341
|
+
tag.dataset.pluginCss = tagId$5;
|
|
1342
|
+
tag.textContent = css$5;
|
|
1310
1343
|
document.head.appendChild(tag);
|
|
1311
1344
|
}
|
|
1312
1345
|
var entry_module_css_default = {
|
|
1313
|
-
"
|
|
1314
|
-
"
|
|
1346
|
+
"rail": "QVHFVG_rail",
|
|
1347
|
+
"trigger": "QVHFVG_trigger"
|
|
1315
1348
|
};
|
|
1316
1349
|
//#endregion
|
|
1317
1350
|
//#region ../usage/src/client/shared/entry.tsx
|
|
@@ -1442,44 +1475,44 @@ window.__ModuleLoader__.load({
|
|
|
1442
1475
|
}
|
|
1443
1476
|
//#endregion
|
|
1444
1477
|
//#region \0dsh-css:D:\work\github\dsh\dsh-agent-toolkit\packages\usage\src\client\usage\chart.module.css.mjs
|
|
1445
|
-
const css$
|
|
1446
|
-
const tagId$
|
|
1447
|
-
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$
|
|
1478
|
+
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)}";
|
|
1479
|
+
const tagId$4 = "dsh-agent-toolkit/chart.module.css-a305f9e5";
|
|
1480
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$4) + "]") === null) {
|
|
1448
1481
|
const tag = document.createElement("style");
|
|
1449
1482
|
tag.dataset.plugin = "dsh-agent-toolkit";
|
|
1450
|
-
tag.dataset.pluginCss = tagId$
|
|
1451
|
-
tag.textContent = css$
|
|
1483
|
+
tag.dataset.pluginCss = tagId$4;
|
|
1484
|
+
tag.textContent = css$4;
|
|
1452
1485
|
document.head.appendChild(tag);
|
|
1453
1486
|
}
|
|
1454
1487
|
var chart_module_css_default = {
|
|
1455
|
-
"chartTheme": "_8LXSJW_chartTheme",
|
|
1456
1488
|
"legend": "_8LXSJW_legend",
|
|
1457
|
-
"
|
|
1489
|
+
"swatchFresh": "_8LXSJW_swatchFresh",
|
|
1458
1490
|
"swatchCached": "_8LXSJW_swatchCached",
|
|
1491
|
+
"tooltipTotal": "_8LXSJW_tooltipTotal",
|
|
1459
1492
|
"tooltipTitle": "_8LXSJW_tooltipTitle",
|
|
1460
|
-
"
|
|
1461
|
-
"
|
|
1493
|
+
"tooltip": "_8LXSJW_tooltip",
|
|
1494
|
+
"chartTheme": "_8LXSJW_chartTheme"
|
|
1462
1495
|
};
|
|
1463
1496
|
//#endregion
|
|
1464
1497
|
//#region \0dsh-css:D:\work\github\dsh\dsh-agent-toolkit\packages\usage\src\client\usage\ActivityHeatmap.module.css.mjs
|
|
1465
|
-
const css$
|
|
1466
|
-
const tagId$
|
|
1467
|
-
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$
|
|
1498
|
+
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)}";
|
|
1499
|
+
const tagId$3 = "dsh-agent-toolkit/ActivityHeatmap.module.css-aab58cb9";
|
|
1500
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$3) + "]") === null) {
|
|
1468
1501
|
const tag = document.createElement("style");
|
|
1469
1502
|
tag.dataset.plugin = "dsh-agent-toolkit";
|
|
1470
|
-
tag.dataset.pluginCss = tagId$
|
|
1471
|
-
tag.textContent = css$
|
|
1503
|
+
tag.dataset.pluginCss = tagId$3;
|
|
1504
|
+
tag.textContent = css$3;
|
|
1472
1505
|
document.head.appendChild(tag);
|
|
1473
1506
|
}
|
|
1474
1507
|
var ActivityHeatmap_module_css_default = {
|
|
1475
|
-
"grid": "hjrYrq_grid",
|
|
1476
|
-
"level0": "hjrYrq_level0",
|
|
1477
|
-
"week": "hjrYrq_week",
|
|
1478
1508
|
"level4": "hjrYrq_level4",
|
|
1479
|
-
"level1": "hjrYrq_level1",
|
|
1480
1509
|
"months": "hjrYrq_months",
|
|
1510
|
+
"level1": "hjrYrq_level1",
|
|
1511
|
+
"level3": "hjrYrq_level3",
|
|
1512
|
+
"week": "hjrYrq_week",
|
|
1513
|
+
"level0": "hjrYrq_level0",
|
|
1481
1514
|
"level2": "hjrYrq_level2",
|
|
1482
|
-
"
|
|
1515
|
+
"grid": "hjrYrq_grid"
|
|
1483
1516
|
};
|
|
1484
1517
|
//#endregion
|
|
1485
1518
|
//#region ../usage/src/client/usage/ActivityHeatmap.tsx
|
|
@@ -8842,8 +8875,8 @@ window.__ModuleLoader__.load({
|
|
|
8842
8875
|
function isPlainObject(value) {
|
|
8843
8876
|
if (!value || !isObjectish(value)) return false;
|
|
8844
8877
|
const proto = getPrototypeOf(value);
|
|
8845
|
-
if (proto === null || proto === O[PROTOTYPE]) return true;
|
|
8846
|
-
const Ctor = O.hasOwnProperty.call(proto, CONSTRUCTOR) && proto[CONSTRUCTOR];
|
|
8878
|
+
if (proto === null || proto === O$1[PROTOTYPE]) return true;
|
|
8879
|
+
const Ctor = O$1.hasOwnProperty.call(proto, CONSTRUCTOR) && proto[CONSTRUCTOR];
|
|
8847
8880
|
if (Ctor === Object) return true;
|
|
8848
8881
|
if (!isFunction(Ctor)) return false;
|
|
8849
8882
|
let ctorString = cachedCtorStrings.get(Ctor);
|
|
@@ -8858,7 +8891,7 @@ window.__ModuleLoader__.load({
|
|
|
8858
8891
|
return value[DRAFT_STATE].base_;
|
|
8859
8892
|
}
|
|
8860
8893
|
function each(obj, iter, strict = true) {
|
|
8861
|
-
if (getArchtype(obj) === 0) (strict ? Reflect.ownKeys(obj) : O.keys(obj)).forEach((key) => {
|
|
8894
|
+
if (getArchtype(obj) === 0) (strict ? Reflect.ownKeys(obj) : O$1.keys(obj)).forEach((key) => {
|
|
8862
8895
|
iter(key, obj[key], obj);
|
|
8863
8896
|
});
|
|
8864
8897
|
else obj.forEach((entry, index) => iter(index, entry, obj));
|
|
@@ -8881,7 +8914,7 @@ window.__ModuleLoader__.load({
|
|
|
8881
8914
|
if (isArray(base)) return Array[PROTOTYPE].slice.call(base);
|
|
8882
8915
|
const isPlain = isPlainObject(base);
|
|
8883
8916
|
if (strict === true || strict === "class_only" && !isPlain) {
|
|
8884
|
-
const descriptors = O.getOwnPropertyDescriptors(base);
|
|
8917
|
+
const descriptors = O$1.getOwnPropertyDescriptors(base);
|
|
8885
8918
|
delete descriptors[DRAFT_STATE];
|
|
8886
8919
|
let keys = Reflect.ownKeys(descriptors);
|
|
8887
8920
|
for (let i = 0; i < keys.length; i++) {
|
|
@@ -8898,23 +8931,23 @@ window.__ModuleLoader__.load({
|
|
|
8898
8931
|
[VALUE]: base[key]
|
|
8899
8932
|
};
|
|
8900
8933
|
}
|
|
8901
|
-
return O.create(getPrototypeOf(base), descriptors);
|
|
8934
|
+
return O$1.create(getPrototypeOf(base), descriptors);
|
|
8902
8935
|
} else {
|
|
8903
8936
|
const proto = getPrototypeOf(base);
|
|
8904
8937
|
if (proto !== null && isPlain) return { ...base };
|
|
8905
|
-
const obj = O.create(proto);
|
|
8906
|
-
return O.assign(obj, base);
|
|
8938
|
+
const obj = O$1.create(proto);
|
|
8939
|
+
return O$1.assign(obj, base);
|
|
8907
8940
|
}
|
|
8908
8941
|
}
|
|
8909
8942
|
function freeze$1(obj, deep = false) {
|
|
8910
8943
|
if (isFrozen(obj) || isDraft$1(obj) || !isDraftable$1(obj)) return obj;
|
|
8911
|
-
if (getArchtype(obj) > 1) O.defineProperties(obj, {
|
|
8944
|
+
if (getArchtype(obj) > 1) O$1.defineProperties(obj, {
|
|
8912
8945
|
set: dontMutateMethodOverride,
|
|
8913
8946
|
add: dontMutateMethodOverride,
|
|
8914
8947
|
clear: dontMutateMethodOverride,
|
|
8915
8948
|
delete: dontMutateMethodOverride
|
|
8916
8949
|
});
|
|
8917
|
-
O.freeze(obj);
|
|
8950
|
+
O$1.freeze(obj);
|
|
8918
8951
|
if (deep) each(obj, (_key, value) => {
|
|
8919
8952
|
freeze$1(value, true);
|
|
8920
8953
|
}, false);
|
|
@@ -8925,7 +8958,7 @@ window.__ModuleLoader__.load({
|
|
|
8925
8958
|
}
|
|
8926
8959
|
function isFrozen(obj) {
|
|
8927
8960
|
if (obj === null || !isObjectish(obj)) return true;
|
|
8928
|
-
return O.isFrozen(obj);
|
|
8961
|
+
return O$1.isFrozen(obj);
|
|
8929
8962
|
}
|
|
8930
8963
|
function getPlugin(pluginKey) {
|
|
8931
8964
|
const plugin = plugins[pluginKey];
|
|
@@ -9158,13 +9191,13 @@ window.__ModuleLoader__.load({
|
|
|
9158
9191
|
if (state) state.finalized_ = false;
|
|
9159
9192
|
return copy;
|
|
9160
9193
|
}
|
|
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;
|
|
9194
|
+
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
9195
|
var init_immer = __esmMin((() => {
|
|
9163
9196
|
NOTHING = Symbol.for("immer-nothing");
|
|
9164
9197
|
DRAFTABLE = Symbol.for("immer-draftable");
|
|
9165
9198
|
DRAFT_STATE = Symbol.for("immer-state");
|
|
9166
|
-
O = Object;
|
|
9167
|
-
getPrototypeOf = O.getPrototypeOf;
|
|
9199
|
+
O$1 = Object;
|
|
9200
|
+
getPrototypeOf = O$1.getPrototypeOf;
|
|
9168
9201
|
CONSTRUCTOR = "constructor";
|
|
9169
9202
|
PROTOTYPE = "prototype";
|
|
9170
9203
|
CONFIGURABLE = "configurable";
|
|
@@ -9172,9 +9205,9 @@ window.__ModuleLoader__.load({
|
|
|
9172
9205
|
WRITABLE = "writable";
|
|
9173
9206
|
VALUE = "value";
|
|
9174
9207
|
isDraft$1 = (value) => !!value && !!value[DRAFT_STATE];
|
|
9175
|
-
objectCtorString = O[PROTOTYPE][CONSTRUCTOR].toString();
|
|
9208
|
+
objectCtorString = O$1[PROTOTYPE][CONSTRUCTOR].toString();
|
|
9176
9209
|
cachedCtorStrings = /* @__PURE__ */ new WeakMap();
|
|
9177
|
-
has = (thing, prop, type = getArchtype(thing)) => type === 2 ? thing.has(prop) : O[PROTOTYPE].hasOwnProperty.call(thing, prop);
|
|
9210
|
+
has = (thing, prop, type = getArchtype(thing)) => type === 2 ? thing.has(prop) : O$1[PROTOTYPE].hasOwnProperty.call(thing, prop);
|
|
9178
9211
|
get = (thing, prop, type = getArchtype(thing)) => type === 2 ? thing.get(prop) : thing[prop];
|
|
9179
9212
|
set = (thing, propOrOldValue, value, type = getArchtype(thing)) => {
|
|
9180
9213
|
if (type === 2) thing.set(propOrOldValue, value);
|
|
@@ -14053,8 +14086,8 @@ window.__ModuleLoader__.load({
|
|
|
14053
14086
|
useStore: () => G
|
|
14054
14087
|
});
|
|
14055
14088
|
module.exports = Ye(Ft);
|
|
14056
|
-
var p = $e(require("react"));
|
|
14057
|
-
var He = p.version.startsWith("19");
|
|
14089
|
+
var p$1 = $e(require("react"));
|
|
14090
|
+
var He = p$1.version.startsWith("19");
|
|
14058
14091
|
var Be = Symbol.for(He ? "react.transitional.element" : "react.element");
|
|
14059
14092
|
var ze = Symbol.for("react.portal");
|
|
14060
14093
|
var Ke = Symbol.for("react.fragment");
|
|
@@ -14264,7 +14297,7 @@ window.__ModuleLoader__.load({
|
|
|
14264
14297
|
var ct = at();
|
|
14265
14298
|
var it = () => typeof navigator < "u" && navigator.product === "ReactNative";
|
|
14266
14299
|
var ut = it();
|
|
14267
|
-
var Pt = () => ct || ut ? p.useLayoutEffect : p.useEffect;
|
|
14300
|
+
var Pt = () => ct || ut ? p$1.useLayoutEffect : p$1.useEffect;
|
|
14268
14301
|
var A = Pt();
|
|
14269
14302
|
function Oe(e, t) {
|
|
14270
14303
|
return e === t ? e !== 0 || t !== 0 || 1 / e === 1 / t : e !== e && t !== t;
|
|
@@ -14351,9 +14384,9 @@ window.__ModuleLoader__.load({
|
|
|
14351
14384
|
var wt = Symbol.for("react-redux-context");
|
|
14352
14385
|
var xt = typeof globalThis < "u" ? globalThis : {};
|
|
14353
14386
|
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;
|
|
14387
|
+
if (!p$1.createContext) return {};
|
|
14388
|
+
let e = xt[wt] ??= /* @__PURE__ */ new Map(), t = e.get(p$1.createContext);
|
|
14389
|
+
return t || (t = p$1.createContext(null), e.set(p$1.createContext, t)), t;
|
|
14357
14390
|
}
|
|
14358
14391
|
var f = Ct();
|
|
14359
14392
|
var Ot = [null, null];
|
|
@@ -14399,17 +14432,17 @@ window.__ModuleLoader__.load({
|
|
|
14399
14432
|
areMergedPropsEqual: u
|
|
14400
14433
|
};
|
|
14401
14434
|
function C(O) {
|
|
14402
|
-
let [E, J, b] = p.useMemo(() => {
|
|
14435
|
+
let [E, J, b] = p$1.useMemo(() => {
|
|
14403
14436
|
let { reactReduxForwardedRef: h, ...k } = O;
|
|
14404
14437
|
return [
|
|
14405
14438
|
O.context,
|
|
14406
14439
|
h,
|
|
14407
14440
|
k
|
|
14408
14441
|
];
|
|
14409
|
-
}, [O]), _ = p.useMemo(() => {
|
|
14442
|
+
}, [O]), _ = p$1.useMemo(() => {
|
|
14410
14443
|
let h = l;
|
|
14411
14444
|
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(() => {
|
|
14445
|
+
}, [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
14446
|
if (!m) return Ot;
|
|
14414
14447
|
let h = z(g, I ? void 0 : D.subscription);
|
|
14415
14448
|
return [h, h.notifyNestedSubs.bind(h)];
|
|
@@ -14417,18 +14450,18 @@ window.__ModuleLoader__.load({
|
|
|
14417
14450
|
g,
|
|
14418
14451
|
I,
|
|
14419
14452
|
D
|
|
14420
|
-
]), ue = p.useMemo(() => I ? D : {
|
|
14453
|
+
]), ue = p$1.useMemo(() => I ? D : {
|
|
14421
14454
|
...D,
|
|
14422
14455
|
subscription: V
|
|
14423
14456
|
}, [
|
|
14424
14457
|
I,
|
|
14425
14458
|
D,
|
|
14426
14459
|
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);
|
|
14460
|
+
]), 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
14461
|
A(() => (ee.current = !0, () => {
|
|
14429
14462
|
ee.current = !1;
|
|
14430
14463
|
}), []);
|
|
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]);
|
|
14464
|
+
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
14465
|
Dt(bt, [
|
|
14433
14466
|
Q,
|
|
14434
14467
|
Z,
|
|
@@ -14439,7 +14472,7 @@ window.__ModuleLoader__.load({
|
|
|
14439
14472
|
]);
|
|
14440
14473
|
let $;
|
|
14441
14474
|
try {
|
|
14442
|
-
$ = p.useSyncExternalStore(Ie, le, ce ? () => X(ce(), b) : le);
|
|
14475
|
+
$ = p$1.useSyncExternalStore(Ie, le, ce ? () => X(ce(), b) : le);
|
|
14443
14476
|
} catch (h) {
|
|
14444
14477
|
throw te.current && (h.message += `
|
|
14445
14478
|
The error may be correlated with this previous error:
|
|
@@ -14450,7 +14483,7 @@ ${te.current.stack}
|
|
|
14450
14483
|
A(() => {
|
|
14451
14484
|
te.current = void 0, W.current = void 0, Z.current = $;
|
|
14452
14485
|
});
|
|
14453
|
-
let oe = p.useMemo(() => p.createElement(T, {
|
|
14486
|
+
let oe = p$1.useMemo(() => p$1.createElement(T, {
|
|
14454
14487
|
...$,
|
|
14455
14488
|
ref: J
|
|
14456
14489
|
}), [
|
|
@@ -14458,16 +14491,16 @@ ${te.current.stack}
|
|
|
14458
14491
|
T,
|
|
14459
14492
|
$
|
|
14460
14493
|
]);
|
|
14461
|
-
return p.useMemo(() => m ? p.createElement(_.Provider, { value: ue }, oe) : oe, [
|
|
14494
|
+
return p$1.useMemo(() => m ? p$1.createElement(_.Provider, { value: ue }, oe) : oe, [
|
|
14462
14495
|
_,
|
|
14463
14496
|
oe,
|
|
14464
14497
|
ue
|
|
14465
14498
|
]);
|
|
14466
14499
|
}
|
|
14467
|
-
let N = p.memo(C);
|
|
14500
|
+
let N = p$1.memo(C);
|
|
14468
14501
|
if (N.WrappedComponent = T, N.displayName = C.displayName = S, a) {
|
|
14469
|
-
let E = p.forwardRef(function(b, _) {
|
|
14470
|
-
return p.createElement(N, {
|
|
14502
|
+
let E = p$1.forwardRef(function(b, _) {
|
|
14503
|
+
return p$1.createElement(N, {
|
|
14471
14504
|
...b,
|
|
14472
14505
|
reactReduxForwardedRef: _
|
|
14473
14506
|
});
|
|
@@ -14480,25 +14513,25 @@ ${te.current.stack}
|
|
|
14480
14513
|
var Ee = Re;
|
|
14481
14514
|
var ke = Re;
|
|
14482
14515
|
function Rt(e) {
|
|
14483
|
-
let { children: t, context: o, serverState: n, store: r } = e, s = p.useMemo(() => {
|
|
14516
|
+
let { children: t, context: o, serverState: n, store: r } = e, s = p$1.useMemo(() => {
|
|
14484
14517
|
let a = z(r);
|
|
14485
14518
|
return {
|
|
14486
14519
|
store: r,
|
|
14487
14520
|
subscription: a,
|
|
14488
14521
|
getServerState: n ? () => n : void 0
|
|
14489
14522
|
};
|
|
14490
|
-
}, [r, n]), i = p.useMemo(() => r.getState(), [r]);
|
|
14523
|
+
}, [r, n]), i = p$1.useMemo(() => r.getState(), [r]);
|
|
14491
14524
|
return A(() => {
|
|
14492
14525
|
let { subscription: a } = s;
|
|
14493
14526
|
return a.onStateChange = a.notifyNestedSubs, a.trySubscribe(), i !== r.getState() && a.notifyNestedSubs(), () => {
|
|
14494
14527
|
a.tryUnsubscribe(), a.onStateChange = void 0;
|
|
14495
14528
|
};
|
|
14496
|
-
}, [s, i]), p.createElement((o || f).Provider, { value: s }, t);
|
|
14529
|
+
}, [s, i]), p$1.createElement((o || f).Provider, { value: s }, t);
|
|
14497
14530
|
}
|
|
14498
14531
|
var Fe = Rt;
|
|
14499
14532
|
function L(e = f) {
|
|
14500
14533
|
return function() {
|
|
14501
|
-
return p.useContext(e);
|
|
14534
|
+
return p$1.useContext(e);
|
|
14502
14535
|
};
|
|
14503
14536
|
}
|
|
14504
14537
|
var K = L();
|
|
@@ -14520,11 +14553,11 @@ ${te.current.stack}
|
|
|
14520
14553
|
function ae(e = f) {
|
|
14521
14554
|
let t = e === f ? K : L(e), o = (n, r = {}) => {
|
|
14522
14555
|
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) {
|
|
14556
|
+
p$1.useRef(!0);
|
|
14557
|
+
let P = p$1.useCallback({ [n.name](x) {
|
|
14525
14558
|
return n(x);
|
|
14526
14559
|
} }[n.name], [n]), d = (0, ve.useSyncExternalStoreWithSelector)(a.addNestedSub, u.getState, c || u.getState, P, s);
|
|
14527
|
-
return p.useDebugValue(d), d;
|
|
14560
|
+
return p$1.useDebugValue(d), d;
|
|
14528
14561
|
};
|
|
14529
14562
|
return Object.assign(o, { withTypes: () => o }), o;
|
|
14530
14563
|
}
|
|
@@ -52506,29 +52539,29 @@ ${te.current.stack}
|
|
|
52506
52539
|
}
|
|
52507
52540
|
//#endregion
|
|
52508
52541
|
//#region \0dsh-css:D:\work\github\dsh\dsh-agent-toolkit\packages\usage\src\client\usage\UsageModal.module.css.mjs
|
|
52509
|
-
const css$
|
|
52510
|
-
const tagId$
|
|
52511
|
-
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$
|
|
52542
|
+
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}";
|
|
52543
|
+
const tagId$2 = "dsh-agent-toolkit/UsageModal.module.css-3b7b09e9";
|
|
52544
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$2) + "]") === null) {
|
|
52512
52545
|
const tag = document.createElement("style");
|
|
52513
52546
|
tag.dataset.plugin = "dsh-agent-toolkit";
|
|
52514
|
-
tag.dataset.pluginCss = tagId$
|
|
52515
|
-
tag.textContent = css$
|
|
52547
|
+
tag.dataset.pluginCss = tagId$2;
|
|
52548
|
+
tag.textContent = css$2;
|
|
52516
52549
|
document.head.appendChild(tag);
|
|
52517
52550
|
}
|
|
52518
52551
|
var UsageModal_module_css_default = {
|
|
52519
|
-
"
|
|
52552
|
+
"tabs": "MODeXa_tabs",
|
|
52553
|
+
"tab": "MODeXa_tab",
|
|
52554
|
+
"tabActive": "MODeXa_tabActive",
|
|
52520
52555
|
"sectionTitle": "MODeXa_sectionTitle",
|
|
52521
52556
|
"pagerButton": "MODeXa_pagerButton",
|
|
52522
|
-
"total": "MODeXa_total",
|
|
52523
|
-
"tabActive": "MODeXa_tabActive",
|
|
52524
|
-
"dialog": "MODeXa_dialog",
|
|
52525
|
-
"tabs": "MODeXa_tabs",
|
|
52526
|
-
"rowCalls": "MODeXa_rowCalls",
|
|
52527
52557
|
"compaction": "MODeXa_compaction",
|
|
52558
|
+
"rowName": "MODeXa_rowName",
|
|
52559
|
+
"dialog": "MODeXa_dialog",
|
|
52560
|
+
"dateLabel": "MODeXa_dateLabel",
|
|
52528
52561
|
"row": "MODeXa_row",
|
|
52529
52562
|
"pager": "MODeXa_pager",
|
|
52530
|
-
"
|
|
52531
|
-
"
|
|
52563
|
+
"total": "MODeXa_total",
|
|
52564
|
+
"rowCalls": "MODeXa_rowCalls"
|
|
52532
52565
|
};
|
|
52533
52566
|
//#endregion
|
|
52534
52567
|
//#region ../usage/src/client/usage/UsageModal.tsx
|
|
@@ -52688,7 +52721,7 @@ ${te.current.stack}
|
|
|
52688
52721
|
}
|
|
52689
52722
|
//#endregion
|
|
52690
52723
|
//#region ../usage/src/client/usage/entry.tsx
|
|
52691
|
-
const SidebarEntry$
|
|
52724
|
+
const SidebarEntry$2 = createSidebarEntry({
|
|
52692
52725
|
id: "dsh-agent-toolkit:usage",
|
|
52693
52726
|
order: 0,
|
|
52694
52727
|
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconDataOutline16, { size: 18 }),
|
|
@@ -52697,7 +52730,7 @@ ${te.current.stack}
|
|
|
52697
52730
|
});
|
|
52698
52731
|
/** 槽注册要求完整 composed props(含运行时 share useSessions/useWorkspaces);实现只消费 wide。 */
|
|
52699
52732
|
function UsageEntry(props) {
|
|
52700
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SidebarEntry$
|
|
52733
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SidebarEntry$2, { wide: props.wide });
|
|
52701
52734
|
}
|
|
52702
52735
|
//#endregion
|
|
52703
52736
|
//#region ../usage/src/client/usage/index.ts
|
|
@@ -52710,7 +52743,7 @@ ${te.current.stack}
|
|
|
52710
52743
|
}
|
|
52711
52744
|
//#endregion
|
|
52712
52745
|
//#region src/client/bots/api.ts
|
|
52713
|
-
async function request(input, init) {
|
|
52746
|
+
async function request$1(input, init) {
|
|
52714
52747
|
const res = init === void 0 ? await fetch(input) : await fetch(input, {
|
|
52715
52748
|
...init,
|
|
52716
52749
|
headers: { "content-type": "application/json" }
|
|
@@ -52721,27 +52754,27 @@ ${te.current.stack}
|
|
|
52721
52754
|
}
|
|
52722
52755
|
return res.json();
|
|
52723
52756
|
}
|
|
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);
|
|
52757
|
+
const fetchBots = () => request$1("/dsh-agent-toolkit/api/bots/bots").then((r) => r.bots);
|
|
52758
|
+
const fetchProviders = () => request$1("/dsh-agent-toolkit/api/bots/providers").then((r) => r.providers);
|
|
52759
|
+
const fetchAgents$1 = () => request$1("/dsh-agent-toolkit/api/agents");
|
|
52760
|
+
const fetchModels = (provider) => request$1(`/dsh-agent-toolkit/api/bots/models?provider=${encodeURIComponent(provider)}`).then((r) => r.models);
|
|
52728
52761
|
function createBot(input) {
|
|
52729
|
-
return request("/dsh-agent-toolkit/api/bots/bots", {
|
|
52762
|
+
return request$1("/dsh-agent-toolkit/api/bots/bots", {
|
|
52730
52763
|
method: "POST",
|
|
52731
52764
|
body: JSON.stringify(input)
|
|
52732
52765
|
});
|
|
52733
52766
|
}
|
|
52734
52767
|
function updateBot(id, input) {
|
|
52735
|
-
return request(`/dsh-agent-toolkit/api/bots/bots?id=${encodeURIComponent(id)}`, {
|
|
52768
|
+
return request$1(`/dsh-agent-toolkit/api/bots/bots?id=${encodeURIComponent(id)}`, {
|
|
52736
52769
|
method: "PUT",
|
|
52737
52770
|
body: JSON.stringify(input)
|
|
52738
52771
|
});
|
|
52739
52772
|
}
|
|
52740
52773
|
function deleteBot(id) {
|
|
52741
|
-
return request(`/dsh-agent-toolkit/api/bots/bots?id=${encodeURIComponent(id)}`, { method: "DELETE" });
|
|
52774
|
+
return request$1(`/dsh-agent-toolkit/api/bots/bots?id=${encodeURIComponent(id)}`, { method: "DELETE" });
|
|
52742
52775
|
}
|
|
52743
|
-
const startRegisterApp = () => request("/dsh-agent-toolkit/api/bots/register-app", { method: "POST" });
|
|
52744
|
-
const pollRegisterApp = (id) => request(`/dsh-agent-toolkit/api/bots/register-app/status?id=${encodeURIComponent(id)}`).then((r) => r.state);
|
|
52776
|
+
const startRegisterApp = () => request$1("/dsh-agent-toolkit/api/bots/register-app", { method: "POST" });
|
|
52777
|
+
const pollRegisterApp = (id) => request$1(`/dsh-agent-toolkit/api/bots/register-app/status?id=${encodeURIComponent(id)}`).then((r) => r.state);
|
|
52745
52778
|
//#endregion
|
|
52746
52779
|
//#region ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/can-promise.js
|
|
52747
52780
|
var require_can_promise = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
@@ -55146,41 +55179,41 @@ ${te.current.stack}
|
|
|
55146
55179
|
return SvgRenderer.render(data, opts);
|
|
55147
55180
|
});
|
|
55148
55181
|
})))();
|
|
55149
|
-
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);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}";
|
|
55150
|
-
const tagId = "dsh-agent-toolkit/bots.module.css-2ed59f26";
|
|
55151
|
-
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
|
|
55182
|
+
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}";
|
|
55183
|
+
const tagId$1 = "dsh-agent-toolkit/bots.module.css-2ed59f26";
|
|
55184
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$1) + "]") === null) {
|
|
55152
55185
|
const tag = document.createElement("style");
|
|
55153
55186
|
tag.dataset.plugin = "dsh-agent-toolkit";
|
|
55154
|
-
tag.dataset.pluginCss = tagId;
|
|
55155
|
-
tag.textContent = css;
|
|
55187
|
+
tag.dataset.pluginCss = tagId$1;
|
|
55188
|
+
tag.textContent = css$1;
|
|
55156
55189
|
document.head.appendChild(tag);
|
|
55157
55190
|
}
|
|
55158
55191
|
var bots_module_css_default = {
|
|
55159
|
-
"stepSeparator": "vTbXga_stepSeparator",
|
|
55160
|
-
"stepActive": "vTbXga_stepActive",
|
|
55161
55192
|
"group": "vTbXga_group",
|
|
55162
|
-
"
|
|
55163
|
-
"
|
|
55164
|
-
"
|
|
55193
|
+
"step": "vTbXga_step",
|
|
55194
|
+
"stepActive": "vTbXga_stepActive",
|
|
55195
|
+
"textarea": "vTbXga_textarea",
|
|
55165
55196
|
"groupTitle": "vTbXga_groupTitle",
|
|
55166
|
-
"
|
|
55167
|
-
"
|
|
55168
|
-
"botMain": "vTbXga_botMain",
|
|
55197
|
+
"dialog": "vTbXga_dialog",
|
|
55198
|
+
"botName": "vTbXga_botName",
|
|
55169
55199
|
"botDelete": "vTbXga_botDelete",
|
|
55170
55200
|
"input": "vTbXga_input",
|
|
55171
|
-
"
|
|
55172
|
-
"
|
|
55173
|
-
"
|
|
55174
|
-
"
|
|
55201
|
+
"steps": "vTbXga_steps",
|
|
55202
|
+
"stepSeparator": "vTbXga_stepSeparator",
|
|
55203
|
+
"tab": "vTbXga_tab",
|
|
55204
|
+
"botMain": "vTbXga_botMain",
|
|
55205
|
+
"scanSection": "vTbXga_scanSection",
|
|
55206
|
+
"hint": "vTbXga_hint",
|
|
55207
|
+
"formActions": "vTbXga_formActions",
|
|
55175
55208
|
"channelBadge": "vTbXga_channelBadge",
|
|
55209
|
+
"tabs": "vTbXga_tabs",
|
|
55210
|
+
"createButton": "vTbXga_createButton",
|
|
55176
55211
|
"botRow": "vTbXga_botRow",
|
|
55212
|
+
"status": "vTbXga_status",
|
|
55177
55213
|
"select": "vTbXga_select",
|
|
55178
|
-
"tab": "vTbXga_tab",
|
|
55179
|
-
"dialog": "vTbXga_dialog",
|
|
55180
55214
|
"field": "vTbXga_field",
|
|
55181
|
-
"
|
|
55182
|
-
"error": "vTbXga_error"
|
|
55183
|
-
"hint": "vTbXga_hint"
|
|
55215
|
+
"tabActive": "vTbXga_tabActive",
|
|
55216
|
+
"error": "vTbXga_error"
|
|
55184
55217
|
};
|
|
55185
55218
|
//#endregion
|
|
55186
55219
|
//#region src/client/bots/BotForm.tsx
|
|
@@ -55210,7 +55243,7 @@ ${te.current.stack}
|
|
|
55210
55243
|
const pollTimer = (0, react.useRef)(void 0);
|
|
55211
55244
|
(0, react.useEffect)(() => {
|
|
55212
55245
|
let stale = false;
|
|
55213
|
-
fetchAgents().then((as) => {
|
|
55246
|
+
fetchAgents$1().then((as) => {
|
|
55214
55247
|
if (stale) return;
|
|
55215
55248
|
setAgents(as);
|
|
55216
55249
|
setAgentRef((current) => {
|
|
@@ -55816,7 +55849,7 @@ ${te.current.stack}
|
|
|
55816
55849
|
}
|
|
55817
55850
|
//#endregion
|
|
55818
55851
|
//#region src/client/bots/entry.tsx
|
|
55819
|
-
const SidebarEntry = createSidebarEntry$1({
|
|
55852
|
+
const SidebarEntry$1 = createSidebarEntry$1({
|
|
55820
55853
|
id: "dsh-agent-toolkit:bots",
|
|
55821
55854
|
order: 1,
|
|
55822
55855
|
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconAgentPresetOutline16, { size: 18 }),
|
|
@@ -55825,7 +55858,7 @@ ${te.current.stack}
|
|
|
55825
55858
|
});
|
|
55826
55859
|
/** 槽注册要求完整 composed props(含运行时 share useSessions/useWorkspaces);实现只消费 wide + useWorkspaces。 */
|
|
55827
55860
|
function BotsEntry(props) {
|
|
55828
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SidebarEntry, {
|
|
55861
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SidebarEntry$1, {
|
|
55829
55862
|
wide: props.wide,
|
|
55830
55863
|
useWorkspaces: props.useWorkspaces
|
|
55831
55864
|
});
|
|
@@ -55840,6 +55873,1453 @@ ${te.current.stack}
|
|
|
55840
55873
|
}, BotsEntry));
|
|
55841
55874
|
}
|
|
55842
55875
|
//#endregion
|
|
55876
|
+
//#region src/client/schedule/api.ts
|
|
55877
|
+
async function request(input, init) {
|
|
55878
|
+
const res = init === void 0 ? await fetch(input) : await fetch(input, {
|
|
55879
|
+
...init,
|
|
55880
|
+
headers: { "content-type": "application/json" }
|
|
55881
|
+
});
|
|
55882
|
+
if (!res.ok) {
|
|
55883
|
+
const body = await res.text().catch(() => "");
|
|
55884
|
+
throw new Error(body || `HTTP ${res.status}`);
|
|
55885
|
+
}
|
|
55886
|
+
return res.json();
|
|
55887
|
+
}
|
|
55888
|
+
const BASE = "/dsh-agent-toolkit/api/cron";
|
|
55889
|
+
const fetchTasks = () => request(`${BASE}/tasks`).then((r) => r.tasks);
|
|
55890
|
+
const createTask = (input) => request(`${BASE}/tasks`, {
|
|
55891
|
+
method: "POST",
|
|
55892
|
+
body: JSON.stringify(input)
|
|
55893
|
+
});
|
|
55894
|
+
const updateTask = (id, patch) => request(`${BASE}/tasks/${encodeURIComponent(id)}`, {
|
|
55895
|
+
method: "PUT",
|
|
55896
|
+
body: JSON.stringify(patch)
|
|
55897
|
+
});
|
|
55898
|
+
const deleteTask = (id) => request(`${BASE}/tasks/${encodeURIComponent(id)}`, { method: "DELETE" });
|
|
55899
|
+
const triggerTask = (id) => request(`${BASE}/tasks/${encodeURIComponent(id)}/trigger`, {
|
|
55900
|
+
method: "POST",
|
|
55901
|
+
body: "{}"
|
|
55902
|
+
});
|
|
55903
|
+
const fetchRuns = (id) => request(`${BASE}/tasks/${encodeURIComponent(id)}/runs`).then((r) => r.runs);
|
|
55904
|
+
const fetchProjects = () => request(`${BASE}/projects`).then((r) => r.projects);
|
|
55905
|
+
const fetchAgents = () => request("/dsh-agent-toolkit/api/agents");
|
|
55906
|
+
//#endregion
|
|
55907
|
+
//#region \0dsh-css:D:\work\github\dsh\dsh-agent-toolkit\packages\toolkit\src\client\schedule\schedule.module.css.mjs
|
|
55908
|
+
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}";
|
|
55909
|
+
const tagId = "dsh-agent-toolkit/schedule.module.css-a938255d";
|
|
55910
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
|
|
55911
|
+
const tag = document.createElement("style");
|
|
55912
|
+
tag.dataset.plugin = "dsh-agent-toolkit";
|
|
55913
|
+
tag.dataset.pluginCss = tagId;
|
|
55914
|
+
tag.textContent = css;
|
|
55915
|
+
document.head.appendChild(tag);
|
|
55916
|
+
}
|
|
55917
|
+
var schedule_module_css_default = {
|
|
55918
|
+
"main": "_22qt-W_main",
|
|
55919
|
+
"field": "_22qt-W_field",
|
|
55920
|
+
"textarea": "_22qt-W_textarea",
|
|
55921
|
+
"row": "_22qt-W_row",
|
|
55922
|
+
"actionDanger": "_22qt-W_actionDanger",
|
|
55923
|
+
"meta": "_22qt-W_meta",
|
|
55924
|
+
"dialog": "_22qt-W_dialog",
|
|
55925
|
+
"badge": "_22qt-W_badge",
|
|
55926
|
+
"name": "_22qt-W_name",
|
|
55927
|
+
"radioGroup": "_22qt-W_radioGroup",
|
|
55928
|
+
"option": "_22qt-W_option",
|
|
55929
|
+
"action": "_22qt-W_action",
|
|
55930
|
+
"error": "_22qt-W_error",
|
|
55931
|
+
"enabled": "_22qt-W_enabled",
|
|
55932
|
+
"runRow": "_22qt-W_runRow",
|
|
55933
|
+
"runError": "_22qt-W_runError",
|
|
55934
|
+
"radio": "_22qt-W_radio",
|
|
55935
|
+
"checkbox": "_22qt-W_checkbox",
|
|
55936
|
+
"formActions": "_22qt-W_formActions",
|
|
55937
|
+
"runs": "_22qt-W_runs",
|
|
55938
|
+
"createButton": "_22qt-W_createButton",
|
|
55939
|
+
"input": "_22qt-W_input",
|
|
55940
|
+
"select": "_22qt-W_select"
|
|
55941
|
+
};
|
|
55942
|
+
//#endregion
|
|
55943
|
+
//#region src/client/schedule/ScheduleModal.tsx
|
|
55944
|
+
/** 定时任务管理模态框:任务列表(行内开关/编辑/删除两段确认/立即触发)+ 运行历史展开。 */
|
|
55945
|
+
/** 调度规则摘要(列表行内一行)。 */
|
|
55946
|
+
function scheduleSummary(task) {
|
|
55947
|
+
switch (task.schedule.kind) {
|
|
55948
|
+
case "cron": return `cron: ${task.schedule.expr}${task.schedule.timeZone !== void 0 ? ` (${task.schedule.timeZone})` : ""}`;
|
|
55949
|
+
case "at": return `at: ${new Date(task.schedule.at).toLocaleString()}`;
|
|
55950
|
+
case "every": return `every ${task.schedule.seconds}s`;
|
|
55951
|
+
}
|
|
55952
|
+
}
|
|
55953
|
+
const RUN_STATUS_KEY = {
|
|
55954
|
+
ok: "run.ok",
|
|
55955
|
+
error: "run.error",
|
|
55956
|
+
running: "run.running",
|
|
55957
|
+
"skipped-overlap": "run.skipped-overlap"
|
|
55958
|
+
};
|
|
55959
|
+
function ScheduleModal(props) {
|
|
55960
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Modal, {
|
|
55961
|
+
open: props.open,
|
|
55962
|
+
onClose: props.onClose,
|
|
55963
|
+
title: props.t("modal.title"),
|
|
55964
|
+
closeLabel: props.t("modal.close"),
|
|
55965
|
+
className: schedule_module_css_default.dialog,
|
|
55966
|
+
children: props.open && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScheduleModalBody, { ...props })
|
|
55967
|
+
});
|
|
55968
|
+
}
|
|
55969
|
+
function ScheduleModalBody({ onClose: _onClose, ...props }) {
|
|
55970
|
+
const { t, openSession } = props;
|
|
55971
|
+
const [view, setView] = (0, react.useState)("list");
|
|
55972
|
+
const { state, reload } = useLoadState$1(() => fetchTasks(), []);
|
|
55973
|
+
const [confirmDeleteId, setConfirmDeleteId] = (0, react.useState)(null);
|
|
55974
|
+
const [error, setError] = (0, react.useState)(null);
|
|
55975
|
+
const [expandedId, setExpandedId] = (0, react.useState)(null);
|
|
55976
|
+
async function remove(task) {
|
|
55977
|
+
if (confirmDeleteId !== task.id) {
|
|
55978
|
+
setConfirmDeleteId(task.id);
|
|
55979
|
+
setError(null);
|
|
55980
|
+
return;
|
|
55981
|
+
}
|
|
55982
|
+
try {
|
|
55983
|
+
await deleteTask(task.id);
|
|
55984
|
+
setConfirmDeleteId(null);
|
|
55985
|
+
reload();
|
|
55986
|
+
} catch (e) {
|
|
55987
|
+
setError(t("list.deleteFailed", { message: e instanceof Error ? e.message : String(e) }));
|
|
55988
|
+
}
|
|
55989
|
+
}
|
|
55990
|
+
async function toggleEnabled(task) {
|
|
55991
|
+
try {
|
|
55992
|
+
await updateTask(task.id, { enabled: !task.enabled });
|
|
55993
|
+
reload();
|
|
55994
|
+
} catch (e) {
|
|
55995
|
+
setError(e instanceof Error ? e.message : String(e));
|
|
55996
|
+
}
|
|
55997
|
+
}
|
|
55998
|
+
async function trigger(task) {
|
|
55999
|
+
try {
|
|
56000
|
+
await triggerTask(task.id);
|
|
56001
|
+
reload();
|
|
56002
|
+
} catch (e) {
|
|
56003
|
+
setError(t("list.triggerFailed", { message: e instanceof Error ? e.message : String(e) }));
|
|
56004
|
+
}
|
|
56005
|
+
}
|
|
56006
|
+
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, () => {
|
|
56007
|
+
reload();
|
|
56008
|
+
setView("list");
|
|
56009
|
+
}, () => {
|
|
56010
|
+
setView("list");
|
|
56011
|
+
}) });
|
|
56012
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
56013
|
+
state.kind === "loading" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("list.loading") }),
|
|
56014
|
+
state.kind === "error" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("list.error") }),
|
|
56015
|
+
state.kind === "ok" && state.data.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("list.empty") }),
|
|
56016
|
+
state.kind === "ok" && state.data.map((task) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
56017
|
+
className: schedule_module_css_default.row,
|
|
56018
|
+
children: [
|
|
56019
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
56020
|
+
type: "checkbox",
|
|
56021
|
+
className: schedule_module_css_default.enabled,
|
|
56022
|
+
"aria-label": task.name,
|
|
56023
|
+
checked: task.enabled,
|
|
56024
|
+
onChange: () => {
|
|
56025
|
+
toggleEnabled(task);
|
|
56026
|
+
}
|
|
56027
|
+
}),
|
|
56028
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
56029
|
+
type: "button",
|
|
56030
|
+
className: schedule_module_css_default.main,
|
|
56031
|
+
onClick: () => {
|
|
56032
|
+
setConfirmDeleteId(null);
|
|
56033
|
+
props.onEdit !== void 0 ? props.onEdit(task) : setView({
|
|
56034
|
+
mode: "edit",
|
|
56035
|
+
task
|
|
56036
|
+
});
|
|
56037
|
+
},
|
|
56038
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
56039
|
+
className: schedule_module_css_default.name,
|
|
56040
|
+
children: task.name
|
|
56041
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
56042
|
+
className: schedule_module_css_default.meta,
|
|
56043
|
+
children: [
|
|
56044
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: scheduleSummary(task) }),
|
|
56045
|
+
" · ",
|
|
56046
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: task.target.kind === "main" ? t("list.targetMain") : t("list.targetRole", { roleId: task.target.roleId }) }),
|
|
56047
|
+
" · ",
|
|
56048
|
+
/* @__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") })
|
|
56049
|
+
]
|
|
56050
|
+
})]
|
|
56051
|
+
}),
|
|
56052
|
+
task.lastRun !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Pill, {
|
|
56053
|
+
className: schedule_module_css_default.badge,
|
|
56054
|
+
children: t(RUN_STATUS_KEY[task.lastRun.status])
|
|
56055
|
+
}),
|
|
56056
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
56057
|
+
type: "button",
|
|
56058
|
+
className: schedule_module_css_default.action,
|
|
56059
|
+
onClick: () => {
|
|
56060
|
+
setExpandedId(expandedId === task.id ? null : task.id);
|
|
56061
|
+
},
|
|
56062
|
+
children: t("list.history")
|
|
56063
|
+
}),
|
|
56064
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
56065
|
+
type: "button",
|
|
56066
|
+
className: schedule_module_css_default.action,
|
|
56067
|
+
onClick: () => {
|
|
56068
|
+
trigger(task);
|
|
56069
|
+
},
|
|
56070
|
+
children: t("list.trigger")
|
|
56071
|
+
}),
|
|
56072
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
56073
|
+
type: "button",
|
|
56074
|
+
className: clsx(schedule_module_css_default.action, schedule_module_css_default.actionDanger),
|
|
56075
|
+
onClick: () => {
|
|
56076
|
+
remove(task);
|
|
56077
|
+
},
|
|
56078
|
+
children: confirmDeleteId === task.id ? t("list.confirmDelete") : t("list.delete")
|
|
56079
|
+
})
|
|
56080
|
+
]
|
|
56081
|
+
}), expandedId === task.id && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RunHistory, {
|
|
56082
|
+
taskId: task.id,
|
|
56083
|
+
openSession,
|
|
56084
|
+
t
|
|
56085
|
+
})] }, task.id)),
|
|
56086
|
+
error !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
56087
|
+
role: "alert",
|
|
56088
|
+
className: schedule_module_css_default.error,
|
|
56089
|
+
children: error
|
|
56090
|
+
}),
|
|
56091
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
56092
|
+
variant: "primary",
|
|
56093
|
+
className: schedule_module_css_default.createButton,
|
|
56094
|
+
onClick: () => {
|
|
56095
|
+
setConfirmDeleteId(null);
|
|
56096
|
+
props.onCreate !== void 0 ? props.onCreate() : setView({ mode: "create" });
|
|
56097
|
+
},
|
|
56098
|
+
children: t("list.create")
|
|
56099
|
+
})
|
|
56100
|
+
] });
|
|
56101
|
+
}
|
|
56102
|
+
function RunHistory({ taskId, openSession, t }) {
|
|
56103
|
+
const { state } = useLoadState$1(() => fetchRuns(taskId), [taskId]);
|
|
56104
|
+
if (state.kind !== "ok") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
56105
|
+
className: schedule_module_css_default.runs,
|
|
56106
|
+
children: t("list.loading")
|
|
56107
|
+
});
|
|
56108
|
+
if (state.data.length === 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
56109
|
+
className: schedule_module_css_default.runs,
|
|
56110
|
+
children: t("list.historyEmpty")
|
|
56111
|
+
});
|
|
56112
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
56113
|
+
className: schedule_module_css_default.runs,
|
|
56114
|
+
children: state.data.map((run) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
56115
|
+
className: schedule_module_css_default.runRow,
|
|
56116
|
+
children: [
|
|
56117
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: new Date(run.triggeredAt).toLocaleString() }),
|
|
56118
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Pill, { children: t(RUN_STATUS_KEY[run.status]) }),
|
|
56119
|
+
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"] }),
|
|
56120
|
+
run.error !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
56121
|
+
className: schedule_module_css_default.runError,
|
|
56122
|
+
children: run.error
|
|
56123
|
+
}),
|
|
56124
|
+
run.sessionId !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
56125
|
+
type: "button",
|
|
56126
|
+
className: schedule_module_css_default.action,
|
|
56127
|
+
onClick: () => {
|
|
56128
|
+
openSession(run.sessionId);
|
|
56129
|
+
},
|
|
56130
|
+
children: t("run.openSession")
|
|
56131
|
+
})
|
|
56132
|
+
]
|
|
56133
|
+
}, run.id))
|
|
56134
|
+
});
|
|
56135
|
+
}
|
|
56136
|
+
//#endregion
|
|
56137
|
+
//#region src/client/schedule/entry.tsx
|
|
56138
|
+
const SidebarEntry = createSidebarEntry$1({
|
|
56139
|
+
id: "dsh-agent-toolkit:schedule",
|
|
56140
|
+
order: 2,
|
|
56141
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
56142
|
+
width: "18",
|
|
56143
|
+
height: "18",
|
|
56144
|
+
viewBox: "0 0 16 16",
|
|
56145
|
+
fill: "none",
|
|
56146
|
+
"aria-hidden": "true",
|
|
56147
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
56148
|
+
cx: "8",
|
|
56149
|
+
cy: "8",
|
|
56150
|
+
r: "6.5",
|
|
56151
|
+
stroke: "currentColor"
|
|
56152
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
56153
|
+
d: "M8 4.5V8L10.5 9.5",
|
|
56154
|
+
stroke: "currentColor",
|
|
56155
|
+
strokeLinecap: "round"
|
|
56156
|
+
})]
|
|
56157
|
+
}),
|
|
56158
|
+
title: "定时任务",
|
|
56159
|
+
renderModal: (p) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScheduleModal, { ...p })
|
|
56160
|
+
});
|
|
56161
|
+
function ScheduleEntry(props) {
|
|
56162
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SidebarEntry, {
|
|
56163
|
+
wide: props.wide,
|
|
56164
|
+
t: props.t,
|
|
56165
|
+
openSession: props.openSession,
|
|
56166
|
+
renderForm: props.renderForm
|
|
56167
|
+
});
|
|
56168
|
+
}
|
|
56169
|
+
//#endregion
|
|
56170
|
+
//#region ../../node_modules/.pnpm/croner@10.0.1/node_modules/croner/dist/croner.js
|
|
56171
|
+
function T(s) {
|
|
56172
|
+
return Date.UTC(s.y, s.m - 1, s.d, s.h, s.i, s.s);
|
|
56173
|
+
}
|
|
56174
|
+
function D(s, e) {
|
|
56175
|
+
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;
|
|
56176
|
+
}
|
|
56177
|
+
function A(s, e) {
|
|
56178
|
+
let t = new Date(Date.parse(s));
|
|
56179
|
+
if (isNaN(t)) throw new Error("Invalid ISO8601 passed to timezone parser.");
|
|
56180
|
+
let r = s.substring(9);
|
|
56181
|
+
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);
|
|
56182
|
+
}
|
|
56183
|
+
function v(s, e, t) {
|
|
56184
|
+
return k(A(s, e), t);
|
|
56185
|
+
}
|
|
56186
|
+
function k(s, e) {
|
|
56187
|
+
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);
|
|
56188
|
+
if (D(h, s)) {
|
|
56189
|
+
let u = /* @__PURE__ */ new Date(o.getTime() - 36e5);
|
|
56190
|
+
return D(g(u, s.tz), s) ? u : o;
|
|
56191
|
+
}
|
|
56192
|
+
let l = new Date(o.getTime() + T(s) - T(h));
|
|
56193
|
+
if (D(g(l, s.tz), s)) return l;
|
|
56194
|
+
if (e) throw new Error("Invalid date passed to fromTZ()");
|
|
56195
|
+
return o.getTime() > l.getTime() ? o : l;
|
|
56196
|
+
}
|
|
56197
|
+
function g(s, e) {
|
|
56198
|
+
let t, r;
|
|
56199
|
+
try {
|
|
56200
|
+
t = new Intl.DateTimeFormat("en-US", {
|
|
56201
|
+
timeZone: e,
|
|
56202
|
+
year: "numeric",
|
|
56203
|
+
month: "numeric",
|
|
56204
|
+
day: "numeric",
|
|
56205
|
+
hour: "numeric",
|
|
56206
|
+
minute: "numeric",
|
|
56207
|
+
second: "numeric",
|
|
56208
|
+
hour12: !1
|
|
56209
|
+
}), r = t.formatToParts(s);
|
|
56210
|
+
} catch (i) {
|
|
56211
|
+
let a = i instanceof Error ? i.message : String(i);
|
|
56212
|
+
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}`);
|
|
56213
|
+
}
|
|
56214
|
+
let n = {
|
|
56215
|
+
year: 0,
|
|
56216
|
+
month: 0,
|
|
56217
|
+
day: 0,
|
|
56218
|
+
hour: 0,
|
|
56219
|
+
minute: 0,
|
|
56220
|
+
second: 0
|
|
56221
|
+
};
|
|
56222
|
+
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));
|
|
56223
|
+
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)}`);
|
|
56224
|
+
return n.hour === 24 && (n.hour = 0), {
|
|
56225
|
+
y: n.year,
|
|
56226
|
+
m: n.month,
|
|
56227
|
+
d: n.day,
|
|
56228
|
+
h: n.hour,
|
|
56229
|
+
i: n.minute,
|
|
56230
|
+
s: n.second,
|
|
56231
|
+
tz: e
|
|
56232
|
+
};
|
|
56233
|
+
}
|
|
56234
|
+
function b(s, e, t, r, n, i, a) {
|
|
56235
|
+
return {
|
|
56236
|
+
y: s,
|
|
56237
|
+
m: e,
|
|
56238
|
+
d: t,
|
|
56239
|
+
h: r,
|
|
56240
|
+
i: n,
|
|
56241
|
+
s: i,
|
|
56242
|
+
tz: a
|
|
56243
|
+
};
|
|
56244
|
+
}
|
|
56245
|
+
var O = [
|
|
56246
|
+
1,
|
|
56247
|
+
2,
|
|
56248
|
+
4,
|
|
56249
|
+
8,
|
|
56250
|
+
16
|
|
56251
|
+
];
|
|
56252
|
+
var C = class {
|
|
56253
|
+
pattern;
|
|
56254
|
+
timezone;
|
|
56255
|
+
mode;
|
|
56256
|
+
alternativeWeekdays;
|
|
56257
|
+
sloppyRanges;
|
|
56258
|
+
second;
|
|
56259
|
+
minute;
|
|
56260
|
+
hour;
|
|
56261
|
+
day;
|
|
56262
|
+
month;
|
|
56263
|
+
dayOfWeek;
|
|
56264
|
+
year;
|
|
56265
|
+
lastDayOfMonth;
|
|
56266
|
+
lastWeekday;
|
|
56267
|
+
nearestWeekdays;
|
|
56268
|
+
starDOM;
|
|
56269
|
+
starDOW;
|
|
56270
|
+
starYear;
|
|
56271
|
+
useAndLogic;
|
|
56272
|
+
constructor(e, t, r) {
|
|
56273
|
+
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();
|
|
56274
|
+
}
|
|
56275
|
+
parse() {
|
|
56276
|
+
if (!(typeof this.pattern == "string" || this.pattern instanceof String)) throw new TypeError("CronPattern: Pattern has to be of type string.");
|
|
56277
|
+
this.pattern.indexOf("@") >= 0 && (this.pattern = this.handleNicknames(this.pattern).trim());
|
|
56278
|
+
let e = this.pattern.match(/\S+/g) || [""], t = e.length;
|
|
56279
|
+
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.");
|
|
56280
|
+
if (this.mode !== "auto") {
|
|
56281
|
+
let n;
|
|
56282
|
+
switch (this.mode) {
|
|
56283
|
+
case "5-part":
|
|
56284
|
+
n = 5;
|
|
56285
|
+
break;
|
|
56286
|
+
case "6-part":
|
|
56287
|
+
n = 6;
|
|
56288
|
+
break;
|
|
56289
|
+
case "7-part":
|
|
56290
|
+
n = 7;
|
|
56291
|
+
break;
|
|
56292
|
+
case "5-or-6-parts":
|
|
56293
|
+
n = [5, 6];
|
|
56294
|
+
break;
|
|
56295
|
+
case "6-or-7-parts":
|
|
56296
|
+
n = [6, 7];
|
|
56297
|
+
break;
|
|
56298
|
+
default: n = 0;
|
|
56299
|
+
}
|
|
56300
|
+
if (!(Array.isArray(n) ? n.includes(t) : t === n)) {
|
|
56301
|
+
let a = Array.isArray(n) ? n.join(" or ") : n.toString();
|
|
56302
|
+
throw new TypeError(`CronPattern: mode '${this.mode}' requires exactly ${a} parts, but pattern '${this.pattern}' has ${t} parts.`);
|
|
56303
|
+
}
|
|
56304
|
+
}
|
|
56305
|
+
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.");
|
|
56306
|
+
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) {
|
|
56307
|
+
case "5-part":
|
|
56308
|
+
e[0] = "0", e[6] = "*";
|
|
56309
|
+
break;
|
|
56310
|
+
case "6-part":
|
|
56311
|
+
e[6] = "*";
|
|
56312
|
+
break;
|
|
56313
|
+
case "5-or-6-parts": e[6] = "*";
|
|
56314
|
+
}
|
|
56315
|
+
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);
|
|
56316
|
+
let r = this.alternativeWeekdays ? -1 : 0;
|
|
56317
|
+
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]);
|
|
56318
|
+
}
|
|
56319
|
+
partToArray(e, t, r, n) {
|
|
56320
|
+
let i = this[e], a = e === "day" && this.lastDayOfMonth, o = e === "day" && this.lastWeekday;
|
|
56321
|
+
if (t === "" && !a && !o) throw new TypeError("CronPattern: configuration entry " + e + " (" + t + ") is empty, check for trailing spaces.");
|
|
56322
|
+
if (t === "*") return i.fill(n);
|
|
56323
|
+
let h = t.split(",");
|
|
56324
|
+
if (h.length > 1) for (let l = 0; l < h.length; l++) this.partToArray(e, h[l], r, n);
|
|
56325
|
+
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);
|
|
56326
|
+
}
|
|
56327
|
+
throwAtIllegalCharacters(e) {
|
|
56328
|
+
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.");
|
|
56329
|
+
}
|
|
56330
|
+
handleNumber(e, t, r, n) {
|
|
56331
|
+
let i = this.extractNth(e, t), a = e.toUpperCase().includes("W");
|
|
56332
|
+
if (t !== "day" && a) throw new TypeError("CronPattern: Nearest weekday modifier (W) only allowed in day-of-month.");
|
|
56333
|
+
a && (t = "nearestWeekdays");
|
|
56334
|
+
let o = parseInt(i[0], 10) + r;
|
|
56335
|
+
if (isNaN(o)) throw new TypeError("CronPattern: " + t + " is not a number: '" + e + "'");
|
|
56336
|
+
this.setPart(t, o, i[1] || n);
|
|
56337
|
+
}
|
|
56338
|
+
setPart(e, t, r) {
|
|
56339
|
+
if (!Object.prototype.hasOwnProperty.call(this, e)) throw new TypeError("CronPattern: Invalid part specified: " + e);
|
|
56340
|
+
if (e === "dayOfWeek") {
|
|
56341
|
+
if (t === 7 && (t = 0), t < 0 || t > 6) throw new RangeError("CronPattern: Invalid value for dayOfWeek: " + t);
|
|
56342
|
+
this.setNthWeekdayOfMonth(t, r);
|
|
56343
|
+
return;
|
|
56344
|
+
}
|
|
56345
|
+
if (e === "second" || e === "minute") {
|
|
56346
|
+
if (t < 0 || t >= 60) throw new RangeError("CronPattern: Invalid value for " + e + ": " + t);
|
|
56347
|
+
} else if (e === "hour") {
|
|
56348
|
+
if (t < 0 || t >= 24) throw new RangeError("CronPattern: Invalid value for " + e + ": " + t);
|
|
56349
|
+
} else if (e === "day" || e === "nearestWeekdays") {
|
|
56350
|
+
if (t < 0 || t >= 31) throw new RangeError("CronPattern: Invalid value for " + e + ": " + t);
|
|
56351
|
+
} else if (e === "month") {
|
|
56352
|
+
if (t < 0 || t >= 12) throw new RangeError("CronPattern: Invalid value for " + e + ": " + t);
|
|
56353
|
+
} else if (e === "year" && (t < 1 || t >= 1e4)) throw new RangeError("CronPattern: Invalid value for " + e + ": " + t + " (supported range: 1-9999)");
|
|
56354
|
+
this[e][t] = r;
|
|
56355
|
+
}
|
|
56356
|
+
validateNotNaN(e, t) {
|
|
56357
|
+
if (isNaN(e)) throw new TypeError(t);
|
|
56358
|
+
}
|
|
56359
|
+
validateRange(e, t, r, n, i) {
|
|
56360
|
+
if (e > t) throw new TypeError("CronPattern: From value is larger than to value: '" + i + "'");
|
|
56361
|
+
if (r !== void 0) {
|
|
56362
|
+
if (r === 0) throw new TypeError("CronPattern: Syntax error, illegal stepping: 0");
|
|
56363
|
+
if (r > this[n].length) throw new TypeError("CronPattern: Syntax error, steps cannot be greater than maximum value of part (" + this[n].length + ")");
|
|
56364
|
+
}
|
|
56365
|
+
}
|
|
56366
|
+
handleRangeWithStepping(e, t, r, n) {
|
|
56367
|
+
if (e.toUpperCase().includes("W")) throw new TypeError("CronPattern: Syntax error, W is not allowed in ranges with stepping.");
|
|
56368
|
+
let i = this.extractNth(e, t), a = i[0].match(/^(\d+)-(\d+)\/(\d+)$/);
|
|
56369
|
+
if (a === null) throw new TypeError("CronPattern: Syntax error, illegal range with stepping: '" + e + "'");
|
|
56370
|
+
let [, o, h, l] = a, y = parseInt(o, 10) + r, u = parseInt(h, 10) + r, d = parseInt(l, 10);
|
|
56371
|
+
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);
|
|
56372
|
+
for (let c = y; c <= u; c += d) this.setPart(t, c, i[1] || n);
|
|
56373
|
+
}
|
|
56374
|
+
extractNth(e, t) {
|
|
56375
|
+
let r = e, n;
|
|
56376
|
+
if (r.includes("#")) {
|
|
56377
|
+
if (t !== "dayOfWeek") throw new Error("CronPattern: nth (#) only allowed in day-of-week field");
|
|
56378
|
+
n = r.split("#")[1], r = r.split("#")[0];
|
|
56379
|
+
} else if (r.toUpperCase().endsWith("L")) {
|
|
56380
|
+
if (t !== "dayOfWeek") throw new Error("CronPattern: L modifier only allowed in day-of-week field (use L alone for day-of-month)");
|
|
56381
|
+
n = "L", r = r.slice(0, -1);
|
|
56382
|
+
}
|
|
56383
|
+
return [r, n];
|
|
56384
|
+
}
|
|
56385
|
+
handleRange(e, t, r, n) {
|
|
56386
|
+
if (e.toUpperCase().includes("W")) throw new TypeError("CronPattern: Syntax error, W is not allowed in a range.");
|
|
56387
|
+
let i = this.extractNth(e, t), a = i[0].split("-");
|
|
56388
|
+
if (a.length !== 2) throw new TypeError("CronPattern: Syntax error, illegal range: '" + e + "'");
|
|
56389
|
+
let o = parseInt(a[0], 10) + r, h = parseInt(a[1], 10) + r;
|
|
56390
|
+
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);
|
|
56391
|
+
for (let l = o; l <= h; l++) this.setPart(t, l, i[1] || n);
|
|
56392
|
+
}
|
|
56393
|
+
handleStepping(e, t, r, n) {
|
|
56394
|
+
if (e.toUpperCase().includes("W")) throw new TypeError("CronPattern: Syntax error, W is not allowed in parts with stepping.");
|
|
56395
|
+
let i = this.extractNth(e, t), a = i[0].split("/");
|
|
56396
|
+
if (a.length !== 2) throw new TypeError("CronPattern: Syntax error, illegal stepping: '" + e + "'");
|
|
56397
|
+
if (this.sloppyRanges) a[0] === "" && (a[0] = "*");
|
|
56398
|
+
else {
|
|
56399
|
+
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.");
|
|
56400
|
+
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.");
|
|
56401
|
+
}
|
|
56402
|
+
let o = 0;
|
|
56403
|
+
a[0] !== "*" && (o = parseInt(a[0], 10) + r);
|
|
56404
|
+
let h = parseInt(a[1], 10);
|
|
56405
|
+
this.validateNotNaN(h, "CronPattern: Syntax error, illegal stepping: (NaN)"), this.validateRange(0, this[t].length - 1, h, t, e);
|
|
56406
|
+
for (let l = o; l < this[t].length; l += h) this.setPart(t, l, i[1] || n);
|
|
56407
|
+
}
|
|
56408
|
+
replaceAlphaDays(e) {
|
|
56409
|
+
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");
|
|
56410
|
+
}
|
|
56411
|
+
replaceAlphaDaysQuartz(e) {
|
|
56412
|
+
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");
|
|
56413
|
+
}
|
|
56414
|
+
replaceAlphaMonths(e) {
|
|
56415
|
+
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");
|
|
56416
|
+
}
|
|
56417
|
+
handleNicknames(e) {
|
|
56418
|
+
let t = e.trim().toLowerCase();
|
|
56419
|
+
if (t === "@yearly" || t === "@annually") return "0 0 1 1 *";
|
|
56420
|
+
if (t === "@monthly") return "0 0 1 * *";
|
|
56421
|
+
if (t === "@weekly") return "0 0 * * 0";
|
|
56422
|
+
if (t === "@daily" || t === "@midnight") return "0 0 * * *";
|
|
56423
|
+
if (t === "@hourly") return "0 * * * *";
|
|
56424
|
+
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.");
|
|
56425
|
+
return e;
|
|
56426
|
+
}
|
|
56427
|
+
setNthWeekdayOfMonth(e, t) {
|
|
56428
|
+
if (typeof t != "number" && t.toUpperCase() === "L") this.dayOfWeek[e] = this.dayOfWeek[e] | 32;
|
|
56429
|
+
else if (t === 63) this.dayOfWeek[e] = 63;
|
|
56430
|
+
else if (t < 6 && t > 0) this.dayOfWeek[e] = this.dayOfWeek[e] | O[t - 1];
|
|
56431
|
+
else throw new TypeError(`CronPattern: nth weekday out of range, should be 1-5 or L. Value: ${t}, Type: ${typeof t}`);
|
|
56432
|
+
}
|
|
56433
|
+
};
|
|
56434
|
+
var P = [
|
|
56435
|
+
31,
|
|
56436
|
+
28,
|
|
56437
|
+
31,
|
|
56438
|
+
30,
|
|
56439
|
+
31,
|
|
56440
|
+
30,
|
|
56441
|
+
31,
|
|
56442
|
+
31,
|
|
56443
|
+
30,
|
|
56444
|
+
31,
|
|
56445
|
+
30,
|
|
56446
|
+
31
|
|
56447
|
+
];
|
|
56448
|
+
var f = [
|
|
56449
|
+
[
|
|
56450
|
+
"month",
|
|
56451
|
+
"year",
|
|
56452
|
+
0
|
|
56453
|
+
],
|
|
56454
|
+
[
|
|
56455
|
+
"day",
|
|
56456
|
+
"month",
|
|
56457
|
+
-1
|
|
56458
|
+
],
|
|
56459
|
+
[
|
|
56460
|
+
"hour",
|
|
56461
|
+
"day",
|
|
56462
|
+
0
|
|
56463
|
+
],
|
|
56464
|
+
[
|
|
56465
|
+
"minute",
|
|
56466
|
+
"hour",
|
|
56467
|
+
0
|
|
56468
|
+
],
|
|
56469
|
+
[
|
|
56470
|
+
"second",
|
|
56471
|
+
"minute",
|
|
56472
|
+
0
|
|
56473
|
+
]
|
|
56474
|
+
];
|
|
56475
|
+
var m = class s {
|
|
56476
|
+
tz;
|
|
56477
|
+
ms;
|
|
56478
|
+
second;
|
|
56479
|
+
minute;
|
|
56480
|
+
hour;
|
|
56481
|
+
day;
|
|
56482
|
+
month;
|
|
56483
|
+
year;
|
|
56484
|
+
constructor(e, t) {
|
|
56485
|
+
if (this.tz = t, e && e instanceof Date) if (!isNaN(e)) this.fromDate(e);
|
|
56486
|
+
else throw new TypeError("CronDate: Invalid date passed to CronDate constructor");
|
|
56487
|
+
else if (e == null) this.fromDate(/* @__PURE__ */ new Date());
|
|
56488
|
+
else if (e && typeof e == "string") this.fromString(e);
|
|
56489
|
+
else if (e instanceof s) this.fromCronDate(e);
|
|
56490
|
+
else throw new TypeError("CronDate: Invalid type (" + typeof e + ") passed to CronDate constructor");
|
|
56491
|
+
}
|
|
56492
|
+
getLastDayOfMonth(e, t) {
|
|
56493
|
+
return t !== 1 ? P[t] : new Date(Date.UTC(e, t + 1, 0)).getUTCDate();
|
|
56494
|
+
}
|
|
56495
|
+
getLastWeekday(e, t) {
|
|
56496
|
+
let r = this.getLastDayOfMonth(e, t), i = new Date(Date.UTC(e, t, r)).getUTCDay();
|
|
56497
|
+
return i === 0 ? r - 2 : i === 6 ? r - 1 : r;
|
|
56498
|
+
}
|
|
56499
|
+
getNearestWeekday(e, t, r) {
|
|
56500
|
+
let n = this.getLastDayOfMonth(e, t);
|
|
56501
|
+
if (r > n) return -1;
|
|
56502
|
+
let a = new Date(Date.UTC(e, t, r)).getUTCDay();
|
|
56503
|
+
return a === 0 ? r === n ? r - 2 : r + 1 : a === 6 ? r === 1 ? r + 2 : r - 1 : r;
|
|
56504
|
+
}
|
|
56505
|
+
isNthWeekdayOfMonth(e, t, r, n) {
|
|
56506
|
+
let a = new Date(Date.UTC(e, t, r)).getUTCDay(), o = 0;
|
|
56507
|
+
for (let h = 1; h <= r; h++) new Date(Date.UTC(e, t, h)).getUTCDay() === a && o++;
|
|
56508
|
+
if (n & 63 && O[o - 1] & n) return !0;
|
|
56509
|
+
if (n & 32) {
|
|
56510
|
+
let h = this.getLastDayOfMonth(e, t);
|
|
56511
|
+
for (let l = r + 1; l <= h; l++) if (new Date(Date.UTC(e, t, l)).getUTCDay() === a) return !1;
|
|
56512
|
+
return !0;
|
|
56513
|
+
}
|
|
56514
|
+
return !1;
|
|
56515
|
+
}
|
|
56516
|
+
fromDate(e) {
|
|
56517
|
+
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();
|
|
56518
|
+
else try {
|
|
56519
|
+
let t = g(e, this.tz);
|
|
56520
|
+
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;
|
|
56521
|
+
} catch (t) {
|
|
56522
|
+
let r = t instanceof Error ? t.message : String(t);
|
|
56523
|
+
throw new TypeError(`CronDate: Failed to convert date to timezone '${this.tz}'. This may happen with invalid timezone names or dates. Original error: ${r}`);
|
|
56524
|
+
}
|
|
56525
|
+
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();
|
|
56526
|
+
}
|
|
56527
|
+
fromCronDate(e) {
|
|
56528
|
+
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;
|
|
56529
|
+
}
|
|
56530
|
+
apply() {
|
|
56531
|
+
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) {
|
|
56532
|
+
let e = new Date(Date.UTC(this.year, this.month, this.day, this.hour, this.minute, this.second, this.ms));
|
|
56533
|
+
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;
|
|
56534
|
+
} else return !1;
|
|
56535
|
+
}
|
|
56536
|
+
fromString(e) {
|
|
56537
|
+
if (typeof this.tz == "number") {
|
|
56538
|
+
let t = v(e);
|
|
56539
|
+
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();
|
|
56540
|
+
} else return this.fromDate(v(e, this.tz));
|
|
56541
|
+
}
|
|
56542
|
+
findNext(e, t, r, n) {
|
|
56543
|
+
return this._findMatch(e, t, r, n, 1);
|
|
56544
|
+
}
|
|
56545
|
+
_findMatch(e, t, r, n, i) {
|
|
56546
|
+
let a = this[t], o;
|
|
56547
|
+
r.lastDayOfMonth && (o = this.getLastDayOfMonth(this.year, this.month));
|
|
56548
|
+
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;
|
|
56549
|
+
for (let u = l; y(u); u += i) {
|
|
56550
|
+
let d = r[t][u];
|
|
56551
|
+
if (t === "day" && !d) {
|
|
56552
|
+
for (let c = 0; c < r.nearestWeekdays.length; c++) if (r.nearestWeekdays[c]) {
|
|
56553
|
+
let M = this.getNearestWeekday(this.year, this.month, c - n);
|
|
56554
|
+
if (M === -1) continue;
|
|
56555
|
+
if (M === u - n) {
|
|
56556
|
+
d = 1;
|
|
56557
|
+
break;
|
|
56558
|
+
}
|
|
56559
|
+
}
|
|
56560
|
+
}
|
|
56561
|
+
if (t === "day" && r.lastWeekday) {
|
|
56562
|
+
let c = this.getLastWeekday(this.year, this.month);
|
|
56563
|
+
u - n === c && (d = 1);
|
|
56564
|
+
}
|
|
56565
|
+
if (t === "day" && r.lastDayOfMonth && u - n == o && (d = 1), t === "day" && !r.starDOW) {
|
|
56566
|
+
let c = r.dayOfWeek[(h + (u - n - 1)) % 7];
|
|
56567
|
+
if (c && c & 63) c = this.isNthWeekdayOfMonth(this.year, this.month, u - n, c) ? 1 : 0;
|
|
56568
|
+
else if (c) throw new Error(`CronDate: Invalid value for dayOfWeek encountered. ${c}`);
|
|
56569
|
+
r.useAndLogic ? d = d && c : !e.domAndDow && !r.starDOM ? d = d || c : d = d && c;
|
|
56570
|
+
}
|
|
56571
|
+
if (d) return this[t] = u - n, a !== this[t] ? 2 : 1;
|
|
56572
|
+
}
|
|
56573
|
+
return 3;
|
|
56574
|
+
}
|
|
56575
|
+
recurse(e, t, r) {
|
|
56576
|
+
if (r === 0 && !e.starYear) {
|
|
56577
|
+
if (this.year >= 0 && this.year < e.year.length && e.year[this.year] === 0) {
|
|
56578
|
+
let i = -1;
|
|
56579
|
+
for (let a = this.year + 1; a < e.year.length && a < 1e4; a++) if (e.year[a] === 1) {
|
|
56580
|
+
i = a;
|
|
56581
|
+
break;
|
|
56582
|
+
}
|
|
56583
|
+
if (i === -1) return null;
|
|
56584
|
+
this.year = i, this.month = 0, this.day = 1, this.hour = 0, this.minute = 0, this.second = 0, this.ms = 0;
|
|
56585
|
+
}
|
|
56586
|
+
if (this.year >= 1e4) return null;
|
|
56587
|
+
}
|
|
56588
|
+
let n = this.findNext(t, f[r][0], e, f[r][2]);
|
|
56589
|
+
if (n > 1) {
|
|
56590
|
+
let i = r + 1;
|
|
56591
|
+
for (; i < f.length;) this[f[i][0]] = -f[i][2], i++;
|
|
56592
|
+
if (n === 3) {
|
|
56593
|
+
if (this[f[r][1]]++, this[f[r][0]] = -f[r][2], this.apply(), r === 0 && !e.starYear) {
|
|
56594
|
+
for (; this.year >= 0 && this.year < e.year.length && e.year[this.year] === 0 && this.year < 1e4;) this.year++;
|
|
56595
|
+
if (this.year >= 1e4 || this.year >= e.year.length) return null;
|
|
56596
|
+
}
|
|
56597
|
+
return this.recurse(e, t, 0);
|
|
56598
|
+
} else if (this.apply()) return this.recurse(e, t, r - 1);
|
|
56599
|
+
}
|
|
56600
|
+
return r += 1, r >= f.length ? this : (e.starYear ? this.year >= 3e3 : this.year >= 1e4) ? null : this.recurse(e, t, r);
|
|
56601
|
+
}
|
|
56602
|
+
increment(e, t, r) {
|
|
56603
|
+
return this.second += t.interval !== void 0 && t.interval > 1 && r ? t.interval : 1, this.ms = 0, this.apply(), this.recurse(e, t, 0);
|
|
56604
|
+
}
|
|
56605
|
+
decrement(e, t) {
|
|
56606
|
+
return this.second -= t.interval !== void 0 && t.interval > 1 ? t.interval : 1, this.ms = 0, this.apply(), this.recurseBackward(e, t, 0, 0);
|
|
56607
|
+
}
|
|
56608
|
+
recurseBackward(e, t, r, n = 0) {
|
|
56609
|
+
if (n > 1e4) return null;
|
|
56610
|
+
if (r === 0 && !e.starYear) {
|
|
56611
|
+
if (this.year >= 0 && this.year < e.year.length && e.year[this.year] === 0) {
|
|
56612
|
+
let a = -1;
|
|
56613
|
+
for (let o = this.year - 1; o >= 0; o--) if (e.year[o] === 1) {
|
|
56614
|
+
a = o;
|
|
56615
|
+
break;
|
|
56616
|
+
}
|
|
56617
|
+
if (a === -1) return null;
|
|
56618
|
+
this.year = a, this.month = 11, this.day = 31, this.hour = 23, this.minute = 59, this.second = 59, this.ms = 0;
|
|
56619
|
+
}
|
|
56620
|
+
if (this.year < 0) return null;
|
|
56621
|
+
}
|
|
56622
|
+
let i = this.findPrevious(t, f[r][0], e, f[r][2]);
|
|
56623
|
+
if (i > 1) {
|
|
56624
|
+
let a = r + 1;
|
|
56625
|
+
for (; a < f.length;) {
|
|
56626
|
+
let o = f[a][0], h = f[a][2], l = this.getMaxPatternValue(o, e, h);
|
|
56627
|
+
this[o] = l, a++;
|
|
56628
|
+
}
|
|
56629
|
+
if (i === 3) {
|
|
56630
|
+
if (this[f[r][1]]--, r === 0) {
|
|
56631
|
+
let y = this.getLastDayOfMonth(this.year, this.month);
|
|
56632
|
+
this.day > y && (this.day = y);
|
|
56633
|
+
}
|
|
56634
|
+
if (r === 1) if (this.day <= 0) this.day = 1;
|
|
56635
|
+
else {
|
|
56636
|
+
let y = this.year, u = this.month;
|
|
56637
|
+
for (; u < 0;) u += 12, y--;
|
|
56638
|
+
for (; u > 11;) u -= 12, y++;
|
|
56639
|
+
let d = u !== 1 ? P[u] : new Date(Date.UTC(y, u + 1, 0)).getUTCDate();
|
|
56640
|
+
this.day > d && (this.day = d);
|
|
56641
|
+
}
|
|
56642
|
+
this.apply();
|
|
56643
|
+
let o = f[r][0], h = f[r][2], l = this.getMaxPatternValue(o, e, h);
|
|
56644
|
+
if (o === "day") {
|
|
56645
|
+
let y = this.getLastDayOfMonth(this.year, this.month);
|
|
56646
|
+
this[o] = Math.min(l, y);
|
|
56647
|
+
} else this[o] = l;
|
|
56648
|
+
if (this.apply(), r === 0) {
|
|
56649
|
+
let y = f[1][2], u = this.getMaxPatternValue("day", e, y), d = this.getLastDayOfMonth(this.year, this.month), c = Math.min(u, d);
|
|
56650
|
+
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]));
|
|
56651
|
+
}
|
|
56652
|
+
if (r === 0 && !e.starYear) {
|
|
56653
|
+
for (; this.year >= 0 && this.year < e.year.length && e.year[this.year] === 0;) this.year--;
|
|
56654
|
+
if (this.year < 0) return null;
|
|
56655
|
+
}
|
|
56656
|
+
return this.recurseBackward(e, t, 0, n + 1);
|
|
56657
|
+
} else if (this.apply()) return this.recurseBackward(e, t, r - 1, n + 1);
|
|
56658
|
+
}
|
|
56659
|
+
return r += 1, r >= f.length ? this : this.year < 0 ? null : this.recurseBackward(e, t, r, n + 1);
|
|
56660
|
+
}
|
|
56661
|
+
getMaxPatternValue(e, t, r) {
|
|
56662
|
+
if (e === "day" && t.lastDayOfMonth) return this.getLastDayOfMonth(this.year, this.month);
|
|
56663
|
+
if (e === "day" && !t.starDOW) return this.getLastDayOfMonth(this.year, this.month);
|
|
56664
|
+
for (let n = t[e].length - 1; n >= 0; n--) if (t[e][n]) return n - r;
|
|
56665
|
+
return t[e].length - 1 - r;
|
|
56666
|
+
}
|
|
56667
|
+
findPrevious(e, t, r, n) {
|
|
56668
|
+
return this._findMatch(e, t, r, n, -1);
|
|
56669
|
+
}
|
|
56670
|
+
getDate(e) {
|
|
56671
|
+
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);
|
|
56672
|
+
}
|
|
56673
|
+
getTime() {
|
|
56674
|
+
return this.getDate(!1).getTime();
|
|
56675
|
+
}
|
|
56676
|
+
match(e, t) {
|
|
56677
|
+
if (!e.starYear && (this.year < 0 || this.year >= e.year.length || e.year[this.year] === 0)) return !1;
|
|
56678
|
+
for (let r = 0; r < f.length; r++) {
|
|
56679
|
+
let n = f[r][0], i = f[r][2], a = this[n];
|
|
56680
|
+
if (a + i < 0 || a + i >= e[n].length) return !1;
|
|
56681
|
+
let o = e[n][a + i];
|
|
56682
|
+
if (n === "day") {
|
|
56683
|
+
if (!o) {
|
|
56684
|
+
for (let h = 0; h < e.nearestWeekdays.length; h++) if (e.nearestWeekdays[h]) {
|
|
56685
|
+
let l = this.getNearestWeekday(this.year, this.month, h - i);
|
|
56686
|
+
if (l !== -1 && l === a) {
|
|
56687
|
+
o = 1;
|
|
56688
|
+
break;
|
|
56689
|
+
}
|
|
56690
|
+
}
|
|
56691
|
+
}
|
|
56692
|
+
if (e.lastWeekday) a === this.getLastWeekday(this.year, this.month) && (o = 1);
|
|
56693
|
+
if (e.lastDayOfMonth) a === this.getLastDayOfMonth(this.year, this.month) && (o = 1);
|
|
56694
|
+
if (!e.starDOW) {
|
|
56695
|
+
let h = new Date(Date.UTC(this.year, this.month, 1, 0, 0, 0, 0)).getUTCDay(), l = e.dayOfWeek[(h + (a - 1)) % 7];
|
|
56696
|
+
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;
|
|
56697
|
+
}
|
|
56698
|
+
}
|
|
56699
|
+
if (!o) return !1;
|
|
56700
|
+
}
|
|
56701
|
+
return !0;
|
|
56702
|
+
}
|
|
56703
|
+
};
|
|
56704
|
+
function R(s) {
|
|
56705
|
+
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, ![
|
|
56706
|
+
"auto",
|
|
56707
|
+
"5-part",
|
|
56708
|
+
"6-part",
|
|
56709
|
+
"7-part",
|
|
56710
|
+
"5-or-6-parts",
|
|
56711
|
+
"6-or-7-parts"
|
|
56712
|
+
].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'.");
|
|
56713
|
+
if (s.startAt && (s.startAt = new m(s.startAt, s.timezone)), s.stopAt && (s.stopAt = new m(s.stopAt, s.timezone)), s.interval !== null) {
|
|
56714
|
+
if (isNaN(s.interval)) throw new Error("CronOptions: Supplied value for interval is not a number");
|
|
56715
|
+
if (s.interval < 0) throw new Error("CronOptions: Supplied value for interval can not be negative");
|
|
56716
|
+
}
|
|
56717
|
+
if (s.utcOffset !== void 0) {
|
|
56718
|
+
if (isNaN(s.utcOffset)) throw new Error("CronOptions: Invalid value passed for utcOffset, should be number representing minutes offset from UTC.");
|
|
56719
|
+
if (s.utcOffset < -870 || s.utcOffset > 870) throw new Error("CronOptions: utcOffset out of bounds.");
|
|
56720
|
+
if (s.utcOffset !== void 0 && s.timezone) throw new Error("CronOptions: Combining 'utcOffset' with 'timezone' is not allowed.");
|
|
56721
|
+
}
|
|
56722
|
+
if (s.unref !== !0 && s.unref !== !1) throw new Error("CronOptions: Unref should be either true, false or undefined(false).");
|
|
56723
|
+
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.");
|
|
56724
|
+
return s;
|
|
56725
|
+
}
|
|
56726
|
+
function p(s) {
|
|
56727
|
+
return Object.prototype.toString.call(s) === "[object Function]" || typeof s == "function" || s instanceof Function;
|
|
56728
|
+
}
|
|
56729
|
+
function _(s) {
|
|
56730
|
+
return p(s);
|
|
56731
|
+
}
|
|
56732
|
+
function x(s) {
|
|
56733
|
+
typeof Deno < "u" && typeof Deno.unrefTimer < "u" ? Deno.unrefTimer(s) : s && typeof s.unref < "u" && s.unref();
|
|
56734
|
+
}
|
|
56735
|
+
var W = 3e4;
|
|
56736
|
+
var w = [];
|
|
56737
|
+
var E = class {
|
|
56738
|
+
name;
|
|
56739
|
+
options;
|
|
56740
|
+
_states;
|
|
56741
|
+
fn;
|
|
56742
|
+
getTz() {
|
|
56743
|
+
return this.options.timezone || this.options.utcOffset;
|
|
56744
|
+
}
|
|
56745
|
+
applyDayOffset(e) {
|
|
56746
|
+
if (this.options.dayOffset !== void 0 && this.options.dayOffset !== 0) {
|
|
56747
|
+
let t = this.options.dayOffset * 24 * 60 * 60 * 1e3;
|
|
56748
|
+
return new Date(e.getTime() + t);
|
|
56749
|
+
}
|
|
56750
|
+
return e;
|
|
56751
|
+
}
|
|
56752
|
+
constructor(e, t, r) {
|
|
56753
|
+
let n, i;
|
|
56754
|
+
if (p(t)) i = t;
|
|
56755
|
+
else if (typeof t == "object") n = t;
|
|
56756
|
+
else if (t !== void 0) throw new Error("Cron: Invalid argument passed for optionsIn. Should be one of function, or object (options).");
|
|
56757
|
+
if (p(r)) i = r;
|
|
56758
|
+
else if (typeof r == "object") n = r;
|
|
56759
|
+
else if (r !== void 0) throw new Error("Cron: Invalid argument passed for funcIn. Should be one of function, or object (options).");
|
|
56760
|
+
if (this.name = n?.name, this.options = R(n), this._states = {
|
|
56761
|
+
kill: !1,
|
|
56762
|
+
blocking: !1,
|
|
56763
|
+
previousRun: void 0,
|
|
56764
|
+
currentRun: void 0,
|
|
56765
|
+
once: void 0,
|
|
56766
|
+
currentTimeout: void 0,
|
|
56767
|
+
maxRuns: n ? n.maxRuns : void 0,
|
|
56768
|
+
paused: n ? n.paused : !1,
|
|
56769
|
+
pattern: new C("* * * * *", void 0, { mode: "auto" })
|
|
56770
|
+
}, 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, {
|
|
56771
|
+
mode: this.options.mode,
|
|
56772
|
+
alternativeWeekdays: this.options.alternativeWeekdays,
|
|
56773
|
+
sloppyRanges: this.options.sloppyRanges
|
|
56774
|
+
}), this.name) {
|
|
56775
|
+
if (w.find((o) => o.name === this.name)) throw new Error("Cron: Tried to initialize new named job '" + this.name + "', but name already taken.");
|
|
56776
|
+
w.push(this);
|
|
56777
|
+
}
|
|
56778
|
+
return i !== void 0 && _(i) && (this.fn = i, this.schedule()), this;
|
|
56779
|
+
}
|
|
56780
|
+
nextRun(e) {
|
|
56781
|
+
let t = this._next(e);
|
|
56782
|
+
return t ? this.applyDayOffset(t.getDate(!1)) : null;
|
|
56783
|
+
}
|
|
56784
|
+
nextRuns(e, t) {
|
|
56785
|
+
this._states.maxRuns !== void 0 && e > this._states.maxRuns && (e = this._states.maxRuns);
|
|
56786
|
+
let r = t || this._states.currentRun || void 0;
|
|
56787
|
+
return this._enumerateRuns(e, r, "next");
|
|
56788
|
+
}
|
|
56789
|
+
previousRuns(e, t) {
|
|
56790
|
+
return this._enumerateRuns(e, t || void 0, "previous");
|
|
56791
|
+
}
|
|
56792
|
+
_enumerateRuns(e, t, r) {
|
|
56793
|
+
let n = [], i = t ? new m(t, this.getTz()) : null, a = r === "next" ? this._next : this._previous;
|
|
56794
|
+
for (; e--;) {
|
|
56795
|
+
let o = a.call(this, i);
|
|
56796
|
+
if (!o) break;
|
|
56797
|
+
let h = o.getDate(!1);
|
|
56798
|
+
n.push(this.applyDayOffset(h)), i = o;
|
|
56799
|
+
}
|
|
56800
|
+
return n;
|
|
56801
|
+
}
|
|
56802
|
+
match(e) {
|
|
56803
|
+
if (this._states.once) {
|
|
56804
|
+
let r = new m(e, this.getTz());
|
|
56805
|
+
r.ms = 0;
|
|
56806
|
+
let n = new m(this._states.once, this.getTz());
|
|
56807
|
+
return n.ms = 0, r.getTime() === n.getTime();
|
|
56808
|
+
}
|
|
56809
|
+
let t = new m(e, this.getTz());
|
|
56810
|
+
return t.ms = 0, t.match(this._states.pattern, this.options);
|
|
56811
|
+
}
|
|
56812
|
+
getPattern() {
|
|
56813
|
+
if (!this._states.once) return this._states.pattern ? this._states.pattern.pattern : void 0;
|
|
56814
|
+
}
|
|
56815
|
+
getOnce() {
|
|
56816
|
+
return this._states.once ? this._states.once.getDate() : null;
|
|
56817
|
+
}
|
|
56818
|
+
isRunning() {
|
|
56819
|
+
let e = this.nextRun(this._states.currentRun), t = !this._states.paused, r = this.fn !== void 0, n = !this._states.kill;
|
|
56820
|
+
return t && r && n && e !== null;
|
|
56821
|
+
}
|
|
56822
|
+
isStopped() {
|
|
56823
|
+
return this._states.kill;
|
|
56824
|
+
}
|
|
56825
|
+
isBusy() {
|
|
56826
|
+
return this._states.blocking;
|
|
56827
|
+
}
|
|
56828
|
+
currentRun() {
|
|
56829
|
+
return this._states.currentRun ? this._states.currentRun.getDate() : null;
|
|
56830
|
+
}
|
|
56831
|
+
previousRun() {
|
|
56832
|
+
return this._states.previousRun ? this._states.previousRun.getDate() : null;
|
|
56833
|
+
}
|
|
56834
|
+
msToNext(e) {
|
|
56835
|
+
let t = this._next(e);
|
|
56836
|
+
return t ? e instanceof m || e instanceof Date ? t.getTime() - e.getTime() : t.getTime() - new m(e).getTime() : null;
|
|
56837
|
+
}
|
|
56838
|
+
stop() {
|
|
56839
|
+
this._states.kill = !0, this._states.currentTimeout && clearTimeout(this._states.currentTimeout);
|
|
56840
|
+
let e = w.indexOf(this);
|
|
56841
|
+
e >= 0 && w.splice(e, 1);
|
|
56842
|
+
}
|
|
56843
|
+
pause() {
|
|
56844
|
+
return this._states.paused = !0, !this._states.kill;
|
|
56845
|
+
}
|
|
56846
|
+
resume() {
|
|
56847
|
+
return this._states.paused = !1, !this._states.kill;
|
|
56848
|
+
}
|
|
56849
|
+
schedule(e) {
|
|
56850
|
+
if (e && this.fn) throw new Error("Cron: It is not allowed to schedule two functions using the same Croner instance.");
|
|
56851
|
+
e && (this.fn = e);
|
|
56852
|
+
let t = this.msToNext(), r = this.nextRun(this._states.currentRun);
|
|
56853
|
+
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);
|
|
56854
|
+
}
|
|
56855
|
+
async _trigger(e) {
|
|
56856
|
+
this._states.blocking = !0, this._states.currentRun = new m(void 0, this.getTz());
|
|
56857
|
+
try {
|
|
56858
|
+
if (this.options.catch) try {
|
|
56859
|
+
this.fn !== void 0 && await this.fn(this, this.options.context);
|
|
56860
|
+
} catch (t) {
|
|
56861
|
+
if (p(this.options.catch)) try {
|
|
56862
|
+
this.options.catch(t, this);
|
|
56863
|
+
} catch {}
|
|
56864
|
+
}
|
|
56865
|
+
else this.fn !== void 0 && await this.fn(this, this.options.context);
|
|
56866
|
+
} finally {
|
|
56867
|
+
this._states.previousRun = new m(e, this.getTz()), this._states.blocking = !1;
|
|
56868
|
+
}
|
|
56869
|
+
}
|
|
56870
|
+
async trigger() {
|
|
56871
|
+
await this._trigger();
|
|
56872
|
+
}
|
|
56873
|
+
runsLeft() {
|
|
56874
|
+
return this._states.maxRuns;
|
|
56875
|
+
}
|
|
56876
|
+
_checkTrigger(e) {
|
|
56877
|
+
let t = /* @__PURE__ */ new Date(), r = !this._states.paused && t.getTime() >= e.getTime(), n = this._states.blocking && this.options.protect;
|
|
56878
|
+
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();
|
|
56879
|
+
}
|
|
56880
|
+
_next(e) {
|
|
56881
|
+
let t = !!(e || this._states.currentRun), r = !1;
|
|
56882
|
+
!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);
|
|
56883
|
+
let n = this._states.once || new m(e, this.getTz());
|
|
56884
|
+
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;
|
|
56885
|
+
}
|
|
56886
|
+
_previous(e) {
|
|
56887
|
+
let t = new m(e, this.getTz());
|
|
56888
|
+
this.options.stopAt && t.getTime() > this.options.stopAt.getTime() && (t = this.options.stopAt);
|
|
56889
|
+
let r = new m(t, this.getTz());
|
|
56890
|
+
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);
|
|
56891
|
+
}
|
|
56892
|
+
_calculatePreviousRun(e, t) {
|
|
56893
|
+
let r = new m(void 0, this.getTz()), n = e;
|
|
56894
|
+
if (this.options.startAt.getTime() <= r.getTime()) {
|
|
56895
|
+
n = this.options.startAt;
|
|
56896
|
+
let i = n.getTime() + this.options.interval * 1e3;
|
|
56897
|
+
for (; i <= r.getTime();) n = new m(n, this.getTz()).increment(this._states.pattern, this.options, !0), i = n.getTime() + this.options.interval * 1e3;
|
|
56898
|
+
t = !0;
|
|
56899
|
+
}
|
|
56900
|
+
return n === null && (n = void 0), [n, t];
|
|
56901
|
+
}
|
|
56902
|
+
};
|
|
56903
|
+
//#endregion
|
|
56904
|
+
//#region src/client/schedule/TaskForm.tsx
|
|
56905
|
+
/** 定时任务创建/编辑表单:名称/提示词/项目下拉/目标 radio/调度三选一(cron 预览经内联 croner 计算)/catchup/enabled。 */
|
|
56906
|
+
/** cron 未来 3 次触发预览(内联 croner;非法表达式返回空数组)。 */
|
|
56907
|
+
function previewCron(expr, timeZone) {
|
|
56908
|
+
if (expr.trim().split(/\s+/).length !== 5) return [];
|
|
56909
|
+
try {
|
|
56910
|
+
return new E(expr, {
|
|
56911
|
+
paused: true,
|
|
56912
|
+
...timeZone !== "" ? { timezone: timeZone } : {}
|
|
56913
|
+
}).nextRuns(3).map((d) => d.getTime());
|
|
56914
|
+
} catch {
|
|
56915
|
+
return [];
|
|
56916
|
+
}
|
|
56917
|
+
}
|
|
56918
|
+
function TaskForm({ draft, t, onSaved, onCancel }) {
|
|
56919
|
+
const [name, setName] = (0, react.useState)(draft?.name ?? "");
|
|
56920
|
+
const [prompt, setPrompt] = (0, react.useState)(draft?.prompt ?? "");
|
|
56921
|
+
const [cwd, setCwd] = (0, react.useState)(draft?.cwd ?? "");
|
|
56922
|
+
const [targetKind, setTargetKind] = (0, react.useState)(draft?.target.kind ?? "main");
|
|
56923
|
+
const [roleId, setRoleId] = (0, react.useState)(draft?.target.kind === "role" ? draft.target.roleId : "");
|
|
56924
|
+
const [scheduleKind, setScheduleKind] = (0, react.useState)(draft?.schedule.kind ?? "cron");
|
|
56925
|
+
const [cronExpr, setCronExpr] = (0, react.useState)(draft?.schedule.kind === "cron" ? draft.schedule.expr : "0 9 * * *");
|
|
56926
|
+
const [timeZone, setTimeZone] = (0, react.useState)(draft?.schedule.kind === "cron" ? draft.schedule.timeZone ?? "" : "");
|
|
56927
|
+
const [atTime, setAtTime] = (0, react.useState)(draft?.schedule.kind === "at" ? draft.schedule.at.slice(0, 16) : "");
|
|
56928
|
+
const [everySeconds, setEverySeconds] = (0, react.useState)(draft?.schedule.kind === "every" ? String(draft.schedule.seconds) : "3600");
|
|
56929
|
+
const [catchup, setCatchup] = (0, react.useState)(draft?.catchup ?? true);
|
|
56930
|
+
const [enabled, setEnabled] = (0, react.useState)(draft?.enabled ?? true);
|
|
56931
|
+
const [error, setError] = (0, react.useState)(null);
|
|
56932
|
+
const { state: projectsState } = useLoadState$1(() => fetchProjects(), []);
|
|
56933
|
+
const { state: agentsState } = useLoadState$1(() => fetchAgents(), []);
|
|
56934
|
+
const projects = projectsState.kind === "ok" ? projectsState.data : [];
|
|
56935
|
+
const roles = (agentsState.kind === "ok" ? agentsState.data : []).filter((a) => a.id !== "main");
|
|
56936
|
+
(0, react.useEffect)(() => {
|
|
56937
|
+
if (cwd === "" && projects.length > 0) setCwd(projects[0]);
|
|
56938
|
+
}, [projects, cwd]);
|
|
56939
|
+
const preview = (0, react.useMemo)(() => scheduleKind === "cron" ? previewCron(cronExpr, timeZone) : [], [
|
|
56940
|
+
scheduleKind,
|
|
56941
|
+
cronExpr,
|
|
56942
|
+
timeZone
|
|
56943
|
+
]);
|
|
56944
|
+
function buildInput() {
|
|
56945
|
+
const schedule = scheduleKind === "cron" ? {
|
|
56946
|
+
kind: "cron",
|
|
56947
|
+
expr: cronExpr,
|
|
56948
|
+
...timeZone !== "" ? { timeZone } : {}
|
|
56949
|
+
} : scheduleKind === "at" ? {
|
|
56950
|
+
kind: "at",
|
|
56951
|
+
at: new Date(atTime).toISOString()
|
|
56952
|
+
} : {
|
|
56953
|
+
kind: "every",
|
|
56954
|
+
seconds: Number(everySeconds)
|
|
56955
|
+
};
|
|
56956
|
+
return {
|
|
56957
|
+
name,
|
|
56958
|
+
prompt,
|
|
56959
|
+
cwd,
|
|
56960
|
+
schedule,
|
|
56961
|
+
target: targetKind === "role" ? {
|
|
56962
|
+
kind: "role",
|
|
56963
|
+
roleId
|
|
56964
|
+
} : { kind: "main" },
|
|
56965
|
+
catchup,
|
|
56966
|
+
enabled
|
|
56967
|
+
};
|
|
56968
|
+
}
|
|
56969
|
+
async function save() {
|
|
56970
|
+
setError(null);
|
|
56971
|
+
try {
|
|
56972
|
+
const input = buildInput();
|
|
56973
|
+
if (draft === void 0) await createTask(input);
|
|
56974
|
+
else await updateTask(draft.id, input);
|
|
56975
|
+
onSaved();
|
|
56976
|
+
} catch (e) {
|
|
56977
|
+
setError(t("form.saveFailed", { message: e instanceof Error ? e.message : String(e) }));
|
|
56978
|
+
}
|
|
56979
|
+
}
|
|
56980
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
|
|
56981
|
+
onSubmit: (e) => {
|
|
56982
|
+
e.preventDefault();
|
|
56983
|
+
save();
|
|
56984
|
+
},
|
|
56985
|
+
children: [
|
|
56986
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
56987
|
+
className: schedule_module_css_default.field,
|
|
56988
|
+
children: [t("form.name"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Input, {
|
|
56989
|
+
value: name,
|
|
56990
|
+
onChange: (e) => {
|
|
56991
|
+
setName(e.target.value);
|
|
56992
|
+
},
|
|
56993
|
+
required: true,
|
|
56994
|
+
"aria-label": t("form.name"),
|
|
56995
|
+
className: schedule_module_css_default.input
|
|
56996
|
+
})]
|
|
56997
|
+
}),
|
|
56998
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
56999
|
+
className: schedule_module_css_default.field,
|
|
57000
|
+
children: [t("form.prompt"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
|
|
57001
|
+
value: prompt,
|
|
57002
|
+
onChange: (e) => {
|
|
57003
|
+
setPrompt(e.target.value);
|
|
57004
|
+
},
|
|
57005
|
+
rows: 5,
|
|
57006
|
+
required: true,
|
|
57007
|
+
className: schedule_module_css_default.textarea
|
|
57008
|
+
})]
|
|
57009
|
+
}),
|
|
57010
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
57011
|
+
className: schedule_module_css_default.field,
|
|
57012
|
+
children: [t("form.project"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("select", {
|
|
57013
|
+
value: cwd,
|
|
57014
|
+
onChange: (e) => {
|
|
57015
|
+
setCwd(e.target.value);
|
|
57016
|
+
},
|
|
57017
|
+
className: schedule_module_css_default.select,
|
|
57018
|
+
children: projects.map((p) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
57019
|
+
value: p,
|
|
57020
|
+
children: p
|
|
57021
|
+
}, p))
|
|
57022
|
+
})]
|
|
57023
|
+
}),
|
|
57024
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("fieldset", {
|
|
57025
|
+
className: clsx(schedule_module_css_default.field, schedule_module_css_default.radioGroup),
|
|
57026
|
+
children: [
|
|
57027
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("legend", { children: t("form.target") }),
|
|
57028
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
57029
|
+
className: schedule_module_css_default.option,
|
|
57030
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
57031
|
+
type: "radio",
|
|
57032
|
+
className: schedule_module_css_default.radio,
|
|
57033
|
+
name: "target",
|
|
57034
|
+
checked: targetKind === "main",
|
|
57035
|
+
onChange: () => {
|
|
57036
|
+
setTargetKind("main");
|
|
57037
|
+
}
|
|
57038
|
+
}), t("form.targetMain")]
|
|
57039
|
+
}),
|
|
57040
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
57041
|
+
className: schedule_module_css_default.option,
|
|
57042
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
57043
|
+
type: "radio",
|
|
57044
|
+
className: schedule_module_css_default.radio,
|
|
57045
|
+
name: "target",
|
|
57046
|
+
checked: targetKind === "role",
|
|
57047
|
+
onChange: () => {
|
|
57048
|
+
setTargetKind("role");
|
|
57049
|
+
}
|
|
57050
|
+
}), t("form.targetRole")]
|
|
57051
|
+
}),
|
|
57052
|
+
targetKind === "role" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("select", {
|
|
57053
|
+
"aria-label": t("form.targetRole"),
|
|
57054
|
+
className: schedule_module_css_default.select,
|
|
57055
|
+
value: roleId,
|
|
57056
|
+
onChange: (e) => {
|
|
57057
|
+
setRoleId(e.target.value);
|
|
57058
|
+
},
|
|
57059
|
+
children: roles.map((r) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
57060
|
+
value: r.id,
|
|
57061
|
+
children: r.name
|
|
57062
|
+
}, r.id))
|
|
57063
|
+
})
|
|
57064
|
+
]
|
|
57065
|
+
}),
|
|
57066
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("fieldset", {
|
|
57067
|
+
className: clsx(schedule_module_css_default.field, schedule_module_css_default.radioGroup),
|
|
57068
|
+
children: [
|
|
57069
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("legend", { children: t("form.schedule") }),
|
|
57070
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
57071
|
+
className: schedule_module_css_default.option,
|
|
57072
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
57073
|
+
type: "radio",
|
|
57074
|
+
className: schedule_module_css_default.radio,
|
|
57075
|
+
name: "schedule",
|
|
57076
|
+
checked: scheduleKind === "cron",
|
|
57077
|
+
onChange: () => {
|
|
57078
|
+
setScheduleKind("cron");
|
|
57079
|
+
}
|
|
57080
|
+
}), t("form.scheduleCron")]
|
|
57081
|
+
}),
|
|
57082
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
57083
|
+
className: schedule_module_css_default.option,
|
|
57084
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
57085
|
+
type: "radio",
|
|
57086
|
+
className: schedule_module_css_default.radio,
|
|
57087
|
+
name: "schedule",
|
|
57088
|
+
checked: scheduleKind === "at",
|
|
57089
|
+
onChange: () => {
|
|
57090
|
+
setScheduleKind("at");
|
|
57091
|
+
}
|
|
57092
|
+
}), t("form.scheduleAt")]
|
|
57093
|
+
}),
|
|
57094
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
57095
|
+
className: schedule_module_css_default.option,
|
|
57096
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
57097
|
+
type: "radio",
|
|
57098
|
+
className: schedule_module_css_default.radio,
|
|
57099
|
+
name: "schedule",
|
|
57100
|
+
checked: scheduleKind === "every",
|
|
57101
|
+
onChange: () => {
|
|
57102
|
+
setScheduleKind("every");
|
|
57103
|
+
}
|
|
57104
|
+
}), t("form.scheduleEvery")]
|
|
57105
|
+
}),
|
|
57106
|
+
scheduleKind === "cron" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
57107
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
57108
|
+
className: schedule_module_css_default.field,
|
|
57109
|
+
children: [t("form.cronExpr"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Input, {
|
|
57110
|
+
value: cronExpr,
|
|
57111
|
+
onChange: (e) => {
|
|
57112
|
+
setCronExpr(e.target.value);
|
|
57113
|
+
},
|
|
57114
|
+
className: schedule_module_css_default.input
|
|
57115
|
+
})]
|
|
57116
|
+
}),
|
|
57117
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
57118
|
+
className: schedule_module_css_default.field,
|
|
57119
|
+
children: [t("form.timeZone"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Input, {
|
|
57120
|
+
value: timeZone,
|
|
57121
|
+
onChange: (e) => {
|
|
57122
|
+
setTimeZone(e.target.value);
|
|
57123
|
+
},
|
|
57124
|
+
placeholder: "Asia/Shanghai",
|
|
57125
|
+
className: schedule_module_css_default.input
|
|
57126
|
+
})]
|
|
57127
|
+
}),
|
|
57128
|
+
preview.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
57129
|
+
"data-testid": "cron-preview",
|
|
57130
|
+
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)) })]
|
|
57131
|
+
})
|
|
57132
|
+
] }),
|
|
57133
|
+
scheduleKind === "at" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
57134
|
+
className: schedule_module_css_default.field,
|
|
57135
|
+
children: [t("form.atTime"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Input, {
|
|
57136
|
+
type: "datetime-local",
|
|
57137
|
+
value: atTime,
|
|
57138
|
+
onChange: (e) => {
|
|
57139
|
+
setAtTime(e.target.value);
|
|
57140
|
+
},
|
|
57141
|
+
className: schedule_module_css_default.input
|
|
57142
|
+
})]
|
|
57143
|
+
}),
|
|
57144
|
+
scheduleKind === "every" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
57145
|
+
className: schedule_module_css_default.field,
|
|
57146
|
+
children: [t("form.everySeconds"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Input, {
|
|
57147
|
+
type: "number",
|
|
57148
|
+
min: 60,
|
|
57149
|
+
value: everySeconds,
|
|
57150
|
+
onChange: (e) => {
|
|
57151
|
+
setEverySeconds(e.target.value);
|
|
57152
|
+
},
|
|
57153
|
+
className: schedule_module_css_default.input
|
|
57154
|
+
})]
|
|
57155
|
+
})
|
|
57156
|
+
]
|
|
57157
|
+
}),
|
|
57158
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
57159
|
+
className: schedule_module_css_default.option,
|
|
57160
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
57161
|
+
type: "checkbox",
|
|
57162
|
+
className: schedule_module_css_default.checkbox,
|
|
57163
|
+
checked: catchup,
|
|
57164
|
+
onChange: (e) => {
|
|
57165
|
+
setCatchup(e.target.checked);
|
|
57166
|
+
}
|
|
57167
|
+
}), t("form.catchup")]
|
|
57168
|
+
}),
|
|
57169
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
57170
|
+
className: schedule_module_css_default.option,
|
|
57171
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
57172
|
+
type: "checkbox",
|
|
57173
|
+
className: schedule_module_css_default.checkbox,
|
|
57174
|
+
checked: enabled,
|
|
57175
|
+
onChange: (e) => {
|
|
57176
|
+
setEnabled(e.target.checked);
|
|
57177
|
+
}
|
|
57178
|
+
}), t("form.enabled")]
|
|
57179
|
+
}),
|
|
57180
|
+
error !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
57181
|
+
role: "alert",
|
|
57182
|
+
className: schedule_module_css_default.error,
|
|
57183
|
+
children: error
|
|
57184
|
+
}),
|
|
57185
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
57186
|
+
className: schedule_module_css_default.formActions,
|
|
57187
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
57188
|
+
variant: "outline",
|
|
57189
|
+
type: "button",
|
|
57190
|
+
onClick: onCancel,
|
|
57191
|
+
children: t("form.cancel")
|
|
57192
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
57193
|
+
variant: "primary",
|
|
57194
|
+
type: "submit",
|
|
57195
|
+
children: t("form.save")
|
|
57196
|
+
})]
|
|
57197
|
+
})
|
|
57198
|
+
]
|
|
57199
|
+
});
|
|
57200
|
+
}
|
|
57201
|
+
//#endregion
|
|
57202
|
+
//#region src/client/schedule/locales.ts
|
|
57203
|
+
/** schedule 浏览器半文案:zh 为真源,en 键集严格一致。 */
|
|
57204
|
+
const NS = "agent-schedule";
|
|
57205
|
+
const zh = {
|
|
57206
|
+
"modal.title": "定时任务",
|
|
57207
|
+
"modal.close": "关闭",
|
|
57208
|
+
"list.loading": "加载中…",
|
|
57209
|
+
"list.error": "加载失败,请重试",
|
|
57210
|
+
"list.empty": "还没有定时任务,点击「新建任务」开始。",
|
|
57211
|
+
"list.create": "新建任务",
|
|
57212
|
+
"list.edit": "编辑",
|
|
57213
|
+
"list.delete": "删除",
|
|
57214
|
+
"list.confirmDelete": "确认删除?",
|
|
57215
|
+
"list.deleteFailed": "删除失败:{message}",
|
|
57216
|
+
"list.trigger": "立即触发",
|
|
57217
|
+
"list.triggerFailed": "触发失败:{message}",
|
|
57218
|
+
"list.targetMain": "主 Agent",
|
|
57219
|
+
"list.targetRole": "角色 {roleId}",
|
|
57220
|
+
"list.nextRun": "下次触发 {time}",
|
|
57221
|
+
"list.noNextRun": "已停用",
|
|
57222
|
+
"list.history": "运行历史",
|
|
57223
|
+
"list.historyEmpty": "暂无运行记录",
|
|
57224
|
+
"run.ok": "成功",
|
|
57225
|
+
"run.error": "失败",
|
|
57226
|
+
"run.running": "运行中",
|
|
57227
|
+
"run.skipped-overlap": "跳过(上次未结束)",
|
|
57228
|
+
"run.openSession": "查看会话",
|
|
57229
|
+
"form.name": "名称",
|
|
57230
|
+
"form.prompt": "提示词",
|
|
57231
|
+
"form.project": "项目",
|
|
57232
|
+
"form.target": "目标",
|
|
57233
|
+
"form.targetMain": "主 Agent",
|
|
57234
|
+
"form.targetRole": "角色",
|
|
57235
|
+
"form.schedule": "调度",
|
|
57236
|
+
"form.scheduleCron": "cron 表达式",
|
|
57237
|
+
"form.scheduleAt": "一次性时间",
|
|
57238
|
+
"form.scheduleEvery": "固定间隔",
|
|
57239
|
+
"form.cronExpr": "表达式(分 时 日 月 周)",
|
|
57240
|
+
"form.timeZone": "时区(可选,IANA)",
|
|
57241
|
+
"form.atTime": "触发时间",
|
|
57242
|
+
"form.everySeconds": "间隔秒数(≥60)",
|
|
57243
|
+
"form.preview": "未来 3 次触发",
|
|
57244
|
+
"form.catchup": "停机补跑(重启后补跑一次漏掉的触发)",
|
|
57245
|
+
"form.enabled": "启用",
|
|
57246
|
+
"form.save": "保存",
|
|
57247
|
+
"form.cancel": "取消",
|
|
57248
|
+
"form.saveFailed": "保存失败:{message}"
|
|
57249
|
+
};
|
|
57250
|
+
const en = {
|
|
57251
|
+
"modal.title": "Scheduled tasks",
|
|
57252
|
+
"modal.close": "Close",
|
|
57253
|
+
"list.loading": "Loading…",
|
|
57254
|
+
"list.error": "Failed to load, please retry",
|
|
57255
|
+
"list.empty": "No scheduled tasks yet. Click \"New task\" to start.",
|
|
57256
|
+
"list.create": "New task",
|
|
57257
|
+
"list.edit": "Edit",
|
|
57258
|
+
"list.delete": "Delete",
|
|
57259
|
+
"list.confirmDelete": "Confirm delete?",
|
|
57260
|
+
"list.deleteFailed": "Delete failed: {message}",
|
|
57261
|
+
"list.trigger": "Run now",
|
|
57262
|
+
"list.triggerFailed": "Trigger failed: {message}",
|
|
57263
|
+
"list.targetMain": "Main agent",
|
|
57264
|
+
"list.targetRole": "Role {roleId}",
|
|
57265
|
+
"list.nextRun": "Next run {time}",
|
|
57266
|
+
"list.noNextRun": "Disabled",
|
|
57267
|
+
"list.history": "Run history",
|
|
57268
|
+
"list.historyEmpty": "No runs yet",
|
|
57269
|
+
"run.ok": "OK",
|
|
57270
|
+
"run.error": "Error",
|
|
57271
|
+
"run.running": "Running",
|
|
57272
|
+
"run.skipped-overlap": "Skipped (overlap)",
|
|
57273
|
+
"run.openSession": "Open session",
|
|
57274
|
+
"form.name": "Name",
|
|
57275
|
+
"form.prompt": "Prompt",
|
|
57276
|
+
"form.project": "Project",
|
|
57277
|
+
"form.target": "Target",
|
|
57278
|
+
"form.targetMain": "Main agent",
|
|
57279
|
+
"form.targetRole": "Role",
|
|
57280
|
+
"form.schedule": "Schedule",
|
|
57281
|
+
"form.scheduleCron": "Cron expression",
|
|
57282
|
+
"form.scheduleAt": "One-shot time",
|
|
57283
|
+
"form.scheduleEvery": "Fixed interval",
|
|
57284
|
+
"form.cronExpr": "Expression (minute hour day month weekday)",
|
|
57285
|
+
"form.timeZone": "Time zone (optional, IANA)",
|
|
57286
|
+
"form.atTime": "Run at",
|
|
57287
|
+
"form.everySeconds": "Interval seconds (>= 60)",
|
|
57288
|
+
"form.preview": "Next 3 runs",
|
|
57289
|
+
"form.catchup": "Catch up missed runs after restart",
|
|
57290
|
+
"form.enabled": "Enabled",
|
|
57291
|
+
"form.save": "Save",
|
|
57292
|
+
"form.cancel": "Cancel",
|
|
57293
|
+
"form.saveFailed": "Save failed: {message}"
|
|
57294
|
+
};
|
|
57295
|
+
//#endregion
|
|
57296
|
+
//#region src/client/schedule/index.ts
|
|
57297
|
+
function setupScheduleClient(ctx) {
|
|
57298
|
+
ctx.effect(() => ctx.locale.register(NS, {
|
|
57299
|
+
zh,
|
|
57300
|
+
en
|
|
57301
|
+
}), "dsh-agent-toolkit: schedule dictionaries");
|
|
57302
|
+
const sessions = ctx.sessions;
|
|
57303
|
+
const openSession = (sessionId) => {
|
|
57304
|
+
sessions.open(sessionId);
|
|
57305
|
+
};
|
|
57306
|
+
ctx.slots.inject("sidebar.footer.action", () => ctx.slots.register({
|
|
57307
|
+
name: "sidebar.footer.action",
|
|
57308
|
+
id: "dsh-agent-toolkit:schedule",
|
|
57309
|
+
order: 2,
|
|
57310
|
+
locale: NS
|
|
57311
|
+
}, (props) => ScheduleEntry({
|
|
57312
|
+
...props,
|
|
57313
|
+
openSession,
|
|
57314
|
+
renderForm: (draft, onSaved, onCancel) => (0, react.createElement)(TaskForm, {
|
|
57315
|
+
draft,
|
|
57316
|
+
t: props.t,
|
|
57317
|
+
onSaved,
|
|
57318
|
+
onCancel
|
|
57319
|
+
})
|
|
57320
|
+
})));
|
|
57321
|
+
}
|
|
57322
|
+
//#endregion
|
|
55843
57323
|
//#region src/client/index.ts
|
|
55844
57324
|
const inject = [
|
|
55845
57325
|
"sessions",
|
|
@@ -55857,6 +57337,7 @@ ${te.current.stack}
|
|
|
55857
57337
|
console.warn("[dsh-agent-toolkit] 侧边栏「Token 用量」入口已由独立包 @dsh-agent-toolkit/token-usage 注册,本包停用用量面板", error);
|
|
55858
57338
|
}
|
|
55859
57339
|
setupBotsClient(ctx);
|
|
57340
|
+
setupScheduleClient(ctx);
|
|
55860
57341
|
}
|
|
55861
57342
|
//#endregion
|
|
55862
57343
|
exports.apply = apply;
|