feat(studio): add AI workspace with Codex ACP integration
Test / Tests and coverage
Intrepid/Prometeu/Studio/pipeline/head This commit looks good

This commit is contained in:
2026-11-23 03:11:33 +00:00
parent a2b6a81a27
commit ae7d01aa99
36 changed files with 2550 additions and 28 deletions
+76 -2
View File
@@ -100,5 +100,79 @@ cleanup blocks a replacement opening and offers an explicit cleanup retry.
`closeAsync()` completes after coordinated session and presentation teardown;
callers must await it off the FX thread before shutting down their worker pool.
No editor host, ACP, domain workspace, asset authoring, debug or shipping view is
mounted in this product. Native Play remains behind the execution API.
The project shell also includes the **AI workspace**: a left chat manager,
conversation log and editable prompt. The right-hand footer icon opens a compact
prompt from other tabs, with a chat selector, New chat and actions menu. Its native
divider resizes the panel without covering the content. The same compositor moves
into the AI tab; there the footer icon focuses it. Text survives tab changes,
collapse and presentation changes, and is discarded when the project closes.
The footer icon is the only open/collapse control and remains highlighted while
the prompt is visible. Starting Play collapses the drawer while preserving the
text. Tab headers share a uniform width that follows the longest current title
and the active presentation settings.
Studio preferences show **AI / ACP**, Codex and ChatGPT login only.
Both managers support **local chats**: create/select, rename and confirmed delete.
They share one active conversation, with an independent text draft per chat. A
project opens without chats; create one to enable writing. Renaming keeps the
draft and identity, and deleting selects the next/previous remaining chat.
Cancelling a dialog leaves the chat unchanged. All chats and drafts are temporary
and are discarded on project close, including any open chat dialog. Reopening
starts empty.
**Prometeu Studio > Preferences > AI / ACP** saves one non-secret executable and
literal argument vector for every project in `~/.prometeu-studio/ai-settings.json`.
Project settings do not contain ACP configuration. Legacy `acp` fields in project
setup are ignored and omitted by later setup writes; runtime/save/indentation and
MCP intent remain intact. An arbitrary project never becomes the global default.
Install the pinned adapter once, from the Studio repository:
```sh
bash scripts/install-codex-acp.sh
```
The installer needs a working Node.js 22+ and npm for initial installation. It stages
`@agentclientprotocol/codex-acp@2.9.0` under
`~/.prometeu-studio/agents/codex-acp/2.9.0` and publishes the stable launcher
`~/.prometeu-studio/bin/codex-acp`. It selects a working Node, checks common NVM
locations and embeds its absolute path/PATH so desktop launch does not depend on
your terminal environment. `STUDIO_NODE_BIN` can explicitly select Node;
`STUDIO_NPM_CLI` can select npm-cli.js. A compatible installed Codex 0.171.x is reused;
otherwise the adapter uses its package dependency. The installer preserves a custom
global preference and refuses to replace an unmanaged launcher. It does not modify
system Node/npm, project files or ChatGPT login. Re-running the installer reuses the
pinned installed package. No npx or temporary launcher is needed at runtime.
Opening a project automatically connects the installed adapter using these shared
settings and that project's root as cwd. An existing Codex ChatGPT login is reused.
Without a login, open Studio preferences and explicitly sign in; no browser opens
automatically. Connection and login actions operate on the opened project's process;
settings can also be saved from the launcher. Changes apply at the next connection.
Sessions and drafts remain isolated by project. Sending creates one session per chat,
opens AI and streams its response into that chat even when selection changes. One
request runs per project. Cancel waits for termination; deleting a running chat or
closing the project first cancels it. Permission requests require an explicit choice.
Transport/process ownership live in the application behind a neutral Studio API port.
The draft clears only after agent progress or successful completion, and only if
it still matches the sent text. A rejection retains it; Recover last request copies
the last submitted text only into an empty draft. After connection loss, old
conversations remain readable but require a new chat to send after reconnection.
Studio chats remain temporary; the agent may keep separate history. Loading that
history and asset attachment are disabled. Creating/selecting/renaming local chats
does not start ACP or authenticate.
The contract is [AI workspace presentation](../docs/specs/studio/15.%20AI%20Workspace%20Presentation%20Specification.md).
The execution contract is [Codex ACP integration](../docs/specs/studio/16.%20Codex%20ACP%20Integration%20Specification.md).
The opt-in real gate sends a minimal no-tools prompt using an **existing** ChatGPT
login in a disposable directory; it does not open browser login:
```sh
./gradlew :prometeu-app:test --tests p.studio.app.acp.CodexAcpConnectionTest
./gradlew :prometeu-app:codexAcpSmoke
# Optional existing-project handshake, without prompts or tools there:
./gradlew :prometeu-app:codexAcpSmoke -PstudioCodexProject=/absolute/path/to/project
```
No editor host, asset authoring, debug or shipping view is mounted in this product.
Native Play remains behind the execution API.