Commit Graph

2091 Commits

Author SHA1 Message Date
Hunter B 30992aa0e3 feat(tui): add /swarm WhaleFlow-backed multi-agent overlay (#3178)
/swarm [N] <task> is a high-fanout overlay on the current mode (Agent/Plan/YOLO),
NOT a fourth mode. It mirrors the proven /agent command pattern: it emits a
model instruction to decompose the task, fan out one headless sub-agent per
subtask via agent_open (role/agent_type per subtask, max_depth N for nesting),
run them concurrently, and synthesize from each worker's result SUMMARY (not its
transcript) — the isolation pattern that keeps the orchestrator light.

Registered with aliases fanout/qun; CmdSwarmDescription was already localized in
all locales. Validated by the command-registry completeness tests (unique
names/aliases, complete metadata); broad commands suite 431/0.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-13 02:09:51 -07:00
Hunter B 04aa64d569 feat(tui): lock mode/thinking while a turn is running (#2982)
While a turn is in flight (`is_loading`), the model/permission surface the
engine is acting on must not shift underneath it. User-initiated mode cycling
(cycle_mode / cycle_mode_reverse) and thinking cycling (cycle_effort) are now
refused with a concise status message ("… is locked while a turn is running —
press Esc to interrupt first") and the selection stays put (the chip "twitches"
back rather than moving). Internal set_mode transitions (YOLO/plan) are
unaffected — only the user gestures are guarded.

Unit-tested: locked while is_loading, works again once idle. Persistent
busy/free chip styling is left for a visual-review pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-13 02:05:52 -07:00
Hunter B 3246ef067c fix(cli): keep Anthropic exec-only in the interactive TUI
The fleet-foundation provider expansion added Anthropic/Zai/Stepfun/Minimax as
recognized providers (auth parser + PROVIDER_LIST), but also flipped all four to
TUI-supported in provider_is_supported_by_tui — making every ProviderKind
supported, killing the rejection path and breaking three build_tui_command
rejection tests (the flip had no positive test, so it was an unverified side
effect).

Anthropic speaks the native Messages API, not the OpenAI-compatible shape the
interactive loop expects, so it stays exec-only (as it was on origin):
`codewhale --provider anthropic` is rejected with a hint to use
`codewhale exec --provider anthropic`. Zai (GLM/Z.AI — the v0.8.60 headline),
Stepfun, and Minimax are OpenAI-compatible and remain interactively supported.

Restores the rejection guard and the 3 tests (now 95/0 in codewhale-cli).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-13 01:37:14 -07:00
Hunter B 5106ecfb2d test(fleet): CI-safe multi-worker dogfood smoke with injected failure (#3166)
Adds a verifiable dogfood smoke that drives several concurrent exec-style
workers (three healthy + one injected-failure that emits an error event and
exits non-zero) through the real host adapter, asserting distinct terminal
pass/fail outcomes — no external services, no model calls, no codewhale binary.
Documents the automated CI smoke vs the manual `codewhale fleet run` path in
the dogfood spec, and is honest that the manager run-loop cutover to drive real
FleetExecutor workers is still in progress.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-13 01:30:06 -07:00
Hunter B d47431269f feat(fleet): FleetExecutor runs workers as real exec subprocesses (#3096/#3154)
Adds FleetExecutor: drives a worker as a local `codewhale exec` subprocess via
the existing host adapter, incrementally drains its stream-json output into
FleetWorkerEventPayload ledger events, and finalizes the terminal outcome from
the process exit. The worker's heavy runtime/tool construction lives in its own
process, so the orchestrator only ingests a compact event stream — the
isolation pattern that keeps fanout light (per Codex/Kimi/Claude Code).

Verified end-to-end by an integration test that runs a REAL subprocess emitting
stream-json (standing in for `codewhale exec`) through the real adapter and
asserts RunningTool + terminal Completed events flow out — no codewhale binary
needed. 8 executor tests pass; the 58 existing fleet tests stay green
(executor is not yet wired into `codewhale fleet run`, so no behavior change).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-13 01:24:22 -07:00
Hunter B 91cbaf2811 feat(fleet): exec-subprocess worker building blocks (#3096/#3154)
A fleet worker IS a headless `codewhale exec` run — not a separate execution
engine. New crates/tui/src/fleet/executor.rs provides the bridge:

- build_worker_exec_command: FleetTaskSpec + FleetExecConfig ->
  `codewhale exec --auto --output-format stream-json [--model/--allowed-tools/
  --disallowed-tools/--max-turns/--append-system-prompt] <prompt>`. Secrets are
  never on argv (worker resolves its own config/keyring).
- map_exec_stream_line: maps the worker's stream-json events
  ({"type":"tool_use"|"content"|"tool_result"|"done"|"error"}) into
  FleetWorkerEventPayload so the durable ledger persists the worker's OWN event
  vocabulary (collapses the translation layer toward identity).
- classify_worker_exit: process exit -> terminal Completed/Failed/Cancelled.

This is the substrate for replacing the local simulation with real headless
workers. fleet_task_prompt is now pub(crate). 7 new unit tests; building blocks
only (no behavior change yet) so the 58 existing fleet tests stay green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-13 01:20:28 -07:00
Hunter B b1cc6ecf5d merge: fleet security/trust + headless-worker foundation + depth unification 2026-06-13 01:11:50 -07:00
Hunter B e8b52ac57a feat(fleet): security/trust + headless-worker foundation; unify recursion depth
Lands the Agent Fleet security/trust boundary and the headless-worker bridge on
the v0.8.60 line, and collapses the sub-agent and fleet recursion model into a
single shared axis (Hunter steer: "not two moving targets").

Security & trust (#3165):
- FleetTrustLevel, FleetSecurityPolicy, FleetSecretRef (redacted), FleetWorkerAuth,
  FleetCapabilityGrant, FleetAlertEndpoint (redacted) in protocol.
- secrets: resolve_direct(key, source_hint) — fleet secret resolution, never logged.
- Host adapters refuse secret-bearing env keys; SSH uses SendEnv (no argv secrets).

Roles & delegation (#3167):
- fleet role -> SubAgentType mapping; reviewer/verifier default read-only.

Headless worker bridge (#3096/#3154, partial — still simulation, real spawn next):
- worker_runtime: FleetTaskSpec -> AgentWorkerSpec, status -> ledger events,
  exec hardening (mirrors #3027), parallel-safe read-only tool set (#2983).
- FleetManager carries an optional SharedSubAgentManager + exec config.

Recursion depth — ONE axis:
- codewhale_config now owns DEFAULT_SPAWN_DEPTH (3) + MAX_SPAWN_DEPTH_CEILING (3).
- sub-agent DEFAULT_MAX_SPAWN_DEPTH and the fleet clamp both source these consts.
- fleet default raised 1 -> 3 to match standalone sub-agents; root runs at depth 0,
  budget gates child delegation. End-to-end test proves a depth-0 fleet worker
  reaches 3 nested levels (afford >= 3).

Dogfood scaffolding (#3166, partial): docs/examples/fleet-dogfood.toml.

Tests green: codewhale-config fleet, codewhale-tui fleet (58), subagent max_depth;
cargo fmt + git diff --check clean; cargo check --workspace ok.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-13 01:10:30 -07:00
Hunter B 754cff1c84 Refresh GLM and MiniMax provider models 2026-06-12 23:56:01 -07:00
Hunter B 751ff943aa fix(tui): group strategy context under work checklist 2026-06-12 22:55:11 -07:00
Hunter B c0ba6ce5ad feat(subagents): add agent run receipts 2026-06-12 22:45:53 -07:00
Hunter B fb1a27b4f2 feat(fleet): add manager runbook skill 2026-06-12 22:26:35 -07:00
Hunter B e9f0c1c13b feat(config): add first-party MiniMax provider route
Refs #1310.

Adds the direct minimax provider slot, auth/config/env bindings, model aliases, docs, and picker/status surfaces. MiniMax requests now set reasoning_split and preserve reasoning_details history so thinking stays out of answer text.

Also updates Moonshot/Kimi reasoning classification for the Kimi Code route so reasoning_content streams into Thinking cells instead of inline prose.
2026-06-12 22:05:22 -07:00
Hunter Bown e6005eb9ac feat(config): add first-party Z.ai and StepFlash/StepFun provider routes (#3187) (#3191)
* feat(config): add first-party Z.ai and StepFlash/StepFun provider routes (#3187)

Add Z.ai (GLM Coding Plan) and StepFun/StepFlash as first-party providers:

Provider: Z.ai
- Default model: GLM-5.1 (200K context, 128K output, thinking, function calling)
- Base URL: https://api.z.ai/api/coding/paas/v4
- Auth: ZAI_API_KEY / Z_AI_API_KEY
- Config key: [providers.zai]

Provider: StepFun
- Default model: step-3.7-flash (256K context, 256K output, 3-level reasoning)
- Base URL: https://api.stepfun.ai/v1
- Auth: STEPFUN_API_KEY / STEP_API_KEY
- Config key: [providers.stepfun]

Both providers use OpenAI-compatible Chat Completions transport.

Includes:
- ProviderKind enum variants with serde aliases
- ProvidersToml config fields with aliases
- Provider trait implementations in provider.rs
- PROVIDER_REGISTRY, ALL, KIND_LOOKUP, FROM_KIND_LOOKUP updates
- EnvRuntimeOverrides fields and env-var loading
- TUI ApiProvider enum and lookup table updates
- CLI provider_slot and provider_env_vars additions
- Exhaustive match arms across client.rs, config.rs, engine.rs, main.rs,
  provider_picker.rs, ui.rs, and config_persistence.rs

Verified: cargo check passes, config provider tests (67/67) pass.

* test(tui): update provider picker tests for Zai and Stepfun additions
2026-06-12 19:58:57 -07:00
Hunter B 6b5ffd5627 feat(tui): expose fleet status surfaces 2026-06-12 19:35:11 -07:00
Hunter B bc61857fad feat(tui): add opt-in fleet alert dry-runs 2026-06-12 19:17:50 -07:00
Hunter B 714276e1c1 feat(tui): add verifiable fleet task specs 2026-06-12 19:01:00 -07:00
Hunter B 44f429f108 feat(tui): add fleet scheduler policy 2026-06-12 18:43:36 -07:00
Hunter B 9e5688b8c8 feat(tui): add fleet host adapters 2026-06-12 18:31:29 -07:00
Hunter B 66a45c0070 feat(tui): add local fleet manager commands 2026-06-12 18:15:18 -07:00
Hunter B 8ba8f7f2f5 merge #3156 fleet ledger 2026-06-12 17:56:41 -07:00
Hunter B 023434cb2a fix(tui): harden fleet ledger replay and compaction 2026-06-12 17:56:26 -07:00
Hunter B b0c876e5ac merge #3155 fleet protocol fixes into ledger branch
# Conflicts:
#	crates/protocol/src/fleet.rs
2026-06-12 17:50:45 -07:00
Hunter B 59848f18fc merge #3155 fleet protocol types
# Conflicts:
#	crates/protocol/src/lib.rs
2026-06-12 17:50:18 -07:00
Hunter B f0ae838eb1 fix(protocol): harden fleet JSON contract 2026-06-12 17:48:59 -07:00
Hunter B 5b47d46092 chore: seed v0.8.60 branch from main after v0.8.59
# Conflicts:
#	README.md
#	crates/cli/src/lib.rs
#	crates/config/src/lib.rs
#	crates/config/src/provider.rs
#	crates/tui/src/commands/mod.rs
#	crates/tui/src/localization.rs
#	crates/tui/src/prompts.rs
#	crates/tui/src/tui/ui.rs
#	crates/tui/src/tui/ui/tests.rs
#	crates/tui/src/tui/widgets/tool_card.rs
#	scripts/benchmarks/cli-compare.py
2026-06-12 17:42:22 -07:00
CodeWhale Agent 3d822488fe chore(fmt): apply cargo fmt for CI parity gate 2026-06-12 17:02:17 -07:00
CodeWhale Agent 97f8a98b75 fix(config): align Kimi OAuth credentials with Kimi Code 2026-06-12 16:43:25 -07:00
CodeWhale Agent 738a265197 fix(tui): show Bash for shell work in visible UI 2026-06-12 16:32:32 -07:00
CodeWhale Agent f870eb3e19 fix(tui): keep subagents alive across backgrounded waits 2026-06-12 16:16:39 -07:00
CodeWhale Agent d48373617f fix(tui): clear sidebar hover highlight on exit while loading 2026-06-12 15:54:08 -07:00
CodeWhale Agent b0577057c9 fix(tui): localize notifications and persist sidebar focus 2026-06-12 15:47:44 -07:00
dependabot[bot] 7856d26d64 build(deps): bump tempfile from 3.24.0 to 3.27.0 (#2997)
Bumps [tempfile](https://github.com/Stebalien/tempfile) from 3.24.0 to 3.27.0.
- [Changelog](https://github.com/Stebalien/tempfile/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Stebalien/tempfile/compare/v3.24.0...v3.27.0)

---
updated-dependencies:
- dependency-name: tempfile
  dependency-version: 3.27.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-12 15:44:26 -07:00
dependabot[bot] 45f334828f chore(deps): bump pdf-extract from 0.7.12 to 0.10.0 (#3184)
Bumps [pdf-extract](https://github.com/jrmuizel/pdf-extract) from 0.7.12 to 0.10.0.
- [Commits](https://github.com/jrmuizel/pdf-extract/compare/v0.7.12...v0.10.0)

---
updated-dependencies:
- dependency-name: pdf-extract
  dependency-version: 0.10.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-12 15:44:13 -07:00
CodeWhale Agent e4989c0eae feat(tui): add Copy to the sidebar right-click context menu
Removing Paste from the sidebar menu (#3065) left rows with no copy
path at all — sidebar text can't be mouse-selected. Right-clicking a
sidebar row now offers Copy, which writes the row's untruncated text
plus its hover detail to the clipboard via a new
ContextMenuAction::CopyText. Run stays first for clickable rows.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 15:35:20 -07:00
CodeWhale Agent ba1104251a feat(tui): richer Work overflow and Agents hover detail in sidebar
- Work panel: hovering the '+N more checklist items' overflow row now
  reveals the omitted checklist items in the popover, so a
  height-constrained panel no longer hides work items with no way to
  inspect them (#3063).
- Agents panel: the compact agent label row's hover text now carries a
  full dossier — id, role, status, elapsed time, step count, objective
  (new SidebarAgentRow field, from SubAgentAssignment), branch, and
  untruncated progress. Compact rows stay unchanged.
- Detail-row hover keeps the full progress text instead of the
  summarized form.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 15:26:53 -07:00
CodeWhale Agent 2da01367e6 fix(tui): keep sidebar resize live during active turns
The loading mouse filter (should_drop_loading_mouse_motion) dropped all
Drag events while app.is_loading unless a transcript selection or
scrollbar drag was active. A sidebar resize started on the handle
(Down passes the filter) then never received its Drag events, leaving
the resize wedged mid-gesture during live runs (#3063, symptom of the
#3096 subagent-runtime pressure on the TUI).

- Allow Drag events through the loading filter while
  app.sidebar_resizing is set.
- Clear last_sidebar_area / last_sidebar_handle_area and any in-flight
  resize when the sidebar is hidden or doesn't fit, so stale handle
  hit-areas can't capture clicks.
- Tests: resize down/drag/up while loading, mouse-up outside the
  handle still ends the resize.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 15:26:53 -07:00
CodeWhale Agent 3169c459ed docs(changelog): document harvested v0.8.59 features 2026-06-12 14:54:47 -07:00
CodeWhale Agent 7ea05982f2 fix(clippy): resolve rust 1.96 lint errors blocking the release gate
cargo clippy --workspace -D warnings fails on three pre-existing spots
newly flagged by the current toolchain: unnecessary_sort_by in
context_report, question_mark in the provider fallback chain, and
unnecessary_map_or in the empty-state widget check. Apply the
mechanical fixes clippy suggests; no behavior change.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 14:48:42 -07:00
CodeWhale Agent 88ec6b5ea5 Harvest PR #3010: lock slim default prompt with calm-overlay regression test
The release branch already ships the slim-prompt intent in a stronger
form than #3010 — compose_default_static_layers appends no personality
overlay at all (voice/tone guidance is folded into the constitution
preamble), where the PR only emptied the Calm arm. Carry over the PR's
regression test, which derives its assertion from calm.md itself so a
future re-inclusion of the overlay text fails loudly.

Harvested from PR #3010 by @894876246

Co-authored-by: Hanmiao Li <894876246@qq.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 14:43:42 -07:00
CodeWhale Agent 71c45cf92f Harvest PR #2808: thread undo/retry and snapshot restore endpoints
The release branch independently evolved the sessions API from #2808
(POST /v1/sessions creates from a thread, /v1/sessions/{id}/resume-thread
resumes), but the turn-rewind and snapshot-restore endpoints never
landed. Port them onto the current thread model:

- POST /v1/threads/{id}/undo — fork at the Nth-from-last user message
  and return the dropped user text for input pre-population.
- POST /v1/threads/{id}/patch-undo — restore the newest differing
  tool:/pre-turn: workspace snapshot (same target selection as the
  TUI's patch_undo), then fork the conversation; reports the file
  rollback result alongside the forked thread.
- POST /v1/threads/{id}/retry — fork and immediately start a turn
  re-using the dropped user text (or an override prompt), adapted to
  the extended StartTurnRequest (dynamic_tools, environment_id).
- POST /v1/snapshots/{id}/restore — restore a workspace snapshot by id.

fork_at_user_message and its tests were already present; this adds the
HTTP surface plus endpoint tests for undo/patch-undo/retry/restore.

Harvested from PR #2808 by @bengao168

Co-authored-by: Ben Gao <bengao168@msn.com>
Co-authored-by: Hunter Bown <hmbown@gmail.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 14:43:42 -07:00
CodeWhale Agent 9b31621b19 Harvest PR #3051: voice input commands and hotbar integration
Port /voice, /voice-send, and /voice-control into the command strategy
registry as groups/core/voice.rs. The handlers only flip App state
(voice_enabled, voice_send_enabled, voice_control_enabled) and emit the
new AppAction::VoiceCapture; the UI event loop performs the actual
record + transcribe cycle so credentials come from the live Config
(deepseek_api_key/deepseek_base_url) instead of auth fields cached on
App, and no audio is ever recorded by the registry smoke tests.

- voice.toggle hotbar action dispatches the real /voice command and
  reports voice_enabled as its active state, replacing the placeholder.
- Recording uses sox/rec/arecord with RMS-based silence detection;
  transcription posts input_audio blocks to the provider chat
  completions API (async reqwest — the blocking client would panic
  inside the tokio event loop).
- Transcripts insert at the composer cursor via App::insert_str. With
  /voice-send enabled, a transcript ending in "send it" / 发送 strips
  the suffix and submits; a bare "send it" submits the current composer
  content. With /voice-control enabled, transcription runs through the
  AI dictation pipeline that sees the composer text.
- Failures (no recorder, no API key, short recording, network) surface
  as localized status messages and disarm voice input.
- Localized command help and status strings for all seven shipped
  locales; /voice now appears in the command palette.

Harvested from PR #3051 by @huqiantao

Co-authored-by: huqiantao <huqiantao@users.noreply.github.com>
Co-authored-by: Hunter B <hmbown@gmail.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 14:43:27 -07:00
CodeWhale Agent 662a459ee5 Harvest PR #2773: activate provider fallback chain
Harvested from PR #2773 by @idling11

Co-authored-by: Hanmiao Li <894876246@qq.com>
2026-06-12 14:12:51 -07:00
CodeWhale Agent 4200b64365 Harvest PR #2851: command strategy registry
Harvested from PR #2851 by @aboimpinto

Co-authored-by: Paulo Aboim Pinto <aboimpinto@gmail.com>

Co-authored-by: Hunter Bown <hmbown@gmail.com>
2026-06-12 14:04:22 -07:00
CodeWhale Agent 89a9981bf9 Merge PR #2879: Hugging Face provider docs and tests
Harvested from PR #2879 by @mvanhorn

Co-authored-by: mvanhorn <455140+mvanhorn@users.noreply.github.com>
2026-06-12 13:56:03 -07:00
CodeWhale Agent 1dc4c279ac Merge PR #3005: provider metadata registry
Harvested from PR #3005 by @sximelon

Co-authored-by: sximelon <15710511+sximelon@users.noreply.github.com>
2026-06-12 13:52:29 -07:00
CodeWhale Agent 81265ec71b feat(config): surface experimental feature flags 2026-06-12 13:36:13 -07:00
CodeWhale Agent d921b5670d fix(tui): keep Ghostty motion override live 2026-06-12 13:27:29 -07:00
CodeWhale Agent a0724bc5af fix(release): harden Windows shell env and PDF extraction
(cherry picked from commit 2d5f2d235849cd2fa520937a529935759e3782a3)
2026-06-12 12:12:24 -07:00
Hunter Bown 2b63a84473 Merge branch 'main' into feat/fleet-ledger-3156 2026-06-12 11:44:57 -07:00