feat: experimental codemode (#34677)

This commit is contained in:
Aiden Cline 2026-07-02 23:48:34 -05:00 committed by GitHub
commit cb93114424
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
37 changed files with 11329 additions and 45 deletions

View file

@ -0,0 +1,10 @@
/**
* Token estimation for budgeting model-facing text. Copied from
* `@opencode-ai/core/util/token` (chars / 4) so this package stays
* dependency-free; keep the two in sync if the heuristic ever changes.
*/
export * as Token from "./token.js"
const CHARS_PER_TOKEN = 4
export const estimate = (input: string) => Math.max(0, Math.round(input.length / CHARS_PER_TOKEN))