@squidcloud/client 1.0.488 → 1.0.490

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 (55) 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 +128 -4
  5. package/dist/internal-common/src/public-types/ai-common.public-types.d.ts +21 -9
  6. package/dist/internal-common/src/public-types/ai-knowledge-base.public-types.d.ts +262 -6
  7. package/dist/internal-common/src/public-types/connector.public-types.d.ts +1 -1
  8. package/dist/internal-common/src/public-types/extraction.public-types.d.ts +28 -1
  9. package/dist/internal-common/src/public-types/integration.public-types.d.ts +10 -2
  10. package/dist/internal-common/src/public-types/source-code.public-types.d.ts +12 -0
  11. package/dist/internal-common/src/public-types/web.public-types.d.ts +18 -1
  12. package/dist/typescript-client/src/ai-knowledge-base/ai-knowledge-base-client-reference.d.ts +31 -3
  13. package/dist/typescript-client/src/integration-client.d.ts +30 -3
  14. package/dist/typescript-client/src/query-utils.d.ts +14 -2
  15. package/dist/typescript-client/src/version.d.ts +1 -1
  16. package/dist/typescript-client/src/web-client.d.ts +4 -2
  17. package/package.json +1 -1
  18. package/dist/internal-common/src/ai/system-openai-compatible.d.ts +0 -35
  19. package/dist/internal-common/src/metric-name.d.ts +0 -14
  20. package/dist/internal-common/src/public-types-backend/api-call.public-context.d.ts +0 -30
  21. package/dist/internal-common/src/public-types-backend/mutation.public-context.d.ts +0 -161
  22. package/dist/internal-common/src/public-types-backend/native-query.public-context.d.ts +0 -75
  23. package/dist/internal-common/src/public-types-backend/query.public-context.d.ts +0 -193
  24. package/dist/internal-common/src/types/ai-agent.types.d.ts +0 -302
  25. package/dist/internal-common/src/types/ai-knowledge-base.types.d.ts +0 -306
  26. package/dist/internal-common/src/types/ai-matchmaking.types.d.ts +0 -19
  27. package/dist/internal-common/src/types/backend-function.types.d.ts +0 -1
  28. package/dist/internal-common/src/types/communication.types.d.ts +0 -1
  29. package/dist/internal-common/src/types/document.types.d.ts +0 -1
  30. package/dist/internal-common/src/types/file.types.d.ts +0 -6
  31. package/dist/internal-common/src/types/headers.types.d.ts +0 -41
  32. package/dist/internal-common/src/types/management-api-key.types.d.ts +0 -92
  33. package/dist/internal-common/src/types/mutation.types.d.ts +0 -1
  34. package/dist/internal-common/src/types/notification.types.d.ts +0 -19
  35. package/dist/internal-common/src/types/observability.types.d.ts +0 -168
  36. package/dist/internal-common/src/types/query.types.d.ts +0 -15
  37. package/dist/internal-common/src/types/secret.types.d.ts +0 -7
  38. package/dist/internal-common/src/types/socket.types.d.ts +0 -1
  39. package/dist/internal-common/src/types/stage.d.ts +0 -9
  40. package/dist/internal-common/src/types/time-units.d.ts +0 -1
  41. package/dist/internal-common/src/types/url-shortener.types.d.ts +0 -45
  42. package/dist/internal-common/src/utils/array.d.ts +0 -7
  43. package/dist/internal-common/src/utils/e2e-test-utils.d.ts +0 -2
  44. package/dist/internal-common/src/utils/file-utils.d.ts +0 -2
  45. package/dist/internal-common/src/utils/global.utils.d.ts +0 -1
  46. package/dist/internal-common/src/utils/http.d.ts +0 -10
  47. package/dist/internal-common/src/utils/lock.manager.d.ts +0 -14
  48. package/dist/internal-common/src/utils/metric-utils.d.ts +0 -4
  49. package/dist/internal-common/src/utils/metrics.types.d.ts +0 -7
  50. package/dist/internal-common/src/utils/object.d.ts +0 -86
  51. package/dist/internal-common/src/utils/serialization.d.ts +0 -24
  52. package/dist/internal-common/src/utils/squid.constants.d.ts +0 -6
  53. package/dist/internal-common/src/utils/trace-id-generator.d.ts +0 -1
  54. package/dist/internal-common/src/utils/validation.d.ts +0 -19
  55. package/dist/internal-common/src/websocket.impl.d.ts +0 -26
@@ -1,4 +1,4 @@
1
- import { AgentContextRequest, AiChatModelSelection, UpsertContextStatusError } from './ai-agent.public-types';
1
+ import { AgentContextRequest, AiChatModelSelection, AiReasoningEffort, ContextImageFailure, UpsertContextStatusError } from './ai-agent.public-types';
2
2
  import { AiEmbeddingsModelSelection, AiRerankProvider } from './ai-common.public-types';
3
3
  import { AiContextId, AiKnowledgeBaseId, AppId } from './communication.public-types';
4
4
  import { DocumentExtractionMethod } from './extraction.public-types';
@@ -44,8 +44,8 @@ export interface AiKnowledgeBase {
44
44
  graphRag?: AiKnowledgeBaseGraphConfig;
45
45
  /**
46
46
  * Default RAG strategy for newly ingested contexts; a per-request `options.ragType` overrides it.
47
- * Omitted ⇒ the server default (`'basic'`). Changing it affects future ingests only — existing chunks
48
- * are not re-processed.
47
+ * Omitted ⇒ the server default (`'contextual'`). Changing it affects future ingests only — existing
48
+ * chunks are not re-processed.
49
49
  */
50
50
  ragType?: AiRagType;
51
51
  /**
@@ -54,9 +54,56 @@ export interface AiKnowledgeBase {
54
54
  * store. Under the combined-ingest strategy this stays ≈0 — growth is a visible fallback-rate signal.
55
55
  */
56
56
  contextualIngestUsage?: KnowledgeBaseGraphUsage;
57
+ /**
58
+ * Per-caller access control over retrieval. Omitted ⇒ `'none'`: stored scopes are ignored and every
59
+ * caller sees every chunk.
60
+ */
61
+ accessControl?: AiKnowledgeBaseAccessControl;
57
62
  /** The timestamp the knowledge base was last updated */
58
63
  updatedAt: Date;
59
64
  }
65
+ /**
66
+ * The access-control modes a knowledge base can be in. See {@link AiKnowledgeBaseAccessControl}.
67
+ * @category AI
68
+ */
69
+ export declare const AI_KB_ACCESS_CONTROL_MODES: readonly ["none", "enforced"];
70
+ /**
71
+ * A knowledge base access-control mode. See {@link AI_KB_ACCESS_CONTROL_MODES}.
72
+ * @category AI
73
+ */
74
+ export type AiKnowledgeBaseAccessControlMode = (typeof AI_KB_ACCESS_CONTROL_MODES)[number];
75
+ /**
76
+ * Restricts what a search returns to the content its caller is entitled to.
77
+ *
78
+ * Under `'enforced'`, every chunk carries the access scopes of the context it came from, the caller is
79
+ * resolved to the scopes they hold, and the two are intersected inside the vector query — so a caller
80
+ * never retrieves a chunk they hold no scope for. A chunk stamped as public is visible to everyone; a
81
+ * chunk with no scopes at all (ingested before access control was enabled) is visible to no one.
82
+ *
83
+ * Enforcement covers retrieval channels that can apply the scope predicate. The raw-text scan (`grep`)
84
+ * and knowledge-graph (`queryGraph`, `searchMode: 'graph'`) channels read stores that carry no scopes,
85
+ * so an enforced knowledge base refuses them rather than answering unfiltered.
86
+ *
87
+ * Mutable, but enabling it on a populated knowledge base hides everything already ingested until those
88
+ * contexts are re-ingested with scopes.
89
+ *
90
+ * @category AI
91
+ */
92
+ export interface AiKnowledgeBaseAccessControl {
93
+ /** `'none'` (the default) ignores stored scopes entirely; `'enforced'` intersects them per caller. */
94
+ mode: AiKnowledgeBaseAccessControlMode;
95
+ /**
96
+ * The backend function that resolves a caller into the access scopes they hold, as
97
+ * `'ServiceName:functionName'`. It runs once per search, receives a `ResolveKbScopesContext` and
98
+ * returns the scopes as an array of strings. Required under `'enforced'`.
99
+ *
100
+ * An `'enforced'` knowledge base whose function is not deployed fails every search rather than
101
+ * falling back to an unfiltered one.
102
+ *
103
+ * @pattern ^[^:]+:[^:]+$
104
+ */
105
+ scopeResolver?: string;
106
+ }
60
107
  /**
61
108
  * Represents a field in an AI knowledge base metadata.
62
109
  */
@@ -225,6 +272,13 @@ export interface AiKnowledgeBaseGraphPathFacetConfig {
225
272
  /** Path segment separator. Defaults to `'/'`. */
226
273
  separator?: string;
227
274
  }
275
+ /**
276
+ * The canonical declaration of {@link FOLDER_PATH_METADATA_FIELD_NAME}, shared by every writer that
277
+ * declares it on a knowledge base. `llmExtraction` is off, so a missing folder path stays absent
278
+ * instead of being guessed from document content.
279
+ * @category AI
280
+ */
281
+ export declare const FOLDER_PATH_METADATA_FIELD: AiKnowledgeBaseMetadataField;
228
282
  /** A single entity surfaced in a graph search's {@link AiKnowledgeBaseGraphContext}. @category AI */
229
283
  export interface AiKnowledgeBaseGraphContextEntity {
230
284
  /** Canonical display name of the entity. */
@@ -271,6 +325,11 @@ export interface AiKnowledgeBaseChatOptions {
271
325
  includeMetadata?: boolean;
272
326
  /** Which provider's reranker to use for reranking the context. Defaults to 'cohere'. */
273
327
  rerankProvider?: AiRerankProvider;
328
+ /**
329
+ * Minimum reranker relevance score a chunk must reach to stay once at least 10 chunks are already kept.
330
+ * Defaults to 0.2. Lets an eval tune the drop threshold per reranker, whose score ranges differ.
331
+ */
332
+ rerankScoreThreshold?: number;
274
333
  /** The maximum number of results to return. Defaults to 30 */
275
334
  limit?: number;
276
335
  /** How many chunks to look over. Defaults to 100 */
@@ -452,6 +511,18 @@ export interface BaseAiKnowledgeBaseContextRequest {
452
511
  type: AiKnowledgeBaseContextType;
453
512
  /** Optional metadata associated with the context item. */
454
513
  metadata?: AiContextMetadata;
514
+ /**
515
+ * Access scopes granting read access to this context, stamped onto every chunk it produces. Only
516
+ * meaningful on a knowledge base with `accessControl.mode: 'enforced'`, where a caller retrieves the
517
+ * context only if they hold at least one of these scopes.
518
+ *
519
+ * Supplied here rather than through a follow-up call so a restricted context is never briefly
520
+ * readable by everyone between being indexed and being scoped. Omitted on a re-ingest keeps whatever
521
+ * scopes the context already had; an empty array makes it visible to every caller.
522
+ *
523
+ * Scopes are opaque strings the resolver and the ingest side agree on. The `__` prefix is reserved.
524
+ */
525
+ scopes?: Array<string>;
455
526
  }
456
527
  /**
457
528
  * Base options for upserting text content into the AI agent's context.
@@ -571,6 +642,34 @@ export interface AiKnowledgeBaseFileContextRequest extends BaseAiKnowledgeBaseCo
571
642
  * @category AI
572
643
  */
573
644
  export declare const BULK_INGESTION_MAX_MULTIPART_FILE_BYTES: number;
645
+ /**
646
+ * Largest single file the platform's upload endpoints accept, per file: the multer limit core applies
647
+ * to every file-upload route (`COMMON_FILE_UPLOAD_OPTIONS`). By definition it also caps a bulk-ingestion
648
+ * source object, whichever way its bytes arrive: core re-enforces it on every staged object — rejecting
649
+ * the whole staging batch with the oversized object — so a staging caller pre-parks larger files.
650
+ * @category AI
651
+ */
652
+ export declare const MAX_UPLOAD_FILE_BYTES: number;
653
+ /**
654
+ * Embedding models the bulk-ingestion (batch embeddings) lane admits. A model needs a provider batch
655
+ * adapter to be listed here, but an adapter alone is not enough: a route is listed only once every core
656
+ * pod can take it, because a pod on an older image routes a job it cannot place to the wrong provider.
657
+ * This list IS that switch — adding a model here opens its route everywhere at once.
658
+ *
659
+ * Public and shared deliberately: `bulkUpsertContexts` answers a batch-transport job on any other model
660
+ * with a 501, but `createBulkUploadUrls` resolves no base at all, so a caller that stages before it upserts
661
+ * learns of the refusal only once the bytes are already uploaded. A caller that knows this bound can check
662
+ * the base up front and refuse the request instead — which only works while this list says what the
663
+ * deployment will really take. A base on an unlisted model keeps ingesting on the sync transport.
664
+ * @category AI
665
+ */
666
+ export declare const BULK_INGESTION_EMBEDDING_MODELS: readonly ["text-embedding-3-small", "voyage-3-large", "voyage-4-large", "voyage-4"];
667
+ /**
668
+ * Whether `model` is one of {@link BULK_INGESTION_EMBEDDING_MODELS}. Takes any embedding model selection
669
+ * (an integration-backed model spec is an object and is never supported).
670
+ * @category AI
671
+ */
672
+ export declare function isBulkIngestionEmbeddingModel(model: unknown): model is (typeof BULK_INGESTION_EMBEDDING_MODELS)[number];
574
673
  /**
575
674
  * @category AI
576
675
  */
@@ -600,6 +699,11 @@ export interface AiKnowledgeBaseSearchOptions {
600
699
  limit?: number;
601
700
  /** Which provider's reranker to use for reranking the context. Defaults to 'cohere'. */
602
701
  rerankProvider?: AiRerankProvider;
702
+ /**
703
+ * Minimum reranker relevance score a chunk must reach to stay once at least 10 chunks are already kept.
704
+ * Defaults to 0.2. Lets an eval tune the drop threshold per reranker, whose score ranges differ.
705
+ */
706
+ rerankScoreThreshold?: number;
603
707
  /** How many chunks to look over. Defaults to 100 */
604
708
  chunkLimit?: number;
605
709
  /** Which chat model to use when asking the question */
@@ -668,6 +772,25 @@ export interface UpsertKnowledgeBaseContextResponse {
668
772
  * singular counterpart of {@link UpsertKnowledgeBaseContextsResponse.graphIndexingSkippedContextIds}.
669
773
  */
670
774
  graphIndexingSkipped?: boolean;
775
+ /**
776
+ * First images (capped) the context lacks a description for because describing them failed; the context
777
+ * is otherwise fully ingested. Absent when every image succeeded. `imageFailureCount` is the total.
778
+ */
779
+ imageFailures?: Array<ContextImageFailure>;
780
+ /** Total number of failed images, which exceeds `imageFailures.length` when the list was capped. */
781
+ imageFailureCount?: number;
782
+ }
783
+ /**
784
+ * The failed images of one context in a multi-context upsert.
785
+ * @category AI
786
+ */
787
+ export interface UpsertContextImageFailures {
788
+ /** The context the images belong to. */
789
+ contextId: AiContextId;
790
+ /** First failed images (capped); `imageFailureCount` is the total. */
791
+ imageFailures: Array<ContextImageFailure>;
792
+ /** Total number of failed images, which exceeds `imageFailures.length` when the list was capped. */
793
+ imageFailureCount: number;
671
794
  }
672
795
  /**
673
796
  * Response structure for upserting contexts for an AiKnowledgeBase
@@ -692,6 +815,12 @@ export interface UpsertKnowledgeBaseContextsResponse {
692
815
  * caller can report the graph-coverage gap. Absent/empty when nothing was skipped or graph is disabled.
693
816
  */
694
817
  graphIndexingSkippedContextIds?: Array<AiContextId>;
818
+ /**
819
+ * Per stored context, the images that lack a description because describing them failed; each such
820
+ * context is otherwise fully ingested. A context that failed outright lists its images on its entry in
821
+ * `failures` instead. Absent when every image succeeded.
822
+ */
823
+ imageFailures?: Array<UpsertContextImageFailures>;
695
824
  }
696
825
  /**
697
826
  * Request structure for searching an AiKnowledgeBase
@@ -848,6 +977,11 @@ export interface BaseAiKnowledgeBaseSearchContextsRequest {
848
977
  rerank?: boolean;
849
978
  /** Which chat model to use when doing reranking */
850
979
  chatModel?: AiChatModelSelection;
980
+ /**
981
+ * Reasoning effort of the reranking model. A score needs little thought, so `'low'` is the usual
982
+ * choice; when unset the model applies its own default.
983
+ */
984
+ rerankReasoningEffort?: AiReasoningEffort;
851
985
  }
852
986
  /**
853
987
  * Request structure for searching AI contexts in the AiKnowledgeBase with prompt.
@@ -1099,6 +1233,14 @@ export interface GetKnowledgeBaseGraphStatusResponse {
1099
1233
  * is pending. Recomputed per poll — it moves forward while ingest activity continues.
1100
1234
  */
1101
1235
  nextAutoBuildAt?: number;
1236
+ /**
1237
+ * True when graph-scoped search (`graphFilter.underConcept`) runs on the index-native denormalized
1238
+ * `conceptIds` pre-filter: the backend's search indexes serve the field AND the chunk copies are in
1239
+ * sync with the doc nodes. False while either half is not ready (index still building, or a rebuild
1240
+ * is in flight — a rebuild drops the sync gate for its duration); scoped search then uses the
1241
+ * capped contextId-closure fallback. Absent when GraphRAG is disabled.
1242
+ */
1243
+ conceptScopeReady?: boolean;
1102
1244
  }
1103
1245
  /** The most recent graph backfill/rebuild job of a knowledge base. @category AI */
1104
1246
  export interface KnowledgeBaseGraphBuildJob {
@@ -1291,6 +1433,8 @@ export interface KnowledgeBaseGraphTopic {
1291
1433
  parentId?: string;
1292
1434
  /** Documents under the topic, when tracked. */
1293
1435
  docCount?: number;
1436
+ /** Members of the topic: entities at level 0, child topics at higher levels. */
1437
+ memberCount?: number;
1294
1438
  }
1295
1439
  /**
1296
1440
  * An aggregated relationship edge between two leaf topics: how many entity relationships cross
@@ -1359,6 +1503,8 @@ export interface KnowledgeBaseGraphQueryMatch {
1359
1503
  description?: string;
1360
1504
  /** Documents under the node, where tracked (topics and facet nodes). */
1361
1505
  docCount?: number;
1506
+ /** Topics: members of the node (entities at level 0, child topics at higher levels). */
1507
+ memberCount?: number;
1362
1508
  }
1363
1509
  /** A node in a `subtree` response: the resolved node with its children, recursively. @category AI */
1364
1510
  export interface KnowledgeBaseGraphQuerySubtreeNode {
@@ -1463,6 +1609,16 @@ export interface QueryKnowledgeBaseGraphResponse {
1463
1609
  * @category AI
1464
1610
  */
1465
1611
  export interface BulkIngestionContext {
1612
+ /**
1613
+ * The id of the context. Optional: when omitted, the server generates one and rejects the upload if
1614
+ * another context in the knowledge base already holds identical content (content-level dedup). Provide
1615
+ * an explicit id to address a specific context — that overwrites it unconditionally and allows duplicate
1616
+ * content across different ids, exactly as the synchronous `upsertContexts` treats a supplied id. Must
1617
+ * be unique within one request (each staged context becomes one per-file row keyed by this id), at most
1618
+ * 512 UTF-8 bytes of letters, digits, `_`, `.`, `:`, `@` or `-` only, and the overwrite lands
1619
+ * asynchronously when the job finalizes the file.
1620
+ */
1621
+ contextId?: AiContextId;
1466
1622
  /** `'text'` (the default) stages a text context; `'file'` consumes the next uploaded file positionally. */
1467
1623
  type?: 'text' | 'file';
1468
1624
  /** Title for a text context (required); optional display title for a file context. */
@@ -1489,6 +1645,14 @@ export interface BulkIngestionContext {
1489
1645
  * knowledge base's `metadataFields` schema when one is declared.
1490
1646
  */
1491
1647
  metadata?: Record<string, unknown>;
1648
+ /**
1649
+ * Access scopes granting read access to this context, stamped onto every chunk it produces when the
1650
+ * job finalizes; mirrors {@link BaseAiKnowledgeBaseContextRequest.scopes}, with the same semantics:
1651
+ * omitted keeps whatever scopes the context already had, an empty array makes it visible to every
1652
+ * caller. On a knowledge base with `accessControl.mode: 'enforced'`, a context whose scopes resolve
1653
+ * to nothing at finalize is stamped unreadable rather than public.
1654
+ */
1655
+ scopes?: Array<string>;
1492
1656
  }
1493
1657
  /**
1494
1658
  * Request structure for staging contexts through bulk ingestion: a durable, asynchronous lane that
@@ -1516,12 +1680,17 @@ export interface BulkIngestionUpsertContextsResponse {
1516
1680
  */
1517
1681
  contextIds: Array<string>;
1518
1682
  /**
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.
1683
+ * Contexts rejected because the knowledge base already holds identical content — either stored under
1684
+ * an existing context or accepted earlier in this same call. Absent when nothing was rejected.
1521
1685
  *
1522
1686
  * Same shape and `errorCode: 'DUPLICATE_CONTENT'` the synchronous `upsertContexts` returns, so a caller
1523
1687
  * handles a duplicate identically on both lanes. These contexts are NOT part of the job: they are not
1524
1688
  * extracted, not staged, and never appear in its per-file statuses.
1689
+ *
1690
+ * Covers TEXT contexts and MULTIPART file contexts (their bytes are in hand at staging). A file staged
1691
+ * by `stagedObjectKey` is the one exception: its bytes are first read by the deferred extraction pass,
1692
+ * so its duplicate surfaces asynchronously as a failed file with `errorCode: 'DUPLICATE_CONTENT'` in
1693
+ * the job's per-file statuses instead.
1525
1694
  */
1526
1695
  duplicates?: Array<UpsertContextStatusError>;
1527
1696
  }
@@ -1563,6 +1732,48 @@ export interface BulkIngestionFileStatus {
1563
1732
  status: 'processing' | 'completed' | 'failed';
1564
1733
  /** Present only when status is 'failed': the terminal failure reason. */
1565
1734
  errorMessage?: string;
1735
+ /**
1736
+ * Machine-readable class of a failed file, for outcomes to treat differently from real failures.
1737
+ * `'DUPLICATE_CONTENT'` marks a duplicate found by the deferred extraction pass (a presigned
1738
+ * object's bytes are first read there) — a skip, not a failure: the KB already holds this content.
1739
+ * Additive; absent for ordinary failures.
1740
+ */
1741
+ errorCode?: 'DUPLICATE_CONTENT';
1742
+ /**
1743
+ * First images (capped) the context lacks a description for because describing them failed; a
1744
+ * `completed` file is otherwise fully ingested. Absent when every image succeeded.
1745
+ */
1746
+ imageFailures?: Array<ContextImageFailure>;
1747
+ /** Total number of failed images, which exceeds `imageFailures.length` when the list was capped. */
1748
+ imageFailureCount?: number;
1749
+ }
1750
+ /**
1751
+ * One provider batch created for a bulk-ingestion job, so a caller can tell a job waiting on a
1752
+ * submitted provider batch (healthy — the designed cost/latency tradeoff of the batch lane, with
1753
+ * turnaround up to 24 hours) from a job that is actually stuck, and see since when.
1754
+ * @category AI
1755
+ */
1756
+ export interface BulkIngestionProviderBatchStatus {
1757
+ /** The provider running the batch. Mirrors the core batch row's union, like {@link state}. */
1758
+ provider: 'openai' | 'anthropic' | 'mistral' | 'voyage';
1759
+ /** The provider API the batch rides. Mirrors the core batch row's union, like {@link state}. */
1760
+ endpoint: '/v1/embeddings' | '/v1/messages/batches' | '/v1/chat/completions' | '/v1/ocr';
1761
+ /**
1762
+ * The batch's lifecycle state: `intent` (created, not yet submitted), `submitted` (waiting on the
1763
+ * provider), `ended` (provider finished, results not yet absorbed), or terminal
1764
+ * (`reconciled`/`cancelled`/`failed`).
1765
+ */
1766
+ state: 'intent' | 'submitted' | 'ended' | 'reconciled' | 'cancelled' | 'failed';
1767
+ /** The provider's own batch id; absent until the batch is submitted. */
1768
+ providerBatchId?: string;
1769
+ /** When the batch was created — the "since when has this been waiting" clock for an in-flight batch. */
1770
+ createdAt: Date;
1771
+ /**
1772
+ * When the batch row was last written. NOT a state-transition time: the poller refreshes it on every
1773
+ * poll of an in-flight batch, so on a healthy job it is always recent — it freezing means polling
1774
+ * stopped, not that the batch is waiting. Read wait duration off {@link createdAt}.
1775
+ */
1776
+ updatedAt: Date;
1566
1777
  }
1567
1778
  /**
1568
1779
  * Response describing a bulk-ingestion job's current state and progress counts.
@@ -1571,10 +1782,55 @@ export interface BulkIngestionFileStatus {
1571
1782
  export interface BulkIngestionJobStatusResponse {
1572
1783
  /** The job's lifecycle state (e.g. running, completed, failed, cancelled). */
1573
1784
  state: string;
1785
+ /**
1786
+ * The job's execution transport: `'batch'` rides provider batches (half price, tails up to 24
1787
+ * hours), `'sync'` executes inline within minutes. Decided at staging from the job's size, with one
1788
+ * transition — a defer-eligible job whose OCR routing lands on the provider batch is promoted
1789
+ * `'sync'` to `'batch'` — and held from then on. Descriptive metadata ONLY: it says how the job
1790
+ * runs, never whether a batch is draining right now, so it must not gate any wait/timeout policy;
1791
+ * that is {@link activeProviderBatchCount}. Optional on the wire: consumers must tolerate its
1792
+ * absence.
1793
+ */
1794
+ transport?: 'batch' | 'sync';
1795
+ /**
1796
+ * The lanes a `'batch'` job ROUTES inline — at the synchronous price, within minutes — rather than onto a
1797
+ * provider batch: `embeddings`, whose batches are too small for the discount to beat the queue tail.
1798
+ * Absent when every lane batches, and on a `'sync'` job (every lane of which runs inline). The job's
1799
+ * routing policy, not a record of what ran: a lane handed to the inline transport by a cancelled
1800
+ * provider-batch tail executes inline without being named here. Descriptive metadata, like {@link transport}.
1801
+ */
1802
+ inlineLanes?: Array<'embeddings' | 'imageDescription' | 'spreadsheetSummary' | 'metadataExtraction'>;
1574
1803
  /** Progress counters aggregated from the job's files and logical requests. */
1575
1804
  counts: BulkIngestionJobStatusCounts;
1576
- /** Provider batch ids submitted for this job. */
1805
+ /** Provider batch ids created for this job, across every batch state — including already-drained ones. */
1577
1806
  providerBatchIds: Array<string>;
1807
+ /**
1808
+ * Number of provider batches still in flight (created, submitted, or awaiting result reconciliation).
1809
+ * THE deferral signal: work is draining through a provider batch right now exactly when this is
1810
+ * positive — unlike {@link providerBatchIds}, which keeps terminal batches, and unlike
1811
+ * {@link transport}, which is descriptive metadata. Optional on the wire: consumers must tolerate
1812
+ * its absence.
1813
+ */
1814
+ activeProviderBatchCount?: number;
1815
+ /**
1816
+ * Per-batch detail for every provider batch of the job, so a caller can tell a healthy wait on a
1817
+ * submitted provider batch from a stall — and see since when. A SUPERSET of
1818
+ * {@link providerBatchIds}, not index-aligned with it: an `intent` batch appears here with no
1819
+ * `providerBatchId` while that list omits it. Optional on the wire: consumers must tolerate its
1820
+ * absence.
1821
+ */
1822
+ providerBatches?: Array<BulkIngestionProviderBatchStatus>;
1823
+ /**
1824
+ * Coarse answer to "what is this job doing right now": `awaiting-provider-batch` while the
1825
+ * PROVIDER is working — an `intent` or `submitted` batch (deferred OCR included; it wins whatever stage the
1826
+ * files carry) or batch-route work still queued for submission — `extracting` while files still
1827
+ * await or undergo extraction with no submitted batch, and `indexing` otherwise (inline/flex
1828
+ * requests executing, `ended` batches' results being absorbed, contexts being written — our own
1829
+ * work, however long it takes). Present only while the job {@link state} is `running`; the other
1830
+ * non-terminal states (`finalizing`, `cancelling`) already name what the job is doing. Optional on
1831
+ * the wire: consumers must tolerate its absence.
1832
+ */
1833
+ phase?: 'extracting' | 'awaiting-provider-batch' | 'indexing';
1578
1834
  /** Per-file status, one entry per staged context (bounded by the job's file cap). */
1579
1835
  files: Array<BulkIngestionFileStatus>;
1580
1836
  }
@@ -4,7 +4,7 @@
4
4
  * 'CONNECTOR_PACKAGES_TO_EXCLUDE_FROM_AUTO_SYNC' in ConnectorsService (console-backend).
5
5
  * @category Platform
6
6
  */
7
- export declare const CONNECTOR_IDS: readonly ["bitbucket", "confluence", "cotomi", "essentials", "freshdesk", "github", "google_calendar", "google_drive", "hubspot", "sharepoint", "jira", "jira_jsm", "linear", "mail", "onedrive", "outlook", "salesforce", "servicenow_csm", "slack", "teams", "ticketmind_companion", "zendesk"];
7
+ export declare const CONNECTOR_IDS: readonly ["bitbucket", "confluence", "cotomi", "essentials", "freshdesk", "generic_site_ingester", "github", "google_calendar", "google_drive", "hubspot", "sharepoint", "jira", "jira_jsm", "linear", "mail", "onedrive", "outlook", "salesforce", "servicenow_csm", "slack", "teams", "ticketmind_companion", "zendesk"];
8
8
  /**
9
9
  * Unique connector package name.
10
10
  * @category Platform
@@ -1,7 +1,12 @@
1
1
  /**
2
2
  * The extraction method to use for processing documents.
3
+ *
4
+ * `legacy` extracts text and embedded images in-process without any external model call.
5
+ * `legacy_with_llm` extracts the same text, and additionally renders each page to a screenshot that is
6
+ * described by a vision model — covering content the text layer cannot carry (figures, layout, scanned
7
+ * regions) at the cost of one model call per page. Both run with no external OCR provider.
3
8
  */
4
- export type DocumentExtractionMethod = 'mistral_ocr' | 'legacy' | 'amazon_textract' | 'azure_document_intelligence';
9
+ export type DocumentExtractionMethod = 'mistral_ocr' | 'legacy' | 'legacy_with_llm' | 'amazon_textract' | 'azure_document_intelligence';
5
10
  /**
6
11
  * Options for customizing how data is extracted from a document.
7
12
  */
@@ -51,6 +56,14 @@ export interface ExtractDataFromDocumentOptions {
51
56
  * URL-based extraction ignores it and never returns `documentMetadata`.
52
57
  */
53
58
  collectDocumentMetadata?: boolean;
59
+ /**
60
+ * Safety-net storage expiration (seconds) registered WITH the long-term upload of the original file,
61
+ * before its bytes land — so a process crash at any later point (mid-OCR, before the caller ever
62
+ * learns the path) leaves a self-collecting object instead of a permanent orphan. The caller that
63
+ * sets this owns clearing the expiration once it durably references the path; leaving it unset keeps
64
+ * the original permanent from the moment it uploads.
65
+ */
66
+ originalFileExpirationSeconds?: number;
54
67
  }
55
68
  /**
56
69
  * Request payload for extracting data from a document via URL.
@@ -74,6 +87,10 @@ export interface ExtractDataFromDocumentFileRequest {
74
87
  */
75
88
  options?: ExtractDataFromDocumentOptions;
76
89
  }
90
+ /**
91
+ * What an extracted image depicts: an image embedded in the page, or a full-page screenshot.
92
+ */
93
+ export type ExtractedImageKind = 'embedded' | 'fullPage';
77
94
  /**
78
95
  * Representation of an image extracted from a document, for use in generated content.
79
96
  */
@@ -90,6 +107,11 @@ export interface ExtractDataFromDocumentImage {
90
107
  * The base64-encoded image data, prefixed with its MIME type (e.g., data:image/png;base64,...).
91
108
  */
92
109
  imageBase64Url: string;
110
+ /**
111
+ * What the image depicts. Absent means `embedded`. Selects the description prompt — a page
112
+ * screenshot is described as a complement to the page's stored text, an embedded image in full.
113
+ */
114
+ kind?: ExtractedImageKind;
93
115
  }
94
116
  /**
95
117
  * A single extracted page from the document, including structured content and images.
@@ -262,6 +284,11 @@ export interface ExtractDataFromDocumentResponse {
262
284
  * Array of pages containing extracted data.
263
285
  */
264
286
  pages: Array<ExtractDataFromDocumentPage>;
287
+ /**
288
+ * Pages the OCR provider reported as processed (billed), when it reports one. Can exceed
289
+ * `pages.length` — a blank page is billed but returns no content.
290
+ */
291
+ ocrPagesProcessed?: number;
265
292
  /**
266
293
  * Path to the original file in cloud storage, if applicable.
267
294
  */
@@ -1,6 +1,6 @@
1
1
  import { IntegrationId } from './communication.public-types';
2
2
  /** List of all integration types supported by Squid. */
3
- export declare const INTEGRATION_TYPES: readonly ["active_directory", "ai_agents", "ai_chatbot", "algolia", "alloydb", "api", "auth0", "bedrock", "azure_blob", "azure_cosmosdb", "azure_postgresql", "azure_sql", "bigquery", "bitbucket", "built_in_azure_blob", "built_in_db", "built_in_gcs", "built_in_queue", "built_in_s3", "cassandra", "clickhouse", "cloudsql", "cockroach", "cognito", "connected_knowledgebases", "confluence", "confluent", "datadog", "db2", "descope", "documentdb", "azure-entra-external-id", "dynamodb", "elasticsearch", "firebase_auth", "firestore", "gcs", "github", "google_calendar", "google_docs", "google_drive", "graphql", "hubspot", "jira", "jira_jsm", "jwt_hmac", "jwt_rsa", "kafka", "keycloak", "linear", "mariadb", "monday", "mongo", "mssql", "databricks", "mysql", "newrelic", "okta", "onedrive", "outlook", "oracledb", "pinecone", "postgres", "redis", "s3", "salesforce", "sap_hana", "sentry", "snowflake", "spanner", "xata", "zendesk", "servicenow_csm", "freshdesk", "mail", "slack", "mcp", "a2a", "legend", "teams", "openai_compatible", "openai_compatible_embedding", "sharepoint", "vertex"];
3
+ export declare const INTEGRATION_TYPES: readonly ["active_directory", "ai_agents", "ai_chatbot", "algolia", "alloydb", "api", "auth0", "bedrock", "azure_blob", "azure_cosmosdb", "azure_postgresql", "azure_sql", "bigquery", "bitbucket", "built_in_azure_blob", "built_in_db", "built_in_gcs", "built_in_queue", "built_in_s3", "cassandra", "clickhouse", "cloudsql", "cockroach", "cognito", "connected_knowledgebases", "confluence", "confluent", "datadog", "db2", "descope", "documentdb", "azure-entra-external-id", "azure-entra-id", "dynamodb", "elasticsearch", "firebase_auth", "firestore", "gcs", "generic_site_ingester", "github", "google_calendar", "google_docs", "google_drive", "graphql", "hubspot", "jira", "jira_jsm", "jwt_hmac", "jwt_rsa", "kafka", "keycloak", "linear", "mariadb", "monday", "mongo", "mssql", "databricks", "mysql", "newrelic", "okta", "onedrive", "outlook", "oracledb", "pinecone", "postgres", "redis", "s3", "salesforce", "sap_hana", "sentry", "snowflake", "spanner", "xata", "zendesk", "servicenow_csm", "freshdesk", "mail", "slack", "mcp", "a2a", "legend", "teams", "openai_compatible", "openai_compatible_embedding", "sharepoint", "vertex"];
4
4
  /**
5
5
  * @category Database
6
6
  */
@@ -8,7 +8,7 @@ export declare const DATA_INTEGRATION_TYPES: readonly ["bigquery", "built_in_db"
8
8
  /**
9
9
  * @category Auth
10
10
  */
11
- export declare const AUTH_INTEGRATION_TYPES: readonly ["auth0", "jwt_rsa", "jwt_hmac", "cognito", "okta", "keycloak", "descope", "firebase_auth", "azure-entra-external-id"];
11
+ export declare const AUTH_INTEGRATION_TYPES: readonly ["auth0", "jwt_rsa", "jwt_hmac", "cognito", "okta", "keycloak", "descope", "firebase_auth", "azure-entra-external-id", "azure-entra-id"];
12
12
  /**
13
13
  * Auth integration types that can OAuth-protect an MCP server (see `McpOAuthOptions` and
14
14
  * `AiAgentMcpServerConfig.oauthIntegrationId`). Kept in sync with the providers supported by the
@@ -48,9 +48,17 @@ export interface IntegrationInfo<ConfigurationType = Record<string, any> | undef
48
48
  creationDate?: Date;
49
49
  /** The date when the integration was last updated. */
50
50
  updateDate?: Date;
51
+ /**
52
+ * When false, the integration is disabled: runtime access is rejected and sync jobs skip it.
53
+ * Absent means enabled on create; an update that omits it keeps the stored value, so re-enabling
54
+ * requires an explicit `enabled: true`.
55
+ */
56
+ enabled?: boolean | null;
51
57
  /** The configuration object for the integration, if any. */
52
58
  configuration: ConfigurationType;
53
59
  }
60
+ /** Returns true when the integration is explicitly disabled. An absent or null `enabled` means enabled. */
61
+ export declare function isIntegrationDisabled(integration: Pick<IntegrationInfo, 'enabled'>): boolean;
54
62
  /** Integration IDs used for built-in integrations by Squid. */
55
63
  export declare const SQUID_BUILT_IN_INTEGRATION_IDS: readonly [string, string, string];
56
64
  /** Returns true if ID is a built-in integration ID in Squid. */
@@ -10,6 +10,14 @@ export declare const SOURCE_CODE_MAX_SUPPLEMENTAL_INSTRUCTIONS_LENGTH = 20000;
10
10
  export declare const SOURCE_CODE_ANALYZER_MODELS: readonly ["claude-code", "codex"];
11
11
  /** Identifies a CLI provider available for source-code analysis. */
12
12
  export type SourceCodeAnalyzerModel = (typeof SOURCE_CODE_ANALYZER_MODELS)[number];
13
+ /** Lists trusted source-cache lifecycle strategies. */
14
+ export declare const SOURCE_CODE_CACHE_STRATEGIES: readonly ["reuse", "recreate"];
15
+ /** Selects how source analysis manages its pod-local trusted cache. */
16
+ export type SourceCodeCacheStrategy = (typeof SOURCE_CODE_CACHE_STRATEGIES)[number];
17
+ /** Lists the repository capabilities available to the configured CLI agent. */
18
+ export declare const SOURCE_CODE_EXECUTION_MODES: readonly ["read-only", "write"];
19
+ /** Selects whether the configured CLI agent may modify and publish repository state. */
20
+ export type SourceCodeExecutionMode = (typeof SOURCE_CODE_EXECUTION_MODES)[number];
13
21
  /** Lists supported source-control providers. */
14
22
  export declare const SOURCE_CONTROL_PROVIDERS: readonly ["github", "bitbucket"];
15
23
  /** Identifies a supported source-control provider. */
@@ -30,6 +38,10 @@ export interface AiAgentSourceCodeIntegrationOptions {
30
38
  analyzerReasoningEffort?: CanonicalReasoningEffort;
31
39
  /** Provides supplemental code-analysis instructions. */
32
40
  analyzerInstructions?: string;
41
+ /** Reuses the pod-local trusted cache by default or recreates it for every analysis. */
42
+ cacheStrategy?: SourceCodeCacheStrategy;
43
+ /** Inspects repositories by default or enables unrestricted repository work. */
44
+ executionMode?: SourceCodeExecutionMode;
33
45
  }
34
46
  /** Stores the immutable GitHub identity and access metadata for a selected repository. */
35
47
  export interface GitHubRepositoryConfiguration {
@@ -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.
@@ -19,6 +19,14 @@ export interface UpsertContextsOptions {
19
19
  */
20
20
  onUploaded?: () => void;
21
21
  }
22
+ /**
23
+ * Options for retrieving a knowledge base context.
24
+ * @category AI
25
+ */
26
+ export interface GetContextOptions {
27
+ /** The number of characters after which text is truncated. Optional */
28
+ truncateTextAfter?: number;
29
+ }
22
30
  /**
23
31
  * A reference to an AI knowledge base.
24
32
  */
@@ -73,9 +81,11 @@ export declare class AiKnowledgeBaseReference {
73
81
  */
74
82
  listContextIds(): Promise<Array<AiContextId>>;
75
83
  /**
76
- * Retrieves a specific context by its ID.
84
+ * Retrieves a specific context by its ID. Pass `truncateTextAfter: 0` to omit the context's `text`
85
+ * field from the response when only its metadata (e.g. `contentHash`) is needed — the stored text
86
+ * can be multiple MB, and truncating it avoids sending that payload back in full.
77
87
  */
78
- getContext(contextId: string): Promise<AiKnowledgeBaseContext | undefined>;
88
+ getContext(contextId: string, options?: GetContextOptions): Promise<AiKnowledgeBaseContext | undefined>;
79
89
  /**
80
90
  * Deletes a specific context by its ID.
81
91
  */
@@ -84,6 +94,20 @@ export declare class AiKnowledgeBaseReference {
84
94
  * Deletes multiple contexts.
85
95
  */
86
96
  deleteContexts(contextIds: Array<string>): Promise<void>;
97
+ /**
98
+ * Replaces the access scopes that grant read access to a context.
99
+ *
100
+ * Only meaningful on a knowledge base with `accessControl.mode: 'enforced'`: a search then returns a
101
+ * context only when the caller holds at least one of its scopes. Passing an empty array makes the
102
+ * context visible to every caller.
103
+ *
104
+ * The refresh primitive for permissions that changed at the source without the document itself
105
+ * changing. Pass `scopes` on the upsert instead when ingesting, so a restricted context is never
106
+ * briefly readable by everyone.
107
+ *
108
+ * @returns how many of the context's chunks were rewritten.
109
+ */
110
+ setContextScopes(contextId: string, scopes: Array<string>): Promise<number>;
87
111
  /**
88
112
  * Adds or updates a single context.
89
113
  */
@@ -164,12 +188,16 @@ export declare class AiKnowledgeBaseReference {
164
188
  * spreadsheet rows verbatim, and matches characters rather than meaning. The pattern is always a
165
189
  * literal — regex metacharacters in it are escaped — and matching is case-insensitive.
166
190
  * `options.metadataFilter` scopes the scan to the contexts it admits before any text is matched.
191
+ * Refused on a knowledge base with `accessControl.mode: 'enforced'` — the raw text carries no access
192
+ * scopes, so the scan cannot be filtered per caller.
167
193
  */
168
194
  grep(pattern: string, options?: GrepKnowledgeBaseOptions): Promise<GrepKnowledgeBaseResponse>;
169
195
  /**
170
196
  * Queries the knowledge base's graph (documents, entities, themes, facets) through the closed op set
171
197
  * — overview / resolve / describe / subtree / docsUnder / conceptsOf / neighborhood / pathBetween /
172
- * globalSummary. Requires `graphRag.enabled` on the knowledge base.
198
+ * globalSummary. Requires `graphRag.enabled` on the knowledge base. Refused on a knowledge base with
199
+ * `accessControl.mode: 'enforced'` — the graph carries no access scopes, so its answers cannot be
200
+ * filtered per caller.
173
201
  */
174
202
  queryGraph(request: Omit<QueryKnowledgeBaseGraphRequest, 'knowledgeBaseId'>): Promise<QueryKnowledgeBaseGraphResponse>;
175
203
  /**