Skip to content

ai: tighten public surface and document CuaProvider + supported models - #7

Merged
rgarcia merged 4 commits into
mainfrom
hypeship/cua-ai-docs-polish
May 13, 2026
Merged

ai: tighten public surface and document CuaProvider + supported models#7
rgarcia merged 4 commits into
mainfrom
hypeship/cua-ai-docs-polish

Conversation

@rgarcia

@rgarcia rgarcia commented May 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Follow-up polish to @onkernel/cua-ai's docs and public surface:

  • parseCuaModelRef / formatCuaModelRef: now module-private. They were only ever shaped as implementation details (pure string munging) and had no external callers in the workspace — getCuaModel exercises both internally. Tests for the error paths now route through getCuaModel so the user-visible behavior is still covered. Also dropped the empty-id guard from formatCuaModelRef since both call sites pass a known-non-empty id.
  • README:
    • Dropped the "See examples/quickstart.ts" stub — wasn't adding value.
    • Added a CuaProvider section between Model Refs and listCuaModels. Explains that CuaProvider is a string union (not a runtime object), how it overlaps with pi-ai's Provider, and the gemini/google rename.
    • Pulled the model catalog into docs/supported-models.md and linked it from Model Refs. Each provider section lists family/exact matchers with citation links to the official CUA docs.
  • Quickstart timestamp: Date.now(): kept. Investigated pi-ai's complete() — it just delegates to the registered provider's stream function and pi-ai's UserMessage type requires timestamp: number. Nothing defaults it, so the example must include it.

Test plan

  • npm run build (cua-ai package)
  • npm test (cua-ai package — 43 passed / 7 skipped)
  • npm run typecheck (workspace)

🤖 Generated with Claude Code


Note

Medium Risk
Medium risk because it changes the public provider identifier from gemini to google and narrows top-level exports, which can break downstream imports and model refs even though runtime behavior is mostly unchanged.

Overview
Provider ID alignment: switches CUA provider/model refs from gemini:* to google:* (including agent defaults, tool routing, model annotations/overrides, examples, and integration tests) and simplifies providerForModel() to return model.provider after validation.

Public surface + docs: restructures packages/ai/src/index.ts to explicitly export only the intended APIs/types (adding isCuaProvider) and adds docs/supported-models.md plus README updates describing CuaProvider, model-ref format, and supported-model listings.

Test robustness: relaxes batch tool integration assertions for providers that may emit no tool calls (e.g. tzafon), gating expectations via new per-provider flags while still requiring usage token reporting.

Reviewed by Cursor Bugbot for commit ce5024b. Bugbot is set up for automated code reviews on this repo. Configure here.

rgarcia and others added 4 commits May 12, 2026 14:07
- Un-export parseCuaModelRef/formatCuaModelRef (internal helpers).
- Add docs/supported-models.md enumerating CUA-supported models per
  provider with source citations, linked from README.
- Add a CuaProvider section to the README explaining the type, its
  relationship to pi-ai's Provider, and the gemini/google rename.
- Drop the now-redundant "See examples/quickstart.ts" line from the
  README quick start.
- Rename CuaProvider key from "gemini" to "google" so it matches pi-ai's
  Model.provider exactly. providerForModel becomes a thin isCuaProvider
  guard. Drops the rename map and the dead piProviderFor switch.
- Switch packages/ai/src/index.ts from `export *` to named re-exports
  for models.ts and providers/common.ts. Keeps the public surface to
  getCuaModel/listCuaModels/providerForModel/isCuaProvider, the action
  types/input types, CUA tool name constants, CUA_ACTION_TYPES, and
  createComputerToolDefinitions. Internal exports (parseCuaModelRef,
  formatCuaModelRef, findCuaAnnotation, CUA_PROVIDERS,
  CUA_MODEL_ANNOTATIONS, schemas) stay reachable from tests via
  ../src/models.js but are no longer part of the package interface.
- Restore parse/format unit tests, plus update annotation tests to the
  new google key.
- Trim README copy: drop the registry/override caveat, drop "with
  source citations", and rewrite the CuaProvider section now that the
  rename is gone. Reword the action-vocabulary section to talk about
  types instead of dropped schemas.
Tzafon's model is non-deterministic about emitting tool calls under our
test prompts; mirror the requireToolCalls guard from #8 so a no-tool-call
response no longer fails CI.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@rgarcia
rgarcia marked this pull request as ready for review May 13, 2026 15:54
@firetiger-agent

Copy link
Copy Markdown

Firetiger deploy monitoring skipped

This PR didn't match the auto-monitor filter configured on your GitHub connection:

Any PR that changes the kernel API. Monitor changes to API endpoints (packages/api/cmd/api/) and Temporal workflows (packages/api/lib/temporal) in the kernel repo

Reason: PR modifies documentation and public API surface of the @onkernel/cua-ai package, not the kernel API endpoints (packages/api/cmd/api/) or Temporal workflows (packages/api/lib/temporal) specified in the filter.

To monitor this PR anyway, reply with @firetiger monitor this.

@rgarcia
rgarcia merged commit 3ba105a into main May 13, 2026
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