@maximem/synap-js-sdk 0.4.3 → 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/anticipation-cache-ARYEEKMU.cjs.map +1 -1
  2. package/dist/{chunk-HR5Y3KXS.cjs → chunk-2TVL5IPQ.cjs} +7 -1
  3. package/dist/chunk-2TVL5IPQ.cjs.map +1 -0
  4. package/dist/{chunk-VXRCBMCY.cjs → chunk-3JSE64GW.cjs} +1 -1
  5. package/dist/chunk-3JSE64GW.cjs.map +1 -0
  6. package/dist/{chunk-T3NZBIV2.js → chunk-OCMM2Z5P.js} +7 -1
  7. package/dist/chunk-OCMM2Z5P.js.map +1 -0
  8. package/dist/chunk-RB57I2IQ.cjs.map +1 -1
  9. package/dist/chunk-ZKOJDUN4.cjs.map +1 -1
  10. package/dist/{chunk-5SC3ELNK.js → chunk-ZU6ZC4SU.js} +1 -1
  11. package/dist/chunk-ZU6ZC4SU.js.map +1 -0
  12. package/dist/env-55ULHNJZ.cjs.map +1 -1
  13. package/dist/grpc/index.cjs +7 -7
  14. package/dist/grpc/index.cjs.map +1 -1
  15. package/dist/grpc/index.d.cts +4 -0
  16. package/dist/grpc/index.d.ts +4 -0
  17. package/dist/grpc/index.js +3 -3
  18. package/dist/index.cjs +157 -94
  19. package/dist/index.cjs.map +1 -1
  20. package/dist/index.d.cts +174 -20
  21. package/dist/index.d.ts +174 -20
  22. package/dist/index.js +77 -14
  23. package/dist/index.js.map +1 -1
  24. package/dist/stream-client-6V4FGKZ3.js +7 -0
  25. package/dist/stream-client-PRTOH62B.cjs +7 -0
  26. package/dist/stream-client-PRTOH62B.cjs.map +1 -0
  27. package/package.json +1 -1
  28. package/dist/chunk-5SC3ELNK.js.map +0 -1
  29. package/dist/chunk-HR5Y3KXS.cjs.map +0 -1
  30. package/dist/chunk-T3NZBIV2.js.map +0 -1
  31. package/dist/chunk-VXRCBMCY.cjs.map +0 -1
  32. package/dist/stream-client-ME5N5NK4.js +0 -7
  33. package/dist/stream-client-ZN6ADZBR.cjs +0 -7
  34. package/dist/stream-client-ZN6ADZBR.cjs.map +0 -1
  35. /package/dist/{stream-client-ME5N5NK4.js.map → stream-client-6V4FGKZ3.js.map} +0 -0
package/dist/index.cjs CHANGED
@@ -22,7 +22,7 @@
22
22
 
23
23
 
24
24
 
25
- var _chunkHR5Y3KXScjs = require('./chunk-HR5Y3KXS.cjs');
25
+ var _chunk2TVL5IPQcjs = require('./chunk-2TVL5IPQ.cjs');
26
26
 
27
27
 
28
28
 
@@ -113,7 +113,7 @@ function shouldRetry(input) {
113
113
  if (attempt >= policy.maxAttempts) {
114
114
  return { retry: false, delaySeconds: 0, reason: "max_attempts_exhausted" };
115
115
  }
116
- if (!_chunkHR5Y3KXScjs.isSynapError.call(void 0, error) || !error.transient) {
116
+ if (!_chunk2TVL5IPQcjs.isSynapError.call(void 0, error) || !error.transient) {
117
117
  return { retry: false, delaySeconds: 0, reason: "not_transient" };
118
118
  }
119
119
  const idempotent = _nullishCoalesce(input.idempotent, () => ( IDEMPOTENT_METHODS.has(method.toUpperCase())));
@@ -131,7 +131,7 @@ function shouldRetry(input) {
131
131
  };
132
132
  }
133
133
  function backoffDelay(error, attempt, policy) {
134
- if (error instanceof _chunkHR5Y3KXScjs.RateLimitError && error.retryAfterSeconds != null) {
134
+ if (error instanceof _chunk2TVL5IPQcjs.RateLimitError && error.retryAfterSeconds != null) {
135
135
  return Math.min(error.retryAfterSeconds, policy.backoffMax);
136
136
  }
137
137
  const exponential = policy.backoffBase * 2 ** (attempt - 1);
@@ -205,7 +205,7 @@ var B2C_ISOLATION = "equals_customer";
205
205
  function checkCustomerId(isolation, customerId, where, instanceId) {
206
206
  if (customerId === void 0 || customerId === null || customerId === "") return;
207
207
  if (isolation !== B2C_ISOLATION) return;
208
- throw new (0, _chunkHR5Y3KXScjs.InvalidInputError)(
208
+ throw new (0, _chunk2TVL5IPQcjs.InvalidInputError)(
209
209
  `${where}: customer_id is not accepted on this instance${instanceId ? ` (${instanceId})` : ""}, which is B2C (user_context_isolation='${B2C_ISOLATION}'). Send user_id only; it is the whole identity, and the server files and reads your data under it. Received customer_id=${JSON.stringify(customerId)}.`
210
210
  );
211
211
  }
@@ -229,7 +229,7 @@ var HttpTransport = (_class2 = class {
229
229
  this.#credentials = options.credentials;
230
230
  this.baseUrl = (_nullishCoalesce(options.baseUrl, () => ( DEFAULT_BASE_URL))).replace(/\/+$/, "");
231
231
  this.timeouts = { ...DEFAULT_TIMEOUTS, ...options.timeouts };
232
- this.retryPolicy = { ...DEFAULT_RETRY_POLICY, ...options.retryPolicy };
232
+ this.retryPolicy = options.retryPolicy === null ? { ...DEFAULT_RETRY_POLICY, maxAttempts: 1 } : { ...DEFAULT_RETRY_POLICY, ...options.retryPolicy };
233
233
  this.userAgent = _nullishCoalesce(options.userAgent, () => ( "@maximem/synap-js-sdk"));
234
234
  this.fetchImpl = _nullishCoalesce(options.fetchImpl, () => ( globalThis.fetch.bind(globalThis)));
235
235
  this.keepAliveOptions = _nullishCoalesce(options.keepAlive, () => ( {}));
@@ -285,9 +285,16 @@ var HttpTransport = (_class2 = class {
285
285
  setTimeouts(timeouts) {
286
286
  this.timeouts = { ...this.timeouts, ...timeouts };
287
287
  }
288
- /** `null` restores the default policy, matching Python's `retry_policy=None`. */
288
+ /**
289
+ * `null` DISABLES retries, matching Python.
290
+ *
291
+ * Python's `SDKConfig(retry_policy=None)` leaves `self.retry_policy` unset and
292
+ * `max_attempts` falls to 1 (http_client.py:180). We restored the default
293
+ * policy instead, so a caller following the "Disabling Retries" documentation
294
+ * got three attempts and no way to turn them off.
295
+ */
289
296
  setRetryPolicy(policy) {
290
- this.retryPolicy = policy === null ? { ...DEFAULT_RETRY_POLICY } : { ...this.retryPolicy, ...policy };
297
+ this.retryPolicy = policy === null ? { ...DEFAULT_RETRY_POLICY, maxAttempts: 1 } : { ...this.retryPolicy, ...policy };
291
298
  }
292
299
  close() {
293
300
  this.closed = true;
@@ -317,7 +324,7 @@ var HttpTransport = (_class2 = class {
317
324
  await sleep(decision.delaySeconds * 1e3, options.signal);
318
325
  }
319
326
  }
320
- throw _nullishCoalesce(_optionalChain([last, 'optionalAccess', _10 => _10.error]), () => ( new (0, _chunkHR5Y3KXScjs.SynapError)("Request failed with no recorded error")));
327
+ throw _nullishCoalesce(_optionalChain([last, 'optionalAccess', _10 => _10.error]), () => ( new (0, _chunk2TVL5IPQcjs.SynapError)("Request failed with no recorded error")));
321
328
  }
322
329
  async attempt(name, options, correlationId) {
323
330
  const spec = ENDPOINTS[name];
@@ -350,7 +357,7 @@ var HttpTransport = (_class2 = class {
350
357
  try {
351
358
  return JSON.parse(text);
352
359
  } catch (e3) {
353
- throw new (0, _chunkHR5Y3KXScjs.SynapError)(`Malformed JSON in response from ${url}`, { correlationId });
360
+ throw new (0, _chunk2TVL5IPQcjs.SynapError)(`Malformed JSON in response from ${url}`, { correlationId });
354
361
  }
355
362
  }
356
363
  buildUrl(path, query) {
@@ -384,14 +391,14 @@ var HttpTransport = (_class2 = class {
384
391
  }
385
392
  }, _class2);
386
393
  function isOutcomeUnknown(error) {
387
- if (error instanceof _chunkHR5Y3KXScjs.RateLimitError) return false;
388
- if (error instanceof _chunkHR5Y3KXScjs.ServiceUnavailableError) return false;
389
- if (error instanceof _chunkHR5Y3KXScjs.AuthenticationError) return false;
390
- if (error instanceof _chunkHR5Y3KXScjs.InvalidInputError) return false;
391
- if (error instanceof _chunkHR5Y3KXScjs.ConflictError) return false;
392
- if (error instanceof _chunkHR5Y3KXScjs.InsufficientCreditsError) return false;
393
- if (error instanceof _chunkHR5Y3KXScjs.ContextNotFoundError) return false;
394
- if (error instanceof _chunkHR5Y3KXScjs.NetworkTimeoutError) return true;
394
+ if (error instanceof _chunk2TVL5IPQcjs.RateLimitError) return false;
395
+ if (error instanceof _chunk2TVL5IPQcjs.ServiceUnavailableError) return false;
396
+ if (error instanceof _chunk2TVL5IPQcjs.AuthenticationError) return false;
397
+ if (error instanceof _chunk2TVL5IPQcjs.InvalidInputError) return false;
398
+ if (error instanceof _chunk2TVL5IPQcjs.ConflictError) return false;
399
+ if (error instanceof _chunk2TVL5IPQcjs.InsufficientCreditsError) return false;
400
+ if (error instanceof _chunk2TVL5IPQcjs.ContextNotFoundError) return false;
401
+ if (error instanceof _chunk2TVL5IPQcjs.NetworkTimeoutError) return true;
395
402
  if (isConnectionRefusal(error)) return false;
396
403
  return true;
397
404
  }
@@ -400,12 +407,12 @@ function isConnectionRefusal(error) {
400
407
  return code === "ECONNREFUSED" || code === "ENOTFOUND" || code === "EAI_AGAIN" || code === "ECONNRESET" || code === "EHOSTUNREACH";
401
408
  }
402
409
  function toTransportError(error, correlationId) {
403
- if (error instanceof _chunkHR5Y3KXScjs.SynapError) return error;
410
+ if (error instanceof _chunk2TVL5IPQcjs.SynapError) return error;
404
411
  const name = _optionalChain([error, 'optionalAccess', _14 => _14.name]);
405
412
  if (name === "AbortError" || name === "TimeoutError") {
406
- return new (0, _chunkHR5Y3KXScjs.NetworkTimeoutError)("Request timed out", { correlationId, cause: error });
413
+ return new (0, _chunk2TVL5IPQcjs.NetworkTimeoutError)("Request timed out", { correlationId, cause: error });
407
414
  }
408
- return new (0, _chunkHR5Y3KXScjs.ServiceUnavailableError)(
415
+ return new (0, _chunk2TVL5IPQcjs.ServiceUnavailableError)(
409
416
  `Network request failed: ${_nullishCoalesce(_optionalChain([error, 'optionalAccess', _15 => _15.message]), () => ( String(error)))}`,
410
417
  { correlationId, cause: error }
411
418
  );
@@ -425,48 +432,53 @@ async function toHttpError(response, correlationId) {
425
432
  switch (response.status) {
426
433
  case 400:
427
434
  case 422:
428
- return new (0, _chunkHR5Y3KXScjs.InvalidInputError)(message, opts);
435
+ return new (0, _chunk2TVL5IPQcjs.InvalidInputError)(message, opts);
429
436
  case 401:
430
437
  case 403:
431
- return new (0, _chunkHR5Y3KXScjs.AuthenticationError)(message, opts);
438
+ return new (0, _chunk2TVL5IPQcjs.AuthenticationError)(message, opts);
432
439
  case 404:
433
- return new (0, _chunkHR5Y3KXScjs.ContextNotFoundError)(message, opts);
440
+ return new (0, _chunk2TVL5IPQcjs.ContextNotFoundError)(message, opts);
434
441
  case 402:
435
- return new (0, _chunkHR5Y3KXScjs.InsufficientCreditsError)(message, {
442
+ return new (0, _chunk2TVL5IPQcjs.InsufficientCreditsError)(message, {
436
443
  ...opts,
437
444
  balanceCredits: numberOrNull(parsed["balance_credits"]),
438
- requiredCredits: numberOrNull(parsed["required_credits"])
445
+ requiredCredits: _nullishCoalesce(numberOrNull(parsed["minimum_required_credits"]), () => ( numberOrNull(parsed["required_credits"]))),
446
+ recoveryUrl: stringOrNull(parsed["recovery_url"]),
447
+ redeemUrl: stringOrNull(parsed["redeem_url"])
439
448
  });
440
449
  case 409:
441
450
  if (detailObject !== null && detailObject["code"] === "transcript_conflict") {
442
- return new (0, _chunkHR5Y3KXScjs.TranscriptConflictError)(message, opts);
451
+ return new (0, _chunk2TVL5IPQcjs.TranscriptConflictError)(message, opts);
443
452
  }
444
- return new (0, _chunkHR5Y3KXScjs.ConflictError)(message, opts);
453
+ return new (0, _chunk2TVL5IPQcjs.ConflictError)(message, opts);
445
454
  case 429: {
446
455
  const header = response.headers.get("retry-after");
447
456
  const retryAfter = header !== null && header.trim() !== "" ? Number(header) : null;
448
- return new (0, _chunkHR5Y3KXScjs.RateLimitError)(message, {
457
+ return new (0, _chunk2TVL5IPQcjs.RateLimitError)(message, {
449
458
  ...opts,
450
459
  retryAfterSeconds: retryAfter !== null && Number.isFinite(retryAfter) ? retryAfter : null
451
460
  });
452
461
  }
453
462
  case 503:
454
- return new (0, _chunkHR5Y3KXScjs.ServiceUnavailableError)(message, opts);
463
+ return new (0, _chunk2TVL5IPQcjs.ServiceUnavailableError)(message, opts);
455
464
  case 504:
456
- return new (0, _chunkHR5Y3KXScjs.AgentUnavailableError)(message, opts);
465
+ return new (0, _chunk2TVL5IPQcjs.AgentUnavailableError)(message, opts);
457
466
  default:
458
- if (response.status >= 500) return new (0, _chunkHR5Y3KXScjs.ServiceUnavailableError)(message, opts);
459
- return new (0, _chunkHR5Y3KXScjs.SynapError)(message, opts);
467
+ if (response.status >= 500) return new (0, _chunk2TVL5IPQcjs.ServiceUnavailableError)(message, opts);
468
+ return new (0, _chunk2TVL5IPQcjs.SynapError)(message, opts);
460
469
  }
461
470
  }
462
471
  function numberOrNull(v) {
463
472
  return typeof v === "number" && Number.isFinite(v) ? v : null;
464
473
  }
474
+ function stringOrNull(v) {
475
+ return typeof v === "string" && v !== "" ? v : null;
476
+ }
465
477
  function withTimeout(ms, external) {
466
478
  const controller = new AbortController();
467
479
  const onExternalAbort = () => controller.abort(_optionalChain([external, 'optionalAccess', _16 => _16.reason]));
468
480
  const timer = setTimeout(() => {
469
- controller.abort(new (0, _chunkHR5Y3KXScjs.NetworkTimeoutError)(`Timed out after ${ms}ms`));
481
+ controller.abort(new (0, _chunk2TVL5IPQcjs.NetworkTimeoutError)(`Timed out after ${ms}ms`));
470
482
  }, ms);
471
483
  _optionalChain([timer, 'access', _17 => _17.unref, 'optionalCall', _18 => _18()]);
472
484
  if (external) {
@@ -518,10 +530,10 @@ function buildFetchRequest(scope, options) {
518
530
  const precisionLevel = _nullishCoalesce(opt(options, "precision_level", "precisionLevel"), () => ( "high"));
519
531
  const mode = _nullishCoalesce(options.mode, () => ( "fast"));
520
532
  if (searchQuery !== void 0 && !Array.isArray(searchQuery)) {
521
- throw new (0, _chunkHR5Y3KXScjs.InvalidInputError)("search_query must be an array when provided");
533
+ throw new (0, _chunk2TVL5IPQcjs.InvalidInputError)("search_query must be an array when provided");
522
534
  }
523
535
  if (options.types !== void 0 && !Array.isArray(options.types)) {
524
- throw new (0, _chunkHR5Y3KXScjs.InvalidInputError)("types must be an array when provided");
536
+ throw new (0, _chunk2TVL5IPQcjs.InvalidInputError)("types must be an array when provided");
525
537
  }
526
538
  const body = {
527
539
  conversation_id: _nullishCoalesce(conversationId, () => ( null)),
@@ -536,16 +548,39 @@ function buildFetchRequest(scope, options) {
536
548
  }
537
549
  switch (scope) {
538
550
  case "user":
539
- if (!userId) throw new (0, _chunkHR5Y3KXScjs.InvalidInputError)("user_id is required");
540
- body["user_id"] = userId;
541
- if (customerId !== void 0) body["customer_id"] = customerId;
551
+ {
552
+ if (!userId) throw new (0, _chunk2TVL5IPQcjs.InvalidInputError)("user_id is required");
553
+ body["user_id"] = userId;
554
+ const scopePath = opt(options, "scope_path", "scopePath");
555
+ if (scopePath !== void 0) body["scope"] = scopePath;
556
+ const contextMode = _nullishCoalesce(opt(options, "context_mode", "contextMode"), () => ( "in-conversation"));
557
+ if (!VALID_CONTEXT_MODES.includes(contextMode)) {
558
+ throw new (0, _chunk2TVL5IPQcjs.InvalidInputError)(
559
+ `Invalid context_mode '${contextMode}'. Must be one of: ${VALID_CONTEXT_MODES.join(", ")}`
560
+ );
561
+ }
562
+ const lastN = _nullishCoalesce(opt(options, "last_n_conversations", "lastNConversations"), () => ( 1));
563
+ if (!Number.isInteger(lastN)) {
564
+ throw new (0, _chunk2TVL5IPQcjs.InvalidInputError)("last_n_conversations must be an integer");
565
+ }
566
+ if (lastN < 0 || lastN > 20) {
567
+ throw new (0, _chunk2TVL5IPQcjs.InvalidInputError)("last_n_conversations must be between 0 and 20");
568
+ }
569
+ if (contextMode === "conversation-summary") {
570
+ body["context_mode"] = contextMode;
571
+ body["include_profile"] = _nullishCoalesce(opt(options, "include_profile", "includeProfile"), () => ( true));
572
+ body["last_n_conversations"] = lastN;
573
+ }
574
+ if (customerId !== void 0) body["customer_id"] = customerId;
575
+ break;
576
+ }
542
577
  break;
543
578
  case "customer":
544
- if (!customerId) throw new (0, _chunkHR5Y3KXScjs.InvalidInputError)("customer_id is required");
579
+ if (!customerId) throw new (0, _chunk2TVL5IPQcjs.InvalidInputError)("customer_id is required");
545
580
  body["customer_id"] = customerId;
546
581
  break;
547
582
  case "conversation":
548
- if (!conversationId) throw new (0, _chunkHR5Y3KXScjs.InvalidInputError)("conversation_id is required");
583
+ if (!conversationId) throw new (0, _chunk2TVL5IPQcjs.InvalidInputError)("conversation_id is required");
549
584
  if (userId !== void 0) body["user_id"] = userId;
550
585
  if (customerId !== void 0) body["customer_id"] = customerId;
551
586
  break;
@@ -554,6 +589,7 @@ function buildFetchRequest(scope, options) {
554
589
  }
555
590
  return { endpoint: ENDPOINT_BY_SCOPE[scope], body };
556
591
  }
592
+ var VALID_CONTEXT_MODES = ["in-conversation", "conversation-summary"];
557
593
  async function fetchContext(transport, scope, options = {}, hooks = {}) {
558
594
  const startedAt = Date.now();
559
595
  transport.checkCustomerId(
@@ -789,17 +825,17 @@ function isoOrNull(v) {
789
825
  return v instanceof Date ? v.toISOString() : v;
790
826
  }
791
827
  function buildCreateBody(options) {
792
- if (!options.document) throw new (0, _chunkHR5Y3KXScjs.InvalidInputError)("document is required");
828
+ if (!options.document) throw new (0, _chunk2TVL5IPQcjs.InvalidInputError)("document is required");
793
829
  const o2 = options;
794
830
  const documentType = _nullishCoalesce(either(o2, "document_type", "documentType"), () => ( DEFAULT_DOCUMENT_TYPE));
795
831
  const mode = _nullishCoalesce(options.mode, () => ( DEFAULT_INGEST_MODE));
796
832
  if (!DOCUMENT_TYPES.includes(documentType)) {
797
- throw new (0, _chunkHR5Y3KXScjs.InvalidInputError)(
833
+ throw new (0, _chunk2TVL5IPQcjs.InvalidInputError)(
798
834
  `Invalid document_type '${documentType}'. Expected one of: ${DOCUMENT_TYPES.join(", ")}`
799
835
  );
800
836
  }
801
837
  if (!INGEST_MODES.includes(mode)) {
802
- throw new (0, _chunkHR5Y3KXScjs.InvalidInputError)(
838
+ throw new (0, _chunk2TVL5IPQcjs.InvalidInputError)(
803
839
  `Invalid mode '${mode}'. Expected one of: ${INGEST_MODES.join(", ")}`
804
840
  );
805
841
  }
@@ -827,7 +863,7 @@ function createMemoriesInterface(transport) {
827
863
  async batch_create(options) {
828
864
  const docs = options.documents;
829
865
  if (!Array.isArray(docs) || docs.length === 0) {
830
- throw new (0, _chunkHR5Y3KXScjs.InvalidInputError)("documents must be a non-empty array");
866
+ throw new (0, _chunk2TVL5IPQcjs.InvalidInputError)("documents must be a non-empty array");
831
867
  }
832
868
  const failFast = _nullishCoalesce(_nullishCoalesce(options.fail_fast, () => ( options.failFast)), () => ( false));
833
869
  return transport.request("memories_batch", {
@@ -837,15 +873,15 @@ function createMemoriesInterface(transport) {
837
873
  async create_from_file(options) {
838
874
  const userId = _nullishCoalesce(options.user_id, () => ( options.userId));
839
875
  const customerId = _nullishCoalesce(options.customer_id, () => ( options.customerId));
840
- if (!userId) throw new (0, _chunkHR5Y3KXScjs.InvalidInputError)("user_id is required");
876
+ if (!userId) throw new (0, _chunk2TVL5IPQcjs.InvalidInputError)("user_id is required");
841
877
  transport.checkCustomerId(customerId, "memories.create_from_file");
842
878
  const filePath = _nullishCoalesce(options.file_path, () => ( options.filePath));
843
879
  const sources = [filePath, options.file, options.text].filter((v) => v !== void 0);
844
880
  if (sources.length === 0) {
845
- throw new (0, _chunkHR5Y3KXScjs.InvalidInputError)("One of file_path, file, or text must be provided.");
881
+ throw new (0, _chunk2TVL5IPQcjs.InvalidInputError)("One of file_path, file, or text must be provided.");
846
882
  }
847
883
  if (sources.length > 1) {
848
- throw new (0, _chunkHR5Y3KXScjs.InvalidInputError)(
884
+ throw new (0, _chunk2TVL5IPQcjs.InvalidInputError)(
849
885
  "Provide exactly one of file_path, file, or text, not several."
850
886
  );
851
887
  }
@@ -876,13 +912,13 @@ function createMemoriesInterface(transport) {
876
912
  });
877
913
  },
878
914
  async get(memoryId) {
879
- if (!memoryId) throw new (0, _chunkHR5Y3KXScjs.InvalidInputError)("memory_id is required");
915
+ if (!memoryId) throw new (0, _chunk2TVL5IPQcjs.InvalidInputError)("memory_id is required");
880
916
  return transport.request("memories_get", { pathParams: { memory_id: memoryId } });
881
917
  },
882
918
  async update(options) {
883
919
  const memoryId = _nullishCoalesce(options.memory_id, () => ( options.memoryId));
884
- if (!memoryId) throw new (0, _chunkHR5Y3KXScjs.InvalidInputError)("memory_id is required");
885
- if (!options.document) throw new (0, _chunkHR5Y3KXScjs.InvalidInputError)("document is required");
920
+ if (!memoryId) throw new (0, _chunk2TVL5IPQcjs.InvalidInputError)("memory_id is required");
921
+ if (!options.document) throw new (0, _chunk2TVL5IPQcjs.InvalidInputError)("document is required");
886
922
  const body = {
887
923
  document: options.document,
888
924
  merge_strategy: _nullishCoalesce(_nullishCoalesce(options.merge_strategy, () => ( options.mergeStrategy)), () => ( "smart-merge"))
@@ -897,20 +933,20 @@ function createMemoriesInterface(transport) {
897
933
  },
898
934
  async delete(memoryId) {
899
935
  if (!memoryId) {
900
- throw new (0, _chunkHR5Y3KXScjs.InvalidInputError)(
936
+ throw new (0, _chunk2TVL5IPQcjs.InvalidInputError)(
901
937
  "memory_id is required. Deleting by user is no longer supported: the previous implementation tracked ids in process memory, so it silently deleted nothing in any serverless or multi-process deployment while reporting success."
902
938
  );
903
939
  }
904
940
  return transport.request("memories_delete", { pathParams: { memory_id: memoryId } });
905
941
  },
906
942
  async status(ingestionId) {
907
- if (!ingestionId) throw new (0, _chunkHR5Y3KXScjs.InvalidInputError)("ingestion_id is required");
943
+ if (!ingestionId) throw new (0, _chunk2TVL5IPQcjs.InvalidInputError)("ingestion_id is required");
908
944
  return transport.request("memories_status", {
909
945
  pathParams: { ingestion_id: ingestionId }
910
946
  });
911
947
  },
912
948
  async wait_for_completion(ingestionId, options = {}) {
913
- if (!ingestionId) throw new (0, _chunkHR5Y3KXScjs.InvalidInputError)("ingestion_id is required");
949
+ if (!ingestionId) throw new (0, _chunk2TVL5IPQcjs.InvalidInputError)("ingestion_id is required");
914
950
  const timeoutMs = (_nullishCoalesce(_nullishCoalesce(options.timeout_seconds, () => ( options.timeoutSeconds)), () => ( 300))) * 1e3;
915
951
  const pollMs = (_nullishCoalesce(_nullishCoalesce(options.poll_interval_seconds, () => ( options.pollIntervalSeconds)), () => ( 2))) * 1e3;
916
952
  const deadline = Date.now() + timeoutMs;
@@ -948,17 +984,26 @@ var UUID_RE = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9
948
984
  function validateConversationId(conversationId) {
949
985
  if (conversationId === void 0 || conversationId === null || conversationId === "") return;
950
986
  if (typeof conversationId !== "string" || !UUID_RE.test(conversationId)) {
951
- throw new (0, _chunkHR5Y3KXScjs.InvalidConversationIdError)(`Invalid conversation ID: ${String(conversationId)}`);
987
+ throw new (0, _chunk2TVL5IPQcjs.InvalidConversationIdError)(`Invalid conversation ID: ${String(conversationId)}`);
952
988
  }
953
989
  }
954
990
  function validateInstanceId(instanceId) {
955
991
  if (instanceId === void 0 || instanceId === null || instanceId === "") return;
956
992
  if (typeof instanceId !== "string" || !INSTANCE_ID_RE.test(instanceId)) {
957
- throw new (0, _chunkHR5Y3KXScjs.InvalidInstanceIdError)(`Invalid instance ID: ${String(instanceId)}`);
993
+ throw new (0, _chunk2TVL5IPQcjs.InvalidInstanceIdError)(`Invalid instance ID: ${String(instanceId)}`);
958
994
  }
959
995
  }
960
996
 
961
997
  // src/conversation/interface.ts
998
+ var COMPACTION_LEVELS = [
999
+ "low",
1000
+ "medium",
1001
+ "high",
1002
+ "adaptive",
1003
+ "aggressive",
1004
+ "balanced",
1005
+ "conservative"
1006
+ ];
962
1007
  function either2(o2, snake, camel) {
963
1008
  const a = o2[snake];
964
1009
  if (a !== void 0) return a;
@@ -974,13 +1019,13 @@ function buildRecordMessageBody(options) {
974
1019
  const conversationId = either2(o2, "conversation_id", "conversationId");
975
1020
  const userId = either2(o2, "user_id", "userId");
976
1021
  const customerId = either2(o2, "customer_id", "customerId");
977
- if (!conversationId) throw new (0, _chunkHR5Y3KXScjs.InvalidInputError)("conversation_id is required");
1022
+ if (!conversationId) throw new (0, _chunk2TVL5IPQcjs.InvalidInputError)("conversation_id is required");
978
1023
  validateConversationId(conversationId);
979
- if (!options.role) throw new (0, _chunkHR5Y3KXScjs.InvalidInputError)("role is required");
1024
+ if (!options.role) throw new (0, _chunk2TVL5IPQcjs.InvalidInputError)("role is required");
980
1025
  if (options.content === void 0 || options.content === null) {
981
- throw new (0, _chunkHR5Y3KXScjs.InvalidInputError)("content is required");
1026
+ throw new (0, _chunk2TVL5IPQcjs.InvalidInputError)("content is required");
982
1027
  }
983
- if (!userId) throw new (0, _chunkHR5Y3KXScjs.InvalidInputError)("user_id is required");
1028
+ if (!userId) throw new (0, _chunk2TVL5IPQcjs.InvalidInputError)("user_id is required");
984
1029
  const body = {
985
1030
  conversation_id: conversationId,
986
1031
  role: options.role,
@@ -998,10 +1043,10 @@ function buildIngestTranscriptBody(options) {
998
1043
  const o2 = options;
999
1044
  const conversationId = either2(o2, "conversation_id", "conversationId");
1000
1045
  const userId = either2(o2, "user_id", "userId");
1001
- if (!conversationId) throw new (0, _chunkHR5Y3KXScjs.InvalidInputError)("conversation_id is required");
1002
- if (!userId) throw new (0, _chunkHR5Y3KXScjs.InvalidInputError)("user_id is required");
1046
+ if (!conversationId) throw new (0, _chunk2TVL5IPQcjs.InvalidInputError)("conversation_id is required");
1047
+ if (!userId) throw new (0, _chunk2TVL5IPQcjs.InvalidInputError)("user_id is required");
1003
1048
  if (options.transcript === void 0 || options.transcript === null) {
1004
- throw new (0, _chunkHR5Y3KXScjs.InvalidInputError)("transcript is required");
1049
+ throw new (0, _chunk2TVL5IPQcjs.InvalidInputError)("transcript is required");
1005
1050
  }
1006
1051
  const body = {
1007
1052
  conversation_id: conversationId,
@@ -1023,7 +1068,7 @@ function buildIngestTranscriptBody(options) {
1023
1068
  function buildCompactBody(options) {
1024
1069
  const o2 = options;
1025
1070
  const conversationId = either2(o2, "conversation_id", "conversationId");
1026
- if (!conversationId) throw new (0, _chunkHR5Y3KXScjs.InvalidInputError)("conversation_id is required");
1071
+ if (!conversationId) throw new (0, _chunk2TVL5IPQcjs.InvalidInputError)("conversation_id is required");
1027
1072
  validateConversationId(conversationId);
1028
1073
  const body = { conversation_id: conversationId, force: _nullishCoalesce(options.force, () => ( false)) };
1029
1074
  const strategy = _nullishCoalesce(options.strategy, () => ( either2(o2, "compaction_level", "compactionLevel")));
@@ -1079,7 +1124,7 @@ function createConversationNamespace(transport, subscribers = new CompactionSubs
1079
1124
  }) {
1080
1125
  const convId = (v) => {
1081
1126
  const id = typeof v === "string" ? v : _nullishCoalesce(v.conversation_id, () => ( v.conversationId));
1082
- if (!id) throw new (0, _chunkHR5Y3KXScjs.InvalidInputError)("conversation_id is required");
1127
+ if (!id) throw new (0, _chunk2TVL5IPQcjs.InvalidInputError)("conversation_id is required");
1083
1128
  validateConversationId(id);
1084
1129
  return id;
1085
1130
  };
@@ -1105,7 +1150,7 @@ function createConversationNamespace(transport, subscribers = new CompactionSubs
1105
1150
  },
1106
1151
  async record_messages_batch(messages) {
1107
1152
  if (!Array.isArray(messages) || messages.length === 0) {
1108
- throw new (0, _chunkHR5Y3KXScjs.InvalidInputError)("messages must be a non-empty array");
1153
+ throw new (0, _chunk2TVL5IPQcjs.InvalidInputError)("messages must be a non-empty array");
1109
1154
  }
1110
1155
  for (const m of messages) {
1111
1156
  const mo = m;
@@ -1196,8 +1241,8 @@ function createConversationNamespace(transport, subscribers = new CompactionSubs
1196
1241
  * Returns an idempotent unsubscribe thunk, matching Python.
1197
1242
  */
1198
1243
  subscribe_to_compaction_updates(conversationId, callback) {
1199
- if (!conversationId) throw new (0, _chunkHR5Y3KXScjs.InvalidInputError)("conversation_id is required");
1200
- if (typeof callback !== "function") throw new (0, _chunkHR5Y3KXScjs.InvalidInputError)("callback is required");
1244
+ if (!conversationId) throw new (0, _chunk2TVL5IPQcjs.InvalidInputError)("conversation_id is required");
1245
+ if (typeof callback !== "function") throw new (0, _chunk2TVL5IPQcjs.InvalidInputError)("callback is required");
1201
1246
  return subscribers.add(conversationId, callback);
1202
1247
  },
1203
1248
  /** Remove subscribers for one conversation, or all of them. Returns the count removed. */
@@ -1213,7 +1258,7 @@ function createUserNamespace(transport, hooks = {}) {
1213
1258
  return {
1214
1259
  async get_profile(options) {
1215
1260
  const userId = typeof options === "string" ? options : _nullishCoalesce(options.user_id, () => ( options.userId));
1216
- if (!userId) throw new (0, _chunkHR5Y3KXScjs.InvalidInputError)("user_id is required");
1261
+ if (!userId) throw new (0, _chunk2TVL5IPQcjs.InvalidInputError)("user_id is required");
1217
1262
  const customerId = typeof options === "string" ? void 0 : _nullishCoalesce(options.customer_id, () => ( options.customerId));
1218
1263
  return transport.request("user_profile", {
1219
1264
  pathParams: { user_id: userId },
@@ -1229,15 +1274,26 @@ function createUserNamespace(transport, hooks = {}) {
1229
1274
  }
1230
1275
 
1231
1276
  // src/credits/interface.ts
1277
+ function iso2(v) {
1278
+ return v instanceof Date ? v.toISOString() : v;
1279
+ }
1232
1280
  function createCreditsNamespace(transport) {
1233
1281
  return {
1234
1282
  async get_balance() {
1235
1283
  return transport.request("credits_balance");
1236
1284
  },
1237
1285
  async get_ledger(options = {}) {
1238
- return transport.request("credits_ledger", {
1239
- query: { limit: _nullishCoalesce(options.limit, () => ( 50)), offset: _nullishCoalesce(options.offset, () => ( 0)) }
1240
- });
1286
+ const query = {
1287
+ limit: _nullishCoalesce(options.limit, () => ( 100)),
1288
+ offset: _nullishCoalesce(options.offset, () => ( 0))
1289
+ };
1290
+ const entryType = _nullishCoalesce(options.entry_type, () => ( options.entryType));
1291
+ if (entryType !== void 0) query["entry_type"] = entryType;
1292
+ const from = _nullishCoalesce(options.from_time, () => ( options.fromTime));
1293
+ if (from !== void 0) query["from"] = iso2(from);
1294
+ const to = _nullishCoalesce(options.to_time, () => ( options.toTime));
1295
+ if (to !== void 0) query["to"] = iso2(to);
1296
+ return transport.request("credits_ledger", { query });
1241
1297
  },
1242
1298
  async estimate(options) {
1243
1299
  return transport.request("credits_estimate", {
@@ -1251,7 +1307,7 @@ function createCreditsNamespace(transport) {
1251
1307
  });
1252
1308
  },
1253
1309
  async redeem(code) {
1254
- if (!code) throw new (0, _chunkHR5Y3KXScjs.InvalidInputError)("code is required");
1310
+ if (!code) throw new (0, _chunk2TVL5IPQcjs.InvalidInputError)("code is required");
1255
1311
  return transport.request("credits_redeem", { body: { code } });
1256
1312
  }
1257
1313
  };
@@ -1262,11 +1318,11 @@ function createCacheNamespace(cache) {
1262
1318
  return {
1263
1319
  clear: () => cache.clear(),
1264
1320
  clear_user: (userId) => {
1265
- if (!userId) throw new (0, _chunkHR5Y3KXScjs.InvalidInputError)("user_id is required");
1321
+ if (!userId) throw new (0, _chunk2TVL5IPQcjs.InvalidInputError)("user_id is required");
1266
1322
  cache.dropEntity(userId);
1267
1323
  },
1268
1324
  clear_customer: (customerId) => {
1269
- if (!customerId) throw new (0, _chunkHR5Y3KXScjs.InvalidInputError)("customer_id is required");
1325
+ if (!customerId) throw new (0, _chunk2TVL5IPQcjs.InvalidInputError)("customer_id is required");
1270
1326
  cache.dropEntity(customerId);
1271
1327
  },
1272
1328
  stats: () => ({ bundles: cache.size, items: cache.itemCount })
@@ -1315,9 +1371,9 @@ function createInstanceNamespace(credentials, cache, onTurn) {
1315
1371
  const namespace = {
1316
1372
  async listen(options = {}) {
1317
1373
  if (client !== null) {
1318
- throw new (0, _chunkHR5Y3KXScjs.ListeningAlreadyActiveError)("Listening is already active on this instance");
1374
+ throw new (0, _chunk2TVL5IPQcjs.ListeningAlreadyActiveError)("Listening is already active on this instance");
1319
1375
  }
1320
- const { GrpcStreamClient } = await Promise.resolve().then(() => _interopRequireWildcard(require("./stream-client-ZN6ADZBR.cjs")));
1376
+ const { GrpcStreamClient } = await Promise.resolve().then(() => _interopRequireWildcard(require("./stream-client-PRTOH62B.cjs")));
1321
1377
  const onContext = _nullishCoalesce(options.on_context, () => ( options.onContext));
1322
1378
  const onDisconnect = _nullishCoalesce(options.on_disconnect, () => ( options.onDisconnect));
1323
1379
  const onReconnect = _nullishCoalesce(options.on_reconnect, () => ( options.onReconnect));
@@ -1342,8 +1398,8 @@ function createInstanceNamespace(credentials, cache, onTurn) {
1342
1398
  try {
1343
1399
  await created.connect();
1344
1400
  } catch (error) {
1345
- if (error instanceof _chunkHR5Y3KXScjs.SynapError) throw error;
1346
- throw new (0, _chunkHR5Y3KXScjs.SynapError)(
1401
+ if (error instanceof _chunk2TVL5IPQcjs.SynapError) throw error;
1402
+ throw new (0, _chunk2TVL5IPQcjs.SynapError)(
1347
1403
  `Could not open the Synap anticipation stream: ${_nullishCoalesce(_optionalChain([error, 'optionalAccess', _49 => _49.message]), () => ( String(error)))}`,
1348
1404
  { cause: error }
1349
1405
  );
@@ -1357,9 +1413,9 @@ function createInstanceNamespace(credentials, cache, onTurn) {
1357
1413
  await active.disconnect();
1358
1414
  },
1359
1415
  async send_message(options) {
1360
- if (client === null) throw new (0, _chunkHR5Y3KXScjs.ListeningNotActiveError)("Listening is not active");
1416
+ if (client === null) throw new (0, _chunk2TVL5IPQcjs.ListeningNotActiveError)("Listening is not active");
1361
1417
  if (options.content === void 0) {
1362
- throw new (0, _chunkHR5Y3KXScjs.ListeningNotActiveError)("content is required");
1418
+ throw new (0, _chunk2TVL5IPQcjs.ListeningNotActiveError)("content is required");
1363
1419
  }
1364
1420
  const conversationId = _nullishCoalesce(_nullishCoalesce(options.conversation_id, () => ( options.conversationId)), () => ( ""));
1365
1421
  _optionalChain([onTurn, 'optionalCall', _50 => _50({
@@ -1377,12 +1433,18 @@ function createInstanceNamespace(credentials, cache, onTurn) {
1377
1433
  session_id: _nullishCoalesce(_nullishCoalesce(options.session_id, () => ( options.sessionId)), () => ( "")),
1378
1434
  metadata: _nullishCoalesce(options.metadata, () => ( {})),
1379
1435
  timestamp_ms: Date.now(),
1436
+ tool_name: _nullishCoalesce(_nullishCoalesce(options.tool_name, () => ( options.toolName)), () => ( "")),
1437
+ // Python serialises tool_args with json.dumps into tool_args_json.
1438
+ tool_args_json: (() => {
1439
+ const a = _nullishCoalesce(options.tool_args, () => ( options.toolArgs));
1440
+ return a === void 0 ? "" : JSON.stringify(a);
1441
+ })(),
1380
1442
  search_queries: _nullishCoalesce(_nullishCoalesce(options.search_queries, () => ( options.searchQueries)), () => ( [])),
1381
1443
  context_types: _nullishCoalesce(_nullishCoalesce(options.context_types, () => ( options.contextTypes)), () => ( []))
1382
1444
  });
1383
1445
  },
1384
1446
  async record_thinking(options) {
1385
- if (client === null) throw new (0, _chunkHR5Y3KXScjs.ListeningNotActiveError)("Listening is not active");
1447
+ if (client === null) throw new (0, _chunk2TVL5IPQcjs.ListeningNotActiveError)("Listening is not active");
1386
1448
  client.sendConversationEvent({
1387
1449
  // Python emits reasoning as an `agent_thinking` conversation event.
1388
1450
  event_type: "agent_thinking",
@@ -2146,7 +2208,7 @@ function buildTool(target, options = {}, onWarning = () => {
2146
2208
  const scope = String(_nullishCoalesce(options.scope, () => ( "user"))).toLowerCase();
2147
2209
  if (!VALID_SCOPES.includes(scope)) {
2148
2210
  const sorted = [...VALID_SCOPES].sort();
2149
- throw new (0, _chunkHR5Y3KXScjs.InvalidInputError)(
2211
+ throw new (0, _chunk2TVL5IPQcjs.InvalidInputError)(
2150
2212
  `scope must be one of ['${sorted.join("', '")}'], got '${String(options.scope)}'`
2151
2213
  );
2152
2214
  }
@@ -2154,10 +2216,10 @@ function buildTool(target, options = {}, onWarning = () => {
2154
2216
  const customerId = _nullishCoalesce(options.customer_id, () => ( options.customerId));
2155
2217
  const conversationId = _nullishCoalesce(options.conversation_id, () => ( options.conversationId));
2156
2218
  if (scope === "user" && (userId === void 0 || userId === "")) {
2157
- throw new (0, _chunkHR5Y3KXScjs.InvalidInputError)("scope='user' requires user_id");
2219
+ throw new (0, _chunk2TVL5IPQcjs.InvalidInputError)("scope='user' requires user_id");
2158
2220
  }
2159
2221
  if (scope === "customer" && (customerId === void 0 || customerId === "")) {
2160
- throw new (0, _chunkHR5Y3KXScjs.InvalidInputError)("scope='customer' requires customer_id");
2222
+ throw new (0, _chunk2TVL5IPQcjs.InvalidInputError)("scope='customer' requires customer_id");
2161
2223
  }
2162
2224
  if (scope === "conversation" && (userId === void 0 || userId === "")) {
2163
2225
  onWarning(
@@ -2166,7 +2228,7 @@ function buildTool(target, options = {}, onWarning = () => {
2166
2228
  }
2167
2229
  const style = String(_nullishCoalesce(options.style, () => ( "openai")));
2168
2230
  if (style !== "openai" && style !== "anthropic") {
2169
- throw new (0, _chunkHR5Y3KXScjs.InvalidInputError)(`style must be 'openai' or 'anthropic', got '${style}'`);
2231
+ throw new (0, _chunk2TVL5IPQcjs.InvalidInputError)(`style must be 'openai' or 'anthropic', got '${style}'`);
2170
2232
  }
2171
2233
  const toolName = _nullishCoalesce(options.name, () => ( `synap_fetch_${scope}_context`));
2172
2234
  const toolDesc = _nullishCoalesce(options.description, () => ( defaultToolDescription(scope)));
@@ -2351,9 +2413,9 @@ var SynapClient = class {
2351
2413
  */
2352
2414
  async searchMemory(options) {
2353
2415
  const userId = _nullishCoalesce(options.user_id, () => ( options.userId));
2354
- if (!userId) throw new (0, _chunkHR5Y3KXScjs.InvalidInputError)("user_id is required");
2416
+ if (!userId) throw new (0, _chunk2TVL5IPQcjs.InvalidInputError)("user_id is required");
2355
2417
  if (options.query === void 0 || options.query === null) {
2356
- throw new (0, _chunkHR5Y3KXScjs.InvalidInputError)("query is required");
2418
+ throw new (0, _chunk2TVL5IPQcjs.InvalidInputError)("query is required");
2357
2419
  }
2358
2420
  const context = await fetchContext(this.#transport, "user", {
2359
2421
  user_id: userId,
@@ -2374,7 +2436,7 @@ var SynapClient = class {
2374
2436
  */
2375
2437
  async getMemories(options) {
2376
2438
  const userId = _nullishCoalesce(options.user_id, () => ( options.userId));
2377
- if (!userId) throw new (0, _chunkHR5Y3KXScjs.InvalidInputError)("user_id is required");
2439
+ if (!userId) throw new (0, _chunk2TVL5IPQcjs.InvalidInputError)("user_id is required");
2378
2440
  const context = await fetchContext(this.#transport, "user", {
2379
2441
  user_id: userId,
2380
2442
  ...pick3(options, "customer_id", "customerId") !== void 0 ? { customer_id: pick3(options, "customer_id", "customerId") } : {},
@@ -2422,8 +2484,8 @@ var SynapClient = class {
2422
2484
  const whoami = await this.#transport.request("whoami", {});
2423
2485
  const resolvedClientId = String(_nullishCoalesce(whoami["client_id"], () => ( "")));
2424
2486
  const resolvedInstanceId = String(_nullishCoalesce(whoami["instance_id"], () => ( "")));
2425
- const iso2 = whoami["user_context_isolation"];
2426
- this.#transport.userContextIsolation = typeof iso2 === "string" ? iso2 : void 0;
2487
+ const iso3 = whoami["user_context_isolation"];
2488
+ this.#transport.userContextIsolation = typeof iso3 === "string" ? iso3 : void 0;
2427
2489
  this.#transport.updateCredentials({
2428
2490
  ...resolvedClientId !== "" && credentials.clientId === "" ? { clientId: resolvedClientId } : {},
2429
2491
  ...resolvedInstanceId !== "" && credentials.instanceId === "" ? { instanceId: resolvedInstanceId } : {}
@@ -2467,7 +2529,7 @@ var SynapClient = class {
2467
2529
  */
2468
2530
  configure(options = {}) {
2469
2531
  if (this.#initialized) {
2470
- throw new (0, _chunkHR5Y3KXScjs.InvalidInputError)("Cannot reconfigure after initialization");
2532
+ throw new (0, _chunk2TVL5IPQcjs.InvalidInputError)("Cannot reconfigure after initialization");
2471
2533
  }
2472
2534
  if (options.timeouts !== void 0) this.#transport.setTimeouts(options.timeouts);
2473
2535
  if (options.retryPolicy !== void 0 || options.retry_policy !== void 0) {
@@ -2565,7 +2627,7 @@ var SynapClient = class {
2565
2627
  successful.push([label, result.value]);
2566
2628
  continue;
2567
2629
  }
2568
- if (result.reason instanceof _chunkHR5Y3KXScjs.InvalidInputError) throw result.reason;
2630
+ if (result.reason instanceof _chunk2TVL5IPQcjs.InvalidInputError) throw result.reason;
2569
2631
  this.#warn(`Scope '${label}' fetch failed in unified fetch (non-fatal): ${String(result.reason)}`);
2570
2632
  }
2571
2633
  const merged = mergeScopeResults(successful);
@@ -2696,7 +2758,7 @@ function resolveBaseUrl(options) {
2696
2758
  function resolveCredentials(options) {
2697
2759
  const apiKey = _nullishCoalesce(options.apiKey, () => ( _chunkZKOJDUN4cjs.getEnv.call(void 0, "SYNAP_API_KEY")));
2698
2760
  if (!apiKey) {
2699
- throw new (0, _chunkHR5Y3KXScjs.InvalidInputError)(
2761
+ throw new (0, _chunk2TVL5IPQcjs.InvalidInputError)(
2700
2762
  "No Synap API key found. Set SYNAP_API_KEY in your environment, or pass apiKey to the SynapClient constructor."
2701
2763
  );
2702
2764
  }
@@ -2756,5 +2818,6 @@ function resolveCredentials(options) {
2756
2818
 
2757
2819
 
2758
2820
 
2759
- exports.ANY_SCOPE = _chunkRB57I2IQcjs.ANY_SCOPE; exports.AgentUnavailableError = _chunkHR5Y3KXScjs.AgentUnavailableError; exports.AnticipationCache = _chunkRB57I2IQcjs.AnticipationCache; exports.AuthenticationError = _chunkHR5Y3KXScjs.AuthenticationError; exports.BM25 = _chunkRB57I2IQcjs.BM25; exports.CONTRACT = _chunkRB57I2IQcjs.CONTRACT; exports.ConflictError = _chunkHR5Y3KXScjs.ConflictError; exports.ConnectionError = _chunkHR5Y3KXScjs.ConnectionError; exports.ContextNotFoundError = _chunkHR5Y3KXScjs.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 = _chunkHR5Y3KXScjs.InsufficientCreditsError; exports.InvalidConversationIdError = _chunkHR5Y3KXScjs.InvalidConversationIdError; exports.InvalidInputError = _chunkHR5Y3KXScjs.InvalidInputError; exports.InvalidInstanceIdError = _chunkHR5Y3KXScjs.InvalidInstanceIdError; exports.ListeningAlreadyActiveError = _chunkHR5Y3KXScjs.ListeningAlreadyActiveError; exports.ListeningNotActiveError = _chunkHR5Y3KXScjs.ListeningNotActiveError; exports.NetworkTimeoutError = _chunkHR5Y3KXScjs.NetworkTimeoutError; exports.PermanentError = _chunkHR5Y3KXScjs.PermanentError; exports.RateLimitError = _chunkHR5Y3KXScjs.RateLimitError; exports.SDKError = _chunkHR5Y3KXScjs.SDKError; exports.SDK_VERSION = SDK_VERSION; exports.ServiceUnavailableError = _chunkHR5Y3KXScjs.ServiceUnavailableError; exports.SessionExpiredError = _chunkHR5Y3KXScjs.SessionExpiredError; exports.SynapClient = SynapClient; exports.SynapError = _chunkHR5Y3KXScjs.SynapError; exports.SynapPermanentError = _chunkHR5Y3KXScjs.SynapPermanentError; exports.SynapTransientError = _chunkHR5Y3KXScjs.SynapTransientError; exports.THRESHOLDS = _chunkRB57I2IQcjs.THRESHOLDS; exports.TranscriptConflictError = _chunkHR5Y3KXScjs.TranscriptConflictError; exports.TransientError = _chunkHR5Y3KXScjs.TransientError; exports.flattenContextItems = flattenContextItems; exports.formatForPrompt = formatForPrompt; exports.isOutcomeUnknown = isOutcomeUnknown; exports.isRecallQuery = _chunkRB57I2IQcjs.isRecallQuery; exports.isSynapError = _chunkHR5Y3KXScjs.isSynapError; exports.mergeScopeResults = mergeScopeResults; exports.resolvePath = resolvePath; exports.shouldRetry = shouldRetry; exports.stem = _chunkRB57I2IQcjs.stem; exports.tokenize = _chunkRB57I2IQcjs.tokenize;
2821
+
2822
+ exports.ANY_SCOPE = _chunkRB57I2IQcjs.ANY_SCOPE; exports.AgentUnavailableError = _chunk2TVL5IPQcjs.AgentUnavailableError; exports.AnticipationCache = _chunkRB57I2IQcjs.AnticipationCache; exports.AuthenticationError = _chunk2TVL5IPQcjs.AuthenticationError; exports.BM25 = _chunkRB57I2IQcjs.BM25; exports.COMPACTION_LEVELS = COMPACTION_LEVELS; exports.CONTRACT = _chunkRB57I2IQcjs.CONTRACT; exports.ConflictError = _chunk2TVL5IPQcjs.ConflictError; exports.ConnectionError = _chunk2TVL5IPQcjs.ConnectionError; exports.ContextNotFoundError = _chunk2TVL5IPQcjs.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 = _chunk2TVL5IPQcjs.InsufficientCreditsError; exports.InvalidConversationIdError = _chunk2TVL5IPQcjs.InvalidConversationIdError; exports.InvalidInputError = _chunk2TVL5IPQcjs.InvalidInputError; exports.InvalidInstanceIdError = _chunk2TVL5IPQcjs.InvalidInstanceIdError; exports.ListeningAlreadyActiveError = _chunk2TVL5IPQcjs.ListeningAlreadyActiveError; exports.ListeningNotActiveError = _chunk2TVL5IPQcjs.ListeningNotActiveError; exports.NetworkTimeoutError = _chunk2TVL5IPQcjs.NetworkTimeoutError; exports.PermanentError = _chunk2TVL5IPQcjs.PermanentError; exports.RateLimitError = _chunk2TVL5IPQcjs.RateLimitError; exports.SDKError = _chunk2TVL5IPQcjs.SDKError; exports.SDK_VERSION = SDK_VERSION; exports.ServiceUnavailableError = _chunk2TVL5IPQcjs.ServiceUnavailableError; exports.SessionExpiredError = _chunk2TVL5IPQcjs.SessionExpiredError; exports.SynapClient = SynapClient; exports.SynapError = _chunk2TVL5IPQcjs.SynapError; exports.SynapPermanentError = _chunk2TVL5IPQcjs.SynapPermanentError; exports.SynapTransientError = _chunk2TVL5IPQcjs.SynapTransientError; exports.THRESHOLDS = _chunkRB57I2IQcjs.THRESHOLDS; exports.TranscriptConflictError = _chunk2TVL5IPQcjs.TranscriptConflictError; exports.TransientError = _chunk2TVL5IPQcjs.TransientError; exports.flattenContextItems = flattenContextItems; exports.formatForPrompt = formatForPrompt; exports.isOutcomeUnknown = isOutcomeUnknown; exports.isRecallQuery = _chunkRB57I2IQcjs.isRecallQuery; exports.isSynapError = _chunk2TVL5IPQcjs.isSynapError; exports.mergeScopeResults = mergeScopeResults; exports.resolvePath = resolvePath; exports.shouldRetry = shouldRetry; exports.stem = _chunkRB57I2IQcjs.stem; exports.tokenize = _chunkRB57I2IQcjs.tokenize;
2760
2823
  //# sourceMappingURL=index.cjs.map