@maximem/synap-js-sdk 0.5.2 → 0.5.6
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/anticipation-cache-LRE3TLK4.cjs.map +1 -1
- package/dist/{chunk-DJPYUPSV.js → chunk-RP4YOEUN.js} +6 -2
- package/dist/chunk-RP4YOEUN.js.map +1 -0
- package/dist/chunk-T372OL3Q.cjs.map +1 -1
- package/dist/chunk-T6U5PVAD.cjs.map +1 -1
- package/dist/{chunk-WWTGJZA7.cjs → chunk-WE4QSR6A.cjs} +6 -2
- package/dist/chunk-WE4QSR6A.cjs.map +1 -0
- package/dist/chunk-ZKOJDUN4.cjs.map +1 -1
- package/dist/env-55ULHNJZ.cjs.map +1 -1
- package/dist/grpc/index.cjs +3 -3
- package/dist/grpc/index.cjs.map +1 -1
- 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 +131 -37
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +124 -7
- package/dist/index.d.ts +124 -7
- package/dist/index.js +107 -13
- package/dist/index.js.map +1 -1
- package/dist/stream-client-A6IO6E47.cjs +16 -0
- package/dist/stream-client-A6IO6E47.cjs.map +1 -0
- package/dist/{stream-client-5CGJNTH4.js → stream-client-Y5NFAMIH.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-GJM4YSXW.cjs.map +0 -1
- /package/dist/{stream-client-5CGJNTH4.js.map → stream-client-Y5NFAMIH.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";
|
|
@@ -372,6 +377,12 @@ interface RawContextItem {
|
|
|
372
377
|
valid_until?: string | null;
|
|
373
378
|
temporal_category?: string | null;
|
|
374
379
|
temporal_confidence?: number;
|
|
380
|
+
/**
|
|
381
|
+
* The search queries of the fetch that found this item, in the order they
|
|
382
|
+
* were sent. Absent from a server that predates the field, and on an item
|
|
383
|
+
* served from the prefetch cache.
|
|
384
|
+
*/
|
|
385
|
+
matched_queries?: string[];
|
|
375
386
|
[key: string]: unknown;
|
|
376
387
|
}
|
|
377
388
|
interface RawConversationContext {
|
|
@@ -402,7 +413,15 @@ interface TemporalFields {
|
|
|
402
413
|
temporalCategory: string | null;
|
|
403
414
|
temporalConfidence: number;
|
|
404
415
|
}
|
|
405
|
-
|
|
416
|
+
/**
|
|
417
|
+
* Which of the fetch's search queries found an item. A fetch can carry several
|
|
418
|
+
* and returns one set for all of them. Always an array: empty when the fetch
|
|
419
|
+
* named no query or the server predates the field.
|
|
420
|
+
*/
|
|
421
|
+
interface QueryAttribution {
|
|
422
|
+
matchedQueries: string[];
|
|
423
|
+
}
|
|
424
|
+
interface Fact extends TemporalFields, QueryAttribution {
|
|
406
425
|
id: string;
|
|
407
426
|
content: string;
|
|
408
427
|
confidence: number;
|
|
@@ -410,7 +429,7 @@ interface Fact extends TemporalFields {
|
|
|
410
429
|
extractedAt: string | null;
|
|
411
430
|
metadata: Json;
|
|
412
431
|
}
|
|
413
|
-
interface Preference extends TemporalFields {
|
|
432
|
+
interface Preference extends TemporalFields, QueryAttribution {
|
|
414
433
|
id: string;
|
|
415
434
|
category: string;
|
|
416
435
|
content: string;
|
|
@@ -419,7 +438,7 @@ interface Preference extends TemporalFields {
|
|
|
419
438
|
extractedAt: string | null;
|
|
420
439
|
metadata: Json;
|
|
421
440
|
}
|
|
422
|
-
interface Episode extends TemporalFields {
|
|
441
|
+
interface Episode extends TemporalFields, QueryAttribution {
|
|
423
442
|
id: string;
|
|
424
443
|
summary: string;
|
|
425
444
|
occurredAt: string | null;
|
|
@@ -427,7 +446,7 @@ interface Episode extends TemporalFields {
|
|
|
427
446
|
participants: unknown[];
|
|
428
447
|
metadata: Json;
|
|
429
448
|
}
|
|
430
|
-
interface Emotion extends TemporalFields {
|
|
449
|
+
interface Emotion extends TemporalFields, QueryAttribution {
|
|
431
450
|
id: string;
|
|
432
451
|
emotionType: string;
|
|
433
452
|
intensity: number;
|
|
@@ -435,7 +454,7 @@ interface Emotion extends TemporalFields {
|
|
|
435
454
|
context: string;
|
|
436
455
|
metadata: Json;
|
|
437
456
|
}
|
|
438
|
-
interface TemporalEvent {
|
|
457
|
+
interface TemporalEvent extends QueryAttribution {
|
|
439
458
|
id: string;
|
|
440
459
|
content: string;
|
|
441
460
|
eventDate: string | null;
|
|
@@ -501,6 +520,33 @@ interface FetchOptions {
|
|
|
501
520
|
mode?: string;
|
|
502
521
|
precision_level?: string;
|
|
503
522
|
precisionLevel?: string;
|
|
523
|
+
/**
|
|
524
|
+
* The moment the question is being asked, so the server can resolve a period
|
|
525
|
+
* the question names ("in March", "two months ago") instead of counting back
|
|
526
|
+
* from now.
|
|
527
|
+
*
|
|
528
|
+
* Sent only when provided, like `precision_level`: the golden payloads in
|
|
529
|
+
* CONTRACT/conformance/request_payloads.json are byte-for-byte, so an
|
|
530
|
+
* always-present key would break every existing case.
|
|
531
|
+
*
|
|
532
|
+
* Lenient on the server: `"2023-03-11"`, `"2023/03/11 21:26"` and
|
|
533
|
+
* `"2023/03/11 (Sat) 21:26"` all parse, and anything unreadable falls back to
|
|
534
|
+
* now with a warning rather than failing the read.
|
|
535
|
+
*/
|
|
536
|
+
query_date?: string;
|
|
537
|
+
queryDate?: string;
|
|
538
|
+
/**
|
|
539
|
+
* How many items each search query may contribute when `search_query` holds
|
|
540
|
+
* more than one, so a query with many strong matches cannot take every
|
|
541
|
+
* place. `max_results` stays the ceiling on the whole response: three
|
|
542
|
+
* queries at five each under `max_results: 10` return ten.
|
|
543
|
+
*
|
|
544
|
+
* Sent only when provided, like `query_date`. Left out, or with one query,
|
|
545
|
+
* the response is the best `max_results` items overall, as before. `0` is
|
|
546
|
+
* treated as left out.
|
|
547
|
+
*/
|
|
548
|
+
max_results_per_query?: number;
|
|
549
|
+
maxResultsPerQuery?: number;
|
|
504
550
|
/** Sent only when explicitly false, matching the Python controllers. */
|
|
505
551
|
include_conversation_context?: boolean;
|
|
506
552
|
/**
|
|
@@ -649,6 +695,44 @@ interface BatchCreateOptions {
|
|
|
649
695
|
fail_fast?: boolean;
|
|
650
696
|
failFast?: boolean;
|
|
651
697
|
}
|
|
698
|
+
/** Mirrors the Python ForgetMode enum. */
|
|
699
|
+
declare const FORGET_MODES: readonly ["preview", "direct"];
|
|
700
|
+
type ForgetMode = (typeof FORGET_MODES)[number];
|
|
701
|
+
interface ForgetOptions {
|
|
702
|
+
/** What to forget, in the user's own words (3 to 500 characters). */
|
|
703
|
+
description: string;
|
|
704
|
+
user_id?: string | null;
|
|
705
|
+
userId?: string | null;
|
|
706
|
+
customer_id?: string | null;
|
|
707
|
+
customerId?: string | null;
|
|
708
|
+
/**
|
|
709
|
+
* The level to search, named in full, one entry per level down to it:
|
|
710
|
+
* `{ customer: "acme", team: "payments", user: "dana" }`. Only needed when
|
|
711
|
+
* your scope ladder has a level between customer and user.
|
|
712
|
+
*/
|
|
713
|
+
scope?: Record<string, string> | null;
|
|
714
|
+
/** `"preview"` (default) or `"direct"`. See `MemoriesInterface.forget`. */
|
|
715
|
+
mode?: ForgetMode | string;
|
|
716
|
+
}
|
|
717
|
+
/** A memory the description matched. Mirrors Python's `ForgetCandidate`. */
|
|
718
|
+
interface ForgetCandidate {
|
|
719
|
+
memory_id: string;
|
|
720
|
+
content: string;
|
|
721
|
+
memory_type?: string | null;
|
|
722
|
+
/** `"memory"`, or where a copy lives: chunk, sentence, entity, triple, profile, candidate. */
|
|
723
|
+
store?: string;
|
|
724
|
+
}
|
|
725
|
+
type ForgetStatus = 'nothing_matches' | 'preview' | 'deleted' | 'partial';
|
|
726
|
+
/** Result of `memories.forget`. Mirrors Python's `ForgetResponse`. */
|
|
727
|
+
interface ForgetResult {
|
|
728
|
+
status: ForgetStatus;
|
|
729
|
+
request_id: string | null;
|
|
730
|
+
candidates: ForgetCandidate[];
|
|
731
|
+
deleted_ids: string[];
|
|
732
|
+
failed_ids: string[];
|
|
733
|
+
still_present_in: string[];
|
|
734
|
+
may_be_incomplete: boolean;
|
|
735
|
+
}
|
|
652
736
|
interface MemoriesInterface {
|
|
653
737
|
create(options: CreateMemoryOptions): Promise<CreateMemoryResult>;
|
|
654
738
|
batch_create(options: BatchCreateOptions): Promise<BatchCreateResult>;
|
|
@@ -656,6 +740,35 @@ interface MemoriesInterface {
|
|
|
656
740
|
get(memoryId: string): Promise<Json>;
|
|
657
741
|
update(options: UpdateMemoryOptions): Promise<Json>;
|
|
658
742
|
delete(memoryId: string): Promise<Json>;
|
|
743
|
+
/**
|
|
744
|
+
* Forget memories by describing them in the user's own words. Use it when
|
|
745
|
+
* you do not hold memory ids; to delete one memory by id, use `delete()`.
|
|
746
|
+
*
|
|
747
|
+
* The call must be scoped to exactly one user: pass `user_id`, plus
|
|
748
|
+
* `customer_id` on a B2B instance. Otherwise the server answers 400, raised
|
|
749
|
+
* as `InvalidInputError`.
|
|
750
|
+
*
|
|
751
|
+
* Modes:
|
|
752
|
+
* - `"preview"` (default): files a pending request that a person approves in
|
|
753
|
+
* the dashboard under Deletion requests. Deletes nothing. `candidates`
|
|
754
|
+
* lists what matched.
|
|
755
|
+
* - `"direct"`: finds and soft-deletes in one call. Not idempotent as a
|
|
756
|
+
* request: a repeat is harmless and finds nothing new, but it is a new
|
|
757
|
+
* request.
|
|
758
|
+
*
|
|
759
|
+
* `status` is `"nothing_matches"`, `"preview"`, `"deleted"` or `"partial"`.
|
|
760
|
+
* `"partial"` means the memories are hidden but a store named in
|
|
761
|
+
* `still_present_in` may still hold the text, so do not tell an end user it
|
|
762
|
+
* was removed unless `status === "deleted"`. `failed_ids` lists memories that
|
|
763
|
+
* could not be deleted; `may_be_incomplete` is true when the match may not
|
|
764
|
+
* have covered everything.
|
|
765
|
+
*
|
|
766
|
+
* Errors: `InvalidInputError` for 400/422 or a bad `description`/`mode`
|
|
767
|
+
* caught before sending; `ServiceUnavailableError` for 503 (the matcher was
|
|
768
|
+
* unavailable and nothing was deleted, so trying again is safe; the
|
|
769
|
+
* transport applies its normal retry policy first); `RateLimitError` for 429.
|
|
770
|
+
*/
|
|
771
|
+
forget(options: ForgetOptions): Promise<ForgetResult>;
|
|
659
772
|
status(ingestionId: string): Promise<Json>;
|
|
660
773
|
wait_for_completion(ingestionId: string, options?: WaitOptions): Promise<Json>;
|
|
661
774
|
}
|
|
@@ -1367,6 +1480,10 @@ interface UnifiedFetchOptions {
|
|
|
1367
1480
|
types?: string[];
|
|
1368
1481
|
mode?: string;
|
|
1369
1482
|
precision_level?: string;
|
|
1483
|
+
/** The moment the question is being asked. See FetchOptions.query_date. */
|
|
1484
|
+
query_date?: string;
|
|
1485
|
+
/** A share of the response per search query. See FetchOptions.max_results_per_query. */
|
|
1486
|
+
max_results_per_query?: number;
|
|
1370
1487
|
include_conversation_context?: boolean;
|
|
1371
1488
|
scopes?: string[];
|
|
1372
1489
|
include_scope_labels?: boolean;
|
|
@@ -1537,7 +1654,7 @@ declare class SynapClient {
|
|
|
1537
1654
|
* build when the two disagree, which is the only thing that makes a manual
|
|
1538
1655
|
* publish safe.
|
|
1539
1656
|
*/
|
|
1540
|
-
declare const SDK_VERSION = "0.5.
|
|
1657
|
+
declare const SDK_VERSION = "0.5.6";
|
|
1541
1658
|
|
|
1542
1659
|
/**
|
|
1543
1660
|
* BM25 scorer for the anticipation cache.
|
|
@@ -1693,4 +1810,4 @@ interface SynapSdkLike {
|
|
|
1693
1810
|
};
|
|
1694
1811
|
}
|
|
1695
1812
|
|
|
1696
|
-
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 };
|
|
1813
|
+
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";
|
|
@@ -372,6 +377,12 @@ interface RawContextItem {
|
|
|
372
377
|
valid_until?: string | null;
|
|
373
378
|
temporal_category?: string | null;
|
|
374
379
|
temporal_confidence?: number;
|
|
380
|
+
/**
|
|
381
|
+
* The search queries of the fetch that found this item, in the order they
|
|
382
|
+
* were sent. Absent from a server that predates the field, and on an item
|
|
383
|
+
* served from the prefetch cache.
|
|
384
|
+
*/
|
|
385
|
+
matched_queries?: string[];
|
|
375
386
|
[key: string]: unknown;
|
|
376
387
|
}
|
|
377
388
|
interface RawConversationContext {
|
|
@@ -402,7 +413,15 @@ interface TemporalFields {
|
|
|
402
413
|
temporalCategory: string | null;
|
|
403
414
|
temporalConfidence: number;
|
|
404
415
|
}
|
|
405
|
-
|
|
416
|
+
/**
|
|
417
|
+
* Which of the fetch's search queries found an item. A fetch can carry several
|
|
418
|
+
* and returns one set for all of them. Always an array: empty when the fetch
|
|
419
|
+
* named no query or the server predates the field.
|
|
420
|
+
*/
|
|
421
|
+
interface QueryAttribution {
|
|
422
|
+
matchedQueries: string[];
|
|
423
|
+
}
|
|
424
|
+
interface Fact extends TemporalFields, QueryAttribution {
|
|
406
425
|
id: string;
|
|
407
426
|
content: string;
|
|
408
427
|
confidence: number;
|
|
@@ -410,7 +429,7 @@ interface Fact extends TemporalFields {
|
|
|
410
429
|
extractedAt: string | null;
|
|
411
430
|
metadata: Json;
|
|
412
431
|
}
|
|
413
|
-
interface Preference extends TemporalFields {
|
|
432
|
+
interface Preference extends TemporalFields, QueryAttribution {
|
|
414
433
|
id: string;
|
|
415
434
|
category: string;
|
|
416
435
|
content: string;
|
|
@@ -419,7 +438,7 @@ interface Preference extends TemporalFields {
|
|
|
419
438
|
extractedAt: string | null;
|
|
420
439
|
metadata: Json;
|
|
421
440
|
}
|
|
422
|
-
interface Episode extends TemporalFields {
|
|
441
|
+
interface Episode extends TemporalFields, QueryAttribution {
|
|
423
442
|
id: string;
|
|
424
443
|
summary: string;
|
|
425
444
|
occurredAt: string | null;
|
|
@@ -427,7 +446,7 @@ interface Episode extends TemporalFields {
|
|
|
427
446
|
participants: unknown[];
|
|
428
447
|
metadata: Json;
|
|
429
448
|
}
|
|
430
|
-
interface Emotion extends TemporalFields {
|
|
449
|
+
interface Emotion extends TemporalFields, QueryAttribution {
|
|
431
450
|
id: string;
|
|
432
451
|
emotionType: string;
|
|
433
452
|
intensity: number;
|
|
@@ -435,7 +454,7 @@ interface Emotion extends TemporalFields {
|
|
|
435
454
|
context: string;
|
|
436
455
|
metadata: Json;
|
|
437
456
|
}
|
|
438
|
-
interface TemporalEvent {
|
|
457
|
+
interface TemporalEvent extends QueryAttribution {
|
|
439
458
|
id: string;
|
|
440
459
|
content: string;
|
|
441
460
|
eventDate: string | null;
|
|
@@ -501,6 +520,33 @@ interface FetchOptions {
|
|
|
501
520
|
mode?: string;
|
|
502
521
|
precision_level?: string;
|
|
503
522
|
precisionLevel?: string;
|
|
523
|
+
/**
|
|
524
|
+
* The moment the question is being asked, so the server can resolve a period
|
|
525
|
+
* the question names ("in March", "two months ago") instead of counting back
|
|
526
|
+
* from now.
|
|
527
|
+
*
|
|
528
|
+
* Sent only when provided, like `precision_level`: the golden payloads in
|
|
529
|
+
* CONTRACT/conformance/request_payloads.json are byte-for-byte, so an
|
|
530
|
+
* always-present key would break every existing case.
|
|
531
|
+
*
|
|
532
|
+
* Lenient on the server: `"2023-03-11"`, `"2023/03/11 21:26"` and
|
|
533
|
+
* `"2023/03/11 (Sat) 21:26"` all parse, and anything unreadable falls back to
|
|
534
|
+
* now with a warning rather than failing the read.
|
|
535
|
+
*/
|
|
536
|
+
query_date?: string;
|
|
537
|
+
queryDate?: string;
|
|
538
|
+
/**
|
|
539
|
+
* How many items each search query may contribute when `search_query` holds
|
|
540
|
+
* more than one, so a query with many strong matches cannot take every
|
|
541
|
+
* place. `max_results` stays the ceiling on the whole response: three
|
|
542
|
+
* queries at five each under `max_results: 10` return ten.
|
|
543
|
+
*
|
|
544
|
+
* Sent only when provided, like `query_date`. Left out, or with one query,
|
|
545
|
+
* the response is the best `max_results` items overall, as before. `0` is
|
|
546
|
+
* treated as left out.
|
|
547
|
+
*/
|
|
548
|
+
max_results_per_query?: number;
|
|
549
|
+
maxResultsPerQuery?: number;
|
|
504
550
|
/** Sent only when explicitly false, matching the Python controllers. */
|
|
505
551
|
include_conversation_context?: boolean;
|
|
506
552
|
/**
|
|
@@ -649,6 +695,44 @@ interface BatchCreateOptions {
|
|
|
649
695
|
fail_fast?: boolean;
|
|
650
696
|
failFast?: boolean;
|
|
651
697
|
}
|
|
698
|
+
/** Mirrors the Python ForgetMode enum. */
|
|
699
|
+
declare const FORGET_MODES: readonly ["preview", "direct"];
|
|
700
|
+
type ForgetMode = (typeof FORGET_MODES)[number];
|
|
701
|
+
interface ForgetOptions {
|
|
702
|
+
/** What to forget, in the user's own words (3 to 500 characters). */
|
|
703
|
+
description: string;
|
|
704
|
+
user_id?: string | null;
|
|
705
|
+
userId?: string | null;
|
|
706
|
+
customer_id?: string | null;
|
|
707
|
+
customerId?: string | null;
|
|
708
|
+
/**
|
|
709
|
+
* The level to search, named in full, one entry per level down to it:
|
|
710
|
+
* `{ customer: "acme", team: "payments", user: "dana" }`. Only needed when
|
|
711
|
+
* your scope ladder has a level between customer and user.
|
|
712
|
+
*/
|
|
713
|
+
scope?: Record<string, string> | null;
|
|
714
|
+
/** `"preview"` (default) or `"direct"`. See `MemoriesInterface.forget`. */
|
|
715
|
+
mode?: ForgetMode | string;
|
|
716
|
+
}
|
|
717
|
+
/** A memory the description matched. Mirrors Python's `ForgetCandidate`. */
|
|
718
|
+
interface ForgetCandidate {
|
|
719
|
+
memory_id: string;
|
|
720
|
+
content: string;
|
|
721
|
+
memory_type?: string | null;
|
|
722
|
+
/** `"memory"`, or where a copy lives: chunk, sentence, entity, triple, profile, candidate. */
|
|
723
|
+
store?: string;
|
|
724
|
+
}
|
|
725
|
+
type ForgetStatus = 'nothing_matches' | 'preview' | 'deleted' | 'partial';
|
|
726
|
+
/** Result of `memories.forget`. Mirrors Python's `ForgetResponse`. */
|
|
727
|
+
interface ForgetResult {
|
|
728
|
+
status: ForgetStatus;
|
|
729
|
+
request_id: string | null;
|
|
730
|
+
candidates: ForgetCandidate[];
|
|
731
|
+
deleted_ids: string[];
|
|
732
|
+
failed_ids: string[];
|
|
733
|
+
still_present_in: string[];
|
|
734
|
+
may_be_incomplete: boolean;
|
|
735
|
+
}
|
|
652
736
|
interface MemoriesInterface {
|
|
653
737
|
create(options: CreateMemoryOptions): Promise<CreateMemoryResult>;
|
|
654
738
|
batch_create(options: BatchCreateOptions): Promise<BatchCreateResult>;
|
|
@@ -656,6 +740,35 @@ interface MemoriesInterface {
|
|
|
656
740
|
get(memoryId: string): Promise<Json>;
|
|
657
741
|
update(options: UpdateMemoryOptions): Promise<Json>;
|
|
658
742
|
delete(memoryId: string): Promise<Json>;
|
|
743
|
+
/**
|
|
744
|
+
* Forget memories by describing them in the user's own words. Use it when
|
|
745
|
+
* you do not hold memory ids; to delete one memory by id, use `delete()`.
|
|
746
|
+
*
|
|
747
|
+
* The call must be scoped to exactly one user: pass `user_id`, plus
|
|
748
|
+
* `customer_id` on a B2B instance. Otherwise the server answers 400, raised
|
|
749
|
+
* as `InvalidInputError`.
|
|
750
|
+
*
|
|
751
|
+
* Modes:
|
|
752
|
+
* - `"preview"` (default): files a pending request that a person approves in
|
|
753
|
+
* the dashboard under Deletion requests. Deletes nothing. `candidates`
|
|
754
|
+
* lists what matched.
|
|
755
|
+
* - `"direct"`: finds and soft-deletes in one call. Not idempotent as a
|
|
756
|
+
* request: a repeat is harmless and finds nothing new, but it is a new
|
|
757
|
+
* request.
|
|
758
|
+
*
|
|
759
|
+
* `status` is `"nothing_matches"`, `"preview"`, `"deleted"` or `"partial"`.
|
|
760
|
+
* `"partial"` means the memories are hidden but a store named in
|
|
761
|
+
* `still_present_in` may still hold the text, so do not tell an end user it
|
|
762
|
+
* was removed unless `status === "deleted"`. `failed_ids` lists memories that
|
|
763
|
+
* could not be deleted; `may_be_incomplete` is true when the match may not
|
|
764
|
+
* have covered everything.
|
|
765
|
+
*
|
|
766
|
+
* Errors: `InvalidInputError` for 400/422 or a bad `description`/`mode`
|
|
767
|
+
* caught before sending; `ServiceUnavailableError` for 503 (the matcher was
|
|
768
|
+
* unavailable and nothing was deleted, so trying again is safe; the
|
|
769
|
+
* transport applies its normal retry policy first); `RateLimitError` for 429.
|
|
770
|
+
*/
|
|
771
|
+
forget(options: ForgetOptions): Promise<ForgetResult>;
|
|
659
772
|
status(ingestionId: string): Promise<Json>;
|
|
660
773
|
wait_for_completion(ingestionId: string, options?: WaitOptions): Promise<Json>;
|
|
661
774
|
}
|
|
@@ -1367,6 +1480,10 @@ interface UnifiedFetchOptions {
|
|
|
1367
1480
|
types?: string[];
|
|
1368
1481
|
mode?: string;
|
|
1369
1482
|
precision_level?: string;
|
|
1483
|
+
/** The moment the question is being asked. See FetchOptions.query_date. */
|
|
1484
|
+
query_date?: string;
|
|
1485
|
+
/** A share of the response per search query. See FetchOptions.max_results_per_query. */
|
|
1486
|
+
max_results_per_query?: number;
|
|
1370
1487
|
include_conversation_context?: boolean;
|
|
1371
1488
|
scopes?: string[];
|
|
1372
1489
|
include_scope_labels?: boolean;
|
|
@@ -1537,7 +1654,7 @@ declare class SynapClient {
|
|
|
1537
1654
|
* build when the two disagree, which is the only thing that makes a manual
|
|
1538
1655
|
* publish safe.
|
|
1539
1656
|
*/
|
|
1540
|
-
declare const SDK_VERSION = "0.5.
|
|
1657
|
+
declare const SDK_VERSION = "0.5.6";
|
|
1541
1658
|
|
|
1542
1659
|
/**
|
|
1543
1660
|
* BM25 scorer for the anticipation cache.
|
|
@@ -1693,4 +1810,4 @@ interface SynapSdkLike {
|
|
|
1693
1810
|
};
|
|
1694
1811
|
}
|
|
1695
1812
|
|
|
1696
|
-
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 };
|
|
1813
|
+
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 };
|