@teamlearners/clawops 0.21.0 → 0.23.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/dist/agent/index.cjs +31 -14
- package/dist/agent/index.cjs.map +1 -1
- package/dist/agent/index.d.cts +21 -1
- package/dist/agent/index.d.ts +21 -1
- package/dist/agent/index.js +23 -6
- package/dist/agent/index.js.map +1 -1
- package/dist/{chunk-MSQH3MCJ.js → chunk-JU36ASTU.js} +3 -3
- package/dist/{chunk-MSQH3MCJ.js.map → chunk-JU36ASTU.js.map} +1 -1
- package/dist/{chunk-TRLJ6I3F.cjs → chunk-NXMTLS2U.cjs} +3 -3
- package/dist/{chunk-TRLJ6I3F.cjs.map → chunk-NXMTLS2U.cjs.map} +1 -1
- package/dist/index.cjs +35 -35
- package/dist/index.js +2 -2
- package/package.json +1 -1
package/dist/agent/index.d.cts
CHANGED
|
@@ -246,8 +246,17 @@ declare class CallSession {
|
|
|
246
246
|
}): Promise<string>;
|
|
247
247
|
/** Send a sequence of DTMF digits. */
|
|
248
248
|
sendDtmfSequence(digits: string): Promise<void>;
|
|
249
|
-
/**
|
|
249
|
+
/**
|
|
250
|
+
* Transfer the call to a phone number or SIP endpoint.
|
|
251
|
+
*
|
|
252
|
+
* destinationType='pstn' (default): `to` is a phone number dialed via carrier.
|
|
253
|
+
* destinationType='sip': `to` is a SIP URI (e.g. `sip:user@host`) connected
|
|
254
|
+
* directly to a SIP endpoint without going through the PSTN carrier. Requires the
|
|
255
|
+
* account to have an active `sip_trunk` add-on; otherwise the transfer fails and
|
|
256
|
+
* the call continues with the AI (result `{ status: 'failed', ... }`).
|
|
257
|
+
*/
|
|
250
258
|
transfer(to: string, options?: {
|
|
259
|
+
destinationType?: 'pstn' | 'sip';
|
|
251
260
|
mode?: 'blind' | 'warm';
|
|
252
261
|
afterTransfer?: 'terminate' | 'return';
|
|
253
262
|
holdMedia?: string;
|
|
@@ -458,6 +467,13 @@ interface ClawOpsAgentOptions {
|
|
|
458
467
|
* Python SDK 의 `prewarm_enabled` 과 mirror.
|
|
459
468
|
*/
|
|
460
469
|
prewarmEnabled?: boolean;
|
|
470
|
+
/**
|
|
471
|
+
* 이 에이전트의 모든 발신에 적용되는 AMD(machineDetection) default.
|
|
472
|
+
* `'Enable'`=감지 후 `AnsweredBy` 통보(통화 계속), `'Hangup'`=음성사서함 감지 시 자동 종료.
|
|
473
|
+
* `call(to, { machineDetection })` 로 호출별 override 가능.
|
|
474
|
+
* 우선순위: 호출 인자 > 인스턴스 default > 비활성. Python SDK 의 `machine_detection` 과 mirror.
|
|
475
|
+
*/
|
|
476
|
+
machineDetection?: 'Enable' | 'Hangup';
|
|
461
477
|
}
|
|
462
478
|
declare class ClawOpsAgent {
|
|
463
479
|
private _apiKey;
|
|
@@ -489,6 +505,8 @@ declare class ClawOpsAgent {
|
|
|
489
505
|
/** prewarm 세션이 실제 CallSession 에 attach 완료된 callId. attached 이후의 stop() 은 정상 종료 경로가 책임진다. */
|
|
490
506
|
private _prewarmAttached;
|
|
491
507
|
private _prewarmEnabled;
|
|
508
|
+
/** 모든 발신에 적용되는 AMD default. call() 인자로 호출별 override 가능. */
|
|
509
|
+
private _machineDetection?;
|
|
492
510
|
constructor(options: ClawOpsAgentOptions);
|
|
493
511
|
private static _validateGain;
|
|
494
512
|
/**
|
|
@@ -522,6 +540,8 @@ declare class ClawOpsAgent {
|
|
|
522
540
|
*
|
|
523
541
|
* @param options.machineDetection 자동응답기/음성사서함 감지(AMD).
|
|
524
542
|
* `'Enable'`=감지 후 `AnsweredBy` 통보(통화 계속), `'Hangup'`=음성사서함 감지 시 자동 종료.
|
|
543
|
+
* 미지정 시 인스턴스 default(생성자의 `machineDetection`)를 따른다.
|
|
544
|
+
* 우선순위: 호출 인자 > 인스턴스 default > 비활성.
|
|
525
545
|
*/
|
|
526
546
|
call(to: string, options?: {
|
|
527
547
|
timeout?: number;
|
package/dist/agent/index.d.ts
CHANGED
|
@@ -246,8 +246,17 @@ declare class CallSession {
|
|
|
246
246
|
}): Promise<string>;
|
|
247
247
|
/** Send a sequence of DTMF digits. */
|
|
248
248
|
sendDtmfSequence(digits: string): Promise<void>;
|
|
249
|
-
/**
|
|
249
|
+
/**
|
|
250
|
+
* Transfer the call to a phone number or SIP endpoint.
|
|
251
|
+
*
|
|
252
|
+
* destinationType='pstn' (default): `to` is a phone number dialed via carrier.
|
|
253
|
+
* destinationType='sip': `to` is a SIP URI (e.g. `sip:user@host`) connected
|
|
254
|
+
* directly to a SIP endpoint without going through the PSTN carrier. Requires the
|
|
255
|
+
* account to have an active `sip_trunk` add-on; otherwise the transfer fails and
|
|
256
|
+
* the call continues with the AI (result `{ status: 'failed', ... }`).
|
|
257
|
+
*/
|
|
250
258
|
transfer(to: string, options?: {
|
|
259
|
+
destinationType?: 'pstn' | 'sip';
|
|
251
260
|
mode?: 'blind' | 'warm';
|
|
252
261
|
afterTransfer?: 'terminate' | 'return';
|
|
253
262
|
holdMedia?: string;
|
|
@@ -458,6 +467,13 @@ interface ClawOpsAgentOptions {
|
|
|
458
467
|
* Python SDK 의 `prewarm_enabled` 과 mirror.
|
|
459
468
|
*/
|
|
460
469
|
prewarmEnabled?: boolean;
|
|
470
|
+
/**
|
|
471
|
+
* 이 에이전트의 모든 발신에 적용되는 AMD(machineDetection) default.
|
|
472
|
+
* `'Enable'`=감지 후 `AnsweredBy` 통보(통화 계속), `'Hangup'`=음성사서함 감지 시 자동 종료.
|
|
473
|
+
* `call(to, { machineDetection })` 로 호출별 override 가능.
|
|
474
|
+
* 우선순위: 호출 인자 > 인스턴스 default > 비활성. Python SDK 의 `machine_detection` 과 mirror.
|
|
475
|
+
*/
|
|
476
|
+
machineDetection?: 'Enable' | 'Hangup';
|
|
461
477
|
}
|
|
462
478
|
declare class ClawOpsAgent {
|
|
463
479
|
private _apiKey;
|
|
@@ -489,6 +505,8 @@ declare class ClawOpsAgent {
|
|
|
489
505
|
/** prewarm 세션이 실제 CallSession 에 attach 완료된 callId. attached 이후의 stop() 은 정상 종료 경로가 책임진다. */
|
|
490
506
|
private _prewarmAttached;
|
|
491
507
|
private _prewarmEnabled;
|
|
508
|
+
/** 모든 발신에 적용되는 AMD default. call() 인자로 호출별 override 가능. */
|
|
509
|
+
private _machineDetection?;
|
|
492
510
|
constructor(options: ClawOpsAgentOptions);
|
|
493
511
|
private static _validateGain;
|
|
494
512
|
/**
|
|
@@ -522,6 +540,8 @@ declare class ClawOpsAgent {
|
|
|
522
540
|
*
|
|
523
541
|
* @param options.machineDetection 자동응답기/음성사서함 감지(AMD).
|
|
524
542
|
* `'Enable'`=감지 후 `AnsweredBy` 통보(통화 계속), `'Hangup'`=음성사서함 감지 시 자동 종료.
|
|
543
|
+
* 미지정 시 인스턴스 default(생성자의 `machineDetection`)를 따른다.
|
|
544
|
+
* 우선순위: 호출 인자 > 인스턴스 default > 비활성.
|
|
525
545
|
*/
|
|
526
546
|
call(to: string, options?: {
|
|
527
547
|
timeout?: number;
|
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-JU36ASTU.js';
|
|
2
2
|
import pino from 'pino';
|
|
3
3
|
import * as fs from 'fs';
|
|
4
4
|
import * as path from 'path';
|
|
@@ -1247,13 +1247,22 @@ var CallSession = class {
|
|
|
1247
1247
|
}
|
|
1248
1248
|
}
|
|
1249
1249
|
}
|
|
1250
|
-
/**
|
|
1250
|
+
/**
|
|
1251
|
+
* Transfer the call to a phone number or SIP endpoint.
|
|
1252
|
+
*
|
|
1253
|
+
* destinationType='pstn' (default): `to` is a phone number dialed via carrier.
|
|
1254
|
+
* destinationType='sip': `to` is a SIP URI (e.g. `sip:user@host`) connected
|
|
1255
|
+
* directly to a SIP endpoint without going through the PSTN carrier. Requires the
|
|
1256
|
+
* account to have an active `sip_trunk` add-on; otherwise the transfer fails and
|
|
1257
|
+
* the call continues with the AI (result `{ status: 'failed', ... }`).
|
|
1258
|
+
*/
|
|
1251
1259
|
async transfer(to, options) {
|
|
1252
1260
|
if (!this._transferFn) {
|
|
1253
1261
|
throw new Error("transfer not available");
|
|
1254
1262
|
}
|
|
1255
1263
|
return this._transferFn({
|
|
1256
1264
|
to,
|
|
1265
|
+
destinationType: options?.destinationType ?? "pstn",
|
|
1257
1266
|
mode: options?.mode ?? "blind",
|
|
1258
1267
|
afterTransfer: options?.afterTransfer ?? "terminate",
|
|
1259
1268
|
holdMedia: options?.holdMedia ?? "ringback",
|
|
@@ -1737,6 +1746,8 @@ var ClawOpsAgent = class _ClawOpsAgent {
|
|
|
1737
1746
|
/** prewarm 세션이 실제 CallSession 에 attach 완료된 callId. attached 이후의 stop() 은 정상 종료 경로가 책임진다. */
|
|
1738
1747
|
_prewarmAttached = /* @__PURE__ */ new Set();
|
|
1739
1748
|
_prewarmEnabled;
|
|
1749
|
+
/** 모든 발신에 적용되는 AMD default. call() 인자로 호출별 override 가능. */
|
|
1750
|
+
_machineDetection;
|
|
1740
1751
|
constructor(options) {
|
|
1741
1752
|
this._apiKey = options.apiKey ?? process.env["CLAWOPS_API_KEY"] ?? "";
|
|
1742
1753
|
this._accountId = options.accountId ?? process.env["CLAWOPS_ACCOUNT_ID"] ?? "";
|
|
@@ -1751,6 +1762,7 @@ var ClawOpsAgent = class _ClawOpsAgent {
|
|
|
1751
1762
|
this._rxGain = _ClawOpsAgent._validateGain("rxGain", options.rxGain ?? 1);
|
|
1752
1763
|
this._txGain = _ClawOpsAgent._validateGain("txGain", options.txGain ?? 1);
|
|
1753
1764
|
this._prewarmEnabled = options.prewarmEnabled ?? true;
|
|
1765
|
+
this._machineDetection = options.machineDetection;
|
|
1754
1766
|
if (options.tracing) {
|
|
1755
1767
|
setTracingConfig(options.tracing);
|
|
1756
1768
|
}
|
|
@@ -1879,6 +1891,8 @@ var ClawOpsAgent = class _ClawOpsAgent {
|
|
|
1879
1891
|
*
|
|
1880
1892
|
* @param options.machineDetection 자동응답기/음성사서함 감지(AMD).
|
|
1881
1893
|
* `'Enable'`=감지 후 `AnsweredBy` 통보(통화 계속), `'Hangup'`=음성사서함 감지 시 자동 종료.
|
|
1894
|
+
* 미지정 시 인스턴스 default(생성자의 `machineDetection`)를 따른다.
|
|
1895
|
+
* 우선순위: 호출 인자 > 인스턴스 default > 비활성.
|
|
1882
1896
|
*/
|
|
1883
1897
|
async call(to, options) {
|
|
1884
1898
|
await this.connect();
|
|
@@ -1888,8 +1902,9 @@ var ClawOpsAgent = class _ClawOpsAgent {
|
|
|
1888
1902
|
From: this._fromNumber,
|
|
1889
1903
|
Timeout: options?.timeout ?? 60
|
|
1890
1904
|
};
|
|
1891
|
-
|
|
1892
|
-
|
|
1905
|
+
const effectiveMd = options?.machineDetection ?? this._machineDetection;
|
|
1906
|
+
if (effectiveMd) {
|
|
1907
|
+
body["MachineDetection"] = effectiveMd;
|
|
1893
1908
|
}
|
|
1894
1909
|
const resp = await fetch(url, {
|
|
1895
1910
|
method: "POST",
|
|
@@ -2334,11 +2349,12 @@ var SEND_DTMF = {
|
|
|
2334
2349
|
};
|
|
2335
2350
|
var TRANSFER_CALL = {
|
|
2336
2351
|
name: "transfer_call",
|
|
2337
|
-
description: "Transfer the current call to another phone number. Use for blind transfer (direct handoff) or warm transfer (with whisper message to the target).",
|
|
2352
|
+
description: "Transfer the current call to another phone number or SIP endpoint. Use for blind transfer (direct handoff) or warm transfer (with whisper message to the target).",
|
|
2338
2353
|
parameters: {
|
|
2339
2354
|
type: "object",
|
|
2340
2355
|
properties: {
|
|
2341
|
-
to: { type: "string", description: "
|
|
2356
|
+
to: { type: "string", description: "Transfer destination. A phone number when destination_type is 'pstn', or a SIP URI (e.g. 'sip:user@host') when destination_type is 'sip'." },
|
|
2357
|
+
destination_type: { type: "string", enum: ["pstn", "sip"], description: "pstn: dial a phone number via carrier (default). sip: connect directly to a SIP endpoint (no carrier/PSTN)." },
|
|
2342
2358
|
mode: { type: "string", enum: ["blind", "warm"], description: "blind: direct transfer (default), warm: play whisper to target first" },
|
|
2343
2359
|
after_transfer: { type: "string", enum: ["terminate", "return"], description: "terminate: end AI session (default), return: AI resumes after transfer ends" },
|
|
2344
2360
|
whisper: { type: "string", description: "Message to speak to transfer target before connecting customer (warm mode only)" },
|
|
@@ -2428,6 +2444,7 @@ async function executeBuiltinTool(funcName, args, call) {
|
|
|
2428
2444
|
if (funcName === "transfer_call") {
|
|
2429
2445
|
try {
|
|
2430
2446
|
call.transfer(args["to"], {
|
|
2447
|
+
destinationType: args["destination_type"] ?? void 0,
|
|
2431
2448
|
mode: args["mode"] ?? void 0,
|
|
2432
2449
|
afterTransfer: args["after_transfer"] ?? void 0,
|
|
2433
2450
|
whisper: args["whisper"] ?? void 0,
|