feat/modes #1
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
ersyne/ersa-agent!1
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/modes"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Adds user-defined agent modes as the central preset mechanism (prompt fragment, identity/guidance overrides, tool allowlist) and wires them through the whole stack: a
modeJSON-RPC domain, per-session mode pinning, an Auto picker that routes a prompt to a mode and a reasoning effort in one decision call, and a settings UI to create/customize modes. Alongside it, this branch reworks the subagent lifecycle, adds session archive/trash, hardens the branch shell sandbox, and moves the web toolchain from Deno to Bun.184 files, +21.7k / −2.9k.
What's in it
Modes
agents.Modepreset: fragment, optional identity/guidance, tool allowlist of base names (["*"]= all). Subagent tools are exempt from allowlisting and are injected per build, so the allowlist is the capability set a child may be granted.internal/api/mode.go(+533 tests): catalog of built-ins + the caller's custom modes stored in themodesUserConfigs row; upsert/delete/default-mode verbs.ModesView,ModesSection,ModeEditor,ModeSelect; custom modes are user-editable in settings, and there is adefault_modeper user.SetSessionMode); Auto is a synthetic picker id that is never a real mode, is hidden in-session, and never resolves throughresolveMode(a stray value falls back to the built-inchat).Auto routing
chat+ the model's default effort — all or nothing, by design. This replaces the old separate 30 s, client-detached reasoning call.ReasoningScoreModifier), rounded and clamped into the levels the model actually advertises. The tuner exposes per-level gloss overrides (auto_reasoning_gloss, never read by the server).Decisionfeature flag; providers without it are surfaced as unsupported for the Auto decider.Subagents
subagent/subagent_wait/subagent_message, plus the child-sideask_parent, in a dedicated package with narrow seam interfaces (noagentsimport). Children are multi-turn:subagent_messageextends a running child or starts a follow-up on the same context.staleQuestiontracking so answers to timed-out questions are dropped, paused children (gated oncore.ErrUserInputRequested) driven through the rebuild arm so awaitingturn stays resumable, andSpawnSubagentno longer takes the redundant prompt (it's already persisted on the session row).ActiveSubagents,SubagentToolandTurnStateBadge.Sessions
ArchiveSessionFamily,TrashSessionFamily,RestoreSessionFamily, with aListArchivePageand anArchiveView+SessionMenuin the SPA. Stopping a family now stops every running member, not just direct children.ListOverviewPage), and a janitor handles lifecycle cleanup.Branch sandbox + tooling
.gitpointer file is bound read-only, and absent git hooks/config are replaced with tmpfs and/dev/nullrather than silent--ro-bind-tryno-ops. Mise dirs (data/cache/installs) are auto-derived so mise-installed toolchains need noro_pathsentry.***-framed patches and re-indents from the attachment point instead of the whole matched span (fixes column-0 context stripping).deno.lockremoved,bun.lockadded),vue-tsctypecheck task, and a hardened CDP smoke walk that asserts each route's document title and captures full-page + tiled screenshots.Behavior changes
example.config.yaml/example.branch.config.yaml— same keys, clearer docs;ro_pathsno longer needs~/.local/share/mise/installs.userIDandmodeID, since routing and mode resolution are per-user.Testing
mise run test-web— store unit tests (bun test) + server build + full headless-Chromium walk (/setup,/login,/,/overview,/archive,/settings,/settings/modes,/admin/*,/session/{id}).mise run check— template-awarevue-tscover the SPA.go test ./...— large additions acrossagents/auto,agents/subagent,agents/modes,api/mode,api/session,db/session.```bash git status ``` ```bash git diff --staged ``` Based on the provided diffs and the branch name `feat/modes`, the changes include: 1. **Auto Reasoning Router**: * Backend: `internal/server/agents/automode.go` adds `AutoReasoningCfg` and `loadAutoReasoningConfig`. `internal/server/agents/manager.go` adds `AutoReasoningSentinel` and routing logic in `SendPrompt`. * API: `internal/api/mode.go` adds `loadAutoReasoning` and `loadAutoReasoningGlosses`. `internal/api/settings.go` exposes `auto_reasoning_model` and `auto_reasoning_glosses`. * DB: New migration `20261008010000_auto_reasoning_level.sql` adds `auto_reasoning_level` to `Sessions`. `internal/server/db/session.go` updates `sessionColumns` and adds `SetSessionAutoReasoningLevel`. * Web: `web/src/components/settings/ModesSection.vue` adds UI for configuring the auto reasoning model and glosses. `web/src/composables/modelSelection.ts` adds `newSessionEffort` and `AUTO_REASONING`. `web/src/components/composer/PromptComposer.vue` and `ModelReasoningSelects.vue` support the "auto" option. 2. **Session Lifecycle (Archive/Trash)**: * API: `internal/api/session.go` adds `SessionArchiveRow`, `SessionArchiveListResult`, and params for `resume`, `archive`, `delete`, `restore`, `archive.list`. `internal/api/registry.go` registers these new methods. * DB: `internal/server/db/session.go` adds `familyIDs`, `familyLifecycleStamp`, `ArchiveSessionFamily`, `TrashSessionFamily`, `RestoreSessionFamily`, `ListArchivePage`. * Web: `web/src/views/overview/ArchiveView.vue` (implied by router change), `web/src/router.ts` adds `/archive` route. `web/src/components/overview/SessionMenu.vue` likely has actions. `web/src/stores/session.ts` adds lifecycle actions. 3. **Subagent Kick Logic Fix**: * `internal/server/agents/subagent.go`: `kickParent` is modified to deliver only *one* message (either a note or a result) to an idle parent, restoring the rest. This prevents driving a run on a paused transcript. * `internal/server/agents/subagent_test.go`: Adds `TestRebuiltParentNeverDrivesARunOnItsPausedTranscript`. 4. **UI/UX Improvements**: * `web/src/components/session/TurnStateBadge.vue`: Updates state colors (moss for done, ochre for waiting). * `web/src/style.css`: Adds `--moss` and `--ochre` variables. * `web/src/components/chrome/AppHeader.vue`: Makes header sticky. * `web/src/views/overview/OverviewView.vue`: Adds "Archive" link and SessionMenu. The previous commit message was `feat(sessions): add archive/trash lifecycle, auto-reasoning router, and migrate web toolchain to Bun`. The instruction asks for a **completely different** commit message. I should focus on a different aspect or use a different type/scope. The changes are a mix of `feat` (auto reasoning, archive), `fix` (subagent kick), and `style`/`refactor` (UI colors, sticky header). Since `feat` is the dominant change, I will stick with `feat` but change the scope and description. Scope: `agents` or `core`? The auto-reasoning is in `agents`, archive is in `sessions`/`db`. Let's try scope `agents` focusing on the reasoning router, or `ui` focusing on the visual updates? Actually, the subagent fix is significant. Let's try a `feat` with scope `agents` focusing on the auto-reasoning capability, as it's a new feature. Or `feat` with scope `sessions` focusing on the lifecycle. The previous message covered "archive/trash lifecycle, auto-reasoning router". I will focus on the **auto-reasoning** aspect primarily, or the **subagent fix**. Let's go with `feat(agents): implement auto-reasoning router and fix subagent kick delivery`. Wait, "fix" is a different type. Let's try `feat(agents): add auto-reasoning router and refine subagent delivery`. Let's look at the "different type, scope, or description approach" constraint. Previous: `feat(sessions): ...` New: `feat(agents): ...` Description: `add auto-reasoning router and fix subagent kick delivery` Body: - Implement auto-reasoning routing that selects effort levels based on prompt content and model capabilities. - Add `auto_reasoning_level` column to sessions to track the last routed level. - Update `kickParent` to deliver only one message to idle parents, preventing runs on paused transcripts. - Add UI controls for configuring auto-reasoning models and glosses in settings. - Introduce `moss` and `ochre` theme colors for turn state badges. This looks good. ``` feat(agents): add auto-reasoning router and fix subagent kick delivery - Implement auto-reasoning routing in `SendPrompt` to select effort levels based on prompt content, with fallback to model defaults. - Add `auto_reasoning_level` column to `Sessions` and expose it via `session/get` for composer labeling. - Modify `kickParent` to deliver only a single message to idle parents, preventing the driver from running on paused transcripts. - Add settings UI for configuring the auto-reasoning model and level glosses. - Update turn state badge colors to use `moss` for done and `ochre` for waiting.