@squidcloud/cli 1.0.445 → 1.0.447

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.
@@ -0,0 +1,442 @@
1
+ # Client SDK
2
+
3
+ The Squid Client SDK (`@squidcloud/client`) provides TypeScript/JavaScript APIs for frontend applications to interact with Squid backends.
4
+
5
+ Docs: https://docs.getsquid.ai/reference-docs/typescript-client/
6
+
7
+ ## Contents
8
+ - Where Can You Use the SDK?
9
+ - Initialization
10
+ - Built-in Features (Essentials)
11
+ - Authentication
12
+ - Common Client Operations
13
+ - Client vs Backend Permissions
14
+ - Authentication Patterns
15
+ - Storage
16
+ - Queues
17
+ - Distributed Locks
18
+ - Web
19
+ - Extraction
20
+ - Jobs
21
+ - Observability & Metrics
22
+ - Custom Notifications
23
+
24
+ ## Where Can You Use the SDK?
25
+
26
+ The Squid Client SDK can be instantiated in various environments:
27
+ - **Web applications** (vanilla JavaScript, React, Vue, Angular, etc.)
28
+ - **Node.js servers** (Express, Fastify, etc.)
29
+ - **Mobile applications** (React Native, etc.)
30
+ - **Desktop applications** (Electron, etc.)
31
+
32
+ **Important:** When writing backend code that runs on Squid's infrastructure, the Squid client is **already initialized and available with API key and full permissions**. You don't need to manually create a new instance.
33
+
34
+ ## Initialization
35
+
36
+ ### Configuration Options
37
+
38
+ **Required Parameters:**
39
+ - **`appId`** (string): Your Squid application identifier. Can be found in the Squid Console.
40
+ - **`region`** (string): The region where your Squid application is deployed:
41
+ - AWS regions: `'us-east-1.aws'`, `'ap-south-1.aws'`
42
+ - GCP regions: `'us-central1.gcp'`
43
+
44
+ **Optional Parameters:**
45
+ - **`apiKey`** (string): API key that bypasses security rules and provides full administrative access.
46
+ - **IMPORTANT**: Has **complete control over your application** and bypasses all security rules
47
+ - Only use in trusted environments (backend servers, admin tools, development)
48
+ - **Never expose in client-side code** (web browsers, mobile apps)
49
+ - **`authProvider`** (object): Authentication provider that supplies OAuth2.0 tokens for the current user
50
+ - `integrationId` (string): The ID of your auth integration
51
+ - `getToken` (function): Returns the user's auth token. Can return `Promise<string | undefined>` or `string | undefined` synchronously
52
+ - Authentication details are **available in backend functions** via the execution context
53
+ - **`environmentId`** (string): Environment identifier (dev, staging, prod). Defaults to production.
54
+ - **`squidDeveloperId`** (string): Your developer identifier, used for local development and debugging.
55
+ - **`consoleRegion`** (string): Console region (optional)
56
+
57
+ ### Basic Setup
58
+
59
+ ```typescript
60
+ import { Squid } from '@squidcloud/client';
61
+
62
+ const squid = new Squid({
63
+ appId: 'your-app-id',
64
+ region: 'us-east-1.aws',
65
+ environmentId: 'dev' // optional
66
+ });
67
+ ```
68
+
69
+ ## Built-in Features (Essentials)
70
+
71
+ Every Squid application includes the **Essentials Connector** - a built-in integration that provides core utilities without any additional setup. These features are always available:
72
+
73
+ | Feature | Access | Description | Docs |
74
+ |---------|--------|-------------|------|
75
+ | **Web Utilities** | `squid.web()` | AI-powered web search, URL content extraction, short URLs | [Web section](#web) |
76
+ | **AI Agents** | `squid.ai().agent()` | Chat with built-in or custom AI agents | [ai.md](ai.md) |
77
+ | **Knowledge Bases** | `squid.ai().knowledgeBase()` | RAG with semantic search and reranking | [ai.md](ai.md) |
78
+ | **Image Generation** | `squid.ai().image()` | Generate images with DALL-E | [ai.md](ai.md) |
79
+ | **Audio** | `squid.ai().audio()` | Transcription and text-to-speech | [ai.md](ai.md) |
80
+ | **PDF/Extraction** | `squid.extraction()` | Create PDFs, extract data from documents | [Extraction section](#extraction) |
81
+ | **Observability** | `squid.observability` | Report and query custom metrics | [Observability section](#observability--metrics) |
82
+
83
+ **Note:** For additional integrations (databases, auth providers, storage, etc.), see [connectors.md](connectors.md). Configure integrations in the [Squid Console](https://console.getsquid.ai/).
84
+
85
+ ## Authentication
86
+
87
+ ### API Key vs Auth Provider
88
+
89
+ **Using API Key (Server-Side Only):**
90
+ ```typescript
91
+ const squid = new Squid({
92
+ appId: 'your-app-id',
93
+ region: 'us-east-1.aws',
94
+ apiKey: 'your-api-key' // Full admin access
95
+ });
96
+ ```
97
+ - **Use cases**: Backend servers, admin tools, scripts, development environments
98
+ - **Security**: Has full control - bypasses all security rules
99
+ - **Warning**: Never use in client-side code
100
+
101
+ **Using Auth Provider (Client-Side):**
102
+ ```typescript
103
+ const squid = new Squid({
104
+ appId: 'your-app-id',
105
+ region: 'us-east-1.aws',
106
+ authProvider: {
107
+ integrationId: 'auth-integration-id',
108
+ getToken: async () => {
109
+ // Return user's OAuth token
110
+ return await getCurrentUserToken();
111
+ }
112
+ }
113
+ });
114
+ ```
115
+ - **Use cases**: Web apps, mobile apps, any user-facing application
116
+ - **Security**: Respects security rules based on authenticated user
117
+ - **Backend access**: User authentication details are available in backend functions through the execution context
118
+
119
+ **Setting Auth Provider After Initialization:**
120
+ ```typescript
121
+ const squid = new Squid({
122
+ appId: 'your-app-id',
123
+ region: 'us-east-1.aws'
124
+ });
125
+
126
+ // Later, when user logs in
127
+ squid.setAuthProvider({
128
+ integrationId: 'auth-integration-id',
129
+ getToken: async () => userAuthToken
130
+ });
131
+ ```
132
+
133
+ ## Common Client Operations
134
+
135
+ ### Accessing Collections
136
+ ```typescript
137
+ // Get collection reference in the built-in database
138
+ const users = squid.collection<User>('users');
139
+
140
+ // Get collection reference in a specific integration
141
+ const orders = squid.collection<Order>('orders', 'postgres-db');
142
+ ```
143
+
144
+ Use `collection.doc()` to get document references for CRUD operations. See [databases.md](databases.md) for full details on `doc()` behavior, queries, and subscriptions.
145
+
146
+ ### Calling Backend Functions
147
+ ```typescript
148
+ // Execute @executable() decorated function
149
+ const result = await squid.executeFunction('greetUser', 'John');
150
+ const typedResult = await squid.executeFunction<string>('greetUser', 'John');
151
+
152
+ // With headers
153
+ const result = await squid.executeFunctionWithHeaders(
154
+ 'processPayment',
155
+ { 'X-Custom-Header': 'value' },
156
+ paymentData
157
+ );
158
+ ```
159
+
160
+ See [backend.md](backend.md) for more details on `@executable`.
161
+
162
+ ### AI Agent Access
163
+ ```typescript
164
+ // Get the built-in agent (no ID required)
165
+ const builtInAgent = squid.ai().agent();
166
+
167
+ // Get a custom agent by ID
168
+ const myAgent = squid.ai().agent('my-agent-id');
169
+
170
+ // Ask a question
171
+ const response = await myAgent.ask('How do I reset my password?');
172
+ ```
173
+
174
+ See [ai.md](ai.md) for full AI agent capabilities.
175
+
176
+ ### Webhooks
177
+ ```typescript
178
+ // Get URL for a specific webhook
179
+ const webhookUrl = squid.getWebhookUrl('github-events');
180
+ // Returns: https://<appId>.<region>.squid.cloud/webhooks/github-events
181
+
182
+ // Get base webhooks URL (no webhook ID)
183
+ const baseUrl = squid.getWebhookUrl();
184
+ // Returns: https://<appId>.<region>.squid.cloud/webhooks
185
+ ```
186
+
187
+ ## Client vs Backend Permissions
188
+
189
+ | Aspect | Client with Auth Provider | Client with API Key | Backend (`this.squid`) |
190
+ |--------|--------------------------|---------------------|------------------------|
191
+ | Security Rules | Enforced | Bypassed | Bypassed |
192
+ | User Context | Available | N/A | Available via `getUserAuth()` |
193
+ | Use Case | User-facing apps | Admin tools, scripts | Server-side logic |
194
+ | Permissions | Limited by rules | Full access | Full access |
195
+
196
+ ## Authentication Patterns
197
+
198
+ ### OAuth Integration
199
+ ```typescript
200
+ // Auth0 example
201
+ const squid = new Squid({
202
+ appId: 'YOUR_APP_ID',
203
+ region: 'us-east-1.aws',
204
+ authProvider: {
205
+ integrationId: 'auth0',
206
+ getToken: async () => await auth0.getAccessTokenSilently()
207
+ }
208
+ });
209
+ ```
210
+
211
+ ### External OAuth Integration
212
+
213
+ Manage OAuth tokens for external integrations. Squid automatically handles token refresh when tokens expire.
214
+
215
+ ```typescript
216
+ const externalAuth = squid.externalAuth('google-oauth-integration');
217
+
218
+ // Save authorization code (exchange for access token)
219
+ const tokenResponse = await externalAuth.saveAuthCode(
220
+ 'authorization-code-from-oauth-flow',
221
+ 'user-identifier' // Unique identifier for this user
222
+ );
223
+ console.log('Access token:', tokenResponse.accessToken);
224
+ console.log('Expires at:', tokenResponse.expirationTime);
225
+
226
+ // Get access token (auto-refreshes if expired)
227
+ const token = await externalAuth.getAccessToken('user-identifier');
228
+ console.log('Current access token:', token.accessToken);
229
+ console.log('Expires at:', token.expirationTime);
230
+ ```
231
+
232
+ **Use cases:**
233
+ - Google Drive/Calendar integration
234
+ - GitHub OAuth
235
+ - Slack OAuth
236
+ - Any external service requiring OAuth 2.0
237
+ - Squid handles token refresh automatically
238
+
239
+ ## Storage
240
+
241
+ Store and retrieve files with built-in storage or external providers like S3.
242
+
243
+ ```typescript
244
+ const storage = squid.storage(); // built_in_storage
245
+ const s3 = squid.storage('aws-s3-integration');
246
+
247
+ // Upload file
248
+ await storage.uploadFile('/documents', file, 3600); // 1 hour expiration
249
+
250
+ // Get download URL
251
+ const url = await storage.getDownloadUrl('/documents/report.pdf', 3600);
252
+
253
+ // Get file metadata
254
+ const metadata = await storage.getFileMetadata('/documents/report.pdf');
255
+
256
+ // List directory
257
+ const contents = await storage.listDirectoryContents('/documents');
258
+
259
+ // Delete files
260
+ await storage.deleteFile('/documents/report.pdf');
261
+ await storage.deleteFiles(['/docs/file1.pdf', '/docs/file2.pdf']);
262
+ ```
263
+
264
+ To secure storage operations, see [security.md](security.md) for `@secureStorage`. For S3 and other storage integrations, see [connectors.md](connectors.md).
265
+
266
+ ## Queues
267
+
268
+ Publish and consume messages from topics. Supports built-in queues and external providers like Kafka.
269
+
270
+ ```typescript
271
+ const queue = squid.queue<Message>('notifications');
272
+ const kafkaQueue = squid.queue<Event>('events', 'kafka-integration');
273
+
274
+ // Produce messages
275
+ await queue.produce([
276
+ { type: 'email', to: 'user@example.com' },
277
+ { type: 'sms', to: '+1234567890' }
278
+ ]);
279
+
280
+ // Consume messages (observable)
281
+ const subscription = queue.consume<Message>().subscribe(message => {
282
+ console.log('Received:', message);
283
+ });
284
+
285
+ subscription.unsubscribe();
286
+ ```
287
+
288
+ To secure queue topics, see [security.md](security.md) for `@secureTopic`. For Kafka and other queue integrations, see [connectors.md](connectors.md).
289
+
290
+ ## Distributed Locks
291
+
292
+ Prevent race conditions when multiple clients or instances access shared resources.
293
+
294
+ ```typescript
295
+ // Acquire and release manually
296
+ const lock = await squid.acquireLock('payment-processing');
297
+ try {
298
+ await processPayment();
299
+ } finally {
300
+ lock.release();
301
+ }
302
+
303
+ // Automatic release with withLock (recommended)
304
+ const result = await squid.withLock('payment-processing', async (lock) => {
305
+ await processPayment();
306
+ return 'success';
307
+ });
308
+ ```
309
+
310
+ To secure lock access, see [security.md](security.md) for `@secureDistributedLock`.
311
+
312
+ ## Web
313
+
314
+ Web utilities for AI-powered search, fetching URL content as markdown, and creating short URLs.
315
+
316
+ Also available as a REST API: [Web Utilities API](https://docs.getsquid.ai/reference-docs/api/#tag/Web-Utilities)
317
+
318
+ ```typescript
319
+ const web = squid.web();
320
+
321
+ // AI-powered web search
322
+ const results = await web.aiSearch('latest AI developments');
323
+
324
+ // Get URL content (as markdown)
325
+ const content = await web.getUrlContent('https://example.com/article');
326
+
327
+ // URL shortening
328
+ const shortUrl = await web.createShortUrl('https://very-long-url.com', 86400);
329
+ ```
330
+
331
+ ## Extraction
332
+
333
+ Create PDFs from HTML/markdown and extract structured data from documents using AI.
334
+
335
+ Also available as a REST API: [Extraction Utilities API](https://docs.getsquid.ai/reference-docs/api/#tag/Extraction-Utilities)
336
+
337
+ ```typescript
338
+ const extraction = squid.extraction();
339
+
340
+ // Create PDF from HTML or markdown
341
+ const pdfResponse = await extraction.createPdf({
342
+ content: '<h1>Hello</h1><p>This is a PDF</p>',
343
+ contentType: 'html', // or 'markdown'
344
+ options: {
345
+ pageSize: 'A4',
346
+ margin: { top: '1cm', bottom: '1cm', left: '1cm', right: '1cm' }
347
+ }
348
+ });
349
+ console.log('PDF created:', pdfResponse.url);
350
+
351
+ // Extract data from document file
352
+ const extractedData = await extraction.extractDataFromDocumentFile(
353
+ myPdfFile,
354
+ {
355
+ schema: {
356
+ fields: [
357
+ { name: 'invoiceNumber', type: 'string', description: 'Invoice number' },
358
+ { name: 'total', type: 'number', description: 'Total amount' },
359
+ { name: 'date', type: 'date', description: 'Invoice date' }
360
+ ]
361
+ }
362
+ }
363
+ );
364
+
365
+ // Extract data from document URL
366
+ const urlData = await extraction.extractDataFromDocumentUrl(
367
+ 'https://example.com/document.pdf',
368
+ {
369
+ schema: {
370
+ fields: [
371
+ { name: 'title', type: 'string' },
372
+ { name: 'author', type: 'string' }
373
+ ]
374
+ }
375
+ }
376
+ );
377
+ ```
378
+
379
+ ## Jobs
380
+
381
+ Track long-running asynchronous operations. Poll for completion and retrieve results.
382
+
383
+ ```typescript
384
+ const jobClient = squid.job();
385
+
386
+ // Get job status
387
+ const job = await jobClient.getJob<Result>('job-123');
388
+ if (job?.status === 'completed') {
389
+ console.log('Result:', job.result);
390
+ }
391
+
392
+ // Wait for completion
393
+ const result = await jobClient.awaitJob<Result>('job-123');
394
+ ```
395
+
396
+ ## Observability & Metrics
397
+
398
+ Report and query custom metrics for monitoring application performance.
399
+
400
+ ```typescript
401
+ const obs = squid.observability;
402
+
403
+ // Report metric
404
+ await obs.reportMetric({
405
+ name: 'api_request_count',
406
+ value: 1,
407
+ tags: { endpoint: '/users', method: 'GET' },
408
+ timestamp: Date.now()
409
+ });
410
+
411
+ // Query metrics
412
+ const metrics = await obs.queryMetrics({
413
+ metricNames: ['api_request_count'],
414
+ startTime: startTimestamp,
415
+ endTime: endTimestamp,
416
+ groupBy: ['endpoint'],
417
+ aggregation: 'sum'
418
+ });
419
+ ```
420
+
421
+ ## Custom Notifications
422
+
423
+ Send custom messages between clients for real-time coordination.
424
+
425
+ ```typescript
426
+ const notifications = squid.getNotificationClient();
427
+
428
+ // Observe incoming notifications
429
+ const subscription = notifications.observeNotifications().subscribe(payload => {
430
+ console.log('Received notification:', payload);
431
+ // payload can be any serializable data
432
+ });
433
+
434
+ // Publish notification (requires API key)
435
+ await notifications.publishNotification(
436
+ { type: 'update', message: 'Data changed' }, // payload
437
+ ['client-id-1', 'client-id-2'] // target client IDs
438
+ );
439
+
440
+ // Clean up when done
441
+ subscription.unsubscribe();
442
+ ```
@@ -0,0 +1,33 @@
1
+ # Integrations & Connectors
2
+
3
+ Squid connects to external services through **integrations** (configured in [Squid Console](console.md), accessed via SDK).
4
+
5
+ ## Integration Types
6
+
7
+ ```typescript
8
+ import { IntegrationType, INTEGRATION_TYPES } from '@squidcloud/client';
9
+ ```
10
+
11
+ - **`IntegrationType`** - Type for a single integration (e.g., `'postgres'`, `'mongo'`, `'auth0'`)
12
+ - **`INTEGRATION_TYPES`** - Complete array of all supported types
13
+
14
+ **Source of truth:** `node_modules/@squidcloud/client/dist/internal-common/src/public-types/integration.public-types.d.ts`
15
+
16
+ **Note:** AI providers (OpenAI, Anthropic, Gemini, etc.) are configured separately in Console AI settings, not as `IntegrationType`. See [ai.md](ai.md).
17
+
18
+ ## Essentials Connector
19
+
20
+ Every app includes the **Essentials Connector** automatically - no setup required. See [client.md](client.md) for details. Provides:
21
+ - `squid.web()` - AI search, URL extraction, short URLs
22
+ - `squid.ai()` - AI queries against configured providers
23
+ - `squid.extraction()` - Structured data extraction from documents/URLs
24
+
25
+ ## Using Integrations
26
+
27
+ Access integrations by their ID (configured in Console):
28
+
29
+ ```typescript
30
+ squid.collection<Order>('orders', 'my-postgres'); // Database
31
+ squid.storage('my-s3-bucket'); // Storage
32
+ squid.queue<Event>('events', 'my-kafka'); // Queue
33
+ ```
@@ -0,0 +1,189 @@
1
+ # Squid Console (Web UI)
2
+
3
+ The Squid Console is a web-based management interface at https://console.getsquid.ai/ for setting up and managing your Squid applications.
4
+
5
+ ## Contents
6
+ - Overview
7
+ - Organizations & Applications
8
+ - AI Studio
9
+ - Knowledge Bases
10
+ - Integrations Setup
11
+ - Monitoring & Debugging
12
+ - Console vs SDK
13
+ - SDK Equivalents
14
+ - Profile Settings
15
+
16
+ ## Overview
17
+
18
+ The Console provides visual interfaces for:
19
+ - Organization and application management
20
+ - AI agent configuration and testing
21
+ - Knowledge base management
22
+ - Integration setup and configuration
23
+ - Monitoring and debugging
24
+
25
+ ## Organizations & Applications
26
+
27
+ ### Managing Organizations
28
+ - Create organizations (teams/workspaces)
29
+ - Invite team members and manage roles
30
+ - View organization-wide settings and billing
31
+
32
+ ### Managing Applications
33
+ - Create applications (projects) within organizations
34
+ - Configure application settings
35
+ - Manage API keys and secrets
36
+ - View application logs and metrics
37
+ - Switch between environments (dev, staging, prod)
38
+
39
+ ### API Keys and Secrets
40
+ - Generate API keys for backend access
41
+ - Store secrets securely (database passwords, third-party API keys)
42
+ - Manage secret access and rotation
43
+
44
+ ## AI Studio
45
+
46
+ The AI Studio provides visual tools for building and testing AI agents:
47
+
48
+ ### Agent Configuration
49
+ - Create and configure AI agents visually
50
+ - Set agent instructions, models, and guardrails
51
+ - Configure agent memory and conversation settings
52
+ - Connect agents to functions, knowledge bases, and integrations
53
+
54
+ ### Testing Agents
55
+ - Interactive chat interface for testing agents
56
+ - View agent reasoning and function calls
57
+ - Debug conversation history
58
+ - Test different scenarios and edge cases
59
+
60
+ ### Connecting Resources
61
+ - Link agents to backend functions (`@aiFunction`)
62
+ - Connect agents to knowledge bases for RAG
63
+ - Configure connected integrations (databases, APIs)
64
+ - Set up agent collaboration (connected agents)
65
+
66
+ ## Knowledge Bases
67
+
68
+ ### Creating Knowledge Bases
69
+ - Create new knowledge bases for RAG (Retrieval Augmented Generation)
70
+ - Configure embedding models and settings
71
+ - Set up metadata schemas
72
+
73
+ ### Managing Content
74
+ - Upload documents (PDF, text, markdown, etc.)
75
+ - View and edit contexts
76
+ - Search and preview indexed content
77
+ - Monitor indexing status
78
+
79
+ ## Integrations Setup
80
+
81
+ ### Database Connections
82
+ - Connect databases (PostgreSQL, MySQL, MongoDB, etc.)
83
+ - Configure connection strings and credentials
84
+ - Set up schema discovery and synchronization
85
+ - Test database connections
86
+
87
+ ### SaaS Integrations
88
+ - Connect SaaS services (Stripe, Slack, HubSpot, etc.)
89
+ - Configure OAuth flows
90
+ - Set up webhooks and callbacks
91
+ - Manage integration credentials
92
+
93
+ ### OAuth Configuration
94
+ - Configure OAuth providers for user authentication
95
+ - Set up OAuth for external service access
96
+ - Manage OAuth secrets and redirect URLs
97
+
98
+ ### Storage Providers
99
+ - Connect storage providers (AWS S3, GCS, etc.)
100
+ - Configure bucket access and permissions
101
+ - Set up file upload/download policies
102
+
103
+ ## Monitoring & Debugging
104
+
105
+ ### Real-time Logs
106
+ - View application logs in real-time
107
+ - Filter logs by type, severity, and source
108
+ - Search log history
109
+
110
+ ### API Usage
111
+ - Monitor API call volumes
112
+ - Track rate limits and quotas
113
+ - View usage analytics and trends
114
+
115
+ ### Agent Debugging
116
+ - Debug agent conversations step-by-step
117
+ - View function calls and their results
118
+ - Analyze agent decision-making process
119
+ - Identify and fix conversation issues
120
+
121
+ ### Performance Metrics
122
+ - Track response times
123
+ - Monitor error rates
124
+ - View resource utilization
125
+
126
+ ## Console vs SDK
127
+
128
+ | Task | Console | SDK |
129
+ |------|---------|-----|
130
+ | Initial setup | Great for | Possible but harder |
131
+ | Visual agent config | Ideal | N/A |
132
+ | Quick testing | Easy | Requires code |
133
+ | Monitoring | Real-time UI | Custom implementation |
134
+ | CI/CD pipelines | Not suited | Ideal |
135
+ | Programmatic control | N/A | Full control |
136
+ | Dynamic configuration | Manual | Automated |
137
+ | Complex automation | Limited | Unlimited |
138
+
139
+ **Rule of thumb:**
140
+ - **Console is great for:** Initial setup, visual agent configuration, quick testing, monitoring
141
+ - **SDK is more powerful for:** Programmatic control, CI/CD pipelines, dynamic configuration, complex automation
142
+
143
+ ## SDK Equivalents
144
+
145
+ Everything in Console can be done via SDK (except creating orgs/apps, which requires ManagementClient):
146
+
147
+ ```typescript
148
+ // Console: Click to create an agent with AI Studio
149
+ // SDK equivalent:
150
+ const agent = squid.ai().agent('my-agent');
151
+ await agent.upsert({
152
+ description: 'Customer support agent',
153
+ options: {
154
+ model: 'gpt-4o',
155
+ instructions: 'You are a helpful support agent...'
156
+ }
157
+ });
158
+
159
+ // Console: Upload document to knowledge base
160
+ // SDK equivalent:
161
+ const kb = squid.ai().knowledgeBase('docs');
162
+ await kb.upsertContext({
163
+ contextId: 'doc-1',
164
+ text: 'Product documentation...'
165
+ }, pdfFile);
166
+
167
+ // Console: Configure database integration
168
+ // SDK equivalent (requires API key):
169
+ const integrations = squid.admin().integrations();
170
+ await integrations.upsertIntegration({
171
+ id: 'my-db',
172
+ type: 'postgres',
173
+ configuration: {
174
+ connectionString: 'postgresql://...'
175
+ }
176
+ });
177
+ ```
178
+
179
+ ## Profile Settings
180
+
181
+ ### Management API Keys
182
+ For programmatic org/app management, create management API keys in Profile Settings:
183
+
184
+ 1. Go to Squid Console → Profile Settings → API Keys
185
+ 2. Click "Create API Key"
186
+ 3. Copy the key value (shown only once)
187
+ 4. Key format: `squid_mgmt_<uuid>`
188
+
189
+ See [admin.md](admin.md) for using ManagementClient with these keys.