fix: fixed tool-call compatibility and tiny runtime resolver behavior

- Updated tool-call handling to accept string and object arguments.
- Stored object tool-call args directly into block.partialArgs and block.arguments.
- Added compiled runtime module resolution honoring exports, main, and index fallbacks.
- Patched tiny runtime loading to install resolver stubs and load the resolved entry file.
This commit is contained in:
can1357
2026-06-04 05:40:17 +02:00
parent 40ba8c19cf
commit 7490967f0e
7 changed files with 269 additions and 15 deletions
@@ -1,10 +1,20 @@
#!/usr/bin/env bun
import { createRequire } from "node:module";
import * as path from "node:path";
const packageDir = path.join(import.meta.dir, "..");
const outputPath = path.join(packageDir, "dist", "omp");
// Transformers.js is an optional, native-heavy dependency that is never bundled
// into the binary; the tiny-model worker `bun install`s it into a runtime cache
// on first use. The `catalog:` spec cannot be resolved from inside the compiled
// bunfs (issue #1763), so embed the concrete installed version here for the
// worker to pin its runtime install against.
const transformersVersion = (
createRequire(import.meta.url)("@huggingface/transformers/package.json") as { version: string }
).version;
function shouldAdhocSignDarwinBinary(): boolean {
return process.platform === "darwin";
}
@@ -40,6 +50,8 @@ async function main(): Promise<void> {
"--keep-names",
"--define",
'process.env.PI_COMPILED="true"',
"--define",
`process.env.PI_TINY_TRANSFORMERS_VERSION=${JSON.stringify(transformersVersion)}`,
"--external",
"mupdf",
"--root",