src/agent/runner.ts | Entry point, stdin parse, agent dispatch, IPC transport selection. | run(), parseStdinPayload(), compactHistory(), historyToPiMessages(), AgentConfig, IIPCClient |
src/agent/ipc-client.ts | Length-prefixed Unix socket IPC with heartbeat keep-alive | IPCClient (connect, call, disconnect, reconnect) |
src/agent/http-ipc-client.ts | HTTP-based IPC client for k8s pods (drop-in replacement for IPCClient) | HttpIPCClient, HttpIPCClientOptions |
src/agent/skill-installer.ts | Skill dependency installer — reads SKILL.md install specs, runs missing installs. Not called eagerly; agent runs install commands via bash when it uses a skill. | installSkillDeps() |
src/agent/stream-utils.ts | Shared pi-ai message conversion and stream event utilities | convertPiMessages(), emitStreamEvents() |
src/agent/heartbeat-state.ts | Heartbeat check state persistence (last-run timestamps) | HeartbeatState |
src/agent/local-sandbox.ts | Agent-side local sandbox executor; runs bash/file tools in-container with host audit gate | createLocalSandbox(), LocalSandboxOptions |
src/agent/tool-catalog.ts | Single source of truth for tool metadata, context-aware filtering, plugin commands, and Cowork plugin tools | TOOL_CATALOG, filterTools(), ToolFilterContext, normalizeOrigin(), normalizeIdentityFile() |
src/agent/prompt/modules/commands.ts | Plugin commands prompt module (priority 72) — surfaces installed plugin slash commands | CommandsModule |
src/agent/ipc-tools.ts | Tools that proxy to host via IPC (pi-session runner) | createIPCTools(client, opts) |
src/agent/tools/describe-tools.ts | Agent-side factory stubs for the describe_tools + call_tool meta-tools (indirect dispatch mode). Catalog entries in tool-catalog.ts plumb the real wiring; the factories exist for isolated unit tests and Task 4.x hook points (projection, spill). | createDescribeToolsTool(), createCallToolTool() |
src/host/ipc-handlers/sandbox-tools.ts | IPC handlers for bash/file ops (host-side, subprocess mode only) | createSandboxToolHandlers() |
src/agent/identity-loader.ts | Loads identity files from preloaded stdin payload (or filesystem fallback) | loadIdentityFiles(opts) |
src/agent/agent-setup.ts | Shared setup: prompt building, event subscription, tool filtering | buildSystemPrompt(), subscribeAgentEvents() |
src/agent/prompt/builder.ts | Assembles system prompt from ordered modules | PromptBuilder, PromptResult |
src/agent/prompt/types.ts | PromptContext, PromptModule interface, IdentityFiles | PromptContext, PromptModule, IdentityFiles |
src/agent/ipc-transport.ts | IPC LLM stream function; converts IPC responses to pi-ai events with image block support | createIPCStreamFn() |
src/agent/web-proxy-bridge.ts | TCP-to-Unix-socket bridge for HTTP forward proxy. Loopback listener (127.0.0.1) forwards to host web proxy via mounted Unix socket. Handles both HTTP forwarding and HTTPS CONNECT tunneling. Same pattern as tcp-bridge.ts | startWebProxyBridge(), WebProxyBridge |
src/agent/proxy-stream.ts | Proxy-based LLM stream function; routes via credential-injecting proxy | createProxyStreamFn(), makeProxyErrorMessage() |
src/agent/runners/pi-session.ts | pi-coding-agent runner variant with proxy or IPC LLM transport | runPiSession() |
src/agent/runners/claude-code.ts | Claude Code runner variant with Agent SDK | runClaudeCode(), buildSDKPrompt() |
src/agent/mcp-server.ts | MCP tool registry for claude-code runner | createIPCMcpServer(), MCPServerOptions |
src/agent/git-cli.ts | Native git CLI wrapper (execFile, no shell). Supports separate gitdir via GIT_DIR/GIT_WORK_TREE env vars | gitExec(), gitClone(), gitFetch(), gitResetHard(), gitCommit(), gitPush(), GitOpts |
src/agent/git-sidecar.ts | K8s sidecar HTTP server for git ops. Runs in separate container, manages .git directory. HTTP endpoints: POST /pull, POST /turn-complete, GET /health | startGitSidecar() |
src/agent/git-workspace.ts | Agent-side git workspace wrapper for non-k8s mode. Clone, pull, commit+push lifecycle | GitWorkspace (clone, init, pull, commitAndPush) |