@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/src/parser.ts
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SCHEDULE_SCRIPT_KIND,
|
|
3
|
+
type ScheduleScriptPromptPayload,
|
|
4
|
+
} from "./types.ts";
|
|
5
|
+
|
|
6
|
+
interface RawReminder {
|
|
7
|
+
readonly schedule_id: string;
|
|
8
|
+
readonly occurrence_at?: string;
|
|
9
|
+
readonly reminder_prompt: string;
|
|
10
|
+
readonly [key: string]: unknown;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface ParsedScriptJob {
|
|
14
|
+
readonly scheduleId: string;
|
|
15
|
+
readonly reminder: RawReminder;
|
|
16
|
+
readonly payload: ScheduleScriptPromptPayload;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface ParsedBatch {
|
|
20
|
+
readonly scripts: readonly ParsedScriptJob[];
|
|
21
|
+
readonly remainingReminders: readonly RawReminder[];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function formatScriptPrompt(
|
|
25
|
+
payload: Omit<ScheduleScriptPromptPayload, "kind">,
|
|
26
|
+
): string {
|
|
27
|
+
return JSON.stringify({
|
|
28
|
+
kind: SCHEDULE_SCRIPT_KIND,
|
|
29
|
+
scriptPath: payload.scriptPath,
|
|
30
|
+
state: payload.state,
|
|
31
|
+
...(payload.timeoutMs ? { timeoutMs: payload.timeoutMs } : {}),
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function parseScriptPrompt(
|
|
36
|
+
promptText: string,
|
|
37
|
+
): ScheduleScriptPromptPayload | null {
|
|
38
|
+
if (!promptText) return null;
|
|
39
|
+
try {
|
|
40
|
+
const parsed = JSON.parse(promptText.trim());
|
|
41
|
+
if (
|
|
42
|
+
parsed &&
|
|
43
|
+
typeof parsed === "object" &&
|
|
44
|
+
parsed.kind === SCHEDULE_SCRIPT_KIND &&
|
|
45
|
+
typeof parsed.scriptPath === "string" &&
|
|
46
|
+
"state" in parsed &&
|
|
47
|
+
parsed.state !== undefined
|
|
48
|
+
) {
|
|
49
|
+
const timeoutMs =
|
|
50
|
+
typeof parsed.timeoutMs === "number" &&
|
|
51
|
+
Number.isFinite(parsed.timeoutMs) &&
|
|
52
|
+
parsed.timeoutMs > 0
|
|
53
|
+
? parsed.timeoutMs
|
|
54
|
+
: undefined;
|
|
55
|
+
return {
|
|
56
|
+
kind: SCHEDULE_SCRIPT_KIND,
|
|
57
|
+
scriptPath: parsed.scriptPath,
|
|
58
|
+
state: parsed.state,
|
|
59
|
+
...(timeoutMs ? { timeoutMs } : {}),
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
} catch {
|
|
63
|
+
// Not JSON or does not match shape
|
|
64
|
+
}
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export function parseReminderBatch(messageText: string): ParsedBatch | null {
|
|
69
|
+
const line = messageText
|
|
70
|
+
.split("\n")
|
|
71
|
+
.find((l) => l.startsWith("reminders_json:"));
|
|
72
|
+
if (!line) return null;
|
|
73
|
+
|
|
74
|
+
const jsonText = line.slice("reminders_json:".length).trim();
|
|
75
|
+
let rawItems: unknown;
|
|
76
|
+
try {
|
|
77
|
+
rawItems = JSON.parse(jsonText);
|
|
78
|
+
} catch {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
if (!Array.isArray(rawItems)) return null;
|
|
82
|
+
|
|
83
|
+
const scripts: ParsedScriptJob[] = [];
|
|
84
|
+
const remainingReminders: RawReminder[] = [];
|
|
85
|
+
|
|
86
|
+
for (const item of rawItems) {
|
|
87
|
+
if (
|
|
88
|
+
!item ||
|
|
89
|
+
typeof item !== "object" ||
|
|
90
|
+
typeof (item as Record<string, unknown>).reminder_prompt !== "string" ||
|
|
91
|
+
typeof (item as Record<string, unknown>).schedule_id !== "string"
|
|
92
|
+
) {
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
const reminder = item as RawReminder;
|
|
96
|
+
const scriptPayload = parseScriptPrompt(reminder.reminder_prompt);
|
|
97
|
+
if (scriptPayload) {
|
|
98
|
+
scripts.push({
|
|
99
|
+
scheduleId: reminder.schedule_id,
|
|
100
|
+
reminder,
|
|
101
|
+
payload: scriptPayload,
|
|
102
|
+
});
|
|
103
|
+
} else {
|
|
104
|
+
remainingReminders.push(reminder);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (scripts.length === 0) return null;
|
|
109
|
+
|
|
110
|
+
return {
|
|
111
|
+
scripts,
|
|
112
|
+
remainingReminders,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export function formatRemainingBatch(
|
|
117
|
+
remainingReminders: readonly RawReminder[],
|
|
118
|
+
originalText: string,
|
|
119
|
+
): string {
|
|
120
|
+
const lineIdx = originalText.indexOf("reminders_json:");
|
|
121
|
+
if (lineIdx === -1) return originalText;
|
|
122
|
+
|
|
123
|
+
const lineEnd = originalText.indexOf("\n", lineIdx);
|
|
124
|
+
const prefix = originalText.slice(0, lineIdx);
|
|
125
|
+
const suffix = lineEnd === -1 ? "" : originalText.slice(lineEnd);
|
|
126
|
+
return `${prefix}reminders_json: ${JSON.stringify(remainingReminders)}${suffix}`;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export function formatWakingPrompt(
|
|
130
|
+
scriptPrompts: readonly string[],
|
|
131
|
+
remainingBatchText?: string,
|
|
132
|
+
): string {
|
|
133
|
+
const parts = scriptPrompts.filter(Boolean);
|
|
134
|
+
if (remainingBatchText?.trim()) {
|
|
135
|
+
parts.push(remainingBatchText);
|
|
136
|
+
}
|
|
137
|
+
return parts.join("\n\n");
|
|
138
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { readFile, writeFile } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { pathToFileURL } from "node:url";
|
|
4
|
+
import type { ScriptContext } from "./types.ts";
|
|
5
|
+
|
|
6
|
+
async function run(): Promise<void> {
|
|
7
|
+
const [, , scriptPath, inputPath, outputPath] = process.argv;
|
|
8
|
+
if (!scriptPath || !inputPath || !outputPath) {
|
|
9
|
+
console.error("Usage: runner-cli.ts <scriptPath> <inputPath> <outputPath>");
|
|
10
|
+
process.exit(2);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
try {
|
|
14
|
+
const rawInput = await readFile(inputPath, "utf8");
|
|
15
|
+
const input = JSON.parse(rawInput) as ScriptContext;
|
|
16
|
+
if (!("state" in input) || input.state === undefined) {
|
|
17
|
+
throw new Error("Invalid script context: 'state' is mandatory");
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const resolvedScript = path.resolve(process.cwd(), scriptPath);
|
|
21
|
+
const mod = (await import(pathToFileURL(resolvedScript).href)) as {
|
|
22
|
+
main?: (ctx: ScriptContext) => unknown;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
if (typeof mod.main !== "function") {
|
|
26
|
+
throw new Error(
|
|
27
|
+
`Script '${scriptPath}' does not export a 'main' function`,
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const rawResult = await mod.main(input);
|
|
32
|
+
if (
|
|
33
|
+
typeof rawResult !== "object" ||
|
|
34
|
+
rawResult === null ||
|
|
35
|
+
!("state" in rawResult) ||
|
|
36
|
+
rawResult.state === undefined
|
|
37
|
+
) {
|
|
38
|
+
throw new Error("Invalid script result: 'state' is mandatory");
|
|
39
|
+
}
|
|
40
|
+
if (
|
|
41
|
+
"prompt" in rawResult &&
|
|
42
|
+
rawResult.prompt !== undefined &&
|
|
43
|
+
typeof rawResult.prompt !== "string"
|
|
44
|
+
) {
|
|
45
|
+
throw new Error("Invalid script result: 'prompt' must be a string");
|
|
46
|
+
}
|
|
47
|
+
if (
|
|
48
|
+
"error" in rawResult &&
|
|
49
|
+
rawResult.error !== undefined &&
|
|
50
|
+
typeof rawResult.error !== "string"
|
|
51
|
+
) {
|
|
52
|
+
throw new Error("Invalid script result: 'error' must be a string");
|
|
53
|
+
}
|
|
54
|
+
if (
|
|
55
|
+
"stop" in rawResult &&
|
|
56
|
+
rawResult.stop !== undefined &&
|
|
57
|
+
typeof rawResult.stop !== "boolean"
|
|
58
|
+
) {
|
|
59
|
+
throw new Error("Invalid script result: 'stop' must be a boolean");
|
|
60
|
+
}
|
|
61
|
+
const result = rawResult;
|
|
62
|
+
|
|
63
|
+
await writeFile(outputPath, JSON.stringify({ success: true, result }));
|
|
64
|
+
process.exit(0);
|
|
65
|
+
} catch (error: unknown) {
|
|
66
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
67
|
+
const stack = error instanceof Error ? error.stack : undefined;
|
|
68
|
+
try {
|
|
69
|
+
await writeFile(
|
|
70
|
+
outputPath,
|
|
71
|
+
JSON.stringify({ success: false, error: message, stack }),
|
|
72
|
+
);
|
|
73
|
+
} catch {
|
|
74
|
+
// ignore secondary write errors
|
|
75
|
+
}
|
|
76
|
+
console.error(stack ?? message);
|
|
77
|
+
process.exit(1);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
void run();
|
package/src/skill.ts
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
export const SCHEDULE_SCRIPT_SKILL_NAME = "schedule-script";
|
|
2
|
+
export const SCHEDULE_SCRIPT_SKILL_DESCRIPTION =
|
|
3
|
+
"Schedule recurring TypeScript background scripts without consuming LLM tokens.";
|
|
4
|
+
|
|
5
|
+
export const SCHEDULE_SCRIPT_SKILL_CONTENT = `
|
|
6
|
+
# Schedule Script Skill
|
|
7
|
+
|
|
8
|
+
Run TypeScript scripts periodically in the background using DSH Automation Tasks.
|
|
9
|
+
Iterations execute in isolated Node 26 subprocesses and consume 0 LLM tokens during silent monitoring.
|
|
10
|
+
|
|
11
|
+
## Script Contract
|
|
12
|
+
|
|
13
|
+
Scripts are standalone files with **zero imports**. Define your script-specific \`State\` interface, with the runner contract inlined directly on \`main\`:
|
|
14
|
+
|
|
15
|
+
\`\`\`ts
|
|
16
|
+
// 1. Define your custom State shape (mandatory initial state passed when scheduled)
|
|
17
|
+
interface State {
|
|
18
|
+
target: string;
|
|
19
|
+
count: number;
|
|
20
|
+
lastChecked?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// 2. Export main with the inlined runner contract
|
|
24
|
+
export async function main(ctx: {
|
|
25
|
+
state: State; // Preserved state (mandatory, seeded when scheduled)
|
|
26
|
+
sessionId: string; // Active DSH session ID
|
|
27
|
+
}): Promise<{
|
|
28
|
+
state: State; // REQUIRED: state preserved for next run
|
|
29
|
+
prompt?: string; // OPTIONAL: awakens agent in chat with this prompt
|
|
30
|
+
error?: string; // OPTIONAL: recoverable warning shown in UI row
|
|
31
|
+
stop?: boolean; // OPTIONAL: stops recurrence when true
|
|
32
|
+
}> {
|
|
33
|
+
const count = ctx.state.count + 1;
|
|
34
|
+
|
|
35
|
+
// Case 1: Silent poll (0 LLM tokens, updates status pill quietly)
|
|
36
|
+
if (count < 3) {
|
|
37
|
+
return {
|
|
38
|
+
state: { ...ctx.state, count, lastChecked: new Date().toISOString() },
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Case 2: Recoverable warning (surfaces in UI row, keeps schedule active)
|
|
43
|
+
if (count === 3) {
|
|
44
|
+
return {
|
|
45
|
+
state: { ...ctx.state, count, lastChecked: new Date().toISOString() },
|
|
46
|
+
error: "Temporary network timeout while checking endpoint (will retry)",
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Case 3: Prompt (awakens agent in chat to reason and take action)
|
|
51
|
+
return {
|
|
52
|
+
state: { ...ctx.state, count, lastChecked: new Date().toISOString() },
|
|
53
|
+
prompt: \`Polled run #\${count}: found 3 tasks ready for processing.\`,
|
|
54
|
+
stop: true, // auto-stops further recurrence
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
\`\`\`
|
|
58
|
+
|
|
59
|
+
### Summary of Inlined Return Fields
|
|
60
|
+
| Field | Type | Behavior |
|
|
61
|
+
| :--- | :--- | :--- |
|
|
62
|
+
| \`state\` | \`State\` (required) | Preserved and passed back into \`ctx.state\` on the next run. |
|
|
63
|
+
| \`prompt\` | \`string\` (optional) | Replaces automation prompt with this text and **awakens the agent** to respond. |
|
|
64
|
+
| \`error\` | \`string\` (optional) | Marks run with a recoverable warning in the UI row; **keeps schedule running** without LLM call. |
|
|
65
|
+
| \`stop\` | \`boolean\` (optional) | If \`true\`, cleanly stops further recurrence. |
|
|
66
|
+
|
|
67
|
+
### Critical vs Recoverable Errors
|
|
68
|
+
- **Recoverable Errors**: Handled in your script and returned via \`error: "..."\`. Surfaced in the UI status row without stopping the schedule or invoking the LLM.
|
|
69
|
+
- **Critical Errors**: Uncaught exceptions, syntax errors, or execution timeouts automatically halt recurrence, mark the schedule as stopped, and surface the error in the UI.
|
|
70
|
+
|
|
71
|
+
## Tool Activation Notice
|
|
72
|
+
|
|
73
|
+
The tools \`test_schedule_script\` and \`schedule_script\` are conditionally activated by loading this skill. Tool admissions are resolved at turn boundaries, which means **these tools are only visible to the agent on the NEXT turn**. They cannot be called within the same turn that invokes the skill.
|
|
74
|
+
|
|
75
|
+
## Mandatory Two-Step Workflow
|
|
76
|
+
|
|
77
|
+
Scheduling scripts is strictly a **two-step conversational process**.
|
|
78
|
+
|
|
79
|
+
### Step 1: Prepare Script & Propose Parameters (Turn 1)
|
|
80
|
+
|
|
81
|
+
1. Write or update the standalone TypeScript script in the workspace (e.g. \`.agents/scripts/<name>.ts\`).
|
|
82
|
+
2. Do **NOT** attempt to call \`test_schedule_script\` or \`schedule_script\` in this turn (they are not admitted yet).
|
|
83
|
+
3. Present the proposed schedule parameters to the user and request confirmation. End the turn immediately.
|
|
84
|
+
|
|
85
|
+
#### Example Output to the User:
|
|
86
|
+
\`\`\`markdown
|
|
87
|
+
I have created the background poller script at \`.agents/scripts/poller.ts\`.
|
|
88
|
+
|
|
89
|
+
**Proposed Schedule:**
|
|
90
|
+
- **Script Path:** \`.agents/scripts/poller.ts\`
|
|
91
|
+
- **Title:** Check Endpoint Health
|
|
92
|
+
- **Interval:** 60s
|
|
93
|
+
- **Initial State:** \`{ "target": "https://api.example.com/health", "count": 0 }\`
|
|
94
|
+
|
|
95
|
+
Please confirm to proceed with testing and scheduling this task.
|
|
96
|
+
\`\`\`
|
|
97
|
+
|
|
98
|
+
### Step 2: Test & Schedule Upon Confirmation (Turn 2)
|
|
99
|
+
|
|
100
|
+
Once the user confirms in the next turn, \`test_schedule_script\` and \`schedule_script\` are admitted and ready to use:
|
|
101
|
+
|
|
102
|
+
1. **Test the script**: Execute \`test_schedule_script\` with the script path and initial state:
|
|
103
|
+
\`\`\`json
|
|
104
|
+
{
|
|
105
|
+
"script_path": ".agents/scripts/poller.ts",
|
|
106
|
+
"state": { "target": "https://api.example.com/health", "count": 0 }
|
|
107
|
+
}
|
|
108
|
+
\`\`\`
|
|
109
|
+
Verify \`success: true\`. Fix any syntax or runtime errors before proceeding.
|
|
110
|
+
|
|
111
|
+
2. **Schedule the script**: Only after \`test_schedule_script\` succeeds, call \`schedule_script\`:
|
|
112
|
+
\`\`\`json
|
|
113
|
+
{
|
|
114
|
+
"script_path": ".agents/scripts/poller.ts",
|
|
115
|
+
"title": "Check Endpoint Health",
|
|
116
|
+
"interval_seconds": 60,
|
|
117
|
+
"state": { "target": "https://api.example.com/health", "count": 0 }
|
|
118
|
+
}
|
|
119
|
+
\`\`\`
|
|
120
|
+
`.trim();
|
package/src/styles.ts
ADDED
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
export const SCHEDULE_SCRIPT_CSS = `
|
|
2
|
+
.dsh-schedule-root,
|
|
3
|
+
.dsh-schedule-root * {
|
|
4
|
+
box-sizing: border-box;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.dsh-schedule-root {
|
|
8
|
+
display: inline-flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
position: relative;
|
|
11
|
+
font-family: inherit;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/* 28px Icon-Only Button */
|
|
15
|
+
.dsh-schedule-icon-btn {
|
|
16
|
+
width: 28px;
|
|
17
|
+
height: 28px;
|
|
18
|
+
padding: 0;
|
|
19
|
+
display: inline-flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
justify-content: center;
|
|
22
|
+
flex: none;
|
|
23
|
+
border-radius: var(--dsw-radius-sm, 4px);
|
|
24
|
+
background: transparent;
|
|
25
|
+
border: none;
|
|
26
|
+
cursor: pointer;
|
|
27
|
+
position: relative;
|
|
28
|
+
color: var(--dsw-alias-label-secondary, #64748b);
|
|
29
|
+
transition: all 0.15s ease;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.dsh-schedule-icon-btn:hover {
|
|
33
|
+
background: var(--dsw-alias-interactive-bg-hover, rgba(0, 0, 0, 0.05));
|
|
34
|
+
color: var(--dsw-alias-label-primary, inherit);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.dsh-schedule-icon-btn.is-active,
|
|
38
|
+
.dsh-schedule-icon-btn.is-pressed {
|
|
39
|
+
background: var(--dsw-alias-interactive-bg-active, rgba(0, 0, 0, 0.08));
|
|
40
|
+
color: var(--dsw-alias-state-business-primary, inherit);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.dsh-schedule-icon-btn:focus-visible {
|
|
44
|
+
outline: 2px solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary, #2563eb));
|
|
45
|
+
outline-offset: -2px;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* Status Dot Badge on Icon */
|
|
49
|
+
.dsh-schedule-dot {
|
|
50
|
+
width: 6px;
|
|
51
|
+
height: 6px;
|
|
52
|
+
border-radius: 50%;
|
|
53
|
+
flex-shrink: 0;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.dsh-schedule-dot-badge {
|
|
57
|
+
position: absolute;
|
|
58
|
+
top: 3px;
|
|
59
|
+
right: 3px;
|
|
60
|
+
width: 7px;
|
|
61
|
+
height: 7px;
|
|
62
|
+
border-radius: 50%;
|
|
63
|
+
box-shadow: 0 0 0 1.5px var(--dsw-alias-bg-base, #ffffff);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.dsh-schedule-dot[data-status="active"],
|
|
67
|
+
.dsh-schedule-dot-badge[data-status="active"] {
|
|
68
|
+
background: var(--dsw-alias-state-success-primary, #10b981);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.dsh-schedule-dot[data-status="warning"],
|
|
72
|
+
.dsh-schedule-dot-badge[data-status="warning"],
|
|
73
|
+
.dsh-schedule-dot[data-status="paused"],
|
|
74
|
+
.dsh-schedule-dot-badge[data-status="paused"] {
|
|
75
|
+
background: var(--dsw-alias-state-warn-primary, #f59e0b);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.dsh-schedule-dot[data-status="error"],
|
|
79
|
+
.dsh-schedule-dot-badge[data-status="error"] {
|
|
80
|
+
background: var(--dsw-alias-state-error-primary, #ef4444);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.dsh-schedule-dot[data-status="stopped"],
|
|
84
|
+
.dsh-schedule-dot-badge[data-status="stopped"] {
|
|
85
|
+
background: var(--dsw-alias-label-tertiary, #94a3b8);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/* Popover Card Component - Portaled to document.body to avoid parent clipping */
|
|
89
|
+
.dsh-schedule-popover {
|
|
90
|
+
position: fixed;
|
|
91
|
+
top: max(12px, var(--dsh-frame-overlay-top, 12px));
|
|
92
|
+
left: 12px;
|
|
93
|
+
right: anchor(right);
|
|
94
|
+
bottom: calc(anchor(top) + 8px);
|
|
95
|
+
align-self: safe end;
|
|
96
|
+
justify-self: safe end;
|
|
97
|
+
margin: 0;
|
|
98
|
+
height: fit-content;
|
|
99
|
+
box-sizing: border-box;
|
|
100
|
+
font-family: var(--dsw-font-sans, system-ui, -apple-system, sans-serif);
|
|
101
|
+
width: 310px;
|
|
102
|
+
max-width: calc(100vw - 24px);
|
|
103
|
+
max-height: calc(100vh - 24px);
|
|
104
|
+
background: var(--dsw-alias-bg-layer-1, var(--dsw-alias-bg-base, #ffffff));
|
|
105
|
+
border: 1px solid var(--dsw-alias-border-l2, var(--dsw-alias-border-l1, rgba(0, 0, 0, 0.12)));
|
|
106
|
+
border-radius: var(--dsw-radius-md, 8px);
|
|
107
|
+
padding: 12px 14px;
|
|
108
|
+
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14), 0 2px 6px rgba(0, 0, 0, 0.06);
|
|
109
|
+
color: var(--dsw-alias-label-primary, #0f172a);
|
|
110
|
+
font-size: 13px;
|
|
111
|
+
line-height: 1.5;
|
|
112
|
+
z-index: 1000;
|
|
113
|
+
display: flex;
|
|
114
|
+
flex-direction: column;
|
|
115
|
+
gap: 10px;
|
|
116
|
+
overflow-y: auto;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.dsh-schedule-popover * {
|
|
120
|
+
box-sizing: border-box;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/* Static variant for Ladle stories or embedded previews */
|
|
124
|
+
.dsh-schedule-popover.is-static {
|
|
125
|
+
position: relative;
|
|
126
|
+
inset: auto;
|
|
127
|
+
max-width: 100%;
|
|
128
|
+
z-index: auto;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.dsh-schedule-popover-header {
|
|
132
|
+
display: flex;
|
|
133
|
+
align-items: center;
|
|
134
|
+
justify-content: space-between;
|
|
135
|
+
gap: 8px;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.dsh-schedule-popover-title {
|
|
139
|
+
font-weight: 600;
|
|
140
|
+
font-size: 13px;
|
|
141
|
+
display: flex;
|
|
142
|
+
align-items: baseline;
|
|
143
|
+
gap: 6px;
|
|
144
|
+
color: var(--dsw-alias-label-primary, inherit);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.dsh-schedule-popover-title svg {
|
|
148
|
+
align-self: baseline;
|
|
149
|
+
transform: translateY(2px);
|
|
150
|
+
flex-shrink: 0;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.dsh-schedule-status-badge {
|
|
154
|
+
display: inline-flex;
|
|
155
|
+
align-items: center;
|
|
156
|
+
gap: 4px;
|
|
157
|
+
padding: 2px 7px;
|
|
158
|
+
border-radius: var(--dsw-radius-xs, 4px);
|
|
159
|
+
font-size: 11px;
|
|
160
|
+
font-weight: 500;
|
|
161
|
+
line-height: 1;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.dsh-schedule-status-badge[data-status="active"] {
|
|
165
|
+
background: color-mix(in srgb, var(--dsw-alias-state-success-primary, #10b981) 12%, transparent);
|
|
166
|
+
color: var(--dsw-alias-state-success-primary, #059669);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.dsh-schedule-status-badge[data-status="warning"],
|
|
170
|
+
.dsh-schedule-status-badge[data-status="paused"] {
|
|
171
|
+
background: color-mix(in srgb, var(--dsw-alias-state-warn-primary, #f59e0b) 12%, transparent);
|
|
172
|
+
color: var(--dsw-alias-state-warn-label, var(--dsw-alias-state-warn-primary, #d97706));
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.dsh-schedule-status-badge[data-status="error"] {
|
|
176
|
+
background: color-mix(in srgb, var(--dsw-alias-state-error-primary, #ef4444) 12%, transparent);
|
|
177
|
+
color: var(--dsw-alias-state-error-primary, #dc2626);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.dsh-schedule-status-badge[data-status="stopped"] {
|
|
181
|
+
background: color-mix(in srgb, var(--dsw-alias-label-tertiary, #94a3b8) 15%, transparent);
|
|
182
|
+
color: var(--dsw-alias-label-tertiary, #64748b);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.dsh-schedule-details-grid {
|
|
186
|
+
display: flex;
|
|
187
|
+
flex-direction: column;
|
|
188
|
+
gap: 6px;
|
|
189
|
+
font-size: 12px;
|
|
190
|
+
color: var(--dsw-alias-label-secondary, #64748b);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.dsh-schedule-detail-row {
|
|
194
|
+
display: flex;
|
|
195
|
+
align-items: center;
|
|
196
|
+
justify-content: space-between;
|
|
197
|
+
gap: 8px;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.dsh-schedule-detail-value {
|
|
201
|
+
color: var(--dsw-alias-label-primary, inherit);
|
|
202
|
+
font-weight: 500;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.dsh-schedule-mono-badge {
|
|
206
|
+
font-family: var(--dsw-font-mono, monospace);
|
|
207
|
+
font-size: 11px;
|
|
208
|
+
padding: 2px 6px;
|
|
209
|
+
border-radius: var(--dsw-radius-xs, 4px);
|
|
210
|
+
background: var(--dsw-alias-interactive-bg-subtle, rgba(0, 0, 0, 0.04));
|
|
211
|
+
border: 1px solid var(--dsw-alias-border-l1, rgba(0, 0, 0, 0.08));
|
|
212
|
+
color: var(--dsw-alias-label-primary, inherit);
|
|
213
|
+
max-width: 190px;
|
|
214
|
+
overflow: hidden;
|
|
215
|
+
text-overflow: ellipsis;
|
|
216
|
+
white-space: nowrap;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.dsh-schedule-error-value {
|
|
220
|
+
color: var(--dsw-alias-state-warn-label, var(--dsw-alias-state-warn-primary, #d97706));
|
|
221
|
+
max-width: 190px;
|
|
222
|
+
overflow: hidden;
|
|
223
|
+
text-overflow: ellipsis;
|
|
224
|
+
white-space: nowrap;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/* Fatal Error Callout */
|
|
228
|
+
.dsh-schedule-callout {
|
|
229
|
+
padding: 8px 10px;
|
|
230
|
+
border-radius: var(--dsw-radius-sm, 6px);
|
|
231
|
+
font-size: 12px;
|
|
232
|
+
line-height: 1.4;
|
|
233
|
+
white-space: pre-wrap;
|
|
234
|
+
word-break: break-word;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.dsh-schedule-callout-header {
|
|
238
|
+
font-weight: 600;
|
|
239
|
+
margin-bottom: 2px;
|
|
240
|
+
display: flex;
|
|
241
|
+
align-items: center;
|
|
242
|
+
gap: 4px;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.dsh-schedule-callout-fatal {
|
|
246
|
+
background: color-mix(in srgb, var(--dsw-alias-state-error-primary, #ef4444) 8%, transparent);
|
|
247
|
+
border: 1px solid color-mix(in srgb, var(--dsw-alias-state-error-primary, #ef4444) 25%, transparent);
|
|
248
|
+
color: var(--dsw-alias-state-error-primary, #dc2626);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.dsh-schedule-callout-warning {
|
|
252
|
+
background: color-mix(in srgb, var(--dsw-alias-state-warn-primary, #f59e0b) 8%, transparent);
|
|
253
|
+
border: 1px solid color-mix(in srgb, var(--dsw-alias-state-warn-primary, #f59e0b) 25%, transparent);
|
|
254
|
+
color: var(--dsw-alias-state-warn-label, var(--dsw-alias-state-warn-primary, #d97706));
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.dsh-schedule-callout-paused {
|
|
258
|
+
background: color-mix(in srgb, var(--dsw-alias-state-warn-primary, #f59e0b) 8%, transparent);
|
|
259
|
+
border: 1px solid color-mix(in srgb, var(--dsw-alias-state-warn-primary, #f59e0b) 25%, transparent);
|
|
260
|
+
color: var(--dsw-alias-state-warn-label, var(--dsw-alias-state-warn-primary, #d97706));
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
.dsh-schedule-callout-completed {
|
|
264
|
+
background: color-mix(in srgb, var(--dsw-alias-state-success-primary, #10b981) 8%, transparent);
|
|
265
|
+
border: 1px solid color-mix(in srgb, var(--dsw-alias-state-success-primary, #10b981) 25%, transparent);
|
|
266
|
+
color: var(--dsw-alias-state-success-primary, #059669);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.dsh-schedule-callout-stopped {
|
|
270
|
+
background: color-mix(in srgb, var(--dsw-alias-label-tertiary, #94a3b8) 10%, transparent);
|
|
271
|
+
border: 1px solid color-mix(in srgb, var(--dsw-alias-label-tertiary, #94a3b8) 25%, transparent);
|
|
272
|
+
color: var(--dsw-alias-label-secondary, #64748b);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/* Command Row in Chat Trajectory */
|
|
276
|
+
.dsh-schedule-command-card {
|
|
277
|
+
display: flex;
|
|
278
|
+
flex-direction: column;
|
|
279
|
+
width: 100%;
|
|
280
|
+
min-width: 0;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
.dsh-schedule-command-separator {
|
|
284
|
+
flex: none;
|
|
285
|
+
width: 2px;
|
|
286
|
+
height: 2px;
|
|
287
|
+
margin: 0 8px;
|
|
288
|
+
border-radius: 1px;
|
|
289
|
+
background: var(--dsw-alias-label-caption, #cbd5e1);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
.dsh-schedule-command-status {
|
|
293
|
+
min-width: 0;
|
|
294
|
+
overflow: hidden;
|
|
295
|
+
flex: 0 1 auto;
|
|
296
|
+
font-size: var(--dsh-content-font-size-secondary, 13px);
|
|
297
|
+
line-height: calc(24px + var(--dsh-content-font-delta, 0px));
|
|
298
|
+
color: var(--dsw-alias-label-secondary, inherit);
|
|
299
|
+
text-overflow: ellipsis;
|
|
300
|
+
white-space: nowrap;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.dsh-schedule-command-status[data-error] {
|
|
304
|
+
color: var(--dsw-alias-state-error-primary, #ef4444);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.dsh-schedule-command-error-line {
|
|
308
|
+
display: flex;
|
|
309
|
+
align-items: flex-start;
|
|
310
|
+
gap: 6px;
|
|
311
|
+
padding-left: 22px;
|
|
312
|
+
margin-top: 2px;
|
|
313
|
+
margin-bottom: 4px;
|
|
314
|
+
font-size: 12px;
|
|
315
|
+
line-height: 1.4;
|
|
316
|
+
color: var(--dsw-alias-state-warn-label, var(--dsw-alias-state-warn-primary, #d97706));
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
.dsh-schedule-command-error-line[data-fatal="true"] {
|
|
320
|
+
color: var(--dsw-alias-state-error-primary, #ef4444);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
.dsh-schedule-command-error-bullet {
|
|
324
|
+
flex-shrink: 0;
|
|
325
|
+
font-size: 11px;
|
|
326
|
+
line-height: 1.4;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
.dsh-schedule-command-error-text {
|
|
330
|
+
word-break: break-word;
|
|
331
|
+
white-space: pre-wrap;
|
|
332
|
+
}
|
|
333
|
+
`;
|