@shanesaravia/hive 0.1.1 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -0
- package/README.md +70 -10
- package/node_modules/@hive/shared/dist/directStudio.d.ts +7 -0
- package/node_modules/@hive/shared/dist/directStudio.js +17 -0
- package/node_modules/@hive/shared/dist/index.d.ts +1 -0
- package/node_modules/@hive/shared/dist/index.js +1 -0
- package/node_modules/@hive/shared/dist/status.d.ts +1 -1
- package/node_modules/@hive/shared/dist/status.js +19 -7
- package/node_modules/@hive/shared/dist/types.d.ts +5 -0
- package/node_modules/@hive/shared/package.json +3 -0
- package/package.json +1 -1
- package/packages/server/dist/api/rest.js +229 -14
- package/packages/server/dist/control/codexRuntime.js +24 -4
- package/packages/server/dist/hooks/hookIngest.js +44 -1
- package/packages/server/dist/missions/missionsStore.js +12 -0
- package/packages/server/dist/plans/plansStore.js +35 -4
- package/packages/server/dist/roster/rosterBuilder.js +212 -39
- package/packages/server/dist/skills/skillDiscovery.js +10 -8
- package/packages/server/dist/skills/skillInvocation.js +11 -0
- package/packages/server/dist/worktrees/worktreeReclaim.js +156 -0
- package/packages/web/dist/assets/index-Bzle5Xla.css +2 -0
- package/packages/web/dist/assets/index-C6AY0vYC.js +11 -0
- package/packages/web/dist/index.html +2 -2
- package/templates/agents/hive-orchestrator.md +6 -0
- package/packages/web/dist/assets/index-CrKMFCkZ.js +0 -11
- package/packages/web/dist/assets/index-gEGU_lr3.css +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,50 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to Hive will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## 0.2.1 — 2026-08-25
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Plan tab shows a "Phases" / "Tasks" section header, clarifying that task numbers are global across phases.
|
|
10
|
+
- Pending decisions appear in the top notice slot as a compact strip and slide-over, visible from every tab and both presentations, replacing the Conversation-tab-only placement.
|
|
11
|
+
- Office desks are click targets that behave exactly like their avatar, across manager, worker, and direct seats in both the fleet floor and the mission room.
|
|
12
|
+
- Shared `DetailDrawer` shell so worker inspection and pending decisions match in width, background, header rhythm, and dismissal.
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
|
|
16
|
+
- Mission room collapses its goal to one line, compacts summary tiles, drops duplicate side-panel titles, and lets the room and chat grow with the viewport, adding roughly 100px of chat at 900px tall and 320px on tall displays.
|
|
17
|
+
- Widened the mission room viewBox so the whole floor stays inside the canvas, with height capped to avoid empty canvas beneath it.
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
|
|
21
|
+
- Reclaim a mission's worktree and branch when it is deleted, archived, or completed, instead of leaving every worktree-isolated mission behind on disk forever. Completion keeps a worktree that holds uncommitted changes, since a follow-up message reopens a completed mission and **Clear completed desks** completes many at once.
|
|
22
|
+
- Resume a reopened mission in its base repository when its worktree has already been reclaimed, rather than resuming into a path that no longer exists.
|
|
23
|
+
- An unanswered decision keeps a mission in `waiting_on_you` instead of decaying to idle or stalled once the session record goes quiet, so office lighting, desks, status pill, and the attention badge stay in agreement.
|
|
24
|
+
- Suppressed the duplicate "Waiting for your reply" banner when a structured decision already covers it.
|
|
25
|
+
|
|
26
|
+
## 0.2.0 — 2026-08-25
|
|
27
|
+
|
|
28
|
+
Adds the visual office, a second presentation of the same fleet state alongside the existing cards.
|
|
29
|
+
|
|
30
|
+
### Highlights
|
|
31
|
+
|
|
32
|
+
- Global **Cards | Office** presentation switch, with both views reading one shared fleet snapshot
|
|
33
|
+
- Spatial headquarters with a shared Direct studio, per-mission orchestration rooms, a Review hall, hallways, and an elevator, plus deterministic overflow floors
|
|
34
|
+
- Stable, ID-derived room, desk, and avatar assignment that costs no model tokens
|
|
35
|
+
- Direct manipulation throughout: desks, managers, workers, rooms, and notices open the mission, worker, or tab they represent
|
|
36
|
+
- Mission details available in room view without leaving the office, with Conversation as the default panel
|
|
37
|
+
- Spatial search and filtering, dimming direct and review seats independently while orchestration missions filter by room
|
|
38
|
+
- Living office behavior for working, typing, thinking, idle, waiting, blocked, failed, reviewing, and paused states, with status-aware desks, monitors, and room lighting
|
|
39
|
+
- Manager and worker lifecycle movement — entrances, delegation, worker-to-manager handoffs, review transfers, and exits — ordered by per-identity FIFO transition queues
|
|
40
|
+
- Factual speech, ambient thought, alert, and output dialogue whose cadence scales with floor activity
|
|
41
|
+
- System, Reduced, and Full motion modes with configurable dialogue settings
|
|
42
|
+
- Guided mission launch and plan approval, refined mission controls, and live provider skill discovery
|
|
43
|
+
|
|
44
|
+
### Fixed
|
|
45
|
+
|
|
46
|
+
- Fleet and detail room views share transition state, so entering a room no longer replays a completed animation
|
|
47
|
+
- Room lighting, chat continuity, and startup transitions no longer flash stale state on arrival or reload
|
|
48
|
+
|
|
5
49
|
## 0.1.1 — 2026-08-23
|
|
6
50
|
|
|
7
51
|
- Add `hive update`, with read-only checks, interactive or unattended installation, setup refresh, and automatic restart of an active local server.
|
package/README.md
CHANGED
|
@@ -7,7 +7,13 @@
|
|
|
7
7
|
|
|
8
8
|
[](https://github.com/shanesaravia/hive/actions/workflows/release-verification.yml)
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
### Cards dashboard
|
|
11
|
+
|
|
12
|
+

|
|
13
|
+
|
|
14
|
+
### Visual office
|
|
15
|
+
|
|
16
|
+

|
|
11
17
|
|
|
12
18
|
## What Hive is
|
|
13
19
|
|
|
@@ -33,6 +39,10 @@ Hive does not resell model access or replace provider authentication. It gives l
|
|
|
33
39
|
- Direct and orchestrated execution modes for either provider
|
|
34
40
|
- Per-mission Claude Code or Codex provider and model selection
|
|
35
41
|
- Provider model discovery from the locally installed CLIs
|
|
42
|
+
- Switchable **Cards** and deterministic 2.5D **Office** presentations backed by the same live mission state
|
|
43
|
+
- Multi-floor visual capacity with a shared direct studio, orchestration rooms, review hall, and off-floor arrival notices
|
|
44
|
+
- Clickable rooms, managers, workers, and direct desks with spatial mission drill-down
|
|
45
|
+
- Token-free avatar identity, entrances/exits, live posture, monitor state, room lighting, dialogue, and worker handoffs
|
|
36
46
|
- Structured phased plans, weighted progress, dependency graphs, revisions, and evidence
|
|
37
47
|
- Parallel worker visibility, assignments, elapsed time, activity, token usage, changed files, tests, and outputs
|
|
38
48
|
- Separate mission lifecycle and runtime activity states
|
|
@@ -41,6 +51,7 @@ Hive does not resell model access or replace provider authentication. It gives l
|
|
|
41
51
|
- User-controlled Pause, Resume, Complete, Reopen, Archive, manager handoff, task retry, cancellation, reassignment, and reprioritization
|
|
42
52
|
- Orchestrator-proposed **Awaiting acceptance** state
|
|
43
53
|
- Completion gates with verification evidence, explicit waivers, and user acceptance
|
|
54
|
+
- Optional **Plan first** workflow that requires approval before implementation and worker fan-out
|
|
44
55
|
- Reusable built-in, user, and repository mission templates with a visual editor
|
|
45
56
|
- Workspace and mission policies, permissions, worker/token/time budgets, and usage projections
|
|
46
57
|
- Semantic activity feed plus parallel manager/worker timeline
|
|
@@ -151,13 +162,18 @@ Uninstalling the npm package intentionally retains mission history, configuratio
|
|
|
151
162
|
|
|
152
163
|
## Create a mission
|
|
153
164
|
|
|
165
|
+
For a focused direct task, the fleet's quick-start bar provides provider and model selectors and uses worktree isolation when the selected Claude repository supports it. If the task needs parallel workers, switch to orchestrated setup; Hive carries the entered prompt into the full **New mission** flow with the cursor preserved at the end.
|
|
166
|
+
|
|
167
|
+
Use **New mission** when you want the full configuration:
|
|
168
|
+
|
|
154
169
|
1. Select **New mission**.
|
|
155
170
|
2. Enter the intended working directory. Absolute paths and paths beginning with `~` are supported; matching local folders appear as you type.
|
|
156
171
|
3. Choose **Claude** or **Codex**, then optionally select a model. Leaving model blank uses that CLI's configured default.
|
|
157
172
|
4. Choose **Direct** or **Orchestrated** mode.
|
|
158
173
|
5. Describe the task and optionally provide a mission name.
|
|
159
|
-
6.
|
|
160
|
-
7.
|
|
174
|
+
6. Configure launch behavior: Claude worktree isolation, optional **Plan first** approval for orchestrated missions, and any template.
|
|
175
|
+
7. Expand **Advanced settings** when the mission needs policy overrides or worker, concurrency, token, or time budgets.
|
|
176
|
+
8. Start the mission. You can follow it from either the Cards dashboard or visual Office without changing its underlying state.
|
|
161
177
|
|
|
162
178
|
The selected working directory matters. The provider CLI is launched from that directory so it can resolve the same repository instructions, configuration, MCP servers, and skills it would see when launched manually there.
|
|
163
179
|
|
|
@@ -165,7 +181,9 @@ The selected working directory matters. The provider CLI is launched from that d
|
|
|
165
181
|
|
|
166
182
|
Open a mission card and send a follow-up from the Conversation panel. Both providers preserve their native conversation/thread identity while Hive records each turn under the same durable mission.
|
|
167
183
|
|
|
168
|
-
|
|
184
|
+
Type `/` in either the new-mission prompt or an existing conversation to search the skills available to that provider in the selected working directory. Hive reads Claude skills for Claude missions and Codex skills for Codex missions; slash-form Codex selections are translated to the provider's native invocation form behind the scenes. Recognized skills are highlighted and sent as ordinary prompt text, leaving the provider CLI responsible for execution and permissions. Hive discovers skill metadata only; it does not preload entire skill bodies into mission context.
|
|
185
|
+
|
|
186
|
+
If a provider or deliberately interactive skill asks a structured question, Hive surfaces it in **Needs you** and the mission conversation. Answering there resumes the same mission; skill prompts are not silently bypassed.
|
|
169
187
|
|
|
170
188
|
## Navigate the fleet
|
|
171
189
|
|
|
@@ -177,19 +195,38 @@ The fleet is organized around attention rather than process creation time:
|
|
|
177
195
|
|
|
178
196
|
Search covers mission names, conversations, plans, workers, files, errors, decisions, evidence, and outputs. Filters are available for lifecycle/activity status, repository, template, and date. Claude sessions started outside Hive appear separately as discovered local sessions; they can be adopted, stopped, or hidden without pretending they are already durable Hive missions.
|
|
179
197
|
|
|
198
|
+
### Use the visual office
|
|
199
|
+
|
|
200
|
+
Use the global **Cards | Office** control to switch presentation. The choice is remembered locally and follows you into mission details, so the visual workflow does not unexpectedly send you back to the data dashboard.
|
|
201
|
+
|
|
202
|
+
The office is a second presentation of the same mission data, not a simulation or separate runtime:
|
|
203
|
+
|
|
204
|
+
- A desk in the shared **Direct studio** represents one direct mission. Select a desk to open that mission, or select the studio itself for its aggregate worker list and bulk **Clear completed desks** action.
|
|
205
|
+
- An **orchestration room** represents one orchestrated mission. The manager has a distinct position and appearance; each active worker receives a stable desk and can be opened directly.
|
|
206
|
+
- Managers move to the shared **Review hall** when their missions reach **Awaiting acceptance**. Selecting an occupant opens the corresponding mission.
|
|
207
|
+
- Headquarters contains the direct studio, orchestration rooms, and review hall. Additional operations floors are allocated deterministically when orchestration capacity fills; off-floor arrivals are called out without pulling you away from the floor you are viewing.
|
|
208
|
+
- Search and filters dim nonmatching rooms or individual direct/review seats while retaining spatial context.
|
|
209
|
+
|
|
210
|
+
Room plaques and avatar/desk hover states expose mission identity. Room lighting, desk accents, monitor symbols, postures, and bubbles communicate observed activity, waiting, failure, review, and occupancy. Entrances, exits, elevator travel, and worker-to-manager handoffs are driven by a local FIFO presentation queue so backend events remain ordered and do not spend model tokens.
|
|
211
|
+
|
|
212
|
+
Office controls let you follow the operating-system motion preference or explicitly reduce/enable motion, and choose how much work/personality dialogue appears. Dialogue cadence scales with floor occupancy to keep quiet floors alive without covering the workspace in bubbles.
|
|
213
|
+
|
|
180
214
|
## Understand a mission
|
|
181
215
|
|
|
182
|
-
Each mission has
|
|
216
|
+
Each mission has five primary views in the standard details presentation. The spatial room presentation exposes the same controls and panels beside the room, with **Conversation** selected by default:
|
|
183
217
|
|
|
184
218
|
| View | What it shows |
|
|
185
219
|
| --- | --- |
|
|
186
220
|
| Conversation | The durable user/orchestrator thread across all provider turns |
|
|
187
|
-
| Plan
|
|
221
|
+
| Plan | Goal, current work, next work, blockers, phased plan, dependencies, gates, evidence, and weighted progress |
|
|
222
|
+
| Workers | Manager/worker roster, assignments, runtime state, timing, tools, files, outputs, and worker controls |
|
|
188
223
|
| Activity | A semantic event feed or parallel timeline for the manager and workers |
|
|
189
224
|
| Technical | Provider job history, bounded handoff context, policies, and mission-report export |
|
|
190
225
|
|
|
191
226
|
Worker rows open a detail drawer containing the assignment, role, current tool/command, files read or changed, tests, artifacts, timing, tokens, termination state, and task-specific controls. Runtime job IDs remain available for diagnosis without becoming the mission's product identity.
|
|
192
227
|
|
|
228
|
+
Mission names can be edited from either presentation. Renaming changes Hive's durable mission label without pretending to rename an already-running provider job or breaking the underlying conversation.
|
|
229
|
+
|
|
193
230
|
## Plans, progress, and dependencies
|
|
194
231
|
|
|
195
232
|
For non-trivial work, orchestrators publish a structured plan with phases, milestones, tasks, optional subtasks, dependencies, owners, weights, blockers, acceptance criteria, and evidence. Hive then derives progress from completed task weights rather than asking an LLM to estimate a percentage.
|
|
@@ -204,7 +241,7 @@ The plan begins with:
|
|
|
204
241
|
|
|
205
242
|
Use **Plan** for the readable phased workflow and **Dependencies** for the interactive work graph and critical path. Completed and future phases collapse by default, task operational details are expandable, and dependency IDs are translated into task names.
|
|
206
243
|
|
|
207
|
-
|
|
244
|
+
Enable **Plan first** when creating an orchestrated mission to require a pre-implementation checkpoint. The manager publishes the proposal and waits; approving it from the Plan view or global decision inbox records the same decision and resumes implementation. Requesting changes returns feedback to the manager. Missions created without this option remain autonomous, and stale approval controls disappear once implementation starts. Plan approval is separate from accepting a completed mission.
|
|
208
245
|
|
|
209
246
|
## Completion and acceptance
|
|
210
247
|
|
|
@@ -274,6 +311,20 @@ Hive deliberately separates the durable mission lifecycle from current runtime a
|
|
|
274
311
|
|
|
275
312
|
A Claude job ending does **not** automatically mean its mission succeeded. Orchestrators move missions to **Awaiting acceptance**; the user accepts completion or requests changes. Manual lifecycle controls are available in the mission header.
|
|
276
313
|
|
|
314
|
+
### Worktree reclamation
|
|
315
|
+
|
|
316
|
+
Missions launched with worktree isolation get a checked-out worktree under `.claude/worktrees/` and a matching `worktree-` branch. Hive reclaims both when a mission reaches a terminal state, so repositories do not accumulate abandoned checkouts.
|
|
317
|
+
|
|
318
|
+
| Mission reaches | Worktree |
|
|
319
|
+
| --- | --- |
|
|
320
|
+
| Deleted | Removed |
|
|
321
|
+
| Archived | Removed |
|
|
322
|
+
| Completed | Removed when clean; **kept** when it holds uncommitted changes |
|
|
323
|
+
|
|
324
|
+
Completion is treated more cautiously than deletion or archiving because it is reversible — sending a follow-up message to a completed mission reopens it — and because **Clear completed desks** completes many Direct missions at once. Uncommitted work in a worktree therefore survives completion, and a worktree left behind for that reason is recorded in the mission's Activity tab.
|
|
325
|
+
|
|
326
|
+
Reclamation only ever touches worktrees in Hive's managed layout; a repository or a hand-made directory is never removed, whatever a stale job record claims. If a reopened mission's worktree has already been reclaimed, Hive resumes it in the repository the worktree was cut from and records the change.
|
|
327
|
+
|
|
277
328
|
## MCP servers, skills, and project configuration
|
|
278
329
|
|
|
279
330
|
Hive launches the normal local provider CLI rather than a separate container or account.
|
|
@@ -291,7 +342,10 @@ Orchestrated managers cannot directly edit files: Hive launches them with `Edit`
|
|
|
291
342
|
|
|
292
343
|
```text
|
|
293
344
|
Browser UI (React + Vite)
|
|
294
|
-
│
|
|
345
|
+
│
|
|
346
|
+
├── Cards dashboard
|
|
347
|
+
├── deterministic SVG visual office
|
|
348
|
+
└── REST + WebSocket
|
|
295
349
|
Hive server (Fastify)
|
|
296
350
|
│
|
|
297
351
|
├── adapts Claude and Codex runtime state into provider-neutral turns
|
|
@@ -369,7 +423,11 @@ npm run hive -- serve
|
|
|
369
423
|
npm run hive -- orchestrator start "<task>" [--worktree] [--name <name>]
|
|
370
424
|
```
|
|
371
425
|
|
|
372
|
-
|
|
426
|
+
Project planning is split by scope:
|
|
427
|
+
|
|
428
|
+
- [`docs/IMPROVEMENTS.md`](docs/IMPROVEMENTS.md) — core product roadmap and completion checklist
|
|
429
|
+
- [`docs/VISUAL_OFFICE_PLAN.md`](docs/VISUAL_OFFICE_PLAN.md) — completed visual-office foundation
|
|
430
|
+
- [`docs/VISUAL_OFFICE_FEEL_ALIVE_PLAN.md`](docs/VISUAL_OFFICE_FEEL_ALIVE_PLAN.md) — current and upcoming atmosphere, interaction, and polish phases
|
|
373
431
|
|
|
374
432
|
## Troubleshooting
|
|
375
433
|
|
|
@@ -407,7 +465,7 @@ This means the mission remains unfinished while Hive sees no meaningful runtime
|
|
|
407
465
|
|
|
408
466
|
### Accept & complete says completion gates remain
|
|
409
467
|
|
|
410
|
-
Open **Plan
|
|
468
|
+
Open **Plan** and inspect Completion gates. Tests, CI, review, documentation, and other technical gates must be satisfied or waived with a reason. A pending user-approval gate is satisfied automatically by **Accept & complete** and should not block that action.
|
|
411
469
|
|
|
412
470
|
### Data after a restart
|
|
413
471
|
|
|
@@ -419,6 +477,8 @@ Restart Hive with `hive`, then reopen the same mission card. Hive reloads durabl
|
|
|
419
477
|
- Codex uses its workspace-write sandbox in the selected repository; Hive-created Codex worktrees are not yet available.
|
|
420
478
|
- Claude hooks provide richer tool-level evidence than providers or workers that do not emit equivalent structured events.
|
|
421
479
|
- Policies and budgets combine launch-time enforcement with orchestrator guidance; they are not a substitute for operating-system isolation.
|
|
480
|
+
- The visual office is a deterministic status presentation, not a claim that agents are physically active; snapshot state remains authoritative and animation yields to accessibility preferences.
|
|
481
|
+
- Mission artifacts, shared hallway events beyond lifecycle/handoffs, an activity ticker, ambient sound, and celebrations remain planned visual-office polish rather than current functionality.
|
|
422
482
|
- Optional multi-mission initiatives remain intentionally deferred. A mission is the primary durable unit of work.
|
|
423
483
|
|
|
424
484
|
## Project status
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { OrchestratorNode } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* A deliberately conservative definition of an idle Direct Studio desk.
|
|
4
|
+
* Bulk cleanup must never accept gates or dismiss a mission that still needs
|
|
5
|
+
* work or user attention.
|
|
6
|
+
*/
|
|
7
|
+
export declare function canClearDirectStudioMission(node: OrchestratorNode): boolean;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const CLEARABLE_ACTIVITY = new Set(["idle", "done", "offline"]);
|
|
2
|
+
/**
|
|
3
|
+
* A deliberately conservative definition of an idle Direct Studio desk.
|
|
4
|
+
* Bulk cleanup must never accept gates or dismiss a mission that still needs
|
|
5
|
+
* work or user attention.
|
|
6
|
+
*/
|
|
7
|
+
export function canClearDirectStudioMission(node) {
|
|
8
|
+
if (node.mission.mode !== "direct" || node.lifecycleStatus !== "active")
|
|
9
|
+
return false;
|
|
10
|
+
if (!CLEARABLE_ACTIVITY.has(node.activityStatus) || node.inFlight.tasks > 0 || node.inFlight.queued > 0)
|
|
11
|
+
return false;
|
|
12
|
+
if (node.workers.some((worker) => !worker.doneAt && (worker.jobState === "working" || worker.jobState === "busy")))
|
|
13
|
+
return false;
|
|
14
|
+
if (node.alerts.length > 0)
|
|
15
|
+
return false;
|
|
16
|
+
return !(node.plan?.gates ?? []).some((gate) => gate.required && gate.status !== "satisfied" && gate.status !== "waived");
|
|
17
|
+
}
|
|
@@ -6,7 +6,7 @@ import type { ClaudeJob, ClaudeSession, DerivedStatus, HiveEvent } from "./types
|
|
|
6
6
|
* since that's the one case pure file-watching can otherwise miss (the
|
|
7
7
|
* process died without a clean shutdown).
|
|
8
8
|
*/
|
|
9
|
-
export declare function deriveStatus(session: ClaudeSession | undefined, job: ClaudeJob | undefined, recentEvents?: HiveEvent[]): {
|
|
9
|
+
export declare function deriveStatus(session: ClaudeSession | undefined, job: ClaudeJob | undefined, recentEvents?: HiveEvent[], now?: number): {
|
|
10
10
|
status: DerivedStatus;
|
|
11
11
|
stale: boolean;
|
|
12
12
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const STALE_JOB_STATES = new Set(["working", "busy"]);
|
|
2
|
+
const JOB_SESSION_STARTUP_GRACE_MS = 15_000;
|
|
2
3
|
/**
|
|
3
4
|
* Pure status derivation — no network/LLM calls. Joins the raw session/job
|
|
4
5
|
* records already on disk. A job still marked "working" with no matching
|
|
@@ -6,7 +7,7 @@ const STALE_JOB_STATES = new Set(["working", "busy"]);
|
|
|
6
7
|
* since that's the one case pure file-watching can otherwise miss (the
|
|
7
8
|
* process died without a clean shutdown).
|
|
8
9
|
*/
|
|
9
|
-
export function deriveStatus(session, job, recentEvents = []) {
|
|
10
|
+
export function deriveStatus(session, job, recentEvents = [], now = Date.now()) {
|
|
10
11
|
// The daemon's idle notification ("Claude is waiting for your input") fires
|
|
11
12
|
// after every completed turn — it means "session idle", not "the assistant
|
|
12
13
|
// asked you something", so it must not read as waiting_on_you. Permission
|
|
@@ -21,6 +22,14 @@ export function deriveStatus(session, job, recentEvents = []) {
|
|
|
21
22
|
const latestEventTs = recentEvents.at(-1)?.ts ?? 0;
|
|
22
23
|
const blockedEventIsCurrent = blockedEvent !== undefined && blockedEvent.ts >= latestEventTs;
|
|
23
24
|
if (!session && job && STALE_JOB_STATES.has(job.state)) {
|
|
25
|
+
// Claude publishes a resumed background job before its matching live
|
|
26
|
+
// session record. Keep that normal startup gap in "working" instead of
|
|
27
|
+
// briefly presenting a failed mission. Truly orphaned jobs still become
|
|
28
|
+
// stale errors when this short grace period expires.
|
|
29
|
+
const createdAt = job.createdAt ? Date.parse(job.createdAt) : NaN;
|
|
30
|
+
if (Number.isFinite(createdAt) && Math.max(0, now - createdAt) < JOB_SESSION_STARTUP_GRACE_MS) {
|
|
31
|
+
return { status: "working", stale: false };
|
|
32
|
+
}
|
|
24
33
|
return { status: "error", stale: true };
|
|
25
34
|
}
|
|
26
35
|
if (!session) {
|
|
@@ -29,12 +38,15 @@ export function deriveStatus(session, job, recentEvents = []) {
|
|
|
29
38
|
if (session.status === "waiting") {
|
|
30
39
|
return { status: "waiting_on_you", stale: false };
|
|
31
40
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
//
|
|
36
|
-
//
|
|
37
|
-
|
|
41
|
+
// Claude also labels conversational closing questions such as "Anything
|
|
42
|
+
// else?" as blocked. Those are completed, optional follow-up turns—not
|
|
43
|
+
// actionable decisions. Treat the provider block as authoritative only
|
|
44
|
+
// when it carries a permission ask, explicit choices, or a current
|
|
45
|
+
// structured blocked_on_user event.
|
|
46
|
+
const actionableProviderBlock = Boolean(job?.needs && (/^approve\s/i.test(job.needs)
|
|
47
|
+
|| (job.promptChoices?.length ?? 0) > 0
|
|
48
|
+
|| blockedEventIsCurrent));
|
|
49
|
+
if ((job?.state === "blocked" || job?.tempo === "blocked") && actionableProviderBlock) {
|
|
38
50
|
return { status: "waiting_on_you", stale: false };
|
|
39
51
|
}
|
|
40
52
|
// A busy session outranks event-inferred waiting: the runtime is provably
|
|
@@ -48,6 +48,8 @@ export interface ClaudeJob {
|
|
|
48
48
|
fan: JobFanEntry[];
|
|
49
49
|
tokens?: number;
|
|
50
50
|
needs?: string;
|
|
51
|
+
/** Structured choices for a provider prompt parked by Hive. */
|
|
52
|
+
promptChoices?: string[];
|
|
51
53
|
output?: unknown;
|
|
52
54
|
/**
|
|
53
55
|
* Hive-augmented (not part of the daemon's state.json): the latest assistant
|
|
@@ -105,6 +107,8 @@ export interface MissionSummary {
|
|
|
105
107
|
policy?: MissionPolicy;
|
|
106
108
|
provider?: MissionProvider;
|
|
107
109
|
model?: string;
|
|
110
|
+
/** Require explicit user approval of the proposed plan before implementation or worker delegation begins. */
|
|
111
|
+
planFirst?: boolean;
|
|
108
112
|
/** Repositories beyond the working directory this mission also touches; each grants --add-dir access on every turn. */
|
|
109
113
|
additionalRepositories?: string[];
|
|
110
114
|
}
|
|
@@ -230,6 +234,7 @@ export interface CompletionGate {
|
|
|
230
234
|
status: CompletionGateStatus;
|
|
231
235
|
required: boolean;
|
|
232
236
|
evidence: string[];
|
|
237
|
+
source?: "orchestrator" | "template" | "user";
|
|
233
238
|
waiver?: {
|
|
234
239
|
reason: string;
|
|
235
240
|
waivedAt: number;
|
package/package.json
CHANGED