@voicethere/agent 0.23.1 → 0.23.2

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.
@@ -557,6 +557,34 @@ function clearPendingConversationHistoryAcksForSession(sessionId, reason) {
557
557
  }
558
558
  var sessionExecutionContext = new AsyncLocalStorage();
559
559
  var agentLogSessionContext = new AsyncLocalStorage();
560
+ var CURRENT_SESSION_ID_GETTER_KEY = Symbol.for("voicethere.agent.currentSessionId");
561
+ function currentHandlerSessionId() {
562
+ const id = sessionExecutionContext.getStore()?.sessionId ?? agentLogSessionContext.getStore();
563
+ return id ? id : void 0;
564
+ }
565
+ var previousSessionIdGetter;
566
+ function stringOrUndefined(value) {
567
+ return typeof value === "string" && value ? value : void 0;
568
+ }
569
+ function currentSessionIdGetter() {
570
+ const own = currentHandlerSessionId();
571
+ if (own)
572
+ return own;
573
+ try {
574
+ return stringOrUndefined(previousSessionIdGetter?.());
575
+ } catch {
576
+ return void 0;
577
+ }
578
+ }
579
+ function installCurrentSessionIdGetter() {
580
+ const g = globalThis;
581
+ const previous = g[CURRENT_SESSION_ID_GETTER_KEY];
582
+ if (previous === currentSessionIdGetter)
583
+ return;
584
+ g[CURRENT_SESSION_ID_GETTER_KEY] = currentSessionIdGetter;
585
+ previousSessionIdGetter = typeof previous === "function" ? previous : void 0;
586
+ }
587
+ installCurrentSessionIdGetter();
560
588
  var inboundQueueAuthority = null;
561
589
  var childUnhandledRejectionGuardInstalled = false;
562
590
  function normalizeRejectionReason(reason) {
@@ -1082,7 +1110,7 @@ function sanitizeAgentLogFields(fields) {
1082
1110
  }
1083
1111
  }
1084
1112
  function buildAgentLogPayload(level, message, fields, sessionId) {
1085
- const resolvedSessionId = sessionId ?? sessionExecutionContext.getStore()?.sessionId ?? agentLogSessionContext.getStore();
1113
+ const resolvedSessionId = sessionId ?? currentHandlerSessionId();
1086
1114
  const sanitizedFields = fields ? sanitizeAgentLogFields(fields) : void 0;
1087
1115
  return {
1088
1116
  type: "log",
@@ -11311,6 +11311,34 @@ function clearPendingConversationHistoryAcksForSession(sessionId, reason) {
11311
11311
  }
11312
11312
  var sessionExecutionContext = new AsyncLocalStorage();
11313
11313
  var agentLogSessionContext = new AsyncLocalStorage();
11314
+ var CURRENT_SESSION_ID_GETTER_KEY = Symbol.for("voicethere.agent.currentSessionId");
11315
+ function currentHandlerSessionId() {
11316
+ const id = sessionExecutionContext.getStore()?.sessionId ?? agentLogSessionContext.getStore();
11317
+ return id ? id : void 0;
11318
+ }
11319
+ var previousSessionIdGetter;
11320
+ function stringOrUndefined(value) {
11321
+ return typeof value === "string" && value ? value : void 0;
11322
+ }
11323
+ function currentSessionIdGetter() {
11324
+ const own = currentHandlerSessionId();
11325
+ if (own)
11326
+ return own;
11327
+ try {
11328
+ return stringOrUndefined(previousSessionIdGetter?.());
11329
+ } catch {
11330
+ return void 0;
11331
+ }
11332
+ }
11333
+ function installCurrentSessionIdGetter() {
11334
+ const g = globalThis;
11335
+ const previous = g[CURRENT_SESSION_ID_GETTER_KEY];
11336
+ if (previous === currentSessionIdGetter)
11337
+ return;
11338
+ g[CURRENT_SESSION_ID_GETTER_KEY] = currentSessionIdGetter;
11339
+ previousSessionIdGetter = typeof previous === "function" ? previous : void 0;
11340
+ }
11341
+ installCurrentSessionIdGetter();
11314
11342
  var inboundQueueAuthority = null;
11315
11343
  var childUnhandledRejectionGuardInstalled = false;
11316
11344
  function normalizeRejectionReason(reason) {
@@ -11850,7 +11878,7 @@ function sanitizeAgentLogFields(fields) {
11850
11878
  }
11851
11879
  }
11852
11880
  function buildAgentLogPayload(level, message, fields, sessionId) {
11853
- const resolvedSessionId = sessionId ?? sessionExecutionContext.getStore()?.sessionId ?? agentLogSessionContext.getStore();
11881
+ const resolvedSessionId = sessionId ?? currentHandlerSessionId();
11854
11882
  const sanitizedFields = fields ? sanitizeAgentLogFields(fields) : void 0;
11855
11883
  return {
11856
11884
  type: "log",
@@ -635,6 +635,34 @@ function isVoicethereAgentChild() {
635
635
  }
636
636
  var sessionExecutionContext = new AsyncLocalStorage();
637
637
  var agentLogSessionContext = new AsyncLocalStorage();
638
+ var CURRENT_SESSION_ID_GETTER_KEY = Symbol.for("voicethere.agent.currentSessionId");
639
+ function currentHandlerSessionId() {
640
+ const id = sessionExecutionContext.getStore()?.sessionId ?? agentLogSessionContext.getStore();
641
+ return id ? id : void 0;
642
+ }
643
+ var previousSessionIdGetter;
644
+ function stringOrUndefined(value) {
645
+ return typeof value === "string" && value ? value : void 0;
646
+ }
647
+ function currentSessionIdGetter() {
648
+ const own = currentHandlerSessionId();
649
+ if (own)
650
+ return own;
651
+ try {
652
+ return stringOrUndefined(previousSessionIdGetter?.());
653
+ } catch {
654
+ return void 0;
655
+ }
656
+ }
657
+ function installCurrentSessionIdGetter() {
658
+ const g = globalThis;
659
+ const previous = g[CURRENT_SESSION_ID_GETTER_KEY];
660
+ if (previous === currentSessionIdGetter)
661
+ return;
662
+ g[CURRENT_SESSION_ID_GETTER_KEY] = currentSessionIdGetter;
663
+ previousSessionIdGetter = typeof previous === "function" ? previous : void 0;
664
+ }
665
+ installCurrentSessionIdGetter();
638
666
  var inboundQueueAuthority = null;
639
667
  var childUnhandledRejectionGuardInstalled = false;
640
668
  function normalizeRejectionReason(reason) {
@@ -1367,7 +1395,7 @@ function sanitizeAgentLogFields(fields) {
1367
1395
  }
1368
1396
  }
1369
1397
  function buildAgentLogPayload(level, message, fields, sessionId) {
1370
- const resolvedSessionId = sessionId ?? sessionExecutionContext.getStore()?.sessionId ?? agentLogSessionContext.getStore();
1398
+ const resolvedSessionId = sessionId ?? currentHandlerSessionId();
1371
1399
  const sanitizedFields = fields ? sanitizeAgentLogFields(fields) : void 0;
1372
1400
  return {
1373
1401
  type: "log",
@@ -31205,6 +31205,34 @@ function isVoicethereAgentChild() {
31205
31205
  }
31206
31206
  var sessionExecutionContext = new AsyncLocalStorage();
31207
31207
  var agentLogSessionContext = new AsyncLocalStorage();
31208
+ var CURRENT_SESSION_ID_GETTER_KEY = Symbol.for("voicethere.agent.currentSessionId");
31209
+ function currentHandlerSessionId() {
31210
+ const id = sessionExecutionContext.getStore()?.sessionId ?? agentLogSessionContext.getStore();
31211
+ return id ? id : void 0;
31212
+ }
31213
+ var previousSessionIdGetter;
31214
+ function stringOrUndefined(value) {
31215
+ return typeof value === "string" && value ? value : void 0;
31216
+ }
31217
+ function currentSessionIdGetter() {
31218
+ const own2 = currentHandlerSessionId();
31219
+ if (own2)
31220
+ return own2;
31221
+ try {
31222
+ return stringOrUndefined(previousSessionIdGetter?.());
31223
+ } catch {
31224
+ return void 0;
31225
+ }
31226
+ }
31227
+ function installCurrentSessionIdGetter() {
31228
+ const g = globalThis;
31229
+ const previous = g[CURRENT_SESSION_ID_GETTER_KEY];
31230
+ if (previous === currentSessionIdGetter)
31231
+ return;
31232
+ g[CURRENT_SESSION_ID_GETTER_KEY] = currentSessionIdGetter;
31233
+ previousSessionIdGetter = typeof previous === "function" ? previous : void 0;
31234
+ }
31235
+ installCurrentSessionIdGetter();
31208
31236
  var inboundQueueAuthority = null;
31209
31237
  var childUnhandledRejectionGuardInstalled = false;
31210
31238
  function normalizeRejectionReason(reason) {
@@ -31858,7 +31886,7 @@ function sanitizeAgentLogFields(fields) {
31858
31886
  }
31859
31887
  }
31860
31888
  function buildAgentLogPayload(level, message, fields, sessionId) {
31861
- const resolvedSessionId = sessionId ?? sessionExecutionContext.getStore()?.sessionId ?? agentLogSessionContext.getStore();
31889
+ const resolvedSessionId = sessionId ?? currentHandlerSessionId();
31862
31890
  const sanitizedFields = fields ? sanitizeAgentLogFields(fields) : void 0;
31863
31891
  return {
31864
31892
  type: "log",
@@ -31205,6 +31205,34 @@ function isVoicethereAgentChild() {
31205
31205
  }
31206
31206
  var sessionExecutionContext = new AsyncLocalStorage();
31207
31207
  var agentLogSessionContext = new AsyncLocalStorage();
31208
+ var CURRENT_SESSION_ID_GETTER_KEY = Symbol.for("voicethere.agent.currentSessionId");
31209
+ function currentHandlerSessionId() {
31210
+ const id = sessionExecutionContext.getStore()?.sessionId ?? agentLogSessionContext.getStore();
31211
+ return id ? id : void 0;
31212
+ }
31213
+ var previousSessionIdGetter;
31214
+ function stringOrUndefined(value) {
31215
+ return typeof value === "string" && value ? value : void 0;
31216
+ }
31217
+ function currentSessionIdGetter() {
31218
+ const own2 = currentHandlerSessionId();
31219
+ if (own2)
31220
+ return own2;
31221
+ try {
31222
+ return stringOrUndefined(previousSessionIdGetter?.());
31223
+ } catch {
31224
+ return void 0;
31225
+ }
31226
+ }
31227
+ function installCurrentSessionIdGetter() {
31228
+ const g = globalThis;
31229
+ const previous = g[CURRENT_SESSION_ID_GETTER_KEY];
31230
+ if (previous === currentSessionIdGetter)
31231
+ return;
31232
+ g[CURRENT_SESSION_ID_GETTER_KEY] = currentSessionIdGetter;
31233
+ previousSessionIdGetter = typeof previous === "function" ? previous : void 0;
31234
+ }
31235
+ installCurrentSessionIdGetter();
31208
31236
  var inboundQueueAuthority = null;
31209
31237
  var childUnhandledRejectionGuardInstalled = false;
31210
31238
  function normalizeRejectionReason(reason) {
@@ -31858,7 +31886,7 @@ function sanitizeAgentLogFields(fields) {
31858
31886
  }
31859
31887
  }
31860
31888
  function buildAgentLogPayload(level, message, fields, sessionId) {
31861
- const resolvedSessionId = sessionId ?? sessionExecutionContext.getStore()?.sessionId ?? agentLogSessionContext.getStore();
31889
+ const resolvedSessionId = sessionId ?? currentHandlerSessionId();
31862
31890
  const sanitizedFields = fields ? sanitizeAgentLogFields(fields) : void 0;
31863
31891
  return {
31864
31892
  type: "log",
@@ -31205,6 +31205,34 @@ function isVoicethereAgentChild() {
31205
31205
  }
31206
31206
  var sessionExecutionContext = new AsyncLocalStorage();
31207
31207
  var agentLogSessionContext = new AsyncLocalStorage();
31208
+ var CURRENT_SESSION_ID_GETTER_KEY = Symbol.for("voicethere.agent.currentSessionId");
31209
+ function currentHandlerSessionId() {
31210
+ const id = sessionExecutionContext.getStore()?.sessionId ?? agentLogSessionContext.getStore();
31211
+ return id ? id : void 0;
31212
+ }
31213
+ var previousSessionIdGetter;
31214
+ function stringOrUndefined(value) {
31215
+ return typeof value === "string" && value ? value : void 0;
31216
+ }
31217
+ function currentSessionIdGetter() {
31218
+ const own2 = currentHandlerSessionId();
31219
+ if (own2)
31220
+ return own2;
31221
+ try {
31222
+ return stringOrUndefined(previousSessionIdGetter?.());
31223
+ } catch {
31224
+ return void 0;
31225
+ }
31226
+ }
31227
+ function installCurrentSessionIdGetter() {
31228
+ const g = globalThis;
31229
+ const previous = g[CURRENT_SESSION_ID_GETTER_KEY];
31230
+ if (previous === currentSessionIdGetter)
31231
+ return;
31232
+ g[CURRENT_SESSION_ID_GETTER_KEY] = currentSessionIdGetter;
31233
+ previousSessionIdGetter = typeof previous === "function" ? previous : void 0;
31234
+ }
31235
+ installCurrentSessionIdGetter();
31208
31236
  var inboundQueueAuthority = null;
31209
31237
  var childUnhandledRejectionGuardInstalled = false;
31210
31238
  function normalizeRejectionReason(reason) {
@@ -31858,7 +31886,7 @@ function sanitizeAgentLogFields(fields) {
31858
31886
  }
31859
31887
  }
31860
31888
  function buildAgentLogPayload(level, message, fields, sessionId) {
31861
- const resolvedSessionId = sessionId ?? sessionExecutionContext.getStore()?.sessionId ?? agentLogSessionContext.getStore();
31889
+ const resolvedSessionId = sessionId ?? currentHandlerSessionId();
31862
31890
  const sanitizedFields = fields ? sanitizeAgentLogFields(fields) : void 0;
31863
31891
  return {
31864
31892
  type: "log",
@@ -577,6 +577,34 @@ function isVoicethereAgentChild() {
577
577
  }
578
578
  var sessionExecutionContext = new AsyncLocalStorage();
579
579
  var agentLogSessionContext = new AsyncLocalStorage();
580
+ var CURRENT_SESSION_ID_GETTER_KEY = Symbol.for("voicethere.agent.currentSessionId");
581
+ function currentHandlerSessionId() {
582
+ const id = sessionExecutionContext.getStore()?.sessionId ?? agentLogSessionContext.getStore();
583
+ return id ? id : void 0;
584
+ }
585
+ var previousSessionIdGetter;
586
+ function stringOrUndefined(value) {
587
+ return typeof value === "string" && value ? value : void 0;
588
+ }
589
+ function currentSessionIdGetter() {
590
+ const own = currentHandlerSessionId();
591
+ if (own)
592
+ return own;
593
+ try {
594
+ return stringOrUndefined(previousSessionIdGetter?.());
595
+ } catch {
596
+ return void 0;
597
+ }
598
+ }
599
+ function installCurrentSessionIdGetter() {
600
+ const g = globalThis;
601
+ const previous = g[CURRENT_SESSION_ID_GETTER_KEY];
602
+ if (previous === currentSessionIdGetter)
603
+ return;
604
+ g[CURRENT_SESSION_ID_GETTER_KEY] = currentSessionIdGetter;
605
+ previousSessionIdGetter = typeof previous === "function" ? previous : void 0;
606
+ }
607
+ installCurrentSessionIdGetter();
580
608
  var inboundQueueAuthority = null;
581
609
  var childUnhandledRejectionGuardInstalled = false;
582
610
  function normalizeRejectionReason(reason) {
@@ -1222,7 +1250,7 @@ function sanitizeAgentLogFields(fields) {
1222
1250
  }
1223
1251
  }
1224
1252
  function buildAgentLogPayload(level, message, fields, sessionId) {
1225
- const resolvedSessionId = sessionId ?? sessionExecutionContext.getStore()?.sessionId ?? agentLogSessionContext.getStore();
1253
+ const resolvedSessionId = sessionId ?? currentHandlerSessionId();
1226
1254
  const sanitizedFields = fields ? sanitizeAgentLogFields(fields) : void 0;
1227
1255
  return {
1228
1256
  type: "log",
@@ -562,6 +562,34 @@ function isVoicethereAgentChild() {
562
562
  }
563
563
  var sessionExecutionContext = new AsyncLocalStorage();
564
564
  var agentLogSessionContext = new AsyncLocalStorage();
565
+ var CURRENT_SESSION_ID_GETTER_KEY = Symbol.for("voicethere.agent.currentSessionId");
566
+ function currentHandlerSessionId() {
567
+ const id = sessionExecutionContext.getStore()?.sessionId ?? agentLogSessionContext.getStore();
568
+ return id ? id : void 0;
569
+ }
570
+ var previousSessionIdGetter;
571
+ function stringOrUndefined(value) {
572
+ return typeof value === "string" && value ? value : void 0;
573
+ }
574
+ function currentSessionIdGetter() {
575
+ const own = currentHandlerSessionId();
576
+ if (own)
577
+ return own;
578
+ try {
579
+ return stringOrUndefined(previousSessionIdGetter?.());
580
+ } catch {
581
+ return void 0;
582
+ }
583
+ }
584
+ function installCurrentSessionIdGetter() {
585
+ const g = globalThis;
586
+ const previous = g[CURRENT_SESSION_ID_GETTER_KEY];
587
+ if (previous === currentSessionIdGetter)
588
+ return;
589
+ g[CURRENT_SESSION_ID_GETTER_KEY] = currentSessionIdGetter;
590
+ previousSessionIdGetter = typeof previous === "function" ? previous : void 0;
591
+ }
592
+ installCurrentSessionIdGetter();
565
593
  var inboundQueueAuthority = null;
566
594
  var childUnhandledRejectionGuardInstalled = false;
567
595
  function normalizeRejectionReason(reason) {
@@ -1213,7 +1241,7 @@ function sanitizeAgentLogFields(fields) {
1213
1241
  }
1214
1242
  }
1215
1243
  function buildAgentLogPayload(level, message, fields, sessionId) {
1216
- const resolvedSessionId = sessionId ?? sessionExecutionContext.getStore()?.sessionId ?? agentLogSessionContext.getStore();
1244
+ const resolvedSessionId = sessionId ?? currentHandlerSessionId();
1217
1245
  const sanitizedFields = fields ? sanitizeAgentLogFields(fields) : void 0;
1218
1246
  return {
1219
1247
  type: "log",
@@ -592,6 +592,34 @@ function isVoicethereAgentChild() {
592
592
  }
593
593
  var sessionExecutionContext = new AsyncLocalStorage();
594
594
  var agentLogSessionContext = new AsyncLocalStorage();
595
+ var CURRENT_SESSION_ID_GETTER_KEY = Symbol.for("voicethere.agent.currentSessionId");
596
+ function currentHandlerSessionId() {
597
+ const id = sessionExecutionContext.getStore()?.sessionId ?? agentLogSessionContext.getStore();
598
+ return id ? id : void 0;
599
+ }
600
+ var previousSessionIdGetter;
601
+ function stringOrUndefined(value) {
602
+ return typeof value === "string" && value ? value : void 0;
603
+ }
604
+ function currentSessionIdGetter() {
605
+ const own = currentHandlerSessionId();
606
+ if (own)
607
+ return own;
608
+ try {
609
+ return stringOrUndefined(previousSessionIdGetter?.());
610
+ } catch {
611
+ return void 0;
612
+ }
613
+ }
614
+ function installCurrentSessionIdGetter() {
615
+ const g = globalThis;
616
+ const previous = g[CURRENT_SESSION_ID_GETTER_KEY];
617
+ if (previous === currentSessionIdGetter)
618
+ return;
619
+ g[CURRENT_SESSION_ID_GETTER_KEY] = currentSessionIdGetter;
620
+ previousSessionIdGetter = typeof previous === "function" ? previous : void 0;
621
+ }
622
+ installCurrentSessionIdGetter();
595
623
  var inboundQueueAuthority = null;
596
624
  var childUnhandledRejectionGuardInstalled = false;
597
625
  function normalizeRejectionReason(reason) {
@@ -1457,7 +1485,7 @@ function sanitizeAgentLogFields(fields) {
1457
1485
  }
1458
1486
  }
1459
1487
  function buildAgentLogPayload(level, message, fields, sessionId) {
1460
- const resolvedSessionId = sessionId ?? sessionExecutionContext.getStore()?.sessionId ?? agentLogSessionContext.getStore();
1488
+ const resolvedSessionId = sessionId ?? currentHandlerSessionId();
1461
1489
  const sanitizedFields = fields ? sanitizeAgentLogFields(fields) : void 0;
1462
1490
  return {
1463
1491
  type: "log",
@@ -561,6 +561,34 @@ function isVoicethereAgentChild() {
561
561
  }
562
562
  var sessionExecutionContext = new AsyncLocalStorage();
563
563
  var agentLogSessionContext = new AsyncLocalStorage();
564
+ var CURRENT_SESSION_ID_GETTER_KEY = Symbol.for("voicethere.agent.currentSessionId");
565
+ function currentHandlerSessionId() {
566
+ const id = sessionExecutionContext.getStore()?.sessionId ?? agentLogSessionContext.getStore();
567
+ return id ? id : void 0;
568
+ }
569
+ var previousSessionIdGetter;
570
+ function stringOrUndefined(value) {
571
+ return typeof value === "string" && value ? value : void 0;
572
+ }
573
+ function currentSessionIdGetter() {
574
+ const own = currentHandlerSessionId();
575
+ if (own)
576
+ return own;
577
+ try {
578
+ return stringOrUndefined(previousSessionIdGetter?.());
579
+ } catch {
580
+ return void 0;
581
+ }
582
+ }
583
+ function installCurrentSessionIdGetter() {
584
+ const g = globalThis;
585
+ const previous = g[CURRENT_SESSION_ID_GETTER_KEY];
586
+ if (previous === currentSessionIdGetter)
587
+ return;
588
+ g[CURRENT_SESSION_ID_GETTER_KEY] = currentSessionIdGetter;
589
+ previousSessionIdGetter = typeof previous === "function" ? previous : void 0;
590
+ }
591
+ installCurrentSessionIdGetter();
564
592
  var inboundQueueAuthority = null;
565
593
  var childUnhandledRejectionGuardInstalled = false;
566
594
  function normalizeRejectionReason(reason) {
@@ -1190,7 +1218,7 @@ function sanitizeAgentLogFields(fields) {
1190
1218
  }
1191
1219
  }
1192
1220
  function buildAgentLogPayload(level, message, fields, sessionId) {
1193
- const resolvedSessionId = sessionId ?? sessionExecutionContext.getStore()?.sessionId ?? agentLogSessionContext.getStore();
1221
+ const resolvedSessionId = sessionId ?? currentHandlerSessionId();
1194
1222
  const sanitizedFields = fields ? sanitizeAgentLogFields(fields) : void 0;
1195
1223
  return {
1196
1224
  type: "log",
@@ -561,6 +561,34 @@ function isVoicethereAgentChild() {
561
561
  }
562
562
  var sessionExecutionContext = new AsyncLocalStorage();
563
563
  var agentLogSessionContext = new AsyncLocalStorage();
564
+ var CURRENT_SESSION_ID_GETTER_KEY = Symbol.for("voicethere.agent.currentSessionId");
565
+ function currentHandlerSessionId() {
566
+ const id = sessionExecutionContext.getStore()?.sessionId ?? agentLogSessionContext.getStore();
567
+ return id ? id : void 0;
568
+ }
569
+ var previousSessionIdGetter;
570
+ function stringOrUndefined(value) {
571
+ return typeof value === "string" && value ? value : void 0;
572
+ }
573
+ function currentSessionIdGetter() {
574
+ const own = currentHandlerSessionId();
575
+ if (own)
576
+ return own;
577
+ try {
578
+ return stringOrUndefined(previousSessionIdGetter?.());
579
+ } catch {
580
+ return void 0;
581
+ }
582
+ }
583
+ function installCurrentSessionIdGetter() {
584
+ const g = globalThis;
585
+ const previous = g[CURRENT_SESSION_ID_GETTER_KEY];
586
+ if (previous === currentSessionIdGetter)
587
+ return;
588
+ g[CURRENT_SESSION_ID_GETTER_KEY] = currentSessionIdGetter;
589
+ previousSessionIdGetter = typeof previous === "function" ? previous : void 0;
590
+ }
591
+ installCurrentSessionIdGetter();
564
592
  var inboundQueueAuthority = null;
565
593
  var childUnhandledRejectionGuardInstalled = false;
566
594
  function normalizeRejectionReason(reason) {
@@ -1174,7 +1202,7 @@ function sanitizeAgentLogFields(fields) {
1174
1202
  }
1175
1203
  }
1176
1204
  function buildAgentLogPayload(level, message, fields, sessionId) {
1177
- const resolvedSessionId = sessionId ?? sessionExecutionContext.getStore()?.sessionId ?? agentLogSessionContext.getStore();
1205
+ const resolvedSessionId = sessionId ?? currentHandlerSessionId();
1178
1206
  const sanitizedFields = fields ? sanitizeAgentLogFields(fields) : void 0;
1179
1207
  return {
1180
1208
  type: "log",
@@ -564,6 +564,34 @@ function isVoicethereAgentChild() {
564
564
  }
565
565
  var sessionExecutionContext = new AsyncLocalStorage();
566
566
  var agentLogSessionContext = new AsyncLocalStorage();
567
+ var CURRENT_SESSION_ID_GETTER_KEY = Symbol.for("voicethere.agent.currentSessionId");
568
+ function currentHandlerSessionId() {
569
+ const id = sessionExecutionContext.getStore()?.sessionId ?? agentLogSessionContext.getStore();
570
+ return id ? id : void 0;
571
+ }
572
+ var previousSessionIdGetter;
573
+ function stringOrUndefined(value) {
574
+ return typeof value === "string" && value ? value : void 0;
575
+ }
576
+ function currentSessionIdGetter() {
577
+ const own = currentHandlerSessionId();
578
+ if (own)
579
+ return own;
580
+ try {
581
+ return stringOrUndefined(previousSessionIdGetter?.());
582
+ } catch {
583
+ return void 0;
584
+ }
585
+ }
586
+ function installCurrentSessionIdGetter() {
587
+ const g = globalThis;
588
+ const previous = g[CURRENT_SESSION_ID_GETTER_KEY];
589
+ if (previous === currentSessionIdGetter)
590
+ return;
591
+ g[CURRENT_SESSION_ID_GETTER_KEY] = currentSessionIdGetter;
592
+ previousSessionIdGetter = typeof previous === "function" ? previous : void 0;
593
+ }
594
+ installCurrentSessionIdGetter();
567
595
  var inboundQueueAuthority = null;
568
596
  var childUnhandledRejectionGuardInstalled = false;
569
597
  function normalizeRejectionReason(reason) {
@@ -1185,7 +1213,7 @@ function sanitizeAgentLogFields(fields) {
1185
1213
  }
1186
1214
  }
1187
1215
  function buildAgentLogPayload(level, message, fields, sessionId) {
1188
- const resolvedSessionId = sessionId ?? sessionExecutionContext.getStore()?.sessionId ?? agentLogSessionContext.getStore();
1216
+ const resolvedSessionId = sessionId ?? currentHandlerSessionId();
1189
1217
  const sanitizedFields = fields ? sanitizeAgentLogFields(fields) : void 0;
1190
1218
  return {
1191
1219
  type: "log",
@@ -11312,6 +11312,34 @@ function clearPendingConversationHistoryAcksForSession(sessionId, reason) {
11312
11312
  }
11313
11313
  var sessionExecutionContext = new AsyncLocalStorage();
11314
11314
  var agentLogSessionContext = new AsyncLocalStorage();
11315
+ var CURRENT_SESSION_ID_GETTER_KEY = Symbol.for("voicethere.agent.currentSessionId");
11316
+ function currentHandlerSessionId() {
11317
+ const id = sessionExecutionContext.getStore()?.sessionId ?? agentLogSessionContext.getStore();
11318
+ return id ? id : void 0;
11319
+ }
11320
+ var previousSessionIdGetter;
11321
+ function stringOrUndefined(value) {
11322
+ return typeof value === "string" && value ? value : void 0;
11323
+ }
11324
+ function currentSessionIdGetter() {
11325
+ const own = currentHandlerSessionId();
11326
+ if (own)
11327
+ return own;
11328
+ try {
11329
+ return stringOrUndefined(previousSessionIdGetter?.());
11330
+ } catch {
11331
+ return void 0;
11332
+ }
11333
+ }
11334
+ function installCurrentSessionIdGetter() {
11335
+ const g = globalThis;
11336
+ const previous = g[CURRENT_SESSION_ID_GETTER_KEY];
11337
+ if (previous === currentSessionIdGetter)
11338
+ return;
11339
+ g[CURRENT_SESSION_ID_GETTER_KEY] = currentSessionIdGetter;
11340
+ previousSessionIdGetter = typeof previous === "function" ? previous : void 0;
11341
+ }
11342
+ installCurrentSessionIdGetter();
11315
11343
  var inboundQueueAuthority = null;
11316
11344
  var childUnhandledRejectionGuardInstalled = false;
11317
11345
  function normalizeRejectionReason(reason) {
@@ -11842,7 +11870,7 @@ function sanitizeAgentLogFields(fields) {
11842
11870
  }
11843
11871
  }
11844
11872
  function buildAgentLogPayload(level, message, fields, sessionId) {
11845
- const resolvedSessionId = sessionId ?? sessionExecutionContext.getStore()?.sessionId ?? agentLogSessionContext.getStore();
11873
+ const resolvedSessionId = sessionId ?? currentHandlerSessionId();
11846
11874
  const sanitizedFields = fields ? sanitizeAgentLogFields(fields) : void 0;
11847
11875
  return {
11848
11876
  type: "log",
@@ -557,6 +557,34 @@ function clearPendingConversationHistoryAcksForSession(sessionId, reason) {
557
557
  }
558
558
  var sessionExecutionContext = new AsyncLocalStorage();
559
559
  var agentLogSessionContext = new AsyncLocalStorage();
560
+ var CURRENT_SESSION_ID_GETTER_KEY = Symbol.for("voicethere.agent.currentSessionId");
561
+ function currentHandlerSessionId() {
562
+ const id = sessionExecutionContext.getStore()?.sessionId ?? agentLogSessionContext.getStore();
563
+ return id ? id : void 0;
564
+ }
565
+ var previousSessionIdGetter;
566
+ function stringOrUndefined(value) {
567
+ return typeof value === "string" && value ? value : void 0;
568
+ }
569
+ function currentSessionIdGetter() {
570
+ const own = currentHandlerSessionId();
571
+ if (own)
572
+ return own;
573
+ try {
574
+ return stringOrUndefined(previousSessionIdGetter?.());
575
+ } catch {
576
+ return void 0;
577
+ }
578
+ }
579
+ function installCurrentSessionIdGetter() {
580
+ const g = globalThis;
581
+ const previous = g[CURRENT_SESSION_ID_GETTER_KEY];
582
+ if (previous === currentSessionIdGetter)
583
+ return;
584
+ g[CURRENT_SESSION_ID_GETTER_KEY] = currentSessionIdGetter;
585
+ previousSessionIdGetter = typeof previous === "function" ? previous : void 0;
586
+ }
587
+ installCurrentSessionIdGetter();
560
588
  var inboundQueueAuthority = null;
561
589
  var childUnhandledRejectionGuardInstalled = false;
562
590
  function normalizeRejectionReason(reason) {
@@ -1082,7 +1110,7 @@ function sanitizeAgentLogFields(fields) {
1082
1110
  }
1083
1111
  }
1084
1112
  function buildAgentLogPayload(level, message, fields, sessionId) {
1085
- const resolvedSessionId = sessionId ?? sessionExecutionContext.getStore()?.sessionId ?? agentLogSessionContext.getStore();
1113
+ const resolvedSessionId = sessionId ?? currentHandlerSessionId();
1086
1114
  const sanitizedFields = fields ? sanitizeAgentLogFields(fields) : void 0;
1087
1115
  return {
1088
1116
  type: "log",
@@ -557,6 +557,34 @@ function clearPendingConversationHistoryAcksForSession(sessionId, reason) {
557
557
  }
558
558
  var sessionExecutionContext = new AsyncLocalStorage();
559
559
  var agentLogSessionContext = new AsyncLocalStorage();
560
+ var CURRENT_SESSION_ID_GETTER_KEY = Symbol.for("voicethere.agent.currentSessionId");
561
+ function currentHandlerSessionId() {
562
+ const id = sessionExecutionContext.getStore()?.sessionId ?? agentLogSessionContext.getStore();
563
+ return id ? id : void 0;
564
+ }
565
+ var previousSessionIdGetter;
566
+ function stringOrUndefined(value) {
567
+ return typeof value === "string" && value ? value : void 0;
568
+ }
569
+ function currentSessionIdGetter() {
570
+ const own = currentHandlerSessionId();
571
+ if (own)
572
+ return own;
573
+ try {
574
+ return stringOrUndefined(previousSessionIdGetter?.());
575
+ } catch {
576
+ return void 0;
577
+ }
578
+ }
579
+ function installCurrentSessionIdGetter() {
580
+ const g = globalThis;
581
+ const previous = g[CURRENT_SESSION_ID_GETTER_KEY];
582
+ if (previous === currentSessionIdGetter)
583
+ return;
584
+ g[CURRENT_SESSION_ID_GETTER_KEY] = currentSessionIdGetter;
585
+ previousSessionIdGetter = typeof previous === "function" ? previous : void 0;
586
+ }
587
+ installCurrentSessionIdGetter();
560
588
  var inboundQueueAuthority = null;
561
589
  var childUnhandledRejectionGuardInstalled = false;
562
590
  function normalizeRejectionReason(reason) {
@@ -1093,7 +1121,7 @@ function sanitizeAgentLogFields(fields) {
1093
1121
  }
1094
1122
  }
1095
1123
  function buildAgentLogPayload(level, message, fields, sessionId) {
1096
- const resolvedSessionId = sessionId ?? sessionExecutionContext.getStore()?.sessionId ?? agentLogSessionContext.getStore();
1124
+ const resolvedSessionId = sessionId ?? currentHandlerSessionId();
1097
1125
  const sanitizedFields = fields ? sanitizeAgentLogFields(fields) : void 0;
1098
1126
  return {
1099
1127
  type: "log",
package/eject/llm/loop.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Copied from @voicethere/agent 0.23.1. Package updates no longer change this file.
1
+ // Copied from @voicethere/agent 0.23.2. Package updates no longer change this file.
2
2
  import { randomUUID } from "node:crypto";
3
3
  import {
4
4
  type AgentHandlers,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voicethere/agent",
3
- "version": "0.23.1",
3
+ "version": "0.23.2",
4
4
  "description": "VoiceThere customer agent SDK — IPC types and runtime helpers for sandboxed child bundles",
5
5
  "type": "module",
6
6
  "exports": {