@maximem/synap-js-sdk 0.6.1 → 0.6.5

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.
Files changed (43) hide show
  1. package/README.md +2 -2
  2. package/dist/anticipation-cache-Q7IYC3ID.cjs +26 -0
  3. package/dist/anticipation-cache-Q7IYC3ID.cjs.map +1 -0
  4. package/dist/{anticipation-cache-RWKF55J4.js → anticipation-cache-VL5WHTJB.js} +8 -2
  5. package/dist/{chunk-N55UBGER.js → chunk-4HD6KU3D.js} +46 -3
  6. package/dist/chunk-4HD6KU3D.js.map +1 -0
  7. package/dist/chunk-7IZHVYO2.cjs.map +1 -1
  8. package/dist/{chunk-ICUFS3B5.cjs → chunk-BYUGILQI.cjs} +136 -142
  9. package/dist/chunk-BYUGILQI.cjs.map +1 -0
  10. package/dist/{chunk-R72YL6Q4.js → chunk-CSG3N5E3.js} +136 -142
  11. package/dist/chunk-CSG3N5E3.js.map +1 -0
  12. package/dist/{chunk-2VJV4HCF.cjs → chunk-IZUIPREP.cjs} +59 -16
  13. package/dist/chunk-IZUIPREP.cjs.map +1 -0
  14. package/dist/chunk-ZKOJDUN4.cjs.map +1 -1
  15. package/dist/env-55ULHNJZ.cjs.map +1 -1
  16. package/dist/{errors-DWjdpExq.d.cts → errors-x5bpgxmC.d.cts} +18 -3
  17. package/dist/{errors-DWjdpExq.d.ts → errors-x5bpgxmC.d.ts} +18 -3
  18. package/dist/grpc/index.cjs +4 -4
  19. package/dist/grpc/index.cjs.map +1 -1
  20. package/dist/grpc/index.d.cts +11 -3
  21. package/dist/grpc/index.d.ts +11 -3
  22. package/dist/grpc/index.js +3 -3
  23. package/dist/index.cjs +283 -56
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.d.cts +85 -17
  26. package/dist/index.d.ts +85 -17
  27. package/dist/index.js +252 -25
  28. package/dist/index.js.map +1 -1
  29. package/dist/onnx-encoder-4RSL6ID4.cjs.map +1 -1
  30. package/dist/{stream-client-GRDVRBFA.js → stream-client-7YONF2GD.js} +2 -2
  31. package/dist/stream-client-IPHDTXQO.cjs +22 -0
  32. package/dist/stream-client-IPHDTXQO.cjs.map +1 -0
  33. package/package.json +1 -1
  34. package/dist/anticipation-cache-LPNKMRBH.cjs +0 -20
  35. package/dist/anticipation-cache-LPNKMRBH.cjs.map +0 -1
  36. package/dist/chunk-2VJV4HCF.cjs.map +0 -1
  37. package/dist/chunk-ICUFS3B5.cjs.map +0 -1
  38. package/dist/chunk-N55UBGER.js.map +0 -1
  39. package/dist/chunk-R72YL6Q4.js.map +0 -1
  40. package/dist/stream-client-SZIYGVVJ.cjs +0 -22
  41. package/dist/stream-client-SZIYGVVJ.cjs.map +0 -1
  42. /package/dist/{anticipation-cache-RWKF55J4.js.map → anticipation-cache-VL5WHTJB.js.map} +0 -0
  43. /package/dist/{stream-client-GRDVRBFA.js.map → stream-client-7YONF2GD.js.map} +0 -0
package/dist/index.cjs CHANGED
@@ -9,8 +9,7 @@
9
9
 
10
10
 
11
11
 
12
-
13
- var _chunkICUFS3B5cjs = require('./chunk-ICUFS3B5.cjs');
12
+ var _chunkBYUGILQIcjs = require('./chunk-BYUGILQI.cjs');
14
13
 
15
14
 
16
15
  var _chunkZKOJDUN4cjs = require('./chunk-ZKOJDUN4.cjs');
@@ -55,6 +54,8 @@ var ENDPOINTS = {
55
54
  memories_update: { method: "PATCH", path: "/api/v1/memories/{memory_id}", idempotent: false },
56
55
  memories_delete: { method: "DELETE", path: "/api/v1/memories/{memory_id}", idempotent: true },
57
56
  memories_forget: { method: "POST", path: "/api/v1/memories/forget", idempotent: false },
57
+ data_delete: { method: "POST", path: "/v1/data/delete", idempotent: true },
58
+ data_delete_status: { method: "GET", path: "/v1/data/delete/{deletion_id}", idempotent: true },
58
59
  context_fetch_user: { method: "POST", path: "/v1/context/user/fetch", idempotent: true },
59
60
  context_fetch_customer: { method: "POST", path: "/v1/context/customer/fetch", idempotent: true },
60
61
  context_fetch_client: { method: "POST", path: "/v1/context/client/fetch", idempotent: true },
@@ -387,7 +388,7 @@ var HttpTransport = (_class2 = class {
387
388
  if (gated) this.cooldownCheck(cooldownKey, correlationId);
388
389
  let attempt = 0;
389
390
  let last = null;
390
- while (attempt < this.retryPolicy.maxAttempts) {
391
+ while (attempt < Math.max(1, this.retryPolicy.maxAttempts)) {
391
392
  attempt += 1;
392
393
  try {
393
394
  const result = await this.attempt(name, options, correlationId);
@@ -740,6 +741,41 @@ function sortByRankScore(items) {
740
741
  return [...items].sort(byRankScore);
741
742
  }
742
743
 
744
+ // src/context/no-query.ts
745
+ var MEMORY_TYPES2 = ["facts", "preferences", "episodes", "emotions", "temporal_events"];
746
+ var emptyLists = () => Object.fromEntries(MEMORY_TYPES2.map((t) => [t, []]));
747
+ function hasQuery(searchQuery) {
748
+ if (typeof searchQuery === "string") return searchQuery.trim() !== "";
749
+ if (!Array.isArray(searchQuery)) return false;
750
+ return searchQuery.some((q) => typeof q === "string" && q.trim() !== "");
751
+ }
752
+ function conversationStateContext(prompt, conversationId) {
753
+ const recent = Array.isArray(prompt["recent_messages"]) ? prompt["recent_messages"] : [];
754
+ const turns = recent.filter((m) => typeof m === "object" && m !== null && !Array.isArray(m)).map((m) => ({ role: _nullishCoalesce(m["role"], () => ( null)), content: _nullishCoalesce(m["content"], () => ( null)), timestamp: _nullishCoalesce(m["timestamp"], () => ( null)) }));
755
+ return {
756
+ ...emptyLists(),
757
+ conversation_context: {
758
+ conversation_id: conversationId,
759
+ summary: prompt["context_block"] || null,
760
+ recent_turns: turns,
761
+ compaction_id: prompt["compaction_id"] || null,
762
+ formatted_context: prompt["formatted_context"] || null
763
+ }
764
+ };
765
+ }
766
+ function profileContext(profile) {
767
+ if (typeof profile !== "object" || profile === null || Array.isArray(profile)) return null;
768
+ let doc = profile;
769
+ const inner = doc["profile"];
770
+ if (!("attributes" in doc) && typeof inner === "object" && inner !== null && !Array.isArray(inner)) {
771
+ doc = inner;
772
+ }
773
+ const attributes = doc["attributes"];
774
+ const hasAttributes = typeof attributes === "object" && attributes !== null && Object.keys(attributes).length > 0;
775
+ if (!hasAttributes && !doc["overview"]) return null;
776
+ return { ...emptyLists(), profile: doc };
777
+ }
778
+
743
779
  // src/context/fetch.ts
744
780
  var ENDPOINT_BY_SCOPE = {
745
781
  user: "context_fetch_user",
@@ -867,6 +903,12 @@ function retrievalOptionsOf(options) {
867
903
  }
868
904
  return { mode, precisionLevel };
869
905
  }
906
+ function validateSearchQuery(searchQuery) {
907
+ if (searchQuery === void 0 || searchQuery === null) return;
908
+ if (!Array.isArray(searchQuery) || searchQuery.some((query) => typeof query !== "string")) {
909
+ throw new (0, _chunk7IZHVYO2cjs.InvalidInputError)("search_query must be an array of strings when provided");
910
+ }
911
+ }
870
912
  async function fetchContext(transport, scope, options = {}, hooks = {}) {
871
913
  const startedAt = Date.now();
872
914
  await _optionalChain([transport, 'access', _29 => _29.ready, 'optionalCall', _30 => _30()]);
@@ -877,7 +919,13 @@ async function fetchContext(transport, scope, options = {}, hooks = {}) {
877
919
  const responseShape = responseShapeOf(options);
878
920
  retrievalOptionsOf(options);
879
921
  const { contextMode } = scopeOptionsOf(scope, options);
922
+ const searchQuery = opt(options, "search_query", "searchQuery");
923
+ validateSearchQuery(searchQuery);
880
924
  const summaryMode = scope === "user" && contextMode === "conversation-summary";
925
+ if (!summaryMode && hooks.withoutQuery && !hasQuery(searchQuery)) {
926
+ const answer = await hooks.withoutQuery(scope, options);
927
+ if (answer !== null) return applyResponseShape(answer, responseShape);
928
+ }
881
929
  const finish = (response2) => {
882
930
  _optionalChain([hooks, 'access', _31 => _31.onResponse, 'optionalCall', _32 => _32(scope, options, response2)]);
883
931
  return response2;
@@ -1770,6 +1818,138 @@ function createConversationNamespace(transport, subscribers = new CompactionSubs
1770
1818
  };
1771
1819
  }
1772
1820
 
1821
+ // src/data/interface.ts
1822
+ var DATA_SCOPES = ["user", "conversation", "customer"];
1823
+ var MAX_WAIT_CALLS = 50;
1824
+ var ID_FIELD = {
1825
+ user: "user_id",
1826
+ customer: "customer_id",
1827
+ conversation: "conversation_id"
1828
+ };
1829
+ function either3(o2, snake, camel) {
1830
+ const a = o2[snake];
1831
+ if (a !== void 0) return a;
1832
+ const b = o2[camel];
1833
+ return b === void 0 ? void 0 : b;
1834
+ }
1835
+ function buildDeleteBody(options, instanceId) {
1836
+ const o2 = options;
1837
+ const scope = options.scope;
1838
+ if (scope !== null && typeof scope === "object") {
1839
+ throw new (0, _chunk7IZHVYO2cjs.InvalidInputError)(
1840
+ "scope must be one of: user, conversation, customer. A dict is not accepted here (the rung-path dict used by memories.create and fetch is a different parameter)."
1841
+ );
1842
+ }
1843
+ if (typeof scope !== "string" || !DATA_SCOPES.includes(scope)) {
1844
+ throw new (0, _chunk7IZHVYO2cjs.InvalidInputError)(
1845
+ `Invalid scope '${String(scope)}'. Expected one of: ${DATA_SCOPES.join(", ")}`
1846
+ );
1847
+ }
1848
+ const dryRun = _nullishCoalesce(either3(o2, "dry_run", "dryRun"), () => ( false));
1849
+ if (typeof dryRun !== "boolean") throw new (0, _chunk7IZHVYO2cjs.InvalidInputError)("dry_run must be a boolean");
1850
+ const ids = {
1851
+ user_id: either3(o2, "user_id", "userId"),
1852
+ customer_id: either3(o2, "customer_id", "customerId"),
1853
+ conversation_id: either3(o2, "conversation_id", "conversationId")
1854
+ };
1855
+ for (const [name, value] of Object.entries(ids)) {
1856
+ if (value !== void 0 && value !== null && (typeof value !== "string" || value.trim() === "")) {
1857
+ throw new (0, _chunk7IZHVYO2cjs.InvalidInputError)(`${name} must not be empty`);
1858
+ }
1859
+ }
1860
+ const field = ID_FIELD[scope];
1861
+ const target = ids[field];
1862
+ if (target === void 0 || target === null) {
1863
+ throw new (0, _chunk7IZHVYO2cjs.InvalidInputError)(`${field} is required for scope='${scope}'`);
1864
+ }
1865
+ const confirm = _nullishCoalesce(options.confirm, () => ( null));
1866
+ if (!dryRun) {
1867
+ if (confirm === null || confirm === "") {
1868
+ throw new (0, _chunk7IZHVYO2cjs.InvalidInputError)(
1869
+ `confirm is required unless dry_run=True: pass the ${field} being deleted as confirm`
1870
+ );
1871
+ }
1872
+ if (confirm !== target) {
1873
+ throw new (0, _chunk7IZHVYO2cjs.InvalidInputError)(`confirm must equal the ${field} being deleted`);
1874
+ }
1875
+ }
1876
+ return {
1877
+ scope,
1878
+ instance_id: instanceId,
1879
+ user_id: _nullishCoalesce(ids["user_id"], () => ( null)),
1880
+ customer_id: _nullishCoalesce(ids["customer_id"], () => ( null)),
1881
+ conversation_id: _nullishCoalesce(ids["conversation_id"], () => ( null)),
1882
+ dry_run: dryRun,
1883
+ confirm
1884
+ };
1885
+ }
1886
+ function normalise(raw) {
1887
+ return {
1888
+ deletion_id: null,
1889
+ status: "unknown",
1890
+ scope: null,
1891
+ dry_run: false,
1892
+ found: false,
1893
+ counts: {},
1894
+ stores: {},
1895
+ still_present_in: [],
1896
+ // Pessimistic: true only when the server said so.
1897
+ fully_removed: false,
1898
+ continue: false,
1899
+ kept: [],
1900
+ note: null,
1901
+ memories_kept: false,
1902
+ audit: null,
1903
+ local_cleared: [],
1904
+ ...raw
1905
+ };
1906
+ }
1907
+ function createDataInterface(transport, onDeleted) {
1908
+ return {
1909
+ async delete(options) {
1910
+ const o2 = options;
1911
+ await transport.checkCustomerId(
1912
+ either3(o2, "customer_id", "customerId"),
1913
+ "data.delete"
1914
+ );
1915
+ const body = buildDeleteBody(options, transport.currentCredentials().instanceId);
1916
+ const dryRun = body["dry_run"] === true;
1917
+ const wait = _nullishCoalesce(options.wait, () => ( true));
1918
+ let result = null;
1919
+ for (let i = 0; i < (wait ? MAX_WAIT_CALLS : 1); i += 1) {
1920
+ result = normalise(
1921
+ await transport.request("data_delete", { body })
1922
+ );
1923
+ if (dryRun || !result.continue) break;
1924
+ }
1925
+ const final = result;
1926
+ if (!dryRun && ["complete", "partial", "in_progress"].includes(final.status) && onDeleted) {
1927
+ try {
1928
+ final.local_cleared = onDeleted({
1929
+ scope: body["scope"],
1930
+ userId: _nullishCoalesce(body["user_id"], () => ( null)),
1931
+ customerId: _nullishCoalesce(body["customer_id"], () => ( null)),
1932
+ conversationId: _nullishCoalesce(body["conversation_id"], () => ( null))
1933
+ });
1934
+ } catch (e7) {
1935
+ }
1936
+ }
1937
+ return final;
1938
+ },
1939
+ async status(deletionId) {
1940
+ if (typeof deletionId !== "string" || deletionId.trim() === "") {
1941
+ throw new (0, _chunk7IZHVYO2cjs.InvalidInputError)("deletion_id is required");
1942
+ }
1943
+ return normalise(
1944
+ await transport.request("data_delete_status", {
1945
+ pathParams: { deletion_id: deletionId },
1946
+ query: { instance_id: transport.currentCredentials().instanceId }
1947
+ })
1948
+ );
1949
+ }
1950
+ };
1951
+ }
1952
+
1773
1953
  // src/user/interface.ts
1774
1954
  function createUserNamespace(transport, hooks = {}) {
1775
1955
  return {
@@ -1894,10 +2074,10 @@ function jsonOrText(value) {
1894
2074
  (_k, v) => typeof v === "bigint" ? String(v) : v
1895
2075
  );
1896
2076
  return out === void 0 ? String(value) : out;
1897
- } catch (e7) {
2077
+ } catch (e8) {
1898
2078
  try {
1899
2079
  return String(value);
1900
- } catch (e8) {
2080
+ } catch (e9) {
1901
2081
  return "";
1902
2082
  }
1903
2083
  }
@@ -1950,7 +2130,7 @@ function createInstanceNamespace(credentials, cache, onTurn, agentModel = () =>
1950
2130
  ...customerId ? { customer_id: customerId } : {}
1951
2131
  });
1952
2132
  openSessions.set(conversationId, sessionId);
1953
- } catch (e9) {
2133
+ } catch (e10) {
1954
2134
  }
1955
2135
  }
1956
2136
  const namespace = {
@@ -1960,9 +2140,9 @@ function createInstanceNamespace(credentials, cache, onTurn, agentModel = () =>
1960
2140
  }
1961
2141
  try {
1962
2142
  _optionalChain([onListen, 'optionalCall', _66 => _66()]);
1963
- } catch (e10) {
2143
+ } catch (e11) {
1964
2144
  }
1965
- const { GrpcStreamClient } = await Promise.resolve().then(() => _interopRequireWildcard(require("./stream-client-SZIYGVVJ.cjs")));
2145
+ const { GrpcStreamClient } = await Promise.resolve().then(() => _interopRequireWildcard(require("./stream-client-IPHDTXQO.cjs")));
1966
2146
  const onContext = _nullishCoalesce(options.on_context, () => ( options.onContext));
1967
2147
  const onDisconnect = _nullishCoalesce(options.on_disconnect, () => ( options.onDisconnect));
1968
2148
  const onReconnect = _nullishCoalesce(options.on_reconnect, () => ( options.onReconnect));
@@ -2022,7 +2202,7 @@ function createInstanceNamespace(credentials, cache, onTurn, agentModel = () =>
2022
2202
  session_id: sessionId,
2023
2203
  conversation_id: conversationId
2024
2204
  });
2025
- } catch (e11) {
2205
+ } catch (e12) {
2026
2206
  }
2027
2207
  },
2028
2208
  async send_message(options) {
@@ -2151,7 +2331,7 @@ function createInstanceNamespace(credentials, cache, onTurn, agentModel = () =>
2151
2331
  }
2152
2332
 
2153
2333
  // src/version.ts
2154
- var SDK_VERSION = "0.6.1";
2334
+ var SDK_VERSION = "0.6.5";
2155
2335
 
2156
2336
  // src/registry.ts
2157
2337
  var instances = /* @__PURE__ */ new Map();
@@ -2291,7 +2471,7 @@ var ShortTermStore = class {
2291
2471
  if (this.#archive !== null) {
2292
2472
  try {
2293
2473
  this.#archive.add(conversationId, role, content, stamp, { messageId: _nullishCoalesce(confirmation.messageId, () => ( null)) });
2294
- } catch (e12) {
2474
+ } catch (e13) {
2295
2475
  }
2296
2476
  }
2297
2477
  const entry = _nullishCoalesce(this.#entries.get(conversationId), () => ( this.#blank(conversationId)));
@@ -2505,7 +2685,7 @@ var TurnStore = (_class3 = class {
2505
2685
  #conversations = /* @__PURE__ */ new Map();
2506
2686
  #vectors = /* @__PURE__ */ new Map();
2507
2687
  constructor(options = {}) {;_class3.prototype.__init6.call(this);
2508
- this.limits = _nullishCoalesce(options.limits, () => ( { ..._chunkICUFS3B5cjs.HISTORY_SEARCH.store_limits }));
2688
+ this.limits = _nullishCoalesce(options.limits, () => ( { ..._chunkBYUGILQIcjs.HISTORY_SEARCH.store_limits }));
2509
2689
  this.#now = _nullishCoalesce(options.now, () => ( (() => Date.now() / 1e3)));
2510
2690
  }
2511
2691
  add(conversationId, role, content, timestamp, options = {}) {
@@ -2649,11 +2829,11 @@ var TurnStore = (_class3 = class {
2649
2829
 
2650
2830
  // src/cache/history-search.ts
2651
2831
  var WORD_RE = /[\p{L}\p{N}\p{M}]+/gu;
2652
- var FORMS = _nullishCoalesce(_chunkICUFS3B5cjs.HISTORY_SEARCH.irregular_forms, () => ( {}));
2832
+ var FORMS = _nullishCoalesce(_chunkBYUGILQIcjs.HISTORY_SEARCH.irregular_forms, () => ( {}));
2653
2833
  function tokenize2(text) {
2654
2834
  const out = [];
2655
2835
  for (const word of _nullishCoalesce((text || "").toLowerCase().match(WORD_RE), () => ( []))) {
2656
- if (/^[\x00-\x7f]+$/.test(word)) out.push(..._chunkICUFS3B5cjs.tokenize.call(void 0, _nullishCoalesce(FORMS[word], () => ( word))));
2836
+ if (/^[\x00-\x7f]+$/.test(word)) out.push(..._chunkBYUGILQIcjs.tokenize.call(void 0, _nullishCoalesce(FORMS[word], () => ( word))));
2657
2837
  else out.push(word);
2658
2838
  }
2659
2839
  return out;
@@ -2790,19 +2970,19 @@ function windowsOf(pieces, maxWords) {
2790
2970
  }
2791
2971
  function askedKinds(query) {
2792
2972
  const out = [];
2793
- for (const [name, spec] of Object.entries(_nullishCoalesce(_chunkICUFS3B5cjs.HISTORY_SEARCH.asked_kinds, () => ( {})))) {
2973
+ for (const [name, spec] of Object.entries(_nullishCoalesce(_chunkBYUGILQIcjs.HISTORY_SEARCH.asked_kinds, () => ( {})))) {
2794
2974
  if (name.startsWith("$") || typeof spec !== "object") continue;
2795
2975
  if (new RegExp(spec.query, "i").test(_nullishCoalesce(query, () => ( "")))) out.push(new RegExp(spec.value));
2796
2976
  }
2797
2977
  return out;
2798
2978
  }
2799
2979
  function asksHowItStarted(query) {
2800
- const spec = _chunkICUFS3B5cjs.HISTORY_SEARCH.early_query;
2980
+ const spec = _chunkBYUGILQIcjs.HISTORY_SEARCH.early_query;
2801
2981
  if (!_optionalChain([spec, 'optionalAccess', _78 => _78.pattern])) return false;
2802
2982
  return new RegExp(spec.pattern, (_nullishCoalesce(spec.flags, () => ( ""))).includes("i") ? "i" : "").test(_nullishCoalesce(query, () => ( "")));
2803
2983
  }
2804
2984
  async function searchTurns(turns, query, options = {}) {
2805
- const params = _chunkICUFS3B5cjs.HISTORY_SEARCH;
2985
+ const params = _chunkBYUGILQIcjs.HISTORY_SEARCH;
2806
2986
  const k = params.max_excerpts;
2807
2987
  const skip = new Set(_nullishCoalesce(options.exclude, () => ( [])));
2808
2988
  const pool = turns.filter((t) => t.content && !skip.has(t.content) && !skip.has(_nullishCoalesce(t.message_id, () => ( ""))));
@@ -2829,7 +3009,7 @@ async function searchTurns(turns, query, options = {}) {
2829
3009
  });
2830
3010
  });
2831
3011
  const docs = units.map((u) => tokenize2(u.content));
2832
- const bm = new (0, _chunkICUFS3B5cjs.BM25)(docs);
3012
+ const bm = new (0, _chunkBYUGILQIcjs.BM25)(docs);
2833
3013
  const termList = [...terms];
2834
3014
  const rows = units.map((turn, i) => {
2835
3015
  const held = new Set(docs[i]);
@@ -2967,13 +3147,13 @@ async function embeddingRanks(pool, query, encoder, store, minCosine) {
2967
3147
  }
2968
3148
  function toolResultText(result, toolName) {
2969
3149
  let text = typeof result === "string" ? result : _nullishCoalesce(JSON.stringify(result), () => ( String(result)));
2970
- const limit = _nullishCoalesce(_chunkICUFS3B5cjs.HISTORY_SEARCH.tool_result_max_chars, () => ( 16e3));
3150
+ const limit = _nullishCoalesce(_chunkBYUGILQIcjs.HISTORY_SEARCH.tool_result_max_chars, () => ( 16e3));
2971
3151
  if (text.length > limit) text = text.slice(0, limit) + " ...[cut]";
2972
3152
  return `[tool result: ${toolName || "tool"}] ${text}`;
2973
3153
  }
2974
3154
  function renderExcerpts(excerpts, latest = "") {
2975
3155
  if (excerpts.length === 0) return "";
2976
- const lines = [_chunkICUFS3B5cjs.HISTORY_SEARCH.heading];
3156
+ const lines = [_chunkBYUGILQIcjs.HISTORY_SEARCH.heading];
2977
3157
  for (const e of excerpts) {
2978
3158
  let where = e.position ? `turn ${e.position}, ${e.role}` : `${e.role}, earlier`;
2979
3159
  if (e.timestamp) {
@@ -3066,7 +3246,7 @@ function overlayLocalRecentTurns(response, store, conversationId, configured) {
3066
3246
  compacted_at: orLocal("compacted_at", entry.compactedAt),
3067
3247
  conversation_id: conversationId
3068
3248
  };
3069
- } catch (e13) {
3249
+ } catch (e14) {
3070
3250
  }
3071
3251
  }
3072
3252
 
@@ -3079,7 +3259,7 @@ function stringify(value) {
3079
3259
  if (t === "string" || t === "number" || t === "boolean") return String(value);
3080
3260
  try {
3081
3261
  return _nullishCoalesce(JSON.stringify(value), () => ( ""));
3082
- } catch (e14) {
3262
+ } catch (e15) {
3083
3263
  return String(value);
3084
3264
  }
3085
3265
  }
@@ -3283,7 +3463,7 @@ function pick2(item, ...names) {
3283
3463
  }
3284
3464
  return void 0;
3285
3465
  }
3286
- function normalise(item) {
3466
+ function normalise2(item) {
3287
3467
  const content = _nullishCoalesce(pick2(item, "content"), () => ( ""));
3288
3468
  const confidence = _nullishCoalesce(pick2(item, "confidence"), () => ( 0));
3289
3469
  const extractedAt = _nullishCoalesce(pick2(item, "extracted_at", "created_at"), () => ( null));
@@ -3318,7 +3498,7 @@ function mergeUserSummary(response, bundle) {
3318
3498
  if (!Array.isArray(items)) continue;
3319
3499
  const existing = _nullishCoalesce(response[collection], () => ( []));
3320
3500
  const existingIds = new Set(existing.map((i) => String(_nullishCoalesce(_nullishCoalesce(i.id, () => ( i.item_id)), () => ( "")))));
3321
- const fresh = items.filter((i) => typeof i === "object" && i !== null && !existingIds.has(itemId(i))).slice(0, MAX_SUMMARY_ITEMS).map(normalise);
3501
+ const fresh = items.filter((i) => typeof i === "object" && i !== null && !existingIds.has(itemId(i))).slice(0, MAX_SUMMARY_ITEMS).map(normalise2);
3322
3502
  if (fresh.length === 0) continue;
3323
3503
  response[collection] = [...existing, ...fresh];
3324
3504
  }
@@ -3327,16 +3507,16 @@ function mergeUserSummary(response, bundle) {
3327
3507
 
3328
3508
  // src/context/anticipated.ts
3329
3509
  function scopeLookupParams(scope, params) {
3330
- const { searchQuery, entityId, customerId, clientId, conversationId, scopeRung } = params;
3510
+ const { searchQuery, entityId, customerId, clientId, conversationId, scopeRung, maxResultsPerQuery } = params;
3331
3511
  switch (scope) {
3332
3512
  case "conversation":
3333
- return { searchQuery, entityId, customerId, clientId, conversationId, scopeRung };
3513
+ return { searchQuery, entityId, customerId, clientId, conversationId, scopeRung, maxResultsPerQuery };
3334
3514
  case "user":
3335
- return { searchQuery, entityId, customerId, clientId, scopeRung };
3515
+ return { searchQuery, entityId, customerId, clientId, scopeRung, maxResultsPerQuery };
3336
3516
  case "customer":
3337
- return { searchQuery, entityId: null, customerId, clientId, scopeRung };
3517
+ return { searchQuery, entityId: null, customerId, clientId, scopeRung, maxResultsPerQuery };
3338
3518
  case "client":
3339
- return { searchQuery, entityId: null, customerId: null, clientId, scopeRung };
3519
+ return { searchQuery, entityId: null, customerId: null, clientId, scopeRung, maxResultsPerQuery };
3340
3520
  }
3341
3521
  }
3342
3522
  function buildAnticipationResponse(hit) {
@@ -3372,11 +3552,12 @@ async function tryServeFromCache(cache, scope, params, maxItems) {
3372
3552
  clientId: _nullishCoalesce(scoped.clientId, () => ( null)),
3373
3553
  conversationId: _nullishCoalesce(scoped.conversationId, () => ( null)),
3374
3554
  scopeRung: _nullishCoalesce(scoped.scopeRung, () => ( null)),
3375
- maxItems
3555
+ maxItems,
3556
+ maxResultsPerQuery: _nullishCoalesce(scoped.maxResultsPerQuery, () => ( null))
3376
3557
  });
3377
3558
  if (hit === null) return { response: null, hit: null };
3378
3559
  return { response: buildAnticipationResponse(hit), hit };
3379
- } catch (e15) {
3560
+ } catch (e16) {
3380
3561
  return { response: null, hit: null };
3381
3562
  }
3382
3563
  }
@@ -3875,6 +4056,7 @@ var SynapClient = (_class4 = class _SynapClient {
3875
4056
 
3876
4057
 
3877
4058
 
4059
+
3878
4060
  #closed = false;
3879
4061
  #initialized = false;
3880
4062
  #identity;
@@ -3929,12 +4111,11 @@ var SynapClient = (_class4 = class _SynapClient {
3929
4111
  });
3930
4112
  if (options.heartbeat) this.#transport.startHeartbeat();
3931
4113
  this.#transport.identityResolver = () => this.#resolveIdentity();
3932
- this.#anticipationCache = new (0, _chunkICUFS3B5cjs.AnticipationCache)();
4114
+ this.#anticipationCache = new (0, _chunkBYUGILQIcjs.AnticipationCache)();
3933
4115
  this.#fetchHooks = {
3934
4116
  beforeFetch: async (scope, options2) => {
3935
4117
  const o2 = options2;
3936
4118
  if (_nullishCoalesce(o2["query_date"], () => ( o2["queryDate"]))) return null;
3937
- if (_nullishCoalesce(o2["max_results_per_query"], () => ( o2["maxResultsPerQuery"]))) return null;
3938
4119
  const attempt = await tryServeFromCache(
3939
4120
  this.#anticipationCache,
3940
4121
  scope,
@@ -3949,9 +4130,10 @@ var SynapClient = (_class4 = class _SynapClient {
3949
4130
  // on entity and conversation alone, so a bundle prefetched for one
3950
4131
  // rung answered a caller standing at another, entirely inside this
3951
4132
  // process and invisible to every server log.
3952
- scopeRung: _chunkICUFS3B5cjs.rungKey.call(void 0,
4133
+ scopeRung: _chunkBYUGILQIcjs.rungKey.call(void 0,
3953
4134
  _nullishCoalesce(o2["scope_path"], () => ( o2["scopePath"]))
3954
- )
4135
+ ),
4136
+ maxResultsPerQuery: _nullishCoalesce(_nullishCoalesce(o2["max_results_per_query"], () => ( o2["maxResultsPerQuery"])), () => ( null))
3955
4137
  },
3956
4138
  Number(_nullishCoalesce(_nullishCoalesce(o2["max_results"], () => ( o2["maxResults"])), () => ( 10)))
3957
4139
  );
@@ -3961,7 +4143,7 @@ var SynapClient = (_class4 = class _SynapClient {
3961
4143
  servedItemIds: servedItemIds(attempt.hit),
3962
4144
  bundleId: _nullishCoalesce(attempt.hit.bundleIds[0], () => ( "")),
3963
4145
  borderline: attempt.hit.band === "borderline",
3964
- raceDeadlineMs: _chunkICUFS3B5cjs.SEMANTIC_MATCH.race_deadline_ms
4146
+ raceDeadlineMs: _chunkBYUGILQIcjs.SEMANTIC_MATCH.race_deadline_ms
3965
4147
  };
3966
4148
  },
3967
4149
  onAssembled: (scope, options2, response, startedAt) => {
@@ -3977,6 +4159,30 @@ var SynapClient = (_class4 = class _SynapClient {
3977
4159
  // Python's `_should_skip_server_st`: when this process already holds the
3978
4160
  // conversation's compaction and every turn after it, the server is told
3979
4161
  // not to assemble them again.
4162
+ // A fetch with no query, as Python answers it inside the two scoped
4163
+ // fetches: the conversation's state, or the user's profile when there
4164
+ // is one. A profile read that fails falls back to the fetch as before.
4165
+ withoutQuery: async (scope, options2) => {
4166
+ const o2 = options2;
4167
+ if (scope === "conversation") {
4168
+ const id = _nullishCoalesce(o2["conversation_id"], () => ( o2["conversationId"]));
4169
+ const prompt = await this.conversation.context.get_context_for_prompt({ conversation_id: id });
4170
+ return conversationStateContext(prompt, id);
4171
+ }
4172
+ if (scope === "user") {
4173
+ try {
4174
+ const customerId = _nullishCoalesce(o2["customer_id"], () => ( o2["customerId"]));
4175
+ const profile = await this.user.get_profile({
4176
+ user_id: _nullishCoalesce(o2["user_id"], () => ( o2["userId"])),
4177
+ ...customerId !== void 0 ? { customer_id: customerId } : {}
4178
+ });
4179
+ return profileContext(profile);
4180
+ } catch (e17) {
4181
+ return null;
4182
+ }
4183
+ }
4184
+ return null;
4185
+ },
3980
4186
  skipServerShortTerm: (conversationId) => {
3981
4187
  if (!this.#isStAuthoritative()) return false;
3982
4188
  const entry = this.#shortTerm.get(conversationId);
@@ -3990,7 +4196,7 @@ var SynapClient = (_class4 = class _SynapClient {
3990
4196
  response,
3991
4197
  _nullishCoalesce(o2["conversation_id"], () => ( o2["conversationId"])),
3992
4198
  owner,
3993
- _chunkICUFS3B5cjs.rungKey.call(void 0, _nullishCoalesce(o2["scope_path"], () => ( o2["scopePath"])))
4199
+ _chunkBYUGILQIcjs.rungKey.call(void 0, _nullishCoalesce(o2["scope_path"], () => ( o2["scopePath"])))
3994
4200
  );
3995
4201
  }
3996
4202
  };
@@ -4011,7 +4217,7 @@ var SynapClient = (_class4 = class _SynapClient {
4011
4217
  this.#localEncoder = _nullishCoalesce(_nullishCoalesce(options.history_search_encoder, () => ( options.historySearchEncoder)), () => ( null));
4012
4218
  const modelOption = options.history_search_model !== void 0 ? options.history_search_model : options.historySearchModel;
4013
4219
  this.#localModelName = modelOption === void 0 ? "auto" : modelOption;
4014
- if (_optionalChain([this, 'access', _79 => _79.#localEncoder, 'optionalAccess', _80 => _80.model]) === _chunkICUFS3B5cjs.SEMANTIC_MATCH.model) this.#anticipationCache.setEncoder(this.#localEncoder);
4220
+ if (_optionalChain([this, 'access', _79 => _79.#localEncoder, 'optionalAccess', _80 => _80.model]) === _chunkBYUGILQIcjs.SEMANTIC_MATCH.model) this.#anticipationCache.setEncoder(this.#localEncoder);
4015
4221
  this.#turns = new TurnCounter();
4016
4222
  this.conversation = createConversationNamespace(
4017
4223
  this.#transport,
@@ -4037,7 +4243,7 @@ var SynapClient = (_class4 = class _SynapClient {
4037
4243
  },
4038
4244
  (response, conversationId, userId, scopePath) => {
4039
4245
  overlayLocalRecentTurns(response, this.#shortTerm, conversationId, this.#stVerbatimOverlay);
4040
- this.#injectUserSummary(response, conversationId, userId, _chunkICUFS3B5cjs.rungKey.call(void 0, scopePath));
4246
+ this.#injectUserSummary(response, conversationId, userId, _chunkBYUGILQIcjs.rungKey.call(void 0, scopePath));
4041
4247
  },
4042
4248
  {
4043
4249
  prompt: (conversationId, style) => this.#localPrompt(conversationId, style),
@@ -4057,6 +4263,22 @@ var SynapClient = (_class4 = class _SynapClient {
4057
4263
  if (id) this.#anticipationCache.dropEntity(id);
4058
4264
  }
4059
4265
  });
4266
+ this.data = createDataInterface(this.#transport, ({ scope, userId, customerId, conversationId }) => {
4267
+ const cleared = [];
4268
+ if (scope === "conversation") {
4269
+ if (conversationId) {
4270
+ this.#shortTerm.invalidate(conversationId);
4271
+ this.#turnStore.drop(conversationId);
4272
+ cleared.push("short_term_context", "turns");
4273
+ }
4274
+ } else {
4275
+ for (const id of new Set(scope === "user" ? [userId, customerId] : [customerId])) {
4276
+ if (id) this.#anticipationCache.dropEntity(id);
4277
+ }
4278
+ cleared.push("anticipation_cache");
4279
+ }
4280
+ return cleared;
4281
+ });
4060
4282
  this.credits = createCreditsNamespace(this.#transport);
4061
4283
  this.cache = createCacheNamespace(this.#anticipationCache);
4062
4284
  this.instance = createInstanceNamespace(
@@ -4204,7 +4426,7 @@ var SynapClient = (_class4 = class _SynapClient {
4204
4426
  this.#registryKeys.push(resolvedInstanceId);
4205
4427
  }
4206
4428
  }
4207
- } catch (e16) {
4429
+ } catch (e18) {
4208
4430
  }
4209
4431
  }
4210
4432
  /**
@@ -4312,7 +4534,9 @@ var SynapClient = (_class4 = class _SynapClient {
4312
4534
  const labels = [];
4313
4535
  const tasks = [];
4314
4536
  const present = (v) => v !== void 0 && v !== null && v !== "";
4315
- if (present(conversationId) && wants("conversation")) {
4537
+ const conversationState = present(conversationId) && contextMode !== "conversation-summary" && !hasQuery(searchQuery) && wants("conversation");
4538
+ const withConversationContext = includeConversationContext;
4539
+ if (present(conversationId) && wants("conversation") && !conversationState) {
4316
4540
  labels.push("conversation");
4317
4541
  tasks.push(this.conversation.context.fetch({
4318
4542
  conversation_id: conversationId,
@@ -4348,7 +4572,7 @@ var SynapClient = (_class4 = class _SynapClient {
4348
4572
  ...shared
4349
4573
  }));
4350
4574
  }
4351
- if (tasks.length === 0) {
4575
+ if (tasks.length === 0 && !(conversationState && includeConversationContext)) {
4352
4576
  const empty = mergeScopeResults([]);
4353
4577
  return empty;
4354
4578
  }
@@ -4367,17 +4591,20 @@ var SynapClient = (_class4 = class _SynapClient {
4367
4591
  for (const [, response] of successful) {
4368
4592
  overlayLocalRecentTurns(response, this.#shortTerm, conversationId, this.#stVerbatimOverlay);
4369
4593
  }
4370
- if (includeConversationContext && present(conversationId)) {
4594
+ if (withConversationContext && present(conversationId)) {
4371
4595
  try {
4372
4596
  merged.conversation_context = await this.conversation.context.get_context_for_prompt({
4373
4597
  conversation_id: conversationId
4374
4598
  });
4375
- } catch (e17) {
4599
+ if (conversationState && !merged.scopes_queried.includes("conversation")) {
4600
+ merged.scopes_queried.unshift("conversation");
4601
+ }
4602
+ } catch (e19) {
4376
4603
  }
4377
4604
  }
4378
4605
  merged.formatted_context = formatForPrompt(merged, {
4379
4606
  includeScope: includeScopeLabels,
4380
- includeConversationContext
4607
+ includeConversationContext: withConversationContext
4381
4608
  });
4382
4609
  return merged;
4383
4610
  }
@@ -4402,13 +4629,13 @@ var SynapClient = (_class4 = class _SynapClient {
4402
4629
  /**
4403
4630
  * Report a locally served fetch back to the server.
4404
4631
  *
4405
- * Only while listening: the event rides the Listen stream, and there is
4406
- * nowhere to put it otherwise. Never throws, because a telemetry failure
4407
- * must not fail a retrieval that already succeeded.
4632
+ * It rides the Listen stream. While the stream is reconnecting the stream
4633
+ * client holds it and sends it on reconnect: a hit never reaches a fetch
4634
+ * route, so this report is the only count of it. Never throws, because a
4635
+ * telemetry failure must not fail a retrieval that already succeeded.
4408
4636
  */
4409
4637
  #emitContextUsed(options, scope, served) {
4410
4638
  try {
4411
- if (!this.instance.is_listening) return;
4412
4639
  this.instance._internal.sendContextUsed({
4413
4640
  bundle_id: served.bundleId,
4414
4641
  conversation_id: String(_nullishCoalesce(_nullishCoalesce(options["conversation_id"], () => ( options["conversationId"])), () => ( ""))),
@@ -4424,7 +4651,7 @@ var SynapClient = (_class4 = class _SynapClient {
4424
4651
  // not carry the caller's words.
4425
4652
  query_count: distinctQueryCount(_nullishCoalesce(options["search_query"], () => ( options["searchQuery"])))
4426
4653
  });
4427
- } catch (e18) {
4654
+ } catch (e20) {
4428
4655
  }
4429
4656
  }
4430
4657
  /**
@@ -4449,7 +4676,7 @@ var SynapClient = (_class4 = class _SynapClient {
4449
4676
  }),
4450
4677
  scope
4451
4678
  });
4452
- } catch (e19) {
4679
+ } catch (e21) {
4453
4680
  }
4454
4681
  }
4455
4682
  /**
@@ -4551,7 +4778,7 @@ var SynapClient = (_class4 = class _SynapClient {
4551
4778
  toolResultText(result, _nullishCoalesce(options.tool_name, () => ( options.toolName))),
4552
4779
  _nullishCoalesce(options.timestamp, () => ( (/* @__PURE__ */ new Date()).toISOString()))
4553
4780
  );
4554
- } catch (e20) {
4781
+ } catch (e22) {
4555
4782
  }
4556
4783
  }
4557
4784
  static __initStatic() {this.BACKFILL_COOLDOWN_MS = 6e4}
@@ -4565,13 +4792,13 @@ var SynapClient = (_class4 = class _SynapClient {
4565
4792
  if (this.#localModelStarted) return;
4566
4793
  this.#localModelStarted = true;
4567
4794
  if (localModelOff()) return;
4568
- const name = this.#localModelName === "auto" ? _chunkICUFS3B5cjs.SEMANTIC_MATCH.model : this.#localModelName;
4795
+ const name = this.#localModelName === "auto" ? _chunkBYUGILQIcjs.SEMANTIC_MATCH.model : this.#localModelName;
4569
4796
  if (!name) return;
4570
4797
  const callerEncoder = this.#localEncoder;
4571
4798
  void Promise.resolve().then(() => _interopRequireWildcard(require("./onnx-encoder-4RSL6ID4.cjs"))).then(({ canRunLocalModel, loadOnnxEncoder }) => canRunLocalModel() ? loadOnnxEncoder(name) : null).then((encoder) => {
4572
4799
  if (encoder === null) return;
4573
4800
  if (callerEncoder === null) this.#localEncoder = encoder;
4574
- if (encoder.model === _chunkICUFS3B5cjs.SEMANTIC_MATCH.model) this.#anticipationCache.setEncoder(encoder);
4801
+ if (encoder.model === _chunkBYUGILQIcjs.SEMANTIC_MATCH.model) this.#anticipationCache.setEncoder(encoder);
4575
4802
  }).catch(() => {
4576
4803
  });
4577
4804
  }
@@ -4665,7 +4892,7 @@ function resolveBaseUrl(options) {
4665
4892
  return fromEnv !== void 0 && fromEnv !== "" ? fromEnv : void 0;
4666
4893
  }
4667
4894
  function resolveCredentials(options) {
4668
- const apiKey = _nullishCoalesce(options.apiKey, () => ( _chunkZKOJDUN4cjs.getEnv.call(void 0, "SYNAP_API_KEY")));
4895
+ const apiKey = options.apiKey || _chunkZKOJDUN4cjs.getEnv.call(void 0, "SYNAP_API_KEY");
4669
4896
  if (!apiKey) {
4670
4897
  throw new (0, _chunk7IZHVYO2cjs.AuthenticationError)(
4671
4898
  "No Synap API key found. Set SYNAP_API_KEY in your environment, or pass apiKey to the SynapClient constructor."
@@ -4738,5 +4965,5 @@ function resolveCredentials(options) {
4738
4965
 
4739
4966
 
4740
4967
 
4741
- exports.ANY_SCOPE = _chunkICUFS3B5cjs.ANY_SCOPE; exports.AgentUnavailableError = _chunk7IZHVYO2cjs.AgentUnavailableError; exports.AnticipationCache = _chunkICUFS3B5cjs.AnticipationCache; exports.AuthenticationError = _chunk7IZHVYO2cjs.AuthenticationError; exports.BM25 = _chunkICUFS3B5cjs.BM25; exports.COMPACTION_LEVELS = COMPACTION_LEVELS; exports.CONTRACT = _chunkICUFS3B5cjs.CONTRACT; exports.ConflictError = _chunk7IZHVYO2cjs.ConflictError; exports.ConnectionError = _chunk7IZHVYO2cjs.ConnectionError; exports.ContextNotFoundError = _chunk7IZHVYO2cjs.ContextNotFoundError; exports.CustomerIdNotAcceptedError = _chunk7IZHVYO2cjs.CustomerIdNotAcceptedError; 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.EXCERPT_CATEGORY = EXCERPT_CATEGORY; exports.FORGET_MODES = FORGET_MODES; exports.HttpTransport = HttpTransport; exports.INGEST_MODES = INGEST_MODES; exports.ITEM_COLLECTIONS = ITEM_COLLECTIONS; exports.InstanceBuildFailedError = _chunk7IZHVYO2cjs.InstanceBuildFailedError; exports.InstanceNotReadyError = _chunk7IZHVYO2cjs.InstanceNotReadyError; exports.InsufficientCreditsError = _chunk7IZHVYO2cjs.InsufficientCreditsError; exports.InvalidConversationIdError = _chunk7IZHVYO2cjs.InvalidConversationIdError; exports.InvalidInputError = _chunk7IZHVYO2cjs.InvalidInputError; exports.InvalidInstanceIdError = _chunk7IZHVYO2cjs.InvalidInstanceIdError; exports.ListeningAlreadyActiveError = _chunk7IZHVYO2cjs.ListeningAlreadyActiveError; exports.ListeningNotActiveError = _chunk7IZHVYO2cjs.ListeningNotActiveError; exports.MEMORY_TYPES = MEMORY_TYPES; exports.NetworkTimeoutError = _chunk7IZHVYO2cjs.NetworkTimeoutError; exports.PermanentError = _chunk7IZHVYO2cjs.PermanentError; exports.RESPONSE_SHAPES = RESPONSE_SHAPES; exports.RateLimitError = _chunk7IZHVYO2cjs.RateLimitError; exports.SDKError = _chunk7IZHVYO2cjs.SDKError; exports.SDK_VERSION = SDK_VERSION; exports.ServiceUnavailableError = _chunk7IZHVYO2cjs.ServiceUnavailableError; exports.SessionExpiredError = _chunk7IZHVYO2cjs.SessionExpiredError; exports.SynapClient = SynapClient; exports.SynapError = _chunk7IZHVYO2cjs.SynapError; exports.SynapPermanentError = _chunk7IZHVYO2cjs.SynapPermanentError; exports.SynapTransientError = _chunk7IZHVYO2cjs.SynapTransientError; exports.THRESHOLDS = _chunkICUFS3B5cjs.THRESHOLDS; exports.TranscriptConflictError = _chunk7IZHVYO2cjs.TranscriptConflictError; exports.TransientError = _chunk7IZHVYO2cjs.TransientError; exports.applyResponseShape = applyResponseShape; exports.flattenContextItems = flattenContextItems; exports.formatForPrompt = formatForPrompt; exports.isOutcomeUnknown = isOutcomeUnknown; exports.isRecallQuery = _chunkICUFS3B5cjs.isRecallQuery; exports.isSynapError = _chunk7IZHVYO2cjs.isSynapError; exports.mergeScopeResults = mergeScopeResults; exports.rankItems = rankItems; exports.resolvePath = resolvePath; exports.shouldRetry = shouldRetry; exports.stem = _chunkICUFS3B5cjs.stem; exports.tokenize = _chunkICUFS3B5cjs.tokenize; exports.wireRankScore = wireRankScore;
4968
+ exports.ANY_SCOPE = _chunkBYUGILQIcjs.ANY_SCOPE; exports.AgentUnavailableError = _chunk7IZHVYO2cjs.AgentUnavailableError; exports.AnticipationCache = _chunkBYUGILQIcjs.AnticipationCache; exports.AuthenticationError = _chunk7IZHVYO2cjs.AuthenticationError; exports.BM25 = _chunkBYUGILQIcjs.BM25; exports.COMPACTION_LEVELS = COMPACTION_LEVELS; exports.CONTRACT = _chunkBYUGILQIcjs.CONTRACT; exports.ConflictError = _chunk7IZHVYO2cjs.ConflictError; exports.ConnectionError = _chunk7IZHVYO2cjs.ConnectionError; exports.ContextNotFoundError = _chunk7IZHVYO2cjs.ContextNotFoundError; exports.CustomerIdNotAcceptedError = _chunk7IZHVYO2cjs.CustomerIdNotAcceptedError; exports.DATA_SCOPES = DATA_SCOPES; 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.EXCERPT_CATEGORY = EXCERPT_CATEGORY; exports.FORGET_MODES = FORGET_MODES; exports.HttpTransport = HttpTransport; exports.INGEST_MODES = INGEST_MODES; exports.ITEM_COLLECTIONS = ITEM_COLLECTIONS; exports.InstanceBuildFailedError = _chunk7IZHVYO2cjs.InstanceBuildFailedError; exports.InstanceNotReadyError = _chunk7IZHVYO2cjs.InstanceNotReadyError; exports.InsufficientCreditsError = _chunk7IZHVYO2cjs.InsufficientCreditsError; exports.InvalidConversationIdError = _chunk7IZHVYO2cjs.InvalidConversationIdError; exports.InvalidInputError = _chunk7IZHVYO2cjs.InvalidInputError; exports.InvalidInstanceIdError = _chunk7IZHVYO2cjs.InvalidInstanceIdError; exports.ListeningAlreadyActiveError = _chunk7IZHVYO2cjs.ListeningAlreadyActiveError; exports.ListeningNotActiveError = _chunk7IZHVYO2cjs.ListeningNotActiveError; exports.MEMORY_TYPES = MEMORY_TYPES; exports.NetworkTimeoutError = _chunk7IZHVYO2cjs.NetworkTimeoutError; exports.PermanentError = _chunk7IZHVYO2cjs.PermanentError; exports.RESPONSE_SHAPES = RESPONSE_SHAPES; exports.RateLimitError = _chunk7IZHVYO2cjs.RateLimitError; exports.SDKError = _chunk7IZHVYO2cjs.SDKError; exports.SDK_VERSION = SDK_VERSION; exports.ServiceUnavailableError = _chunk7IZHVYO2cjs.ServiceUnavailableError; exports.SessionExpiredError = _chunk7IZHVYO2cjs.SessionExpiredError; exports.SynapClient = SynapClient; exports.SynapError = _chunk7IZHVYO2cjs.SynapError; exports.SynapPermanentError = _chunk7IZHVYO2cjs.SynapPermanentError; exports.SynapTransientError = _chunk7IZHVYO2cjs.SynapTransientError; exports.THRESHOLDS = _chunkBYUGILQIcjs.THRESHOLDS; exports.TranscriptConflictError = _chunk7IZHVYO2cjs.TranscriptConflictError; exports.TransientError = _chunk7IZHVYO2cjs.TransientError; exports.applyResponseShape = applyResponseShape; exports.flattenContextItems = flattenContextItems; exports.formatForPrompt = formatForPrompt; exports.isOutcomeUnknown = isOutcomeUnknown; exports.isSynapError = _chunk7IZHVYO2cjs.isSynapError; exports.mergeScopeResults = mergeScopeResults; exports.rankItems = rankItems; exports.resolvePath = resolvePath; exports.shouldRetry = shouldRetry; exports.stem = _chunkBYUGILQIcjs.stem; exports.tokenize = _chunkBYUGILQIcjs.tokenize; exports.wireRankScore = wireRankScore;
4742
4969
  //# sourceMappingURL=index.cjs.map