@nexusm/sdk 1.3.3 → 3.0.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.d.mts +190 -188
- package/dist/index.d.ts +190 -188
- package/dist/index.js +18 -33
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -32
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -656,122 +656,88 @@ interface ContextRequest {
|
|
|
656
656
|
as_of?: string;
|
|
657
657
|
}
|
|
658
658
|
/**
|
|
659
|
-
* A
|
|
660
|
-
*
|
|
659
|
+
* A user profile memory element (`ContextRetrieveResponse.profile[]`).
|
|
660
|
+
* Mirrors backend `ProfileMemory`.
|
|
661
661
|
*/
|
|
662
|
-
interface
|
|
663
|
-
/**
|
|
664
|
-
|
|
662
|
+
interface ProfileMemory {
|
|
663
|
+
/** Memory identifier */
|
|
664
|
+
memory_id: string;
|
|
665
665
|
/** Memory content text */
|
|
666
666
|
content: string;
|
|
667
|
-
/**
|
|
668
|
-
memory_type:
|
|
667
|
+
/** Memory type */
|
|
668
|
+
memory_type: string;
|
|
669
|
+
/** Optional category */
|
|
670
|
+
category?: string | null;
|
|
669
671
|
/** Relevance score from similarity search */
|
|
670
|
-
|
|
671
|
-
/**
|
|
672
|
-
|
|
672
|
+
similarity_score?: number | null;
|
|
673
|
+
/** Arbitrary metadata */
|
|
674
|
+
metadata?: Record<string, unknown>;
|
|
673
675
|
}
|
|
674
676
|
/**
|
|
675
|
-
*
|
|
676
|
-
*
|
|
677
|
+
* A conversation message element (`ContextRetrieveResponse.history[]`).
|
|
678
|
+
* Mirrors backend `ConversationMessage`.
|
|
677
679
|
*/
|
|
678
|
-
interface
|
|
679
|
-
/**
|
|
680
|
-
|
|
681
|
-
/** Total number of memories the user has */
|
|
682
|
-
total_count: number;
|
|
683
|
-
}
|
|
684
|
-
/** A single message within conversation history. */
|
|
685
|
-
interface ContextMessage {
|
|
680
|
+
interface ConversationMessage {
|
|
681
|
+
/** Message identifier */
|
|
682
|
+
message_id: string;
|
|
686
683
|
/** Message role */
|
|
687
684
|
role: 'user' | 'assistant' | 'system' | 'tool';
|
|
688
685
|
/** Message content text */
|
|
689
686
|
content: string;
|
|
690
|
-
/**
|
|
687
|
+
/** Creation timestamp (ISO 8601) */
|
|
691
688
|
created_at: string;
|
|
689
|
+
/** Arbitrary metadata */
|
|
690
|
+
metadata?: Record<string, unknown>;
|
|
692
691
|
}
|
|
693
692
|
/**
|
|
694
|
-
*
|
|
695
|
-
*
|
|
696
|
-
*/
|
|
697
|
-
interface ContextHistory {
|
|
698
|
-
/** List of recent messages */
|
|
699
|
-
messages: ContextMessage[];
|
|
700
|
-
/** Auto-generated conversation summary (if available) */
|
|
701
|
-
summary?: string;
|
|
702
|
-
/** Session identifier */
|
|
703
|
-
session_id?: string;
|
|
704
|
-
}
|
|
705
|
-
/** Entity ownership type in the knowledge graph */
|
|
706
|
-
type OwnerType = 'agent' | 'user';
|
|
707
|
-
/**
|
|
708
|
-
* A knowledge entity within the graph context.
|
|
709
|
-
* Sourced from Fast GraphRAG.
|
|
693
|
+
* A knowledge graph entity element (`ContextRetrieveResponse.graph[]`).
|
|
694
|
+
* Mirrors backend `ContextGraphEntity`.
|
|
710
695
|
*/
|
|
711
|
-
interface
|
|
712
|
-
/**
|
|
713
|
-
|
|
696
|
+
interface ContextGraphEntity {
|
|
697
|
+
/** Entity identifier */
|
|
698
|
+
entity_id: string;
|
|
714
699
|
/** Entity display name */
|
|
715
700
|
name: string;
|
|
716
|
-
/** Entity type classification
|
|
717
|
-
|
|
701
|
+
/** Entity type classification */
|
|
702
|
+
type: string;
|
|
718
703
|
/** Entity description */
|
|
719
|
-
description?: string;
|
|
720
|
-
/**
|
|
721
|
-
|
|
722
|
-
/**
|
|
723
|
-
|
|
724
|
-
}
|
|
725
|
-
/** A relationship between two entities in the knowledge graph. */
|
|
726
|
-
interface ContextRelation {
|
|
727
|
-
/** Source entity name */
|
|
728
|
-
source: string;
|
|
729
|
-
/** Relationship type label */
|
|
730
|
-
relation: string;
|
|
731
|
-
/** Target entity name */
|
|
732
|
-
target: string;
|
|
733
|
-
/** Relationship weight/strength */
|
|
734
|
-
weight?: number;
|
|
735
|
-
}
|
|
736
|
-
/**
|
|
737
|
-
* Knowledge graph section of the context response.
|
|
738
|
-
* Sourced from Fast GraphRAG.
|
|
739
|
-
*/
|
|
740
|
-
interface ContextGraph {
|
|
741
|
-
/** List of relevant entities */
|
|
742
|
-
entities: ContextEntity[];
|
|
743
|
-
/** List of relationships between entities */
|
|
744
|
-
relations: ContextRelation[];
|
|
745
|
-
}
|
|
746
|
-
/**
|
|
747
|
-
* Retrieval performance metadata.
|
|
748
|
-
* Provides timing information for each retrieval layer.
|
|
749
|
-
*/
|
|
750
|
-
interface ContextMeta {
|
|
751
|
-
/** Total retrieval time in milliseconds */
|
|
752
|
-
took_ms: number;
|
|
753
|
-
/** Memory retrieval time in milliseconds */
|
|
754
|
-
memory_took_ms?: number;
|
|
755
|
-
/** History retrieval time in milliseconds */
|
|
756
|
-
history_took_ms?: number;
|
|
757
|
-
/** Graph retrieval time in milliseconds */
|
|
758
|
-
graph_took_ms?: number;
|
|
759
|
-
/** Original query text */
|
|
760
|
-
query?: string;
|
|
704
|
+
description?: string | null;
|
|
705
|
+
/** Relationships (free-form objects) */
|
|
706
|
+
relationships?: Array<Record<string, unknown>>;
|
|
707
|
+
/** Relevance score for unified ranking */
|
|
708
|
+
relevance_score?: number;
|
|
761
709
|
}
|
|
762
710
|
/**
|
|
763
711
|
* Aggregated context response from the retrieve endpoint.
|
|
764
|
-
*
|
|
712
|
+
*
|
|
713
|
+
* **v2.0.0 BREAKING (contract reconciliation, ADR-003):** canonical = backend
|
|
714
|
+
* flat-array shape. `profile`/`history`/`graph` are now flat arrays (not nested
|
|
715
|
+
* `{memories,...}` containers); `meta` is removed (use `total_latency_ms`);
|
|
716
|
+
* top-level diagnostic/identity fields are surfaced directly.
|
|
765
717
|
*/
|
|
766
718
|
interface ContextRetrieveResponse {
|
|
767
|
-
/**
|
|
768
|
-
|
|
769
|
-
/**
|
|
770
|
-
|
|
771
|
-
/**
|
|
772
|
-
|
|
773
|
-
/**
|
|
774
|
-
|
|
719
|
+
/** Unique retrieval ID for feedback association (PUT /feedback/{retrieve_id}, 7d window) */
|
|
720
|
+
retrieve_id?: string | null;
|
|
721
|
+
/** User profile memories (flat array) */
|
|
722
|
+
profile?: ProfileMemory[] | null;
|
|
723
|
+
/** Conversation history (flat array) */
|
|
724
|
+
history?: ConversationMessage[] | null;
|
|
725
|
+
/** Knowledge graph entities (flat array) */
|
|
726
|
+
graph?: ContextGraphEntity[] | null;
|
|
727
|
+
/** AI-synthesized user profile (free-form key-value) */
|
|
728
|
+
ai_profile?: Record<string, unknown> | null;
|
|
729
|
+
/** Retrieval completion timestamp (ISO 8601) */
|
|
730
|
+
retrieved_at: string;
|
|
731
|
+
/** Total retrieval time in milliseconds */
|
|
732
|
+
total_latency_ms: number;
|
|
733
|
+
/** Partial-failure errors (sub-service name -> message) */
|
|
734
|
+
errors?: Record<string, string> | null;
|
|
735
|
+
/** A/B experiment group assignment (US-030) */
|
|
736
|
+
experiment_group?: 'control' | 'treatment' | 'override_vector' | 'override_rerank' | 'error' | null;
|
|
737
|
+
/** Count of memories removed by US-035 temporal validity filter (diagnostic; 0 = none filtered) */
|
|
738
|
+
temporal_filtered_count?: number | null;
|
|
739
|
+
/** Echoes the request `as_of` anchor (null for current-time retrieval) */
|
|
740
|
+
as_of?: string | null;
|
|
775
741
|
}
|
|
776
742
|
|
|
777
743
|
/**
|
|
@@ -914,16 +880,42 @@ interface MemorySearch {
|
|
|
914
880
|
*/
|
|
915
881
|
threshold?: number;
|
|
916
882
|
}
|
|
883
|
+
/**
|
|
884
|
+
* A single semantic-search result element (`MemorySearchResult.results[]`).
|
|
885
|
+
* Mirrors backend `SearchResult` (flat — not a nested `Memory` object).
|
|
886
|
+
*
|
|
887
|
+
* @since 2.0.0
|
|
888
|
+
*/
|
|
889
|
+
interface SearchResult {
|
|
890
|
+
/** Memory identifier */
|
|
891
|
+
memory_id: string;
|
|
892
|
+
/** Memory content text */
|
|
893
|
+
content: string;
|
|
894
|
+
/** Memory type */
|
|
895
|
+
memory_type: string;
|
|
896
|
+
/** Similarity score (0..1) */
|
|
897
|
+
similarity: number;
|
|
898
|
+
/** Arbitrary metadata */
|
|
899
|
+
metadata?: Record<string, unknown>;
|
|
900
|
+
}
|
|
917
901
|
/**
|
|
918
902
|
* Response from a semantic memory search operation.
|
|
903
|
+
*
|
|
904
|
+
* **v2.0.0 BREAKING (contract reconciliation, ADR-003):** canonical = backend
|
|
905
|
+
* `MemorySearchResponse`. `results` is now a flat `SearchResult[]` (not
|
|
906
|
+
* `Memory[]`); `took_ms` renamed `search_time_ms`; `total_found` added.
|
|
907
|
+
* (Backend response_model is named `MemorySearchResponse`; this SDK type keeps
|
|
908
|
+
* the name `MemorySearchResult` — shapes are identical.)
|
|
919
909
|
*/
|
|
920
910
|
interface MemorySearchResult {
|
|
921
|
-
/**
|
|
922
|
-
results:
|
|
911
|
+
/** Matching results (flat) */
|
|
912
|
+
results: SearchResult[];
|
|
923
913
|
/** Original search query */
|
|
924
914
|
query: string;
|
|
915
|
+
/** Total number of matches found */
|
|
916
|
+
total_found: number;
|
|
925
917
|
/** Search execution time in milliseconds */
|
|
926
|
-
|
|
918
|
+
search_time_ms: number;
|
|
927
919
|
}
|
|
928
920
|
/**
|
|
929
921
|
* Paginated list of memories.
|
|
@@ -1512,26 +1504,15 @@ interface GraphQueryResponse {
|
|
|
1512
1504
|
*/
|
|
1513
1505
|
|
|
1514
1506
|
/**
|
|
1515
|
-
*
|
|
1507
|
+
* Parameters for listing knowledge entities.
|
|
1516
1508
|
*
|
|
1517
|
-
*
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
/** Entity display name */
|
|
1521
|
-
name: string;
|
|
1522
|
-
/** Entity type classification (e.g., Person, Organization, Concept) */
|
|
1523
|
-
entity_type: string;
|
|
1524
|
-
/** Entity description */
|
|
1525
|
-
description?: string;
|
|
1526
|
-
/** Additional entity properties */
|
|
1527
|
-
properties?: Record<string, unknown>;
|
|
1528
|
-
}
|
|
1529
|
-
/**
|
|
1530
|
-
* Parameters for listing knowledge entities with optional filtering.
|
|
1509
|
+
* v3.0.0 BREAKING: `user_id` is required — the backend (and OpenAPI) demand
|
|
1510
|
+
* it (`Query(..., min_length=1)`); the previous optional typing let calls
|
|
1511
|
+
* compile that 422'd at runtime.
|
|
1531
1512
|
*/
|
|
1532
1513
|
interface EntityListParams {
|
|
1533
|
-
/**
|
|
1534
|
-
user_id
|
|
1514
|
+
/** Entity owner user ID (required by the backend) */
|
|
1515
|
+
user_id: string;
|
|
1535
1516
|
/** Filter by entity type classification */
|
|
1536
1517
|
entity_type?: string;
|
|
1537
1518
|
/** Maximum number of results to return */
|
|
@@ -1542,9 +1523,11 @@ interface EntityListParams {
|
|
|
1542
1523
|
/**
|
|
1543
1524
|
* Service for managing the knowledge graph via Fast GraphRAG.
|
|
1544
1525
|
*
|
|
1545
|
-
* Provides entity
|
|
1526
|
+
* Provides entity listing, BFS graph traversal queries, and automatic
|
|
1546
1527
|
* entity/relationship extraction from unstructured text. Supports
|
|
1547
1528
|
* both public (agent-owned) and private (user-owned) knowledge.
|
|
1529
|
+
* (v3.0.0: entity creation was removed — the backend has no
|
|
1530
|
+
* POST /knowledge/entities route; entities are created via extract().)
|
|
1548
1531
|
*
|
|
1549
1532
|
* @example
|
|
1550
1533
|
* ```typescript
|
|
@@ -1567,19 +1550,12 @@ interface EntityListParams {
|
|
|
1567
1550
|
*/
|
|
1568
1551
|
declare class KnowledgeService extends BaseService {
|
|
1569
1552
|
/**
|
|
1570
|
-
*
|
|
1553
|
+
* List knowledge entities for a user with optional filtering.
|
|
1571
1554
|
*
|
|
1572
|
-
* @param
|
|
1573
|
-
* @returns The newly created entity with generated entity_id.
|
|
1574
|
-
*/
|
|
1575
|
-
createEntity(data: EntityCreate, options?: RequestOptions): Promise<KnowledgeEntity>;
|
|
1576
|
-
/**
|
|
1577
|
-
* List knowledge entities with optional filtering.
|
|
1578
|
-
*
|
|
1579
|
-
* @param params - Optional filters for user_id, entity_type, and pagination controls.
|
|
1555
|
+
* @param params - Filters: required user_id (backend-enforced), optional entity_type and pagination controls.
|
|
1580
1556
|
* @returns Paginated list of knowledge entities.
|
|
1581
1557
|
*/
|
|
1582
|
-
listEntities(params
|
|
1558
|
+
listEntities(params: EntityListParams, options?: RequestOptions): Promise<EntityListResponse>;
|
|
1583
1559
|
/**
|
|
1584
1560
|
* Query the knowledge graph using BFS traversal.
|
|
1585
1561
|
*
|
|
@@ -1761,14 +1737,21 @@ declare class ActivityService extends BaseService {
|
|
|
1761
1737
|
* Supports multi-tenant isolation, API key management,
|
|
1762
1738
|
* quota tracking, and usage statistics.
|
|
1763
1739
|
*
|
|
1764
|
-
*
|
|
1740
|
+
* v3.0.0 BREAKING (tenant-contract-reconciliation, 2026-06-10): canonical =
|
|
1741
|
+
* backend Pydantic response models (`schemas/tenant.py`). The previous shapes
|
|
1742
|
+
* were drifted: `Tenant` had a phantom nested `usage` object (the wire is
|
|
1743
|
+
* flat), `UsageStats` declared 3 phantom fields and missed 11 real ones, and
|
|
1744
|
+
* `ApiKeyCreate` used the phantom request field `expires_days` (the wire is
|
|
1745
|
+
* `expires_in_days` — the old name was silently dropped by the backend,
|
|
1746
|
+
* creating never-expiring keys).
|
|
1765
1747
|
*/
|
|
1766
1748
|
/** Available tenant subscription tiers */
|
|
1767
1749
|
type TenantTier = 'free' | 'starter' | 'pro' | 'enterprise';
|
|
1768
|
-
/** API Key permission scopes */
|
|
1769
|
-
type ApiKeyScope = 'read' | 'write' | 'admin';
|
|
1770
1750
|
/**
|
|
1771
1751
|
* Tenant quotas configuration defining resource limits.
|
|
1752
|
+
*
|
|
1753
|
+
* The backend serializes a free-form object; the keys below are the
|
|
1754
|
+
* well-known ones. Unknown keys are preserved via the index signature.
|
|
1772
1755
|
*/
|
|
1773
1756
|
interface TenantQuotas {
|
|
1774
1757
|
/** Maximum number of memories allowed */
|
|
@@ -1777,23 +1760,18 @@ interface TenantQuotas {
|
|
|
1777
1760
|
max_conversations?: number;
|
|
1778
1761
|
/** Maximum API calls per day */
|
|
1779
1762
|
max_api_calls_per_day?: number;
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
* Current resource usage counts for a tenant.
|
|
1783
|
-
*/
|
|
1784
|
-
interface TenantUsage {
|
|
1785
|
-
/** Current number of memories stored */
|
|
1786
|
-
memories_count?: number;
|
|
1787
|
-
/** Current number of conversations */
|
|
1788
|
-
conversations_count?: number;
|
|
1789
|
-
/** API calls made today */
|
|
1790
|
-
api_calls_today?: number;
|
|
1763
|
+
/** Forward-compatible: any additional quota dimensions */
|
|
1764
|
+
[key: string]: unknown;
|
|
1791
1765
|
}
|
|
1792
1766
|
/**
|
|
1793
1767
|
* A tenant (organization) on the Nexus platform.
|
|
1794
1768
|
* Each tenant has isolated data and configurable quotas.
|
|
1795
1769
|
*
|
|
1796
|
-
* GET /tenants/me
|
|
1770
|
+
* GET /tenants/me — mirrors backend `TenantInfoResponse` (flat shape).
|
|
1771
|
+
*
|
|
1772
|
+
* v3.0.0 BREAKING: usage counts are FLAT top-level fields (the nested
|
|
1773
|
+
* `usage` object never existed on the wire); adds `quota_remaining` and
|
|
1774
|
+
* `graph_nodes_count` (previously missing).
|
|
1797
1775
|
*/
|
|
1798
1776
|
interface Tenant {
|
|
1799
1777
|
/** Unique tenant identifier (UUID) */
|
|
@@ -1803,17 +1781,28 @@ interface Tenant {
|
|
|
1803
1781
|
/** Subscription tier */
|
|
1804
1782
|
tier: TenantTier;
|
|
1805
1783
|
/** Resource quotas */
|
|
1806
|
-
quotas
|
|
1807
|
-
/**
|
|
1808
|
-
|
|
1784
|
+
quotas: TenantQuotas;
|
|
1785
|
+
/** Remaining headroom per quota dimension */
|
|
1786
|
+
quota_remaining: Record<string, number>;
|
|
1809
1787
|
/** Timestamp when the tenant was created (ISO 8601) */
|
|
1810
1788
|
created_at: string;
|
|
1789
|
+
/** Current number of memories stored (flat — not nested under `usage`) */
|
|
1790
|
+
memories_count: number;
|
|
1791
|
+
/** Current number of conversations (flat — not nested under `usage`) */
|
|
1792
|
+
conversations_count: number;
|
|
1793
|
+
/** Current number of knowledge graph nodes */
|
|
1794
|
+
graph_nodes_count: number;
|
|
1811
1795
|
}
|
|
1812
1796
|
/**
|
|
1813
1797
|
* An API key for authenticating with the Nexus platform.
|
|
1814
1798
|
* The full key value is only returned once at creation time.
|
|
1815
1799
|
*
|
|
1816
1800
|
* GET /tenants/me/api-keys
|
|
1801
|
+
*
|
|
1802
|
+
* v3.0.0: `scopes` is a free-form string array documenting backend reality —
|
|
1803
|
+
* known values are `"read"`, `"write"`, `"admin"` and the `"*"` wildcard
|
|
1804
|
+
* (the backend authorizes via `scope in scopes or "*" in scopes`). The old
|
|
1805
|
+
* `ApiKeyScope` enum could not represent `"*"`, the actual default.
|
|
1817
1806
|
*/
|
|
1818
1807
|
interface ApiKey {
|
|
1819
1808
|
/** Unique API key identifier (UUID) */
|
|
@@ -1822,8 +1811,8 @@ interface ApiKey {
|
|
|
1822
1811
|
key_prefix: string;
|
|
1823
1812
|
/** Human-readable name for the API key */
|
|
1824
1813
|
name: string;
|
|
1825
|
-
/** Permission scopes granted to this key */
|
|
1826
|
-
scopes:
|
|
1814
|
+
/** Permission scopes granted to this key (known values: read, write, admin, "*") */
|
|
1815
|
+
scopes: string[];
|
|
1827
1816
|
/** Expiration timestamp (null = never expires) (ISO 8601) */
|
|
1828
1817
|
expires_at?: string | null;
|
|
1829
1818
|
/** Last time this key was used (ISO 8601) */
|
|
@@ -1834,23 +1823,28 @@ interface ApiKey {
|
|
|
1834
1823
|
/**
|
|
1835
1824
|
* Request payload for creating a new API key.
|
|
1836
1825
|
*
|
|
1837
|
-
* POST /tenants/me/api-keys
|
|
1826
|
+
* POST /tenants/me/api-keys — mirrors backend `ApiKeyCreate`.
|
|
1827
|
+
*
|
|
1828
|
+
* v3.0.0 BREAKING: `expires_days` → `expires_in_days` (the backend request
|
|
1829
|
+
* field). The old name was silently ignored by the backend (no
|
|
1830
|
+
* `extra=forbid`), so keys created through the SDK never expired.
|
|
1838
1831
|
*/
|
|
1839
1832
|
interface ApiKeyCreate {
|
|
1840
|
-
/** Human-readable name for the API key (1-
|
|
1833
|
+
/** Human-readable name for the API key (1-255 characters) */
|
|
1841
1834
|
name: string;
|
|
1842
1835
|
/**
|
|
1843
|
-
* Permission scopes for the key.
|
|
1844
|
-
* @default ["
|
|
1836
|
+
* Permission scopes for the key (known values: read, write, admin, "*").
|
|
1837
|
+
* @default ["*"] — the backend default grants the full wildcard; tightening
|
|
1838
|
+
* the default is a separate backend security follow-up.
|
|
1845
1839
|
*/
|
|
1846
|
-
scopes?:
|
|
1840
|
+
scopes?: string[];
|
|
1847
1841
|
/**
|
|
1848
1842
|
* Number of days until the key expires.
|
|
1849
1843
|
* Omit for a key that never expires.
|
|
1850
1844
|
* @minimum 1
|
|
1851
1845
|
* @maximum 365
|
|
1852
1846
|
*/
|
|
1853
|
-
|
|
1847
|
+
expires_in_days?: number;
|
|
1854
1848
|
}
|
|
1855
1849
|
/**
|
|
1856
1850
|
* Response from creating a new API key.
|
|
@@ -1867,19 +1861,40 @@ interface ApiKeyCreated extends ApiKey {
|
|
|
1867
1861
|
/**
|
|
1868
1862
|
* Usage statistics for a tenant over a specific time period.
|
|
1869
1863
|
*
|
|
1870
|
-
* GET /tenants/me/usage
|
|
1864
|
+
* GET /tenants/me/usage — mirrors backend `UsageStatsResponse` (13 fields).
|
|
1865
|
+
*
|
|
1866
|
+
* v3.0.0 BREAKING: full realignment. The previous 5-field shape declared 3
|
|
1867
|
+
* phantom fields (`tokens_used` / `memories_created` / `conversations_created`)
|
|
1868
|
+
* and missed the latency/success-rate/storage fields the backend actually
|
|
1869
|
+
* emits.
|
|
1871
1870
|
*/
|
|
1872
1871
|
interface UsageStats {
|
|
1872
|
+
/** Tenant identifier (UUID) */
|
|
1873
|
+
tenant_id: string;
|
|
1873
1874
|
/** Time period for the statistics */
|
|
1874
1875
|
period: 'day' | 'week' | 'month';
|
|
1875
1876
|
/** Total API calls in the period */
|
|
1876
1877
|
api_calls: number;
|
|
1877
|
-
/**
|
|
1878
|
-
|
|
1879
|
-
/**
|
|
1880
|
-
|
|
1881
|
-
/**
|
|
1882
|
-
|
|
1878
|
+
/** Success rate over the period (0-100) */
|
|
1879
|
+
success_rate: number;
|
|
1880
|
+
/** Average request latency in milliseconds */
|
|
1881
|
+
avg_latency_ms: number;
|
|
1882
|
+
/** p50 latency in milliseconds (null when no traffic) */
|
|
1883
|
+
p50_latency_ms?: number | null;
|
|
1884
|
+
/** p95 latency in milliseconds (null when no traffic) */
|
|
1885
|
+
p95_latency_ms?: number | null;
|
|
1886
|
+
/** p99 latency in milliseconds (null when no traffic) */
|
|
1887
|
+
p99_latency_ms?: number | null;
|
|
1888
|
+
/** Current number of memories stored */
|
|
1889
|
+
memories_count: number;
|
|
1890
|
+
/** Current number of conversations */
|
|
1891
|
+
conversations_count: number;
|
|
1892
|
+
/** Current number of knowledge graph nodes */
|
|
1893
|
+
graph_nodes_count: number;
|
|
1894
|
+
/** Storage consumed in bytes */
|
|
1895
|
+
storage_used_bytes: number;
|
|
1896
|
+
/** Storage limit in bytes */
|
|
1897
|
+
storage_limit_bytes: number;
|
|
1883
1898
|
}
|
|
1884
1899
|
|
|
1885
1900
|
/**
|
|
@@ -1908,9 +1923,9 @@ interface UsageStats {
|
|
|
1908
1923
|
* const tenant = await nexus.tenants.me();
|
|
1909
1924
|
* console.log(`Tenant: ${tenant.name} (${tenant.tier})`);
|
|
1910
1925
|
*
|
|
1911
|
-
* // Check
|
|
1912
|
-
* const usage = await nexus.tenants.usage();
|
|
1913
|
-
* console.log(`
|
|
1926
|
+
* // Check usage statistics for the last week
|
|
1927
|
+
* const usage = await nexus.tenants.usage('week');
|
|
1928
|
+
* console.log(`API calls: ${usage.api_calls} (${usage.success_rate}% ok)`);
|
|
1914
1929
|
* ```
|
|
1915
1930
|
*/
|
|
1916
1931
|
declare class TenantService extends BaseService {
|
|
@@ -1924,14 +1939,17 @@ declare class TenantService extends BaseService {
|
|
|
1924
1939
|
*/
|
|
1925
1940
|
me(options?: RequestOptions): Promise<Tenant>;
|
|
1926
1941
|
/**
|
|
1927
|
-
* Retrieve the current tenant's
|
|
1942
|
+
* Retrieve the current tenant's usage statistics.
|
|
1928
1943
|
*
|
|
1929
|
-
* Returns counts
|
|
1930
|
-
*
|
|
1944
|
+
* Returns API-call counts, success rate, latency percentiles, resource
|
|
1945
|
+
* counts, and storage usage for the requested period — the backend
|
|
1946
|
+
* `UsageStatsResponse` shape (v3.0.0: previously mistyped as a 3-field
|
|
1947
|
+
* `TenantUsage` that never matched the wire).
|
|
1931
1948
|
*
|
|
1932
|
-
* @
|
|
1949
|
+
* @param period - Statistics window: `'day'` (default) | `'week'` | `'month'`.
|
|
1950
|
+
* @returns Usage statistics for the authenticated tenant.
|
|
1933
1951
|
*/
|
|
1934
|
-
usage(options?: RequestOptions): Promise<
|
|
1952
|
+
usage(period?: 'day' | 'week' | 'month', options?: RequestOptions): Promise<UsageStats>;
|
|
1935
1953
|
/**
|
|
1936
1954
|
* List all API keys for the current tenant.
|
|
1937
1955
|
*
|
|
@@ -2512,22 +2530,6 @@ declare const messageCreateSchema: z.ZodObject<{
|
|
|
2512
2530
|
metadata?: Record<string, unknown> | undefined;
|
|
2513
2531
|
}>;
|
|
2514
2532
|
|
|
2515
|
-
declare const entityCreateSchema: z.ZodObject<{
|
|
2516
|
-
name: z.ZodString;
|
|
2517
|
-
entity_type: z.ZodString;
|
|
2518
|
-
description: z.ZodOptional<z.ZodString>;
|
|
2519
|
-
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
2520
|
-
}, "strip", z.ZodTypeAny, {
|
|
2521
|
-
name: string;
|
|
2522
|
-
entity_type: string;
|
|
2523
|
-
description?: string | undefined;
|
|
2524
|
-
properties?: Record<string, unknown> | undefined;
|
|
2525
|
-
}, {
|
|
2526
|
-
name: string;
|
|
2527
|
-
entity_type: string;
|
|
2528
|
-
description?: string | undefined;
|
|
2529
|
-
properties?: Record<string, unknown> | undefined;
|
|
2530
|
-
}>;
|
|
2531
2533
|
declare const graphQueryRequestSchema: z.ZodObject<{
|
|
2532
2534
|
entity_name: z.ZodString;
|
|
2533
2535
|
depth: z.ZodOptional<z.ZodNumber>;
|
|
@@ -2557,16 +2559,16 @@ declare const extractionRequestSchema: z.ZodObject<{
|
|
|
2557
2559
|
|
|
2558
2560
|
declare const apiKeyCreateSchema: z.ZodObject<{
|
|
2559
2561
|
name: z.ZodString;
|
|
2560
|
-
scopes: z.ZodOptional<z.ZodArray<z.
|
|
2561
|
-
|
|
2562
|
+
scopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
2563
|
+
expires_in_days: z.ZodOptional<z.ZodNumber>;
|
|
2562
2564
|
}, "strip", z.ZodTypeAny, {
|
|
2563
2565
|
name: string;
|
|
2564
|
-
scopes?:
|
|
2565
|
-
|
|
2566
|
+
scopes?: string[] | undefined;
|
|
2567
|
+
expires_in_days?: number | undefined;
|
|
2566
2568
|
}, {
|
|
2567
2569
|
name: string;
|
|
2568
|
-
scopes?:
|
|
2569
|
-
|
|
2570
|
+
scopes?: string[] | undefined;
|
|
2571
|
+
expires_in_days?: number | undefined;
|
|
2570
2572
|
}>;
|
|
2571
2573
|
|
|
2572
|
-
export { type Activity, type ActivityProcessingStatus, ActivityService, type ActivityStats, type ActivityStatusResponse, type ActivityStreamRequest, type ActivityStreamResponse, type ActivityType, ApiError, type ApiErrorDetail, type ApiKey, type ApiKeyCreate, type ApiKeyCreated, type
|
|
2574
|
+
export { type Activity, type ActivityProcessingStatus, ActivityService, type ActivityStats, type ActivityStatusResponse, type ActivityStreamRequest, type ActivityStreamResponse, type ActivityType, ApiError, type ApiErrorDetail, type ApiKey, type ApiKeyCreate, type ApiKeyCreated, type ApiResponse, AuthenticationError, type CacheConfig, type CompoundId, ConfigurationError, type ContextDepth, type ContextDepthPreset, type ContextGraphEntity, type ContextLayer, type ContextRequest, type ContextRetrieveResponse, ContextService, type Conversation, type ConversationCreate, type ConversationDetail, type ConversationList, type ConversationListParams, type ConversationMessage, ConversationService, type ConversationStatus, type ConversationSummary, DEFAULT_CONFIG, DEPTH_PRESETS, type EntityListParams, type EntityListResponse, type ErrorReportRequest, type ErrorReportResponse, ErrorService, type ErrorSeverity, type ErrorType, type ExtractionRequest, type ExtractionResult, type FeedbackItemRequest, type FeedbackListItem, type FeedbackListParams, type FeedbackListResponse, type FeedbackResponse, FeedbackService, type FeedbackSubmitRequest, type GraphPath, type GraphPathEntity, type GraphPathRelationship, type GraphQueryRequest, type GraphQueryResponse, type HealthResponse, type HealthStatus, InputValidationError, type JournalEntry, type JournalResponse, type KnowledgeEntity, type KnowledgeRelationship, KnowledgeService, type Memory, type MemoryCreate, type MemoryJournalParams, type MemoryList, type MemoryListParams, type MemorySearch, type MemorySearchResult, MemoryService, type MemoryType, type MemoryUpdate, type Message, type MessageCreate, type MessageList, type MessageListParams, type MessageRole, NetworkError, NexusClient, type NexusConfig, NexusError, NotFoundError, type OfflineConfig, OfflineQueue, type PaginatedResponse, type Pagination, type ProfileMemory, type QueuedRequest, RateLimitError, type RequestOptions, type ResolvedCacheConfig, type ResolvedConfig, type ResolvedRetryConfig, type RetryConfig, type SearchResult, type ServiceStatus, type SortOrder, type Tenant, type TenantQuotas, TenantService, type TenantTier, TimeoutError, type UsageStats, ValidationError, apiKeyCreateSchema, contextRequestSchema, conversationCreateSchema, extractionRequestSchema, graphQueryRequestSchema, memoryCreateSchema, memorySearchSchema, memoryUpdateSchema, messageCreateSchema, resolveConfig };
|