@cmdop/sdk 1.1.0 → 2.0.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 +87 -114
- package/bin/cmdop-core-darwin-arm64 +0 -0
- package/bin/cmdop-core-darwin-x64 +0 -0
- package/bin/cmdop-core-linux-arm64 +0 -0
- package/bin/cmdop-core-linux-x64 +0 -0
- package/bin/cmdop-core-win32-x64.exe +0 -0
- package/dist/index.cjs +388 -959
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +573 -3859
- package/dist/index.d.ts +573 -3859
- package/dist/index.js +374 -861
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
- package/dist/chunk-HVTWZ3OM.js +0 -63
- package/dist/chunk-HVTWZ3OM.js.map +0 -1
- package/dist/errors-4ITNIIVL.js +0 -3
- package/dist/errors-4ITNIIVL.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cmdop/sdk",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Typed Node SDK for
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "Typed Node SDK for the current Cmdop machine roster, agent stream, and durable messages.",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"homepage": "https://
|
|
6
|
+
"homepage": "https://cmdop.com/sdk",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "git+https://github.com/commandoperator/cmdop-sdk.git",
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/node": "^20.14.0",
|
|
52
52
|
"tsup": "^8.3.0",
|
|
53
|
+
"tsx": "^4.23.1",
|
|
53
54
|
"typescript": "^5.6.0",
|
|
54
55
|
"vitest": "^2.1.0"
|
|
55
56
|
},
|
package/dist/chunk-HVTWZ3OM.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
// src/errors.ts
|
|
2
|
-
var CmdopError = class extends Error {
|
|
3
|
-
status;
|
|
4
|
-
code;
|
|
5
|
-
body;
|
|
6
|
-
constructor(message, status, code, body) {
|
|
7
|
-
super(message);
|
|
8
|
-
this.name = new.target.name;
|
|
9
|
-
this.status = status;
|
|
10
|
-
this.code = code;
|
|
11
|
-
this.body = body;
|
|
12
|
-
Object.setPrototypeOf(this, new.target.prototype);
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
var AuthError = class extends CmdopError {
|
|
16
|
-
};
|
|
17
|
-
var PermissionError = class extends CmdopError {
|
|
18
|
-
};
|
|
19
|
-
var NotFoundError = class extends CmdopError {
|
|
20
|
-
};
|
|
21
|
-
var ConflictError = class extends CmdopError {
|
|
22
|
-
};
|
|
23
|
-
var ValidationError = class extends CmdopError {
|
|
24
|
-
};
|
|
25
|
-
var RateLimitError = class extends CmdopError {
|
|
26
|
-
retryAfter;
|
|
27
|
-
constructor(message, code, retryAfter, body) {
|
|
28
|
-
super(message, void 0, code, body);
|
|
29
|
-
this.retryAfter = retryAfter;
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
var ServerError = class extends CmdopError {
|
|
33
|
-
};
|
|
34
|
-
var ConnectionError = class extends CmdopError {
|
|
35
|
-
};
|
|
36
|
-
var AgentStreamError = class extends CmdopError {
|
|
37
|
-
constructor(code, message) {
|
|
38
|
-
super(message, void 0, code);
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
var CODE_MAP = {
|
|
42
|
-
auth: AuthError,
|
|
43
|
-
permission: PermissionError,
|
|
44
|
-
not_found: NotFoundError,
|
|
45
|
-
conflict: ConflictError,
|
|
46
|
-
validation: ValidationError,
|
|
47
|
-
server: ServerError,
|
|
48
|
-
connection: ConnectionError
|
|
49
|
-
};
|
|
50
|
-
function mapCoreError(code, message) {
|
|
51
|
-
if (code === "rate_limit") {
|
|
52
|
-
return new RateLimitError(message, code);
|
|
53
|
-
}
|
|
54
|
-
const Ctor = CODE_MAP[code];
|
|
55
|
-
if (Ctor) {
|
|
56
|
-
return new Ctor(message, void 0, code);
|
|
57
|
-
}
|
|
58
|
-
return new CmdopError(message, void 0, code);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export { AgentStreamError, AuthError, CmdopError, ConflictError, ConnectionError, NotFoundError, PermissionError, RateLimitError, ServerError, ValidationError, mapCoreError };
|
|
62
|
-
//# sourceMappingURL=chunk-HVTWZ3OM.js.map
|
|
63
|
-
//# sourceMappingURL=chunk-HVTWZ3OM.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/errors.ts"],"names":[],"mappings":";AAUO,IAAM,UAAA,GAAN,cAAyB,KAAA,CAAM;AAAA,EAC3B,MAAA;AAAA,EACA,IAAA;AAAA,EACA,IAAA;AAAA,EAET,WAAA,CAAY,OAAA,EAAiB,MAAA,EAAiB,IAAA,EAAe,IAAA,EAAgB;AAC3E,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,OAAO,GAAA,CAAA,MAAA,CAAW,IAAA;AACvB,IAAA,IAAA,CAAK,MAAA,GAAS,MAAA;AACd,IAAA,IAAA,CAAK,IAAA,GAAO,IAAA;AACZ,IAAA,IAAA,CAAK,IAAA,GAAO,IAAA;AAEZ,IAAA,MAAA,CAAO,cAAA,CAAe,IAAA,EAAM,GAAA,CAAA,MAAA,CAAW,SAAS,CAAA;AAAA,EAClD;AACF;AAEO,IAAM,SAAA,GAAN,cAAwB,UAAA,CAAW;AAAC;AACpC,IAAM,eAAA,GAAN,cAA8B,UAAA,CAAW;AAAC;AAC1C,IAAM,aAAA,GAAN,cAA4B,UAAA,CAAW;AAAC;AACxC,IAAM,aAAA,GAAN,cAA4B,UAAA,CAAW;AAAC;AACxC,IAAM,eAAA,GAAN,cAA8B,UAAA,CAAW;AAAC;AAE1C,IAAM,cAAA,GAAN,cAA6B,UAAA,CAAW;AAAA,EACpC,UAAA;AAAA,EACT,WAAA,CAAY,OAAA,EAAiB,IAAA,EAAe,UAAA,EAAqB,IAAA,EAAgB;AAC/E,IAAA,KAAA,CAAM,OAAA,EAAS,MAAA,EAAW,IAAA,EAAM,IAAI,CAAA;AACpC,IAAA,IAAA,CAAK,UAAA,GAAa,UAAA;AAAA,EACpB;AACF;AAEO,IAAM,WAAA,GAAN,cAA0B,UAAA,CAAW;AAAC;AACtC,IAAM,eAAA,GAAN,cAA8B,UAAA,CAAW;AAAC;AAG1C,IAAM,gBAAA,GAAN,cAA+B,UAAA,CAAW;AAAA,EAC/C,WAAA,CAAY,MAAc,OAAA,EAAiB;AACzC,IAAA,KAAA,CAAM,OAAA,EAAS,QAAW,IAAI,CAAA;AAAA,EAChC;AACF;AASA,IAAM,QAAA,GAA2C;AAAA,EAC/C,IAAA,EAAM,SAAA;AAAA,EACN,UAAA,EAAY,eAAA;AAAA,EACZ,SAAA,EAAW,aAAA;AAAA,EACX,QAAA,EAAU,aAAA;AAAA,EACV,UAAA,EAAY,eAAA;AAAA,EACZ,MAAA,EAAQ,WAAA;AAAA,EACR,UAAA,EAAY;AACd,CAAA;AAGO,SAAS,YAAA,CAAa,MAAc,OAAA,EAA6B;AACtE,EAAA,IAAI,SAAS,YAAA,EAAc;AACzB,IAAA,OAAO,IAAI,cAAA,CAAe,OAAA,EAAS,IAAI,CAAA;AAAA,EACzC;AACA,EAAA,MAAM,IAAA,GAAO,SAAS,IAAI,CAAA;AAC1B,EAAA,IAAI,IAAA,EAAM;AACR,IAAA,OAAO,IAAI,IAAA,CAAK,OAAA,EAAS,MAAA,EAAW,IAAI,CAAA;AAAA,EAC1C;AAEA,EAAA,OAAO,IAAI,UAAA,CAAW,OAAA,EAAS,MAAA,EAAW,IAAI,CAAA;AAChD","file":"chunk-HVTWZ3OM.js","sourcesContent":["/**\n * Error hierarchy + `ErrorInfo.code` -> typed error mapper.\n *\n * Mirror of the Python `CmdopError` tree. The Go core emits a terminal `ERROR`\n * frame carrying an `ErrorInfo{code, message}`; {@link mapCoreError} maps that\n * `code` to the right typed exception. Codes are owned by the core\n * (`internal/core/errmap.go`): `auth / permission / not_found / conflict /\n * validation / rate_limit / server / connection` (+ catch-alls).\n */\n\nexport class CmdopError extends Error {\n readonly status?: number;\n readonly code?: string;\n readonly body?: unknown;\n\n constructor(message: string, status?: number, code?: string, body?: unknown) {\n super(message);\n this.name = new.target.name;\n this.status = status;\n this.code = code;\n this.body = body;\n // Restore prototype chain for instanceof across transpile targets.\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\nexport class AuthError extends CmdopError {}\nexport class PermissionError extends CmdopError {}\nexport class NotFoundError extends CmdopError {}\nexport class ConflictError extends CmdopError {}\nexport class ValidationError extends CmdopError {}\n\nexport class RateLimitError extends CmdopError {\n readonly retryAfter?: number;\n constructor(message: string, code?: string, retryAfter?: number, body?: unknown) {\n super(message, undefined, code, body);\n this.retryAfter = retryAfter;\n }\n}\n\nexport class ServerError extends CmdopError {}\nexport class ConnectionError extends CmdopError {}\n\n/** An `error` outcome from `machines.ask` (machine_offline/timeout/internal). */\nexport class AgentStreamError extends CmdopError {\n constructor(code: string, message: string) {\n super(message, undefined, code);\n }\n}\n\ntype CmdopErrorCtor = new (\n message: string,\n status?: number,\n code?: string,\n body?: unknown,\n) => CmdopError;\n\nconst CODE_MAP: Record<string, CmdopErrorCtor> = {\n auth: AuthError,\n permission: PermissionError,\n not_found: NotFoundError,\n conflict: ConflictError,\n validation: ValidationError,\n server: ServerError,\n connection: ConnectionError,\n};\n\n/** Map a core `ErrorInfo{code, message}` to a typed {@link CmdopError}. */\nexport function mapCoreError(code: string, message: string): CmdopError {\n if (code === \"rate_limit\") {\n return new RateLimitError(message, code);\n }\n const Ctor = CODE_MAP[code];\n if (Ctor) {\n return new Ctor(message, undefined, code);\n }\n // internal / unknown_op / unsupported / anything new -> base error.\n return new CmdopError(message, undefined, code);\n}\n"]}
|
package/dist/errors-4ITNIIVL.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export { AgentStreamError, AuthError, CmdopError, ConflictError, ConnectionError, NotFoundError, PermissionError, RateLimitError, ServerError, ValidationError, mapCoreError } from './chunk-HVTWZ3OM.js';
|
|
2
|
-
//# sourceMappingURL=errors-4ITNIIVL.js.map
|
|
3
|
-
//# sourceMappingURL=errors-4ITNIIVL.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"errors-4ITNIIVL.js"}
|