@runtypelabs/sdk 1.7.1 → 1.7.3

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 (80) hide show
  1. package/dist/index.cjs +7026 -0
  2. package/dist/index.cjs.map +1 -0
  3. package/dist/index.d.cts +5147 -0
  4. package/dist/index.d.ts +5146 -27
  5. package/dist/index.js +6955 -77
  6. package/dist/index.js.map +1 -1
  7. package/package.json +14 -7
  8. package/dist/batch-builder.d.ts +0 -106
  9. package/dist/batch-builder.d.ts.map +0 -1
  10. package/dist/batch-builder.js +0 -124
  11. package/dist/batch-builder.js.map +0 -1
  12. package/dist/batches-namespace.d.ts +0 -132
  13. package/dist/batches-namespace.d.ts.map +0 -1
  14. package/dist/batches-namespace.js +0 -128
  15. package/dist/batches-namespace.js.map +0 -1
  16. package/dist/case-types.d.ts +0 -42
  17. package/dist/case-types.d.ts.map +0 -1
  18. package/dist/case-types.js +0 -16
  19. package/dist/case-types.js.map +0 -1
  20. package/dist/client-token-types.d.ts +0 -143
  21. package/dist/client-token-types.d.ts.map +0 -1
  22. package/dist/client-token-types.js +0 -11
  23. package/dist/client-token-types.js.map +0 -1
  24. package/dist/client.d.ts +0 -131
  25. package/dist/client.d.ts.map +0 -1
  26. package/dist/client.js +0 -501
  27. package/dist/client.js.map +0 -1
  28. package/dist/endpoints.d.ts +0 -1248
  29. package/dist/endpoints.d.ts.map +0 -1
  30. package/dist/endpoints.js +0 -1649
  31. package/dist/endpoints.js.map +0 -1
  32. package/dist/error-handling-types.d.ts +0 -71
  33. package/dist/error-handling-types.d.ts.map +0 -1
  34. package/dist/error-handling-types.js +0 -12
  35. package/dist/error-handling-types.js.map +0 -1
  36. package/dist/eval-builder.d.ts +0 -216
  37. package/dist/eval-builder.d.ts.map +0 -1
  38. package/dist/eval-builder.js +0 -225
  39. package/dist/eval-builder.js.map +0 -1
  40. package/dist/evals-namespace.d.ts +0 -205
  41. package/dist/evals-namespace.d.ts.map +0 -1
  42. package/dist/evals-namespace.js +0 -208
  43. package/dist/evals-namespace.js.map +0 -1
  44. package/dist/flow-builder.d.ts +0 -717
  45. package/dist/flow-builder.d.ts.map +0 -1
  46. package/dist/flow-builder.js +0 -592
  47. package/dist/flow-builder.js.map +0 -1
  48. package/dist/flow-result.d.ts +0 -117
  49. package/dist/flow-result.d.ts.map +0 -1
  50. package/dist/flow-result.js +0 -175
  51. package/dist/flow-result.js.map +0 -1
  52. package/dist/flows-namespace.d.ts +0 -442
  53. package/dist/flows-namespace.d.ts.map +0 -1
  54. package/dist/flows-namespace.js +0 -686
  55. package/dist/flows-namespace.js.map +0 -1
  56. package/dist/generated-tool-gate.d.ts +0 -75
  57. package/dist/generated-tool-gate.d.ts.map +0 -1
  58. package/dist/generated-tool-gate.js +0 -314
  59. package/dist/generated-tool-gate.js.map +0 -1
  60. package/dist/index.d.ts.map +0 -1
  61. package/dist/prompts-namespace.d.ts +0 -237
  62. package/dist/prompts-namespace.d.ts.map +0 -1
  63. package/dist/prompts-namespace.js +0 -222
  64. package/dist/prompts-namespace.js.map +0 -1
  65. package/dist/runtype.d.ts +0 -232
  66. package/dist/runtype.d.ts.map +0 -1
  67. package/dist/runtype.js +0 -367
  68. package/dist/runtype.js.map +0 -1
  69. package/dist/stream-utils.d.ts +0 -58
  70. package/dist/stream-utils.d.ts.map +0 -1
  71. package/dist/stream-utils.js +0 -373
  72. package/dist/stream-utils.js.map +0 -1
  73. package/dist/transform.d.ts +0 -30
  74. package/dist/transform.d.ts.map +0 -1
  75. package/dist/transform.js +0 -196
  76. package/dist/transform.js.map +0 -1
  77. package/dist/types.d.ts +0 -717
  78. package/dist/types.d.ts.map +0 -1
  79. package/dist/types.js +0 -7
  80. package/dist/types.js.map +0 -1
package/dist/types.d.ts DELETED
@@ -1,717 +0,0 @@
1
- /**
2
- * Client-specific types with camelCase field names
3
- * These types transform the API's snake_case responses to camelCase for JavaScript/TypeScript consumers
4
- */
5
- export type JsonPrimitive = string | number | boolean | null;
6
- export type JsonArray = JsonValue[];
7
- export type JsonObject = {
8
- [key: string]: JsonValue;
9
- };
10
- export type JsonValue = JsonPrimitive | JsonObject | JsonArray;
11
- export type Metadata = JsonObject;
12
- export interface JSONSchema {
13
- type: 'object' | 'string' | 'number' | 'boolean' | 'array' | 'null';
14
- properties?: Record<string, JSONSchema>;
15
- required?: string[];
16
- items?: JSONSchema;
17
- description?: string;
18
- default?: JsonValue;
19
- enum?: JsonPrimitive[];
20
- minimum?: number;
21
- maximum?: number;
22
- minLength?: number;
23
- maxLength?: number;
24
- pattern?: string;
25
- }
26
- export interface ClientConfig {
27
- apiKey?: string;
28
- baseUrl?: string;
29
- apiVersion?: string;
30
- timeout?: number;
31
- headers?: Record<string, string>;
32
- }
33
- export interface PaginationResponse<T> {
34
- data: T[];
35
- pagination: {
36
- nextCursor: string | null;
37
- prevCursor: string | null;
38
- hasMore: boolean;
39
- hasPrev: boolean;
40
- limit: number;
41
- currentOffset: number;
42
- totalPages?: number;
43
- currentPage?: number;
44
- totalCount?: number;
45
- };
46
- }
47
- export interface ApiResponse<T> {
48
- data?: T;
49
- success?: boolean;
50
- error?: string;
51
- message?: string;
52
- }
53
- export interface FlowStep {
54
- id: string;
55
- type: string;
56
- name: string;
57
- order: number;
58
- enabled: boolean;
59
- config: JsonObject;
60
- }
61
- export interface Flow {
62
- id: string;
63
- name: string;
64
- description?: string;
65
- status: 'draft' | 'active' | 'paused' | 'failed';
66
- userId: string;
67
- organizationId?: string;
68
- createdAt: string;
69
- updatedAt: string;
70
- lastRunAt?: string;
71
- prompts?: Prompt[];
72
- /** Flow steps embedded in the flow response (consolidated from flow_steps endpoint) */
73
- flowSteps?: FlowStep[];
74
- /** Number of steps in the flow */
75
- stepCount?: number;
76
- }
77
- export interface Prompt {
78
- id: string;
79
- name: string;
80
- text: string;
81
- responseFormat: 'default' | 'json' | 'markdown' | 'html' | 'xml';
82
- model: string;
83
- isStreamed: boolean;
84
- tools: string[];
85
- inputVariables?: string;
86
- estimatedTokens?: number;
87
- estimatedCost?: string;
88
- userId: string;
89
- createdAt: string;
90
- updatedAt: string;
91
- flows?: FlowAttachment[];
92
- }
93
- export interface FlowAttachment {
94
- flowId: string;
95
- flowName: string;
96
- order: number;
97
- }
98
- export interface RuntypeRecord {
99
- id: string;
100
- type: string;
101
- name: string;
102
- metadata: Metadata;
103
- metadataLabels?: {
104
- [key: string]: string;
105
- };
106
- metadataSchema?: {
107
- keys: string[];
108
- keyMapping?: {
109
- [key: string]: string;
110
- };
111
- keyTypes?: {
112
- [key: string]: string;
113
- };
114
- types?: {
115
- [key: string]: string;
116
- };
117
- sizeKb: number;
118
- keyCount: number;
119
- updatedAt: string;
120
- };
121
- availableFields?: string[];
122
- userId: string;
123
- createdAt: string;
124
- updatedAt: string;
125
- }
126
- export interface ApiKey {
127
- id: string;
128
- name: string;
129
- keyPrefix: string;
130
- searchHint?: string;
131
- permissions: string[];
132
- isActive: boolean;
133
- expiresAt?: string;
134
- allowedIps: string[];
135
- createdAt: string;
136
- updatedAt?: string;
137
- lastUsedAt?: string;
138
- }
139
- export interface ModelConfig {
140
- id: string;
141
- provider: string;
142
- modelId: string;
143
- displayName?: string;
144
- requiresApiKey: boolean;
145
- costPer1kTokens?: number;
146
- contextLength?: number;
147
- maxOutputTokens?: number;
148
- maxTokens?: number;
149
- supportsStreaming?: boolean;
150
- supportedResponseFormats?: string[];
151
- supportsSearch?: boolean;
152
- isEnabled: boolean;
153
- isDefault: boolean;
154
- settings: JsonObject;
155
- createdAt: string;
156
- updatedAt: string;
157
- providerKeyId?: string | null;
158
- requiresIntegration?: string;
159
- apiKey?: string;
160
- scope?: 'personal' | 'organization';
161
- organizationId?: string;
162
- }
163
- export interface UserProfile {
164
- id: string;
165
- firstName?: string;
166
- lastName?: string;
167
- email: string;
168
- preferences?: {
169
- theme?: 'light' | 'dark' | 'system';
170
- notifications?: boolean;
171
- defaultModel?: string;
172
- };
173
- }
174
- export interface CreateFlowRequest {
175
- name: string;
176
- description?: string;
177
- flowSteps?: Array<{
178
- type: 'prompt' | 'context' | 'condition' | 'output' | 'email';
179
- name: string;
180
- order?: number;
181
- enabled?: boolean;
182
- config: JsonObject;
183
- }>;
184
- }
185
- export interface CreatePromptRequest {
186
- flowIds?: string[];
187
- name: string;
188
- text: string;
189
- responseFormat?: 'json' | 'markdown' | 'text' | 'html' | 'xml';
190
- model?: string;
191
- inputVariables?: string;
192
- }
193
- export interface CreateRecordRequest {
194
- type: string;
195
- name: string;
196
- metadata?: Metadata;
197
- }
198
- export interface BulkEditCondition {
199
- field: string;
200
- operator: 'equals' | 'equals_ci' | 'not_equals' | 'contains' | 'not_contains';
201
- value: string | number | boolean;
202
- }
203
- export interface BulkEditRequest {
204
- recordIds?: string[];
205
- conditions?: BulkEditCondition[];
206
- updates?: JsonObject;
207
- deleteFields?: string[];
208
- dryRun?: boolean;
209
- applyToAll?: boolean;
210
- }
211
- export interface BulkEditResult {
212
- id: string;
213
- before: JsonObject;
214
- after: JsonObject;
215
- }
216
- export interface BulkEditResponse {
217
- data: BulkEditResult[];
218
- recordIds?: number[];
219
- }
220
- export interface ProviderApiKey {
221
- id: number;
222
- provider: 'openai' | 'anthropic' | 'huggingface' | 'google' | 'xai' | 'mixlayer' | 'togetherai';
223
- name: string;
224
- keyPreview: string;
225
- isDefault: boolean;
226
- isActive: boolean;
227
- usageCount: number;
228
- lastUsedAt?: string;
229
- createdAt: string;
230
- updatedAt: string;
231
- }
232
- export interface CreateProviderKeyRequest {
233
- provider: 'openai' | 'anthropic' | 'huggingface' | 'google' | 'xai' | 'mixlayer' | 'togetherai';
234
- name: string;
235
- apiKey: string;
236
- isDefault?: boolean;
237
- }
238
- export interface UpdateProviderKeyRequest {
239
- name?: string;
240
- apiKey?: string;
241
- isDefault?: boolean;
242
- isActive?: boolean;
243
- }
244
- export interface CreateApiKeyRequest {
245
- name: string;
246
- permissions?: string[];
247
- expiresAt?: string;
248
- allowedIps?: string[];
249
- environment?: 'test' | 'production';
250
- }
251
- export interface CreateModelConfigRequest {
252
- provider: 'mixlayer' | 'openai' | 'anthropic' | 'google' | 'xai' | 'huggingface' | 'togetherai';
253
- modelId: string;
254
- apiKey?: string;
255
- settings?: JsonObject;
256
- }
257
- /** Content part types for multi-modal messages */
258
- export interface TextContentPart {
259
- type: 'text';
260
- text: string;
261
- }
262
- export interface ImageContentPart {
263
- type: 'image';
264
- image: string;
265
- mimeType?: string;
266
- }
267
- export interface FileContentPart {
268
- type: 'file';
269
- data: string;
270
- mimeType: string;
271
- filename: string;
272
- }
273
- export type MessageContent = string | Array<TextContentPart | ImageContentPart | FileContentPart>;
274
- /**
275
- * Options for upsert mode - controls conflict detection and versioning
276
- */
277
- export interface UpsertOptions {
278
- /** Whether to create a version snapshot before updating (default: true) */
279
- createVersionOnChange?: boolean;
280
- /** Allow overwriting changes made via dashboard/API (default: false) */
281
- allowOverwriteExternalChanges?: boolean;
282
- }
283
- /**
284
- * Environment type for dispatch requests
285
- * - 'development': Use development credentials (default for testing in dashboard)
286
- * - 'production': Use production credentials (shows warning in UI)
287
- */
288
- export type DispatchEnvironment = 'development' | 'production';
289
- export interface DispatchRequest {
290
- record?: {
291
- id?: number | string;
292
- name?: string;
293
- type?: string;
294
- metadata?: Metadata;
295
- };
296
- flow: {
297
- id?: string;
298
- name?: string;
299
- steps?: Array<any>;
300
- };
301
- messages?: Array<{
302
- role: 'system' | 'user' | 'assistant';
303
- content: MessageContent;
304
- }>;
305
- /**
306
- * Secure credentials for tool authentication
307
- * - Never logged or returned in responses
308
- * - Only used for variable substitution in tool headers/URLs
309
- * - Available as {{secrets.key_name}} in tool configurations
310
- */
311
- secrets?: Record<string, string>;
312
- /**
313
- * Top-level input variables accessible as {{varName}} in templates
314
- * - Allows simple syntax without _record.metadata prefix
315
- * - Takes precedence over record.metadata when resolving variables
316
- * - Keys cannot start with '_' (reserved for system variables)
317
- */
318
- inputs?: Record<string, unknown>;
319
- options?: {
320
- streamResponse?: boolean;
321
- modelOverride?: string;
322
- recordMode?: 'existing' | 'create' | 'virtual';
323
- flowMode?: 'existing' | 'create' | 'virtual' | 'upsert';
324
- storeResults?: boolean;
325
- autoAppendMetadata?: boolean;
326
- debugMode?: boolean;
327
- /**
328
- * Environment for credential lookup
329
- * - 'development': Use development credentials (default)
330
- * - 'production': Use production credentials
331
- * Credentials are looked up with environment-specific first, then fallback to "all environments"
332
- */
333
- environment?: DispatchEnvironment;
334
- createVersion?: boolean;
335
- versionType?: 'published' | 'draft' | 'test' | 'virtual';
336
- versionLabel?: string;
337
- versionNotes?: string;
338
- flowVersionId?: string;
339
- upsertOptions?: UpsertOptions;
340
- };
341
- }
342
- export interface ListParams {
343
- limit?: number;
344
- cursor?: string;
345
- direction?: 'next' | 'prev';
346
- }
347
- export interface RecordListParams extends ListParams {
348
- metadataKeys?: string;
349
- metadataKeysAll?: string;
350
- minFields?: number;
351
- maxFields?: number;
352
- metadataTypes?: string;
353
- hasLargeFields?: boolean;
354
- minSizeKb?: number;
355
- maxSizeKb?: number;
356
- sortBy?: string;
357
- sortOrder?: 'asc' | 'desc';
358
- includeFields?: boolean;
359
- }
360
- export interface Tool {
361
- id: string;
362
- userId: string;
363
- organizationId?: string;
364
- name: string;
365
- description: string;
366
- toolType: 'flow' | 'custom' | 'external' | 'local';
367
- parametersSchema: JSONSchema;
368
- config: ToolConfig;
369
- isActive: boolean;
370
- createdAt: string;
371
- updatedAt: string;
372
- }
373
- export type ToolConfig = FlowToolConfig | CustomToolConfig | ExternalToolConfig | LocalToolConfig;
374
- export interface FlowToolConfig {
375
- flowId: string;
376
- parameterMapping: Record<string, string>;
377
- outputMapping?: string;
378
- }
379
- export interface CustomToolConfig {
380
- code: string;
381
- timeout: number;
382
- allowedApis: string[];
383
- }
384
- export interface ExternalToolConfig {
385
- url: string;
386
- method: 'GET' | 'POST' | 'PUT' | 'DELETE';
387
- headers?: Record<string, string>;
388
- authType?: 'none' | 'bearer' | 'api_key';
389
- }
390
- export interface LocalToolConfig {
391
- [key: string]: JsonValue;
392
- }
393
- export interface BuiltInTool {
394
- id: string;
395
- name: string;
396
- description: string;
397
- category: 'image_generation' | 'web_search' | 'code_execution' | 'file_operations' | 'data_analysis';
398
- providers: string[];
399
- parametersSchema: JSONSchema;
400
- defaultConfig?: JsonObject;
401
- documentationUrl?: string;
402
- }
403
- export interface ToolExecution {
404
- id: string;
405
- toolId: string;
406
- flowExecutionId?: string;
407
- stepId?: string;
408
- userId: string;
409
- inputParameters: JsonObject;
410
- outputResult: JsonValue;
411
- status: 'pending' | 'success' | 'failed';
412
- errorMessage?: string;
413
- executionTimeMs?: number;
414
- createdAt: string;
415
- }
416
- export interface CreateToolRequest {
417
- name: string;
418
- description: string;
419
- toolType: 'flow' | 'custom' | 'external';
420
- parametersSchema: JSONSchema;
421
- config: ToolConfig;
422
- }
423
- export interface UpdateToolRequest {
424
- name?: string;
425
- description?: string;
426
- parametersSchema?: JSONSchema;
427
- config?: ToolConfig;
428
- isActive?: boolean;
429
- }
430
- export interface ExecuteToolRequest {
431
- toolId: string;
432
- parameters: JsonObject;
433
- }
434
- export interface ExecuteToolResponse {
435
- executionId: string;
436
- result: JsonValue;
437
- status: 'success' | 'failed';
438
- errorMessage?: string;
439
- executionTimeMs: number;
440
- }
441
- export interface ModelUsageQueryParams {
442
- startDate?: string;
443
- endDate?: string;
444
- period?: 'today' | 'yesterday' | 'last_7_days' | 'last_30_days' | 'current_month' | 'last_month' | 'current_year';
445
- granularity?: 'hour' | 'day' | 'week' | 'month';
446
- modelConfigId?: string;
447
- }
448
- export interface ModelUsageSummary {
449
- totalRequests: number;
450
- totalCost: number;
451
- totalTokens: number;
452
- platformCost?: number;
453
- userCost?: number;
454
- platformTokens?: number;
455
- userTokens?: number;
456
- }
457
- export interface ModelUsageDetail {
458
- modelId: string;
459
- modelName?: string;
460
- provider: string;
461
- requestCount: number;
462
- totalCost: number;
463
- totalTokens: number;
464
- avgCostPerRequest: number;
465
- }
466
- export interface ModelUsageTimeSeries {
467
- date: string;
468
- requests: number;
469
- cost: number;
470
- tokens: number;
471
- }
472
- export interface ModelUsageResponse {
473
- meta: {
474
- startDate: string;
475
- endDate: string;
476
- period?: string;
477
- granularity?: string;
478
- };
479
- summary: ModelUsageSummary;
480
- usageByModel: Record<string, ModelUsageDetail>;
481
- timeSeries?: ModelUsageTimeSeries[];
482
- }
483
- /**
484
- * Runtime tool definition for inline tool definitions in requests.
485
- * These are not persisted - they're defined and used within a single request.
486
- *
487
- * Runtime tools allow you to define tools dynamically without saving them
488
- * to the database. They support the same tool types as saved tools:
489
- * - external: HTTP API calls with variable substitution
490
- * - custom: JavaScript/Python code execution
491
- * - flow: Execute another Runtype flow
492
- *
493
- * @example
494
- * ```typescript
495
- * const runtimeTool: RuntimeTool = {
496
- * name: 'list_flows',
497
- * description: 'List all flows in the workspace',
498
- * toolType: 'external',
499
- * parametersSchema: {
500
- * type: 'object',
501
- * properties: {
502
- * limit: { type: 'number', default: 20 }
503
- * }
504
- * },
505
- * config: {
506
- * url: 'https://api.runtype.com/v1/flows',
507
- * method: 'GET',
508
- * headers: { Authorization: '{{_internal.auth_token}}' }
509
- * }
510
- * }
511
- * ```
512
- */
513
- export interface RuntimeTool {
514
- name: string;
515
- description: string;
516
- toolType: 'flow' | 'custom' | 'external' | 'local';
517
- parametersSchema: JSONSchema;
518
- config?: RuntimeToolConfig;
519
- }
520
- /**
521
- * Config options for runtime tools
522
- */
523
- export type RuntimeToolConfig = RuntimeFlowToolConfig | RuntimeCustomToolConfig | RuntimeExternalToolConfig | RuntimeLocalToolConfig;
524
- export interface RuntimeLocalToolConfig {
525
- [key: string]: JsonValue;
526
- }
527
- export interface RuntimeFlowToolConfig {
528
- flowId: string;
529
- parameterMapping?: Record<string, string>;
530
- outputMapping?: string;
531
- }
532
- export interface RuntimeCustomToolConfig {
533
- code: string;
534
- language?: 'javascript' | 'typescript' | 'python';
535
- sandboxProvider?: 'quickjs' | 'daytona' | 'cloudflare-worker';
536
- timeout?: number;
537
- }
538
- export interface RuntimeExternalToolConfig {
539
- url: string;
540
- method?: 'GET' | 'POST' | 'PUT' | 'DELETE';
541
- headers?: Record<string, string>;
542
- }
543
- /**
544
- * Tools configuration for prompt steps.
545
- * Supports both saved tools (by ID) and runtime tools (inline definitions).
546
- *
547
- * @example
548
- * ```typescript
549
- * const toolsConfig: ToolsConfig = {
550
- * // Reference saved tools by ID
551
- * toolIds: ['tool_abc123', 'tool_def456'],
552
- * // Or define tools inline
553
- * runtimeTools: [
554
- * {
555
- * name: 'search_docs',
556
- * description: 'Search documentation',
557
- * toolType: 'external',
558
- * parametersSchema: { ... },
559
- * config: { url: '...', method: 'GET' }
560
- * }
561
- * ],
562
- * maxToolCalls: 10,
563
- * toolCallStrategy: 'auto'
564
- * }
565
- * ```
566
- */
567
- /**
568
- * Authentication configuration for custom MCP servers
569
- */
570
- export interface CustomMCPServerAuth {
571
- /** Authentication type */
572
- type: 'bearer' | 'api_key' | 'basic' | 'custom_header' | 'oauth2' | 'none';
573
- /** Header name for api_key or custom_header auth types */
574
- headerName?: string;
575
- /** Token/key value for bearer, api_key, or custom_header */
576
- token?: string;
577
- /** Username for basic auth */
578
- username?: string;
579
- /** Password for basic auth */
580
- password?: string;
581
- /** OAuth2 credentials (for oauth2 auth type) */
582
- oauth2?: {
583
- accessToken?: string;
584
- refreshToken?: string;
585
- tokenEndpoint?: string;
586
- clientId?: string;
587
- clientSecret?: string;
588
- expiresAt?: number;
589
- scope?: string;
590
- issuer?: string;
591
- };
592
- }
593
- /**
594
- * Custom MCP server configuration for runtime use.
595
- *
596
- * Allows connecting to custom MCP-compatible servers at dispatch time,
597
- * with credentials passed inline (never logged or stored).
598
- *
599
- * @example
600
- * ```typescript
601
- * const mcpServer: CustomMCPServer = {
602
- * id: 'notion',
603
- * name: 'Notion Integration',
604
- * url: 'https://my-notion-mcp.example.com/mcp',
605
- * auth: {
606
- * type: 'bearer',
607
- * token: process.env.NOTION_MCP_TOKEN
608
- * },
609
- * timeout: 30000,
610
- * allowedTools: ['create_page', 'search_pages']
611
- * }
612
- * ```
613
- */
614
- export interface CustomMCPServer {
615
- /** Unique identifier for this server instance (used in tool IDs: mcp:custom_{id}:toolname) */
616
- id: string;
617
- /** Display name for UI/logging */
618
- name?: string;
619
- /** Server URL (required) */
620
- url: string;
621
- /** Authentication configuration (treated as secret, never logged) */
622
- auth?: CustomMCPServerAuth;
623
- /** Optional: filter to only allow specific tools (by name) */
624
- allowedTools?: string[];
625
- /** Optional: timeout in milliseconds (default: 30000, max: 60000) */
626
- timeout?: number;
627
- /** Optional: transport type (default: 'streamable_http') */
628
- transport?: 'streamable_http' | 'rest';
629
- /** Optional: whether the server is enabled (default: true) */
630
- enabled?: boolean;
631
- }
632
- export interface ToolsConfig {
633
- /** IDs of saved tools to use */
634
- toolIds?: string[];
635
- /** Inline runtime tool definitions (not persisted) */
636
- runtimeTools?: RuntimeTool[];
637
- /**
638
- * Custom MCP servers with credentials passed at runtime.
639
- * Maximum 5 servers per step.
640
- *
641
- * @example
642
- * ```typescript
643
- * mcpServers: [{
644
- * id: 'notion',
645
- * url: 'https://my-mcp.example.com/mcp',
646
- * auth: { type: 'bearer', token: process.env.MCP_TOKEN }
647
- * }]
648
- * ```
649
- */
650
- mcpServers?: CustomMCPServer[];
651
- /** Maximum number of tool calls allowed per step */
652
- maxToolCalls?: number;
653
- /** Tool call strategy: 'auto' (model decides), 'required' (must call), 'none' (disabled) */
654
- toolCallStrategy?: 'auto' | 'required' | 'none';
655
- /** Whether to allow parallel tool calls */
656
- parallelCalls?: boolean;
657
- /** Per-tool configuration overrides */
658
- toolConfigs?: Record<string, JsonObject>;
659
- }
660
- /**
661
- * Reasoning configuration for AI models that support extended thinking.
662
- *
663
- * Enables models like GPT-5, Claude 4, Gemini 2.5 to show their reasoning process.
664
- * Different providers have different configuration options.
665
- *
666
- * @example Simple boolean (uses provider defaults)
667
- * ```typescript
668
- * reasoning: true
669
- * ```
670
- *
671
- * @example GPT-5 with detailed reasoning
672
- * ```typescript
673
- * reasoning: {
674
- * enabled: true,
675
- * reasoningEffort: 'high',
676
- * reasoningSummary: 'detailed'
677
- * }
678
- * ```
679
- *
680
- * @example Claude with thinking budget
681
- * ```typescript
682
- * reasoning: {
683
- * enabled: true,
684
- * budgetTokens: 16000
685
- * }
686
- * ```
687
- */
688
- export interface ReasoningConfig {
689
- /** Enable reasoning (required) */
690
- enabled: boolean;
691
- /** Reasoning effort level for OpenAI models. 'xhigh' only available for GPT-5.1-Codex-Max */
692
- reasoningEffort?: 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
693
- /** Reasoning summary mode - required for GPT-5 streaming. 'auto' for condensed, 'detailed' for comprehensive */
694
- reasoningSummary?: 'auto' | 'detailed';
695
- /** Maximum tokens for Claude extended thinking */
696
- budgetTokens?: number;
697
- /** Maximum tokens for Gemini thinking */
698
- thinkingBudget?: number;
699
- /** Whether to include thinking in the response */
700
- includeThoughts?: boolean;
701
- }
702
- /**
703
- * Reasoning configuration value - either a simple boolean or detailed config.
704
- *
705
- * @example Simple enable/disable
706
- * ```typescript
707
- * reasoning: true // Enable with provider defaults
708
- * reasoning: false // Explicitly disable
709
- * ```
710
- *
711
- * @example Detailed configuration
712
- * ```typescript
713
- * reasoning: { enabled: true, reasoningEffort: 'high' }
714
- * ```
715
- */
716
- export type ReasoningValue = boolean | ReasoningConfig;
717
- //# sourceMappingURL=types.d.ts.map