ttp-agent-sdk 2.45.1 → 2.45.4

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.
@@ -11810,7 +11810,7 @@ var TextChatSDK = /*#__PURE__*/function (_EventEmitter) {
11810
11810
 
11811
11811
  // SDK build time for debugging
11812
11812
  if (true) {
11813
- helloMessage.lastBuildTime = "2026-06-12T15:13:11.602Z";
11813
+ helloMessage.lastBuildTime = "2026-06-12T20:23:48.560Z";
11814
11814
  }
11815
11815
  try {
11816
11816
  this.ws.send(JSON.stringify(helloMessage));
@@ -14941,13 +14941,33 @@ var AsyncFunction = Object.getPrototypeOf(/*#__PURE__*/_asyncToGenerator(/*#__PU
14941
14941
  }, _callee);
14942
14942
  }))).constructor;
14943
14943
 
14944
- // Wrap and compile an adapter body. The body is stored as an arrow function
14945
- // expression, so we wrap it, evaluate, and invoke. AsyncFunction (not
14944
+ // Wrap and compile an adapter body. Two authoring styles are accepted:
14945
+ //
14946
+ // 1. Function expression (how DB partner adapters are stored):
14947
+ // async (ctx) => { ...; return {...}; }
14948
+ // 2. Raw statement body (how client-tool scripts are typed in the UI):
14949
+ // alert("hi"); return { ok: true };
14950
+ // The body runs inside an AsyncFunction whose single parameter is `ctx`,
14951
+ // so `ctx.args` etc. are directly in scope.
14952
+ //
14953
+ // Expression style is detected by shape (starts with `async`, `function`, `(`,
14954
+ // or `name =>`) and tried first; if it doesn't parse as an expression we fall
14955
+ // back to compiling the code as a plain body. AsyncFunction (not
14946
14956
  // `new Function`) enforces an async execution context — no accidental sync
14947
14957
  // adapter bodies.
14958
+ var FN_EXPR_RE = /^\s*(async[\s(])|^\s*function\b|^\s*\(|^\s*[A-Za-z_$][\w$]*\s*=>/;
14948
14959
  function compileAdapter(codeJs) {
14960
+ if (FN_EXPR_RE.test(codeJs)) {
14961
+ try {
14962
+ // eslint-disable-next-line no-new-func
14963
+ return new AsyncFunction('ctx', "\"use strict\"; return (".concat(codeJs, ").call(null, ctx);"));
14964
+ } catch (e) {
14965
+ // Looked like an expression but doesn't parse as one (e.g. an
14966
+ // IIFE-opening statement body) — fall through to body compilation.
14967
+ }
14968
+ }
14949
14969
  // eslint-disable-next-line no-new-func
14950
- return new AsyncFunction('ctx', "\"use strict\"; return (".concat(codeJs, ").call(null, ctx);"));
14970
+ return new AsyncFunction('ctx', "\"use strict\"; ".concat(codeJs));
14951
14971
  }
14952
14972
 
14953
14973
  // Cheap 32-bit string hash, rendered as 12 hex chars. NOT cryptographic —
@@ -19956,8 +19976,8 @@ var VoiceSDK = _v2_VoiceSDK_js__WEBPACK_IMPORTED_MODULE_0__["default"];
19956
19976
 
19957
19977
 
19958
19978
  // Version - injected at build time from package.json via webpack DefinePlugin
19959
- var VERSION = "2.45.0";
19960
- var BUILD_TIME = "2026-06-12T15:13:11.602Z";
19979
+ var VERSION = "2.45.2";
19980
+ var BUILD_TIME = "2026-06-12T20:23:48.560Z";
19961
19981
  console.log("%c TTP Agent SDK v".concat(VERSION, " (").concat(BUILD_TIME, ") "), 'background: #4f46e5; color: white; font-size: 12px; font-weight: bold; padding: 2px 6px; border-radius: 4px;');
19962
19982
 
19963
19983
  // Named exports
@@ -27459,7 +27479,7 @@ var VoiceSDK_v2 = /*#__PURE__*/function (_EventEmitter) {
27459
27479
 
27460
27480
  // Include SDK build time for debugging
27461
27481
  if (true) {
27462
- helloMessage.lastBuildTime = "2026-06-12T15:13:11.602Z";
27482
+ helloMessage.lastBuildTime = "2026-06-12T20:23:48.560Z";
27463
27483
  }
27464
27484
 
27465
27485
  // Page context is intentionally NOT attached to the hello message.