heyio 1.1.0 → 1.1.1
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/dist/copilot/tools.js +15 -0
- package/dist/store/schedules.js +26 -0
- package/package.json +1 -1
package/dist/copilot/tools.js
CHANGED
|
@@ -245,6 +245,21 @@ export function createTools() {
|
|
|
245
245
|
return `Schedule ${id} deleted.`;
|
|
246
246
|
},
|
|
247
247
|
}),
|
|
248
|
+
defineTool("schedule_update", {
|
|
249
|
+
description: "Update an existing schedule's cron, agenda, prompt, or enabled status",
|
|
250
|
+
parameters: z.object({
|
|
251
|
+
id: z.string().describe("Schedule ID to update"),
|
|
252
|
+
cron: z.string().optional().describe("New cron expression"),
|
|
253
|
+
agenda: z.string().optional().describe("New agenda text"),
|
|
254
|
+
prompt: z.string().optional().describe("New prompt text"),
|
|
255
|
+
enabled: z.boolean().optional().describe("Enable or disable the schedule"),
|
|
256
|
+
}),
|
|
257
|
+
handler: async ({ id, cron, agenda, prompt, enabled }) => {
|
|
258
|
+
const { updateSchedule } = await import("../store/schedules.js");
|
|
259
|
+
const schedule = updateSchedule(id, { cron, agenda, prompt, enabled });
|
|
260
|
+
return `Schedule ${id} updated. Cron: ${schedule.cron}, Enabled: ${!!schedule.enabled}`;
|
|
261
|
+
},
|
|
262
|
+
}),
|
|
248
263
|
// --- Shell Tool ---
|
|
249
264
|
defineTool("shell_exec", {
|
|
250
265
|
description: "Execute a shell command on the host machine. Use for git, gh CLI, file operations, etc. Commands run in the user's environment with their credentials.",
|
package/dist/store/schedules.js
CHANGED
|
@@ -24,6 +24,32 @@ export function toggleSchedule(id, enabled) {
|
|
|
24
24
|
const db = getDb();
|
|
25
25
|
db.prepare("UPDATE schedules SET enabled = ? WHERE id = ?").run(enabled ? 1 : 0, id);
|
|
26
26
|
}
|
|
27
|
+
export function updateSchedule(id, input) {
|
|
28
|
+
const db = getDb();
|
|
29
|
+
const fields = [];
|
|
30
|
+
const params = [];
|
|
31
|
+
if (input.cron !== undefined) {
|
|
32
|
+
fields.push("cron = ?");
|
|
33
|
+
params.push(input.cron);
|
|
34
|
+
}
|
|
35
|
+
if (input.agenda !== undefined) {
|
|
36
|
+
fields.push("agenda = ?");
|
|
37
|
+
params.push(input.agenda);
|
|
38
|
+
}
|
|
39
|
+
if (input.prompt !== undefined) {
|
|
40
|
+
fields.push("prompt = ?");
|
|
41
|
+
params.push(input.prompt);
|
|
42
|
+
}
|
|
43
|
+
if (input.enabled !== undefined) {
|
|
44
|
+
fields.push("enabled = ?");
|
|
45
|
+
params.push(input.enabled ? 1 : 0);
|
|
46
|
+
}
|
|
47
|
+
if (fields.length > 0) {
|
|
48
|
+
params.push(id);
|
|
49
|
+
db.prepare(`UPDATE schedules SET ${fields.join(", ")} WHERE id = ?`).run(...params);
|
|
50
|
+
}
|
|
51
|
+
return db.prepare("SELECT * FROM schedules WHERE id = ?").get(id);
|
|
52
|
+
}
|
|
27
53
|
export function deleteSchedule(id) {
|
|
28
54
|
const db = getDb();
|
|
29
55
|
db.prepare("DELETE FROM schedules WHERE id = ?").run(id);
|