@squidcloud/client 1.0.485 → 1.0.487
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/cjs/index.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/internal-common/src/public-types/ai-agent.public-types.d.ts +32 -16
- package/dist/internal-common/src/public-types/ai-common.public-types.d.ts +4 -4
- package/dist/internal-common/src/public-types/ai-knowledge-base.public-types.d.ts +183 -0
- package/dist/internal-common/src/public-types/extraction.public-types.d.ts +1 -1
- package/dist/typescript-client/src/ai-client.d.ts +1 -0
- package/dist/typescript-client/src/ai-knowledge-base/ai-knowledge-base-client-reference.d.ts +54 -1
- package/dist/typescript-client/src/ai-knowledge-base/ai-knowledge-base-client.d.ts +2 -0
- package/dist/typescript-client/src/version.d.ts +1 -1
- package/package.json +2 -7
- package/dist/internal-common/src/ai/system-openai-compatible.d.ts +0 -35
- package/dist/internal-common/src/metric-name.d.ts +0 -14
- package/dist/internal-common/src/public-types-backend/api-call.public-context.d.ts +0 -30
- package/dist/internal-common/src/public-types-backend/mutation.public-context.d.ts +0 -161
- package/dist/internal-common/src/public-types-backend/native-query.public-context.d.ts +0 -75
- package/dist/internal-common/src/public-types-backend/query.public-context.d.ts +0 -193
- package/dist/internal-common/src/types/ai-agent.types.d.ts +0 -253
- package/dist/internal-common/src/types/ai-knowledge-base.types.d.ts +0 -306
- package/dist/internal-common/src/types/ai-matchmaking.types.d.ts +0 -19
- package/dist/internal-common/src/types/backend-function.types.d.ts +0 -1
- package/dist/internal-common/src/types/communication.types.d.ts +0 -1
- package/dist/internal-common/src/types/document.types.d.ts +0 -1
- package/dist/internal-common/src/types/file.types.d.ts +0 -6
- package/dist/internal-common/src/types/headers.types.d.ts +0 -41
- package/dist/internal-common/src/types/management-api-key.types.d.ts +0 -92
- package/dist/internal-common/src/types/mutation.types.d.ts +0 -1
- package/dist/internal-common/src/types/notification.types.d.ts +0 -19
- package/dist/internal-common/src/types/observability.types.d.ts +0 -168
- package/dist/internal-common/src/types/query.types.d.ts +0 -15
- package/dist/internal-common/src/types/secret.types.d.ts +0 -7
- package/dist/internal-common/src/types/socket.types.d.ts +0 -1
- package/dist/internal-common/src/types/stage.d.ts +0 -9
- package/dist/internal-common/src/types/time-units.d.ts +0 -1
- package/dist/internal-common/src/types/url-shortener.types.d.ts +0 -45
- package/dist/internal-common/src/utils/array.d.ts +0 -7
- package/dist/internal-common/src/utils/e2e-test-utils.d.ts +0 -2
- package/dist/internal-common/src/utils/file-utils.d.ts +0 -2
- package/dist/internal-common/src/utils/global.utils.d.ts +0 -1
- package/dist/internal-common/src/utils/http.d.ts +0 -10
- package/dist/internal-common/src/utils/lock.manager.d.ts +0 -14
- package/dist/internal-common/src/utils/metric-utils.d.ts +0 -4
- package/dist/internal-common/src/utils/metrics.types.d.ts +0 -7
- package/dist/internal-common/src/utils/object.d.ts +0 -86
- package/dist/internal-common/src/utils/serialization.d.ts +0 -24
- package/dist/internal-common/src/utils/squid.constants.d.ts +0 -6
- package/dist/internal-common/src/utils/trace-id-generator.d.ts +0 -1
- package/dist/internal-common/src/utils/validation.d.ts +0 -19
- package/dist/internal-common/src/websocket.impl.d.ts +0 -26
|
@@ -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
|
-
*
|
|
157
|
-
*
|
|
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
|
-
*
|
|
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
|
|
199
|
+
* - `AiStructuredOutputFormat`: Structured output with schema - guarantees JSON conforms exactly to provided schema
|
|
199
200
|
*
|
|
200
|
-
* **Structured outputs
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
*
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
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
|
|
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;
|
|
@@ -8,7 +8,7 @@ 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
|
|
@@ -39,17 +39,17 @@ export declare const GEMINI_CHAT_MODEL_NAMES: readonly ["gemini-3.1-pro", "gemin
|
|
|
39
39
|
* Public Grok chat model names (active models only).
|
|
40
40
|
* @category AI
|
|
41
41
|
*/
|
|
42
|
-
export declare const GROK_CHAT_MODEL_NAMES: readonly ["grok-4.
|
|
42
|
+
export declare const GROK_CHAT_MODEL_NAMES: readonly ["grok-4.5", "grok-4-1-fast-reasoning", "grok-4-1-fast-non-reasoning"];
|
|
43
43
|
/**
|
|
44
44
|
* Public Anthropic chat model names (active models only).
|
|
45
45
|
* @category AI
|
|
46
46
|
*/
|
|
47
|
-
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"];
|
|
48
48
|
/**
|
|
49
49
|
* The supported AI model names.
|
|
50
50
|
* @category AI
|
|
51
51
|
*/
|
|
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-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.
|
|
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"];
|
|
53
53
|
/** Checks if the given model name is a global AI chat model name. */
|
|
54
54
|
export declare function isVendorAiChatModelName(modelName: unknown): modelName is VendorAiChatModelName;
|
|
55
55
|
/**
|
|
@@ -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
|
*/
|
|
@@ -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?;
|
package/dist/typescript-client/src/ai-knowledge-base/ai-knowledge-base-client-reference.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
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.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@squidcloud/client",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.487",
|
|
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,15 +50,10 @@
|
|
|
50
50
|
"rxjs": ">=7.5.7 <8.0.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@supercharge/promise-pool": "^3.2.0",
|
|
54
|
-
"copy-webpack-plugin": "^14.0.0",
|
|
55
53
|
"generate-package-json-webpack-plugin": "^2.6.0",
|
|
56
54
|
"otrie": "^1.2.2",
|
|
57
|
-
"tsconfig-paths-webpack-plugin": "^4.1.0",
|
|
58
55
|
"typedoc": "^0.28.10",
|
|
59
|
-
"typedoc-plugin-markdown": "^4.8.1"
|
|
60
|
-
"webpack": "^5.106.2",
|
|
61
|
-
"webpack-cli": "^5.1.4"
|
|
56
|
+
"typedoc-plugin-markdown": "^4.8.1"
|
|
62
57
|
},
|
|
63
58
|
"browser": {
|
|
64
59
|
"ws": false
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* System-level OpenAI-compatible backends ("slots") for Squid's own internal AI calls.
|
|
3
|
-
*
|
|
4
|
-
* Generic plumbing for pointing an internal model at ANY OpenAI-compatible HTTP endpoint —
|
|
5
|
-
* primarily Squid's own self-hosted models, but any OpenAI-compatible backend works. The
|
|
6
|
-
* non-secret part of a slot (base URL, optional headers/extra body) is hardcoded here on purpose
|
|
7
|
-
* (changing a backend is a reviewed code change); only the API key lives in Vault under
|
|
8
|
-
* `SystemSecrets['openai-compatible'][slotName].apiKey`.
|
|
9
|
-
*
|
|
10
|
-
* NOT the customer-facing `openai_compatible` Integration (per-app, console-configured). Models
|
|
11
|
-
* served through these slots are declared in `AI_CHAT_MODEL_REGISTRY` with
|
|
12
|
-
* `providerType: 'openai-compatible'` + `openAiCompatibleSlot`, and resolve only with
|
|
13
|
-
* `keyType: 'system'` (see `AiProviderFactory.getChatProviderForModel`) — never customer-reachable.
|
|
14
|
-
*
|
|
15
|
-
* No slots are defined yet (foundation only). To wire one up:
|
|
16
|
-
* 1. add a slot below, e.g. `'my-model': { baseUrl: 'https://llm.internal.squid/v1' }`;
|
|
17
|
-
* 2. seed its key in `SystemSecrets['openai-compatible']['my-model'].apiKey`;
|
|
18
|
-
* 3. add a model entry in ai-model.registry.ts pointing `openAiCompatibleSlot: 'my-model'`.
|
|
19
|
-
*/
|
|
20
|
-
/** Non-secret configuration of one system OpenAI-compatible backend. */
|
|
21
|
-
export interface SystemOpenAiCompatibleSlotConfig {
|
|
22
|
-
/** Base URL of the OpenAI-compatible API, e.g. a self-hosted 'https://llm.internal.squid/v1'. */
|
|
23
|
-
baseUrl: string;
|
|
24
|
-
/** Extra HTTP headers sent with every request. */
|
|
25
|
-
headers?: Record<string, string>;
|
|
26
|
-
/** Extra JSON body fields merged into every request — reserved wire fields are dropped by the provider. */
|
|
27
|
-
extraBody?: Record<string, unknown>;
|
|
28
|
-
}
|
|
29
|
-
/** Name of a system OpenAI-compatible slot (a key of `SYSTEM_OPENAI_COMPATIBLE_SLOTS`). */
|
|
30
|
-
export type SystemOpenAiCompatibleSlotName = string;
|
|
31
|
-
/**
|
|
32
|
-
* Registered system OpenAI-compatible slots, keyed by name. Empty by design — add a self-hosted
|
|
33
|
-
* (or any other) OpenAI-compatible backend here; see the module doc above.
|
|
34
|
-
*/
|
|
35
|
-
export declare const SYSTEM_OPENAI_COMPATIBLE_SLOTS: Record<SystemOpenAiCompatibleSlotName, SystemOpenAiCompatibleSlotConfig>;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Names of the Squid metrics.
|
|
3
|
-
*
|
|
4
|
-
* This list and its Kotlin counterpart (MetricName.kt) may diverge:
|
|
5
|
-
* each side declares only the metrics that its own backend emits.
|
|
6
|
-
* However, metrics emitted by both backends MUST use identical names on both sides —
|
|
7
|
-
* otherwise dashboards and metric queries that mix data from both sources will break.
|
|
8
|
-
*
|
|
9
|
-
* See MetricName.kt for documentation on each value.
|
|
10
|
-
*/
|
|
11
|
-
export declare const ALL_SQUID_METRIC_NAMES: readonly ["squid_functionExecution_count", "squid_functionExecution_time", "squid_aiChatbotContext_size", "squid_aiChatbotChatInputTokens_count", "squid_aiChatbotChatOutputTokens_count", "squid_aiChatbotChatReasoningTokens_count", "squid_aiChatbotChatCacheReadInputTokens_count", "squid_aiChatbotChatCacheWriteInputTokens_count", "squid_aiChatbotChatCostUsd_count", "squid_aiChatbotChatOutcome_count", "squid_aiImageGeneration_count", "squid_aiImageGeneration_time", "squid_aiRemoveBackground_count", "squid_aiRemoveBackground_time", "squid_aiAudioTranscribe_count", "squid_aiAudioTranscribe_time", "squid_aiAudioCreateSpeech_count", "squid_aiAudioCreateSpeech_time", "squid_aiIntegrationData_count", "squid_aiIntegrationData_time", "squid_aiIntegrationApi_count", "squid_aiIntegrationApi_time", "squid_apiControllerCall_count", "squid_apiControllerCall_time", "squid_aiContextUpsert_count", "squid_aiContextDelete_count", "squid_codeInitialization_count", "squid_codeInitialization_time", "squid_sourceCodeAnalysis_count", "squid_sourceCodeAnalysis_time", "squid_sourceCodeLeaseWait_time", "squid_sourceCodeWorkspaceBytes_value", "squid_sourceCodeInputTokens_count", "squid_sourceCodeOutputTokens_count", "squid_deleteApiKey_count", "squid_deleteApiKey_time", "squid_deleteSecret_count", "squid_deleteSecret_time", "squid_discoverGraphQLConnectionSchema_count", "squid_discoverGraphQLConnectionSchema_time", "squid_discoverOpenApiSchema_count", "squid_discoverOpenApiSchema_time", "squid_discoverOpenApiSchemaFromFile_count", "squid_discoverOpenApiSchemaFromFile_time", "squid_executeBackendFunction_count", "squid_executeBackendFunction_time", "squid_apiControllerCall_count", "squid_apiControllerCall_time", "squid_getAiChatbotProfiles_count", "squid_getAiChatbotProfiles_time", "squid_getAllApiKeys_count", "squid_getAllApiKeys_time", "squid_getAllSecrets_count", "squid_getAllSecrets_time", "squid_getAppApiKey_count", "squid_getAppApiKey_time", "squid_getSecret_count", "squid_getSecret_time", "squid_graphql_count", "squid_graphql_time", "squid_graphqlQuery_count", "squid_graphqlQuery_time", "squid_integrationCount_value", "squid_mutate_count", "squid_mutate_time", "squid_metricQuery_count", "squid_metricQuery_time", "squid_metricReport_count", "squid_metricReport_time", "squid_nativeQuery_count", "squid_nativeQuery_time", "squid_openapi_count", "squid_openapi_time", "squid_produceTopicMessage_count", "squid_produceTopicMessage_time", "squid_query_count", "squid_query_time", "squid_queueMessageHandler_count", "squid_queueMessageHandler_time", "squid_registerQuery_count", "squid_registerQuery_time", "squid_rerankChunks_count", "squid_rerankChunks_time", "squid_schedulerJob_count", "squid_schedulerJob_time", "squid_eventHandler_count", "squid_eventHandler_time", "squid_schema_size", "squid_secrets_entries", "squid_storageDeleteFiles_count", "squid_storageDeleteFiles_time", "squid_storageGetDownloadUrl_count", "squid_storageGetDownloadUrl_time", "squid_storageGetFileMetadata_count", "squid_storageGetFileMetadata_time", "squid_storageListDirectoryContents_count", "squid_storageListDirectoryContents_time", "squid_storageUploadFile_count", "squid_storageUploadFile_time", "squid_subscribeToTopic_count", "squid_subscribeToTopic_time", "squid_testGraphQLConnection_count", "squid_testGraphQLConnection_time", "squid_testAgentProtocolConnection_count", "squid_testAgentProtocolConnection_time", "squid_trigger_count", "squid_trigger_time", "squid_upsertApiKey_count", "squid_upsertApiKey_time", "squid_upsertSecret_count", "squid_upsertSecret_time", "squid_vectorChunks_count", "squid_vectorChunks_time", "squid_webhook_count", "squid_webhook_time", "squid_acquireLock_count", "squid_acquireLock_time", "squid_releaseLock_count", "squid_releaseLock_time"];
|
|
12
|
-
export type MetricName = (typeof ALL_SQUID_METRIC_NAMES)[number];
|
|
13
|
-
/** Common prefix for all Squid metrics. */
|
|
14
|
-
export declare const SQUID_METRIC_NAME_PREFIX = "squid_";
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { ApiOptions } from '../public-types/api-client.public-types';
|
|
2
|
-
import { ApiEndpointId, HttpMethod } from '../public-types/api.public-types';
|
|
3
|
-
import { IntegrationId } from '../public-types/communication.public-types';
|
|
4
|
-
/** The headers of an API call. */
|
|
5
|
-
export type ApiHeaders = Record<string, string | number | boolean>;
|
|
6
|
-
/** The context of an API call. */
|
|
7
|
-
export declare class ApiCallContext {
|
|
8
|
-
readonly integrationId: IntegrationId;
|
|
9
|
-
readonly endpointId: ApiEndpointId;
|
|
10
|
-
readonly url: string;
|
|
11
|
-
readonly method: HttpMethod;
|
|
12
|
-
readonly body: unknown;
|
|
13
|
-
readonly options: ApiOptions;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Represents a request to call an API through a specified integration and endpoint.
|
|
17
|
-
* Includes optional method override and additional request options.
|
|
18
|
-
*/
|
|
19
|
-
export interface CallApiRequest<BodyType = any> {
|
|
20
|
-
/** The identifier of the integration through which the API is called. */
|
|
21
|
-
integrationId: IntegrationId;
|
|
22
|
-
/** Target API endpoint to invoke. */
|
|
23
|
-
endpointId: ApiEndpointId;
|
|
24
|
-
/** Optional request payload. */
|
|
25
|
-
body?: BodyType;
|
|
26
|
-
/** Optional HTTP method override. Default is POST. */
|
|
27
|
-
overrideMethod?: HttpMethod;
|
|
28
|
-
/** Additional request options. */
|
|
29
|
-
options: ApiOptions;
|
|
30
|
-
}
|