@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.
Files changed (80) hide show
  1. package/dist/cli/index.js +8941 -3700
  2. package/dist/connectors/airtable-oauth.js +87 -23
  3. package/dist/connectors/airtable.js +130 -23
  4. package/dist/connectors/amplitude.js +47 -23
  5. package/dist/connectors/anthropic.js +41 -17
  6. package/dist/connectors/asana.js +76 -25
  7. package/dist/connectors/attio.js +69 -28
  8. package/dist/connectors/aws-billing.js +47 -23
  9. package/dist/connectors/azure-sql.js +322 -25
  10. package/dist/connectors/backlog-api-key.js +79 -30
  11. package/dist/connectors/clickup.js +89 -25
  12. package/dist/connectors/cosmosdb.js +51 -27
  13. package/dist/connectors/customerio.js +47 -23
  14. package/dist/connectors/dbt.js +725 -40
  15. package/dist/connectors/freshdesk.js +121 -23
  16. package/dist/connectors/freshsales.js +47 -23
  17. package/dist/connectors/freshservice.js +47 -23
  18. package/dist/connectors/gamma.js +54 -30
  19. package/dist/connectors/gemini.js +41 -17
  20. package/dist/connectors/github.js +51 -27
  21. package/dist/connectors/gmail-oauth.js +42 -23
  22. package/dist/connectors/gmail.js +43 -19
  23. package/dist/connectors/google-ads.js +47 -23
  24. package/dist/connectors/google-analytics-oauth.js +191 -40
  25. package/dist/connectors/google-analytics.js +529 -111
  26. package/dist/connectors/google-audit-log.js +43 -19
  27. package/dist/connectors/google-calendar-oauth.js +100 -30
  28. package/dist/connectors/google-calendar.js +100 -26
  29. package/dist/connectors/google-docs.js +42 -23
  30. package/dist/connectors/google-drive.js +64 -23
  31. package/dist/connectors/google-search-console-oauth.js +165 -32
  32. package/dist/connectors/google-sheets.js +142 -199
  33. package/dist/connectors/google-slides.js +42 -23
  34. package/dist/connectors/grafana.js +84 -25
  35. package/dist/connectors/hackernews.d.ts +5 -0
  36. package/dist/connectors/hackernews.js +909 -0
  37. package/dist/connectors/hubspot-oauth.js +73 -22
  38. package/dist/connectors/hubspot.js +64 -24
  39. package/dist/connectors/influxdb.js +47 -23
  40. package/dist/connectors/intercom-oauth.js +104 -25
  41. package/dist/connectors/intercom.js +51 -27
  42. package/dist/connectors/jdbc.js +76 -25
  43. package/dist/connectors/jira-api-key.js +107 -26
  44. package/dist/connectors/kintone-api-token.js +105 -33
  45. package/dist/connectors/kintone.js +182 -26
  46. package/dist/connectors/linear.js +93 -27
  47. package/dist/connectors/linkedin-ads.js +80 -29
  48. package/dist/connectors/mailchimp-oauth.js +45 -21
  49. package/dist/connectors/mailchimp.js +45 -21
  50. package/dist/connectors/meta-ads-oauth.js +72 -29
  51. package/dist/connectors/meta-ads.js +74 -29
  52. package/dist/connectors/mixpanel.js +47 -23
  53. package/dist/connectors/monday.js +48 -24
  54. package/dist/connectors/mongodb.js +47 -23
  55. package/dist/connectors/notion-oauth.js +92 -24
  56. package/dist/connectors/notion.js +144 -26
  57. package/dist/connectors/openai.js +41 -17
  58. package/dist/connectors/oracle.js +316 -26
  59. package/dist/connectors/outlook-oauth.js +53 -34
  60. package/dist/connectors/powerbi-oauth.js +45 -26
  61. package/dist/connectors/salesforce.js +150 -24
  62. package/dist/connectors/semrush.js +45 -21
  63. package/dist/connectors/sentry.js +75 -25
  64. package/dist/connectors/shopify-oauth.js +75 -23
  65. package/dist/connectors/shopify.js +47 -23
  66. package/dist/connectors/sqlserver.js +322 -25
  67. package/dist/connectors/stripe-api-key.js +105 -30
  68. package/dist/connectors/stripe-oauth.js +102 -32
  69. package/dist/connectors/supabase.js +315 -21
  70. package/dist/connectors/tableau.js +54 -30
  71. package/dist/connectors/tiktok-ads.js +76 -31
  72. package/dist/connectors/wix-store.js +47 -23
  73. package/dist/connectors/x.d.ts +5 -0
  74. package/dist/connectors/x.js +951 -0
  75. package/dist/connectors/zendesk-oauth.js +87 -25
  76. package/dist/connectors/zendesk.js +51 -27
  77. package/dist/index.js +9005 -3709
  78. package/dist/main.js +9005 -3709
  79. package/dist/vite-plugin.js +8939 -3698
  80. package/package.json +12 -4
@@ -1,6 +1,11 @@
1
1
  var __getOwnPropNames = Object.getOwnPropertyNames;
2
- var __esm = (fn, res) => function __init() {
3
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
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
@@ -245,6 +250,15 @@ var ConnectorPlugin = class _ConnectorPlugin {
245
250
  * `runSetupFlow` from `setup-flow.ts`.
246
251
  */
247
252
  setup;
253
+ /**
254
+ * 統一 introspection。SQL DB の `information_schema` / `SHOW` / `DESCRIBE` や SaaS の
255
+ * メタデータ API といった取得経路の差を吸収し、tables / columns / PK / FK を共通型
256
+ * {@link IntrospectedSchema} へ正規化して返す。取得経路は {@link IntrospectContext} で
257
+ * 抽象化され、SQL DB は `ctx.query`、SaaS は `ctx.proxyFetch` + `ctx.params` を使う。
258
+ * `ctx.profile === true` のときは L2 プロファイル(行数・NULL 率等)も best-effort で埋める。
259
+ * coding-agent の `DataContextIndex` がデータ地図を構築する際に使う。
260
+ */
261
+ introspect;
248
262
  /**
249
263
  * Opt-out of the default "verify before save" behavior on connection
250
264
  * creation. The backend invokes `checkConnection` synchronously while
@@ -259,6 +273,14 @@ var ConnectorPlugin = class _ConnectorPlugin {
259
273
  * the default verify-on-create behavior without opt-in.
260
274
  */
261
275
  skipConnectionCheckOnCreate;
276
+ /**
277
+ * 決定論的な「立ち上げ survey」レシピ(ルールベース prewarm 基盤)。実装した connector は、LLM を使わずに
278
+ * read-only で自分を survey する probe 列(テーブル/列メタデータ → 小サンプル)を宣言する。coding-agent の
279
+ * recon driver がこれを読み、connector ツールの `execute` を直接呼んで結果を seed にする。未実装の connector は
280
+ * driver 側で safely skip される(その connection は listConnections のみ seed)。標準 `information_schema` を
281
+ * 持つ SQL connector は `makeStandardSqlSurveyProbes` を使える。**probe は必ず read-only**。
282
+ */
283
+ surveyProbes;
262
284
  constructor(config) {
263
285
  this.slug = config.slug;
264
286
  this.authType = config.authType;
@@ -276,7 +298,9 @@ var ConnectorPlugin = class _ConnectorPlugin {
276
298
  this.query = config.query;
277
299
  this.checkConnection = config.checkConnection;
278
300
  this.setup = config.setup;
301
+ this.introspect = config.introspect;
279
302
  this.skipConnectionCheckOnCreate = config.skipConnectionCheckOnCreate;
303
+ this.surveyProbes = config.surveyProbes;
280
304
  }
281
305
  get connectorKey() {
282
306
  return _ConnectorPlugin.deriveKey(this.slug, this.authType);
@@ -284,7 +308,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
284
308
  /**
285
309
  * Create tools for connections that belong to this connector.
286
310
  * Filters connections by connectorKey internally.
287
- * Returns tools keyed as `${connectorKey}_${toolName}`.
311
+ * Returns tools keyed as `connector_${connectorKey}_${toolName}`.
288
312
  */
289
313
  createTools(connections, config, opts) {
290
314
  const myConnections = connections.filter(
@@ -294,7 +318,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
294
318
  for (const t of Object.values(this.tools)) {
295
319
  const tool = t.createTool(myConnections, config);
296
320
  const originalToModelOutput = tool.toModelOutput;
297
- result[`${this.connectorKey}_${t.name}`] = {
321
+ result[`connector_${this.connectorKey}_${t.name}`] = {
298
322
  ...tool,
299
323
  toModelOutput: async (options) => {
300
324
  if (!originalToModelOutput) {
@@ -314,25 +338,25 @@ var ConnectorPlugin = class _ConnectorPlugin {
314
338
  if (authType) return `${slug}-${authType}`;
315
339
  const LEGACY_NULL_AUTH_TYPE_MAP = {
316
340
  // user-password
317
- "postgresql": "user-password",
318
- "mysql": "user-password",
319
- "clickhouse": "user-password",
320
- "kintone": "user-password",
341
+ postgresql: "user-password",
342
+ mysql: "user-password",
343
+ clickhouse: "user-password",
344
+ kintone: "user-password",
321
345
  "squadbase-db": "user-password",
322
346
  // service-account
323
- "snowflake": "service-account",
324
- "bigquery": "service-account",
347
+ snowflake: "service-account",
348
+ bigquery: "service-account",
325
349
  "google-analytics": "service-account",
326
350
  "google-calendar": "service-account",
327
351
  "aws-athena": "service-account",
328
- "redshift": "service-account",
352
+ redshift: "service-account",
329
353
  // api-key
330
- "databricks": "api-key",
331
- "dbt": "api-key",
332
- "airtable": "api-key",
333
- "openai": "api-key",
334
- "gemini": "api-key",
335
- "anthropic": "api-key",
354
+ databricks: "api-key",
355
+ dbt: "api-key",
356
+ airtable: "api-key",
357
+ openai: "api-key",
358
+ gemini: "api-key",
359
+ anthropic: "api-key",
336
360
  "wix-store": "api-key"
337
361
  };
338
362
  const fallbackAuthType = LEGACY_NULL_AUTH_TYPE_MAP[slug];
@@ -424,13 +448,13 @@ var AUTH_TYPES = {
424
448
  // ../connectors/src/connectors/notion/setup.ts
425
449
  var notionOnboarding = new ConnectorOnboarding({
426
450
  dataOverviewInstructions: {
427
- en: `1. Call notion_request with POST /search and { "page_size": 5 } to discover available pages and databases
428
- 2. For each database found, call notion_request with POST /databases/{database_id}/query and { "page_size": 5 } to sample records and understand the schema
429
- 3. Call notion_request with GET /users to list workspace members
451
+ en: `1. Call connector_notion_request with POST /search and { "page_size": 5 } to discover available pages and databases
452
+ 2. For each database found, call connector_notion_request with POST /databases/{database_id}/query and { "page_size": 5 } to sample records and understand the schema
453
+ 3. Call connector_notion_request with GET /users to list workspace members
430
454
  4. Explore page content with GET /blocks/{page_id}/children as needed`,
431
- ja: `1. notion_request \u3067 POST /search \u3092 { "page_size": 5 } \u3067\u547C\u3073\u51FA\u3057\u3001\u5229\u7528\u53EF\u80FD\u306A\u30DA\u30FC\u30B8\u3068\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u3092\u691C\u51FA
432
- 2. \u898B\u3064\u304B\u3063\u305F\u5404\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u306B\u3064\u3044\u3066\u3001notion_request \u3067 POST /databases/{database_id}/query \u3092 { "page_size": 5 } \u3067\u547C\u3073\u51FA\u3057\u3001\u30EC\u30B3\u30FC\u30C9\u306E\u30B5\u30F3\u30D7\u30EA\u30F3\u30B0\u3068\u30B9\u30AD\u30FC\u30DE\u306E\u628A\u63E1\u3092\u884C\u3046
433
- 3. notion_request \u3067 GET /users \u3092\u547C\u3073\u51FA\u3057\u3001\u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u30E1\u30F3\u30D0\u30FC\u3092\u4E00\u89A7\u8868\u793A
455
+ ja: `1. connector_notion_request \u3067 POST /search \u3092 { "page_size": 5 } \u3067\u547C\u3073\u51FA\u3057\u3001\u5229\u7528\u53EF\u80FD\u306A\u30DA\u30FC\u30B8\u3068\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u3092\u691C\u51FA
456
+ 2. \u898B\u3064\u304B\u3063\u305F\u5404\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u306B\u3064\u3044\u3066\u3001connector_notion_request \u3067 POST /databases/{database_id}/query \u3092 { "page_size": 5 } \u3067\u547C\u3073\u51FA\u3057\u3001\u30EC\u30B3\u30FC\u30C9\u306E\u30B5\u30F3\u30D7\u30EA\u30F3\u30B0\u3068\u30B9\u30AD\u30FC\u30DE\u306E\u628A\u63E1\u3092\u884C\u3046
457
+ 3. connector_notion_request \u3067 GET /users \u3092\u547C\u3073\u51FA\u3057\u3001\u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u30E1\u30F3\u30D0\u30FC\u3092\u4E00\u89A7\u8868\u793A
434
458
  4. \u5FC5\u8981\u306B\u5FDC\u3058\u3066 GET /blocks/{page_id}/children \u3067\u30DA\u30FC\u30B8\u30B3\u30F3\u30C6\u30F3\u30C4\u3092\u63A2\u7D22`
435
459
  }
436
460
  });
@@ -494,6 +518,38 @@ async function getDatabase(params, databaseId) {
494
518
  }
495
519
  return await res.json();
496
520
  }
521
+ async function queryDatabaseSample(params, databaseId) {
522
+ try {
523
+ const res = await apiFetch(params, `/databases/${databaseId}/query`, {
524
+ method: "POST",
525
+ body: JSON.stringify({ page_size: 3 })
526
+ });
527
+ if (!res.ok) return [];
528
+ const data = await res.json();
529
+ return data.results ?? [];
530
+ } catch {
531
+ return [];
532
+ }
533
+ }
534
+ function formatPropertyValue(prop) {
535
+ if (prop == null || typeof prop !== "object") return "";
536
+ const p = prop;
537
+ const t = p.type ?? "";
538
+ const v = p[t];
539
+ if (v == null) return "";
540
+ if (typeof v === "string" || typeof v === "number" || typeof v === "boolean")
541
+ return String(v);
542
+ if (Array.isArray(v)) {
543
+ if (v.length === 0) return "";
544
+ const first = v[0];
545
+ return first.plain_text ?? first.name ?? `[${v.length} items]`;
546
+ }
547
+ if (typeof v === "object") {
548
+ const o = v;
549
+ return o.name ?? o.plain_text ?? o.start ?? JSON.stringify(v).slice(0, 30);
550
+ }
551
+ return String(v);
552
+ }
497
553
  var notionSetupFlow = {
498
554
  initialState: () => ({}),
499
555
  steps: [
@@ -538,16 +594,77 @@ var notionSetupFlow = {
538
594
  sections.push(`### Database: ${title}`, "", `- id: \`${db.id}\``, "");
539
595
  sections.push("| Property | Type |");
540
596
  sections.push("|----------|------|");
541
- for (const [name, def] of Object.entries(db.properties ?? {})) {
597
+ const propEntries = Object.entries(db.properties ?? {});
598
+ for (const [name, def] of propEntries) {
542
599
  const escapedName = name.replace(/\|/g, "\\|");
543
600
  sections.push(`| ${escapedName} | ${def?.type ?? "-"} |`);
544
601
  }
545
602
  sections.push("");
603
+ const pages = await queryDatabaseSample(rt.params, dbId);
604
+ if (pages.length > 0) {
605
+ const sampleProps = propEntries.slice(0, 5).map(([n]) => n);
606
+ if (sampleProps.length > 0) {
607
+ sections.push(`#### Sample pages (${pages.length})`, "");
608
+ sections.push(`| ${sampleProps.join(" | ")} |`);
609
+ sections.push(`| ${sampleProps.map(() => "---").join(" | ")} |`);
610
+ for (const page of pages) {
611
+ const cells = sampleProps.map(
612
+ (n) => formatPropertyValue(page.properties?.[n]).replace(/\|/g, "\\|")
613
+ );
614
+ sections.push(`| ${cells.join(" | ")} |`);
615
+ }
616
+ sections.push("");
617
+ }
618
+ }
546
619
  }
547
620
  return sections.join("\n");
548
621
  }
549
622
  };
550
623
 
624
+ // ../connectors/src/connectors/notion/introspect.ts
625
+ var MAX_PAGES = 20;
626
+ var PAGE_SIZE = 100;
627
+ async function introspectNotion(ctx) {
628
+ const tables = [];
629
+ let cursor;
630
+ for (let page = 0; page < MAX_PAGES; page++) {
631
+ const body = {
632
+ filter: { property: "object", value: "database" },
633
+ page_size: PAGE_SIZE
634
+ };
635
+ if (cursor) body.start_cursor = cursor;
636
+ const res = await apiFetch(ctx.params, "/search", {
637
+ method: "POST",
638
+ body: JSON.stringify(body)
639
+ });
640
+ if (!res.ok) {
641
+ throw new Error(`notion: search failed (${res.status})`);
642
+ }
643
+ const data = await res.json();
644
+ for (const db of data.results ?? []) {
645
+ const name = (db.title ?? []).map((t) => t.plain_text ?? "").join("").trim() || "Untitled";
646
+ const columns = Object.entries(
647
+ db.properties ?? {}
648
+ ).map(([propName, prop]) => {
649
+ const column = {
650
+ name: propName,
651
+ dataType: prop.type ?? "unknown",
652
+ nullable: true
653
+ };
654
+ if (prop.type === "title") column.isPrimaryKey = true;
655
+ if (prop.type === "relation" && prop.relation?.database_id) {
656
+ column.foreignKey = { table: prop.relation.database_id, column: "" };
657
+ }
658
+ return column;
659
+ });
660
+ tables.push({ schema: "", name, type: "table", columns });
661
+ }
662
+ if (!data.has_more || !data.next_cursor) break;
663
+ cursor = data.next_cursor;
664
+ }
665
+ return { tables };
666
+ }
667
+
551
668
  // ../connectors/src/connectors/notion/tools/request.ts
552
669
  import { z } from "zod";
553
670
  var BASE_URL3 = "https://api.notion.com/v1";
@@ -643,7 +760,7 @@ var notionConnector = new ConnectorPlugin({
643
760
  systemPrompt: {
644
761
  en: `### Tools
645
762
 
646
- - \`notion_request\`: The only way to call the Notion REST API. Use it to search pages and databases, query database records, retrieve page content and blocks, and manage workspace data. Authentication (Bearer token) and Notion-Version header are configured automatically. Pagination uses cursor-based \`start_cursor\` and \`page_size\` (max 100) with \`has_more\` and \`next_cursor\` in the response.
763
+ - \`connector_notion_request\`: The only way to call the Notion REST API. Use it to search pages and databases, query database records, retrieve page content and blocks, and manage workspace data. Authentication (Bearer token) and Notion-Version header are configured automatically. Pagination uses cursor-based \`start_cursor\` and \`page_size\` (max 100) with \`has_more\` and \`next_cursor\` in the response.
647
764
 
648
765
  ### Business Logic
649
766
 
@@ -713,7 +830,7 @@ export default async function handler(c: Context) {
713
830
  - Properties with more than 25 items (e.g., people, relation) need the property endpoint for full data`,
714
831
  ja: `### \u30C4\u30FC\u30EB
715
832
 
716
- - \`notion_request\`: Notion REST API\u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u30DA\u30FC\u30B8\u3084\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u306E\u691C\u7D22\u3001\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u30EC\u30B3\u30FC\u30C9\u306E\u30AF\u30A8\u30EA\u3001\u30DA\u30FC\u30B8\u30B3\u30F3\u30C6\u30F3\u30C4\u3084\u30D6\u30ED\u30C3\u30AF\u306E\u53D6\u5F97\u3001\u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u30C7\u30FC\u30BF\u306E\u7BA1\u7406\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u8A8D\u8A3C\uFF08Bearer\u30C8\u30FC\u30AF\u30F3\uFF09\u3068Notion-Version\u30D8\u30C3\u30C0\u30FC\u306F\u81EA\u52D5\u7684\u306B\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002\u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\u306F\u30EC\u30B9\u30DD\u30F3\u30B9\u306E \`has_more\` \u3068 \`next_cursor\` \u306B\u3088\u308B\u30AB\u30FC\u30BD\u30EB\u30D9\u30FC\u30B9\u3067\u3001\`start_cursor\` \u3068 \`page_size\`\uFF08\u6700\u5927100\uFF09\u3092\u4F7F\u7528\u3057\u307E\u3059\u3002
833
+ - \`connector_notion_request\`: Notion REST API\u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u30DA\u30FC\u30B8\u3084\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u306E\u691C\u7D22\u3001\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u30EC\u30B3\u30FC\u30C9\u306E\u30AF\u30A8\u30EA\u3001\u30DA\u30FC\u30B8\u30B3\u30F3\u30C6\u30F3\u30C4\u3084\u30D6\u30ED\u30C3\u30AF\u306E\u53D6\u5F97\u3001\u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u30C7\u30FC\u30BF\u306E\u7BA1\u7406\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u8A8D\u8A3C\uFF08Bearer\u30C8\u30FC\u30AF\u30F3\uFF09\u3068Notion-Version\u30D8\u30C3\u30C0\u30FC\u306F\u81EA\u52D5\u7684\u306B\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002\u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\u306F\u30EC\u30B9\u30DD\u30F3\u30B9\u306E \`has_more\` \u3068 \`next_cursor\` \u306B\u3088\u308B\u30AB\u30FC\u30BD\u30EB\u30D9\u30FC\u30B9\u3067\u3001\`start_cursor\` \u3068 \`page_size\`\uFF08\u6700\u5927100\uFF09\u3092\u4F7F\u7528\u3057\u307E\u3059\u3002
717
834
 
718
835
  ### Business Logic
719
836
 
@@ -783,6 +900,7 @@ export default async function handler(c: Context) {
783
900
  - 25\u4EF6\u4EE5\u4E0A\u306E\u30A2\u30A4\u30C6\u30E0\u3092\u6301\u3064\u30D7\u30ED\u30D1\u30C6\u30A3\uFF08people\u3001relation\u306A\u3069\uFF09\u306F\u5B8C\u5168\u306A\u30C7\u30FC\u30BF\u53D6\u5F97\u306B\u30D7\u30ED\u30D1\u30C6\u30A3\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\u304C\u5FC5\u8981\u3067\u3059`
784
901
  },
785
902
  tools,
903
+ introspect: (ctx) => introspectNotion(ctx),
786
904
  setup: (params, ctx, config) => runSetupFlow(notionSetupFlow, params, ctx, config),
787
905
  async checkConnection(params, _config) {
788
906
  const apiKey = params[parameters.apiKey.slug];
@@ -1,6 +1,11 @@
1
1
  var __getOwnPropNames = Object.getOwnPropertyNames;
2
- var __esm = (fn, res) => function __init() {
3
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
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
@@ -105,6 +110,15 @@ var ConnectorPlugin = class _ConnectorPlugin {
105
110
  * `runSetupFlow` from `setup-flow.ts`.
106
111
  */
107
112
  setup;
113
+ /**
114
+ * 統一 introspection。SQL DB の `information_schema` / `SHOW` / `DESCRIBE` や SaaS の
115
+ * メタデータ API といった取得経路の差を吸収し、tables / columns / PK / FK を共通型
116
+ * {@link IntrospectedSchema} へ正規化して返す。取得経路は {@link IntrospectContext} で
117
+ * 抽象化され、SQL DB は `ctx.query`、SaaS は `ctx.proxyFetch` + `ctx.params` を使う。
118
+ * `ctx.profile === true` のときは L2 プロファイル(行数・NULL 率等)も best-effort で埋める。
119
+ * coding-agent の `DataContextIndex` がデータ地図を構築する際に使う。
120
+ */
121
+ introspect;
108
122
  /**
109
123
  * Opt-out of the default "verify before save" behavior on connection
110
124
  * creation. The backend invokes `checkConnection` synchronously while
@@ -119,6 +133,14 @@ var ConnectorPlugin = class _ConnectorPlugin {
119
133
  * the default verify-on-create behavior without opt-in.
120
134
  */
121
135
  skipConnectionCheckOnCreate;
136
+ /**
137
+ * 決定論的な「立ち上げ survey」レシピ(ルールベース prewarm 基盤)。実装した connector は、LLM を使わずに
138
+ * read-only で自分を survey する probe 列(テーブル/列メタデータ → 小サンプル)を宣言する。coding-agent の
139
+ * recon driver がこれを読み、connector ツールの `execute` を直接呼んで結果を seed にする。未実装の connector は
140
+ * driver 側で safely skip される(その connection は listConnections のみ seed)。標準 `information_schema` を
141
+ * 持つ SQL connector は `makeStandardSqlSurveyProbes` を使える。**probe は必ず read-only**。
142
+ */
143
+ surveyProbes;
122
144
  constructor(config) {
123
145
  this.slug = config.slug;
124
146
  this.authType = config.authType;
@@ -136,7 +158,9 @@ var ConnectorPlugin = class _ConnectorPlugin {
136
158
  this.query = config.query;
137
159
  this.checkConnection = config.checkConnection;
138
160
  this.setup = config.setup;
161
+ this.introspect = config.introspect;
139
162
  this.skipConnectionCheckOnCreate = config.skipConnectionCheckOnCreate;
163
+ this.surveyProbes = config.surveyProbes;
140
164
  }
141
165
  get connectorKey() {
142
166
  return _ConnectorPlugin.deriveKey(this.slug, this.authType);
@@ -144,7 +168,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
144
168
  /**
145
169
  * Create tools for connections that belong to this connector.
146
170
  * Filters connections by connectorKey internally.
147
- * Returns tools keyed as `${connectorKey}_${toolName}`.
171
+ * Returns tools keyed as `connector_${connectorKey}_${toolName}`.
148
172
  */
149
173
  createTools(connections, config, opts) {
150
174
  const myConnections = connections.filter(
@@ -154,7 +178,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
154
178
  for (const t of Object.values(this.tools)) {
155
179
  const tool = t.createTool(myConnections, config);
156
180
  const originalToModelOutput = tool.toModelOutput;
157
- result[`${this.connectorKey}_${t.name}`] = {
181
+ result[`connector_${this.connectorKey}_${t.name}`] = {
158
182
  ...tool,
159
183
  toModelOutput: async (options) => {
160
184
  if (!originalToModelOutput) {
@@ -174,25 +198,25 @@ var ConnectorPlugin = class _ConnectorPlugin {
174
198
  if (authType) return `${slug}-${authType}`;
175
199
  const LEGACY_NULL_AUTH_TYPE_MAP = {
176
200
  // user-password
177
- "postgresql": "user-password",
178
- "mysql": "user-password",
179
- "clickhouse": "user-password",
180
- "kintone": "user-password",
201
+ postgresql: "user-password",
202
+ mysql: "user-password",
203
+ clickhouse: "user-password",
204
+ kintone: "user-password",
181
205
  "squadbase-db": "user-password",
182
206
  // service-account
183
- "snowflake": "service-account",
184
- "bigquery": "service-account",
207
+ snowflake: "service-account",
208
+ bigquery: "service-account",
185
209
  "google-analytics": "service-account",
186
210
  "google-calendar": "service-account",
187
211
  "aws-athena": "service-account",
188
- "redshift": "service-account",
212
+ redshift: "service-account",
189
213
  // api-key
190
- "databricks": "api-key",
191
- "dbt": "api-key",
192
- "airtable": "api-key",
193
- "openai": "api-key",
194
- "gemini": "api-key",
195
- "anthropic": "api-key",
214
+ databricks: "api-key",
215
+ dbt: "api-key",
216
+ airtable: "api-key",
217
+ openai: "api-key",
218
+ gemini: "api-key",
219
+ anthropic: "api-key",
196
220
  "wix-store": "api-key"
197
221
  };
198
222
  const fallbackAuthType = LEGACY_NULL_AUTH_TYPE_MAP[slug];