@teamlearners/clawops 0.28.0 → 0.30.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 +42 -11
- package/dist/agent/index.cjs +9 -9
- package/dist/agent/index.js +1 -1
- package/dist/{chunk-5MCVFEXW.js → chunk-622J6BJ5.js} +3 -3
- package/dist/{chunk-5MCVFEXW.js.map → chunk-622J6BJ5.js.map} +1 -1
- package/dist/{chunk-OBVMJFXL.cjs → chunk-IGFGK3XZ.cjs} +3 -3
- package/dist/{chunk-OBVMJFXL.cjs.map → chunk-IGFGK3XZ.cjs.map} +1 -1
- package/dist/index.cjs +101 -42
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +168 -45
- package/dist/index.d.ts +168 -45
- package/dist/index.js +68 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -270,33 +270,64 @@ await client.recordings.delete('CAabcdef1234567890');
|
|
|
270
270
|
### 전화번호 (Numbers)
|
|
271
271
|
|
|
272
272
|
```typescript
|
|
273
|
-
// 번호
|
|
274
|
-
const number = await client.numbers.create(
|
|
275
|
-
console.log(number.
|
|
273
|
+
// 번호 발급 — 풀에서 자동 배정되며 어떤 번호가 나올지는 지정할 수 없다
|
|
274
|
+
const number = await client.numbers.create();
|
|
275
|
+
console.log(number.number, number.routingType); // 07012340001 webhook
|
|
276
276
|
|
|
277
|
-
// 번호 목록 조회
|
|
277
|
+
// 번호 목록 조회 (페이지네이션 없음 — 보유한 번호가 전부 반환된다)
|
|
278
278
|
const numbers = await client.numbers.list();
|
|
279
279
|
|
|
280
|
-
//
|
|
281
|
-
await client.numbers.update('07012340001', { webhookUrl: 'https://my-app.com/webhook' });
|
|
280
|
+
// 발급 직후에는 webhookUrl 이 비어 있어 걸려온 전화가 거절된다. 착신 라우팅을 지정한다.
|
|
282
281
|
|
|
283
|
-
//
|
|
284
|
-
|
|
282
|
+
// 매니지드 에이전트가 받도록
|
|
283
|
+
await client.numbers.update('07012340001', {
|
|
284
|
+
routingType: 'agent',
|
|
285
|
+
agentId: 'AG7c2f9b1e4a6d',
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
// 콜 플로우(ARS)가 받도록
|
|
289
|
+
await client.numbers.update('07012340001', {
|
|
290
|
+
routingType: 'callflow',
|
|
291
|
+
callFlowId: 'CF41b8e07d9c25',
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
// 내 서버의 VoiceML 이 받도록
|
|
295
|
+
await client.numbers.update('07012340001', {
|
|
296
|
+
routingType: 'webhook',
|
|
297
|
+
webhookUrl: 'https://my-app.com/voice',
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
// 보유한 다른 번호로 착신전환 (같은 계정의 번호만 가능)
|
|
301
|
+
await client.numbers.update('07012340001', {
|
|
302
|
+
routingType: 'forward',
|
|
303
|
+
forwardTo: '07012340002',
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
// 소프트폰 단말 착신 (sip_trunk 부가서비스 + 등록 단말 필요)
|
|
285
307
|
const creds = await client.sipCredentials.list({ status: 'active' });
|
|
286
|
-
// 2) 그 id 로 라우팅 설정
|
|
287
308
|
await client.numbers.update('07012340001', {
|
|
288
309
|
routingType: 'softphone',
|
|
289
310
|
sipCredentialId: creds[0].id,
|
|
290
311
|
});
|
|
291
312
|
|
|
292
|
-
// (
|
|
313
|
+
// 외부 PBX 로 (sip_trunk 부가서비스 + 활성 라우트 1개 이상 필요)
|
|
293
314
|
const endpoints = await client.sipEndpoints.list({ status: 'active' });
|
|
294
315
|
await client.numbers.update('07012340001', { routingType: 'sip', sipEndpointId: endpoints[0].id });
|
|
295
316
|
|
|
296
|
-
//
|
|
317
|
+
// 수신 통화 상태 통지
|
|
318
|
+
await client.numbers.update('07012340001', {
|
|
319
|
+
statusCallback: 'https://my-app.com/call-status',
|
|
320
|
+
statusCallbackEvents: 'initiated ringing answered completed',
|
|
321
|
+
});
|
|
322
|
+
|
|
323
|
+
// 번호 반납 — 되돌릴 수 없고 같은 번호를 다시 받는다는 보장이 없다
|
|
297
324
|
await client.numbers.delete('07012340001');
|
|
298
325
|
```
|
|
299
326
|
|
|
327
|
+
라우팅을 바꾸면 다른 라우팅 필드는 서버에서 자동으로 비워집니다. `agent` 에서 `webhook` 으로
|
|
328
|
+
되돌리면 `agentId` 가 `null` 이 되므로, 다시 `agent` 로 돌아갈 때 `agentId` 를 새로 지정해야
|
|
329
|
+
합니다.
|
|
330
|
+
|
|
300
331
|
### 메시지 (Messages)
|
|
301
332
|
|
|
302
333
|
```typescript
|
package/dist/agent/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkIGFGK3XZ_cjs = require('../chunk-IGFGK3XZ.cjs');
|
|
4
4
|
var chunkXAOA3XFQ_cjs = require('../chunk-XAOA3XFQ.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: chunkIGFGK3XZ_cjs.VERSION,
|
|
732
732
|
runtime: `node/${process.versions.node}`,
|
|
733
733
|
os: `${process.platform}/${os__default.default.arch()}`
|
|
734
734
|
};
|
|
@@ -1433,7 +1433,7 @@ var ClawOpsAgent = class _ClawOpsAgent {
|
|
|
1433
1433
|
constructor(options) {
|
|
1434
1434
|
this._apiKey = options.apiKey ?? process.env["CLAWOPS_API_KEY"] ?? "";
|
|
1435
1435
|
this._accountId = options.accountId ?? process.env["CLAWOPS_ACCOUNT_ID"] ?? "";
|
|
1436
|
-
this._baseUrl = options.baseUrl ??
|
|
1436
|
+
this._baseUrl = options.baseUrl ?? chunkIGFGK3XZ_cjs.DEFAULT_BASE_URL;
|
|
1437
1437
|
this._fromNumber = options.from;
|
|
1438
1438
|
this._session = options.session;
|
|
1439
1439
|
this._recording = options.recording ?? false;
|
|
@@ -1457,7 +1457,7 @@ var ClawOpsAgent = class _ClawOpsAgent {
|
|
|
1457
1457
|
}
|
|
1458
1458
|
static _validateGain(name, gain) {
|
|
1459
1459
|
if (typeof gain !== "number" || !Number.isFinite(gain) || gain < 0) {
|
|
1460
|
-
throw new
|
|
1460
|
+
throw new chunkIGFGK3XZ_cjs.AgentError(`${name}=${gain} must be a finite number >= 0`);
|
|
1461
1461
|
}
|
|
1462
1462
|
return gain;
|
|
1463
1463
|
}
|
|
@@ -1471,7 +1471,7 @@ var ClawOpsAgent = class _ClawOpsAgent {
|
|
|
1471
1471
|
tool(nameOrTool, description, parameters, handler) {
|
|
1472
1472
|
if (typeof nameOrTool === "string") {
|
|
1473
1473
|
if (!description || !parameters || !handler) {
|
|
1474
|
-
throw new
|
|
1474
|
+
throw new chunkIGFGK3XZ_cjs.AgentError(
|
|
1475
1475
|
"tool(name, description, parameters, handler) requires all arguments."
|
|
1476
1476
|
);
|
|
1477
1477
|
}
|
|
@@ -1507,10 +1507,10 @@ var ClawOpsAgent = class _ClawOpsAgent {
|
|
|
1507
1507
|
async connect() {
|
|
1508
1508
|
if (this._controlWs) return;
|
|
1509
1509
|
if (!this._apiKey) {
|
|
1510
|
-
throw new
|
|
1510
|
+
throw new chunkIGFGK3XZ_cjs.AgentError("API key is required. Set CLAWOPS_API_KEY or pass apiKey option.");
|
|
1511
1511
|
}
|
|
1512
1512
|
if (!this._accountId) {
|
|
1513
|
-
throw new
|
|
1513
|
+
throw new chunkIGFGK3XZ_cjs.AgentError(
|
|
1514
1514
|
"Account ID is required. Set CLAWOPS_ACCOUNT_ID or pass accountId option."
|
|
1515
1515
|
);
|
|
1516
1516
|
}
|
|
@@ -1534,7 +1534,7 @@ var ClawOpsAgent = class _ClawOpsAgent {
|
|
|
1534
1534
|
} catch {
|
|
1535
1535
|
}
|
|
1536
1536
|
} catch (err) {
|
|
1537
|
-
throw new
|
|
1537
|
+
throw new chunkIGFGK3XZ_cjs.AgentConnectionError(
|
|
1538
1538
|
`Failed to connect to ClawOps: ${err instanceof Error ? err.message : String(err)}`
|
|
1539
1539
|
);
|
|
1540
1540
|
}
|
|
@@ -1598,7 +1598,7 @@ var ClawOpsAgent = class _ClawOpsAgent {
|
|
|
1598
1598
|
});
|
|
1599
1599
|
if (resp.status !== 201) {
|
|
1600
1600
|
const error = await resp.json();
|
|
1601
|
-
throw new
|
|
1601
|
+
throw new chunkIGFGK3XZ_cjs.AgentError(`\uBC1C\uC2E0 \uC2E4\uD328 (${resp.status}): ${error["error"] ?? ""}`);
|
|
1602
1602
|
}
|
|
1603
1603
|
const data = await resp.json();
|
|
1604
1604
|
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-622J6BJ5.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-WKGTY7QT.js';
|
|
3
3
|
export { BUILTIN_TOOL_NAMES, BuiltinTool, DECODE_TABLE, createAgentLogger, createPipelineLogger, executeBuiltinTool, getBuiltinToolSchemas, isBuiltinTool, pcm16ToUlaw, resamplePcm16, ulawToPcm16 } from '../chunk-WKGTY7QT.js';
|
|
4
4
|
import * as fs from 'fs';
|
|
@@ -149,7 +149,7 @@ function makeStatusError(status, body, headers, request) {
|
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
// src/version.ts
|
|
152
|
-
var VERSION = "0.
|
|
152
|
+
var VERSION = "0.30.0" ;
|
|
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-622J6BJ5.js.map
|
|
163
|
+
//# sourceMappingURL=chunk-622J6BJ5.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,CAAS;AAAA,EAClC,MAAA;AAAA,EACA,IAAA;AAAA,EACA,OAAA;AAAA,EAET,WAAA,C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AAkB","file":"chunk-5MCVFEXW.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,EAA0C;AACrE,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAO,U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AO,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-622J6BJ5.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"]}
|
|
@@ -151,7 +151,7 @@ function makeStatusError(status, body, headers, request) {
|
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
// src/version.ts
|
|
154
|
-
var VERSION = "0.
|
|
154
|
+
var VERSION = "0.30.0" ;
|
|
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-IGFGK3XZ.cjs.map
|
|
188
|
+
//# sourceMappingURL=chunk-IGFGK3XZ.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,CAAK,OAAA,GAAU,OAAA;AAAA,EACjB;AACF;AAEO,IAAM,cAAA,GAAN,cAA6B,QAAA,CAAS;AAAA,EAClC,MAAA;AAAA,EACA,IAAA;AAAA,EACA,OAAA;AAAA,EAET,WAAA,CACE,OAAA,EACA,QAAA,EACA,IAAA,EACA,OAAA,EACA;AACA,IAAA,KAAA,CAAM,SAAS,OAAO,CAAA;AACtB,IAAA,IAAA,CAAK,IAAA,GAAO,gBAAA;AACZ,IAAA,IAAA,CAAK,SAAS,QAAA,CAAS,MAAA;AACvB,IAAA,IAAA,CAAK,IAAA,GAAO,IAAA;AACZ,IAAA,IAAA,CAAK,UAAU,QAAA,CAAS,OAAA;AAAA,EAC1B;AACF;AAEO,IA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AAA;AAAA,EACL,GAAA,EAAK;AACP,CAAA;AAEO,SAAS,eAAA,CACd,MAAA,EACA,IAAA,EACA,OAAA,EACA,OAAA,EACgB;AAChB,EAAA,IAAI,OAAA,GAAU,EAAA;AACd,EAAA,IAAI,IAAA,IAAQ,OAAO,IAAA,KAAS,QAAA,IAAY,WAAW,IAAA,EAAM;AACvD,IAAA,OAAA,GAAW,IAAA,CAA2B,KAAA;AAAA,EACxC,CAAA,MAAO;AACL,IAAA,OAAA,GAAU,QAAQ,MAAM,CAAA,CAAA;AAAA,EAC1B;AAEA,EAAA,MAAM,UAAA,GAAa,qBAAqB,MAAM,CAAA;AAC9C,EAAA,IAAI,UAAA,EAAY;AACd,IAAA,OAAO,IAAI,WAAW,OAAA,EAAS,EAAE,QAAQ,OAAA,EAAQ,EAAG,MAAM,OAAO,CAAA;AAAA,EACnE;AACA,EAAA,IAAI,UAAU,GAAA,EAAK;AACjB,IAAA,OAAO,IAAI,oBAAoB,OAAA,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-OBVMJFXL.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,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,CAAS;AAAA,EAClC,MAAA;AAAA,EACA,IAAA;AAAA,EACA,OAAA;AAAA,EAET,WAAA,CACE,OAAA,EACA,QAAA,EACA,IAAA,EACA,OAAA,EACA;AACA,IAAA,KAAA,CAAM,SAAS,OAAO,CAAA;AACtB,IAAA,IAAA,CAAK,IA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K,mBAAA;AAAA,EACL,GAAA,EAAK,qBAAA;AAAA,EACL,GAAA,EAAK,aAAA;AAAA,EACL,GAAA,EAAK,aAAA;AAAA,EACL,GAAA,EAAK,wBAAA;AAAA,EACL,GAAA,EAAK,cAAA;AAAA,EACL,GAAA,EAAK,mBAAA;AAAA,EACL,GAAA,EAAK;AACP,CAAA;AAEO,SAAS,eAAA,CACd,MAAA,EACA,IAAA,EACA,OAAA,EACA,OAAA,EACgB;AAChB,EAAA,IAAI,OAAA,GAAU,EAAA;AACd,EAAA,IAAI,IAAA,IAAQ,OAAO,IAAA,KAAS,QAAA,IAAY,WAAW,IAAA,EAAM;AACvD,IAAA,OAAA,GAAW,IAAA,CAA2B,KAAA;AAAA,EACxC,CAAA,MAAO;AACL,IAAA,OAAA,GAAU,QAAQ,MAAM,CAAA,CAAA;AAAA,EAC1B;AAEA,EAAA,MAAM,UAAA,GAAa,qBAAqB,MAAM,CAAA;AAC9C,EAAA,IAAI,UAAA,EAAY;AACd,IAAA,OAAO,IAAI,WAAW,OAAA,EAAS,EAAE,QAAQ,OAAA,EAAQ,EAAG,MAAM,OAAO,CAAA;AAAA,EACnE;AACA,EAAA,IAAI,UAAU,GAAA,EAAK;AACjB,IAAA,OAAO,IAAI,oBAAoB,OAAA,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-IGFGK3XZ.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"]}
|
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 chunkIGFGK3XZ_cjs = require('./chunk-IGFGK3XZ.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 chunkIGFGK3XZ_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 chunkIGFGK3XZ_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 ?? chunkIGFGK3XZ_cjs.DEFAULT_BASE_URL).replace(/\/+$/, ""));
|
|
34
|
+
this._maxRetries = options.maxRetries ?? chunkIGFGK3XZ_cjs.DEFAULT_MAX_RETRIES;
|
|
35
|
+
this._timeout = options.timeout ?? chunkIGFGK3XZ_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/${chunkIGFGK3XZ_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 chunkIGFGK3XZ_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 chunkIGFGK3XZ_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 chunkIGFGK3XZ_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 chunkIGFGK3XZ_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 chunkIGFGK3XZ_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(chunkIGFGK3XZ_cjs.INITIAL_RETRY_DELAY * 2 ** retriesTaken, chunkIGFGK3XZ_cjs.MAX_RETRY_DELAY);
|
|
127
127
|
return delay * (1 + Math.random());
|
|
128
128
|
}
|
|
129
129
|
_sleep(ms) {
|
|
@@ -519,12 +519,22 @@ var SummaryStatusSchema = zod.z.object({
|
|
|
519
519
|
}).passthrough();
|
|
520
520
|
|
|
521
521
|
// src/resources/calls.ts
|
|
522
|
+
function callContextBody(ctx) {
|
|
523
|
+
if (!ctx) return void 0;
|
|
524
|
+
const body = { Instruction: ctx.instruction };
|
|
525
|
+
if (ctx.variables !== void 0) body.Variables = ctx.variables;
|
|
526
|
+
return body;
|
|
527
|
+
}
|
|
522
528
|
var Calls = class extends APIResource {
|
|
523
529
|
async create(params, options = {}) {
|
|
524
530
|
const body = stripNotGiven({
|
|
525
531
|
To: params.to,
|
|
526
532
|
From: params.from,
|
|
527
533
|
Url: params.url,
|
|
534
|
+
AgentId: params.agentId,
|
|
535
|
+
CallContext: callContextBody(params.callContext),
|
|
536
|
+
CallFlowId: params.callFlowId,
|
|
537
|
+
Variables: params.variables,
|
|
528
538
|
StatusCallback: params.statusCallback,
|
|
529
539
|
StatusCallbackEvent: params.statusCallbackEvent,
|
|
530
540
|
Timeout: params.timeout,
|
|
@@ -673,25 +683,53 @@ var Messages = class extends APIResource {
|
|
|
673
683
|
};
|
|
674
684
|
var PhoneNumberSchema = zod.z.object({
|
|
675
685
|
number: zod.z.string(),
|
|
686
|
+
numberType: zod.z.string().nullable().optional(),
|
|
676
687
|
source: zod.z.string().nullable().optional(),
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
688
|
+
// routingType 은 enum 으로 좁히지 않는다. 좁히면 서버가 라우팅 종류를 늘렸을 때 그 번호가
|
|
689
|
+
// 섞인 목록 조회가 통째로 실패한다(0.28.0 까지의 실제 결함: 'agent' 로 라우팅된 번호
|
|
690
|
+
// 하나가 numbers.list() 전체를 깨뜨렸다).
|
|
691
|
+
routingType: zod.z.string().nullable().optional(),
|
|
692
|
+
agentId: zod.z.string().nullable().optional(),
|
|
693
|
+
callFlowId: zod.z.string().nullable().optional(),
|
|
694
|
+
forwardTo: zod.z.string().nullable().optional(),
|
|
680
695
|
sipEndpointId: zod.z.string().nullable().optional(),
|
|
681
696
|
sipCredentialId: zod.z.string().nullable().optional(),
|
|
697
|
+
webhookUrl: zod.z.string().nullable().optional(),
|
|
698
|
+
webhookMethod: zod.z.string().nullable().optional(),
|
|
699
|
+
webhookHeaders: zod.z.record(zod.z.string()).nullable().optional(),
|
|
700
|
+
callContextUrl: zod.z.string().nullable().optional(),
|
|
701
|
+
statusCallback: zod.z.string().nullable().optional(),
|
|
702
|
+
statusCallbackEvents: zod.z.string().nullable().optional(),
|
|
703
|
+
dictionaryId: zod.z.string().nullable().optional(),
|
|
682
704
|
createdAt: zod.z.string().nullable().optional()
|
|
683
705
|
}).passthrough();
|
|
684
706
|
|
|
685
707
|
// src/resources/numbers.ts
|
|
686
708
|
var Numbers = class extends APIResource {
|
|
709
|
+
/**
|
|
710
|
+
* 번호를 발급합니다. 번호 풀에서 자동으로 배정되며 어떤 번호가 나올지는 지정할 수 없습니다.
|
|
711
|
+
*
|
|
712
|
+
* 발급 직후 번호는 `routingType: "webhook"` 이고 `webhookUrl` 이 비어 있어, 그대로 두면
|
|
713
|
+
* 걸려온 전화가 거절됩니다. 이어서 `update()` 로 착신 라우팅을 지정하세요.
|
|
714
|
+
*/
|
|
687
715
|
async create(params = {}, options = {}) {
|
|
688
|
-
const body = stripNotGiven({
|
|
716
|
+
const body = stripNotGiven({
|
|
717
|
+
webhookUrl: params.webhookUrl,
|
|
718
|
+
webhookMethod: params.webhookMethod,
|
|
719
|
+
webhookHeaders: params.webhookHeaders,
|
|
720
|
+
statusCallback: params.statusCallback,
|
|
721
|
+
statusCallbackEvents: params.statusCallbackEvents
|
|
722
|
+
});
|
|
689
723
|
return this._client._post(`${this._basePath}/numbers`, {
|
|
690
724
|
body: Object.keys(body).length ? body : void 0,
|
|
691
725
|
castTo: PhoneNumberSchema,
|
|
692
726
|
...options
|
|
693
727
|
});
|
|
694
728
|
}
|
|
729
|
+
/**
|
|
730
|
+
* 등록된 번호 목록을 조회합니다. 페이지네이션과 필터가 없으며 보유한 번호가 한 번에 전부
|
|
731
|
+
* 반환됩니다.
|
|
732
|
+
*/
|
|
695
733
|
async list(options = {}) {
|
|
696
734
|
const schema = zod.z.object({ data: zod.z.array(PhoneNumberSchema) }).passthrough();
|
|
697
735
|
const result = await this._client._get(`${this._basePath}/numbers`, {
|
|
@@ -700,13 +738,30 @@ var Numbers = class extends APIResource {
|
|
|
700
738
|
});
|
|
701
739
|
return result.data;
|
|
702
740
|
}
|
|
741
|
+
/**
|
|
742
|
+
* 번호 설정을 수정합니다. 착신 라우팅(webhook/agent/callflow/forward/sip/softphone)과
|
|
743
|
+
* webhook, 상태 통지, 받아쓰기 사전을 변경할 수 있습니다. 보낸 필드만 반영되고 생략한
|
|
744
|
+
* 필드는 유지됩니다.
|
|
745
|
+
*
|
|
746
|
+
* 라우팅을 바꾸면 다른 라우팅 필드는 서버에서 자동으로 비워집니다. `agent` 에서
|
|
747
|
+
* `webhook` 으로 되돌리면 `agentId` 가 null 이 되므로, 다시 `agent` 로 돌아갈 때
|
|
748
|
+
* `agentId` 를 새로 지정해야 합니다.
|
|
749
|
+
*/
|
|
703
750
|
async update(number, params = {}, options = {}) {
|
|
704
751
|
const body = stripNotGiven({
|
|
705
|
-
webhookUrl: params.webhookUrl,
|
|
706
|
-
webhookMethod: params.webhookMethod,
|
|
707
752
|
routingType: params.routingType,
|
|
753
|
+
agentId: params.agentId,
|
|
754
|
+
callFlowId: params.callFlowId,
|
|
755
|
+
forwardTo: params.forwardTo,
|
|
708
756
|
sipEndpointId: params.sipEndpointId,
|
|
709
|
-
sipCredentialId: params.sipCredentialId
|
|
757
|
+
sipCredentialId: params.sipCredentialId,
|
|
758
|
+
webhookUrl: params.webhookUrl,
|
|
759
|
+
webhookMethod: params.webhookMethod,
|
|
760
|
+
webhookHeaders: params.webhookHeaders,
|
|
761
|
+
callContextUrl: params.callContextUrl,
|
|
762
|
+
statusCallback: params.statusCallback,
|
|
763
|
+
statusCallbackEvents: params.statusCallbackEvents,
|
|
764
|
+
dictionaryId: params.dictionaryId
|
|
710
765
|
});
|
|
711
766
|
return this._client._put(`${this._basePath}/numbers/${number}`, {
|
|
712
767
|
body,
|
|
@@ -714,6 +769,10 @@ var Numbers = class extends APIResource {
|
|
|
714
769
|
...options
|
|
715
770
|
});
|
|
716
771
|
}
|
|
772
|
+
/**
|
|
773
|
+
* 번호를 반납합니다. 번호는 풀로 복귀하며 되돌릴 수 없습니다. 같은 번호를 다시
|
|
774
|
+
* 발급받는다는 보장이 없습니다.
|
|
775
|
+
*/
|
|
717
776
|
async delete(number, options = {}) {
|
|
718
777
|
await this._client._delete(`${this._basePath}/numbers/${number}`, options);
|
|
719
778
|
}
|
|
@@ -898,7 +957,7 @@ var AccountContext = class {
|
|
|
898
957
|
return new BlockedRecipients(this._client, this._accountId);
|
|
899
958
|
}
|
|
900
959
|
};
|
|
901
|
-
var WebhookVerificationError = class extends
|
|
960
|
+
var WebhookVerificationError = class extends chunkIGFGK3XZ_cjs.ClawOpsError {
|
|
902
961
|
constructor(message = "Webhook \uC11C\uBA85\uC774 \uC77C\uCE58\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.") {
|
|
903
962
|
super(message);
|
|
904
963
|
this.name = "WebhookVerificationError";
|
|
@@ -928,13 +987,13 @@ var ClawOps = class extends APIClient {
|
|
|
928
987
|
constructor(options = {}) {
|
|
929
988
|
let apiKey = options.apiKey ?? process.env.CLAWOPS_API_KEY;
|
|
930
989
|
if (!apiKey) {
|
|
931
|
-
throw new
|
|
990
|
+
throw new chunkIGFGK3XZ_cjs.ClawOpsError("apiKey\uB97C \uC9C0\uC815\uD558\uAC70\uB098 CLAWOPS_API_KEY \uD658\uACBD\uBCC0\uC218\uB97C \uC124\uC815\uD558\uC138\uC694.");
|
|
932
991
|
}
|
|
933
992
|
let accountId = options.accountId ?? process.env.CLAWOPS_ACCOUNT_ID;
|
|
934
993
|
if (!accountId) {
|
|
935
|
-
throw new
|
|
994
|
+
throw new chunkIGFGK3XZ_cjs.ClawOpsError("accountId\uB97C \uC9C0\uC815\uD558\uAC70\uB098 CLAWOPS_ACCOUNT_ID \uD658\uACBD\uBCC0\uC218\uB97C \uC124\uC815\uD558\uC138\uC694.");
|
|
936
995
|
}
|
|
937
|
-
const baseURL = options.baseURL ?? process.env.CLAWOPS_BASE_URL ??
|
|
996
|
+
const baseURL = options.baseURL ?? process.env.CLAWOPS_BASE_URL ?? chunkIGFGK3XZ_cjs.DEFAULT_BASE_URL;
|
|
938
997
|
super({
|
|
939
998
|
apiKey,
|
|
940
999
|
baseURL,
|
|
@@ -985,75 +1044,75 @@ var client_default_default = ClawOps;
|
|
|
985
1044
|
|
|
986
1045
|
Object.defineProperty(exports, "APIConnectionError", {
|
|
987
1046
|
enumerable: true,
|
|
988
|
-
get: function () { return
|
|
1047
|
+
get: function () { return chunkIGFGK3XZ_cjs.APIConnectionError; }
|
|
989
1048
|
});
|
|
990
1049
|
Object.defineProperty(exports, "APIError", {
|
|
991
1050
|
enumerable: true,
|
|
992
|
-
get: function () { return
|
|
1051
|
+
get: function () { return chunkIGFGK3XZ_cjs.APIError; }
|
|
993
1052
|
});
|
|
994
1053
|
Object.defineProperty(exports, "APIResponseValidationError", {
|
|
995
1054
|
enumerable: true,
|
|
996
|
-
get: function () { return
|
|
1055
|
+
get: function () { return chunkIGFGK3XZ_cjs.APIResponseValidationError; }
|
|
997
1056
|
});
|
|
998
1057
|
Object.defineProperty(exports, "APIStatusError", {
|
|
999
1058
|
enumerable: true,
|
|
1000
|
-
get: function () { return
|
|
1059
|
+
get: function () { return chunkIGFGK3XZ_cjs.APIStatusError; }
|
|
1001
1060
|
});
|
|
1002
1061
|
Object.defineProperty(exports, "APITimeoutError", {
|
|
1003
1062
|
enumerable: true,
|
|
1004
|
-
get: function () { return
|
|
1063
|
+
get: function () { return chunkIGFGK3XZ_cjs.APITimeoutError; }
|
|
1005
1064
|
});
|
|
1006
1065
|
Object.defineProperty(exports, "AgentConnectionError", {
|
|
1007
1066
|
enumerable: true,
|
|
1008
|
-
get: function () { return
|
|
1067
|
+
get: function () { return chunkIGFGK3XZ_cjs.AgentConnectionError; }
|
|
1009
1068
|
});
|
|
1010
1069
|
Object.defineProperty(exports, "AgentError", {
|
|
1011
1070
|
enumerable: true,
|
|
1012
|
-
get: function () { return
|
|
1071
|
+
get: function () { return chunkIGFGK3XZ_cjs.AgentError; }
|
|
1013
1072
|
});
|
|
1014
1073
|
Object.defineProperty(exports, "AuthenticationError", {
|
|
1015
1074
|
enumerable: true,
|
|
1016
|
-
get: function () { return
|
|
1075
|
+
get: function () { return chunkIGFGK3XZ_cjs.AuthenticationError; }
|
|
1017
1076
|
});
|
|
1018
1077
|
Object.defineProperty(exports, "BadRequestError", {
|
|
1019
1078
|
enumerable: true,
|
|
1020
|
-
get: function () { return
|
|
1079
|
+
get: function () { return chunkIGFGK3XZ_cjs.BadRequestError; }
|
|
1021
1080
|
});
|
|
1022
1081
|
Object.defineProperty(exports, "ClawOpsError", {
|
|
1023
1082
|
enumerable: true,
|
|
1024
|
-
get: function () { return
|
|
1083
|
+
get: function () { return chunkIGFGK3XZ_cjs.ClawOpsError; }
|
|
1025
1084
|
});
|
|
1026
1085
|
Object.defineProperty(exports, "ConflictError", {
|
|
1027
1086
|
enumerable: true,
|
|
1028
|
-
get: function () { return
|
|
1087
|
+
get: function () { return chunkIGFGK3XZ_cjs.ConflictError; }
|
|
1029
1088
|
});
|
|
1030
1089
|
Object.defineProperty(exports, "InternalServerError", {
|
|
1031
1090
|
enumerable: true,
|
|
1032
|
-
get: function () { return
|
|
1091
|
+
get: function () { return chunkIGFGK3XZ_cjs.InternalServerError; }
|
|
1033
1092
|
});
|
|
1034
1093
|
Object.defineProperty(exports, "NotFoundError", {
|
|
1035
1094
|
enumerable: true,
|
|
1036
|
-
get: function () { return
|
|
1095
|
+
get: function () { return chunkIGFGK3XZ_cjs.NotFoundError; }
|
|
1037
1096
|
});
|
|
1038
1097
|
Object.defineProperty(exports, "PermissionDeniedError", {
|
|
1039
1098
|
enumerable: true,
|
|
1040
|
-
get: function () { return
|
|
1099
|
+
get: function () { return chunkIGFGK3XZ_cjs.PermissionDeniedError; }
|
|
1041
1100
|
});
|
|
1042
1101
|
Object.defineProperty(exports, "RateLimitError", {
|
|
1043
1102
|
enumerable: true,
|
|
1044
|
-
get: function () { return
|
|
1103
|
+
get: function () { return chunkIGFGK3XZ_cjs.RateLimitError; }
|
|
1045
1104
|
});
|
|
1046
1105
|
Object.defineProperty(exports, "ServiceUnavailableError", {
|
|
1047
1106
|
enumerable: true,
|
|
1048
|
-
get: function () { return
|
|
1107
|
+
get: function () { return chunkIGFGK3XZ_cjs.ServiceUnavailableError; }
|
|
1049
1108
|
});
|
|
1050
1109
|
Object.defineProperty(exports, "UnprocessableEntityError", {
|
|
1051
1110
|
enumerable: true,
|
|
1052
|
-
get: function () { return
|
|
1111
|
+
get: function () { return chunkIGFGK3XZ_cjs.UnprocessableEntityError; }
|
|
1053
1112
|
});
|
|
1054
1113
|
Object.defineProperty(exports, "VERSION", {
|
|
1055
1114
|
enumerable: true,
|
|
1056
|
-
get: function () { return
|
|
1115
|
+
get: function () { return chunkIGFGK3XZ_cjs.VERSION; }
|
|
1057
1116
|
});
|
|
1058
1117
|
exports.APIClient = APIClient;
|
|
1059
1118
|
exports.AccountContext = AccountContext;
|