mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-05 23:37:25 +00:00
Adds a built-in, opt-in codemode tool that runs model-written JavaScript in the codemode sandbox. Scripts call the other active tools as tools.<name>(args), including concurrently with Promise.all; only the return value, console output, and images attached with image() reach the model. Nested calls run through the agent loop via a new AgentToolContext (5th execute argument, ctx.executeTool for extension tools), so argument validation and the beforeToolCall/afterToolCall hooks apply. Hooks and tool_call/tool_result events carry the parent call id. Tools can declare outputSchema and return structuredContent; codemode passes that to scripts and falls back to text content otherwise. The codemode package gains globals, declaration rendering from JSON Schema, and optional deadlines.
45 lines
903 B
JSON
45 lines
903 B
JSON
{
|
|
"name": "@earendil-works/pi-codemode",
|
|
"version": "0.87.1",
|
|
"description": "Sandboxed JavaScript execution where the only capability is calling injected tools",
|
|
"type": "module",
|
|
"main": "./dist/index.js",
|
|
"types": "./dist/index.d.ts",
|
|
"exports": {
|
|
".": {
|
|
"types": "./dist/index.d.ts",
|
|
"import": "./dist/index.js"
|
|
}
|
|
},
|
|
"files": [
|
|
"dist",
|
|
"README.md"
|
|
],
|
|
"scripts": {
|
|
"clean": "shx rm -rf dist",
|
|
"build": "tsc -p tsconfig.build.json",
|
|
"test": "vitest --run",
|
|
"prepublishOnly": "npm run clean && npm run build"
|
|
},
|
|
"keywords": [
|
|
"pi",
|
|
"codemode",
|
|
"sandbox",
|
|
"vm",
|
|
"worker"
|
|
],
|
|
"author": "Earendil Works",
|
|
"license": "MIT",
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "git+https://github.com/earendil-works/pi.git",
|
|
"directory": "packages/codemode"
|
|
},
|
|
"engines": {
|
|
"node": ">=22.19.0"
|
|
},
|
|
"devDependencies": {
|
|
"shx": "0.4.0",
|
|
"vitest": "4.1.9"
|
|
}
|
|
}
|