You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The 1.0 RequestContext/zero-argument resolver stay public. New fields, overloads, provider/callback/Tool hooks and init(profile:history:) remain Compatibility SPI. A missing profile model still throws the existing explicit error; no default model or constructor-visibility decision is introduced.
Per-request model/options/profile resolution, lifecycle preparation and producing-request callbacks.
Writable profile/callback history; read-only Tool/dynamic-instructions history. Protected pending entries survive writes without leaking into durable history.
Raw public Tools retain identity; execution/native bindings carry canonical history and the selected offered-Tool list.
Shared continuation mapping keeps the ordinary transcript + inFlight path. Profile projection only replaces the uniquely matching complete unchanged round; legal removals/reordering remain authoritative.
Tool-output identity is owning ToolCalls round + call ID, not global provider call-ID deduplication. Provider fixtures compare the complete committed ToolCalls entry seen by hooks/Tools, including ID and metadata.
Normal history-preserving merges synchronize upstream main 7d43219, including #357 per-request usage accounting, #341 Ollama reasoning, #358 host-scoped Chat Completions reasoning, #300 response-start timeouts, #362 cancellation collection, #364 partial structured snapshots and #366/#367 bounds/reasoning/system-Tool fixes. Earlier #336 final-request usage, #340 HTTPTransport, #297/#325/#331/#343/#352/#354/#356 remain intact. No force-push, new checkout, replacement PR or extra fallback.
Response/snapshot usage remains the final request, including zero when unreported; the internal ledger retains earlier requests across handoffs. Non-streaming profile and ordinary generation now use upstream's request-counting channel, so completed requests are counted before return and retained when generation throws. Streams are created outside an enclosing response's accounting channel, including the profile-dispatch task. Prompt/schema/image entry-point regressions first reproduced 10 accounting issues and 6 stream-leak issues, then passed. Existing handoff totals, original call-site round budgets and complete committed-entry identities remain covered.
Fresh local verification (2026-10-23)
Head cf4ad0d. CI=1 GIT_CONFIG_GLOBAL=/dev/null swift test: 949 tests / 100 suites passed. The separate upstream macro test target also passed 2 tests / 1 suite. Strict formatting/diff checks passed. These are compile/offline tests, not live API, model-weight or Apple Intelligence inference acceptance.
A separate same-checkout scratch run with --traits MLX,Llama,CoreML passed 1115 / 110 on this head; no live weight/inference acceptance is claimed.
Provider follow-ups remain separate: #344 OpenAI, #345 OpenResponses, #346 Anthropic, #347 Gemini, #348 Ollama and #349 native projection/initial context reuse. #346/#347 additionally depend on #312. Public profile construction and the separate ordinary Ollama continuation PR remain outstanding scope decisions.
For an ordinary session with static instructions, withProfileToolExecution passes the full canonical request transcript into this binding. Unlike the unbound history getter, the binding does not filter instructions, so a Tool reading @SessionProperty(\.history) sees instruction entries despite HistoryView's instruction-free contract. Filter instructions when constructing the history binding.
Updated in 89c0077: the shared profile/model-handoff budget now reads the original call-site options.maximumToolRounds and preserves #331’s ToolRoundLimitExceeded type/payload. Fresh full SwiftPM run: 850 tests in 87 suites passed, including nondefault two-round ordinary/profile budget regressions and shared-counter access. The legacy RequestContext/zero-argument resolver remains public; only the added fields/overloads/hooks stay SPI. The shared wire-message mapper and reused-call-ID/provider encoding changes from the latest review are still pending separately, not claimed fixed here. Latest-head upstream CI is action_required (workflow approval), not a compile/test failure.
The remaining shared-continuation work is now implemented in 90c85f1 / 1dcc38c and propagated to the provider PRs.
One shared wire-message mapper keeps transcript + inFlight for ordinary sessions. Profiles replace only the matching unchanged round; a removed/reordered projection remains authoritative.
ToolOutput identity is scoped to its owning ToolCalls round. Regression cases reuse call_0 in two rounds and across turns and inspect the continuation requests, rather than deduplicating by that ID globally.
Protected in-flight history is restored during writable-history edits without leaking it into durable history.
The original options.maximumToolRounds counter remains shared across model handoffs; the upstream ToolRoundLimitExceeded payload now retains all earlier completed rounds as well.
Fresh validation: this runtime head passes 880 tests / 91 suites. Each provider branch was independently tested and pushed. The aggregate draft #317 passes 930 / 92 with default traits and 798 / 83 using a new isolated AsyncHTTPClient scratch build. These are offline CI-mode tests, not live inference. All merges preserve published history.
The constructor visibility and ordinary Ollama nonstreaming PR separation remain outstanding decisions; this push does not claim those two requests are complete.
Synced the stack normally with upstream 7013d51 (#351 typed bounds, #336 final-request usage and #340 HTTPTransport), preserving the separate PR boundaries.
In #3152e96883, a profile handoff now carries completed requests in the internal request ledger, leaving Response/Snapshot.usage as the final request, including zero when that final request reports none. It also retains the selected provider's earlier requests so session.usage counts the whole handoff. A streaming/non-streaming regression first reproduced 12 failures, then passed; provider handoff fixtures now assert final-zero versus cumulative session accounting.
All provider branches now use the injected HTTPTransport for their continuation requests. The existing complete ToolCalls entry/metadata, round-scoped call IDs, shared round budget, legal history projections, image snapshot/MIME behavior and native delegate are retained. Ollama's already-published ordinary non-streaming loop remains intact; its new ordinary/profile final-usage regression first failed in all four cases, then passed. No new constructor visibility/default-model choice or separate Ollama PR is bundled here.
Fresh local CI-mode verification: #315909 tests / 96 suites, plus 1075 / 106 with MLX/Llama/CoreML. Draft aggregate #317802d496 contains every new implementation head and passed 969 / 97 default, 826 / 87 AsyncHTTPClient and 1135 / 107 MLX/Llama/CoreML with separate scratch paths in the same fixed checkout. Individual PR descriptions list their latest head/results. These are compile/offline checks, not live API/model-weight inference acceptance. The aggregate keeps its original independent 64-line README delta and stays draft.
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
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.
Scope
Shared execution support for #314's composition API. Depends on #314/#313 and main's #352. Isolated layer comparison.
The 1.0 RequestContext/zero-argument resolver stay public. New fields, overloads, provider/callback/Tool hooks and init(profile:history:) remain Compatibility SPI. A missing profile model still throws the existing explicit error; no default model or constructor-visibility decision is introduced.
Upstream 1.1 synchronization
Normal history-preserving merges synchronize upstream main 7d43219, including #357 per-request usage accounting, #341 Ollama reasoning, #358 host-scoped Chat Completions reasoning, #300 response-start timeouts, #362 cancellation collection, #364 partial structured snapshots and #366/#367 bounds/reasoning/system-Tool fixes. Earlier #336 final-request usage, #340 HTTPTransport, #297/#325/#331/#343/#352/#354/#356 remain intact. No force-push, new checkout, replacement PR or extra fallback.
Response/snapshot usage remains the final request, including zero when unreported; the internal ledger retains earlier requests across handoffs. Non-streaming profile and ordinary generation now use upstream's request-counting channel, so completed requests are counted before return and retained when generation throws. Streams are created outside an enclosing response's accounting channel, including the profile-dispatch task. Prompt/schema/image entry-point regressions first reproduced 10 accounting issues and 6 stream-leak issues, then passed. Existing handoff totals, original call-site round budgets and complete committed-entry identities remain covered.
Fresh local verification (2026-10-23)
Head cf4ad0d.
CI=1 GIT_CONFIG_GLOBAL=/dev/null swift test: 949 tests / 100 suites passed. The separate upstream macro test target also passed 2 tests / 1 suite. Strict formatting/diff checks passed. These are compile/offline tests, not live API, model-weight or Apple Intelligence inference acceptance.A separate same-checkout scratch run with --traits MLX,Llama,CoreML passed 1115 / 110 on this head; no live weight/inference acceptance is claimed.
Provider follow-ups remain separate: #344 OpenAI, #345 OpenResponses, #346 Anthropic, #347 Gemini, #348 Ollama and #349 native projection/initial context reuse. #346/#347 additionally depend on #312. Public profile construction and the separate ordinary Ollama continuation PR remain outstanding scope decisions.