@maximem/synap-js-sdk 0.5.4 → 0.5.7

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/index.cjs CHANGED
@@ -49,6 +49,7 @@ var ENDPOINTS = {
49
49
  memories_get: { method: "GET", path: "/api/v1/memories/{memory_id}", idempotent: true },
50
50
  memories_update: { method: "PATCH", path: "/api/v1/memories/{memory_id}", idempotent: false },
51
51
  memories_delete: { method: "DELETE", path: "/api/v1/memories/{memory_id}", idempotent: true },
52
+ memories_forget: { method: "POST", path: "/api/v1/memories/forget", idempotent: false },
52
53
  context_fetch_user: { method: "POST", path: "/v1/context/user/fetch", idempotent: true },
53
54
  context_fetch_customer: { method: "POST", path: "/v1/context/customer/fetch", idempotent: true },
54
55
  context_fetch_client: { method: "POST", path: "/v1/context/client/fetch", idempotent: true },
@@ -537,6 +538,7 @@ function buildFetchRequest(scope, options) {
537
538
  const maxResults = _nullishCoalesce(opt(options, "max_results", "maxResults"), () => ( 10));
538
539
  const precisionLevel = _nullishCoalesce(opt(options, "precision_level", "precisionLevel"), () => ( "high"));
539
540
  const queryDate = opt(options, "query_date", "queryDate");
541
+ const perQuery = opt(options, "max_results_per_query", "maxResultsPerQuery");
540
542
  const mode = _nullishCoalesce(options.mode, () => ( "fast"));
541
543
  if (searchQuery !== void 0 && !Array.isArray(searchQuery)) {
542
544
  throw new (0, _chunkT372OL3Qcjs.InvalidInputError)("search_query must be an array when provided");
@@ -553,6 +555,7 @@ function buildFetchRequest(scope, options) {
553
555
  };
554
556
  if (precisionLevel !== "high") body["precision_level"] = precisionLevel;
555
557
  if (queryDate) body["query_date"] = queryDate;
558
+ if (perQuery) body["max_results_per_query"] = perQuery;
556
559
  if (options.include_conversation_context === false) {
557
560
  body["include_conversation_context"] = false;
558
561
  }
@@ -628,9 +631,14 @@ function pick(...values) {
628
631
  return pickDefined(...values);
629
632
  }
630
633
  var obj = (v) => _nullishCoalesce(v, () => ( {}));
634
+ function matchedQueries(item = {}) {
635
+ const raw = _nullishCoalesce(item["matchedQueries"], () => ( item.matched_queries));
636
+ return Array.isArray(raw) ? raw : [];
637
+ }
631
638
  function normalizeTemporalFields(item = {}) {
632
639
  return {
633
640
  eventDate: pick(item["eventDate"], item.event_date, null),
641
+ saidAt: pick(item["saidAt"], item.said_at, null),
634
642
  validUntil: pick(item["validUntil"], item.valid_until, null),
635
643
  temporalCategory: pick(item["temporalCategory"], item.temporal_category, null),
636
644
  temporalConfidence: pick(item["temporalConfidence"], item.temporal_confidence, 0)
@@ -644,7 +652,8 @@ function normalizeFact(item = {}) {
644
652
  source: item.source || "",
645
653
  extractedAt: pick(item["extractedAt"], item.extracted_at, null),
646
654
  metadata: obj(item.metadata),
647
- ...normalizeTemporalFields(item)
655
+ ...normalizeTemporalFields(item),
656
+ matchedQueries: matchedQueries(item)
648
657
  };
649
658
  }
650
659
  function normalizePreference(item = {}) {
@@ -656,7 +665,8 @@ function normalizePreference(item = {}) {
656
665
  source: item.source || "",
657
666
  extractedAt: pick(item["extractedAt"], item.extracted_at, null),
658
667
  metadata: obj(item.metadata),
659
- ...normalizeTemporalFields(item)
668
+ ...normalizeTemporalFields(item),
669
+ matchedQueries: matchedQueries(item)
660
670
  };
661
671
  }
662
672
  function normalizeEpisode(item = {}) {
@@ -667,7 +677,8 @@ function normalizeEpisode(item = {}) {
667
677
  significance: pick(item["significance"], item.confidence, 0),
668
678
  participants: item["participants"] || [],
669
679
  metadata: obj(item.metadata),
670
- ...normalizeTemporalFields(item)
680
+ ...normalizeTemporalFields(item),
681
+ matchedQueries: matchedQueries(item)
671
682
  };
672
683
  }
673
684
  function normalizeEmotion(item = {}) {
@@ -678,7 +689,8 @@ function normalizeEmotion(item = {}) {
678
689
  detectedAt: pick(item["detectedAt"], item["detected_at"], null),
679
690
  context: item["context"] || "",
680
691
  metadata: obj(item.metadata),
681
- ...normalizeTemporalFields(item)
692
+ ...normalizeTemporalFields(item),
693
+ matchedQueries: matchedQueries(item)
682
694
  };
683
695
  }
684
696
  function normalizeTemporalEvent(item = {}) {
@@ -686,13 +698,15 @@ function normalizeTemporalEvent(item = {}) {
686
698
  id: item.id || "",
687
699
  content: item.content || "",
688
700
  eventDate: pick(item["eventDate"], item.event_date, null),
701
+ saidAt: pick(item["saidAt"], item.said_at, null),
689
702
  validUntil: pick(item["validUntil"], item.valid_until, null),
690
703
  temporalCategory: pick(item["temporalCategory"], item.temporal_category, ""),
691
704
  temporalConfidence: pick(item["temporalConfidence"], item.temporal_confidence, 0),
692
705
  confidence: pick(item.confidence, 0),
693
706
  source: item.source || "",
694
707
  extractedAt: pick(item["extractedAt"], item.extracted_at, null),
695
- metadata: obj(item.metadata)
708
+ metadata: obj(item.metadata),
709
+ matchedQueries: matchedQueries(item)
696
710
  };
697
711
  }
698
712
  function normalizeContextMetadata(metadata = {}) {
@@ -748,6 +762,7 @@ var dt = (v) => v ? String(v) : null;
748
762
  function temporal(item) {
749
763
  return {
750
764
  event_date: dt(item["event_date"]),
765
+ said_at: dt(item["said_at"]),
751
766
  valid_until: dt(item["valid_until"]),
752
767
  temporal_category: _nullishCoalesce(item["temporal_category"], () => ( null)),
753
768
  temporal_confidence: n(item["temporal_confidence"], 0)
@@ -866,8 +881,33 @@ function buildCreateBody(options) {
866
881
  metadata: _nullishCoalesce(options.metadata, () => ( {}))
867
882
  };
868
883
  }
884
+ var FORGET_MODES = ["preview", "direct"];
885
+ var FORGET_DESCRIPTION_MIN = 3;
886
+ var FORGET_DESCRIPTION_MAX = 500;
887
+ function buildForgetBody(options) {
888
+ const description = options.description;
889
+ if (typeof description !== "string" || description.length < FORGET_DESCRIPTION_MIN || description.length > FORGET_DESCRIPTION_MAX) {
890
+ throw new (0, _chunkT372OL3Qcjs.InvalidInputError)(
891
+ `description must be between ${FORGET_DESCRIPTION_MIN} and ${FORGET_DESCRIPTION_MAX} characters`
892
+ );
893
+ }
894
+ const mode = _nullishCoalesce(options.mode, () => ( "preview"));
895
+ if (!FORGET_MODES.includes(mode)) {
896
+ throw new (0, _chunkT372OL3Qcjs.InvalidInputError)(
897
+ `Invalid mode '${mode}'. Expected one of: ${FORGET_MODES.join(", ")}`
898
+ );
899
+ }
900
+ const o2 = options;
901
+ return {
902
+ description,
903
+ user_id: _nullishCoalesce(either(o2, "user_id", "userId"), () => ( null)),
904
+ customer_id: _nullishCoalesce(either(o2, "customer_id", "customerId"), () => ( null)),
905
+ scope: _nullishCoalesce(options.scope, () => ( null)),
906
+ mode
907
+ };
908
+ }
869
909
  var TERMINAL_STATUSES = /* @__PURE__ */ new Set(["completed", "failed", "error", "cancelled"]);
870
- function createMemoriesInterface(transport) {
910
+ function createMemoriesInterface(transport, onForgotten) {
871
911
  return {
872
912
  async create(options) {
873
913
  const o2 = options;
@@ -953,6 +993,23 @@ function createMemoriesInterface(transport) {
953
993
  }
954
994
  return transport.request("memories_delete", { pathParams: { memory_id: memoryId } });
955
995
  },
996
+ async forget(options) {
997
+ const o2 = options;
998
+ transport.checkCustomerId(_nullishCoalesce(o2["customer_id"], () => ( o2["customerId"])), "memories.forget");
999
+ const body = buildForgetBody(options);
1000
+ const result = await transport.request("memories_forget", { body });
1001
+ const removed = !!_optionalChain([result, 'optionalAccess', _33 => _33.deleted_ids, 'optionalAccess', _34 => _34.length]) || _optionalChain([result, 'optionalAccess', _35 => _35.status]) === "deleted" || _optionalChain([result, 'optionalAccess', _36 => _36.status]) === "partial";
1002
+ if (removed && onForgotten) {
1003
+ try {
1004
+ onForgotten({
1005
+ userId: _nullishCoalesce(body["user_id"], () => ( null)),
1006
+ customerId: _nullishCoalesce(body["customer_id"], () => ( null))
1007
+ });
1008
+ } catch (e5) {
1009
+ }
1010
+ }
1011
+ return result;
1012
+ },
956
1013
  async status(ingestionId) {
957
1014
  if (!ingestionId) throw new (0, _chunkT372OL3Qcjs.InvalidInputError)("ingestion_id is required");
958
1015
  return transport.request("memories_status", {
@@ -981,14 +1038,14 @@ function sleep2(ms, signal) {
981
1038
  if (ms <= 0) return Promise.resolve();
982
1039
  return new Promise((resolve, reject) => {
983
1040
  const timer = setTimeout(() => {
984
- _optionalChain([signal, 'optionalAccess', _33 => _33.removeEventListener, 'call', _34 => _34("abort", onAbort)]);
1041
+ _optionalChain([signal, 'optionalAccess', _37 => _37.removeEventListener, 'call', _38 => _38("abort", onAbort)]);
985
1042
  resolve();
986
1043
  }, ms);
987
1044
  function onAbort() {
988
1045
  clearTimeout(timer);
989
- reject(_nullishCoalesce(_optionalChain([signal, 'optionalAccess', _35 => _35.reason]), () => ( new Error("Aborted"))));
1046
+ reject(_nullishCoalesce(_optionalChain([signal, 'optionalAccess', _39 => _39.reason]), () => ( new Error("Aborted"))));
990
1047
  }
991
- _optionalChain([signal, 'optionalAccess', _36 => _36.addEventListener, 'call', _37 => _37("abort", onAbort, { once: true })]);
1048
+ _optionalChain([signal, 'optionalAccess', _40 => _40.addEventListener, 'call', _41 => _41("abort", onAbort, { once: true })]);
992
1049
  });
993
1050
  }
994
1051
 
@@ -1227,7 +1284,7 @@ function createConversationNamespace(transport, subscribers = new CompactionSubs
1227
1284
  pathParams: { conversation_id: id },
1228
1285
  query: { style: _nullishCoalesce(options.style, () => ( "structured")) }
1229
1286
  });
1230
- return _nullishCoalesce(_nullishCoalesce(_optionalChain([result, 'optionalAccess', _38 => _38["context_for_prompt"]]), () => ( result)), () => ( {}));
1287
+ return _nullishCoalesce(_nullishCoalesce(_optionalChain([result, 'optionalAccess', _42 => _42["context_for_prompt"]]), () => ( result)), () => ( {}));
1231
1288
  },
1232
1289
  async compact(options) {
1233
1290
  return transport.request("conversations_compact", { body: buildCompactBody(options) });
@@ -1402,10 +1459,10 @@ function jsonOrText(value) {
1402
1459
  (_k, v) => typeof v === "bigint" ? String(v) : v
1403
1460
  );
1404
1461
  return out === void 0 ? String(value) : out;
1405
- } catch (e5) {
1462
+ } catch (e6) {
1406
1463
  try {
1407
1464
  return String(value);
1408
- } catch (e6) {
1465
+ } catch (e7) {
1409
1466
  return "";
1410
1467
  }
1411
1468
  }
@@ -1417,17 +1474,17 @@ function createInstanceNamespace(credentials, cache, onTurn) {
1417
1474
  let applyCompaction = null;
1418
1475
  const internals = {
1419
1476
  onCompactionUpdate(conversationId, bundle) {
1420
- _optionalChain([applyCompaction, 'optionalCall', _39 => _39(bundle)]);
1421
- _optionalChain([dispatchCompaction, 'optionalCall', _40 => _40(conversationId, bundle)]);
1477
+ _optionalChain([applyCompaction, 'optionalCall', _43 => _43(bundle)]);
1478
+ _optionalChain([dispatchCompaction, 'optionalCall', _44 => _44(conversationId, bundle)]);
1422
1479
  },
1423
1480
  setCompactionApplier(apply) {
1424
1481
  applyCompaction = apply;
1425
1482
  },
1426
1483
  sendContextUsed(event) {
1427
- _optionalChain([client, 'optionalAccess', _41 => _41.sendContextUsed, 'call', _42 => _42(event)]);
1484
+ _optionalChain([client, 'optionalAccess', _45 => _45.sendContextUsed, 'call', _46 => _46(event)]);
1428
1485
  },
1429
1486
  sendContextAssembled(event) {
1430
- _optionalChain([client, 'optionalAccess', _43 => _43.sendContextAssembled, 'call', _44 => _44(event)]);
1487
+ _optionalChain([client, 'optionalAccess', _47 => _47.sendContextAssembled, 'call', _48 => _48(event)]);
1431
1488
  },
1432
1489
  setCompactionDispatcher(dispatch) {
1433
1490
  dispatchCompaction = dispatch;
@@ -1449,7 +1506,7 @@ function createInstanceNamespace(credentials, cache, onTurn) {
1449
1506
  ...customerId ? { customer_id: customerId } : {}
1450
1507
  });
1451
1508
  openSessions.set(conversationId, sessionId);
1452
- } catch (e7) {
1509
+ } catch (e8) {
1453
1510
  }
1454
1511
  }
1455
1512
  const namespace = {
@@ -1457,7 +1514,7 @@ function createInstanceNamespace(credentials, cache, onTurn) {
1457
1514
  if (client !== null) {
1458
1515
  throw new (0, _chunkT372OL3Qcjs.ListeningAlreadyActiveError)("Listening is already active on this instance");
1459
1516
  }
1460
- const { GrpcStreamClient } = await Promise.resolve().then(() => _interopRequireWildcard(require("./stream-client-GJM4YSXW.cjs")));
1517
+ const { GrpcStreamClient } = await Promise.resolve().then(() => _interopRequireWildcard(require("./stream-client-N46JBT5A.cjs")));
1461
1518
  const onContext = _nullishCoalesce(options.on_context, () => ( options.onContext));
1462
1519
  const onDisconnect = _nullishCoalesce(options.on_disconnect, () => ( options.onDisconnect));
1463
1520
  const onReconnect = _nullishCoalesce(options.on_reconnect, () => ( options.onReconnect));
@@ -1475,11 +1532,11 @@ function createInstanceNamespace(credentials, cache, onTurn) {
1475
1532
  if (state !== "connected") openSessions.clear();
1476
1533
  if (state === "reconnecting") {
1477
1534
  reconnectAttempts += 1;
1478
- _optionalChain([onReconnect, 'optionalCall', _45 => _45(reconnectAttempts)]);
1535
+ _optionalChain([onReconnect, 'optionalCall', _49 => _49(reconnectAttempts)]);
1479
1536
  } else if (state === "disconnected") {
1480
- const stopped = _nullishCoalesce(_optionalChain([stream, 'optionalAccess', _46 => _46.lastError]), () => ( null));
1537
+ const stopped = _nullishCoalesce(_optionalChain([stream, 'optionalAccess', _50 => _50.lastError]), () => ( null));
1481
1538
  const reason = stopped === null ? "stream disconnected" : `credit_stop:${_nullishCoalesce(stopped.reason, () => ( "unknown"))}`;
1482
- _optionalChain([onDisconnect, 'optionalCall', _47 => _47(reason)]);
1539
+ _optionalChain([onDisconnect, 'optionalCall', _51 => _51(reason)]);
1483
1540
  }
1484
1541
  }
1485
1542
  });
@@ -1489,7 +1546,7 @@ function createInstanceNamespace(credentials, cache, onTurn) {
1489
1546
  } catch (error) {
1490
1547
  if (error instanceof _chunkT372OL3Qcjs.SynapError) throw error;
1491
1548
  throw new (0, _chunkT372OL3Qcjs.SynapError)(
1492
- `Could not open the Synap anticipation stream: ${_nullishCoalesce(_optionalChain([error, 'optionalAccess', _48 => _48.message]), () => ( String(error)))}`,
1549
+ `Could not open the Synap anticipation stream: ${_nullishCoalesce(_optionalChain([error, 'optionalAccess', _52 => _52.message]), () => ( String(error)))}`,
1493
1550
  { cause: error }
1494
1551
  );
1495
1552
  }
@@ -1514,7 +1571,7 @@ function createInstanceNamespace(credentials, cache, onTurn) {
1514
1571
  session_id: sessionId,
1515
1572
  conversation_id: conversationId
1516
1573
  });
1517
- } catch (e8) {
1574
+ } catch (e9) {
1518
1575
  }
1519
1576
  },
1520
1577
  async send_message(options) {
@@ -1535,7 +1592,7 @@ function createInstanceNamespace(credentials, cache, onTurn) {
1535
1592
  _nullishCoalesce(_nullishCoalesce(options.customer_id, () => ( options.customerId)), () => ( ""))
1536
1593
  );
1537
1594
  if (eventType === "user_message" || eventType === "assistant_message") {
1538
- _optionalChain([onTurn, 'optionalCall', _49 => _49({
1595
+ _optionalChain([onTurn, 'optionalCall', _53 => _53({
1539
1596
  conversationId,
1540
1597
  role: _nullishCoalesce(options.role, () => ( "user")),
1541
1598
  content: options.content
@@ -1629,7 +1686,7 @@ function createInstanceNamespace(credentials, cache, onTurn) {
1629
1686
  }
1630
1687
 
1631
1688
  // src/version.ts
1632
- var SDK_VERSION = "0.5.4";
1689
+ var SDK_VERSION = "0.5.7";
1633
1690
 
1634
1691
  // src/registry.ts
1635
1692
  var instances = /* @__PURE__ */ new Map();
@@ -1841,7 +1898,7 @@ function overlayLocalRecentTurns(response, store, conversationId, configured) {
1841
1898
  compacted_at: orLocal("compacted_at", entry.compactedAt),
1842
1899
  conversation_id: conversationId
1843
1900
  };
1844
- } catch (e9) {
1901
+ } catch (e10) {
1845
1902
  }
1846
1903
  }
1847
1904
 
@@ -1854,7 +1911,7 @@ function stringify(value) {
1854
1911
  if (t === "string" || t === "number" || t === "boolean") return String(value);
1855
1912
  try {
1856
1913
  return _nullishCoalesce(JSON.stringify(value), () => ( ""));
1857
- } catch (e10) {
1914
+ } catch (e11) {
1858
1915
  return String(value);
1859
1916
  }
1860
1917
  }
@@ -2058,6 +2115,7 @@ function normalise(item) {
2058
2115
  detected_at: _nullishCoalesce(pick2(item, "detected_at", "extracted_at", "created_at"), () => ( null)),
2059
2116
  metadata: _nullishCoalesce(pick2(item, "metadata"), () => ( {})),
2060
2117
  event_date: _nullishCoalesce(pick2(item, "event_date"), () => ( null)),
2118
+ said_at: _nullishCoalesce(pick2(item, "said_at"), () => ( null)),
2061
2119
  valid_until: _nullishCoalesce(pick2(item, "valid_until"), () => ( null)),
2062
2120
  temporal_category: _nullishCoalesce(pick2(item, "temporal_category"), () => ( null)),
2063
2121
  temporal_confidence: Number(_nullishCoalesce(pick2(item, "temporal_confidence"), () => ( 0)))
@@ -2128,10 +2186,14 @@ function tryServeFromCache(cache, scope, params, maxItems) {
2128
2186
  });
2129
2187
  if (hit === null) return { response: null, hit: null };
2130
2188
  return { response: buildAnticipationResponse(hit), hit };
2131
- } catch (e11) {
2189
+ } catch (e12) {
2132
2190
  return { response: null, hit: null };
2133
2191
  }
2134
2192
  }
2193
+ function distinctQueryCount(searchQuery) {
2194
+ if (!Array.isArray(searchQuery)) return 0;
2195
+ return new Set(searchQuery.filter((q) => typeof q === "string" && q.length > 0)).size;
2196
+ }
2135
2197
 
2136
2198
  // src/context/assembled.ts
2137
2199
  var COLLECTIONS2 = ["facts", "preferences", "episodes", "emotions", "temporal_events"];
@@ -2629,6 +2691,7 @@ var SynapClient = class {
2629
2691
  beforeFetch: (scope, options2) => {
2630
2692
  const o2 = options2;
2631
2693
  if (_nullishCoalesce(o2["query_date"], () => ( o2["queryDate"]))) return null;
2694
+ if (_nullishCoalesce(o2["max_results_per_query"], () => ( o2["maxResultsPerQuery"]))) return null;
2632
2695
  const attempt = tryServeFromCache(
2633
2696
  this.#anticipationCache,
2634
2697
  scope,
@@ -2699,7 +2762,11 @@ var SynapClient = class {
2699
2762
  compacted: (conversationId, format) => this.#localCompacted(conversationId, format)
2700
2763
  }
2701
2764
  );
2702
- this.memories = createMemoriesInterface(this.#transport);
2765
+ this.memories = createMemoriesInterface(this.#transport, ({ userId, customerId }) => {
2766
+ for (const id of /* @__PURE__ */ new Set([userId, customerId])) {
2767
+ if (id) this.#anticipationCache.dropEntity(id);
2768
+ }
2769
+ });
2703
2770
  this.credits = createCreditsNamespace(this.#transport);
2704
2771
  this.cache = createCacheNamespace(this.#anticipationCache);
2705
2772
  this.instance = createInstanceNamespace(
@@ -2829,7 +2896,7 @@ var SynapClient = class {
2829
2896
  this.#registryKeys.push(resolvedInstanceId);
2830
2897
  }
2831
2898
  }
2832
- } catch (e12) {
2899
+ } catch (e13) {
2833
2900
  }
2834
2901
  }
2835
2902
  /**
@@ -2898,6 +2965,7 @@ var SynapClient = class {
2898
2965
  mode = "fast",
2899
2966
  precision_level: precisionLevel = "high",
2900
2967
  query_date: queryDate,
2968
+ max_results_per_query: maxResultsPerQuery,
2901
2969
  include_conversation_context: includeConversationContext = true,
2902
2970
  scopes,
2903
2971
  include_scope_labels: includeScopeLabels = false,
@@ -2916,7 +2984,8 @@ var SynapClient = class {
2916
2984
  // In `shared` so it reaches all four branches at once. The Python edit
2917
2985
  // threaded three call sites by hand and missed the client branch, which
2918
2986
  // sits one indent deeper; spreading removes that whole class of miss.
2919
- query_date: queryDate
2987
+ query_date: queryDate,
2988
+ max_results_per_query: maxResultsPerQuery
2920
2989
  };
2921
2990
  const labels = [];
2922
2991
  const tasks = [];
@@ -2981,7 +3050,7 @@ var SynapClient = class {
2981
3050
  merged.conversation_context = await this.conversation.context.get_context_for_prompt({
2982
3051
  conversation_id: conversationId
2983
3052
  });
2984
- } catch (e13) {
3053
+ } catch (e14) {
2985
3054
  }
2986
3055
  }
2987
3056
  merged.formatted_context = formatForPrompt(merged, {
@@ -3026,9 +3095,14 @@ var SynapClient = class {
3026
3095
  served_item_ids: served.servedItemIds,
3027
3096
  scope,
3028
3097
  source_bundle_ids: served.bundleId ? [served.bundleId] : [],
3029
- timestamp_ms: Date.now()
3098
+ timestamp_ms: Date.now(),
3099
+ // How many distinct search queries the fetch carried. A hit never
3100
+ // reaches the fetch route, so this event is how the server learns it
3101
+ // happened and what it is charged by. The count only: this event must
3102
+ // not carry the caller's words.
3103
+ query_count: distinctQueryCount(_nullishCoalesce(options["search_query"], () => ( options["searchQuery"])))
3030
3104
  });
3031
- } catch (e14) {
3105
+ } catch (e15) {
3032
3106
  }
3033
3107
  }
3034
3108
  /**
@@ -3053,7 +3127,7 @@ var SynapClient = class {
3053
3127
  }),
3054
3128
  scope
3055
3129
  });
3056
- } catch (e15) {
3130
+ } catch (e16) {
3057
3131
  }
3058
3132
  }
3059
3133
  /**
@@ -3131,7 +3205,7 @@ function pick3(o2, snake, camel) {
3131
3205
  function resolveBaseUrl(options) {
3132
3206
  const explicit = _nullishCoalesce(options.baseUrl, () => ( options.api_base_url));
3133
3207
  if (explicit !== void 0) return explicit;
3134
- const fromEnv = _optionalChain([_chunkZKOJDUN4cjs.getEnv.call(void 0, "SYNAP_BASE_URL"), 'optionalAccess', _50 => _50.trim, 'call', _51 => _51()]);
3208
+ const fromEnv = _optionalChain([_chunkZKOJDUN4cjs.getEnv.call(void 0, "SYNAP_BASE_URL"), 'optionalAccess', _54 => _54.trim, 'call', _55 => _55()]);
3135
3209
  return fromEnv !== void 0 && fromEnv !== "" ? fromEnv : void 0;
3136
3210
  }
3137
3211
  function resolveCredentials(options) {
@@ -3198,5 +3272,6 @@ function resolveCredentials(options) {
3198
3272
 
3199
3273
 
3200
3274
 
3201
- exports.ANY_SCOPE = _chunkT6U5PVADcjs.ANY_SCOPE; exports.AgentUnavailableError = _chunkT372OL3Qcjs.AgentUnavailableError; exports.AnticipationCache = _chunkT6U5PVADcjs.AnticipationCache; exports.AuthenticationError = _chunkT372OL3Qcjs.AuthenticationError; exports.BM25 = _chunkT6U5PVADcjs.BM25; exports.COMPACTION_LEVELS = COMPACTION_LEVELS; exports.CONTRACT = _chunkT6U5PVADcjs.CONTRACT; exports.ConflictError = _chunkT372OL3Qcjs.ConflictError; exports.ConnectionError = _chunkT372OL3Qcjs.ConnectionError; exports.ContextNotFoundError = _chunkT372OL3Qcjs.ContextNotFoundError; exports.DEFAULT_BASE_URL = DEFAULT_BASE_URL; exports.DEFAULT_DOCUMENT_TYPE = DEFAULT_DOCUMENT_TYPE; exports.DEFAULT_INGEST_MODE = DEFAULT_INGEST_MODE; exports.DEFAULT_RETRY_POLICY = DEFAULT_RETRY_POLICY; exports.DEFAULT_TIMEOUTS = DEFAULT_TIMEOUTS; exports.DOCUMENT_TYPES = DOCUMENT_TYPES; exports.ENDPOINTS = ENDPOINTS; exports.HttpTransport = HttpTransport; exports.INGEST_MODES = INGEST_MODES; exports.ITEM_COLLECTIONS = ITEM_COLLECTIONS; exports.InsufficientCreditsError = _chunkT372OL3Qcjs.InsufficientCreditsError; exports.InvalidConversationIdError = _chunkT372OL3Qcjs.InvalidConversationIdError; exports.InvalidInputError = _chunkT372OL3Qcjs.InvalidInputError; exports.InvalidInstanceIdError = _chunkT372OL3Qcjs.InvalidInstanceIdError; exports.ListeningAlreadyActiveError = _chunkT372OL3Qcjs.ListeningAlreadyActiveError; exports.ListeningNotActiveError = _chunkT372OL3Qcjs.ListeningNotActiveError; exports.NetworkTimeoutError = _chunkT372OL3Qcjs.NetworkTimeoutError; exports.PermanentError = _chunkT372OL3Qcjs.PermanentError; exports.RateLimitError = _chunkT372OL3Qcjs.RateLimitError; exports.SDKError = _chunkT372OL3Qcjs.SDKError; exports.SDK_VERSION = SDK_VERSION; exports.ServiceUnavailableError = _chunkT372OL3Qcjs.ServiceUnavailableError; exports.SessionExpiredError = _chunkT372OL3Qcjs.SessionExpiredError; exports.SynapClient = SynapClient; exports.SynapError = _chunkT372OL3Qcjs.SynapError; exports.SynapPermanentError = _chunkT372OL3Qcjs.SynapPermanentError; exports.SynapTransientError = _chunkT372OL3Qcjs.SynapTransientError; exports.THRESHOLDS = _chunkT6U5PVADcjs.THRESHOLDS; exports.TranscriptConflictError = _chunkT372OL3Qcjs.TranscriptConflictError; exports.TransientError = _chunkT372OL3Qcjs.TransientError; exports.flattenContextItems = flattenContextItems; exports.formatForPrompt = formatForPrompt; exports.isOutcomeUnknown = isOutcomeUnknown; exports.isRecallQuery = _chunkT6U5PVADcjs.isRecallQuery; exports.isSynapError = _chunkT372OL3Qcjs.isSynapError; exports.mergeScopeResults = mergeScopeResults; exports.resolvePath = resolvePath; exports.shouldRetry = shouldRetry; exports.stem = _chunkT6U5PVADcjs.stem; exports.tokenize = _chunkT6U5PVADcjs.tokenize;
3275
+
3276
+ exports.ANY_SCOPE = _chunkT6U5PVADcjs.ANY_SCOPE; exports.AgentUnavailableError = _chunkT372OL3Qcjs.AgentUnavailableError; exports.AnticipationCache = _chunkT6U5PVADcjs.AnticipationCache; exports.AuthenticationError = _chunkT372OL3Qcjs.AuthenticationError; exports.BM25 = _chunkT6U5PVADcjs.BM25; exports.COMPACTION_LEVELS = COMPACTION_LEVELS; exports.CONTRACT = _chunkT6U5PVADcjs.CONTRACT; exports.ConflictError = _chunkT372OL3Qcjs.ConflictError; exports.ConnectionError = _chunkT372OL3Qcjs.ConnectionError; exports.ContextNotFoundError = _chunkT372OL3Qcjs.ContextNotFoundError; exports.DEFAULT_BASE_URL = DEFAULT_BASE_URL; exports.DEFAULT_DOCUMENT_TYPE = DEFAULT_DOCUMENT_TYPE; exports.DEFAULT_INGEST_MODE = DEFAULT_INGEST_MODE; exports.DEFAULT_RETRY_POLICY = DEFAULT_RETRY_POLICY; exports.DEFAULT_TIMEOUTS = DEFAULT_TIMEOUTS; exports.DOCUMENT_TYPES = DOCUMENT_TYPES; exports.ENDPOINTS = ENDPOINTS; exports.FORGET_MODES = FORGET_MODES; exports.HttpTransport = HttpTransport; exports.INGEST_MODES = INGEST_MODES; exports.ITEM_COLLECTIONS = ITEM_COLLECTIONS; exports.InsufficientCreditsError = _chunkT372OL3Qcjs.InsufficientCreditsError; exports.InvalidConversationIdError = _chunkT372OL3Qcjs.InvalidConversationIdError; exports.InvalidInputError = _chunkT372OL3Qcjs.InvalidInputError; exports.InvalidInstanceIdError = _chunkT372OL3Qcjs.InvalidInstanceIdError; exports.ListeningAlreadyActiveError = _chunkT372OL3Qcjs.ListeningAlreadyActiveError; exports.ListeningNotActiveError = _chunkT372OL3Qcjs.ListeningNotActiveError; exports.NetworkTimeoutError = _chunkT372OL3Qcjs.NetworkTimeoutError; exports.PermanentError = _chunkT372OL3Qcjs.PermanentError; exports.RateLimitError = _chunkT372OL3Qcjs.RateLimitError; exports.SDKError = _chunkT372OL3Qcjs.SDKError; exports.SDK_VERSION = SDK_VERSION; exports.ServiceUnavailableError = _chunkT372OL3Qcjs.ServiceUnavailableError; exports.SessionExpiredError = _chunkT372OL3Qcjs.SessionExpiredError; exports.SynapClient = SynapClient; exports.SynapError = _chunkT372OL3Qcjs.SynapError; exports.SynapPermanentError = _chunkT372OL3Qcjs.SynapPermanentError; exports.SynapTransientError = _chunkT372OL3Qcjs.SynapTransientError; exports.THRESHOLDS = _chunkT6U5PVADcjs.THRESHOLDS; exports.TranscriptConflictError = _chunkT372OL3Qcjs.TranscriptConflictError; exports.TransientError = _chunkT372OL3Qcjs.TransientError; exports.flattenContextItems = flattenContextItems; exports.formatForPrompt = formatForPrompt; exports.isOutcomeUnknown = isOutcomeUnknown; exports.isRecallQuery = _chunkT6U5PVADcjs.isRecallQuery; exports.isSynapError = _chunkT372OL3Qcjs.isSynapError; exports.mergeScopeResults = mergeScopeResults; exports.resolvePath = resolvePath; exports.shouldRetry = shouldRetry; exports.stem = _chunkT6U5PVADcjs.stem; exports.tokenize = _chunkT6U5PVADcjs.tokenize;
3202
3277
  //# sourceMappingURL=index.cjs.map