tabminal 2.0.14 → 2.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/ACP_PLANING.md ADDED
@@ -0,0 +1,184 @@
1
+ # ACP Planing
2
+
3
+ ## Goal
4
+
5
+ Integrate ACP-based coding agents into Tabminal without implementing agents
6
+ ourselves. Agents run on the Tabminal host, managed by the Tabminal backend.
7
+ The web UI adds an Agent panel integrated into the existing workspace/editor
8
+ area and supports multiple concurrent agent tabs per host.
9
+
10
+ ## Constraints
11
+
12
+ - Do not break existing terminal, file editor, multi-host, or AI-assist flows.
13
+ - Reuse community-maintained protocol and agent ecosystem pieces where
14
+ practical.
15
+ - Keep lifecycle bounded: lazy start, reusable while tabs are open, and
16
+ cleaned up after inactivity.
17
+ - Host isolation remains strict: each agent runtime and tab belongs to one
18
+ host.
19
+ - MVP should be usable before advanced ACP capabilities are added.
20
+
21
+ ## Selected Architecture
22
+
23
+ ### Backend
24
+
25
+ Add an ACP supervisor inside the Tabminal backend.
26
+
27
+ Responsibilities:
28
+ - List supported agent definitions available on the host.
29
+ - Start ACP runtimes on demand.
30
+ - Reuse ACP runtime processes while tabs/sessions are active.
31
+ - Create ACP sessions within a runtime.
32
+ - Bridge ACP events to browser clients over a dedicated WebSocket.
33
+ - Expose minimal approval surfaces later; MVP focuses on prompt/stream/cancel.
34
+
35
+ Transport strategy:
36
+ - Primary: stdio-launched ACP agents.
37
+ - Future: attach to TCP ACP servers for tools like GitHub Copilot CLI.
38
+
39
+ Lifecycle:
40
+ - Lazy runtime start on first use.
41
+ - Keep alive while any agent tab is attached.
42
+ - Idle timeout after last tab closes.
43
+ - Destroy all runtimes on backend shutdown.
44
+
45
+ ### Frontend
46
+
47
+ Add a host-scoped Agent button beside the file editor toggle area.
48
+
49
+ Behavior:
50
+ - Clicking Agent opens a dropdown of available agents for the active host.
51
+ - Choosing an agent opens a new Agent tab inside the existing editor pane tab
52
+ strip.
53
+ - Agent tabs coexist with file tabs.
54
+ - Each agent tab streams conversation updates and supports prompt send/cancel.
55
+
56
+ MVP UI:
57
+ - Agent tabs render in the editor workspace.
58
+ - Transcript area with coalesced message stream.
59
+ - Prompt textarea + single send/stop button.
60
+ - Mode picker, new chat action, and slash-command chips when available.
61
+ - Status row with host, cwd, mode, and runtime/session status.
62
+
63
+ ## Reuse Strategy
64
+
65
+ Use:
66
+ - `@agentclientprotocol/sdk` for protocol/client implementation.
67
+ - ACP Registry later for agent metadata discovery.
68
+
69
+ Do not directly embed:
70
+ - Chrome ACP web client.
71
+ - ACP UI desktop frontend.
72
+
73
+ Reason:
74
+ - They are standalone apps, not embeddable widgets.
75
+ - Tabminal needs native integration with existing host/session/workspace state.
76
+
77
+ ## MVP Scope
78
+
79
+ ### Phase 1
80
+
81
+ Status:
82
+ - Implemented on `acp` branch and usable with real browser smoke.
83
+ - Backend ACP supervisor, API, and WS fan-out are live.
84
+ - Frontend agent tabs, transcript rendering, prompt send/cancel, and
85
+ permission resolution are live.
86
+ - Agent tab metadata now persists on the backend and restores across backend
87
+ restart for ACP runtimes that support `loadSession`.
88
+ - Agent panel interaction polish is live:
89
+ - duplicate agent tabs auto-number as `#1`, `#2`, ...
90
+ - `Enter` sends
91
+ - `Esc` stops active runs
92
+ - `Ctrl+J` and `Shift+Enter` insert newlines
93
+ - mode switching and new-chat flows are available in-panel
94
+ - tool calls and permission requests render as structured cards
95
+ - Verified with:
96
+ - `npm run lint`
97
+ - `npm test`
98
+ - browser smoke against isolated local ACP test agent
99
+ - browser restart-restore validation against backend-persisted ACP tabs
100
+ - Current polish fixes already applied:
101
+ - Codex token stream is coalesced into a single assistant message instead of
102
+ one message per chunk.
103
+ - User prompts are no longer duplicated when an ACP runtime echoes
104
+ `user_message_chunk` updates after local optimistic insertion.
105
+ - Gemini definition availability is disabled with reason
106
+ `API key missing` when no key is configured.
107
+ - Agent panel typography has been reduced to align with the existing
108
+ workspace/editor density.
109
+
110
+ Backend:
111
+ - ACP supervisor module.
112
+ - Built-in agent definitions for Gemini CLI, Codex CLI adapter, Claude adapter,
113
+ and Copilot CLI ACP server descriptor.
114
+ - REST endpoints:
115
+ - `GET /api/agents`
116
+ - `POST /api/agents/tabs`
117
+ - `POST /api/agents/tabs/:tabId/prompt`
118
+ - `POST /api/agents/tabs/:tabId/cancel`
119
+ - `POST /api/agents/tabs/:tabId/mode`
120
+ - `POST /api/agents/tabs/:tabId/permissions/:permissionId`
121
+ - `DELETE /api/agents/tabs/:tabId`
122
+ - WebSocket endpoint for live event fan-out.
123
+
124
+ Frontend:
125
+ - Agent dropdown button.
126
+ - Agent tab state model.
127
+ - Agent transcript rendering.
128
+ - Prompt send/stop.
129
+ - Mode picker.
130
+ - New chat action.
131
+ - Slash-command starter chips.
132
+ - Structured tool call / permission cards.
133
+ - Host-scoped tabs in editor pane.
134
+
135
+ ### Deferred
136
+
137
+ - File attachments.
138
+ - Rich diff/resource rendering in tool outputs.
139
+ - Terminal execution transcript UI for ACP tool calls.
140
+ - Registry-driven install UX.
141
+ - TCP ACP runtime support in UI.
142
+ - Dedicated conversation history browser independent of terminal sessions.
143
+
144
+ ## Safety and Isolation
145
+
146
+ - Agent runtimes inherit the host filesystem context, not browser-local state.
147
+ - Prompt and transcript data stay isolated per host.
148
+ - Closing an agent tab detaches from its ACP session.
149
+ - When the last ACP session on a runtime closes, runtime enters idle cleanup.
150
+
151
+ ## Test Plan
152
+
153
+ Backend:
154
+ - Unit tests for supervisor lifecycle.
155
+ - Mock ACP runtime process to test stream/cancel behavior.
156
+ - API tests for create/send/cancel/close.
157
+
158
+ Frontend:
159
+ - State/unit tests are minimal in current stack; use integration smoke.
160
+ - Manual flow:
161
+ - open agent dropdown
162
+ - create Gemini/Codex tab
163
+ - send prompt
164
+ - receive stream
165
+ - cancel
166
+ - open second agent tab
167
+ - verify file editor tabs still work
168
+ - verify terminal tabs still work
169
+
170
+ Regression checks:
171
+ - `npm run lint`
172
+ - `npm test`
173
+ - existing multi-host session behavior
174
+ - editor pane switching between file tabs and agent tabs
175
+
176
+ ## Implementation Order
177
+
178
+ 1. Add ACP dependency and inspect exact SDK client API.
179
+ 2. Implement backend supervisor with a mockable adapter layer.
180
+ 3. Expose API/WS endpoints with no frontend integration yet.
181
+ 4. Add frontend Agent button and agent tab model.
182
+ 5. Wire prompt streaming and cancellation.
183
+ 6. Run tests and manual smoke.
184
+ 7. Iterate on lifecycle and UI fit.