/schedule: list, create from words (the server's compile, a preview first, optionally to run here), pause, resume, run now, history — over /api/v2 with the device's token (spec 3.5.0)
ci / check (push) Waiting to run

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
HomerandClaude Opus 5.5 committed 2026-11-10 12:18:49 +00:00
1 parent d111cad22e
commit a4027d5626
6 files changed
+369 -7

No files matched your search

+7 -7
View File
@@ -77,14 +77,14 @@ test("off: a scheduled session, prompt and monitor are refused with the fixed te
config(fake.url)
const root = project()
const { c } = await client(limitsFor(root, { scheduled: false }))
const err = await c.request("session/new", { cwd: root, _meta: { lembas: { scheduled: sched() } } }).catch((e) => e)
const err: any = await c.request("session/new", { cwd: root, _meta: { lembas: { scheduled: sched() } } }).catch((e: any) => e)
expect(err.message).toBe(SCHEDULED.texts.off)
expect(err.data).toEqual({ reason: "scheduled_off" })
const m = await c.request("_lembas/monitor", { cwd: root, command: "true" }).catch((e) => e)
const m: any = await c.request("_lembas/monitor", { cwd: root, command: "true" }).catch((e: any) => e)
expect(m.data).toEqual({ reason: "scheduled_off" })
// An ordinary agent chat is not affected.
const s: any = await c.request("session/new", { cwd: root })
const p = await c.request("session/prompt", { sessionId: s.sessionId, prompt: [{ type: "text", text: "go" }], _meta: { lembas: { scheduled: sched() } } }).catch((e) => e)
const p: any = await c.request("session/prompt", { sessionId: s.sessionId, prompt: [{ type: "text", text: "go" }], _meta: { lembas: { scheduled: sched() } } }).catch((e: any) => e)
expect(p.data).toEqual({ reason: "scheduled_off" })
})
@@ -97,13 +97,13 @@ test("the mode: Edit when none chosen, Auto only when the schedule says it, Plan
expect(none.modes.currentModeId).toBe("edit")
const auto: any = await c.request("session/new", { cwd: root, _meta: { lembas: { scheduled: sched({ mode: "auto" }) } } })
expect(auto.modes.currentModeId).toBe("auto")
const plan = await c.request("session/new", { cwd: root, _meta: { lembas: { scheduled: sched({ mode: "plan" }) } } }).catch((e) => e)
const plan: any = await c.request("session/new", { cwd: root, _meta: { lembas: { scheduled: sched({ mode: "plan" }) } } }).catch((e: any) => e)
expect(plan.message).toBe(SCHEDULED.texts.plan)
const { c: c2 } = await client(limitsFor(root, { maxMode: "manual" }))
const low: any = await c2.request("session/new", { cwd: root, _meta: { lembas: { scheduled: sched({ mode: "auto" }) } } })
expect(low.modes.currentModeId).toBe("manual")
// A folder outside the roots: the usual reason, marked.
const out = await c.request("session/new", { cwd: tmpdir(), _meta: { lembas: { scheduled: sched() } } }).catch((e) => e)
const out: any = await c.request("session/new", { cwd: tmpdir(), _meta: { lembas: { scheduled: sched() } } }).catch((e: any) => e)
expect(out.data).toEqual({ reason: "folder" })
})
@@ -160,10 +160,10 @@ test("_lembas/monitor: runs what the mode allows, refuses what it would ask abou
const r: any = await c.request("_lembas/monitor", { cwd: root, command: "cat feed.txt", mode: "edit" })
expect(r).toMatchObject({ exit: 0, timed_out: false, excerpt: "one\n", truncated: false, bytes: 4 })
expect(r.hash).toBe(monitorHash(0, "one\n"))
const asks = await c.request("_lembas/monitor", { cwd: root, command: "rm -rf build", mode: "edit" }).catch((e) => e)
const asks: any = await c.request("_lembas/monitor", { cwd: root, command: "rm -rf build", mode: "edit" }).catch((e: any) => e)
expect(asks.data).toEqual({ reason: "permission" })
expect(asks.message).toContain("edit mode")
const plan = await c.request("_lembas/monitor", { cwd: root, command: "cat feed.txt", mode: "plan" }).catch((e) => e)
const plan: any = await c.request("_lembas/monitor", { cwd: root, command: "cat feed.txt", mode: "plan" }).catch((e: any) => e)
expect(plan.data).toEqual({ reason: "plan" })
})