@z3rno/sdk 0.6.0 → 0.7.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.d.cts CHANGED
@@ -1103,6 +1103,112 @@ declare const TurnListResponse: z.ZodObject<{
1103
1103
  conversation_id: string;
1104
1104
  }>;
1105
1105
  type TurnListResponse = z.infer<typeof TurnListResponse>;
1106
+ /** Per-tenant budget caps. Zero means inherit server default. */
1107
+ declare const TenantBudgets: z.ZodObject<{
1108
+ daily_tokens: z.ZodNumber;
1109
+ daily_llm_calls: z.ZodNumber;
1110
+ daily_embeddings: z.ZodNumber;
1111
+ monthly_tokens: z.ZodNumber;
1112
+ monthly_llm_calls: z.ZodNumber;
1113
+ monthly_embeddings: z.ZodNumber;
1114
+ }, "strip", z.ZodTypeAny, {
1115
+ daily_tokens: number;
1116
+ daily_llm_calls: number;
1117
+ daily_embeddings: number;
1118
+ monthly_tokens: number;
1119
+ monthly_llm_calls: number;
1120
+ monthly_embeddings: number;
1121
+ }, {
1122
+ daily_tokens: number;
1123
+ daily_llm_calls: number;
1124
+ daily_embeddings: number;
1125
+ monthly_tokens: number;
1126
+ monthly_llm_calls: number;
1127
+ monthly_embeddings: number;
1128
+ }>;
1129
+ type TenantBudgets = z.infer<typeof TenantBudgets>;
1130
+ /** Server response: stored overrides + resolved effective caps. */
1131
+ declare const TenantBudgetsView: z.ZodObject<{
1132
+ overrides: z.ZodObject<{
1133
+ daily_tokens: z.ZodNumber;
1134
+ daily_llm_calls: z.ZodNumber;
1135
+ daily_embeddings: z.ZodNumber;
1136
+ monthly_tokens: z.ZodNumber;
1137
+ monthly_llm_calls: z.ZodNumber;
1138
+ monthly_embeddings: z.ZodNumber;
1139
+ }, "strip", z.ZodTypeAny, {
1140
+ daily_tokens: number;
1141
+ daily_llm_calls: number;
1142
+ daily_embeddings: number;
1143
+ monthly_tokens: number;
1144
+ monthly_llm_calls: number;
1145
+ monthly_embeddings: number;
1146
+ }, {
1147
+ daily_tokens: number;
1148
+ daily_llm_calls: number;
1149
+ daily_embeddings: number;
1150
+ monthly_tokens: number;
1151
+ monthly_llm_calls: number;
1152
+ monthly_embeddings: number;
1153
+ }>;
1154
+ effective: z.ZodObject<{
1155
+ daily_tokens: z.ZodNumber;
1156
+ daily_llm_calls: z.ZodNumber;
1157
+ daily_embeddings: z.ZodNumber;
1158
+ monthly_tokens: z.ZodNumber;
1159
+ monthly_llm_calls: z.ZodNumber;
1160
+ monthly_embeddings: z.ZodNumber;
1161
+ }, "strip", z.ZodTypeAny, {
1162
+ daily_tokens: number;
1163
+ daily_llm_calls: number;
1164
+ daily_embeddings: number;
1165
+ monthly_tokens: number;
1166
+ monthly_llm_calls: number;
1167
+ monthly_embeddings: number;
1168
+ }, {
1169
+ daily_tokens: number;
1170
+ daily_llm_calls: number;
1171
+ daily_embeddings: number;
1172
+ monthly_tokens: number;
1173
+ monthly_llm_calls: number;
1174
+ monthly_embeddings: number;
1175
+ }>;
1176
+ }, "strip", z.ZodTypeAny, {
1177
+ overrides: {
1178
+ daily_tokens: number;
1179
+ daily_llm_calls: number;
1180
+ daily_embeddings: number;
1181
+ monthly_tokens: number;
1182
+ monthly_llm_calls: number;
1183
+ monthly_embeddings: number;
1184
+ };
1185
+ effective: {
1186
+ daily_tokens: number;
1187
+ daily_llm_calls: number;
1188
+ daily_embeddings: number;
1189
+ monthly_tokens: number;
1190
+ monthly_llm_calls: number;
1191
+ monthly_embeddings: number;
1192
+ };
1193
+ }, {
1194
+ overrides: {
1195
+ daily_tokens: number;
1196
+ daily_llm_calls: number;
1197
+ daily_embeddings: number;
1198
+ monthly_tokens: number;
1199
+ monthly_llm_calls: number;
1200
+ monthly_embeddings: number;
1201
+ };
1202
+ effective: {
1203
+ daily_tokens: number;
1204
+ daily_llm_calls: number;
1205
+ daily_embeddings: number;
1206
+ monthly_tokens: number;
1207
+ monthly_llm_calls: number;
1208
+ monthly_embeddings: number;
1209
+ };
1210
+ }>;
1211
+ type TenantBudgetsView = z.infer<typeof TenantBudgetsView>;
1106
1212
 
1107
1213
  /**
1108
1214
  * Z3rno TypeScript SDK client.
@@ -1570,6 +1676,16 @@ declare class Z3rnoClient {
1570
1676
  afterTurn?: number;
1571
1677
  limit?: number;
1572
1678
  }): Promise<TurnListResponse>;
1679
+ /**
1680
+ * Read this org's stored budget overrides + resolved effective caps.
1681
+ * Auth: any admin/write/read member of the calling org.
1682
+ */
1683
+ getMyBudgets(): Promise<TenantBudgetsView>;
1684
+ /**
1685
+ * Replace this org's budget overrides. Zero / missing fields
1686
+ * inherit the server default. Auth: admin/write only.
1687
+ */
1688
+ setMyBudgets(budgets: Partial<TenantBudgets>): Promise<TenantBudgetsView>;
1573
1689
  private request;
1574
1690
  private sleep;
1575
1691
  private handleResponse;
@@ -1877,4 +1993,4 @@ declare class Z3rnoMastraMemory {
1877
1993
  private normaliseRole;
1878
1994
  }
1879
1995
 
1880
- 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, TurnAddResponse, TurnListResponse, TurnResponse, ValidationError, Z3rnoClient, type Z3rnoClientConfig, Z3rnoConnectionError, Z3rnoError, Z3rnoMastraMemory, type Z3rnoMastraMemoryOptions, type Z3rnoMessageRole, Z3rnoTimeoutError, Z3rnoVercelMemory, type Z3rnoVercelMemoryOptions };
1996
+ 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 };
package/dist/index.d.ts CHANGED
@@ -1103,6 +1103,112 @@ declare const TurnListResponse: z.ZodObject<{
1103
1103
  conversation_id: string;
1104
1104
  }>;
1105
1105
  type TurnListResponse = z.infer<typeof TurnListResponse>;
1106
+ /** Per-tenant budget caps. Zero means inherit server default. */
1107
+ declare const TenantBudgets: z.ZodObject<{
1108
+ daily_tokens: z.ZodNumber;
1109
+ daily_llm_calls: z.ZodNumber;
1110
+ daily_embeddings: z.ZodNumber;
1111
+ monthly_tokens: z.ZodNumber;
1112
+ monthly_llm_calls: z.ZodNumber;
1113
+ monthly_embeddings: z.ZodNumber;
1114
+ }, "strip", z.ZodTypeAny, {
1115
+ daily_tokens: number;
1116
+ daily_llm_calls: number;
1117
+ daily_embeddings: number;
1118
+ monthly_tokens: number;
1119
+ monthly_llm_calls: number;
1120
+ monthly_embeddings: number;
1121
+ }, {
1122
+ daily_tokens: number;
1123
+ daily_llm_calls: number;
1124
+ daily_embeddings: number;
1125
+ monthly_tokens: number;
1126
+ monthly_llm_calls: number;
1127
+ monthly_embeddings: number;
1128
+ }>;
1129
+ type TenantBudgets = z.infer<typeof TenantBudgets>;
1130
+ /** Server response: stored overrides + resolved effective caps. */
1131
+ declare const TenantBudgetsView: z.ZodObject<{
1132
+ overrides: z.ZodObject<{
1133
+ daily_tokens: z.ZodNumber;
1134
+ daily_llm_calls: z.ZodNumber;
1135
+ daily_embeddings: z.ZodNumber;
1136
+ monthly_tokens: z.ZodNumber;
1137
+ monthly_llm_calls: z.ZodNumber;
1138
+ monthly_embeddings: z.ZodNumber;
1139
+ }, "strip", z.ZodTypeAny, {
1140
+ daily_tokens: number;
1141
+ daily_llm_calls: number;
1142
+ daily_embeddings: number;
1143
+ monthly_tokens: number;
1144
+ monthly_llm_calls: number;
1145
+ monthly_embeddings: number;
1146
+ }, {
1147
+ daily_tokens: number;
1148
+ daily_llm_calls: number;
1149
+ daily_embeddings: number;
1150
+ monthly_tokens: number;
1151
+ monthly_llm_calls: number;
1152
+ monthly_embeddings: number;
1153
+ }>;
1154
+ effective: z.ZodObject<{
1155
+ daily_tokens: z.ZodNumber;
1156
+ daily_llm_calls: z.ZodNumber;
1157
+ daily_embeddings: z.ZodNumber;
1158
+ monthly_tokens: z.ZodNumber;
1159
+ monthly_llm_calls: z.ZodNumber;
1160
+ monthly_embeddings: z.ZodNumber;
1161
+ }, "strip", z.ZodTypeAny, {
1162
+ daily_tokens: number;
1163
+ daily_llm_calls: number;
1164
+ daily_embeddings: number;
1165
+ monthly_tokens: number;
1166
+ monthly_llm_calls: number;
1167
+ monthly_embeddings: number;
1168
+ }, {
1169
+ daily_tokens: number;
1170
+ daily_llm_calls: number;
1171
+ daily_embeddings: number;
1172
+ monthly_tokens: number;
1173
+ monthly_llm_calls: number;
1174
+ monthly_embeddings: number;
1175
+ }>;
1176
+ }, "strip", z.ZodTypeAny, {
1177
+ overrides: {
1178
+ daily_tokens: number;
1179
+ daily_llm_calls: number;
1180
+ daily_embeddings: number;
1181
+ monthly_tokens: number;
1182
+ monthly_llm_calls: number;
1183
+ monthly_embeddings: number;
1184
+ };
1185
+ effective: {
1186
+ daily_tokens: number;
1187
+ daily_llm_calls: number;
1188
+ daily_embeddings: number;
1189
+ monthly_tokens: number;
1190
+ monthly_llm_calls: number;
1191
+ monthly_embeddings: number;
1192
+ };
1193
+ }, {
1194
+ overrides: {
1195
+ daily_tokens: number;
1196
+ daily_llm_calls: number;
1197
+ daily_embeddings: number;
1198
+ monthly_tokens: number;
1199
+ monthly_llm_calls: number;
1200
+ monthly_embeddings: number;
1201
+ };
1202
+ effective: {
1203
+ daily_tokens: number;
1204
+ daily_llm_calls: number;
1205
+ daily_embeddings: number;
1206
+ monthly_tokens: number;
1207
+ monthly_llm_calls: number;
1208
+ monthly_embeddings: number;
1209
+ };
1210
+ }>;
1211
+ type TenantBudgetsView = z.infer<typeof TenantBudgetsView>;
1106
1212
 
1107
1213
  /**
1108
1214
  * Z3rno TypeScript SDK client.
@@ -1570,6 +1676,16 @@ declare class Z3rnoClient {
1570
1676
  afterTurn?: number;
1571
1677
  limit?: number;
1572
1678
  }): Promise<TurnListResponse>;
1679
+ /**
1680
+ * Read this org's stored budget overrides + resolved effective caps.
1681
+ * Auth: any admin/write/read member of the calling org.
1682
+ */
1683
+ getMyBudgets(): Promise<TenantBudgetsView>;
1684
+ /**
1685
+ * Replace this org's budget overrides. Zero / missing fields
1686
+ * inherit the server default. Auth: admin/write only.
1687
+ */
1688
+ setMyBudgets(budgets: Partial<TenantBudgets>): Promise<TenantBudgetsView>;
1573
1689
  private request;
1574
1690
  private sleep;
1575
1691
  private handleResponse;
@@ -1877,4 +1993,4 @@ declare class Z3rnoMastraMemory {
1877
1993
  private normaliseRole;
1878
1994
  }
1879
1995
 
1880
- 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, TurnAddResponse, TurnListResponse, TurnResponse, ValidationError, Z3rnoClient, type Z3rnoClientConfig, Z3rnoConnectionError, Z3rnoError, Z3rnoMastraMemory, type Z3rnoMastraMemoryOptions, type Z3rnoMessageRole, Z3rnoTimeoutError, Z3rnoVercelMemory, type Z3rnoVercelMemoryOptions };
1996
+ 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 };
package/dist/index.js CHANGED
@@ -447,6 +447,18 @@ var TurnListResponse = z.object({
447
447
  total: z.number(),
448
448
  conversation_id: z.string()
449
449
  });
450
+ var TenantBudgets = z.object({
451
+ daily_tokens: z.number(),
452
+ daily_llm_calls: z.number(),
453
+ daily_embeddings: z.number(),
454
+ monthly_tokens: z.number(),
455
+ monthly_llm_calls: z.number(),
456
+ monthly_embeddings: z.number()
457
+ });
458
+ var TenantBudgetsView = z.object({
459
+ overrides: TenantBudgets,
460
+ effective: TenantBudgets
461
+ });
450
462
 
451
463
  // src/client.ts
452
464
  var Z3rnoClient = class {
@@ -941,6 +953,31 @@ var Z3rnoClient = class {
941
953
  const resp = await this.request("GET", path);
942
954
  return TurnListResponse.parse(resp);
943
955
  }
956
+ // --- Tenant budgets (v0.20.3) ---
957
+ /**
958
+ * Read this org's stored budget overrides + resolved effective caps.
959
+ * Auth: any admin/write/read member of the calling org.
960
+ */
961
+ async getMyBudgets() {
962
+ const resp = await this.request("GET", "/v1/tenants/me/budgets");
963
+ return TenantBudgetsView.parse(resp);
964
+ }
965
+ /**
966
+ * Replace this org's budget overrides. Zero / missing fields
967
+ * inherit the server default. Auth: admin/write only.
968
+ */
969
+ async setMyBudgets(budgets) {
970
+ const body = {
971
+ daily_tokens: budgets.daily_tokens ?? 0,
972
+ daily_llm_calls: budgets.daily_llm_calls ?? 0,
973
+ daily_embeddings: budgets.daily_embeddings ?? 0,
974
+ monthly_tokens: budgets.monthly_tokens ?? 0,
975
+ monthly_llm_calls: budgets.monthly_llm_calls ?? 0,
976
+ monthly_embeddings: budgets.monthly_embeddings ?? 0
977
+ };
978
+ const resp = await this.request("PUT", "/v1/tenants/me/budgets", body);
979
+ return TenantBudgetsView.parse(resp);
980
+ }
944
981
  // --- HTTP layer ---
945
982
  async request(method, path, body) {
946
983
  let lastError;
@@ -1015,6 +1052,9 @@ var Z3rnoClient = class {
1015
1052
  }
1016
1053
  async handleResponse(resp) {
1017
1054
  if (resp.ok) {
1055
+ if (resp.status === 204) {
1056
+ return void 0;
1057
+ }
1018
1058
  return resp.json();
1019
1059
  }
1020
1060
  let detail = resp.statusText;
@@ -1207,6 +1247,6 @@ var Z3rnoMastraMemory = class {
1207
1247
  }
1208
1248
  };
1209
1249
 
1210
- 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, TurnAddResponse, TurnListResponse, TurnResponse, ValidationError, Z3rnoClient, Z3rnoConnectionError, Z3rnoError, Z3rnoMastraMemory, Z3rnoTimeoutError, Z3rnoVercelMemory };
1250
+ 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 };
1211
1251
  //# sourceMappingURL=index.js.map
1212
1252
  //# sourceMappingURL=index.js.map