@squadbase/vite-server 0.1.17-dev.24af54e → 0.1.17-dev.423ee34

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 (77) hide show
  1. package/dist/cli/index.js +4873 -1073
  2. package/dist/connectors/airtable-oauth.js +78 -11
  3. package/dist/connectors/airtable.js +74 -11
  4. package/dist/connectors/amplitude.js +38 -11
  5. package/dist/connectors/anthropic.js +4 -2
  6. package/dist/connectors/asana.js +67 -13
  7. package/dist/connectors/attio.js +60 -16
  8. package/dist/connectors/aws-billing.js +38 -11
  9. package/dist/connectors/azure-sql.js +64 -13
  10. package/dist/connectors/backlog-api-key.js +70 -18
  11. package/dist/connectors/clickup.js +80 -13
  12. package/dist/connectors/cosmosdb.js +42 -15
  13. package/dist/connectors/customerio.js +39 -12
  14. package/dist/connectors/dbt.js +716 -28
  15. package/dist/connectors/freshdesk.js +112 -11
  16. package/dist/connectors/freshsales.js +38 -11
  17. package/dist/connectors/freshservice.js +38 -11
  18. package/dist/connectors/gamma.js +47 -20
  19. package/dist/connectors/gemini.js +4 -2
  20. package/dist/connectors/github.js +42 -15
  21. package/dist/connectors/gmail-oauth.js +38 -13
  22. package/dist/connectors/gmail.js +34 -7
  23. package/dist/connectors/google-ads.js +38 -11
  24. package/dist/connectors/google-analytics-oauth.js +182 -28
  25. package/dist/connectors/google-analytics.js +653 -104
  26. package/dist/connectors/google-audit-log.js +34 -7
  27. package/dist/connectors/google-calendar-oauth.js +91 -18
  28. package/dist/connectors/google-calendar.js +91 -14
  29. package/dist/connectors/google-docs.js +38 -13
  30. package/dist/connectors/google-drive.js +60 -13
  31. package/dist/connectors/google-search-console-oauth.js +156 -20
  32. package/dist/connectors/google-sheets.js +36 -9
  33. package/dist/connectors/google-slides.js +38 -13
  34. package/dist/connectors/grafana.js +75 -13
  35. package/dist/connectors/hubspot-oauth.js +69 -12
  36. package/dist/connectors/hubspot.js +55 -12
  37. package/dist/connectors/influxdb.js +38 -11
  38. package/dist/connectors/intercom-oauth.js +100 -15
  39. package/dist/connectors/intercom.js +42 -15
  40. package/dist/connectors/jdbc.js +36 -9
  41. package/dist/connectors/jira-api-key.js +98 -14
  42. package/dist/connectors/kintone-api-token.js +96 -21
  43. package/dist/connectors/kintone.js +84 -14
  44. package/dist/connectors/linear.js +84 -15
  45. package/dist/connectors/linkedin-ads.js +71 -17
  46. package/dist/connectors/mailchimp-oauth.js +36 -9
  47. package/dist/connectors/mailchimp.js +36 -9
  48. package/dist/connectors/meta-ads-oauth.js +63 -17
  49. package/dist/connectors/meta-ads.js +65 -17
  50. package/dist/connectors/mixpanel.js +38 -11
  51. package/dist/connectors/monday.js +39 -12
  52. package/dist/connectors/mongodb.js +38 -11
  53. package/dist/connectors/notion-oauth.js +88 -14
  54. package/dist/connectors/notion.js +90 -14
  55. package/dist/connectors/openai.js +4 -2
  56. package/dist/connectors/oracle.js +78 -20
  57. package/dist/connectors/outlook-oauth.js +48 -23
  58. package/dist/connectors/powerbi-oauth.js +321 -49
  59. package/dist/connectors/salesforce.js +72 -12
  60. package/dist/connectors/semrush.js +374 -52
  61. package/dist/connectors/sentry.js +66 -13
  62. package/dist/connectors/shopify-oauth.js +71 -13
  63. package/dist/connectors/shopify.js +38 -11
  64. package/dist/connectors/sqlserver.js +64 -13
  65. package/dist/connectors/stripe-api-key.js +96 -18
  66. package/dist/connectors/stripe-oauth.js +98 -22
  67. package/dist/connectors/supabase.js +55 -11
  68. package/dist/connectors/tableau.js +262 -92
  69. package/dist/connectors/tiktok-ads.js +67 -19
  70. package/dist/connectors/wix-store.js +38 -11
  71. package/dist/connectors/zendesk-oauth.js +83 -15
  72. package/dist/connectors/zendesk.js +42 -15
  73. package/dist/index.d.ts +1 -0
  74. package/dist/index.js +4902 -1077
  75. package/dist/main.js +4891 -1071
  76. package/dist/vite-plugin.js +4871 -1071
  77. package/package.json +1 -1
@@ -16,6 +16,7 @@ var init_parameter_definition = __esm({
16
16
  type;
17
17
  secret;
18
18
  required;
19
+ isDeprecated;
19
20
  constructor(config) {
20
21
  this.slug = config.slug;
21
22
  this.name = config.name;
@@ -24,6 +25,7 @@ var init_parameter_definition = __esm({
24
25
  this.type = config.type;
25
26
  this.secret = config.secret;
26
27
  this.required = config.required;
28
+ this.isDeprecated = config.isDeprecated ?? false;
27
29
  }
28
30
  /**
29
31
  * Get the parameter value from a ConnectorConnectionObject.
@@ -192,7 +194,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
192
194
  /**
193
195
  * Create tools for connections that belong to this connector.
194
196
  * Filters connections by connectorKey internally.
195
- * Returns tools keyed as `${connectorKey}_${toolName}`.
197
+ * Returns tools keyed as `connector_${connectorKey}_${toolName}`.
196
198
  */
197
199
  createTools(connections, config, opts) {
198
200
  const myConnections = connections.filter(
@@ -202,7 +204,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
202
204
  for (const t of Object.values(this.tools)) {
203
205
  const tool = t.createTool(myConnections, config);
204
206
  const originalToModelOutput = tool.toModelOutput;
205
- result[`${this.connectorKey}_${t.name}`] = {
207
+ result[`connector_${this.connectorKey}_${t.name}`] = {
206
208
  ...tool,
207
209
  toModelOutput: async (options) => {
208
210
  if (!originalToModelOutput) {
@@ -258,19 +260,34 @@ async function runSetupFlow(flow, params, ctx, config) {
258
260
  };
259
261
  let state = flow.initialState();
260
262
  let answerIdx = 0;
263
+ const pendingParameterUpdates = [];
261
264
  for (const step of flow.steps) {
262
265
  const ans = ctx.answers[answerIdx];
263
266
  if (ans && ans.questionSlug === step.slug) {
264
267
  state = step.applyAnswer(state, ans.answer);
268
+ if (step.toParameterUpdates) {
269
+ pendingParameterUpdates.push(...step.toParameterUpdates(state));
270
+ }
265
271
  answerIdx += 1;
266
272
  continue;
267
273
  }
274
+ const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
268
275
  if (step.type === "text") {
276
+ if (step.fetchOptions) {
277
+ const options2 = await step.fetchOptions(state, runtime);
278
+ if (options2.length === 0) {
279
+ continue;
280
+ }
281
+ }
269
282
  return {
270
283
  type: "nextQuestion",
271
284
  questionSlug: step.slug,
272
285
  question: step.question[ctx.language],
273
- questionType: "text"
286
+ questionType: "text",
287
+ allowFreeText: resolvedAllowFreeText,
288
+ ...pendingParameterUpdates.length > 0 && {
289
+ parameterUpdates: pendingParameterUpdates
290
+ }
274
291
  };
275
292
  }
276
293
  const options = step.fetchOptions ? await step.fetchOptions(state, runtime) : [];
@@ -282,11 +299,21 @@ async function runSetupFlow(flow, params, ctx, config) {
282
299
  questionSlug: step.slug,
283
300
  question: step.question[ctx.language],
284
301
  questionType: step.type,
285
- options
302
+ options,
303
+ allowFreeText: resolvedAllowFreeText,
304
+ ...pendingParameterUpdates.length > 0 && {
305
+ parameterUpdates: pendingParameterUpdates
306
+ }
286
307
  };
287
308
  }
288
309
  const dataInvestigationResult = await flow.finalize(state, runtime);
289
- return { type: "fulfilled", dataInvestigationResult };
310
+ return {
311
+ type: "fulfilled",
312
+ dataInvestigationResult,
313
+ ...pendingParameterUpdates.length > 0 && {
314
+ parameterUpdates: pendingParameterUpdates
315
+ }
316
+ };
290
317
  }
291
318
 
292
319
  // ../connectors/src/auth-types.ts
@@ -462,16 +489,16 @@ var ENTITY_LABELS = {
462
489
  }
463
490
  };
464
491
  var ENTITY_PATHS = {
465
- customers: "/v1/customers?limit=1",
466
- charges: "/v1/charges?limit=1",
467
- invoices: "/v1/invoices?limit=1",
468
- subscriptions: "/v1/subscriptions?limit=1",
469
- products: "/v1/products?limit=1",
470
- prices: "/v1/prices?limit=1",
471
- payouts: "/v1/payouts?limit=1",
472
- refunds: "/v1/refunds?limit=1",
473
- disputes: "/v1/disputes?limit=1",
474
- paymentIntents: "/v1/payment_intents?limit=1"
492
+ customers: "/v1/customers?limit=3",
493
+ charges: "/v1/charges?limit=3",
494
+ invoices: "/v1/invoices?limit=3",
495
+ subscriptions: "/v1/subscriptions?limit=3",
496
+ products: "/v1/products?limit=3",
497
+ prices: "/v1/prices?limit=3",
498
+ payouts: "/v1/payouts?limit=3",
499
+ refunds: "/v1/refunds?limit=3",
500
+ disputes: "/v1/disputes?limit=3",
501
+ paymentIntents: "/v1/payment_intents?limit=3"
475
502
  };
476
503
  var ENTITY_VALUES = Object.keys(ENTITY_PATHS);
477
504
  async function defaultFetchEntity(params, path2) {
@@ -507,6 +534,7 @@ function createStripeSetupFlow(fetchEntity = defaultFetchEntity, labelPrefix = "
507
534
  const sections = [`## ${labelPrefix}`, ""];
508
535
  for (const entity of selected) {
509
536
  let count = "available";
537
+ let sampleRows = [];
510
538
  const res = await fetchEntity(rt.params, ENTITY_PATHS[entity]);
511
539
  if (res.ok) {
512
540
  const data = await res.json();
@@ -515,13 +543,63 @@ function createStripeSetupFlow(fetchEntity = defaultFetchEntity, labelPrefix = "
515
543
  } else if (data.has_more === false) {
516
544
  count = String(data.data?.length ?? 1);
517
545
  } else if (Array.isArray(data.data)) {
518
- count = "1+ (paginated)";
546
+ count = "many (paginated)";
519
547
  }
548
+ sampleRows = (data.data ?? []).slice(0, 3);
520
549
  } else {
521
550
  count = "unavailable";
522
551
  }
523
552
  sections.push(`### ${ENTITY_LABELS[entity].en}`, "");
524
553
  sections.push(`Status: ${count}`, "");
554
+ if ((entity === "charges" || entity === "paymentIntents") && sampleRows.length > 0) {
555
+ sections.push("**Recent sample:**", "");
556
+ sections.push("| ID | Amount | Currency | Status | Created |");
557
+ sections.push("|----|--------|----------|--------|---------|");
558
+ for (const row of sampleRows) {
559
+ const id = String(row["id"] ?? "-").replace(/\|/g, "\\|");
560
+ const amount = typeof row["amount"] === "number" ? (row["amount"] / 100).toFixed(2) : "-";
561
+ const currency = String(row["currency"] ?? "-");
562
+ const status = String(row["status"] ?? "-");
563
+ const created = typeof row["created"] === "number" ? new Date(row["created"] * 1e3).toISOString().slice(0, 10) : "-";
564
+ sections.push(
565
+ `| ${id} | ${amount} | ${currency} | ${status} | ${created} |`
566
+ );
567
+ }
568
+ sections.push("");
569
+ }
570
+ if (entity === "invoices" && sampleRows.length > 0) {
571
+ sections.push("**Recent sample:**", "");
572
+ sections.push("| ID | Total | Currency | Status | Created |");
573
+ sections.push("|----|-------|----------|--------|---------|");
574
+ for (const row of sampleRows) {
575
+ const id = String(row["id"] ?? "-").replace(/\|/g, "\\|");
576
+ const total = typeof row["total"] === "number" ? (row["total"] / 100).toFixed(2) : "-";
577
+ const currency = String(row["currency"] ?? "-");
578
+ const status = String(row["status"] ?? "-");
579
+ const created = typeof row["created"] === "number" ? new Date(row["created"] * 1e3).toISOString().slice(0, 10) : "-";
580
+ sections.push(
581
+ `| ${id} | ${total} | ${currency} | ${status} | ${created} |`
582
+ );
583
+ }
584
+ sections.push("");
585
+ }
586
+ if (entity === "subscriptions" && sampleRows.length > 0) {
587
+ sections.push("**Recent sample:**", "");
588
+ sections.push("| ID | Status | Currency | Interval | Created |");
589
+ sections.push("|----|--------|----------|----------|---------|");
590
+ for (const row of sampleRows) {
591
+ const id = String(row["id"] ?? "-").replace(/\|/g, "\\|");
592
+ const status = String(row["status"] ?? "-");
593
+ const currency = String(row["currency"] ?? "-");
594
+ const items = row["items"];
595
+ const interval = items?.data?.[0]?.plan?.interval ?? "-";
596
+ const created = typeof row["created"] === "number" ? new Date(row["created"] * 1e3).toISOString().slice(0, 10) : "-";
597
+ sections.push(
598
+ `| ${id} | ${status} | ${currency} | ${interval} | ${created} |`
599
+ );
600
+ }
601
+ sections.push("");
602
+ }
525
603
  }
526
604
  return sections.join("\n");
527
605
  }
@@ -544,7 +622,7 @@ var stripeApiKeyConnector = new ConnectorPlugin({
544
622
  systemPrompt: {
545
623
  en: `### Tools
546
624
 
547
- - \`stripe-api-key_request\`: The only way to call the Stripe API. Use it to query charges, customers, invoices, subscriptions, products, prices, payment intents, balances, and more. Authentication is configured automatically using the API Key (Bearer token). Stripe uses cursor-based pagination with \`starting_after\` and \`has_more\`.
625
+ - \`connector_stripe-api-key_request\`: The only way to call the Stripe API. Use it to query charges, customers, invoices, subscriptions, products, prices, payment intents, balances, and more. Authentication is configured automatically using the API Key (Bearer token). Stripe uses cursor-based pagination with \`starting_after\` and \`has_more\`.
548
626
 
549
627
  ### Stripe API Reference
550
628
 
@@ -595,7 +673,7 @@ const data = await res.json();
595
673
  \`\`\``,
596
674
  ja: `### \u30C4\u30FC\u30EB
597
675
 
598
- - \`stripe-api-key_request\`: Stripe API\u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u8ACB\u6C42\u3001\u9867\u5BA2\u3001\u8ACB\u6C42\u66F8\u3001\u30B5\u30D6\u30B9\u30AF\u30EA\u30D7\u30B7\u30E7\u30F3\u3001\u5546\u54C1\u3001\u4FA1\u683C\u3001\u652F\u6255\u3044\u30A4\u30F3\u30C6\u30F3\u30C8\u3001\u6B8B\u9AD8\u306A\u3069\u306E\u30AF\u30A8\u30EA\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002API\u30AD\u30FC\uFF08Bearer\u30C8\u30FC\u30AF\u30F3\uFF09\u3067\u8A8D\u8A3C\u306F\u81EA\u52D5\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002Stripe\u306F \`starting_after\` \u3068 \`has_more\` \u306B\u3088\u308B\u30AB\u30FC\u30BD\u30EB\u30D9\u30FC\u30B9\u306E\u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\u3092\u4F7F\u7528\u3057\u307E\u3059\u3002
676
+ - \`connector_stripe-api-key_request\`: Stripe API\u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u8ACB\u6C42\u3001\u9867\u5BA2\u3001\u8ACB\u6C42\u66F8\u3001\u30B5\u30D6\u30B9\u30AF\u30EA\u30D7\u30B7\u30E7\u30F3\u3001\u5546\u54C1\u3001\u4FA1\u683C\u3001\u652F\u6255\u3044\u30A4\u30F3\u30C6\u30F3\u30C8\u3001\u6B8B\u9AD8\u306A\u3069\u306E\u30AF\u30A8\u30EA\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002API\u30AD\u30FC\uFF08Bearer\u30C8\u30FC\u30AF\u30F3\uFF09\u3067\u8A8D\u8A3C\u306F\u81EA\u52D5\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002Stripe\u306F \`starting_after\` \u3068 \`has_more\` \u306B\u3088\u308B\u30AB\u30FC\u30BD\u30EB\u30D9\u30FC\u30B9\u306E\u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\u3092\u4F7F\u7528\u3057\u307E\u3059\u3002
599
677
 
600
678
  ### Stripe API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
601
679
 
@@ -114,7 +114,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
114
114
  /**
115
115
  * Create tools for connections that belong to this connector.
116
116
  * Filters connections by connectorKey internally.
117
- * Returns tools keyed as `${connectorKey}_${toolName}`.
117
+ * Returns tools keyed as `connector_${connectorKey}_${toolName}`.
118
118
  */
119
119
  createTools(connections, config, opts) {
120
120
  const myConnections = connections.filter(
@@ -124,7 +124,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
124
124
  for (const t of Object.values(this.tools)) {
125
125
  const tool = t.createTool(myConnections, config);
126
126
  const originalToModelOutput = tool.toModelOutput;
127
- result[`${this.connectorKey}_${t.name}`] = {
127
+ result[`connector_${this.connectorKey}_${t.name}`] = {
128
128
  ...tool,
129
129
  toModelOutput: async (options) => {
130
130
  if (!originalToModelOutput) {
@@ -180,19 +180,34 @@ async function runSetupFlow(flow, params, ctx, config) {
180
180
  };
181
181
  let state = flow.initialState();
182
182
  let answerIdx = 0;
183
+ const pendingParameterUpdates = [];
183
184
  for (const step of flow.steps) {
184
185
  const ans = ctx.answers[answerIdx];
185
186
  if (ans && ans.questionSlug === step.slug) {
186
187
  state = step.applyAnswer(state, ans.answer);
188
+ if (step.toParameterUpdates) {
189
+ pendingParameterUpdates.push(...step.toParameterUpdates(state));
190
+ }
187
191
  answerIdx += 1;
188
192
  continue;
189
193
  }
194
+ const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
190
195
  if (step.type === "text") {
196
+ if (step.fetchOptions) {
197
+ const options2 = await step.fetchOptions(state, runtime);
198
+ if (options2.length === 0) {
199
+ continue;
200
+ }
201
+ }
191
202
  return {
192
203
  type: "nextQuestion",
193
204
  questionSlug: step.slug,
194
205
  question: step.question[ctx.language],
195
- questionType: "text"
206
+ questionType: "text",
207
+ allowFreeText: resolvedAllowFreeText,
208
+ ...pendingParameterUpdates.length > 0 && {
209
+ parameterUpdates: pendingParameterUpdates
210
+ }
196
211
  };
197
212
  }
198
213
  const options = step.fetchOptions ? await step.fetchOptions(state, runtime) : [];
@@ -204,11 +219,21 @@ async function runSetupFlow(flow, params, ctx, config) {
204
219
  questionSlug: step.slug,
205
220
  question: step.question[ctx.language],
206
221
  questionType: step.type,
207
- options
222
+ options,
223
+ allowFreeText: resolvedAllowFreeText,
224
+ ...pendingParameterUpdates.length > 0 && {
225
+ parameterUpdates: pendingParameterUpdates
226
+ }
208
227
  };
209
228
  }
210
229
  const dataInvestigationResult = await flow.finalize(state, runtime);
211
- return { type: "fulfilled", dataInvestigationResult };
230
+ return {
231
+ type: "fulfilled",
232
+ dataInvestigationResult,
233
+ ...pendingParameterUpdates.length > 0 && {
234
+ parameterUpdates: pendingParameterUpdates
235
+ }
236
+ };
212
237
  }
213
238
 
214
239
  // ../connectors/src/auth-types.ts
@@ -362,11 +387,11 @@ var stripeOnboarding = new ConnectorOnboarding({
362
387
  - Write only 1 sentence between tool calls, then immediately call the next tool. Skip unnecessary explanations and proceed efficiently`
363
388
  },
364
389
  dataOverviewInstructions: {
365
- en: `1. Call stripe-oauth_request with GET /v1/customers?limit=5 to explore customers structure
366
- 2. Call stripe-oauth_request with GET /v1/charges?limit=5 to explore charges structure
390
+ en: `1. Call connector_stripe-oauth_request with GET /v1/customers?limit=5 to explore customers structure
391
+ 2. Call connector_stripe-oauth_request with GET /v1/charges?limit=5 to explore charges structure
367
392
  3. Explore other endpoints (invoices, subscriptions, products) as needed`,
368
- ja: `1. stripe-oauth_request \u3067 GET /v1/customers?limit=5 \u3092\u547C\u3073\u51FA\u3057\u3001\u9867\u5BA2\u306E\u69CB\u9020\u3092\u78BA\u8A8D
369
- 2. stripe-oauth_request \u3067 GET /v1/charges?limit=5 \u3092\u547C\u3073\u51FA\u3057\u3001\u8AB2\u91D1\u306E\u69CB\u9020\u3092\u78BA\u8A8D
393
+ ja: `1. connector_stripe-oauth_request \u3067 GET /v1/customers?limit=5 \u3092\u547C\u3073\u51FA\u3057\u3001\u9867\u5BA2\u306E\u69CB\u9020\u3092\u78BA\u8A8D
394
+ 2. connector_stripe-oauth_request \u3067 GET /v1/charges?limit=5 \u3092\u547C\u3073\u51FA\u3057\u3001\u8AB2\u91D1\u306E\u69CB\u9020\u3092\u78BA\u8A8D
370
395
  3. \u5FC5\u8981\u306B\u5FDC\u3058\u3066\u4ED6\u306E\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\uFF08\u8ACB\u6C42\u66F8\u3001\u30B5\u30D6\u30B9\u30AF\u30EA\u30D7\u30B7\u30E7\u30F3\u3001\u5546\u54C1\uFF09\u3092\u63A2\u7D22`
371
396
  }
372
397
  });
@@ -396,16 +421,16 @@ var ENTITY_LABELS = {
396
421
  }
397
422
  };
398
423
  var ENTITY_PATHS = {
399
- customers: "/v1/customers?limit=1",
400
- charges: "/v1/charges?limit=1",
401
- invoices: "/v1/invoices?limit=1",
402
- subscriptions: "/v1/subscriptions?limit=1",
403
- products: "/v1/products?limit=1",
404
- prices: "/v1/prices?limit=1",
405
- payouts: "/v1/payouts?limit=1",
406
- refunds: "/v1/refunds?limit=1",
407
- disputes: "/v1/disputes?limit=1",
408
- paymentIntents: "/v1/payment_intents?limit=1"
424
+ customers: "/v1/customers?limit=3",
425
+ charges: "/v1/charges?limit=3",
426
+ invoices: "/v1/invoices?limit=3",
427
+ subscriptions: "/v1/subscriptions?limit=3",
428
+ products: "/v1/products?limit=3",
429
+ prices: "/v1/prices?limit=3",
430
+ payouts: "/v1/payouts?limit=3",
431
+ refunds: "/v1/refunds?limit=3",
432
+ disputes: "/v1/disputes?limit=3",
433
+ paymentIntents: "/v1/payment_intents?limit=3"
409
434
  };
410
435
  var ENTITY_VALUES = Object.keys(ENTITY_PATHS);
411
436
  var stripeOauthSetupFlow = {
@@ -437,6 +462,7 @@ var stripeOauthSetupFlow = {
437
462
  const sections = ["## Stripe", ""];
438
463
  for (const entity of selected) {
439
464
  let count = "available";
465
+ let sampleRows = [];
440
466
  const res = await rt.config.proxyFetch(
441
467
  `${BASE_URL3}${ENTITY_PATHS[entity]}`,
442
468
  { method: "GET" }
@@ -448,13 +474,63 @@ var stripeOauthSetupFlow = {
448
474
  } else if (data.has_more === false) {
449
475
  count = String(data.data?.length ?? 1);
450
476
  } else if (Array.isArray(data.data)) {
451
- count = "1+ (paginated)";
477
+ count = "many (paginated)";
452
478
  }
479
+ sampleRows = (data.data ?? []).slice(0, 3);
453
480
  } else {
454
481
  count = "unavailable";
455
482
  }
456
483
  sections.push(`### ${ENTITY_LABELS[entity].en}`, "");
457
484
  sections.push(`Status: ${count}`, "");
485
+ if ((entity === "charges" || entity === "paymentIntents") && sampleRows.length > 0) {
486
+ sections.push("**Recent sample:**", "");
487
+ sections.push("| ID | Amount | Currency | Status | Created |");
488
+ sections.push("|----|--------|----------|--------|---------|");
489
+ for (const row of sampleRows) {
490
+ const id = String(row["id"] ?? "-").replace(/\|/g, "\\|");
491
+ const amount = typeof row["amount"] === "number" ? (row["amount"] / 100).toFixed(2) : "-";
492
+ const currency = String(row["currency"] ?? "-");
493
+ const status = String(row["status"] ?? "-");
494
+ const created = typeof row["created"] === "number" ? new Date(row["created"] * 1e3).toISOString().slice(0, 10) : "-";
495
+ sections.push(
496
+ `| ${id} | ${amount} | ${currency} | ${status} | ${created} |`
497
+ );
498
+ }
499
+ sections.push("");
500
+ }
501
+ if (entity === "invoices" && sampleRows.length > 0) {
502
+ sections.push("**Recent sample:**", "");
503
+ sections.push("| ID | Total | Currency | Status | Created |");
504
+ sections.push("|----|-------|----------|--------|---------|");
505
+ for (const row of sampleRows) {
506
+ const id = String(row["id"] ?? "-").replace(/\|/g, "\\|");
507
+ const total = typeof row["total"] === "number" ? (row["total"] / 100).toFixed(2) : "-";
508
+ const currency = String(row["currency"] ?? "-");
509
+ const status = String(row["status"] ?? "-");
510
+ const created = typeof row["created"] === "number" ? new Date(row["created"] * 1e3).toISOString().slice(0, 10) : "-";
511
+ sections.push(
512
+ `| ${id} | ${total} | ${currency} | ${status} | ${created} |`
513
+ );
514
+ }
515
+ sections.push("");
516
+ }
517
+ if (entity === "subscriptions" && sampleRows.length > 0) {
518
+ sections.push("**Recent sample:**", "");
519
+ sections.push("| ID | Status | Currency | Interval | Created |");
520
+ sections.push("|----|--------|----------|----------|---------|");
521
+ for (const row of sampleRows) {
522
+ const id = String(row["id"] ?? "-").replace(/\|/g, "\\|");
523
+ const status = String(row["status"] ?? "-");
524
+ const currency = String(row["currency"] ?? "-");
525
+ const items = row["items"];
526
+ const interval = items?.data?.[0]?.plan?.interval ?? "-";
527
+ const created = typeof row["created"] === "number" ? new Date(row["created"] * 1e3).toISOString().slice(0, 10) : "-";
528
+ sections.push(
529
+ `| ${id} | ${status} | ${currency} | ${interval} | ${created} |`
530
+ );
531
+ }
532
+ sections.push("");
533
+ }
458
534
  }
459
535
  return sections.join("\n");
460
536
  }
@@ -484,7 +560,7 @@ var stripeOauthConnector = new ConnectorPlugin({
484
560
  systemPrompt: {
485
561
  en: `### Tools
486
562
 
487
- - \`stripe-oauth_request\`: The only way to call the Stripe API. Use it to query charges, customers, invoices, subscriptions, products, prices, payment intents, balances, and more. Authentication is configured automatically via OAuth. Stripe uses cursor-based pagination with \`starting_after\` and \`has_more\`.
563
+ - \`connector_stripe-oauth_request\`: The only way to call the Stripe API. Use it to query charges, customers, invoices, subscriptions, products, prices, payment intents, balances, and more. Authentication is configured automatically via OAuth. Stripe uses cursor-based pagination with \`starting_after\` and \`has_more\`.
488
564
 
489
565
  ### Stripe API Reference
490
566
 
@@ -533,7 +609,7 @@ const data = await res.json();
533
609
  \`\`\``,
534
610
  ja: `### \u30C4\u30FC\u30EB
535
611
 
536
- - \`stripe-oauth_request\`: Stripe API\u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u8ACB\u6C42\u3001\u9867\u5BA2\u3001\u8ACB\u6C42\u66F8\u3001\u30B5\u30D6\u30B9\u30AF\u30EA\u30D7\u30B7\u30E7\u30F3\u3001\u5546\u54C1\u3001\u4FA1\u683C\u3001\u652F\u6255\u3044\u30A4\u30F3\u30C6\u30F3\u30C8\u3001\u6B8B\u9AD8\u306A\u3069\u306E\u30AF\u30A8\u30EA\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002OAuth\u7D4C\u7531\u3067\u8A8D\u8A3C\u306F\u81EA\u52D5\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002Stripe\u306F \`starting_after\` \u3068 \`has_more\` \u306B\u3088\u308B\u30AB\u30FC\u30BD\u30EB\u30D9\u30FC\u30B9\u306E\u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\u3092\u4F7F\u7528\u3057\u307E\u3059\u3002
612
+ - \`connector_stripe-oauth_request\`: Stripe API\u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u8ACB\u6C42\u3001\u9867\u5BA2\u3001\u8ACB\u6C42\u66F8\u3001\u30B5\u30D6\u30B9\u30AF\u30EA\u30D7\u30B7\u30E7\u30F3\u3001\u5546\u54C1\u3001\u4FA1\u683C\u3001\u652F\u6255\u3044\u30A4\u30F3\u30C6\u30F3\u30C8\u3001\u6B8B\u9AD8\u306A\u3069\u306E\u30AF\u30A8\u30EA\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002OAuth\u7D4C\u7531\u3067\u8A8D\u8A3C\u306F\u81EA\u52D5\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002Stripe\u306F \`starting_after\` \u3068 \`has_more\` \u306B\u3088\u308B\u30AB\u30FC\u30BD\u30EB\u30D9\u30FC\u30B9\u306E\u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\u3092\u4F7F\u7528\u3057\u307E\u3059\u3002
537
613
 
538
614
  ### Stripe API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
539
615
 
@@ -16,6 +16,7 @@ var init_parameter_definition = __esm({
16
16
  type;
17
17
  secret;
18
18
  required;
19
+ isDeprecated;
19
20
  constructor(config) {
20
21
  this.slug = config.slug;
21
22
  this.name = config.name;
@@ -24,6 +25,7 @@ var init_parameter_definition = __esm({
24
25
  this.type = config.type;
25
26
  this.secret = config.secret;
26
27
  this.required = config.required;
28
+ this.isDeprecated = config.isDeprecated ?? false;
27
29
  }
28
30
  /**
29
31
  * Get the parameter value from a ConnectorConnectionObject.
@@ -206,7 +208,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
206
208
  /**
207
209
  * Create tools for connections that belong to this connector.
208
210
  * Filters connections by connectorKey internally.
209
- * Returns tools keyed as `${connectorKey}_${toolName}`.
211
+ * Returns tools keyed as `connector_${connectorKey}_${toolName}`.
210
212
  */
211
213
  createTools(connections, config, opts) {
212
214
  const myConnections = connections.filter(
@@ -216,7 +218,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
216
218
  for (const t of Object.values(this.tools)) {
217
219
  const tool = t.createTool(myConnections, config);
218
220
  const originalToModelOutput = tool.toModelOutput;
219
- result[`${this.connectorKey}_${t.name}`] = {
221
+ result[`connector_${this.connectorKey}_${t.name}`] = {
220
222
  ...tool,
221
223
  toModelOutput: async (options) => {
222
224
  if (!originalToModelOutput) {
@@ -272,19 +274,34 @@ async function runSetupFlow(flow, params, ctx, config) {
272
274
  };
273
275
  let state = flow.initialState();
274
276
  let answerIdx = 0;
277
+ const pendingParameterUpdates = [];
275
278
  for (const step of flow.steps) {
276
279
  const ans = ctx.answers[answerIdx];
277
280
  if (ans && ans.questionSlug === step.slug) {
278
281
  state = step.applyAnswer(state, ans.answer);
282
+ if (step.toParameterUpdates) {
283
+ pendingParameterUpdates.push(...step.toParameterUpdates(state));
284
+ }
279
285
  answerIdx += 1;
280
286
  continue;
281
287
  }
288
+ const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
282
289
  if (step.type === "text") {
290
+ if (step.fetchOptions) {
291
+ const options2 = await step.fetchOptions(state, runtime);
292
+ if (options2.length === 0) {
293
+ continue;
294
+ }
295
+ }
283
296
  return {
284
297
  type: "nextQuestion",
285
298
  questionSlug: step.slug,
286
299
  question: step.question[ctx.language],
287
- questionType: "text"
300
+ questionType: "text",
301
+ allowFreeText: resolvedAllowFreeText,
302
+ ...pendingParameterUpdates.length > 0 && {
303
+ parameterUpdates: pendingParameterUpdates
304
+ }
288
305
  };
289
306
  }
290
307
  const options = step.fetchOptions ? await step.fetchOptions(state, runtime) : [];
@@ -296,11 +313,21 @@ async function runSetupFlow(flow, params, ctx, config) {
296
313
  questionSlug: step.slug,
297
314
  question: step.question[ctx.language],
298
315
  questionType: step.type,
299
- options
316
+ options,
317
+ allowFreeText: resolvedAllowFreeText,
318
+ ...pendingParameterUpdates.length > 0 && {
319
+ parameterUpdates: pendingParameterUpdates
320
+ }
300
321
  };
301
322
  }
302
323
  const dataInvestigationResult = await flow.finalize(state, runtime);
303
- return { type: "fulfilled", dataInvestigationResult };
324
+ return {
325
+ type: "fulfilled",
326
+ dataInvestigationResult,
327
+ ...pendingParameterUpdates.length > 0 && {
328
+ parameterUpdates: pendingParameterUpdates
329
+ }
330
+ };
304
331
  }
305
332
  async function resolveSetupSelection(params) {
306
333
  const { selected, allSentinel, fetchAll, limit } = params;
@@ -413,8 +440,8 @@ var supabaseSetupFlow = {
413
440
  slug: "tables",
414
441
  type: "multiSelect",
415
442
  question: {
416
- ja: "\u5BFE\u8C61\u30C6\u30FC\u30D6\u30EB\u3092\u9078\u3093\u3067\u304F\u3060\u3055\u3044\uFF08\u8907\u6570\u9078\u629E\u53EF\uFF09",
417
- en: "Select target tables (multi-select allowed)"
443
+ ja: "\u5BFE\u8C61\u30C6\u30FC\u30D6\u30EB\u30FB\u30D3\u30E5\u30FC\u3092\u9078\u3093\u3067\u304F\u3060\u3055\u3044\uFF08\u8907\u6570\u9078\u629E\u53EF\uFF09",
444
+ en: "Select target tables and views (multi-select allowed)"
418
445
  },
419
446
  async fetchOptions(state, rt) {
420
447
  if (!state.schema) return [];
@@ -423,7 +450,7 @@ var supabaseSetupFlow = {
423
450
  return [
424
451
  {
425
452
  value: ALL_TABLES,
426
- label: rt.language === "ja" ? "\u3059\u3079\u3066\u306E\u30C6\u30FC\u30D6\u30EB" : "All tables"
453
+ label: rt.language === "ja" ? "\u3059\u3079\u3066\u306E\u30C6\u30FC\u30D6\u30EB\u30FB\u30D3\u30E5\u30FC" : "All tables and views"
427
454
  },
428
455
  ...tableOptions
429
456
  ];
@@ -442,6 +469,21 @@ var supabaseSetupFlow = {
442
469
  fetchAll: () => fetchTableNames(rt.params, schema),
443
470
  limit: SUPABASE_SETUP_MAX_TABLES
444
471
  });
472
+ let rowCounts = /* @__PURE__ */ new Map();
473
+ try {
474
+ const countRows = await runQuery(
475
+ rt.params,
476
+ `SELECT relname, n_live_tup FROM pg_stat_user_tables WHERE schemaname = $1`,
477
+ [schema]
478
+ );
479
+ rowCounts = new Map(
480
+ countRows.map((r) => [
481
+ String(r["relname"] ?? ""),
482
+ Number(r["n_live_tup"] ?? 0)
483
+ ])
484
+ );
485
+ } catch {
486
+ }
445
487
  const sections = [
446
488
  "## Supabase",
447
489
  "",
@@ -457,7 +499,9 @@ var supabaseSetupFlow = {
457
499
  ORDER BY ordinal_position`,
458
500
  [schema, table]
459
501
  );
460
- sections.push(`#### Table: ${table}`, "");
502
+ const rowCount = rowCounts.get(table);
503
+ const heading = typeof rowCount === "number" ? `#### Table: ${table} (~${rowCount.toLocaleString()} rows)` : `#### Table: ${table}`;
504
+ sections.push(heading, "");
461
505
  sections.push("| Column | Type | Nullable | Default |");
462
506
  sections.push("|--------|------|----------|---------|");
463
507
  for (const c of cols) {
@@ -568,7 +612,7 @@ var supabaseConnector = new ConnectorPlugin({
568
612
  systemPrompt: {
569
613
  en: `### Tools
570
614
 
571
- - \`supabase_executeQuery\`: Executes a PostgreSQL query against the Supabase project's database and returns rows. Use this for schema exploration via \`information_schema.tables\`/\`columns\` and for sampling data. See the SQL Reference below for syntax notes and Supabase-specific schemas.
615
+ - \`connector_supabase_executeQuery\`: Executes a PostgreSQL query against the Supabase project's database and returns rows. Use this for schema exploration via \`information_schema.tables\`/\`columns\` and for sampling data. See the SQL Reference below for syntax notes and Supabase-specific schemas.
572
616
 
573
617
  ### Business Logic
574
618
 
@@ -585,7 +629,7 @@ The business logic type for this connector is "sql".
585
629
  - Always include LIMIT in queries`,
586
630
  ja: `### \u30C4\u30FC\u30EB
587
631
 
588
- - \`supabase_executeQuery\`: Supabase\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E Postgres \u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u306B\u5BFE\u3057\u3066\u30AF\u30A8\u30EA\u3092\u5B9F\u884C\u3057\u3001\u884C\u30C7\u30FC\u30BF\u3092\u8FD4\u3057\u307E\u3059\u3002\`information_schema.tables\`/\`columns\` \u3092\u4F7F\u3063\u305F\u30B9\u30AD\u30FC\u30DE\u63A2\u7D22\u3084\u30C7\u30FC\u30BF\u306E\u30B5\u30F3\u30D7\u30EA\u30F3\u30B0\u306B\u4F7F\u3044\u307E\u3059\u3002\u69CB\u6587\u306E\u6CE8\u610F\u70B9\u3068 Supabase \u56FA\u6709\u306E\u30B9\u30AD\u30FC\u30DE\u306F\u4E0B\u90E8\u306E\u300CSQL \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9\u300D\u3092\u53C2\u7167\u3057\u3066\u304F\u3060\u3055\u3044\u3002
632
+ - \`connector_supabase_executeQuery\`: Supabase\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E Postgres \u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u306B\u5BFE\u3057\u3066\u30AF\u30A8\u30EA\u3092\u5B9F\u884C\u3057\u3001\u884C\u30C7\u30FC\u30BF\u3092\u8FD4\u3057\u307E\u3059\u3002\`information_schema.tables\`/\`columns\` \u3092\u4F7F\u3063\u305F\u30B9\u30AD\u30FC\u30DE\u63A2\u7D22\u3084\u30C7\u30FC\u30BF\u306E\u30B5\u30F3\u30D7\u30EA\u30F3\u30B0\u306B\u4F7F\u3044\u307E\u3059\u3002\u69CB\u6587\u306E\u6CE8\u610F\u70B9\u3068 Supabase \u56FA\u6709\u306E\u30B9\u30AD\u30FC\u30DE\u306F\u4E0B\u90E8\u306E\u300CSQL \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9\u300D\u3092\u53C2\u7167\u3057\u3066\u304F\u3060\u3055\u3044\u3002
589
633
 
590
634
  ### Business Logic
591
635