@maximem/synap-js-sdk 0.4.7 → 0.4.8

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/dist/{anticipation-cache-BMVF5sXb.d.cts → anticipation-cache-C1rUEpaW.d.cts} +22 -1
  2. package/dist/{anticipation-cache-BMVF5sXb.d.ts → anticipation-cache-C1rUEpaW.d.ts} +22 -1
  3. package/dist/anticipation-cache-LRE3TLK4.cjs +14 -0
  4. package/dist/anticipation-cache-LRE3TLK4.cjs.map +1 -0
  5. package/dist/anticipation-cache-WLU4NMD5.js +14 -0
  6. package/dist/chunk-2TVL5IPQ.cjs.map +1 -1
  7. package/dist/{chunk-3JSE64GW.cjs → chunk-7CWBRHUO.cjs} +15 -2
  8. package/dist/chunk-7CWBRHUO.cjs.map +1 -0
  9. package/dist/{chunk-6LDUDKHS.js → chunk-ODVOQOSO.js} +124 -8
  10. package/dist/chunk-ODVOQOSO.js.map +1 -0
  11. package/dist/{chunk-ZU6ZC4SU.js → chunk-T5QQBJ6T.js} +15 -2
  12. package/dist/chunk-T5QQBJ6T.js.map +1 -0
  13. package/dist/{chunk-RB57I2IQ.cjs → chunk-T6U5PVAD.cjs} +125 -9
  14. package/dist/chunk-T6U5PVAD.cjs.map +1 -0
  15. package/dist/chunk-ZKOJDUN4.cjs.map +1 -1
  16. package/dist/env-55ULHNJZ.cjs.map +1 -1
  17. package/dist/grpc/index.cjs +4 -4
  18. package/dist/grpc/index.cjs.map +1 -1
  19. package/dist/grpc/index.d.cts +3 -3
  20. package/dist/grpc/index.d.ts +3 -3
  21. package/dist/grpc/index.js +3 -3
  22. package/dist/index.cjs +27 -16
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.d.cts +11 -4
  25. package/dist/index.d.ts +11 -4
  26. package/dist/index.js +25 -14
  27. package/dist/index.js.map +1 -1
  28. package/dist/stream-client-2C5KIOWP.js +7 -0
  29. package/dist/stream-client-GPU37E6F.cjs +7 -0
  30. package/dist/stream-client-GPU37E6F.cjs.map +1 -0
  31. package/package.json +6 -1
  32. package/dist/anticipation-cache-ARYEEKMU.cjs +0 -10
  33. package/dist/anticipation-cache-ARYEEKMU.cjs.map +0 -1
  34. package/dist/anticipation-cache-H7HEVWQC.js +0 -10
  35. package/dist/chunk-3JSE64GW.cjs.map +0 -1
  36. package/dist/chunk-6LDUDKHS.js.map +0 -1
  37. package/dist/chunk-RB57I2IQ.cjs.map +0 -1
  38. package/dist/chunk-ZU6ZC4SU.js.map +0 -1
  39. package/dist/stream-client-6V4FGKZ3.js +0 -7
  40. package/dist/stream-client-PRTOH62B.cjs +0 -7
  41. package/dist/stream-client-PRTOH62B.cjs.map +0 -1
  42. /package/dist/{anticipation-cache-H7HEVWQC.js.map → anticipation-cache-WLU4NMD5.js.map} +0 -0
  43. /package/dist/{stream-client-6V4FGKZ3.js.map → stream-client-2C5KIOWP.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/private/tmp/ndeep-main/synap/sdk/js/dist/chunk-T6U5PVAD.cjs","../src/behavior/anticipation.json","../src/behavior/contract.ts","../src/cache/bm25.ts","../src/context/anticipation-cache.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACF,wDAA6B;AAC7B;AACA;ACLA,IAAA,qBAAA,EAAA;AAAA,EACE,QAAA,EAAY,yQAAA;AAAA,EACZ,OAAA,EAAW,CAAA;AAAA,EACX,aAAA,EAAiB;AAAA,IACf,IAAA,EAAQ,geAAA;AAAA,IACR,QAAA,EAAY,+BAAA;AAAA,IACZ,OAAA,EAAW,KAAA;AAAA,IACX,QAAA,EAAY;AAAA,MACV;AAAA,QACE,OAAA,EAAW,iBAAA;AAAA,QACX,KAAA,EAAS,GAAA;AAAA,QACT,IAAA,EAAQ;AAAA,MACV,CAAA;AAAA,MACA;AAAA,QACE,OAAA,EAAW,eAAA;AAAA,QACX,KAAA,EAAS,GAAA;AAAA,QACT,IAAA,EAAQ;AAAA,MACV,CAAA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AAA;AACT,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASQ,EAAA;AAGA,IAAA;AACF,IAAA;AACA,IAAA;AACA,IAAA;AACG,IAAA;AACT,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASQ,EAAA;AAGA,IAAA;AACN,IAAA;AACO,MAAA;AACA,MAAA;AAED,MAAA;AACE,MAAA;AACR,IAAA;AACO,IAAA;AACT,EAAA;AAEQ,EAAA;AACD,IAAA;AACD,IAAA;AAEG,IAAA;AACT,EAAA;AAEQ,EAAA;AACA,IAAA;AAIA,IAAA;AACA,IAAA;AAEN,IAAA;AACQ,MAAA;AACA,MAAA;AACF,MAAA;AACN,IAAA;AACF,EAAA;AAEQ,EAAA;AACD,IAAA;AACA,IAAA;AAGA,IAAA;AACA,IAAA;AACP,EAAA;AACF;AAES;AAIA,EAAA;AAGT;AAES;AACA,EAAA;AACT;AJwKY;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/private/tmp/ndeep-main/synap/sdk/js/dist/chunk-T6U5PVAD.cjs","sourcesContent":[null,"{\n \"$comment\": \"SOURCE OF TRUTH for anticipation-cache behavior, shared by the Python and JS/TS SDKs. Do not duplicate these values into either SDK's source. See ../README.md. Regexes are restricted to the intersection of Python 're' and ECMAScript; both SDKs have a parity test.\",\n \"version\": 1,\n \"recall_bypass\": {\n \"note\": \"WS4 of the playground query-hygiene plan. A recall-shaped question never serves from the anticipation cache. Asymmetric cost is why: a stale false-hit makes the agent answer 'I don't see that' while the store holds the fact (the BZQR6J cross-session failure), whereas bypassing costs only cold-fetch latency on a turn where the user already expects a lookup. Stem coverage cannot gate this \\u2014 false hits were measured at coverage=1.00. Ties break toward INCLUDING a pattern.\",\n \"env_flag\": \"SYNAP_SDK_CACHE_RECALL_BYPASS\",\n \"default\": false,\n \"patterns\": [\n {\n \"pattern\": \"\\\\bremind me\\\\b\",\n \"flags\": \"i\",\n \"note\": \"Original set (WS4, playground query-hygiene plan).\"\n },\n {\n \"pattern\": \"\\\\bon file\\\\b\",\n \"flags\": \"i\",\n \"note\": \"Original set (WS4).\"\n },\n {\n \"pattern\": \"\\\\b(your|my|the) records\\\\b\",\n \"flags\": \"i\",\n \"note\": \"Original set (WS4).\"\n },\n {\n \"pattern\": \"\\\\bdo you (have|know|remember|recall|see)\\\\b\",\n \"flags\": \"i\",\n \"note\": \"Original set (WS4).\"\n },\n {\n \"pattern\": \"\\\\bwhat (do|did) (i|you) (say|tell|mention|have)\\\\b\",\n \"flags\": \"i\",\n \"note\": \"Original set (WS4).\"\n },\n {\n \"pattern\": \"\\\\bwhat('s| is) my\\\\b\",\n \"flags\": \"i\",\n \"note\": \"Original set (WS4).\"\n },\n {\n \"pattern\": \"\\\\bwhere (am i|do i live)\\\\b\",\n \"flags\": \"i\",\n \"note\": \"Original set (WS4).\"\n },\n {\n \"pattern\": \"\\\\bhow long have i\\\\b\",\n \"flags\": \"i\",\n \"note\": \"Original set (WS4).\"\n },\n {\n \"pattern\": \"\\\\bwhich of my\\\\b\",\n \"flags\": \"i\",\n \"note\": \"Original set (WS4).\"\n },\n {\n \"pattern\": \"\\\\bwhat .{0,40}\\\\b(again|earlier|last time|previously|yesterday)\\\\b\",\n \"flags\": \"i\",\n \"note\": \"Original set (WS4). 'again' alone is deliberately NOT a marker: 'book me a ride again' is a task query, not a recall query.\"\n },\n {\n \"pattern\": \"\\\\bwill you use to (contact|reach|notify)\\\\b\",\n \"flags\": \"i\",\n \"note\": \"Original set (WS4).\"\n },\n {\n \"pattern\": \"\\\\b(confirm|verify|double.?check)\\\\b.{0,40}\\\\bmy\\\\b\",\n \"flags\": \"i\",\n \"note\": \"2026-07-16 eval register issue #11: 'can you confirm my email address?' served a stale bundle. Also catches 'confirm my booking' \\u2014 an intentional over-match, costing one cloud fetch.\"\n },\n {\n \"pattern\": \"\\\\b(linked to|associated with|registered (to|on|with)) my\\\\b\",\n \"flags\": \"i\",\n \"note\": \"2026-07-16 eval register issue #11: 'what name is linked to my Uber account?' served a stale bundle.\"\n },\n {\n \"pattern\": \"\\\\b(best|preferred) way to (reach|contact|update|notify) me\\\\b\",\n \"flags\": \"i\",\n \"note\": \"2026-07-16 eval register issue #11: 'best way to contact me with updates' served a stale bundle.\"\n },\n {\n \"pattern\": \"\\\\bhow (do|will|can|should) you (reach|contact|notify) me\\\\b\",\n \"flags\": \"i\",\n \"note\": \"2026-07-16 eval register issue #11, sibling phrasing of the above.\"\n },\n {\n \"pattern\": \"\\\\bwhich .{0,40}\\\\b(are|will) you (going to )?(use|using)\\\\b\",\n \"flags\": \"i\",\n \"note\": \"2026-07-16 eval register issue #11: 'which email are you going to use?' served a stale bundle.\"\n },\n {\n \"pattern\": \"\\\\bon (my|the) account\\\\b\",\n \"flags\": \"i\",\n \"note\": \"2026-07-16 eval register issue #11.\"\n }\n ]\n },\n \"thresholds\": {\n \"bm25\": {\n \"value\": 1.5,\n \"note\": \"Nominal threshold. The value actually applied is derived per query: max(effective_floor, min(bm25, query_token_scale * len(query_tokens))). Short queries cannot reach the nominal score, so holding them to it would miss every time.\"\n },\n \"novel_term\": {\n \"value\": 0.45,\n \"note\": \"Fraction of query stems absent from the cached corpus that forces a miss.\"\n },\n \"min_corpus_for_novel_gate\": {\n \"value\": 200,\n \"note\": \"The novel-term gate is meaningless on a small corpus, where the ratio is dominated by ordinary English word forms. Measured: a fresh playground conversation reaches ~60 stems after the first push and would trip the 0.45 gate on essentially every second-turn query. 200 means the gate engages once a customer has ~3-4 typical bundles cached.\"\n },\n \"effective_floor\": {\n \"value\": 0.6,\n \"note\": \"Lower bound on the derived per-query threshold. Below this, BM25 stops discriminating.\"\n },\n \"query_token_scale\": {\n \"value\": 0.3,\n \"note\": \"Scales the threshold down for short queries: 0.3 points of score per query token.\"\n }\n },\n \"bm25\": {\n \"k1\": 1.5,\n \"b\": 0.75,\n \"idf_floor\": 0.5,\n \"min_token_len\": 2,\n \"min_stem_len\": 4,\n \"suffixes\": [\n \"ences\",\n \"ances\",\n \"ation\",\n \"tion\",\n \"sion\",\n \"ence\",\n \"ance\",\n \"ness\",\n \"ment\",\n \"able\",\n \"ible\",\n \"ical\",\n \"ally\",\n \"ies\",\n \"ive\",\n \"ful\",\n \"ous\",\n \"ing\",\n \"ary\",\n \"ly\",\n \"ed\",\n \"es\",\n \"s\"\n ],\n \"stop_words\": [\n \"a\",\n \"about\",\n \"after\",\n \"an\",\n \"and\",\n \"are\",\n \"at\",\n \"be\",\n \"been\",\n \"before\",\n \"being\",\n \"but\",\n \"by\",\n \"can\",\n \"could\",\n \"did\",\n \"do\",\n \"does\",\n \"for\",\n \"from\",\n \"had\",\n \"has\",\n \"have\",\n \"how\",\n \"if\",\n \"in\",\n \"into\",\n \"is\",\n \"it\",\n \"its\",\n \"may\",\n \"might\",\n \"no\",\n \"nor\",\n \"not\",\n \"of\",\n \"on\",\n \"or\",\n \"over\",\n \"should\",\n \"so\",\n \"than\",\n \"that\",\n \"the\",\n \"then\",\n \"these\",\n \"this\",\n \"those\",\n \"to\",\n \"was\",\n \"were\",\n \"what\",\n \"when\",\n \"where\",\n \"which\",\n \"who\",\n \"whom\",\n \"why\",\n \"will\",\n \"with\",\n \"would\"\n ],\n \"alias_token\": {\n \"pattern\": \"\\\\[\\\\[([A-Za-z][A-Za-z0-9_]*_[a-z0-9]{12})\\\\]\\\\]\",\n \"note\": \"An alias label as it appears in text: [[PERSON_PHONE_h2n7v5cx8m0d]]. Kept whole rather than split, because 'person' and 'phone' are boilerplate shared by every label of that field type and would make two different people's memories score alike. Mirrors synap/cloud/shared/tokenizer.py \\u2014 keep the two in step.\"\n },\n \"suffix_note\": \"Order matters: longest-first, because _stem returns on first match. Reordering this list silently changes every stem and therefore every BM25 score.\"\n },\n \"env_flags\": {\n \"$comment\": \"Read at CALL time, never at module load. Python does os.environ.get inside the function bodies; JS must do the same or late process.env mutation stops working and the flag looks broken. See gotcha G-S.\",\n \"SYNAP_SDK_CACHE_RECALL_BYPASS\": {\n \"default\": false,\n \"truthy\": [\n \"true\",\n \"1\",\n \"yes\"\n ]\n },\n \"SYNAP_SDK_CACHE_HONOR_TTL_HINT\": {\n \"default\": false,\n \"truthy\": [\n \"true\",\n \"1\",\n \"yes\"\n ],\n \"note\": \"A bundle's server ttl_hint_seconds may only SHORTEN the global TTL, never extend it.\"\n },\n \"SYNAP_SDK_CACHE_INVALIDATE_ON_WRITE\": {\n \"default\": false,\n \"truthy\": [\n \"true\",\n \"1\",\n \"yes\"\n ],\n \"note\": \"2026-07-16 eval register issue #8: the cloud invalidates its own Redis caches on ingest, but that stops at the process boundary.\"\n },\n \"SYNAP_SDK_CACHE_MAX_ENTRY_AGE\": {\n \"default\": null,\n \"note\": \"2026-07-16 eval register issue #6: stored_at is a sliding lease renewed on hit, so under steady traffic a pre-update snapshot never expired. Defaults to 2x the sliding TTL; 0 disables.\"\n },\n \"SYNAP_SDK_CACHE_COVERAGE_MIN\": {\n \"default\": null\n }\n },\n \"coverage_gate\": {\n \"note\": \"Fraction of the query's stems present in the picked items. A bundle can clear the BM25 threshold on one shared token ('account') while lacking the asked-for fact entirely: the false HIT behind the eval's 'forgot the name' failure. ALWAYS computed and reported; ENFORCED only when SYNAP_SDK_CACHE_COVERAGE_MIN is explicitly set, so default behavior is unchanged. When it does fire it must gate BEFORE any side effect, so a rejected lookup leaves cache state untouched.\",\n \"env_flag\": \"SYNAP_SDK_CACHE_COVERAGE_MIN\",\n \"default\": null,\n \"empty_query_coverage\": 1.0\n },\n \"telemetry\": {\n \"rejected_items_cap\": {\n \"value\": 20,\n \"note\": \"Rejected items reported per lookup, highest score first, so a large cache cannot bloat the payload.\"\n },\n \"content_preview_chars\": 120\n },\n \"rung_key\": {\n \"$comment\": \"SOURCE OF TRUTH for how a scope rung is written on the wire and compared in both SDK anticipation caches. The server stamps a pushed bundle with this string (ContextBundleProto.anticipation_scope_rung) and each SDK builds the same string from the `scope` path its own fetch names; a bundle is servable only when the two agree. Three implementations exist by necessity (server Python, SDK Python, SDK TypeScript) because the producer is not an SDK, so the vectors below are what stops them drifting.\",\n \"note\": \"Node ids are deliberately not what travels. They are registry surrogates and an SDK in a customer's process has never seen one; a caller names a rung with level keys and its own external ids, so that is the vocabulary the comparison happens in. Level keys are ^[a-z][a-z0-9_]{0,63}$ so they can hold neither separator and only the value needs escaping.\",\n \"separator\": \"|\",\n \"assign\": \"=\",\n \"sort\": \"by level key, ascending, plain codepoint order\",\n \"escapes\": {\n \"\\\\\": \"\\\\\\\\\",\n \"|\": \"\\\\p\",\n \"=\": \"\\\\e\"\n },\n \"escape_order\": \"backslash first. Reversing it makes `a|b` and `a\\\\pb` encode to the same string, which is a false match between two different rungs.\",\n \"absent\": \"null (an empty proto string on the wire) means the bundle or the request named no rung. Serving requires the two to be EQUAL, so absent matches only absent. That leaves every client without nested scoping byte-identical to today and refuses every genuinely cross-rung serve; the cost of the rule being wrong is a cold fetch, and the cost of a subset rule being wrong is one person's context handed to another.\",\n \"vectors\": [\n {\n \"path\": {},\n \"key\": null,\n \"note\": \"no path named\"\n },\n {\n \"path\": {\n \"customer\": \"acme\"\n },\n \"key\": \"customer=acme\"\n },\n {\n \"path\": {\n \"customer\": \"acme\",\n \"team\": \"payments\",\n \"user\": \"dana\"\n },\n \"key\": \"customer=acme|team=payments|user=dana\"\n },\n {\n \"path\": {\n \"user\": \"dana\",\n \"team\": \"payments\",\n \"customer\": \"acme\"\n },\n \"key\": \"customer=acme|team=payments|user=dana\",\n \"note\": \"insertion order must not change the key; a dict has whatever order the caller wrote and ladder order is not available here\"\n },\n {\n \"path\": {\n \"customer\": \"a|b\"\n },\n \"key\": \"customer=a\\\\pb\"\n },\n {\n \"path\": {\n \"customer\": \"a=b\"\n },\n \"key\": \"customer=a\\\\eb\"\n },\n {\n \"path\": {\n \"customer\": \"a\\\\b\"\n },\n \"key\": \"customer=a\\\\\\\\b\"\n },\n {\n \"path\": {\n \"customer\": \"a\\\\pb\"\n },\n \"key\": \"customer=a\\\\\\\\pb\",\n \"note\": \"the escape-order case: this must NOT collide with a|b above\"\n },\n {\n \"path\": {\n \"customer\": \"ab\"\n },\n \"key\": \"customer=ab\"\n },\n {\n \"path\": {\n \"customer\": \"a\",\n \"b\": \"c\"\n },\n \"key\": \"b=c|customer=a\",\n \"note\": \"sorted by key, so `customer=ab` and this cannot collapse\"\n }\n ]\n }\n}\n","/**\n * Loader for the shared SDK behavior contract.\n *\n * The values here are tuned against measured eval failures and are shared,\n * byte-identical, with the Python SDK. They live in data rather than code\n * specifically so the two SDKs cannot drift. See\n * `synap/sdk/CONTRACT/README.md`.\n *\n * `anticipation.json` is vendored into `src/` by\n * `synap/sdk/scripts/sync-behavior.sh` and imported (not read from disk) so\n * that the bundler inlines it. Reading it with `node:fs` at runtime would work\n * in Node and break in every bundled target: Edge, Workers, and anything under\n * webpack/turbopack, where `dist/` is rewritten and relative paths do not\n * survive. It is the same failure mode as `@grpc/proto-loader` reading a\n * `.proto` off disk (gotcha G-P).\n */\n\nimport contractJson from './anticipation.json' with { type: 'json' };\n\nexport interface RecallPattern {\n pattern: string;\n flags: string;\n note: string;\n}\n\nexport interface BehaviorContract {\n version: number;\n recall_bypass: {\n note: string;\n env_flag: string;\n default: boolean;\n patterns: RecallPattern[];\n };\n thresholds: {\n bm25: { value: number; note: string };\n novel_term: { value: number; note: string };\n min_corpus_for_novel_gate: { value: number; note: string };\n effective_floor: { value: number; note: string };\n query_token_scale: { value: number; note: string };\n };\n coverage_gate: {\n note: string;\n env_flag: string;\n default: number | null;\n empty_query_coverage: number;\n };\n telemetry: {\n rejected_items_cap: { value: number; note: string };\n content_preview_chars: number;\n };\n bm25: {\n k1: number;\n b: number;\n idf_floor: number;\n min_token_len: number;\n min_stem_len: number;\n suffixes: string[];\n stop_words: string[];\n alias_token: { pattern: string; note: string };\n };\n}\n\nexport const CONTRACT = contractJson as unknown as BehaviorContract;\n\n/** ECMAScript flags we accept. Anything else is invalid in Python too. */\nconst ALLOWED_FLAGS = new Set(['i', 'm', 's']);\n\nfunction compile(pattern: string, flags: string): RegExp {\n for (const ch of flags) {\n if (!ALLOWED_FLAGS.has(ch)) {\n throw new Error(\n `Unsupported regex flag '${ch}' in behavior contract. Flags must be ` +\n `valid in both Python and ECMAScript.`,\n );\n }\n }\n return new RegExp(pattern, flags);\n}\n\n/**\n * Compiled recall-bypass patterns, in contract order.\n *\n * Deliberately NOT using the `g` flag: a global RegExp carries `lastIndex`\n * between calls, so a shared instance would match on one query and then miss\n * on the next. That failure is intermittent and traffic-dependent, which is\n * the worst kind to debug.\n */\nexport const RECALL_PATTERNS: readonly RegExp[] = CONTRACT.recall_bypass.patterns.map((p) =>\n compile(p.pattern, p.flags ?? ''),\n);\n\nexport const THRESHOLDS = {\n bm25: CONTRACT.thresholds.bm25.value,\n novelTerm: CONTRACT.thresholds.novel_term.value,\n minCorpusForNovelGate: CONTRACT.thresholds.min_corpus_for_novel_gate.value,\n /** Lower bound on the derived per-query threshold. */\n effectiveFloor: CONTRACT.thresholds.effective_floor.value,\n /** Points of score allowed per query token when deriving the threshold. */\n queryTokenScale: CONTRACT.thresholds.query_token_scale.value,\n} as const;\n\nexport const BM25_PARAMS = CONTRACT.bm25;\nexport const STOP_WORDS: ReadonlySet<string> = new Set(CONTRACT.bm25.stop_words);\n// Order is load-bearing: stem() returns on first match, so this must stay\n// longest-first exactly as the contract lists it.\nexport const SUFFIXES: readonly string[] = CONTRACT.bm25.suffixes;\nexport const ALIAS_TOKEN_SOURCE = CONTRACT.bm25.alias_token.pattern;\n\n/** True when any query string looks like an explicit memory-recall ask. */\nexport function isRecallQuery(searchQuery: readonly (string | null | undefined)[] | null | undefined): boolean {\n for (const q of searchQuery ?? []) {\n if (!q) continue;\n for (const pattern of RECALL_PATTERNS) {\n if (pattern.test(q)) return true;\n }\n }\n return false;\n}\n","/**\n * BM25 scorer for the anticipation cache.\n *\n * A faithful port of `maximem_synap/cache/bm25.py`. Every tuned value comes\n * from the shared behavior contract, so the two implementations cannot drift\n * on parameters. What they *can* still drift on is arithmetic, which is what\n * the shared conformance corpus is for.\n */\n\nimport { BM25_PARAMS, STOP_WORDS, SUFFIXES, ALIAS_TOKEN_SOURCE } from '../behavior/contract.js';\n\nconst MIN_STEM_LEN = BM25_PARAMS.min_stem_len;\nconst MIN_TOKEN_LEN = BM25_PARAMS.min_token_len;\n\nexport function stem(word: string): string {\n // Order is load-bearing: longest suffix first, return on first match.\n for (const suffix of SUFFIXES) {\n if (word.endsWith(suffix) && word.length - suffix.length >= MIN_STEM_LEN) {\n return word.slice(0, word.length - suffix.length);\n }\n }\n return word;\n}\n\n/**\n * An alias label, as it appears in text: `[[PERSON_PHONE_h2n7v5cx8m0d]]`.\n *\n * Kept whole rather than split into `person`, `phone` and the suffix, because\n * the first two are boilerplate shared by every label of that field type and\n * would make two different people's memories score alike.\n *\n * Mirrors `synap/cloud/shared/tokenizer.py`. Keep the two in step.\n */\nfunction aliasTokenRe(): RegExp {\n // Constructed per call because `g` regexes carry `lastIndex`, and this one\n // is used with replace(). A module-level shared instance would produce\n // different results on alternating calls.\n return new RegExp(ALIAS_TOKEN_SOURCE, 'g');\n}\n\nconst WORD_RE = /[a-z0-9]+/g;\n\n/** Tokenize, lowercase, remove stop words, and stem. Alias labels survive whole. */\nexport function tokenize(text: string | null | undefined): string[] {\n if (!text) return [];\n\n const labels: string[] = [];\n const remainder = text.replace(aliasTokenRe(), (_match, captured: string) => {\n labels.push(captured.toLowerCase());\n return ' ';\n });\n\n const words = remainder.toLowerCase().match(WORD_RE) ?? [];\n const out = labels.slice();\n for (const w of words) {\n if (w.length >= MIN_TOKEN_LEN && !STOP_WORDS.has(w)) out.push(stem(w));\n }\n return out;\n}\n\n/** Okapi BM25 scorer over a small in-memory corpus. */\nexport class BM25 {\n static readonly IDF_FLOOR = BM25_PARAMS.idf_floor;\n\n readonly k1: number;\n readonly b: number;\n readonly corpus: readonly (readonly string[])[];\n readonly docCount: number;\n readonly avgdl: number;\n readonly docLens: readonly number[];\n readonly idf: ReadonlyMap<string, number>;\n\n constructor(\n corpus: readonly (readonly string[])[],\n k1: number = BM25_PARAMS.k1,\n b: number = BM25_PARAMS.b,\n ) {\n this.k1 = k1;\n this.b = b;\n this.corpus = corpus;\n this.docCount = corpus.length;\n this.docLens = corpus.map((doc) => doc.length);\n // Python falls back to 1.0 rather than dividing by zero on an empty corpus.\n this.avgdl = this.docCount\n ? this.docLens.reduce((a, n) => a + n, 0) / this.docCount\n : 1.0;\n\n const idf = new Map<string, number>();\n const allTerms = new Set<string>();\n for (const doc of corpus) for (const t of doc) allTerms.add(t);\n for (const term of allTerms) {\n let df = 0;\n for (const doc of corpus) if (doc.includes(term)) df++;\n const raw = Math.log((this.docCount - df + 0.5) / (df + 0.5) + 1.0);\n idf.set(term, Math.max(raw, BM25.IDF_FLOOR));\n }\n this.idf = idf;\n }\n\n score(queryTokens: readonly string[], docIdx: number): number {\n const doc = this.corpus[docIdx];\n if (doc === undefined) return 0;\n const dl = this.docLens[docIdx] ?? 0;\n\n const tfMap = new Map<string, number>();\n for (const t of doc) tfMap.set(t, (tfMap.get(t) ?? 0) + 1);\n\n let s = 0;\n for (const term of queryTokens) {\n const tf = tfMap.get(term);\n if (tf === undefined) continue;\n const idf = this.idf.get(term) ?? BM25.IDF_FLOOR;\n const numerator = tf * (this.k1 + 1);\n const denominator = tf + this.k1 * (1 - this.b + (this.b * dl) / this.avgdl);\n s += (idf * numerator) / denominator;\n }\n return s;\n }\n\n scores(queryTokens: readonly string[]): number[] {\n return this.corpus.map((_, i) => this.score(queryTokens, i));\n }\n}\n","/**\n * In-memory TTL cache for context bundles pushed over gRPC.\n *\n * Port of `maximem_synap/cache/anticipation_cache.py`.\n *\n * ## Why this is a faithful port and not a simplification\n *\n * `@maximem/synap-vercel-adk` already contains a native TS anticipation cache,\n * and it is a simplification: a hardcoded 30-minute TTL, a plain BM25 threshold\n * with no per-query derivation, and none of the gates below. Shipping that as\n * the SDK's cache would mean two retrieval behaviors under one brand, which is\n * gotcha G-C. Every gate here exists because a specific eval failed without it:\n *\n * - **Recall bypass** runs BEFORE scoring. The measured false hit scored 2.86\n * at coverage 1.00, so no score-side gate could ever have caught it.\n * - **The novel-term gate** is suppressed below a 200-stem corpus, because at\n * cold start ordinary English trips it on nearly every query.\n * - **The per-query threshold** scales down for short queries, which otherwise\n * cannot reach the nominal score at all.\n * - **The coverage gate** catches a bundle that clears BM25 on one shared\n * token (\"account\") while lacking the asked-for fact.\n *\n * All thresholds come from the shared behavior contract.\n */\n\nimport { BM25, tokenize } from '../cache/bm25.js';\nimport { CONTRACT, THRESHOLDS, isRecallQuery } from '../behavior/contract.js';\nimport { getEnvFlag, getEnvFloat } from '../util/env.js';\n\nconst EFFECTIVE_FLOOR = CONTRACT.thresholds.effective_floor.value;\nconst QUERY_TOKEN_SCALE = CONTRACT.thresholds.query_token_scale.value;\nconst REJECTED_CAP = CONTRACT.telemetry.rejected_items_cap.value;\nconst PREVIEW_CHARS = CONTRACT.telemetry.content_preview_chars;\n\n/** Sentinel scope that matches any requester. */\nexport const ANY_SCOPE = '_any';\n\n// ── the rung a request or a bundle stands at ───────────────────────────────\n//\n// A pushed bundle is stamped with the scope rung the server retrieved it at,\n// and a fetch names one through `scope_path`. Both are written the same way so\n// they can be compared as strings, because nothing in this process can resolve\n// anything: the server speaks in registry node ids and an SDK in a customer's\n// app has never seen one, so the comparison happens in the vocabulary the\n// CALLER uses, which is level keys and the client's own external ids.\n//\n// The recipe and its golden vectors live in the shared behavior contract\n// (CONTRACT/behavior/anticipation.json, `rung_key`). It is written three times\n// (here, the Python SDK, the server) because the producer is not an SDK, so\n// the usual \"port it once\" rule cannot apply. Do NOT re-tune it here.\nconst RUNG_SEPARATOR = '|';\nconst RUNG_ASSIGN = '=';\n\n/**\n * The rung a `scope_path` names, canonically, or null for no path.\n *\n * Sorted by level key because an object carries whatever order the caller\n * wrote it in, and the ladder's own order is not knowable here. Only the value\n * is escaped: level keys are `^[a-z][a-z0-9_]{0,63}$`, so they can hold\n * neither separator. Backslash is escaped first, or `a|b` and `a\\pb` would\n * encode to the same string, which is a false match between two rungs.\n */\nexport function rungKey(\n scopePath: Record<string, string> | null | undefined,\n): string | null {\n if (!scopePath) return null;\n const pairs: [string, string][] = [];\n for (const [k, v] of Object.entries(scopePath)) {\n if (k === '' || v === null || v === undefined || String(v) === '') continue;\n pairs.push([String(k), String(v)]);\n }\n if (pairs.length === 0) return null;\n pairs.sort((a, b) => (a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0));\n return pairs\n .map(([k, v]) => {\n const escaped = v\n .split('\\\\').join('\\\\\\\\')\n .split(RUNG_SEPARATOR).join('\\\\p')\n .split(RUNG_ASSIGN).join('\\\\e');\n return `${k}${RUNG_ASSIGN}${escaped}`;\n })\n .join(RUNG_SEPARATOR);\n}\n\n/**\n * May a bundle stamped `bundleRung` answer a request at `requestRung`?\n *\n * Equality, and equality on purpose. A subset rule (\"the bundle names more\n * rungs than you did, close enough\") reads as the generous option and is the\n * dangerous one: the rung nobody named is exactly the rung that tells two\n * people sharing an external id apart, which is the case the whole ladder\n * exists for. Being wrong here costs a cold fetch; being wrong the other way\n * hands one person's context to another.\n *\n * null on either side means \"named no rung\". Both null is every request in\n * production today and it serves, so nothing changes for anyone who has not\n * turned nested scoping on. `''` normalises to null because a proto string\n * field has no null and an unstamped bundle arrives as the empty string.\n */\nexport function rungServes(\n bundleRung: string | null | undefined,\n requestRung: string | null | undefined,\n): boolean {\n return (bundleRung || null) === (requestRung || null);\n}\n\nexport interface BundleItem {\n item_id?: string;\n content?: string;\n [key: string]: unknown;\n}\n\nexport interface ContextBundle {\n bundleId: string;\n entityId?: string | null;\n conversationId?: string | null;\n itemsByType: Record<string, BundleItem[]>;\n /** Server hint; may only SHORTEN the global TTL, never extend it. */\n ttlHintSeconds?: number | null;\n /** Which anticipation pattern produced this bundle. Diagnostics only. */\n bundleType?: string | null;\n /** The queries the server anticipated. Diagnostics only. */\n searchQueries?: readonly string[] | null;\n /**\n * The scope rung the server retrieved this bundle at, as `rungKey` writes\n * one. Absent from anything an older server sent, which reads as \"named no\n * rung\" rather than as \"matches anything\".\n */\n scopeRung?: string | null;\n}\n\ninterface ItemRecord {\n bundleId: string;\n itemType: string;\n content: string;\n tokens: string[];\n itemDict: BundleItem;\n}\n\ninterface EntryRecord {\n bundleId: string;\n entityId: string;\n conversationId: string | null;\n bundleType: string | null;\n searchQueries: string[];\n /** Sliding lease, refreshed on hit unless TTL hints are honoured. */\n storedAt: number;\n /** Absolute creation time; the max-entry-age cap uses this, not the lease. */\n createdAt: number;\n ttlHintSeconds: number | null;\n scopeRung: string | null;\n}\n\nexport interface LookupResult {\n itemsByType: Record<string, BundleItem[]>;\n bundleIds: string[];\n score: number;\n coverage: number;\n}\n\nexport interface LookupParams {\n searchQuery?: readonly string[] | null;\n entityId?: string | null;\n customerId?: string | null;\n clientId?: string | null;\n conversationId?: string | null;\n /**\n * The rung this request names, from its `scope_path`. A SECOND, independent\n * dimension and NOT another tier of the entity funnel: the funnel widens and\n * the rung does not, because a rung is a boundary and a boundary that widens\n * is not one.\n */\n scopeRung?: string | null;\n maxItems?: number;\n}\n\nexport type ExitReason =\n | 'empty'\n | 'recall_bypass'\n | 'no_query_tokens'\n | 'novel_term_gate'\n | 'empty_corpus'\n | 'no_items_above_threshold'\n | 'coverage_gate'\n | 'hit';\n\nexport interface LookupTelemetry {\n searchQuery: string[];\n entityId: string | null;\n customerId: string | null;\n clientId: string | null;\n conversationId: string | null;\n scopeRung: string | null;\n scopeFilterAccepted: string[];\n novelTermRatio: number | null;\n bm25Threshold: number | null;\n bm25QueryTokens: string[];\n itemsPicked: unknown[];\n itemsRejected: unknown[];\n coverage: number | null;\n hit: boolean;\n exitReason: ExitReason;\n}\n\nexport interface SnapshotItemPreview {\n type: string;\n scope: string | null;\n content: string;\n}\n\nexport interface SnapshotItemRecord {\n bundle_id: string;\n item_type: string;\n tokens: string[];\n content: string;\n}\n\nexport interface SnapshotBundle {\n bundle_id: string;\n entity_id: string;\n conversation_id: string | null;\n bundle_type: string | null;\n search_queries: string[];\n scope_counts: Record<string, number>;\n total_items: number;\n items: SnapshotItemPreview[];\n}\n\nexport interface AnticipationCacheSnapshot {\n total_entries: number;\n total_item_records: number;\n scope_breakdown_overall: Record<string, number>;\n corpus_vocab_size: number;\n corpus_vocab_sample: string[];\n item_records: SnapshotItemRecord[];\n bundles: SnapshotBundle[];\n}\n\nexport interface AnticipationCacheOptions {\n ttlSeconds?: number;\n maxBundles?: number;\n /** Injected in tests. Defaults to a monotonic clock. */\n now?: () => number;\n onLookup?: (telemetry: LookupTelemetry) => void;\n}\n\nconst DEFAULT_TTL_SECONDS = 1800;\nconst DEFAULT_MAX_BUNDLES = 50;\n\nexport class AnticipationCache {\n private readonly ttlSeconds: number;\n private readonly maxBundles: number;\n private readonly now: () => number;\n private readonly onLookup: ((t: LookupTelemetry) => void) | undefined;\n\n private entries = new Map<string, EntryRecord>();\n private items: ItemRecord[] = [];\n private corpusVocab = new Set<string>();\n private bm25: BM25 | null = null;\n private bm25Dirty = true;\n\n constructor(options: AnticipationCacheOptions = {}) {\n this.ttlSeconds = options.ttlSeconds ?? DEFAULT_TTL_SECONDS;\n this.maxBundles = options.maxBundles ?? DEFAULT_MAX_BUNDLES;\n this.now = options.now ?? monotonicNow;\n this.onLookup = options.onLookup;\n }\n\n get size(): number {\n return this.entries.size;\n }\n\n get itemCount(): number {\n return this.items.length;\n }\n\n store(bundle: ContextBundle): void {\n if (!bundle.bundleId) return;\n this.evictExpired();\n\n // Client-scope knowledge (FAQs, policies) arrives with no entity, and the\n // sentinel makes it visible to every requester.\n const entityId = bundle.entityId || ANY_SCOPE;\n\n if (this.entries.has(bundle.bundleId)) this.dropBundle(bundle.bundleId);\n\n const now = this.now();\n this.entries.set(bundle.bundleId, {\n bundleId: bundle.bundleId,\n entityId,\n conversationId: bundle.conversationId ?? null,\n bundleType: bundle.bundleType ?? null,\n searchQueries: [...(bundle.searchQueries ?? [])],\n storedAt: now,\n createdAt: now,\n ttlHintSeconds: bundle.ttlHintSeconds ?? null,\n scopeRung: bundle.scopeRung || null,\n });\n\n for (const [itemType, list] of Object.entries(bundle.itemsByType ?? {})) {\n for (const item of list ?? []) {\n const content = String(item.content ?? '');\n const tokens = tokenize(content);\n this.items.push({ bundleId: bundle.bundleId, itemType, content, tokens, itemDict: item });\n for (const t of tokens) this.corpusVocab.add(t);\n }\n }\n this.bm25Dirty = true;\n\n // LRU by lease age.\n while (this.entries.size > this.maxBundles) {\n let oldest: EntryRecord | null = null;\n for (const e of this.entries.values()) {\n if (oldest === null || e.storedAt < oldest.storedAt) oldest = e;\n }\n if (oldest === null) break;\n this.dropBundle(oldest.bundleId);\n }\n }\n\n lookup(params: LookupParams): LookupResult | null {\n const {\n searchQuery = null, entityId = null, customerId = null,\n clientId = null, conversationId = null, scopeRung = null, maxItems = 10,\n } = params;\n\n this.evictExpired();\n\n const accepted = this.buildAcceptedScope(entityId, customerId, clientId);\n const telemetry: LookupTelemetry = {\n searchQuery: (searchQuery ?? []).filter((q): q is string => Boolean(q)),\n entityId, customerId, clientId, conversationId,\n scopeRung: scopeRung ?? null,\n scopeFilterAccepted: [...accepted].sort(),\n novelTermRatio: null, bm25Threshold: null, bm25QueryTokens: [],\n itemsPicked: [], itemsRejected: [], coverage: null,\n hit: false, exitReason: 'empty',\n };\n\n if (this.entries.size === 0 || this.items.length === 0) {\n return this.miss(telemetry, 'empty');\n }\n\n const hasQuery = (searchQuery ?? []).some((q) => q && q.trim() !== '');\n if (!hasQuery) {\n return this.freshnessLookup(entityId, scopeRung ?? null, maxItems, telemetry);\n }\n\n // Recall bypass fires BEFORE scoring: a stale false-hit on a recall-shaped\n // question makes the agent deny a fact the store holds, and the measured\n // failure cleared every score-side gate.\n if (getEnvFlag(CONTRACT.recall_bypass.env_flag) && isRecallQuery(searchQuery)) {\n return this.miss(telemetry, 'recall_bypass');\n }\n\n const queryTokens = (searchQuery ?? []).flatMap((q) => tokenize(q));\n telemetry.bm25QueryTokens = queryTokens;\n if (queryTokens.length === 0) {\n return this.miss(telemetry, 'no_query_tokens');\n }\n\n const uniqueStems = new Set(queryTokens);\n let novel = 0;\n for (const s of uniqueStems) if (!this.corpusVocab.has(s)) novel++;\n const novelRatio = uniqueStems.size ? novel / uniqueStems.size : 0;\n telemetry.novelTermRatio = round4(novelRatio);\n\n // Only meaningful once the corpus has real vocabulary. Below the floor the\n // ratio is dominated by ordinary English and would miss on nearly anything.\n if (\n this.corpusVocab.size >= THRESHOLDS.minCorpusForNovelGate &&\n novelRatio >= THRESHOLDS.novelTerm\n ) {\n return this.miss(telemetry, 'novel_term_gate');\n }\n\n if (this.bm25Dirty || this.bm25 === null) {\n if (this.items.length === 0) return this.miss(telemetry, 'empty_corpus');\n this.bm25 = new BM25(this.items.map((i) => i.tokens));\n this.bm25Dirty = false;\n }\n\n const scores = this.bm25.scores(queryTokens);\n const validBundles = this.getValidBundleIds(accepted, conversationId, scopeRung ?? null);\n\n const effectiveThreshold = Math.max(\n EFFECTIVE_FLOOR,\n Math.min(THRESHOLDS.bm25, QUERY_TOKEN_SCALE * queryTokens.length),\n );\n telemetry.bm25Threshold = round4(effectiveThreshold);\n\n const picked: { score: number; item: ItemRecord }[] = [];\n const rejected: { score: number; payload: Record<string, unknown> }[] = [];\n\n for (let idx = 0; idx < scores.length; idx++) {\n const item = this.items[idx]!;\n const score = scores[idx]!;\n const reject = (reason: string) =>\n rejected.push({\n score,\n payload: {\n item_index: idx, bundle_id: item.bundleId, item_type: item.itemType,\n content_first_120: item.content.slice(0, PREVIEW_CHARS),\n bm25_score: round4(score), reason,\n },\n });\n if (score < effectiveThreshold) { reject('below_threshold'); continue; }\n if (!validBundles.has(item.bundleId)) { reject('scope_filter_excluded'); continue; }\n picked.push({ score, item });\n }\n\n rejected.sort((a, b) => b.score - a.score);\n telemetry.itemsRejected = rejected.slice(0, REJECTED_CAP).map((r) => r.payload);\n\n if (picked.length === 0) {\n return this.miss(telemetry, 'no_items_above_threshold');\n }\n\n picked.sort((a, b) => b.score - a.score);\n const top = picked.slice(0, maxItems);\n\n const pickedStems = new Set<string>();\n for (const { item } of top) for (const t of item.tokens) pickedStems.add(t);\n let overlap = 0;\n for (const s of uniqueStems) if (pickedStems.has(s)) overlap++;\n const coverage = uniqueStems.size ? overlap / uniqueStems.size : 1.0;\n telemetry.coverage = round4(coverage);\n\n // Observe-only unless explicitly configured. A malformed setting stays\n // observe-only rather than failing closed on every lookup.\n const coverageMin = getEnvFloat('SYNAP_SDK_CACHE_COVERAGE_MIN');\n if (coverageMin !== null && coverage < coverageMin) {\n // Gate BEFORE any side effect, so a rejected lookup leaves cache state\n // untouched and does not refresh a lease.\n return this.miss(telemetry, 'coverage_gate');\n }\n\n const itemsByType: Record<string, BundleItem[]> = {};\n const bundleIds = new Set<string>();\n for (const { item } of top) {\n (itemsByType[item.itemType] ??= []).push(item.itemDict);\n bundleIds.add(item.bundleId);\n }\n\n // Honouring a TTL hint also means a hit stops renewing the lease, otherwise\n // a hinted bundle under steady traffic would outlive its hint.\n const refreshOnHit = !getEnvFlag('SYNAP_SDK_CACHE_HONOR_TTL_HINT');\n if (refreshOnHit) {\n const now = this.now();\n for (const id of bundleIds) {\n const entry = this.entries.get(id);\n if (entry) entry.storedAt = now;\n }\n }\n\n telemetry.hit = true;\n telemetry.exitReason = 'hit';\n telemetry.itemsPicked = top.map(({ score, item }) => ({\n bundle_id: item.bundleId, item_type: item.itemType,\n content_first_120: item.content.slice(0, PREVIEW_CHARS), bm25_score: round4(score),\n }));\n this.fire(telemetry);\n\n return {\n itemsByType,\n bundleIds: [...bundleIds],\n score: top[0]!.score,\n coverage,\n };\n }\n\n /**\n * Drop this entity's bundles after a write, so the cache stops serving a\n * pre-write view. Gated on the flag: this is the write-path hook.\n */\n invalidateEntity(entityId: string): number {\n if (!getEnvFlag('SYNAP_SDK_CACHE_INVALIDATE_ON_WRITE')) return 0;\n return this.dropEntity(entityId);\n }\n\n /**\n * Unconditionally drop this entity's bundles. Backs `cache.clear_user` and\n * `cache.clear_customer`, which are explicit user requests and so are not\n * gated on the invalidate-on-write flag.\n */\n dropEntity(entityId: string): number {\n let dropped = 0;\n for (const entry of [...this.entries.values()]) {\n // Never drop shared client-scope knowledge on one entity's behalf.\n if (entry.entityId === ANY_SCOPE) continue;\n if (entry.entityId === entityId) { this.dropBundle(entry.bundleId); dropped++; }\n }\n return dropped;\n }\n\n /**\n * A read-only diagnostic projection of the cache.\n *\n * Backs `client.anticipation_cache_snapshot()` and mirrors Python's shape\n * key for key, including snake_case keys: this output gets logged, diffed\n * and pasted into issues across both SDKs, so it is a wire format.\n *\n * Note the 140-character content previews. That is Python's literal, and it\n * is deliberately NOT the 120 of `telemetry.content_preview_chars` from the\n * contract, which caps lookup telemetry rather than this snapshot.\n */\n snapshot(): AnticipationCacheSnapshot {\n const SNAPSHOT_PREVIEW_CHARS = 140;\n const overallScope = new Map<string, number>();\n const itemsByBundle = new Map<string, ItemRecord[]>();\n for (const record of this.items) {\n const list = itemsByBundle.get(record.bundleId);\n if (list === undefined) itemsByBundle.set(record.bundleId, [record]);\n else list.push(record);\n }\n\n const bundles: SnapshotBundle[] = [];\n for (const [bundleId, entry] of this.entries) {\n const perBundle = new Map<string, number>();\n const itemPreviews: SnapshotItemPreview[] = [];\n for (const record of itemsByBundle.get(bundleId) ?? []) {\n // `scope` is absent on plenty of items; Python's Counter happily keys\n // on None, which JSON-serialises to null, so preserve the distinction\n // rather than coercing to a string.\n const scope = (record.itemDict['scope'] ?? null) as string | null;\n const key = scope === null ? '' : scope;\n overallScope.set(key, (overallScope.get(key) ?? 0) + 1);\n perBundle.set(key, (perBundle.get(key) ?? 0) + 1);\n itemPreviews.push({\n type: record.itemType,\n scope,\n content: record.content.slice(0, SNAPSHOT_PREVIEW_CHARS),\n });\n }\n let totalItems = 0;\n for (const n of perBundle.values()) totalItems += n;\n bundles.push({\n bundle_id: bundleId,\n entity_id: entry.entityId,\n conversation_id: entry.conversationId,\n bundle_type: entry.bundleType,\n search_queries: [...entry.searchQueries],\n scope_counts: Object.fromEntries(perBundle),\n total_items: totalItems,\n items: itemPreviews,\n });\n }\n\n return {\n total_entries: this.entries.size,\n total_item_records: this.items.length,\n scope_breakdown_overall: Object.fromEntries(overallScope),\n corpus_vocab_size: this.corpusVocab.size,\n corpus_vocab_sample: [...this.corpusVocab].sort().slice(0, 80),\n item_records: this.items.slice(0, 20).map((rec) => ({\n bundle_id: rec.bundleId,\n item_type: rec.itemType,\n tokens: rec.tokens.slice(0, 25),\n content: rec.content.slice(0, SNAPSHOT_PREVIEW_CHARS),\n })),\n bundles,\n };\n }\n\n /**\n * The freshest `user_summary` bundle for this entity, or null.\n *\n * `entityId` is REQUIRED, and a missing one refuses the lookup rather than\n * falling back to the freshest summary across all users. Python hardened this\n * for exactly that reason: the permissive version could splice user A's\n * summary into user B's response on the conversation-scope path.\n */\n lookupUserSummary(\n entityId: string | null | undefined,\n scopeRung: string | null = null,\n ): Record<string, unknown> | null {\n if (!entityId) return null;\n this.evictExpired();\n\n let freshest: EntryRecord | null = null;\n for (const entry of this.entries.values()) {\n if (entry.bundleType !== 'user_summary') continue;\n if (!rungServes(entry.scopeRung, scopeRung)) continue;\n // ANY_SCOPE covers client-shared summaries, which are safe for everyone.\n if (entry.entityId !== entityId && entry.entityId !== ANY_SCOPE) continue;\n if (freshest === null || entry.storedAt > freshest.storedAt) freshest = entry;\n }\n if (freshest === null) return null;\n\n // Serving refreshes the sliding lease, unless the server's TTL hint is\n // being honoured, in which case the hint owns expiry.\n if (!getEnvFlag('SYNAP_SDK_CACHE_HONOR_TTL_HINT')) {\n freshest.storedAt = this.now();\n }\n return this.#bundleFor(freshest.bundleId);\n }\n\n /** Rebuild a bundle's items_by_type from the flat item records. */\n #bundleFor(bundleId: string): Record<string, unknown> {\n const itemsByType: Record<string, BundleItem[]> = {};\n for (const record of this.items) {\n if (record.bundleId !== bundleId) continue;\n (itemsByType[record.itemType] ??= []).push(record.itemDict);\n }\n return { bundle_id: bundleId, items_by_type: itemsByType };\n }\n\n /**\n * Drop every bundle belonging to one conversation.\n *\n * Backs the `compaction_update` signal on the Listen stream: a compaction\n * rewrites the conversation's summary, so any bundle built from the previous\n * state is stale and must not keep serving for the rest of its TTL.\n *\n * Unlike `dropEntity`, client-scope bundles are NOT spared: a bundle is only\n * dropped here if it is bound to this specific conversation, and a shared\n * client-scope bundle has no conversation id to match.\n */\n dropConversation(conversationId: string): number {\n if (!conversationId) return 0;\n let dropped = 0;\n for (const entry of [...this.entries.values()]) {\n if (entry.conversationId === conversationId) { this.dropBundle(entry.bundleId); dropped++; }\n }\n return dropped;\n }\n\n clear(): void {\n this.entries.clear();\n this.items = [];\n this.corpusVocab.clear();\n this.bm25 = null;\n this.bm25Dirty = true;\n }\n\n // ── internals ───────────────────────────────────────────────────────────────\n\n private miss(telemetry: LookupTelemetry, reason: ExitReason): null {\n telemetry.exitReason = reason;\n telemetry.hit = false;\n this.fire(telemetry);\n return null;\n }\n\n private fire(telemetry: LookupTelemetry): void {\n // Exception-safe by contract: a buggy hook must never break the SDK.\n try {\n this.onLookup?.(telemetry);\n } catch {\n /* ignored on purpose */\n }\n }\n\n private freshnessLookup(\n entityId: string | null,\n scopeRung: string | null,\n maxItems: number,\n telemetry: LookupTelemetry,\n ): LookupResult | null {\n // This path serves a WHOLE bundle on no query at all, so it is the least\n // filtered way out of this cache and needs the rung as much as the scored\n // path does.\n const candidates = [...this.entries.values()]\n .filter((e) => rungServes(e.scopeRung, scopeRung))\n .filter((e) => entityId === null || e.entityId === entityId || e.entityId === ANY_SCOPE)\n .sort((a, b) => b.storedAt - a.storedAt);\n if (candidates.length === 0) return this.miss(telemetry, 'empty');\n\n const newest = candidates[0]!;\n const itemsByType: Record<string, BundleItem[]> = {};\n let n = 0;\n for (const item of this.items) {\n if (item.bundleId !== newest.bundleId) continue;\n if (n >= maxItems) break;\n (itemsByType[item.itemType] ??= []).push(item.itemDict);\n n++;\n }\n if (n === 0) return this.miss(telemetry, 'empty');\n\n telemetry.hit = true;\n telemetry.exitReason = 'hit';\n this.fire(telemetry);\n return { itemsByType, bundleIds: [newest.bundleId], score: 0, coverage: 1.0 };\n }\n\n /**\n * The widened scope-match set for a request.\n *\n * A narrower-scope request also matches broader-scope bundles for the same\n * customer or client. Falsy ids are dropped so an empty customer_id cannot\n * accidentally match bundles keyed at \"\".\n */\n private buildAcceptedScope(\n entityId: string | null, customerId: string | null, clientId: string | null,\n ): Set<string> {\n const accepted = new Set<string>([ANY_SCOPE]);\n if (entityId) accepted.add(entityId);\n if (customerId) accepted.add(customerId);\n if (clientId) accepted.add(clientId);\n return accepted;\n }\n\n /**\n * The rung is checked FIRST and it never widens. Everything else here widens\n * deliberately: a user-scope request reaches customer-shared bundles, and a\n * conversation-scope request reaches user-scope ones. A rung is the opposite\n * kind of thing, so it is checked before the tiers and no amount of widening\n * can put a cross-rung bundle back in.\n */\n private getValidBundleIds(\n accepted: Set<string>, conversationId: string | null, scopeRung: string | null,\n ): Set<string> {\n const valid = new Set<string>();\n for (const entry of this.entries.values()) {\n if (!rungServes(entry.scopeRung, scopeRung)) continue;\n if (!accepted.has(entry.entityId)) continue;\n // A conversation-scoped bundle is only valid inside its conversation.\n if (entry.conversationId && conversationId && entry.conversationId !== conversationId) continue;\n valid.add(entry.bundleId);\n }\n return valid;\n }\n\n private effectiveTtl(entry: EntryRecord): number {\n if (!getEnvFlag('SYNAP_SDK_CACHE_HONOR_TTL_HINT')) return this.ttlSeconds;\n if (entry.ttlHintSeconds == null || entry.ttlHintSeconds <= 0) return this.ttlSeconds;\n // A hint may only shorten.\n return Math.min(this.ttlSeconds, entry.ttlHintSeconds);\n }\n\n private evictExpired(): void {\n const now = this.now();\n // Default cap is twice the sliding TTL; 0 disables. Without it a bundle\n // under steady traffic renews forever and can serve a retired value\n // indefinitely.\n const configuredMaxAge = getEnvFloat('SYNAP_SDK_CACHE_MAX_ENTRY_AGE');\n const maxAge = configuredMaxAge ?? this.ttlSeconds * 2;\n\n for (const entry of [...this.entries.values()]) {\n const idleExpired = now - entry.storedAt > this.effectiveTtl(entry);\n const ageExpired = maxAge > 0 && now - entry.createdAt > maxAge;\n if (idleExpired || ageExpired) this.dropBundle(entry.bundleId);\n }\n }\n\n private dropBundle(bundleId: string): void {\n if (!this.entries.delete(bundleId)) return;\n this.items = this.items.filter((i) => i.bundleId !== bundleId);\n // Vocabulary is rebuilt rather than decremented: a stem can be shared by\n // several bundles, so per-bundle subtraction would drop stems still in use.\n this.corpusVocab = new Set(this.items.flatMap((i) => i.tokens));\n this.bm25Dirty = true;\n }\n}\n\nfunction monotonicNow(): number {\n // performance.now() is monotonic and unaffected by wall-clock adjustments,\n // matching Python's time.monotonic(). Date.now() would let an NTP step\n // expire or resurrect every entry at once.\n return typeof performance !== 'undefined' && typeof performance.now === 'function'\n ? performance.now() / 1000\n : Date.now() / 1000;\n}\n\nfunction round4(n: number): number {\n return Number(n.toFixed(4));\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["/private/tmp/claude-501/-Users-scaler-maximem-synap/941df347-d7e5-4dc7-a714-e7bd41f7ddd2/scratchpad/wt-scopefix/synap/sdk/js/dist/chunk-ZKOJDUN4.cjs","../src/util/env.ts"],"names":[],"mappings":"AAAA;ACaA,IAAM,OAAA,kBAAS,IAAI,GAAA,CAAI,CAAC,MAAA,EAAQ,GAAA,EAAK,KAAK,CAAC,CAAA;AAE3C,SAAS,OAAA,CAAQ,IAAA,EAAkC;AACjD,EAAA,GAAA,CAAI,OAAO,QAAA,IAAY,YAAA,GAAe,OAAA,CAAQ,IAAA,IAAQ,KAAA,CAAA,EAAW,OAAO,KAAA,CAAA;AACxE,EAAA,OAAO,OAAA,CAAQ,GAAA,CAAI,IAAI,CAAA;AACzB;AAGO,SAAS,UAAA,CAAW,IAAA,EAAc,SAAA,EAAW,KAAA,EAAgB;AAClE,EAAA,MAAM,IAAA,EAAM,OAAA,CAAQ,IAAI,CAAA;AACxB,EAAA,GAAA,CAAI,IAAA,IAAQ,KAAA,EAAA,GAAa,GAAA,CAAI,IAAA,CAAK,EAAA,IAAM,EAAA,EAAI,OAAO,QAAA;AACnD,EAAA,OAAO,MAAA,CAAO,GAAA,CAAI,GAAA,CAAI,IAAA,CAAK,CAAA,CAAE,WAAA,CAAY,CAAC,CAAA;AAC5C;AAGO,SAAS,WAAA,CAAY,IAAA,EAA6B;AACvD,EAAA,MAAM,IAAA,kBAAM,OAAA,iBAAQ,IAAI,CAAA,6BAAG,IAAA,mBAAK,GAAA;AAChC,EAAA,GAAA,CAAI,CAAC,GAAA,EAAK,OAAO,IAAA;AACjB,EAAA,MAAM,EAAA,EAAI,MAAA,CAAO,GAAG,CAAA;AACpB,EAAA,OAAO,MAAA,CAAO,QAAA,CAAS,CAAC,EAAA,EAAI,EAAA,EAAI,IAAA;AAClC;AAEO,SAAS,MAAA,CAAO,IAAA,EAAkC;AACvD,EAAA,MAAM,EAAA,EAAI,OAAA,CAAQ,IAAI,CAAA;AACtB,EAAA,OAAO,EAAA,IAAM,KAAA,EAAA,GAAa,EAAA,IAAM,GAAA,EAAK,KAAA,EAAA,EAAY,CAAA;AACnD;ADjBA;AACA;AACE;AACA;AACA;AACF,4FAAC","file":"/private/tmp/claude-501/-Users-scaler-maximem-synap/941df347-d7e5-4dc7-a714-e7bd41f7ddd2/scratchpad/wt-scopefix/synap/sdk/js/dist/chunk-ZKOJDUN4.cjs","sourcesContent":[null,"/**\n * Environment access.\n *\n * Every read happens at CALL time, never at module load. Python does\n * `os.environ.get(...)` inside the function bodies, and tests plus runtime\n * toggles depend on that: a value captured at import time makes a later\n * `process.env` mutation look like the flag simply does not work. That is\n * gotcha G-S.\n *\n * `process` is absent on Workers and in the browser, so every accessor\n * tolerates it being missing.\n */\n\nconst TRUTHY = new Set(['true', '1', 'yes']);\n\nfunction readEnv(name: string): string | undefined {\n if (typeof process === 'undefined' || process.env === undefined) return undefined;\n return process.env[name];\n}\n\n/** Boolean flag. Defaults to false, matching the Python SDK's flags. */\nexport function getEnvFlag(name: string, fallback = false): boolean {\n const raw = readEnv(name);\n if (raw === undefined || raw.trim() === '') return fallback;\n return TRUTHY.has(raw.trim().toLowerCase());\n}\n\n/** Numeric setting. Returns null when unset OR malformed: a bad value must not fail closed. */\nexport function getEnvFloat(name: string): number | null {\n const raw = readEnv(name)?.trim();\n if (!raw) return null;\n const n = Number(raw);\n return Number.isFinite(n) ? n : null;\n}\n\nexport function getEnv(name: string): string | undefined {\n const v = readEnv(name);\n return v === undefined || v === '' ? undefined : v;\n}\n"]}
1
+ {"version":3,"sources":["/private/tmp/ndeep-main/synap/sdk/js/dist/chunk-ZKOJDUN4.cjs","../src/util/env.ts"],"names":[],"mappings":"AAAA;ACaA,IAAM,OAAA,kBAAS,IAAI,GAAA,CAAI,CAAC,MAAA,EAAQ,GAAA,EAAK,KAAK,CAAC,CAAA;AAE3C,SAAS,OAAA,CAAQ,IAAA,EAAkC;AACjD,EAAA,GAAA,CAAI,OAAO,QAAA,IAAY,YAAA,GAAe,OAAA,CAAQ,IAAA,IAAQ,KAAA,CAAA,EAAW,OAAO,KAAA,CAAA;AACxE,EAAA,OAAO,OAAA,CAAQ,GAAA,CAAI,IAAI,CAAA;AACzB;AAGO,SAAS,UAAA,CAAW,IAAA,EAAc,SAAA,EAAW,KAAA,EAAgB;AAClE,EAAA,MAAM,IAAA,EAAM,OAAA,CAAQ,IAAI,CAAA;AACxB,EAAA,GAAA,CAAI,IAAA,IAAQ,KAAA,EAAA,GAAa,GAAA,CAAI,IAAA,CAAK,EAAA,IAAM,EAAA,EAAI,OAAO,QAAA;AACnD,EAAA,OAAO,MAAA,CAAO,GAAA,CAAI,GAAA,CAAI,IAAA,CAAK,CAAA,CAAE,WAAA,CAAY,CAAC,CAAA;AAC5C;AAGO,SAAS,WAAA,CAAY,IAAA,EAA6B;AACvD,EAAA,MAAM,IAAA,kBAAM,OAAA,iBAAQ,IAAI,CAAA,6BAAG,IAAA,mBAAK,GAAA;AAChC,EAAA,GAAA,CAAI,CAAC,GAAA,EAAK,OAAO,IAAA;AACjB,EAAA,MAAM,EAAA,EAAI,MAAA,CAAO,GAAG,CAAA;AACpB,EAAA,OAAO,MAAA,CAAO,QAAA,CAAS,CAAC,EAAA,EAAI,EAAA,EAAI,IAAA;AAClC;AAEO,SAAS,MAAA,CAAO,IAAA,EAAkC;AACvD,EAAA,MAAM,EAAA,EAAI,OAAA,CAAQ,IAAI,CAAA;AACtB,EAAA,OAAO,EAAA,IAAM,KAAA,EAAA,GAAa,EAAA,IAAM,GAAA,EAAK,KAAA,EAAA,EAAY,CAAA;AACnD;ADjBA;AACA;AACE;AACA;AACA;AACF,4FAAC","file":"/private/tmp/ndeep-main/synap/sdk/js/dist/chunk-ZKOJDUN4.cjs","sourcesContent":[null,"/**\n * Environment access.\n *\n * Every read happens at CALL time, never at module load. Python does\n * `os.environ.get(...)` inside the function bodies, and tests plus runtime\n * toggles depend on that: a value captured at import time makes a later\n * `process.env` mutation look like the flag simply does not work. That is\n * gotcha G-S.\n *\n * `process` is absent on Workers and in the browser, so every accessor\n * tolerates it being missing.\n */\n\nconst TRUTHY = new Set(['true', '1', 'yes']);\n\nfunction readEnv(name: string): string | undefined {\n if (typeof process === 'undefined' || process.env === undefined) return undefined;\n return process.env[name];\n}\n\n/** Boolean flag. Defaults to false, matching the Python SDK's flags. */\nexport function getEnvFlag(name: string, fallback = false): boolean {\n const raw = readEnv(name);\n if (raw === undefined || raw.trim() === '') return fallback;\n return TRUTHY.has(raw.trim().toLowerCase());\n}\n\n/** Numeric setting. Returns null when unset OR malformed: a bad value must not fail closed. */\nexport function getEnvFloat(name: string): number | null {\n const raw = readEnv(name)?.trim();\n if (!raw) return null;\n const n = Number(raw);\n return Number.isFinite(n) ? n : null;\n}\n\nexport function getEnv(name: string): string | undefined {\n const v = readEnv(name);\n return v === undefined || v === '' ? undefined : v;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["/private/tmp/claude-501/-Users-scaler-maximem-synap/941df347-d7e5-4dc7-a714-e7bd41f7ddd2/scratchpad/wt-scopefix/synap/sdk/js/dist/env-55ULHNJZ.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACF,kJAAC","file":"/private/tmp/claude-501/-Users-scaler-maximem-synap/941df347-d7e5-4dc7-a714-e7bd41f7ddd2/scratchpad/wt-scopefix/synap/sdk/js/dist/env-55ULHNJZ.cjs"}
1
+ {"version":3,"sources":["/private/tmp/ndeep-main/synap/sdk/js/dist/env-55ULHNJZ.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACF,kJAAC","file":"/private/tmp/ndeep-main/synap/sdk/js/dist/env-55ULHNJZ.cjs"}
@@ -4,7 +4,7 @@ var _chunk2TVL5IPQcjs = require('../chunk-2TVL5IPQ.cjs');
4
4
 
5
5
 
6
6
 
7
- var _chunk3JSE64GWcjs = require('../chunk-3JSE64GW.cjs');
7
+ var _chunk7CWBRHUOcjs = require('../chunk-7CWBRHUO.cjs');
8
8
 
9
9
  // src/grpc/index.ts
10
10
  async function checkGrpcAvailability() {
@@ -39,8 +39,8 @@ async function listen(options) {
39
39
  throw new (0, _chunk2TVL5IPQcjs.ListeningNotActiveError)(availability.detail);
40
40
  }
41
41
  const [{ GrpcStreamClient: StreamClient }, { AnticipationCache }, { getEnv }] = await Promise.all([
42
- Promise.resolve().then(() => _interopRequireWildcard(require("../stream-client-PRTOH62B.cjs"))),
43
- Promise.resolve().then(() => _interopRequireWildcard(require("../anticipation-cache-ARYEEKMU.cjs"))),
42
+ Promise.resolve().then(() => _interopRequireWildcard(require("../stream-client-GPU37E6F.cjs"))),
43
+ Promise.resolve().then(() => _interopRequireWildcard(require("../anticipation-cache-LRE3TLK4.cjs"))),
44
44
  Promise.resolve().then(() => _interopRequireWildcard(require("../env-55ULHNJZ.cjs")))
45
45
  ]);
46
46
  const apiKey = _nullishCoalesce(_nullishCoalesce(options.apiKey, () => ( getEnv("SYNAP_API_KEY"))), () => ( ""));
@@ -83,5 +83,5 @@ async function listen(options) {
83
83
 
84
84
 
85
85
 
86
- exports.GrpcStreamClient = _chunk3JSE64GWcjs.GrpcStreamClient; exports.PROTO_SHA = _chunk3JSE64GWcjs.PROTO_SHA; exports.checkGrpcAvailability = checkGrpcAvailability; exports.listen = listen;
86
+ exports.GrpcStreamClient = _chunk7CWBRHUOcjs.GrpcStreamClient; exports.PROTO_SHA = _chunk7CWBRHUOcjs.PROTO_SHA; exports.checkGrpcAvailability = checkGrpcAvailability; exports.listen = listen;
87
87
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/private/tmp/claude-501/-Users-scaler-maximem-synap/941df347-d7e5-4dc7-a714-e7bd41f7ddd2/scratchpad/wt-scopefix/synap/sdk/js/dist/grpc/index.cjs","../../src/grpc/index.ts"],"names":[],"mappings":"AAAA;AACE;AACF,yDAA8B;AAC9B;AACE;AACA;AACF,yDAA8B;AAC9B;AACA;ACkCA,MAAA,SAAsB,qBAAA,CAAA,EAAmD;AACvE,EAAA,MAAM,OAAA,EACJ,OAAO,QAAA,IAAY,YAAA,mBACnB,OAAA,mBAAQ,QAAA,6BAAU,OAAA,IAAS,KAAA,EAAA,GAC3B,OAAQ,UAAA,CAAyC,YAAA,IAAgB,WAAA;AAEnE,EAAA,GAAA,CAAI,CAAC,MAAA,EAAQ;AACX,IAAA,OAAO;AAAA,MACL,SAAA,EAAW,KAAA;AAAA,MACX,MAAA,EAAQ,UAAA;AAAA,MACR,MAAA,EACE;AAAA,IAIJ,CAAA;AAAA,EACF;AAEA,EAAA,IAAI;AACF,IAAA,MAAM,4DAAA;AAAA;AAAA,MAA0B;AAAA,IAAe,GAAA;AAC/C,IAAA,OAAO,EAAE,SAAA,EAAW,KAAK,CAAA;AAAA,EAC3B,EAAA,MAAA,CAAS,KAAA,EAAO;AACd,IAAA,OAAO;AAAA,MACL,SAAA,EAAW,KAAA;AAAA,MACX,MAAA,EAAQ,gBAAA;AAAA,MACR,MAAA,EACE,CAAA,o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;AACA;AACA;AACA;AACF,+LAAC","file":"/private/tmp/claude-501/-Users-scaler-maximem-synap/941df347-d7e5-4dc7-a714-e7bd41f7ddd2/scratchpad/wt-scopefix/synap/sdk/js/dist/grpc/index.cjs","sourcesContent":[null,"/**\n * gRPC anticipation stream: availability and loading.\n *\n * This is a SUBPATH export (`@maximem/synap-js-sdk/grpc`) and is never\n * imported by the main entry point. Three reasons, all of which have bitten\n * someone already:\n *\n * 1. `@grpc/grpc-js` plus its protos is roughly 5MB. HTTP-only and Edge users\n * should not pay for it (gotcha G-Q).\n * 2. grpc-js is built on `node:http2`, `node:net` and `node:tls`. Merely\n * importing it on Edge or Workers fails the *build*, not the call. Keeping\n * it behind a subpath plus a lazy `import()` means importing the SDK on\n * Edge stays safe.\n * 3. It is an `optionalDependency`, so it may legitimately be absent.\n *\n * ## Proto loading\n *\n * The stream is live. The proto ships as an INLINED JSON descriptor\n * (./descriptor.ts) loaded through `proto-loader.fromJSON`, not through\n * `loadSync(path)`. proto-loader's file-based path reads the `.proto` off disk\n * at runtime, which breaks under webpack/turbopack bundling and Vercel's `nft`\n * file tracing: at deploy time rather than at test time (gotcha G-P). Inlining\n * gets the same result as ts-proto codegen without a codegen toolchain.\n */\n\nimport { ListeningNotActiveError } from '../errors.js';\nexport { GrpcStreamClient } from './stream-client.js';\nexport type {\n StreamState, StreamCredentials, StreamClientOptions, ConversationEventInput,\n} from './stream-client.js';\nexport { PROTO_SHA } from './descriptor.js';\n\nexport type GrpcAvailability =\n | { available: true }\n | { available: false; reason: 'not-node' | 'module-missing'; detail: string };\n\n/**\n * Whether a gRPC stream could run here.\n *\n * Deliberately does not throw: callers use this to decide whether to offer the\n * stream at all, and a hard failure at that point is unhelpful.\n */\nexport async function checkGrpcAvailability(): Promise<GrpcAvailability> {\n const isNode =\n typeof process !== 'undefined' &&\n process.versions?.node !== undefined &&\n typeof (globalThis as { EdgeRuntime?: unknown }).EdgeRuntime === 'undefined';\n\n if (!isNode) {\n return {\n available: false,\n reason: 'not-node',\n detail:\n 'gRPC needs raw TCP and node:http2, which Edge runtimes and Workers do ' +\n 'not provide. HTTP context fetching works normally here; only the ' +\n 'anticipation stream is unavailable. Reaching Edge would require a ' +\n 'gRPC-Web or Connect endpoint on the server, which does not exist yet.',\n };\n }\n\n try {\n await import(/* @vite-ignore */ '@grpc/grpc-js');\n return { available: true };\n } catch (error) {\n return {\n available: false,\n reason: 'module-missing',\n detail:\n '@grpc/grpc-js is an optional dependency and is not installed. Run ' +\n '`npm install @grpc/grpc-js` to enable the anticipation stream. ' +\n `(${(error as Error)?.message ?? String(error)})`,\n };\n }\n}\n\nexport interface ListenOptions {\n conversationId: string;\n userId?: string;\n customerId?: string;\n onBundle?: (bundle: unknown) => void;\n}\n\nexport interface ListeningSession {\n stop(): Promise<void>;\n readonly active: boolean;\n}\n\n/**\n * Start the anticipation stream directly, without a SynapClient.\n *\n * Most callers want `client.instance.listen()` instead, which shares the\n * client's credentials and anticipation cache. This exists for the case where\n * only the stream is wanted.\n *\n * **Opt-in, and off by default.** The removed wrapper called `listen()`\n * unconditionally during init, so every user had a stream whether they asked\n * for one or not. Making it opt-in is the right default, but it is not a\n * neutral change: fewer streams means fewer anticipation hits and therefore\n * MORE billed cloud fetches for existing users. That has to be announced\n * rather than discovered (gotcha G-Y).\n */\nexport async function listen(\n options: ListenOptions & {\n apiKey?: string;\n clientId?: string;\n instanceId?: string;\n host?: string;\n port?: number;\n useTls?: boolean;\n },\n): Promise<ListeningSession> {\n if (!options.conversationId) {\n // conversation_id is not a scope tier, but the stream genuinely requires\n // one: it is what the server keys the anticipation session on.\n throw new ListeningNotActiveError('conversation_id is required to start a listening stream');\n }\n\n const availability = await checkGrpcAvailability();\n if (!availability.available) {\n throw new ListeningNotActiveError(availability.detail);\n }\n\n const [{ GrpcStreamClient: StreamClient }, { AnticipationCache }, { getEnv }] = await Promise.all([\n import('./stream-client.js'),\n import('../context/anticipation-cache.js'),\n import('../util/env.js'),\n ]);\n\n const apiKey = options.apiKey ?? getEnv('SYNAP_API_KEY') ?? '';\n if (apiKey === '') {\n throw new ListeningNotActiveError(\n 'No Synap API key found. Set SYNAP_API_KEY or pass apiKey.',\n );\n }\n\n const cache = new AnticipationCache();\n const client = new StreamClient(\n {\n apiKey,\n clientId: options.clientId ?? getEnv('SYNAP_CLIENT_ID') ?? '',\n instanceId: options.instanceId ?? getEnv('SYNAP_INSTANCE_ID') ?? '',\n },\n cache,\n {\n ...(options.host !== undefined ? { host: options.host } : {}),\n ...(options.port !== undefined ? { port: options.port } : {}),\n ...(options.useTls !== undefined ? { useTls: options.useTls } : {}),\n ...(options.onBundle !== undefined ? { onContext: options.onBundle } : {}),\n },\n );\n await client.connect();\n client.sendSessionControl({\n action: 'start',\n conversation_id: options.conversationId,\n ...(options.userId !== undefined ? { user_id: options.userId } : {}),\n ...(options.customerId !== undefined ? { customer_id: options.customerId } : {}),\n });\n\n return {\n stop: () => client.disconnect(),\n get active() { return client.isConnected; },\n };\n}\n"]}
1
+ {"version":3,"sources":["/private/tmp/ndeep-main/synap/sdk/js/dist/grpc/index.cjs","../../src/grpc/index.ts"],"names":[],"mappings":"AAAA;AACE;AACF,yDAA8B;AAC9B;AACE;AACA;AACF,yDAA8B;AAC9B;AACA;ACkCA,MAAA,SAAsB,qBAAA,CAAA,EAAmD;AACvE,EAAA,MAAM,OAAA,EACJ,OAAO,QAAA,IAAY,YAAA,mBACnB,OAAA,mBAAQ,QAAA,6BAAU,OAAA,IAAS,KAAA,EAAA,GAC3B,OAAQ,UAAA,CAAyC,YAAA,IAAgB,WAAA;AAEnE,EAAA,GAAA,CAAI,CAAC,MAAA,EAAQ;AACX,IAAA,OAAO;AAAA,MACL,SAAA,EAAW,KAAA;AAAA,MACX,MAAA,EAAQ,UAAA;AAAA,MACR,MAAA,EACE;AAAA,IAIJ,CAAA;AAAA,EACF;AAEA,EAAA,IAAI;AACF,IAAA,MAAM,4DAAA;AAAA;AAAA,MAA0B;AAAA,IAAe,GAAA;AAC/C,IAAA,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IACL,IAAA,EAAM,CAAA,EAAA,GAAM,MAAA,CAAO,UAAA,CAAW,CAAA;AAAA,IAC9B,IAAI,MAAA,CAAA,EAAS;AAAE,MAAA,OAAO,MAAA,CAAO,WAAA;AAAA,IAAa;AAAA,EAC5C,CAAA;AACF;ADlFA;AACE;AACA;AACA;AACA;AACF,+LAAC","file":"/private/tmp/ndeep-main/synap/sdk/js/dist/grpc/index.cjs","sourcesContent":[null,"/**\n * gRPC anticipation stream: availability and loading.\n *\n * This is a SUBPATH export (`@maximem/synap-js-sdk/grpc`) and is never\n * imported by the main entry point. Three reasons, all of which have bitten\n * someone already:\n *\n * 1. `@grpc/grpc-js` plus its protos is roughly 5MB. HTTP-only and Edge users\n * should not pay for it (gotcha G-Q).\n * 2. grpc-js is built on `node:http2`, `node:net` and `node:tls`. Merely\n * importing it on Edge or Workers fails the *build*, not the call. Keeping\n * it behind a subpath plus a lazy `import()` means importing the SDK on\n * Edge stays safe.\n * 3. It is an `optionalDependency`, so it may legitimately be absent.\n *\n * ## Proto loading\n *\n * The stream is live. The proto ships as an INLINED JSON descriptor\n * (./descriptor.ts) loaded through `proto-loader.fromJSON`, not through\n * `loadSync(path)`. proto-loader's file-based path reads the `.proto` off disk\n * at runtime, which breaks under webpack/turbopack bundling and Vercel's `nft`\n * file tracing: at deploy time rather than at test time (gotcha G-P). Inlining\n * gets the same result as ts-proto codegen without a codegen toolchain.\n */\n\nimport { ListeningNotActiveError } from '../errors.js';\nexport { GrpcStreamClient } from './stream-client.js';\nexport type {\n StreamState, StreamCredentials, StreamClientOptions, ConversationEventInput,\n} from './stream-client.js';\nexport { PROTO_SHA } from './descriptor.js';\n\nexport type GrpcAvailability =\n | { available: true }\n | { available: false; reason: 'not-node' | 'module-missing'; detail: string };\n\n/**\n * Whether a gRPC stream could run here.\n *\n * Deliberately does not throw: callers use this to decide whether to offer the\n * stream at all, and a hard failure at that point is unhelpful.\n */\nexport async function checkGrpcAvailability(): Promise<GrpcAvailability> {\n const isNode =\n typeof process !== 'undefined' &&\n process.versions?.node !== undefined &&\n typeof (globalThis as { EdgeRuntime?: unknown }).EdgeRuntime === 'undefined';\n\n if (!isNode) {\n return {\n available: false,\n reason: 'not-node',\n detail:\n 'gRPC needs raw TCP and node:http2, which Edge runtimes and Workers do ' +\n 'not provide. HTTP context fetching works normally here; only the ' +\n 'anticipation stream is unavailable. Reaching Edge would require a ' +\n 'gRPC-Web or Connect endpoint on the server, which does not exist yet.',\n };\n }\n\n try {\n await import(/* @vite-ignore */ '@grpc/grpc-js');\n return { available: true };\n } catch (error) {\n return {\n available: false,\n reason: 'module-missing',\n detail:\n '@grpc/grpc-js is an optional dependency and is not installed. Run ' +\n '`npm install @grpc/grpc-js` to enable the anticipation stream. ' +\n `(${(error as Error)?.message ?? String(error)})`,\n };\n }\n}\n\nexport interface ListenOptions {\n conversationId: string;\n userId?: string;\n customerId?: string;\n onBundle?: (bundle: unknown) => void;\n}\n\nexport interface ListeningSession {\n stop(): Promise<void>;\n readonly active: boolean;\n}\n\n/**\n * Start the anticipation stream directly, without a SynapClient.\n *\n * Most callers want `client.instance.listen()` instead, which shares the\n * client's credentials and anticipation cache. This exists for the case where\n * only the stream is wanted.\n *\n * **Opt-in, and off by default.** The removed wrapper called `listen()`\n * unconditionally during init, so every user had a stream whether they asked\n * for one or not. Making it opt-in is the right default, but it is not a\n * neutral change: fewer streams means fewer anticipation hits and therefore\n * MORE billed cloud fetches for existing users. That has to be announced\n * rather than discovered (gotcha G-Y).\n */\nexport async function listen(\n options: ListenOptions & {\n apiKey?: string;\n clientId?: string;\n instanceId?: string;\n host?: string;\n port?: number;\n useTls?: boolean;\n },\n): Promise<ListeningSession> {\n if (!options.conversationId) {\n // conversation_id is not a scope tier, but the stream genuinely requires\n // one: it is what the server keys the anticipation session on.\n throw new ListeningNotActiveError('conversation_id is required to start a listening stream');\n }\n\n const availability = await checkGrpcAvailability();\n if (!availability.available) {\n throw new ListeningNotActiveError(availability.detail);\n }\n\n const [{ GrpcStreamClient: StreamClient }, { AnticipationCache }, { getEnv }] = await Promise.all([\n import('./stream-client.js'),\n import('../context/anticipation-cache.js'),\n import('../util/env.js'),\n ]);\n\n const apiKey = options.apiKey ?? getEnv('SYNAP_API_KEY') ?? '';\n if (apiKey === '') {\n throw new ListeningNotActiveError(\n 'No Synap API key found. Set SYNAP_API_KEY or pass apiKey.',\n );\n }\n\n const cache = new AnticipationCache();\n const client = new StreamClient(\n {\n apiKey,\n clientId: options.clientId ?? getEnv('SYNAP_CLIENT_ID') ?? '',\n instanceId: options.instanceId ?? getEnv('SYNAP_INSTANCE_ID') ?? '',\n },\n cache,\n {\n ...(options.host !== undefined ? { host: options.host } : {}),\n ...(options.port !== undefined ? { port: options.port } : {}),\n ...(options.useTls !== undefined ? { useTls: options.useTls } : {}),\n ...(options.onBundle !== undefined ? { onContext: options.onBundle } : {}),\n },\n );\n await client.connect();\n client.sendSessionControl({\n action: 'start',\n conversation_id: options.conversationId,\n ...(options.userId !== undefined ? { user_id: options.userId } : {}),\n ...(options.customerId !== undefined ? { customer_id: options.customerId } : {}),\n });\n\n return {\n stop: () => client.disconnect(),\n get active() { return client.isConnected; },\n };\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { A as AnticipationCache } from '../anticipation-cache-BMVF5sXb.cjs';
1
+ import { A as AnticipationCache } from '../anticipation-cache-C1rUEpaW.cjs';
2
2
 
3
3
  /**
4
4
  * Bidirectional gRPC stream client for the Synap anticipation channel.
@@ -82,14 +82,14 @@ declare class GrpcStreamClient {
82
82
  *
83
83
  * Source: synap/proto/synap_service.proto
84
84
  * Generator: synap/sdk/scripts/gen_proto_descriptor.mjs
85
- * Proto SHA: 1a9a098645d1b3cf
85
+ * Proto SHA: a58c9b031b41530d
86
86
  *
87
87
  * The proto is inlined as a JSON descriptor rather than loaded from disk so
88
88
  * that bundlers and Vercel file tracing cannot lose it. Regenerate with
89
89
  * `npm run sync-behavior` in synap/sdk/js.
90
90
  */
91
91
  /** sha256 (first 16 hex chars) of the proto this descriptor was built from. */
92
- declare const PROTO_SHA = "1a9a098645d1b3cf";
92
+ declare const PROTO_SHA = "a58c9b031b41530d";
93
93
 
94
94
  /**
95
95
  * gRPC anticipation stream: availability and loading.
@@ -1,4 +1,4 @@
1
- import { A as AnticipationCache } from '../anticipation-cache-BMVF5sXb.js';
1
+ import { A as AnticipationCache } from '../anticipation-cache-C1rUEpaW.js';
2
2
 
3
3
  /**
4
4
  * Bidirectional gRPC stream client for the Synap anticipation channel.
@@ -82,14 +82,14 @@ declare class GrpcStreamClient {
82
82
  *
83
83
  * Source: synap/proto/synap_service.proto
84
84
  * Generator: synap/sdk/scripts/gen_proto_descriptor.mjs
85
- * Proto SHA: 1a9a098645d1b3cf
85
+ * Proto SHA: a58c9b031b41530d
86
86
  *
87
87
  * The proto is inlined as a JSON descriptor rather than loaded from disk so
88
88
  * that bundlers and Vercel file tracing cannot lose it. Regenerate with
89
89
  * `npm run sync-behavior` in synap/sdk/js.
90
90
  */
91
91
  /** sha256 (first 16 hex chars) of the proto this descriptor was built from. */
92
- declare const PROTO_SHA = "1a9a098645d1b3cf";
92
+ declare const PROTO_SHA = "a58c9b031b41530d";
93
93
 
94
94
  /**
95
95
  * gRPC anticipation stream: availability and loading.
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  GrpcStreamClient,
6
6
  PROTO_SHA
7
- } from "../chunk-ZU6ZC4SU.js";
7
+ } from "../chunk-T5QQBJ6T.js";
8
8
 
9
9
  // src/grpc/index.ts
10
10
  async function checkGrpcAvailability() {
@@ -39,8 +39,8 @@ async function listen(options) {
39
39
  throw new ListeningNotActiveError(availability.detail);
40
40
  }
41
41
  const [{ GrpcStreamClient: StreamClient }, { AnticipationCache }, { getEnv }] = await Promise.all([
42
- import("../stream-client-6V4FGKZ3.js"),
43
- import("../anticipation-cache-H7HEVWQC.js"),
42
+ import("../stream-client-2C5KIOWP.js"),
43
+ import("../anticipation-cache-WLU4NMD5.js"),
44
44
  import("../env-QCUKKW36.js")
45
45
  ]);
46
46
  const apiKey = options.apiKey ?? getEnv("SYNAP_API_KEY") ?? "";
package/dist/index.cjs CHANGED
@@ -32,7 +32,8 @@ var _chunk2TVL5IPQcjs = require('./chunk-2TVL5IPQ.cjs');
32
32
 
33
33
 
34
34
 
35
- var _chunkRB57I2IQcjs = require('./chunk-RB57I2IQ.cjs');
35
+
36
+ var _chunkT6U5PVADcjs = require('./chunk-T6U5PVAD.cjs');
36
37
 
37
38
 
38
39
  var _chunkZKOJDUN4cjs = require('./chunk-ZKOJDUN4.cjs');
@@ -1205,7 +1206,8 @@ function createConversationNamespace(transport, subscribers = new CompactionSubs
1205
1206
  onFetched(
1206
1207
  response,
1207
1208
  id,
1208
- _nullishCoalesce(options.user_id, () => ( options.userId))
1209
+ _nullishCoalesce(options.user_id, () => ( options.userId)),
1210
+ _nullishCoalesce(options.scope_path, () => ( options.scopePath))
1209
1211
  );
1210
1212
  return response;
1211
1213
  },
@@ -1400,7 +1402,7 @@ function createInstanceNamespace(credentials, cache, onTurn) {
1400
1402
  if (client !== null) {
1401
1403
  throw new (0, _chunk2TVL5IPQcjs.ListeningAlreadyActiveError)("Listening is already active on this instance");
1402
1404
  }
1403
- const { GrpcStreamClient } = await Promise.resolve().then(() => _interopRequireWildcard(require("./stream-client-PRTOH62B.cjs")));
1405
+ const { GrpcStreamClient } = await Promise.resolve().then(() => _interopRequireWildcard(require("./stream-client-GPU37E6F.cjs")));
1404
1406
  const onContext = _nullishCoalesce(options.on_context, () => ( options.onContext));
1405
1407
  const onDisconnect = _nullishCoalesce(options.on_disconnect, () => ( options.onDisconnect));
1406
1408
  const onReconnect = _nullishCoalesce(options.on_reconnect, () => ( options.onReconnect));
@@ -1494,7 +1496,7 @@ function createInstanceNamespace(credentials, cache, onTurn) {
1494
1496
  }
1495
1497
 
1496
1498
  // src/version.ts
1497
- var SDK_VERSION = "1.0.0-beta.0";
1499
+ var SDK_VERSION = "0.4.7";
1498
1500
 
1499
1501
  // src/registry.ts
1500
1502
  var instances = /* @__PURE__ */ new Map();
@@ -1944,16 +1946,16 @@ function mergeUserSummary(response, bundle) {
1944
1946
 
1945
1947
  // src/context/anticipated.ts
1946
1948
  function scopeLookupParams(scope, params) {
1947
- const { searchQuery, entityId, customerId, clientId, conversationId } = params;
1949
+ const { searchQuery, entityId, customerId, clientId, conversationId, scopeRung } = params;
1948
1950
  switch (scope) {
1949
1951
  case "conversation":
1950
- return { searchQuery, entityId, customerId, clientId, conversationId };
1952
+ return { searchQuery, entityId, customerId, clientId, conversationId, scopeRung };
1951
1953
  case "user":
1952
- return { searchQuery, entityId, customerId, clientId };
1954
+ return { searchQuery, entityId, customerId, clientId, scopeRung };
1953
1955
  case "customer":
1954
- return { searchQuery, entityId: null, customerId, clientId };
1956
+ return { searchQuery, entityId: null, customerId, clientId, scopeRung };
1955
1957
  case "client":
1956
- return { searchQuery, entityId: null, customerId: null, clientId };
1958
+ return { searchQuery, entityId: null, customerId: null, clientId, scopeRung };
1957
1959
  }
1958
1960
  }
1959
1961
  function buildAnticipationResponse(hit) {
@@ -1988,6 +1990,7 @@ function tryServeFromCache(cache, scope, params, maxItems) {
1988
1990
  customerId: _nullishCoalesce(scoped.customerId, () => ( null)),
1989
1991
  clientId: _nullishCoalesce(scoped.clientId, () => ( null)),
1990
1992
  conversationId: _nullishCoalesce(scoped.conversationId, () => ( null)),
1993
+ scopeRung: _nullishCoalesce(scoped.scopeRung, () => ( null)),
1991
1994
  maxItems
1992
1995
  });
1993
1996
  if (hit === null) return { response: null, hit: null };
@@ -2488,7 +2491,7 @@ var SynapClient = class {
2488
2491
  userAgent: `@maximem/synap-js-sdk/${SDK_VERSION}`
2489
2492
  });
2490
2493
  if (options.heartbeat) this.#transport.startHeartbeat();
2491
- this.#anticipationCache = new (0, _chunkRB57I2IQcjs.AnticipationCache)();
2494
+ this.#anticipationCache = new (0, _chunkT6U5PVADcjs.AnticipationCache)();
2492
2495
  this.#fetchHooks = {
2493
2496
  beforeFetch: (scope, options2) => {
2494
2497
  const o2 = options2;
@@ -2500,7 +2503,15 @@ var SynapClient = class {
2500
2503
  entityId: _nullishCoalesce(o2["user_id"], () => ( o2["userId"])),
2501
2504
  customerId: _nullishCoalesce(o2["customer_id"], () => ( o2["customerId"])),
2502
2505
  clientId: this.#transport.currentCredentials().clientId || null,
2503
- conversationId: _nullishCoalesce(o2["conversation_id"], () => ( o2["conversationId"]))
2506
+ conversationId: _nullishCoalesce(o2["conversation_id"], () => ( o2["conversationId"])),
2507
+ // The rung this read is addressed to, in the same words the server
2508
+ // stamped on the bundles it pushed. Without it the cache matched
2509
+ // on entity and conversation alone, so a bundle prefetched for one
2510
+ // rung answered a caller standing at another, entirely inside this
2511
+ // process and invisible to every server log.
2512
+ scopeRung: _chunkT6U5PVADcjs.rungKey.call(void 0,
2513
+ _nullishCoalesce(o2["scope_path"], () => ( o2["scopePath"]))
2514
+ )
2504
2515
  },
2505
2516
  Number(_nullishCoalesce(_nullishCoalesce(o2["max_results"], () => ( o2["maxResults"])), () => ( 10)))
2506
2517
  );
@@ -2545,9 +2556,9 @@ var SynapClient = class {
2545
2556
  ({ conversationId, role, content, timestamp }) => {
2546
2557
  this.#shortTerm.appendTurn(conversationId, role, content, timestamp);
2547
2558
  },
2548
- (response, conversationId, userId) => {
2559
+ (response, conversationId, userId, scopePath) => {
2549
2560
  overlayLocalRecentTurns(response, this.#shortTerm, conversationId, this.#stVerbatimOverlay);
2550
- this.#injectUserSummary(response, conversationId, userId);
2561
+ this.#injectUserSummary(response, conversationId, userId, _chunkT6U5PVADcjs.rungKey.call(void 0, scopePath));
2551
2562
  },
2552
2563
  {
2553
2564
  prompt: (conversationId, style) => this.#localPrompt(conversationId, style),
@@ -2912,11 +2923,11 @@ var SynapClient = class {
2912
2923
  * cannot be scoped, and an unscoped lookup is how user A's summary ends up in
2913
2924
  * user B's response.
2914
2925
  */
2915
- #injectUserSummary(response, conversationId, userId) {
2926
+ #injectUserSummary(response, conversationId, userId, scopeRung) {
2916
2927
  this.#turns.increment(conversationId);
2917
2928
  if (userId === void 0 || userId === "") return;
2918
2929
  if (!this.#turns.shouldInject(conversationId)) return;
2919
- const summary = this.#anticipationCache.lookupUserSummary(userId);
2930
+ const summary = this.#anticipationCache.lookupUserSummary(userId, scopeRung);
2920
2931
  if (summary === null) return;
2921
2932
  mergeUserSummary(response, summary);
2922
2933
  }
@@ -3047,5 +3058,5 @@ function resolveCredentials(options) {
3047
3058
 
3048
3059
 
3049
3060
 
3050
- 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;
3061
+ exports.ANY_SCOPE = _chunkT6U5PVADcjs.ANY_SCOPE; exports.AgentUnavailableError = _chunk2TVL5IPQcjs.AgentUnavailableError; exports.AnticipationCache = _chunkT6U5PVADcjs.AnticipationCache; exports.AuthenticationError = _chunk2TVL5IPQcjs.AuthenticationError; exports.BM25 = _chunkT6U5PVADcjs.BM25; exports.COMPACTION_LEVELS = COMPACTION_LEVELS; exports.CONTRACT = _chunkT6U5PVADcjs.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 = _chunkT6U5PVADcjs.THRESHOLDS; exports.TranscriptConflictError = _chunk2TVL5IPQcjs.TranscriptConflictError; exports.TransientError = _chunk2TVL5IPQcjs.TransientError; exports.flattenContextItems = flattenContextItems; exports.formatForPrompt = formatForPrompt; exports.isOutcomeUnknown = isOutcomeUnknown; exports.isRecallQuery = _chunkT6U5PVADcjs.isRecallQuery; exports.isSynapError = _chunk2TVL5IPQcjs.isSynapError; exports.mergeScopeResults = mergeScopeResults; exports.resolvePath = resolvePath; exports.shouldRetry = shouldRetry; exports.stem = _chunkT6U5PVADcjs.stem; exports.tokenize = _chunkT6U5PVADcjs.tokenize;
3051
3062
  //# sourceMappingURL=index.cjs.map