Commit Graph

4409 Commits

Author SHA1 Message Date
gsxdsm
4866f341bd fix(engine): prevent worktree collisions on manual task moves
Two related bugs let two in-progress tasks share a single
.worktrees/<name> directory:

1. The dashboard POST /tasks/:id/move route promoted tasks to
   in-progress without allocating a fresh worktree path, so a queued
   task carrying a stale worktree field from a prior preserveResumeState
   requeue could land in-progress on a directory already held by another
   active task.

2. moveTask({preserveResumeState:true}) kept the worktree pointer on
   requeue. When the on-disk checkout was later removed or reassigned,
   the next dispatch collided with a worktree the scheduler had handed
   to another task.

moveTask now releases the worktree pointer on every reopen-to-todo hop
(branch is kept so committed progress survives via git worktree add
<path> <branch>). A new preserveWorktree option opts internal bounces
out of the release. moveTask also accepts an allocateWorktree callback
that runs under a new cross-task allocation lock in TaskStore, so two
concurrent moves cannot pick the same name from a stale snapshot. Both
the manual-move route and the scheduler dispatch path flow through the
allocator and share the lock.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-06 07:23:38 -07:00
gsxdsm
9f2b96e235 fix(engine): make heartbeat helper imports static to fail fast on partial dist
Convert the dynamic await import("./agent-session-helpers.js") and
await import("./session-skill-context.js") calls inside the heartbeat
executor to static top-level imports, matching the rationale of
26a14698c (which already made the sibling pi.js import static).
This surfaces ERR_MODULE_NOT_FOUND at engine load time rather than
mid-heartbeat when a worktree is on a branch missing the helpers.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-06 06:49:30 -07:00
gsxdsm
e3ca545a66 fix: make agent error modal taller on mobile so full message is visible from top
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-06 06:40:44 -07:00
Fusion
b28ae48fff feat(FN-3102): add plugin contribution types, scheduled evaluator, and agen
This merge adds a new evaluation framework including signal collection (`eval-signal-collector.ts`), typed evaluation signals (`eval-types.ts`), and an evaluator engine module (`evaluator.ts`) with cron-runner integration for scheduled evaluation. It also establishes plugin contribution type constra

Fusion-Task-Id: FN-3102
2026-05-06 06:18:09 -07:00
Fusion
6a599d607a feat(FN-3389): fix scheduled evaluator integration types
Completes typing for the scheduled evaluator integration in the cron runner and project engine, with corresponding test updates in the evaluator test file.

Fusion-Task-Id: FN-3389
2026-05-06 06:05:05 -07:00
Fusion
409f06c5e3 feat(FN-3553): improve agent creation with native shell connection and onbo
This merge adds a canonical in-dialog AI interview flow for agent onboarding (FN-3553), replacing the old wizard with a multi-step dialog that guides users through creating and reviewing agent prompts before spawning, plus tokenized typography fixes. It also introduces native shell connection handof

Fusion-Task-Id: FN-3553
2026-05-06 05:53:01 -07:00
Fusion
419c6f3b31 feat(FN-3400): add native shell connection handoff, plugin management CLI/l
This merge adds a complete plugin management system (FN-3565) with CLI commands, a loader, runner, and dashboard routes, along with project-scoped auth storage (FN-3544), native shell connection support for mobile (FN-3400) spanning onboarding, connection manager, and remote desktop handoff, and ref

Fusion-Task-Id: FN-3400
2026-05-06 05:29:56 -07:00
Fusion
fb0e15562d feat(FN-3544): add project-scoped auth storage and docs updates
- Add project auth storage model and persistence wiring in core DB/store/types
- Expand core test coverage for DB migration, store behavior, and project auth store flows
- Update heartbeat agent, settings, dashboard, and storage documentation for the new behavior
- Replace hardcoded mobile touch-target sizing in dependency graph styles with token-based sizing

Fusion-Task-Id: FN-3544
2026-05-06 04:56:29 -07:00
Fusion
408a46e1c2 feat(FN-3565): add plugin management CLI, loader, runner, and dashboard rou
This merge adds a complete plugin management system to Fusion: a new `fn plugin` CLI command for installing/removing plugins, a plugin loader in core, a plugin runner in engine, and dashboard routes for plugin management UI, along with a plugin management guide in docs. It also documents task evalua

Fusion-Task-Id: FN-3565
2026-05-06 04:32:29 -07:00
Fusion
ce323742a3 feat(FN-3514): document task evaluation settings in settings reference
Documents task evaluation settings by adding 6 lines to the settings reference guide.

Fusion-Task-Id: FN-3514
2026-05-06 04:09:23 -07:00
gsxdsm
990abc7b56 feat(FN-3571): merge fusion/fn-3571 2026-05-06 03:54:15 -07:00
Fusion
79a6b2c840 feat(FN-3539): remove duplicate todos entry and update navigation docs
Merged branch removes the duplicate desktop "Todos" nav entry from the Header, syncs the `allowParallelExecution` runtime toggle into `AgentDetailView`, and updates the corresponding docs (agents.md, settings-reference.md, todo-view.md, dashboard-guide.md) to reflect the navigation change. Tests wer

Fusion-Task-Id: FN-3539
2026-05-06 03:52:18 -07:00
Fusion
e518ce0b6c feat(FN-3567): sync allowParallelExecution runtime toggle
Fixes FN-3567 by synchronizing the `allowParallelExecution` runtime toggle in the AgentDetailView component, adding one line to keep the setting in sync.

Fusion-Task-Id: FN-3567
2026-05-06 03:36:02 -07:00
Fusion
e72156bd58 feat(FN-3079): add changeset for plugin dashboard views delivery
Completes the plugin dashboard views feature (FN-3079) by adding the changeset that documents the change for the next release.

Fusion-Task-Id: FN-3079
2026-05-06 03:20:15 -07:00
Fusion
94a5dca53c feat(FN-3535): restore terminated agent state and align lifecycle controls
This merge completes the agent terminated state alignment (FN-3535), adding "running → terminated" transition support with consistent styling and lifecycle controls across the heartbeat engine, agent store, and dashboard UI, plus plugin author documentation improvements (FN-3537) and plugin loader t

Fusion-Task-Id: FN-3535
2026-05-06 03:07:27 -07:00
Fusion
348f343b00 feat(FN-3537): add browser navigation section to dashboard guide
Added a browser navigation section to the dashboard guide documentation.

Fusion-Task-Id: FN-3537
2026-05-06 02:55:17 -07:00
Fusion
321a394300 feat(FN-3566): audit and reconcile local main against origin
Merged FN-3566 work that audits local main divergence from origin and reconciles the branch, adding an audit trail document (`FN-3566-STEP1-AUDIT.md`) to track the divergence analysis and safeguards applied during the reconciliation process.

Fusion-Task-Id: FN-3566
2026-05-06 02:23:59 -07:00
Fusion
c630a94ef8 feat(FN-3564): isolate plugin loader test state to prevent cross-test conta
Refactored plugin-loader tests and implementation to isolate plugin test contamination, improving test independence in `@fusion/core`.

Fusion-Task-Id: FN-3564
2026-05-06 02:14:05 -07:00
gsxdsm
1ada98b53f chore(release): v0.22.0
Version bump via changesets.
2026-05-06 00:11:20 -07:00
gsxdsm
6ab270cfe2 fix(dashboard): wrap mission card stats so counts reflow in narrow sidebar
In a narrow resized sidebar the milestones / features / tasks counts ran
off the card edge because .mission-list__item-summary was a non-wrapping
flex row. Switch it to flex-wrap with split row/column gaps so the stats
reflow onto new lines instead of clipping.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-06 00:09:33 -07:00
gsxdsm
2f439121e0 fix(dashboard): primary mission CTA, auto-select first, richer empty state
- Promote the sidebar "Plan New Mission" CTA to a btn-primary (matching the
  chat sidebar's "New Chat") and drop the dashed icon buttons; full-width
  progress bar and Activity row each get their own line in the card.
- Auto-select the first mission in the inline desktop view so users land
  in detail rather than the empty placeholder. Skipped in mobile and the
  standalone modal so existing flows and unit tests stay intact.
- Replace the bare "No missions yet" line with a richer empty state that
  explains what missions are and offers an inline Plan New Mission CTA.
- Guard loadMissionDetail against malformed responses (missing milestones)
  so racing fetch fallbacks don't crash the detail render.
- Update three MissionManager tests to match the new copy/structure.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-06 00:05:55 -07:00
gsxdsm
06b9a21ad5 fix(engine): stop tears down in-progress merger and triager sessions
TriageProcessor.stop() previously only halted the polling loop, so
in-flight specify sessions and their reviewer subagents kept streaming
past shutdown. Extracted the existing global-pause teardown into
abortAndDisposeActiveSessions() and call it from stop() too.

aiMergeTask creates three sessions during a merge — autostash resolver,
in-merge verification fix agent, and pull-rebase conflict resolver — but
only the autostash one was registered via onSession. The other two are
now registered (with onSession threaded through pushToRemoteAfterMerge
into the rebase resolver chain), so ProjectEngine.stop() actually
disposes whichever merger session is running when shutdown lands.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-06 00:05:55 -07:00
gsxdsm
47e6c48ac9 test(dashboard): drop AgentDetailView Import button assertions
The Import button moved to the AgentsView header; its detail-view test
coverage no longer applies.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-06 00:05:55 -07:00
gsxdsm
12c1eb0d44 fix(dashboard): drop residual terminated-state refs lost in merger autostash
Recovers cleanups from stash@{2}/stash@{3} (FN-3530 merger autostashes)
that the merger never restored: 4 dead `[data-state="terminated"]`
selectors in AgentListModal.css, 3 CSS-class assertions in
agent-css-classes.test.ts targeting classes the runtime no longer emits,
and a `state: "terminated"` fixture in routes-agents.test.ts now flipped
to `paused` so the "invalid state transitions" test exercises a real
rejection (paused→paused is not in AGENT_VALID_TRANSITIONS).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-06 00:05:55 -07:00
gsxdsm
f61bea99e9 fix(dashboard): widen mission card title and surface Plan New Mission CTA
- Stack mission cards vertically inside the sidebar so the title gets
  the full card width; action buttons drop to their own row below.
- Move the Activity timestamp out of the cramped stats row onto its
  own line.
- Replace the icon-only Sparkles button in the sidebar header with a
  full-width centered "Plan New Mission" button (icon + text). Mobile
  footer button uses the same label.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-06 00:05:55 -07:00
gsxdsm
639484f006 fix(dashboard): tighten agents view Import button label and controls class
- Shorten Import button aria-label/title to "Import" to match visible text.
- Add agent-controls-actions class to the global controls wrapper.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-06 00:05:55 -07:00
gsxdsm
2eaddb6f56 fix(dashboard): resizable mission sidebar and cleaner card header
- Make the mission split sidebar drag-resizable (220–560px, persisted) so
  long mission titles aren't trapped behind a fixed-width column.
- Move card tags (autopilot/health/status) to a row below the title and
  drop the overflowing "Active: …" line.
- Collapse mission creation to a single AI-driven entry point: rename
  Sparkles to "Create New Mission" and remove the manual "+" button.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-06 00:05:55 -07:00
gsxdsm
c9d7677ab0 fix(dashboard): drop themed background behind agent detail header avatar
The avatar already self-renders its colored badge; the wrapper's
var(--todo) tile produced a redundant outline around the icon.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-06 00:05:55 -07:00
gsxdsm
25178346ac fix(dashboard): re-apply agent Import button move
The previous commit's working-tree state lost the AgentsView/AgentDetailView
edits during an auto-stash flow; re-applies the move so Import sits beside
"New Agent" in the global header and is gone from the detail page and
controls panel.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-06 00:05:55 -07:00
Fusion
137a5d1b5b feat(FN-3097): wire plugin prompt contributions into execution surfaces
- Add plugin prompt contribution support across executor, triage, reviewer, and heartbeat instruction builders
- Thread plugin runner context into execution prompt assembly and preserve source issue commit reference hints
- Expand engine tests to cover prompt contribution injection behavior and regression scenarios
- Update architecture and plugin authoring docs with prompt surface integration details

Fusion-Task-Id: FN-3097
2026-05-06 00:05:55 -07:00
gsxdsm
b6ffb613b0 fix(dashboard): null WebSocket handlers before close to stop terminal tab doubling
Creating a new terminal tab caused every pty data chunk (including
keystroke echo) to render twice in xterm. The connect-effect's
`contextChanged` dep flips true→false in the same render cycle as
the new connection: the effect re-runs, React calls cleanup which
closed the still-CONNECTING WS without nulling its handlers, then
connect() opens a fresh WS. The ghost socket's onmessage continued
firing on the shared `onDataCallbacksRef` Set, delivering each chunk
twice (and producing the "WebSocket is closed before the connection
is established" warning). Null onopen/onmessage/onclose/onerror in
both cleanup() and connect()'s pre-close branch.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-06 00:05:55 -07:00
Fusion
9ff2af567d feat(FN-3538): document pause-safe stuck timing in settings reference
Merged step 4 of the FN-3538 branch, which adds documentation for pause-safe stuck timing to the settings reference.

Fusion-Task-Id: FN-3538
2026-05-06 00:05:55 -07:00
Fusion
2c497b3734 docs(FN-3538): clarify pause-safe stuck timeout behavior
- Update enginePaused setting docs to specify stuck-task timers are suspended while pauses are active
- Document that paused wall-clock time does not count toward taskStuckTimeoutMs, including shared globalPause windows
- Clarify that unpausing restores scheduling and grants active sessions a fresh stuck-task grace window before detection resumes

Fusion-Task-Id: FN-3538
2026-05-06 00:05:55 -07:00
Fusion
6523f995df feat(FN-3534): surface task provenance in extension outputs
Merges FN-3534 to surface task provenance in CLI extension outputs (task list/show) with corresponding tests and a changeset for the published `@runfusion/fusion` package. Also includes FN-3297 test coverage for incomplete runtime distribution trees in the test-artifacts script.

Fusion-Task-Id: FN-3534
2026-05-06 00:05:55 -07:00
gsxdsm
d2ca8aef17 fix(engine): reconcile agents stuck in running state after missed heartbeat
Recovery path now calls completeRun(terminated) so the canonical agent-state
transition runs, and reconcileOrphanedRunningAgents both catches stale-heartbeat
cases and runs every poll so pre-existing stuck rows self-heal post-upgrade.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-06 00:05:55 -07:00
Fusion
e70b1c5d15 feat(FN-3534): surface task provenance in extension outputs
- Add task provenance fields to extension task list/show outputs for better source visibility
- Expand CLI extension tests to cover provenance rendering in task list and task detail responses
- Add a changeset for @runfusion/fusion documenting the provenance output update
- Harden ensure-test-artifacts script and tests to cover incomplete runtime dist tree scenarios

Fusion-Task-Id: FN-3534
2026-05-06 00:05:55 -07:00
gsxdsm
8be2a39105 feat(dashboard): move agent Import button to global agents header
Surfaces Import alongside "New Agent" in the agents header and removes
the duplicate buttons from individual agent detail pages and the
controls panel.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-06 00:05:54 -07:00
Fusion
1ff50c6e9e feat(FN-3297): add test coverage for incomplete runtime dist trees
Adds test coverage for incomplete runtime dist trees in the test-artifacts script, with one new test file and a small fix to the script itself.

Fusion-Task-Id: FN-3297
2026-05-06 00:05:54 -07:00
gsxdsm
9a49f78944 Merge pull request #49 from timothyjlaurent/fix/mission-interview-default-model
fix(dashboard): resolve default model from settings for mission interview
2026-05-06 00:03:16 -07:00
gsxdsm
015998ff52 Merge pull request #47 from timothyjlaurent/timothyjlaurent/fix-anthropic-logout
fix(auth): prevent credential resurrection after Anthropic logout
2026-05-06 00:02:40 -07:00
Timothy Laurent
96114f86ab fix(dashboard): resolve default model from settings for mission interview
The mission interview route passed modelProvider/modelId from the request
body directly without resolving the configured default model from settings.
When "Use default" was selected, both values were undefined, causing
createFnAgent to use pi's internal fallback instead of the user's
configured default (e.g. zai/glm-5.1). This produced "AI returned no
valid JSON" errors.

Use resolvePlanningSettingsModel() to resolve the effective model from
the settings hierarchy (planning-specific → project → global defaults),
with explicit request overrides still taking precedence.

Closes #48

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-05 22:24:38 -07:00
gsxdsm
e004b205d9 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>
2026-05-05 22:18:35 -07:00
gsxdsm
03529ba940 feat(dashboard): add tool-output toggle to agent log viewer with persisted markdown/tools prefs
Adds a "Tools: On/Off" toggle next to the existing markdown toggle in
AgentLogViewer (used by both agent logs and task agent logs). When tool
output is off, tool/tool_result/tool_error entries are filtered before
grouping so only agent text and thinking render. Both toggles persist
globally across sessions via localStorage (fn-agent-log-markdown,
fn-agent-log-tool-output).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 22:18:35 -07:00
gsxdsm
3f2fadd103 feat(engine): gate executor and heartbeat on allowParallelExecution
When a permanent agent has allowParallelExecution=false, TaskExecutor.execute()
defers if the agent has an active heartbeat run, and HeartbeatScheduler defers
a heartbeat if the agent's bound task has an active executor session. Each side
re-dispatches the other's deferred work on completion via resumeTaskForAgent
and the in-process runtime's onRunCompleted hook.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 22:18:35 -07:00
Timothy Laurent
248ef6d779 fix(auth): add remove() trap to engine auth storage proxy
The CLI proxy already had a remove() trap, but the engine's
createFusionAuthStorage was missing it. Without this trap, calling
remove() on a provider would delete the credential from storage but
not add it to loggedOutProviders, allowing fallback credentials to
resurrect the provider on the next read.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-05 22:00:07 -07:00
Timothy Laurent
eb3787e06b fix(auth): update tombstones after storage writes to prevent state drift
Reorder logout/set/remove traps so in-memory loggedOutProviders is only
updated after the underlying storage write succeeds. If target.logout()
or target.set() throws, the tombstone set now stays consistent with the
actual storage state.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-05 21:42:13 -07:00
Timothy Laurent
c82d7736da fix(auth): filter target.list() against loggedOutProviders for consistency
The list() trap now applies a final filter against loggedOutProviders,
matching the defensive approach used in the CLI layer. While target.logout()
removes entries from underlying storage, this prevents any edge case where
a logged-out provider could appear in list() results.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-05 21:33:44 -07:00
Timothy Laurent
7724cadaf4 fix(auth): harden logout proxy traps from review feedback
- get() now returns undefined for logged-out providers instead of
  delegating to target.get() which could bypass the guard
- getCredential() in provider-auth returns undefined for logged-out
  providers instead of falling through to authStorage.get()
- getAll() skips logged-out providers at top of loop
- list() filters modelsJsonApiKeys against loggedOutProviders
- Added remove() trap in provider-auth for clearApiKey flow

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-05 21:21:33 -07:00
Timothy Laurent
148b2e8f4c fix(auth): prevent credential resurrection after Anthropic logout
The logout flow had two bugs causing credentials to reappear immediately:

1. The codebase has two separate auth storage Proxy chains:
   - createFusionAuthStorage (engine, for agents)
   - mergeAuthStorageReads (CLI, for dashboard UI)
   Neither had a logout trap, so supplemental credentials from
   ~/.claude/.credentials.json were never excluded after logout.

2. The upstream AuthStorage.hasAuth() checks environment variables
   (ANTHROPIC_API_KEY), which always returns true regardless of logout.

Fix: Add loggedOutProviders tracking to both Proxy chains. All query
traps (has, hasAuth, get, getAll, list, getApiKey) return false/undefined
for logged-out providers instead of delegating to the underlying storage.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-05 20:51:44 -07:00
gsxdsm
8575c48d85 fix(engine): make merger autostash recovery resilient and AI-resolve conflicts
When rootDir is the developer's primary checkout, the merger stashes
uncommitted edits before its hard resets and applies them back at the
end. Previously a pop conflict logged a single warning and silently
left the stash in place — a subsequent merge would push another
autostash on top, burying the first. Recent FN-3299 work was lost this
way and surfaced two side-by-side fusion-merger-autostash entries in
the local stash list.

Three changes:

- AI auto-resolve on apply conflict. The new
  runAiAgentForAutostashConflict spawns the same createResolvedAgentSession
  path as the in-merge fix-agent, instructs it to clear conflict markers
  in place without committing, and verifies markers are gone post-run.
  On verified success the stash is dropped; on any failure or remaining
  markers the stash is left intact for manual recovery.
- Outcome surfaced via new MergeResult.autostash (AutostashOutcome)
  field so dashboard / CLI / daemon can show developers whether their
  work was reapplied cleanly, AI-resolved, or needs manual recovery.
- Deterministic stash identity. Replaced `git stash push` + label-grep
  (which races against concurrent stashing tools) with `git stash create`
  + `git stash store`, capturing SHA atomically with snapshot creation
  and using it for apply / drop. Untracked files captured via `git add
  -A` before create; cleanup via `git reset --hard` + `git clean -fd`.

Also surfaces orphaned `fusion-merger-autostash:*` entries from prior
runs at merge entry, so they can no longer be silently buried.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 20:47:38 -07:00