@squadbase/vite-server 0.1.17-dev.a107052 → 0.1.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/dist/cli/index.js +3266 -730
  2. package/dist/connectors/airtable-oauth.js +48 -8
  3. package/dist/connectors/airtable.js +44 -8
  4. package/dist/connectors/amplitude.js +8 -8
  5. package/dist/connectors/anthropic.js +2 -2
  6. package/dist/connectors/asana.js +37 -10
  7. package/dist/connectors/attio.js +30 -13
  8. package/dist/connectors/aws-billing.js +8 -8
  9. package/dist/connectors/azure-sql.js +31 -7
  10. package/dist/connectors/backlog-api-key.js +40 -15
  11. package/dist/connectors/clickup.js +50 -10
  12. package/dist/connectors/cosmosdb.js +12 -12
  13. package/dist/connectors/customerio.js +8 -8
  14. package/dist/connectors/dbt.js +686 -25
  15. package/dist/connectors/freshdesk.js +82 -8
  16. package/dist/connectors/freshsales.js +8 -8
  17. package/dist/connectors/freshservice.js +8 -8
  18. package/dist/connectors/gamma.js +15 -15
  19. package/dist/connectors/gemini.js +2 -2
  20. package/dist/connectors/github.js +12 -12
  21. package/dist/connectors/gmail-oauth.js +10 -10
  22. package/dist/connectors/gmail.js +4 -4
  23. package/dist/connectors/google-ads.js +8 -8
  24. package/dist/connectors/google-analytics-oauth.js +152 -25
  25. package/dist/connectors/google-analytics.js +475 -95
  26. package/dist/connectors/google-audit-log.js +4 -4
  27. package/dist/connectors/google-calendar-oauth.js +61 -15
  28. package/dist/connectors/google-calendar.js +61 -11
  29. package/dist/connectors/google-docs.js +10 -10
  30. package/dist/connectors/google-drive.js +32 -10
  31. package/dist/connectors/google-search-console-oauth.js +126 -17
  32. package/dist/connectors/google-sheets.js +6 -6
  33. package/dist/connectors/google-slides.js +10 -10
  34. package/dist/connectors/grafana.js +45 -10
  35. package/dist/connectors/hubspot-oauth.js +41 -9
  36. package/dist/connectors/hubspot.js +25 -9
  37. package/dist/connectors/influxdb.js +8 -8
  38. package/dist/connectors/intercom-oauth.js +72 -12
  39. package/dist/connectors/intercom.js +12 -12
  40. package/dist/connectors/jdbc.js +6 -6
  41. package/dist/connectors/jira-api-key.js +68 -11
  42. package/dist/connectors/kintone-api-token.js +66 -18
  43. package/dist/connectors/kintone.js +54 -11
  44. package/dist/connectors/linear.js +54 -12
  45. package/dist/connectors/linkedin-ads.js +41 -14
  46. package/dist/connectors/mailchimp-oauth.js +6 -6
  47. package/dist/connectors/mailchimp.js +6 -6
  48. package/dist/connectors/meta-ads-oauth.js +33 -14
  49. package/dist/connectors/meta-ads.js +35 -14
  50. package/dist/connectors/mixpanel.js +8 -8
  51. package/dist/connectors/monday.js +9 -9
  52. package/dist/connectors/mongodb.js +8 -8
  53. package/dist/connectors/notion-oauth.js +60 -11
  54. package/dist/connectors/notion.js +60 -11
  55. package/dist/connectors/openai.js +2 -2
  56. package/dist/connectors/oracle.js +23 -7
  57. package/dist/connectors/outlook-oauth.js +20 -20
  58. package/dist/connectors/powerbi-oauth.js +12 -12
  59. package/dist/connectors/salesforce.js +42 -9
  60. package/dist/connectors/semrush.js +6 -6
  61. package/dist/connectors/sentry.js +36 -10
  62. package/dist/connectors/shopify-oauth.js +43 -10
  63. package/dist/connectors/shopify.js +8 -8
  64. package/dist/connectors/sqlserver.js +31 -7
  65. package/dist/connectors/stripe-api-key.js +66 -15
  66. package/dist/connectors/stripe-oauth.js +70 -19
  67. package/dist/connectors/supabase.js +22 -5
  68. package/dist/connectors/tableau.js +14 -14
  69. package/dist/connectors/tiktok-ads.js +37 -16
  70. package/dist/connectors/wix-store.js +8 -8
  71. package/dist/connectors/zendesk-oauth.js +55 -12
  72. package/dist/connectors/zendesk.js +12 -12
  73. package/dist/index.js +3284 -728
  74. package/dist/main.js +3284 -728
  75. package/dist/vite-plugin.js +3264 -728
  76. package/package.json +1 -1
@@ -226,7 +226,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
226
226
  /**
227
227
  * Create tools for connections that belong to this connector.
228
228
  * Filters connections by connectorKey internally.
229
- * Returns tools keyed as `${connectorKey}_${toolName}`.
229
+ * Returns tools keyed as `connector_${connectorKey}_${toolName}`.
230
230
  */
231
231
  createTools(connections, config, opts) {
232
232
  const myConnections = connections.filter(
@@ -236,7 +236,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
236
236
  for (const t of Object.values(this.tools)) {
237
237
  const tool = t.createTool(myConnections, config);
238
238
  const originalToModelOutput = tool.toModelOutput;
239
- result[`${this.connectorKey}_${t.name}`] = {
239
+ result[`connector_${this.connectorKey}_${t.name}`] = {
240
240
  ...tool,
241
241
  toModelOutput: async (options) => {
242
242
  if (!originalToModelOutput) {
@@ -808,7 +808,7 @@ var googleAuditLogConnector = new ConnectorPlugin({
808
808
  systemPrompt: {
809
809
  en: `### Tools
810
810
 
811
- - \`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\`.
811
+ - \`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
812
 
813
813
  ### OAuth Scopes (pass as \`scopes\` argument)
814
814
 
@@ -897,7 +897,7 @@ export default async function handler(c: Context) {
897
897
  \`\`\``,
898
898
  ja: `### \u30C4\u30FC\u30EB
899
899
 
900
- - \`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
900
+ - \`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
901
 
902
902
  ### OAuth \u30B9\u30B3\u30FC\u30D7 (\`scopes\` \u5F15\u6570\u3067\u6E21\u3059)
903
903
 
@@ -242,7 +242,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
242
242
  /**
243
243
  * Create tools for connections that belong to this connector.
244
244
  * Filters connections by connectorKey internally.
245
- * Returns tools keyed as `${connectorKey}_${toolName}`.
245
+ * Returns tools keyed as `connector_${connectorKey}_${toolName}`.
246
246
  */
247
247
  createTools(connections, config, opts) {
248
248
  const myConnections = connections.filter(
@@ -252,7 +252,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
252
252
  for (const t of Object.values(this.tools)) {
253
253
  const tool = t.createTool(myConnections, config);
254
254
  const originalToModelOutput = tool.toModelOutput;
255
- result[`${this.connectorKey}_${t.name}`] = {
255
+ result[`connector_${this.connectorKey}_${t.name}`] = {
256
256
  ...tool,
257
257
  toModelOutput: async (options) => {
258
258
  if (!originalToModelOutput) {
@@ -537,10 +537,10 @@ var googleCalendarOauthOnboarding = new ConnectorOnboarding({
537
537
  - Write only 1 sentence between tool calls, then immediately call the next tool. Skip unnecessary explanations and proceed efficiently`
538
538
  },
539
539
  dataOverviewInstructions: {
540
- en: `1. Call google-calendar-oauth_request with GET /calendars/{calendarId} to get the default calendar's metadata
541
- 2. Call 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`,
542
- ja: `1. 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
543
- 2. 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`
540
+ en: `1. Call connector_google-calendar-oauth_request with GET /calendars/{calendarId} to get the default calendar's metadata
541
+ 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`,
542
+ 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
543
+ 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
544
  }
545
545
  });
546
546
 
@@ -564,6 +564,37 @@ async function listCalendars(config) {
564
564
  const data = await calendarApiFetch(config, url);
565
565
  return data.items ?? [];
566
566
  }
567
+ async function fetchEventActivity(config, calendarId) {
568
+ try {
569
+ const now = /* @__PURE__ */ new Date();
570
+ const thirtyDaysAgo = new Date(now.getTime() - 30 * 24 * 60 * 60 * 1e3);
571
+ const qs = new URLSearchParams({
572
+ maxResults: "250",
573
+ timeMin: thirtyDaysAgo.toISOString(),
574
+ timeMax: now.toISOString(),
575
+ showDeleted: "true"
576
+ });
577
+ const url = `https://www.googleapis.com/calendar/v3/calendars/${encodeURIComponent(
578
+ calendarId
579
+ )}/events?${qs.toString()}`;
580
+ const data = await calendarApiFetch(config, url);
581
+ const items = data.items ?? [];
582
+ const activity = {
583
+ total: items.length,
584
+ confirmed: 0,
585
+ tentative: 0,
586
+ cancelled: 0
587
+ };
588
+ for (const ev of items) {
589
+ if (ev.status === "confirmed") activity.confirmed += 1;
590
+ else if (ev.status === "tentative") activity.tentative += 1;
591
+ else if (ev.status === "cancelled") activity.cancelled += 1;
592
+ }
593
+ return activity;
594
+ } catch {
595
+ return null;
596
+ }
597
+ }
567
598
  function displayName(c) {
568
599
  return c.summaryOverride ?? c.summary ?? c.id;
569
600
  }
@@ -609,19 +640,34 @@ var googleCalendarOauthSetupFlow = {
609
640
  );
610
641
  return sections.join("\n");
611
642
  }
612
- sections.push("| Calendar | Time Zone | Primary | Access |");
613
- sections.push("|----------|-----------|---------|--------|");
614
- for (const id of targetIds) {
643
+ sections.push(
644
+ "| Calendar | Time Zone | Primary | Access | Events (30d) | Confirmed | Tentative | Cancelled |"
645
+ );
646
+ sections.push(
647
+ "|----------|-----------|---------|--------|--------------|-----------|-----------|-----------|"
648
+ );
649
+ const activities = await Promise.all(
650
+ targetIds.map((id) => fetchEventActivity(rt.config, id))
651
+ );
652
+ for (let i = 0; i < targetIds.length; i++) {
653
+ const id = targetIds[i];
615
654
  const c = byId.get(id);
655
+ const activity = activities[i] ?? null;
656
+ const total = activity ? String(activity.total) : "-";
657
+ const confirmed = activity ? String(activity.confirmed) : "-";
658
+ const tentative = activity ? String(activity.tentative) : "-";
659
+ const cancelled = activity ? String(activity.cancelled) : "-";
616
660
  if (!c) {
617
- sections.push(`| ${id} | - | - | - |`);
661
+ sections.push(
662
+ `| ${id} | - | - | - | ${total} | ${confirmed} | ${tentative} | ${cancelled} |`
663
+ );
618
664
  continue;
619
665
  }
620
666
  const tz = c.timeZone ?? "-";
621
667
  const primary = c.primary ? "yes" : "no";
622
668
  const access = c.accessRole ?? "-";
623
669
  sections.push(
624
- `| ${displayName(c)} | ${tz} | ${primary} | ${access} |`
670
+ `| ${displayName(c)} | ${tz} | ${primary} | ${access} | ${total} | ${confirmed} | ${tentative} | ${cancelled} |`
625
671
  );
626
672
  }
627
673
  sections.push("");
@@ -783,8 +829,8 @@ var googleCalendarOauthConnector = new ConnectorPlugin({
783
829
  systemPrompt: {
784
830
  en: `### Tools
785
831
 
786
- - \`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.
787
- - \`google-calendar-oauth_listCalendars\`: List accessible Google Calendars. Use during setup to discover available calendars.
832
+ - \`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.
833
+ - \`connector_google-calendar-oauth_listCalendars\`: List accessible Google Calendars. Use during setup to discover available calendars.
788
834
 
789
835
  ### Google Calendar API v3 Reference
790
836
 
@@ -848,8 +894,8 @@ console.log(event.summary, event.attendees);
848
894
  \`\`\``,
849
895
  ja: `### \u30C4\u30FC\u30EB
850
896
 
851
- - \`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
852
- - \`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
897
+ - \`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
898
+ - \`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
899
 
854
900
  ### Google Calendar API v3 \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
855
901
 
@@ -247,7 +247,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
247
247
  /**
248
248
  * Create tools for connections that belong to this connector.
249
249
  * Filters connections by connectorKey internally.
250
- * Returns tools keyed as `${connectorKey}_${toolName}`.
250
+ * Returns tools keyed as `connector_${connectorKey}_${toolName}`.
251
251
  */
252
252
  createTools(connections, config, opts) {
253
253
  const myConnections = connections.filter(
@@ -257,7 +257,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
257
257
  for (const t of Object.values(this.tools)) {
258
258
  const tool = t.createTool(myConnections, config);
259
259
  const originalToModelOutput = tool.toModelOutput;
260
- result[`${this.connectorKey}_${t.name}`] = {
260
+ result[`connector_${this.connectorKey}_${t.name}`] = {
261
261
  ...tool,
262
262
  toModelOutput: async (options) => {
263
263
  if (!originalToModelOutput) {
@@ -932,6 +932,41 @@ async function listCalendars(params, subject) {
932
932
  );
933
933
  return data.items ?? [];
934
934
  }
935
+ async function fetchEventActivity(params, subject, calendarId) {
936
+ try {
937
+ const now = /* @__PURE__ */ new Date();
938
+ const thirtyDaysAgo = new Date(now.getTime() - 30 * 24 * 60 * 60 * 1e3);
939
+ const qs = new URLSearchParams({
940
+ maxResults: "250",
941
+ timeMin: thirtyDaysAgo.toISOString(),
942
+ timeMax: now.toISOString(),
943
+ showDeleted: "true"
944
+ });
945
+ const url = `https://www.googleapis.com/calendar/v3/calendars/${encodeURIComponent(
946
+ calendarId
947
+ )}/events?${qs.toString()}`;
948
+ const data = await calendarApiFetch(
949
+ params,
950
+ subject,
951
+ url
952
+ );
953
+ const items = data.items ?? [];
954
+ const activity = {
955
+ total: items.length,
956
+ confirmed: 0,
957
+ tentative: 0,
958
+ cancelled: 0
959
+ };
960
+ for (const ev of items) {
961
+ if (ev.status === "confirmed") activity.confirmed += 1;
962
+ else if (ev.status === "tentative") activity.tentative += 1;
963
+ else if (ev.status === "cancelled") activity.cancelled += 1;
964
+ }
965
+ return activity;
966
+ } catch {
967
+ return null;
968
+ }
969
+ }
935
970
  function displayName(c) {
936
971
  return c.summaryOverride ?? c.summary ?? c.id;
937
972
  }
@@ -998,19 +1033,34 @@ var googleCalendarSetupFlow = {
998
1033
  );
999
1034
  return sections.join("\n");
1000
1035
  }
1001
- sections.push("| Calendar | Time Zone | Primary | Access |");
1002
- sections.push("|----------|-----------|---------|--------|");
1003
- for (const id of targetIds) {
1036
+ sections.push(
1037
+ "| Calendar | Time Zone | Primary | Access | Events (30d) | Confirmed | Tentative | Cancelled |"
1038
+ );
1039
+ sections.push(
1040
+ "|----------|-----------|---------|--------|--------------|-----------|-----------|-----------|"
1041
+ );
1042
+ const activities = await Promise.all(
1043
+ targetIds.map((id) => fetchEventActivity(rt.params, subj, id))
1044
+ );
1045
+ for (let i = 0; i < targetIds.length; i++) {
1046
+ const id = targetIds[i];
1004
1047
  const c = byId.get(id);
1048
+ const activity = activities[i] ?? null;
1049
+ const total = activity ? String(activity.total) : "-";
1050
+ const confirmed = activity ? String(activity.confirmed) : "-";
1051
+ const tentative = activity ? String(activity.tentative) : "-";
1052
+ const cancelled = activity ? String(activity.cancelled) : "-";
1005
1053
  if (!c) {
1006
- sections.push(`| ${id} | - | - | - |`);
1054
+ sections.push(
1055
+ `| ${id} | - | - | - | ${total} | ${confirmed} | ${tentative} | ${cancelled} |`
1056
+ );
1007
1057
  continue;
1008
1058
  }
1009
1059
  const tz = c.timeZone ?? "-";
1010
1060
  const primary = c.primary ? "yes" : "no";
1011
1061
  const access = c.accessRole ?? "-";
1012
1062
  sections.push(
1013
- `| ${displayName(c)} | ${tz} | ${primary} | ${access} |`
1063
+ `| ${displayName(c)} | ${tz} | ${primary} | ${access} | ${total} | ${confirmed} | ${tentative} | ${cancelled} |`
1014
1064
  );
1015
1065
  }
1016
1066
  sections.push("");
@@ -1038,8 +1088,8 @@ var googleCalendarConnector = new ConnectorPlugin({
1038
1088
 
1039
1089
  This connector exposes two request tools that correspond to the two ways a Service Account can authenticate against the Google Calendar API:
1040
1090
 
1041
- - \`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.
1042
- - \`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.
1091
+ - \`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.
1092
+ - \`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
1093
 
1044
1094
  Both tools require a \`scopes\` argument.
1045
1095
 
@@ -1136,8 +1186,8 @@ export default async function handler(c: Context) {
1136
1186
 
1137
1187
  \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
1188
 
1139
- - \`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
1140
- - \`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
1189
+ - \`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
1190
+ - \`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
1191
 
1142
1192
  \u4E21\u30C4\u30FC\u30EB\u3068\u3082 \`scopes\` \u5F15\u6570\u304C\u5FC5\u9808\u3067\u3059\u3002
1143
1193
 
@@ -160,7 +160,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
160
160
  /**
161
161
  * Create tools for connections that belong to this connector.
162
162
  * Filters connections by connectorKey internally.
163
- * Returns tools keyed as `${connectorKey}_${toolName}`.
163
+ * Returns tools keyed as `connector_${connectorKey}_${toolName}`.
164
164
  */
165
165
  createTools(connections, config, opts) {
166
166
  const myConnections = connections.filter(
@@ -170,7 +170,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
170
170
  for (const t of Object.values(this.tools)) {
171
171
  const tool = t.createTool(myConnections, config);
172
172
  const originalToModelOutput = tool.toModelOutput;
173
- result[`${this.connectorKey}_${t.name}`] = {
173
+ result[`connector_${this.connectorKey}_${t.name}`] = {
174
174
  ...tool,
175
175
  toModelOutput: async (options) => {
176
176
  if (!originalToModelOutput) {
@@ -310,10 +310,10 @@ function normalizeRequestPath(path2, basePathSegment) {
310
310
  // ../connectors/src/connectors/google-docs/setup.ts
311
311
  var googleDocsOnboarding = new ConnectorOnboarding({
312
312
  dataOverviewInstructions: {
313
- en: `1. Create a new document with google-docs-oauth_request (POST with body { title: "..." }) or use an existing document ID.
314
- 2. Call google-docs-oauth_request with GET /{documentId} to fetch the document's content and metadata.`,
315
- ja: `1. google-docs-oauth_request \u3092 POST\uFF08Body: { title: "..." }\uFF09\u3067\u547C\u3073\u51FA\u3057\u3066\u65B0\u3057\u3044\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u3092\u4F5C\u6210\u3059\u308B\u304B\u3001\u65E2\u5B58\u306E\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8ID\u3092\u5229\u7528\u3057\u307E\u3059\u3002
316
- 2. google-docs-oauth_request \u3067 GET /{documentId} \u3092\u547C\u3073\u51FA\u3057\u3001\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306E\u5185\u5BB9\u3068\u30E1\u30BF\u30C7\u30FC\u30BF\u3092\u53D6\u5F97\u3057\u307E\u3059\u3002`
313
+ en: `1. Create a new document with connector_google-docs-oauth_request (POST with body { title: "..." }) or use an existing document ID.
314
+ 2. Call connector_google-docs-oauth_request with GET /{documentId} to fetch the document's content and metadata.`,
315
+ ja: `1. connector_google-docs-oauth_request \u3092 POST\uFF08Body: { title: "..." }\uFF09\u3067\u547C\u3073\u51FA\u3057\u3066\u65B0\u3057\u3044\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u3092\u4F5C\u6210\u3059\u308B\u304B\u3001\u65E2\u5B58\u306E\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8ID\u3092\u5229\u7528\u3057\u307E\u3059\u3002
316
+ 2. connector_google-docs-oauth_request \u3067 GET /{documentId} \u3092\u547C\u3073\u51FA\u3057\u3001\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306E\u5185\u5BB9\u3068\u30E1\u30BF\u30C7\u30FC\u30BF\u3092\u53D6\u5F97\u3057\u307E\u3059\u3002`
317
317
  }
318
318
  });
319
319
 
@@ -566,9 +566,9 @@ var googleDocsConnector = new ConnectorPlugin({
566
566
  systemPrompt: {
567
567
  en: `### Tools (setup-time only)
568
568
 
569
- - \`google-docs-oauth_request\`: Call the Google Docs API directly during setup / data overview. Supports read and write operations. Use it to get document content, create new documents, and modify document content via batchUpdate. Authentication is configured automatically via OAuth.
569
+ - \`connector_google-docs-oauth_request\`: Call the Google Docs API directly during setup / data overview. Supports read and write operations. Use it to get document content, create new documents, and modify document content via batchUpdate. Authentication is configured automatically via OAuth.
570
570
 
571
- > **Important**: The \`google-docs-oauth_request\` tool is only available at setup time. Inside server-logic handlers, use the SDK (\`connection(id).createDocument\`, etc.) \u2014 the SDK's fetch is already wired through the OAuth proxy. **Do NOT** hand-roll HTTP calls to \`_sqcore/connections/*/request\` from a handler.
571
+ > **Important**: The \`connector_google-docs-oauth_request\` tool is only available at setup time. Inside server-logic handlers, use the SDK (\`connection(id).createDocument\`, etc.) \u2014 the SDK's fetch is already wired through the OAuth proxy. **Do NOT** hand-roll HTTP calls to \`_sqcore/connections/*/request\` from a handler.
572
572
 
573
573
  ### Google Docs API Reference
574
574
 
@@ -635,9 +635,9 @@ await docs.batchUpdate(documentId, [
635
635
  \`\`\``,
636
636
  ja: `### \u30C4\u30FC\u30EB\uFF08\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u6642\u306E\u307F\uFF09
637
637
 
638
- - \`google-docs-oauth_request\`: \u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3084\u30C7\u30FC\u30BF\u6982\u8981\u628A\u63E1\u6642\u306B Google Docs API \u3092\u76F4\u63A5\u53E9\u304F\u30C4\u30FC\u30EB\u3067\u3059\u3002\u8AAD\u307F\u53D6\u308A\u3068\u66F8\u304D\u8FBC\u307F\u306E\u4E21\u65B9\u3092\u30B5\u30DD\u30FC\u30C8\u3057\u307E\u3059\u3002\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u5185\u5BB9\u306E\u53D6\u5F97\u3001\u65B0\u3057\u3044\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306E\u4F5C\u6210\u3001batchUpdate \u306B\u3088\u308B\u5185\u5BB9\u5909\u66F4\u306A\u3069\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002OAuth \u7D4C\u7531\u3067\u8A8D\u8A3C\u306F\u81EA\u52D5\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002
638
+ - \`connector_google-docs-oauth_request\`: \u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3084\u30C7\u30FC\u30BF\u6982\u8981\u628A\u63E1\u6642\u306B Google Docs API \u3092\u76F4\u63A5\u53E9\u304F\u30C4\u30FC\u30EB\u3067\u3059\u3002\u8AAD\u307F\u53D6\u308A\u3068\u66F8\u304D\u8FBC\u307F\u306E\u4E21\u65B9\u3092\u30B5\u30DD\u30FC\u30C8\u3057\u307E\u3059\u3002\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u5185\u5BB9\u306E\u53D6\u5F97\u3001\u65B0\u3057\u3044\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306E\u4F5C\u6210\u3001batchUpdate \u306B\u3088\u308B\u5185\u5BB9\u5909\u66F4\u306A\u3069\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002OAuth \u7D4C\u7531\u3067\u8A8D\u8A3C\u306F\u81EA\u52D5\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002
639
639
 
640
- > **\u91CD\u8981**: \`google-docs-oauth_request\` \u306F\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u6642\u306E\u307F\u5229\u7528\u53EF\u80FD\u3067\u3059\u3002\u30B5\u30FC\u30D0\u30FC\u30ED\u30B8\u30C3\u30AF\u306E\u30CF\u30F3\u30C9\u30E9\u5185\u3067\u306F\u5FC5\u305A SDK\uFF08\`connection(id).createDocument\` \u306A\u3069\uFF09\u3092\u4F7F\u3063\u3066\u304F\u3060\u3055\u3044\u3002SDK \u306E fetch \u306F OAuth \u30D7\u30ED\u30AD\u30B7\u7D4C\u7531\u3067\u65E2\u306B\u914D\u7DDA\u3055\u308C\u3066\u3044\u307E\u3059\u3002\u30CF\u30F3\u30C9\u30E9\u304B\u3089 \`_sqcore/connections/*/request\` \u3092\u624B\u66F8\u304D\u3067\u547C\u3073\u51FA\u3055\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002
640
+ > **\u91CD\u8981**: \`connector_google-docs-oauth_request\` \u306F\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u6642\u306E\u307F\u5229\u7528\u53EF\u80FD\u3067\u3059\u3002\u30B5\u30FC\u30D0\u30FC\u30ED\u30B8\u30C3\u30AF\u306E\u30CF\u30F3\u30C9\u30E9\u5185\u3067\u306F\u5FC5\u305A SDK\uFF08\`connection(id).createDocument\` \u306A\u3069\uFF09\u3092\u4F7F\u3063\u3066\u304F\u3060\u3055\u3044\u3002SDK \u306E fetch \u306F OAuth \u30D7\u30ED\u30AD\u30B7\u7D4C\u7531\u3067\u65E2\u306B\u914D\u7DDA\u3055\u308C\u3066\u3044\u307E\u3059\u3002\u30CF\u30F3\u30C9\u30E9\u304B\u3089 \`_sqcore/connections/*/request\` \u3092\u624B\u66F8\u304D\u3067\u547C\u3073\u51FA\u3055\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002
641
641
 
642
642
  ### Google Docs API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
643
643
 
@@ -249,7 +249,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
249
249
  /**
250
250
  * Create tools for connections that belong to this connector.
251
251
  * Filters connections by connectorKey internally.
252
- * Returns tools keyed as `${connectorKey}_${toolName}`.
252
+ * Returns tools keyed as `connector_${connectorKey}_${toolName}`.
253
253
  */
254
254
  createTools(connections, config, opts) {
255
255
  const myConnections = connections.filter(
@@ -259,7 +259,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
259
259
  for (const t of Object.values(this.tools)) {
260
260
  const tool = t.createTool(myConnections, config);
261
261
  const originalToModelOutput = tool.toModelOutput;
262
- result[`${this.connectorKey}_${t.name}`] = {
262
+ result[`connector_${this.connectorKey}_${t.name}`] = {
263
263
  ...tool,
264
264
  toModelOutput: async (options) => {
265
265
  if (!originalToModelOutput) {
@@ -399,10 +399,10 @@ function normalizeRequestPath(path2, basePathSegment) {
399
399
  // ../connectors/src/connectors/google-drive/setup.ts
400
400
  var googleDriveOnboarding = new ConnectorOnboarding({
401
401
  dataOverviewInstructions: {
402
- en: `1. Call google-drive-oauth_request with GET /files?pageSize=20&fields=files(id,name,mimeType,modifiedTime)&orderBy=modifiedTime desc to list recent files
403
- 2. Call google-drive-oauth_request with GET /about?fields=user,storageQuota to get account info and storage usage`,
404
- ja: `1. google-drive-oauth_request \u3067 GET /files?pageSize=20&fields=files(id,name,mimeType,modifiedTime)&orderBy=modifiedTime desc \u3092\u547C\u3073\u51FA\u3057\u3001\u6700\u8FD1\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u4E00\u89A7\u8868\u793A
405
- 2. google-drive-oauth_request \u3067 GET /about?fields=user,storageQuota \u3092\u547C\u3073\u51FA\u3057\u3001\u30A2\u30AB\u30A6\u30F3\u30C8\u60C5\u5831\u3068\u30B9\u30C8\u30EC\u30FC\u30B8\u4F7F\u7528\u91CF\u3092\u53D6\u5F97`
402
+ en: `1. Call connector_google-drive-oauth_request with GET /files?pageSize=20&fields=files(id,name,mimeType,modifiedTime)&orderBy=modifiedTime desc to list recent files
403
+ 2. Call connector_google-drive-oauth_request with GET /about?fields=user,storageQuota to get account info and storage usage`,
404
+ ja: `1. connector_google-drive-oauth_request \u3067 GET /files?pageSize=20&fields=files(id,name,mimeType,modifiedTime)&orderBy=modifiedTime desc \u3092\u547C\u3073\u51FA\u3057\u3001\u6700\u8FD1\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u4E00\u89A7\u8868\u793A
405
+ 2. connector_google-drive-oauth_request \u3067 GET /about?fields=user,storageQuota \u3092\u547C\u3073\u51FA\u3057\u3001\u30A2\u30AB\u30A6\u30F3\u30C8\u60C5\u5831\u3068\u30B9\u30C8\u30EC\u30FC\u30B8\u4F7F\u7528\u91CF\u3092\u53D6\u5F97`
406
406
  }
407
407
  });
408
408
 
@@ -543,6 +543,28 @@ var googleDriveSetupFlow = {
543
543
  );
544
544
  }
545
545
  sections.push("");
546
+ try {
547
+ const counts = /* @__PURE__ */ new Map();
548
+ for (const f of allFiles) {
549
+ const key = f.mimeType === FOLDER_MIME ? "folder" : f.mimeType ?? "(unknown)";
550
+ counts.set(key, (counts.get(key) ?? 0) + 1);
551
+ }
552
+ const top = Array.from(counts.entries()).sort((a, b) => b[1] - a[1]).slice(0, 10);
553
+ if (top.length > 0) {
554
+ sections.push(
555
+ rt.language === "ja" ? "### \u30D5\u30A1\u30A4\u30EB\u7A2E\u5225\u306E\u5185\u8A33 (\u4E0A\u4F4D10\u4EF6)" : "### File type breakdown (top 10)",
556
+ ""
557
+ );
558
+ sections.push("| Mime Type | Count |");
559
+ sections.push("|-----------|-------|");
560
+ for (const [mime, count] of top) {
561
+ const safe = mime.replace(/\|/g, "\\|");
562
+ sections.push(`| ${safe} | ${count} |`);
563
+ }
564
+ sections.push("");
565
+ }
566
+ } catch {
567
+ }
546
568
  return sections.join("\n");
547
569
  }
548
570
  };
@@ -694,9 +716,9 @@ var googleDriveConnector = new ConnectorPlugin({
694
716
  systemPrompt: {
695
717
  en: `### Tools (setup-time only)
696
718
 
697
- - \`google-drive-oauth_request\`: Send authenticated requests to the Google Drive API v3 during setup / data overview. Supports GET, POST, and PATCH methods. Authentication is configured automatically via OAuth.
719
+ - \`connector_google-drive-oauth_request\`: Send authenticated requests to the Google Drive API v3 during setup / data overview. Supports GET, POST, and PATCH methods. Authentication is configured automatically via OAuth.
698
720
 
699
- > **Important**: The \`google-drive-oauth_request\` tool is only available at setup time. Inside server-logic handlers, use the SDK (\`connection(id).listFiles\`, etc.) \u2014 the SDK's fetch is already wired through the OAuth proxy. **Do NOT** hand-roll HTTP calls to \`_sqcore/connections/*/request\` from a handler.
721
+ > **Important**: The \`connector_google-drive-oauth_request\` tool is only available at setup time. Inside server-logic handlers, use the SDK (\`connection(id).listFiles\`, etc.) \u2014 the SDK's fetch is already wired through the OAuth proxy. **Do NOT** hand-roll HTTP calls to \`_sqcore/connections/*/request\` from a handler.
700
722
 
701
723
  ### Google Drive API Reference
702
724
 
@@ -830,9 +852,9 @@ await drive.updateFile("fileId123", {}, "newFolderId", "oldFolderId");
830
852
  \`\`\``,
831
853
  ja: `### \u30C4\u30FC\u30EB\uFF08\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u6642\u306E\u307F\uFF09
832
854
 
833
- - \`google-drive-oauth_request\`: \u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3084\u30C7\u30FC\u30BF\u6982\u8981\u628A\u63E1\u6642\u306B Google Drive API v3 \u3078\u8A8D\u8A3C\u6E08\u307F\u30EA\u30AF\u30A8\u30B9\u30C8\u3092\u9001\u4FE1\u3057\u307E\u3059\u3002GET, POST, PATCH \u30E1\u30BD\u30C3\u30C9\u3092\u30B5\u30DD\u30FC\u30C8\u3057\u307E\u3059\u3002OAuth \u7D4C\u7531\u3067\u8A8D\u8A3C\u306F\u81EA\u52D5\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002
855
+ - \`connector_google-drive-oauth_request\`: \u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3084\u30C7\u30FC\u30BF\u6982\u8981\u628A\u63E1\u6642\u306B Google Drive API v3 \u3078\u8A8D\u8A3C\u6E08\u307F\u30EA\u30AF\u30A8\u30B9\u30C8\u3092\u9001\u4FE1\u3057\u307E\u3059\u3002GET, POST, PATCH \u30E1\u30BD\u30C3\u30C9\u3092\u30B5\u30DD\u30FC\u30C8\u3057\u307E\u3059\u3002OAuth \u7D4C\u7531\u3067\u8A8D\u8A3C\u306F\u81EA\u52D5\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002
834
856
 
835
- > **\u91CD\u8981**: \`google-drive-oauth_request\` \u306F\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u6642\u306E\u307F\u5229\u7528\u53EF\u80FD\u3067\u3059\u3002\u30B5\u30FC\u30D0\u30FC\u30ED\u30B8\u30C3\u30AF\u306E\u30CF\u30F3\u30C9\u30E9\u5185\u3067\u306F\u5FC5\u305A SDK\uFF08\`connection(id).listFiles\` \u306A\u3069\uFF09\u3092\u4F7F\u3063\u3066\u304F\u3060\u3055\u3044\u3002SDK \u306E fetch \u306F OAuth \u30D7\u30ED\u30AD\u30B7\u7D4C\u7531\u3067\u65E2\u306B\u914D\u7DDA\u3055\u308C\u3066\u3044\u307E\u3059\u3002\u30CF\u30F3\u30C9\u30E9\u304B\u3089 \`_sqcore/connections/*/request\` \u3092\u624B\u66F8\u304D\u3067\u547C\u3073\u51FA\u3055\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002
857
+ > **\u91CD\u8981**: \`connector_google-drive-oauth_request\` \u306F\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u6642\u306E\u307F\u5229\u7528\u53EF\u80FD\u3067\u3059\u3002\u30B5\u30FC\u30D0\u30FC\u30ED\u30B8\u30C3\u30AF\u306E\u30CF\u30F3\u30C9\u30E9\u5185\u3067\u306F\u5FC5\u305A SDK\uFF08\`connection(id).listFiles\` \u306A\u3069\uFF09\u3092\u4F7F\u3063\u3066\u304F\u3060\u3055\u3044\u3002SDK \u306E fetch \u306F OAuth \u30D7\u30ED\u30AD\u30B7\u7D4C\u7531\u3067\u65E2\u306B\u914D\u7DDA\u3055\u308C\u3066\u3044\u307E\u3059\u3002\u30CF\u30F3\u30C9\u30E9\u304B\u3089 \`_sqcore/connections/*/request\` \u3092\u624B\u66F8\u304D\u3067\u547C\u3073\u51FA\u3055\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002
836
858
 
837
859
  ### Google Drive API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
838
860
 
@@ -256,7 +256,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
256
256
  /**
257
257
  * Create tools for connections that belong to this connector.
258
258
  * Filters connections by connectorKey internally.
259
- * Returns tools keyed as `${connectorKey}_${toolName}`.
259
+ * Returns tools keyed as `connector_${connectorKey}_${toolName}`.
260
260
  */
261
261
  createTools(connections, config, opts) {
262
262
  const myConnections = connections.filter(
@@ -266,7 +266,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
266
266
  for (const t of Object.values(this.tools)) {
267
267
  const tool = t.createTool(myConnections, config);
268
268
  const originalToModelOutput = tool.toModelOutput;
269
- result[`${this.connectorKey}_${t.name}`] = {
269
+ result[`connector_${this.connectorKey}_${t.name}`] = {
270
270
  ...tool,
271
271
  toModelOutput: async (options) => {
272
272
  if (!originalToModelOutput) {
@@ -551,10 +551,10 @@ var googleSearchConsoleOauthOnboarding = new ConnectorOnboarding({
551
551
  - Write only 1 sentence between tool calls, then immediately call the next tool. Skip unnecessary explanations and proceed efficiently`
552
552
  },
553
553
  dataOverviewInstructions: {
554
- en: `1. Call google-search-console-oauth_request with GET /sites/{siteUrl} to fetch metadata for the configured site
555
- 2. Call google-search-console-oauth_request with POST /sites/{siteUrl}/searchAnalytics/query and a small body \u2014 startDate/endDate covering the last 7 days, dimensions ["date"], rowLimit 7 \u2014 to verify that performance data is available`,
556
- ja: `1. google-search-console-oauth_request \u3067 GET /sites/{siteUrl} \u3092\u547C\u3073\u51FA\u3057\u3001\u8A2D\u5B9A\u3055\u308C\u305F\u30B5\u30A4\u30C8\u306E\u30E1\u30BF\u30C7\u30FC\u30BF\u3092\u53D6\u5F97
557
- 2. google-search-console-oauth_request \u3067 POST /sites/{siteUrl}/searchAnalytics/query \u3092\u76F4\u8FD17\u65E5\u9593\u306E startDate/endDate\u3001dimensions ["date"]\u3001rowLimit 7 \u3067\u547C\u3073\u51FA\u3057\u3001\u30D1\u30D5\u30A9\u30FC\u30DE\u30F3\u30B9\u30C7\u30FC\u30BF\u306E\u53EF\u7528\u6027\u3092\u78BA\u8A8D`
554
+ en: `1. Call connector_google-search-console-oauth_request with GET /sites/{siteUrl} to fetch metadata for the configured site
555
+ 2. Call connector_google-search-console-oauth_request with POST /sites/{siteUrl}/searchAnalytics/query and a small body \u2014 startDate/endDate covering the last 7 days, dimensions ["date"], rowLimit 7 \u2014 to verify that performance data is available`,
556
+ ja: `1. connector_google-search-console-oauth_request \u3067 GET /sites/{siteUrl} \u3092\u547C\u3073\u51FA\u3057\u3001\u8A2D\u5B9A\u3055\u308C\u305F\u30B5\u30A4\u30C8\u306E\u30E1\u30BF\u30C7\u30FC\u30BF\u3092\u53D6\u5F97
557
+ 2. connector_google-search-console-oauth_request \u3067 POST /sites/{siteUrl}/searchAnalytics/query \u3092\u76F4\u8FD17\u65E5\u9593\u306E startDate/endDate\u3001dimensions ["date"]\u3001rowLimit 7 \u3067\u547C\u3073\u51FA\u3057\u3001\u30D1\u30D5\u30A9\u30FC\u30DE\u30F3\u30B9\u30C7\u30FC\u30BF\u306E\u53EF\u7528\u6027\u3092\u78BA\u8A8D`
558
558
  }
559
559
  });
560
560
 
@@ -577,6 +577,33 @@ function isVerified(site) {
577
577
  const level = site.permissionLevel ?? "";
578
578
  return level !== "" && level !== "siteUnverifiedUser";
579
579
  }
580
+ function formatDate(daysAgo) {
581
+ const d = /* @__PURE__ */ new Date();
582
+ d.setDate(d.getDate() - daysAgo);
583
+ return d.toISOString().slice(0, 10);
584
+ }
585
+ async function querySearchAnalytics(proxyFetch, siteUrl, dimensions, rowLimit) {
586
+ try {
587
+ const res = await proxyFetch(
588
+ `${SITES_URL}/${encodeURIComponent(siteUrl)}/searchAnalytics/query`,
589
+ {
590
+ method: "POST",
591
+ headers: { "Content-Type": "application/json" },
592
+ body: JSON.stringify({
593
+ startDate: formatDate(28),
594
+ endDate: formatDate(1),
595
+ dimensions,
596
+ rowLimit
597
+ })
598
+ }
599
+ );
600
+ if (!res.ok) return [];
601
+ const data = await res.json();
602
+ return data.rows ?? [];
603
+ } catch {
604
+ return [];
605
+ }
606
+ }
580
607
  var googleSearchConsoleOauthSetupFlow = {
581
608
  initialState: () => ({}),
582
609
  steps: [
@@ -615,7 +642,6 @@ var googleSearchConsoleOauthSetupFlow = {
615
642
  }
616
643
  const allSites = await listSites(rt.config.proxyFetch);
617
644
  const verified = allSites.filter(isVerified);
618
- const siteByUrl = new Map(verified.map((s) => [s.siteUrl ?? "", s]));
619
645
  const targetSiteUrls = await resolveSetupSelection({
620
646
  selected: state.sites,
621
647
  allSentinel: ALL_SITES,
@@ -627,15 +653,98 @@ var googleSearchConsoleOauthSetupFlow = {
627
653
  sections.push("_No sites selected._", "");
628
654
  return sections.join("\n");
629
655
  }
630
- sections.push("| Site URL | Permission Level |");
631
- sections.push("|----------|------------------|");
632
656
  for (const siteUrl of targetSiteUrls) {
633
- const site = siteByUrl.get(siteUrl);
634
- const permission = site?.permissionLevel ?? "-";
635
657
  const safeSiteUrl = siteUrl.replace(/\|/g, "\\|");
636
- sections.push(`| ${safeSiteUrl} | ${permission} |`);
658
+ sections.push(`### Site: ${safeSiteUrl}`, "");
659
+ const topQueries = await querySearchAnalytics(
660
+ rt.config.proxyFetch,
661
+ siteUrl,
662
+ ["query"],
663
+ 10
664
+ );
665
+ if (topQueries.length > 0) {
666
+ sections.push("#### Top Search Queries (last 28 days)", "");
667
+ sections.push("| Query | Clicks | Impressions | CTR | Avg Position |");
668
+ sections.push("|-------|--------|-------------|-----|-------------|");
669
+ for (const row of topQueries) {
670
+ const q = (row.keys?.[0] ?? "").replace(/\|/g, "\\|");
671
+ const clicks = row.clicks ?? 0;
672
+ const impressions = row.impressions ?? 0;
673
+ const ctr = ((row.ctr ?? 0) * 100).toFixed(1);
674
+ const pos = (row.position ?? 0).toFixed(1);
675
+ sections.push(
676
+ `| ${q} | ${clicks} | ${impressions} | ${ctr}% | ${pos} |`
677
+ );
678
+ }
679
+ sections.push("");
680
+ }
681
+ const topPages = await querySearchAnalytics(
682
+ rt.config.proxyFetch,
683
+ siteUrl,
684
+ ["page"],
685
+ 10
686
+ );
687
+ if (topPages.length > 0) {
688
+ sections.push("#### Top Pages (last 28 days)", "");
689
+ sections.push("| Page | Clicks | Impressions | CTR | Avg Position |");
690
+ sections.push("|------|--------|-------------|-----|-------------|");
691
+ for (const row of topPages) {
692
+ const pg = (row.keys?.[0] ?? "").replace(/\|/g, "\\|");
693
+ const clicks = row.clicks ?? 0;
694
+ const impressions = row.impressions ?? 0;
695
+ const ctr = ((row.ctr ?? 0) * 100).toFixed(1);
696
+ const pos = (row.position ?? 0).toFixed(1);
697
+ sections.push(
698
+ `| ${pg} | ${clicks} | ${impressions} | ${ctr}% | ${pos} |`
699
+ );
700
+ }
701
+ sections.push("");
702
+ }
703
+ const deviceRows = await querySearchAnalytics(
704
+ rt.config.proxyFetch,
705
+ siteUrl,
706
+ ["device"],
707
+ 5
708
+ );
709
+ if (deviceRows.length > 0) {
710
+ sections.push("#### Device Breakdown (last 28 days)", "");
711
+ sections.push("| Device | Clicks | Impressions | CTR | Avg Position |");
712
+ sections.push("|--------|--------|-------------|-----|-------------|");
713
+ for (const row of deviceRows) {
714
+ const dev = row.keys?.[0] ?? "";
715
+ const clicks = row.clicks ?? 0;
716
+ const impressions = row.impressions ?? 0;
717
+ const ctr = ((row.ctr ?? 0) * 100).toFixed(1);
718
+ const pos = (row.position ?? 0).toFixed(1);
719
+ sections.push(
720
+ `| ${dev} | ${clicks} | ${impressions} | ${ctr}% | ${pos} |`
721
+ );
722
+ }
723
+ sections.push("");
724
+ }
725
+ const countryRows = await querySearchAnalytics(
726
+ rt.config.proxyFetch,
727
+ siteUrl,
728
+ ["country"],
729
+ 10
730
+ );
731
+ if (countryRows.length > 0) {
732
+ sections.push("#### Top Countries (last 28 days)", "");
733
+ sections.push("| Country | Clicks | Impressions | CTR | Avg Position |");
734
+ sections.push("|---------|--------|-------------|-----|-------------|");
735
+ for (const row of countryRows) {
736
+ const c = row.keys?.[0] ?? "";
737
+ const clicks = row.clicks ?? 0;
738
+ const impressions = row.impressions ?? 0;
739
+ const ctr = ((row.ctr ?? 0) * 100).toFixed(1);
740
+ const pos = (row.position ?? 0).toFixed(1);
741
+ sections.push(
742
+ `| ${c} | ${clicks} | ${impressions} | ${ctr}% | ${pos} |`
743
+ );
744
+ }
745
+ sections.push("");
746
+ }
637
747
  }
638
- sections.push("");
639
748
  return sections.join("\n");
640
749
  }
641
750
  };
@@ -798,8 +907,8 @@ var googleSearchConsoleOauthConnector = new ConnectorPlugin({
798
907
  systemPrompt: {
799
908
  en: `### Tools
800
909
 
801
- - \`google-search-console-oauth_request\`: Send authenticated requests to the Google Search Console API (Webmasters v3). Use it for searchAnalytics queries, sitemap inspection, and site metadata. The {siteUrl} placeholder in paths is automatically replaced and URL-encoded. Authentication is configured automatically via OAuth.
802
- - \`google-search-console-oauth_listSites\`: List accessible Search Console sites. Use during setup to discover available properties.
910
+ - \`connector_google-search-console-oauth_request\`: Send authenticated requests to the Google Search Console API (Webmasters v3). Use it for searchAnalytics queries, sitemap inspection, and site metadata. The {siteUrl} placeholder in paths is automatically replaced and URL-encoded. Authentication is configured automatically via OAuth.
911
+ - \`connector_google-search-console-oauth_listSites\`: List accessible Search Console sites. Use during setup to discover available properties.
803
912
 
804
913
  ### Search Console API Reference
805
914
 
@@ -884,8 +993,8 @@ sitemaps.forEach(s => console.log(s.path, s.lastSubmitted));
884
993
  \`\`\``,
885
994
  ja: `### \u30C4\u30FC\u30EB
886
995
 
887
- - \`google-search-console-oauth_request\`: Google Search Console API (Webmasters v3) \u3078\u8A8D\u8A3C\u6E08\u307F\u30EA\u30AF\u30A8\u30B9\u30C8\u3092\u9001\u4FE1\u3057\u307E\u3059\u3002searchAnalytics \u30AF\u30A8\u30EA\u3001\u30B5\u30A4\u30C8\u30DE\u30C3\u30D7\u78BA\u8A8D\u3001\u30B5\u30A4\u30C8\u30E1\u30BF\u30C7\u30FC\u30BF\u306E\u53D6\u5F97\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u30D1\u30B9\u5185\u306E{siteUrl}\u30D7\u30EC\u30FC\u30B9\u30DB\u30EB\u30C0\u30FC\u306F\u81EA\u52D5\u7684\u306BURL\u30A8\u30F3\u30B3\u30FC\u30C9\u3055\u308C\u7F6E\u63DB\u3055\u308C\u307E\u3059\u3002OAuth\u7D4C\u7531\u3067\u8A8D\u8A3C\u306F\u81EA\u52D5\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002
888
- - \`google-search-console-oauth_listSites\`: \u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306ASearch Console\u30B5\u30A4\u30C8\u306E\u4E00\u89A7\u3092\u53D6\u5F97\u3057\u307E\u3059\u3002\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u6642\u306B\u5229\u7528\u53EF\u80FD\u306A\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u78BA\u8A8D\u3059\u308B\u305F\u3081\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002
996
+ - \`connector_google-search-console-oauth_request\`: Google Search Console API (Webmasters v3) \u3078\u8A8D\u8A3C\u6E08\u307F\u30EA\u30AF\u30A8\u30B9\u30C8\u3092\u9001\u4FE1\u3057\u307E\u3059\u3002searchAnalytics \u30AF\u30A8\u30EA\u3001\u30B5\u30A4\u30C8\u30DE\u30C3\u30D7\u78BA\u8A8D\u3001\u30B5\u30A4\u30C8\u30E1\u30BF\u30C7\u30FC\u30BF\u306E\u53D6\u5F97\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u30D1\u30B9\u5185\u306E{siteUrl}\u30D7\u30EC\u30FC\u30B9\u30DB\u30EB\u30C0\u30FC\u306F\u81EA\u52D5\u7684\u306BURL\u30A8\u30F3\u30B3\u30FC\u30C9\u3055\u308C\u7F6E\u63DB\u3055\u308C\u307E\u3059\u3002OAuth\u7D4C\u7531\u3067\u8A8D\u8A3C\u306F\u81EA\u52D5\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002
997
+ - \`connector_google-search-console-oauth_listSites\`: \u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306ASearch Console\u30B5\u30A4\u30C8\u306E\u4E00\u89A7\u3092\u53D6\u5F97\u3057\u307E\u3059\u3002\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u6642\u306B\u5229\u7528\u53EF\u80FD\u306A\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u78BA\u8A8D\u3059\u308B\u305F\u3081\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002
889
998
 
890
999
  ### Search Console API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
891
1000