refactor(coding-agent): consolidated tool surface onto xd:// devices and hub
- Added the `xd://` virtual device protocol (`internal-urls/xd-protocol.ts`, `tools/xdev.ts`): tools declaring `loadMode: "discoverable"` are unmounted from the request tools array and driven via `read xd://` (list/docs+schema) and `write xd://<tool>` (execute), gated by the `tools.xdev` setting (default on) and inlined into the system prompt. - Merged the `irc`, `job`, and `launch` tools into a single `hub` tool (`tools/hub/`, `async/job-manager.ts`): messaging keeps `send`/`inbox`/`list`, job control maps to `wait`/`cancel`/`jobs`, process supervision keeps `start`/`logs`/`stop`/`restart`/`describe` with `ps`, and the unified `wait` races background jobs against peer messages; SDK `IrcTool`/`JobTool`/`LaunchTool` are replaced by `HubTool`. - Removed the hidden `resolve` tool in favor of the `xd://resolve`/`xd://reject`/`xd://propose` resolution devices, auto-including `write` whenever a deferrable tool or plan mode is present. - Removed the BM25 tool-discovery system: the `search_tool_bm25` tool, the `tool-discovery` module, the `tools.discoveryMode`/`mcp.discoveryMode`/`mcp.discoveryDefaultServers`/`tools.essentialOverride` settings, per-tool MCP selection, and the `mcp_tool_selection` message type. - Unified tool presentation on `ToolLoadMode` (`essential`|`discoverable`), replacing the custom-tool `xdev?: boolean` opt-out; custom, extension, MCP, RPC host, image-generation, and TTS tools now default to `discoverable`, and added a `satisfies` predicate to `SoftToolRequirement`. - Removed the standalone `ssh` command tool and `ssh/ssh-executor` (the `ssh://` read/write/search protocol stays), and made `--tools` address hidden built-ins. - Updated collab-web to render `xd://` dispatches and `hub` op families, dropped the `search_tool_bm25`/`ssh`/`report-finding` renderers, refreshed tool docs and prompts, and migrated the affected tests and changelogs.
This commit is contained in:
@@ -47,7 +47,6 @@ import {
|
||||
BUILTIN_TOOLS,
|
||||
HIDDEN_TOOLS,
|
||||
createTools,
|
||||
ResolveTool,
|
||||
} from "@oh-my-pi/pi-coding-agent";
|
||||
|
||||
// Auth and models setup
|
||||
@@ -108,22 +107,20 @@ await session.prompt("Hello");
|
||||
|
||||
## Resolve preview workflow (AST edit apply/discard)
|
||||
|
||||
`ast_edit` now always returns a preview. To finalize, call hidden `resolve` with a required reason.
|
||||
`ast_edit` now always returns a preview. To finalize, write plain text to the appropriate virtual device with the `write` tool.
|
||||
|
||||
- `action: "apply"` → commit pending preview changes
|
||||
- `action: "discard"` → drop pending preview changes
|
||||
- `reason: string` is required for both paths
|
||||
- `xd://resolve` → apply the pending preview; body = reason text
|
||||
- `xd://reject` → discard the pending preview; body = reason text
|
||||
|
||||
`createAgentSession()` / `createTools()` include `resolve` automatically, even when filtering `toolNames`.
|
||||
If you are composing tools manually, use `HIDDEN_TOOLS.resolve` (or `ResolveTool`) and wire the same `pendingActionStore`.
|
||||
`createAgentSession()` / `createTools()` auto-include `write` whenever a deferrable tool (e.g. `ast_edit`) is present, so the devices are always reachable.
|
||||
|
||||
```typescript
|
||||
const tools = await createTools(toolSession, ["ast_edit"]); // resolve is auto-included
|
||||
const resolveTool = tools.find(t => t.name === "resolve") as ResolveTool;
|
||||
const tools = await createTools(toolSession, ["ast_edit"]); // write is auto-included
|
||||
const writeTool = tools.find(t => t.name === "write")!;
|
||||
|
||||
await resolveTool.execute("call-1", {
|
||||
action: "apply",
|
||||
reason: "Preview matches expected replacements",
|
||||
await writeTool.execute("call-1", {
|
||||
path: "xd://resolve",
|
||||
content: "Preview matches expected replacements",
|
||||
});
|
||||
```
|
||||
## Options
|
||||
|
||||
Reference in New Issue
Block a user