Simplify 4-layer policy to 3-layer:
- Layer 1: Global allow/deny (user config)
- Layer 2: Provider-specific rules
- Layer 3: Subagent restrictions
Removed:
- ToolProfileId type (minimal/coding/web/full)
- TOOL_PROFILES constant
- getProfilePolicy function
- profile field from ToolsConfig
Users can achieve the same effect using allow/deny with group:* syntax.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Resolve tools before building subagent system prompt so the
"## Tooling" section is included, matching OpenClaw's pattern.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add optional onApprovalNeeded callback to exec tool (backward compatible)
- Thread callback through CreateToolsOptions → AgentOptions → resolveTools
- Add ExecApprovalConfig to ProfileConfig for per-profile configuration
- Create CLI terminal approval callback (readline-based) for non-Hub mode
- Export all exec approval types and functions from tools index
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add minLength:1 to sessions_spawn task parameter to prevent empty
task strings. Remove parentSessionId from AgentOptions as the
subagent registry tracks lineage via requesterSessionId.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Register sessions_spawn tool in the tool system with TypeBox schema.
Subagents are blocked from spawning nested subagents via both tool
policy (DEFAULT_SUBAGENT_TOOL_DENY) and runtime guard. Add group:subagent
tool group and parentSessionId to AgentOptions.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Direct Perplexity API (pplx-*) uses "sonar-pro" model name
- OpenRouter (sk-or-*) uses "perplexity/sonar-pro" model name
- Refactor inferPerplexityBaseUrl to inferPerplexityConfig returning both baseUrl and model
- Export internal functions for potential reuse
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add 'list' action to process tool that displays all registered processes
with their ID, command, status, duration, and source (exec/process).
Example output:
ID COMMAND STATUS DURATION SOURCE
019c139c-dbb7-70ec-ab91-0a7fd2711043 curl -X POST running 15.2s [exec]
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Utilize the onUpdate callback from pi-agent-core's AgentTool interface
to stream output updates in real-time while commands are executing.
- Accept onUpdate as 4th parameter in execute function
- Emit tailBuffer updates on each stdout/stderr data event
- Stop emitting updates once command is backgrounded (yielded)
This enables UI to show live command output progress via the
tool_execution_update agent event.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Previously, when a command exceeded yieldMs (default 5s) and was
auto-backgrounded, exec returned an empty output string. This caused
agents to misinterpret slow commands (like curl) as failed, leading
to infinite retry loops.
Changes:
- Implement three-layer buffer system (pending 30KB + aggregated 200KB + tail 1KB)
- Return collected output snapshot when backgrounding instead of empty string
- Increase default yieldMs from 5s to 10s for better coverage
- Add auto sweeper for terminated process cleanup (30min TTL)
- Register process immediately on spawn to capture all output
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Replace phased roadmap with simple future tools list
- Add Chinese README (README.zh-CN.md)
- Add language switching links between EN/CN docs
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Use spread operator to conditionally add description property
instead of assigning undefined to optional fields.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Use `validation.valid === false` instead of `!validation.valid`
to properly narrow the discriminated union type.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Update createAllTools to accept options object with profileId
- Add memory tools when profileId is provided
- Add group:memory tool group for memory tools
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add architecture diagram showing Hub-Agent-Client relationship and
document how Profile config.json integrates with tools configuration.
Mark Phase 2 as complete.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add mergeToolsConfig function to combine Profile tools config with
CLI options. Profile config serves as base, CLI options override.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Document the 4-layer policy filter system, tool groups, profiles,
and usage examples for both CLI and programmatic interfaces.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Handle undefined values correctly in optional object properties
for TypeScript strict mode compatibility.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add tests for createPinnedLookup, resolvePinnedHostname,
createPinnedDispatcher, and closeDispatcher functions.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* chore(deps): add web tools dependencies
Add undici, @mozilla/readability, linkedom, and turndown for
web fetching and HTML content extraction capabilities.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat(agent): add web_fetch and web_search tools
Port network tools from moltbot with the following features:
web_fetch:
- Fetch and extract readable content from URLs
- Dual extraction mode: readability (smart) or turndown (full page)
- SSRF protection (blocks private IPs, localhost)
- Response caching with TTL
- Redirect handling
web_search:
- Brave Search API for traditional results
- Perplexity API for AI-synthesized answers
- Region/language settings
- Freshness filtering (Brave only)
- Auto-detects provider from available API keys
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat(agent): register web_fetch and web_search tools
Add web tools to the agent's tool registry.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Add a glob tool that allows agents to find files matching glob patterns.
Features:
- Supports standard glob patterns (e.g., **/*.ts, src/**/*.{js,jsx})
- Results sorted by modification time (most recent first)
- Configurable result limit and ignore patterns
- Default ignores for node_modules, .git, dist, etc.
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
* feat(agent): add auto-backgrounding to exec tool
- Add yieldMs parameter to exec tool (default 5s) - commands that don't
complete within this time automatically run in background
- Create shared process-registry.ts for unified process management
- Refactor process.ts to use shared registry
- Add --debug CLI flag for session message logging
- Signal isolation: backgrounded processes ignore abort signals
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix(session): preserve tool_use/tool_result pairs during compaction
Previously, session compaction simply kept the last N messages, which
could break tool_use/tool_result pairs if the cut point fell between
them. This caused "tool_call_id is not found" errors from the API.
Now compaction finds a safe cut point that starts from either:
- A user message without tool_result
- An assistant message whose tool_use is needed by the next tool_result
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat(session): use Kimi as default model for summary compaction
- Auto-detect MOONSHOT_API_KEY from environment
- Use moonshot-v1-128k (cheaper than k2-thinking)
- Fall back to tokens mode if API key not available
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* docs: add rule to never use git commit --amend
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* docs: clarify git amend rule for immediate fixes
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Translate all comments, JSDoc strings, and documentation text from Chinese to English across 19 files for improved accessibility and consistency with the broader developer community.
Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
- Add TTL-based auto-cleanup for terminated processes (1 hour)
- Add 'cleanup' action for manual removal of terminated processes
- Fix buffer overflow when single chunk exceeds MAX_OUTPUT_BUFFER
- Track terminatedAt timestamp for cleanup eligibility
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add Agent Profile module for managing agent identity, soul, tools,
memory, and bootstrap configuration
- Add profile CLI (pnpm agent:profile) for creating/listing/showing profiles
- Default sessionId to UUIDv7 instead of "default"
- Expose Agent.sessionId as public readonly property
- Improve exec/process tools error handling (no more crashes on spawn errors)
- Add 'output' action to process tool for reading stdout/stderr
- Better tool descriptions to guide agent in choosing exec vs process
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>