Skip to content

The app window docks its editing chat on the left - #549

Merged
FMXExpress merged 2 commits into
mainfrom
claude/app-chat-dock
Aug 15, 2026
Merged

FMXExpress merged 2 commits into
mainfrom
claude/app-chat-dock

Conversation

@FMXExpress

Copy link
Copy Markdown
Owner

Follow-up to #548, which merged while this was being written — so it's a fresh branch off main rather than a push onto merged history.

The change

The app window's statusbar had a Chat button that opened a separate floating window. That put a layer of window management between the app and the conversation that changes it, for no compensating clarity. It now toggles a chat pane docked inside the app window itself:

[ chat | grip | the app ]
  • The grip drags to resize, 180px floor. One non-obvious detail: the iframe swallows mousemove, so a naive drag stalls the instant the pointer crosses onto the app — the frame goes pointer-events: none for the duration of the drag and back afterwards.
  • Same buildChatUI as every other chat home, so the live-preview loop from Self-contained apps, the project dock, the Agent Console, and the desktop that asks #548 comes for free and at its tightest: a turn that touches the app reloads the frame sitting directly beside the words that caused it.
  • Dialog answers (the pasclaw-ui ask block's buttons) route through the app window too — the chain is now chat window → app-window pane → dock pane, so a question asked from any of the three homes is answered back into that same one.
  • Lazy and hidden by default: built on first toggle, kept for the window's life. An app opened to be used is all app until you ask to edit it.

That gives the desktop three homes for one conversation — the dock pane (project-first), this one (app-first), and the floating window (when you want it loose) — all from a single builder, so they can't drift apart.

Verification

  • node --check on the extracted script passes
  • Binary + webui.res rebuilt from scratch; the regenerated resource is byte-identical to the committed one
  • make test-desktop-routes → OK

Targets main directly — not stacked on any open PR.


Generated by Claude Code

The statusbar's Chat button opened a separate floating window -- the
conversation that CHANGES the app, walled off from the app it changes
by a layer of window management with no compensating clarity. Now it
toggles a chat pane docked inside the app window itself, on the left:

  [ chat | grip | the app ]

The grip drags to resize (180px floor; the iframe goes pointer-inert
for the drag, since it would otherwise eat the mousemoves). The pane is
the same buildChatUI as every other chat home, so the live-preview loop
comes for free: a turn that touches the app reloads the frame sitting
right next to the words that caused it. Dialog answers route through
the app window too -- the chain is chat window, then app pane, then
dock pane.

Built lazily on first toggle and kept for the window's life; hidden by
default so an app opened to be USED is all app.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KYD1zZPD7GuM8pF1btwi2U

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5c62533f4b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/pkg/gateway/desktop.html Outdated
Comment on lines +2668 to +2669
const aw = WINS.get("app:" + project);
if (aw && aw.__submitText) { aw.__submitText(String(v)); return; }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Route dialog replies to their originating chat

When multiple chat homes exist for the same project, this fixed lookup order sends the answer to whichever home appears first rather than to the chat that created the dialog. For example, an ask emitted by the app-side chat is submitted into an open floating chat, while an ask emitted by the dock is submitted into the app chat after that pane has been initialized—even if it is currently hidden. Because each buildChatUI instance has its own history closure, the originating conversation never receives the response; capture that instance's submit callback when rendering the block instead of resolving it by project.

Useful? React with 👍 / 👎.

renderUIBlock resolved the chat to reply into by PROJECT, walking a
fixed order -- floating window, then app pane, then dock pane. A project
can have all three open at once and each buildChatUI keeps its own
history closure, so the order decided the recipient rather than the
question did: an ask emitted by the dock pane was answered into the
floating window, and once an app pane had been built it took every
reply even while hidden. The asking conversation never heard back, and
another was handed an answer to a question it never asked.

The block now carries its origin. buildChatUI names its submitText and
hands it to renderUIBlock alongside the project; renderUIBlock calls it
directly. No reply callback means nothing asked -- staying silent beats
guessing at a conversation.

That leaves the three WINS/DOCK_CHATS lookups with no readers, so the
__submitText plumbing that fed them comes out too: a hook nothing reads
is a mechanism the next reader would believe in.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KYD1zZPD7GuM8pF1btwi2U
@FMXExpress
FMXExpress merged commit 049bd7d into main Aug 15, 2026
khongten001 pushed a commit to khongten001/PasClaw that referenced this pull request Nov 10, 2026
A project could have its conversation open in three places at once --
floating window, dock pane, app-window pane -- each a separate
buildChatUI closure with its own private history array. Whichever one
you typed into was the only one that knew what you had said, and closing
the window that happened to hold it ended the conversation with it. The
dialog-routing bug fixed in FMXExpress#549 was a symptom: there was no such thing
as "the" chat for a project to route an answer back to.

There is now exactly one. PROJECT_CHATS holds a single instance per
project; showChatIn re-parents its root DOM node to whichever surface is
its current home, and appendChild detaching from the previous parent is
what makes two live copies impossible rather than merely discouraged.

The home is the app window's left bar, as asked. openChat is a router
now: a project with a ready app opens the app WITH the chat beside it,
because what you are about to say is nearly always about what you are
looking at. A project with no app yet has no such window, so its
conversation lives in the dock pane until the first app exists -- and
the turn that builds that app opens the window with the chat, which is
the moment the conversation moves into its permanent home. Hiding the
pane or closing the window hands it back to the dock; the dock, when
the app window is showing it, says where it went instead of rendering a
second emptier copy. The floating chat window is gone.

And the conversation outlives the page. Each project's chat is filed to
its own session (desktop-<project>) after every turn and replayed on
first build, so a reload -- or another browser against the same gateway
-- reopens the conversation rather than starting a stranger's. The id is
derived from the slug rather than stored, since a slug is already a safe
session id and a mapping would be one more thing to keep in step. Saves
are best effort: a turn that cannot be filed is still a turn.

Fixed on the way, because the router made it a normal path rather than a
rarity: openApp on an ALREADY-OPEN app rebuilt its whole body into the
live window -- createWindow hands back the existing one, and everything
after it builds contents, so a second app frame and a second chat pane
stacked inside the same body. It now raises the live window instead, and
the check sits above the network-permission prompt so raising an open app
never re-asks a question already answered.

Verified against a running gateway: PUT creates the session, GET replays
it, an unseen session 404s into the empty-conversation path, a re-PUT
replaces wholesale, and a slug with dots and dashes is a valid id.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KYD1zZPD7GuM8pF1btwi2U
FMXExpress pushed a commit that referenced this pull request Nov 13, 2026
renderMarkdown (webui.html and desktop.html) looped forever on text with
CRLF line endings. In a JS regex "." stops at "\r", so "## Title\r"
failed the heading test while still stopping a paragraph: the paragraph
branch took no line, i never moved, and the tab froze pushing empty
paragraphs ("this page is slowing down"), and froze again on every
reload because the web UI reopens the latest chat. Same for a
"```lang\r" fence and for U+2028 / U+2029. The Delphi build's sLineBreak
is CRLF and the Anthropic provider joins a reply's text blocks with it,
so a reply whose block ended in a heading was enough. Present since
#549.

- Line endings are normalised (\r\n, \r, U+2028, U+2029 -> \n) before
  splitting, in renderMarkdown and renderAssistantHTML.
- The paragraph branch always takes the line it is on (it failed every
  block test, so it is paragraph text), so no line can stall the loop
  whatever a future block test and the stop tests disagree on.

LF text renders byte-identically to before; CRLF renders as its LF
equivalent. The native client's Pascal renderer was checked on the same
inputs and is unaffected.

test-webui-markdown loads renderMarkdown from both pages and runs every
line ending in vm with a 2 s timeout, so a regression fails instead of
hanging the build: 32 failures on the old pages, none now. In Chromium a
CRLF reply froze main's web UI (no response for 23 s) and renders in
0.7 s with the fix.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KYD1zZPD7GuM8pF1btwi2U
FMXExpress pushed a commit that referenced this pull request Nov 13, 2026
renderMarkdown (webui.html and desktop.html) looped forever on text with
CRLF line endings. In a JS regex "." stops at "\r", so "## Title\r"
failed the heading test while still stopping a paragraph: the paragraph
branch took no line, i never moved, and the tab froze pushing empty
paragraphs ("this page is slowing down"), and froze again on every
reload because the web UI reopens the latest chat. Same for a
"```lang\r" fence and for U+2028 / U+2029. The Delphi build's sLineBreak
is CRLF and the Anthropic provider joins a reply's text blocks with it,
so a reply whose block ended in a heading was enough. Present since
#549.

- Line endings are normalised (\r\n, \r, U+2028, U+2029 -> \n) before
  splitting, in renderMarkdown and renderAssistantHTML.
- The paragraph branch always takes the line it is on (it failed every
  block test, so it is paragraph text), so no line can stall the loop
  whatever a future block test and the stop tests disagree on.

LF text renders byte-identically to before; CRLF renders as its LF
equivalent. The native client's Pascal renderer was checked on the same
inputs and is unaffected.

test-webui-markdown loads renderMarkdown from both pages and runs every
line ending in vm with a 2 s timeout, so a regression fails instead of
hanging the build: 32 failures on the old pages, none now. In Chromium a
CRLF reply froze main's web UI (no response for 23 s) and renders in
0.7 s with the fix.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KYD1zZPD7GuM8pF1btwi2U
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants