Просмотр исходного кода

docs: record prompt workspace todo

zhenyu.hu 3 недель назад
Родитель
Сommit
2163ce82b5
2 измененных файлов с 108 добавлено и 1 удалено
  1. 107 0
      docs/plans/todo-11-prompt-workspace.md
  2. 1 1
      docs/plans/todos.md

+ 107 - 0
docs/plans/todo-11-prompt-workspace.md

@@ -0,0 +1,107 @@
+# Todo 11 Prompt Workspace Plan
+
+**Status:** done
+
+## Result
+
+Implemented by subagent and committed as `ee2334f feat: add prompt workspace persistence`.
+
+Main-session verification:
+
+```bash
+uv run pytest tests/test_websocket_api.py
+uv run pytest
+```
+
+Results:
+
+- focused static/WebSocket tests: `14 passed, 1 warning in 0.23s`
+- full suite: `25 passed, 1 warning in 0.18s`
+
+## Goal
+
+Improve prompt and pre-message editing with browser-side persistence and reusable prompt sets.
+
+## Why
+
+The original requirement expects editing multiple system prompts and pre-messages. The MVP supports editing them, but every refresh loses the setup. A local prompt workspace lets a debugger quickly switch between prompt configurations without introducing a backend database.
+
+## Scope
+
+This todo covers:
+
+- Browser-side prompt set save/load/delete using `localStorage`.
+- Saving system prompts, pre-messages, and current ChatAgent/EventAgent parameter values.
+- A small UI section for prompt set name, saved-set selector, save, load, and delete.
+- Tests that verify the static page exposes prompt workspace controls and JS uses stable storage keys.
+
+This todo does not cover:
+
+- Server-side persistence.
+- Sharing prompt sets between users.
+- Import/export files.
+- Rich prompt templating.
+
+## Files
+
+- Modify: `src/agent_lab/presentation/static/index.html`
+- Modify: `src/agent_lab/presentation/static/app.js`
+- Modify: `src/agent_lab/presentation/static/styles.css` only if needed for compact layout.
+- Modify/add tests, preferably `tests/test_websocket_api.py` or a new focused static UI test.
+- Do not modify: `docs/plans/todos.md`.
+
+## Design
+
+Use `localStorage` key `agent-lab.prompt-sets.v1`. Store JSON:
+
+```json
+{
+  "sets": {
+    "default debugger": {
+      "system_prompts": ["..."],
+      "pre_messages": [{"role": "user", "content": "..."}],
+      "chat_agent": {"model": "", "temperature": 0.2, "max_tokens": 800},
+      "event_agent": {"enabled_tools": ["handoff_note"], "max_event_loops": 3}
+    }
+  }
+}
+```
+
+The UI should include:
+
+- prompt set name input;
+- saved set selector;
+- save button;
+- load button;
+- delete button.
+
+Saving reads the current form. Loading restores fields and tool checkboxes after tools are loaded. Deleting removes the selected set.
+
+## Steps
+
+1. Add failing static tests for:
+   - `index.html` contains prompt workspace controls.
+   - `app.js` contains `agent-lab.prompt-sets.v1` and functions for save/load/delete.
+2. Implement prompt workspace controls in HTML.
+3. Implement localStorage helpers in JS.
+4. Ensure loading a prompt set can restore dynamic tool checkboxes after `/api/tools` finishes.
+5. Run:
+
+```bash
+uv run pytest tests/test_websocket_api.py
+uv run pytest
+```
+
+6. If successful, commit implementation files only with message:
+
+```bash
+git commit -m "feat: add prompt workspace persistence"
+```
+
+## Verification
+
+Expected result:
+
+- Static tests prove controls and storage key exist.
+- Existing WebSocket/API tests still pass.
+- Full suite passes.

+ 1 - 1
docs/plans/todos.md

@@ -28,5 +28,5 @@
 | 8 | done | `docs/plans/todo-8-tool-pre-message-guard.md` | Prevent manually configured pre-messages from producing invalid provider `tool` payloads without `tool_call_id`. | Tests prove invalid tool pre-messages are rejected and UI no longer exposes `tool` role. |
 | 8 | done | `docs/plans/todo-8-tool-pre-message-guard.md` | Prevent manually configured pre-messages from producing invalid provider `tool` payloads without `tool_call_id`. | Tests prove invalid tool pre-messages are rejected and UI no longer exposes `tool` role. |
 | 9 | done | `docs/plans/todo-9-explicit-runtime-queues.md` | Refactor runtime internals to explicit input, output, and event queues while preserving the WebSocket stream contract. | Tests prove ChatAgent consumes input queue, EventAgent consumes event queue, and output queue drives streamed responses. |
 | 9 | done | `docs/plans/todo-9-explicit-runtime-queues.md` | Refactor runtime internals to explicit input, output, and event queues while preserving the WebSocket stream contract. | Tests prove ChatAgent consumes input queue, EventAgent consumes event queue, and output queue drives streamed responses. |
 | 10 | done | `docs/plans/todo-10-tool-registry-management.md` | Replace the single hardcoded EventAgent tool checkbox with a backend tool registry and UI-managed loaded tools. | Tests prove available tools are listed by API and selected tools control EventAgent behavior. |
 | 10 | done | `docs/plans/todo-10-tool-registry-management.md` | Replace the single hardcoded EventAgent tool checkbox with a backend tool registry and UI-managed loaded tools. | Tests prove available tools are listed by API and selected tools control EventAgent behavior. |
-| 11 | pending | `docs/plans/todo-11-prompt-workspace.md` | Improve prompt/pre-message editing with browser-side persistence and reusable prompt sets. | UI tests or focused JS tests prove prompts persist and can be restored. |
+| 11 | done | `docs/plans/todo-11-prompt-workspace.md` | Improve prompt/pre-message editing with browser-side persistence and reusable prompt sets. | UI tests or focused JS tests prove prompts persist and can be restored. |
 | 12 | pending | `docs/plans/todo-12-round-stats.md` | Move round statistics to structured backend events for token counts, cached tokens, TTFT, elapsed time, and per-turn summaries. | Tests prove backend emits deterministic stats events and UI renders them. |
 | 12 | pending | `docs/plans/todo-12-round-stats.md` | Move round statistics to structured backend events for token counts, cached tokens, TTFT, elapsed time, and per-turn summaries. | Tests prove backend emits deterministic stats events and UI renders them. |