@cmdop/sdk 1.0.0 → 1.0.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,16 +1,17 @@
1
1
  # @cmdop/sdk (Node)
2
2
 
3
- Typed Node SDK for CMDOP. A **thin** client: it spawns the baked-in `cmdop-core`
4
- Go binary and speaks a protobuf-length-delimited `Envelope` protocol over its
5
- stdio. All relay logic (REST, the `/ask` SSE stream, pin/confirm side-channels,
6
- retries, error mapping) lives in the Go core.
7
-
8
- - **No Go toolchain, no `cmdop_go` install** — every platform's `cmdop-core`
9
- binary is baked into the one package; the right one is selected at runtime
10
- (no `optionalDependencies`). `npm i @cmdop/sdk` is everything.
11
- - **Pure stdio** — no local port, no socket. Token via `CMDOP_TOKEN` env at spawn.
12
- - **No macOS notarization** — npm-extracted binaries are unquarantined (ad-hoc
13
- signed only).
3
+ ![@cmdop/sdk — Node SDK for CMDOP](https://raw.githubusercontent.com/commandoperator/cmdop-sdk/main/assets/hero-cmdop-node.webp)
4
+
5
+ Typed Node SDK for CMDOP — manage your machines, fleets, tunnels, and schedules,
6
+ stream a machine's AI agent, and drive the skills marketplace, all from typed
7
+ TypeScript.
8
+
9
+ - **One install, zero dependencies** — `npm i @cmdop/sdk` is everything. No
10
+ native build step, no `optionalDependencies`, nothing fetched on first run.
11
+ - **Works anywhere, offline-ready** — a single self-contained package runs the
12
+ same on macOS, Linux, and Windows, including air-gapped hosts.
13
+ - **Typed end to end** — full TypeScript types for every resource and response,
14
+ with one clean async streaming API for live agent output.
14
15
 
15
16
  ## Install
16
17
 
@@ -33,7 +34,7 @@ for (const m of page.items) console.log(m.hostname, m.presence);
33
34
  const text = await c.machines.ask(machineId, "uptime").collect();
34
35
  console.log(text);
35
36
 
36
- await c.close(); // reap the core subprocess
37
+ await c.close(); // release resources
37
38
  ```
38
39
 
39
40
  `await using c = new Client(...)` works too (`Symbol.asyncDispose`).
@@ -58,9 +59,9 @@ List endpoints also expose `iter(...)` (an async generator over every item,
58
59
  following cursors) and `pages(...)` (an async generator over each page).
59
60
 
60
61
  > **Two planes, one client.** `machines / fleets / tunnels / schedules / keys`
61
- > talk to the relay with `CMDOP_TOKEN`; the **`skills`** marketplace lives on the
62
- > platform (Django) and uses the `UserAPIKey` (`CMDOP_API_KEY`). Both are passed
63
- > to the core at spawn; you only set whichever you use.
62
+ > use your relay token (`CMDOP_TOKEN`); the **`skills`** marketplace uses your
63
+ > platform API key (`CMDOP_API_KEY`). Set whichever you need — the client routes
64
+ > each call to the right plane for you.
64
65
 
65
66
  ## Streaming: `machines.ask()`
66
67
 
@@ -100,15 +101,14 @@ pin_denied`. An `error` outcome throws `AgentStreamError`.
100
101
  | `CMDOP_API_BASE_URL` | platform REST root | `https://api.cmdop.com` |
101
102
  | `CMDOP_FLEET_ID` | default fleet for fleet-scoped ops | none |
102
103
  | `CMDOP_TIMEOUT_MS` | per-call timeout | `30000` |
103
- | `CMDOP_CORE_BINARY` | override the baked binary (dev / offline) | baked binary |
104
104
 
105
105
  Precedence is always explicit option > env var > default. Pass a string to the
106
106
  constructor (`new Client("token")`) as a shorthand for `{ token }`.
107
107
 
108
108
  ## Error handling
109
109
 
110
- The core emits a terminal `ERROR` frame; the client maps its `code` to a typed
111
- error (all extend `CmdopError`):
110
+ Every failure surfaces as a typed error carrying a stable `code` (all extend
111
+ `CmdopError`):
112
112
 
113
113
  ```ts
114
114
  import {
@@ -125,19 +125,5 @@ try {
125
125
  }
126
126
  ```
127
127
 
128
- `ConnectionError` also covers the core process dying mid-call (pending
129
- promises reject). `AgentStreamError` is the streaming-`ask` error outcome.
130
-
131
- ## Local development
132
-
133
- Released packages bake in every platform's binary. For local work, build the
134
- core and point the client at it with `CMDOP_CORE_BINARY` (also the offline
135
- escape hatch in production):
136
-
137
- ```bash
138
- cd ../../cmdop_go/go && go build -o /tmp/cmdop-core ./cmd/cmdop-core
139
- CMDOP_CORE_BINARY=/tmp/cmdop-core CMDOP_TOKEN=... node ...
140
- ```
141
-
142
- Tests: `pnpm exec vitest run`. The cross-language parity gate:
143
- `python ../../core/parity/check.py`.
128
+ `ConnectionError` also covers a lost connection mid-call (pending promises
129
+ reject). `AgentStreamError` is the streaming-`ask` error outcome.
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,8 +1,17 @@
1
1
  {
2
2
  "name": "@cmdop/sdk",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Typed Node SDK for CMDOP \u2014 spawns the baked-in cmdop-core Go binary and speaks protobuf over stdio (machines, fleets, tunnels, schedules, keys, and machine AI ask streaming).",
5
5
  "license": "MIT",
6
+ "homepage": "https://github.com/commandoperator/cmdop-sdk/tree/main/node#readme",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/commandoperator/cmdop-sdk.git",
10
+ "directory": "node"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/commandoperator/cmdop-sdk/issues"
14
+ },
6
15
  "type": "module",
7
16
  "main": "./dist/index.cjs",
8
17
  "module": "./dist/index.js",