@squidcloud/client 1.0.484 → 1.0.486

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.
Files changed (52) hide show
  1. package/dist/cjs/index.js +1 -1
  2. package/dist/esm/index.js +1 -1
  3. package/dist/internal-common/src/public-types/ai-agent.public-types.d.ts +86 -18
  4. package/dist/internal-common/src/public-types/ai-common.public-types.d.ts +13 -4
  5. package/dist/internal-common/src/public-types/ai-knowledge-base.public-types.d.ts +183 -0
  6. package/dist/internal-common/src/public-types/extraction.public-types.d.ts +1 -1
  7. package/dist/internal-common/src/public-types/integration.public-types.d.ts +6 -0
  8. package/dist/internal-common/src/public-types/source-code.public-types.d.ts +5 -0
  9. package/dist/typescript-client/src/agent/ai-agent-client-reference.d.ts +12 -1
  10. package/dist/typescript-client/src/ai-client.d.ts +1 -0
  11. package/dist/typescript-client/src/ai-knowledge-base/ai-knowledge-base-client-reference.d.ts +54 -1
  12. package/dist/typescript-client/src/ai-knowledge-base/ai-knowledge-base-client.d.ts +2 -0
  13. package/dist/typescript-client/src/version.d.ts +1 -1
  14. package/package.json +2 -9
  15. package/dist/internal-common/src/ai/system-openai-compatible.d.ts +0 -35
  16. package/dist/internal-common/src/metric-name.d.ts +0 -14
  17. package/dist/internal-common/src/public-types-backend/api-call.public-context.d.ts +0 -30
  18. package/dist/internal-common/src/public-types-backend/mutation.public-context.d.ts +0 -161
  19. package/dist/internal-common/src/public-types-backend/native-query.public-context.d.ts +0 -75
  20. package/dist/internal-common/src/public-types-backend/query.public-context.d.ts +0 -193
  21. package/dist/internal-common/src/types/ai-agent.types.d.ts +0 -249
  22. package/dist/internal-common/src/types/ai-knowledge-base.types.d.ts +0 -306
  23. package/dist/internal-common/src/types/ai-matchmaking.types.d.ts +0 -19
  24. package/dist/internal-common/src/types/backend-function.types.d.ts +0 -1
  25. package/dist/internal-common/src/types/communication.types.d.ts +0 -1
  26. package/dist/internal-common/src/types/document.types.d.ts +0 -1
  27. package/dist/internal-common/src/types/file.types.d.ts +0 -6
  28. package/dist/internal-common/src/types/headers.types.d.ts +0 -41
  29. package/dist/internal-common/src/types/management-api-key.types.d.ts +0 -92
  30. package/dist/internal-common/src/types/mutation.types.d.ts +0 -1
  31. package/dist/internal-common/src/types/notification.types.d.ts +0 -5
  32. package/dist/internal-common/src/types/observability.types.d.ts +0 -168
  33. package/dist/internal-common/src/types/query.types.d.ts +0 -15
  34. package/dist/internal-common/src/types/secret.types.d.ts +0 -7
  35. package/dist/internal-common/src/types/socket.types.d.ts +0 -1
  36. package/dist/internal-common/src/types/stage.d.ts +0 -9
  37. package/dist/internal-common/src/types/time-units.d.ts +0 -1
  38. package/dist/internal-common/src/types/url-shortener.types.d.ts +0 -45
  39. package/dist/internal-common/src/utils/array.d.ts +0 -7
  40. package/dist/internal-common/src/utils/e2e-test-utils.d.ts +0 -2
  41. package/dist/internal-common/src/utils/file-utils.d.ts +0 -2
  42. package/dist/internal-common/src/utils/global.utils.d.ts +0 -1
  43. package/dist/internal-common/src/utils/http.d.ts +0 -10
  44. package/dist/internal-common/src/utils/lock.manager.d.ts +0 -14
  45. package/dist/internal-common/src/utils/metric-utils.d.ts +0 -4
  46. package/dist/internal-common/src/utils/metrics.types.d.ts +0 -7
  47. package/dist/internal-common/src/utils/object.d.ts +0 -86
  48. package/dist/internal-common/src/utils/serialization.d.ts +0 -24
  49. package/dist/internal-common/src/utils/squid.constants.d.ts +0 -6
  50. package/dist/internal-common/src/utils/trace-id-generator.d.ts +0 -1
  51. package/dist/internal-common/src/utils/validation.d.ts +0 -19
  52. package/dist/internal-common/src/websocket.impl.d.ts +0 -26
@@ -1,5 +1,5 @@
1
1
  import { JSONSchema } from 'json-schema-typed';
2
- import { AiAudioCreateSpeechModelName, AiAudioTranscriptionModelName, AiChatModelName, AiImageModelName, AiProviderType, AiRerankProvider, AnthropicChatModelName, GeminiChatModelName, GrokChatModelName, ModelIdSpec, OpenAiAudioCreateSpeechModelName, OpenAiAudioTranscriptionModelName, OpenAiChatModelName, OpenAiCreateSpeechFormat, OpenAiImageModelName } from './ai-common.public-types';
2
+ import { AiAudioCreateSpeechModelName, AiAudioTranscriptionModelName, AiChatModelName, AiImageModelName, AiProviderType, AiRerankProvider, AnthropicChatModelName, CanonicalReasoningEffort, GeminiChatModelName, GrokChatModelName, ModelIdSpec, OpenAiAudioCreateSpeechModelName, OpenAiAudioTranscriptionModelName, OpenAiChatModelName, OpenAiCreateSpeechFormat, OpenAiImageModelName } from './ai-common.public-types';
3
3
  import { AiContextMetadata, AiContextMetadataFilter, AiKnowledgeBaseContextType, AiRagType } from './ai-knowledge-base.public-types';
4
4
  import { AiFunctionId, AiFunctionIdWithContext, UserAiChatModelName } from './backend.public-types';
5
5
  import { AiAgentId, AiContextId, AiKnowledgeBaseId, AppId, IntegrationId } from './communication.public-types';
@@ -153,11 +153,12 @@ export type ApiKeySource = 'user' | 'system';
153
153
  /**
154
154
  * Structured output format configuration for AI models that support schema-constrained responses.
155
155
  *
156
- * When used with supported models,
157
- * this guarantees that responses will strictly conform to the provided JSON schema through
158
- * constrained decoding - the model cannot generate tokens that violate the schema.
156
+ * The schema is sent to the model's provider, which constrains decoding to it - the model cannot
157
+ * generate tokens that violate the schema, so the response conforms to it exactly.
159
158
  *
160
- * If the model does not support structured output, the response format will default to 'json_object'.
159
+ * A schema the provider rejects is reported as a `400` carrying its diagnostic, and a model whose
160
+ * protocol cannot carry a schema at all refuses the request with `STRUCTURED_OUTPUT_NOT_SUPPORTED`
161
+ * rather than answering without the shape that was asked for.
161
162
  * **Example:**
162
163
  * ```typescript
163
164
  * {
@@ -175,13 +176,13 @@ export type ApiKeySource = 'user' | 'system';
175
176
  * ```
176
177
  *
177
178
  * @see https://docs.anthropic.com/en/docs/build-with-claude/structured-outputs
179
+ * @see https://platform.openai.com/docs/guides/structured-outputs
180
+ * @see https://ai.google.dev/gemini-api/docs/structured-output
181
+ * @see https://docs.x.ai/docs/guides/structured-outputs
178
182
  * @category AI
179
183
  */
180
184
  export interface AiStructuredOutputFormat {
181
- /**
182
- * The type of structured output.
183
- * Currently only 'json_schema' is supported by Anthropic models.
184
- */
185
+ /** The type of structured output. 'json_schema' is the only one. */
185
186
  type: 'json_schema';
186
187
  /**
187
188
  * The JSON schema that the AI response must strictly conform to.
@@ -195,12 +196,19 @@ export interface AiStructuredOutputFormat {
195
196
  * **Available formats:**
196
197
  * - `'text'`: Plain text response (default) - standard conversational output
197
198
  * - `'json_object'`: JSON response - model attempts to return valid JSON, but without strict schema validation
198
- * - `AiStructuredOutputFormat`: Structured output with schema (Anthropic only) - guarantees JSON conforms exactly to provided schema
199
+ * - `AiStructuredOutputFormat`: Structured output with schema - guarantees JSON conforms exactly to provided schema
199
200
  *
200
- * **Structured outputs (Anthropic-specific):**
201
- * For Anthropic models that support structured outputs, you can pass an object with `type: 'json_schema'`
202
- * and a JSON schema. This uses constrained decoding to guarantee the response matches your schema perfectly,
203
- * eliminating parsing errors and validation issues.
201
+ * **Structured outputs:**
202
+ * Pass an object with `type: 'json_schema'` and a JSON schema. The schema travels to the model's
203
+ * provider, which constrains decoding to it, so the response matches the schema perfectly and
204
+ * parsing or validating it again is unnecessary. A schema the provider rejects comes back as a
205
+ * `400` carrying its diagnostic.
206
+ *
207
+ * Every vendor model carries a schema. The exception is a model whose protocol has no field for
208
+ * one — the CLI agents (`claude-code`, `codex`) and models a customer serves through
209
+ * `@llmService` — where such a request is refused with `STRUCTURED_OUTPUT_NOT_SUPPORTED` rather
210
+ * than answered without the shape it asked for. Use `'json_object'` and state the shape in the
211
+ * prompt for those.
204
212
  *
205
213
  * **Example with structured output:**
206
214
  * ```typescript
@@ -306,7 +314,10 @@ export interface AiConnectedKnowledgeBaseMetadata {
306
314
  knowledgeBaseId: AiKnowledgeBaseId;
307
315
  /** A description of when to use this AiKnowledgeBase */
308
316
  description: string;
309
- /** Whether to include document metadata when providing KB search results to the agent. Defaults to false. */
317
+ /**
318
+ * Whether to include document metadata when providing this KB's results to the agent — both chunk
319
+ * search results and literal-scan matches. Defaults to false.
320
+ */
310
321
  includeMetadata?: boolean;
311
322
  /**
312
323
  * When true, the chat agent gets a tool to enumerate/search this KB's metadata field values on
@@ -450,7 +461,11 @@ export interface BaseAiChatOptions {
450
461
  enablePromptRewriteForRag?: boolean;
451
462
  /** Whether to include references from the source context in the response. Default to false. */
452
463
  includeReference?: boolean;
453
- /** The format of the response from the AI model. Note that not all models support JSON format. Default to 'text'. */
464
+ /**
465
+ * The format of the response from the AI model. Defaults to 'text'. A `json_schema` format is
466
+ * refused for a model whose provider has no way to carry a schema — see
467
+ * {@link AiAgentResponseFormat}.
468
+ */
454
469
  responseFormat?: AiAgentResponseFormat;
455
470
  /** Whether to response in a "smooth typing" way, beneficial when the chat result is displayed in a UI. Default to true. */
456
471
  smoothTyping?: boolean;
@@ -520,7 +535,8 @@ export interface BaseAiChatOptions {
520
535
  * Use `low` for brief responses, `medium` for balanced detail, or `high` for comprehensive explanations.
521
536
  * Default: 'medium'.
522
537
  *
523
- * Note: this parameter is only supported by OpenAI plain text responses and is ignored for others.
538
+ * Note: this parameter is only supported by OpenAI and is ignored for others. It applies to every
539
+ * response format, including `json_object` and `json_schema`.
524
540
  * For other providers ask about verbosity in prompt and using `maxOutputTokens`.
525
541
  */
526
542
  verbosity?: AiVerbosityLevel;
@@ -575,7 +591,7 @@ export interface OpenAiChatOptions extends BaseAiChatOptions {
575
591
  * not support the exact requested level.
576
592
  * @category AI
577
593
  */
578
- export type CanonicalReasoningEffort = 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'max';
594
+ export type { CanonicalReasoningEffort } from './ai-common.public-types';
579
595
  /**
580
596
  * AI reasoning effort. Pass one of the canonical levels for portable, autocomplete-friendly usage, or
581
597
  * a raw provider-native string when a model exposes a level outside the canonical set.
@@ -660,6 +676,56 @@ export type AiChatOptions<T extends AiChatModelSelection | undefined = undefined
660
676
  export type AllAiAgentChatOptions = {
661
677
  [K in keyof BaseAiChatOptions | keyof GeminiChatOptions | keyof GrokChatOptions | keyof OpenAiChatOptions | keyof AnthropicChatOptions]?: (K extends keyof BaseAiChatOptions ? BaseAiChatOptions[K] : never) | (K extends keyof GeminiChatOptions ? GeminiChatOptions[K] : never) | (K extends keyof GrokChatOptions ? GrokChatOptions[K] : never) | (K extends keyof OpenAiChatOptions ? OpenAiChatOptions[K] : never) | (K extends keyof AnthropicChatOptions ? AnthropicChatOptions[K] : never);
662
678
  };
679
+ /**
680
+ * Configuration for exposing an AI agent as an MCP server at `/mcp/<agentId>`.
681
+ * @category AI
682
+ */
683
+ export interface AiAgentMcpServerConfig {
684
+ /** Whether the agent is exposed as an MCP server. */
685
+ enabled: boolean;
686
+ /**
687
+ * Description of the MCP server, served as the `instructions` field of the MCP initialize
688
+ * result. Defaults to the agent description when not provided.
689
+ */
690
+ description?: string;
691
+ /**
692
+ * Description of the MCP `ask` tool, exposed in the tools manifest.
693
+ * Defaults to a generic ask-the-agent description when not provided.
694
+ */
695
+ toolDescription?: string;
696
+ /**
697
+ * ID of an auth integration used to OAuth-protect the MCP server. When set, MCP requests must
698
+ * include a valid bearer token from this integration. Without this and `requireApiKey`, the
699
+ * MCP endpoint is public.
700
+ */
701
+ oauthIntegrationId?: IntegrationId;
702
+ /**
703
+ * When true, MCP requests must present the agent's API key as a bearer token
704
+ * (`Authorization: Bearer <agent API key>` or the `x-squid-agent-api-key` header). Can be
705
+ * combined with `oauthIntegrationId`, in which case either credential is accepted.
706
+ */
707
+ requireApiKey?: boolean;
708
+ }
709
+ /**
710
+ * Request to AI-generate the MCP server and tool descriptions for an agent based on its
711
+ * instructions and connected resources.
712
+ * @category AI
713
+ */
714
+ export interface GenerateAgentMcpDescriptionsRequest {
715
+ /** The ID of the agent to generate MCP descriptions for. */
716
+ agentId: AiAgentId;
717
+ }
718
+ /**
719
+ * AI-generated MCP descriptions for an agent. Returned without persisting — the caller saves them
720
+ * onto the agent's MCP server configuration.
721
+ * @category AI
722
+ */
723
+ export interface GenerateAgentMcpDescriptionsResponse {
724
+ /** Generated description of the MCP server. */
725
+ description: string;
726
+ /** Generated description of the MCP `ask` tool. */
727
+ toolDescription: string;
728
+ }
663
729
  /**
664
730
  * A definition of an AI agent with its properties and default chat options.
665
731
  * @category AI
@@ -683,6 +749,8 @@ export interface AiAgent<T extends AiChatModelSelection | undefined = undefined>
683
749
  options: AiChatOptions<T>;
684
750
  /** Optional api key used specifically for operations on this agent */
685
751
  apiKey?: string;
752
+ /** Optional configuration for exposing the agent as an MCP server. */
753
+ mcpServer?: AiAgentMcpServerConfig;
686
754
  }
687
755
  /**
688
756
  * @category AI
@@ -8,13 +8,18 @@ export declare const RERANK_PROVIDERS: readonly ["cohere", "none"];
8
8
  */
9
9
  export type AiRerankProvider = (typeof RERANK_PROVIDERS)[number];
10
10
  /** List of available AI provider types. See AiProviderType. */
11
- export declare const AI_PROVIDER_TYPES: readonly ["anthropic", "bedrock", "claude-code", "codex", "cohere", "flux", "gemini", "openai", "openai-compatible", "grok", "stability", "voyage", "mistral", "textract", "vertex", "external"];
11
+ export declare const AI_PROVIDER_TYPES: readonly ["anthropic", "bedrock", "claude-code", "codex", "cohere", "flux", "gemini", "openai", "openai-compatible", "grok", "stability", "voyage", "mistral", "textract", "azure_document_intelligence", "vertex", "external"];
12
12
  /**
13
13
  * Type of the AI provider.
14
14
  * References a single AI service, regardless of the model or other AI function it provides (like
15
15
  * chat/search/transcribe etc...).
16
16
  */
17
17
  export type AiProviderType = (typeof AI_PROVIDER_TYPES)[number];
18
+ /**
19
+ * Canonical reasoning-effort levels, ordered from least to most effort.
20
+ * @category AI
21
+ */
22
+ export type CanonicalReasoningEffort = 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'max' | 'ultra';
18
23
  /**
19
24
  * Type of AI provider that supports file upload operations.
20
25
  * Only a subset of AI providers support file management features.
@@ -34,17 +39,17 @@ export declare const GEMINI_CHAT_MODEL_NAMES: readonly ["gemini-3.1-pro", "gemin
34
39
  * Public Grok chat model names (active models only).
35
40
  * @category AI
36
41
  */
37
- export declare const GROK_CHAT_MODEL_NAMES: readonly ["grok-4.3", "grok-4-1-fast-reasoning", "grok-4-1-fast-non-reasoning"];
42
+ export declare const GROK_CHAT_MODEL_NAMES: readonly ["grok-4.5", "grok-4-1-fast-reasoning", "grok-4-1-fast-non-reasoning"];
38
43
  /**
39
44
  * Public Anthropic chat model names (active models only).
40
45
  * @category AI
41
46
  */
42
- export declare const ANTHROPIC_CHAT_MODEL_NAMES: readonly ["claude-haiku-4-5-20251001", "claude-opus-5", "claude-sonnet-5"];
47
+ export declare const ANTHROPIC_CHAT_MODEL_NAMES: readonly ["claude-fable-5", "claude-haiku-4-5-20251001", "claude-opus-5", "claude-sonnet-5"];
43
48
  /**
44
49
  * The supported AI model names.
45
50
  * @category AI
46
51
  */
47
- export declare const VENDOR_AI_CHAT_MODEL_NAMES: readonly ["gpt-5.4-mini", "gpt-5.4-nano", "gpt-5.5", "gpt-5.5-pro", "gpt-5.6-sol", "gpt-5.6-terra", "gpt-5.6-luna", "claude-haiku-4-5-20251001", "claude-opus-5", "claude-sonnet-5", "gemini-3.1-pro", "gemini-3.6-flash", "gemini-3.5-flash-lite", "grok-4.3", "grok-4-1-fast-reasoning", "grok-4-1-fast-non-reasoning"];
52
+ export declare const VENDOR_AI_CHAT_MODEL_NAMES: readonly ["gpt-5.4-mini", "gpt-5.4-nano", "gpt-5.5", "gpt-5.5-pro", "gpt-5.6-sol", "gpt-5.6-terra", "gpt-5.6-luna", "claude-fable-5", "claude-haiku-4-5-20251001", "claude-opus-5", "claude-sonnet-5", "gemini-3.1-pro", "gemini-3.6-flash", "gemini-3.5-flash-lite", "grok-4.5", "grok-4-1-fast-reasoning", "grok-4-1-fast-non-reasoning"];
48
53
  /** Checks if the given model name is a global AI chat model name. */
49
54
  export declare function isVendorAiChatModelName(modelName: unknown): modelName is VendorAiChatModelName;
50
55
  /**
@@ -219,6 +224,10 @@ export type AiModelSource = (typeof AI_MODEL_SOURCES)[number];
219
224
  export interface ModelIdSpec {
220
225
  /** The model ID used for API calls. */
221
226
  modelId: AiChatModelName;
227
+ /** The provider serving this model when Squid can determine it from the model registry. */
228
+ providerType?: AiProviderType;
229
+ /** Canonical reasoning-effort levels accepted natively by this model. */
230
+ reasoningEfforts?: CanonicalReasoningEffort[];
222
231
  /** The integration ID if this model comes from an integration (OpenAI-compatible, Bedrock). Is undefined for Squid-provided models. */
223
232
  integrationId?: string;
224
233
  /** Human-readable display name for the model (e.g. "GPT-4o"). */
@@ -554,6 +554,16 @@ export interface AiKnowledgeBaseFileContextRequest extends BaseAiKnowledgeBaseCo
554
554
  */
555
555
  discardOriginalFile?: boolean;
556
556
  }
557
+ /**
558
+ * Largest single file the bulk multipart staging endpoint accepts (`bulkUpsertContexts` with `files`).
559
+ *
560
+ * Public and shared deliberately: the upload parser rejects an oversized part with a 413 that carries no
561
+ * fallback token, so a client that does not know this bound has no way to route around it — every retry
562
+ * fails identically. Callers with larger files should use `createBulkUploadUrls` + `stagedObjectKey`, which
563
+ * uploads straight to storage and is not subject to it.
564
+ * @category AI
565
+ */
566
+ export declare const BULK_INGESTION_MAX_MULTIPART_FILE_BYTES: number;
557
567
  /**
558
568
  * @category AI
559
569
  */
@@ -1430,3 +1440,176 @@ export interface QueryKnowledgeBaseGraphResponse {
1430
1440
  /** `globalSummary`: the KB's topic summaries ranked against the query, most relevant first. */
1431
1441
  summaries?: Array<KnowledgeBaseGraphQueryGlobalSummary>;
1432
1442
  }
1443
+ /**
1444
+ * One context to stage through bulk ingestion.
1445
+ * @category AI
1446
+ */
1447
+ export interface BulkIngestionContext {
1448
+ /** `'text'` (the default) stages a text context; `'file'` consumes the next uploaded file positionally. */
1449
+ type?: 'text' | 'file';
1450
+ /** Title for a text context (required); optional display title for a file context. */
1451
+ title?: string;
1452
+ /** The text content to stage; required for `type: 'text'`. */
1453
+ text?: string;
1454
+ /** Whether to extract images: inline markdown/HTML images for text contexts, embedded images for files. */
1455
+ extractImages?: boolean;
1456
+ /** Hint about a text context's format; only meaningful for `type: 'text'`. */
1457
+ format?: 'markdown' | 'html' | 'plain';
1458
+ /**
1459
+ * Key returned by bulk/createUploadUrls; the server ingests the staged object as this context's file.
1460
+ * Mutually exclusive with a positional multipart file.
1461
+ */
1462
+ stagedObjectKey?: string;
1463
+ /**
1464
+ * The preferred method for extracting data from a file context; mirrors the sync lane's field of the
1465
+ * same name, so a caller's choice survives whichever lane a deployment routes the upload through.
1466
+ */
1467
+ preferredExtractionMethod?: DocumentExtractionMethod;
1468
+ /**
1469
+ * Optional metadata associated with the context item; mirrors {@link BaseAiKnowledgeBaseContextRequest.metadata}.
1470
+ * Squid-reserved keys are stripped server-side, and values are validated/normalized against the target
1471
+ * knowledge base's `metadataFields` schema when one is declared.
1472
+ */
1473
+ metadata?: Record<string, unknown>;
1474
+ }
1475
+ /**
1476
+ * Request structure for staging contexts through bulk ingestion: a durable, asynchronous lane that
1477
+ * processes contexts through provider batch APIs rather than inline, for high-volume ingestion. Poll
1478
+ * {@link BulkIngestionJobStatusResponse} with the returned job id for progress.
1479
+ * @category AI
1480
+ */
1481
+ export interface BulkIngestionUpsertContextsRequest {
1482
+ /** The id of the AiKnowledgeBase to ingest into. */
1483
+ knowledgeBaseId: string;
1484
+ /** The contexts to stage; each becomes one bulk-ingestion file. */
1485
+ contexts: Array<BulkIngestionContext>;
1486
+ }
1487
+ /**
1488
+ * Response for a staged bulk-ingestion request.
1489
+ * @category AI
1490
+ */
1491
+ export interface BulkIngestionUpsertContextsResponse {
1492
+ /** The id of the staged bulk-ingestion job. */
1493
+ jobId: string;
1494
+ /**
1495
+ * Context ids assigned to the staged contexts, in the same order as the request's `contexts` array. A
1496
+ * context rejected as a duplicate still occupies its slot here, so this stays index-aligned with the
1497
+ * request; cross-reference `duplicates` by `contextId` to tell which ids were actually staged.
1498
+ */
1499
+ contextIds: Array<string>;
1500
+ /**
1501
+ * Contexts rejected because the knowledge base already holds identical content — either stored under an
1502
+ * existing context or accepted earlier in this same call. Absent when nothing was rejected.
1503
+ *
1504
+ * Same shape and `errorCode: 'DUPLICATE_CONTENT'` the synchronous `upsertContexts` returns, so a caller
1505
+ * handles a duplicate identically on both lanes. These contexts are NOT part of the job: they are not
1506
+ * extracted, not staged, and never appear in its per-file statuses.
1507
+ */
1508
+ duplicates?: Array<UpsertContextStatusError>;
1509
+ }
1510
+ /**
1511
+ * Request structure for reading a bulk-ingestion job's progress.
1512
+ * @category AI
1513
+ */
1514
+ export interface BulkIngestionJobStatusRequest {
1515
+ /** The id of the bulk-ingestion job to inspect. */
1516
+ jobId: string;
1517
+ }
1518
+ /**
1519
+ * Progress counters for a bulk-ingestion job, aggregated from its files and logical requests.
1520
+ * @category AI
1521
+ */
1522
+ export interface BulkIngestionJobStatusCounts {
1523
+ /** Total files staged for the job. */
1524
+ files: number;
1525
+ /** Files whose contexts have been finalized into the knowledge base. */
1526
+ finalized: number;
1527
+ /** Files that terminally failed. */
1528
+ failed: number;
1529
+ /** Logical requests still pending submission. */
1530
+ requestsPending: number;
1531
+ /** Logical requests submitted to the provider and awaiting results. */
1532
+ requestsSubmitted: number;
1533
+ }
1534
+ /**
1535
+ * Per-file/per-context status within a bulk-ingestion job, so a caller can see which file finished,
1536
+ * which is still processing, and why a file failed.
1537
+ * @category AI
1538
+ */
1539
+ export interface BulkIngestionFileStatus {
1540
+ /** The context id assigned to this file at staging. */
1541
+ contextId: string;
1542
+ /** The file's title — the uploaded file name, or the caller-supplied title for text contexts. */
1543
+ title: string;
1544
+ /** User-facing per-file status. */
1545
+ status: 'processing' | 'completed' | 'failed';
1546
+ /** Present only when status is 'failed': the terminal failure reason. */
1547
+ errorMessage?: string;
1548
+ }
1549
+ /**
1550
+ * Response describing a bulk-ingestion job's current state and progress counts.
1551
+ * @category AI
1552
+ */
1553
+ export interface BulkIngestionJobStatusResponse {
1554
+ /** The job's lifecycle state (e.g. running, completed, failed, cancelled). */
1555
+ state: string;
1556
+ /** Progress counters aggregated from the job's files and logical requests. */
1557
+ counts: BulkIngestionJobStatusCounts;
1558
+ /** Provider batch ids submitted for this job. */
1559
+ providerBatchIds: Array<string>;
1560
+ /** Per-file status, one entry per staged context (bounded by the job's file cap). */
1561
+ files: Array<BulkIngestionFileStatus>;
1562
+ }
1563
+ /**
1564
+ * Request structure for cancelling a running bulk-ingestion job.
1565
+ * @category AI
1566
+ */
1567
+ export interface BulkIngestionCancelRequest {
1568
+ /** The id of the bulk-ingestion job to cancel. */
1569
+ jobId: string;
1570
+ }
1571
+ /**
1572
+ * Request structure for subscribing to push updates on a bulk-ingestion job. Once subscribed, the caller's
1573
+ * client id receives a `bulkIngestionStatus` socket event on each orchestrator tick that touches the job,
1574
+ * plus one final event on completion/failure/cancellation — in addition to (not instead of) polling
1575
+ * {@link BulkIngestionJobStatusResponse} through `bulk/getJob`.
1576
+ * @category AI
1577
+ */
1578
+ export interface BulkIngestionSubscribeRequest {
1579
+ /** The id of the bulk-ingestion job to subscribe to. */
1580
+ jobId: string;
1581
+ }
1582
+ /**
1583
+ * Request structure for minting presigned upload URLs for direct-to-storage bulk ingestion: the caller
1584
+ * PUTs each file's bytes straight to storage, then references it in {@link BulkIngestionContext} via
1585
+ * `stagedObjectKey`, bypassing multipart upload through core.
1586
+ * @category AI
1587
+ */
1588
+ export interface BulkIngestionCreateUploadUrlsRequest {
1589
+ /** The files to mint upload URLs for (at most 500 per call). */
1590
+ files: Array<{
1591
+ fileName: string;
1592
+ }>;
1593
+ }
1594
+ /**
1595
+ * Response listing a presigned upload URL and staged-object key for each requested file, positionally
1596
+ * aligned with the request's `files` array.
1597
+ * @category AI
1598
+ */
1599
+ export interface BulkIngestionCreateUploadUrlsResponse {
1600
+ /** One entry per requested file. */
1601
+ uploads: Array<{
1602
+ /** The original file name, echoed back from the request. */
1603
+ fileName: string;
1604
+ /** Presigned URL the caller PUTs the file's bytes to; expires shortly after minting. */
1605
+ uploadUrl: string;
1606
+ /**
1607
+ * Headers the PUT MUST carry in addition to the caller's own `Content-Type`. Empty on storage
1608
+ * backends that mandate none (S3); on Azure Blob Storage the PUT is rejected with 400
1609
+ * `MissingRequiredHeader` unless these are sent.
1610
+ */
1611
+ requiredHeaders: Record<string, string>;
1612
+ /** Key to pass as {@link BulkIngestionContext.stagedObjectKey} once the PUT completes. */
1613
+ stagedObjectKey: string;
1614
+ }>;
1615
+ }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * The extraction method to use for processing documents.
3
3
  */
4
- export type DocumentExtractionMethod = 'mistral_ocr' | 'legacy' | 'amazon_textract';
4
+ export type DocumentExtractionMethod = 'mistral_ocr' | 'legacy' | 'amazon_textract' | 'azure_document_intelligence';
5
5
  /**
6
6
  * Options for customizing how data is extracted from a document.
7
7
  */
@@ -9,6 +9,12 @@ export declare const DATA_INTEGRATION_TYPES: readonly ["bigquery", "built_in_db"
9
9
  * @category Auth
10
10
  */
11
11
  export declare const AUTH_INTEGRATION_TYPES: readonly ["auth0", "jwt_rsa", "jwt_hmac", "cognito", "okta", "keycloak", "descope", "firebase_auth", "azure-entra-external-id"];
12
+ /**
13
+ * Auth integration types that can OAuth-protect an MCP server (see `McpOAuthOptions` and
14
+ * `AiAgentMcpServerConfig.oauthIntegrationId`). Kept in sync with the providers supported by the
15
+ * MCP OAuth validation in core.
16
+ */
17
+ export declare const MCP_OAUTH_INTEGRATION_TYPES: readonly ["auth0"];
12
18
  /** Supported integration types for GraphQL-based services. */
13
19
  export declare const GRAPHQL_INTEGRATION_TYPES: readonly ["graphql"];
14
20
  /** Supported integration types for HTTP-based services. */
@@ -1,3 +1,4 @@
1
+ import type { CanonicalReasoningEffort } from './ai-agent.public-types';
1
2
  import type { IntegrationInfo } from './integration.public-types';
2
3
  /** Identifies the source-code analysis AI function. */
3
4
  export declare const SOURCE_CODE_ANALYZE_FUNCTION_ID = "analyzeCode";
@@ -23,6 +24,10 @@ export interface AiAgentSourceCodeIntegrationOptions {
23
24
  codeAnalysisEnabled: boolean;
24
25
  /** Selects the CLI provider used for code analysis. */
25
26
  analyzerModel?: SourceCodeAnalyzerModel;
27
+ /** Selects a concrete model from the analyzer provider's CLI registry. */
28
+ analyzerModelId?: string;
29
+ /** Selects the reasoning effort used by the analyzer CLI. */
30
+ analyzerReasoningEffort?: CanonicalReasoningEffort;
26
31
  /** Provides supplemental code-analysis instructions. */
27
32
  analyzerInstructions?: string;
28
33
  }
@@ -1,5 +1,5 @@
1
1
  import { Observable } from 'rxjs';
2
- import { AiAgent, AiChatMessage, AiChatModelSelection, AiConnectedAgentMetadata, AiConnectedIntegrationMetadata, AiConnectedKnowledgeBaseMetadata, AiStatusMessage, AiTranscribeAndAskResponse, AllAiAgentChatOptions, BuildAgentOptions, GuardrailsOptions, ListAgentRevisionsResponse, UpsertAgentRequest } from '../../../internal-common/src/public-types/ai-agent.public-types';
2
+ import { AiAgent, AiAgentMcpServerConfig, AiChatMessage, AiChatModelSelection, AiConnectedAgentMetadata, AiConnectedIntegrationMetadata, AiConnectedKnowledgeBaseMetadata, AiStatusMessage, AiTranscribeAndAskResponse, AllAiAgentChatOptions, BuildAgentOptions, GenerateAgentMcpDescriptionsResponse, GuardrailsOptions, ListAgentRevisionsResponse, UpsertAgentRequest } from '../../../internal-common/src/public-types/ai-agent.public-types';
3
3
  import { JobId } from '../../../internal-common/src/public-types/job.public-types';
4
4
  import { Paths } from '../../../internal-common/src/public-types/typescript.public-types';
5
5
  import { AiAskOptions, AiAskOptionsWithVoice, AiChatOptionsWithoutVoice, AskResponse, AskWithVoiceResponse, TranscribeAndAskWithVoiceResponse, TranscribeAndChatResponse } from './ai-agent-client.types';
@@ -52,6 +52,17 @@ export declare class AiAgentReference {
52
52
  * Updates the agent's guardrails with the provided options.
53
53
  */
54
54
  updateGuardrails(guardrails: GuardrailsOptions): Promise<void>;
55
+ /**
56
+ * Updates the agent's MCP server configuration, controlling whether the agent is exposed as an
57
+ * MCP server at `/mcp/<agentId>`. Requires an API key.
58
+ */
59
+ updateMcpServer(mcpServer: AiAgentMcpServerConfig): Promise<void>;
60
+ /**
61
+ * AI-generates the MCP server and `ask` tool descriptions for the agent based on its
62
+ * instructions and connected resources. Returns the descriptions without persisting them —
63
+ * save them with {@link updateMcpServer}. Requires an API key.
64
+ */
65
+ generateMcpDescriptions(): Promise<GenerateAgentMcpDescriptionsResponse>;
55
66
  /**
56
67
  * Updates the agent's custom guardrails with the provided custom guardrail.
57
68
  */
@@ -19,6 +19,7 @@ export declare class AiClient {
19
19
  private readonly socketManager;
20
20
  private readonly rpcManager;
21
21
  private readonly jobClient;
22
+ private readonly clientIdService;
22
23
  private readonly backendFunctionManager;
23
24
  private readonly getMetricAnnotations;
24
25
  private aiAgentClient?;
@@ -1,4 +1,5 @@
1
- import { AiEmbeddingsModelWithOptionalFields, AiKnowledgeBase, AiKnowledgeBaseChatOptions, AiKnowledgeBaseContext, AiKnowledgeBaseContextRequest, AiKnowledgeBaseContextWithReasoning, AiKnowledgeBaseDownloadContextResponse, AiKnowledgeBaseSearchContextsWithContextIdRequest, AiKnowledgeBaseSearchContextsWithPromptRequest, AiKnowledgeBaseSearchResponse, AiKnowledgeBaseSearchResultChunk, ExploreKnowledgeBaseGraphRequest, ExploreKnowledgeBaseGraphResponse, GenerateMetadataFieldDescriptionsRequest, GenerateMetadataFieldDescriptionsResponse, GetKnowledgeBaseGraphStatusResponse, GrepKnowledgeBaseOptions, GrepKnowledgeBaseResponse, ListAiKnowledgeBaseContextsPageResponse, ListKnowledgeBaseContextsOptions, QueryKnowledgeBaseGraphRequest, QueryKnowledgeBaseGraphResponse, RebuildKnowledgeBaseGraphRequest, UpsertKnowledgeBaseContextResponse, UpsertKnowledgeBaseContextsResponse } from '../../../internal-common/src/public-types/ai-knowledge-base.public-types';
1
+ import { Observable } from 'rxjs';
2
+ import { AiEmbeddingsModelWithOptionalFields, AiKnowledgeBase, AiKnowledgeBaseChatOptions, AiKnowledgeBaseContext, AiKnowledgeBaseContextRequest, AiKnowledgeBaseContextWithReasoning, AiKnowledgeBaseDownloadContextResponse, AiKnowledgeBaseSearchContextsWithContextIdRequest, AiKnowledgeBaseSearchContextsWithPromptRequest, AiKnowledgeBaseSearchResponse, AiKnowledgeBaseSearchResultChunk, BulkIngestionContext, BulkIngestionCreateUploadUrlsResponse, BulkIngestionJobStatusResponse, BulkIngestionUpsertContextsResponse, ExploreKnowledgeBaseGraphRequest, ExploreKnowledgeBaseGraphResponse, GenerateMetadataFieldDescriptionsRequest, GenerateMetadataFieldDescriptionsResponse, GetKnowledgeBaseGraphStatusResponse, GrepKnowledgeBaseOptions, GrepKnowledgeBaseResponse, ListAiKnowledgeBaseContextsPageResponse, ListKnowledgeBaseContextsOptions, QueryKnowledgeBaseGraphRequest, QueryKnowledgeBaseGraphResponse, RebuildKnowledgeBaseGraphRequest, UpsertKnowledgeBaseContextResponse, UpsertKnowledgeBaseContextsResponse } from '../../../internal-common/src/public-types/ai-knowledge-base.public-types';
2
3
  import { AiContextId } from '../../../internal-common/src/public-types/communication.public-types';
3
4
  /**
4
5
  * Parameters for creating or updating an AI agent.
@@ -25,6 +26,8 @@ export declare class AiKnowledgeBaseReference {
25
26
  private readonly knowledgeBaseId;
26
27
  private readonly rpcManager;
27
28
  private readonly jobClient;
29
+ private readonly socketManager;
30
+ private readonly clientIdService;
28
31
  /**
29
32
  * Returns the AI knowledge base.
30
33
  * @returns A promise that resolves to the AI knowledge base or undefined if not found.
@@ -91,6 +94,56 @@ export declare class AiKnowledgeBaseReference {
91
94
  * (content-level dedup). Requests that carry an explicit `contextId` overwrite that context unconditionally.
92
95
  */
93
96
  upsertContexts(contextRequests: Array<AiKnowledgeBaseContextRequest>, files?: Array<File>, options?: UpsertContextsOptions): Promise<UpsertKnowledgeBaseContextsResponse>;
97
+ /**
98
+ * Stages contexts through bulk ingestion — a durable, asynchronous lane that processes contexts through
99
+ * provider batch APIs rather than inline, built for high-volume ingestion. Unlike {@link upsertContexts},
100
+ * this method returns as soon as the request is staged and **never** awaits ingestion completion; track
101
+ * progress with {@link observeBulkIngestionJob} or by polling {@link getBulkIngestionJob} with the
102
+ * returned job id.
103
+ * @param contextRequests The contexts to stage; each becomes one bulk-ingestion file.
104
+ * @param files Positional files for contexts with `type: 'file'` and no `stagedObjectKey`. At most 50
105
+ * files, and 256 MB across all of them — the multipart body is buffered in memory server-side, so both
106
+ * caps are enforced by the upload parser and exceeding either is rejected before staging runs. For larger
107
+ * sets use {@link createBulkUploadUrls} and pass `stagedObjectKey` instead, which uploads straight to
108
+ * storage and is subject to neither cap.
109
+ * @returns The id of the staged bulk-ingestion job, plus the context id assigned to each staged context
110
+ * (in the same order as `contextRequests`).
111
+ */
112
+ bulkUpsertContexts(contextRequests: Array<BulkIngestionContext>, files?: Array<File>): Promise<BulkIngestionUpsertContextsResponse>;
113
+ /**
114
+ * Mints presigned upload URLs for direct-to-storage bulk files, bypassing multipart upload through core.
115
+ * PUT each file's bytes to its `uploadUrl` — sending every header in that entry's `requiredHeaders`,
116
+ * which some storage backends reject the PUT without — then reference the matching `stagedObjectKey` in
117
+ * a {@link BulkIngestionContext} passed to {@link bulkUpsertContexts}.
118
+ * @param fileNames The names of the files to mint upload URLs for (at most 500 per call).
119
+ */
120
+ createBulkUploadUrls(fileNames: Array<string>): Promise<BulkIngestionCreateUploadUrlsResponse>;
121
+ /**
122
+ * Returns a bulk-ingestion job's current lifecycle state and progress counts.
123
+ */
124
+ getBulkIngestionJob(jobId: string): Promise<BulkIngestionJobStatusResponse>;
125
+ /**
126
+ * Cancels a running bulk-ingestion job. Already-finalized contexts are kept; the job transitions to
127
+ * `cancelled` once in-flight provider work drains.
128
+ */
129
+ cancelBulkIngestionJob(jobId: string): Promise<void>;
130
+ /**
131
+ * Emits every `bulkIngestionStatus` push the server sends for the job and completes once a terminal
132
+ * state (`completed`, `failed` or `cancelled`) is emitted. Unlike {@link JobClient.awaitJob}, a terminal
133
+ * `failed`/`cancelled` state is delivered as a normal emitted value — the observable itself never errors
134
+ * because the job reached a terminal state; it only errors on a transport/subscription failure.
135
+ *
136
+ * Re-subscribes to the server-side push automatically if the client's connection id changes mid-subscription
137
+ * (e.g. after a long disconnect). Unsubscribing tears down the underlying socket listener. The observable is
138
+ * cold: each subscription independently registers a server-side push subscription, so share it (e.g. rxjs
139
+ * `share()`) when multiple consumers observe one job.
140
+ *
141
+ * If the job's app or knowledge base is deleted mid-flight, the job row is purged without a terminal push,
142
+ * so the observable never completes on its own; bound it (e.g. rxjs `timeout()`) when deletion is possible.
143
+ */
144
+ observeBulkIngestionJob(jobId: string): Observable<BulkIngestionJobStatusResponse & {
145
+ jobId: string;
146
+ }>;
94
147
  /**
95
148
  * Performs a semantic search in the knowledge base and returns chunks from the different contexts.
96
149
  */
@@ -10,6 +10,8 @@ import { AiKnowledgeBaseReference } from './ai-knowledge-base-client-reference';
10
10
  export declare class AiKnowledgeBaseClient {
11
11
  private readonly rpcManager;
12
12
  private readonly jobClient;
13
+ private readonly socketManager;
14
+ private readonly clientIdService;
13
15
  /**
14
16
  * Retrieves an instance of AiKnowledeBaseReference for a specific kb ID.
15
17
  * This reference provides methods for interacting with the knowledgebase.
@@ -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.484";
5
+ export declare const SQUIDCLOUD_CLIENT_PACKAGE_VERSION = "1.0.486";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squidcloud/client",
3
- "version": "1.0.484",
3
+ "version": "1.0.486",
4
4
  "description": "A typescript implementation of the Squid client",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -50,17 +50,10 @@
50
50
  "rxjs": ">=7.5.7 <8.0.0"
51
51
  },
52
52
  "devDependencies": {
53
- "@supercharge/promise-pool": "^3.2.0",
54
- "@webpack-cli/generators": "^3.0.7",
55
- "copy-webpack-plugin": "^14.0.0",
56
53
  "generate-package-json-webpack-plugin": "^2.6.0",
57
54
  "otrie": "^1.2.2",
58
- "tsconfig-paths-webpack-plugin": "^4.1.0",
59
- "tscpaths": "^0.0.9",
60
55
  "typedoc": "^0.28.10",
61
- "typedoc-plugin-markdown": "^4.8.1",
62
- "webpack": "^5.106.2",
63
- "webpack-cli": "^5.1.4"
56
+ "typedoc-plugin-markdown": "^4.8.1"
64
57
  },
65
58
  "browser": {
66
59
  "ws": false