@squadbase/vite-server 0.1.3-dev.15 → 0.1.3-dev.16
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/dist/cli/index.js +2105 -2700
- package/dist/connectors/airtable-oauth.js +16 -5
- package/dist/connectors/airtable.js +16 -5
- package/dist/connectors/amplitude.js +16 -5
- package/dist/connectors/anthropic.js +16 -5
- package/dist/connectors/asana.js +16 -5
- package/dist/connectors/attio.js +16 -5
- package/dist/connectors/backlog-api-key.js +16 -5
- package/dist/connectors/customerio.js +16 -5
- package/dist/connectors/dbt.js +16 -5
- package/dist/connectors/gamma.js +16 -5
- package/dist/connectors/gemini.js +16 -5
- package/dist/connectors/gmail-oauth.js +16 -5
- package/dist/connectors/gmail.js +68 -34
- package/dist/connectors/google-ads.js +16 -5
- package/dist/connectors/google-analytics-oauth.js +16 -5
- package/dist/connectors/google-analytics.js +16 -5
- package/dist/connectors/google-calendar-oauth.js +16 -5
- package/dist/connectors/google-calendar.js +71 -48
- package/dist/connectors/{google-drive-oauth.d.ts → google-docs.d.ts} +1 -1
- package/dist/connectors/google-docs.js +585 -0
- package/dist/connectors/google-drive.d.ts +1 -1
- package/dist/connectors/google-drive.js +391 -327
- package/dist/connectors/google-sheets.d.ts +1 -1
- package/dist/connectors/google-sheets.js +210 -280
- package/dist/connectors/google-slides.d.ts +1 -1
- package/dist/connectors/google-slides.js +198 -335
- package/dist/connectors/grafana.js +16 -5
- package/dist/connectors/hubspot-oauth.js +16 -5
- package/dist/connectors/hubspot.js +16 -5
- package/dist/connectors/intercom-oauth.js +16 -5
- package/dist/connectors/intercom.js +16 -5
- package/dist/connectors/jira-api-key.js +16 -5
- package/dist/connectors/kintone-api-token.js +133 -59
- package/dist/connectors/kintone.js +16 -5
- package/dist/connectors/linkedin-ads.js +16 -5
- package/dist/connectors/mailchimp-oauth.js +16 -5
- package/dist/connectors/mailchimp.js +16 -5
- package/dist/connectors/mixpanel.js +16 -5
- package/dist/connectors/notion-oauth.js +16 -5
- package/dist/connectors/notion.js +16 -5
- package/dist/connectors/openai.js +16 -5
- package/dist/connectors/sentry.js +16 -5
- package/dist/connectors/shopify-oauth.js +16 -5
- package/dist/connectors/shopify.js +16 -5
- package/dist/connectors/stripe-api-key.js +16 -5
- package/dist/connectors/stripe-oauth.js +16 -5
- package/dist/connectors/wix-store.js +16 -5
- package/dist/connectors/zendesk-oauth.js +16 -5
- package/dist/connectors/zendesk.js +16 -5
- package/dist/index.js +2100 -2695
- package/dist/main.js +2100 -2695
- package/dist/vite-plugin.js +2100 -2695
- package/package.json +7 -15
- package/dist/connectors/google-drive-oauth.js +0 -879
- package/dist/connectors/google-sheets-oauth.d.ts +0 -5
- package/dist/connectors/google-sheets-oauth.js +0 -821
- package/dist/connectors/google-slides-oauth.d.ts +0 -5
- package/dist/connectors/google-slides-oauth.js +0 -742
|
@@ -140,16 +140,27 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
140
140
|
* Filters connections by connectorKey internally.
|
|
141
141
|
* Returns tools keyed as `${connectorKey}_${toolName}`.
|
|
142
142
|
*/
|
|
143
|
-
createTools(connections, config) {
|
|
143
|
+
createTools(connections, config, opts) {
|
|
144
144
|
const myConnections = connections.filter(
|
|
145
145
|
(c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
|
|
146
146
|
);
|
|
147
147
|
const result = {};
|
|
148
148
|
for (const t of Object.values(this.tools)) {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
149
|
+
const tool = t.createTool(myConnections, config);
|
|
150
|
+
const originalToModelOutput = tool.toModelOutput;
|
|
151
|
+
result[`${this.connectorKey}_${t.name}`] = {
|
|
152
|
+
...tool,
|
|
153
|
+
toModelOutput: async (options) => {
|
|
154
|
+
if (!originalToModelOutput) {
|
|
155
|
+
return opts.truncateOutput(options.output);
|
|
156
|
+
}
|
|
157
|
+
const modelOutput = await originalToModelOutput(options);
|
|
158
|
+
if (modelOutput.type === "text" || modelOutput.type === "json") {
|
|
159
|
+
return opts.truncateOutput(modelOutput.value);
|
|
160
|
+
}
|
|
161
|
+
return modelOutput;
|
|
162
|
+
}
|
|
163
|
+
};
|
|
153
164
|
}
|
|
154
165
|
return result;
|
|
155
166
|
}
|
|
@@ -244,16 +244,27 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
244
244
|
* Filters connections by connectorKey internally.
|
|
245
245
|
* Returns tools keyed as `${connectorKey}_${toolName}`.
|
|
246
246
|
*/
|
|
247
|
-
createTools(connections, config) {
|
|
247
|
+
createTools(connections, config, opts) {
|
|
248
248
|
const myConnections = connections.filter(
|
|
249
249
|
(c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
|
|
250
250
|
);
|
|
251
251
|
const result = {};
|
|
252
252
|
for (const t of Object.values(this.tools)) {
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
253
|
+
const tool = t.createTool(myConnections, config);
|
|
254
|
+
const originalToModelOutput = tool.toModelOutput;
|
|
255
|
+
result[`${this.connectorKey}_${t.name}`] = {
|
|
256
|
+
...tool,
|
|
257
|
+
toModelOutput: async (options) => {
|
|
258
|
+
if (!originalToModelOutput) {
|
|
259
|
+
return opts.truncateOutput(options.output);
|
|
260
|
+
}
|
|
261
|
+
const modelOutput = await originalToModelOutput(options);
|
|
262
|
+
if (modelOutput.type === "text" || modelOutput.type === "json") {
|
|
263
|
+
return opts.truncateOutput(modelOutput.value);
|
|
264
|
+
}
|
|
265
|
+
return modelOutput;
|
|
266
|
+
}
|
|
267
|
+
};
|
|
257
268
|
}
|
|
258
269
|
return result;
|
|
259
270
|
}
|
|
@@ -296,16 +296,27 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
296
296
|
* Filters connections by connectorKey internally.
|
|
297
297
|
* Returns tools keyed as `${connectorKey}_${toolName}`.
|
|
298
298
|
*/
|
|
299
|
-
createTools(connections, config) {
|
|
299
|
+
createTools(connections, config, opts) {
|
|
300
300
|
const myConnections = connections.filter(
|
|
301
301
|
(c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
|
|
302
302
|
);
|
|
303
303
|
const result = {};
|
|
304
304
|
for (const t of Object.values(this.tools)) {
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
305
|
+
const tool = t.createTool(myConnections, config);
|
|
306
|
+
const originalToModelOutput = tool.toModelOutput;
|
|
307
|
+
result[`${this.connectorKey}_${t.name}`] = {
|
|
308
|
+
...tool,
|
|
309
|
+
toModelOutput: async (options) => {
|
|
310
|
+
if (!originalToModelOutput) {
|
|
311
|
+
return opts.truncateOutput(options.output);
|
|
312
|
+
}
|
|
313
|
+
const modelOutput = await originalToModelOutput(options);
|
|
314
|
+
if (modelOutput.type === "text" || modelOutput.type === "json") {
|
|
315
|
+
return opts.truncateOutput(modelOutput.value);
|
|
316
|
+
}
|
|
317
|
+
return modelOutput;
|
|
318
|
+
}
|
|
319
|
+
};
|
|
309
320
|
}
|
|
310
321
|
return result;
|
|
311
322
|
}
|
|
@@ -94,16 +94,27 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
94
94
|
* Filters connections by connectorKey internally.
|
|
95
95
|
* Returns tools keyed as `${connectorKey}_${toolName}`.
|
|
96
96
|
*/
|
|
97
|
-
createTools(connections, config) {
|
|
97
|
+
createTools(connections, config, opts) {
|
|
98
98
|
const myConnections = connections.filter(
|
|
99
99
|
(c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
|
|
100
100
|
);
|
|
101
101
|
const result = {};
|
|
102
102
|
for (const t of Object.values(this.tools)) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
103
|
+
const tool = t.createTool(myConnections, config);
|
|
104
|
+
const originalToModelOutput = tool.toModelOutput;
|
|
105
|
+
result[`${this.connectorKey}_${t.name}`] = {
|
|
106
|
+
...tool,
|
|
107
|
+
toModelOutput: async (options) => {
|
|
108
|
+
if (!originalToModelOutput) {
|
|
109
|
+
return opts.truncateOutput(options.output);
|
|
110
|
+
}
|
|
111
|
+
const modelOutput = await originalToModelOutput(options);
|
|
112
|
+
if (modelOutput.type === "text" || modelOutput.type === "json") {
|
|
113
|
+
return opts.truncateOutput(modelOutput.value);
|
|
114
|
+
}
|
|
115
|
+
return modelOutput;
|
|
116
|
+
}
|
|
117
|
+
};
|
|
107
118
|
}
|
|
108
119
|
return result;
|
|
109
120
|
}
|
|
@@ -246,16 +246,27 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
246
246
|
* Filters connections by connectorKey internally.
|
|
247
247
|
* Returns tools keyed as `${connectorKey}_${toolName}`.
|
|
248
248
|
*/
|
|
249
|
-
createTools(connections, config) {
|
|
249
|
+
createTools(connections, config, opts) {
|
|
250
250
|
const myConnections = connections.filter(
|
|
251
251
|
(c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
|
|
252
252
|
);
|
|
253
253
|
const result = {};
|
|
254
254
|
for (const t of Object.values(this.tools)) {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
255
|
+
const tool = t.createTool(myConnections, config);
|
|
256
|
+
const originalToModelOutput = tool.toModelOutput;
|
|
257
|
+
result[`${this.connectorKey}_${t.name}`] = {
|
|
258
|
+
...tool,
|
|
259
|
+
toModelOutput: async (options) => {
|
|
260
|
+
if (!originalToModelOutput) {
|
|
261
|
+
return opts.truncateOutput(options.output);
|
|
262
|
+
}
|
|
263
|
+
const modelOutput = await originalToModelOutput(options);
|
|
264
|
+
if (modelOutput.type === "text" || modelOutput.type === "json") {
|
|
265
|
+
return opts.truncateOutput(modelOutput.value);
|
|
266
|
+
}
|
|
267
|
+
return modelOutput;
|
|
268
|
+
}
|
|
269
|
+
};
|
|
259
270
|
}
|
|
260
271
|
return result;
|
|
261
272
|
}
|
|
@@ -106,16 +106,27 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
106
106
|
* Filters connections by connectorKey internally.
|
|
107
107
|
* Returns tools keyed as `${connectorKey}_${toolName}`.
|
|
108
108
|
*/
|
|
109
|
-
createTools(connections, config) {
|
|
109
|
+
createTools(connections, config, opts) {
|
|
110
110
|
const myConnections = connections.filter(
|
|
111
111
|
(c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
|
|
112
112
|
);
|
|
113
113
|
const result = {};
|
|
114
114
|
for (const t of Object.values(this.tools)) {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
115
|
+
const tool = t.createTool(myConnections, config);
|
|
116
|
+
const originalToModelOutput = tool.toModelOutput;
|
|
117
|
+
result[`${this.connectorKey}_${t.name}`] = {
|
|
118
|
+
...tool,
|
|
119
|
+
toModelOutput: async (options) => {
|
|
120
|
+
if (!originalToModelOutput) {
|
|
121
|
+
return opts.truncateOutput(options.output);
|
|
122
|
+
}
|
|
123
|
+
const modelOutput = await originalToModelOutput(options);
|
|
124
|
+
if (modelOutput.type === "text" || modelOutput.type === "json") {
|
|
125
|
+
return opts.truncateOutput(modelOutput.value);
|
|
126
|
+
}
|
|
127
|
+
return modelOutput;
|
|
128
|
+
}
|
|
129
|
+
};
|
|
119
130
|
}
|
|
120
131
|
return result;
|
|
121
132
|
}
|
|
@@ -250,16 +250,27 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
250
250
|
* Filters connections by connectorKey internally.
|
|
251
251
|
* Returns tools keyed as `${connectorKey}_${toolName}`.
|
|
252
252
|
*/
|
|
253
|
-
createTools(connections, config) {
|
|
253
|
+
createTools(connections, config, opts) {
|
|
254
254
|
const myConnections = connections.filter(
|
|
255
255
|
(c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
|
|
256
256
|
);
|
|
257
257
|
const result = {};
|
|
258
258
|
for (const t of Object.values(this.tools)) {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
259
|
+
const tool = t.createTool(myConnections, config);
|
|
260
|
+
const originalToModelOutput = tool.toModelOutput;
|
|
261
|
+
result[`${this.connectorKey}_${t.name}`] = {
|
|
262
|
+
...tool,
|
|
263
|
+
toModelOutput: async (options) => {
|
|
264
|
+
if (!originalToModelOutput) {
|
|
265
|
+
return opts.truncateOutput(options.output);
|
|
266
|
+
}
|
|
267
|
+
const modelOutput = await originalToModelOutput(options);
|
|
268
|
+
if (modelOutput.type === "text" || modelOutput.type === "json") {
|
|
269
|
+
return opts.truncateOutput(modelOutput.value);
|
|
270
|
+
}
|
|
271
|
+
return modelOutput;
|
|
272
|
+
}
|
|
273
|
+
};
|
|
263
274
|
}
|
|
264
275
|
return result;
|
|
265
276
|
}
|
|
@@ -88,16 +88,27 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
88
88
|
* Filters connections by connectorKey internally.
|
|
89
89
|
* Returns tools keyed as `${connectorKey}_${toolName}`.
|
|
90
90
|
*/
|
|
91
|
-
createTools(connections, config) {
|
|
91
|
+
createTools(connections, config, opts) {
|
|
92
92
|
const myConnections = connections.filter(
|
|
93
93
|
(c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
|
|
94
94
|
);
|
|
95
95
|
const result = {};
|
|
96
96
|
for (const t of Object.values(this.tools)) {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
97
|
+
const tool = t.createTool(myConnections, config);
|
|
98
|
+
const originalToModelOutput = tool.toModelOutput;
|
|
99
|
+
result[`${this.connectorKey}_${t.name}`] = {
|
|
100
|
+
...tool,
|
|
101
|
+
toModelOutput: async (options) => {
|
|
102
|
+
if (!originalToModelOutput) {
|
|
103
|
+
return opts.truncateOutput(options.output);
|
|
104
|
+
}
|
|
105
|
+
const modelOutput = await originalToModelOutput(options);
|
|
106
|
+
if (modelOutput.type === "text" || modelOutput.type === "json") {
|
|
107
|
+
return opts.truncateOutput(modelOutput.value);
|
|
108
|
+
}
|
|
109
|
+
return modelOutput;
|
|
110
|
+
}
|
|
111
|
+
};
|
|
101
112
|
}
|
|
102
113
|
return result;
|
|
103
114
|
}
|
|
@@ -362,16 +362,27 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
362
362
|
* Filters connections by connectorKey internally.
|
|
363
363
|
* Returns tools keyed as `${connectorKey}_${toolName}`.
|
|
364
364
|
*/
|
|
365
|
-
createTools(connections, config) {
|
|
365
|
+
createTools(connections, config, opts) {
|
|
366
366
|
const myConnections = connections.filter(
|
|
367
367
|
(c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
|
|
368
368
|
);
|
|
369
369
|
const result = {};
|
|
370
370
|
for (const t of Object.values(this.tools)) {
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
371
|
+
const tool = t.createTool(myConnections, config);
|
|
372
|
+
const originalToModelOutput = tool.toModelOutput;
|
|
373
|
+
result[`${this.connectorKey}_${t.name}`] = {
|
|
374
|
+
...tool,
|
|
375
|
+
toModelOutput: async (options) => {
|
|
376
|
+
if (!originalToModelOutput) {
|
|
377
|
+
return opts.truncateOutput(options.output);
|
|
378
|
+
}
|
|
379
|
+
const modelOutput = await originalToModelOutput(options);
|
|
380
|
+
if (modelOutput.type === "text" || modelOutput.type === "json") {
|
|
381
|
+
return opts.truncateOutput(modelOutput.value);
|
|
382
|
+
}
|
|
383
|
+
return modelOutput;
|
|
384
|
+
}
|
|
385
|
+
};
|
|
375
386
|
}
|
|
376
387
|
return result;
|
|
377
388
|
}
|
|
@@ -156,16 +156,27 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
156
156
|
* Filters connections by connectorKey internally.
|
|
157
157
|
* Returns tools keyed as `${connectorKey}_${toolName}`.
|
|
158
158
|
*/
|
|
159
|
-
createTools(connections, config) {
|
|
159
|
+
createTools(connections, config, opts) {
|
|
160
160
|
const myConnections = connections.filter(
|
|
161
161
|
(c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
|
|
162
162
|
);
|
|
163
163
|
const result = {};
|
|
164
164
|
for (const t of Object.values(this.tools)) {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
165
|
+
const tool = t.createTool(myConnections, config);
|
|
166
|
+
const originalToModelOutput = tool.toModelOutput;
|
|
167
|
+
result[`${this.connectorKey}_${t.name}`] = {
|
|
168
|
+
...tool,
|
|
169
|
+
toModelOutput: async (options) => {
|
|
170
|
+
if (!originalToModelOutput) {
|
|
171
|
+
return opts.truncateOutput(options.output);
|
|
172
|
+
}
|
|
173
|
+
const modelOutput = await originalToModelOutput(options);
|
|
174
|
+
if (modelOutput.type === "text" || modelOutput.type === "json") {
|
|
175
|
+
return opts.truncateOutput(modelOutput.value);
|
|
176
|
+
}
|
|
177
|
+
return modelOutput;
|
|
178
|
+
}
|
|
179
|
+
};
|
|
169
180
|
}
|
|
170
181
|
return result;
|
|
171
182
|
}
|
|
@@ -90,16 +90,27 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
90
90
|
* Filters connections by connectorKey internally.
|
|
91
91
|
* Returns tools keyed as `${connectorKey}_${toolName}`.
|
|
92
92
|
*/
|
|
93
|
-
createTools(connections, config) {
|
|
93
|
+
createTools(connections, config, opts) {
|
|
94
94
|
const myConnections = connections.filter(
|
|
95
95
|
(c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
|
|
96
96
|
);
|
|
97
97
|
const result = {};
|
|
98
98
|
for (const t of Object.values(this.tools)) {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
99
|
+
const tool = t.createTool(myConnections, config);
|
|
100
|
+
const originalToModelOutput = tool.toModelOutput;
|
|
101
|
+
result[`${this.connectorKey}_${t.name}`] = {
|
|
102
|
+
...tool,
|
|
103
|
+
toModelOutput: async (options) => {
|
|
104
|
+
if (!originalToModelOutput) {
|
|
105
|
+
return opts.truncateOutput(options.output);
|
|
106
|
+
}
|
|
107
|
+
const modelOutput = await originalToModelOutput(options);
|
|
108
|
+
if (modelOutput.type === "text" || modelOutput.type === "json") {
|
|
109
|
+
return opts.truncateOutput(modelOutput.value);
|
|
110
|
+
}
|
|
111
|
+
return modelOutput;
|
|
112
|
+
}
|
|
113
|
+
};
|
|
103
114
|
}
|
|
104
115
|
return result;
|
|
105
116
|
}
|
|
@@ -281,16 +281,27 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
281
281
|
* Filters connections by connectorKey internally.
|
|
282
282
|
* Returns tools keyed as `${connectorKey}_${toolName}`.
|
|
283
283
|
*/
|
|
284
|
-
createTools(connections, config) {
|
|
284
|
+
createTools(connections, config, opts) {
|
|
285
285
|
const myConnections = connections.filter(
|
|
286
286
|
(c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
|
|
287
287
|
);
|
|
288
288
|
const result = {};
|
|
289
289
|
for (const t of Object.values(this.tools)) {
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
290
|
+
const tool = t.createTool(myConnections, config);
|
|
291
|
+
const originalToModelOutput = tool.toModelOutput;
|
|
292
|
+
result[`${this.connectorKey}_${t.name}`] = {
|
|
293
|
+
...tool,
|
|
294
|
+
toModelOutput: async (options) => {
|
|
295
|
+
if (!originalToModelOutput) {
|
|
296
|
+
return opts.truncateOutput(options.output);
|
|
297
|
+
}
|
|
298
|
+
const modelOutput = await originalToModelOutput(options);
|
|
299
|
+
if (modelOutput.type === "text" || modelOutput.type === "json") {
|
|
300
|
+
return opts.truncateOutput(modelOutput.value);
|
|
301
|
+
}
|
|
302
|
+
return modelOutput;
|
|
303
|
+
}
|
|
304
|
+
};
|
|
294
305
|
}
|
|
295
306
|
return result;
|
|
296
307
|
}
|
|
@@ -88,16 +88,27 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
88
88
|
* Filters connections by connectorKey internally.
|
|
89
89
|
* Returns tools keyed as `${connectorKey}_${toolName}`.
|
|
90
90
|
*/
|
|
91
|
-
createTools(connections, config) {
|
|
91
|
+
createTools(connections, config, opts) {
|
|
92
92
|
const myConnections = connections.filter(
|
|
93
93
|
(c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
|
|
94
94
|
);
|
|
95
95
|
const result = {};
|
|
96
96
|
for (const t of Object.values(this.tools)) {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
97
|
+
const tool = t.createTool(myConnections, config);
|
|
98
|
+
const originalToModelOutput = tool.toModelOutput;
|
|
99
|
+
result[`${this.connectorKey}_${t.name}`] = {
|
|
100
|
+
...tool,
|
|
101
|
+
toModelOutput: async (options) => {
|
|
102
|
+
if (!originalToModelOutput) {
|
|
103
|
+
return opts.truncateOutput(options.output);
|
|
104
|
+
}
|
|
105
|
+
const modelOutput = await originalToModelOutput(options);
|
|
106
|
+
if (modelOutput.type === "text" || modelOutput.type === "json") {
|
|
107
|
+
return opts.truncateOutput(modelOutput.value);
|
|
108
|
+
}
|
|
109
|
+
return modelOutput;
|
|
110
|
+
}
|
|
111
|
+
};
|
|
101
112
|
}
|
|
102
113
|
return result;
|
|
103
114
|
}
|
|
@@ -263,16 +263,27 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
263
263
|
* Filters connections by connectorKey internally.
|
|
264
264
|
* Returns tools keyed as `${connectorKey}_${toolName}`.
|
|
265
265
|
*/
|
|
266
|
-
createTools(connections, config) {
|
|
266
|
+
createTools(connections, config, opts) {
|
|
267
267
|
const myConnections = connections.filter(
|
|
268
268
|
(c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
|
|
269
269
|
);
|
|
270
270
|
const result = {};
|
|
271
271
|
for (const t of Object.values(this.tools)) {
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
272
|
+
const tool = t.createTool(myConnections, config);
|
|
273
|
+
const originalToModelOutput = tool.toModelOutput;
|
|
274
|
+
result[`${this.connectorKey}_${t.name}`] = {
|
|
275
|
+
...tool,
|
|
276
|
+
toModelOutput: async (options) => {
|
|
277
|
+
if (!originalToModelOutput) {
|
|
278
|
+
return opts.truncateOutput(options.output);
|
|
279
|
+
}
|
|
280
|
+
const modelOutput = await originalToModelOutput(options);
|
|
281
|
+
if (modelOutput.type === "text" || modelOutput.type === "json") {
|
|
282
|
+
return opts.truncateOutput(modelOutput.value);
|
|
283
|
+
}
|
|
284
|
+
return modelOutput;
|
|
285
|
+
}
|
|
286
|
+
};
|
|
276
287
|
}
|
|
277
288
|
return result;
|
|
278
289
|
}
|