@maximem/synap-js-sdk 0.5.4 → 0.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-DJPYUPSV.js → chunk-FXGLT6AT.js} +10 -2
- package/dist/chunk-FXGLT6AT.js.map +1 -0
- package/dist/{chunk-WWTGJZA7.cjs → chunk-HCULAVJC.cjs} +10 -2
- package/dist/chunk-HCULAVJC.cjs.map +1 -0
- package/dist/grpc/index.cjs +3 -3
- package/dist/grpc/index.d.cts +2 -2
- package/dist/grpc/index.d.ts +2 -2
- package/dist/grpc/index.js +2 -2
- package/dist/index.cjs +112 -37
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +131 -7
- package/dist/index.d.ts +131 -7
- package/dist/index.js +86 -11
- package/dist/index.js.map +1 -1
- package/dist/stream-client-N46JBT5A.cjs +16 -0
- package/dist/{stream-client-GJM4YSXW.cjs.map → stream-client-N46JBT5A.cjs.map} +1 -1
- package/dist/{stream-client-5CGJNTH4.js → stream-client-VWKINE47.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-DJPYUPSV.js.map +0 -1
- package/dist/chunk-WWTGJZA7.cjs.map +0 -1
- package/dist/stream-client-GJM4YSXW.cjs +0 -16
- /package/dist/{stream-client-5CGJNTH4.js.map → stream-client-VWKINE47.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -60,6 +60,11 @@ declare const ENDPOINTS: {
|
|
|
60
60
|
readonly path: "/api/v1/memories/{memory_id}";
|
|
61
61
|
readonly idempotent: true;
|
|
62
62
|
};
|
|
63
|
+
readonly memories_forget: {
|
|
64
|
+
readonly method: "POST";
|
|
65
|
+
readonly path: "/api/v1/memories/forget";
|
|
66
|
+
readonly idempotent: false;
|
|
67
|
+
};
|
|
63
68
|
readonly context_fetch_user: {
|
|
64
69
|
readonly method: "POST";
|
|
65
70
|
readonly path: "/v1/context/user/fetch";
|
|
@@ -369,9 +374,25 @@ interface RawContextItem {
|
|
|
369
374
|
extracted_at?: string | null;
|
|
370
375
|
metadata?: Json;
|
|
371
376
|
event_date?: string | null;
|
|
377
|
+
/**
|
|
378
|
+
* The day the words were SAID, which is not the day the event happened.
|
|
379
|
+
*
|
|
380
|
+
* `event_date` is empty unless somebody stated when the event took place, so
|
|
381
|
+
* without this field beside it an item whose turn stated no event date
|
|
382
|
+
* arrives with no machine-readable date at all. Empty when the client never
|
|
383
|
+
* told the server when the conversation happened; it is never the server's
|
|
384
|
+
* own ingest or extraction clock.
|
|
385
|
+
*/
|
|
386
|
+
said_at?: string | null;
|
|
372
387
|
valid_until?: string | null;
|
|
373
388
|
temporal_category?: string | null;
|
|
374
389
|
temporal_confidence?: number;
|
|
390
|
+
/**
|
|
391
|
+
* The search queries of the fetch that found this item, in the order they
|
|
392
|
+
* were sent. Absent from a server that predates the field, and on an item
|
|
393
|
+
* served from the prefetch cache.
|
|
394
|
+
*/
|
|
395
|
+
matched_queries?: string[];
|
|
375
396
|
[key: string]: unknown;
|
|
376
397
|
}
|
|
377
398
|
interface RawConversationContext {
|
|
@@ -398,11 +419,29 @@ interface RawContext {
|
|
|
398
419
|
}
|
|
399
420
|
interface TemporalFields {
|
|
400
421
|
eventDate: string | null;
|
|
422
|
+
/**
|
|
423
|
+
* The day the words were SAID, which is not the day the event happened.
|
|
424
|
+
*
|
|
425
|
+
* `event_date` is empty unless somebody stated when the event took place, so
|
|
426
|
+
* without this field beside it an item whose turn stated no event date
|
|
427
|
+
* arrives with no machine-readable date at all. Empty when the client never
|
|
428
|
+
* told the server when the conversation happened; it is never the server's
|
|
429
|
+
* own ingest or extraction clock.
|
|
430
|
+
*/
|
|
431
|
+
saidAt: string | null;
|
|
401
432
|
validUntil: string | null;
|
|
402
433
|
temporalCategory: string | null;
|
|
403
434
|
temporalConfidence: number;
|
|
404
435
|
}
|
|
405
|
-
|
|
436
|
+
/**
|
|
437
|
+
* Which of the fetch's search queries found an item. A fetch can carry several
|
|
438
|
+
* and returns one set for all of them. Always an array: empty when the fetch
|
|
439
|
+
* named no query or the server predates the field.
|
|
440
|
+
*/
|
|
441
|
+
interface QueryAttribution {
|
|
442
|
+
matchedQueries: string[];
|
|
443
|
+
}
|
|
444
|
+
interface Fact extends TemporalFields, QueryAttribution {
|
|
406
445
|
id: string;
|
|
407
446
|
content: string;
|
|
408
447
|
confidence: number;
|
|
@@ -410,7 +449,7 @@ interface Fact extends TemporalFields {
|
|
|
410
449
|
extractedAt: string | null;
|
|
411
450
|
metadata: Json;
|
|
412
451
|
}
|
|
413
|
-
interface Preference extends TemporalFields {
|
|
452
|
+
interface Preference extends TemporalFields, QueryAttribution {
|
|
414
453
|
id: string;
|
|
415
454
|
category: string;
|
|
416
455
|
content: string;
|
|
@@ -419,7 +458,7 @@ interface Preference extends TemporalFields {
|
|
|
419
458
|
extractedAt: string | null;
|
|
420
459
|
metadata: Json;
|
|
421
460
|
}
|
|
422
|
-
interface Episode extends TemporalFields {
|
|
461
|
+
interface Episode extends TemporalFields, QueryAttribution {
|
|
423
462
|
id: string;
|
|
424
463
|
summary: string;
|
|
425
464
|
occurredAt: string | null;
|
|
@@ -427,7 +466,7 @@ interface Episode extends TemporalFields {
|
|
|
427
466
|
participants: unknown[];
|
|
428
467
|
metadata: Json;
|
|
429
468
|
}
|
|
430
|
-
interface Emotion extends TemporalFields {
|
|
469
|
+
interface Emotion extends TemporalFields, QueryAttribution {
|
|
431
470
|
id: string;
|
|
432
471
|
emotionType: string;
|
|
433
472
|
intensity: number;
|
|
@@ -435,10 +474,12 @@ interface Emotion extends TemporalFields {
|
|
|
435
474
|
context: string;
|
|
436
475
|
metadata: Json;
|
|
437
476
|
}
|
|
438
|
-
interface TemporalEvent {
|
|
477
|
+
interface TemporalEvent extends QueryAttribution {
|
|
439
478
|
id: string;
|
|
440
479
|
content: string;
|
|
441
480
|
eventDate: string | null;
|
|
481
|
+
/** See the note on `TemporalFields.saidAt`. */
|
|
482
|
+
saidAt: string | null;
|
|
442
483
|
validUntil: string | null;
|
|
443
484
|
/**
|
|
444
485
|
* Nullable despite the `''` default in the normaliser: `pickDefined` skips
|
|
@@ -516,6 +557,18 @@ interface FetchOptions {
|
|
|
516
557
|
*/
|
|
517
558
|
query_date?: string;
|
|
518
559
|
queryDate?: string;
|
|
560
|
+
/**
|
|
561
|
+
* How many items each search query may contribute when `search_query` holds
|
|
562
|
+
* more than one, so a query with many strong matches cannot take every
|
|
563
|
+
* place. `max_results` stays the ceiling on the whole response: three
|
|
564
|
+
* queries at five each under `max_results: 10` return ten.
|
|
565
|
+
*
|
|
566
|
+
* Sent only when provided, like `query_date`. Left out, or with one query,
|
|
567
|
+
* the response is the best `max_results` items overall, as before. `0` is
|
|
568
|
+
* treated as left out.
|
|
569
|
+
*/
|
|
570
|
+
max_results_per_query?: number;
|
|
571
|
+
maxResultsPerQuery?: number;
|
|
519
572
|
/** Sent only when explicitly false, matching the Python controllers. */
|
|
520
573
|
include_conversation_context?: boolean;
|
|
521
574
|
/**
|
|
@@ -564,6 +617,8 @@ interface FlatMemory {
|
|
|
564
617
|
metadata: Json;
|
|
565
618
|
context_type: 'fact' | 'preference' | 'episode' | 'emotion' | 'temporal_event';
|
|
566
619
|
event_date: string | null;
|
|
620
|
+
/** See `TemporalFields.saidAt` in ./types. */
|
|
621
|
+
said_at: string | null;
|
|
567
622
|
valid_until: string | null;
|
|
568
623
|
temporal_category: string | null;
|
|
569
624
|
temporal_confidence: number;
|
|
@@ -664,6 +719,44 @@ interface BatchCreateOptions {
|
|
|
664
719
|
fail_fast?: boolean;
|
|
665
720
|
failFast?: boolean;
|
|
666
721
|
}
|
|
722
|
+
/** Mirrors the Python ForgetMode enum. */
|
|
723
|
+
declare const FORGET_MODES: readonly ["preview", "direct"];
|
|
724
|
+
type ForgetMode = (typeof FORGET_MODES)[number];
|
|
725
|
+
interface ForgetOptions {
|
|
726
|
+
/** What to forget, in the user's own words (3 to 500 characters). */
|
|
727
|
+
description: string;
|
|
728
|
+
user_id?: string | null;
|
|
729
|
+
userId?: string | null;
|
|
730
|
+
customer_id?: string | null;
|
|
731
|
+
customerId?: string | null;
|
|
732
|
+
/**
|
|
733
|
+
* The level to search, named in full, one entry per level down to it:
|
|
734
|
+
* `{ customer: "acme", team: "payments", user: "dana" }`. Only needed when
|
|
735
|
+
* your scope ladder has a level between customer and user.
|
|
736
|
+
*/
|
|
737
|
+
scope?: Record<string, string> | null;
|
|
738
|
+
/** `"preview"` (default) or `"direct"`. See `MemoriesInterface.forget`. */
|
|
739
|
+
mode?: ForgetMode | string;
|
|
740
|
+
}
|
|
741
|
+
/** A memory the description matched. Mirrors Python's `ForgetCandidate`. */
|
|
742
|
+
interface ForgetCandidate {
|
|
743
|
+
memory_id: string;
|
|
744
|
+
content: string;
|
|
745
|
+
memory_type?: string | null;
|
|
746
|
+
/** `"memory"`, or where a copy lives: chunk, sentence, entity, triple, profile, candidate. */
|
|
747
|
+
store?: string;
|
|
748
|
+
}
|
|
749
|
+
type ForgetStatus = 'nothing_matches' | 'preview' | 'deleted' | 'partial';
|
|
750
|
+
/** Result of `memories.forget`. Mirrors Python's `ForgetResponse`. */
|
|
751
|
+
interface ForgetResult {
|
|
752
|
+
status: ForgetStatus;
|
|
753
|
+
request_id: string | null;
|
|
754
|
+
candidates: ForgetCandidate[];
|
|
755
|
+
deleted_ids: string[];
|
|
756
|
+
failed_ids: string[];
|
|
757
|
+
still_present_in: string[];
|
|
758
|
+
may_be_incomplete: boolean;
|
|
759
|
+
}
|
|
667
760
|
interface MemoriesInterface {
|
|
668
761
|
create(options: CreateMemoryOptions): Promise<CreateMemoryResult>;
|
|
669
762
|
batch_create(options: BatchCreateOptions): Promise<BatchCreateResult>;
|
|
@@ -671,6 +764,35 @@ interface MemoriesInterface {
|
|
|
671
764
|
get(memoryId: string): Promise<Json>;
|
|
672
765
|
update(options: UpdateMemoryOptions): Promise<Json>;
|
|
673
766
|
delete(memoryId: string): Promise<Json>;
|
|
767
|
+
/**
|
|
768
|
+
* Forget memories by describing them in the user's own words. Use it when
|
|
769
|
+
* you do not hold memory ids; to delete one memory by id, use `delete()`.
|
|
770
|
+
*
|
|
771
|
+
* The call must be scoped to exactly one user: pass `user_id`, plus
|
|
772
|
+
* `customer_id` on a B2B instance. Otherwise the server answers 400, raised
|
|
773
|
+
* as `InvalidInputError`.
|
|
774
|
+
*
|
|
775
|
+
* Modes:
|
|
776
|
+
* - `"preview"` (default): files a pending request that a person approves in
|
|
777
|
+
* the dashboard under Deletion requests. Deletes nothing. `candidates`
|
|
778
|
+
* lists what matched.
|
|
779
|
+
* - `"direct"`: finds and soft-deletes in one call. Not idempotent as a
|
|
780
|
+
* request: a repeat is harmless and finds nothing new, but it is a new
|
|
781
|
+
* request.
|
|
782
|
+
*
|
|
783
|
+
* `status` is `"nothing_matches"`, `"preview"`, `"deleted"` or `"partial"`.
|
|
784
|
+
* `"partial"` means the memories are hidden but a store named in
|
|
785
|
+
* `still_present_in` may still hold the text, so do not tell an end user it
|
|
786
|
+
* was removed unless `status === "deleted"`. `failed_ids` lists memories that
|
|
787
|
+
* could not be deleted; `may_be_incomplete` is true when the match may not
|
|
788
|
+
* have covered everything.
|
|
789
|
+
*
|
|
790
|
+
* Errors: `InvalidInputError` for 400/422 or a bad `description`/`mode`
|
|
791
|
+
* caught before sending; `ServiceUnavailableError` for 503 (the matcher was
|
|
792
|
+
* unavailable and nothing was deleted, so trying again is safe; the
|
|
793
|
+
* transport applies its normal retry policy first); `RateLimitError` for 429.
|
|
794
|
+
*/
|
|
795
|
+
forget(options: ForgetOptions): Promise<ForgetResult>;
|
|
674
796
|
status(ingestionId: string): Promise<Json>;
|
|
675
797
|
wait_for_completion(ingestionId: string, options?: WaitOptions): Promise<Json>;
|
|
676
798
|
}
|
|
@@ -1384,6 +1506,8 @@ interface UnifiedFetchOptions {
|
|
|
1384
1506
|
precision_level?: string;
|
|
1385
1507
|
/** The moment the question is being asked. See FetchOptions.query_date. */
|
|
1386
1508
|
query_date?: string;
|
|
1509
|
+
/** A share of the response per search query. See FetchOptions.max_results_per_query. */
|
|
1510
|
+
max_results_per_query?: number;
|
|
1387
1511
|
include_conversation_context?: boolean;
|
|
1388
1512
|
scopes?: string[];
|
|
1389
1513
|
include_scope_labels?: boolean;
|
|
@@ -1554,7 +1678,7 @@ declare class SynapClient {
|
|
|
1554
1678
|
* build when the two disagree, which is the only thing that makes a manual
|
|
1555
1679
|
* publish safe.
|
|
1556
1680
|
*/
|
|
1557
|
-
declare const SDK_VERSION = "0.5.
|
|
1681
|
+
declare const SDK_VERSION = "0.5.7";
|
|
1558
1682
|
|
|
1559
1683
|
/**
|
|
1560
1684
|
* BM25 scorer for the anticipation cache.
|
|
@@ -1710,4 +1834,4 @@ interface SynapSdkLike {
|
|
|
1710
1834
|
};
|
|
1711
1835
|
}
|
|
1712
1836
|
|
|
1713
|
-
export { type AnthropicToolDefinition, AnticipationCacheSnapshot, type AsToolOptions, BM25, type BatchCreateResult, COMPACTION_LEVELS, CONTRACT, type CacheNamespace, type CacheStats, type CompactOptions, type CompactionCallback, type CompactionLevel, type ConfigureOptions, type ContextMetadata, type ConversationContext, type ConversationNamespace, type CreateFromFileOptions, type CreateMemoryOptions, type CreateMemoryResult, type Credentials, type CreditBalance, type CreditBucket, type CreditEstimate, type CreditLedgerEntry, type CreditLedgerPage, type CreditsNamespace, DEFAULT_BASE_URL, DEFAULT_DOCUMENT_TYPE, DEFAULT_INGEST_MODE, DEFAULT_RETRY_POLICY, DEFAULT_TIMEOUTS, DOCUMENT_TYPES, type DocumentType, ENDPOINTS, type Emotion, type EndpointName, type EndpointSpec, type Episode, type EstimateOptions, type Fact, type FetchOptions, type FlatMemory, type FormatOptions, HttpTransport, type HttpTransportOptions, INGEST_MODES, ITEM_COLLECTIONS, type IngestMode, type IngestTranscriptOptions, type InstanceNamespace, type ItemCollection, type Json, type LedgerOptions, type ListenOptions, type MemoriesInterface, type NormalisedContext, type OpenAiToolDefinition, type Preference, type RawContext, type RawContextItem, type RawConversationContext, type RecordMessageOptions, type RecordThinkingOptions, type RedeemResult, type RequestOptions, type RetryPolicy, SDK_VERSION, type Scope, type SendMessageOptions, SynapClient, type SynapClientOptions, type SynapLogLevel, type SynapLogger, type SynapSdkLike, THRESHOLDS, type TemporalEvent, type TemporalFields, type TimeoutConfig, type ToolDefinition, type ToolHandler, type ToolScope, type ToolStyle, type TranscriptIngestResult, type TranscriptTurn, type UnifiedContext, type UnifiedFetchOptions, type UpdateMemoryOptions, type UserNamespace, type WaitOptions, type WriteInvalidator, flattenContextItems, formatForPrompt, isOutcomeUnknown, isRecallQuery, mergeScopeResults, resolvePath, shouldRetry, stem, tokenize };
|
|
1837
|
+
export { type AnthropicToolDefinition, AnticipationCacheSnapshot, type AsToolOptions, BM25, type BatchCreateResult, COMPACTION_LEVELS, CONTRACT, type CacheNamespace, type CacheStats, type CompactOptions, type CompactionCallback, type CompactionLevel, type ConfigureOptions, type ContextMetadata, type ConversationContext, type ConversationNamespace, type CreateFromFileOptions, type CreateMemoryOptions, type CreateMemoryResult, type Credentials, type CreditBalance, type CreditBucket, type CreditEstimate, type CreditLedgerEntry, type CreditLedgerPage, type CreditsNamespace, DEFAULT_BASE_URL, DEFAULT_DOCUMENT_TYPE, DEFAULT_INGEST_MODE, DEFAULT_RETRY_POLICY, DEFAULT_TIMEOUTS, DOCUMENT_TYPES, type DocumentType, ENDPOINTS, type Emotion, type EndpointName, type EndpointSpec, type Episode, type EstimateOptions, FORGET_MODES, type Fact, type FetchOptions, type FlatMemory, type ForgetCandidate, type ForgetMode, type ForgetOptions, type ForgetResult, type ForgetStatus, type FormatOptions, HttpTransport, type HttpTransportOptions, INGEST_MODES, ITEM_COLLECTIONS, type IngestMode, type IngestTranscriptOptions, type InstanceNamespace, type ItemCollection, type Json, type LedgerOptions, type ListenOptions, type MemoriesInterface, type NormalisedContext, type OpenAiToolDefinition, type Preference, type RawContext, type RawContextItem, type RawConversationContext, type RecordMessageOptions, type RecordThinkingOptions, type RedeemResult, type RequestOptions, type RetryPolicy, SDK_VERSION, type Scope, type SendMessageOptions, SynapClient, type SynapClientOptions, type SynapLogLevel, type SynapLogger, type SynapSdkLike, THRESHOLDS, type TemporalEvent, type TemporalFields, type TimeoutConfig, type ToolDefinition, type ToolHandler, type ToolScope, type ToolStyle, type TranscriptIngestResult, type TranscriptTurn, type UnifiedContext, type UnifiedFetchOptions, type UpdateMemoryOptions, type UserNamespace, type WaitOptions, type WriteInvalidator, flattenContextItems, formatForPrompt, isOutcomeUnknown, isRecallQuery, mergeScopeResults, resolvePath, shouldRetry, stem, tokenize };
|
package/dist/index.d.ts
CHANGED
|
@@ -60,6 +60,11 @@ declare const ENDPOINTS: {
|
|
|
60
60
|
readonly path: "/api/v1/memories/{memory_id}";
|
|
61
61
|
readonly idempotent: true;
|
|
62
62
|
};
|
|
63
|
+
readonly memories_forget: {
|
|
64
|
+
readonly method: "POST";
|
|
65
|
+
readonly path: "/api/v1/memories/forget";
|
|
66
|
+
readonly idempotent: false;
|
|
67
|
+
};
|
|
63
68
|
readonly context_fetch_user: {
|
|
64
69
|
readonly method: "POST";
|
|
65
70
|
readonly path: "/v1/context/user/fetch";
|
|
@@ -369,9 +374,25 @@ interface RawContextItem {
|
|
|
369
374
|
extracted_at?: string | null;
|
|
370
375
|
metadata?: Json;
|
|
371
376
|
event_date?: string | null;
|
|
377
|
+
/**
|
|
378
|
+
* The day the words were SAID, which is not the day the event happened.
|
|
379
|
+
*
|
|
380
|
+
* `event_date` is empty unless somebody stated when the event took place, so
|
|
381
|
+
* without this field beside it an item whose turn stated no event date
|
|
382
|
+
* arrives with no machine-readable date at all. Empty when the client never
|
|
383
|
+
* told the server when the conversation happened; it is never the server's
|
|
384
|
+
* own ingest or extraction clock.
|
|
385
|
+
*/
|
|
386
|
+
said_at?: string | null;
|
|
372
387
|
valid_until?: string | null;
|
|
373
388
|
temporal_category?: string | null;
|
|
374
389
|
temporal_confidence?: number;
|
|
390
|
+
/**
|
|
391
|
+
* The search queries of the fetch that found this item, in the order they
|
|
392
|
+
* were sent. Absent from a server that predates the field, and on an item
|
|
393
|
+
* served from the prefetch cache.
|
|
394
|
+
*/
|
|
395
|
+
matched_queries?: string[];
|
|
375
396
|
[key: string]: unknown;
|
|
376
397
|
}
|
|
377
398
|
interface RawConversationContext {
|
|
@@ -398,11 +419,29 @@ interface RawContext {
|
|
|
398
419
|
}
|
|
399
420
|
interface TemporalFields {
|
|
400
421
|
eventDate: string | null;
|
|
422
|
+
/**
|
|
423
|
+
* The day the words were SAID, which is not the day the event happened.
|
|
424
|
+
*
|
|
425
|
+
* `event_date` is empty unless somebody stated when the event took place, so
|
|
426
|
+
* without this field beside it an item whose turn stated no event date
|
|
427
|
+
* arrives with no machine-readable date at all. Empty when the client never
|
|
428
|
+
* told the server when the conversation happened; it is never the server's
|
|
429
|
+
* own ingest or extraction clock.
|
|
430
|
+
*/
|
|
431
|
+
saidAt: string | null;
|
|
401
432
|
validUntil: string | null;
|
|
402
433
|
temporalCategory: string | null;
|
|
403
434
|
temporalConfidence: number;
|
|
404
435
|
}
|
|
405
|
-
|
|
436
|
+
/**
|
|
437
|
+
* Which of the fetch's search queries found an item. A fetch can carry several
|
|
438
|
+
* and returns one set for all of them. Always an array: empty when the fetch
|
|
439
|
+
* named no query or the server predates the field.
|
|
440
|
+
*/
|
|
441
|
+
interface QueryAttribution {
|
|
442
|
+
matchedQueries: string[];
|
|
443
|
+
}
|
|
444
|
+
interface Fact extends TemporalFields, QueryAttribution {
|
|
406
445
|
id: string;
|
|
407
446
|
content: string;
|
|
408
447
|
confidence: number;
|
|
@@ -410,7 +449,7 @@ interface Fact extends TemporalFields {
|
|
|
410
449
|
extractedAt: string | null;
|
|
411
450
|
metadata: Json;
|
|
412
451
|
}
|
|
413
|
-
interface Preference extends TemporalFields {
|
|
452
|
+
interface Preference extends TemporalFields, QueryAttribution {
|
|
414
453
|
id: string;
|
|
415
454
|
category: string;
|
|
416
455
|
content: string;
|
|
@@ -419,7 +458,7 @@ interface Preference extends TemporalFields {
|
|
|
419
458
|
extractedAt: string | null;
|
|
420
459
|
metadata: Json;
|
|
421
460
|
}
|
|
422
|
-
interface Episode extends TemporalFields {
|
|
461
|
+
interface Episode extends TemporalFields, QueryAttribution {
|
|
423
462
|
id: string;
|
|
424
463
|
summary: string;
|
|
425
464
|
occurredAt: string | null;
|
|
@@ -427,7 +466,7 @@ interface Episode extends TemporalFields {
|
|
|
427
466
|
participants: unknown[];
|
|
428
467
|
metadata: Json;
|
|
429
468
|
}
|
|
430
|
-
interface Emotion extends TemporalFields {
|
|
469
|
+
interface Emotion extends TemporalFields, QueryAttribution {
|
|
431
470
|
id: string;
|
|
432
471
|
emotionType: string;
|
|
433
472
|
intensity: number;
|
|
@@ -435,10 +474,12 @@ interface Emotion extends TemporalFields {
|
|
|
435
474
|
context: string;
|
|
436
475
|
metadata: Json;
|
|
437
476
|
}
|
|
438
|
-
interface TemporalEvent {
|
|
477
|
+
interface TemporalEvent extends QueryAttribution {
|
|
439
478
|
id: string;
|
|
440
479
|
content: string;
|
|
441
480
|
eventDate: string | null;
|
|
481
|
+
/** See the note on `TemporalFields.saidAt`. */
|
|
482
|
+
saidAt: string | null;
|
|
442
483
|
validUntil: string | null;
|
|
443
484
|
/**
|
|
444
485
|
* Nullable despite the `''` default in the normaliser: `pickDefined` skips
|
|
@@ -516,6 +557,18 @@ interface FetchOptions {
|
|
|
516
557
|
*/
|
|
517
558
|
query_date?: string;
|
|
518
559
|
queryDate?: string;
|
|
560
|
+
/**
|
|
561
|
+
* How many items each search query may contribute when `search_query` holds
|
|
562
|
+
* more than one, so a query with many strong matches cannot take every
|
|
563
|
+
* place. `max_results` stays the ceiling on the whole response: three
|
|
564
|
+
* queries at five each under `max_results: 10` return ten.
|
|
565
|
+
*
|
|
566
|
+
* Sent only when provided, like `query_date`. Left out, or with one query,
|
|
567
|
+
* the response is the best `max_results` items overall, as before. `0` is
|
|
568
|
+
* treated as left out.
|
|
569
|
+
*/
|
|
570
|
+
max_results_per_query?: number;
|
|
571
|
+
maxResultsPerQuery?: number;
|
|
519
572
|
/** Sent only when explicitly false, matching the Python controllers. */
|
|
520
573
|
include_conversation_context?: boolean;
|
|
521
574
|
/**
|
|
@@ -564,6 +617,8 @@ interface FlatMemory {
|
|
|
564
617
|
metadata: Json;
|
|
565
618
|
context_type: 'fact' | 'preference' | 'episode' | 'emotion' | 'temporal_event';
|
|
566
619
|
event_date: string | null;
|
|
620
|
+
/** See `TemporalFields.saidAt` in ./types. */
|
|
621
|
+
said_at: string | null;
|
|
567
622
|
valid_until: string | null;
|
|
568
623
|
temporal_category: string | null;
|
|
569
624
|
temporal_confidence: number;
|
|
@@ -664,6 +719,44 @@ interface BatchCreateOptions {
|
|
|
664
719
|
fail_fast?: boolean;
|
|
665
720
|
failFast?: boolean;
|
|
666
721
|
}
|
|
722
|
+
/** Mirrors the Python ForgetMode enum. */
|
|
723
|
+
declare const FORGET_MODES: readonly ["preview", "direct"];
|
|
724
|
+
type ForgetMode = (typeof FORGET_MODES)[number];
|
|
725
|
+
interface ForgetOptions {
|
|
726
|
+
/** What to forget, in the user's own words (3 to 500 characters). */
|
|
727
|
+
description: string;
|
|
728
|
+
user_id?: string | null;
|
|
729
|
+
userId?: string | null;
|
|
730
|
+
customer_id?: string | null;
|
|
731
|
+
customerId?: string | null;
|
|
732
|
+
/**
|
|
733
|
+
* The level to search, named in full, one entry per level down to it:
|
|
734
|
+
* `{ customer: "acme", team: "payments", user: "dana" }`. Only needed when
|
|
735
|
+
* your scope ladder has a level between customer and user.
|
|
736
|
+
*/
|
|
737
|
+
scope?: Record<string, string> | null;
|
|
738
|
+
/** `"preview"` (default) or `"direct"`. See `MemoriesInterface.forget`. */
|
|
739
|
+
mode?: ForgetMode | string;
|
|
740
|
+
}
|
|
741
|
+
/** A memory the description matched. Mirrors Python's `ForgetCandidate`. */
|
|
742
|
+
interface ForgetCandidate {
|
|
743
|
+
memory_id: string;
|
|
744
|
+
content: string;
|
|
745
|
+
memory_type?: string | null;
|
|
746
|
+
/** `"memory"`, or where a copy lives: chunk, sentence, entity, triple, profile, candidate. */
|
|
747
|
+
store?: string;
|
|
748
|
+
}
|
|
749
|
+
type ForgetStatus = 'nothing_matches' | 'preview' | 'deleted' | 'partial';
|
|
750
|
+
/** Result of `memories.forget`. Mirrors Python's `ForgetResponse`. */
|
|
751
|
+
interface ForgetResult {
|
|
752
|
+
status: ForgetStatus;
|
|
753
|
+
request_id: string | null;
|
|
754
|
+
candidates: ForgetCandidate[];
|
|
755
|
+
deleted_ids: string[];
|
|
756
|
+
failed_ids: string[];
|
|
757
|
+
still_present_in: string[];
|
|
758
|
+
may_be_incomplete: boolean;
|
|
759
|
+
}
|
|
667
760
|
interface MemoriesInterface {
|
|
668
761
|
create(options: CreateMemoryOptions): Promise<CreateMemoryResult>;
|
|
669
762
|
batch_create(options: BatchCreateOptions): Promise<BatchCreateResult>;
|
|
@@ -671,6 +764,35 @@ interface MemoriesInterface {
|
|
|
671
764
|
get(memoryId: string): Promise<Json>;
|
|
672
765
|
update(options: UpdateMemoryOptions): Promise<Json>;
|
|
673
766
|
delete(memoryId: string): Promise<Json>;
|
|
767
|
+
/**
|
|
768
|
+
* Forget memories by describing them in the user's own words. Use it when
|
|
769
|
+
* you do not hold memory ids; to delete one memory by id, use `delete()`.
|
|
770
|
+
*
|
|
771
|
+
* The call must be scoped to exactly one user: pass `user_id`, plus
|
|
772
|
+
* `customer_id` on a B2B instance. Otherwise the server answers 400, raised
|
|
773
|
+
* as `InvalidInputError`.
|
|
774
|
+
*
|
|
775
|
+
* Modes:
|
|
776
|
+
* - `"preview"` (default): files a pending request that a person approves in
|
|
777
|
+
* the dashboard under Deletion requests. Deletes nothing. `candidates`
|
|
778
|
+
* lists what matched.
|
|
779
|
+
* - `"direct"`: finds and soft-deletes in one call. Not idempotent as a
|
|
780
|
+
* request: a repeat is harmless and finds nothing new, but it is a new
|
|
781
|
+
* request.
|
|
782
|
+
*
|
|
783
|
+
* `status` is `"nothing_matches"`, `"preview"`, `"deleted"` or `"partial"`.
|
|
784
|
+
* `"partial"` means the memories are hidden but a store named in
|
|
785
|
+
* `still_present_in` may still hold the text, so do not tell an end user it
|
|
786
|
+
* was removed unless `status === "deleted"`. `failed_ids` lists memories that
|
|
787
|
+
* could not be deleted; `may_be_incomplete` is true when the match may not
|
|
788
|
+
* have covered everything.
|
|
789
|
+
*
|
|
790
|
+
* Errors: `InvalidInputError` for 400/422 or a bad `description`/`mode`
|
|
791
|
+
* caught before sending; `ServiceUnavailableError` for 503 (the matcher was
|
|
792
|
+
* unavailable and nothing was deleted, so trying again is safe; the
|
|
793
|
+
* transport applies its normal retry policy first); `RateLimitError` for 429.
|
|
794
|
+
*/
|
|
795
|
+
forget(options: ForgetOptions): Promise<ForgetResult>;
|
|
674
796
|
status(ingestionId: string): Promise<Json>;
|
|
675
797
|
wait_for_completion(ingestionId: string, options?: WaitOptions): Promise<Json>;
|
|
676
798
|
}
|
|
@@ -1384,6 +1506,8 @@ interface UnifiedFetchOptions {
|
|
|
1384
1506
|
precision_level?: string;
|
|
1385
1507
|
/** The moment the question is being asked. See FetchOptions.query_date. */
|
|
1386
1508
|
query_date?: string;
|
|
1509
|
+
/** A share of the response per search query. See FetchOptions.max_results_per_query. */
|
|
1510
|
+
max_results_per_query?: number;
|
|
1387
1511
|
include_conversation_context?: boolean;
|
|
1388
1512
|
scopes?: string[];
|
|
1389
1513
|
include_scope_labels?: boolean;
|
|
@@ -1554,7 +1678,7 @@ declare class SynapClient {
|
|
|
1554
1678
|
* build when the two disagree, which is the only thing that makes a manual
|
|
1555
1679
|
* publish safe.
|
|
1556
1680
|
*/
|
|
1557
|
-
declare const SDK_VERSION = "0.5.
|
|
1681
|
+
declare const SDK_VERSION = "0.5.7";
|
|
1558
1682
|
|
|
1559
1683
|
/**
|
|
1560
1684
|
* BM25 scorer for the anticipation cache.
|
|
@@ -1710,4 +1834,4 @@ interface SynapSdkLike {
|
|
|
1710
1834
|
};
|
|
1711
1835
|
}
|
|
1712
1836
|
|
|
1713
|
-
export { type AnthropicToolDefinition, AnticipationCacheSnapshot, type AsToolOptions, BM25, type BatchCreateResult, COMPACTION_LEVELS, CONTRACT, type CacheNamespace, type CacheStats, type CompactOptions, type CompactionCallback, type CompactionLevel, type ConfigureOptions, type ContextMetadata, type ConversationContext, type ConversationNamespace, type CreateFromFileOptions, type CreateMemoryOptions, type CreateMemoryResult, type Credentials, type CreditBalance, type CreditBucket, type CreditEstimate, type CreditLedgerEntry, type CreditLedgerPage, type CreditsNamespace, DEFAULT_BASE_URL, DEFAULT_DOCUMENT_TYPE, DEFAULT_INGEST_MODE, DEFAULT_RETRY_POLICY, DEFAULT_TIMEOUTS, DOCUMENT_TYPES, type DocumentType, ENDPOINTS, type Emotion, type EndpointName, type EndpointSpec, type Episode, type EstimateOptions, type Fact, type FetchOptions, type FlatMemory, type FormatOptions, HttpTransport, type HttpTransportOptions, INGEST_MODES, ITEM_COLLECTIONS, type IngestMode, type IngestTranscriptOptions, type InstanceNamespace, type ItemCollection, type Json, type LedgerOptions, type ListenOptions, type MemoriesInterface, type NormalisedContext, type OpenAiToolDefinition, type Preference, type RawContext, type RawContextItem, type RawConversationContext, type RecordMessageOptions, type RecordThinkingOptions, type RedeemResult, type RequestOptions, type RetryPolicy, SDK_VERSION, type Scope, type SendMessageOptions, SynapClient, type SynapClientOptions, type SynapLogLevel, type SynapLogger, type SynapSdkLike, THRESHOLDS, type TemporalEvent, type TemporalFields, type TimeoutConfig, type ToolDefinition, type ToolHandler, type ToolScope, type ToolStyle, type TranscriptIngestResult, type TranscriptTurn, type UnifiedContext, type UnifiedFetchOptions, type UpdateMemoryOptions, type UserNamespace, type WaitOptions, type WriteInvalidator, flattenContextItems, formatForPrompt, isOutcomeUnknown, isRecallQuery, mergeScopeResults, resolvePath, shouldRetry, stem, tokenize };
|
|
1837
|
+
export { type AnthropicToolDefinition, AnticipationCacheSnapshot, type AsToolOptions, BM25, type BatchCreateResult, COMPACTION_LEVELS, CONTRACT, type CacheNamespace, type CacheStats, type CompactOptions, type CompactionCallback, type CompactionLevel, type ConfigureOptions, type ContextMetadata, type ConversationContext, type ConversationNamespace, type CreateFromFileOptions, type CreateMemoryOptions, type CreateMemoryResult, type Credentials, type CreditBalance, type CreditBucket, type CreditEstimate, type CreditLedgerEntry, type CreditLedgerPage, type CreditsNamespace, DEFAULT_BASE_URL, DEFAULT_DOCUMENT_TYPE, DEFAULT_INGEST_MODE, DEFAULT_RETRY_POLICY, DEFAULT_TIMEOUTS, DOCUMENT_TYPES, type DocumentType, ENDPOINTS, type Emotion, type EndpointName, type EndpointSpec, type Episode, type EstimateOptions, FORGET_MODES, type Fact, type FetchOptions, type FlatMemory, type ForgetCandidate, type ForgetMode, type ForgetOptions, type ForgetResult, type ForgetStatus, type FormatOptions, HttpTransport, type HttpTransportOptions, INGEST_MODES, ITEM_COLLECTIONS, type IngestMode, type IngestTranscriptOptions, type InstanceNamespace, type ItemCollection, type Json, type LedgerOptions, type ListenOptions, type MemoriesInterface, type NormalisedContext, type OpenAiToolDefinition, type Preference, type RawContext, type RawContextItem, type RawConversationContext, type RecordMessageOptions, type RecordThinkingOptions, type RedeemResult, type RequestOptions, type RetryPolicy, SDK_VERSION, type Scope, type SendMessageOptions, SynapClient, type SynapClientOptions, type SynapLogLevel, type SynapLogger, type SynapSdkLike, THRESHOLDS, type TemporalEvent, type TemporalFields, type TimeoutConfig, type ToolDefinition, type ToolHandler, type ToolScope, type ToolStyle, type TranscriptIngestResult, type TranscriptTurn, type UnifiedContext, type UnifiedFetchOptions, type UpdateMemoryOptions, type UserNamespace, type WaitOptions, type WriteInvalidator, flattenContextItems, formatForPrompt, isOutcomeUnknown, isRecallQuery, mergeScopeResults, resolvePath, shouldRetry, stem, tokenize };
|