@maximem/synap-js-sdk 0.4.0 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { a as AnticipationCacheSnapshot } from './anticipation-cache-BgkqcTPJ.cjs';
2
- export { b as ANY_SCOPE, A as AnticipationCache, c as AnticipationCacheOptions, B as BundleItem, C as ContextBundle, E as ExitReason, L as LookupParams, d as LookupResult, e as LookupTelemetry, S as SnapshotBundle, f as SnapshotItemPreview, g as SnapshotItemRecord } from './anticipation-cache-BgkqcTPJ.cjs';
1
+ import { a as AnticipationCacheSnapshot } from './anticipation-cache-BMVF5sXb.cjs';
2
+ export { b as ANY_SCOPE, A as AnticipationCache, c as AnticipationCacheOptions, B as BundleItem, C as ContextBundle, E as ExitReason, L as LookupParams, d as LookupResult, e as LookupTelemetry, S as SnapshotBundle, f as SnapshotItemPreview, g as SnapshotItemRecord } from './anticipation-cache-BMVF5sXb.cjs';
3
3
 
4
4
  /**
5
5
  * AUTOGENERATED FROM synap/sdk/CONTRACT/endpoints.yaml -- DO NOT EDIT.
@@ -714,6 +714,16 @@ type WriteInvalidator = (ids: {
714
714
  customerId?: string | undefined;
715
715
  }) => void;
716
716
 
717
+ /**
718
+ * Scope-aware context fetching.
719
+ *
720
+ * Scopes are client > customer > user. `conversation_id` is NOT a tier: it
721
+ * groups turns within a scope. Passing it narrows an existing scope rather
722
+ * than selecting a different one.
723
+ */
724
+
725
+ type Scope = 'user' | 'customer' | 'client' | 'conversation';
726
+
717
727
  /** User namespace. Mirrors `UserInterface` in the Python SDK. */
718
728
 
719
729
  interface UserNamespace {
@@ -846,6 +856,12 @@ interface InstanceNamespace {
846
856
  /** @internal Shared with the conversation namespace so both use one stream. */
847
857
  interface InstanceInternals {
848
858
  onCompactionUpdate(conversationId: string, bundle: Record<string, unknown>): void;
859
+ /** Set by the client so a compaction can prune the locally buffered tail. */
860
+ setCompactionApplier(apply: (bundle: Record<string, unknown>) => void): void;
861
+ /** Learning-loop event, fired after a fetch is served from the cache. */
862
+ sendContextUsed(event: Record<string, unknown>): void;
863
+ /** Audit event, fired after every fetch resolves. */
864
+ sendContextAssembled(event: Record<string, unknown>): void;
849
865
  setCompactionDispatcher(dispatch: (conversationId: string, bundle: Record<string, unknown>) => void): void;
850
866
  isListening(): boolean;
851
867
  }
@@ -979,6 +995,14 @@ interface SynapClientOptions {
979
995
  */
980
996
  heartbeat?: boolean;
981
997
  fetchImpl?: typeof fetch;
998
+ /**
999
+ * Bypass the process registry and build a genuinely separate client.
1000
+ *
1001
+ * Underscored because it mirrors Python's `_force_new` and is not part of the
1002
+ * everyday surface. Needed in tests, and for the rare case of deliberately
1003
+ * running two clients on one identity with separate caches.
1004
+ */
1005
+ _force_new?: boolean;
982
1006
  }
983
1007
  interface ScopedContext {
984
1008
  context: {
@@ -1310,16 +1334,6 @@ declare const TransientError: typeof SynapTransientError;
1310
1334
  declare const PermanentError: typeof SynapPermanentError;
1311
1335
  declare const ConnectionError: typeof NetworkTimeoutError;
1312
1336
 
1313
- /**
1314
- * Scope-aware context fetching.
1315
- *
1316
- * Scopes are client > customer > user. `conversation_id` is NOT a tier: it
1317
- * groups turns within a scope. Passing it narrows an existing scope rather
1318
- * than selecting a different one.
1319
- */
1320
-
1321
- type Scope = 'user' | 'customer' | 'client' | 'conversation';
1322
-
1323
1337
  /**
1324
1338
  * BM25 scorer for the anticipation cache.
1325
1339
  *
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { a as AnticipationCacheSnapshot } from './anticipation-cache-BgkqcTPJ.js';
2
- export { b as ANY_SCOPE, A as AnticipationCache, c as AnticipationCacheOptions, B as BundleItem, C as ContextBundle, E as ExitReason, L as LookupParams, d as LookupResult, e as LookupTelemetry, S as SnapshotBundle, f as SnapshotItemPreview, g as SnapshotItemRecord } from './anticipation-cache-BgkqcTPJ.js';
1
+ import { a as AnticipationCacheSnapshot } from './anticipation-cache-BMVF5sXb.js';
2
+ export { b as ANY_SCOPE, A as AnticipationCache, c as AnticipationCacheOptions, B as BundleItem, C as ContextBundle, E as ExitReason, L as LookupParams, d as LookupResult, e as LookupTelemetry, S as SnapshotBundle, f as SnapshotItemPreview, g as SnapshotItemRecord } from './anticipation-cache-BMVF5sXb.js';
3
3
 
4
4
  /**
5
5
  * AUTOGENERATED FROM synap/sdk/CONTRACT/endpoints.yaml -- DO NOT EDIT.
@@ -714,6 +714,16 @@ type WriteInvalidator = (ids: {
714
714
  customerId?: string | undefined;
715
715
  }) => void;
716
716
 
717
+ /**
718
+ * Scope-aware context fetching.
719
+ *
720
+ * Scopes are client > customer > user. `conversation_id` is NOT a tier: it
721
+ * groups turns within a scope. Passing it narrows an existing scope rather
722
+ * than selecting a different one.
723
+ */
724
+
725
+ type Scope = 'user' | 'customer' | 'client' | 'conversation';
726
+
717
727
  /** User namespace. Mirrors `UserInterface` in the Python SDK. */
718
728
 
719
729
  interface UserNamespace {
@@ -846,6 +856,12 @@ interface InstanceNamespace {
846
856
  /** @internal Shared with the conversation namespace so both use one stream. */
847
857
  interface InstanceInternals {
848
858
  onCompactionUpdate(conversationId: string, bundle: Record<string, unknown>): void;
859
+ /** Set by the client so a compaction can prune the locally buffered tail. */
860
+ setCompactionApplier(apply: (bundle: Record<string, unknown>) => void): void;
861
+ /** Learning-loop event, fired after a fetch is served from the cache. */
862
+ sendContextUsed(event: Record<string, unknown>): void;
863
+ /** Audit event, fired after every fetch resolves. */
864
+ sendContextAssembled(event: Record<string, unknown>): void;
849
865
  setCompactionDispatcher(dispatch: (conversationId: string, bundle: Record<string, unknown>) => void): void;
850
866
  isListening(): boolean;
851
867
  }
@@ -979,6 +995,14 @@ interface SynapClientOptions {
979
995
  */
980
996
  heartbeat?: boolean;
981
997
  fetchImpl?: typeof fetch;
998
+ /**
999
+ * Bypass the process registry and build a genuinely separate client.
1000
+ *
1001
+ * Underscored because it mirrors Python's `_force_new` and is not part of the
1002
+ * everyday surface. Needed in tests, and for the rare case of deliberately
1003
+ * running two clients on one identity with separate caches.
1004
+ */
1005
+ _force_new?: boolean;
982
1006
  }
983
1007
  interface ScopedContext {
984
1008
  context: {
@@ -1310,16 +1334,6 @@ declare const TransientError: typeof SynapTransientError;
1310
1334
  declare const PermanentError: typeof SynapPermanentError;
1311
1335
  declare const ConnectionError: typeof NetworkTimeoutError;
1312
1336
 
1313
- /**
1314
- * Scope-aware context fetching.
1315
- *
1316
- * Scopes are client > customer > user. `conversation_id` is NOT a tier: it
1317
- * groups turns within a scope. Passing it narrows an existing scope rather
1318
- * than selecting a different one.
1319
- */
1320
-
1321
- type Scope = 'user' | 'customer' | 'client' | 'conversation';
1322
-
1323
1337
  /**
1324
1338
  * BM25 scorer for the anticipation cache.
1325
1339
  *