@z3rno/sdk 0.8.0 → 0.9.0
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 +55 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +121 -4
- package/dist/index.d.ts +121 -4
- package/dist/index.js +55 -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;
|
|
@@ -1690,6 +1772,16 @@ declare class Z3rnoClient {
|
|
|
1690
1772
|
afterTurn?: number;
|
|
1691
1773
|
limit?: number;
|
|
1692
1774
|
}): Promise<TurnListResponse>;
|
|
1775
|
+
/**
|
|
1776
|
+
* Cross-tenant admin sub-namespace (v0.22.1, slice 21.3).
|
|
1777
|
+
*
|
|
1778
|
+
* Pairs with z3rno-server v0.22.1's `/v1/tenants/{orgId}/budgets`
|
|
1779
|
+
* surface. Requires `SUPERADMIN_ENABLED=true` on the server and
|
|
1780
|
+
* the client to be configured with the matching superadmin API
|
|
1781
|
+
* key. Methods raise `AuthenticationError` (401) or a generic
|
|
1782
|
+
* `Z3rnoError` (403) otherwise.
|
|
1783
|
+
*/
|
|
1784
|
+
get admin(): AdminAPI;
|
|
1693
1785
|
/**
|
|
1694
1786
|
* Read this org's stored budget overrides + resolved effective caps.
|
|
1695
1787
|
* Auth: any admin/write/read member of the calling org.
|
|
@@ -1704,6 +1796,31 @@ declare class Z3rnoClient {
|
|
|
1704
1796
|
private sleep;
|
|
1705
1797
|
private handleResponse;
|
|
1706
1798
|
}
|
|
1799
|
+
/**
|
|
1800
|
+
* Cross-tenant admin sub-namespace exposed via `client.admin`.
|
|
1801
|
+
*
|
|
1802
|
+
* Construction captures the parent client's `request` method as a
|
|
1803
|
+
* bound closure — no privileged access to the class internals, just
|
|
1804
|
+
* a function reference. That's deliberate: the namespace is
|
|
1805
|
+
* dependency-injected the same way a stub would be, so test doubles
|
|
1806
|
+
* can swap it out without touching the parent client.
|
|
1807
|
+
*/
|
|
1808
|
+
declare class AdminAPI {
|
|
1809
|
+
private readonly request;
|
|
1810
|
+
constructor(request: (method: string, path: string, body?: unknown) => Promise<unknown>);
|
|
1811
|
+
/**
|
|
1812
|
+
* Read another tenant's budget overrides + effective caps.
|
|
1813
|
+
*
|
|
1814
|
+
* Requires `SUPERADMIN_ENABLED=true` server-side and the client to
|
|
1815
|
+
* be configured with the superadmin API key.
|
|
1816
|
+
*/
|
|
1817
|
+
getBudgets(orgId: string): Promise<TenantBudgetsView>;
|
|
1818
|
+
/**
|
|
1819
|
+
* Replace another tenant's budget overrides. Zero / missing fields
|
|
1820
|
+
* inherit the server default.
|
|
1821
|
+
*/
|
|
1822
|
+
setBudgets(orgId: string, budgets: Partial<TenantBudgets>): Promise<TenantBudgetsView>;
|
|
1823
|
+
}
|
|
1707
1824
|
|
|
1708
1825
|
/**
|
|
1709
1826
|
* Z3rno SDK error hierarchy.
|
|
@@ -2007,4 +2124,4 @@ declare class Z3rnoMastraMemory {
|
|
|
2007
2124
|
private normaliseRole;
|
|
2008
2125
|
}
|
|
2009
2126
|
|
|
2010
|
-
export { AuditEntry, AuditPageResponse, AuthenticationError, BatchStoreResponse, ConversationResponse, type CoreMessage, DistillJobResponse, DistillJobStatusResponse, EndSessionResponse, ForgetResponse, IngestJobResponse, IngestJobStatusResponse, type MastraMessage, type MastraRole, MemoryHistoryResponse, MemoryResponse, MemoryType, MemoryVersion, NotFoundError, RateLimitError, RecallResponse, RecallResultItem, RefineJobResponse, RefineJobStatusResponse, RelationshipType, RetrievalStrategy, ServerError, SessionResponse, StoreMemoryRequest, TenantBudgets, TenantBudgetsView, TurnAddResponse, TurnListResponse, TurnResponse, ValidationError, Z3rnoClient, type Z3rnoClientConfig, Z3rnoConnectionError, Z3rnoError, Z3rnoMastraMemory, type Z3rnoMastraMemoryOptions, type Z3rnoMessageRole, Z3rnoTimeoutError, Z3rnoVercelMemory, type Z3rnoVercelMemoryOptions };
|
|
2127
|
+
export { AdminAPI, AuditEntry, AuditPageResponse, AuthenticationError, BatchStoreResponse, ConversationResponse, type CoreMessage, DistillJobResponse, DistillJobStatusResponse, EndSessionResponse, ForgetResponse, IngestJobResponse, IngestJobStatusResponse, type MastraMessage, type MastraRole, MemoryHistoryResponse, MemoryResponse, MemoryType, MemoryVersion, NotFoundError, RateLimitError, RecallResponse, RecallResultItem, RefineJobResponse, RefineJobStatusResponse, RelationshipType, RetrievalStrategy, ServerError, SessionResponse, StoreMemoryRequest, TenantBudgets, TenantBudgetsView, TurnAddResponse, TurnListResponse, TurnResponse, ValidationError, Z3rnoClient, type Z3rnoClientConfig, Z3rnoConnectionError, Z3rnoError, Z3rnoMastraMemory, type Z3rnoMastraMemoryOptions, type Z3rnoMessageRole, Z3rnoTimeoutError, Z3rnoVercelMemory, type Z3rnoVercelMemoryOptions };
|
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;
|
|
@@ -1690,6 +1772,16 @@ declare class Z3rnoClient {
|
|
|
1690
1772
|
afterTurn?: number;
|
|
1691
1773
|
limit?: number;
|
|
1692
1774
|
}): Promise<TurnListResponse>;
|
|
1775
|
+
/**
|
|
1776
|
+
* Cross-tenant admin sub-namespace (v0.22.1, slice 21.3).
|
|
1777
|
+
*
|
|
1778
|
+
* Pairs with z3rno-server v0.22.1's `/v1/tenants/{orgId}/budgets`
|
|
1779
|
+
* surface. Requires `SUPERADMIN_ENABLED=true` on the server and
|
|
1780
|
+
* the client to be configured with the matching superadmin API
|
|
1781
|
+
* key. Methods raise `AuthenticationError` (401) or a generic
|
|
1782
|
+
* `Z3rnoError` (403) otherwise.
|
|
1783
|
+
*/
|
|
1784
|
+
get admin(): AdminAPI;
|
|
1693
1785
|
/**
|
|
1694
1786
|
* Read this org's stored budget overrides + resolved effective caps.
|
|
1695
1787
|
* Auth: any admin/write/read member of the calling org.
|
|
@@ -1704,6 +1796,31 @@ declare class Z3rnoClient {
|
|
|
1704
1796
|
private sleep;
|
|
1705
1797
|
private handleResponse;
|
|
1706
1798
|
}
|
|
1799
|
+
/**
|
|
1800
|
+
* Cross-tenant admin sub-namespace exposed via `client.admin`.
|
|
1801
|
+
*
|
|
1802
|
+
* Construction captures the parent client's `request` method as a
|
|
1803
|
+
* bound closure — no privileged access to the class internals, just
|
|
1804
|
+
* a function reference. That's deliberate: the namespace is
|
|
1805
|
+
* dependency-injected the same way a stub would be, so test doubles
|
|
1806
|
+
* can swap it out without touching the parent client.
|
|
1807
|
+
*/
|
|
1808
|
+
declare class AdminAPI {
|
|
1809
|
+
private readonly request;
|
|
1810
|
+
constructor(request: (method: string, path: string, body?: unknown) => Promise<unknown>);
|
|
1811
|
+
/**
|
|
1812
|
+
* Read another tenant's budget overrides + effective caps.
|
|
1813
|
+
*
|
|
1814
|
+
* Requires `SUPERADMIN_ENABLED=true` server-side and the client to
|
|
1815
|
+
* be configured with the superadmin API key.
|
|
1816
|
+
*/
|
|
1817
|
+
getBudgets(orgId: string): Promise<TenantBudgetsView>;
|
|
1818
|
+
/**
|
|
1819
|
+
* Replace another tenant's budget overrides. Zero / missing fields
|
|
1820
|
+
* inherit the server default.
|
|
1821
|
+
*/
|
|
1822
|
+
setBudgets(orgId: string, budgets: Partial<TenantBudgets>): Promise<TenantBudgetsView>;
|
|
1823
|
+
}
|
|
1707
1824
|
|
|
1708
1825
|
/**
|
|
1709
1826
|
* Z3rno SDK error hierarchy.
|
|
@@ -2007,4 +2124,4 @@ declare class Z3rnoMastraMemory {
|
|
|
2007
2124
|
private normaliseRole;
|
|
2008
2125
|
}
|
|
2009
2126
|
|
|
2010
|
-
export { AuditEntry, AuditPageResponse, AuthenticationError, BatchStoreResponse, ConversationResponse, type CoreMessage, DistillJobResponse, DistillJobStatusResponse, EndSessionResponse, ForgetResponse, IngestJobResponse, IngestJobStatusResponse, type MastraMessage, type MastraRole, MemoryHistoryResponse, MemoryResponse, MemoryType, MemoryVersion, NotFoundError, RateLimitError, RecallResponse, RecallResultItem, RefineJobResponse, RefineJobStatusResponse, RelationshipType, RetrievalStrategy, ServerError, SessionResponse, StoreMemoryRequest, TenantBudgets, TenantBudgetsView, TurnAddResponse, TurnListResponse, TurnResponse, ValidationError, Z3rnoClient, type Z3rnoClientConfig, Z3rnoConnectionError, Z3rnoError, Z3rnoMastraMemory, type Z3rnoMastraMemoryOptions, type Z3rnoMessageRole, Z3rnoTimeoutError, Z3rnoVercelMemory, type Z3rnoVercelMemoryOptions };
|
|
2127
|
+
export { AdminAPI, AuditEntry, AuditPageResponse, AuthenticationError, BatchStoreResponse, ConversationResponse, type CoreMessage, DistillJobResponse, DistillJobStatusResponse, EndSessionResponse, ForgetResponse, IngestJobResponse, IngestJobStatusResponse, type MastraMessage, type MastraRole, MemoryHistoryResponse, MemoryResponse, MemoryType, MemoryVersion, NotFoundError, RateLimitError, RecallResponse, RecallResultItem, RefineJobResponse, RefineJobStatusResponse, RelationshipType, RetrievalStrategy, ServerError, SessionResponse, StoreMemoryRequest, TenantBudgets, TenantBudgetsView, TurnAddResponse, TurnListResponse, TurnResponse, ValidationError, Z3rnoClient, type Z3rnoClientConfig, Z3rnoConnectionError, Z3rnoError, Z3rnoMastraMemory, type Z3rnoMastraMemoryOptions, type Z3rnoMessageRole, Z3rnoTimeoutError, Z3rnoVercelMemory, type Z3rnoVercelMemoryOptions };
|
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),
|
|
@@ -966,6 +974,18 @@ var Z3rnoClient = class {
|
|
|
966
974
|
return TurnListResponse.parse(resp);
|
|
967
975
|
}
|
|
968
976
|
// --- Tenant budgets (v0.20.3) ---
|
|
977
|
+
/**
|
|
978
|
+
* Cross-tenant admin sub-namespace (v0.22.1, slice 21.3).
|
|
979
|
+
*
|
|
980
|
+
* Pairs with z3rno-server v0.22.1's `/v1/tenants/{orgId}/budgets`
|
|
981
|
+
* surface. Requires `SUPERADMIN_ENABLED=true` on the server and
|
|
982
|
+
* the client to be configured with the matching superadmin API
|
|
983
|
+
* key. Methods raise `AuthenticationError` (401) or a generic
|
|
984
|
+
* `Z3rnoError` (403) otherwise.
|
|
985
|
+
*/
|
|
986
|
+
get admin() {
|
|
987
|
+
return new AdminAPI(this.request.bind(this));
|
|
988
|
+
}
|
|
969
989
|
/**
|
|
970
990
|
* Read this org's stored budget overrides + resolved effective caps.
|
|
971
991
|
* Auth: any admin/write/read member of the calling org.
|
|
@@ -1109,6 +1129,38 @@ var Z3rnoClient = class {
|
|
|
1109
1129
|
}
|
|
1110
1130
|
}
|
|
1111
1131
|
};
|
|
1132
|
+
var AdminAPI = class {
|
|
1133
|
+
constructor(request) {
|
|
1134
|
+
this.request = request;
|
|
1135
|
+
}
|
|
1136
|
+
request;
|
|
1137
|
+
/**
|
|
1138
|
+
* Read another tenant's budget overrides + effective caps.
|
|
1139
|
+
*
|
|
1140
|
+
* Requires `SUPERADMIN_ENABLED=true` server-side and the client to
|
|
1141
|
+
* be configured with the superadmin API key.
|
|
1142
|
+
*/
|
|
1143
|
+
async getBudgets(orgId) {
|
|
1144
|
+
const resp = await this.request("GET", `/v1/tenants/${orgId}/budgets`);
|
|
1145
|
+
return TenantBudgetsView.parse(resp);
|
|
1146
|
+
}
|
|
1147
|
+
/**
|
|
1148
|
+
* Replace another tenant's budget overrides. Zero / missing fields
|
|
1149
|
+
* inherit the server default.
|
|
1150
|
+
*/
|
|
1151
|
+
async setBudgets(orgId, budgets) {
|
|
1152
|
+
const body = {
|
|
1153
|
+
daily_tokens: budgets.daily_tokens ?? 0,
|
|
1154
|
+
daily_llm_calls: budgets.daily_llm_calls ?? 0,
|
|
1155
|
+
daily_embeddings: budgets.daily_embeddings ?? 0,
|
|
1156
|
+
monthly_tokens: budgets.monthly_tokens ?? 0,
|
|
1157
|
+
monthly_llm_calls: budgets.monthly_llm_calls ?? 0,
|
|
1158
|
+
monthly_embeddings: budgets.monthly_embeddings ?? 0
|
|
1159
|
+
};
|
|
1160
|
+
const resp = await this.request("PUT", `/v1/tenants/${orgId}/budgets`, body);
|
|
1161
|
+
return TenantBudgetsView.parse(resp);
|
|
1162
|
+
}
|
|
1163
|
+
};
|
|
1112
1164
|
|
|
1113
1165
|
// src/integrations/vercel-ai.ts
|
|
1114
1166
|
var Z3rnoVercelMemory = class {
|
|
@@ -1259,6 +1311,6 @@ var Z3rnoMastraMemory = class {
|
|
|
1259
1311
|
}
|
|
1260
1312
|
};
|
|
1261
1313
|
|
|
1262
|
-
export { AuditEntry, AuditPageResponse, AuthenticationError, BatchStoreResponse, ConversationResponse, DistillJobResponse, DistillJobStatusResponse, EndSessionResponse, ForgetResponse, IngestJobResponse, IngestJobStatusResponse, MemoryHistoryResponse, MemoryResponse, MemoryType, MemoryVersion, NotFoundError, RateLimitError, RecallResponse, RecallResultItem, RefineJobResponse, RefineJobStatusResponse, RelationshipType, RetrievalStrategy, ServerError, SessionResponse, TenantBudgets, TenantBudgetsView, TurnAddResponse, TurnListResponse, TurnResponse, ValidationError, Z3rnoClient, Z3rnoConnectionError, Z3rnoError, Z3rnoMastraMemory, Z3rnoTimeoutError, Z3rnoVercelMemory };
|
|
1314
|
+
export { AdminAPI, AuditEntry, AuditPageResponse, AuthenticationError, BatchStoreResponse, ConversationResponse, DistillJobResponse, DistillJobStatusResponse, EndSessionResponse, ForgetResponse, IngestJobResponse, IngestJobStatusResponse, MemoryHistoryResponse, MemoryResponse, MemoryType, MemoryVersion, NotFoundError, RateLimitError, RecallResponse, RecallResultItem, RefineJobResponse, RefineJobStatusResponse, RelationshipType, RetrievalStrategy, ServerError, SessionResponse, TenantBudgets, TenantBudgetsView, TurnAddResponse, TurnListResponse, TurnResponse, ValidationError, Z3rnoClient, Z3rnoConnectionError, Z3rnoError, Z3rnoMastraMemory, Z3rnoTimeoutError, Z3rnoVercelMemory };
|
|
1263
1315
|
//# sourceMappingURL=index.js.map
|
|
1264
1316
|
//# sourceMappingURL=index.js.map
|