diff --git a/.changeset/scheduler-host-seam-and-runtime-mutation.md b/.changeset/scheduler-host-seam-and-runtime-mutation.md deleted file mode 100644 index 0d18ad20..00000000 --- a/.changeset/scheduler-host-seam-and-runtime-mutation.md +++ /dev/null @@ -1,43 +0,0 @@ ---- -"@herdctl/core": minor ---- - -Scheduler: host-execution seam + runtime schedule mutation (additive, backward-compatible) - -Make the scheduler embeddable so a host can own execution and mutate schedules at -runtime. Existing headless fleets are unchanged — every new capability is opt-in. - -- **Host-execution seam (#375):** `FleetManager.setScheduleTriggerHandler(handler)` - mirrors `setSessionWakeHandler`. When set, a fired schedule routes to the host - handler (which can resume/stream the turn on its own hub) instead of the built-in - headless `ScheduleExecutor`; when unset, schedules run headless exactly as before. - Cron/interval timing is untouched. Every scheduler-fired trigger — including a - forced immediate fire — funnels through this seam. -- **Relative-wake timezone hardening (#311):** `resolveSystemTimeZone()` centralizes - the host-timezone lookup used by `calculateNextCronTrigger`/ - `calculatePreviousCronTrigger`, falling back to `UTC` when an ICU-less runtime - reports no timezone (which could otherwise revive the 24h-idle bug). -- **Runtime schedule mutation (#376):** `FleetManager.setAgentSchedule(agent, name, - schedule)` and `removeAgentSchedule(agent, name)` add/remove a single schedule on a - registered agent without a whole-agent `addAgent(replace)`. `setAgentSchedule` also - normalizes a lingering persisted `disabled` status to `idle` (via the new - `armScheduleState` helper) so a set-after-disable is actually eligible to fire. - Removal prunes persisted state via the new `deleteScheduleState` helper. -- **Concurrency-safe mutation:** schedule-state read-modify-writes are now serialized - per state file (no lost sibling updates); a removed schedule with an in-flight run is - tombstoned so that run's trailing write can't resurrect deleted state; and the - in-flight run's running-set entry is retained (only warn-once bookkeeping is cleared) - so a same-name re-add can't start a second concurrent execution. The tombstone is - coordinated with the active execution generation so it is neither left set nor cleared - too early: `setAgents` lifts it for a re-armed schedule **only when no run for that key - is in flight** — so `reload()` / `addAgent({replace})` / `setAgentSchedule` re-arm a - removed name cleanly (no runaway per-tick firing from a stuck tombstone) while a still - in-flight removed generation's trailing `next_run_at`/`last_error` write stays - suppressed (can't contaminate the freshly re-added schedule); the tombstone is then - lifted by that run's own `executeJob` finally on completion, or immediately by the - remover when no run is in flight. `removeAgentSchedule` is in-memory-only (like - `addAgent`/`removeAgent`): it does not rewrite `herdctl.yaml`, so a later `reload()` - legitimately brings the schedule back. -- **Mutation gate:** a new `allowScheduleMutation` FleetManager option (default - `false`) gates the two mutation methods; when disabled they throw the new - `ScheduleMutationDisabledError`. Enable/disable of existing schedules stays ungated. diff --git a/.changeset/trigger-type-spawned-377.md b/.changeset/trigger-type-spawned-377.md deleted file mode 100644 index 23fb7052..00000000 --- a/.changeset/trigger-type-spawned-377.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -"@herdctl/core": minor -"@herdctl/web": minor ---- - -Add `spawned` trigger type (#377) - -Extend `TriggerTypeSchema` with an explicit `spawned` value so a host (e.g. paddock) -can persist run provenance for agent-spawned jobs as a first-class enum rather than -inferring it. Additive and backward-compatible — existing headless fleets are -unchanged. - -- **core:** `spawned` added to `TriggerTypeSchema` (and therefore the `TriggerType` - type). `schedule` already covers scheduled runs, so no separate `scheduled` value - is introduced. -- **web:** the job-history trigger-type icon/label map renders `spawned` with a - `Bot` icon labelled "Spawned". - -Supports paddock#267 (provenance badges). diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index bb9b5a9f..2a41f80f 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -1,5 +1,13 @@ # herdctl +## 1.5.27 + +### Patch Changes + +- Updated dependencies [[`247d452`](https://github.com/edspencer/herdctl/commit/247d452d3363615694bec0cc8776b64c53624c64), [`822fdfb`](https://github.com/edspencer/herdctl/commit/822fdfbd0c049886217021b07a1e9070b9bf6b29)]: + - @herdctl/core@5.21.0 + - @herdctl/web@0.10.0 + ## 1.5.26 ### Patch Changes diff --git a/packages/cli/package.json b/packages/cli/package.json index d50c98f3..bf75b45c 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "herdctl", - "version": "1.5.26", + "version": "1.5.27", "description": "Autonomous Agent Fleet Management for Claude Code", "license": "MIT", "type": "module", diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md index c7d4d62f..46f91328 100644 --- a/packages/core/CHANGELOG.md +++ b/packages/core/CHANGELOG.md @@ -1,5 +1,64 @@ # @herdctl/core +## 5.21.0 + +### Minor Changes + +- [#379](https://github.com/edspencer/herdctl/pull/379) [`247d452`](https://github.com/edspencer/herdctl/commit/247d452d3363615694bec0cc8776b64c53624c64) Thanks [@edspencer](https://github.com/edspencer)! - Scheduler: host-execution seam + runtime schedule mutation (additive, backward-compatible) + + Make the scheduler embeddable so a host can own execution and mutate schedules at + runtime. Existing headless fleets are unchanged — every new capability is opt-in. + + - **Host-execution seam (#375):** `FleetManager.setScheduleTriggerHandler(handler)` + mirrors `setSessionWakeHandler`. When set, a fired schedule routes to the host + handler (which can resume/stream the turn on its own hub) instead of the built-in + headless `ScheduleExecutor`; when unset, schedules run headless exactly as before. + Cron/interval timing is untouched. Every scheduler-fired trigger — including a + forced immediate fire — funnels through this seam. + - **Relative-wake timezone hardening (#311):** `resolveSystemTimeZone()` centralizes + the host-timezone lookup used by `calculateNextCronTrigger`/ + `calculatePreviousCronTrigger`, falling back to `UTC` when an ICU-less runtime + reports no timezone (which could otherwise revive the 24h-idle bug). + - **Runtime schedule mutation (#376):** `FleetManager.setAgentSchedule(agent, name, +schedule)` and `removeAgentSchedule(agent, name)` add/remove a single schedule on a + registered agent without a whole-agent `addAgent(replace)`. `setAgentSchedule` also + normalizes a lingering persisted `disabled` status to `idle` (via the new + `armScheduleState` helper) so a set-after-disable is actually eligible to fire. + Removal prunes persisted state via the new `deleteScheduleState` helper. + - **Concurrency-safe mutation:** schedule-state read-modify-writes are now serialized + per state file (no lost sibling updates); a removed schedule with an in-flight run is + tombstoned so that run's trailing write can't resurrect deleted state; and the + in-flight run's running-set entry is retained (only warn-once bookkeeping is cleared) + so a same-name re-add can't start a second concurrent execution. The tombstone is + coordinated with the active execution generation so it is neither left set nor cleared + too early: `setAgents` lifts it for a re-armed schedule **only when no run for that key + is in flight** — so `reload()` / `addAgent({replace})` / `setAgentSchedule` re-arm a + removed name cleanly (no runaway per-tick firing from a stuck tombstone) while a still + in-flight removed generation's trailing `next_run_at`/`last_error` write stays + suppressed (can't contaminate the freshly re-added schedule); the tombstone is then + lifted by that run's own `executeJob` finally on completion, or immediately by the + remover when no run is in flight. `removeAgentSchedule` is in-memory-only (like + `addAgent`/`removeAgent`): it does not rewrite `herdctl.yaml`, so a later `reload()` + legitimately brings the schedule back. + - **Mutation gate:** a new `allowScheduleMutation` FleetManager option (default + `false`) gates the two mutation methods; when disabled they throw the new + `ScheduleMutationDisabledError`. Enable/disable of existing schedules stays ungated. + +- [#380](https://github.com/edspencer/herdctl/pull/380) [`822fdfb`](https://github.com/edspencer/herdctl/commit/822fdfbd0c049886217021b07a1e9070b9bf6b29) Thanks [@edspencer](https://github.com/edspencer)! - Add `spawned` trigger type (#377) + + Extend `TriggerTypeSchema` with an explicit `spawned` value so a host (e.g. paddock) + can persist run provenance for agent-spawned jobs as a first-class enum rather than + inferring it. Additive and backward-compatible — existing headless fleets are + unchanged. + + - **core:** `spawned` added to `TriggerTypeSchema` (and therefore the `TriggerType` + type). `schedule` already covers scheduled runs, so no separate `scheduled` value + is introduced. + - **web:** the job-history trigger-type icon/label map renders `spawned` with a + `Bot` icon labelled "Spawned". + + Supports paddock#267 (provenance badges). + ## 5.20.1 ### Patch Changes diff --git a/packages/core/package.json b/packages/core/package.json index 262fb6ec..3a8c44c9 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@herdctl/core", - "version": "5.20.1", + "version": "5.21.0", "description": "Core library for herdctl fleet management", "license": "MIT", "type": "module", diff --git a/packages/web/CHANGELOG.md b/packages/web/CHANGELOG.md index bc1c64d2..a6eb2327 100644 --- a/packages/web/CHANGELOG.md +++ b/packages/web/CHANGELOG.md @@ -1,5 +1,29 @@ # @herdctl/web +## 0.10.0 + +### Minor Changes + +- [#380](https://github.com/edspencer/herdctl/pull/380) [`822fdfb`](https://github.com/edspencer/herdctl/commit/822fdfbd0c049886217021b07a1e9070b9bf6b29) Thanks [@edspencer](https://github.com/edspencer)! - Add `spawned` trigger type (#377) + + Extend `TriggerTypeSchema` with an explicit `spawned` value so a host (e.g. paddock) + can persist run provenance for agent-spawned jobs as a first-class enum rather than + inferring it. Additive and backward-compatible — existing headless fleets are + unchanged. + + - **core:** `spawned` added to `TriggerTypeSchema` (and therefore the `TriggerType` + type). `schedule` already covers scheduled runs, so no separate `scheduled` value + is introduced. + - **web:** the job-history trigger-type icon/label map renders `spawned` with a + `Bot` icon labelled "Spawned". + + Supports paddock#267 (provenance badges). + +### Patch Changes + +- Updated dependencies [[`247d452`](https://github.com/edspencer/herdctl/commit/247d452d3363615694bec0cc8776b64c53624c64), [`822fdfb`](https://github.com/edspencer/herdctl/commit/822fdfbd0c049886217021b07a1e9070b9bf6b29)]: + - @herdctl/core@5.21.0 + ## 0.9.31 ### Patch Changes diff --git a/packages/web/package.json b/packages/web/package.json index 1b6aebb5..f50447f1 100644 --- a/packages/web/package.json +++ b/packages/web/package.json @@ -1,6 +1,6 @@ { "name": "@herdctl/web", - "version": "0.9.31", + "version": "0.10.0", "description": "Web dashboard for herdctl fleet management", "license": "MIT", "type": "module",