Skip to content

feat(@browser-ai/core): rename input usage#157

Merged
jakobhoeg merged 1 commit intojakobhoeg:mainfrom
mikechao:rename-input-usage
Mar 10, 2026
Merged

feat(@browser-ai/core): rename input usage#157
jakobhoeg merged 1 commit intojakobhoeg:mainfrom
mikechao:rename-input-usage

Conversation

@mikechao
Copy link
Contributor

This PR addresses #150

Because @types/dom-chromium-ai has not yet shipped the new names, yet, dom-chromium-ai-augmentation.d.ts was created to fill this gap.

src/dom-chromium-ai-augmentation.d.ts (new)
Merges the four new members into the existing global LanguageModel interface via TypeScript declaration merging. No types are duplicated or overridden — the new names simply sit alongside the old ones that @types/dom-chromium-ai already provides. Once the upstream package ships the new names, this file can be deleted with no other changes required.

Runtime changes

  • Session event registration now detects support at runtime: registers contextoverflow when "oncontextoverflow" in session, falls back to quotaoverflow for older Chrome builds.
  • getContextUsage() and getContextWindow() read contextUsage/contextWindow with ?? inputUsage/?? inputQuota as a fallback, so both old and new Chrome builds work correctly.
  • onContextOverflow is the new option name; onQuotaOverflow is retained as a @deprecated alias that resolves through the same code path.

Public API changes (@browser-ai/core)

  • getContextUsage() / getContextWindow() — new methods (replace getInputUsage() / getInputQuota())
  • onContextOverflow — new setting (replaces onQuotaOverflow)
  • Old names kept as @deprecated aliases for backward compatibility

Other files updated

  • examples/next-hybrid — updated to use new method and option names
  • docs/content/docs/ai-sdk-v6/core/api-reference.mdx — updated API reference
  • test/session-manager.test.ts — 33 tests, all passing (3 new tests cover fallback paths and deprecated alias behaviour)

@vercel
Copy link

vercel bot commented Feb 24, 2026

@mikechao is attempting to deploy a commit to the browser-ai OSS Program Team on Vercel.

A member of the Team first needs to authorize it.

@vercel
Copy link

vercel bot commented Mar 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
built-in-ai Ready Ready Preview, Comment Mar 2, 2026 6:24pm

Request Review

@jakobhoeg
Copy link
Owner

Thank you @mikechao! Mind resolving the merge conficts? I just pushed a small refactor

@mikechao mikechao force-pushed the rename-input-usage branch from 890c1aa to 8d635c5 Compare March 2, 2026 18:17
@mikechao
Copy link
Contributor Author

mikechao commented Mar 2, 2026

Hi @jakobhoeg

I updated the main branch and rebased these changes on top it.

Copy link
Owner

@jakobhoeg jakobhoeg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you!

@jakobhoeg jakobhoeg merged commit 1eae1e9 into jakobhoeg:main Mar 10, 2026
7 checks passed
@mikechao mikechao deleted the rename-input-usage branch March 10, 2026 21:03
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.

2 participants