Skip to content

Mac: AI generation as a conversation with versions and drafts (phase 1) - #85

Merged
everettjf merged 3 commits into
mainfrom
ai-conversation-mac
Nov 19, 2026
Merged

everettjf merged 3 commits into
mainfrom
ai-conversation-mac

Conversation

@everettjf

Copy link
Copy Markdown
Owner

What the user gets

The AI window of the Mac app is now a conversation about one widget: describe it, look at the preview, ask for a change, look again.

  • Each turn sends the earlier requests of the conversation, the current source and the selected Skills, so "make the title smaller" edits the widget on screen and the AI knows what was asked before.
  • Each change that runs becomes a numbered version. "Go to This Version" or the arrows show an older one; continuing from it leaves the later turns behind.
  • A change that does not run, a provider error or Stop leaves the widget and the preview as they were. Before, the preview went blank during a Refine and a failed Refine lost the last good widget.
  • Conversations are saved after every change and offered again as drafts.
  • Changing the preview size runs the widget again on the Mac and sends nothing.

The conversation window

Empty state: docs/images/ai-conversation-mac-empty.png. Both pictures are drawn by a test with a prepared conversation (see below); they are not captures of a session with a real model.

This is phase 1 of the plan agreed with the owner. Not in it: streaming, several sizes at once, the same conversation in the editor's Copilot panel, targeted edits, a diff view, and the iPhone and iPad screens. No linked issue.

Security and compatibility

  • A saved conversation holds requests, the AI's notes, error summaries and widget sources. It holds no key, token, header, server or model. testSavedConversationRoundTripsAndHoldsNoCredential reads the file and checks.
  • Conversations are local files in the app's Application Support folder, not in iCloud or the app group. At most 50 are kept, 30 versions each.
  • Generated code still runs only through AgentRuntimeBridge in a temporary package under the normal runtime limits.
  • A turn makes at most 4 provider requests (was up to 20 by default); Apple Private Cloud Compute stays at 3.
  • Console lines sent with a repair are now cut to 300 characters each. This also applies to the existing single-request flow.
  • AgentLoopEvent gains a note case and AgentLoopRequest.Mode a turn case. The existing modes, the iPhone and iPad screens and the editor Copilot are unchanged.
  • Skills remain prompt text only.

Found while doing this, not changed here

The AI preview package has no widget.json, so it is treated as a legacy package and may use the network. A widget saved from the AI window gets a new Package 2.0 manifest with no permissions. A generated widget that fetches data therefore works in the preview and fails after saving until network and its domains are added in the editor. This was already so before this change. Android has the AI declare network use; the Apple apps do not. It is described in docs/ai-conversation.md.

What ran, on this Mac

  • ScriptWidgetRuntimeTests, macOS, whole suite: 827 tests, 794 passed, 33 skipped, 0 failed. The 18 new tests are in AIConversationTests; they use a stub provider and no key.
  • ScriptWidgetMac build: succeeded.
  • ScriptWidget (iOS) simulator build: succeeded.
  • ScriptWidgetRuntimeTests on the iPhone 18 Pro Max simulator, AIConversationTests and AIGenerationTests only: 32 tests, 28 passed, 4 skipped, 0 failed.
  • node Scripts/validate-doc-links.mjs and node Scripts/validate-release.mjs: passed.

What did not run

  • ./Scripts/release-readiness.sh as a whole. Its editor, Web Studio and preview-engine steps were skipped: no JavaScript changed and the worktree has no node_modules. The rest of the iOS test suite was not run.
  • The window was not clicked through in the running app, and no real model was called. The pictures show layout only. Typing, sending, Stop, the menus and saving are covered by the session tests, not by a hand test.
  • No physical device. The Mac interface has no Simplified Chinese strings, as before.

🤖 Generated with Claude Code

everettjf and others added 2 commits November 18, 2026 20:59
The AI window was one request with automatic repair and a Refine field that
knew nothing of earlier requests. It is now a conversation about one widget:
each turn sends the earlier requests, the current source and the selected
Skills; each change that runs becomes a version the user can go back to; a
change that does not run, a provider error or Stop leaves the widget and the
preview as they were. Conversations are saved after every change as local
JSON files and offered again as drafts.

A turn makes at most four provider requests (one generation, three repairs)
instead of up to twenty. Changing the preview size runs the widget again
locally and sends nothing. Console lines sent with a repair are cut to 300
characters each.

A saved conversation holds requests, notes, error summaries and sources. It
holds no key, token, header, server or model; a test reads the file to check.

The shared model, store and session are compiled for iPhone and iPad too, but
their screens are unchanged. Tests use a stub provider and need no key.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Driving the window in a test build against a local stand-in provider showed
three things: a conversation opened again started at its first turn instead
of its last, the token line wrapped once the numbers grew, and the subtitle
was cut off when the provider picker was shown. A capture of that run is
added to the documentation.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@everettjf

Copy link
Copy Markdown
Owner Author

Run in the app, on this Mac, after the first commit. The unsigned Debug build was started in the app's own test mode with a separate home folder, with a provider profile passed as launch arguments (nothing saved to settings) that points at a local stand-in server. No key and no real model.

Worked as described: opening from File > Generate Widget with AI, sending with Return, the first widget and its preview, a change that failed once and was repaired ("Fixed automatically 1 time"), a change that never ran (widget and preview stayed, Try Again and Show Its Code shown), Go to This Version, continuing from the older version (later turn marked "left behind"), Stop (ended at once), a provider error with Retry (both a 500 from the stand-in and Apple Private Cloud Compute being unavailable), and reopening the draft after closing the window and after quitting the app.

Fixed in the second commit: a reopened conversation now scrolls to its last turn, the token line no longer wraps, the subtitle is shorter.

Not exercised: Save Widget. In this build the widget library folder does not exist, so saving answered "Invalid package name"; the call is the one the old window made. The size picker was not operated in the app (it is a pop-up menu); the session test covers it. A real model, a signed build and the menus of the + and … buttons were not tried.

Run in the app

Skipped unless ROCKY_OPENAI_APIKEY is set, like the existing live tests. It
sends a new widget, a restyling and an addition, and checks that each turn
runs, that the model says what it did, and that the first turn's text is
still there after the third.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@everettjf

Copy link
Copy Markdown
Owner Author

Real model, on this Mac: testThreeTurnsAgainstARealProviderWhenConfigured against DeepSeek deepseek-flash (key supplied by the owner through the environment, not stored). One run, passed.

Turn Request Result Repairs Tokens Seconds
1 A card that says Hello in large text with today's date under it, on a light background ran 0 13,003 7
2 Make the Hello text smaller and change the background to dark blue with white text ran 0 12,352 2
3 Add a line at the bottom that says Have a nice day ran 0 12,576 2

Turn 2 changed five lines of 24 (the background, the title's font and color, and three colors that would not read on dark blue). Turn 3 added two lines and changed nothing else. Each reply carried the one-sentence note.

This is one run of one easy case; it is not a quality measurement. The result was checked as source and by the runtime, not looked at as a picture.

@everettjf
everettjf merged commit 76c7981 into main Nov 19, 2026
3 checks passed
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.

1 participant