@lukstei/dsh-schedule-script 0.0.0-stage → 0.2.2-rc.5.3
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/LICENSE +21 -0
- package/README.md +203 -2
- package/cordis.patch.yml +4 -0
- package/dist/client.js +848 -0
- package/dist/index.js +826 -0
- package/package.json +103 -3
- package/src/client.tsx +717 -0
- package/src/executor.ts +101 -0
- package/src/fold.ts +154 -0
- package/src/index.ts +616 -0
- package/src/parser.ts +138 -0
- package/src/runner-cli.ts +81 -0
- package/src/skill.ts +120 -0
- package/src/styles.ts +333 -0
- package/src/types.ts +132 -0
package/dist/client.js
ADDED
|
@@ -0,0 +1,848 @@
|
|
|
1
|
+
window.__ModuleLoader__.load({
|
|
2
|
+
id: "@lukstei/dsh-schedule-script",
|
|
3
|
+
factory: (require) => {
|
|
4
|
+
var module = { exports: {} };
|
|
5
|
+
var exports = module.exports;
|
|
6
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
7
|
+
let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
8
|
+
let react = require("react");
|
|
9
|
+
let react_dom = require("react-dom");
|
|
10
|
+
let zod = require("zod");
|
|
11
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
12
|
+
// src/types.ts
|
|
13
|
+
const SCHEDULE_SCRIPT_KIND = "dsh-schedule-script";
|
|
14
|
+
const SCHEDULE_SCRIPT_EVENT_NAME = "dsh-schedule-script";
|
|
15
|
+
const scriptExecutionStatusSchema = zod.z.enum([
|
|
16
|
+
"idle",
|
|
17
|
+
"running",
|
|
18
|
+
"warning",
|
|
19
|
+
"error",
|
|
20
|
+
"stopped"
|
|
21
|
+
]);
|
|
22
|
+
zod.z.enum([
|
|
23
|
+
"active",
|
|
24
|
+
"paused",
|
|
25
|
+
"ended",
|
|
26
|
+
"deleted"
|
|
27
|
+
]);
|
|
28
|
+
zod.z.object({
|
|
29
|
+
scriptStatus: scriptExecutionStatusSchema,
|
|
30
|
+
skillInvoked: zod.z.boolean().optional(),
|
|
31
|
+
scheduleId: zod.z.string().optional(),
|
|
32
|
+
cleanupPending: zod.z.boolean().optional(),
|
|
33
|
+
cleanupError: zod.z.string().optional(),
|
|
34
|
+
scriptPath: zod.z.string().optional(),
|
|
35
|
+
totalRuns: zod.z.number(),
|
|
36
|
+
lastRunAt: zod.z.number().optional(),
|
|
37
|
+
lastDurationMs: zod.z.number().optional(),
|
|
38
|
+
state: zod.z.unknown().optional(),
|
|
39
|
+
lastPrompt: zod.z.object({
|
|
40
|
+
message: zod.z.string(),
|
|
41
|
+
timestamp: zod.z.number()
|
|
42
|
+
}).optional(),
|
|
43
|
+
lastError: zod.z.object({
|
|
44
|
+
message: zod.z.string(),
|
|
45
|
+
timestamp: zod.z.number(),
|
|
46
|
+
fatal: zod.z.boolean().default(false)
|
|
47
|
+
}).optional()
|
|
48
|
+
});
|
|
49
|
+
// src/parser.ts
|
|
50
|
+
function parseScriptPrompt(promptText) {
|
|
51
|
+
if (!promptText) return null;
|
|
52
|
+
try {
|
|
53
|
+
const parsed = JSON.parse(promptText.trim());
|
|
54
|
+
if (parsed && typeof parsed === "object" && parsed.kind === "dsh-schedule-script" && typeof parsed.scriptPath === "string" && "state" in parsed && parsed.state !== void 0) {
|
|
55
|
+
const timeoutMs = typeof parsed.timeoutMs === "number" && Number.isFinite(parsed.timeoutMs) && parsed.timeoutMs > 0 ? parsed.timeoutMs : void 0;
|
|
56
|
+
return {
|
|
57
|
+
kind: SCHEDULE_SCRIPT_KIND,
|
|
58
|
+
scriptPath: parsed.scriptPath,
|
|
59
|
+
state: parsed.state,
|
|
60
|
+
...timeoutMs ? { timeoutMs } : {}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
} catch {}
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
// src/styles.ts
|
|
67
|
+
const SCHEDULE_SCRIPT_CSS = `
|
|
68
|
+
.dsh-schedule-root,
|
|
69
|
+
.dsh-schedule-root * {
|
|
70
|
+
box-sizing: border-box;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.dsh-schedule-root {
|
|
74
|
+
display: inline-flex;
|
|
75
|
+
align-items: center;
|
|
76
|
+
position: relative;
|
|
77
|
+
font-family: inherit;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/* 28px Icon-Only Button */
|
|
81
|
+
.dsh-schedule-icon-btn {
|
|
82
|
+
width: 28px;
|
|
83
|
+
height: 28px;
|
|
84
|
+
padding: 0;
|
|
85
|
+
display: inline-flex;
|
|
86
|
+
align-items: center;
|
|
87
|
+
justify-content: center;
|
|
88
|
+
flex: none;
|
|
89
|
+
border-radius: var(--dsw-radius-sm, 4px);
|
|
90
|
+
background: transparent;
|
|
91
|
+
border: none;
|
|
92
|
+
cursor: pointer;
|
|
93
|
+
position: relative;
|
|
94
|
+
color: var(--dsw-alias-label-secondary, #64748b);
|
|
95
|
+
transition: all 0.15s ease;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.dsh-schedule-icon-btn:hover {
|
|
99
|
+
background: var(--dsw-alias-interactive-bg-hover, rgba(0, 0, 0, 0.05));
|
|
100
|
+
color: var(--dsw-alias-label-primary, inherit);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.dsh-schedule-icon-btn.is-active,
|
|
104
|
+
.dsh-schedule-icon-btn.is-pressed {
|
|
105
|
+
background: var(--dsw-alias-interactive-bg-active, rgba(0, 0, 0, 0.08));
|
|
106
|
+
color: var(--dsw-alias-state-business-primary, inherit);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.dsh-schedule-icon-btn:focus-visible {
|
|
110
|
+
outline: 2px solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary, #2563eb));
|
|
111
|
+
outline-offset: -2px;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/* Status Dot Badge on Icon */
|
|
115
|
+
.dsh-schedule-dot {
|
|
116
|
+
width: 6px;
|
|
117
|
+
height: 6px;
|
|
118
|
+
border-radius: 50%;
|
|
119
|
+
flex-shrink: 0;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.dsh-schedule-dot-badge {
|
|
123
|
+
position: absolute;
|
|
124
|
+
top: 3px;
|
|
125
|
+
right: 3px;
|
|
126
|
+
width: 7px;
|
|
127
|
+
height: 7px;
|
|
128
|
+
border-radius: 50%;
|
|
129
|
+
box-shadow: 0 0 0 1.5px var(--dsw-alias-bg-base, #ffffff);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.dsh-schedule-dot[data-status="active"],
|
|
133
|
+
.dsh-schedule-dot-badge[data-status="active"] {
|
|
134
|
+
background: var(--dsw-alias-state-success-primary, #10b981);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.dsh-schedule-dot[data-status="warning"],
|
|
138
|
+
.dsh-schedule-dot-badge[data-status="warning"],
|
|
139
|
+
.dsh-schedule-dot[data-status="paused"],
|
|
140
|
+
.dsh-schedule-dot-badge[data-status="paused"] {
|
|
141
|
+
background: var(--dsw-alias-state-warn-primary, #f59e0b);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.dsh-schedule-dot[data-status="error"],
|
|
145
|
+
.dsh-schedule-dot-badge[data-status="error"] {
|
|
146
|
+
background: var(--dsw-alias-state-error-primary, #ef4444);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.dsh-schedule-dot[data-status="stopped"],
|
|
150
|
+
.dsh-schedule-dot-badge[data-status="stopped"] {
|
|
151
|
+
background: var(--dsw-alias-label-tertiary, #94a3b8);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/* Popover Card Component - Portaled to document.body to avoid parent clipping */
|
|
155
|
+
.dsh-schedule-popover {
|
|
156
|
+
position: fixed;
|
|
157
|
+
top: max(12px, var(--dsh-frame-overlay-top, 12px));
|
|
158
|
+
left: 12px;
|
|
159
|
+
right: anchor(right);
|
|
160
|
+
bottom: calc(anchor(top) + 8px);
|
|
161
|
+
align-self: safe end;
|
|
162
|
+
justify-self: safe end;
|
|
163
|
+
margin: 0;
|
|
164
|
+
height: fit-content;
|
|
165
|
+
box-sizing: border-box;
|
|
166
|
+
font-family: var(--dsw-font-sans, system-ui, -apple-system, sans-serif);
|
|
167
|
+
width: 310px;
|
|
168
|
+
max-width: calc(100vw - 24px);
|
|
169
|
+
max-height: calc(100vh - 24px);
|
|
170
|
+
background: var(--dsw-alias-bg-layer-1, var(--dsw-alias-bg-base, #ffffff));
|
|
171
|
+
border: 1px solid var(--dsw-alias-border-l2, var(--dsw-alias-border-l1, rgba(0, 0, 0, 0.12)));
|
|
172
|
+
border-radius: var(--dsw-radius-md, 8px);
|
|
173
|
+
padding: 12px 14px;
|
|
174
|
+
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14), 0 2px 6px rgba(0, 0, 0, 0.06);
|
|
175
|
+
color: var(--dsw-alias-label-primary, #0f172a);
|
|
176
|
+
font-size: 13px;
|
|
177
|
+
line-height: 1.5;
|
|
178
|
+
z-index: 1000;
|
|
179
|
+
display: flex;
|
|
180
|
+
flex-direction: column;
|
|
181
|
+
gap: 10px;
|
|
182
|
+
overflow-y: auto;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.dsh-schedule-popover * {
|
|
186
|
+
box-sizing: border-box;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/* Static variant for Ladle stories or embedded previews */
|
|
190
|
+
.dsh-schedule-popover.is-static {
|
|
191
|
+
position: relative;
|
|
192
|
+
inset: auto;
|
|
193
|
+
max-width: 100%;
|
|
194
|
+
z-index: auto;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.dsh-schedule-popover-header {
|
|
198
|
+
display: flex;
|
|
199
|
+
align-items: center;
|
|
200
|
+
justify-content: space-between;
|
|
201
|
+
gap: 8px;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.dsh-schedule-popover-title {
|
|
205
|
+
font-weight: 600;
|
|
206
|
+
font-size: 13px;
|
|
207
|
+
display: flex;
|
|
208
|
+
align-items: baseline;
|
|
209
|
+
gap: 6px;
|
|
210
|
+
color: var(--dsw-alias-label-primary, inherit);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.dsh-schedule-popover-title svg {
|
|
214
|
+
align-self: baseline;
|
|
215
|
+
transform: translateY(2px);
|
|
216
|
+
flex-shrink: 0;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.dsh-schedule-status-badge {
|
|
220
|
+
display: inline-flex;
|
|
221
|
+
align-items: center;
|
|
222
|
+
gap: 4px;
|
|
223
|
+
padding: 2px 7px;
|
|
224
|
+
border-radius: var(--dsw-radius-xs, 4px);
|
|
225
|
+
font-size: 11px;
|
|
226
|
+
font-weight: 500;
|
|
227
|
+
line-height: 1;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.dsh-schedule-status-badge[data-status="active"] {
|
|
231
|
+
background: color-mix(in srgb, var(--dsw-alias-state-success-primary, #10b981) 12%, transparent);
|
|
232
|
+
color: var(--dsw-alias-state-success-primary, #059669);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.dsh-schedule-status-badge[data-status="warning"],
|
|
236
|
+
.dsh-schedule-status-badge[data-status="paused"] {
|
|
237
|
+
background: color-mix(in srgb, var(--dsw-alias-state-warn-primary, #f59e0b) 12%, transparent);
|
|
238
|
+
color: var(--dsw-alias-state-warn-label, var(--dsw-alias-state-warn-primary, #d97706));
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.dsh-schedule-status-badge[data-status="error"] {
|
|
242
|
+
background: color-mix(in srgb, var(--dsw-alias-state-error-primary, #ef4444) 12%, transparent);
|
|
243
|
+
color: var(--dsw-alias-state-error-primary, #dc2626);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.dsh-schedule-status-badge[data-status="stopped"] {
|
|
247
|
+
background: color-mix(in srgb, var(--dsw-alias-label-tertiary, #94a3b8) 15%, transparent);
|
|
248
|
+
color: var(--dsw-alias-label-tertiary, #64748b);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.dsh-schedule-details-grid {
|
|
252
|
+
display: flex;
|
|
253
|
+
flex-direction: column;
|
|
254
|
+
gap: 6px;
|
|
255
|
+
font-size: 12px;
|
|
256
|
+
color: var(--dsw-alias-label-secondary, #64748b);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.dsh-schedule-detail-row {
|
|
260
|
+
display: flex;
|
|
261
|
+
align-items: center;
|
|
262
|
+
justify-content: space-between;
|
|
263
|
+
gap: 8px;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.dsh-schedule-detail-value {
|
|
267
|
+
color: var(--dsw-alias-label-primary, inherit);
|
|
268
|
+
font-weight: 500;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
.dsh-schedule-mono-badge {
|
|
272
|
+
font-family: var(--dsw-font-mono, monospace);
|
|
273
|
+
font-size: 11px;
|
|
274
|
+
padding: 2px 6px;
|
|
275
|
+
border-radius: var(--dsw-radius-xs, 4px);
|
|
276
|
+
background: var(--dsw-alias-interactive-bg-subtle, rgba(0, 0, 0, 0.04));
|
|
277
|
+
border: 1px solid var(--dsw-alias-border-l1, rgba(0, 0, 0, 0.08));
|
|
278
|
+
color: var(--dsw-alias-label-primary, inherit);
|
|
279
|
+
max-width: 190px;
|
|
280
|
+
overflow: hidden;
|
|
281
|
+
text-overflow: ellipsis;
|
|
282
|
+
white-space: nowrap;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.dsh-schedule-error-value {
|
|
286
|
+
color: var(--dsw-alias-state-warn-label, var(--dsw-alias-state-warn-primary, #d97706));
|
|
287
|
+
max-width: 190px;
|
|
288
|
+
overflow: hidden;
|
|
289
|
+
text-overflow: ellipsis;
|
|
290
|
+
white-space: nowrap;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/* Fatal Error Callout */
|
|
294
|
+
.dsh-schedule-callout {
|
|
295
|
+
padding: 8px 10px;
|
|
296
|
+
border-radius: var(--dsw-radius-sm, 6px);
|
|
297
|
+
font-size: 12px;
|
|
298
|
+
line-height: 1.4;
|
|
299
|
+
white-space: pre-wrap;
|
|
300
|
+
word-break: break-word;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.dsh-schedule-callout-header {
|
|
304
|
+
font-weight: 600;
|
|
305
|
+
margin-bottom: 2px;
|
|
306
|
+
display: flex;
|
|
307
|
+
align-items: center;
|
|
308
|
+
gap: 4px;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
.dsh-schedule-callout-fatal {
|
|
312
|
+
background: color-mix(in srgb, var(--dsw-alias-state-error-primary, #ef4444) 8%, transparent);
|
|
313
|
+
border: 1px solid color-mix(in srgb, var(--dsw-alias-state-error-primary, #ef4444) 25%, transparent);
|
|
314
|
+
color: var(--dsw-alias-state-error-primary, #dc2626);
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
.dsh-schedule-callout-warning {
|
|
318
|
+
background: color-mix(in srgb, var(--dsw-alias-state-warn-primary, #f59e0b) 8%, transparent);
|
|
319
|
+
border: 1px solid color-mix(in srgb, var(--dsw-alias-state-warn-primary, #f59e0b) 25%, transparent);
|
|
320
|
+
color: var(--dsw-alias-state-warn-label, var(--dsw-alias-state-warn-primary, #d97706));
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
.dsh-schedule-callout-paused {
|
|
324
|
+
background: color-mix(in srgb, var(--dsw-alias-state-warn-primary, #f59e0b) 8%, transparent);
|
|
325
|
+
border: 1px solid color-mix(in srgb, var(--dsw-alias-state-warn-primary, #f59e0b) 25%, transparent);
|
|
326
|
+
color: var(--dsw-alias-state-warn-label, var(--dsw-alias-state-warn-primary, #d97706));
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
.dsh-schedule-callout-completed {
|
|
330
|
+
background: color-mix(in srgb, var(--dsw-alias-state-success-primary, #10b981) 8%, transparent);
|
|
331
|
+
border: 1px solid color-mix(in srgb, var(--dsw-alias-state-success-primary, #10b981) 25%, transparent);
|
|
332
|
+
color: var(--dsw-alias-state-success-primary, #059669);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
.dsh-schedule-callout-stopped {
|
|
336
|
+
background: color-mix(in srgb, var(--dsw-alias-label-tertiary, #94a3b8) 10%, transparent);
|
|
337
|
+
border: 1px solid color-mix(in srgb, var(--dsw-alias-label-tertiary, #94a3b8) 25%, transparent);
|
|
338
|
+
color: var(--dsw-alias-label-secondary, #64748b);
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/* Command Row in Chat Trajectory */
|
|
342
|
+
.dsh-schedule-command-card {
|
|
343
|
+
display: flex;
|
|
344
|
+
flex-direction: column;
|
|
345
|
+
width: 100%;
|
|
346
|
+
min-width: 0;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
.dsh-schedule-command-separator {
|
|
350
|
+
flex: none;
|
|
351
|
+
width: 2px;
|
|
352
|
+
height: 2px;
|
|
353
|
+
margin: 0 8px;
|
|
354
|
+
border-radius: 1px;
|
|
355
|
+
background: var(--dsw-alias-label-caption, #cbd5e1);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
.dsh-schedule-command-status {
|
|
359
|
+
min-width: 0;
|
|
360
|
+
overflow: hidden;
|
|
361
|
+
flex: 0 1 auto;
|
|
362
|
+
font-size: var(--dsh-content-font-size-secondary, 13px);
|
|
363
|
+
line-height: calc(24px + var(--dsh-content-font-delta, 0px));
|
|
364
|
+
color: var(--dsw-alias-label-secondary, inherit);
|
|
365
|
+
text-overflow: ellipsis;
|
|
366
|
+
white-space: nowrap;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
.dsh-schedule-command-status[data-error] {
|
|
370
|
+
color: var(--dsw-alias-state-error-primary, #ef4444);
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
.dsh-schedule-command-error-line {
|
|
374
|
+
display: flex;
|
|
375
|
+
align-items: flex-start;
|
|
376
|
+
gap: 6px;
|
|
377
|
+
padding-left: 22px;
|
|
378
|
+
margin-top: 2px;
|
|
379
|
+
margin-bottom: 4px;
|
|
380
|
+
font-size: 12px;
|
|
381
|
+
line-height: 1.4;
|
|
382
|
+
color: var(--dsw-alias-state-warn-label, var(--dsw-alias-state-warn-primary, #d97706));
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
.dsh-schedule-command-error-line[data-fatal="true"] {
|
|
386
|
+
color: var(--dsw-alias-state-error-primary, #ef4444);
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
.dsh-schedule-command-error-bullet {
|
|
390
|
+
flex-shrink: 0;
|
|
391
|
+
font-size: 11px;
|
|
392
|
+
line-height: 1.4;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
.dsh-schedule-command-error-text {
|
|
396
|
+
word-break: break-word;
|
|
397
|
+
white-space: pre-wrap;
|
|
398
|
+
}
|
|
399
|
+
`;
|
|
400
|
+
// src/client.tsx
|
|
401
|
+
function useScheduleCatalogStatus(ctx, sessionId, scriptPath) {
|
|
402
|
+
const [catalogStatus, setCatalogStatus] = (0, react.useState)({ settled: false });
|
|
403
|
+
(0, react.useEffect)(() => {
|
|
404
|
+
setCatalogStatus({ settled: false });
|
|
405
|
+
let active = true;
|
|
406
|
+
const refresh = async () => {
|
|
407
|
+
try {
|
|
408
|
+
const result = await ctx.remote.schedule.catalog();
|
|
409
|
+
if (!active || !result.ok) return;
|
|
410
|
+
const items = result.value;
|
|
411
|
+
let parsedMatch;
|
|
412
|
+
const matching = items.find((item) => {
|
|
413
|
+
const targetSessionId = item.lastDelivery === void 0 ? void 0 : item.lastDelivery.targetSessionId;
|
|
414
|
+
const isTarget = item.target.kind === "session" && item.target.sessionId === sessionId || targetSessionId === sessionId;
|
|
415
|
+
const isInvolved = item.involvedSessionIds.some((id) => id === sessionId);
|
|
416
|
+
if (!isTarget && !isInvolved) return false;
|
|
417
|
+
if (typeof item.prompt !== "string") return false;
|
|
418
|
+
const parsed = parseScriptPrompt(item.prompt);
|
|
419
|
+
if (!parsed) return false;
|
|
420
|
+
if (scriptPath && parsed.scriptPath !== scriptPath) return false;
|
|
421
|
+
parsedMatch = parsed;
|
|
422
|
+
return true;
|
|
423
|
+
});
|
|
424
|
+
if (matching) setCatalogStatus({
|
|
425
|
+
status: matching.status === "paused" ? "paused" : matching.status === "ended" ? "ended" : "active",
|
|
426
|
+
settled: true,
|
|
427
|
+
matchingItem: matching,
|
|
428
|
+
parsedPrompt: parsedMatch
|
|
429
|
+
});
|
|
430
|
+
else setCatalogStatus({
|
|
431
|
+
status: "deleted",
|
|
432
|
+
settled: true
|
|
433
|
+
});
|
|
434
|
+
} catch {}
|
|
435
|
+
};
|
|
436
|
+
const changed = ctx.remote.$on("schedule/changed", refresh);
|
|
437
|
+
const reset = ctx.on("connection/reset", refresh);
|
|
438
|
+
refresh();
|
|
439
|
+
return () => {
|
|
440
|
+
active = false;
|
|
441
|
+
changed();
|
|
442
|
+
reset();
|
|
443
|
+
};
|
|
444
|
+
}, [
|
|
445
|
+
ctx,
|
|
446
|
+
sessionId,
|
|
447
|
+
scriptPath
|
|
448
|
+
]);
|
|
449
|
+
return catalogStatus;
|
|
450
|
+
}
|
|
451
|
+
function resolveEffectiveScriptState(summary, scheduleStatus) {
|
|
452
|
+
const scriptStatus = summary.scriptStatus ?? (scheduleStatus === "deleted" || scheduleStatus === "ended" ? "stopped" : "idle");
|
|
453
|
+
if (scriptStatus === "error" || summary.lastError?.fatal) return {
|
|
454
|
+
scheduleStatus,
|
|
455
|
+
scriptStatus,
|
|
456
|
+
displayStatus: "error",
|
|
457
|
+
badgeText: "Error"
|
|
458
|
+
};
|
|
459
|
+
if (scriptStatus === "stopped") return {
|
|
460
|
+
scheduleStatus,
|
|
461
|
+
scriptStatus,
|
|
462
|
+
displayStatus: "stopped",
|
|
463
|
+
badgeText: "Stopped"
|
|
464
|
+
};
|
|
465
|
+
if (scheduleStatus === "deleted" || scheduleStatus === "ended") return {
|
|
466
|
+
scheduleStatus,
|
|
467
|
+
scriptStatus,
|
|
468
|
+
displayStatus: "stopped",
|
|
469
|
+
badgeText: "Stopped"
|
|
470
|
+
};
|
|
471
|
+
if (scheduleStatus === "paused") return {
|
|
472
|
+
scheduleStatus,
|
|
473
|
+
scriptStatus,
|
|
474
|
+
displayStatus: "paused",
|
|
475
|
+
badgeText: "Paused"
|
|
476
|
+
};
|
|
477
|
+
if (scriptStatus === "warning" || Boolean(summary.lastError) && !summary.lastError?.fatal) return {
|
|
478
|
+
scheduleStatus,
|
|
479
|
+
scriptStatus,
|
|
480
|
+
displayStatus: "warning",
|
|
481
|
+
badgeText: "Warning"
|
|
482
|
+
};
|
|
483
|
+
return {
|
|
484
|
+
scheduleStatus,
|
|
485
|
+
scriptStatus,
|
|
486
|
+
displayStatus: "active",
|
|
487
|
+
badgeText: "Active"
|
|
488
|
+
};
|
|
489
|
+
}
|
|
490
|
+
function shouldRenderPill(summary, scheduleStatus) {
|
|
491
|
+
if (!summary) return false;
|
|
492
|
+
const hasError = summary.scriptStatus === "error" || Boolean(summary.lastError);
|
|
493
|
+
if (!hasError && summary.totalRuns === 0 && (scheduleStatus === "deleted" || scheduleStatus === "ended" || summary.scriptStatus === "stopped")) return false;
|
|
494
|
+
if (hasError || summary.totalRuns > 0 || scheduleStatus === "active" || scheduleStatus === "paused" || summary.scriptPath) return true;
|
|
495
|
+
return false;
|
|
496
|
+
}
|
|
497
|
+
function TimerIcon({ size = 14 }) {
|
|
498
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
499
|
+
width: size,
|
|
500
|
+
height: size,
|
|
501
|
+
viewBox: "0 0 16 16",
|
|
502
|
+
fill: "none",
|
|
503
|
+
stroke: "currentColor",
|
|
504
|
+
strokeWidth: "1.3",
|
|
505
|
+
strokeLinecap: "round",
|
|
506
|
+
strokeLinejoin: "round",
|
|
507
|
+
"aria-hidden": "true",
|
|
508
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
509
|
+
cx: "8",
|
|
510
|
+
cy: "8",
|
|
511
|
+
r: "6.5"
|
|
512
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("polyline", { points: "8 4.5 8 8 10.5 9.5" })]
|
|
513
|
+
});
|
|
514
|
+
}
|
|
515
|
+
function formatDuration(durationMs) {
|
|
516
|
+
if (durationMs === void 0) return "0.0s";
|
|
517
|
+
return `${(durationMs / 1e3).toFixed(1)}s`;
|
|
518
|
+
}
|
|
519
|
+
function formatRelativeTime(timestamp) {
|
|
520
|
+
if (!timestamp) return "Pending first run";
|
|
521
|
+
const elapsedSec = Math.max(0, Math.floor((Date.now() - timestamp) / 1e3));
|
|
522
|
+
if (elapsedSec < 5) return "just now";
|
|
523
|
+
if (elapsedSec < 60) return `${elapsedSec}s ago`;
|
|
524
|
+
const elapsedMin = Math.floor(elapsedSec / 60);
|
|
525
|
+
if (elapsedMin < 60) return `${elapsedMin}m ago`;
|
|
526
|
+
const elapsedHours = Math.floor(elapsedMin / 60);
|
|
527
|
+
if (elapsedHours < 24) return `${elapsedHours}h ago`;
|
|
528
|
+
return `${Math.floor(elapsedHours / 24)}d ago`;
|
|
529
|
+
}
|
|
530
|
+
function formatClockTime(timestamp) {
|
|
531
|
+
const d = new Date(timestamp);
|
|
532
|
+
return `${String(d.getHours()).padStart(2, "0")}:${String(d.getMinutes()).padStart(2, "0")}`;
|
|
533
|
+
}
|
|
534
|
+
function ScheduleScriptPopoverCard({ summary, scheduleStatus, isStatic = false, cardRef, style }) {
|
|
535
|
+
const effective = resolveEffectiveScriptState(summary, scheduleStatus);
|
|
536
|
+
const statusKey = effective.displayStatus;
|
|
537
|
+
const statusText = effective.badgeText;
|
|
538
|
+
const isFatal = statusKey === "error";
|
|
539
|
+
const isPaused = statusKey === "paused";
|
|
540
|
+
const isStopped = statusKey === "stopped";
|
|
541
|
+
const isWarning = statusKey === "warning";
|
|
542
|
+
const isCompleted = statusKey === "active";
|
|
543
|
+
const scriptName = summary.scriptPath ? summary.scriptPath.split("/").pop() ?? "script.ts" : "Background Script";
|
|
544
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
545
|
+
ref: cardRef,
|
|
546
|
+
style,
|
|
547
|
+
className: `dsh-schedule-popover ${isStatic ? "is-static" : ""}`,
|
|
548
|
+
role: "dialog",
|
|
549
|
+
"aria-label": "Schedule script telemetry",
|
|
550
|
+
onClick: (e) => e.stopPropagation(),
|
|
551
|
+
children: [
|
|
552
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
553
|
+
className: "dsh-schedule-popover-header",
|
|
554
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
555
|
+
className: "dsh-schedule-popover-title",
|
|
556
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(TimerIcon, { size: 14 }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: scriptName })]
|
|
557
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
558
|
+
className: "dsh-schedule-status-badge",
|
|
559
|
+
"data-status": statusKey,
|
|
560
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
561
|
+
className: "dsh-schedule-dot",
|
|
562
|
+
"data-status": statusKey
|
|
563
|
+
}), statusText]
|
|
564
|
+
})]
|
|
565
|
+
}),
|
|
566
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
567
|
+
className: "dsh-schedule-details-grid",
|
|
568
|
+
children: [
|
|
569
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
570
|
+
className: "dsh-schedule-detail-row",
|
|
571
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: "Script" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
572
|
+
className: "dsh-schedule-mono-badge",
|
|
573
|
+
title: summary.scriptPath ?? "n/a",
|
|
574
|
+
children: summary.scriptPath ?? "n/a"
|
|
575
|
+
})]
|
|
576
|
+
}),
|
|
577
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
578
|
+
className: "dsh-schedule-detail-row",
|
|
579
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: "Total Runs" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
580
|
+
className: "dsh-schedule-detail-value",
|
|
581
|
+
children: summary.totalRuns
|
|
582
|
+
})]
|
|
583
|
+
}),
|
|
584
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
585
|
+
className: "dsh-schedule-detail-row",
|
|
586
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: "Last Duration" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
587
|
+
className: "dsh-schedule-detail-value",
|
|
588
|
+
children: formatDuration(summary.lastDurationMs)
|
|
589
|
+
})]
|
|
590
|
+
}),
|
|
591
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
592
|
+
className: "dsh-schedule-detail-row",
|
|
593
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: "Last Run" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
594
|
+
className: "dsh-schedule-detail-value",
|
|
595
|
+
title: summary.lastRunAt ? new Date(summary.lastRunAt).toLocaleString() : void 0,
|
|
596
|
+
children: formatRelativeTime(summary.lastRunAt)
|
|
597
|
+
})]
|
|
598
|
+
}),
|
|
599
|
+
isWarning && summary.lastError?.message && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
600
|
+
className: "dsh-schedule-detail-row",
|
|
601
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: "Error" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
602
|
+
className: "dsh-schedule-detail-value dsh-schedule-error-value",
|
|
603
|
+
title: summary.lastError.message,
|
|
604
|
+
children: summary.lastError.message
|
|
605
|
+
})]
|
|
606
|
+
})
|
|
607
|
+
]
|
|
608
|
+
}),
|
|
609
|
+
summary.cleanupError && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
610
|
+
className: "dsh-schedule-command-error-line",
|
|
611
|
+
children: summary.cleanupError
|
|
612
|
+
}),
|
|
613
|
+
isFatal ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
614
|
+
className: "dsh-schedule-callout dsh-schedule-callout-fatal",
|
|
615
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
616
|
+
className: "dsh-schedule-callout-header",
|
|
617
|
+
children: "✖ Fatal Error"
|
|
618
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: summary.lastError?.message || "Execution failed with an unhandled exception" })]
|
|
619
|
+
}) : isPaused ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
620
|
+
className: "dsh-schedule-callout dsh-schedule-callout-paused",
|
|
621
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
622
|
+
className: "dsh-schedule-callout-header",
|
|
623
|
+
children: "⏸ Paused"
|
|
624
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: "Schedule is paused in Automation Tasks. Resume in UI to continue." })]
|
|
625
|
+
}) : isStopped ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
626
|
+
className: "dsh-schedule-callout dsh-schedule-callout-stopped",
|
|
627
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
628
|
+
className: "dsh-schedule-callout-header",
|
|
629
|
+
children: "⏹ Stopped"
|
|
630
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: summary.scriptStatus === "stopped" ? `Execution stopped cleanly after #${summary.totalRuns} runs` : effective.scheduleStatus === "deleted" ? "Automation task was deleted in Automation Tasks" : "Schedule was stopped in Automation Tasks" })]
|
|
631
|
+
}) : isWarning ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
632
|
+
className: "dsh-schedule-callout dsh-schedule-callout-warning",
|
|
633
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
634
|
+
className: "dsh-schedule-callout-header",
|
|
635
|
+
children: "⚠ Warning"
|
|
636
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: summary.lastError?.message })]
|
|
637
|
+
}) : isCompleted ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
638
|
+
className: "dsh-schedule-callout dsh-schedule-callout-completed",
|
|
639
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
640
|
+
className: "dsh-schedule-callout-header",
|
|
641
|
+
children: "✔ Completed"
|
|
642
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [
|
|
643
|
+
"Run #",
|
|
644
|
+
summary.totalRuns,
|
|
645
|
+
" completed successfully"
|
|
646
|
+
] })]
|
|
647
|
+
}) : null
|
|
648
|
+
]
|
|
649
|
+
});
|
|
650
|
+
}
|
|
651
|
+
function ConnectedScheduleScriptPromptButton({ ctx, sessionId, useProjection }) {
|
|
652
|
+
const projection = useProjection("dshScheduleScript");
|
|
653
|
+
const catalog = useScheduleCatalogStatus(ctx, sessionId, projection?.scriptPath);
|
|
654
|
+
const summary = projection ?? (catalog.parsedPrompt !== void 0 && (catalog.status === "active" || catalog.status === "paused") ? {
|
|
655
|
+
scriptStatus: "idle",
|
|
656
|
+
totalRuns: 0,
|
|
657
|
+
scriptPath: catalog.parsedPrompt.scriptPath,
|
|
658
|
+
state: catalog.parsedPrompt.state
|
|
659
|
+
} : void 0);
|
|
660
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScheduleScriptPromptButton, {
|
|
661
|
+
summary,
|
|
662
|
+
scheduleStatus: catalog.status
|
|
663
|
+
});
|
|
664
|
+
}
|
|
665
|
+
function ScheduleScriptPromptButton(props) {
|
|
666
|
+
const anchorName = `--dsh-schedule-${(0, react.useId)()}`;
|
|
667
|
+
const summary = props.summary;
|
|
668
|
+
const [open, setOpen] = (0, react.useState)(props.initialOpen ?? false);
|
|
669
|
+
const buttonRef = (0, react.useRef)(null);
|
|
670
|
+
const panelRef = (0, react.useRef)(null);
|
|
671
|
+
(0, _deepseek_ai_dsh_client_ui_primitives.useDismissOnOutsidePointer)(buttonRef, open, setOpen, panelRef);
|
|
672
|
+
if (!shouldRenderPill(summary, props.scheduleStatus)) return null;
|
|
673
|
+
const effective = resolveEffectiveScriptState(summary, props.scheduleStatus);
|
|
674
|
+
const statusKey = effective.displayStatus;
|
|
675
|
+
const statusText = effective.badgeText;
|
|
676
|
+
const fullTooltip = `Schedule: ${summary.scriptPath ? summary.scriptPath.split("/").pop() ?? "script.ts" : "Background Script"} (${statusText} · ${summary.totalRuns} runs)`;
|
|
677
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
678
|
+
className: "dsh-schedule-root",
|
|
679
|
+
children: [
|
|
680
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("style", {
|
|
681
|
+
href: "dsh-schedule-script",
|
|
682
|
+
precedence: "default",
|
|
683
|
+
children: SCHEDULE_SCRIPT_CSS
|
|
684
|
+
}),
|
|
685
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
686
|
+
ref: buttonRef,
|
|
687
|
+
style: { anchorName },
|
|
688
|
+
type: "button",
|
|
689
|
+
className: `dsh-schedule-icon-btn ${open ? "is-pressed is-active" : ""}`,
|
|
690
|
+
title: fullTooltip,
|
|
691
|
+
"aria-label": fullTooltip,
|
|
692
|
+
"aria-expanded": open,
|
|
693
|
+
onClick: (e) => {
|
|
694
|
+
e.stopPropagation();
|
|
695
|
+
setOpen(!open);
|
|
696
|
+
},
|
|
697
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(TimerIcon, { size: 14 }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
698
|
+
className: "dsh-schedule-dot-badge",
|
|
699
|
+
"data-status": statusKey
|
|
700
|
+
})]
|
|
701
|
+
}),
|
|
702
|
+
open && typeof document !== "undefined" && (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScheduleScriptPopoverCard, {
|
|
703
|
+
summary,
|
|
704
|
+
scheduleStatus: props.scheduleStatus,
|
|
705
|
+
cardRef: panelRef,
|
|
706
|
+
style: { positionAnchor: anchorName }
|
|
707
|
+
}), document.body)
|
|
708
|
+
]
|
|
709
|
+
});
|
|
710
|
+
}
|
|
711
|
+
const ScheduleScriptPill = ScheduleScriptPromptButton;
|
|
712
|
+
/**
|
|
713
|
+
* Renders the command line in the chat process/trajectory.
|
|
714
|
+
* Displays '>_ dsh-schedule-script · Completed at 10:24' with a separate line for recoverable/fatal errors when present.
|
|
715
|
+
*/
|
|
716
|
+
function ScheduleScriptCommandCard({ node }) {
|
|
717
|
+
const cardRef = (0, react.useRef)(null);
|
|
718
|
+
let payload = null;
|
|
719
|
+
if (node.args) try {
|
|
720
|
+
payload = JSON.parse(node.args);
|
|
721
|
+
} catch {}
|
|
722
|
+
const isRunning = node.outcome === null;
|
|
723
|
+
const isOutcomeError = node.outcome?.kind === "error";
|
|
724
|
+
const completedTime = payload && "durationMs" in payload && typeof payload.durationMs === "number" ? payload.timestamp + payload.durationMs : payload?.timestamp ?? node.time;
|
|
725
|
+
const timeSuffix = completedTime ? ` at ${formatClockTime(completedTime)}` : "";
|
|
726
|
+
const summary = isRunning ? "Running" : isOutcomeError ? `Failed${timeSuffix}` : `Completed${timeSuffix}`;
|
|
727
|
+
const errorText = payload && "error" in payload && typeof payload.error === "string" ? payload.error : void 0;
|
|
728
|
+
const isFatal = Boolean(isOutcomeError || payload && "fatal" in payload && payload.fatal);
|
|
729
|
+
(0, react.useEffect)(() => {
|
|
730
|
+
if (!errorText && !isFatal && !isOutcomeError) return;
|
|
731
|
+
const expandDisclosures = () => {
|
|
732
|
+
const el = cardRef.current;
|
|
733
|
+
if (!el) return;
|
|
734
|
+
const activeEl = typeof document !== "undefined" ? document.activeElement : null;
|
|
735
|
+
const stepProcess = el.closest("[data-step-process]");
|
|
736
|
+
if (stepProcess) {
|
|
737
|
+
const groupBtn = stepProcess.querySelector("button[aria-expanded=\"false\"]");
|
|
738
|
+
if (groupBtn) groupBtn.click();
|
|
739
|
+
}
|
|
740
|
+
const turnAttr = stepProcess?.getAttribute("data-chat-turn");
|
|
741
|
+
let turnBtn = null;
|
|
742
|
+
if (turnAttr) turnBtn = document.querySelector(`button[data-turn-process="${turnAttr}"][aria-expanded="false"]`);
|
|
743
|
+
if (!turnBtn) {
|
|
744
|
+
const flow = stepProcess?.parentElement;
|
|
745
|
+
if (flow) turnBtn = flow.querySelector("button[data-turn-process][aria-expanded=\"false\"]");
|
|
746
|
+
}
|
|
747
|
+
if (turnBtn) turnBtn.click();
|
|
748
|
+
if (activeEl && typeof activeEl.focus === "function" && document.activeElement !== activeEl) activeEl.focus();
|
|
749
|
+
};
|
|
750
|
+
expandDisclosures();
|
|
751
|
+
const t1 = setTimeout(expandDisclosures, 50);
|
|
752
|
+
const t2 = setTimeout(expandDisclosures, 200);
|
|
753
|
+
return () => {
|
|
754
|
+
clearTimeout(t1);
|
|
755
|
+
clearTimeout(t2);
|
|
756
|
+
};
|
|
757
|
+
}, [
|
|
758
|
+
errorText,
|
|
759
|
+
isFatal,
|
|
760
|
+
isOutcomeError
|
|
761
|
+
]);
|
|
762
|
+
const collapsedContent = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
763
|
+
className: "dsh-schedule-command-separator",
|
|
764
|
+
"data-shimmer-decoration": true,
|
|
765
|
+
"aria-hidden": true
|
|
766
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
767
|
+
className: "dsh-schedule-command-status",
|
|
768
|
+
"data-error": isOutcomeError ? "true" : void 0,
|
|
769
|
+
title: completedTime ? new Date(completedTime).toLocaleString() : void 0,
|
|
770
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.TextShimmer, {
|
|
771
|
+
active: isRunning,
|
|
772
|
+
children: summary
|
|
773
|
+
})
|
|
774
|
+
})] });
|
|
775
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
776
|
+
ref: cardRef,
|
|
777
|
+
className: "dsh-schedule-command-card",
|
|
778
|
+
"data-state": isOutcomeError ? "error" : isRunning ? "running" : "ok",
|
|
779
|
+
children: [
|
|
780
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("style", {
|
|
781
|
+
href: "dsh-schedule-script",
|
|
782
|
+
precedence: "default",
|
|
783
|
+
children: SCHEDULE_SCRIPT_CSS
|
|
784
|
+
}),
|
|
785
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.DisclosureRow, {
|
|
786
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconApiOutlineRegular, { size: 14 }),
|
|
787
|
+
title: node.name ?? "dsh-schedule-script",
|
|
788
|
+
running: isRunning,
|
|
789
|
+
open: false,
|
|
790
|
+
expandable: false,
|
|
791
|
+
onToggle: () => {},
|
|
792
|
+
collapsedContent
|
|
793
|
+
}),
|
|
794
|
+
errorText && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
795
|
+
className: "dsh-schedule-command-error-line",
|
|
796
|
+
"data-fatal": isFatal ? "true" : void 0,
|
|
797
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
798
|
+
className: "dsh-schedule-command-error-bullet",
|
|
799
|
+
"aria-hidden": true,
|
|
800
|
+
children: isFatal ? "✖" : "⚠"
|
|
801
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
802
|
+
className: "dsh-schedule-command-error-text",
|
|
803
|
+
title: errorText,
|
|
804
|
+
children: errorText
|
|
805
|
+
})]
|
|
806
|
+
})
|
|
807
|
+
]
|
|
808
|
+
});
|
|
809
|
+
}
|
|
810
|
+
const name = "dsh-schedule-script";
|
|
811
|
+
const inject = [
|
|
812
|
+
"slots",
|
|
813
|
+
"remote",
|
|
814
|
+
"remote.schedule"
|
|
815
|
+
];
|
|
816
|
+
function apply(ctx) {
|
|
817
|
+
ctx.effect(() => ctx.slots.inject("conversation.input.left", () => ctx.slots.register({
|
|
818
|
+
name: "conversation.input.left",
|
|
819
|
+
id: "schedule-script.prompt-button",
|
|
820
|
+
order: 85,
|
|
821
|
+
inject: (sessionId) => ({
|
|
822
|
+
ctx,
|
|
823
|
+
sessionId
|
|
824
|
+
})
|
|
825
|
+
}, ConnectedScheduleScriptPromptButton)), "schedule-script: prompt-button");
|
|
826
|
+
ctx.effect(() => ctx.slots.inject("conversation.chat.commandview", () => ctx.slots.register({
|
|
827
|
+
name: "conversation.chat.commandview",
|
|
828
|
+
key: SCHEDULE_SCRIPT_EVENT_NAME
|
|
829
|
+
}, ScheduleScriptCommandCard)), "schedule-script: commandview");
|
|
830
|
+
}
|
|
831
|
+
exports.ConnectedScheduleScriptPromptButton = ConnectedScheduleScriptPromptButton;
|
|
832
|
+
exports.ScheduleScriptCommandCard = ScheduleScriptCommandCard;
|
|
833
|
+
exports.ScheduleScriptPill = ScheduleScriptPill;
|
|
834
|
+
exports.ScheduleScriptPopoverCard = ScheduleScriptPopoverCard;
|
|
835
|
+
exports.ScheduleScriptPromptButton = ScheduleScriptPromptButton;
|
|
836
|
+
exports.TimerIcon = TimerIcon;
|
|
837
|
+
exports.apply = apply;
|
|
838
|
+
exports.formatClockTime = formatClockTime;
|
|
839
|
+
exports.formatDuration = formatDuration;
|
|
840
|
+
exports.formatRelativeTime = formatRelativeTime;
|
|
841
|
+
exports.inject = inject;
|
|
842
|
+
exports.name = name;
|
|
843
|
+
exports.resolveEffectiveScriptState = resolveEffectiveScriptState;
|
|
844
|
+
exports.shouldRenderPill = shouldRenderPill;
|
|
845
|
+
exports.useScheduleCatalogStatus = useScheduleCatalogStatus;
|
|
846
|
+
return module.exports;
|
|
847
|
+
}
|
|
848
|
+
});
|