@squidcloud/client 1.0.344 → 1.0.346

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.
@@ -421,6 +421,8 @@ export type AiSessionOptions = Partial<{
421
421
  clientId: string;
422
422
  /** The ID of the AI agent involved in the session, if specified. */
423
423
  agentId: string;
424
+ /** The ID of the AI agent involved in starting the session, if specified. */
425
+ rootAgentId: string;
424
426
  }>;
425
427
  /**
426
428
  * The generic options type. When no generic is provided,
@@ -566,16 +568,10 @@ export interface FileContextRequest extends BaseContextRequest {
566
568
  type: 'file';
567
569
  /** Whether to extract images from the file; defaults to false. */
568
570
  extractImages?: boolean;
569
- /** The minimum width for extracted images, if applicable. */
570
- minImageWidth?: number;
571
- /** The minimum height for extracted images, if applicable. */
572
- minImageHeight?: number;
573
- /** Whether to treat the full page as an image; defaults to false. */
574
- fullPageAsImage?: boolean;
571
+ /** The minimum size for extracted images, if applicable. */
572
+ imageMinSizePixels?: number;
575
573
  /** The AI model to use for extraction, if specified. */
576
574
  extractionModel?: AiChatModelName;
577
- /** An optional password to access the file, if encrypted. */
578
- password?: string;
579
575
  }
580
576
  /**
581
577
  * @category AI
@@ -1,62 +1,86 @@
1
1
  /**
2
- * @category Storage
2
+ * Options for customizing how data is extracted from a document.
3
3
  */
4
- export type DocumentFileDataType = 'image';
5
- /**
6
- * Options for extracting data from a document file stored in the storage system.
7
- * @category Storage
8
- */
9
- export interface ExtractDataFromDocumentFileOptions {
10
- /** An optional password required to access the document file, if encrypted. */
11
- password?: string;
4
+ export interface ExtractDataFromDocumentOptions {
5
+ /**
6
+ * Minimum width/height (in pixels) of images to extract. Smaller images will be ignored.
7
+ */
8
+ imageMinSizePixels?: number;
9
+ /**
10
+ * Whether to extract embedded images from the document.
11
+ */
12
+ extractImages?: boolean;
13
+ /**
14
+ * Specific page indexes to extract from the document (0-based). If omitted, all pages are extracted.
15
+ */
16
+ pageIndexes?: number[];
12
17
  }
13
18
  /**
14
- * Represents metadata for a file embedded within a document in the storage system.
15
- * @category Storage
19
+ * Request payload for extracting data from a document via URL.
16
20
  */
17
- export interface DocumentFileData {
18
- /** The type of the embedded file (e.g., 'image'). */
19
- type: DocumentFileDataType;
20
- /** The storage path of the file within the bucket. */
21
- pathInBucket: string;
21
+ export interface ExtractDataFromDocumentUrlRequest {
22
+ /**
23
+ * The publicly accessible URL pointing to the document file.
24
+ */
25
+ url: string;
26
+ /**
27
+ * Optional parameters to control how the extraction is performed.
28
+ */
29
+ options?: ExtractDataFromDocumentOptions;
22
30
  }
23
31
  /**
24
- * Represents data for a single page within a document in the storage system.
25
- * @category Storage
32
+ * Request payload for extracting data from a document file (uploaded directly).
26
33
  */
27
- export interface DocumentPageData {
28
- /** An optional title for the page. */
29
- title?: string;
30
- /** The text content extracted from the page. */
31
- text: string;
32
- /** An array of file data objects embedded in the page. */
33
- fileDataList: DocumentFileData[];
34
+ export interface ExtractDataFromDocumentFileRequest {
35
+ /**
36
+ * Optional parameters to control how the extraction is performed.
37
+ */
38
+ options?: ExtractDataFromDocumentOptions;
34
39
  }
35
40
  /**
36
- * Response structure for data extracted from a document in the storage system.
37
- * @category Storage
41
+ * Representation of an image extracted from a document, for use in generated content.
38
42
  */
39
- export interface ExtractDataFromDocumentResponse {
40
- /** The storage path of the document within the bucket, if available. */
41
- documentPathInBucket?: string;
42
- /** An array of page data extracted from the document. */
43
- pages: DocumentPageData[];
43
+ export interface ExtractDataFromDocumentImage {
44
+ /**
45
+ * A unique identifier for the image.
46
+ */
47
+ id: string;
48
+ /**
49
+ * A placeholder or marker in the content where this image should be inserted.
50
+ */
51
+ textToReplaceInContent: string;
52
+ /**
53
+ * The base64-encoded image data, prefixed with its MIME type (e.g., data:image/png;base64,...).
54
+ */
55
+ imageBase64Url: string;
44
56
  }
45
57
  /**
46
- * Represents text-only data for a single page in a document.
47
- * @category Storage
58
+ * A single extracted page from the document, including structured content and images.
48
59
  */
49
- export interface TextOnlyPageData {
50
- /** The text content of the page. */
51
- text: string;
52
- /** An optional title for the page. */
60
+ export interface ExtractDataFromDocumentPage {
61
+ /**
62
+ * Optional title for the page (e.g., sheet name or section heading).
63
+ */
53
64
  title?: string;
65
+ /**
66
+ * Page index in the original document (0-based).
67
+ */
68
+ index: number;
69
+ /**
70
+ * Extracted textual content or CSV representation of the page.
71
+ */
72
+ content: string;
73
+ /**
74
+ * List of images extracted from this page.
75
+ */
76
+ images: Array<ExtractDataFromDocumentImage>;
54
77
  }
55
78
  /**
56
- * Response structure containing text-only data extracted from a document.
57
- * @category Storage
79
+ * The full result of extracting data from a document, including all pages and any extracted images.
58
80
  */
59
- export interface DocumentTextDataResponse {
60
- /** An array of text-only page data extracted from the document. */
61
- pages: TextOnlyPageData[];
81
+ export interface ExtractDataFromDocumentResponse {
82
+ /**
83
+ * Array of pages containing extracted data.
84
+ */
85
+ pages: Array<ExtractDataFromDocumentPage>;
62
86
  }
@@ -96,13 +96,18 @@ export interface Query<Doc extends DocumentData = any> {
96
96
  /** The maximum number of records to return. */
97
97
  limit: number;
98
98
  /** Optional configuration to limit results by specific fields with custom sorting. */
99
- limitBy?: {
100
- /** The maximum number of records to return for this limit configuration. */
101
- limit: number;
102
- /** The fields to apply the limit to. */
103
- fields: Array<FieldName<Doc>>;
104
- /** Indicates whether to reverse the sort order for this limit. */
105
- reverseSort: boolean;
106
- };
99
+ limitBy?: LimitBy<Doc>;
100
+ }
101
+ /**
102
+ * A configuration object used to apply additional field-based limits to a query.
103
+ * @category Database
104
+ */
105
+ export interface LimitBy<Doc extends DocumentData = any> {
106
+ /** The maximum number of records to return for this limit configuration. */
107
+ limit: number;
108
+ /** The fields to apply the limit to. */
109
+ fields: Array<FieldName<Doc>>;
110
+ /** Indicates whether to reverse the sort order for this limit. */
111
+ reverseSort: boolean;
107
112
  }
108
113
  export {};
@@ -24,12 +24,7 @@ export type SerializedJoinQuery = {
24
24
  /** Indicates whether references should be dereferenced during query execution. */
25
25
  dereference: boolean;
26
26
  /** The root table configuration for the join operation. */
27
- root: {
28
- /** The alias for the root table in the join operation. */
29
- alias: Alias;
30
- /** The query object defining the root table's operation. */
31
- query: Query;
32
- };
27
+ root: RootTableDetails;
33
28
  /** A mapping of aliases to their dependent aliases, defining the join order from left to right. */
34
29
  leftToRight: Record<Alias, Alias[]>;
35
30
  /** A mapping of aliases to their corresponding queries for joined tables. */
@@ -37,6 +32,17 @@ export type SerializedJoinQuery = {
37
32
  /** A mapping of aliases to their join conditions. */
38
33
  joinConditions: Record<Alias, JoinCondition>;
39
34
  };
35
+ /**
36
+ * Configuration details for the root table used in a join query.
37
+ * The root table serves as the entry point for evaluating joined data across multiple tables.
38
+ * @category Database
39
+ */
40
+ export interface RootTableDetails {
41
+ /** The alias for the root table in the join operation. */
42
+ alias: Alias;
43
+ /** The query object defining the root table's operation. */
44
+ query: Query;
45
+ }
40
46
  /**
41
47
  * Represents a serialized merged query structure combining multiple queries for database operations.
42
48
  * @category Database
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Request to search the web.
3
+ */
4
+ export interface WebAiSearchRequest {
5
+ /** The search query. */
6
+ query: string;
7
+ }
8
+ /**
9
+ * Represents a cited URL in the search response.
10
+ */
11
+ export interface WebAiSearchCitedUrl {
12
+ /** The URL of the cited resource. */
13
+ url: string;
14
+ /** The title of the cited resource. */
15
+ title: string;
16
+ }
17
+ /**
18
+ * Response from a web search.
19
+ */
20
+ export interface WebAiSearchResponse {
21
+ /** The search result content in Markdown format. */
22
+ markdownText: string;
23
+ /** A list of cited URLs included in the search response. */
24
+ citedUrls: Array<WebAiSearchCitedUrl>;
25
+ }
26
+ /**
27
+ * Request to fetch content from a URL.
28
+ */
29
+ export interface WebGetUrlContentRequest {
30
+ /** The URL to fetch content from. */
31
+ url: string;
32
+ }
33
+ /**
34
+ * Response from fetching content from a URL.
35
+ */
36
+ export interface WebGetUrlContentResponse {
37
+ /** The content fetched from the URL in Markdown format. */
38
+ markdownText: string;
39
+ }
@@ -1,4 +1,4 @@
1
- import { DocumentTextDataResponse, ExtractDataFromDocumentFileOptions } from '../../internal-common/src/public-types/extraction.public-types';
1
+ import { ExtractDataFromDocumentOptions, ExtractDataFromDocumentResponse } from '../../internal-common/src/public-types/extraction.public-types';
2
2
  /**
3
3
  * ExtractionClient provides methods for extracting structured data
4
4
  * from document files using AI-driven processing.
@@ -13,5 +13,13 @@ export declare class ExtractionClient {
13
13
  * @param options - (Optional) Extraction options such as parsing hints or preprocessing flags.
14
14
  * @returns A promise that resolves with the extracted document data.
15
15
  */
16
- extractDataFromDocumentFile(file: File, options?: ExtractDataFromDocumentFileOptions): Promise<DocumentTextDataResponse>;
16
+ extractDataFromDocumentFile(file: File, options?: ExtractDataFromDocumentOptions): Promise<ExtractDataFromDocumentResponse>;
17
+ /**
18
+ * Extracts structured text data from a document at a remote URL using AI.
19
+ *
20
+ * @param url - The URL of the document to extract data from.
21
+ * @param options - (Optional) Extraction options such as parsing hints or preprocessing flags.
22
+ * @returns A promise that resolves with the extracted document data.
23
+ */
24
+ extractDataFromDocumentUrl(url: string, options?: ExtractDataFromDocumentOptions): Promise<ExtractDataFromDocumentResponse>;
17
25
  }
@@ -53,3 +53,4 @@ export * from './ai-client';
53
53
  export * from './agent/ai-agent-client';
54
54
  export * from './agent/ai-agent-client.types';
55
55
  export * from './agent/ai-agent-client-reference';
56
+ export * from './web-client';
@@ -1,5 +1,4 @@
1
1
  import { AiContextMetadata } from '../../internal-common/src/public-types/ai-agent.public-types';
2
- import { DocumentTextDataResponse } from '../../internal-common/src/public-types/extraction.public-types';
3
2
  /**
4
3
  * Response to a request to get the access token for a personal storage service.
5
4
  * @category Personal Storage
@@ -55,13 +54,6 @@ export declare class PersonalStorageClient {
55
54
  * @returns A promise that resolves with the access token and expiration time.
56
55
  */
57
56
  getAccessToken(identifier: string): Promise<PsGetAccessTokenResponse>;
58
- /**
59
- * Extracts text data from a document.
60
- * @param documentId - The ID of the document to extract text data from.
61
- * @param identifier - A user-provided identifier (usually a user ID) that is associated with the document.
62
- * @returns A promise that resolves with the extracted text data.
63
- */
64
- extractDataFromDocument(documentId: string, identifier: string): Promise<DocumentTextDataResponse>;
65
57
  /**
66
58
  * Indexes a document or folder for AI processing.
67
59
  *
@@ -21,3 +21,4 @@ export * from '../../internal-common/src/public-types/typescript.public-types';
21
21
  export * from '../../internal-common/src/public-types/extraction.public-types';
22
22
  export * from '../../internal-common/src/public-types/ai-matchmaking.types';
23
23
  export * from '../../internal-common/src/public-types/backend.public-types';
24
+ export * from '../../internal-common/src/public-types/web.public-types';
@@ -81,6 +81,10 @@ export declare class ApiKeysSecretClient {
81
81
  * @returns A promise resolving to a record of all stored secret entries.
82
82
  */
83
83
  getAll(): Promise<Record<SecretKey, SecretEntry>>;
84
+ /**
85
+ * Inserts a new API key or updates an existing one with a new autogenerated value.
86
+ * Returns the created secret.
87
+ */
84
88
  upsert(key: SecretKey): Promise<SecretEntry>;
85
89
  /**
86
90
  * Deletes a specified API key.
@@ -12,6 +12,7 @@ import { PersonalStorageClient } from './personal-storage-client';
12
12
  import { SchedulerClient } from './scheduler-client';
13
13
  import { AdminClient } from './admin-client';
14
14
  import { AiClient } from './ai-client';
15
+ import { WebClient } from './web-client';
15
16
  /**
16
17
  * The different options that can be used to initialize a Squid instance.
17
18
  * @category Platform
@@ -109,6 +110,7 @@ export declare class Squid {
109
110
  private readonly aiClient;
110
111
  private readonly apiClient;
111
112
  private readonly adminClient;
113
+ private readonly webClient;
112
114
  private readonly observabilityClient;
113
115
  private readonly queueManagerFactory;
114
116
  private readonly schedulerClient;
@@ -223,6 +225,10 @@ export declare class Squid {
223
225
  * Returns the AdminClient instance for performing administrative operations.
224
226
  */
225
227
  admin(): AdminClient;
228
+ /**
229
+ * Returns a set of functionality for interacting with the web.
230
+ */
231
+ web(): WebClient;
226
232
  /**
227
233
  * Returns a client for accessing file storage for the current app.
228
234
  * Defaults to the built-in storage integration if none is provided.
@@ -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.344";
5
+ export declare const SQUIDCLOUD_CLIENT_PACKAGE_VERSION = "1.0.346";
@@ -0,0 +1,18 @@
1
+ import { WebAiSearchResponse } from '../../internal-common/src/public-types/web.public-types';
2
+ /**
3
+ * WebClient provides methods to interact with web-related functionalities.
4
+ * @category Platform
5
+ */
6
+ export declare class WebClient {
7
+ private readonly rpcManager;
8
+ /**
9
+ * Search the web using AI. Returns a response containing Markdown text and cited URLs.
10
+ * @param query The keywords or query string to search for.
11
+ */
12
+ aiSearch(query: string): Promise<WebAiSearchResponse>;
13
+ /**
14
+ * Fetch content from a URL.
15
+ * @param url The URL to fetch content from.
16
+ */
17
+ getUrlContent(url: string): Promise<string>;
18
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squidcloud/client",
3
- "version": "1.0.344",
3
+ "version": "1.0.346",
4
4
  "description": "A typescript implementation of the Squid client",
5
5
  "main": "dist/cjs/index.js",
6
6
  "types": "dist/typescript-client/src/index.d.ts",