@teamlearners/clawops 0.32.0 → 0.32.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 +1 -1
- package/dist/agent/index.cjs +9 -9
- package/dist/agent/index.js +1 -1
- package/dist/{chunk-HKXRJRAW.cjs → chunk-6ABL54D2.cjs} +3 -3
- package/dist/{chunk-HKXRJRAW.cjs.map → chunk-6ABL54D2.cjs.map} +1 -1
- package/dist/{chunk-MXJ2LM6R.js → chunk-ESYMNP2G.js} +3 -3
- package/dist/{chunk-MXJ2LM6R.js.map → chunk-ESYMNP2G.js.map} +1 -1
- package/dist/index.cjs +35 -35
- package/dist/index.js +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -480,7 +480,7 @@ const client = new ClawOps({
|
|
|
480
480
|
|
|
481
481
|
| 언어 | 패키지 | 저장소 |
|
|
482
482
|
|------|--------|--------|
|
|
483
|
-
| Python | [`clawops`](https://pypi.org/project/clawops/) | [
|
|
483
|
+
| Python | [`clawops`](https://pypi.org/project/clawops/) | [sdk-python](https://github.com/clawopshq/sdk-python) |
|
|
484
484
|
|
|
485
485
|
## 요구사항
|
|
486
486
|
|
package/dist/agent/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk6ABL54D2_cjs = require('../chunk-6ABL54D2.cjs');
|
|
4
4
|
var chunkQD2ZY4UP_cjs = require('../chunk-QD2ZY4UP.cjs');
|
|
5
5
|
var fs = require('fs');
|
|
6
6
|
var path = require('path');
|
|
@@ -728,7 +728,7 @@ var MAX_ERROR_MESSAGE_LENGTH = 200;
|
|
|
728
728
|
function getSdkInfo() {
|
|
729
729
|
return {
|
|
730
730
|
name: "clawops-node",
|
|
731
|
-
version:
|
|
731
|
+
version: chunk6ABL54D2_cjs.VERSION,
|
|
732
732
|
runtime: `node/${process.versions.node}`,
|
|
733
733
|
os: `${process.platform}/${os__default.default.arch()}`
|
|
734
734
|
};
|
|
@@ -1468,7 +1468,7 @@ var ClawOpsAgent = class _ClawOpsAgent {
|
|
|
1468
1468
|
constructor(options) {
|
|
1469
1469
|
this._apiKey = options.apiKey ?? process.env["CLAWOPS_API_KEY"] ?? "";
|
|
1470
1470
|
this._accountId = options.accountId ?? process.env["CLAWOPS_ACCOUNT_ID"] ?? "";
|
|
1471
|
-
this._baseUrl = options.baseUrl ??
|
|
1471
|
+
this._baseUrl = options.baseUrl ?? chunk6ABL54D2_cjs.DEFAULT_BASE_URL;
|
|
1472
1472
|
this._fromNumber = options.from;
|
|
1473
1473
|
this._session = options.session;
|
|
1474
1474
|
this._recording = options.recording ?? false;
|
|
@@ -1492,7 +1492,7 @@ var ClawOpsAgent = class _ClawOpsAgent {
|
|
|
1492
1492
|
}
|
|
1493
1493
|
static _validateGain(name, gain) {
|
|
1494
1494
|
if (typeof gain !== "number" || !Number.isFinite(gain) || gain < 0) {
|
|
1495
|
-
throw new
|
|
1495
|
+
throw new chunk6ABL54D2_cjs.AgentError(`${name}=${gain} must be a finite number >= 0`);
|
|
1496
1496
|
}
|
|
1497
1497
|
return gain;
|
|
1498
1498
|
}
|
|
@@ -1506,7 +1506,7 @@ var ClawOpsAgent = class _ClawOpsAgent {
|
|
|
1506
1506
|
tool(nameOrTool, description, parameters, handler) {
|
|
1507
1507
|
if (typeof nameOrTool === "string") {
|
|
1508
1508
|
if (!description || !parameters || !handler) {
|
|
1509
|
-
throw new
|
|
1509
|
+
throw new chunk6ABL54D2_cjs.AgentError(
|
|
1510
1510
|
"tool(name, description, parameters, handler) requires all arguments."
|
|
1511
1511
|
);
|
|
1512
1512
|
}
|
|
@@ -1542,10 +1542,10 @@ var ClawOpsAgent = class _ClawOpsAgent {
|
|
|
1542
1542
|
async connect() {
|
|
1543
1543
|
if (this._controlWs) return;
|
|
1544
1544
|
if (!this._apiKey) {
|
|
1545
|
-
throw new
|
|
1545
|
+
throw new chunk6ABL54D2_cjs.AgentError("API key is required. Set CLAWOPS_API_KEY or pass apiKey option.");
|
|
1546
1546
|
}
|
|
1547
1547
|
if (!this._accountId) {
|
|
1548
|
-
throw new
|
|
1548
|
+
throw new chunk6ABL54D2_cjs.AgentError(
|
|
1549
1549
|
"Account ID is required. Set CLAWOPS_ACCOUNT_ID or pass accountId option."
|
|
1550
1550
|
);
|
|
1551
1551
|
}
|
|
@@ -1569,7 +1569,7 @@ var ClawOpsAgent = class _ClawOpsAgent {
|
|
|
1569
1569
|
} catch {
|
|
1570
1570
|
}
|
|
1571
1571
|
} catch (err) {
|
|
1572
|
-
throw new
|
|
1572
|
+
throw new chunk6ABL54D2_cjs.AgentConnectionError(
|
|
1573
1573
|
`Failed to connect to ClawOps: ${err instanceof Error ? err.message : String(err)}`
|
|
1574
1574
|
);
|
|
1575
1575
|
}
|
|
@@ -1634,7 +1634,7 @@ var ClawOpsAgent = class _ClawOpsAgent {
|
|
|
1634
1634
|
});
|
|
1635
1635
|
if (resp.status !== 201) {
|
|
1636
1636
|
const error = await resp.json();
|
|
1637
|
-
throw new
|
|
1637
|
+
throw new chunk6ABL54D2_cjs.AgentError(`\uBC1C\uC2E0 \uC2E4\uD328 (${resp.status}): ${error["error"] ?? ""}`);
|
|
1638
1638
|
}
|
|
1639
1639
|
const data = await resp.json();
|
|
1640
1640
|
const callSession = new CallSession({
|
package/dist/agent/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DEFAULT_BASE_URL, AgentError, AgentConnectionError, VERSION } from '../chunk-
|
|
1
|
+
import { DEFAULT_BASE_URL, AgentError, AgentConnectionError, VERSION } from '../chunk-ESYMNP2G.js';
|
|
2
2
|
import { NOOP_LOGGER, resolveBuiltinTools, createAgentLogger, createPipelineLogger, BufferingCall, attachBuffered, ulawToPcm16, resamplePcm16, getBuiltinToolSchemas, BUILTIN_TOOL_NAMES, executeBuiltinTool, CALL_NOT_READY_RESULT, pcm16ToUlaw, applyUlawGain } from '../chunk-4YLSDMLL.js';
|
|
3
3
|
export { BUILTIN_TOOL_NAMES, BuiltinTool, DECODE_TABLE, createAgentLogger, createPipelineLogger, executeBuiltinTool, getBuiltinToolSchemas, isBuiltinTool, pcm16ToUlaw, resamplePcm16, ulawToPcm16 } from '../chunk-4YLSDMLL.js';
|
|
4
4
|
import * as fs from 'fs';
|
|
@@ -151,7 +151,7 @@ function makeStatusError(status, body, headers, request) {
|
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
// src/version.ts
|
|
154
|
-
var VERSION = "0.32.
|
|
154
|
+
var VERSION = "0.32.1" ;
|
|
155
155
|
|
|
156
156
|
// src/constants.ts
|
|
157
157
|
var DEFAULT_BASE_URL = "https://api.claw-ops.com";
|
|
@@ -184,5 +184,5 @@ exports.ServiceUnavailableError = ServiceUnavailableError;
|
|
|
184
184
|
exports.UnprocessableEntityError = UnprocessableEntityError;
|
|
185
185
|
exports.VERSION = VERSION;
|
|
186
186
|
exports.makeStatusError = makeStatusError;
|
|
187
|
-
//# sourceMappingURL=chunk-
|
|
188
|
-
//# sourceMappingURL=chunk-
|
|
187
|
+
//# sourceMappingURL=chunk-6ABL54D2.cjs.map
|
|
188
|
+
//# sourceMappingURL=chunk-6ABL54D2.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/error.ts","../src/version.ts","../src/constants.ts"],"names":[],"mappings":";;;AAAO,IAAM,YAAA,GAAN,cAA2B,KAAA,CAAM;AAAA,EACtC,YAAY,OAAA,EAAiB;AAC3B,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAO,cAAA;AAAA,EACd;AACF;AAEO,IAAM,QAAA,GAAN,cAAuB,YAAA,CAAa;AAAA,EAChC,OAAA;AAAA,EAET,WAAA,CAAY,SAAiB,OAAA,EAA0C;AACrE,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAO,UAAA;AACZ,IAAA,IAAA,CAA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AAM,OAAA,GACT,QAAA;;;ACHG,IAAM,gBAAA,GAAmB;AACzB,IAAM,mBAAA,GAAsB;AAC5B,IAAM,eAAA,GAAkB;AACxB,IAAM,mBAAA,GAAsB;AAC5B,IAAM,eAAA,GAAkB","file":"chunk-HKXRJRAW.cjs","sourcesContent":["export class ClawOpsError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'ClawOpsError';\n }\n}\n\nexport class APIError extends ClawOpsError {\n readonly request: { method: string; url: string };\n\n constructor(message: string, request: { method: string; url: string }) {\n super(message);\n this.name = 'APIError';\n this.request = request;\n }\n}\n\nexport class APIStatusError extends APIError {\n readonly status: number;\n readonly body: unknown;\n readonly headers: Headers | undefined;\n\n constructor(\n message: string,\n response: { status: number; headers?: Headers },\n body: unknown,\n request: { method: string; url: string },\n ) {\n super(message, request);\n this.name = 'APIStatusError';\n this.status = response.status;\n this.body = body;\n this.headers = response.headers;\n }\n}\n\nexport class BadRequestError extends APIStatusError {\n override readonly status = 400 as const;\n constructor(\n message: string,\n response: { status: number; headers?: Headers },\n body: unknown,\n request: { method: string; url: string },\n ) {\n super(message, response, body, request);\n this.name = 'BadRequestError';\n }\n}\n\nexport class AuthenticationError extends APIStatusError {\n override readonly status = 401 as const;\n constructor(\n message: string,\n response: { status: number; headers?: Headers },\n body: unknown,\n request: { method: string; url: string },\n ) {\n super(message, response, body, request);\n this.name = 'AuthenticationError';\n }\n}\n\nexport class PermissionDeniedError extends APIStatusError {\n override readonly status = 403 as const;\n constructor(\n message: string,\n response: { status: number; headers?: Headers },\n body: unknown,\n request: { method: string; url: string },\n ) {\n super(message, response, body, request);\n this.name = 'PermissionDeniedError';\n }\n}\n\nexport class NotFoundError extends APIStatusError {\n override readonly status = 404 as const;\n constructor(\n message: string,\n response: { status: number; headers?: Headers },\n body: unknown,\n request: { method: string; url: string },\n ) {\n super(message, response, body, request);\n this.name = 'NotFoundError';\n }\n}\n\nexport class ConflictError extends APIStatusError {\n override readonly status = 409 as const;\n constructor(\n message: string,\n response: { status: number; headers?: Headers },\n body: unknown,\n request: { method: string; url: string },\n ) {\n super(message, response, body, request);\n this.name = 'ConflictError';\n }\n}\n\nexport class UnprocessableEntityError extends APIStatusError {\n override readonly status = 422 as const;\n constructor(\n message: string,\n response: { status: number; headers?: Headers },\n body: unknown,\n request: { method: string; url: string },\n ) {\n super(message, response, body, request);\n this.name = 'UnprocessableEntityError';\n }\n}\n\n/**\n * HTTP 429 Too Many Requests.\n *\n * 동시 통화 한도 초과 등 일시적 제한. SDK는 자동 재시도(최대 2회, 지수 backoff)를 수행한다.\n * 즉각 피드백이 필요하면 client 생성 시 maxRetries: 0으로 재시도를 비활성화하라.\n */\nexport class RateLimitError extends APIStatusError {\n override readonly status = 429 as const;\n constructor(\n message: string,\n response: { status: number; headers?: Headers },\n body: unknown,\n request: { method: string; url: string },\n ) {\n super(message, response, body, request);\n this.name = 'RateLimitError';\n }\n}\n\nexport class InternalServerError extends APIStatusError {\n override readonly status = 500 as const;\n constructor(\n message: string,\n response: { status: number; headers?: Headers },\n body: unknown,\n request: { method: string; url: string },\n ) {\n super(message, response, body, request);\n this.name = 'InternalServerError';\n }\n}\n\nexport class ServiceUnavailableError extends APIStatusError {\n override readonly status = 503 as const;\n constructor(\n message: string,\n response: { status: number; headers?: Headers },\n body: unknown,\n request: { method: string; url: string },\n ) {\n super(message, response, body, request);\n this.name = 'ServiceUnavailableError';\n }\n}\n\nexport class APIConnectionError extends APIError {\n constructor(request: { method: string; url: string }, message = 'Connection error.') {\n super(message, request);\n this.name = 'APIConnectionError';\n }\n}\n\nexport class APITimeoutError extends APIConnectionError {\n constructor(request: { method: string; url: string }) {\n super(request, 'Request timed out.');\n this.name = 'APITimeoutError';\n }\n}\n\nexport class APIResponseValidationError extends APIError {\n readonly status: number;\n\n constructor(response: { status: number }, request: { method: string; url: string }) {\n super('API response validation failed.', request);\n this.name = 'APIResponseValidationError';\n this.status = response.status;\n }\n}\n\nexport class AgentError extends ClawOpsError {\n constructor(message: string) {\n super(message);\n this.name = 'AgentError';\n }\n}\n\nexport class AgentConnectionError extends AgentError {\n constructor(message = 'Agent WebSocket connection failed.') {\n super(message);\n this.name = 'AgentConnectionError';\n }\n}\n\nconst STATUS_CODE_TO_ERROR: Record<\n number,\n new (\n message: string,\n response: { status: number; headers?: Headers },\n body: unknown,\n request: { method: string; url: string },\n ) => APIStatusError\n> = {\n 400: BadRequestError,\n 401: AuthenticationError,\n 403: PermissionDeniedError,\n 404: NotFoundError,\n 409: ConflictError,\n 422: UnprocessableEntityError,\n 429: RateLimitError,\n 500: InternalServerError,\n 503: ServiceUnavailableError,\n};\n\nexport function makeStatusError(\n status: number,\n body: unknown,\n headers: Headers | undefined,\n request: { method: string; url: string },\n): APIStatusError {\n let message = '';\n if (body && typeof body === 'object' && 'error' in body) {\n message = (body as { error: string }).error;\n } else {\n message = `HTTP ${status}`;\n }\n\n const ErrorClass = STATUS_CODE_TO_ERROR[status];\n if (ErrorClass) {\n return new ErrorClass(message, { status, headers }, body, request);\n }\n if (status >= 500) {\n return new InternalServerError(message, { status, headers }, body, request);\n }\n return new APIStatusError(message, { status, headers }, body, request);\n}\n","declare const __PKG_VERSION__: string;\n\nexport const VERSION: string = typeof __PKG_VERSION__ !== 'undefined'\n ? __PKG_VERSION__\n : 'dev';\n","export const DEFAULT_BASE_URL = 'https://api.claw-ops.com';\nexport const DEFAULT_MAX_RETRIES = 2;\nexport const DEFAULT_TIMEOUT = 600_000; // ms\nexport const INITIAL_RETRY_DELAY = 500; // ms\nexport const MAX_RETRY_DELAY = 8_000; // ms\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/error.ts","../src/version.ts","../src/constants.ts"],"names":[],"mappings":";;;AAAO,IAAM,YAAA,GAAN,cAA2B,KAAA,CAAM;AAAA,EACtC,YAAY,OAAA,EAAiB;AAC3B,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAO,cAAA;AAAA,EACd;AACF;AAEO,IAAM,QAAA,GAA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AA,EAAS,EAAE,QAAQ,OAAA,EAAQ,EAAG,MAAM,OAAO,CAAA;AAAA,EAC5E;AACA,EAAA,OAAO,IAAI,eAAe,OAAA,EAAS,EAAE,QAAQ,OAAA,EAAQ,EAAG,MAAM,OAAO,CAAA;AACvE;;;AC5OO,IAAM,OAAA,GACT,QAAA;;;ACHG,IAAM,gBAAA,GAAmB;AACzB,IAAM,mBAAA,GAAsB;AAC5B,IAAM,eAAA,GAAkB;AACxB,IAAM,mBAAA,GAAsB;AAC5B,IAAM,eAAA,GAAkB","file":"chunk-6ABL54D2.cjs","sourcesContent":["export class ClawOpsError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'ClawOpsError';\n }\n}\n\nexport class APIError extends ClawOpsError {\n readonly request: { method: string; url: string };\n\n constructor(message: string, request: { method: string; url: string }) {\n super(message);\n this.name = 'APIError';\n this.request = request;\n }\n}\n\nexport class APIStatusError extends APIError {\n readonly status: number;\n readonly body: unknown;\n readonly headers: Headers | undefined;\n\n constructor(\n message: string,\n response: { status: number; headers?: Headers },\n body: unknown,\n request: { method: string; url: string },\n ) {\n super(message, request);\n this.name = 'APIStatusError';\n this.status = response.status;\n this.body = body;\n this.headers = response.headers;\n }\n}\n\nexport class BadRequestError extends APIStatusError {\n override readonly status = 400 as const;\n constructor(\n message: string,\n response: { status: number; headers?: Headers },\n body: unknown,\n request: { method: string; url: string },\n ) {\n super(message, response, body, request);\n this.name = 'BadRequestError';\n }\n}\n\nexport class AuthenticationError extends APIStatusError {\n override readonly status = 401 as const;\n constructor(\n message: string,\n response: { status: number; headers?: Headers },\n body: unknown,\n request: { method: string; url: string },\n ) {\n super(message, response, body, request);\n this.name = 'AuthenticationError';\n }\n}\n\nexport class PermissionDeniedError extends APIStatusError {\n override readonly status = 403 as const;\n constructor(\n message: string,\n response: { status: number; headers?: Headers },\n body: unknown,\n request: { method: string; url: string },\n ) {\n super(message, response, body, request);\n this.name = 'PermissionDeniedError';\n }\n}\n\nexport class NotFoundError extends APIStatusError {\n override readonly status = 404 as const;\n constructor(\n message: string,\n response: { status: number; headers?: Headers },\n body: unknown,\n request: { method: string; url: string },\n ) {\n super(message, response, body, request);\n this.name = 'NotFoundError';\n }\n}\n\nexport class ConflictError extends APIStatusError {\n override readonly status = 409 as const;\n constructor(\n message: string,\n response: { status: number; headers?: Headers },\n body: unknown,\n request: { method: string; url: string },\n ) {\n super(message, response, body, request);\n this.name = 'ConflictError';\n }\n}\n\nexport class UnprocessableEntityError extends APIStatusError {\n override readonly status = 422 as const;\n constructor(\n message: string,\n response: { status: number; headers?: Headers },\n body: unknown,\n request: { method: string; url: string },\n ) {\n super(message, response, body, request);\n this.name = 'UnprocessableEntityError';\n }\n}\n\n/**\n * HTTP 429 Too Many Requests.\n *\n * 동시 통화 한도 초과 등 일시적 제한. SDK는 자동 재시도(최대 2회, 지수 backoff)를 수행한다.\n * 즉각 피드백이 필요하면 client 생성 시 maxRetries: 0으로 재시도를 비활성화하라.\n */\nexport class RateLimitError extends APIStatusError {\n override readonly status = 429 as const;\n constructor(\n message: string,\n response: { status: number; headers?: Headers },\n body: unknown,\n request: { method: string; url: string },\n ) {\n super(message, response, body, request);\n this.name = 'RateLimitError';\n }\n}\n\nexport class InternalServerError extends APIStatusError {\n override readonly status = 500 as const;\n constructor(\n message: string,\n response: { status: number; headers?: Headers },\n body: unknown,\n request: { method: string; url: string },\n ) {\n super(message, response, body, request);\n this.name = 'InternalServerError';\n }\n}\n\nexport class ServiceUnavailableError extends APIStatusError {\n override readonly status = 503 as const;\n constructor(\n message: string,\n response: { status: number; headers?: Headers },\n body: unknown,\n request: { method: string; url: string },\n ) {\n super(message, response, body, request);\n this.name = 'ServiceUnavailableError';\n }\n}\n\nexport class APIConnectionError extends APIError {\n constructor(request: { method: string; url: string }, message = 'Connection error.') {\n super(message, request);\n this.name = 'APIConnectionError';\n }\n}\n\nexport class APITimeoutError extends APIConnectionError {\n constructor(request: { method: string; url: string }) {\n super(request, 'Request timed out.');\n this.name = 'APITimeoutError';\n }\n}\n\nexport class APIResponseValidationError extends APIError {\n readonly status: number;\n\n constructor(response: { status: number }, request: { method: string; url: string }) {\n super('API response validation failed.', request);\n this.name = 'APIResponseValidationError';\n this.status = response.status;\n }\n}\n\nexport class AgentError extends ClawOpsError {\n constructor(message: string) {\n super(message);\n this.name = 'AgentError';\n }\n}\n\nexport class AgentConnectionError extends AgentError {\n constructor(message = 'Agent WebSocket connection failed.') {\n super(message);\n this.name = 'AgentConnectionError';\n }\n}\n\nconst STATUS_CODE_TO_ERROR: Record<\n number,\n new (\n message: string,\n response: { status: number; headers?: Headers },\n body: unknown,\n request: { method: string; url: string },\n ) => APIStatusError\n> = {\n 400: BadRequestError,\n 401: AuthenticationError,\n 403: PermissionDeniedError,\n 404: NotFoundError,\n 409: ConflictError,\n 422: UnprocessableEntityError,\n 429: RateLimitError,\n 500: InternalServerError,\n 503: ServiceUnavailableError,\n};\n\nexport function makeStatusError(\n status: number,\n body: unknown,\n headers: Headers | undefined,\n request: { method: string; url: string },\n): APIStatusError {\n let message = '';\n if (body && typeof body === 'object' && 'error' in body) {\n message = (body as { error: string }).error;\n } else {\n message = `HTTP ${status}`;\n }\n\n const ErrorClass = STATUS_CODE_TO_ERROR[status];\n if (ErrorClass) {\n return new ErrorClass(message, { status, headers }, body, request);\n }\n if (status >= 500) {\n return new InternalServerError(message, { status, headers }, body, request);\n }\n return new APIStatusError(message, { status, headers }, body, request);\n}\n","declare const __PKG_VERSION__: string;\n\nexport const VERSION: string = typeof __PKG_VERSION__ !== 'undefined'\n ? __PKG_VERSION__\n : 'dev';\n","export const DEFAULT_BASE_URL = 'https://api.claw-ops.com';\nexport const DEFAULT_MAX_RETRIES = 2;\nexport const DEFAULT_TIMEOUT = 600_000; // ms\nexport const INITIAL_RETRY_DELAY = 500; // ms\nexport const MAX_RETRY_DELAY = 8_000; // ms\n"]}
|
|
@@ -149,7 +149,7 @@ function makeStatusError(status, body, headers, request) {
|
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
// src/version.ts
|
|
152
|
-
var VERSION = "0.32.
|
|
152
|
+
var VERSION = "0.32.1" ;
|
|
153
153
|
|
|
154
154
|
// src/constants.ts
|
|
155
155
|
var DEFAULT_BASE_URL = "https://api.claw-ops.com";
|
|
@@ -159,5 +159,5 @@ var INITIAL_RETRY_DELAY = 500;
|
|
|
159
159
|
var MAX_RETRY_DELAY = 8e3;
|
|
160
160
|
|
|
161
161
|
export { APIConnectionError, APIError, APIResponseValidationError, APIStatusError, APITimeoutError, AgentConnectionError, AgentError, AuthenticationError, BadRequestError, ClawOpsError, ConflictError, DEFAULT_BASE_URL, DEFAULT_MAX_RETRIES, DEFAULT_TIMEOUT, INITIAL_RETRY_DELAY, InternalServerError, MAX_RETRY_DELAY, NotFoundError, PermissionDeniedError, RateLimitError, ServiceUnavailableError, UnprocessableEntityError, VERSION, makeStatusError };
|
|
162
|
-
//# sourceMappingURL=chunk-
|
|
163
|
-
//# sourceMappingURL=chunk-
|
|
162
|
+
//# sourceMappingURL=chunk-ESYMNP2G.js.map
|
|
163
|
+
//# sourceMappingURL=chunk-ESYMNP2G.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/error.ts","../src/version.ts","../src/constants.ts"],"names":[],"mappings":";AAAO,IAAM,YAAA,GAAN,cAA2B,KAAA,CAAM;AAAA,EACtC,YAAY,OAAA,EAAiB;AAC3B,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAO,cAAA;AAAA,EACd;AACF;AAEO,IAAM,QAAA,GAAN,cAAuB,YAAA,CAAa;AAAA,EAChC,OAAA;AAAA,EAET,WAAA,CAAY,SAAiB,OAAA,EAA0C;AACrE,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAO,UAAA;AACZ,IAAA,IAAA,CAAK,OAAA,GAAU,OAAA;AAAA,EACjB;AACF;AAEO,IAAM,cAAA,GAAN,cAA6B,QAAA,CA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AAC5B,IAAM,eAAA,GAAkB;AACxB,IAAM,mBAAA,GAAsB;AAC5B,IAAM,eAAA,GAAkB","file":"chunk-MXJ2LM6R.js","sourcesContent":["export class ClawOpsError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'ClawOpsError';\n }\n}\n\nexport class APIError extends ClawOpsError {\n readonly request: { method: string; url: string };\n\n constructor(message: string, request: { method: string; url: string }) {\n super(message);\n this.name = 'APIError';\n this.request = request;\n }\n}\n\nexport class APIStatusError extends APIError {\n readonly status: number;\n readonly body: unknown;\n readonly headers: Headers | undefined;\n\n constructor(\n message: string,\n response: { status: number; headers?: Headers },\n body: unknown,\n request: { method: string; url: string },\n ) {\n super(message, request);\n this.name = 'APIStatusError';\n this.status = response.status;\n this.body = body;\n this.headers = response.headers;\n }\n}\n\nexport class BadRequestError extends APIStatusError {\n override readonly status = 400 as const;\n constructor(\n message: string,\n response: { status: number; headers?: Headers },\n body: unknown,\n request: { method: string; url: string },\n ) {\n super(message, response, body, request);\n this.name = 'BadRequestError';\n }\n}\n\nexport class AuthenticationError extends APIStatusError {\n override readonly status = 401 as const;\n constructor(\n message: string,\n response: { status: number; headers?: Headers },\n body: unknown,\n request: { method: string; url: string },\n ) {\n super(message, response, body, request);\n this.name = 'AuthenticationError';\n }\n}\n\nexport class PermissionDeniedError extends APIStatusError {\n override readonly status = 403 as const;\n constructor(\n message: string,\n response: { status: number; headers?: Headers },\n body: unknown,\n request: { method: string; url: string },\n ) {\n super(message, response, body, request);\n this.name = 'PermissionDeniedError';\n }\n}\n\nexport class NotFoundError extends APIStatusError {\n override readonly status = 404 as const;\n constructor(\n message: string,\n response: { status: number; headers?: Headers },\n body: unknown,\n request: { method: string; url: string },\n ) {\n super(message, response, body, request);\n this.name = 'NotFoundError';\n }\n}\n\nexport class ConflictError extends APIStatusError {\n override readonly status = 409 as const;\n constructor(\n message: string,\n response: { status: number; headers?: Headers },\n body: unknown,\n request: { method: string; url: string },\n ) {\n super(message, response, body, request);\n this.name = 'ConflictError';\n }\n}\n\nexport class UnprocessableEntityError extends APIStatusError {\n override readonly status = 422 as const;\n constructor(\n message: string,\n response: { status: number; headers?: Headers },\n body: unknown,\n request: { method: string; url: string },\n ) {\n super(message, response, body, request);\n this.name = 'UnprocessableEntityError';\n }\n}\n\n/**\n * HTTP 429 Too Many Requests.\n *\n * 동시 통화 한도 초과 등 일시적 제한. SDK는 자동 재시도(최대 2회, 지수 backoff)를 수행한다.\n * 즉각 피드백이 필요하면 client 생성 시 maxRetries: 0으로 재시도를 비활성화하라.\n */\nexport class RateLimitError extends APIStatusError {\n override readonly status = 429 as const;\n constructor(\n message: string,\n response: { status: number; headers?: Headers },\n body: unknown,\n request: { method: string; url: string },\n ) {\n super(message, response, body, request);\n this.name = 'RateLimitError';\n }\n}\n\nexport class InternalServerError extends APIStatusError {\n override readonly status = 500 as const;\n constructor(\n message: string,\n response: { status: number; headers?: Headers },\n body: unknown,\n request: { method: string; url: string },\n ) {\n super(message, response, body, request);\n this.name = 'InternalServerError';\n }\n}\n\nexport class ServiceUnavailableError extends APIStatusError {\n override readonly status = 503 as const;\n constructor(\n message: string,\n response: { status: number; headers?: Headers },\n body: unknown,\n request: { method: string; url: string },\n ) {\n super(message, response, body, request);\n this.name = 'ServiceUnavailableError';\n }\n}\n\nexport class APIConnectionError extends APIError {\n constructor(request: { method: string; url: string }, message = 'Connection error.') {\n super(message, request);\n this.name = 'APIConnectionError';\n }\n}\n\nexport class APITimeoutError extends APIConnectionError {\n constructor(request: { method: string; url: string }) {\n super(request, 'Request timed out.');\n this.name = 'APITimeoutError';\n }\n}\n\nexport class APIResponseValidationError extends APIError {\n readonly status: number;\n\n constructor(response: { status: number }, request: { method: string; url: string }) {\n super('API response validation failed.', request);\n this.name = 'APIResponseValidationError';\n this.status = response.status;\n }\n}\n\nexport class AgentError extends ClawOpsError {\n constructor(message: string) {\n super(message);\n this.name = 'AgentError';\n }\n}\n\nexport class AgentConnectionError extends AgentError {\n constructor(message = 'Agent WebSocket connection failed.') {\n super(message);\n this.name = 'AgentConnectionError';\n }\n}\n\nconst STATUS_CODE_TO_ERROR: Record<\n number,\n new (\n message: string,\n response: { status: number; headers?: Headers },\n body: unknown,\n request: { method: string; url: string },\n ) => APIStatusError\n> = {\n 400: BadRequestError,\n 401: AuthenticationError,\n 403: PermissionDeniedError,\n 404: NotFoundError,\n 409: ConflictError,\n 422: UnprocessableEntityError,\n 429: RateLimitError,\n 500: InternalServerError,\n 503: ServiceUnavailableError,\n};\n\nexport function makeStatusError(\n status: number,\n body: unknown,\n headers: Headers | undefined,\n request: { method: string; url: string },\n): APIStatusError {\n let message = '';\n if (body && typeof body === 'object' && 'error' in body) {\n message = (body as { error: string }).error;\n } else {\n message = `HTTP ${status}`;\n }\n\n const ErrorClass = STATUS_CODE_TO_ERROR[status];\n if (ErrorClass) {\n return new ErrorClass(message, { status, headers }, body, request);\n }\n if (status >= 500) {\n return new InternalServerError(message, { status, headers }, body, request);\n }\n return new APIStatusError(message, { status, headers }, body, request);\n}\n","declare const __PKG_VERSION__: string;\n\nexport const VERSION: string = typeof __PKG_VERSION__ !== 'undefined'\n ? __PKG_VERSION__\n : 'dev';\n","export const DEFAULT_BASE_URL = 'https://api.claw-ops.com';\nexport const DEFAULT_MAX_RETRIES = 2;\nexport const DEFAULT_TIMEOUT = 600_000; // ms\nexport const INITIAL_RETRY_DELAY = 500; // ms\nexport const MAX_RETRY_DELAY = 8_000; // ms\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/error.ts","../src/version.ts","../src/constants.ts"],"names":[],"mappings":";AAAO,IAAM,YAAA,GAAN,cAA2B,KAAA,CAAM;AAAA,EACtC,YAAY,OAAA,EAAiB;AAC3B,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAO,cAAA;AAAA,EACd;AACF;AAEO,IAAM,QAAA,GAAN,cAAuB,YAAA,CAAa;AAAA,EAChC,OAAA;AAAA,EAET,WAAA,CAAY,SAAiB,OAAA,EAA0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AA,OAAO,IAAI,eAAe,OAAA,EAAS,EAAE,QAAQ,OAAA,EAAQ,EAAG,MAAM,OAAO,CAAA;AACvE;;;AC5OO,IAAM,OAAA,GACT,QAAA;;;ACHG,IAAM,gBAAA,GAAmB;AACzB,IAAM,mBAAA,GAAsB;AAC5B,IAAM,eAAA,GAAkB;AACxB,IAAM,mBAAA,GAAsB;AAC5B,IAAM,eAAA,GAAkB","file":"chunk-ESYMNP2G.js","sourcesContent":["export class ClawOpsError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'ClawOpsError';\n }\n}\n\nexport class APIError extends ClawOpsError {\n readonly request: { method: string; url: string };\n\n constructor(message: string, request: { method: string; url: string }) {\n super(message);\n this.name = 'APIError';\n this.request = request;\n }\n}\n\nexport class APIStatusError extends APIError {\n readonly status: number;\n readonly body: unknown;\n readonly headers: Headers | undefined;\n\n constructor(\n message: string,\n response: { status: number; headers?: Headers },\n body: unknown,\n request: { method: string; url: string },\n ) {\n super(message, request);\n this.name = 'APIStatusError';\n this.status = response.status;\n this.body = body;\n this.headers = response.headers;\n }\n}\n\nexport class BadRequestError extends APIStatusError {\n override readonly status = 400 as const;\n constructor(\n message: string,\n response: { status: number; headers?: Headers },\n body: unknown,\n request: { method: string; url: string },\n ) {\n super(message, response, body, request);\n this.name = 'BadRequestError';\n }\n}\n\nexport class AuthenticationError extends APIStatusError {\n override readonly status = 401 as const;\n constructor(\n message: string,\n response: { status: number; headers?: Headers },\n body: unknown,\n request: { method: string; url: string },\n ) {\n super(message, response, body, request);\n this.name = 'AuthenticationError';\n }\n}\n\nexport class PermissionDeniedError extends APIStatusError {\n override readonly status = 403 as const;\n constructor(\n message: string,\n response: { status: number; headers?: Headers },\n body: unknown,\n request: { method: string; url: string },\n ) {\n super(message, response, body, request);\n this.name = 'PermissionDeniedError';\n }\n}\n\nexport class NotFoundError extends APIStatusError {\n override readonly status = 404 as const;\n constructor(\n message: string,\n response: { status: number; headers?: Headers },\n body: unknown,\n request: { method: string; url: string },\n ) {\n super(message, response, body, request);\n this.name = 'NotFoundError';\n }\n}\n\nexport class ConflictError extends APIStatusError {\n override readonly status = 409 as const;\n constructor(\n message: string,\n response: { status: number; headers?: Headers },\n body: unknown,\n request: { method: string; url: string },\n ) {\n super(message, response, body, request);\n this.name = 'ConflictError';\n }\n}\n\nexport class UnprocessableEntityError extends APIStatusError {\n override readonly status = 422 as const;\n constructor(\n message: string,\n response: { status: number; headers?: Headers },\n body: unknown,\n request: { method: string; url: string },\n ) {\n super(message, response, body, request);\n this.name = 'UnprocessableEntityError';\n }\n}\n\n/**\n * HTTP 429 Too Many Requests.\n *\n * 동시 통화 한도 초과 등 일시적 제한. SDK는 자동 재시도(최대 2회, 지수 backoff)를 수행한다.\n * 즉각 피드백이 필요하면 client 생성 시 maxRetries: 0으로 재시도를 비활성화하라.\n */\nexport class RateLimitError extends APIStatusError {\n override readonly status = 429 as const;\n constructor(\n message: string,\n response: { status: number; headers?: Headers },\n body: unknown,\n request: { method: string; url: string },\n ) {\n super(message, response, body, request);\n this.name = 'RateLimitError';\n }\n}\n\nexport class InternalServerError extends APIStatusError {\n override readonly status = 500 as const;\n constructor(\n message: string,\n response: { status: number; headers?: Headers },\n body: unknown,\n request: { method: string; url: string },\n ) {\n super(message, response, body, request);\n this.name = 'InternalServerError';\n }\n}\n\nexport class ServiceUnavailableError extends APIStatusError {\n override readonly status = 503 as const;\n constructor(\n message: string,\n response: { status: number; headers?: Headers },\n body: unknown,\n request: { method: string; url: string },\n ) {\n super(message, response, body, request);\n this.name = 'ServiceUnavailableError';\n }\n}\n\nexport class APIConnectionError extends APIError {\n constructor(request: { method: string; url: string }, message = 'Connection error.') {\n super(message, request);\n this.name = 'APIConnectionError';\n }\n}\n\nexport class APITimeoutError extends APIConnectionError {\n constructor(request: { method: string; url: string }) {\n super(request, 'Request timed out.');\n this.name = 'APITimeoutError';\n }\n}\n\nexport class APIResponseValidationError extends APIError {\n readonly status: number;\n\n constructor(response: { status: number }, request: { method: string; url: string }) {\n super('API response validation failed.', request);\n this.name = 'APIResponseValidationError';\n this.status = response.status;\n }\n}\n\nexport class AgentError extends ClawOpsError {\n constructor(message: string) {\n super(message);\n this.name = 'AgentError';\n }\n}\n\nexport class AgentConnectionError extends AgentError {\n constructor(message = 'Agent WebSocket connection failed.') {\n super(message);\n this.name = 'AgentConnectionError';\n }\n}\n\nconst STATUS_CODE_TO_ERROR: Record<\n number,\n new (\n message: string,\n response: { status: number; headers?: Headers },\n body: unknown,\n request: { method: string; url: string },\n ) => APIStatusError\n> = {\n 400: BadRequestError,\n 401: AuthenticationError,\n 403: PermissionDeniedError,\n 404: NotFoundError,\n 409: ConflictError,\n 422: UnprocessableEntityError,\n 429: RateLimitError,\n 500: InternalServerError,\n 503: ServiceUnavailableError,\n};\n\nexport function makeStatusError(\n status: number,\n body: unknown,\n headers: Headers | undefined,\n request: { method: string; url: string },\n): APIStatusError {\n let message = '';\n if (body && typeof body === 'object' && 'error' in body) {\n message = (body as { error: string }).error;\n } else {\n message = `HTTP ${status}`;\n }\n\n const ErrorClass = STATUS_CODE_TO_ERROR[status];\n if (ErrorClass) {\n return new ErrorClass(message, { status, headers }, body, request);\n }\n if (status >= 500) {\n return new InternalServerError(message, { status, headers }, body, request);\n }\n return new APIStatusError(message, { status, headers }, body, request);\n}\n","declare const __PKG_VERSION__: string;\n\nexport const VERSION: string = typeof __PKG_VERSION__ !== 'undefined'\n ? __PKG_VERSION__\n : 'dev';\n","export const DEFAULT_BASE_URL = 'https://api.claw-ops.com';\nexport const DEFAULT_MAX_RETRIES = 2;\nexport const DEFAULT_TIMEOUT = 600_000; // ms\nexport const INITIAL_RETRY_DELAY = 500; // ms\nexport const MAX_RETRY_DELAY = 8_000; // ms\n"]}
|
package/dist/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var chunk6ABL54D2_cjs = require('./chunk-6ABL54D2.cjs');
|
|
6
6
|
var zod = require('zod');
|
|
7
7
|
var crypto = require('crypto');
|
|
8
8
|
|
|
@@ -13,11 +13,11 @@ function validateBaseUrl(url) {
|
|
|
13
13
|
try {
|
|
14
14
|
parsed = new URL(url);
|
|
15
15
|
} catch {
|
|
16
|
-
throw new
|
|
16
|
+
throw new chunk6ABL54D2_cjs.ClawOpsError(`Invalid base_url: ${url}`);
|
|
17
17
|
}
|
|
18
18
|
if (parsed.protocol === "https:") return url;
|
|
19
19
|
if (parsed.protocol === "http:" && LOCALHOST_HOSTS.has(parsed.hostname)) return url;
|
|
20
|
-
throw new
|
|
20
|
+
throw new chunk6ABL54D2_cjs.ClawOpsError(
|
|
21
21
|
`base_url\uC740 HTTPS\uB97C \uC0AC\uC6A9\uD574\uC57C \uD569\uB2C8\uB2E4 (\uBC1B\uC740 \uAC12: '${url}'). \uB85C\uCEEC \uAC1C\uBC1C \uC2DC\uC5D0\uB294 http://localhost\uB97C \uC0AC\uC6A9\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4.`
|
|
22
22
|
);
|
|
23
23
|
}
|
|
@@ -30,9 +30,9 @@ var APIClient = class {
|
|
|
30
30
|
_defaultHeaders;
|
|
31
31
|
constructor(options) {
|
|
32
32
|
this._apiKey = options.apiKey;
|
|
33
|
-
this._baseURL = validateBaseUrl((options.baseURL ??
|
|
34
|
-
this._maxRetries = options.maxRetries ??
|
|
35
|
-
this._timeout = options.timeout ??
|
|
33
|
+
this._baseURL = validateBaseUrl((options.baseURL ?? chunk6ABL54D2_cjs.DEFAULT_BASE_URL).replace(/\/+$/, ""));
|
|
34
|
+
this._maxRetries = options.maxRetries ?? chunk6ABL54D2_cjs.DEFAULT_MAX_RETRIES;
|
|
35
|
+
this._timeout = options.timeout ?? chunk6ABL54D2_cjs.DEFAULT_TIMEOUT;
|
|
36
36
|
this._fetch = options.fetch ?? globalThis.fetch;
|
|
37
37
|
this._defaultHeaders = options.defaultHeaders ?? {};
|
|
38
38
|
}
|
|
@@ -41,7 +41,7 @@ var APIClient = class {
|
|
|
41
41
|
Authorization: `Bearer ${this._apiKey}`,
|
|
42
42
|
"Content-Type": "application/json",
|
|
43
43
|
Accept: "application/json",
|
|
44
|
-
"User-Agent": `claw-ops-node/${
|
|
44
|
+
"User-Agent": `claw-ops-node/${chunk6ABL54D2_cjs.VERSION}`,
|
|
45
45
|
...this._defaultHeaders
|
|
46
46
|
};
|
|
47
47
|
if (extra) Object.assign(headers, extra);
|
|
@@ -77,14 +77,14 @@ var APIClient = class {
|
|
|
77
77
|
await this._sleep(this._retryDelay(this._maxRetries - retriesLeft));
|
|
78
78
|
continue;
|
|
79
79
|
}
|
|
80
|
-
throw new
|
|
80
|
+
throw new chunk6ABL54D2_cjs.APITimeoutError({ method: method2, url });
|
|
81
81
|
}
|
|
82
82
|
if (retriesLeft > 0) {
|
|
83
83
|
retriesLeft--;
|
|
84
84
|
await this._sleep(this._retryDelay(this._maxRetries - retriesLeft));
|
|
85
85
|
continue;
|
|
86
86
|
}
|
|
87
|
-
throw new
|
|
87
|
+
throw new chunk6ABL54D2_cjs.APIConnectionError({ method: method2, url });
|
|
88
88
|
} finally {
|
|
89
89
|
clearTimeout(timeoutId);
|
|
90
90
|
}
|
|
@@ -100,7 +100,7 @@ var APIClient = class {
|
|
|
100
100
|
} catch {
|
|
101
101
|
body = null;
|
|
102
102
|
}
|
|
103
|
-
throw
|
|
103
|
+
throw chunk6ABL54D2_cjs.makeStatusError(response.status, body, response.headers, { method: method2, url });
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
async _request(method2, path, options = {}) {
|
|
@@ -111,11 +111,11 @@ var APIClient = class {
|
|
|
111
111
|
try {
|
|
112
112
|
json = await response.json();
|
|
113
113
|
} catch {
|
|
114
|
-
throw new
|
|
114
|
+
throw new chunk6ABL54D2_cjs.APIResponseValidationError({ status: response.status }, { method: method2, url });
|
|
115
115
|
}
|
|
116
116
|
const parsed = options.castTo.safeParse(json);
|
|
117
117
|
if (!parsed.success) {
|
|
118
|
-
throw new
|
|
118
|
+
throw new chunk6ABL54D2_cjs.APIResponseValidationError({ status: response.status }, { method: method2, url });
|
|
119
119
|
}
|
|
120
120
|
return parsed.data;
|
|
121
121
|
}
|
|
@@ -123,7 +123,7 @@ var APIClient = class {
|
|
|
123
123
|
return status === 408 || status === 409 || status === 429 || status >= 500;
|
|
124
124
|
}
|
|
125
125
|
_retryDelay(retriesTaken) {
|
|
126
|
-
const delay = Math.min(
|
|
126
|
+
const delay = Math.min(chunk6ABL54D2_cjs.INITIAL_RETRY_DELAY * 2 ** retriesTaken, chunk6ABL54D2_cjs.MAX_RETRY_DELAY);
|
|
127
127
|
return delay * (1 + Math.random());
|
|
128
128
|
}
|
|
129
129
|
_sleep(ms) {
|
|
@@ -957,7 +957,7 @@ var AccountContext = class {
|
|
|
957
957
|
return new BlockedRecipients(this._client, this._accountId);
|
|
958
958
|
}
|
|
959
959
|
};
|
|
960
|
-
var WebhookVerificationError = class extends
|
|
960
|
+
var WebhookVerificationError = class extends chunk6ABL54D2_cjs.ClawOpsError {
|
|
961
961
|
constructor(message = "Webhook \uC11C\uBA85\uC774 \uC77C\uCE58\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.") {
|
|
962
962
|
super(message);
|
|
963
963
|
this.name = "WebhookVerificationError";
|
|
@@ -987,13 +987,13 @@ var ClawOps = class extends APIClient {
|
|
|
987
987
|
constructor(options = {}) {
|
|
988
988
|
let apiKey = options.apiKey ?? process.env.CLAWOPS_API_KEY;
|
|
989
989
|
if (!apiKey) {
|
|
990
|
-
throw new
|
|
990
|
+
throw new chunk6ABL54D2_cjs.ClawOpsError("apiKey\uB97C \uC9C0\uC815\uD558\uAC70\uB098 CLAWOPS_API_KEY \uD658\uACBD\uBCC0\uC218\uB97C \uC124\uC815\uD558\uC138\uC694.");
|
|
991
991
|
}
|
|
992
992
|
let accountId = options.accountId ?? process.env.CLAWOPS_ACCOUNT_ID;
|
|
993
993
|
if (!accountId) {
|
|
994
|
-
throw new
|
|
994
|
+
throw new chunk6ABL54D2_cjs.ClawOpsError("accountId\uB97C \uC9C0\uC815\uD558\uAC70\uB098 CLAWOPS_ACCOUNT_ID \uD658\uACBD\uBCC0\uC218\uB97C \uC124\uC815\uD558\uC138\uC694.");
|
|
995
995
|
}
|
|
996
|
-
const baseURL = options.baseURL ?? process.env.CLAWOPS_BASE_URL ??
|
|
996
|
+
const baseURL = options.baseURL ?? process.env.CLAWOPS_BASE_URL ?? chunk6ABL54D2_cjs.DEFAULT_BASE_URL;
|
|
997
997
|
super({
|
|
998
998
|
apiKey,
|
|
999
999
|
baseURL,
|
|
@@ -1044,75 +1044,75 @@ var client_default_default = ClawOps;
|
|
|
1044
1044
|
|
|
1045
1045
|
Object.defineProperty(exports, "APIConnectionError", {
|
|
1046
1046
|
enumerable: true,
|
|
1047
|
-
get: function () { return
|
|
1047
|
+
get: function () { return chunk6ABL54D2_cjs.APIConnectionError; }
|
|
1048
1048
|
});
|
|
1049
1049
|
Object.defineProperty(exports, "APIError", {
|
|
1050
1050
|
enumerable: true,
|
|
1051
|
-
get: function () { return
|
|
1051
|
+
get: function () { return chunk6ABL54D2_cjs.APIError; }
|
|
1052
1052
|
});
|
|
1053
1053
|
Object.defineProperty(exports, "APIResponseValidationError", {
|
|
1054
1054
|
enumerable: true,
|
|
1055
|
-
get: function () { return
|
|
1055
|
+
get: function () { return chunk6ABL54D2_cjs.APIResponseValidationError; }
|
|
1056
1056
|
});
|
|
1057
1057
|
Object.defineProperty(exports, "APIStatusError", {
|
|
1058
1058
|
enumerable: true,
|
|
1059
|
-
get: function () { return
|
|
1059
|
+
get: function () { return chunk6ABL54D2_cjs.APIStatusError; }
|
|
1060
1060
|
});
|
|
1061
1061
|
Object.defineProperty(exports, "APITimeoutError", {
|
|
1062
1062
|
enumerable: true,
|
|
1063
|
-
get: function () { return
|
|
1063
|
+
get: function () { return chunk6ABL54D2_cjs.APITimeoutError; }
|
|
1064
1064
|
});
|
|
1065
1065
|
Object.defineProperty(exports, "AgentConnectionError", {
|
|
1066
1066
|
enumerable: true,
|
|
1067
|
-
get: function () { return
|
|
1067
|
+
get: function () { return chunk6ABL54D2_cjs.AgentConnectionError; }
|
|
1068
1068
|
});
|
|
1069
1069
|
Object.defineProperty(exports, "AgentError", {
|
|
1070
1070
|
enumerable: true,
|
|
1071
|
-
get: function () { return
|
|
1071
|
+
get: function () { return chunk6ABL54D2_cjs.AgentError; }
|
|
1072
1072
|
});
|
|
1073
1073
|
Object.defineProperty(exports, "AuthenticationError", {
|
|
1074
1074
|
enumerable: true,
|
|
1075
|
-
get: function () { return
|
|
1075
|
+
get: function () { return chunk6ABL54D2_cjs.AuthenticationError; }
|
|
1076
1076
|
});
|
|
1077
1077
|
Object.defineProperty(exports, "BadRequestError", {
|
|
1078
1078
|
enumerable: true,
|
|
1079
|
-
get: function () { return
|
|
1079
|
+
get: function () { return chunk6ABL54D2_cjs.BadRequestError; }
|
|
1080
1080
|
});
|
|
1081
1081
|
Object.defineProperty(exports, "ClawOpsError", {
|
|
1082
1082
|
enumerable: true,
|
|
1083
|
-
get: function () { return
|
|
1083
|
+
get: function () { return chunk6ABL54D2_cjs.ClawOpsError; }
|
|
1084
1084
|
});
|
|
1085
1085
|
Object.defineProperty(exports, "ConflictError", {
|
|
1086
1086
|
enumerable: true,
|
|
1087
|
-
get: function () { return
|
|
1087
|
+
get: function () { return chunk6ABL54D2_cjs.ConflictError; }
|
|
1088
1088
|
});
|
|
1089
1089
|
Object.defineProperty(exports, "InternalServerError", {
|
|
1090
1090
|
enumerable: true,
|
|
1091
|
-
get: function () { return
|
|
1091
|
+
get: function () { return chunk6ABL54D2_cjs.InternalServerError; }
|
|
1092
1092
|
});
|
|
1093
1093
|
Object.defineProperty(exports, "NotFoundError", {
|
|
1094
1094
|
enumerable: true,
|
|
1095
|
-
get: function () { return
|
|
1095
|
+
get: function () { return chunk6ABL54D2_cjs.NotFoundError; }
|
|
1096
1096
|
});
|
|
1097
1097
|
Object.defineProperty(exports, "PermissionDeniedError", {
|
|
1098
1098
|
enumerable: true,
|
|
1099
|
-
get: function () { return
|
|
1099
|
+
get: function () { return chunk6ABL54D2_cjs.PermissionDeniedError; }
|
|
1100
1100
|
});
|
|
1101
1101
|
Object.defineProperty(exports, "RateLimitError", {
|
|
1102
1102
|
enumerable: true,
|
|
1103
|
-
get: function () { return
|
|
1103
|
+
get: function () { return chunk6ABL54D2_cjs.RateLimitError; }
|
|
1104
1104
|
});
|
|
1105
1105
|
Object.defineProperty(exports, "ServiceUnavailableError", {
|
|
1106
1106
|
enumerable: true,
|
|
1107
|
-
get: function () { return
|
|
1107
|
+
get: function () { return chunk6ABL54D2_cjs.ServiceUnavailableError; }
|
|
1108
1108
|
});
|
|
1109
1109
|
Object.defineProperty(exports, "UnprocessableEntityError", {
|
|
1110
1110
|
enumerable: true,
|
|
1111
|
-
get: function () { return
|
|
1111
|
+
get: function () { return chunk6ABL54D2_cjs.UnprocessableEntityError; }
|
|
1112
1112
|
});
|
|
1113
1113
|
Object.defineProperty(exports, "VERSION", {
|
|
1114
1114
|
enumerable: true,
|
|
1115
|
-
get: function () { return
|
|
1115
|
+
get: function () { return chunk6ABL54D2_cjs.VERSION; }
|
|
1116
1116
|
});
|
|
1117
1117
|
exports.APIClient = APIClient;
|
|
1118
1118
|
exports.AccountContext = AccountContext;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DEFAULT_BASE_URL, DEFAULT_MAX_RETRIES, DEFAULT_TIMEOUT, VERSION, APITimeoutError, APIConnectionError, makeStatusError, APIResponseValidationError, ClawOpsError, INITIAL_RETRY_DELAY, MAX_RETRY_DELAY } from './chunk-
|
|
2
|
-
export { APIConnectionError, APIError, APIResponseValidationError, APIStatusError, APITimeoutError, AgentConnectionError, AgentError, AuthenticationError, BadRequestError, ClawOpsError, ConflictError, InternalServerError, NotFoundError, PermissionDeniedError, RateLimitError, ServiceUnavailableError, UnprocessableEntityError, VERSION } from './chunk-
|
|
1
|
+
import { DEFAULT_BASE_URL, DEFAULT_MAX_RETRIES, DEFAULT_TIMEOUT, VERSION, APITimeoutError, APIConnectionError, makeStatusError, APIResponseValidationError, ClawOpsError, INITIAL_RETRY_DELAY, MAX_RETRY_DELAY } from './chunk-ESYMNP2G.js';
|
|
2
|
+
export { APIConnectionError, APIError, APIResponseValidationError, APIStatusError, APITimeoutError, AgentConnectionError, AgentError, AuthenticationError, BadRequestError, ClawOpsError, ConflictError, InternalServerError, NotFoundError, PermissionDeniedError, RateLimitError, ServiceUnavailableError, UnprocessableEntityError, VERSION } from './chunk-ESYMNP2G.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { timingSafeEqual, createHmac } from 'crypto';
|
|
5
5
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teamlearners/clawops",
|
|
3
|
-
"version": "0.32.
|
|
3
|
+
"version": "0.32.1",
|
|
4
4
|
"description": "Official Node.js/TypeScript SDK for the ClawOps Voice API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -103,6 +103,6 @@
|
|
|
103
103
|
"license": "MIT",
|
|
104
104
|
"repository": {
|
|
105
105
|
"type": "git",
|
|
106
|
-
"url": "https://github.com/
|
|
106
|
+
"url": "https://github.com/clawopshq/sdk-node"
|
|
107
107
|
}
|
|
108
108
|
}
|