@squidcloud/client 1.0.488 → 1.0.489

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 (49) 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-integrations.public-types.d.ts +8 -0
  4. package/dist/internal-common/src/public-types/ai-agent.public-types.d.ts +71 -1
  5. package/dist/internal-common/src/public-types/ai-common.public-types.d.ts +17 -5
  6. package/dist/internal-common/src/public-types/ai-knowledge-base.public-types.d.ts +14 -2
  7. package/dist/internal-common/src/public-types/extraction.public-types.d.ts +13 -0
  8. package/dist/internal-common/src/public-types/web.public-types.d.ts +18 -1
  9. package/dist/typescript-client/src/version.d.ts +1 -1
  10. package/dist/typescript-client/src/web-client.d.ts +4 -2
  11. package/package.json +1 -1
  12. package/dist/internal-common/src/ai/system-openai-compatible.d.ts +0 -35
  13. package/dist/internal-common/src/metric-name.d.ts +0 -14
  14. package/dist/internal-common/src/public-types-backend/api-call.public-context.d.ts +0 -30
  15. package/dist/internal-common/src/public-types-backend/mutation.public-context.d.ts +0 -161
  16. package/dist/internal-common/src/public-types-backend/native-query.public-context.d.ts +0 -75
  17. package/dist/internal-common/src/public-types-backend/query.public-context.d.ts +0 -193
  18. package/dist/internal-common/src/types/ai-agent.types.d.ts +0 -302
  19. package/dist/internal-common/src/types/ai-knowledge-base.types.d.ts +0 -306
  20. package/dist/internal-common/src/types/ai-matchmaking.types.d.ts +0 -19
  21. package/dist/internal-common/src/types/backend-function.types.d.ts +0 -1
  22. package/dist/internal-common/src/types/communication.types.d.ts +0 -1
  23. package/dist/internal-common/src/types/document.types.d.ts +0 -1
  24. package/dist/internal-common/src/types/file.types.d.ts +0 -6
  25. package/dist/internal-common/src/types/headers.types.d.ts +0 -41
  26. package/dist/internal-common/src/types/management-api-key.types.d.ts +0 -92
  27. package/dist/internal-common/src/types/mutation.types.d.ts +0 -1
  28. package/dist/internal-common/src/types/notification.types.d.ts +0 -19
  29. package/dist/internal-common/src/types/observability.types.d.ts +0 -168
  30. package/dist/internal-common/src/types/query.types.d.ts +0 -15
  31. package/dist/internal-common/src/types/secret.types.d.ts +0 -7
  32. package/dist/internal-common/src/types/socket.types.d.ts +0 -1
  33. package/dist/internal-common/src/types/stage.d.ts +0 -9
  34. package/dist/internal-common/src/types/time-units.d.ts +0 -1
  35. package/dist/internal-common/src/types/url-shortener.types.d.ts +0 -45
  36. package/dist/internal-common/src/utils/array.d.ts +0 -7
  37. package/dist/internal-common/src/utils/e2e-test-utils.d.ts +0 -2
  38. package/dist/internal-common/src/utils/file-utils.d.ts +0 -2
  39. package/dist/internal-common/src/utils/global.utils.d.ts +0 -1
  40. package/dist/internal-common/src/utils/http.d.ts +0 -10
  41. package/dist/internal-common/src/utils/lock.manager.d.ts +0 -14
  42. package/dist/internal-common/src/utils/metric-utils.d.ts +0 -4
  43. package/dist/internal-common/src/utils/metrics.types.d.ts +0 -7
  44. package/dist/internal-common/src/utils/object.d.ts +0 -86
  45. package/dist/internal-common/src/utils/serialization.d.ts +0 -24
  46. package/dist/internal-common/src/utils/squid.constants.d.ts +0 -6
  47. package/dist/internal-common/src/utils/trace-id-generator.d.ts +0 -1
  48. package/dist/internal-common/src/utils/validation.d.ts +0 -19
  49. package/dist/internal-common/src/websocket.impl.d.ts +0 -26
@@ -48,6 +48,14 @@ export interface AiApiOptions {
48
48
  * Defaults to no memory.
49
49
  */
50
50
  memoryOptions?: AiAgentMemoryOptions;
51
+ /**
52
+ * How long, in milliseconds, a single AI call of the loop may wait for the provider — endpoint
53
+ * selection, request-body creation and response analysis each get this budget on their own, so
54
+ * the whole call may run for a multiple of it. Values below the chat minimum of 20 000 ms are
55
+ * raised to it. Defaults to the standard chat timeout, or to the timeout of the chat this call
56
+ * runs inside when the caller is a nested one.
57
+ */
58
+ stageTimeoutMs?: number;
51
59
  }
52
60
  /**
53
61
  * Configuration options for AI agent MCP integration.
@@ -420,6 +420,26 @@ export interface IntegrationModelSpec {
420
420
  * @category AI
421
421
  */
422
422
  export type AiChatModelSelection = AiChatModelName | IntegrationModelSpec;
423
+ /**
424
+ * A backup model together with the sampling settings to run it with. Use this form instead of a
425
+ * bare {@link AiChatModelSelection} when the backup needs settings of its own; anything left unset
426
+ * takes the backup model's own default rather than the primary model's value.
427
+ * @category AI
428
+ */
429
+ export interface BackupModelOptions {
430
+ /** The model to fall back to. */
431
+ model: AiChatModelSelection;
432
+ /** The temperature to use when sampling from the backup model. */
433
+ temperature?: number;
434
+ /** The level of reasoning effort to apply; effective only for models with reasoning. */
435
+ reasoningEffort?: AiReasoningEffort;
436
+ /** The maximum number of input tokens Squid may send to the backup model. */
437
+ maxTokens?: number;
438
+ /** The maximum number of tokens the backup model should output. */
439
+ maxOutputTokens?: number;
440
+ /** Response length and detail level; supported by OpenAI models only. */
441
+ verbosity?: AiVerbosityLevel;
442
+ }
423
443
  /**
424
444
  * The base AI agent chat options, should not be used directly.
425
445
  * @category AI
@@ -512,6 +532,52 @@ export interface BaseAiChatOptions {
512
532
  pii?: AiPiiOptions;
513
533
  /** The LLM model to use. Can be a vendor model name (string) or an integration-based model (object). */
514
534
  model?: AiChatModelSelection;
535
+ /**
536
+ * The model to use when `model` cannot serve the conversation's very first request because its
537
+ * provider is unavailable — a rate limit, a capacity outage, or any other failure on the
538
+ * provider's side. A request that fails for its own reasons (an invalid prompt, a rejected
539
+ * schema, an exhausted Squid quota) is never retried on the backup, nor is any request after the
540
+ * first one, nor one that already produced output or ran a tool.
541
+ *
542
+ * A conversation that fell back then STAYS on that backup for the rest of its life, so an outage
543
+ * costs the primary's retry budget once rather than once per turn, and the model does not change
544
+ * mid-dialogue. The pin outlives the option that created it: changing or removing `backupModel`,
545
+ * changing the agent's own `model`, and the primary recovering all leave a pinned conversation
546
+ * where it is, and a pinned model that no longer resolves fails the request rather than moving the
547
+ * conversation. This is deliberate — a conversation accumulates provider-native file ids and a
548
+ * transcript in that provider's dialect, none of which survive a move. Pinning needs Squid-managed
549
+ * memory to have somewhere to record it; without memory every request is a first request anyway.
550
+ *
551
+ * A request carrying `fileIds` follows from the same reasoning, and the two cases differ. A first
552
+ * request does not fall back where that would cost it the attachments — to a model that cannot read
553
+ * ids the primary could, or that reads them without owning them — since answering from a model that
554
+ * never saw them is worse than reporting the outage. Where neither model reads file ids they are
555
+ * inert either way and the fallback proceeds. A
556
+ * conversation already pinned is held to less: it keeps running on its model, and if that model
557
+ * reads no file ids the ids are ignored there as they are anywhere else, because the alternative is
558
+ * a conversation that can never run again.
559
+ *
560
+ * Pass a model name for the model's own defaults, or a {@link BackupModelOptions} object to give
561
+ * the backup its own sampling settings. Everything else — instructions, functions, knowledge
562
+ * bases, connected agents, response format, memory — always comes from the primary configuration.
563
+ *
564
+ * On a turn the backup serves, the sampling settings are ITS settings alone: `temperature`,
565
+ * `reasoningEffort`, `maxTokens`, `maxOutputTokens` and `verbosity` are read from `backupModel`
566
+ * and nowhere else, so a value left unset there takes the backup model's own default even when
567
+ * the agent's profile or the request itself carries one. This holds for every turn of a pinned
568
+ * conversation, not only the one that fell back — tuning meant for one model is not evidence of
569
+ * what another should use.
570
+ *
571
+ * Applies to models served through Squid's own provider SDKs — the vendor models and
572
+ * `openai_compatible`, Bedrock and Vertex integrations. A model you serve yourself from backend
573
+ * code reports its failures as plain errors that carry no provider status, so a turn on one is
574
+ * never diagnosed as a provider outage and never falls back.
575
+ *
576
+ * The backup resolves its API key exactly as it would as the primary model, and is skipped
577
+ * silently when it cannot be resolved, when it reaches the same model as the primary, or when
578
+ * either model is a CLI-backed agent. Leave unset to keep a provider outage surfacing as an error.
579
+ */
580
+ backupModel?: AiChatModelSelection | BackupModelOptions;
515
581
  /** Which provider's reranker to use for reranking the context. Defaults to 'cohere'. */
516
582
  rerankProvider?: AiRerankProvider;
517
583
  /**
@@ -937,9 +1003,13 @@ export interface UpsertContextStatusSuccess extends BaseUpsertContextStatus {
937
1003
  *
938
1004
  * `DUPLICATE_CONTENT` means the request omitted a contextId and its content is
939
1005
  * byte-identical to an existing context in the same knowledge base.
1006
+ *
1007
+ * `EMBEDDING_FAILED` means extraction succeeded but embedding the context's chunks did not; the
1008
+ * content was not written (an overwrite target keeps its previous content) and the request can be
1009
+ * safely retried as-is.
940
1010
  * @category AI
941
1011
  */
942
- export type UpsertContextErrorCode = 'DUPLICATE_CONTENT';
1012
+ export type UpsertContextErrorCode = 'DUPLICATE_CONTENT' | 'EMBEDDING_FAILED';
943
1013
  /**
944
1014
  * The existing context a `DUPLICATE_CONTENT` rejection points at — where the byte-identical original
945
1015
  * already lives.
@@ -20,26 +20,38 @@ export type AiProviderType = (typeof AI_PROVIDER_TYPES)[number];
20
20
  * @category AI
21
21
  */
22
22
  export type CanonicalReasoningEffort = 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'max' | 'ultra';
23
+ /**
24
+ * The AI providers that support file upload operations, and so are the only ones that resolve a
25
+ * pre-uploaded file id. Declared as the list, with the type derived from it, so the two cannot drift:
26
+ * a provider added to one is added to both.
27
+ */
28
+ export declare const AI_FILE_PROVIDER_TYPES: readonly ["openai", "gemini", "anthropic", "grok"];
23
29
  /**
24
30
  * Type of AI provider that supports file upload operations.
25
31
  * Only a subset of AI providers support file management features.
26
32
  */
27
- export type AiFileProviderType = Extract<AiProviderType, 'openai' | 'gemini' | 'anthropic' | 'grok'>;
33
+ export type AiFileProviderType = (typeof AI_FILE_PROVIDER_TYPES)[number];
34
+ /**
35
+ * True when the provider resolves pre-uploaded file ids. Every other provider — the integration-backed
36
+ * and user-defined ones, which report no vendor identity of their own — ignores `fileIds` outright, so
37
+ * for them the ids are inert rather than wrong.
38
+ */
39
+ export declare function isFileCapableProviderType(type: AiProviderType): type is AiFileProviderType;
28
40
  /**
29
41
  * Public OpenAI chat model names (active models only).
30
42
  * @category AI
31
43
  */
32
- export declare const OPENAI_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"];
44
+ export declare const OPENAI_CHAT_MODEL_NAMES: readonly ["gpt-5.5-pro", "gpt-5.6-sol", "gpt-5.6-terra", "gpt-5.6-luna"];
33
45
  /**
34
46
  * Public Gemini chat model names (active models only).
35
47
  * @category AI
36
48
  */
37
- export declare const GEMINI_CHAT_MODEL_NAMES: readonly ["gemini-3.1-pro", "gemini-3.6-flash", "gemini-3.5-flash-lite"];
49
+ export declare const GEMINI_CHAT_MODEL_NAMES: readonly ["gemini-3.1-pro", "gemini-3.7-flash", "gemini-3.5-flash-lite"];
38
50
  /**
39
51
  * Public Grok chat model names (active models only).
40
52
  * @category AI
41
53
  */
42
- export declare const GROK_CHAT_MODEL_NAMES: readonly ["grok-4.5", "grok-4-1-fast-reasoning", "grok-4-1-fast-non-reasoning"];
54
+ export declare const GROK_CHAT_MODEL_NAMES: readonly ["grok-4.6", "grok-4-1-fast-reasoning", "grok-4-1-fast-non-reasoning"];
43
55
  /**
44
56
  * Public Anthropic chat model names (active models only).
45
57
  * @category AI
@@ -49,7 +61,7 @@ export declare const ANTHROPIC_CHAT_MODEL_NAMES: readonly ["claude-fable-5", "cl
49
61
  * The supported AI model names.
50
62
  * @category AI
51
63
  */
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"];
64
+ export declare const VENDOR_AI_CHAT_MODEL_NAMES: readonly ["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.7-flash", "gemini-3.5-flash-lite", "grok-4.6", "grok-4-1-fast-reasoning", "grok-4-1-fast-non-reasoning"];
53
65
  /** Checks if the given model name is a global AI chat model name. */
54
66
  export declare function isVendorAiChatModelName(modelName: unknown): modelName is VendorAiChatModelName;
55
67
  /**
@@ -1516,12 +1516,17 @@ export interface BulkIngestionUpsertContextsResponse {
1516
1516
  */
1517
1517
  contextIds: Array<string>;
1518
1518
  /**
1519
- * Contexts rejected because the knowledge base already holds identical content — either stored under an
1520
- * existing context or accepted earlier in this same call. Absent when nothing was rejected.
1519
+ * Contexts rejected because the knowledge base already holds identical content — either stored under
1520
+ * an existing context or accepted earlier in this same call. Absent when nothing was rejected.
1521
1521
  *
1522
1522
  * Same shape and `errorCode: 'DUPLICATE_CONTENT'` the synchronous `upsertContexts` returns, so a caller
1523
1523
  * handles a duplicate identically on both lanes. These contexts are NOT part of the job: they are not
1524
1524
  * extracted, not staged, and never appear in its per-file statuses.
1525
+ *
1526
+ * Covers TEXT contexts and MULTIPART file contexts (their bytes are in hand at staging). A file staged
1527
+ * by `stagedObjectKey` is the one exception: its bytes are first read by the deferred extraction pass,
1528
+ * so its duplicate surfaces asynchronously as a failed file with `errorCode: 'DUPLICATE_CONTENT'` in
1529
+ * the job's per-file statuses instead.
1525
1530
  */
1526
1531
  duplicates?: Array<UpsertContextStatusError>;
1527
1532
  }
@@ -1563,6 +1568,13 @@ export interface BulkIngestionFileStatus {
1563
1568
  status: 'processing' | 'completed' | 'failed';
1564
1569
  /** Present only when status is 'failed': the terminal failure reason. */
1565
1570
  errorMessage?: string;
1571
+ /**
1572
+ * Machine-readable class of a failed file, for outcomes to treat differently from real failures.
1573
+ * `'DUPLICATE_CONTENT'` marks a duplicate found by the deferred extraction pass (a presigned
1574
+ * object's bytes are first read there) — a skip, not a failure: the KB already holds this content.
1575
+ * Additive; absent for ordinary failures.
1576
+ */
1577
+ errorCode?: 'DUPLICATE_CONTENT';
1566
1578
  }
1567
1579
  /**
1568
1580
  * Response describing a bulk-ingestion job's current state and progress counts.
@@ -51,6 +51,14 @@ export interface ExtractDataFromDocumentOptions {
51
51
  * URL-based extraction ignores it and never returns `documentMetadata`.
52
52
  */
53
53
  collectDocumentMetadata?: boolean;
54
+ /**
55
+ * Safety-net storage expiration (seconds) registered WITH the long-term upload of the original file,
56
+ * before its bytes land — so a process crash at any later point (mid-OCR, before the caller ever
57
+ * learns the path) leaves a self-collecting object instead of a permanent orphan. The caller that
58
+ * sets this owns clearing the expiration once it durably references the path; leaving it unset keeps
59
+ * the original permanent from the moment it uploads.
60
+ */
61
+ originalFileExpirationSeconds?: number;
54
62
  }
55
63
  /**
56
64
  * Request payload for extracting data from a document via URL.
@@ -262,6 +270,11 @@ export interface ExtractDataFromDocumentResponse {
262
270
  * Array of pages containing extracted data.
263
271
  */
264
272
  pages: Array<ExtractDataFromDocumentPage>;
273
+ /**
274
+ * Pages the OCR provider reported as processed (billed), when it reports one. Can exceed
275
+ * `pages.length` — a blank page is billed but returns no content.
276
+ */
277
+ ocrPagesProcessed?: number;
265
278
  /**
266
279
  * Path to the original file in cloud storage, if applicable.
267
280
  */
@@ -6,7 +6,9 @@ export interface WebAiSearchRequest {
6
6
  query: string;
7
7
  /**
8
8
  * When provided, restricts the web search to these domains (subdomains are included).
9
- * Cited URLs in the response are guaranteed to belong to one of the listed domains.
9
+ * Cited URLs in the response are guaranteed to belong to one of the listed domains, as are the
10
+ * consulted ones — see {@link WebAiSearchResponse.consultedUrls} for which of the two Squid
11
+ * enforces itself.
10
12
  */
11
13
  allowedDomains?: Array<string>;
12
14
  }
@@ -27,6 +29,21 @@ export interface WebAiSearchResponse {
27
29
  markdownText: string;
28
30
  /** A list of cited URLs included in the search response. */
29
31
  citedUrls: Array<WebAiSearchCitedUrl>;
32
+ /**
33
+ * Pages the search opened while answering, whether or not the answer cites them. Empty when the
34
+ * search reached nothing.
35
+ *
36
+ * This is what the search did, where {@link citedUrls} is what the answer leans on: a model may
37
+ * open ten pages and find the fact on one, and it may answer so tersely ("2026-08-16") that it
38
+ * cites nothing at all. Read this to show where the answer was looked for, or to establish that a
39
+ * search happened; read {@link citedUrls} to attribute a claim.
40
+ *
41
+ * A {@link WebAiSearchRequest.allowedDomains} restriction is applied to this list by Squid rather
42
+ * than relied upon from the provider, since these pages are reported through a channel the
43
+ * provider does not document as filtered. Citations arrive already filtered, being drawn from a
44
+ * restricted answer.
45
+ */
46
+ consultedUrls: Array<string>;
30
47
  }
31
48
  /**
32
49
  * Request to fetch content from a URL.
@@ -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.488";
5
+ export declare const SQUIDCLOUD_CLIENT_PACKAGE_VERSION = "1.0.489";
@@ -12,13 +12,15 @@ export declare class WebClient {
12
12
  /** Headers for short URL API requests. Only use after asserting apiKey is defined. */
13
13
  private get shortUrlHeaders();
14
14
  /**
15
- * Search the web using AI. Returns a response containing Markdown text and cited URLs.
15
+ * Search the web using AI. Returns a response containing Markdown text, the URLs the answer cites, and
16
+ * the pages the search consulted.
16
17
  * @param query The keywords or query string to search for.
17
18
  * @param abortSignal Optional signal used to abort the underlying request. When the signal aborts, the in-flight
18
19
  * HTTP request is cancelled and its promise rejects, allowing callers to bound a single call
19
20
  * without leaking the request.
20
21
  * @param allowedDomains Optional list of domains the search is restricted to (subdomains included). When provided,
21
- * every cited URL in the response belongs to one of the listed domains.
22
+ * every URL in the response — cited or consulted — belongs to one of the listed domains.
23
+ * Squid enforces this over the consulted pages; citations arrive already restricted.
22
24
  */
23
25
  aiSearch(query: string, abortSignal?: AbortSignal, allowedDomains?: Array<string>): Promise<WebAiSearchResponse>;
24
26
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squidcloud/client",
3
- "version": "1.0.488",
3
+ "version": "1.0.489",
4
4
  "description": "A typescript implementation of the Squid client",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -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_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
- }
@@ -1,161 +0,0 @@
1
- import { SquidDocIdObj, SquidDocument } from '../public-types/document.public-types';
2
- import { Paths } from '../public-types/typescript.public-types';
3
- /**
4
- * The mutation type.
5
- * @category Database
6
- */
7
- export declare const MUTATION_TYPES: readonly ["insert", "update", "delete"];
8
- /**
9
- * @category Database
10
- */
11
- export type MutationType = (typeof MUTATION_TYPES)[number];
12
- /**
13
- * Base fields shared by all document mutations.
14
- * @category Database
15
- */
16
- export interface BaseMutation {
17
- /** The type of the mutation. */
18
- type: MutationType;
19
- /** The identity of the mutated document. */
20
- squidDocIdObj: SquidDocIdObj;
21
- }
22
- /**
23
- * A mutation on a document.
24
- * @category Database
25
- */
26
- export type Mutation<T = any> = UpdateMutation<T> | InsertMutation<T> | DeleteMutation;
27
- /**
28
- * Represents a delete mutation on a document.
29
- * @category Database
30
- */
31
- export interface DeleteMutation extends BaseMutation {
32
- /** Specifies that the mutation is a deletion. */
33
- type: 'delete';
34
- }
35
- /**
36
- * Represents an update mutation on a document.
37
- * @category Database
38
- */
39
- export interface UpdateMutation<T = any> extends BaseMutation {
40
- /** Specifies that the mutation is an update. */
41
- type: 'update';
42
- /** The updated properties */
43
- properties: {
44
- [key in keyof T & string]?: Array<PropertyMutation<T[key]>>;
45
- };
46
- }
47
- /**
48
- * Represents an insert mutation on a document.
49
- * @category Database
50
- */
51
- export interface InsertMutation<T = any> extends BaseMutation {
52
- /** Specifies that the mutation is an insertion. */
53
- type: 'insert';
54
- /** The inserted document */
55
- properties: T;
56
- }
57
- /**
58
- * A representation of a single property update.
59
- * @category Database
60
- */
61
- export type PropertyMutation<Value = any> = ApplyNumericFnPropertyMutation | ApplyStringFnPropertyMutation | ValueUpdatePropertyMutation<Value> | RemovePropertyMutation;
62
- /**
63
- * A value update property mutation.
64
- * @category Database
65
- */
66
- export interface ValueUpdatePropertyMutation<Value = any> {
67
- /** Specifies that the mutation updates a value. */
68
- type: 'update';
69
- /** New value to be set. */
70
- value: Value;
71
- }
72
- /**
73
- * Applying a numeric function to a property.
74
- * @category Database
75
- */
76
- export interface ApplyNumericFnPropertyMutation {
77
- /** Specifies that the mutation applies a numeric function. */
78
- type: 'applyNumericFn';
79
- /** Numeric function to apply. */
80
- fn: 'increment';
81
- /** Value to use in the numeric function. */
82
- value: number;
83
- }
84
- /**
85
- * A property update that removes a property from a document.
86
- * @category Database
87
- */
88
- export interface RemovePropertyMutation {
89
- /** Specifies that the mutation removes a property. */
90
- type: 'removeProperty';
91
- }
92
- /**
93
- * A property mutation that appends a value to the existing string.
94
- * @category Database
95
- */
96
- export interface ApplyExtendString {
97
- /** Specifies that the mutation applies a string function. */
98
- type: 'applyStringFn';
99
- /** String function to extend the existing string. */
100
- fn: 'extendString';
101
- /** String value to append. */
102
- value: string;
103
- }
104
- /**
105
- * A property mutation that trims the existing string.
106
- * @category Database
107
- */
108
- export interface ApplyTrimString {
109
- /** Specifies that the mutation applies a string function. */
110
- type: 'applyStringFn';
111
- /** String function to trim the existing string. */
112
- fn: 'trim';
113
- }
114
- /**
115
- * A property mutation that modifies a string.
116
- * @category Database
117
- */
118
- export type ApplyStringFnPropertyMutation = ApplyExtendString | ApplyTrimString;
119
- /**
120
- * The before and after documents of a document change.
121
- * @category Database
122
- */
123
- export interface BeforeAndAfterDocs<T = SquidDocument> {
124
- /** Document state before the mutation. */
125
- before: T | undefined;
126
- /** Document state after the mutation. */
127
- after: T | undefined;
128
- }
129
- /**
130
- * The mutation context that will be provided to the security function.
131
- * @category Database
132
- */
133
- export declare class MutationContext<T = any> {
134
- readonly mutation: Mutation<T>;
135
- readonly beforeAndAfterDocs: BeforeAndAfterDocs<T>;
136
- readonly serverTimeStamp: Date;
137
- /**
138
- * Returns the state of the document before the mutation was applied.
139
- */
140
- get before(): T | undefined;
141
- /**
142
- * Returns the state of the document after the mutation was applied.
143
- */
144
- get after(): T | undefined;
145
- /**
146
- * Returns the type of the mutation (insert, update, or delete).
147
- */
148
- getMutationType(): MutationType;
149
- /** Returns true if the mutation affects the provided path. */
150
- affectsPath(path: Paths<T>): boolean;
151
- /**
152
- * Find all affected paths starting from a root path.
153
- *
154
- * @example
155
- * doc before - { a: { b: 1, c: 2 }, d: 3 }
156
- * doc after - { a: { b: 1, c: 3 }, d: 4 }
157
- * doc.affectedPaths('a') // ['a.c']
158
- */
159
- affectedPaths(startingRoot?: Paths<T> | string): Array<Paths<T>>;
160
- private checkPath;
161
- }
@@ -1,75 +0,0 @@
1
- import { IntegrationId } from '../public-types/communication.public-types';
2
- /**
3
- * Represents the type of native query request, either relational, elastic or MongoDB.
4
- * @category Database
5
- */
6
- export type NativeQueryRequestType = 'relational' | 'mongo' | 'elasticsearch' | 'pure';
7
- /**
8
- * Base fields shared by all native query contexts.
9
- * @category Database
10
- */
11
- export interface BaseNativeQueryContext {
12
- /** Type of the native query request. */
13
- type: NativeQueryRequestType;
14
- /** Identifier for the integration. */
15
- integrationId: IntegrationId;
16
- }
17
- /**
18
- * Context for executing a relational database query.
19
- * @category Database
20
- */
21
- export interface RelationalNativeQueryContext extends BaseNativeQueryContext {
22
- /** Specifies that the query is for a relational database. */
23
- type: 'relational';
24
- /** SQL query string to be executed. */
25
- query: string;
26
- /** Parameters to be used in the query. */
27
- params: Record<string, any>;
28
- }
29
- /**
30
- * Context for executing a MongoDB query.
31
- * @category Database
32
- */
33
- export interface MongoNativeQueryContext extends BaseNativeQueryContext {
34
- /** Specifies that the query is for a Mongo database. */
35
- type: 'mongo';
36
- /** Name of the MongoDB collection to query. */
37
- collectionName: string;
38
- /** Array of aggregation pipeline stages. */
39
- aggregationPipeline: Array<any | undefined>;
40
- }
41
- /**
42
- * Context for executing an Elasticsearch query.
43
- * @category Database
44
- */
45
- export interface ElasticsearchNativeQueryContext {
46
- /** Specifies that the query is for an Elasticsearch database. */
47
- type: 'elasticsearch';
48
- /** Elasticsearch index to query. */
49
- index: string;
50
- /** Elasticsearch query string. */
51
- endpoint?: string;
52
- /** HTTP method to use for the request. */
53
- method?: 'GET' | 'POST';
54
- /** Body of the request. */
55
- body: Record<string, any>;
56
- /** Headers to include in the request. */
57
- integrationId: IntegrationId;
58
- }
59
- /**
60
- * Context for executing a pure database query.
61
- * @category Database
62
- */
63
- export interface PureNativeQueryContext extends BaseNativeQueryContext {
64
- /** Specifies that the query is for a relational database. */
65
- type: 'pure';
66
- /** SQL query string to be executed. */
67
- query: string;
68
- /** Parameters to be used in the query. */
69
- params: Record<string, any>;
70
- }
71
- /**
72
- * Union type representing either a relational or MongoDB native query context.
73
- * @category Database
74
- */
75
- export type NativeQueryContext = RelationalNativeQueryContext | MongoNativeQueryContext | ElasticsearchNativeQueryContext | PureNativeQueryContext;