hebbrix 2.2.1 → 2.3.1
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/CHANGELOG.md +22 -0
- package/README.md +78 -743
- package/dist/index.d.mts +144 -38
- package/dist/index.d.ts +144 -38
- package/dist/index.js +477 -147
- package/dist/index.mjs +472 -146
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -38,6 +38,12 @@ interface Memory {
|
|
|
38
38
|
source_reference?: string;
|
|
39
39
|
access_count: number;
|
|
40
40
|
last_accessed_at?: string;
|
|
41
|
+
/** Authoritative indexing state returned by GET /v1/memories/{id}. */
|
|
42
|
+
processing_status?: string;
|
|
43
|
+
/** True only when the memory is available to search. */
|
|
44
|
+
searchable?: boolean;
|
|
45
|
+
outbox_event_id?: string;
|
|
46
|
+
status_url?: string;
|
|
41
47
|
created_at: string;
|
|
42
48
|
updated_at: string;
|
|
43
49
|
}
|
|
@@ -155,6 +161,12 @@ interface CreateMemoryParams {
|
|
|
155
161
|
source?: string;
|
|
156
162
|
/** Stable retry key sent as the Idempotency-Key transport header. */
|
|
157
163
|
idempotency_key?: string;
|
|
164
|
+
/** Optional caller cancellation signal; it is never serialized. */
|
|
165
|
+
signal?: AbortSignal;
|
|
166
|
+
/** Client-side readiness deadline used only when wait_for_index=true. */
|
|
167
|
+
index_timeout_ms?: number;
|
|
168
|
+
/** Poll interval for a durable pending receipt. */
|
|
169
|
+
index_poll_interval_ms?: number;
|
|
158
170
|
}
|
|
159
171
|
interface MemoryAddResult {
|
|
160
172
|
id: string;
|
|
@@ -162,6 +174,7 @@ interface MemoryAddResult {
|
|
|
162
174
|
event: "ADD" | "UPDATE" | "NOOP" | string;
|
|
163
175
|
memory?: string;
|
|
164
176
|
reason?: string;
|
|
177
|
+
processing_status?: string;
|
|
165
178
|
}
|
|
166
179
|
interface MemoryAddResponse {
|
|
167
180
|
results: MemoryAddResult[];
|
|
@@ -170,6 +183,9 @@ interface MemoryAddResponse {
|
|
|
170
183
|
searchable: boolean;
|
|
171
184
|
outbox_event_id?: string;
|
|
172
185
|
status_url?: string;
|
|
186
|
+
idempotency_replay?: boolean;
|
|
187
|
+
request_id?: string;
|
|
188
|
+
retry_after?: string;
|
|
173
189
|
job_id?: string;
|
|
174
190
|
created_count: number;
|
|
175
191
|
updated_count: number;
|
|
@@ -198,10 +214,16 @@ interface BatchMemoryCreateParams {
|
|
|
198
214
|
idempotency_key?: string;
|
|
199
215
|
/** Optional caller cancellation signal; it is never serialized. */
|
|
200
216
|
signal?: AbortSignal;
|
|
217
|
+
/** Client-side readiness deadline used only when wait_for_index=true. */
|
|
218
|
+
index_timeout_ms?: number;
|
|
219
|
+
/** Poll interval for a durable 202 receipt. */
|
|
220
|
+
index_poll_interval_ms?: number;
|
|
201
221
|
}
|
|
202
222
|
interface BatchMemoryResponse {
|
|
203
223
|
created: number;
|
|
204
224
|
failed: number;
|
|
225
|
+
accepted: boolean;
|
|
226
|
+
durable: boolean;
|
|
205
227
|
memory_ids: string[];
|
|
206
228
|
errors: string[];
|
|
207
229
|
results: Array<{
|
|
@@ -213,6 +235,8 @@ interface BatchMemoryResponse {
|
|
|
213
235
|
searchable: boolean;
|
|
214
236
|
outbox_event_id?: string;
|
|
215
237
|
status_url?: string;
|
|
238
|
+
idempotency_replay?: boolean;
|
|
239
|
+
request_id?: string;
|
|
216
240
|
}
|
|
217
241
|
interface UpdateMemoryParams {
|
|
218
242
|
content?: string;
|
|
@@ -246,8 +270,10 @@ interface ReasonParams {
|
|
|
246
270
|
facets?: string[];
|
|
247
271
|
}
|
|
248
272
|
interface ListParams {
|
|
249
|
-
|
|
273
|
+
cursor?: string;
|
|
250
274
|
limit?: number;
|
|
275
|
+
name?: string;
|
|
276
|
+
name_prefix?: string;
|
|
251
277
|
}
|
|
252
278
|
interface MemoryListParams {
|
|
253
279
|
collection_id?: string;
|
|
@@ -344,7 +370,7 @@ declare class CollectionsResource extends BaseResource {
|
|
|
344
370
|
/**
|
|
345
371
|
* List all collections
|
|
346
372
|
*/
|
|
347
|
-
list(params?: ListParams): Promise<Collection
|
|
373
|
+
list(params?: ListParams): Promise<CursorPage<Collection>>;
|
|
348
374
|
/**
|
|
349
375
|
* Get a specific collection
|
|
350
376
|
*/
|
|
@@ -360,14 +386,28 @@ declare class CollectionsResource extends BaseResource {
|
|
|
360
386
|
}
|
|
361
387
|
declare class MemoriesResource extends BaseResource {
|
|
362
388
|
/**
|
|
363
|
-
* Create
|
|
389
|
+
* Create one logical memory write. When `wait_for_index=true`, a durable
|
|
390
|
+
* pending receipt is polled without issuing a second create request.
|
|
364
391
|
*/
|
|
365
392
|
create(params: CreateMemoryParams): Promise<MemoryAddResponse>;
|
|
393
|
+
/** Poll a single-write durable receipt until every accepted memory is searchable. */
|
|
394
|
+
waitForSearchable(receipt: MemoryAddResponse, options?: {
|
|
395
|
+
timeoutMs?: number;
|
|
396
|
+
pollIntervalMs?: number;
|
|
397
|
+
signal?: AbortSignal;
|
|
398
|
+
idempotencyKey?: string;
|
|
399
|
+
}): Promise<MemoryAddResponse>;
|
|
400
|
+
private memoryIds;
|
|
401
|
+
private isSearchableCompletion;
|
|
402
|
+
private isTerminalStatus;
|
|
403
|
+
private readinessPath;
|
|
404
|
+
private throwIfPollingAborted;
|
|
405
|
+
private pollingDelay;
|
|
366
406
|
/**
|
|
367
407
|
* Create up to 100 memories with one unambiguous readiness contract.
|
|
368
|
-
* `wait_for_index=true` resolves only for a fully searchable batch
|
|
369
|
-
*
|
|
370
|
-
*
|
|
408
|
+
* `wait_for_index=true` resolves only for a fully searchable batch. A durable
|
|
409
|
+
* server-side 202 is polled to the caller's deadline; expiry raises a typed
|
|
410
|
+
* `IndexingTimeoutError` carrying the original durable receipt.
|
|
371
411
|
*/
|
|
372
412
|
createBatch(params: BatchMemoryCreateParams): Promise<BatchMemoryResponse>;
|
|
373
413
|
/** Poll every item in an asynchronous batch receipt until it is searchable. */
|
|
@@ -459,7 +499,6 @@ declare class RLResource extends BaseResource {
|
|
|
459
499
|
* Train the Memory Manager agent using RL
|
|
460
500
|
*/
|
|
461
501
|
trainMemoryManager(params: {
|
|
462
|
-
collection_id?: string;
|
|
463
502
|
num_episodes?: number;
|
|
464
503
|
[key: string]: any;
|
|
465
504
|
}): Promise<any>;
|
|
@@ -467,7 +506,6 @@ declare class RLResource extends BaseResource {
|
|
|
467
506
|
* Train the Answer Agent using RL
|
|
468
507
|
*/
|
|
469
508
|
trainAnswerAgent(params: {
|
|
470
|
-
collection_id?: string;
|
|
471
509
|
num_episodes?: number;
|
|
472
510
|
[key: string]: any;
|
|
473
511
|
}): Promise<any>;
|
|
@@ -534,8 +572,11 @@ declare class TemporalResource extends BaseResource {
|
|
|
534
572
|
subject: string;
|
|
535
573
|
predicate: string;
|
|
536
574
|
object: string;
|
|
537
|
-
valid_from
|
|
575
|
+
valid_from: string;
|
|
538
576
|
valid_until?: string;
|
|
577
|
+
observed_at?: string;
|
|
578
|
+
subject_type?: string;
|
|
579
|
+
object_type?: string;
|
|
539
580
|
confidence?: number;
|
|
540
581
|
source_memory_id?: string;
|
|
541
582
|
metadata?: Record<string, any>;
|
|
@@ -543,12 +584,20 @@ declare class TemporalResource extends BaseResource {
|
|
|
543
584
|
/**
|
|
544
585
|
* Query temporal facts
|
|
545
586
|
*/
|
|
546
|
-
queryFacts(params
|
|
587
|
+
queryFacts(params: {
|
|
547
588
|
subject?: string;
|
|
548
589
|
predicate?: string;
|
|
549
590
|
object?: string;
|
|
550
591
|
at_time?: string;
|
|
551
592
|
}): Promise<any[]>;
|
|
593
|
+
queryAtTime(params: {
|
|
594
|
+
subject: string;
|
|
595
|
+
timestamp: string;
|
|
596
|
+
predicate?: string;
|
|
597
|
+
}): Promise<any>;
|
|
598
|
+
history(subject: string, predicate: string, limit?: number): Promise<any>;
|
|
599
|
+
conflicts(subject: string, predicate: string): Promise<any>;
|
|
600
|
+
invalidate(subject: string, predicate: string, object: string): Promise<any>;
|
|
552
601
|
/**
|
|
553
602
|
* Query knowledge state at a specific point in time
|
|
554
603
|
*/
|
|
@@ -557,6 +606,8 @@ declare class TemporalResource extends BaseResource {
|
|
|
557
606
|
deleteFact(factId: string): Promise<any>;
|
|
558
607
|
}
|
|
559
608
|
declare class WorkingMemoryResource extends BaseResource {
|
|
609
|
+
readonly sessionId: string;
|
|
610
|
+
constructor(client: MemoryClient);
|
|
560
611
|
/**
|
|
561
612
|
* Add item to working memory buffer
|
|
562
613
|
*/
|
|
@@ -564,33 +615,30 @@ declare class WorkingMemoryResource extends BaseResource {
|
|
|
564
615
|
role: string;
|
|
565
616
|
content: string;
|
|
566
617
|
metadata?: Record<string, any>;
|
|
618
|
+
session_id?: string;
|
|
567
619
|
}): Promise<any>;
|
|
568
620
|
/**
|
|
569
621
|
* Get current working memory context
|
|
570
622
|
*/
|
|
571
|
-
getContext(): Promise<any>;
|
|
623
|
+
getContext(sessionId?: string, includeCompressed?: boolean): Promise<any>;
|
|
572
624
|
/**
|
|
573
625
|
* Compress working memory buffer
|
|
574
626
|
*/
|
|
575
|
-
compress(): Promise<any>;
|
|
627
|
+
compress(sessionId?: string): Promise<any>;
|
|
576
628
|
/**
|
|
577
629
|
* Clear working memory buffer
|
|
578
630
|
*/
|
|
579
|
-
clear(): Promise<any>;
|
|
631
|
+
clear(sessionId?: string): Promise<any>;
|
|
580
632
|
}
|
|
581
633
|
declare class ConsolidationResource extends BaseResource {
|
|
582
634
|
/**
|
|
583
635
|
* Trigger memory consolidation
|
|
584
636
|
*/
|
|
585
|
-
consolidate(collectionId: string,
|
|
637
|
+
consolidate(collectionId: string, lookbackDays?: number, utilityThreshold?: number): Promise<any>;
|
|
586
638
|
/**
|
|
587
639
|
* Get consolidation statistics
|
|
588
640
|
*/
|
|
589
641
|
getStats(collectionId: string): Promise<any>;
|
|
590
|
-
/**
|
|
591
|
-
* Archive old memories
|
|
592
|
-
*/
|
|
593
|
-
archive(collectionId: string, beforeDate?: string): Promise<any>;
|
|
594
642
|
}
|
|
595
643
|
declare class MemoryToolsResource extends BaseResource {
|
|
596
644
|
/**
|
|
@@ -598,7 +646,9 @@ declare class MemoryToolsResource extends BaseResource {
|
|
|
598
646
|
*/
|
|
599
647
|
replace(params: {
|
|
600
648
|
memory_id: string;
|
|
649
|
+
old_content: string;
|
|
601
650
|
new_content: string;
|
|
651
|
+
collection_id: string;
|
|
602
652
|
reason?: string;
|
|
603
653
|
}): Promise<any>;
|
|
604
654
|
/**
|
|
@@ -607,23 +657,15 @@ declare class MemoryToolsResource extends BaseResource {
|
|
|
607
657
|
insert(params: {
|
|
608
658
|
collection_id: string;
|
|
609
659
|
content: string;
|
|
610
|
-
position
|
|
660
|
+
position?: number;
|
|
611
661
|
reason?: string;
|
|
662
|
+
importance?: number;
|
|
663
|
+
metadata?: Record<string, any>;
|
|
612
664
|
}): Promise<any>;
|
|
613
665
|
/**
|
|
614
666
|
* Re-evaluate memory in light of new information
|
|
615
667
|
*/
|
|
616
|
-
rethink(memoryId: string,
|
|
617
|
-
}
|
|
618
|
-
declare class WorldModelResource extends BaseResource {
|
|
619
|
-
/**
|
|
620
|
-
* Simulate retrieval without actually retrieving
|
|
621
|
-
*/
|
|
622
|
-
imagineRetrieval(query: string, collectionId?: string): Promise<any>;
|
|
623
|
-
/**
|
|
624
|
-
* Plan memory operations to achieve goal
|
|
625
|
-
*/
|
|
626
|
-
plan(goal: string, collectionId?: string): Promise<any>;
|
|
668
|
+
rethink(memoryId: string, collectionId: string): Promise<any>;
|
|
627
669
|
}
|
|
628
670
|
|
|
629
671
|
declare class MemoryClient {
|
|
@@ -642,7 +684,6 @@ declare class MemoryClient {
|
|
|
642
684
|
workingMemory: WorkingMemoryResource;
|
|
643
685
|
consolidation: ConsolidationResource;
|
|
644
686
|
memoryTools: MemoryToolsResource;
|
|
645
|
-
worldModel: WorldModelResource;
|
|
646
687
|
proofloop: ProofLoopResource;
|
|
647
688
|
constructor(config?: ClientConfig);
|
|
648
689
|
private getHeaders;
|
|
@@ -662,23 +703,88 @@ declare class MemoryClient {
|
|
|
662
703
|
*/
|
|
663
704
|
declare class HebbrixError extends Error {
|
|
664
705
|
statusCode?: number;
|
|
665
|
-
|
|
706
|
+
code?: string;
|
|
707
|
+
requestId?: string;
|
|
708
|
+
details?: Record<string, any>;
|
|
709
|
+
constructor(message: string, statusCode?: number, options?: {
|
|
710
|
+
code?: string;
|
|
711
|
+
requestId?: string;
|
|
712
|
+
details?: Record<string, any>;
|
|
713
|
+
});
|
|
714
|
+
}
|
|
715
|
+
declare class EntitlementError extends HebbrixError {
|
|
716
|
+
constructor(message: string, statusCode: number, options?: {
|
|
717
|
+
code?: string;
|
|
718
|
+
requestId?: string;
|
|
719
|
+
details?: Record<string, any>;
|
|
720
|
+
});
|
|
721
|
+
}
|
|
722
|
+
interface IndexingWaitErrorOptions {
|
|
723
|
+
idempotencyKey?: string;
|
|
724
|
+
cause?: unknown;
|
|
725
|
+
}
|
|
726
|
+
/** Base class for readiness failures after the API has accepted a durable write. */
|
|
727
|
+
declare class IndexingWaitError extends Error {
|
|
728
|
+
receipt: Record<string, any>;
|
|
729
|
+
memoryIds: string[];
|
|
730
|
+
jobId?: string;
|
|
731
|
+
statusUrl?: string;
|
|
732
|
+
requestId?: string;
|
|
733
|
+
outboxEventId?: string;
|
|
734
|
+
indexingEventId?: string;
|
|
735
|
+
eventId?: string;
|
|
736
|
+
idempotencyReplay?: boolean;
|
|
737
|
+
idempotencyKey?: string;
|
|
738
|
+
retryAfter?: string;
|
|
739
|
+
recovery: Record<string, unknown>;
|
|
740
|
+
cause?: unknown;
|
|
741
|
+
constructor(message: string, receipt: Record<string, any>, options?: IndexingWaitErrorOptions);
|
|
742
|
+
}
|
|
743
|
+
declare class IndexingTimeoutError extends IndexingWaitError {
|
|
744
|
+
constructor(message: string, receipt: Record<string, any>, options?: IndexingWaitErrorOptions);
|
|
745
|
+
}
|
|
746
|
+
declare class IndexingAbortedError extends IndexingWaitError {
|
|
747
|
+
constructor(message: string, receipt: Record<string, any>, options?: IndexingWaitErrorOptions);
|
|
748
|
+
}
|
|
749
|
+
declare class IndexingTerminalError extends IndexingWaitError {
|
|
750
|
+
processingStatus: string;
|
|
751
|
+
constructor(message: string, receipt: Record<string, any>, processingStatus: string, options?: IndexingWaitErrorOptions);
|
|
666
752
|
}
|
|
667
753
|
declare class AuthenticationError extends HebbrixError {
|
|
668
|
-
constructor(message?: string
|
|
754
|
+
constructor(message?: string, options?: {
|
|
755
|
+
code?: string;
|
|
756
|
+
requestId?: string;
|
|
757
|
+
details?: Record<string, any>;
|
|
758
|
+
});
|
|
669
759
|
}
|
|
670
760
|
declare class ValidationError extends HebbrixError {
|
|
671
761
|
errors?: any[];
|
|
672
|
-
constructor(message: string, errors?: any[]
|
|
762
|
+
constructor(message: string, errors?: any[], options?: {
|
|
763
|
+
code?: string;
|
|
764
|
+
requestId?: string;
|
|
765
|
+
details?: Record<string, any>;
|
|
766
|
+
});
|
|
673
767
|
}
|
|
674
768
|
declare class NotFoundError extends HebbrixError {
|
|
675
|
-
constructor(message?: string
|
|
769
|
+
constructor(message?: string, options?: {
|
|
770
|
+
code?: string;
|
|
771
|
+
requestId?: string;
|
|
772
|
+
details?: Record<string, any>;
|
|
773
|
+
});
|
|
676
774
|
}
|
|
677
775
|
declare class RateLimitError extends HebbrixError {
|
|
678
|
-
constructor(message?: string
|
|
776
|
+
constructor(message?: string, options?: {
|
|
777
|
+
code?: string;
|
|
778
|
+
requestId?: string;
|
|
779
|
+
details?: Record<string, any>;
|
|
780
|
+
});
|
|
679
781
|
}
|
|
680
782
|
declare class ServerError extends HebbrixError {
|
|
681
|
-
constructor(message?: string
|
|
783
|
+
constructor(message?: string, options?: {
|
|
784
|
+
code?: string;
|
|
785
|
+
requestId?: string;
|
|
786
|
+
details?: Record<string, any>;
|
|
787
|
+
});
|
|
682
788
|
}
|
|
683
789
|
|
|
684
790
|
interface SafetyEnvelope {
|
|
@@ -701,4 +807,4 @@ interface SafetyEnvelope {
|
|
|
701
807
|
*/
|
|
702
808
|
declare function enforceSearchSafety<T extends object>(response: T, rowsKey?: "results" | "sources"): T & SafetyEnvelope;
|
|
703
809
|
|
|
704
|
-
export { type APIKeyResponse, AuthResource, type AuthResponse, AuthenticationError, type BatchMemoryCreateParams, type BatchMemoryItemParams, type BatchMemoryResponse, type ClientConfig, type Collection, CollectionsResource, ConsolidationResource, type CorrectionCreateParams, type CorrectionSearchParams, CorrectionsResource, type CreateCollectionParams, type CreateMemoryParams, type CursorPage, type EvidenceClaim, type GroundingReceipt, HebbrixError, type ListParams, MemoriesResource, type Memory, type MemoryAddResponse, type MemoryAddResult, MemoryClient, type MemoryJobReceipt, MemoryJobsResource, type MemoryListParams, MemoryToolsResource, type MemoryWithMetadata, NotFoundError, ProceduralResource, type ProofContext, type ProofLoopCandidate, type ProofLoopDecisionParams, type ProofLoopMetricParams, ProofLoopResource, RLResource, RateLimitError, type ReasonParams, type ReasoningResponse, type ReasoningSource, type SafetyEnvelope, type SearchParams, SearchResource, type SearchResponse, type SearchResult, ServerError, TemporalResource, type UpdateCollectionParams, type UpdateMemoryParams, type User, ValidationError, WorkingMemoryResource,
|
|
810
|
+
export { type APIKeyResponse, AuthResource, type AuthResponse, AuthenticationError, type BatchMemoryCreateParams, type BatchMemoryItemParams, type BatchMemoryResponse, type ClientConfig, type Collection, CollectionsResource, ConsolidationResource, type CorrectionCreateParams, type CorrectionSearchParams, CorrectionsResource, type CreateCollectionParams, type CreateMemoryParams, type CursorPage, EntitlementError, type EvidenceClaim, type GroundingReceipt, HebbrixError, IndexingAbortedError, IndexingTerminalError, IndexingTimeoutError, IndexingWaitError, type IndexingWaitErrorOptions, type ListParams, MemoriesResource, type Memory, type MemoryAddResponse, type MemoryAddResult, MemoryClient, type MemoryJobReceipt, MemoryJobsResource, type MemoryListParams, MemoryToolsResource, type MemoryWithMetadata, NotFoundError, ProceduralResource, type ProofContext, type ProofLoopCandidate, type ProofLoopDecisionParams, type ProofLoopMetricParams, ProofLoopResource, RLResource, RateLimitError, type ReasonParams, type ReasoningResponse, type ReasoningSource, type SafetyEnvelope, type SearchParams, SearchResource, type SearchResponse, type SearchResult, ServerError, TemporalResource, type UpdateCollectionParams, type UpdateMemoryParams, type User, ValidationError, WorkingMemoryResource, enforceSearchSafety };
|