


























@@ -25,24 +25,24 @@ resources.
25252626`@openclaw/sdk` ships with:
272728-| Surface | Status | What it does |
29-| ------------------------- | ------- | ---------------------------------------------------------------------------- |
30-| `OpenClaw` | Ready | Main client entry point. Owns transport, connection, requests, and events. |
31-| `GatewayClientTransport` | Ready | WebSocket transport backed by the Gateway client. |
32-| `oc.agents` | Ready | Lists, creates, updates, deletes, and gets agent handles. |
33-| `Agent.run()` | Ready | Starts a Gateway `agent` run and returns a `Run`. |
34-| `oc.runs` | Ready | Creates, gets, waits for, cancels, and streams runs. |
35-| `Run.events()` | Ready | Streams normalized per-run events with replay for fast runs. |
36-| `Run.wait()` | Ready | Calls `agent.wait` and returns a stable `RunResult`. |
37-| `Run.cancel()` | Ready | Calls `sessions.abort` by run id, with session key when available. |
38-| `oc.sessions` | Ready | Creates, resolves, sends to, patches, compacts, and gets session handles. |
39-| `Session.send()` | Ready | Calls `sessions.send` and returns a `Run`. |
40-| `oc.models` | Ready | Calls `models.list` and the current `models.authStatus` status RPC. |
41-| `oc.tools` | Partial | Lists tool catalog and effective tools; direct tool invocation is not wired. |
42-| `oc.artifacts` | Ready | Lists, gets, and downloads Gateway transcript artifacts. |
43-| `oc.approvals` | Ready | Lists and resolves exec approvals through Gateway approval RPCs. |
44-| `oc.rawEvents()` | Ready | Exposes raw Gateway events for advanced consumers. |
45-| `normalizeGatewayEvent()` | Ready | Converts raw Gateway events into the stable SDK event shape. |
28+| Surface | Status | What it does |
29+| ------------------------- | ------ | -------------------------------------------------------------------------- |
30+| `OpenClaw` | Ready | Main client entry point. Owns transport, connection, requests, and events. |
31+| `GatewayClientTransport` | Ready | WebSocket transport backed by the Gateway client. |
32+| `oc.agents` | Ready | Lists, creates, updates, deletes, and gets agent handles. |
33+| `Agent.run()` | Ready | Starts a Gateway `agent` run and returns a `Run`. |
34+| `oc.runs` | Ready | Creates, gets, waits for, cancels, and streams runs. |
35+| `Run.events()` | Ready | Streams normalized per-run events with replay for fast runs. |
36+| `Run.wait()` | Ready | Calls `agent.wait` and returns a stable `RunResult`. |
37+| `Run.cancel()` | Ready | Calls `sessions.abort` by run id, with session key when available. |
38+| `oc.sessions` | Ready | Creates, resolves, sends to, patches, compacts, and gets session handles. |
39+| `Session.send()` | Ready | Calls `sessions.send` and returns a `Run`. |
40+| `oc.models` | Ready | Calls `models.list` and the current `models.authStatus` status RPC. |
41+| `oc.tools` | Ready | Lists, scopes, and invokes Gateway tools through the policy pipeline. |
42+| `oc.artifacts` | Ready | Lists, gets, and downloads Gateway transcript artifacts. |
43+| `oc.approvals` | Ready | Lists and resolves exec approvals through Gateway approval RPCs. |
44+| `oc.rawEvents()` | Ready | Exposes raw Gateway events for advanced consumers. |
45+| `normalizeGatewayEvent()` | Ready | Converts raw Gateway events into the stable SDK event shape. |
46464747The SDK also exports the core types used by those surfaces:
4848`AgentRunParams`, `RunResult`, `RunStatus`, `OpenClawEvent`,
@@ -216,11 +216,19 @@ await oc.models.list();
216216await oc.models.status({ probe: false }); // calls models.authStatus
217217```
218218219-Tool helpers expose the Gateway catalog and effective tool view:
219+Tool helpers expose the Gateway catalog, effective tool view, and direct
220+Gateway tool invocation. `oc.tools.invoke()` returns a typed envelope instead
221+of throwing for policy or approval refusals.
220222221223```typescript
222224await oc.tools.list();
223225await oc.tools.effective({ sessionKey: "main" });
226+await oc.tools.invoke("tool-name", {
227+ args: { input: "value" },
228+ sessionKey: "main",
229+ confirm: false,
230+ idempotencyKey: "tool-call-1",
231+});
224232```
225233226234Artifact helpers expose the Gateway artifact projection for session, run, or
@@ -256,8 +264,6 @@ await oc.tasks.list();
256264await oc.tasks.get("task-id");
257265await oc.tasks.cancel("task-id");
258266259-await oc.tools.invoke("tool-name", {});
260-261267await oc.environments.list();
262268await oc.environments.create({});
263269await oc.environments.status("environment-id");
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。