@cmdop/sdk 1.0.1 → 1.1.0
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
|
@@ -6,6 +6,11 @@ Typed Node SDK for CMDOP — manage your machines, fleets, tunnels, and schedule
|
|
|
6
6
|
stream a machine's AI agent, and drive the skills marketplace, all from typed
|
|
7
7
|
TypeScript.
|
|
8
8
|
|
|
9
|
+
📚 **Docs: [docs.cmdop.com](https://docs.cmdop.com)** · [SDK](https://cmdop.com/sdk) ·
|
|
10
|
+
[Bots](https://cmdop.com/bots) · [Connect](https://cmdop.com/connect)
|
|
11
|
+
|
|
12
|
+

|
|
13
|
+
|
|
9
14
|
- **One install, zero dependencies** — `npm i @cmdop/sdk` is everything. No
|
|
10
15
|
native build step, no `optionalDependencies`, nothing fetched on first run.
|
|
11
16
|
- **Works anywhere, offline-ready** — a single self-contained package runs the
|
|
@@ -88,6 +93,18 @@ for await (const frame of stream) {
|
|
|
88
93
|
const text = await c.machines.ask(machineId, "uptime").collect();
|
|
89
94
|
```
|
|
90
95
|
|
|
96
|
+
**Connection PIN.** If a machine requires a PIN, pass it **upfront** — the SDK is
|
|
97
|
+
headless, so there's no prompt to answer:
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
const text = await c.machines.ask(machineId, "uptime", { pin: "1234" }).collect();
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
A wrong PIN throws `PinDeniedError`; an unverified one throws `PinTimeoutError`
|
|
104
|
+
(both extend `PermissionError`, non-retryable). The reactive `stream.pin(...)`
|
|
105
|
+
callback above is for interactive use (a human at a prompt). The relay never
|
|
106
|
+
stores the PIN — it forwards it once to the target, which verifies it locally.
|
|
107
|
+
|
|
91
108
|
Frame types: `event · done · error · confirm_required · pin_required ·
|
|
92
109
|
pin_denied`. An `error` outcome throws `AgentStreamError`.
|
|
93
110
|
|
|
@@ -114,16 +131,30 @@ Every failure surfaces as a typed error carrying a stable `code` (all extend
|
|
|
114
131
|
import {
|
|
115
132
|
AuthError, PermissionError, NotFoundError, ConflictError,
|
|
116
133
|
ValidationError, RateLimitError, ServerError, ConnectionError,
|
|
117
|
-
AgentStreamError, CmdopError,
|
|
134
|
+
TimeoutError, UnavailableError, AgentStreamError, CmdopError,
|
|
118
135
|
} from "@cmdop/sdk";
|
|
119
136
|
|
|
120
137
|
try {
|
|
121
138
|
await c.machines.get("missing-id");
|
|
122
139
|
} catch (e) {
|
|
123
140
|
if (e instanceof NotFoundError) { /* ... */ }
|
|
124
|
-
else if (e instanceof CmdopError)
|
|
141
|
+
else if (e instanceof CmdopError) {
|
|
142
|
+
if (e.retryable) { /* true on TimeoutError — safe to retry */ }
|
|
143
|
+
console.log(e.code, e.message);
|
|
144
|
+
}
|
|
125
145
|
}
|
|
126
146
|
```
|
|
127
147
|
|
|
128
|
-
`ConnectionError`
|
|
129
|
-
|
|
148
|
+
`ConnectionError` covers a lost connection mid-call (pending promises reject);
|
|
149
|
+
`TimeoutError` (a retryable subclass) is a deadline/handshake timeout;
|
|
150
|
+
`UnavailableError` means the relay is up but the target agent/machine is offline.
|
|
151
|
+
`AgentStreamError` is the streaming-`ask` error outcome.
|
|
152
|
+
|
|
153
|
+
## Links
|
|
154
|
+
|
|
155
|
+
- **Docs** → [docs.cmdop.com](https://docs.cmdop.com)
|
|
156
|
+
- **SDK** → [cmdop.com/sdk](https://cmdop.com/sdk) · **Bots** →
|
|
157
|
+
[cmdop.com/bots](https://cmdop.com/bots) · **Connect** →
|
|
158
|
+
[cmdop.com/connect](https://cmdop.com/connect)
|
|
159
|
+
- [`@cmdop/sdk` on npm](https://www.npmjs.com/package/@cmdop/sdk) ·
|
|
160
|
+
[source](https://github.com/commandoperator/cmdop-sdk)
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/bin/cmdop-core-linux-x64
CHANGED
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cmdop/sdk",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
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://
|
|
6
|
+
"homepage": "https://docs.cmdop.com",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "git+https://github.com/commandoperator/cmdop-sdk.git",
|