You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(daemon): interval-scheduler formula (endoclaw-timer Phase 1 remainder)
Graduate the @endo/genie interval-scheduler prototype
(packages/genie/src/interval/) into @endo/daemon as a first-class
`interval-scheduler` formula, so an agent can hold a scheduled-interval
(heartbeat) capability. This is the "Phase 1 remainder" of the
endoclaw-timer design: formula type, extractDeps edge, and maker-table
entry.
- src/interval-scheduler.js: SES-safe port of the genie scheduler. Uses
the daemon's filePowers (write-then-rename) for per-interval
persistence instead of node:fs, an injected id generator instead of
node:crypto, and injectable setTimeout/clearTimeout/now so the logic is
testable against a deterministic clock. Start-to-start scheduling,
resolve/reschedule with exponential backoff, tick-timeout auto-resolve,
host limits (maxActive/minPeriodMs), pause/resume/revoke, and startup
recovery with missed-tick coalescing all carry over.
- formula-type.js / types.d.ts: register the `interval-scheduler` type,
its formula record ({ agent, maxActive, minPeriodMs, paused }), and the
scheduler powers/facet/entry typedefs.
- daemon.js: extractLabeledDeps case (strong `agent` GC edge), the
maker-table entry (per-formula persistence dir keyed by formula number,
context.thisDiesIfThatDies(agent) + onCancel disarm), and
formulateIntervalScheduler.
- host.js / interfaces.js: a lean `makeIntervalScheduler(petName, opts?)`
host command + HostInterface guard so an agent can obtain and hold the
capability end-to-end.
Tick delivery as daemon mail messages (with a TickResponse exo), the
scheduler's own handle, the proper IntervalScheduler/IntervalControl
facet split on the host method, and CLI commands remain later phases
(Phase 2 / Phase 4) of the design.
Tests: packages/daemon/test/interval-scheduler.test.js (7 cases:
create/persist/list/tick, limits, cancel, pause/resume, revoke, startup
recovery) plus the formula-type registry list. tsc + eslint clean.
Design: journal plan/designs/endo-but-for-bots/endoclaw-timer.md
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
0 commit comments