Repository navigation
Mac editor: the Copilot tab is the widget's AI conversation (phase 2b) - #87
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
No screenshots: see "What did not run". No linked issue.
Security and compatibility
__Build, at most 300 files and 20 MB. A larger widget is refused with a message, not half-copied.widget.jsonplus the hosts a version declares. Only the network permission can be added. A legacy widget (nowidget.json) runs as a legacy package, as it does when installed. Awidget.jsonthat is present but unreadable turns the panel off; it is never treated as absent.writeManifest(which validates), then replaces the document throughEditorService.replaceDocument.AIGenerateSession.copilot) is no longer used on the Mac; iPhone and iPad still use it.AIConversationgains optionalsavedPackageID,AIConversationTurnoptionalisManualEdit; earlier files still load.Found while doing this
ScriptWidgetCompiler.wrappedSourceappends 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.ScriptWidgetMacbuild andScriptWidget(iOS) simulator build: succeeded.AIConversationTestsandAIGenerationTests: 51 tests, 45 passed, 6 skipped, 0 failed.node Scripts/validate-doc-links.mjs: passed.What did not run
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.AIConversationTurnsView: built, not opened again../Scripts/release-readiness.shas a whole, the rest of the iOS suite, a real model with this branch, any physical device.🤖 Generated with Claude Code