Skip to content

feat: public ModelPicker sample over ModelSelection + attachImage/togglePin gap closers#1877

Merged
roryford merged 1 commit into
mainfrom
feat/model-picker-sample
Jun 14, 2026
Merged

feat: public ModelPicker sample over ModelSelection + attachImage/togglePin gap closers#1877
roryford merged 1 commit into
mainfrom
feat/model-picker-sample

Conversation

@roryford

Copy link
Copy Markdown
Owner

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 ModelPicker sample over ModelSelection

  • Promotes the private ModelSelectionTabView → public ModelPicker in ManifoldUIModelManagement: a thin, styleable sample selector. The headless ModelSelection stays the product; ModelPicker is the default, not the only path.
  • Adds a grouping seam (grouped: Bool) that renders the foundation-vs-downloaded sections from ModelSelection.groupModels(_:by:). Defaults to false (the historical flat list).
  • Hoists the grouping into a static ModelSelection.groupModels(_:by:) so the sample view and the headless instance method share one implementation — no ModelLoadCoordinator needed to render. ModelPicker drives selection through a ModelRegistry it already owns (no service widening; respects the service-sharing rule).

2. ModelManagementSheet composes ModelPicker

  • Re-expressed to use ModelPicker(grouped: false) in the Select tab — no behavior change. Existing logic/snapshot/explicit-init tests updated to the new name.

3. Gap closers

4. Docs snippet-gate fix (Correction G / Decision 6)

  • Adds ManifoldUIModelManagement as a third linked product in scripts/extract-snippets-test.sh (it is not umbrella-re-exported) so ModelPicker doc snippets compile.
  • New ManifoldUIModelManagement.docc/ModelPickerSample.md article with three compile-checked ModelPicker snippets (not no-build, not under a blocked heading). Links into the existing docs/QUICKSTART-MODEL-SELECTION.md (owned by PR 2) via prose rather than editing it.

Validation (local)

  • swift build --build-tests — clean.
  • New slices green (ModelPickerTests, attachImage, togglePin); sabotage-checked then reverted.
  • Snippet gate: extract-snippets.sh + extract-snippets-test.sh16 passed, 0 failed, including all three ModelPicker snippets, under the new 3-product scaffold. check-readme.sh passes.
  • API digester clean on ManifoldInference / ManifoldUI / ManifoldUIModelManagement — all additions are additive (no allowlist entry needed).

Resolves #1298
Resolves #1300

🤖 Generated with Claude Code

…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>
@roryford roryford marked this pull request as ready for review June 14, 2026 21:53
@roryford

Copy link
Copy Markdown
Owner Author

Orchestrator review (adversarial): approve. groupModels hoist is a clean single-implementation refactor (instance groupedModels forwards to the new static), and the sample view correctly drives selection through its own ModelRegistry rather than the service coordinator — no service-sharing-rule violation. attachImage delegates to the same internal stageDraftAttachment path as ChatInputBar (not a parallel path); togglePin reads isPinned at call time over the existing idempotent pin/unpin. Snapshot test is a mechanical view-rename, not a masked regression. Digester clean (all additive). Disjoint from #1874/#1875 — merging on green.

@roryford roryford merged commit 502f416 into main Jun 14, 2026
12 checks passed
@roryford roryford deleted the feat/model-picker-sample branch June 14, 2026 22:06
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.

[API] Bulk session deletion on SessionManagerViewModel [API] Extend ModelCapabilities with codeGeneration and multilingual axes

1 participant