feat: public ModelPicker sample over ModelSelection + attachImage/togglePin gap closers#1877
Merged
Conversation
…glePin gap closers Promote the private ModelSelectionTabView to a public ModelPicker — a thin, styleable sample selector over the headless ModelSelection. ModelSelection stays the product (it vends the sorted/grouped list as data and owns the load path); ModelPicker is the default, not the only path. It adds a grouping seam (grouped: Bool) that renders ModelSelection.groupModels(_:by:)'s foundation-vs-downloaded sections, defaulting to the historical flat list. - Re-express ModelManagementSheet to compose ModelPicker (grouped: false) — no behavior change; existing logic/snapshot tests updated to the new name. - Hoist the foundation/downloaded grouping into a static ModelSelection.groupModels(_:by:) so the sample view and the headless instance method share one implementation (no coordinator needed to render). - Gap closers: - ChatViewModel.attachImage(_:mimeType:) (#1298) — convenience over stageAttachment that builds the image MessagePart and routes through the same internal path the bundled composer uses. - SessionManagerViewModel.togglePin(_:) (#1300) — pin/unpin based on the record's current isPinned. - Docs snippet-gate fix (Correction G / Decision 6): add ManifoldUIModelManagement as a third linked product in scripts/extract-snippets-test.sh so ModelPicker doc snippets compile. New ManifoldUIModelManagement.docc article (ModelPickerSample.md) carries three compile-checked ModelPicker snippets that pass the gate; links into the existing QUICKSTART-MODEL-SELECTION.md guide rather than editing it. Tests: ModelPicker renders ModelSelection's sorted/grouped data and shares selection state with the registry; attachImage and togglePin verified (sabotage-checked); existing pinning/staged-attachment/snapshot suites green. API digester clean on ManifoldInference/ManifoldUI/ManifoldUIModelManagement (all additive). Snippet gate passes locally with the new 3-product scaffold. Resolves #1298 Resolves #1300 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Owner
Author
|
Orchestrator review (adversarial): approve. |
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.
PR 3 of the reusable model-selection plan (
docs/plans/reusable-model-selection-surfaces.md). Builds on PR 0 (#1866), PR 1 (#1864), PR 2 (#1873). Draft — do not merge.1. Public
ModelPickersample overModelSelectionModelSelectionTabView→ publicModelPickerinManifoldUIModelManagement: a thin, styleable sample selector. The headlessModelSelectionstays the product;ModelPickeris the default, not the only path.grouped: Bool) that renders the foundation-vs-downloaded sections fromModelSelection.groupModels(_:by:). Defaults tofalse(the historical flat list).ModelSelection.groupModels(_:by:)so the sample view and the headless instance method share one implementation — noModelLoadCoordinatorneeded to render.ModelPickerdrives selection through aModelRegistryit already owns (no service widening; respects the service-sharing rule).2.
ModelManagementSheetcomposesModelPickerModelPicker(grouped: false)in the Select tab — no behavior change. Existing logic/snapshot/explicit-init tests updated to the new name.3. Gap closers
ChatViewModel.attachImage(_:mimeType:)([API] Extend ModelCapabilities with codeGeneration and multilingual axes #1298) — convenience overstageAttachmentthat builds theMessagePart.imageand routes through the same internal path the bundled composer uses (placeholder-hash parity verified).SessionManagerViewModel.togglePin(_:)([API] Bulk session deletion on SessionManagerViewModel #1300) — pins/unpins based on the record'sisPinned.4. Docs snippet-gate fix (Correction G / Decision 6)
ManifoldUIModelManagementas a third linked product inscripts/extract-snippets-test.sh(it is not umbrella-re-exported) soModelPickerdoc snippets compile.ManifoldUIModelManagement.docc/ModelPickerSample.mdarticle with three compile-checkedModelPickersnippets (notno-build, not under a blocked heading). Links into the existingdocs/QUICKSTART-MODEL-SELECTION.md(owned by PR 2) via prose rather than editing it.Validation (local)
swift build --build-tests— clean.ModelPickerTests,attachImage,togglePin); sabotage-checked then reverted.extract-snippets.sh+extract-snippets-test.sh→ 16 passed, 0 failed, including all three ModelPicker snippets, under the new 3-product scaffold.check-readme.shpasses.ManifoldInference/ManifoldUI/ManifoldUIModelManagement— all additions are additive (no allowlist entry needed).Resolves #1298
Resolves #1300
🤖 Generated with Claude Code