Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
5407fc3
chore: add vendor dependencies (@anthropic-ai/sdk, diff, partial-json)
Redux0223 Mar 30, 2026
7bee988
chore: add pi-mono provenance manifest and sync script
Redux0223 Mar 30, 2026
9b8e515
chore: sync raw pi-mono source (21 files, unadapted)
Redux0223 Mar 30, 2026
a1cd057
feat: add SDK-native tool interface and result helpers
Redux0223 Mar 30, 2026
fc5f654
feat: adapt anthropic types and provider utilities from pi-mono
Redux0223 Mar 30, 2026
60bfd03
feat: adapt anthropic streaming provider from pi-mono
Redux0223 Mar 30, 2026
79d6376
feat: adapt agent loop types from pi-mono
Redux0223 Mar 30, 2026
c10213e
feat: adapt agent loop core from pi-mono
Redux0223 Mar 30, 2026
cd084b3
feat: adapt shared tool utilities from pi-mono
Redux0223 Mar 30, 2026
3a0b177
feat: vendor read tool from pi-mono
Redux0223 Mar 30, 2026
606d498
feat: vendor write tool from pi-mono
Redux0223 Mar 30, 2026
902353f
feat: vendor edit tool + fuzzy matching from pi-mono
Redux0223 Mar 30, 2026
e3c1e87
fix: correct truncation field names and add diff types
Redux0223 Mar 30, 2026
22c6bd3
feat: add process registry for backgrounded exec sessions
Redux0223 Mar 30, 2026
f44aa9b
feat: vendor exec tool (renamed from pi-mono bash)
Redux0223 Mar 30, 2026
e53f2a0
feat: vendor process tool for backgrounded session management
Redux0223 Mar 30, 2026
279ad92
feat: vendor SSRF guard from openclaw
Redux0223 Mar 30, 2026
0030e64
feat: vendor web_fetch tool from openclaw
Redux0223 Mar 30, 2026
20ffd7f
feat: add web_search tool (Brave Search API)
Redux0223 Mar 30, 2026
3400581
feat: vendor browser tool schema from openclaw
Redux0223 Mar 30, 2026
9dd0b78
feat: vendor browser tool (host mode only) from openclaw
Redux0223 Mar 30, 2026
244d87b
feat: add tool assembly and anthropicApiKey option
Redux0223 Mar 30, 2026
e01ff41
feat: wire anthropic agentic loop into sdk session
Redux0223 Mar 30, 2026
2ed1149
test: fix session to only use explicitly configured API key
Redux0223 Mar 30, 2026
56cbb8c
chore: finalize provenance manifests
Redux0223 Mar 30, 2026
847817e
fix: address review feedback (points 2, 3, 4)
Redux0223 Mar 30, 2026
b0eac76
refactor: wire vendored agent loop into session, remove inline loop
Redux0223 Mar 30, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
134 changes: 134 additions & 0 deletions manifests/pi-mono-provenance.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
{
"version": 1,
"sourceRepo": "https://github.com/badlogic/pi-mono.git",
"license": "MIT",
"upstreamSha": "cb4e4d8c",
"entries": [
{
"upstream": "packages/coding-agent/src/core/tools/read.ts",
"destination": "src/tools/file/read.ts",
"mode": "adapted",
"adaptations": ["TypeBox→Zod, stripped TUI rendering, replaced AgentTool with OpenClawTool"]
},
{
"upstream": "packages/coding-agent/src/core/tools/write.ts",
"destination": "src/tools/file/write.ts",
"mode": "adapted",
"adaptations": ["TypeBox→Zod, stripped TUI rendering, replaced AgentTool with OpenClawTool"]
},
{
"upstream": "packages/coding-agent/src/core/tools/edit.ts",
"destination": "src/tools/file/edit.ts",
"mode": "adapted",
"adaptations": ["TypeBox→Zod, stripped TUI rendering, replaced AgentTool with OpenClawTool"]
},
{
"upstream": "packages/coding-agent/src/core/tools/edit-diff.ts",
"destination": "src/tools/file/edit-diff.ts",
"mode": "adapted",
"adaptations": ["Fixed import path for path-utils"]
},
{
"upstream": "packages/coding-agent/src/core/tools/bash.ts",
"destination": "src/tools/exec/exec.ts",
"mode": "adapted",
"adaptations": ["TypeBox→Zod, stripped TUI, renamed bash→exec, added background/yield from openclaw"]
},
{
"upstream": "packages/coding-agent/src/core/tools/truncate.ts",
"destination": "src/tools/shared/truncate.ts",
"mode": "copied",
"adaptations": ["No changes needed"]
},
{
"upstream": "packages/coding-agent/src/core/tools/path-utils.ts",
"destination": "src/tools/shared/path-utils.ts",
"mode": "copied",
"adaptations": ["No changes needed"]
},
{
"upstream": "packages/coding-agent/src/core/tools/file-mutation-queue.ts",
"destination": "src/tools/shared/file-mutation-queue.ts",
"mode": "copied",
"adaptations": ["No changes needed"]
},
{
"upstream": "packages/coding-agent/src/utils/shell.ts",
"destination": "src/tools/shared/shell.ts",
"mode": "adapted",
"adaptations": ["Replaced SettingsManager/getBinDir with SHELL env var and defaults"]
},
{
"upstream": "packages/coding-agent/src/utils/child-process.ts",
"destination": "src/tools/shared/child-process.ts",
"mode": "copied",
"adaptations": ["No changes needed"]
},
{
"upstream": "packages/coding-agent/src/utils/mime.ts",
"destination": "src/tools/shared/mime.ts",
"mode": "adapted",
"adaptations": ["Replaced file-type npm dep with inline magic byte detection"]
},
{
"upstream": "packages/agent/src/agent-loop.ts",
"destination": "src/loop/agent-loop.ts",
"mode": "adapted",
"adaptations": ["Replaced @mariozechner/pi-ai imports with local providers, added inline validateToolArguments"]
},
{
"upstream": "packages/agent/src/types.ts",
"destination": "src/loop/agent-types.ts",
"mode": "adapted",
"adaptations": ["Replaced @mariozechner/pi-ai imports, replaced TSchema with any"]
},
{
"upstream": "packages/ai/src/providers/anthropic.ts",
"destination": "src/providers/anthropic.ts",
"mode": "adapted",
"adaptations": ["Removed stealth mode, OAuth/Claude Code identity, GitHub Copilot, fixed imports"]
},
{
"upstream": "packages/ai/src/providers/simple-options.ts",
"destination": "src/providers/simple-options.ts",
"mode": "adapted",
"adaptations": ["Fixed import path to anthropic-types.js"]
},
{
"upstream": "packages/ai/src/providers/transform-messages.ts",
"destination": "src/providers/transform-messages.ts",
"mode": "adapted",
"adaptations": ["Fixed import path to anthropic-types.js"]
},
{
"upstream": "packages/ai/src/utils/event-stream.ts",
"destination": "src/providers/event-stream.ts",
"mode": "adapted",
"adaptations": ["Fixed import path to anthropic-types.js"]
},
{
"upstream": "packages/ai/src/utils/json-parse.ts",
"destination": "src/providers/json-parse.ts",
"mode": "copied",
"adaptations": ["No changes needed"]
},
{
"upstream": "packages/ai/src/utils/sanitize-unicode.ts",
"destination": "src/providers/sanitize-unicode.ts",
"mode": "copied",
"adaptations": ["No changes needed"]
},
{
"upstream": "packages/ai/src/types.ts",
"destination": "src/providers/anthropic-types.ts",
"mode": "adapted",
"adaptations": ["Removed non-Anthropic providers/APIs, removed TypeBox dependency, removed compat types"]
},
{
"upstream": "packages/ai/src/env-api-keys.ts",
"destination": "src/providers/env-api-keys.ts",
"mode": "adapted",
"adaptations": ["Simplified to Anthropic-only (removed all other provider key lookups)"]
}
]
}
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
"test:e2e": "node scripts/package-smoke.mjs"
},
"dependencies": {
"@anthropic-ai/sdk": "^0.80.0",
"diff": "^7.0.0",
"partial-json": "^0.1.7",
"zod": "^4.3.6"
},
"devDependencies": {
Expand Down
55 changes: 55 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

65 changes: 65 additions & 0 deletions scripts/sync-from-pi-mono.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/usr/bin/env node
import fs from "node:fs";
import path from "node:path";

const PI_MONO_ROOT = process.env.PI_MONO_ROOT || process.argv[2];
if (!PI_MONO_ROOT) {
console.error("Usage: PI_MONO_ROOT=/path/to/pi-mono node scripts/sync-from-pi-mono.mjs");
console.error(" or: node scripts/sync-from-pi-mono.mjs /path/to/pi-mono");
process.exit(1);
}
const MANIFEST_PATH = "manifests/pi-mono-provenance.json";

// File map: source (relative to PI_MONO_ROOT) -> destination (relative to repo root)
const FILE_MAP = {
// tools
"packages/coding-agent/src/core/tools/read.ts": "src/tools/file/read.ts",
"packages/coding-agent/src/core/tools/write.ts": "src/tools/file/write.ts",
"packages/coding-agent/src/core/tools/edit.ts": "src/tools/file/edit.ts",
"packages/coding-agent/src/core/tools/edit-diff.ts": "src/tools/file/edit-diff.ts",
"packages/coding-agent/src/core/tools/bash.ts": "src/tools/exec/exec.ts",
"packages/coding-agent/src/core/tools/truncate.ts": "src/tools/shared/truncate.ts",
"packages/coding-agent/src/core/tools/path-utils.ts": "src/tools/shared/path-utils.ts",
"packages/coding-agent/src/core/tools/file-mutation-queue.ts": "src/tools/shared/file-mutation-queue.ts",
// utils
"packages/coding-agent/src/utils/shell.ts": "src/tools/shared/shell.ts",
"packages/coding-agent/src/utils/child-process.ts": "src/tools/shared/child-process.ts",
"packages/coding-agent/src/utils/mime.ts": "src/tools/shared/mime.ts",
// agent loop
"packages/agent/src/agent-loop.ts": "src/loop/agent-loop.ts",
"packages/agent/src/types.ts": "src/loop/agent-types.ts",
// anthropic provider
"packages/ai/src/providers/anthropic.ts": "src/providers/anthropic.ts",
"packages/ai/src/providers/simple-options.ts": "src/providers/simple-options.ts",
"packages/ai/src/providers/transform-messages.ts": "src/providers/transform-messages.ts",
"packages/ai/src/utils/event-stream.ts": "src/providers/event-stream.ts",
"packages/ai/src/utils/json-parse.ts": "src/providers/json-parse.ts",
"packages/ai/src/utils/sanitize-unicode.ts": "src/providers/sanitize-unicode.ts",
"packages/ai/src/types.ts": "src/providers/anthropic-types.ts",
"packages/ai/src/env-api-keys.ts": "src/providers/env-api-keys.ts",
};

console.log("Syncing from pi-mono...");
const manifest = JSON.parse(fs.readFileSync(MANIFEST_PATH, "utf-8"));
manifest.entries = [];

for (const [src, dest] of Object.entries(FILE_MAP)) {
const srcPath = path.join(PI_MONO_ROOT, src);
if (!fs.existsSync(srcPath)) {
console.error(`MISSING: ${srcPath}`);
process.exit(1);
}
const destDir = path.dirname(dest);
fs.mkdirSync(destDir, { recursive: true });
fs.copyFileSync(srcPath, dest);
manifest.entries.push({
upstream: src,
destination: dest,
mode: "adapted",
adaptations: ["pending — see task-specific commits"],
});
console.log(` ${src} -> ${dest}`);
}

fs.writeFileSync(MANIFEST_PATH, JSON.stringify(manifest, null, 2) + "\n");
console.log(`Manifest updated: ${manifest.entries.length} entries`);
Loading
Loading