Galaxy Shell / docs
Docs / Decisões e planos

Complementary definitions: interactive responses and customization

openspec/specs/interaction-decisions/spec.md · Editar no GitHub ↗

Esta página ainda não tem tradução em português. O conteúdo abaixo está em inglês.

Este documento registra decisões, planejamento ou evidências de uma etapa do projeto. Não implica que todos os itens estejam implementados ou validados na versão atual.

Nesta página

Complementary definitions: interactive responses and customization

Purpose

Records that HTML is part of the AI response inside the conversation, with the three responsibilities, corrected acceptance and pinned surfaces that follow from it.

Requirements

Requirement: HTML renders inline in the response

The system SHALL render generated HTML/CSS/JavaScript inside the conversation itself, so the user does not need to open another window or copy code to interact. Full text: section HTML is part of the response.

Scenario: Interactive table

  • WHEN the agent answers with a filterable table
  • THEN it renders as working HTML inside the message

Requirement: Isolated components with a limited channel

The system SHALL keep response components isolated from the core and the shell project; their JavaScript does not receive Node, credentials, shell or desktop tools, and publishing one MUST NOT change the UI globally. An action only prepares a draft that the user sends through the protected control. Full text: section Three distinct responsibilities.

Scenario: Button action

  • WHEN a component button calls its action
  • THEN a draft is prepared and the user reviews and sends it

Requirement: Pinning is an additional presentation

The system SHALL treat pinning as an additional form of presentation, a second isolated frame of the same published revision, with interactive state not carried over from the inline frame. Full text: section HTML is part of the response.

Scenario: Pinned state

  • WHEN a component is pinned
  • THEN the pinned frame starts from the published document

Requirement: Pin controls are protected host controls

The system SHALL draw pin and unpin buttons as protected host controls; generated documents run in an opaque iframe with no token, no network and no access to window.shell, so they cannot pin, unpin or resize themselves. Full text: section Pinned surfaces (2026-10-31).

Scenario: Self-pinning attempt

  • WHEN generated HTML tries to pin itself
  • THEN it cannot, because it has no access to the bridge

Requirement: Pinned frame isolation

The system SHALL give the pinned frame the same surfaceDocument string, sandbox="allow-scripts", an empty allow list and the same Content-Security-Policy as the inline frame, with no tools, no automatic message sending and no microphone. Full text: section Pinned surfaces (2026-10-31).

Scenario: Pinned action

  • WHEN window.surface.action(text) is called in a pinned frame
  • THEN it only prepares a draft for the user to send

Requirement: Pin persistence and limit

The system SHALL persist conversation.pinnedSurfaces in state.json, with at most 4 per conversation, and the core MUST remove unknown ids, duplicates and extra entries when it loads the state. Full text: section Pinned surfaces (2026-10-31).

Scenario: Fifth pin

  • WHEN a fifth pin is requested
  • THEN the core rejects it

Requirement: Pin route

The system SHALL accept POST /api/surface-pin with exactly {conversation, surface, pinned}, authenticated like the other host routes; the core MUST reject archived conversations and surfaces of another conversation, and the agent has no tool for this. Full text: section Pinned surfaces (2026-10-31).

Scenario: Surface of another conversation

  • WHEN the route receives a surface of another conversation
  • THEN the core rejects it

Requirement: Pinned column placement

The system SHALL show pinned components in a column on the right of the chat, per active conversation in pin order, hidden when empty and hidden when the chat is narrower than 760 px, while the pins stay pinned. Full text: section Pinned surfaces (2026-10-31).

Scenario: Narrow chat

  • WHEN the chat is narrower than 760 px
  • THEN the column is hidden and returns when the chat is wide again

Requirement: Corrected acceptance

The system SHALL NOT consider the interactive validation of the native host complete from the inline-table acceptance test, and MUST preserve the already validated cycle of appearance editing, reload, session and recovery separately. Full text: section Corrected acceptance.

Scenario: Inline table test

  • WHEN the inline filterable table test passes
  • THEN the interactive validation of the native host remains unproven

Status

Doc status: current contract. Inline HTML and pinned surfaces are current; the River and Flutter lines under Preserved choices are history. Checked 2026-11-10.

Introduction

Record of 2026-10-26 after consulting the concept session, at the request of the project owner. Complements the web milestone. These definitions correct the acceptance focus of the implementation.

HTML is part of the response

HTML/CSS/JavaScript are a response language of the AI inside the conversation itself, similar to Markdown but with interactive behavior. The response can combine text, a filterable table, a chart, a form or another functional component.

The user does not need to open another window, set aside an area of the grid or copy code to interact. Changing the color or the sidebar of the shell proves customization, but it does not prove this central requirement.

The same content can optionally be pinned beside the chat when it needs space or permanence (see Pinned surfaces). Pinning is an additional form of presentation, not the only one. Collapsing and placing pins on the window grid are not implemented. A pin is not a copy of the HTML into another window: it is a second isolated frame of the same published revision, and interactive state is not carried over from the inline frame.

Three distinct responsibilities

  1. Trusted core: conversation, OpenCode session, permissions, persistence and recovery.
  2. Editable shell project: presentation of the conversation, navigation and controls in HTML/CSS/JavaScript, with restricted editing and recoverable versions.
  3. Response components: documents generated by the agent, rendered inline and isolated from the core and from the shell project.

Publishing an inline component must not change the UI globally. Its JavaScript does not receive Node, credentials, shell or desktop tools. Interactions need an explicit and limited channel to continue the conversation. In the current minimum, an action prepares a draft. The user reviews it and sends it through the protected control.

Host and performance

The discussion of benchmarks in the concept session did not establish a universal winner between Tauri and Electron. Package size does not prove lower memory, better fluidity or performance under the real project load. Benchmarks of other applications do not validate multiple surfaces, generated code and River in this product.

Electron is the implementation choice for the current minimum host, with the existing Chromium. It is not a statement of performance superiority and not a decision to build a custom renderer. Tauri remains an alternative if a concrete limitation justifies a new evaluation.

The project owner's reference to WebGL was corrected to WebAssembly. Wasm can help with heavy computation, but it does not remove the cost of the web engine, layout and paint. It is not part of the current minimum. Local updates, preservation of the interactive DOM, suspension of hidden work and possible virtualization of the history are efficiency criteria. Do not declare virtualization or finished measurements without proof.

Preserved choices

  • River is the chosen Linux compositor. Integration with real windows stays for later.
  • Flutter without Material Design was an authorized and started step, later replaced by the web direction. Its WIP stays preserved, with no obligation of compatibility.
  • Own interface without Material Design, using HTML/CSS/JS in this milestone.
  • External applications are not internal panels of the conversation. Generated components are shell content, not replacements for an external editor, terminal or browser.
  • Grid and persistent environments stay in the concept. The infinite canvas remained a hypothesis. History: the user asked for a workspace canvas on 2026-11-01, see canvas windows.

Corrected acceptance

Ask the agent for a real response that contains an inline filterable table. Check that a specific tool published it, that it renders as working HTML inside the message, and that the filter and the button respond through the UI. The button action must reach the permitted channel without granting authority to the document.

Separately, preserve the already validated cycle of appearance editing, reload, session and recovery. Pinning to the grid, River control and interactive validation of the native host cannot be considered complete from this test.

Pinned surfaces (2026-10-31)

The user can keep a generated inline component beside the chat.

  • Control: the trusted React UI draws a pin button next to the title of each inline component, and an unpin button on each pinned item. They are protected host controls. The generated document runs in an opaque iframe with no token, no network and no access to window.shell, so it cannot pin, unpin or resize itself.
  • Placement: pinned components appear in a column on the right of the chat, in the same ShadowRoot, in pin order. The column belongs to the active conversation (workspace); switching conversation shows that conversation's pins. The column is empty and hidden when there are no pins. When the chat is narrower than 760 px (for example the sidebar presentation), the column is hidden and the conversation takes the full width; the pins stay pinned and the column comes back when the chat is wide again. While the column shows, the host shifts the composer by half of the column width, so the composer stays aligned with the conversation.
  • Isolation: the pinned frame uses the same surfaceDocument string, sandbox="allow-scripts", an empty allow list and the same Content-Security-Policy as the inline frame. It is the same published revision, not a new publication. It has no tools, no automatic message sending and no microphone. As inline, window.surface.action(text) only prepares a draft that the user reviews and sends through the protected input.
  • State: a pinned frame is a separate browsing context. It starts from the published document, so JavaScript state of the inline frame is not shared.
  • Persistence: conversation.pinnedSurfaces holds the ordered surface ids in state.json (profile data directory). Pins survive UI reloads and core restarts. At most 4 per conversation. The core removes unknown ids, duplicates and extra entries when it loads the state.
  • Route: POST /api/surface-pin with exactly {conversation, surface, pinned}, authenticated like the other host routes. The core rejects archived conversations, surfaces of another conversation and a fifth pin. Pin is idempotent; unpin of an unpinned id is accepted. The agent has no tool for this.
  • Host state: pinnedSurfaces travels in the conversation metadata, so a pin change does not resend history. The host projection exposes pinned (ids) to the React UI, and the bridge gets window.shell.pinSurface(id) and unpinSurface(id).

Evidence: web-shell/test/surface-pins.test.js (limits, order, persistence across a store restart and a core restart, route validation) and web-shell/scripts/test-ui-browser.js (?pins-only for the pinned checks: sandbox, CSP, empty permission policy, no bridge, network or microphone access from the pinned frame). Not proven: the Electron host, the live session and a real Smithay desktop.