@teamlearners/clawops 0.22.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.
@@ -251,7 +251,9 @@ declare class CallSession {
251
251
  *
252
252
  * destinationType='pstn' (default): `to` is a phone number dialed via carrier.
253
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.
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', ... }`).
255
257
  */
256
258
  transfer(to: string, options?: {
257
259
  destinationType?: 'pstn' | 'sip';
@@ -465,6 +467,13 @@ interface ClawOpsAgentOptions {
465
467
  * Python SDK 의 `prewarm_enabled` 과 mirror.
466
468
  */
467
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';
468
477
  }
469
478
  declare class ClawOpsAgent {
470
479
  private _apiKey;
@@ -496,6 +505,8 @@ declare class ClawOpsAgent {
496
505
  /** prewarm 세션이 실제 CallSession 에 attach 완료된 callId. attached 이후의 stop() 은 정상 종료 경로가 책임진다. */
497
506
  private _prewarmAttached;
498
507
  private _prewarmEnabled;
508
+ /** 모든 발신에 적용되는 AMD default. call() 인자로 호출별 override 가능. */
509
+ private _machineDetection?;
499
510
  constructor(options: ClawOpsAgentOptions);
500
511
  private static _validateGain;
501
512
  /**
@@ -529,6 +540,8 @@ declare class ClawOpsAgent {
529
540
  *
530
541
  * @param options.machineDetection 자동응답기/음성사서함 감지(AMD).
531
542
  * `'Enable'`=감지 후 `AnsweredBy` 통보(통화 계속), `'Hangup'`=음성사서함 감지 시 자동 종료.
543
+ * 미지정 시 인스턴스 default(생성자의 `machineDetection`)를 따른다.
544
+ * 우선순위: 호출 인자 > 인스턴스 default > 비활성.
532
545
  */
533
546
  call(to: string, options?: {
534
547
  timeout?: number;
@@ -251,7 +251,9 @@ declare class CallSession {
251
251
  *
252
252
  * destinationType='pstn' (default): `to` is a phone number dialed via carrier.
253
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.
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', ... }`).
255
257
  */
256
258
  transfer(to: string, options?: {
257
259
  destinationType?: 'pstn' | 'sip';
@@ -465,6 +467,13 @@ interface ClawOpsAgentOptions {
465
467
  * Python SDK 의 `prewarm_enabled` 과 mirror.
466
468
  */
467
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';
468
477
  }
469
478
  declare class ClawOpsAgent {
470
479
  private _apiKey;
@@ -496,6 +505,8 @@ declare class ClawOpsAgent {
496
505
  /** prewarm 세션이 실제 CallSession 에 attach 완료된 callId. attached 이후의 stop() 은 정상 종료 경로가 책임진다. */
497
506
  private _prewarmAttached;
498
507
  private _prewarmEnabled;
508
+ /** 모든 발신에 적용되는 AMD default. call() 인자로 호출별 override 가능. */
509
+ private _machineDetection?;
499
510
  constructor(options: ClawOpsAgentOptions);
500
511
  private static _validateGain;
501
512
  /**
@@ -529,6 +540,8 @@ declare class ClawOpsAgent {
529
540
  *
530
541
  * @param options.machineDetection 자동응답기/음성사서함 감지(AMD).
531
542
  * `'Enable'`=감지 후 `AnsweredBy` 통보(통화 계속), `'Hangup'`=음성사서함 감지 시 자동 종료.
543
+ * 미지정 시 인스턴스 default(생성자의 `machineDetection`)를 따른다.
544
+ * 우선순위: 호출 인자 > 인스턴스 default > 비활성.
532
545
  */
533
546
  call(to: string, options?: {
534
547
  timeout?: number;
@@ -1,4 +1,4 @@
1
- import { DEFAULT_BASE_URL, AgentError, AgentConnectionError, VERSION } from '../chunk-5PLVSC2U.js';
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';
@@ -1252,7 +1252,9 @@ var CallSession = class {
1252
1252
  *
1253
1253
  * destinationType='pstn' (default): `to` is a phone number dialed via carrier.
1254
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.
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', ... }`).
1256
1258
  */
1257
1259
  async transfer(to, options) {
1258
1260
  if (!this._transferFn) {
@@ -1744,6 +1746,8 @@ var ClawOpsAgent = class _ClawOpsAgent {
1744
1746
  /** prewarm 세션이 실제 CallSession 에 attach 완료된 callId. attached 이후의 stop() 은 정상 종료 경로가 책임진다. */
1745
1747
  _prewarmAttached = /* @__PURE__ */ new Set();
1746
1748
  _prewarmEnabled;
1749
+ /** 모든 발신에 적용되는 AMD default. call() 인자로 호출별 override 가능. */
1750
+ _machineDetection;
1747
1751
  constructor(options) {
1748
1752
  this._apiKey = options.apiKey ?? process.env["CLAWOPS_API_KEY"] ?? "";
1749
1753
  this._accountId = options.accountId ?? process.env["CLAWOPS_ACCOUNT_ID"] ?? "";
@@ -1758,6 +1762,7 @@ var ClawOpsAgent = class _ClawOpsAgent {
1758
1762
  this._rxGain = _ClawOpsAgent._validateGain("rxGain", options.rxGain ?? 1);
1759
1763
  this._txGain = _ClawOpsAgent._validateGain("txGain", options.txGain ?? 1);
1760
1764
  this._prewarmEnabled = options.prewarmEnabled ?? true;
1765
+ this._machineDetection = options.machineDetection;
1761
1766
  if (options.tracing) {
1762
1767
  setTracingConfig(options.tracing);
1763
1768
  }
@@ -1886,6 +1891,8 @@ var ClawOpsAgent = class _ClawOpsAgent {
1886
1891
  *
1887
1892
  * @param options.machineDetection 자동응답기/음성사서함 감지(AMD).
1888
1893
  * `'Enable'`=감지 후 `AnsweredBy` 통보(통화 계속), `'Hangup'`=음성사서함 감지 시 자동 종료.
1894
+ * 미지정 시 인스턴스 default(생성자의 `machineDetection`)를 따른다.
1895
+ * 우선순위: 호출 인자 > 인스턴스 default > 비활성.
1889
1896
  */
1890
1897
  async call(to, options) {
1891
1898
  await this.connect();
@@ -1895,8 +1902,9 @@ var ClawOpsAgent = class _ClawOpsAgent {
1895
1902
  From: this._fromNumber,
1896
1903
  Timeout: options?.timeout ?? 60
1897
1904
  };
1898
- if (options?.machineDetection) {
1899
- body["MachineDetection"] = options.machineDetection;
1905
+ const effectiveMd = options?.machineDetection ?? this._machineDetection;
1906
+ if (effectiveMd) {
1907
+ body["MachineDetection"] = effectiveMd;
1900
1908
  }
1901
1909
  const resp = await fetch(url, {
1902
1910
  method: "POST",