@squadbase/vite-server 0.1.17-dev.3b633bb → 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.
- package/dist/cli/index.js +3307 -739
- package/dist/connectors/airtable-oauth.js +50 -8
- package/dist/connectors/airtable.js +46 -8
- package/dist/connectors/amplitude.js +10 -8
- package/dist/connectors/anthropic.js +4 -2
- package/dist/connectors/asana.js +39 -10
- package/dist/connectors/attio.js +32 -13
- package/dist/connectors/aws-billing.js +10 -8
- package/dist/connectors/azure-sql.js +33 -7
- package/dist/connectors/backlog-api-key.js +42 -15
- package/dist/connectors/clickup.js +52 -10
- package/dist/connectors/cosmosdb.js +14 -12
- package/dist/connectors/customerio.js +10 -8
- package/dist/connectors/dbt.js +688 -25
- package/dist/connectors/freshdesk.js +84 -8
- package/dist/connectors/freshsales.js +10 -8
- package/dist/connectors/freshservice.js +10 -8
- package/dist/connectors/gamma.js +17 -15
- package/dist/connectors/gemini.js +4 -2
- package/dist/connectors/github.js +14 -12
- package/dist/connectors/gmail-oauth.js +10 -10
- package/dist/connectors/gmail.js +6 -4
- package/dist/connectors/google-ads.js +10 -8
- package/dist/connectors/google-analytics-oauth.js +154 -25
- package/dist/connectors/google-analytics.js +536 -109
- package/dist/connectors/google-audit-log.js +6 -4
- package/dist/connectors/google-calendar-oauth.js +63 -15
- package/dist/connectors/google-calendar.js +63 -11
- package/dist/connectors/google-docs.js +10 -10
- package/dist/connectors/google-drive.js +32 -10
- package/dist/connectors/google-search-console-oauth.js +128 -17
- package/dist/connectors/google-sheets.js +8 -6
- package/dist/connectors/google-slides.js +10 -10
- package/dist/connectors/grafana.js +47 -10
- package/dist/connectors/hubspot-oauth.js +41 -9
- package/dist/connectors/hubspot.js +27 -9
- package/dist/connectors/influxdb.js +10 -8
- package/dist/connectors/intercom-oauth.js +72 -12
- package/dist/connectors/intercom.js +14 -12
- package/dist/connectors/jdbc.js +8 -6
- package/dist/connectors/jira-api-key.js +70 -11
- package/dist/connectors/kintone-api-token.js +68 -18
- package/dist/connectors/kintone.js +56 -11
- package/dist/connectors/linear.js +56 -12
- package/dist/connectors/linkedin-ads.js +43 -14
- package/dist/connectors/mailchimp-oauth.js +8 -6
- package/dist/connectors/mailchimp.js +8 -6
- package/dist/connectors/meta-ads-oauth.js +35 -14
- package/dist/connectors/meta-ads.js +37 -14
- package/dist/connectors/mixpanel.js +10 -8
- package/dist/connectors/monday.js +11 -9
- package/dist/connectors/mongodb.js +10 -8
- package/dist/connectors/notion-oauth.js +60 -11
- package/dist/connectors/notion.js +62 -11
- package/dist/connectors/openai.js +4 -2
- package/dist/connectors/oracle.js +25 -7
- package/dist/connectors/outlook-oauth.js +20 -20
- package/dist/connectors/powerbi-oauth.js +12 -12
- package/dist/connectors/salesforce.js +44 -9
- package/dist/connectors/semrush.js +8 -6
- package/dist/connectors/sentry.js +38 -10
- package/dist/connectors/shopify-oauth.js +43 -10
- package/dist/connectors/shopify.js +10 -8
- package/dist/connectors/sqlserver.js +33 -7
- package/dist/connectors/stripe-api-key.js +68 -15
- package/dist/connectors/stripe-oauth.js +70 -19
- package/dist/connectors/supabase.js +24 -5
- package/dist/connectors/tableau.js +16 -14
- package/dist/connectors/tiktok-ads.js +39 -16
- package/dist/connectors/wix-store.js +10 -8
- package/dist/connectors/zendesk-oauth.js +55 -12
- package/dist/connectors/zendesk.js +14 -12
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3336 -743
- package/dist/main.js +3325 -737
- package/dist/vite-plugin.js +3305 -737
- 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
|
|
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[
|
|
207
|
+
result[`connector_${this.connectorKey}_${t.name}`] = {
|
|
206
208
|
...tool,
|
|
207
209
|
toModelOutput: async (options) => {
|
|
208
210
|
if (!originalToModelOutput) {
|
|
@@ -487,16 +489,16 @@ var ENTITY_LABELS = {
|
|
|
487
489
|
}
|
|
488
490
|
};
|
|
489
491
|
var ENTITY_PATHS = {
|
|
490
|
-
customers: "/v1/customers?limit=
|
|
491
|
-
charges: "/v1/charges?limit=
|
|
492
|
-
invoices: "/v1/invoices?limit=
|
|
493
|
-
subscriptions: "/v1/subscriptions?limit=
|
|
494
|
-
products: "/v1/products?limit=
|
|
495
|
-
prices: "/v1/prices?limit=
|
|
496
|
-
payouts: "/v1/payouts?limit=
|
|
497
|
-
refunds: "/v1/refunds?limit=
|
|
498
|
-
disputes: "/v1/disputes?limit=
|
|
499
|
-
paymentIntents: "/v1/payment_intents?limit=
|
|
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"
|
|
500
502
|
};
|
|
501
503
|
var ENTITY_VALUES = Object.keys(ENTITY_PATHS);
|
|
502
504
|
async function defaultFetchEntity(params, path2) {
|
|
@@ -532,6 +534,7 @@ function createStripeSetupFlow(fetchEntity = defaultFetchEntity, labelPrefix = "
|
|
|
532
534
|
const sections = [`## ${labelPrefix}`, ""];
|
|
533
535
|
for (const entity of selected) {
|
|
534
536
|
let count = "available";
|
|
537
|
+
let sampleRows = [];
|
|
535
538
|
const res = await fetchEntity(rt.params, ENTITY_PATHS[entity]);
|
|
536
539
|
if (res.ok) {
|
|
537
540
|
const data = await res.json();
|
|
@@ -540,13 +543,63 @@ function createStripeSetupFlow(fetchEntity = defaultFetchEntity, labelPrefix = "
|
|
|
540
543
|
} else if (data.has_more === false) {
|
|
541
544
|
count = String(data.data?.length ?? 1);
|
|
542
545
|
} else if (Array.isArray(data.data)) {
|
|
543
|
-
count = "
|
|
546
|
+
count = "many (paginated)";
|
|
544
547
|
}
|
|
548
|
+
sampleRows = (data.data ?? []).slice(0, 3);
|
|
545
549
|
} else {
|
|
546
550
|
count = "unavailable";
|
|
547
551
|
}
|
|
548
552
|
sections.push(`### ${ENTITY_LABELS[entity].en}`, "");
|
|
549
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
|
+
}
|
|
550
603
|
}
|
|
551
604
|
return sections.join("\n");
|
|
552
605
|
}
|
|
@@ -569,7 +622,7 @@ var stripeApiKeyConnector = new ConnectorPlugin({
|
|
|
569
622
|
systemPrompt: {
|
|
570
623
|
en: `### Tools
|
|
571
624
|
|
|
572
|
-
- \`
|
|
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\`.
|
|
573
626
|
|
|
574
627
|
### Stripe API Reference
|
|
575
628
|
|
|
@@ -620,7 +673,7 @@ const data = await res.json();
|
|
|
620
673
|
\`\`\``,
|
|
621
674
|
ja: `### \u30C4\u30FC\u30EB
|
|
622
675
|
|
|
623
|
-
- \`
|
|
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
|
|
624
677
|
|
|
625
678
|
### Stripe API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
626
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
|
|
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[
|
|
127
|
+
result[`connector_${this.connectorKey}_${t.name}`] = {
|
|
128
128
|
...tool,
|
|
129
129
|
toModelOutput: async (options) => {
|
|
130
130
|
if (!originalToModelOutput) {
|
|
@@ -387,11 +387,11 @@ var stripeOnboarding = new ConnectorOnboarding({
|
|
|
387
387
|
- Write only 1 sentence between tool calls, then immediately call the next tool. Skip unnecessary explanations and proceed efficiently`
|
|
388
388
|
},
|
|
389
389
|
dataOverviewInstructions: {
|
|
390
|
-
en: `1. Call
|
|
391
|
-
2. Call
|
|
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
|
|
392
392
|
3. Explore other endpoints (invoices, subscriptions, products) as needed`,
|
|
393
|
-
ja: `1.
|
|
394
|
-
2.
|
|
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
|
|
395
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`
|
|
396
396
|
}
|
|
397
397
|
});
|
|
@@ -421,16 +421,16 @@ var ENTITY_LABELS = {
|
|
|
421
421
|
}
|
|
422
422
|
};
|
|
423
423
|
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=
|
|
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"
|
|
434
434
|
};
|
|
435
435
|
var ENTITY_VALUES = Object.keys(ENTITY_PATHS);
|
|
436
436
|
var stripeOauthSetupFlow = {
|
|
@@ -462,6 +462,7 @@ var stripeOauthSetupFlow = {
|
|
|
462
462
|
const sections = ["## Stripe", ""];
|
|
463
463
|
for (const entity of selected) {
|
|
464
464
|
let count = "available";
|
|
465
|
+
let sampleRows = [];
|
|
465
466
|
const res = await rt.config.proxyFetch(
|
|
466
467
|
`${BASE_URL3}${ENTITY_PATHS[entity]}`,
|
|
467
468
|
{ method: "GET" }
|
|
@@ -473,13 +474,63 @@ var stripeOauthSetupFlow = {
|
|
|
473
474
|
} else if (data.has_more === false) {
|
|
474
475
|
count = String(data.data?.length ?? 1);
|
|
475
476
|
} else if (Array.isArray(data.data)) {
|
|
476
|
-
count = "
|
|
477
|
+
count = "many (paginated)";
|
|
477
478
|
}
|
|
479
|
+
sampleRows = (data.data ?? []).slice(0, 3);
|
|
478
480
|
} else {
|
|
479
481
|
count = "unavailable";
|
|
480
482
|
}
|
|
481
483
|
sections.push(`### ${ENTITY_LABELS[entity].en}`, "");
|
|
482
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
|
+
}
|
|
483
534
|
}
|
|
484
535
|
return sections.join("\n");
|
|
485
536
|
}
|
|
@@ -509,7 +560,7 @@ var stripeOauthConnector = new ConnectorPlugin({
|
|
|
509
560
|
systemPrompt: {
|
|
510
561
|
en: `### Tools
|
|
511
562
|
|
|
512
|
-
- \`
|
|
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\`.
|
|
513
564
|
|
|
514
565
|
### Stripe API Reference
|
|
515
566
|
|
|
@@ -558,7 +609,7 @@ const data = await res.json();
|
|
|
558
609
|
\`\`\``,
|
|
559
610
|
ja: `### \u30C4\u30FC\u30EB
|
|
560
611
|
|
|
561
|
-
- \`
|
|
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
|
|
562
613
|
|
|
563
614
|
### Stripe API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
564
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
|
|
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[
|
|
221
|
+
result[`connector_${this.connectorKey}_${t.name}`] = {
|
|
220
222
|
...tool,
|
|
221
223
|
toModelOutput: async (options) => {
|
|
222
224
|
if (!originalToModelOutput) {
|
|
@@ -467,6 +469,21 @@ var supabaseSetupFlow = {
|
|
|
467
469
|
fetchAll: () => fetchTableNames(rt.params, schema),
|
|
468
470
|
limit: SUPABASE_SETUP_MAX_TABLES
|
|
469
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
|
+
}
|
|
470
487
|
const sections = [
|
|
471
488
|
"## Supabase",
|
|
472
489
|
"",
|
|
@@ -482,7 +499,9 @@ var supabaseSetupFlow = {
|
|
|
482
499
|
ORDER BY ordinal_position`,
|
|
483
500
|
[schema, table]
|
|
484
501
|
);
|
|
485
|
-
|
|
502
|
+
const rowCount = rowCounts.get(table);
|
|
503
|
+
const heading = typeof rowCount === "number" ? `#### Table: ${table} (~${rowCount.toLocaleString()} rows)` : `#### Table: ${table}`;
|
|
504
|
+
sections.push(heading, "");
|
|
486
505
|
sections.push("| Column | Type | Nullable | Default |");
|
|
487
506
|
sections.push("|--------|------|----------|---------|");
|
|
488
507
|
for (const c of cols) {
|
|
@@ -593,7 +612,7 @@ var supabaseConnector = new ConnectorPlugin({
|
|
|
593
612
|
systemPrompt: {
|
|
594
613
|
en: `### Tools
|
|
595
614
|
|
|
596
|
-
- \`
|
|
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.
|
|
597
616
|
|
|
598
617
|
### Business Logic
|
|
599
618
|
|
|
@@ -610,7 +629,7 @@ The business logic type for this connector is "sql".
|
|
|
610
629
|
- Always include LIMIT in queries`,
|
|
611
630
|
ja: `### \u30C4\u30FC\u30EB
|
|
612
631
|
|
|
613
|
-
- \`
|
|
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
|
|
614
633
|
|
|
615
634
|
### Business Logic
|
|
616
635
|
|
|
@@ -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.
|
|
@@ -303,7 +305,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
303
305
|
/**
|
|
304
306
|
* Create tools for connections that belong to this connector.
|
|
305
307
|
* Filters connections by connectorKey internally.
|
|
306
|
-
* Returns tools keyed as
|
|
308
|
+
* Returns tools keyed as `connector_${connectorKey}_${toolName}`.
|
|
307
309
|
*/
|
|
308
310
|
createTools(connections, config, opts) {
|
|
309
311
|
const myConnections = connections.filter(
|
|
@@ -313,7 +315,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
313
315
|
for (const t of Object.values(this.tools)) {
|
|
314
316
|
const tool = t.createTool(myConnections, config);
|
|
315
317
|
const originalToModelOutput = tool.toModelOutput;
|
|
316
|
-
result[
|
|
318
|
+
result[`connector_${this.connectorKey}_${t.name}`] = {
|
|
317
319
|
...tool,
|
|
318
320
|
toModelOutput: async (options) => {
|
|
319
321
|
if (!originalToModelOutput) {
|
|
@@ -445,7 +447,7 @@ var tableauOnboarding = new ConnectorOnboarding({
|
|
|
445
447
|
connectionSetupInstructions: {
|
|
446
448
|
en: `Follow these steps to verify the Tableau PAT connection.
|
|
447
449
|
|
|
448
|
-
1. Call \`
|
|
450
|
+
1. Call \`connector_tableau_request\` with \`method: "GET"\` and \`path: "/sites/{siteId}/projects?pageSize=5"\` to list a few projects on the signed-in site
|
|
449
451
|
2. If the call fails with HTTP 401, ask the user to confirm the PAT name/secret and that the Site Content URL matches the site where the PAT was issued (Tableau Cloud sites are case-sensitive)
|
|
450
452
|
|
|
451
453
|
#### Constraints
|
|
@@ -453,7 +455,7 @@ var tableauOnboarding = new ConnectorOnboarding({
|
|
|
453
455
|
- The literal placeholder \`{siteId}\` in the path is automatically replaced with the session's site ID \u2014 do NOT hardcode the ID`,
|
|
454
456
|
ja: `Tableau PAT \u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306E\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u306F\u4EE5\u4E0B\u306E\u624B\u9806\u3067\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002
|
|
455
457
|
|
|
456
|
-
1. \`
|
|
458
|
+
1. \`connector_tableau_request\` \u3092 \`method: "GET"\`\u3001\`path: "/sites/{siteId}/projects?pageSize=5"\` \u3067\u547C\u3073\u51FA\u3057\u3001\u30B5\u30A4\u30F3\u30A4\u30F3\u5148\u30B5\u30A4\u30C8\u306E\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u3092\u3044\u304F\u3064\u304B\u53D6\u5F97\u3059\u308B
|
|
457
459
|
2. HTTP 401 \u3067\u5931\u6557\u3057\u305F\u5834\u5408\u306F\u3001PAT \u540D/\u30B7\u30FC\u30AF\u30EC\u30C3\u30C8\u304A\u3088\u3073 Site Content URL \u304C PAT \u767A\u884C\u30B5\u30A4\u30C8\u3068\u4E00\u81F4\u3057\u3066\u3044\u308B\u304B\u3092\u30E6\u30FC\u30B6\u30FC\u306B\u78BA\u8A8D\u3059\u308B\u3088\u3046\u4F1D\u3048\u308B\uFF08Tableau Cloud \u306E\u30B5\u30A4\u30C8\u540D\u306F\u5927\u6587\u5B57\u5C0F\u6587\u5B57\u3092\u533A\u5225\uFF09
|
|
458
460
|
|
|
459
461
|
#### \u5236\u7D04
|
|
@@ -461,14 +463,14 @@ var tableauOnboarding = new ConnectorOnboarding({
|
|
|
461
463
|
- \u30D1\u30B9\u5185\u306E\u30D7\u30EC\u30FC\u30B9\u30DB\u30EB\u30C0\u30FC \`{siteId}\` \u306F\u30BB\u30C3\u30B7\u30E7\u30F3\u306E\u30B5\u30A4\u30C8 ID \u3067\u81EA\u52D5\u7F6E\u63DB\u3055\u308C\u307E\u3059 \u2014 ID \u3092\u30CF\u30FC\u30C9\u30B3\u30FC\u30C9\u3057\u306A\u3044\u3053\u3068`
|
|
462
464
|
},
|
|
463
465
|
dataOverviewInstructions: {
|
|
464
|
-
en: `1. Call
|
|
465
|
-
2. Call
|
|
466
|
-
3. For a target workbook, call
|
|
467
|
-
4. Call
|
|
468
|
-
ja: `1.
|
|
469
|
-
2.
|
|
470
|
-
3. \u5BFE\u8C61\u30EF\u30FC\u30AF\u30D6\u30C3\u30AF\u306B\u3064\u3044\u3066
|
|
471
|
-
4.
|
|
466
|
+
en: `1. Call connector_tableau_request with GET /sites/{siteId}/projects to list projects
|
|
467
|
+
2. Call connector_tableau_request with GET /sites/{siteId}/workbooks?pageSize=20 to list workbooks
|
|
468
|
+
3. For a target workbook, call connector_tableau_request with GET /sites/{siteId}/workbooks/{workbookId}/views to list its views
|
|
469
|
+
4. Call connector_tableau_request with GET /sites/{siteId}/datasources?pageSize=20 to list published data sources`,
|
|
470
|
+
ja: `1. connector_tableau_request \u3067 GET /sites/{siteId}/projects \u3092\u547C\u3073\u51FA\u3057\u3001\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u4E00\u89A7\u3092\u53D6\u5F97
|
|
471
|
+
2. connector_tableau_request \u3067 GET /sites/{siteId}/workbooks?pageSize=20 \u3092\u547C\u3073\u51FA\u3057\u3001\u30EF\u30FC\u30AF\u30D6\u30C3\u30AF\u4E00\u89A7\u3092\u53D6\u5F97
|
|
472
|
+
3. \u5BFE\u8C61\u30EF\u30FC\u30AF\u30D6\u30C3\u30AF\u306B\u3064\u3044\u3066 connector_tableau_request \u3067 GET /sites/{siteId}/workbooks/{workbookId}/views \u3092\u547C\u3073\u51FA\u3057\u3001\u30D3\u30E5\u30FC\u4E00\u89A7\u3092\u53D6\u5F97
|
|
473
|
+
4. connector_tableau_request \u3067 GET /sites/{siteId}/datasources?pageSize=20 \u3092\u547C\u3073\u51FA\u3057\u3001\u516C\u958B\u30C7\u30FC\u30BF\u30BD\u30FC\u30B9\u4E00\u89A7\u3092\u53D6\u5F97`
|
|
472
474
|
}
|
|
473
475
|
});
|
|
474
476
|
|
|
@@ -921,7 +923,7 @@ var tableauConnector = new ConnectorPlugin({
|
|
|
921
923
|
systemPrompt: {
|
|
922
924
|
en: `### Tools
|
|
923
925
|
|
|
924
|
-
- \`
|
|
926
|
+
- \`connector_tableau_request\`: The only way to call the Tableau REST API. Use it for projects, workbooks, views, data sources, users, and permissions. The \`X-Tableau-Auth\` token is issued and managed centrally by the Squadbase backend so concurrent processes (chat & deployed app) share a single PAT sign-in. Use the literal \`{siteId}\` placeholder in the path \u2014 it is replaced with the session's site ID automatically.
|
|
925
927
|
|
|
926
928
|
### Business Logic
|
|
927
929
|
|
|
@@ -978,7 +980,7 @@ export default async function handler(c: Context) {
|
|
|
978
980
|
- Combine: \`filter=ownerName:eq:alice,tags:in:[finance]\``,
|
|
979
981
|
ja: `### \u30C4\u30FC\u30EB
|
|
980
982
|
|
|
981
|
-
- \`
|
|
983
|
+
- \`connector_tableau_request\`: Tableau REST API \u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u3001\u30EF\u30FC\u30AF\u30D6\u30C3\u30AF\u3001\u30D3\u30E5\u30FC\u3001\u30C7\u30FC\u30BF\u30BD\u30FC\u30B9\u3001\u30E6\u30FC\u30B6\u30FC\u3001\u6A29\u9650\u306A\u3069\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\`X-Tableau-Auth\` \u30C8\u30FC\u30AF\u30F3\u306F Squadbase \u30D0\u30C3\u30AF\u30A8\u30F3\u30C9\u3067\u4E00\u5143\u7BA1\u7406\u3055\u308C\u3001\u8907\u6570\u30D7\u30ED\u30BB\u30B9 (\u30C1\u30E3\u30C3\u30C8\u30FB\u30C7\u30D7\u30ED\u30A4\u6E08\u307F\u30A2\u30D7\u30EA) \u3067\u540C\u3058 PAT \u30B5\u30A4\u30F3\u30A4\u30F3\u3092\u5171\u6709\u3057\u307E\u3059\u3002\u30D1\u30B9\u5185\u306B\u306F \`{siteId}\` \u30D7\u30EC\u30FC\u30B9\u30DB\u30EB\u30C0\u30FC\u3092\u4F7F\u3063\u3066\u304F\u3060\u3055\u3044 \u2014 \u30BB\u30C3\u30B7\u30E7\u30F3\u306E\u30B5\u30A4\u30C8 ID \u3067\u81EA\u52D5\u7F6E\u63DB\u3055\u308C\u307E\u3059\u3002
|
|
982
984
|
|
|
983
985
|
### Business Logic
|
|
984
986
|
|
|
@@ -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.
|
|
@@ -169,7 +171,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
169
171
|
/**
|
|
170
172
|
* Create tools for connections that belong to this connector.
|
|
171
173
|
* Filters connections by connectorKey internally.
|
|
172
|
-
* Returns tools keyed as
|
|
174
|
+
* Returns tools keyed as `connector_${connectorKey}_${toolName}`.
|
|
173
175
|
*/
|
|
174
176
|
createTools(connections, config, opts) {
|
|
175
177
|
const myConnections = connections.filter(
|
|
@@ -179,7 +181,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
179
181
|
for (const t of Object.values(this.tools)) {
|
|
180
182
|
const tool = t.createTool(myConnections, config);
|
|
181
183
|
const originalToModelOutput = tool.toModelOutput;
|
|
182
|
-
result[
|
|
184
|
+
result[`connector_${this.connectorKey}_${t.name}`] = {
|
|
183
185
|
...tool,
|
|
184
186
|
toModelOutput: async (options) => {
|
|
185
187
|
if (!originalToModelOutput) {
|
|
@@ -466,12 +468,12 @@ var tiktokAdsOnboarding = new ConnectorOnboarding({
|
|
|
466
468
|
- Write only 1 sentence between tool calls, then immediately call the next tool. Skip unnecessary explanations and proceed efficiently`
|
|
467
469
|
},
|
|
468
470
|
dataOverviewInstructions: {
|
|
469
|
-
en: `1. Call
|
|
470
|
-
2. Call
|
|
471
|
-
3. Call
|
|
472
|
-
ja: `1.
|
|
473
|
-
2.
|
|
474
|
-
3.
|
|
471
|
+
en: `1. Call connector_tiktok-ads_request with GET campaign/get/ to explore campaign data
|
|
472
|
+
2. Call connector_tiktok-ads_request with GET adgroup/get/ to explore ad group data
|
|
473
|
+
3. Call connector_tiktok-ads_request with GET report/integrated/get/ with metrics=["spend","impressions","clicks","ctr","cpm","cpc"]&dimensions=["campaign_id"]&data_level=AUCTION_CAMPAIGN&start_date=YYYY-MM-DD&end_date=YYYY-MM-DD to check recent performance`,
|
|
474
|
+
ja: `1. connector_tiktok-ads_request \u3067 GET campaign/get/ \u3092\u547C\u3073\u51FA\u3057\u3066\u30AD\u30E3\u30F3\u30DA\u30FC\u30F3\u30C7\u30FC\u30BF\u3092\u63A2\u7D22
|
|
475
|
+
2. connector_tiktok-ads_request \u3067 GET adgroup/get/ \u3092\u547C\u3073\u51FA\u3057\u3066\u5E83\u544A\u30B0\u30EB\u30FC\u30D7\u30C7\u30FC\u30BF\u3092\u63A2\u7D22
|
|
476
|
+
3. connector_tiktok-ads_request \u3067 GET report/integrated/get/ \u306B metrics=["spend","impressions","clicks","ctr","cpm","cpc"]&dimensions=["campaign_id"]&data_level=AUCTION_CAMPAIGN&start_date=YYYY-MM-DD&end_date=YYYY-MM-DD \u3092\u6307\u5B9A\u3057\u3066\u76F4\u8FD1\u306E\u30D1\u30D5\u30A9\u30FC\u30DE\u30F3\u30B9\u3092\u78BA\u8A8D`
|
|
475
477
|
}
|
|
476
478
|
});
|
|
477
479
|
|
|
@@ -511,6 +513,19 @@ async function listAdvertisers(proxyFetch) {
|
|
|
511
513
|
}
|
|
512
514
|
return data.data?.list ?? [];
|
|
513
515
|
}
|
|
516
|
+
async function fetchCampaignCount(proxyFetch, advertiserId) {
|
|
517
|
+
try {
|
|
518
|
+
const url = `${BASE_URL3}/campaign/get/?advertiser_id=${encodeURIComponent(advertiserId)}&page_size=1`;
|
|
519
|
+
const res = await proxyFetch(url, { method: "GET" });
|
|
520
|
+
if (!res.ok) return null;
|
|
521
|
+
const data = await res.json();
|
|
522
|
+
if (data.code !== void 0 && data.code !== 0) return null;
|
|
523
|
+
const total = data.data?.page_info?.total_number;
|
|
524
|
+
return typeof total === "number" ? total : null;
|
|
525
|
+
} catch {
|
|
526
|
+
return null;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
514
529
|
async function fetchAdvertiserInfo(proxyFetch, advertiserId) {
|
|
515
530
|
const advertiserIdsParam = encodeURIComponent(
|
|
516
531
|
JSON.stringify([advertiserId])
|
|
@@ -575,16 +590,24 @@ var tiktokAdsSetupFlow = {
|
|
|
575
590
|
sections.push("_No advertisers selected._", "");
|
|
576
591
|
return sections.join("\n");
|
|
577
592
|
}
|
|
578
|
-
sections.push(
|
|
579
|
-
|
|
593
|
+
sections.push(
|
|
594
|
+
"| Advertiser ID | Name | Currency | Status | Time Zone | Campaigns |"
|
|
595
|
+
);
|
|
596
|
+
sections.push(
|
|
597
|
+
"|---------------|------|----------|--------|-----------|-----------|"
|
|
598
|
+
);
|
|
580
599
|
for (const id of targetIds) {
|
|
581
|
-
const info = await
|
|
600
|
+
const [info, campaignCount] = await Promise.all([
|
|
601
|
+
fetchAdvertiserInfo(rt.config.proxyFetch, id),
|
|
602
|
+
fetchCampaignCount(rt.config.proxyFetch, id)
|
|
603
|
+
]);
|
|
582
604
|
const name = (info.name ?? "-").replace(/\|/g, "\\|");
|
|
583
605
|
const currency = info.currency ?? "-";
|
|
584
606
|
const status = info.status ?? "-";
|
|
585
607
|
const timeZone = info.display_timezone ?? "-";
|
|
608
|
+
const campaigns = campaignCount == null ? "-" : String(campaignCount);
|
|
586
609
|
sections.push(
|
|
587
|
-
`| ${id} | ${name} | ${currency} | ${status} | ${timeZone} |`
|
|
610
|
+
`| ${id} | ${name} | ${currency} | ${status} | ${timeZone} | ${campaigns} |`
|
|
588
611
|
);
|
|
589
612
|
}
|
|
590
613
|
sections.push("");
|
|
@@ -757,8 +780,8 @@ var tiktokAdsConnector = new ConnectorPlugin({
|
|
|
757
780
|
systemPrompt: {
|
|
758
781
|
en: `### Tools
|
|
759
782
|
|
|
760
|
-
- \`
|
|
761
|
-
- \`
|
|
783
|
+
- \`connector_tiktok-ads_request\`: Send authenticated requests to the TikTok Marketing API v1.3. Authentication is handled automatically via OAuth proxy. The advertiser_id is automatically injected if configured.
|
|
784
|
+
- \`connector_tiktok-ads_listAdvertisers\`: List accessible TikTok Ads advertiser accounts. Use this during setup to discover available accounts.
|
|
762
785
|
|
|
763
786
|
### TikTok Marketing API Reference
|
|
764
787
|
|
|
@@ -823,8 +846,8 @@ const data = await res.json();
|
|
|
823
846
|
\`\`\``,
|
|
824
847
|
ja: `### \u30C4\u30FC\u30EB
|
|
825
848
|
|
|
826
|
-
- \`
|
|
827
|
-
- \`
|
|
849
|
+
- \`connector_tiktok-ads_request\`: TikTok Marketing API v1.3\u3078\u8A8D\u8A3C\u6E08\u307F\u30EA\u30AF\u30A8\u30B9\u30C8\u3092\u9001\u4FE1\u3057\u307E\u3059\u3002\u8A8D\u8A3C\u306FOAuth\u30D7\u30ED\u30AD\u30B7\u7D4C\u7531\u3067\u81EA\u52D5\u7684\u306B\u51E6\u7406\u3055\u308C\u307E\u3059\u3002advertiser_id\u304C\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u308B\u5834\u5408\u306F\u81EA\u52D5\u7684\u306B\u6CE8\u5165\u3055\u308C\u307E\u3059\u3002
|
|
850
|
+
- \`connector_tiktok-ads_listAdvertisers\`: \u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306ATikTok Ads\u5E83\u544A\u4E3B\u30A2\u30AB\u30A6\u30F3\u30C8\u306E\u4E00\u89A7\u3092\u53D6\u5F97\u3057\u307E\u3059\u3002\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u6642\u306B\u5229\u7528\u53EF\u80FD\u306A\u30A2\u30AB\u30A6\u30F3\u30C8\u3092\u78BA\u8A8D\u3059\u308B\u305F\u3081\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002
|
|
828
851
|
|
|
829
852
|
### TikTok Marketing API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
830
853
|
|