@squadbase/vite-server 0.1.17-dev.a9ddcfa → 0.1.17-dev.e4768d1
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 +8941 -3700
- package/dist/connectors/airtable-oauth.js +87 -23
- package/dist/connectors/airtable.js +130 -23
- package/dist/connectors/amplitude.js +47 -23
- package/dist/connectors/anthropic.js +41 -17
- package/dist/connectors/asana.js +76 -25
- package/dist/connectors/attio.js +69 -28
- package/dist/connectors/aws-billing.js +47 -23
- package/dist/connectors/azure-sql.js +322 -25
- package/dist/connectors/backlog-api-key.js +79 -30
- package/dist/connectors/clickup.js +89 -25
- package/dist/connectors/cosmosdb.js +51 -27
- package/dist/connectors/customerio.js +47 -23
- package/dist/connectors/dbt.js +725 -40
- package/dist/connectors/freshdesk.js +121 -23
- package/dist/connectors/freshsales.js +47 -23
- package/dist/connectors/freshservice.js +47 -23
- package/dist/connectors/gamma.js +54 -30
- package/dist/connectors/gemini.js +41 -17
- package/dist/connectors/github.js +51 -27
- package/dist/connectors/gmail-oauth.js +42 -23
- package/dist/connectors/gmail.js +43 -19
- package/dist/connectors/google-ads.js +47 -23
- package/dist/connectors/google-analytics-oauth.js +191 -40
- package/dist/connectors/google-analytics.js +529 -111
- package/dist/connectors/google-audit-log.js +43 -19
- package/dist/connectors/google-calendar-oauth.js +100 -30
- package/dist/connectors/google-calendar.js +100 -26
- package/dist/connectors/google-docs.js +42 -23
- package/dist/connectors/google-drive.js +64 -23
- package/dist/connectors/google-search-console-oauth.js +165 -32
- package/dist/connectors/google-sheets.js +142 -199
- package/dist/connectors/google-slides.js +42 -23
- package/dist/connectors/grafana.js +84 -25
- package/dist/connectors/hackernews.d.ts +5 -0
- package/dist/connectors/hackernews.js +909 -0
- package/dist/connectors/hubspot-oauth.js +73 -22
- package/dist/connectors/hubspot.js +64 -24
- package/dist/connectors/influxdb.js +47 -23
- package/dist/connectors/intercom-oauth.js +104 -25
- package/dist/connectors/intercom.js +51 -27
- package/dist/connectors/jdbc.js +76 -25
- package/dist/connectors/jira-api-key.js +107 -26
- package/dist/connectors/kintone-api-token.js +105 -33
- package/dist/connectors/kintone.js +182 -26
- package/dist/connectors/linear.js +93 -27
- package/dist/connectors/linkedin-ads.js +80 -29
- package/dist/connectors/mailchimp-oauth.js +45 -21
- package/dist/connectors/mailchimp.js +45 -21
- package/dist/connectors/meta-ads-oauth.js +72 -29
- package/dist/connectors/meta-ads.js +74 -29
- package/dist/connectors/mixpanel.js +47 -23
- package/dist/connectors/monday.js +48 -24
- package/dist/connectors/mongodb.js +47 -23
- package/dist/connectors/notion-oauth.js +92 -24
- package/dist/connectors/notion.js +144 -26
- package/dist/connectors/openai.js +41 -17
- package/dist/connectors/oracle.js +316 -26
- package/dist/connectors/outlook-oauth.js +53 -34
- package/dist/connectors/powerbi-oauth.js +45 -26
- package/dist/connectors/salesforce.js +150 -24
- package/dist/connectors/semrush.js +45 -21
- package/dist/connectors/sentry.js +75 -25
- package/dist/connectors/shopify-oauth.js +75 -23
- package/dist/connectors/shopify.js +47 -23
- package/dist/connectors/sqlserver.js +322 -25
- package/dist/connectors/stripe-api-key.js +105 -30
- package/dist/connectors/stripe-oauth.js +102 -32
- package/dist/connectors/supabase.js +315 -21
- package/dist/connectors/tableau.js +54 -30
- package/dist/connectors/tiktok-ads.js +76 -31
- package/dist/connectors/wix-store.js +47 -23
- package/dist/connectors/x.d.ts +5 -0
- package/dist/connectors/x.js +951 -0
- package/dist/connectors/zendesk-oauth.js +87 -25
- package/dist/connectors/zendesk.js +51 -27
- package/dist/index.js +9005 -3709
- package/dist/main.js +9005 -3709
- package/dist/vite-plugin.js +8939 -3698
- package/package.json +12 -4
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
2
|
-
var __esm = (fn, res) => function __init() {
|
|
3
|
-
|
|
2
|
+
var __esm = (fn, res, err) => function __init() {
|
|
3
|
+
if (err) throw err[0];
|
|
4
|
+
try {
|
|
5
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
6
|
+
} catch (e) {
|
|
7
|
+
throw err = [e], e;
|
|
8
|
+
}
|
|
4
9
|
};
|
|
5
10
|
|
|
6
11
|
// ../connectors/src/parameter-definition.ts
|
|
@@ -155,6 +160,15 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
155
160
|
* `runSetupFlow` from `setup-flow.ts`.
|
|
156
161
|
*/
|
|
157
162
|
setup;
|
|
163
|
+
/**
|
|
164
|
+
* 統一 introspection。SQL DB の `information_schema` / `SHOW` / `DESCRIBE` や SaaS の
|
|
165
|
+
* メタデータ API といった取得経路の差を吸収し、tables / columns / PK / FK を共通型
|
|
166
|
+
* {@link IntrospectedSchema} へ正規化して返す。取得経路は {@link IntrospectContext} で
|
|
167
|
+
* 抽象化され、SQL DB は `ctx.query`、SaaS は `ctx.proxyFetch` + `ctx.params` を使う。
|
|
168
|
+
* `ctx.profile === true` のときは L2 プロファイル(行数・NULL 率等)も best-effort で埋める。
|
|
169
|
+
* coding-agent の `DataContextIndex` がデータ地図を構築する際に使う。
|
|
170
|
+
*/
|
|
171
|
+
introspect;
|
|
158
172
|
/**
|
|
159
173
|
* Opt-out of the default "verify before save" behavior on connection
|
|
160
174
|
* creation. The backend invokes `checkConnection` synchronously while
|
|
@@ -169,6 +183,14 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
169
183
|
* the default verify-on-create behavior without opt-in.
|
|
170
184
|
*/
|
|
171
185
|
skipConnectionCheckOnCreate;
|
|
186
|
+
/**
|
|
187
|
+
* 決定論的な「立ち上げ survey」レシピ(ルールベース prewarm 基盤)。実装した connector は、LLM を使わずに
|
|
188
|
+
* read-only で自分を survey する probe 列(テーブル/列メタデータ → 小サンプル)を宣言する。coding-agent の
|
|
189
|
+
* recon driver がこれを読み、connector ツールの `execute` を直接呼んで結果を seed にする。未実装の connector は
|
|
190
|
+
* driver 側で safely skip される(その connection は listConnections のみ seed)。標準 `information_schema` を
|
|
191
|
+
* 持つ SQL connector は `makeStandardSqlSurveyProbes` を使える。**probe は必ず read-only**。
|
|
192
|
+
*/
|
|
193
|
+
surveyProbes;
|
|
172
194
|
constructor(config) {
|
|
173
195
|
this.slug = config.slug;
|
|
174
196
|
this.authType = config.authType;
|
|
@@ -186,7 +208,9 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
186
208
|
this.query = config.query;
|
|
187
209
|
this.checkConnection = config.checkConnection;
|
|
188
210
|
this.setup = config.setup;
|
|
211
|
+
this.introspect = config.introspect;
|
|
189
212
|
this.skipConnectionCheckOnCreate = config.skipConnectionCheckOnCreate;
|
|
213
|
+
this.surveyProbes = config.surveyProbes;
|
|
190
214
|
}
|
|
191
215
|
get connectorKey() {
|
|
192
216
|
return _ConnectorPlugin.deriveKey(this.slug, this.authType);
|
|
@@ -194,7 +218,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
194
218
|
/**
|
|
195
219
|
* Create tools for connections that belong to this connector.
|
|
196
220
|
* Filters connections by connectorKey internally.
|
|
197
|
-
* Returns tools keyed as
|
|
221
|
+
* Returns tools keyed as `connector_${connectorKey}_${toolName}`.
|
|
198
222
|
*/
|
|
199
223
|
createTools(connections, config, opts) {
|
|
200
224
|
const myConnections = connections.filter(
|
|
@@ -204,7 +228,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
204
228
|
for (const t of Object.values(this.tools)) {
|
|
205
229
|
const tool = t.createTool(myConnections, config);
|
|
206
230
|
const originalToModelOutput = tool.toModelOutput;
|
|
207
|
-
result[
|
|
231
|
+
result[`connector_${this.connectorKey}_${t.name}`] = {
|
|
208
232
|
...tool,
|
|
209
233
|
toModelOutput: async (options) => {
|
|
210
234
|
if (!originalToModelOutput) {
|
|
@@ -224,25 +248,25 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
224
248
|
if (authType) return `${slug}-${authType}`;
|
|
225
249
|
const LEGACY_NULL_AUTH_TYPE_MAP = {
|
|
226
250
|
// user-password
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
251
|
+
postgresql: "user-password",
|
|
252
|
+
mysql: "user-password",
|
|
253
|
+
clickhouse: "user-password",
|
|
254
|
+
kintone: "user-password",
|
|
231
255
|
"squadbase-db": "user-password",
|
|
232
256
|
// service-account
|
|
233
|
-
|
|
234
|
-
|
|
257
|
+
snowflake: "service-account",
|
|
258
|
+
bigquery: "service-account",
|
|
235
259
|
"google-analytics": "service-account",
|
|
236
260
|
"google-calendar": "service-account",
|
|
237
261
|
"aws-athena": "service-account",
|
|
238
|
-
|
|
262
|
+
redshift: "service-account",
|
|
239
263
|
// api-key
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
264
|
+
databricks: "api-key",
|
|
265
|
+
dbt: "api-key",
|
|
266
|
+
airtable: "api-key",
|
|
267
|
+
openai: "api-key",
|
|
268
|
+
gemini: "api-key",
|
|
269
|
+
anthropic: "api-key",
|
|
246
270
|
"wix-store": "api-key"
|
|
247
271
|
};
|
|
248
272
|
const fallbackAuthType = LEGACY_NULL_AUTH_TYPE_MAP[slug];
|
|
@@ -489,16 +513,16 @@ var ENTITY_LABELS = {
|
|
|
489
513
|
}
|
|
490
514
|
};
|
|
491
515
|
var ENTITY_PATHS = {
|
|
492
|
-
customers: "/v1/customers?limit=
|
|
493
|
-
charges: "/v1/charges?limit=
|
|
494
|
-
invoices: "/v1/invoices?limit=
|
|
495
|
-
subscriptions: "/v1/subscriptions?limit=
|
|
496
|
-
products: "/v1/products?limit=
|
|
497
|
-
prices: "/v1/prices?limit=
|
|
498
|
-
payouts: "/v1/payouts?limit=
|
|
499
|
-
refunds: "/v1/refunds?limit=
|
|
500
|
-
disputes: "/v1/disputes?limit=
|
|
501
|
-
paymentIntents: "/v1/payment_intents?limit=
|
|
516
|
+
customers: "/v1/customers?limit=3",
|
|
517
|
+
charges: "/v1/charges?limit=3",
|
|
518
|
+
invoices: "/v1/invoices?limit=3",
|
|
519
|
+
subscriptions: "/v1/subscriptions?limit=3",
|
|
520
|
+
products: "/v1/products?limit=3",
|
|
521
|
+
prices: "/v1/prices?limit=3",
|
|
522
|
+
payouts: "/v1/payouts?limit=3",
|
|
523
|
+
refunds: "/v1/refunds?limit=3",
|
|
524
|
+
disputes: "/v1/disputes?limit=3",
|
|
525
|
+
paymentIntents: "/v1/payment_intents?limit=3"
|
|
502
526
|
};
|
|
503
527
|
var ENTITY_VALUES = Object.keys(ENTITY_PATHS);
|
|
504
528
|
async function defaultFetchEntity(params, path2) {
|
|
@@ -534,6 +558,7 @@ function createStripeSetupFlow(fetchEntity = defaultFetchEntity, labelPrefix = "
|
|
|
534
558
|
const sections = [`## ${labelPrefix}`, ""];
|
|
535
559
|
for (const entity of selected) {
|
|
536
560
|
let count = "available";
|
|
561
|
+
let sampleRows = [];
|
|
537
562
|
const res = await fetchEntity(rt.params, ENTITY_PATHS[entity]);
|
|
538
563
|
if (res.ok) {
|
|
539
564
|
const data = await res.json();
|
|
@@ -542,13 +567,63 @@ function createStripeSetupFlow(fetchEntity = defaultFetchEntity, labelPrefix = "
|
|
|
542
567
|
} else if (data.has_more === false) {
|
|
543
568
|
count = String(data.data?.length ?? 1);
|
|
544
569
|
} else if (Array.isArray(data.data)) {
|
|
545
|
-
count = "
|
|
570
|
+
count = "many (paginated)";
|
|
546
571
|
}
|
|
572
|
+
sampleRows = (data.data ?? []).slice(0, 3);
|
|
547
573
|
} else {
|
|
548
574
|
count = "unavailable";
|
|
549
575
|
}
|
|
550
576
|
sections.push(`### ${ENTITY_LABELS[entity].en}`, "");
|
|
551
577
|
sections.push(`Status: ${count}`, "");
|
|
578
|
+
if ((entity === "charges" || entity === "paymentIntents") && sampleRows.length > 0) {
|
|
579
|
+
sections.push("**Recent sample:**", "");
|
|
580
|
+
sections.push("| ID | Amount | Currency | Status | Created |");
|
|
581
|
+
sections.push("|----|--------|----------|--------|---------|");
|
|
582
|
+
for (const row of sampleRows) {
|
|
583
|
+
const id = String(row["id"] ?? "-").replace(/\|/g, "\\|");
|
|
584
|
+
const amount = typeof row["amount"] === "number" ? (row["amount"] / 100).toFixed(2) : "-";
|
|
585
|
+
const currency = String(row["currency"] ?? "-");
|
|
586
|
+
const status = String(row["status"] ?? "-");
|
|
587
|
+
const created = typeof row["created"] === "number" ? new Date(row["created"] * 1e3).toISOString().slice(0, 10) : "-";
|
|
588
|
+
sections.push(
|
|
589
|
+
`| ${id} | ${amount} | ${currency} | ${status} | ${created} |`
|
|
590
|
+
);
|
|
591
|
+
}
|
|
592
|
+
sections.push("");
|
|
593
|
+
}
|
|
594
|
+
if (entity === "invoices" && sampleRows.length > 0) {
|
|
595
|
+
sections.push("**Recent sample:**", "");
|
|
596
|
+
sections.push("| ID | Total | Currency | Status | Created |");
|
|
597
|
+
sections.push("|----|-------|----------|--------|---------|");
|
|
598
|
+
for (const row of sampleRows) {
|
|
599
|
+
const id = String(row["id"] ?? "-").replace(/\|/g, "\\|");
|
|
600
|
+
const total = typeof row["total"] === "number" ? (row["total"] / 100).toFixed(2) : "-";
|
|
601
|
+
const currency = String(row["currency"] ?? "-");
|
|
602
|
+
const status = String(row["status"] ?? "-");
|
|
603
|
+
const created = typeof row["created"] === "number" ? new Date(row["created"] * 1e3).toISOString().slice(0, 10) : "-";
|
|
604
|
+
sections.push(
|
|
605
|
+
`| ${id} | ${total} | ${currency} | ${status} | ${created} |`
|
|
606
|
+
);
|
|
607
|
+
}
|
|
608
|
+
sections.push("");
|
|
609
|
+
}
|
|
610
|
+
if (entity === "subscriptions" && sampleRows.length > 0) {
|
|
611
|
+
sections.push("**Recent sample:**", "");
|
|
612
|
+
sections.push("| ID | Status | Currency | Interval | Created |");
|
|
613
|
+
sections.push("|----|--------|----------|----------|---------|");
|
|
614
|
+
for (const row of sampleRows) {
|
|
615
|
+
const id = String(row["id"] ?? "-").replace(/\|/g, "\\|");
|
|
616
|
+
const status = String(row["status"] ?? "-");
|
|
617
|
+
const currency = String(row["currency"] ?? "-");
|
|
618
|
+
const items = row["items"];
|
|
619
|
+
const interval = items?.data?.[0]?.plan?.interval ?? "-";
|
|
620
|
+
const created = typeof row["created"] === "number" ? new Date(row["created"] * 1e3).toISOString().slice(0, 10) : "-";
|
|
621
|
+
sections.push(
|
|
622
|
+
`| ${id} | ${status} | ${currency} | ${interval} | ${created} |`
|
|
623
|
+
);
|
|
624
|
+
}
|
|
625
|
+
sections.push("");
|
|
626
|
+
}
|
|
552
627
|
}
|
|
553
628
|
return sections.join("\n");
|
|
554
629
|
}
|
|
@@ -571,7 +646,7 @@ var stripeApiKeyConnector = new ConnectorPlugin({
|
|
|
571
646
|
systemPrompt: {
|
|
572
647
|
en: `### Tools
|
|
573
648
|
|
|
574
|
-
- \`
|
|
649
|
+
- \`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\`.
|
|
575
650
|
|
|
576
651
|
### Stripe API Reference
|
|
577
652
|
|
|
@@ -622,7 +697,7 @@ const data = await res.json();
|
|
|
622
697
|
\`\`\``,
|
|
623
698
|
ja: `### \u30C4\u30FC\u30EB
|
|
624
699
|
|
|
625
|
-
- \`
|
|
700
|
+
- \`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
|
|
626
701
|
|
|
627
702
|
### Stripe API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
628
703
|
|
|
@@ -75,6 +75,15 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
75
75
|
* `runSetupFlow` from `setup-flow.ts`.
|
|
76
76
|
*/
|
|
77
77
|
setup;
|
|
78
|
+
/**
|
|
79
|
+
* 統一 introspection。SQL DB の `information_schema` / `SHOW` / `DESCRIBE` や SaaS の
|
|
80
|
+
* メタデータ API といった取得経路の差を吸収し、tables / columns / PK / FK を共通型
|
|
81
|
+
* {@link IntrospectedSchema} へ正規化して返す。取得経路は {@link IntrospectContext} で
|
|
82
|
+
* 抽象化され、SQL DB は `ctx.query`、SaaS は `ctx.proxyFetch` + `ctx.params` を使う。
|
|
83
|
+
* `ctx.profile === true` のときは L2 プロファイル(行数・NULL 率等)も best-effort で埋める。
|
|
84
|
+
* coding-agent の `DataContextIndex` がデータ地図を構築する際に使う。
|
|
85
|
+
*/
|
|
86
|
+
introspect;
|
|
78
87
|
/**
|
|
79
88
|
* Opt-out of the default "verify before save" behavior on connection
|
|
80
89
|
* creation. The backend invokes `checkConnection` synchronously while
|
|
@@ -89,6 +98,14 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
89
98
|
* the default verify-on-create behavior without opt-in.
|
|
90
99
|
*/
|
|
91
100
|
skipConnectionCheckOnCreate;
|
|
101
|
+
/**
|
|
102
|
+
* 決定論的な「立ち上げ survey」レシピ(ルールベース prewarm 基盤)。実装した connector は、LLM を使わずに
|
|
103
|
+
* read-only で自分を survey する probe 列(テーブル/列メタデータ → 小サンプル)を宣言する。coding-agent の
|
|
104
|
+
* recon driver がこれを読み、connector ツールの `execute` を直接呼んで結果を seed にする。未実装の connector は
|
|
105
|
+
* driver 側で safely skip される(その connection は listConnections のみ seed)。標準 `information_schema` を
|
|
106
|
+
* 持つ SQL connector は `makeStandardSqlSurveyProbes` を使える。**probe は必ず read-only**。
|
|
107
|
+
*/
|
|
108
|
+
surveyProbes;
|
|
92
109
|
constructor(config) {
|
|
93
110
|
this.slug = config.slug;
|
|
94
111
|
this.authType = config.authType;
|
|
@@ -106,7 +123,9 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
106
123
|
this.query = config.query;
|
|
107
124
|
this.checkConnection = config.checkConnection;
|
|
108
125
|
this.setup = config.setup;
|
|
126
|
+
this.introspect = config.introspect;
|
|
109
127
|
this.skipConnectionCheckOnCreate = config.skipConnectionCheckOnCreate;
|
|
128
|
+
this.surveyProbes = config.surveyProbes;
|
|
110
129
|
}
|
|
111
130
|
get connectorKey() {
|
|
112
131
|
return _ConnectorPlugin.deriveKey(this.slug, this.authType);
|
|
@@ -114,7 +133,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
114
133
|
/**
|
|
115
134
|
* Create tools for connections that belong to this connector.
|
|
116
135
|
* Filters connections by connectorKey internally.
|
|
117
|
-
* Returns tools keyed as
|
|
136
|
+
* Returns tools keyed as `connector_${connectorKey}_${toolName}`.
|
|
118
137
|
*/
|
|
119
138
|
createTools(connections, config, opts) {
|
|
120
139
|
const myConnections = connections.filter(
|
|
@@ -124,7 +143,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
124
143
|
for (const t of Object.values(this.tools)) {
|
|
125
144
|
const tool = t.createTool(myConnections, config);
|
|
126
145
|
const originalToModelOutput = tool.toModelOutput;
|
|
127
|
-
result[
|
|
146
|
+
result[`connector_${this.connectorKey}_${t.name}`] = {
|
|
128
147
|
...tool,
|
|
129
148
|
toModelOutput: async (options) => {
|
|
130
149
|
if (!originalToModelOutput) {
|
|
@@ -144,25 +163,25 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
144
163
|
if (authType) return `${slug}-${authType}`;
|
|
145
164
|
const LEGACY_NULL_AUTH_TYPE_MAP = {
|
|
146
165
|
// user-password
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
166
|
+
postgresql: "user-password",
|
|
167
|
+
mysql: "user-password",
|
|
168
|
+
clickhouse: "user-password",
|
|
169
|
+
kintone: "user-password",
|
|
151
170
|
"squadbase-db": "user-password",
|
|
152
171
|
// service-account
|
|
153
|
-
|
|
154
|
-
|
|
172
|
+
snowflake: "service-account",
|
|
173
|
+
bigquery: "service-account",
|
|
155
174
|
"google-analytics": "service-account",
|
|
156
175
|
"google-calendar": "service-account",
|
|
157
176
|
"aws-athena": "service-account",
|
|
158
|
-
|
|
177
|
+
redshift: "service-account",
|
|
159
178
|
// api-key
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
179
|
+
databricks: "api-key",
|
|
180
|
+
dbt: "api-key",
|
|
181
|
+
airtable: "api-key",
|
|
182
|
+
openai: "api-key",
|
|
183
|
+
gemini: "api-key",
|
|
184
|
+
anthropic: "api-key",
|
|
166
185
|
"wix-store": "api-key"
|
|
167
186
|
};
|
|
168
187
|
const fallbackAuthType = LEGACY_NULL_AUTH_TYPE_MAP[slug];
|
|
@@ -387,11 +406,11 @@ var stripeOnboarding = new ConnectorOnboarding({
|
|
|
387
406
|
- Write only 1 sentence between tool calls, then immediately call the next tool. Skip unnecessary explanations and proceed efficiently`
|
|
388
407
|
},
|
|
389
408
|
dataOverviewInstructions: {
|
|
390
|
-
en: `1. Call
|
|
391
|
-
2. Call
|
|
409
|
+
en: `1. Call connector_stripe-oauth_request with GET /v1/customers?limit=5 to explore customers structure
|
|
410
|
+
2. Call connector_stripe-oauth_request with GET /v1/charges?limit=5 to explore charges structure
|
|
392
411
|
3. Explore other endpoints (invoices, subscriptions, products) as needed`,
|
|
393
|
-
ja: `1.
|
|
394
|
-
2.
|
|
412
|
+
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
|
|
413
|
+
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
|
|
395
414
|
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`
|
|
396
415
|
}
|
|
397
416
|
});
|
|
@@ -421,16 +440,16 @@ var ENTITY_LABELS = {
|
|
|
421
440
|
}
|
|
422
441
|
};
|
|
423
442
|
var ENTITY_PATHS = {
|
|
424
|
-
customers: "/v1/customers?limit=
|
|
425
|
-
charges: "/v1/charges?limit=
|
|
426
|
-
invoices: "/v1/invoices?limit=
|
|
427
|
-
subscriptions: "/v1/subscriptions?limit=
|
|
428
|
-
products: "/v1/products?limit=
|
|
429
|
-
prices: "/v1/prices?limit=
|
|
430
|
-
payouts: "/v1/payouts?limit=
|
|
431
|
-
refunds: "/v1/refunds?limit=
|
|
432
|
-
disputes: "/v1/disputes?limit=
|
|
433
|
-
paymentIntents: "/v1/payment_intents?limit=
|
|
443
|
+
customers: "/v1/customers?limit=3",
|
|
444
|
+
charges: "/v1/charges?limit=3",
|
|
445
|
+
invoices: "/v1/invoices?limit=3",
|
|
446
|
+
subscriptions: "/v1/subscriptions?limit=3",
|
|
447
|
+
products: "/v1/products?limit=3",
|
|
448
|
+
prices: "/v1/prices?limit=3",
|
|
449
|
+
payouts: "/v1/payouts?limit=3",
|
|
450
|
+
refunds: "/v1/refunds?limit=3",
|
|
451
|
+
disputes: "/v1/disputes?limit=3",
|
|
452
|
+
paymentIntents: "/v1/payment_intents?limit=3"
|
|
434
453
|
};
|
|
435
454
|
var ENTITY_VALUES = Object.keys(ENTITY_PATHS);
|
|
436
455
|
var stripeOauthSetupFlow = {
|
|
@@ -462,6 +481,7 @@ var stripeOauthSetupFlow = {
|
|
|
462
481
|
const sections = ["## Stripe", ""];
|
|
463
482
|
for (const entity of selected) {
|
|
464
483
|
let count = "available";
|
|
484
|
+
let sampleRows = [];
|
|
465
485
|
const res = await rt.config.proxyFetch(
|
|
466
486
|
`${BASE_URL3}${ENTITY_PATHS[entity]}`,
|
|
467
487
|
{ method: "GET" }
|
|
@@ -473,13 +493,63 @@ var stripeOauthSetupFlow = {
|
|
|
473
493
|
} else if (data.has_more === false) {
|
|
474
494
|
count = String(data.data?.length ?? 1);
|
|
475
495
|
} else if (Array.isArray(data.data)) {
|
|
476
|
-
count = "
|
|
496
|
+
count = "many (paginated)";
|
|
477
497
|
}
|
|
498
|
+
sampleRows = (data.data ?? []).slice(0, 3);
|
|
478
499
|
} else {
|
|
479
500
|
count = "unavailable";
|
|
480
501
|
}
|
|
481
502
|
sections.push(`### ${ENTITY_LABELS[entity].en}`, "");
|
|
482
503
|
sections.push(`Status: ${count}`, "");
|
|
504
|
+
if ((entity === "charges" || entity === "paymentIntents") && sampleRows.length > 0) {
|
|
505
|
+
sections.push("**Recent sample:**", "");
|
|
506
|
+
sections.push("| ID | Amount | Currency | Status | Created |");
|
|
507
|
+
sections.push("|----|--------|----------|--------|---------|");
|
|
508
|
+
for (const row of sampleRows) {
|
|
509
|
+
const id = String(row["id"] ?? "-").replace(/\|/g, "\\|");
|
|
510
|
+
const amount = typeof row["amount"] === "number" ? (row["amount"] / 100).toFixed(2) : "-";
|
|
511
|
+
const currency = String(row["currency"] ?? "-");
|
|
512
|
+
const status = String(row["status"] ?? "-");
|
|
513
|
+
const created = typeof row["created"] === "number" ? new Date(row["created"] * 1e3).toISOString().slice(0, 10) : "-";
|
|
514
|
+
sections.push(
|
|
515
|
+
`| ${id} | ${amount} | ${currency} | ${status} | ${created} |`
|
|
516
|
+
);
|
|
517
|
+
}
|
|
518
|
+
sections.push("");
|
|
519
|
+
}
|
|
520
|
+
if (entity === "invoices" && sampleRows.length > 0) {
|
|
521
|
+
sections.push("**Recent sample:**", "");
|
|
522
|
+
sections.push("| ID | Total | Currency | Status | Created |");
|
|
523
|
+
sections.push("|----|-------|----------|--------|---------|");
|
|
524
|
+
for (const row of sampleRows) {
|
|
525
|
+
const id = String(row["id"] ?? "-").replace(/\|/g, "\\|");
|
|
526
|
+
const total = typeof row["total"] === "number" ? (row["total"] / 100).toFixed(2) : "-";
|
|
527
|
+
const currency = String(row["currency"] ?? "-");
|
|
528
|
+
const status = String(row["status"] ?? "-");
|
|
529
|
+
const created = typeof row["created"] === "number" ? new Date(row["created"] * 1e3).toISOString().slice(0, 10) : "-";
|
|
530
|
+
sections.push(
|
|
531
|
+
`| ${id} | ${total} | ${currency} | ${status} | ${created} |`
|
|
532
|
+
);
|
|
533
|
+
}
|
|
534
|
+
sections.push("");
|
|
535
|
+
}
|
|
536
|
+
if (entity === "subscriptions" && sampleRows.length > 0) {
|
|
537
|
+
sections.push("**Recent sample:**", "");
|
|
538
|
+
sections.push("| ID | Status | Currency | Interval | Created |");
|
|
539
|
+
sections.push("|----|--------|----------|----------|---------|");
|
|
540
|
+
for (const row of sampleRows) {
|
|
541
|
+
const id = String(row["id"] ?? "-").replace(/\|/g, "\\|");
|
|
542
|
+
const status = String(row["status"] ?? "-");
|
|
543
|
+
const currency = String(row["currency"] ?? "-");
|
|
544
|
+
const items = row["items"];
|
|
545
|
+
const interval = items?.data?.[0]?.plan?.interval ?? "-";
|
|
546
|
+
const created = typeof row["created"] === "number" ? new Date(row["created"] * 1e3).toISOString().slice(0, 10) : "-";
|
|
547
|
+
sections.push(
|
|
548
|
+
`| ${id} | ${status} | ${currency} | ${interval} | ${created} |`
|
|
549
|
+
);
|
|
550
|
+
}
|
|
551
|
+
sections.push("");
|
|
552
|
+
}
|
|
483
553
|
}
|
|
484
554
|
return sections.join("\n");
|
|
485
555
|
}
|
|
@@ -509,7 +579,7 @@ var stripeOauthConnector = new ConnectorPlugin({
|
|
|
509
579
|
systemPrompt: {
|
|
510
580
|
en: `### Tools
|
|
511
581
|
|
|
512
|
-
- \`
|
|
582
|
+
- \`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\`.
|
|
513
583
|
|
|
514
584
|
### Stripe API Reference
|
|
515
585
|
|
|
@@ -558,7 +628,7 @@ const data = await res.json();
|
|
|
558
628
|
\`\`\``,
|
|
559
629
|
ja: `### \u30C4\u30FC\u30EB
|
|
560
630
|
|
|
561
|
-
- \`
|
|
631
|
+
- \`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
|
|
562
632
|
|
|
563
633
|
### Stripe API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
564
634
|
|