Skip to content

Mac AI conversation: streaming, three sizes, declared network use (phase 2a) - #86

Merged
everettjf merged 2 commits into
mainfrom
ai-conversation-phase2
Nov 19, 2026
Merged

everettjf merged 2 commits into
mainfrom
ai-conversation-phase2

Conversation

@everettjf

Copy link
Copy Markdown
Owner

What the user gets

Second step of the AI conversation on the Mac (first step: #85).

  • Streaming. The code appears under the request while the AI writes it. A provider that can not stream is asked in the plain way.
  • Three sizes. Small, Medium and Large are drawn under the preview; a click shows that size. Nothing is sent to the provider. A size larger than the area is scaled to fit.
  • Network use is declared. A widget that fetches data says which hosts it contacts. The hosts are shown under the preview, Save asks before saving such a widget, and the permission and hosts are written into the new widget's widget.json.

Sizes and declared host
Code while it is written

Both pictures are captures of the running app against a local stand-in provider.

Not in this pull request: the same conversation in the editor's Copilot panel. It is the remaining part of phase 2 and needs a signed build with a widget library to try; see below. No linked issue.

Security and compatibility

  • The declaration is model output and is treated as untrusted: only permissions: ["network"] and 1 to 8 hosts, unknown keys rejected, then WidgetPackageManifestValidator. An invalid declaration is not run; the reason goes back to the model as a repair.
  • The conversation preview is now stricter. Its sandbox package carries a Package 2.0 widget.json with no permission, or with the network permission for the declared hosts. Before, it had no manifest and the runtime treated it as a legacy package with open network access, while the saved widget had none. Preview and saved widget now get the same.
  • Saving a widget with declared hosts asks the user first, then goes through ScriptWidgetPackage.writeManifest, which validates again. Private and local hosts stay blocked by the runtime.
  • No other permission can be declared in a conversation.
  • The streamed request sends the credential in the Authorization header only, as before. A response over 4 MB is refused, as before.
  • AgentRuntimeBridge.run gains an optional manifest; without it nothing changes. The earlier single request (iPhone, iPad) and the editor Copilot are unchanged and still run without widget.json.
  • AIConversationVersion gains an optional networkDomains; conversation files written by Mac: AI generation as a conversation with versions and drafts (phase 1) #85 still load.

What ran, on this Mac

  • ScriptWidgetRuntimeTests, macOS, whole suite: 837 tests, 803 passed, 34 skipped, 0 failed. AIConversationTests has 28, of which 26 ran (the live-provider and snapshot tests are opt-in).
  • ScriptWidgetMac build and ScriptWidget (iOS) simulator build: succeeded.
  • iPhone 18 Pro Max simulator, AIConversationTests and AIGenerationTests: 42 tests, 37 passed, 5 skipped, 0 failed.
  • node Scripts/validate-doc-links.mjs: passed.
  • In the running app (unsigned Debug build, test mode, separate home, local stand-in provider): streaming, the three thumbnails, switching to Large, the declared host line and the Save confirmation were seen working.

What did not run

  • ./Scripts/release-readiness.sh as a whole: no JavaScript changed and the worktree has no node_modules. The rest of the iOS suite was not run.
  • Saving, including writing the network permission into the new widget: the unsigned build has no widget library, so the save itself could not complete. The confirmation dialog was seen; the write was not.
  • A real model with this change. DeepSeek ran three turns against Mac: AI generation as a conversation with versions and drafts (phase 1) #85; streaming and the declaration have not been tried against a real provider.
  • A widget that really fetches from a declared host in the preview. The tests check the manifest and the runtime's allow decision for declared and other hosts; they make no network request.
  • No physical device.

🤖 Generated with Claude Code

everettjf and others added 2 commits November 18, 2026 22:15
The reply is read as server-sent events and its code is shown while it is
written. A server that refuses or ignores the streamed form is asked again
in the plain form as long as nothing was received.

The preview draws the widget at Small, Medium and Large under the chosen
size; a click switches. A size larger than the area is scaled to fit.

A widget that uses the network must end its reply with the declaration the
Android app already uses. It is untrusted: only the network permission and
up to eight hosts, checked by the manifest validator; an invalid one is not
run and goes back for repair. The conversation's sandbox now carries a
Package 2.0 widget.json with no permission or with the declared hosts, so
the preview is held to what the saved widget gets. Before, the preview was a
legacy package with open network access and the saved widget had none.
Saving asks first and writes the permission into the new widget.

The earlier single request and the editor Copilot are unchanged and still
run in a package without widget.json.

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

Copy link
Copy Markdown
Owner Author

Real model, on this Mac, with this branch: DeepSeek deepseek-flash, key supplied by the owner through the environment and removed afterwards. One run of each, both passed.

  • testThreeTurnsAgainstARealProviderWhenConfigured: three turns, each ran at the first attempt, 12,504 / 12,392 / 12,485 tokens, 4 / 2 / 1 seconds. The requests went out in the streamed form and the token counts came from the stream's last event.
  • testNetworkWidgetAgainstARealProviderWhenConfigured (new): asked for a widget that fetches https://httpbin.org/uuid. It ran at the first attempt, 12,750 tokens, and declared exactly ["httpbin.org"].

Not established by this: whether the fetch in the preview returned a UUID or the widget drew its fallback message; the test checks that the code ran and what it declared, not what it showed. In the three-turn run the model wrote its notes in Chinese although the requests were English.

@everettjf
everettjf merged commit 69f3e01 into main Nov 19, 2026
2 of 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