cencori 1.8.0 → 1.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.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as CencoriConfig, i as RequestOptions } from './types-CZSIg4JQ.mjs';
2
- export { j as ChatMessage, a as ChatRequest, b as ChatResponse, o as CodeInterpreterTool, c as CompletionRequest, E as EmbeddingRequest, d as EmbeddingResponse, F as FileSearchTool, l as ResponseInputItem, k as ResponsesOutputItem, R as ResponsesRequest, g as ResponsesResponse, m as ResponsesTool, U as UrlCitation, n as WebSearchTool } from './types-CZSIg4JQ.mjs';
1
+ import { C as CencoriConfig, i as RequestOptions } from './types-DbHh0iAg.mjs';
2
+ export { j as ChatMessage, a as ChatRequest, b as ChatResponse, o as CodeInterpreterTool, c as CompletionRequest, E as EmbeddingRequest, d as EmbeddingResponse, F as FileSearchTool, l as ResponseInputItem, k as ResponsesOutputItem, R as ResponsesRequest, g as ResponsesResponse, m as ResponsesTool, U as UrlCitation, n as WebSearchTool } from './types-DbHh0iAg.mjs';
3
3
  import { AINamespace } from './ai/index.mjs';
4
4
  export { StreamChunk } from './ai/index.mjs';
5
5
  import { VisionNamespace } from './vision/index.mjs';
@@ -287,6 +287,20 @@ interface ChatCompletionResponse {
287
287
  content: string;
288
288
  }>;
289
289
  write_status: 'pending' | 'disabled';
290
+ /** Chat request id backing the async writeback — poll GET /v1/memory/writes/:id. Null when write is disabled. */
291
+ write_request_id?: string | null;
292
+ };
293
+ /** Request id for support correlation (X-Request-Id). */
294
+ requestId?: string | null;
295
+ /** Input-guard classification the gateway verdicts (absent when unstreamed/skipped). */
296
+ safety?: {
297
+ scanned: boolean;
298
+ input?: {
299
+ safe: boolean;
300
+ layer: string;
301
+ riskScore: number;
302
+ reasons: string[];
303
+ };
290
304
  };
291
305
  }
292
306
  interface ChatCompletionChunk {
@@ -296,6 +310,14 @@ interface ChatCompletionChunk {
296
310
  interface ChatCompletionStream extends AsyncIterable<ChatCompletionChunk> {
297
311
  /** Number of memories injected into this request (from X-Cencori-Memory-Retrieved). */
298
312
  memoriesRetrieved: number;
313
+ /** Input-guard verdict from the stream-open headers (absent when unscanned). */
314
+ safety?: {
315
+ scanned: boolean;
316
+ input?: {
317
+ safe: boolean;
318
+ riskScore: number;
319
+ };
320
+ };
299
321
  }
300
322
  declare class Completions {
301
323
  private config;
@@ -1157,32 +1179,54 @@ declare class Cencori {
1157
1179
  /**
1158
1180
  * Cencori Error Classes
1159
1181
  *
1160
- * Custom error types for better error handling
1182
+ * Custom error types for better error handling. Every API failure carries
1183
+ * the HTTP status, the machine-readable code, the request id (for support
1184
+ * correlation), and any retry hint the server sent — so callers never have
1185
+ * to guess from a bare message again.
1161
1186
  */
1162
1187
  declare class CencoriError extends Error {
1163
1188
  statusCode?: number | undefined;
1164
1189
  code?: string | undefined;
1165
- constructor(message: string, statusCode?: number | undefined, code?: string | undefined);
1190
+ options?: {
1191
+ requestId?: string | null;
1192
+ retryAfterMs?: number | null;
1193
+ errorBody?: unknown;
1194
+ } | undefined;
1195
+ constructor(message: string, statusCode?: number | undefined, code?: string | undefined, options?: {
1196
+ requestId?: string | null;
1197
+ retryAfterMs?: number | null;
1198
+ errorBody?: unknown;
1199
+ } | undefined);
1200
+ /** Request id for support correlation (X-Request-Id), when the server sent one. */
1201
+ get requestId(): string | null;
1202
+ /** Server-advised wait before retrying, when sent (Retry-After / retry_after_ms). */
1203
+ get retryAfterMs(): number | null;
1204
+ /** True for failures worth retrying: rate limits, bad gateway, unavailable, timeouts. */
1205
+ get isRetryable(): boolean;
1166
1206
  }
1167
1207
  declare class AuthenticationError extends CencoriError {
1168
- constructor(message?: string);
1208
+ constructor(message?: string, options?: {
1209
+ requestId?: string | null;
1210
+ });
1169
1211
  }
1170
1212
  declare class RateLimitError extends CencoriError {
1171
1213
  retryAfterSeconds?: number | null | undefined;
1172
- constructor(message?: string, retryAfterSeconds?: number | null | undefined);
1214
+ constructor(message?: string, retryAfterSeconds?: number | null | undefined, options?: {
1215
+ requestId?: string | null;
1216
+ errorBody?: unknown;
1217
+ });
1173
1218
  }
1174
1219
  declare class SafetyError extends CencoriError {
1175
1220
  reasons?: string[] | undefined;
1176
- constructor(message?: string, reasons?: string[] | undefined);
1221
+ constructor(message?: string, reasons?: string[] | undefined, options?: {
1222
+ requestId?: string | null;
1223
+ errorBody?: unknown;
1224
+ });
1177
1225
  }
1178
1226
 
1179
1227
  /**
1180
1228
  * Utility functions for Cencori SDK
1181
1229
  */
1182
- /**
1183
- * Fetch with automatic retry on 5xx errors
1184
- * Uses exponential backoff: 1s, 2s, 4s
1185
- */
1186
1230
  declare function fetchWithRetry(url: string, options: RequestInit, maxRetries?: number): Promise<Response>;
1187
1231
 
1188
1232
  export { AINamespace, ActionsNamespace, type Agent, type AgentConfig, type AgentKey, type AgentListItem, AgentVersionsNamespace, AgentsNamespace, AuthenticationError, Cencori, CencoriConfig, CencoriEmbeddedApiError, CencoriError, type ChatCompletionChunk, type ChatCompletionCreateParams, type ChatCompletionResponse, type ChatCompletionStream, type ChatMemoryOptions, ChatNamespace, ClientTokensNamespace, ComputeNamespace, ConnectionsNamespace, type CreateAgentKeyParams, type CreateAgentParams, type CreateSessionParams, DocumentsNamespace, type EmbeddedRequestOptions, EndUsersNamespace, InstallationsNamespace, KnowledgeNamespace, McpServersNamespace, MemoryClient, ModelsNamespace, type PaginatedResponse, ProviderConnectionsNamespace, RateLimitError, RatePlansNamespace, RequestOptions, RunsNamespace, SafetyError, type Session, type SessionEvent, type SessionListParams, SessionsNamespace, SkillImportsNamespace, SkillsNamespace, StorageNamespace, TelemetryClient, type Tenant, TenantsNamespace, type TurnParams, type UnifiedModel, type UpdateAgentParams, UsageNamespace, VisionNamespace, VoiceNamespace, WebNamespace, WebhooksNamespace, WorkflowNamespace, Cencori as default, fetchWithRetry };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as CencoriConfig, i as RequestOptions } from './types-CZSIg4JQ.js';
2
- export { j as ChatMessage, a as ChatRequest, b as ChatResponse, o as CodeInterpreterTool, c as CompletionRequest, E as EmbeddingRequest, d as EmbeddingResponse, F as FileSearchTool, l as ResponseInputItem, k as ResponsesOutputItem, R as ResponsesRequest, g as ResponsesResponse, m as ResponsesTool, U as UrlCitation, n as WebSearchTool } from './types-CZSIg4JQ.js';
1
+ import { C as CencoriConfig, i as RequestOptions } from './types-DbHh0iAg.js';
2
+ export { j as ChatMessage, a as ChatRequest, b as ChatResponse, o as CodeInterpreterTool, c as CompletionRequest, E as EmbeddingRequest, d as EmbeddingResponse, F as FileSearchTool, l as ResponseInputItem, k as ResponsesOutputItem, R as ResponsesRequest, g as ResponsesResponse, m as ResponsesTool, U as UrlCitation, n as WebSearchTool } from './types-DbHh0iAg.js';
3
3
  import { AINamespace } from './ai/index.js';
4
4
  export { StreamChunk } from './ai/index.js';
5
5
  import { VisionNamespace } from './vision/index.js';
@@ -287,6 +287,20 @@ interface ChatCompletionResponse {
287
287
  content: string;
288
288
  }>;
289
289
  write_status: 'pending' | 'disabled';
290
+ /** Chat request id backing the async writeback — poll GET /v1/memory/writes/:id. Null when write is disabled. */
291
+ write_request_id?: string | null;
292
+ };
293
+ /** Request id for support correlation (X-Request-Id). */
294
+ requestId?: string | null;
295
+ /** Input-guard classification the gateway verdicts (absent when unstreamed/skipped). */
296
+ safety?: {
297
+ scanned: boolean;
298
+ input?: {
299
+ safe: boolean;
300
+ layer: string;
301
+ riskScore: number;
302
+ reasons: string[];
303
+ };
290
304
  };
291
305
  }
292
306
  interface ChatCompletionChunk {
@@ -296,6 +310,14 @@ interface ChatCompletionChunk {
296
310
  interface ChatCompletionStream extends AsyncIterable<ChatCompletionChunk> {
297
311
  /** Number of memories injected into this request (from X-Cencori-Memory-Retrieved). */
298
312
  memoriesRetrieved: number;
313
+ /** Input-guard verdict from the stream-open headers (absent when unscanned). */
314
+ safety?: {
315
+ scanned: boolean;
316
+ input?: {
317
+ safe: boolean;
318
+ riskScore: number;
319
+ };
320
+ };
299
321
  }
300
322
  declare class Completions {
301
323
  private config;
@@ -1157,32 +1179,54 @@ declare class Cencori {
1157
1179
  /**
1158
1180
  * Cencori Error Classes
1159
1181
  *
1160
- * Custom error types for better error handling
1182
+ * Custom error types for better error handling. Every API failure carries
1183
+ * the HTTP status, the machine-readable code, the request id (for support
1184
+ * correlation), and any retry hint the server sent — so callers never have
1185
+ * to guess from a bare message again.
1161
1186
  */
1162
1187
  declare class CencoriError extends Error {
1163
1188
  statusCode?: number | undefined;
1164
1189
  code?: string | undefined;
1165
- constructor(message: string, statusCode?: number | undefined, code?: string | undefined);
1190
+ options?: {
1191
+ requestId?: string | null;
1192
+ retryAfterMs?: number | null;
1193
+ errorBody?: unknown;
1194
+ } | undefined;
1195
+ constructor(message: string, statusCode?: number | undefined, code?: string | undefined, options?: {
1196
+ requestId?: string | null;
1197
+ retryAfterMs?: number | null;
1198
+ errorBody?: unknown;
1199
+ } | undefined);
1200
+ /** Request id for support correlation (X-Request-Id), when the server sent one. */
1201
+ get requestId(): string | null;
1202
+ /** Server-advised wait before retrying, when sent (Retry-After / retry_after_ms). */
1203
+ get retryAfterMs(): number | null;
1204
+ /** True for failures worth retrying: rate limits, bad gateway, unavailable, timeouts. */
1205
+ get isRetryable(): boolean;
1166
1206
  }
1167
1207
  declare class AuthenticationError extends CencoriError {
1168
- constructor(message?: string);
1208
+ constructor(message?: string, options?: {
1209
+ requestId?: string | null;
1210
+ });
1169
1211
  }
1170
1212
  declare class RateLimitError extends CencoriError {
1171
1213
  retryAfterSeconds?: number | null | undefined;
1172
- constructor(message?: string, retryAfterSeconds?: number | null | undefined);
1214
+ constructor(message?: string, retryAfterSeconds?: number | null | undefined, options?: {
1215
+ requestId?: string | null;
1216
+ errorBody?: unknown;
1217
+ });
1173
1218
  }
1174
1219
  declare class SafetyError extends CencoriError {
1175
1220
  reasons?: string[] | undefined;
1176
- constructor(message?: string, reasons?: string[] | undefined);
1221
+ constructor(message?: string, reasons?: string[] | undefined, options?: {
1222
+ requestId?: string | null;
1223
+ errorBody?: unknown;
1224
+ });
1177
1225
  }
1178
1226
 
1179
1227
  /**
1180
1228
  * Utility functions for Cencori SDK
1181
1229
  */
1182
- /**
1183
- * Fetch with automatic retry on 5xx errors
1184
- * Uses exponential backoff: 1s, 2s, 4s
1185
- */
1186
1230
  declare function fetchWithRetry(url: string, options: RequestInit, maxRetries?: number): Promise<Response>;
1187
1231
 
1188
1232
  export { AINamespace, ActionsNamespace, type Agent, type AgentConfig, type AgentKey, type AgentListItem, AgentVersionsNamespace, AgentsNamespace, AuthenticationError, Cencori, CencoriConfig, CencoriEmbeddedApiError, CencoriError, type ChatCompletionChunk, type ChatCompletionCreateParams, type ChatCompletionResponse, type ChatCompletionStream, type ChatMemoryOptions, ChatNamespace, ClientTokensNamespace, ComputeNamespace, ConnectionsNamespace, type CreateAgentKeyParams, type CreateAgentParams, type CreateSessionParams, DocumentsNamespace, type EmbeddedRequestOptions, EndUsersNamespace, InstallationsNamespace, KnowledgeNamespace, McpServersNamespace, MemoryClient, ModelsNamespace, type PaginatedResponse, ProviderConnectionsNamespace, RateLimitError, RatePlansNamespace, RequestOptions, RunsNamespace, SafetyError, type Session, type SessionEvent, type SessionListParams, SessionsNamespace, SkillImportsNamespace, SkillsNamespace, StorageNamespace, TelemetryClient, type Tenant, TenantsNamespace, type TurnParams, type UnifiedModel, type UpdateAgentParams, UsageNamespace, VisionNamespace, VoiceNamespace, WebNamespace, WebhooksNamespace, WorkflowNamespace, Cencori as default, fetchWithRetry };