@z3rno/sdk 0.7.1 → 0.8.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/dist/index.cjs +23 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +99 -3
- package/dist/index.d.ts +99 -3
- package/dist/index.js +23 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -378,7 +378,7 @@ type ForgetResponse = z.infer<typeof ForgetResponse>;
|
|
|
378
378
|
*
|
|
379
379
|
* Audit entries record every operation performed on the agent's memories.
|
|
380
380
|
*/
|
|
381
|
-
declare const AuditEntry: z.ZodObject<{
|
|
381
|
+
declare const AuditEntry: z.ZodEffects<z.ZodObject<{
|
|
382
382
|
/** Auto-incrementing audit entry ID. */
|
|
383
383
|
id: z.ZodNumber;
|
|
384
384
|
/** UUID of the agent, if applicable. */
|
|
@@ -417,6 +417,28 @@ declare const AuditEntry: z.ZodObject<{
|
|
|
417
417
|
user_id?: string | null | undefined;
|
|
418
418
|
details?: Record<string, unknown> | undefined;
|
|
419
419
|
ip_address?: string | null | undefined;
|
|
420
|
+
}>, {
|
|
421
|
+
/** Alias for `created_at`. Added in v0.8.1 for cross-SDK naming parity. */
|
|
422
|
+
timestamp: string;
|
|
423
|
+
id: number;
|
|
424
|
+
created_at: string;
|
|
425
|
+
operation: string;
|
|
426
|
+
details: Record<string, unknown>;
|
|
427
|
+
agent_id?: string | null | undefined;
|
|
428
|
+
memory_type?: string | null | undefined;
|
|
429
|
+
memory_id?: string | null | undefined;
|
|
430
|
+
user_id?: string | null | undefined;
|
|
431
|
+
ip_address?: string | null | undefined;
|
|
432
|
+
}, {
|
|
433
|
+
id: number;
|
|
434
|
+
created_at: string;
|
|
435
|
+
operation: string;
|
|
436
|
+
agent_id?: string | null | undefined;
|
|
437
|
+
memory_type?: string | null | undefined;
|
|
438
|
+
memory_id?: string | null | undefined;
|
|
439
|
+
user_id?: string | null | undefined;
|
|
440
|
+
details?: Record<string, unknown> | undefined;
|
|
441
|
+
ip_address?: string | null | undefined;
|
|
420
442
|
}>;
|
|
421
443
|
/** Parsed type for an audit entry. */
|
|
422
444
|
type AuditEntry = z.infer<typeof AuditEntry>;
|
|
@@ -425,9 +447,9 @@ type AuditEntry = z.infer<typeof AuditEntry>;
|
|
|
425
447
|
*
|
|
426
448
|
* Supports cursor-based pagination via `page` and `page_size`.
|
|
427
449
|
*/
|
|
428
|
-
declare const AuditPageResponse: z.ZodObject<{
|
|
450
|
+
declare const AuditPageResponse: z.ZodEffects<z.ZodObject<{
|
|
429
451
|
/** Audit entries on this page. */
|
|
430
|
-
entries: z.ZodArray<z.ZodObject<{
|
|
452
|
+
entries: z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
431
453
|
/** Auto-incrementing audit entry ID. */
|
|
432
454
|
id: z.ZodNumber;
|
|
433
455
|
/** UUID of the agent, if applicable. */
|
|
@@ -466,6 +488,28 @@ declare const AuditPageResponse: z.ZodObject<{
|
|
|
466
488
|
user_id?: string | null | undefined;
|
|
467
489
|
details?: Record<string, unknown> | undefined;
|
|
468
490
|
ip_address?: string | null | undefined;
|
|
491
|
+
}>, {
|
|
492
|
+
/** Alias for `created_at`. Added in v0.8.1 for cross-SDK naming parity. */
|
|
493
|
+
timestamp: string;
|
|
494
|
+
id: number;
|
|
495
|
+
created_at: string;
|
|
496
|
+
operation: string;
|
|
497
|
+
details: Record<string, unknown>;
|
|
498
|
+
agent_id?: string | null | undefined;
|
|
499
|
+
memory_type?: string | null | undefined;
|
|
500
|
+
memory_id?: string | null | undefined;
|
|
501
|
+
user_id?: string | null | undefined;
|
|
502
|
+
ip_address?: string | null | undefined;
|
|
503
|
+
}, {
|
|
504
|
+
id: number;
|
|
505
|
+
created_at: string;
|
|
506
|
+
operation: string;
|
|
507
|
+
agent_id?: string | null | undefined;
|
|
508
|
+
memory_type?: string | null | undefined;
|
|
509
|
+
memory_id?: string | null | undefined;
|
|
510
|
+
user_id?: string | null | undefined;
|
|
511
|
+
details?: Record<string, unknown> | undefined;
|
|
512
|
+
ip_address?: string | null | undefined;
|
|
469
513
|
}>, "many">;
|
|
470
514
|
/** Total number of matching audit entries. */
|
|
471
515
|
total: z.ZodNumber;
|
|
@@ -477,6 +521,44 @@ declare const AuditPageResponse: z.ZodObject<{
|
|
|
477
521
|
has_next: z.ZodBoolean;
|
|
478
522
|
}, "strip", z.ZodTypeAny, {
|
|
479
523
|
entries: {
|
|
524
|
+
/** Alias for `created_at`. Added in v0.8.1 for cross-SDK naming parity. */
|
|
525
|
+
timestamp: string;
|
|
526
|
+
id: number;
|
|
527
|
+
created_at: string;
|
|
528
|
+
operation: string;
|
|
529
|
+
details: Record<string, unknown>;
|
|
530
|
+
agent_id?: string | null | undefined;
|
|
531
|
+
memory_type?: string | null | undefined;
|
|
532
|
+
memory_id?: string | null | undefined;
|
|
533
|
+
user_id?: string | null | undefined;
|
|
534
|
+
ip_address?: string | null | undefined;
|
|
535
|
+
}[];
|
|
536
|
+
total: number;
|
|
537
|
+
page: number;
|
|
538
|
+
page_size: number;
|
|
539
|
+
has_next: boolean;
|
|
540
|
+
}, {
|
|
541
|
+
entries: {
|
|
542
|
+
id: number;
|
|
543
|
+
created_at: string;
|
|
544
|
+
operation: string;
|
|
545
|
+
agent_id?: string | null | undefined;
|
|
546
|
+
memory_type?: string | null | undefined;
|
|
547
|
+
memory_id?: string | null | undefined;
|
|
548
|
+
user_id?: string | null | undefined;
|
|
549
|
+
details?: Record<string, unknown> | undefined;
|
|
550
|
+
ip_address?: string | null | undefined;
|
|
551
|
+
}[];
|
|
552
|
+
total: number;
|
|
553
|
+
page: number;
|
|
554
|
+
page_size: number;
|
|
555
|
+
has_next: boolean;
|
|
556
|
+
}>, {
|
|
557
|
+
/** Alias for `total`. Added in v0.8.1 for cross-SDK naming parity. */
|
|
558
|
+
total_count: number;
|
|
559
|
+
entries: {
|
|
560
|
+
/** Alias for `created_at`. Added in v0.8.1 for cross-SDK naming parity. */
|
|
561
|
+
timestamp: string;
|
|
480
562
|
id: number;
|
|
481
563
|
created_at: string;
|
|
482
564
|
operation: string;
|
|
@@ -1402,7 +1484,21 @@ declare class Z3rnoClient {
|
|
|
1402
1484
|
agentId: string;
|
|
1403
1485
|
query?: string;
|
|
1404
1486
|
memoryType?: string;
|
|
1487
|
+
/**
|
|
1488
|
+
* v0.21.2 — JSONB metadata containment filter
|
|
1489
|
+
* (`metadata @> :metadata_filter` server-side). Renamed from
|
|
1490
|
+
* `filters`; the old name is still accepted via `filters` below
|
|
1491
|
+
* but emits a deprecation warning.
|
|
1492
|
+
*/
|
|
1493
|
+
metadataFilter?: Record<string, unknown>;
|
|
1494
|
+
/** @deprecated Use `metadataFilter` instead. */
|
|
1405
1495
|
filters?: Record<string, unknown>;
|
|
1496
|
+
/**
|
|
1497
|
+
* v0.21.1 — scope by end-user id (the `memories.user_id`
|
|
1498
|
+
* column). Multi-user agents use this for per-user recall
|
|
1499
|
+
* isolation. Real WHERE predicate, not just audit context.
|
|
1500
|
+
*/
|
|
1501
|
+
userId?: string;
|
|
1406
1502
|
topK?: number;
|
|
1407
1503
|
similarityThreshold?: number;
|
|
1408
1504
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -378,7 +378,7 @@ type ForgetResponse = z.infer<typeof ForgetResponse>;
|
|
|
378
378
|
*
|
|
379
379
|
* Audit entries record every operation performed on the agent's memories.
|
|
380
380
|
*/
|
|
381
|
-
declare const AuditEntry: z.ZodObject<{
|
|
381
|
+
declare const AuditEntry: z.ZodEffects<z.ZodObject<{
|
|
382
382
|
/** Auto-incrementing audit entry ID. */
|
|
383
383
|
id: z.ZodNumber;
|
|
384
384
|
/** UUID of the agent, if applicable. */
|
|
@@ -417,6 +417,28 @@ declare const AuditEntry: z.ZodObject<{
|
|
|
417
417
|
user_id?: string | null | undefined;
|
|
418
418
|
details?: Record<string, unknown> | undefined;
|
|
419
419
|
ip_address?: string | null | undefined;
|
|
420
|
+
}>, {
|
|
421
|
+
/** Alias for `created_at`. Added in v0.8.1 for cross-SDK naming parity. */
|
|
422
|
+
timestamp: string;
|
|
423
|
+
id: number;
|
|
424
|
+
created_at: string;
|
|
425
|
+
operation: string;
|
|
426
|
+
details: Record<string, unknown>;
|
|
427
|
+
agent_id?: string | null | undefined;
|
|
428
|
+
memory_type?: string | null | undefined;
|
|
429
|
+
memory_id?: string | null | undefined;
|
|
430
|
+
user_id?: string | null | undefined;
|
|
431
|
+
ip_address?: string | null | undefined;
|
|
432
|
+
}, {
|
|
433
|
+
id: number;
|
|
434
|
+
created_at: string;
|
|
435
|
+
operation: string;
|
|
436
|
+
agent_id?: string | null | undefined;
|
|
437
|
+
memory_type?: string | null | undefined;
|
|
438
|
+
memory_id?: string | null | undefined;
|
|
439
|
+
user_id?: string | null | undefined;
|
|
440
|
+
details?: Record<string, unknown> | undefined;
|
|
441
|
+
ip_address?: string | null | undefined;
|
|
420
442
|
}>;
|
|
421
443
|
/** Parsed type for an audit entry. */
|
|
422
444
|
type AuditEntry = z.infer<typeof AuditEntry>;
|
|
@@ -425,9 +447,9 @@ type AuditEntry = z.infer<typeof AuditEntry>;
|
|
|
425
447
|
*
|
|
426
448
|
* Supports cursor-based pagination via `page` and `page_size`.
|
|
427
449
|
*/
|
|
428
|
-
declare const AuditPageResponse: z.ZodObject<{
|
|
450
|
+
declare const AuditPageResponse: z.ZodEffects<z.ZodObject<{
|
|
429
451
|
/** Audit entries on this page. */
|
|
430
|
-
entries: z.ZodArray<z.ZodObject<{
|
|
452
|
+
entries: z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
431
453
|
/** Auto-incrementing audit entry ID. */
|
|
432
454
|
id: z.ZodNumber;
|
|
433
455
|
/** UUID of the agent, if applicable. */
|
|
@@ -466,6 +488,28 @@ declare const AuditPageResponse: z.ZodObject<{
|
|
|
466
488
|
user_id?: string | null | undefined;
|
|
467
489
|
details?: Record<string, unknown> | undefined;
|
|
468
490
|
ip_address?: string | null | undefined;
|
|
491
|
+
}>, {
|
|
492
|
+
/** Alias for `created_at`. Added in v0.8.1 for cross-SDK naming parity. */
|
|
493
|
+
timestamp: string;
|
|
494
|
+
id: number;
|
|
495
|
+
created_at: string;
|
|
496
|
+
operation: string;
|
|
497
|
+
details: Record<string, unknown>;
|
|
498
|
+
agent_id?: string | null | undefined;
|
|
499
|
+
memory_type?: string | null | undefined;
|
|
500
|
+
memory_id?: string | null | undefined;
|
|
501
|
+
user_id?: string | null | undefined;
|
|
502
|
+
ip_address?: string | null | undefined;
|
|
503
|
+
}, {
|
|
504
|
+
id: number;
|
|
505
|
+
created_at: string;
|
|
506
|
+
operation: string;
|
|
507
|
+
agent_id?: string | null | undefined;
|
|
508
|
+
memory_type?: string | null | undefined;
|
|
509
|
+
memory_id?: string | null | undefined;
|
|
510
|
+
user_id?: string | null | undefined;
|
|
511
|
+
details?: Record<string, unknown> | undefined;
|
|
512
|
+
ip_address?: string | null | undefined;
|
|
469
513
|
}>, "many">;
|
|
470
514
|
/** Total number of matching audit entries. */
|
|
471
515
|
total: z.ZodNumber;
|
|
@@ -477,6 +521,44 @@ declare const AuditPageResponse: z.ZodObject<{
|
|
|
477
521
|
has_next: z.ZodBoolean;
|
|
478
522
|
}, "strip", z.ZodTypeAny, {
|
|
479
523
|
entries: {
|
|
524
|
+
/** Alias for `created_at`. Added in v0.8.1 for cross-SDK naming parity. */
|
|
525
|
+
timestamp: string;
|
|
526
|
+
id: number;
|
|
527
|
+
created_at: string;
|
|
528
|
+
operation: string;
|
|
529
|
+
details: Record<string, unknown>;
|
|
530
|
+
agent_id?: string | null | undefined;
|
|
531
|
+
memory_type?: string | null | undefined;
|
|
532
|
+
memory_id?: string | null | undefined;
|
|
533
|
+
user_id?: string | null | undefined;
|
|
534
|
+
ip_address?: string | null | undefined;
|
|
535
|
+
}[];
|
|
536
|
+
total: number;
|
|
537
|
+
page: number;
|
|
538
|
+
page_size: number;
|
|
539
|
+
has_next: boolean;
|
|
540
|
+
}, {
|
|
541
|
+
entries: {
|
|
542
|
+
id: number;
|
|
543
|
+
created_at: string;
|
|
544
|
+
operation: string;
|
|
545
|
+
agent_id?: string | null | undefined;
|
|
546
|
+
memory_type?: string | null | undefined;
|
|
547
|
+
memory_id?: string | null | undefined;
|
|
548
|
+
user_id?: string | null | undefined;
|
|
549
|
+
details?: Record<string, unknown> | undefined;
|
|
550
|
+
ip_address?: string | null | undefined;
|
|
551
|
+
}[];
|
|
552
|
+
total: number;
|
|
553
|
+
page: number;
|
|
554
|
+
page_size: number;
|
|
555
|
+
has_next: boolean;
|
|
556
|
+
}>, {
|
|
557
|
+
/** Alias for `total`. Added in v0.8.1 for cross-SDK naming parity. */
|
|
558
|
+
total_count: number;
|
|
559
|
+
entries: {
|
|
560
|
+
/** Alias for `created_at`. Added in v0.8.1 for cross-SDK naming parity. */
|
|
561
|
+
timestamp: string;
|
|
480
562
|
id: number;
|
|
481
563
|
created_at: string;
|
|
482
564
|
operation: string;
|
|
@@ -1402,7 +1484,21 @@ declare class Z3rnoClient {
|
|
|
1402
1484
|
agentId: string;
|
|
1403
1485
|
query?: string;
|
|
1404
1486
|
memoryType?: string;
|
|
1487
|
+
/**
|
|
1488
|
+
* v0.21.2 — JSONB metadata containment filter
|
|
1489
|
+
* (`metadata @> :metadata_filter` server-side). Renamed from
|
|
1490
|
+
* `filters`; the old name is still accepted via `filters` below
|
|
1491
|
+
* but emits a deprecation warning.
|
|
1492
|
+
*/
|
|
1493
|
+
metadataFilter?: Record<string, unknown>;
|
|
1494
|
+
/** @deprecated Use `metadataFilter` instead. */
|
|
1405
1495
|
filters?: Record<string, unknown>;
|
|
1496
|
+
/**
|
|
1497
|
+
* v0.21.1 — scope by end-user id (the `memories.user_id`
|
|
1498
|
+
* column). Multi-user agents use this for per-user recall
|
|
1499
|
+
* isolation. Real WHERE predicate, not just audit context.
|
|
1500
|
+
*/
|
|
1501
|
+
userId?: string;
|
|
1406
1502
|
topK?: number;
|
|
1407
1503
|
similarityThreshold?: number;
|
|
1408
1504
|
/**
|
package/dist/index.js
CHANGED
|
@@ -276,7 +276,11 @@ var AuditEntry = z.object({
|
|
|
276
276
|
ip_address: z.string().nullable().optional(),
|
|
277
277
|
/** ISO 8601 timestamp of the operation. */
|
|
278
278
|
created_at: z.string()
|
|
279
|
-
})
|
|
279
|
+
}).transform((data) => ({
|
|
280
|
+
...data,
|
|
281
|
+
/** Alias for `created_at`. Added in v0.8.1 for cross-SDK naming parity. */
|
|
282
|
+
timestamp: data.created_at
|
|
283
|
+
}));
|
|
280
284
|
var AuditPageResponse = z.object({
|
|
281
285
|
/** Audit entries on this page. */
|
|
282
286
|
entries: z.array(AuditEntry),
|
|
@@ -288,7 +292,11 @@ var AuditPageResponse = z.object({
|
|
|
288
292
|
page_size: z.number(),
|
|
289
293
|
/** Whether more pages are available. */
|
|
290
294
|
has_next: z.boolean()
|
|
291
|
-
})
|
|
295
|
+
}).transform((data) => ({
|
|
296
|
+
...data,
|
|
297
|
+
/** Alias for `total`. Added in v0.8.1 for cross-SDK naming parity. */
|
|
298
|
+
total_count: data.total
|
|
299
|
+
}));
|
|
292
300
|
var BatchStoreResponse = z.object({
|
|
293
301
|
/** Array of stored memory objects. */
|
|
294
302
|
results: z.array(MemoryResponse),
|
|
@@ -583,11 +591,20 @@ var Z3rnoClient = class {
|
|
|
583
591
|
* ```
|
|
584
592
|
*/
|
|
585
593
|
async recall(params) {
|
|
594
|
+
let metadataFilter = params.metadataFilter;
|
|
595
|
+
if (params.filters !== void 0 && metadataFilter === void 0) {
|
|
596
|
+
if (typeof console !== "undefined" && console.warn) {
|
|
597
|
+
console.warn(
|
|
598
|
+
"Z3rnoClient.recall({filters}) is deprecated; use {metadataFilter} instead."
|
|
599
|
+
);
|
|
600
|
+
}
|
|
601
|
+
metadataFilter = params.filters;
|
|
602
|
+
}
|
|
586
603
|
const body = {
|
|
587
604
|
agent_id: params.agentId,
|
|
588
605
|
query: params.query,
|
|
589
606
|
memory_type: params.memoryType,
|
|
590
|
-
|
|
607
|
+
metadata_filter: metadataFilter,
|
|
591
608
|
top_k: params.topK ?? 10,
|
|
592
609
|
similarity_threshold: params.similarityThreshold ?? 0,
|
|
593
610
|
// Always send strategy + rerank. Older servers silently ignore
|
|
@@ -595,6 +612,9 @@ var Z3rnoClient = class {
|
|
|
595
612
|
strategy: params.strategy ?? "AUTO",
|
|
596
613
|
rerank: params.rerank ?? false
|
|
597
614
|
};
|
|
615
|
+
if (params.userId) {
|
|
616
|
+
body.user_id = params.userId;
|
|
617
|
+
}
|
|
598
618
|
if (params.conversationId) {
|
|
599
619
|
body.conversation_id = params.conversationId;
|
|
600
620
|
}
|