mirror of
https://github.com/earendil-works/pi.git
synced 2026-11-04 08:23:59 +08:00
This adds codemode and MCP support to pi. Codemode (packages/codemode) runs model-written JavaScript in a QuickJS wasm VM inside a worker. From there the script calls pi's tools as async functions, uses a per-session store, and can read the model catalog and run classifiers. The codemode tool in coding-agent is compatible with Codex's exec tool, and codemode.mode works like Codex's tool modes (on or only). Large results are written to a JSON temp file. MCP (packages/mcp) is a standalone client for stdio and streamable HTTP servers, with OAuth. The core only gets general mechanisms; codemode, tool_search and MCP are built-in extensions that use them. Other extensions can replace these built-ins. Tools declare an exposure: direct, model-only, codemode, deferred or hidden. prepareLoadout() lets an orchestrating tool change which tool declarations the model sees. ctx.executeTool() runs nested calls through validation and the tool_call/tool_result hooks. Those calls emit events with parentToolCallId and are recorded as bounded nestedCalls on the parent result, which compaction and HTML export use. Tools can also return structuredContent with an outputSchema, and can report errors with isError instead of throwing. MCP servers come from mcp.json (global, or per project after the project is trusted) or from pi.registerMcpServer(). They are managed with /mcp and pi mcp list|login|logout, and their runtimes load on first use. Closes #10040
110 lines
4.1 KiB
JSON
110 lines
4.1 KiB
JSON
{
|
|
"name": "@earendil-works/pi-coding-agent",
|
|
"version": "0.87.1",
|
|
"description": "Coding agent CLI with read, bash, edit, write tools and session management",
|
|
"type": "module",
|
|
"piConfig": {
|
|
"configDir": ".pi"
|
|
},
|
|
"bin": {
|
|
"pi": "dist/bundle/cli.js"
|
|
},
|
|
"main": "./dist/index.js",
|
|
"types": "./dist/index.d.ts",
|
|
"exports": {
|
|
".": {
|
|
"types": "./dist/index.d.ts",
|
|
"import": "./dist/index.js"
|
|
},
|
|
"./rpc-entry": {
|
|
"import": "./dist/bundle/rpc-entry.js"
|
|
},
|
|
"./client": {
|
|
"source": "./src/client/index.ts"
|
|
},
|
|
"./experimental/plugin": {
|
|
"source": "./src/experimental/plugin.ts"
|
|
}
|
|
},
|
|
"files": [
|
|
"dist",
|
|
"!dist/client",
|
|
"!dist/experimental",
|
|
"!dist/cli/experimental",
|
|
"docs",
|
|
"examples",
|
|
"containerization.md",
|
|
"CHANGELOG.md",
|
|
"npm-shrinkwrap.json"
|
|
],
|
|
"scripts": {
|
|
"clean": "shx rm -rf dist",
|
|
"build": "npm run build:unbundled && node ../../scripts/build-coding-agent-bundle.mjs",
|
|
"build:unbundled": "tsc -p tsconfig.build.json && shx chmod +x dist/cli.js dist/rpc-entry.js && npm run copy-assets",
|
|
"build:binary": "npm --prefix ../tui run build && npm --prefix ../telemetry run build && npm --prefix ../ai run build && npm --prefix ../agent run build && npm --prefix ../protocol run build && npm --prefix ../client run build && npm run build && bun build --compile --no-compile-autoload-bunfig ./dist/bun/cli.js ./src/utils/image-resize-worker.ts ./src/extensions/codemode/worker.ts --outfile dist/pi && npm run copy-binary-assets",
|
|
"copy-assets": "shx mkdir -p dist/modes/interactive/theme && shx cp src/modes/interactive/theme/*.json dist/modes/interactive/theme/ && shx mkdir -p dist/modes/interactive/assets && shx cp src/modes/interactive/assets/*.png dist/modes/interactive/assets/ && shx mkdir -p dist/core/export-html/vendor && shx cp src/core/export-html/template.html src/core/export-html/template.css src/core/export-html/template.js dist/core/export-html/ && shx cp src/core/export-html/vendor/*.js dist/core/export-html/vendor/",
|
|
"copy-binary-assets": "shx cp package.json dist/ && shx cp README.md dist/ && shx cp CHANGELOG.md dist/ && shx mkdir -p dist/theme && shx cp src/modes/interactive/theme/*.json dist/theme/ && shx mkdir -p dist/assets && shx cp src/modes/interactive/assets/*.png dist/assets/ && shx mkdir -p dist/export-html/vendor && shx cp src/core/export-html/template.html dist/export-html/ && shx cp src/core/export-html/vendor/*.js dist/export-html/vendor/ && shx cp -r docs dist/ && shx cp -r examples dist/ && shx cp ../../node_modules/@silvia-odwyer/photon-node/photon_rs_bg.wasm dist/",
|
|
"test": "vitest --run",
|
|
"shrinkwrap": "node ../../scripts/generate-coding-agent-shrinkwrap.mjs",
|
|
"prepublishOnly": "npm run clean && npm run build && npm run shrinkwrap"
|
|
},
|
|
"dependencies": {
|
|
"@earendil-works/chord": "^0.87.1",
|
|
"@earendil-works/pi-agent-core": "^0.87.1",
|
|
"@earendil-works/pi-ai": "^0.87.1",
|
|
"@earendil-works/pi-codemode": "^0.87.1",
|
|
"@earendil-works/pi-mcp": "^0.87.1",
|
|
"@earendil-works/pi-tui": "^0.87.1",
|
|
"@silvia-odwyer/photon-node": "0.3.4",
|
|
"chalk": "6.0.0",
|
|
"cross-spawn": "7.0.6",
|
|
"diff": "8.0.4",
|
|
"grok-mermaid": "0.2.3",
|
|
"highlight.js": "10.7.3",
|
|
"hosted-git-info": "9.0.3",
|
|
"ignore": "7.0.8",
|
|
"jiti": "2.7.0",
|
|
"minimatch": "10.2.6",
|
|
"proper-lockfile": "4.1.2",
|
|
"quickjs-wasi": "3.6.2",
|
|
"semver": "7.8.5",
|
|
"typebox": "1.3.27",
|
|
"undici": "8.10.2",
|
|
"yaml": "2.9.0"
|
|
},
|
|
"overrides": {
|
|
"protobufjs": "7.6.6"
|
|
},
|
|
"devDependencies": {
|
|
"@earendil-works/pi-client": "^0.87.1",
|
|
"@earendil-works/pi-protocol": "^0.87.1",
|
|
"@earendil-works/pi-server": "^0.87.1",
|
|
"@types/cross-spawn": "6.0.6",
|
|
"@types/hosted-git-info": "3.0.5",
|
|
"@types/node": "22.19.19",
|
|
"@types/proper-lockfile": "4.1.4",
|
|
"@types/semver": "7.7.1",
|
|
"marked": "18.0.11",
|
|
"shx": "0.4.0",
|
|
"vitest": "4.1.9"
|
|
},
|
|
"keywords": [
|
|
"coding-agent",
|
|
"ai",
|
|
"llm",
|
|
"cli",
|
|
"tui",
|
|
"agent"
|
|
],
|
|
"author": "Mario Zechner",
|
|
"license": "MIT",
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "git+https://github.com/earendil-works/pi.git",
|
|
"directory": "packages/coding-agent"
|
|
},
|
|
"engines": {
|
|
"node": ">=22.19.0"
|
|
}
|
|
}
|