@runflow-ai/sdk 1.0.60 → 1.0.62

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.
package/README.md CHANGED
@@ -1032,7 +1032,10 @@ const result = await agent.process({
1032
1032
 
1033
1033
  ### Connectors
1034
1034
 
1035
- **Connectors** are dynamic integrations with external services defined in the Runflow backend. Connector tools automatically load schemas from the backend, support mock execution, and handle path parameters seamlessly.
1035
+ **Connectors** are dynamic integrations with external services defined in the Runflow backend. They support two modes of usage:
1036
+
1037
+ 1. **As Tools** - For agent execution (LLM decides when to call)
1038
+ 2. **Direct Invocation** - For programmatic execution (you control when to call)
1036
1039
 
1037
1040
  #### Key Features
1038
1041
 
@@ -1041,20 +1044,27 @@ const result = await agent.process({
1041
1044
  - 🛣️ **Path Parameter Resolution** - Automatic extraction and URL building
1042
1045
  - ⚡ **Lazy Initialization** - Schemas loaded only when needed, cached globally
1043
1046
  - 🔐 **Flexible Authentication** - Supports API Key, Bearer Token, Basic Auth, OAuth2
1047
+ - 🔄 **Multiple Credentials** - Override credentials per execution (multi-tenant support)
1044
1048
  - ✅ **Type-Safe** - Automatic JSON Schema → Zod → LLM Parameters conversion
1045
1049
 
1046
- #### Create Connector Tool
1050
+ ---
1051
+
1052
+ #### Usage Mode 1: As Agent Tool
1053
+
1054
+ Use connectors as tools that the LLM can call automatically
1055
+
1056
+ > **💡 Resource Identifier:** Use the **resource slug** (e.g., `get-customers`, `list-users`) which is auto-generated from the resource name.
1057
+ > Slugs are stable, URL-safe identifiers that won't break if you rename the resource display name.
1047
1058
 
1048
1059
  ```typescript
1049
1060
  import { createConnectorTool, Agent, openai } from '@runflow-ai/sdk';
1050
1061
 
1051
1062
  // Basic connector tool (schema loaded from backend)
1052
1063
  const getClienteTool = createConnectorTool({
1053
- connector: 'api-contabil',
1054
- resource: 'clientes',
1055
- action: 'get',
1064
+ connector: 'api-contabil', // Connector instance slug
1065
+ resource: 'get-customers', // Resource slug
1056
1066
  description: 'Get customer by ID from accounting API',
1057
- enableMock: true, // Optional: enables mock mode
1067
+ enableMock: true, // Optional: enables mock mode
1058
1068
  });
1059
1069
 
1060
1070
  // Use with Agent
@@ -1066,8 +1076,7 @@ const agent = new Agent({
1066
1076
  getCliente: getClienteTool,
1067
1077
  listClientes: createConnectorTool({
1068
1078
  connector: 'api-contabil',
1069
- resource: 'clientes',
1070
- action: 'list',
1079
+ resource: 'list-customers', // Resource slug
1071
1080
  }),
1072
1081
  },
1073
1082
  });
@@ -1080,18 +1089,115 @@ const result = await agent.process({
1080
1089
  });
1081
1090
  ```
1082
1091
 
1092
+ ---
1093
+
1094
+ #### Usage Mode 2: Direct Invocation
1095
+
1096
+ Invoke connectors directly without agent involvement:
1097
+
1098
+ > **💡 Identifiers:**
1099
+ > - **Connector:** Use the instance **slug** (e.g., `hubspot-prod`) - recommended over display name
1100
+ > - **Resource:** Use the resource **slug** (e.g., `create-contact`) - auto-generated from resource name
1101
+
1102
+ ```typescript
1103
+ import { connector } from '@runflow-ai/sdk/connectors';
1104
+ import type { ConnectorExecutionOptions } from '@runflow-ai/sdk';
1105
+
1106
+ // Direct connector call (using slugs - recommended)
1107
+ const result = await connector(
1108
+ 'hubspot-prod', // connector instance slug
1109
+ 'create-contact', // resource slug
1110
+ { // data
1111
+ email: 'john@example.com',
1112
+ firstname: 'John',
1113
+ lastname: 'Doe'
1114
+ }
1115
+ );
1116
+
1117
+ console.log('Contact created:', result);
1118
+ ```
1119
+
1120
+ **With execution options:**
1121
+
1122
+ ```typescript
1123
+ const options: ConnectorExecutionOptions = {
1124
+ credentialId: 'cred-prod-123', // Override credential
1125
+ timeout: 10000, // 10 seconds timeout
1126
+ retries: 3, // Retry 3 times on failure
1127
+ useMock: false, // Use real API
1128
+ };
1129
+
1130
+ const result = await connector(
1131
+ 'api-contabil',
1132
+ 'get-customer', // Resource slug
1133
+ { id: 123 },
1134
+ options
1135
+ );
1136
+ ```
1137
+
1138
+ **Multi-tenant example:**
1139
+
1140
+ ```typescript
1141
+ // Different credentials per customer
1142
+ async function createContactForCustomer(customerId: string, contactData: any) {
1143
+ // Get customer's HubSpot credential
1144
+ const credentialId = await getCustomerCredential(customerId, 'hubspot');
1145
+
1146
+ return await connector(
1147
+ 'hubspot',
1148
+ 'create-contact', // Resource slug
1149
+ contactData,
1150
+ { credentialId }
1151
+ );
1152
+ }
1153
+
1154
+ // Usage
1155
+ await createContactForCustomer('customer-1', { email: 'john@acme.com' });
1156
+ await createContactForCustomer('customer-2', { email: 'jane@techcorp.com' });
1157
+ ```
1158
+
1159
+ **Custom headers (override everything):**
1160
+
1161
+ ```typescript
1162
+ // Custom headers have HIGHEST priority
1163
+ const result = await connector(
1164
+ 'hubspot',
1165
+ 'create-contact', // Resource slug
1166
+ { email: 'test@example.com' },
1167
+ {
1168
+ headers: {
1169
+ 'Authorization': 'Bearer temp-test-token',
1170
+ 'X-Request-ID': generateId(),
1171
+ }
1172
+ }
1173
+ );
1174
+ ```
1175
+
1176
+ **Authentication Priority:**
1177
+
1178
+ 1. **Custom headers** (highest - overrides everything)
1179
+ 2. **credentialId override** (runtime override)
1180
+ 3. **Instance credential** (default from connector instance)
1181
+ 4. **No authentication**
1182
+
1183
+ ---
1184
+
1083
1185
  #### Connector Tool Configuration
1084
1186
 
1085
1187
  ```typescript
1086
1188
  createConnectorTool({
1087
- connector: string, // Connector instance name (e.g., 'hubspot', 'api-contabil')
1088
- resource: string, // Resource name (e.g., 'contacts', 'clientes', 'tickets')
1089
- action: string, // Action name (e.g., 'get', 'list', 'create', 'update')
1189
+ connector: string, // Connector instance slug (e.g., 'hubspot-prod', 'api-contabil')
1190
+ resource: string, // Resource slug (e.g., 'get-contacts', 'list-customers', 'create-ticket')
1090
1191
  description?: string, // Optional: Custom description (defaults to auto-generated)
1091
1192
  enableMock?: boolean, // Optional: Enable mock mode (adds useMock parameter)
1092
1193
  })
1093
1194
  ```
1094
1195
 
1196
+ **Important Notes:**
1197
+ - **`connector`**: Use the instance slug (e.g., `hubspot-prod`) instead of display name
1198
+ - **`resource`**: Use the resource slug (e.g., `get-users`, `create-order`) - auto-generated from resource name
1199
+ - Resource lookup priority: **slug first** → name fallback (backward compatibility)
1200
+
1095
1201
  #### Multiple Connector Tools
1096
1202
 
1097
1203
  ```typescript
@@ -1099,22 +1205,19 @@ createConnectorTool({
1099
1205
  const tools = {
1100
1206
  listClientes: createConnectorTool({
1101
1207
  connector: 'api-contabil',
1102
- resource: 'clientes',
1103
- action: 'list',
1208
+ resource: 'list-customers', // Resource slug
1104
1209
  enableMock: true,
1105
1210
  }),
1106
1211
 
1107
1212
  getCliente: createConnectorTool({
1108
1213
  connector: 'api-contabil',
1109
- resource: 'clientes',
1110
- action: 'get',
1214
+ resource: 'get-customer', // Resource slug
1111
1215
  enableMock: true,
1112
1216
  }),
1113
1217
 
1114
1218
  createCliente: createConnectorTool({
1115
1219
  connector: 'api-contabil',
1116
- resource: 'clientes',
1117
- action: 'create',
1220
+ resource: 'create-customer', // Resource slug
1118
1221
  enableMock: true,
1119
1222
  }),
1120
1223
  };
@@ -1148,10 +1251,11 @@ const agent = new Agent({
1148
1251
  instructions: 'You manage accounting data.',
1149
1252
  model: openai('gpt-4o'),
1150
1253
  tools: {
1151
- listClientes: contabil.tool('clientes', 'list'),
1152
- getCliente: contabil.tool('clientes', 'get'),
1153
- createCliente: contabil.tool('clientes', 'create'),
1154
- updateCliente: contabil.tool('clientes', 'update'),
1254
+ // Using resource slugs
1255
+ listClientes: contabil.tool('list-customers'),
1256
+ getCliente: contabil.tool('get-customer'),
1257
+ createCliente: contabil.tool('create-customer'),
1258
+ updateCliente: contabil.tool('update-customer'),
1155
1259
  },
1156
1260
  });
1157
1261
  ```
@@ -1161,11 +1265,10 @@ const agent = new Agent({
1161
1265
  Connectors automatically resolve path parameters from the resource URL:
1162
1266
 
1163
1267
  ```typescript
1164
- // Resource defined in backend: /clientes/{id}/pedidos/{pedidoId}
1268
+ // Resource defined in backend with path: /clientes/{id}/pedidos/{pedidoId}
1165
1269
  const getClientePedidoTool = createConnectorTool({
1166
1270
  connector: 'api-contabil',
1167
- resource: 'clientes.pedidos',
1168
- action: 'get',
1271
+ resource: 'get-customer-order', // Resource slug
1169
1272
  description: 'Get specific order from a customer',
1170
1273
  });
1171
1274
 
@@ -1186,9 +1289,8 @@ Enable mock mode for development and testing:
1186
1289
  ```typescript
1187
1290
  const tool = createConnectorTool({
1188
1291
  connector: 'api-contabil',
1189
- resource: 'clientes',
1190
- action: 'list',
1191
- enableMock: true, // Adds useMock parameter
1292
+ resource: 'list-customers', // Resource slug
1293
+ enableMock: true, // Adds useMock parameter
1192
1294
  });
1193
1295
 
1194
1296
  // Use mock mode in development
@@ -1200,13 +1302,54 @@ const result = await agent.process({
1200
1302
  });
1201
1303
  ```
1202
1304
 
1305
+ #### Complete Example: Both Modes
1306
+
1307
+ ```typescript
1308
+ import { Agent, openai, createConnectorTool, connector } from '@runflow-ai/sdk';
1309
+
1310
+ // 1. Create tool for agent use
1311
+ const createContactTool = createConnectorTool({
1312
+ connector: 'hubspot',
1313
+ resource: 'contacts',
1314
+ action: 'create',
1315
+ description: 'Create contact in HubSpot',
1316
+ });
1317
+
1318
+ const agent = new Agent({
1319
+ name: 'CRM Agent',
1320
+ instructions: 'You manage contacts in HubSpot.',
1321
+ model: openai('gpt-4o'),
1322
+ tools: { createContact: createContactTool },
1323
+ });
1324
+
1325
+ // 2. Agent decides when to use tool (Mode 1)
1326
+ await agent.process({
1327
+ message: 'Create contact for Alice, alice@example.com',
1328
+ sessionId: 'session-1',
1329
+ });
1330
+
1331
+ // 3. Direct invocation (Mode 2 - you control)
1332
+ await connector(
1333
+ 'hubspot',
1334
+ 'contacts',
1335
+ 'update',
1336
+ {
1337
+ contactId: '123',
1338
+ status: 'customer'
1339
+ },
1340
+ { credentialId: 'cred-prod' }
1341
+ );
1342
+ ```
1343
+
1344
+ ---
1345
+
1203
1346
  #### How It Works
1204
1347
 
1205
1348
  1. **Tool Creation**: `createConnectorTool` creates a tool with a temporary schema
1206
1349
  2. **Lazy Loading**: On first agent execution, schemas are fetched from the backend in parallel
1207
1350
  3. **Schema Conversion**: JSON Schema → Zod → LLM Parameters (automatic)
1208
1351
  4. **Caching**: Schemas are cached globally to avoid repeated API calls
1209
- 5. **Execution**: Tool executes with proper authentication, path resolution, and error handling
1352
+ 5. **Execution**: Tool/API executes with authentication, path resolution, and error handling
1210
1353
 
1211
1354
  #### Automatic Setup
1212
1355
 
@@ -3016,8 +3159,7 @@ agent._setAPIClient(apiClient);
3016
3159
  import { Agent, Runflow, openai, anthropic, bedrock } from '@runflow-ai/sdk';
3017
3160
 
3018
3161
  // Tools & Connectors
3019
- import { createTool, createConnectorTool } from '@runflow-ai/sdk';
3020
- import { hubspot, twilio, email, slack } from '@runflow-ai/sdk';
3162
+ import { createTool, createConnectorTool, connector } from '@runflow-ai/sdk';
3021
3163
 
3022
3164
  // Workflows
3023
3165
  import {
@@ -3065,7 +3207,7 @@ import { openai, anthropic, bedrock } from '@runflow-ai/sdk/core';
3065
3207
  import { createTool } from '@runflow-ai/sdk/tools';
3066
3208
 
3067
3209
  // Connectors
3068
- import { createConnectorTool, hubspot, twilio, email, slack } from '@runflow-ai/sdk/connectors';
3210
+ import { connector, createConnectorTool, loadConnector } from '@runflow-ai/sdk/connectors';
3069
3211
 
3070
3212
  // Workflows
3071
3213
  import { createWorkflow, WorkflowBuilder } from '@runflow-ai/sdk/workflows';
@@ -1,14 +1,32 @@
1
1
  import { z } from 'zod';
2
2
  import { RunflowTool } from '../types';
3
+ /**
4
+ * Create a connector tool for agent use with lazy schema loading
5
+ *
6
+ * @param config - Configuration object
7
+ * @param config.connector - Connector instance slug (e.g., 'hubspot-prod', 'json-placeholder')
8
+ * @param config.resource - Resource slug (e.g., 'get-users', 'create-contact', 'list-todos')
9
+ * @param config.description - Optional custom description
10
+ * @param config.enableMock - Optional: enable mock mode (adds useMock parameter)
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * const getUsersTool = createConnectorTool({
15
+ * connector: 'json-placeholder-default', // Instance slug
16
+ * resource: 'get-users', // Resource slug
17
+ * description: 'Get all users from JSON Placeholder API',
18
+ * enableMock: true,
19
+ * });
20
+ * ```
21
+ */
3
22
  export declare function createConnectorTool(config: {
4
23
  connector: string;
5
24
  resource: string;
6
- action: string;
7
25
  description?: string;
8
26
  enableMock?: boolean;
9
27
  }): RunflowTool;
10
28
  export declare function loadConnector(name: string): {
11
- tool(resource: string, action: string): RunflowTool;
29
+ tool(resource: string): RunflowTool;
12
30
  };
13
31
  export type ConnectorParameters = Record<string, ConnectorParameter>;
14
32
  export type ConnectorParameter = 'string' | 'string?' | 'number' | 'number?' | 'boolean' | 'boolean?' | 'email' | 'email?' | 'url' | 'url?' | 'date' | 'date?' | {
@@ -21,19 +39,4 @@ export interface ConnectorToolOptions {
21
39
  description?: string;
22
40
  outputSchema?: z.ZodSchema;
23
41
  }
24
- export declare const hubspot: {
25
- createContact: () => RunflowTool;
26
- getContact: () => RunflowTool;
27
- createTicket: () => RunflowTool;
28
- };
29
- export declare const twilio: {
30
- sendWhatsApp: () => RunflowTool;
31
- sendSMS: () => RunflowTool;
32
- };
33
- export declare const email: {
34
- send: () => RunflowTool;
35
- };
36
- export declare const slack: {
37
- sendMessage: () => RunflowTool;
38
- };
39
42
  //# sourceMappingURL=connector-creator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"connector-creator.d.ts","sourceRoot":"","sources":["../../src/connectors/connector-creator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAiBvC,wBAAgB,mBAAmB,CAAC,MAAM,EAAE;IAC1C,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,GA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D,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;AAErE,MAAM,MAAM,kBAAkB,GAC1B,QAAQ,GACR,SAAS,GACT,QAAQ,GACR,SAAS,GACT,SAAS,GACT,UAAU,GACV,OAAO,GACP,QAAQ,GACR,KAAK,GACL,MAAM,GACN,MAAM,GACN,OAAO,GACP;IAAE,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,GAClB;IAAE,KAAK,EAAE,kBAAkB,CAAA;CAAE,CAAC;AAElC,MAAM,WAAW,oBAAoB;IACnC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC;CAC5B"}
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.slack = exports.email = exports.twilio = exports.hubspot = void 0;
4
3
  exports.createConnectorTool = createConnectorTool;
5
4
  exports.loadConnector = loadConnector;
6
5
  const zod_1 = require("zod");
@@ -12,12 +11,32 @@ const schemaCache = new Map();
12
11
  // ============================================================================
13
12
  // CREATE CONNECTOR TOOL (LAZY LOADING)
14
13
  // ============================================================================
14
+ /**
15
+ * Create a connector tool for agent use with lazy schema loading
16
+ *
17
+ * @param config - Configuration object
18
+ * @param config.connector - Connector instance slug (e.g., 'hubspot-prod', 'json-placeholder')
19
+ * @param config.resource - Resource slug (e.g., 'get-users', 'create-contact', 'list-todos')
20
+ * @param config.description - Optional custom description
21
+ * @param config.enableMock - Optional: enable mock mode (adds useMock parameter)
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * const getUsersTool = createConnectorTool({
26
+ * connector: 'json-placeholder-default', // Instance slug
27
+ * resource: 'get-users', // Resource slug
28
+ * description: 'Get all users from JSON Placeholder API',
29
+ * enableMock: true,
30
+ * });
31
+ * ```
32
+ */
15
33
  function createConnectorTool(config) {
16
- const resourceKey = `${config.connector}.${config.resource}.${config.action}`;
34
+ // Use double hyphen to separate connector and resource (OpenAI requires ^[a-zA-Z0-9_-]+$)
35
+ const resourceKey = `${config.connector}--${config.resource}`;
17
36
  // Create tool with temporary schema
18
37
  const tool = (0, tool_creator_1.createTool)({
19
38
  id: resourceKey,
20
- description: config.description || `Execute ${config.action} on ${config.resource}`,
39
+ description: config.description || `Execute ${config.resource} on ${config.connector}`,
21
40
  // Temporary schema (will be updated on lazy load)
22
41
  inputSchema: zod_1.z.any(),
23
42
  execute: async ({ context }) => {
@@ -25,8 +44,24 @@ function createConnectorTool(config) {
25
44
  const { createRunflowAPIClient } = require('../core/api-client');
26
45
  const api = createRunflowAPIClient();
27
46
  const { useMock, ...params } = context;
28
- const result = await api.connector(config.connector, config.resource, config.action, params, { useMock: useMock || false });
29
- return result.data || result;
47
+ const result = await api.connector(config.connector, config.resource, params, { useMock: useMock || false });
48
+ // Format result for LLM with helpful context
49
+ if (result.success === false) {
50
+ return `Error executing ${config.resource}: ${result.metadata?.error || 'Unknown error'}`;
51
+ }
52
+ const data = result.data || result;
53
+ // Add helpful context for LLM
54
+ if (Array.isArray(data)) {
55
+ return {
56
+ summary: `Found ${data.length} result(s) from ${config.resource}`,
57
+ count: data.length,
58
+ data: data.slice(0, 10), // Limit to first 10 items to avoid token overflow
59
+ ...(data.length > 10 && {
60
+ note: `Showing first 10 of ${data.length} results. Use filters to narrow down.`
61
+ })
62
+ };
63
+ }
64
+ return data;
30
65
  },
31
66
  });
32
67
  // Add metadata for identification and lazy loading
@@ -44,8 +79,10 @@ function createConnectorTool(config) {
44
79
  try {
45
80
  // Fetch schema from backend
46
81
  const schema = await fetchResourceSchema(config);
82
+ // Sanitize schema before converting (remove invalid properties)
83
+ const sanitizedSchema = sanitizeJSONSchema(schema.inputSchema);
47
84
  // Convert to Zod
48
- let inputSchema = jsonSchemaToZod(schema.inputSchema);
85
+ let inputSchema = jsonSchemaToZod(sanitizedSchema);
49
86
  // Add useMock if enabled
50
87
  if (config.enableMock && inputSchema instanceof zod_1.z.ZodObject) {
51
88
  inputSchema = inputSchema.extend({
@@ -72,14 +109,17 @@ function createConnectorTool(config) {
72
109
  catch (error) {
73
110
  const errorMessage = error instanceof Error ? error.message : String(error);
74
111
  console.error(`❌ Failed to load schema for ${resourceKey}:`, errorMessage);
75
- // Fallback: generic parameters
76
- tool.parameters = {
77
- params: {
78
- type: 'object',
79
- description: 'Parameters for this connector',
80
- required: false,
81
- },
82
- };
112
+ // Mark tool as unavailable
113
+ tool.description = `[UNAVAILABLE] ${config.description || resourceKey}. ` +
114
+ `Resource '${config.resource}' not found in connector '${config.connector}'. ` +
115
+ `Error: ${errorMessage}. ` +
116
+ `Please verify the resource slug exists or create it first.`;
117
+ // Empty parameters - LLM should not use this tool
118
+ tool.parameters = {};
119
+ // Add metadata for debugging
120
+ tool._unavailable = true;
121
+ tool._errorMessage = errorMessage;
122
+ tool._loadError = error;
83
123
  }
84
124
  };
85
125
  return tool;
@@ -93,10 +133,7 @@ async function fetchResourceSchema(config) {
93
133
  const baseUrl = api.baseUrl || process.env.RUNFLOW_API_URL || 'http://localhost:3001';
94
134
  const apiKey = api.apiKey || process.env.RUNFLOW_API_KEY;
95
135
  const tenantId = api.tenantId || process.env.RUNFLOW_TENANT_ID;
96
- // For now, we'll use a simple endpoint structure
97
- // In production, this should match your actual API structure
98
- const resourceName = `${config.resource}.${config.action}`;
99
- const response = await fetch(`${baseUrl}/api/v1/runtime/v1/connectors/${config.connector}/resources/${resourceName}/schema`, {
136
+ const response = await fetch(`${baseUrl}/api/v1/runtime/v1/connectors/${config.connector}/resources/${config.resource}/schema`, {
100
137
  headers: {
101
138
  'Content-Type': 'application/json',
102
139
  'x-api-key': apiKey,
@@ -109,6 +146,50 @@ async function fetchResourceSchema(config) {
109
146
  return await response.json();
110
147
  }
111
148
  // ============================================================================
149
+ // SANITIZE JSON SCHEMA
150
+ // ============================================================================
151
+ /**
152
+ * Sanitize JSON Schema to remove invalid properties
153
+ * - Removes properties with empty names
154
+ * - Adds default items to arrays without items
155
+ * - Cleans up malformed schemas
156
+ */
157
+ function sanitizeJSONSchema(jsonSchema) {
158
+ if (!jsonSchema || jsonSchema.type !== 'object') {
159
+ return jsonSchema;
160
+ }
161
+ const properties = jsonSchema.properties || {};
162
+ const cleanProperties = {};
163
+ // Clean properties
164
+ Object.entries(properties).forEach(([key, prop]) => {
165
+ // Skip properties with empty or whitespace-only names
166
+ if (!key || key.trim() === '') {
167
+ console.warn(`⚠️ [Schema Sanitizer] Skipping property with empty name`);
168
+ return;
169
+ }
170
+ // Fix array properties missing items
171
+ if (prop.type === 'array' && !prop.items) {
172
+ console.warn(`⚠️ [Schema Sanitizer] Array property '${key}' missing items, adding default`);
173
+ prop = {
174
+ ...prop,
175
+ items: { type: 'object', description: 'Array item' }
176
+ };
177
+ }
178
+ // Recursively sanitize nested objects
179
+ if (prop.type === 'object' && prop.properties) {
180
+ prop = {
181
+ ...prop,
182
+ ...sanitizeJSONSchema(prop)
183
+ };
184
+ }
185
+ cleanProperties[key] = prop;
186
+ });
187
+ return {
188
+ ...jsonSchema,
189
+ properties: cleanProperties
190
+ };
191
+ }
192
+ // ============================================================================
112
193
  // CONVERT JSON SCHEMA TO ZOD
113
194
  // ============================================================================
114
195
  function jsonSchemaToZod(jsonSchema) {
@@ -244,65 +325,13 @@ function zodFieldToParameter(schema) {
244
325
  function loadConnector(name) {
245
326
  return {
246
327
  // Returns proxy that creates tools on-demand
247
- tool(resource, action) {
328
+ tool(resource) {
248
329
  return createConnectorTool({
249
330
  connector: name,
250
331
  resource,
251
- action,
252
332
  enableMock: true,
253
333
  });
254
334
  },
255
335
  };
256
336
  }
257
- // Legacy built-in shortcuts (kept for backwards compatibility)
258
- exports.hubspot = {
259
- createContact: () => createConnectorTool({
260
- connector: 'hubspot',
261
- resource: 'contacts',
262
- action: 'create',
263
- enableMock: true,
264
- }),
265
- getContact: () => createConnectorTool({
266
- connector: 'hubspot',
267
- resource: 'contacts',
268
- action: 'get',
269
- enableMock: true,
270
- }),
271
- createTicket: () => createConnectorTool({
272
- connector: 'hubspot',
273
- resource: 'tickets',
274
- action: 'create',
275
- enableMock: true,
276
- }),
277
- };
278
- exports.twilio = {
279
- sendWhatsApp: () => createConnectorTool({
280
- connector: 'twilio',
281
- resource: 'messages',
282
- action: 'send-whatsapp',
283
- enableMock: true,
284
- }),
285
- sendSMS: () => createConnectorTool({
286
- connector: 'twilio',
287
- resource: 'messages',
288
- action: 'send-sms',
289
- enableMock: true,
290
- }),
291
- };
292
- exports.email = {
293
- send: () => createConnectorTool({
294
- connector: 'email',
295
- resource: 'messages',
296
- action: 'send',
297
- enableMock: true,
298
- }),
299
- };
300
- exports.slack = {
301
- sendMessage: () => createConnectorTool({
302
- connector: 'slack',
303
- resource: 'messages',
304
- action: 'send',
305
- enableMock: true,
306
- }),
307
- };
308
337
  //# sourceMappingURL=connector-creator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"connector-creator.js","sourceRoot":"","sources":["../../src/connectors/connector-creator.ts"],"names":[],"mappings":";;;AAmBA,kDAqGC;AAkMD,sCAYC;AAtUD,6BAAwB;AACxB,wDAAmD;AAGnD,+EAA+E;AAC/E,0BAA0B;AAC1B,+EAA+E;AAE/E,MAAM,WAAW,GAAG,IAAI,GAAG,EAKvB,CAAC;AAEL,+EAA+E;AAC/E,uCAAuC;AACvC,+EAA+E;AAE/E,SAAgB,mBAAmB,CAAC,MAMnC;IACC,MAAM,WAAW,GAAG,GAAG,MAAM,CAAC,SAAS,IAAI,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;IAE9E,oCAAoC;IACpC,MAAM,IAAI,GAAG,IAAA,yBAAU,EAAC;QACtB,EAAE,EAAE,WAAW;QACf,WAAW,EAAE,MAAM,CAAC,WAAW,IAAI,WAAW,MAAM,CAAC,MAAM,OAAO,MAAM,CAAC,QAAQ,EAAE;QAEnF,kDAAkD;QAClD,WAAW,EAAE,OAAC,CAAC,GAAG,EAAE;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IAAI;KACjB,CAAC;IAEF,UAAU,EAAE,GAAG,EAAE,CAAC,mBAAmB,CAAC;QACpC,SAAS,EAAE,SAAS;QACpB,QAAQ,EAAE,UAAU;QACpB,MAAM,EAAE,KAAK;QACb,UAAU,EAAE,IAAI;KACjB,CAAC;IAEF,YAAY,EAAE,GAAG,EAAE,CAAC,mBAAmB,CAAC;QACtC,SAAS,EAAE,SAAS;QACpB,QAAQ,EAAE,SAAS;QACnB,MAAM,EAAE,QAAQ;QAChB,UAAU,EAAE,IAAI;KACjB,CAAC;CACH,CAAC;AAEW,QAAA,MAAM,GAAG;IACpB,YAAY,EAAE,GAAG,EAAE,CAAC,mBAAmB,CAAC;QACtC,SAAS,EAAE,QAAQ;QACnB,QAAQ,EAAE,UAAU;QACpB,MAAM,EAAE,eAAe;QACvB,UAAU,EAAE,IAAI;KACjB,CAAC;IAEF,OAAO,EAAE,GAAG,EAAE,CAAC,mBAAmB,CAAC;QACjC,SAAS,EAAE,QAAQ;QACnB,QAAQ,EAAE,UAAU;QACpB,MAAM,EAAE,UAAU;QAClB,UAAU,EAAE,IAAI;KACjB,CAAC;CACH,CAAC;AAEW,QAAA,KAAK,GAAG;IACnB,IAAI,EAAE,GAAG,EAAE,CAAC,mBAAmB,CAAC;QAC9B,SAAS,EAAE,OAAO;QAClB,QAAQ,EAAE,UAAU;QACpB,MAAM,EAAE,MAAM;QACd,UAAU,EAAE,IAAI;KACjB,CAAC;CACH,CAAC;AAEW,QAAA,KAAK,GAAG;IACnB,WAAW,EAAE,GAAG,EAAE,CAAC,mBAAmB,CAAC;QACrC,SAAS,EAAE,OAAO;QAClB,QAAQ,EAAE,UAAU;QACpB,MAAM,EAAE,MAAM;QACd,UAAU,EAAE,IAAI;KACjB,CAAC;CACH,CAAC"}
1
+ {"version":3,"file":"connector-creator.js","sourceRoot":"","sources":["../../src/connectors/connector-creator.ts"],"names":[],"mappings":";;AAsCA,kDA+HC;AAiPD,sCAWC;AAjaD,6BAAwB;AACxB,wDAA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