Add reusable UI2 conversation balloons, tool cards, native Markdown, copy actions and controlled streaming scroll. Preserve typed ACP tool updates and chat lifecycle, add Alt+Enter sending, update specifications and qualify the UI through desktop tests. Include the Pong asset cache.
155 lines
9.6 KiB
Markdown
155 lines
9.6 KiB
Markdown
# AI Workspace Presentation Specification
|
||
|
||
Status: Implemented presentation, local chats and initial ACP integration. Owner: `studio`.
|
||
|
||
## Scope
|
||
|
||
The JavaFX 2 project shell MUST expose an AI tab alongside Gameplay, an AI prompt
|
||
entry in the footer and an AI / ACP section in Studio preferences. This contract
|
||
extends specifications 13–14 without changing execution ownership, runtime input
|
||
contracts or existing execution services. Opening a project connects the installed agent using the shared Studio configuration.
|
||
|
||
## Workspace and prompt
|
||
|
||
The AI tab MUST place the chat manager on the left and the conversation area and
|
||
prompt on the right. Empty conversations MUST use brief localized text, without
|
||
invented responses or agent activity. Chat creation, selection, renaming and
|
||
deletion MUST operate on local state. Loading persisted history and asset attachment
|
||
MUST remain visibly disabled. Sending follows the ACP contract in specification 16.
|
||
The compact manager MUST expose a chat selector, New chat and an actions menu.
|
||
|
||
With the shared prompt focused, Alt+Enter MUST invoke the same Send action in both
|
||
the AI tab and the compact panel. It MUST respect Send availability and consume the
|
||
combination even when sending is unavailable, preserving the draft without adding
|
||
a newline. Enter alone MUST retain normal multiline editing. The shortcut MUST be
|
||
identified in the Send tooltip and accessible help in both languages; it MUST NOT
|
||
be installed as a window-wide accelerator.
|
||
|
||
The footer MUST retain the selected tab's information and reserve a fixed slot at
|
||
the right for an AI icon. The icon MUST have a localized tooltip, accessible name
|
||
and visible keyboard focus. It MUST expose a selected state and an accent
|
||
background while the prompt is visible, including its inline AI-tab form.
|
||
In other tabs, activating it MUST open or collapse a
|
||
prompt panel above the footer. The panel MUST reduce the available content height
|
||
rather than overlap it. A native divider MUST adjust its height, with minimum
|
||
sizes for the upper content and panel; constrained content MUST remain scrollable.
|
||
The footer control MUST be the sole open/collapse control; the prompt panel MUST
|
||
NOT contain a separate collapse button.
|
||
|
||
In the AI tab, activating the footer icon MUST focus the existing prompt. The
|
||
same compositor MUST move between the AI tab and the compact panel: two prompts
|
||
MUST NOT appear simultaneously. Opening/collapsing, tab selection and changes to
|
||
theme, language or text scale MUST retain the entered text. Collapsing MUST return
|
||
focus to a usable control. Focusing the prompt MUST release Gameplay keyboard input.
|
||
Starting Play MUST collapse the external drawer before selecting Gameplay and
|
||
focusing the game. This MUST preserve the draft, including when Play starts from
|
||
the AI tab, so returning to Gameplay does not reopen the drawer automatically.
|
||
|
||
## Local chats and drafts
|
||
|
||
Each project view MUST own one in-memory chat collection and active selection.
|
||
Opening a project MUST start without chats. New chat MUST work in either manager,
|
||
create a stable local identity and numbered initial title, select the new chat and
|
||
allow writing its initially empty draft. It MUST keep the current workspace tab.
|
||
Without a chat, writing MUST be disabled and the UI MUST direct the user to create
|
||
one. The footer entry MUST focus New chat when no editable prompt is available.
|
||
|
||
The full list and compact selector MUST share the same collection and active
|
||
chat. The prompt MUST identify its destination. Selecting in either manager MUST
|
||
restore exactly that chat's text while retaining all other drafts. A title MUST
|
||
NOT serve as chat identity. Presentation changes, opening/collapsing the panel,
|
||
Settings and starting/stopping Play MUST preserve the collection and drafts.
|
||
|
||
Rename MUST be available from both managers, trim external whitespace and reject
|
||
empty titles. Cancelling or invalid input MUST leave identity, title, selection
|
||
and draft unchanged. Delete MUST identify the target and require confirmation.
|
||
Cancelling MUST not alter state. Confirming MUST remove only that chat and draft;
|
||
if active, select the next chat in creation order, otherwise the previous one.
|
||
Deleting the last chat MUST return to no selection and disable writing/rename/delete.
|
||
|
||
Chats, titles, selection and drafts MUST remain transient project-view state.
|
||
The UI MUST briefly explain that they are discarded on project close. Closing
|
||
MUST cancel owned chat dialogs and discard this state; reopening the same project
|
||
or opening another MUST start empty. No chat data MAY be saved by Studio in project files, setup, preferences or a
|
||
database. Local creation/selection/rename MUST NOT start an ACP session; the first
|
||
send creates it lazily. The agent MAY retain its own independent history.
|
||
|
||
## Structured conversation component
|
||
|
||
The conversation MUST use a reusable component in the UI2 component set, replacing
|
||
its history TextArea while retaining the separate prompt compositor. It MUST consume
|
||
presentation data and MUST NOT parse ACP, launch processes or own authentication.
|
||
The same component MUST have a backend-free gallery specimen with replayable
|
||
streaming, Markdown, tools, failure and expansion.
|
||
|
||
Items MUST appear in one chronological sequence. User messages MUST use comic-style
|
||
speech balloons aligned right; assistant messages MUST use speech balloons aligned
|
||
left. Tool calls MUST use centered cards without speech-balloon shapes, with
|
||
left-aligned text. Balloon widths MUST adapt to the available space and have a
|
||
readable maximum. Long code MUST scroll horizontally inside its block; the
|
||
conversation itself MUST NOT require horizontal scrolling.
|
||
|
||
Only the assistant balloon under construction MAY receive text deltas. Its text
|
||
selection MUST be disabled. Finalized balloon content MUST be immutable; theme,
|
||
scale and width changes MAY reflow the same content. A new tool call between
|
||
assistant text segments MUST finalize the preceding balloon, and subsequent text
|
||
MUST create another balloon. Updates to an existing tool MUST retain its card's
|
||
position and MUST NOT rewrite previous balloons. Empty assistant balloons and one
|
||
balloon per text delta MUST NOT be generated.
|
||
|
||
Assistant messages MUST render CommonMark headings, paragraphs, lists, emphasis,
|
||
links and code using a native renderer. HTML MUST remain inert text and images
|
||
MUST NOT trigger resource downloads. Finalized messages MUST allow local text
|
||
selection and the platform copy shortcut. Selection across multiple messages is
|
||
not required. Earlier finalized messages MUST remain selectable while another
|
||
balloon streams. Each balloon MUST offer copying its original text, preserving
|
||
Markdown; while streaming, this copies the currently received snapshot. Code-copy
|
||
controls MUST copy only the code. Copy feedback MUST be brief and preserve layout.
|
||
|
||
Tool cards MUST display a readable title and state, with details initially
|
||
collapsed. Transitioning to failure MUST expand the card once; users MUST be able
|
||
to collapse it again without subsequent updates reopening it. Expanded details
|
||
MUST show only input, output and content actually supplied by the agent. Missing
|
||
details MUST be identified without inventing a command or result. Non-shell tools
|
||
such as read, search and edit MUST use the same card family.
|
||
|
||
The conversation MUST follow new content while the user is at its end. Manual
|
||
scrolling MUST suspend following without stopping generation or reception. Returning
|
||
to the end MUST resume following. New content below the suspended view MUST expose
|
||
a localized Go to latest control that resumes following. Updates, expansion and
|
||
resize MUST preserve reading position when following is suspended. Recycled cells
|
||
and switching chats MUST preserve per-chat expansion and reading/following state.
|
||
|
||
User balloons MUST retain submitted text with delivery/failure metadata separate
|
||
from immutable content. Existing acknowledgement, draft preservation and manual
|
||
recovery rules MUST remain effective. Turn completion, failure and cancellation
|
||
MUST be explicit. Tool status MUST NOT imply success merely because the turn ended.
|
||
Rendering MUST use incremental item updates and bounded batching rather than
|
||
replacing all finalized content for each delta. Content limits and retirement
|
||
follow specification 16 and MUST be visible to the user.
|
||
|
||
## Studio preferences
|
||
|
||
Studio preferences MUST contain an AI / ACP section identifying Codex as the initial
|
||
agent and ChatGPT login as the only authentication choice. It MUST expose the
|
||
shared launch configuration, Connect, login and current connection state.
|
||
The section MUST NOT offer API keys, future authentication choices or billing
|
||
explanations. Login MUST be enabled only after connection and disabled when the
|
||
existing ChatGPT login is recognized. Configuration and execution follow
|
||
[the ACP integration contract](16.%20Codex%20ACP%20Integration%20Specification.md).
|
||
|
||
## Verification and later capabilities
|
||
|
||
Presentation MUST use the existing Studio components, semantic theme colors and
|
||
English/Portuguese bundles. Desktop qualification MUST exercise prompt ownership,
|
||
focus, resizing, independent drafts, synchronized selection, rename validation,
|
||
deletion/cancellation, project lifetime, unavailable operations and settings, in
|
||
both themes and languages, including constrained windows and large text scale.
|
||
Display-free state tests MUST cover independent drafts, stable identity on rename,
|
||
invalid operations, deletion selection and project isolation/disposal.
|
||
|
||
Codex connection, sending, streaming, explicit permissions and cancellation follow
|
||
[specification 16](16.%20Codex%20ACP%20Integration%20Specification.md). Asset attachment
|
||
and persisted chat resumption remain future capabilities. Integration MUST preserve
|
||
shared-composer ownership, independent drafts and the project lifetime boundary.
|