@squidcloud/client 1.0.478 → 1.0.479

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.
@@ -837,6 +837,14 @@ export interface UpsertContextStatusSuccess extends BaseUpsertContextStatus {
837
837
  /** Whether the context upsert was successful or got an error. */
838
838
  status: 'success';
839
839
  }
840
+ /**
841
+ * Machine-readable code identifying a specific upsert failure reason.
842
+ *
843
+ * `DUPLICATE_CONTENT` means the request omitted a contextId and its content is
844
+ * byte-identical to an existing context in the same knowledge base.
845
+ * @category AI
846
+ */
847
+ export type UpsertContextErrorCode = 'DUPLICATE_CONTENT';
840
848
  /**
841
849
  * Status of an individual context item after it failed to upsert.
842
850
  *
@@ -848,6 +856,8 @@ export interface UpsertContextStatusError extends BaseUpsertContextStatus {
848
856
  status: 'error';
849
857
  /** Reason the upsert failed. */
850
858
  errorMessage: string;
859
+ /** Machine-readable code for the failure, when one applies. */
860
+ errorCode?: UpsertContextErrorCode;
851
861
  }
852
862
  /**
853
863
  * Status of an individual context item after attempting to upsert it.
@@ -1020,6 +1030,16 @@ export type AiSessionContext = {
1020
1030
  agentId: string;
1021
1031
  /** The ID of the job associated with the session. */
1022
1032
  jobId: JobId;
1033
+ /**
1034
+ * ID of the status update that triggered this session (e.g. the agent's "Calling AI Function"
1035
+ * event). Status updates emitted on behalf of this session nest under it in the status feed.
1036
+ */
1037
+ parentStatusUpdateId?: string;
1038
+ /**
1039
+ * Whether the invoking agent has audit logging enabled. Sub-agents working on behalf of this
1040
+ * session gate their own audit-log writes on it, keeping one job's audit trail consistent.
1041
+ */
1042
+ auditLog?: boolean;
1023
1043
  /**
1024
1044
  * The chat timeout (in milliseconds) the root chat request explicitly set. Present only when
1025
1045
  * the root request passed `timeoutMs`. Nested AI operations (e.g. AI-query stages spawned by a
@@ -211,6 +211,11 @@ export interface AiKnowledgeBaseContext {
211
211
  * user-supplied values are preserved; consumers can also use this to caveat extracted values.
212
212
  */
213
213
  autoExtractedMetadataFields?: string[];
214
+ /**
215
+ * SHA-256 (hex) of the source bytes (file) or UTF-8 text this context was ingested from. Powers
216
+ * content-level dedup on upsert. Absent on legacy contexts ingested before hashing was introduced.
217
+ */
218
+ contentHash?: string;
214
219
  /** Original request configuration for how the context content was processed. */
215
220
  requestConfig?: AgentContextRequest;
216
221
  }
@@ -228,7 +233,7 @@ export type AiKnowledgeBaseContextRequest = AiKnowledgeBaseTextContextRequest |
228
233
  */
229
234
  export interface BaseAiKnowledgeBaseContextRequest {
230
235
  /** The unique identifier of the context item. */
231
- contextId: string;
236
+ contextId?: string;
232
237
  /** The type of the context content. */
233
238
  type: AiKnowledgeBaseContextType;
234
239
  /** Optional metadata associated with the context item. */
@@ -262,8 +267,13 @@ export type AiKnowledgeBaseTextFormat = 'auto' | 'markdown' | 'html' | 'plain';
262
267
  * @category AI
263
268
  */
264
269
  export interface AiKnowledgeBaseTextContextRequest extends BaseAiKnowledgeBaseContextRequest {
265
- /** The id of the context */
266
- contextId: AiContextId;
270
+ /**
271
+ * The id of the context. Optional: when omitted, the server generates one and rejects the upload if
272
+ * another context in the knowledge base already holds identical content (content-level dedup). Provide
273
+ * an explicit id to address a specific context — that overwrites it unconditionally and allows duplicate
274
+ * content across different ids.
275
+ */
276
+ contextId?: AiContextId;
267
277
  /** Specifies the context type as 'text'. */
268
278
  type: 'text';
269
279
  /** A title for the text context. */
@@ -298,8 +308,13 @@ export interface AiKnowledgeBaseTextContextRequest extends BaseAiKnowledgeBaseCo
298
308
  * @category AI
299
309
  */
300
310
  export interface AiKnowledgeBaseFileContextRequest extends BaseAiKnowledgeBaseContextRequest {
301
- /** The id of the context */
302
- contextId: AiContextId;
311
+ /**
312
+ * The id of the context. Optional: when omitted, the server generates one and rejects the upload if
313
+ * another context in the knowledge base already holds identical content (content-level dedup). Provide
314
+ * an explicit id to address a specific context — that overwrites it unconditionally and allows duplicate
315
+ * content across different ids.
316
+ */
317
+ contextId?: AiContextId;
303
318
  /** Specifies the context type as 'file'. */
304
319
  type: 'file';
305
320
  /** Whether to extract images from the file; defaults to false. */
@@ -410,6 +425,16 @@ export interface UpsertKnowledgeBaseContextResponse {
410
425
  export interface UpsertKnowledgeBaseContextsResponse {
411
426
  /** List of the upsert status of each item sent in the request. */
412
427
  failures: Array<UpsertContextStatusError>;
428
+ /**
429
+ * The context id of every request in the batch, positionally aligned with the `contextRequests` array
430
+ * that was sent — `contextIds[i]` is the id of the i-th request. Each entry is the caller-supplied id,
431
+ * or the id the server generated when the request omitted one, and is present regardless of whether that
432
+ * request succeeded or failed. Lets a caller that upserts without a contextId learn the assigned id.
433
+ *
434
+ * Optional because a newer client talking to an older core (which predates this field) receives it as
435
+ * `undefined` at runtime — callers must handle its absence rather than trust it is always populated.
436
+ */
437
+ contextIds?: Array<AiContextId>;
413
438
  }
414
439
  /**
415
440
  * Request structure for searching an AiKnowledgeBase
@@ -1,4 +1,5 @@
1
1
  import { AiAgentMemoryOptions, AiChatOptions, AiFileUrl, AiSessionContext } from './ai-agent.public-types';
2
+ import { AiChatModelName } from './ai-common.public-types';
2
3
  import { ApiOptions } from './api-client.public-types';
3
4
  import { AiAgentId, IntegrationId } from './communication.public-types';
4
5
  import { PartialBy } from './typescript.public-types';
@@ -201,3 +202,47 @@ export interface ExecuteAiApiResponse {
201
202
  /** Indicates whether the API request execution was successful. */
202
203
  success: boolean;
203
204
  }
205
+ /**
206
+ * Options for executing an AI-powered query over spreadsheet files.
207
+ * @category AI
208
+ */
209
+ export interface AiSpreadsheetQueryOptions {
210
+ /**
211
+ * Extra instructions honored when composing the answer (e.g. formatting rules or domain
212
+ * conventions of the calling agent).
213
+ */
214
+ instructions?: string;
215
+ /** Overrides the model used to answer the query. */
216
+ model?: AiChatModelName;
217
+ }
218
+ /**
219
+ * Request for executing an AI-powered query over spreadsheet files.
220
+ * @category AI
221
+ */
222
+ export interface ExecuteAiSpreadsheetQueryRequest {
223
+ /** Natural language question to answer using the spreadsheet data. */
224
+ prompt: string;
225
+ /** The spreadsheet files to query. */
226
+ files: Array<AiFileUrl>;
227
+ /** Optional query options. */
228
+ options?: AiSpreadsheetQueryOptions;
229
+ /** Optional session context for status updates and tracing. */
230
+ sessionContext?: AiSessionContext;
231
+ }
232
+ /**
233
+ * Response from executing an AI-powered query over spreadsheet files.
234
+ * @category AI
235
+ */
236
+ export interface ExecuteAiSpreadsheetQueryResponse {
237
+ /** AI-generated answer computed from the spreadsheet data. */
238
+ answer: string;
239
+ /** Indicates whether the query execution was successful. */
240
+ success: boolean;
241
+ /**
242
+ * All Python code executed to produce the answer, in execution order. Each step ran as its own
243
+ * sandbox script; multiple steps are joined with `# --- Step N ---` separators.
244
+ */
245
+ executedCode?: string;
246
+ /** Files produced while answering (e.g. charts or exports emitted by the executed code). */
247
+ files?: Array<AiFileUrl>;
248
+ }
@@ -105,6 +105,32 @@ export interface ExtractDataFromDocumentPage {
105
105
  */
106
106
  images: Array<ExtractDataFromDocumentImage>;
107
107
  }
108
+ /**
109
+ * Structural information about one sheet of a spreadsheet file.
110
+ */
111
+ export interface SpreadsheetSheetInfo {
112
+ /**
113
+ * The sheet name.
114
+ */
115
+ name: string;
116
+ /**
117
+ * Number of data rows in the sheet (excluding the header row).
118
+ */
119
+ rowCount: number;
120
+ /**
121
+ * Number of columns in the sheet.
122
+ */
123
+ columnCount: number;
124
+ }
125
+ /**
126
+ * Structural information about a parseable spreadsheet document.
127
+ */
128
+ export interface SpreadsheetDocumentInfo {
129
+ /**
130
+ * The sheets of the spreadsheet, in workbook order.
131
+ */
132
+ sheets: Array<SpreadsheetSheetInfo>;
133
+ }
108
134
  /**
109
135
  * The full result of extracting data from a document, including all pages and any extracted images.
110
136
  */
@@ -122,6 +148,11 @@ export interface ExtractDataFromDocumentResponse {
122
148
  * extractor was able to read it.
123
149
  */
124
150
  documentMetadata?: DocumentMetadata;
151
+ /**
152
+ * Structural information about the sheets when the document is a parseable spreadsheet
153
+ * (best-effort). Presence marks the document for the spreadsheet summary-embedding lane.
154
+ */
155
+ spreadsheet?: SpreadsheetDocumentInfo;
125
156
  }
126
157
  /**
127
158
  * Create PDF request type.
@@ -1,6 +1,6 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import { AiFunctionMetadata } from '../../internal-common/src/public-types/ai-function.public-types';
3
- import { AiQueryOptions, AiQueryResponse, ExecuteAiApiResponse } from '../../internal-common/src/public-types/ai-query.public-types';
3
+ import { AiQueryOptions, AiQueryResponse, AiSpreadsheetQueryOptions, ExecuteAiApiResponse, ExecuteAiSpreadsheetQueryResponse } from '../../internal-common/src/public-types/ai-query.public-types';
4
4
  import { AiAgentClientOptions } from './agent/ai-agent-client';
5
5
  import { AiAgentReference } from './agent/ai-agent-client-reference';
6
6
  import { AiAudioClient } from './ai-audio-client';
@@ -8,7 +8,7 @@ import { AiFilesClient } from './ai-files-client';
8
8
  import { AiImageClient } from './ai-image-client';
9
9
  import { AiKnowledgeBaseReference } from './ai-knowledge-base/ai-knowledge-base-client-reference';
10
10
  import { AiMatchMakingClient } from './ai-matchmaking-client';
11
- import { AiAgent, AiAgentApiIntegrationOptions, AiAgentId, AiFileProviderType, AiKnowledgeBase, AiKnowledgeBaseId, AiProviderType, AiSessionContext, AiStatusMessage, ApplicationAiSettings, IntegrationId, JobId, ListChatModelsRequest, ModelIdSpec, SecretKey } from './public-types';
11
+ import { AiAgent, AiAgentApiIntegrationOptions, AiAgentId, AiFileProviderType, AiFileUrl, AiKnowledgeBase, AiKnowledgeBaseId, AiProviderType, AiSessionContext, AiStatusMessage, ApplicationAiSettings, IntegrationId, JobId, ListChatModelsRequest, ModelIdSpec, SecretKey } from './public-types';
12
12
  /**
13
13
  * AiClient class serves as a facade for interacting with different AI services.
14
14
  * It provides simplified access to AI chatbot and assistant functionalities
@@ -121,6 +121,17 @@ export declare class AiClient {
121
121
  * @returns Promise resolving to the API call result with answer and execution details
122
122
  */
123
123
  executeAiApiCall(integrationId: IntegrationId, prompt: string, options?: AiAgentApiIntegrationOptions, sessionContext?: AiSessionContext): Promise<ExecuteAiApiResponse>;
124
+ /**
125
+ * Executes an AI-powered query over spreadsheet files. The AI lists sheets and runs Python code
126
+ * against the actual files in a sandbox to compute the answer.
127
+ *
128
+ * @param prompt - Natural language question to answer using the spreadsheet data
129
+ * @param files - The spreadsheet files to query
130
+ * @param options - Optional query options (extra instructions, model override)
131
+ * @param sessionContext - Optional session context for status updates and tracing
132
+ * @returns Promise resolving to the computed answer and execution details
133
+ */
134
+ executeAiSpreadsheetQuery(prompt: string, files: Array<AiFileUrl>, options?: AiSpreadsheetQueryOptions, sessionContext?: AiSessionContext): Promise<ExecuteAiSpreadsheetQueryResponse>;
124
135
  /**
125
136
  * Returns name of the secret that stores API key for the given AI provider type.
126
137
  * This API key is used for all requests to the AI provider done from the application.
@@ -66,7 +66,9 @@ export declare class AiKnowledgeBaseReference {
66
66
  */
67
67
  upsertContext(contextRequest: AiKnowledgeBaseContextRequest, file?: File): Promise<UpsertKnowledgeBaseContextResponse>;
68
68
  /**
69
- * Adds or updates multiple contexts.
69
+ * Adds or updates multiple contexts. A context request may omit its `contextId`; when it does, the server
70
+ * generates one and rejects the request if identical content already exists in the knowledge base
71
+ * (content-level dedup). Requests that carry an explicit `contextId` overwrite that context unconditionally.
70
72
  */
71
73
  upsertContexts(contextRequests: Array<AiKnowledgeBaseContextRequest>, files?: Array<File>): Promise<UpsertKnowledgeBaseContextsResponse>;
72
74
  /**
@@ -2,4 +2,4 @@
2
2
  * The current version of the SquidCloud client package.
3
3
  * @category Platform
4
4
  */
5
- export declare const SQUIDCLOUD_CLIENT_PACKAGE_VERSION = "1.0.478";
5
+ export declare const SQUIDCLOUD_CLIENT_PACKAGE_VERSION = "1.0.479";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squidcloud/client",
3
- "version": "1.0.478",
3
+ "version": "1.0.479",
4
4
  "description": "A typescript implementation of the Squid client",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",