Skip to content

Mac editor: the Copilot tab is the widget's AI conversation (phase 2b) - #87

Merged
everettjf merged 1 commit into
mainfrom
ai-conversation-editor
Nov 19, 2026
Merged

everettjf merged 1 commit into
mainfrom
ai-conversation-editor

Conversation

@everettjf

Copy link
Copy Markdown
Owner

Stacked on #86; merge that one first.

What the user gets

The editor's Copilot tab is now the conversation about the open widget. A widget made in the AI window continues the conversation it was made in; any other widget starts one.

  • The AI works on a copy. Each version is drawn small in the panel; the widget and the editor do not change.
  • Apply to Editor writes the version on screen into the open document and saves it, through the editor's existing conflict check.
  • Code the conversation has not seen (typed in the editor, or changed with the Layout panel) is taken over as a version before the next request.
  • Fix Runtime Error sends the error the editor's preview last reported.
  • A widget that imports its own files now works with the AI: the copy holds them.

No screenshots: see "What did not run". No linked issue.

Security and compatibility

  • The copy is made of regular files only: no symbolic links, nothing from __Build, at most 300 files and 20 MB. A larger widget is refused with a message, not half-copied.
  • The copy runs with the widget's own widget.json plus the hosts a version declares. Only the network permission can be added. A legacy widget (no widget.json) runs as a legacy package, as it does when installed. A widget.json that is present but unreadable turns the panel off; it is never treated as absent.
  • A turn never writes to the widget. Apply reads the document again, refuses when it is not what the panel last saw, asks before adding a network host, writes the manifest through writeManifest (which validates), then replaces the document through EditorService.replaceDocument.
  • Conversations are found again by manifest id; a widget that merely has the same name as an earlier one does not get its conversation when both have ids.
  • The single-request Copilot (AIGenerateSession.copilot) is no longer used on the Mac; iPhone and iPad still use it.
  • AIConversation gains optional savedPackageID, AIConversationTurn optional isManualEdit; earlier files still load.

Found while doing this

ScriptWidgetCompiler.wrappedSource appends its closing text directly after the source. Source whose last line is a // comment without a line break does not compile, on every platform that shares that wrapper. Conversation code now always ends with a line break, which avoids it here. The wrapper itself is a cross-platform contract with a build fingerprint and is not changed in this pull request.

What ran, on this Mac

  • ScriptWidgetRuntimeTests, macOS, whole suite: 846 tests, 811 passed, 35 skipped, 0 failed. Nine new tests cover taking over editor code, the pending-version rule, the copy with the widget's files, permissions plus declared hosts, legacy widgets, the copy's limits and links, and finding a conversation by widget.
  • ScriptWidgetMac build and ScriptWidget (iOS) simulator build: succeeded.
  • iPhone 18 Pro Max simulator, AIConversationTests and AIGenerationTests: 51 tests, 45 passed, 6 skipped, 0 failed.
  • node Scripts/validate-doc-links.mjs: passed.

What did not run

  • The Copilot tab itself has not been opened. The unsigned test build has no widget library, so no widget can be opened in the editor. Everything in StudioCopilotConversationView (reading the document, Apply, the conflict message, the network question, the small preview, the layout of the panel) compiles and is unexercised. It needs a signed run from Xcode.
  • The AI window after its turn list was moved into AIConversationTurnsView: built, not opened again.
  • ./Scripts/release-readiness.sh as a whole, the rest of the iOS suite, a real model with this branch, any physical device.

🤖 Generated with Claude Code

The Copilot tab was one request with a proposal to accept or reject. It is
now the conversation about the open widget: the one it was made in, when the
AI window made it, found again by manifest id (by name for a legacy package).

The AI works on a copy. The copy holds the widget's other files, so imports
and images resolve, and runs with the widget's own widget.json plus the hosts
a version declares; a legacy widget runs as a legacy package. Regular files
only, no links, no build cache, at most 300 files and 20 MB. The widget and
the editor change only on "Apply to Editor", which reads the document again,
refuses when it is not what the panel last saw, asks before adding a network
host to the widget, and writes through the editor's own conflict check.

Code the conversation has not seen becomes a version marked as coming from
the editor before the next request. An older version still in the editor
does not replace a newer one that was not applied yet.

Conversation code now ends with a line break. The runtime appends its closing
text straight after the source, so a reply whose last line was a // comment
did not compile.

The turn list is shared by the AI window and the Copilot tab.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@everettjf
everettjf changed the base branch from ai-conversation-phase2 to main November 19, 2026 08:37
@everettjf
everettjf merged commit 5e73a80 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