@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
|
|
@@ -187,6 +192,15 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
187
192
|
* `runSetupFlow` from `setup-flow.ts`.
|
|
188
193
|
*/
|
|
189
194
|
setup;
|
|
195
|
+
/**
|
|
196
|
+
* 統一 introspection。SQL DB の `information_schema` / `SHOW` / `DESCRIBE` や SaaS の
|
|
197
|
+
* メタデータ API といった取得経路の差を吸収し、tables / columns / PK / FK を共通型
|
|
198
|
+
* {@link IntrospectedSchema} へ正規化して返す。取得経路は {@link IntrospectContext} で
|
|
199
|
+
* 抽象化され、SQL DB は `ctx.query`、SaaS は `ctx.proxyFetch` + `ctx.params` を使う。
|
|
200
|
+
* `ctx.profile === true` のときは L2 プロファイル(行数・NULL 率等)も best-effort で埋める。
|
|
201
|
+
* coding-agent の `DataContextIndex` がデータ地図を構築する際に使う。
|
|
202
|
+
*/
|
|
203
|
+
introspect;
|
|
190
204
|
/**
|
|
191
205
|
* Opt-out of the default "verify before save" behavior on connection
|
|
192
206
|
* creation. The backend invokes `checkConnection` synchronously while
|
|
@@ -201,6 +215,14 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
201
215
|
* the default verify-on-create behavior without opt-in.
|
|
202
216
|
*/
|
|
203
217
|
skipConnectionCheckOnCreate;
|
|
218
|
+
/**
|
|
219
|
+
* 決定論的な「立ち上げ survey」レシピ(ルールベース prewarm 基盤)。実装した connector は、LLM を使わずに
|
|
220
|
+
* read-only で自分を survey する probe 列(テーブル/列メタデータ → 小サンプル)を宣言する。coding-agent の
|
|
221
|
+
* recon driver がこれを読み、connector ツールの `execute` を直接呼んで結果を seed にする。未実装の connector は
|
|
222
|
+
* driver 側で safely skip される(その connection は listConnections のみ seed)。標準 `information_schema` を
|
|
223
|
+
* 持つ SQL connector は `makeStandardSqlSurveyProbes` を使える。**probe は必ず read-only**。
|
|
224
|
+
*/
|
|
225
|
+
surveyProbes;
|
|
204
226
|
constructor(config) {
|
|
205
227
|
this.slug = config.slug;
|
|
206
228
|
this.authType = config.authType;
|
|
@@ -218,7 +240,9 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
218
240
|
this.query = config.query;
|
|
219
241
|
this.checkConnection = config.checkConnection;
|
|
220
242
|
this.setup = config.setup;
|
|
243
|
+
this.introspect = config.introspect;
|
|
221
244
|
this.skipConnectionCheckOnCreate = config.skipConnectionCheckOnCreate;
|
|
245
|
+
this.surveyProbes = config.surveyProbes;
|
|
222
246
|
}
|
|
223
247
|
get connectorKey() {
|
|
224
248
|
return _ConnectorPlugin.deriveKey(this.slug, this.authType);
|
|
@@ -226,7 +250,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
226
250
|
/**
|
|
227
251
|
* Create tools for connections that belong to this connector.
|
|
228
252
|
* Filters connections by connectorKey internally.
|
|
229
|
-
* Returns tools keyed as
|
|
253
|
+
* Returns tools keyed as `connector_${connectorKey}_${toolName}`.
|
|
230
254
|
*/
|
|
231
255
|
createTools(connections, config, opts) {
|
|
232
256
|
const myConnections = connections.filter(
|
|
@@ -236,7 +260,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
236
260
|
for (const t of Object.values(this.tools)) {
|
|
237
261
|
const tool = t.createTool(myConnections, config);
|
|
238
262
|
const originalToModelOutput = tool.toModelOutput;
|
|
239
|
-
result[
|
|
263
|
+
result[`connector_${this.connectorKey}_${t.name}`] = {
|
|
240
264
|
...tool,
|
|
241
265
|
toModelOutput: async (options) => {
|
|
242
266
|
if (!originalToModelOutput) {
|
|
@@ -256,25 +280,25 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
256
280
|
if (authType) return `${slug}-${authType}`;
|
|
257
281
|
const LEGACY_NULL_AUTH_TYPE_MAP = {
|
|
258
282
|
// user-password
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
283
|
+
postgresql: "user-password",
|
|
284
|
+
mysql: "user-password",
|
|
285
|
+
clickhouse: "user-password",
|
|
286
|
+
kintone: "user-password",
|
|
263
287
|
"squadbase-db": "user-password",
|
|
264
288
|
// service-account
|
|
265
|
-
|
|
266
|
-
|
|
289
|
+
snowflake: "service-account",
|
|
290
|
+
bigquery: "service-account",
|
|
267
291
|
"google-analytics": "service-account",
|
|
268
292
|
"google-calendar": "service-account",
|
|
269
293
|
"aws-athena": "service-account",
|
|
270
|
-
|
|
294
|
+
redshift: "service-account",
|
|
271
295
|
// api-key
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
296
|
+
databricks: "api-key",
|
|
297
|
+
dbt: "api-key",
|
|
298
|
+
airtable: "api-key",
|
|
299
|
+
openai: "api-key",
|
|
300
|
+
gemini: "api-key",
|
|
301
|
+
anthropic: "api-key",
|
|
278
302
|
"wix-store": "api-key"
|
|
279
303
|
};
|
|
280
304
|
const fallbackAuthType = LEGACY_NULL_AUTH_TYPE_MAP[slug];
|
|
@@ -808,7 +832,7 @@ var googleAuditLogConnector = new ConnectorPlugin({
|
|
|
808
832
|
systemPrompt: {
|
|
809
833
|
en: `### Tools
|
|
810
834
|
|
|
811
|
-
- \`
|
|
835
|
+
- \`connector_google-audit-log-service-account_request_with_delegation\`: Call the Google Workspace Admin SDK Reports API on behalf of a Workspace admin via Domain-wide Delegation. Pass \`subject\` as the admin email; the token will be issued as that user. Always pass \`scopes\`.
|
|
812
836
|
|
|
813
837
|
### OAuth Scopes (pass as \`scopes\` argument)
|
|
814
838
|
|
|
@@ -897,7 +921,7 @@ export default async function handler(c: Context) {
|
|
|
897
921
|
\`\`\``,
|
|
898
922
|
ja: `### \u30C4\u30FC\u30EB
|
|
899
923
|
|
|
900
|
-
- \`
|
|
924
|
+
- \`connector_google-audit-log-service-account_request_with_delegation\`: Domain-wide Delegation \u7D4C\u7531\u3067 Workspace \u7BA1\u7406\u8005\u306B\u306A\u308A\u3059\u307E\u3057\u3066 Google Workspace Admin SDK Reports API \u3092\u547C\u3073\u51FA\u3057\u307E\u3059\u3002\u4EE3\u7406\u5BFE\u8C61\u306E\u7BA1\u7406\u8005\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092 \`subject\` \u3068\u3057\u3066\u6E21\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u30C8\u30FC\u30AF\u30F3\u306F\u305D\u306E\u30E6\u30FC\u30B6\u30FC\u3068\u3057\u3066\u767A\u884C\u3055\u308C\u307E\u3059\u3002\`scopes\` \u3082\u6BCE\u56DE\u6E21\u3057\u3066\u304F\u3060\u3055\u3044\u3002
|
|
901
925
|
|
|
902
926
|
### OAuth \u30B9\u30B3\u30FC\u30D7 (\`scopes\` \u5F15\u6570\u3067\u6E21\u3059)
|
|
903
927
|
|
|
@@ -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];
|
|
@@ -537,10 +561,10 @@ var googleCalendarOauthOnboarding = new ConnectorOnboarding({
|
|
|
537
561
|
- Write only 1 sentence between tool calls, then immediately call the next tool. Skip unnecessary explanations and proceed efficiently`
|
|
538
562
|
},
|
|
539
563
|
dataOverviewInstructions: {
|
|
540
|
-
en: `1. Call
|
|
541
|
-
2. Call
|
|
542
|
-
ja: `1.
|
|
543
|
-
2.
|
|
564
|
+
en: `1. Call connector_google-calendar-oauth_request with GET /calendars/{calendarId} to get the default calendar's metadata
|
|
565
|
+
2. Call connector_google-calendar-oauth_request with GET /calendars/{calendarId}/events with query params timeMin (current RFC3339 timestamp), singleEvents=true, orderBy=startTime, and maxResults=10 to sample upcoming events`,
|
|
566
|
+
ja: `1. connector_google-calendar-oauth_request \u3067 GET /calendars/{calendarId} \u3092\u547C\u3073\u51FA\u3057\u3001\u30C7\u30D5\u30A9\u30EB\u30C8\u30AB\u30EC\u30F3\u30C0\u30FC\u306E\u30E1\u30BF\u30C7\u30FC\u30BF\u3092\u53D6\u5F97
|
|
567
|
+
2. connector_google-calendar-oauth_request \u3067 GET /calendars/{calendarId}/events \u3092\u30AF\u30A8\u30EA\u30D1\u30E9\u30E1\u30FC\u30BF timeMin\uFF08\u73FE\u5728\u306ERFC3339\u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\uFF09\u3001singleEvents=true\u3001orderBy=startTime\u3001maxResults=10 \u3067\u547C\u3073\u51FA\u3057\u3001\u76F4\u8FD1\u306E\u30A4\u30D9\u30F3\u30C8\u3092\u30B5\u30F3\u30D7\u30EA\u30F3\u30B0`
|
|
544
568
|
}
|
|
545
569
|
});
|
|
546
570
|
|
|
@@ -564,6 +588,37 @@ async function listCalendars(config) {
|
|
|
564
588
|
const data = await calendarApiFetch(config, url);
|
|
565
589
|
return data.items ?? [];
|
|
566
590
|
}
|
|
591
|
+
async function fetchEventActivity(config, calendarId) {
|
|
592
|
+
try {
|
|
593
|
+
const now = /* @__PURE__ */ new Date();
|
|
594
|
+
const thirtyDaysAgo = new Date(now.getTime() - 30 * 24 * 60 * 60 * 1e3);
|
|
595
|
+
const qs = new URLSearchParams({
|
|
596
|
+
maxResults: "250",
|
|
597
|
+
timeMin: thirtyDaysAgo.toISOString(),
|
|
598
|
+
timeMax: now.toISOString(),
|
|
599
|
+
showDeleted: "true"
|
|
600
|
+
});
|
|
601
|
+
const url = `https://www.googleapis.com/calendar/v3/calendars/${encodeURIComponent(
|
|
602
|
+
calendarId
|
|
603
|
+
)}/events?${qs.toString()}`;
|
|
604
|
+
const data = await calendarApiFetch(config, url);
|
|
605
|
+
const items = data.items ?? [];
|
|
606
|
+
const activity = {
|
|
607
|
+
total: items.length,
|
|
608
|
+
confirmed: 0,
|
|
609
|
+
tentative: 0,
|
|
610
|
+
cancelled: 0
|
|
611
|
+
};
|
|
612
|
+
for (const ev of items) {
|
|
613
|
+
if (ev.status === "confirmed") activity.confirmed += 1;
|
|
614
|
+
else if (ev.status === "tentative") activity.tentative += 1;
|
|
615
|
+
else if (ev.status === "cancelled") activity.cancelled += 1;
|
|
616
|
+
}
|
|
617
|
+
return activity;
|
|
618
|
+
} catch {
|
|
619
|
+
return null;
|
|
620
|
+
}
|
|
621
|
+
}
|
|
567
622
|
function displayName(c) {
|
|
568
623
|
return c.summaryOverride ?? c.summary ?? c.id;
|
|
569
624
|
}
|
|
@@ -609,19 +664,34 @@ var googleCalendarOauthSetupFlow = {
|
|
|
609
664
|
);
|
|
610
665
|
return sections.join("\n");
|
|
611
666
|
}
|
|
612
|
-
sections.push(
|
|
613
|
-
|
|
614
|
-
|
|
667
|
+
sections.push(
|
|
668
|
+
"| Calendar | Time Zone | Primary | Access | Events (30d) | Confirmed | Tentative | Cancelled |"
|
|
669
|
+
);
|
|
670
|
+
sections.push(
|
|
671
|
+
"|----------|-----------|---------|--------|--------------|-----------|-----------|-----------|"
|
|
672
|
+
);
|
|
673
|
+
const activities = await Promise.all(
|
|
674
|
+
targetIds.map((id) => fetchEventActivity(rt.config, id))
|
|
675
|
+
);
|
|
676
|
+
for (let i = 0; i < targetIds.length; i++) {
|
|
677
|
+
const id = targetIds[i];
|
|
615
678
|
const c = byId.get(id);
|
|
679
|
+
const activity = activities[i] ?? null;
|
|
680
|
+
const total = activity ? String(activity.total) : "-";
|
|
681
|
+
const confirmed = activity ? String(activity.confirmed) : "-";
|
|
682
|
+
const tentative = activity ? String(activity.tentative) : "-";
|
|
683
|
+
const cancelled = activity ? String(activity.cancelled) : "-";
|
|
616
684
|
if (!c) {
|
|
617
|
-
sections.push(
|
|
685
|
+
sections.push(
|
|
686
|
+
`| ${id} | - | - | - | ${total} | ${confirmed} | ${tentative} | ${cancelled} |`
|
|
687
|
+
);
|
|
618
688
|
continue;
|
|
619
689
|
}
|
|
620
690
|
const tz = c.timeZone ?? "-";
|
|
621
691
|
const primary = c.primary ? "yes" : "no";
|
|
622
692
|
const access = c.accessRole ?? "-";
|
|
623
693
|
sections.push(
|
|
624
|
-
`| ${displayName(c)} | ${tz} | ${primary} | ${access} |`
|
|
694
|
+
`| ${displayName(c)} | ${tz} | ${primary} | ${access} | ${total} | ${confirmed} | ${tentative} | ${cancelled} |`
|
|
625
695
|
);
|
|
626
696
|
}
|
|
627
697
|
sections.push("");
|
|
@@ -783,8 +853,8 @@ var googleCalendarOauthConnector = new ConnectorPlugin({
|
|
|
783
853
|
systemPrompt: {
|
|
784
854
|
en: `### Tools
|
|
785
855
|
|
|
786
|
-
- \`
|
|
787
|
-
- \`
|
|
856
|
+
- \`connector_google-calendar-oauth_request\`: Send authenticated requests to the Google Calendar API v3. Use it to list calendars, get events, and manage calendar data. The {calendarId} placeholder in paths is automatically replaced. Authentication is configured automatically via OAuth.
|
|
857
|
+
- \`connector_google-calendar-oauth_listCalendars\`: List accessible Google Calendars. Use during setup to discover available calendars.
|
|
788
858
|
|
|
789
859
|
### Google Calendar API v3 Reference
|
|
790
860
|
|
|
@@ -848,8 +918,8 @@ console.log(event.summary, event.attendees);
|
|
|
848
918
|
\`\`\``,
|
|
849
919
|
ja: `### \u30C4\u30FC\u30EB
|
|
850
920
|
|
|
851
|
-
- \`
|
|
852
|
-
- \`
|
|
921
|
+
- \`connector_google-calendar-oauth_request\`: Google Calendar API v3\u3078\u8A8D\u8A3C\u6E08\u307F\u30EA\u30AF\u30A8\u30B9\u30C8\u3092\u9001\u4FE1\u3057\u307E\u3059\u3002\u30AB\u30EC\u30F3\u30C0\u30FC\u306E\u4E00\u89A7\u53D6\u5F97\u3001\u30A4\u30D9\u30F3\u30C8\u306E\u53D6\u5F97\u3001\u30AB\u30EC\u30F3\u30C0\u30FC\u30C7\u30FC\u30BF\u306E\u7BA1\u7406\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u30D1\u30B9\u5185\u306E{calendarId}\u30D7\u30EC\u30FC\u30B9\u30DB\u30EB\u30C0\u30FC\u306F\u81EA\u52D5\u7684\u306B\u7F6E\u63DB\u3055\u308C\u307E\u3059\u3002OAuth\u7D4C\u7531\u3067\u8A8D\u8A3C\u306F\u81EA\u52D5\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002
|
|
922
|
+
- \`connector_google-calendar-oauth_listCalendars\`: \u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306AGoogle Calendar\u306E\u4E00\u89A7\u3092\u53D6\u5F97\u3057\u307E\u3059\u3002\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u6642\u306B\u5229\u7528\u53EF\u80FD\u306A\u30AB\u30EC\u30F3\u30C0\u30FC\u3092\u78BA\u8A8D\u3059\u308B\u305F\u3081\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002
|
|
853
923
|
|
|
854
924
|
### Google Calendar API v3 \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
855
925
|
|
|
@@ -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
|
|
@@ -208,6 +213,15 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
208
213
|
* `runSetupFlow` from `setup-flow.ts`.
|
|
209
214
|
*/
|
|
210
215
|
setup;
|
|
216
|
+
/**
|
|
217
|
+
* 統一 introspection。SQL DB の `information_schema` / `SHOW` / `DESCRIBE` や SaaS の
|
|
218
|
+
* メタデータ API といった取得経路の差を吸収し、tables / columns / PK / FK を共通型
|
|
219
|
+
* {@link IntrospectedSchema} へ正規化して返す。取得経路は {@link IntrospectContext} で
|
|
220
|
+
* 抽象化され、SQL DB は `ctx.query`、SaaS は `ctx.proxyFetch` + `ctx.params` を使う。
|
|
221
|
+
* `ctx.profile === true` のときは L2 プロファイル(行数・NULL 率等)も best-effort で埋める。
|
|
222
|
+
* coding-agent の `DataContextIndex` がデータ地図を構築する際に使う。
|
|
223
|
+
*/
|
|
224
|
+
introspect;
|
|
211
225
|
/**
|
|
212
226
|
* Opt-out of the default "verify before save" behavior on connection
|
|
213
227
|
* creation. The backend invokes `checkConnection` synchronously while
|
|
@@ -222,6 +236,14 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
222
236
|
* the default verify-on-create behavior without opt-in.
|
|
223
237
|
*/
|
|
224
238
|
skipConnectionCheckOnCreate;
|
|
239
|
+
/**
|
|
240
|
+
* 決定論的な「立ち上げ survey」レシピ(ルールベース prewarm 基盤)。実装した connector は、LLM を使わずに
|
|
241
|
+
* read-only で自分を survey する probe 列(テーブル/列メタデータ → 小サンプル)を宣言する。coding-agent の
|
|
242
|
+
* recon driver がこれを読み、connector ツールの `execute` を直接呼んで結果を seed にする。未実装の connector は
|
|
243
|
+
* driver 側で safely skip される(その connection は listConnections のみ seed)。標準 `information_schema` を
|
|
244
|
+
* 持つ SQL connector は `makeStandardSqlSurveyProbes` を使える。**probe は必ず read-only**。
|
|
245
|
+
*/
|
|
246
|
+
surveyProbes;
|
|
225
247
|
constructor(config) {
|
|
226
248
|
this.slug = config.slug;
|
|
227
249
|
this.authType = config.authType;
|
|
@@ -239,7 +261,9 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
239
261
|
this.query = config.query;
|
|
240
262
|
this.checkConnection = config.checkConnection;
|
|
241
263
|
this.setup = config.setup;
|
|
264
|
+
this.introspect = config.introspect;
|
|
242
265
|
this.skipConnectionCheckOnCreate = config.skipConnectionCheckOnCreate;
|
|
266
|
+
this.surveyProbes = config.surveyProbes;
|
|
243
267
|
}
|
|
244
268
|
get connectorKey() {
|
|
245
269
|
return _ConnectorPlugin.deriveKey(this.slug, this.authType);
|
|
@@ -247,7 +271,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
247
271
|
/**
|
|
248
272
|
* Create tools for connections that belong to this connector.
|
|
249
273
|
* Filters connections by connectorKey internally.
|
|
250
|
-
* Returns tools keyed as
|
|
274
|
+
* Returns tools keyed as `connector_${connectorKey}_${toolName}`.
|
|
251
275
|
*/
|
|
252
276
|
createTools(connections, config, opts) {
|
|
253
277
|
const myConnections = connections.filter(
|
|
@@ -257,7 +281,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
257
281
|
for (const t of Object.values(this.tools)) {
|
|
258
282
|
const tool = t.createTool(myConnections, config);
|
|
259
283
|
const originalToModelOutput = tool.toModelOutput;
|
|
260
|
-
result[
|
|
284
|
+
result[`connector_${this.connectorKey}_${t.name}`] = {
|
|
261
285
|
...tool,
|
|
262
286
|
toModelOutput: async (options) => {
|
|
263
287
|
if (!originalToModelOutput) {
|
|
@@ -277,25 +301,25 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
277
301
|
if (authType) return `${slug}-${authType}`;
|
|
278
302
|
const LEGACY_NULL_AUTH_TYPE_MAP = {
|
|
279
303
|
// user-password
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
304
|
+
postgresql: "user-password",
|
|
305
|
+
mysql: "user-password",
|
|
306
|
+
clickhouse: "user-password",
|
|
307
|
+
kintone: "user-password",
|
|
284
308
|
"squadbase-db": "user-password",
|
|
285
309
|
// service-account
|
|
286
|
-
|
|
287
|
-
|
|
310
|
+
snowflake: "service-account",
|
|
311
|
+
bigquery: "service-account",
|
|
288
312
|
"google-analytics": "service-account",
|
|
289
313
|
"google-calendar": "service-account",
|
|
290
314
|
"aws-athena": "service-account",
|
|
291
|
-
|
|
315
|
+
redshift: "service-account",
|
|
292
316
|
// api-key
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
317
|
+
databricks: "api-key",
|
|
318
|
+
dbt: "api-key",
|
|
319
|
+
airtable: "api-key",
|
|
320
|
+
openai: "api-key",
|
|
321
|
+
gemini: "api-key",
|
|
322
|
+
anthropic: "api-key",
|
|
299
323
|
"wix-store": "api-key"
|
|
300
324
|
};
|
|
301
325
|
const fallbackAuthType = LEGACY_NULL_AUTH_TYPE_MAP[slug];
|
|
@@ -932,6 +956,41 @@ async function listCalendars(params, subject) {
|
|
|
932
956
|
);
|
|
933
957
|
return data.items ?? [];
|
|
934
958
|
}
|
|
959
|
+
async function fetchEventActivity(params, subject, calendarId) {
|
|
960
|
+
try {
|
|
961
|
+
const now = /* @__PURE__ */ new Date();
|
|
962
|
+
const thirtyDaysAgo = new Date(now.getTime() - 30 * 24 * 60 * 60 * 1e3);
|
|
963
|
+
const qs = new URLSearchParams({
|
|
964
|
+
maxResults: "250",
|
|
965
|
+
timeMin: thirtyDaysAgo.toISOString(),
|
|
966
|
+
timeMax: now.toISOString(),
|
|
967
|
+
showDeleted: "true"
|
|
968
|
+
});
|
|
969
|
+
const url = `https://www.googleapis.com/calendar/v3/calendars/${encodeURIComponent(
|
|
970
|
+
calendarId
|
|
971
|
+
)}/events?${qs.toString()}`;
|
|
972
|
+
const data = await calendarApiFetch(
|
|
973
|
+
params,
|
|
974
|
+
subject,
|
|
975
|
+
url
|
|
976
|
+
);
|
|
977
|
+
const items = data.items ?? [];
|
|
978
|
+
const activity = {
|
|
979
|
+
total: items.length,
|
|
980
|
+
confirmed: 0,
|
|
981
|
+
tentative: 0,
|
|
982
|
+
cancelled: 0
|
|
983
|
+
};
|
|
984
|
+
for (const ev of items) {
|
|
985
|
+
if (ev.status === "confirmed") activity.confirmed += 1;
|
|
986
|
+
else if (ev.status === "tentative") activity.tentative += 1;
|
|
987
|
+
else if (ev.status === "cancelled") activity.cancelled += 1;
|
|
988
|
+
}
|
|
989
|
+
return activity;
|
|
990
|
+
} catch {
|
|
991
|
+
return null;
|
|
992
|
+
}
|
|
993
|
+
}
|
|
935
994
|
function displayName(c) {
|
|
936
995
|
return c.summaryOverride ?? c.summary ?? c.id;
|
|
937
996
|
}
|
|
@@ -998,19 +1057,34 @@ var googleCalendarSetupFlow = {
|
|
|
998
1057
|
);
|
|
999
1058
|
return sections.join("\n");
|
|
1000
1059
|
}
|
|
1001
|
-
sections.push(
|
|
1002
|
-
|
|
1003
|
-
|
|
1060
|
+
sections.push(
|
|
1061
|
+
"| Calendar | Time Zone | Primary | Access | Events (30d) | Confirmed | Tentative | Cancelled |"
|
|
1062
|
+
);
|
|
1063
|
+
sections.push(
|
|
1064
|
+
"|----------|-----------|---------|--------|--------------|-----------|-----------|-----------|"
|
|
1065
|
+
);
|
|
1066
|
+
const activities = await Promise.all(
|
|
1067
|
+
targetIds.map((id) => fetchEventActivity(rt.params, subj, id))
|
|
1068
|
+
);
|
|
1069
|
+
for (let i = 0; i < targetIds.length; i++) {
|
|
1070
|
+
const id = targetIds[i];
|
|
1004
1071
|
const c = byId.get(id);
|
|
1072
|
+
const activity = activities[i] ?? null;
|
|
1073
|
+
const total = activity ? String(activity.total) : "-";
|
|
1074
|
+
const confirmed = activity ? String(activity.confirmed) : "-";
|
|
1075
|
+
const tentative = activity ? String(activity.tentative) : "-";
|
|
1076
|
+
const cancelled = activity ? String(activity.cancelled) : "-";
|
|
1005
1077
|
if (!c) {
|
|
1006
|
-
sections.push(
|
|
1078
|
+
sections.push(
|
|
1079
|
+
`| ${id} | - | - | - | ${total} | ${confirmed} | ${tentative} | ${cancelled} |`
|
|
1080
|
+
);
|
|
1007
1081
|
continue;
|
|
1008
1082
|
}
|
|
1009
1083
|
const tz = c.timeZone ?? "-";
|
|
1010
1084
|
const primary = c.primary ? "yes" : "no";
|
|
1011
1085
|
const access = c.accessRole ?? "-";
|
|
1012
1086
|
sections.push(
|
|
1013
|
-
`| ${displayName(c)} | ${tz} | ${primary} | ${access} |`
|
|
1087
|
+
`| ${displayName(c)} | ${tz} | ${primary} | ${access} | ${total} | ${confirmed} | ${tentative} | ${cancelled} |`
|
|
1014
1088
|
);
|
|
1015
1089
|
}
|
|
1016
1090
|
sections.push("");
|
|
@@ -1038,8 +1112,8 @@ var googleCalendarConnector = new ConnectorPlugin({
|
|
|
1038
1112
|
|
|
1039
1113
|
This connector exposes two request tools that correspond to the two ways a Service Account can authenticate against the Google Calendar API:
|
|
1040
1114
|
|
|
1041
|
-
- \`
|
|
1042
|
-
- \`
|
|
1115
|
+
- \`connector_google-calendar-service-account_request_with_delegation\`: Call the Calendar API on behalf of the specified Workspace user via Domain-wide Delegation. Pass \`subject\` as the target user email. Requires Domain-wide Delegation to be authorized for the service account in the Workspace admin console.
|
|
1116
|
+
- \`connector_google-calendar-service-account_request\`: Call the Calendar API as the service account itself (no delegation). Only calendars explicitly shared with the service account email are accessible.
|
|
1043
1117
|
|
|
1044
1118
|
Both tools require a \`scopes\` argument.
|
|
1045
1119
|
|
|
@@ -1136,8 +1210,8 @@ export default async function handler(c: Context) {
|
|
|
1136
1210
|
|
|
1137
1211
|
\u3053\u306E\u30B3\u30CD\u30AF\u30BF\u30FC\u306F\u3001Service Account \u304C Google Calendar API \u306B\u8A8D\u8A3C\u3059\u308B 2 \u3064\u306E\u65B9\u6CD5\u306B\u5BFE\u5FDC\u3059\u308B 2 \u3064\u306E request \u30C4\u30FC\u30EB\u3092\u516C\u958B\u3057\u307E\u3059:
|
|
1138
1212
|
|
|
1139
|
-
- \`
|
|
1140
|
-
- \`
|
|
1213
|
+
- \`connector_google-calendar-service-account_request_with_delegation\`: \u6307\u5B9A\u3055\u308C\u305F Workspace \u30E6\u30FC\u30B6\u30FC\u306B\u4EE3\u308F\u3063\u3066 Domain-wide Delegation \u7D4C\u7531\u3067 Calendar API \u3092\u547C\u3073\u51FA\u3057\u307E\u3059\u3002\u4EE3\u7406\u5BFE\u8C61\u306E\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092 \`subject\` \u3068\u3057\u3066\u6E21\u3057\u3066\u304F\u3060\u3055\u3044\u3002Workspace \u7BA1\u7406\u30B3\u30F3\u30BD\u30FC\u30EB\u3067 Service Account \u306E Domain-wide Delegation \u304C\u627F\u8A8D\u3055\u308C\u3066\u3044\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
|
|
1214
|
+
- \`connector_google-calendar-service-account_request\`: Service Account \u81EA\u8EAB\u3068\u3057\u3066 Calendar API \u3092\u547C\u3073\u51FA\u3057\u307E\u3059 (Domain-wide Delegation \u3092\u4F7F\u308F\u306A\u3044\u7D4C\u8DEF)\u3002Service Account \u306E\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u306B\u660E\u793A\u7684\u306B\u5171\u6709\u3055\u308C\u3066\u3044\u308B\u30AB\u30EC\u30F3\u30C0\u30FC\u306E\u307F\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u3067\u3059\u3002
|
|
1141
1215
|
|
|
1142
1216
|
\u4E21\u30C4\u30FC\u30EB\u3068\u3082 \`scopes\` \u5F15\u6570\u304C\u5FC5\u9808\u3067\u3059\u3002
|
|
1143
1217
|
|