feat(agents): decouple heartbeat from task state, add allowParallelExecution

Permanent agents now run heartbeats regardless of bound-task block state.
The prior queued+blockedBy early-exit and its state-tracking machinery are
removed; HEARTBEAT_SYSTEM_PROMPT is rewritten to scope heartbeats to
ambient coordination (messaging, memory, finding work, delegation,
surfacing/chasing blockers, status). Task body work continues via the
executor path. Ephemeral agents are unchanged.

New allowParallelExecution flag (default true, permanent agents only) on
AgentHeartbeatConfig. When false, heartbeat and executor paths serialize
symmetrically: a heartbeat will not start while the agent's bound task
has an active executor session, and an executor session will not start
while the agent has an active heartbeat run. Either side re-dispatches
the other's deferred work on completion. UI toggle surfaces in the
agent's Heartbeat Settings tab.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-05-05 22:04:06 -07:00
parent 03529ba940
commit e004b205d9
16 changed files with 255 additions and 313 deletions

View File

@@ -66,9 +66,11 @@ describe("projectStorage", () => {
"kb-dashboard-view-mode",
"kb-dashboard-current-project",
"kb-dashboard-recent-projects",
"fn-agent-log-markdown",
"fn-agent-log-tool-output",
]),
);
expect(GLOBAL_STORAGE_KEYS).toHaveLength(5);
expect(GLOBAL_STORAGE_KEYS).toHaveLength(7);
});
it("includes all project-scoped storage keys", () => {