mirror of
https://github.com/earendil-works/pi.git
synced 2026-10-02 00:35:27 +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
74 lines
4.9 KiB
JSON
74 lines
4.9 KiB
JSON
{
|
|
"name": "pi-monorepo",
|
|
"private": true,
|
|
"type": "module",
|
|
"workspaces": [
|
|
"packages/*",
|
|
"packages/session-backends/*",
|
|
"packages/coding-agent/examples/extensions/with-deps",
|
|
"packages/coding-agent/examples/extensions/custom-provider-anthropic",
|
|
"packages/coding-agent/examples/extensions/custom-provider-gitlab-duo",
|
|
"packages/coding-agent/examples/extensions/sandbox",
|
|
"packages/coding-agent/examples/extensions/gondolin"
|
|
],
|
|
"scripts": {
|
|
"clean": "npm run clean --workspaces",
|
|
"build": "cd packages/chord && npm run build && cd ../tui && npm run build && cd ../telemetry && npm run build && cd ../codemode && npm run build && cd ../mcp && npm run build && cd ../ai && npm run build && cd ../durable && npm run build && cd ../agent && npm run build && cd ../session-backends/sqlite-node && npm run build && cd ../../protocol && npm run build && cd ../client && npm run build && cd ../server && npm run build && cd ../coding-agent && npm run build",
|
|
"build:offline": "cd packages/chord && npm run build && cd ../tui && npm run build && cd ../telemetry && npm run build && cd ../codemode && npm run build && cd ../mcp && npm run build && cd ../ai && npm run build:offline && cd ../durable && npm run build && cd ../agent && npm run build && cd ../session-backends/sqlite-node && npm run build && cd ../../protocol && npm run build && cd ../client && npm run build && cd ../server && npm run build && cd ../coding-agent && npm run build",
|
|
"build:native:darwin": "npm --prefix packages/tui run build:native:darwin",
|
|
"build:native:linux": "npm --prefix packages/tui run build:native:linux",
|
|
"build:native:win32": "npm --prefix packages/tui run build:native:win32",
|
|
"check": "biome check --write --error-on-warnings . && npm run check:pinned-deps && npm run check:runtime-deps && npm run check:ts-imports && npm run check:entry-graphs && npm run check:shrinkwrap && npm run check:install-lock:coding-agent && tsc --noEmit && npm run check:browser-smoke",
|
|
"check:browser-smoke": "node scripts/check-browser-smoke.mjs",
|
|
"check:pinned-deps": "node scripts/check-pinned-deps.mjs",
|
|
"check:runtime-deps": "node scripts/check-runtime-deps.mjs",
|
|
"check:package-install": "node scripts/coding-agent-consumer.mjs",
|
|
"check:shrinkwrap": "node scripts/generate-coding-agent-shrinkwrap.mjs --check",
|
|
"check:install-lock:coding-agent": "node scripts/generate-coding-agent-install-lock.mjs --check",
|
|
"check:ts-imports": "node scripts/check-ts-relative-imports.mjs",
|
|
"check:entry-graphs": "node scripts/check-entry-graphs.mjs",
|
|
"generate:models": "npm --prefix packages/ai run generate-models",
|
|
"hydrate:model-data": "npm --prefix packages/ai run hydrate-model-data",
|
|
"check:model-data": "npm --prefix packages/ai run check:model-data",
|
|
"generate:model-catalog": "npm --prefix packages/ai run generate-model-catalog",
|
|
"diff:model-catalog": "node scripts/diff-model-catalog.mjs",
|
|
"eval": "npm run eval --workspace=@earendil-works/pi-evals --",
|
|
"check:model-catalog": "node scripts/publish-model-catalog.mjs --input .artifacts/model-catalog --dry-run",
|
|
"profile:tui": "node scripts/profile-coding-agent-node.mjs --mode tui",
|
|
"profile:rpc": "node scripts/profile-coding-agent-node.mjs --mode rpc",
|
|
"test": "npm run test:scripts && npm run test --workspaces --if-present",
|
|
"test:scripts": "node --test scripts/*.test.mjs scripts/*.test.ts",
|
|
"version:patch": "npm version patch --workspaces --no-git-tag-version --no-workspaces-update && node scripts/sync-versions.js && npm install --package-lock-only --ignore-scripts",
|
|
"version:minor": "npm version minor --workspaces --no-git-tag-version --no-workspaces-update && node scripts/sync-versions.js && npm install --package-lock-only --ignore-scripts",
|
|
"version:major": "npm version major --workspaces --no-git-tag-version --no-workspaces-update && node scripts/sync-versions.js && npm install --package-lock-only --ignore-scripts",
|
|
"version:set": "npm version --workspaces --no-workspaces-update",
|
|
"prepublishOnly": "npm run clean && npm run build && npm run check",
|
|
"publish": "npm run prepublishOnly && node scripts/publish.mjs",
|
|
"publish:dry": "npm run prepublishOnly && node scripts/publish.mjs --dry-run",
|
|
"release:local": "node scripts/local-release.mjs",
|
|
"shrinkwrap:coding-agent": "node scripts/generate-coding-agent-shrinkwrap.mjs",
|
|
"install-lock:coding-agent": "node scripts/generate-coding-agent-install-lock.mjs",
|
|
"release:patch": "node scripts/release.mjs patch",
|
|
"release:minor": "node scripts/release.mjs minor",
|
|
"release:major": "node scripts/release.mjs major",
|
|
"release:fix-links": "node scripts/release-notes.mjs fix-github-releases",
|
|
"prepare": "husky"
|
|
},
|
|
"devDependencies": {
|
|
"@anthropic-ai/sandbox-runtime": "0.0.26",
|
|
"@biomejs/biome": "2.3.5",
|
|
"@types/node": "22.19.19",
|
|
"esbuild": "0.28.2",
|
|
"husky": "9.1.7",
|
|
"shx": "0.4.0",
|
|
"typescript": "7.0.2"
|
|
},
|
|
"engines": {
|
|
"node": ">=22.19.0"
|
|
},
|
|
"version": "0.0.3",
|
|
"overrides": {
|
|
"protobufjs": "7.6.6"
|
|
}
|
|
}
|