Skip to content

Commit 6fde277

Browse files
committed
chore: fix typecheck deps
1 parent 9a639a7 commit 6fde277

File tree

6 files changed

+139
-765
lines changed

6 files changed

+139
-765
lines changed

bun.lock

Lines changed: 129 additions & 758 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

common/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"readable-stream": "^4.7.0",
3939
"seedrandom": "^3.0.5",
4040
"stripe": "^16.11.0",
41+
"zod-from-json-schema": "^0.5.2",
4142
"zod": "3.25.67"
4243
},
4344
"devDependencies": {

packages/agent-runtime/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
"engines": {
2626
"bun": "^1.3.0"
2727
},
28+
"dependencies": {
29+
"quickjs-emscripten-core": "^0.31.0",
30+
"zod-from-json-schema": "^0.5.2"
31+
},
2832
"devDependencies": {
2933
"@types/node": "22",
3034
"@types/bun": "^1.3.0"

packages/agent-runtime/src/util/quickjs-sandbox.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export class QuickJSSandbox {
8484
// Set up logger handler
8585
const loggerHandler = context.newFunction(
8686
'_loggerHandler',
87-
(level, data, msg) => {
87+
(level: any, data: any, msg: any) => {
8888
try {
8989
const levelStr = context.getString(level)
9090
let dataObj: any

packages/agent-runtime/src/util/token-counter.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { LRUCache } from '@codebuff/common/util/lru-cache'
2-
import { encode } from 'gpt-tokenizer/esm/model/gpt-4o'
32

4-
const ANTHROPIC_TOKEN_FUDGE_FACTOR = 1.35
3+
// Rough average characters per token for GPT-style models.
4+
const APPROX_CHARS_PER_TOKEN = 3
55

66
const TOKEN_COUNT_CACHE = new LRUCache<string, number>(1000)
77

@@ -11,10 +11,7 @@ export function countTokens(text: string): number {
1111
if (cached !== undefined) {
1212
return cached
1313
}
14-
const count = Math.floor(
15-
encode(text, { allowedSpecial: 'all' }).length *
16-
ANTHROPIC_TOKEN_FUDGE_FACTOR,
17-
)
14+
const count = Math.ceil(text.length / APPROX_CHARS_PER_TOKEN)
1815

1916
if (text.length > 100) {
2017
// Cache only if the text is long enough to be worth it.

sdk/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
},
6464
"dependencies": {
6565
"@jitl/quickjs-wasmfile-release-sync": "0.31.0",
66+
"@openrouter/ai-sdk-provider": "^1.3.0",
6667
"@vscode/tree-sitter-wasm": "0.1.4",
6768
"ai": "^5.0.0",
6869
"diff": "8.0.2",

0 commit comments

Comments
 (0)