@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
|
|
@@ -132,6 +137,15 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
132
137
|
* `runSetupFlow` from `setup-flow.ts`.
|
|
133
138
|
*/
|
|
134
139
|
setup;
|
|
140
|
+
/**
|
|
141
|
+
* 統一 introspection。SQL DB の `information_schema` / `SHOW` / `DESCRIBE` や SaaS の
|
|
142
|
+
* メタデータ API といった取得経路の差を吸収し、tables / columns / PK / FK を共通型
|
|
143
|
+
* {@link IntrospectedSchema} へ正規化して返す。取得経路は {@link IntrospectContext} で
|
|
144
|
+
* 抽象化され、SQL DB は `ctx.query`、SaaS は `ctx.proxyFetch` + `ctx.params` を使う。
|
|
145
|
+
* `ctx.profile === true` のときは L2 プロファイル(行数・NULL 率等)も best-effort で埋める。
|
|
146
|
+
* coding-agent の `DataContextIndex` がデータ地図を構築する際に使う。
|
|
147
|
+
*/
|
|
148
|
+
introspect;
|
|
135
149
|
/**
|
|
136
150
|
* Opt-out of the default "verify before save" behavior on connection
|
|
137
151
|
* creation. The backend invokes `checkConnection` synchronously while
|
|
@@ -146,6 +160,14 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
146
160
|
* the default verify-on-create behavior without opt-in.
|
|
147
161
|
*/
|
|
148
162
|
skipConnectionCheckOnCreate;
|
|
163
|
+
/**
|
|
164
|
+
* 決定論的な「立ち上げ survey」レシピ(ルールベース prewarm 基盤)。実装した connector は、LLM を使わずに
|
|
165
|
+
* read-only で自分を survey する probe 列(テーブル/列メタデータ → 小サンプル)を宣言する。coding-agent の
|
|
166
|
+
* recon driver がこれを読み、connector ツールの `execute` を直接呼んで結果を seed にする。未実装の connector は
|
|
167
|
+
* driver 側で safely skip される(その connection は listConnections のみ seed)。標準 `information_schema` を
|
|
168
|
+
* 持つ SQL connector は `makeStandardSqlSurveyProbes` を使える。**probe は必ず read-only**。
|
|
169
|
+
*/
|
|
170
|
+
surveyProbes;
|
|
149
171
|
constructor(config) {
|
|
150
172
|
this.slug = config.slug;
|
|
151
173
|
this.authType = config.authType;
|
|
@@ -163,7 +185,9 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
163
185
|
this.query = config.query;
|
|
164
186
|
this.checkConnection = config.checkConnection;
|
|
165
187
|
this.setup = config.setup;
|
|
188
|
+
this.introspect = config.introspect;
|
|
166
189
|
this.skipConnectionCheckOnCreate = config.skipConnectionCheckOnCreate;
|
|
190
|
+
this.surveyProbes = config.surveyProbes;
|
|
167
191
|
}
|
|
168
192
|
get connectorKey() {
|
|
169
193
|
return _ConnectorPlugin.deriveKey(this.slug, this.authType);
|
|
@@ -171,7 +195,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
171
195
|
/**
|
|
172
196
|
* Create tools for connections that belong to this connector.
|
|
173
197
|
* Filters connections by connectorKey internally.
|
|
174
|
-
* Returns tools keyed as
|
|
198
|
+
* Returns tools keyed as `connector_${connectorKey}_${toolName}`.
|
|
175
199
|
*/
|
|
176
200
|
createTools(connections, config, opts) {
|
|
177
201
|
const myConnections = connections.filter(
|
|
@@ -181,7 +205,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
181
205
|
for (const t of Object.values(this.tools)) {
|
|
182
206
|
const tool = t.createTool(myConnections, config);
|
|
183
207
|
const originalToModelOutput = tool.toModelOutput;
|
|
184
|
-
result[
|
|
208
|
+
result[`connector_${this.connectorKey}_${t.name}`] = {
|
|
185
209
|
...tool,
|
|
186
210
|
toModelOutput: async (options) => {
|
|
187
211
|
if (!originalToModelOutput) {
|
|
@@ -201,25 +225,25 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
201
225
|
if (authType) return `${slug}-${authType}`;
|
|
202
226
|
const LEGACY_NULL_AUTH_TYPE_MAP = {
|
|
203
227
|
// user-password
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
228
|
+
postgresql: "user-password",
|
|
229
|
+
mysql: "user-password",
|
|
230
|
+
clickhouse: "user-password",
|
|
231
|
+
kintone: "user-password",
|
|
208
232
|
"squadbase-db": "user-password",
|
|
209
233
|
// service-account
|
|
210
|
-
|
|
211
|
-
|
|
234
|
+
snowflake: "service-account",
|
|
235
|
+
bigquery: "service-account",
|
|
212
236
|
"google-analytics": "service-account",
|
|
213
237
|
"google-calendar": "service-account",
|
|
214
238
|
"aws-athena": "service-account",
|
|
215
|
-
|
|
239
|
+
redshift: "service-account",
|
|
216
240
|
// api-key
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
241
|
+
databricks: "api-key",
|
|
242
|
+
dbt: "api-key",
|
|
243
|
+
airtable: "api-key",
|
|
244
|
+
openai: "api-key",
|
|
245
|
+
gemini: "api-key",
|
|
246
|
+
anthropic: "api-key",
|
|
223
247
|
"wix-store": "api-key"
|
|
224
248
|
};
|
|
225
249
|
const fallbackAuthType = LEGACY_NULL_AUTH_TYPE_MAP[slug];
|
|
@@ -448,11 +472,11 @@ var metaAdsOauthOnboarding = new ConnectorOnboarding({
|
|
|
448
472
|
- Write only 1 sentence between tool calls, then immediately call the next tool. Skip unnecessary explanations and proceed efficiently`
|
|
449
473
|
},
|
|
450
474
|
dataOverviewInstructions: {
|
|
451
|
-
en: `1. Call
|
|
452
|
-
2. Call
|
|
475
|
+
en: `1. Call connector_meta-ads-oauth_request with GET act_{adAccountId}/campaigns?fields=id,name,status,objective to explore campaign data
|
|
476
|
+
2. Call connector_meta-ads-oauth_request with GET act_{adAccountId}/insights?fields=impressions,clicks,spend,ctr,cpm&date_preset=last_7d to check recent performance
|
|
453
477
|
3. Explore ad sets and ads as needed to understand the data structure`,
|
|
454
|
-
ja: `1.
|
|
455
|
-
2.
|
|
478
|
+
ja: `1. connector_meta-ads-oauth_request \u3067 GET act_{adAccountId}/campaigns?fields=id,name,status,objective \u3092\u547C\u3073\u51FA\u3057\u3066\u30AD\u30E3\u30F3\u30DA\u30FC\u30F3\u30C7\u30FC\u30BF\u3092\u63A2\u7D22
|
|
479
|
+
2. connector_meta-ads-oauth_request \u3067 GET act_{adAccountId}/insights?fields=impressions,clicks,spend,ctr,cpm&date_preset=last_7d \u3092\u547C\u3073\u51FA\u3057\u3066\u76F4\u8FD1\u306E\u30D1\u30D5\u30A9\u30FC\u30DE\u30F3\u30B9\u3092\u78BA\u8A8D
|
|
456
480
|
3. \u5FC5\u8981\u306B\u5FDC\u3058\u3066\u5E83\u544A\u30BB\u30C3\u30C8\u3084\u5E83\u544A\u30C7\u30FC\u30BF\u3092\u63A2\u7D22\u3057\u3001\u30C7\u30FC\u30BF\u69CB\u9020\u3092\u628A\u63E1`
|
|
457
481
|
}
|
|
458
482
|
});
|
|
@@ -503,6 +527,18 @@ async function listAdAccounts(proxyFetch) {
|
|
|
503
527
|
const data = await res.json();
|
|
504
528
|
return data.data ?? [];
|
|
505
529
|
}
|
|
530
|
+
async function fetchCampaignCount(proxyFetch, accountId) {
|
|
531
|
+
try {
|
|
532
|
+
const url = `${BASE_URL3}/act_${encodeURIComponent(accountId)}/campaigns?summary=total_count&limit=0`;
|
|
533
|
+
const res = await proxyFetch(url, { method: "GET" });
|
|
534
|
+
if (!res.ok) return null;
|
|
535
|
+
const data = await res.json();
|
|
536
|
+
const total = data.summary?.total_count;
|
|
537
|
+
return typeof total === "number" ? total : null;
|
|
538
|
+
} catch {
|
|
539
|
+
return null;
|
|
540
|
+
}
|
|
541
|
+
}
|
|
506
542
|
function bareAdAccountId(account) {
|
|
507
543
|
if (account.account_id) return account.account_id;
|
|
508
544
|
return (account.id ?? "").replace(/^act_/, "");
|
|
@@ -554,14 +590,21 @@ var metaAdsOauthSetupFlow = {
|
|
|
554
590
|
sections.push("_No ad accounts selected._", "");
|
|
555
591
|
return sections.join("\n");
|
|
556
592
|
}
|
|
557
|
-
sections.push("| Ad Account ID | Name | Currency | Status |");
|
|
558
|
-
sections.push("
|
|
559
|
-
|
|
593
|
+
sections.push("| Ad Account ID | Name | Currency | Status | Campaigns |");
|
|
594
|
+
sections.push("|---------------|------|----------|--------|-----------|");
|
|
595
|
+
const campaignCounts = await Promise.all(
|
|
596
|
+
targetIds.map((id) => fetchCampaignCount(rt.config.proxyFetch, id))
|
|
597
|
+
);
|
|
598
|
+
for (let i = 0; i < targetIds.length; i++) {
|
|
599
|
+
const id = targetIds[i];
|
|
560
600
|
const account = byId.get(id);
|
|
561
601
|
const name = (account?.name ?? "-").replace(/\|/g, "\\|");
|
|
562
602
|
const currency = account?.currency ?? "-";
|
|
563
603
|
const status = statusLabel(account?.account_status);
|
|
564
|
-
|
|
604
|
+
const campaigns = campaignCounts[i] == null ? "-" : String(campaignCounts[i]);
|
|
605
|
+
sections.push(
|
|
606
|
+
`| ${id} | ${name} | ${currency} | ${status} | ${campaigns} |`
|
|
607
|
+
);
|
|
565
608
|
}
|
|
566
609
|
sections.push("");
|
|
567
610
|
return sections.join("\n");
|
|
@@ -716,8 +759,8 @@ var metaAdsOauthConnector = new ConnectorPlugin({
|
|
|
716
759
|
systemPrompt: {
|
|
717
760
|
en: `### Tools
|
|
718
761
|
|
|
719
|
-
- \`
|
|
720
|
-
- \`
|
|
762
|
+
- \`connector_meta-ads-oauth_request\`: Send authenticated requests to the Meta Marketing API v21.0. The {adAccountId} placeholder in paths is automatically replaced. Authentication is handled automatically via OAuth proxy.
|
|
763
|
+
- \`connector_meta-ads-oauth_listAdAccounts\`: List accessible Meta ad accounts. Use this during setup to discover available accounts.
|
|
721
764
|
|
|
722
765
|
### Meta Marketing API Reference
|
|
723
766
|
|
|
@@ -773,8 +816,8 @@ const data = await res.json();
|
|
|
773
816
|
\`\`\``,
|
|
774
817
|
ja: `### \u30C4\u30FC\u30EB
|
|
775
818
|
|
|
776
|
-
- \`
|
|
777
|
-
- \`
|
|
819
|
+
- \`connector_meta-ads-oauth_request\`: Meta Marketing API v21.0\u3078\u8A8D\u8A3C\u6E08\u307F\u30EA\u30AF\u30A8\u30B9\u30C8\u3092\u9001\u4FE1\u3057\u307E\u3059\u3002\u30D1\u30B9\u5185\u306E{adAccountId}\u30D7\u30EC\u30FC\u30B9\u30DB\u30EB\u30C0\u30FC\u306F\u81EA\u52D5\u7684\u306B\u7F6E\u63DB\u3055\u308C\u307E\u3059\u3002\u8A8D\u8A3C\u306FOAuth\u30D7\u30ED\u30AD\u30B7\u7D4C\u7531\u3067\u81EA\u52D5\u7684\u306B\u51E6\u7406\u3055\u308C\u307E\u3059\u3002
|
|
820
|
+
- \`connector_meta-ads-oauth_listAdAccounts\`: \u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306AMeta\u5E83\u544A\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
|
|
778
821
|
|
|
779
822
|
### Meta Marketing API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
780
823
|
|
|
@@ -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
|
|
@@ -203,6 +208,15 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
203
208
|
* `runSetupFlow` from `setup-flow.ts`.
|
|
204
209
|
*/
|
|
205
210
|
setup;
|
|
211
|
+
/**
|
|
212
|
+
* 統一 introspection。SQL DB の `information_schema` / `SHOW` / `DESCRIBE` や SaaS の
|
|
213
|
+
* メタデータ API といった取得経路の差を吸収し、tables / columns / PK / FK を共通型
|
|
214
|
+
* {@link IntrospectedSchema} へ正規化して返す。取得経路は {@link IntrospectContext} で
|
|
215
|
+
* 抽象化され、SQL DB は `ctx.query`、SaaS は `ctx.proxyFetch` + `ctx.params` を使う。
|
|
216
|
+
* `ctx.profile === true` のときは L2 プロファイル(行数・NULL 率等)も best-effort で埋める。
|
|
217
|
+
* coding-agent の `DataContextIndex` がデータ地図を構築する際に使う。
|
|
218
|
+
*/
|
|
219
|
+
introspect;
|
|
206
220
|
/**
|
|
207
221
|
* Opt-out of the default "verify before save" behavior on connection
|
|
208
222
|
* creation. The backend invokes `checkConnection` synchronously while
|
|
@@ -217,6 +231,14 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
217
231
|
* the default verify-on-create behavior without opt-in.
|
|
218
232
|
*/
|
|
219
233
|
skipConnectionCheckOnCreate;
|
|
234
|
+
/**
|
|
235
|
+
* 決定論的な「立ち上げ survey」レシピ(ルールベース prewarm 基盤)。実装した connector は、LLM を使わずに
|
|
236
|
+
* read-only で自分を survey する probe 列(テーブル/列メタデータ → 小サンプル)を宣言する。coding-agent の
|
|
237
|
+
* recon driver がこれを読み、connector ツールの `execute` を直接呼んで結果を seed にする。未実装の connector は
|
|
238
|
+
* driver 側で safely skip される(その connection は listConnections のみ seed)。標準 `information_schema` を
|
|
239
|
+
* 持つ SQL connector は `makeStandardSqlSurveyProbes` を使える。**probe は必ず read-only**。
|
|
240
|
+
*/
|
|
241
|
+
surveyProbes;
|
|
220
242
|
constructor(config) {
|
|
221
243
|
this.slug = config.slug;
|
|
222
244
|
this.authType = config.authType;
|
|
@@ -234,7 +256,9 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
234
256
|
this.query = config.query;
|
|
235
257
|
this.checkConnection = config.checkConnection;
|
|
236
258
|
this.setup = config.setup;
|
|
259
|
+
this.introspect = config.introspect;
|
|
237
260
|
this.skipConnectionCheckOnCreate = config.skipConnectionCheckOnCreate;
|
|
261
|
+
this.surveyProbes = config.surveyProbes;
|
|
238
262
|
}
|
|
239
263
|
get connectorKey() {
|
|
240
264
|
return _ConnectorPlugin.deriveKey(this.slug, this.authType);
|
|
@@ -242,7 +266,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
242
266
|
/**
|
|
243
267
|
* Create tools for connections that belong to this connector.
|
|
244
268
|
* Filters connections by connectorKey internally.
|
|
245
|
-
* Returns tools keyed as
|
|
269
|
+
* Returns tools keyed as `connector_${connectorKey}_${toolName}`.
|
|
246
270
|
*/
|
|
247
271
|
createTools(connections, config, opts) {
|
|
248
272
|
const myConnections = connections.filter(
|
|
@@ -252,7 +276,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
252
276
|
for (const t of Object.values(this.tools)) {
|
|
253
277
|
const tool = t.createTool(myConnections, config);
|
|
254
278
|
const originalToModelOutput = tool.toModelOutput;
|
|
255
|
-
result[
|
|
279
|
+
result[`connector_${this.connectorKey}_${t.name}`] = {
|
|
256
280
|
...tool,
|
|
257
281
|
toModelOutput: async (options) => {
|
|
258
282
|
if (!originalToModelOutput) {
|
|
@@ -272,25 +296,25 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
272
296
|
if (authType) return `${slug}-${authType}`;
|
|
273
297
|
const LEGACY_NULL_AUTH_TYPE_MAP = {
|
|
274
298
|
// user-password
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
299
|
+
postgresql: "user-password",
|
|
300
|
+
mysql: "user-password",
|
|
301
|
+
clickhouse: "user-password",
|
|
302
|
+
kintone: "user-password",
|
|
279
303
|
"squadbase-db": "user-password",
|
|
280
304
|
// service-account
|
|
281
|
-
|
|
282
|
-
|
|
305
|
+
snowflake: "service-account",
|
|
306
|
+
bigquery: "service-account",
|
|
283
307
|
"google-analytics": "service-account",
|
|
284
308
|
"google-calendar": "service-account",
|
|
285
309
|
"aws-athena": "service-account",
|
|
286
|
-
|
|
310
|
+
redshift: "service-account",
|
|
287
311
|
// api-key
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
312
|
+
databricks: "api-key",
|
|
313
|
+
dbt: "api-key",
|
|
314
|
+
airtable: "api-key",
|
|
315
|
+
openai: "api-key",
|
|
316
|
+
gemini: "api-key",
|
|
317
|
+
anthropic: "api-key",
|
|
294
318
|
"wix-store": "api-key"
|
|
295
319
|
};
|
|
296
320
|
const fallbackAuthType = LEGACY_NULL_AUTH_TYPE_MAP[slug];
|
|
@@ -480,11 +504,11 @@ var metaAdsOnboarding = new ConnectorOnboarding({
|
|
|
480
504
|
- Write only 1 sentence between tool calls, then immediately call the next tool. Skip unnecessary explanations and proceed efficiently`
|
|
481
505
|
},
|
|
482
506
|
dataOverviewInstructions: {
|
|
483
|
-
en: `1. Call
|
|
484
|
-
2. Call
|
|
507
|
+
en: `1. Call connector_meta-ads_request with GET act_{adAccountId}/campaigns?fields=id,name,status,objective to explore campaign data
|
|
508
|
+
2. Call connector_meta-ads_request with GET act_{adAccountId}/insights?fields=impressions,clicks,spend,ctr,cpm&date_preset=last_7d to check recent performance
|
|
485
509
|
3. Explore ad sets and ads as needed to understand the data structure`,
|
|
486
|
-
ja: `1.
|
|
487
|
-
2.
|
|
510
|
+
ja: `1. connector_meta-ads_request \u3067 GET act_{adAccountId}/campaigns?fields=id,name,status,objective \u3092\u547C\u3073\u51FA\u3057\u3066\u30AD\u30E3\u30F3\u30DA\u30FC\u30F3\u30C7\u30FC\u30BF\u3092\u63A2\u7D22
|
|
511
|
+
2. connector_meta-ads_request \u3067 GET act_{adAccountId}/insights?fields=impressions,clicks,spend,ctr,cpm&date_preset=last_7d \u3092\u547C\u3073\u51FA\u3057\u3066\u76F4\u8FD1\u306E\u30D1\u30D5\u30A9\u30FC\u30DE\u30F3\u30B9\u3092\u78BA\u8A8D
|
|
488
512
|
3. \u5FC5\u8981\u306B\u5FDC\u3058\u3066\u5E83\u544A\u30BB\u30C3\u30C8\u3084\u5E83\u544A\u30C7\u30FC\u30BF\u3092\u63A2\u7D22\u3057\u3001\u30C7\u30FC\u30BF\u69CB\u9020\u3092\u628A\u63E1`
|
|
489
513
|
}
|
|
490
514
|
});
|
|
@@ -532,6 +556,20 @@ async function listAdAccounts(params) {
|
|
|
532
556
|
const data = await res.json();
|
|
533
557
|
return data.data ?? [];
|
|
534
558
|
}
|
|
559
|
+
async function fetchCampaignCount(params, accountId) {
|
|
560
|
+
try {
|
|
561
|
+
const res = await apiFetch(
|
|
562
|
+
params,
|
|
563
|
+
`/act_${encodeURIComponent(accountId)}/campaigns?summary=total_count&limit=0`
|
|
564
|
+
);
|
|
565
|
+
if (!res.ok) return null;
|
|
566
|
+
const data = await res.json();
|
|
567
|
+
const total = data.summary?.total_count;
|
|
568
|
+
return typeof total === "number" ? total : null;
|
|
569
|
+
} catch {
|
|
570
|
+
return null;
|
|
571
|
+
}
|
|
572
|
+
}
|
|
535
573
|
function bareAdAccountId(account) {
|
|
536
574
|
if (account.account_id) return account.account_id;
|
|
537
575
|
return (account.id ?? "").replace(/^act_/, "");
|
|
@@ -583,14 +621,21 @@ var metaAdsSetupFlow = {
|
|
|
583
621
|
sections.push("_No ad accounts selected._", "");
|
|
584
622
|
return sections.join("\n");
|
|
585
623
|
}
|
|
586
|
-
sections.push("| Ad Account ID | Name | Currency | Status |");
|
|
587
|
-
sections.push("
|
|
588
|
-
|
|
624
|
+
sections.push("| Ad Account ID | Name | Currency | Status | Campaigns |");
|
|
625
|
+
sections.push("|---------------|------|----------|--------|-----------|");
|
|
626
|
+
const campaignCounts = await Promise.all(
|
|
627
|
+
targetIds.map((id) => fetchCampaignCount(rt.params, id))
|
|
628
|
+
);
|
|
629
|
+
for (let i = 0; i < targetIds.length; i++) {
|
|
630
|
+
const id = targetIds[i];
|
|
589
631
|
const account = byId.get(id);
|
|
590
632
|
const name = (account?.name ?? "-").replace(/\|/g, "\\|");
|
|
591
633
|
const currency = account?.currency ?? "-";
|
|
592
634
|
const status = statusLabel(account?.account_status);
|
|
593
|
-
|
|
635
|
+
const campaigns = campaignCounts[i] == null ? "-" : String(campaignCounts[i]);
|
|
636
|
+
sections.push(
|
|
637
|
+
`| ${id} | ${name} | ${currency} | ${status} | ${campaigns} |`
|
|
638
|
+
);
|
|
594
639
|
}
|
|
595
640
|
sections.push("");
|
|
596
641
|
return sections.join("\n");
|
|
@@ -698,8 +743,8 @@ var metaAdsConnector = new ConnectorPlugin({
|
|
|
698
743
|
systemPrompt: {
|
|
699
744
|
en: `### Tools
|
|
700
745
|
|
|
701
|
-
- \`
|
|
702
|
-
- \`
|
|
746
|
+
- \`connector_meta-ads_request\`: Send authenticated requests to the Meta Marketing API v21.0. The {adAccountId} placeholder in paths is automatically replaced. Authentication is configured via the access token parameter.
|
|
747
|
+
- \`connector_meta-ads_listAdAccounts\`: List accessible Meta ad accounts. Use this during setup to discover available accounts.
|
|
703
748
|
|
|
704
749
|
### Meta Marketing API Reference
|
|
705
750
|
|
|
@@ -760,8 +805,8 @@ const accounts = await meta.listAdAccounts();
|
|
|
760
805
|
\`\`\``,
|
|
761
806
|
ja: `### \u30C4\u30FC\u30EB
|
|
762
807
|
|
|
763
|
-
- \`
|
|
764
|
-
- \`
|
|
808
|
+
- \`connector_meta-ads_request\`: Meta Marketing API v21.0\u3078\u8A8D\u8A3C\u6E08\u307F\u30EA\u30AF\u30A8\u30B9\u30C8\u3092\u9001\u4FE1\u3057\u307E\u3059\u3002\u30D1\u30B9\u5185\u306E{adAccountId}\u30D7\u30EC\u30FC\u30B9\u30DB\u30EB\u30C0\u30FC\u306F\u81EA\u52D5\u7684\u306B\u7F6E\u63DB\u3055\u308C\u307E\u3059\u3002\u8A8D\u8A3C\u306F\u30A2\u30AF\u30BB\u30B9\u30C8\u30FC\u30AF\u30F3\u30D1\u30E9\u30E1\u30FC\u30BF\u3067\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002
|
|
809
|
+
- \`connector_meta-ads_listAdAccounts\`: \u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306AMeta\u5E83\u544A\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
|
|
765
810
|
|
|
766
811
|
### Meta Marketing API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
767
812
|
|
|
@@ -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
|
|
@@ -295,6 +300,15 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
295
300
|
* `runSetupFlow` from `setup-flow.ts`.
|
|
296
301
|
*/
|
|
297
302
|
setup;
|
|
303
|
+
/**
|
|
304
|
+
* 統一 introspection。SQL DB の `information_schema` / `SHOW` / `DESCRIBE` や SaaS の
|
|
305
|
+
* メタデータ API といった取得経路の差を吸収し、tables / columns / PK / FK を共通型
|
|
306
|
+
* {@link IntrospectedSchema} へ正規化して返す。取得経路は {@link IntrospectContext} で
|
|
307
|
+
* 抽象化され、SQL DB は `ctx.query`、SaaS は `ctx.proxyFetch` + `ctx.params` を使う。
|
|
308
|
+
* `ctx.profile === true` のときは L2 プロファイル(行数・NULL 率等)も best-effort で埋める。
|
|
309
|
+
* coding-agent の `DataContextIndex` がデータ地図を構築する際に使う。
|
|
310
|
+
*/
|
|
311
|
+
introspect;
|
|
298
312
|
/**
|
|
299
313
|
* Opt-out of the default "verify before save" behavior on connection
|
|
300
314
|
* creation. The backend invokes `checkConnection` synchronously while
|
|
@@ -309,6 +323,14 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
309
323
|
* the default verify-on-create behavior without opt-in.
|
|
310
324
|
*/
|
|
311
325
|
skipConnectionCheckOnCreate;
|
|
326
|
+
/**
|
|
327
|
+
* 決定論的な「立ち上げ survey」レシピ(ルールベース prewarm 基盤)。実装した connector は、LLM を使わずに
|
|
328
|
+
* read-only で自分を survey する probe 列(テーブル/列メタデータ → 小サンプル)を宣言する。coding-agent の
|
|
329
|
+
* recon driver がこれを読み、connector ツールの `execute` を直接呼んで結果を seed にする。未実装の connector は
|
|
330
|
+
* driver 側で safely skip される(その connection は listConnections のみ seed)。標準 `information_schema` を
|
|
331
|
+
* 持つ SQL connector は `makeStandardSqlSurveyProbes` を使える。**probe は必ず read-only**。
|
|
332
|
+
*/
|
|
333
|
+
surveyProbes;
|
|
312
334
|
constructor(config) {
|
|
313
335
|
this.slug = config.slug;
|
|
314
336
|
this.authType = config.authType;
|
|
@@ -326,7 +348,9 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
326
348
|
this.query = config.query;
|
|
327
349
|
this.checkConnection = config.checkConnection;
|
|
328
350
|
this.setup = config.setup;
|
|
351
|
+
this.introspect = config.introspect;
|
|
329
352
|
this.skipConnectionCheckOnCreate = config.skipConnectionCheckOnCreate;
|
|
353
|
+
this.surveyProbes = config.surveyProbes;
|
|
330
354
|
}
|
|
331
355
|
get connectorKey() {
|
|
332
356
|
return _ConnectorPlugin.deriveKey(this.slug, this.authType);
|
|
@@ -334,7 +358,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
334
358
|
/**
|
|
335
359
|
* Create tools for connections that belong to this connector.
|
|
336
360
|
* Filters connections by connectorKey internally.
|
|
337
|
-
* Returns tools keyed as
|
|
361
|
+
* Returns tools keyed as `connector_${connectorKey}_${toolName}`.
|
|
338
362
|
*/
|
|
339
363
|
createTools(connections, config, opts) {
|
|
340
364
|
const myConnections = connections.filter(
|
|
@@ -344,7 +368,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
344
368
|
for (const t of Object.values(this.tools)) {
|
|
345
369
|
const tool = t.createTool(myConnections, config);
|
|
346
370
|
const originalToModelOutput = tool.toModelOutput;
|
|
347
|
-
result[
|
|
371
|
+
result[`connector_${this.connectorKey}_${t.name}`] = {
|
|
348
372
|
...tool,
|
|
349
373
|
toModelOutput: async (options) => {
|
|
350
374
|
if (!originalToModelOutput) {
|
|
@@ -364,25 +388,25 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
364
388
|
if (authType) return `${slug}-${authType}`;
|
|
365
389
|
const LEGACY_NULL_AUTH_TYPE_MAP = {
|
|
366
390
|
// user-password
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
391
|
+
postgresql: "user-password",
|
|
392
|
+
mysql: "user-password",
|
|
393
|
+
clickhouse: "user-password",
|
|
394
|
+
kintone: "user-password",
|
|
371
395
|
"squadbase-db": "user-password",
|
|
372
396
|
// service-account
|
|
373
|
-
|
|
374
|
-
|
|
397
|
+
snowflake: "service-account",
|
|
398
|
+
bigquery: "service-account",
|
|
375
399
|
"google-analytics": "service-account",
|
|
376
400
|
"google-calendar": "service-account",
|
|
377
401
|
"aws-athena": "service-account",
|
|
378
|
-
|
|
402
|
+
redshift: "service-account",
|
|
379
403
|
// api-key
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
404
|
+
databricks: "api-key",
|
|
405
|
+
dbt: "api-key",
|
|
406
|
+
airtable: "api-key",
|
|
407
|
+
openai: "api-key",
|
|
408
|
+
gemini: "api-key",
|
|
409
|
+
anthropic: "api-key",
|
|
386
410
|
"wix-store": "api-key"
|
|
387
411
|
};
|
|
388
412
|
const fallbackAuthType = LEGACY_NULL_AUTH_TYPE_MAP[slug];
|
|
@@ -473,15 +497,15 @@ var mixpanelOnboarding = new ConnectorOnboarding({
|
|
|
473
497
|
- US (default): https://mixpanel.com/api/query (Query API), https://data.mixpanel.com/api/2.0/export (Export API)
|
|
474
498
|
- EU: https://eu.mixpanel.com/api/query, https://data-eu.mixpanel.com/api/2.0/export
|
|
475
499
|
- India: https://in.mixpanel.com/api/query, https://data-in.mixpanel.com/api/2.0/export
|
|
476
|
-
2. Call
|
|
477
|
-
3. Call
|
|
500
|
+
2. Call connector_mixpanel_request with GET {exportBase}?from_date=YYYY-MM-DD&to_date=YYYY-MM-DD (use a short recent date range, e.g. 1-2 days) to export raw events and discover available event types and properties
|
|
501
|
+
3. Call connector_mixpanel_request with POST {queryBase}/engage to query user profiles and understand user properties
|
|
478
502
|
NOTE: The Query API endpoints (insights, funnels, retention) require a bookmark_id or funnel_id from existing reports in Mixpanel. Use the Export API to retrieve raw events and aggregate in code if you need ad-hoc analysis.`,
|
|
479
503
|
ja: `1. \u63A5\u7D9A\u306Eregion\u30D1\u30E9\u30E1\u30FC\u30BF\u3092\u78BA\u8A8D\u3057\u3066\u30D9\u30FC\u30B9URL\u3092\u6C7A\u5B9A\uFF1A
|
|
480
504
|
- US\uFF08\u30C7\u30D5\u30A9\u30EB\u30C8\uFF09: https://mixpanel.com/api/query\uFF08Query API\uFF09\u3001https://data.mixpanel.com/api/2.0/export\uFF08Export API\uFF09
|
|
481
505
|
- EU: https://eu.mixpanel.com/api/query\u3001https://data-eu.mixpanel.com/api/2.0/export
|
|
482
506
|
- India: https://in.mixpanel.com/api/query\u3001https://data-in.mixpanel.com/api/2.0/export
|
|
483
|
-
2.
|
|
484
|
-
3.
|
|
507
|
+
2. connector_mixpanel_request \u3067 GET {exportBase}?from_date=YYYY-MM-DD&to_date=YYYY-MM-DD \u3092\u547C\u3073\u51FA\u3057\uFF08\u76F4\u8FD11-2\u65E5\u306E\u77ED\u3044\u671F\u9593\u3092\u4F7F\u7528\uFF09\u3001\u751F\u30A4\u30D9\u30F3\u30C8\u3092\u30A8\u30AF\u30B9\u30DD\u30FC\u30C8\u3057\u3066\u5229\u7528\u53EF\u80FD\u306A\u30A4\u30D9\u30F3\u30C8\u30BF\u30A4\u30D7\u3068\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u78BA\u8A8D
|
|
508
|
+
3. connector_mixpanel_request \u3067 POST {queryBase}/engage \u3092\u547C\u3073\u51FA\u3057\u3001\u30E6\u30FC\u30B6\u30FC\u30D7\u30ED\u30D5\u30A1\u30A4\u30EB\u3092\u7167\u4F1A\u3057\u3066\u30E6\u30FC\u30B6\u30FC\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u628A\u63E1
|
|
485
509
|
\u6CE8\u610F: Query API\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\uFF08insights\u3001funnels\u3001retention\uFF09\u306FMixpanel\u5185\u306E\u65E2\u5B58\u30EC\u30DD\u30FC\u30C8\u306Ebookmark_id\u307E\u305F\u306Ffunnel_id\u304C\u5FC5\u8981\u3067\u3059\u3002\u30A2\u30C9\u30DB\u30C3\u30AF\u5206\u6790\u304C\u5FC5\u8981\u306A\u5834\u5408\u306F\u3001Export API\u3067\u751F\u30A4\u30D9\u30F3\u30C8\u3092\u53D6\u5F97\u3057\u3001\u30B3\u30FC\u30C9\u4E0A\u3067\u96C6\u8A08\u3057\u3066\u304F\u3060\u3055\u3044\u3002`
|
|
486
510
|
}
|
|
487
511
|
});
|
|
@@ -757,7 +781,7 @@ var mixpanelConnector = new ConnectorPlugin({
|
|
|
757
781
|
systemPrompt: {
|
|
758
782
|
en: `### Tools
|
|
759
783
|
|
|
760
|
-
- \`
|
|
784
|
+
- \`connector_mixpanel_request\`: The only way to call the Mixpanel REST API. Use it for exporting raw events, querying insights/funnels/retention reports, and querying user profiles. Authentication (Basic auth with Service Account username + secret) is configured automatically. The project_id query parameter is appended automatically. Provide the full URL including query parameters \u2014 the base URL varies by region and endpoint type.
|
|
761
785
|
|
|
762
786
|
### Business Logic
|
|
763
787
|
|
|
@@ -816,7 +840,7 @@ export default async function handler(c: Context) {
|
|
|
816
840
|
IMPORTANT: The Insights endpoint requires a bookmark_id from an existing report in the Mixpanel UI. For ad-hoc event analysis, use the Export API to retrieve raw events and aggregate them in code. The Export API is the most flexible and universally accessible endpoint.`,
|
|
817
841
|
ja: `### \u30C4\u30FC\u30EB
|
|
818
842
|
|
|
819
|
-
- \`
|
|
843
|
+
- \`connector_mixpanel_request\`: Mixpanel REST API\u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u751F\u30A4\u30D9\u30F3\u30C8\u306E\u30A8\u30AF\u30B9\u30DD\u30FC\u30C8\u3001\u30A4\u30F3\u30B5\u30A4\u30C8/\u30D5\u30A1\u30CD\u30EB/\u30EA\u30C6\u30F3\u30B7\u30E7\u30F3\u30EC\u30DD\u30FC\u30C8\u306E\u7167\u4F1A\u3001\u30E6\u30FC\u30B6\u30FC\u30D7\u30ED\u30D5\u30A1\u30A4\u30EB\u306E\u7167\u4F1A\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u8A8D\u8A3C\uFF08Service Account\u306E\u30E6\u30FC\u30B6\u30FC\u540D+\u30B7\u30FC\u30AF\u30EC\u30C3\u30C8\u306B\u3088\u308BBasic\u8A8D\u8A3C\uFF09\u306F\u81EA\u52D5\u7684\u306B\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002project_id\u30AF\u30A8\u30EA\u30D1\u30E9\u30E1\u30FC\u30BF\u306F\u81EA\u52D5\u7684\u306B\u4ED8\u52A0\u3055\u308C\u307E\u3059\u3002\u30AF\u30A8\u30EA\u30D1\u30E9\u30E1\u30FC\u30BF\u3092\u542B\u3080\u5B8C\u5168\u306AURL\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044 \u2014 \u30D9\u30FC\u30B9URL\u306F\u30EA\u30FC\u30B8\u30E7\u30F3\u3068\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\u30BF\u30A4\u30D7\u306B\u3088\u3063\u3066\u7570\u306A\u308A\u307E\u3059\u3002
|
|
820
844
|
|
|
821
845
|
### Business Logic
|
|
822
846
|
|