diff options
| author | Adam Malczewski <[email protected]> | 2026-07-01 03:30:42 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-07-01 03:30:42 +0900 |
| commit | 808499ca589724ef2bd681e7ed77177e9126e005 (patch) | |
| tree | 1c0a25a13aae889018b0b036eaec53ffc4973d87 /packages/heartbeat/src/extension.ts | |
| parent | 665672eccff531f7a785295a8f16e57e98106deb (diff) | |
| parent | fdc2d0df8fa5ffca8c1c0957cc8bbbe5f4a5304c (diff) | |
| download | dispatch-808499ca589724ef2bd681e7ed77177e9126e005.tar.gz dispatch-808499ca589724ef2bd681e7ed77177e9126e005.zip | |
Merge branch 'feature/heartbeat-inactive-only' into predev
Diffstat (limited to 'packages/heartbeat/src/extension.ts')
| -rw-r--r-- | packages/heartbeat/src/extension.ts | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/packages/heartbeat/src/extension.ts b/packages/heartbeat/src/extension.ts index f245b7e..b044619 100644 --- a/packages/heartbeat/src/extension.ts +++ b/packages/heartbeat/src/extension.ts @@ -90,6 +90,19 @@ export const extension: Extension = { // Lazy (resolved at fire time, mirroring resolvePrompt). getWorkspaceCwd: async (wsId) => (await conversationStore.getWorkspace(wsId))?.defaultCwd ?? null, + // inactiveOnly: the configured workspace is "busy" while any of its + // conversations are driving or queued for a turn. The orchestrator + // sets persisted status "active" on turn start and "idle" on settle, + // so a single store read (filtered to the configured workspaceId) is + // the live active-agent check. The heartbeat's own spawned conversation + // lives in the DEDICATED heartbeat workspace, so it never self-blocks. + hasActiveAgents: async (wsId) => { + const active = await conversationStore.listConversations({ + workspaceId: wsId, + status: ["active", "queued"], + }); + return active.length > 0; + }, }); // Reconcile stale runs + arm enabled workspaces on boot. |
