@cmdop/sdk 3.6.0 → 3.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,41 +1,61 @@
1
1
  # @cmdop/sdk
2
2
 
3
- Your machines' tools from a program: the same tools agents use through MCP, typed.
3
+ Your computers' tools from TypeScript. Use the same tools AI agents call through MCP, with typed
4
+ arguments and results, your agent's grant and a record of each call.
4
5
 
5
6
  ```bash
6
7
  npm install @cmdop/sdk
7
8
  ```
8
9
 
10
+ Requires Node.js 20+. [Install CMDOP](https://cmdop.ai/download) on a computer, bring it online on
11
+ your page and create an agent token in the Agents tab. Set `CMDOP_URL` to your page's address
12
+ (`https://<address>.cmdop.dev`) and `CMDOP_TOKEN` to that token through your environment.
13
+ The SDK package does not install the machine program. Start with the `read` risk class.
14
+
9
15
  ```ts
10
16
  import { connect } from "@cmdop/sdk";
11
17
 
12
- const cmdop = connect(); // CMDOP_TOKEN, CMDOP_URL
13
- const box = cmdop.machine("box");
14
- console.log((await box.run("uptime")).stdout);
18
+ const client = connect();
19
+ try {
20
+ const online = (await client.machines()).find((machine) => machine.online);
21
+ if (!online) throw new Error("Bring a machine online on your CMDOP page.");
22
+ const info = await client.machine(online.id).sys.info({});
23
+ console.log(info.os, info.arch, info.cpus);
24
+ } finally {
25
+ await client.close();
26
+ }
27
+ ```
28
+
29
+ The program prints the selected computer's OS, architecture and CPU count.
30
+ Use an explicit machine id when the target matters.
31
+
32
+ ## Commands and streaming
15
33
 
16
- const run = box.stream("make test");
34
+ Inside the connected client's `try` block, with `exec` allowed for the agent and machine:
35
+
36
+ ```ts
37
+ const box = client.machine("<machine>");
38
+ console.log((await box.run("uptime")).stdout);
39
+ const run = box.stream("printf 'hello\\n'");
17
40
  for await (const piece of run) process.stdout.write(piece.data);
18
41
  console.log((await run.result).exit_code);
19
42
  ```
20
43
 
21
- Every tool is a typed method on a machine (`box.fs_read({ path })`, `box.task_start({ command })`, …), also under
22
- its group (`box.fs.read({ path })`, `box.task.start({ command })`); `box.screenshot()` decodes the picture; and
23
- `cmdop.call(tool, args, { machine })` reaches any of them by name. A refused call throws `CmdopError` with its
24
- `code`; `deadline` and `signal` bound and cancel any call.
25
-
26
- The tools the server answers itself are methods of the client, with no machine: `cmdop.machines_list()`,
27
- `cmdop.tasks_list()`, `cmdop.history_search({ text })`, `cmdop.docs_read({ path })` (the docs, contents first) and
28
- `cmdop.showtime_guide({ language })`, the guide for a short live demo of what your machines can do.
44
+ `box.fs.read({ path })` and `box.fs_read({ path })` call the same typed tool.
45
+ `box.screenshot()` decodes the image. `client.tasks_list()` and `client.docs_read()` need no
46
+ machine. Installed AI agents are available through `box.agent.*` with the `agent` risk class.
29
47
 
30
- A machine also lets you ask the AI agent programs installed on it (Claude Code, Codex), the same way for each:
31
- `box.agent.list({})` names them, `box.agent.prompt({ prompt, session? })` returns the answer and a `session` to
32
- continue, `box.agent.sessions({})` and `box.agent.cancel({ task })`. The agents answer in words or read files, never
33
- run commands; the token needs the `agent` class and the machine's `ceiling.json` its `agents` key.
48
+ ## Deadlines and errors
34
49
 
35
- ## The same tools over MCP
50
+ Pass `{ deadline: 5_000, signal: controller.signal }` as call options: deadlines use milliseconds
51
+ and `AbortSignal` cancels a call. For `run`, options are its third argument:
52
+ `box.run("uptime", {}, { deadline: 5_000 })`.
53
+ Branch on `CmdopError.code`; `CarrierError` means a connection failed before an answer arrived.
54
+ Python's deadline units differ; check the language reference.
36
55
 
37
- CMDOP is an MCP server too: an agent reaches these tools at `$CMDOP_URL/mcp` (streamable HTTP) with an agent token
38
- as `Authorization: Bearer`, the same kind of token this package takes, under the same grant and record. The
39
- command or settings for each client: https://docs.cmdop.ai/guides/connect
56
+ [Quickstart](https://docs.cmdop.ai/reference/sdk/quickstart) ·
57
+ [TypeScript API](https://docs.cmdop.ai/reference/sdk/typescript) ·
58
+ [MCP client setup](https://docs.cmdop.ai/guides/connect) ·
59
+ [Source and issues](https://github.com/commandoperator/cmdop-sdk)
40
60
 
41
- Website: https://cmdop.ai · Docs: https://docs.cmdop.ai/reference/sdk/typescript · License: MIT
61
+ License: MIT.
@@ -1,4 +1,4 @@
1
- // Generated from cmdop/crates/tools/tools.schema.json (sha256 7128f6bbae917b61, cmdop 0.1.16) by exports/sdk/gen/gen.ts. Do not edit.
1
+ // Generated from cmdop/crates/tools/tools.schema.json (sha256 cef76f12c6264508, cmdop 0.1.16) by exports/sdk/gen/gen.ts. Do not edit.
2
2
  /** Every error code, in the order Rust declares them. */
3
3
  export const ERROR_CODES = ["other", "denied", "unknown_tool", "bad_args", "not_found", "busy", "permission_missing", "screen_locked", "stale_capture", "element_gone", "app_not_allowed", "lease_paused", "paused", "offline", "rate_limited", "quota_exceeded", "not_dispatched", "display_gone", "timed_out", "cancelled", "too_large", "hash_required", "failed", "needs_presence", "unauthorized", "tool_refused", "sandbox_unavailable"];
4
4
  /** The size limits every carrier keeps. */
@@ -1,4 +1,4 @@
1
- // Generated from cmdop/crates/tools/tools.schema.json (sha256 7128f6bbae917b61, cmdop 0.1.16) by exports/sdk/gen/gen.ts. Do not edit.
1
+ // Generated from cmdop/crates/tools/tools.schema.json (sha256 cef76f12c6264508, cmdop 0.1.16) by exports/sdk/gen/gen.ts. Do not edit.
2
2
  /** Title and description of every server tool, as the server lists them. */
3
3
  export const SERVER_TOOLS = {
4
4
  docs_read: { title: "Read the docs", description: "Call before answering how CMDOP works, is set up or is priced: no `path` lists every page of docs.cmdop.ai (path and title); a `path` returns that page as Markdown." },
@@ -1,4 +1,4 @@
1
- // Generated from cmdop/crates/tools/tools.schema.json (sha256 7128f6bbae917b61, cmdop 0.1.16) by exports/sdk/gen/gen.ts. Do not edit.
1
+ // Generated from cmdop/crates/tools/tools.schema.json (sha256 cef76f12c6264508, cmdop 0.1.16) by exports/sdk/gen/gen.ts. Do not edit.
2
2
  /** Group, then method, then the tool it calls. */
3
3
  export const GROUPS = {
4
4
  agent: { cancel: "agent_cancel", list: "agent_list", prompt: "agent_prompt", sessions: "agent_sessions" },
@@ -1,4 +1,4 @@
1
- // Generated from cmdop/crates/tools/tools.schema.json (sha256 7128f6bbae917b61, cmdop 0.1.16) by exports/sdk/gen/gen.ts. Do not edit.
1
+ // Generated from cmdop/crates/tools/tools.schema.json (sha256 cef76f12c6264508, cmdop 0.1.16) by exports/sdk/gen/gen.ts. Do not edit.
2
2
  /** Risk class, version and description of every tool, as the server lists them. */
3
3
  export const TOOLS = {
4
4
  agent_cancel: { risk: "agent", added: "0.1.13", timeoutSecs: 15, description: "Stops a running agent_prompt by its task. What the agent did until then stays done." },
package/dist/version.d.ts CHANGED
@@ -3,4 +3,4 @@
3
3
  * record shows which SDK made a call. The release tool rewrites it together with `package.json`; a test keeps the two
4
4
  * equal.
5
5
  */
6
- export declare const VERSION = "3.5.0";
6
+ export declare const VERSION = "3.6.1";
package/dist/version.js CHANGED
@@ -3,4 +3,4 @@
3
3
  * record shows which SDK made a call. The release tool rewrites it together with `package.json`; a test keeps the two
4
4
  * equal.
5
5
  */
6
- export const VERSION = "3.5.0";
6
+ export const VERSION = "3.6.1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmdop/sdk",
3
- "version": "3.6.0",
3
+ "version": "3.6.1",
4
4
  "description": "Your machines' tools from a program: the same tools agents use through MCP, typed from Rust.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://cmdop.ai",