feat(quick-pane): add constrained agent window
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
# Quick Pane v1 Design
|
||||
|
||||
## Goal
|
||||
|
||||
Quick Pane is a small native window opened by a desktop/window-manager hotkey. It accepts one short request and returns either a useful answer or an explicit escalation within 60 seconds.
|
||||
|
||||
## Scope
|
||||
|
||||
- Cold-launchable, independent Tauri window.
|
||||
- Compact request input, quick-model picker, and workspace picker.
|
||||
- Configured default workspace, quick model, follow-up model, supplemental prompt, time limit, and read-only tool limit.
|
||||
- Ephemeral Quick Pane UI state and best-effort runtime cleanup.
|
||||
- Advisory read-only/no-subagent instructions, inline permission/clarification prompts, and explicit normal-session handoff.
|
||||
|
||||
## Non-goals
|
||||
|
||||
- Persisted quick history.
|
||||
- Named profiles.
|
||||
- App-managed WM binding writes.
|
||||
- Trusted prevention of mutable tools or direct edits.
|
||||
- Trusted prevention of subagents.
|
||||
- A memory-only Pi runtime; Pi may write temporary session data while running.
|
||||
|
||||
## Invocation
|
||||
|
||||
Desktop/WM configuration owns the hotkey so it works while Pi GUI is absent. Settings displays and copies the required command; it does not register or modify system bindings.
|
||||
|
||||
The app creates or focuses a dedicated small Quick Pane window. `Esc` closes it and discards quick-only state.
|
||||
|
||||
## Request lifecycle
|
||||
|
||||
1. Pane chooses configured default workspace and quick model, with per-request overrides.
|
||||
2. It starts an isolated Pi RPC runtime in the chosen workspace.
|
||||
3. Immutable prompt text instructs one request, read-only inspection, zero subagents, configured wall-clock budget, and configured tool-call budget. Current Pi RPC cannot trusted-enforce those instructions; event-derived caps and cleanup are best effort.
|
||||
4. Supplemental user instructions append beneath those prompt guardrails.
|
||||
5. Pane streams answer, tool status, and inline extension requests.
|
||||
6. On success it displays final answer. On a cap it preserves partial answer, explains the cap, and offers handoff.
|
||||
|
||||
## Escalation
|
||||
|
||||
Mutations, subagents, multi-step work, and likely-over-budget work preflight-escalate. The quick agent explains why. The user clicks **Continue in full session** to open a new normal session with:
|
||||
|
||||
- original request;
|
||||
- escalation note or partial findings;
|
||||
- selected workspace; and
|
||||
- configured follow-up model.
|
||||
|
||||
No full session opens automatically.
|
||||
|
||||
## Permissions and privacy
|
||||
|
||||
Quick Pane surfaces Pi extension `select`, `confirm`, `input`, and `editor` requests inline. User explicitly answers every prompt. Existing policy remains authoritative: ordinary workspace reads may be allowed, external-directory reads may ask, and sensitive paths may deny.
|
||||
|
||||
Quick Pane UI request, output, and transcript stay in memory only. Closing pane removes them and triggers best-effort quick-runtime cleanup. Pi may write temporary session data while the child runs. A deliberate handoff persists only in newly created normal-session history.
|
||||
|
||||
## Failure handling
|
||||
|
||||
Unavailable models, startup failures, and crashes render inline actionable errors: retry, pick another quick model, or open normal session. No silent fallback model is used.
|
||||
|
||||
## Settings validation
|
||||
|
||||
Settings reject invalid model, workspace, custom prompt, or numeric limit. Failed save keeps previously stored configuration and marks invalid fields.
|
||||
|
||||
## Acceptance
|
||||
|
||||
From cold or hot desktop state, the hotkey produces an answer or explicit escalation within 60 seconds. Automated component, bridge, persistence, and native tests cover behavior; a manual cold-launch/hotkey smoke test verifies desktop integration.
|
||||
@@ -0,0 +1,43 @@
|
||||
# Quick Pane v1 Implementation Plan
|
||||
|
||||
## 1. Define persisted configuration
|
||||
|
||||
- Add Quick Pane settings types, defaults, validation, serialization, and migration-safe native storage.
|
||||
- Fields: default workspace, quick model, follow-up model, supplemental prompt, maximum seconds, maximum read-only tool calls.
|
||||
- Preserve current configuration when validation or save fails.
|
||||
|
||||
## 2. Add native window and launch contract
|
||||
|
||||
- Extend Tauri configuration and Rust window management with a dedicated Quick Pane window label.
|
||||
- Add command-line action used by external WM hotkey to create/show/focus pane, including cold launch.
|
||||
- Keep `--toggle` and ordinary `--new` behavior unchanged.
|
||||
|
||||
## 3. Build Quick Pane React surface
|
||||
|
||||
- Add isolated state reducer/component for request, selected model/workspace, progress, final answer, partial answer, escalation, extension UI, and errors.
|
||||
- Keep pane transcript in component memory only and request best-effort runtime/session cleanup on close.
|
||||
- Add Settings controls and copyable WM launch command.
|
||||
|
||||
## 4. Add constrained bridge runtime mode
|
||||
|
||||
- Extend runtime creation with Quick Pane metadata and ephemeral session lifecycle.
|
||||
- Build immutable advisory quick-agent instructions around supplemental custom prompt.
|
||||
- Use observed tool events and wall-clock cancellation for best-effort caps; document that current Pi RPC cannot trusted-enforce read-only/no-subagent policy or memory-only runtime sessions.
|
||||
- Instruct preflight escalation for mutation, subagent, multi-step, or likely-over-budget requests.
|
||||
|
||||
## 5. Route interaction and handoff
|
||||
|
||||
- Reuse existing extension request/response protocol for inline Quick Pane permission and clarification dialogs.
|
||||
- On explicit continuation, create normal runtime using workspace and follow-up model.
|
||||
- Prefill it with original request plus escalation note/partial findings.
|
||||
|
||||
## 6. Test and document
|
||||
|
||||
- Add unit tests for settings validation/persistence and guardrail classification.
|
||||
- Add component tests for pane states, picker behavior, inline prompts, error/retry, and cleanup.
|
||||
- Add Rust/bridge tests for window command routing, budget cancellation, ephemeral cleanup, and handoff payload.
|
||||
- Add manual WM hotkey/cold-launch instructions and smoke checklist.
|
||||
|
||||
## Sequencing
|
||||
|
||||
Land configuration/runtime contract first, then native window and UI, then handoff and test coverage. Preserve existing normal-session paths throughout.
|
||||
@@ -0,0 +1,42 @@
|
||||
# Quick Pane v1 Test Plan and QA Checklist
|
||||
|
||||
## Automated coverage
|
||||
|
||||
### Settings
|
||||
|
||||
- Valid defaults load when no Quick Pane configuration exists.
|
||||
- Valid configuration round-trips through native storage.
|
||||
- Invalid workspace, model, prompt, time, and tool values show field errors and retain prior saved state.
|
||||
- Quick model picker affects quick request only; follow-up model remains configured default.
|
||||
|
||||
### Runtime guardrails
|
||||
|
||||
- Quick runtime receives immutable advisory read-only/no-subagent prompt text plus supplemental prompt.
|
||||
- Mutation, subagent, multi-step, and likely-over-budget requests are instructed to preflight-escalate.
|
||||
- Runtime applies best-effort configured 60-second/6-tool caps from observed events and exposes reason.
|
||||
- Partial result survives a cap; pane transcript is removed and runtime cleanup requested after pane close.
|
||||
- Tests/documentation state current limitations: Pi RPC cannot trusted-enforce prompt policy or guarantee memory-only temporary sessions.
|
||||
|
||||
### UI and bridge
|
||||
|
||||
- Quick Pane opens/focuses through dedicated native command without changing normal `--new` or `--toggle` behavior.
|
||||
- Workspace and quick-model picker values reach runtime creation.
|
||||
- Permission and clarification extension requests render inline and send correct response payloads.
|
||||
- Retry, model change, and normal-session actions appear for startup/model/crash errors.
|
||||
- Handoff creates normal session with original request, escalation note, workspace, and follow-up model.
|
||||
|
||||
## Manual smoke checklist
|
||||
|
||||
1. Configure default workspace, models, prompt, and 60-second/6-tool limits.
|
||||
2. Add desktop/WM hotkey using Settings launch command.
|
||||
3. From no running GUI process, invoke hotkey and verify Quick Pane opens/focuses.
|
||||
4. Submit short answer-only request; verify result within 60 seconds.
|
||||
5. Submit read-only inspection request; answer any external-read permission prompt inline.
|
||||
6. Submit mutation or multi-step request; verify reason and **Continue in full session**.
|
||||
7. Continue; verify normal session receives handoff and follow-up model.
|
||||
8. Close Quick Pane; reopen and verify quick transcript is absent.
|
||||
9. Select unavailable model or induce startup failure; verify inline recovery options.
|
||||
|
||||
## Exit criteria
|
||||
|
||||
All targeted automated tests pass. Manual cold-launch/hotkey smoke completes. No regressions in normal sessions, `--toggle`, or `--new` behavior.
|
||||
Reference in New Issue
Block a user