@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
|
|
@@ -306,6 +311,15 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
306
311
|
* `runSetupFlow` from `setup-flow.ts`.
|
|
307
312
|
*/
|
|
308
313
|
setup;
|
|
314
|
+
/**
|
|
315
|
+
* 統一 introspection。SQL DB の `information_schema` / `SHOW` / `DESCRIBE` や SaaS の
|
|
316
|
+
* メタデータ API といった取得経路の差を吸収し、tables / columns / PK / FK を共通型
|
|
317
|
+
* {@link IntrospectedSchema} へ正規化して返す。取得経路は {@link IntrospectContext} で
|
|
318
|
+
* 抽象化され、SQL DB は `ctx.query`、SaaS は `ctx.proxyFetch` + `ctx.params` を使う。
|
|
319
|
+
* `ctx.profile === true` のときは L2 プロファイル(行数・NULL 率等)も best-effort で埋める。
|
|
320
|
+
* coding-agent の `DataContextIndex` がデータ地図を構築する際に使う。
|
|
321
|
+
*/
|
|
322
|
+
introspect;
|
|
309
323
|
/**
|
|
310
324
|
* Opt-out of the default "verify before save" behavior on connection
|
|
311
325
|
* creation. The backend invokes `checkConnection` synchronously while
|
|
@@ -320,6 +334,14 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
320
334
|
* the default verify-on-create behavior without opt-in.
|
|
321
335
|
*/
|
|
322
336
|
skipConnectionCheckOnCreate;
|
|
337
|
+
/**
|
|
338
|
+
* 決定論的な「立ち上げ survey」レシピ(ルールベース prewarm 基盤)。実装した connector は、LLM を使わずに
|
|
339
|
+
* read-only で自分を survey する probe 列(テーブル/列メタデータ → 小サンプル)を宣言する。coding-agent の
|
|
340
|
+
* recon driver がこれを読み、connector ツールの `execute` を直接呼んで結果を seed にする。未実装の connector は
|
|
341
|
+
* driver 側で safely skip される(その connection は listConnections のみ seed)。標準 `information_schema` を
|
|
342
|
+
* 持つ SQL connector は `makeStandardSqlSurveyProbes` を使える。**probe は必ず read-only**。
|
|
343
|
+
*/
|
|
344
|
+
surveyProbes;
|
|
323
345
|
constructor(config) {
|
|
324
346
|
this.slug = config.slug;
|
|
325
347
|
this.authType = config.authType;
|
|
@@ -337,7 +359,9 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
337
359
|
this.query = config.query;
|
|
338
360
|
this.checkConnection = config.checkConnection;
|
|
339
361
|
this.setup = config.setup;
|
|
362
|
+
this.introspect = config.introspect;
|
|
340
363
|
this.skipConnectionCheckOnCreate = config.skipConnectionCheckOnCreate;
|
|
364
|
+
this.surveyProbes = config.surveyProbes;
|
|
341
365
|
}
|
|
342
366
|
get connectorKey() {
|
|
343
367
|
return _ConnectorPlugin.deriveKey(this.slug, this.authType);
|
|
@@ -345,7 +369,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
345
369
|
/**
|
|
346
370
|
* Create tools for connections that belong to this connector.
|
|
347
371
|
* Filters connections by connectorKey internally.
|
|
348
|
-
* Returns tools keyed as
|
|
372
|
+
* Returns tools keyed as `connector_${connectorKey}_${toolName}`.
|
|
349
373
|
*/
|
|
350
374
|
createTools(connections, config, opts) {
|
|
351
375
|
const myConnections = connections.filter(
|
|
@@ -355,7 +379,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
355
379
|
for (const t of Object.values(this.tools)) {
|
|
356
380
|
const tool = t.createTool(myConnections, config);
|
|
357
381
|
const originalToModelOutput = tool.toModelOutput;
|
|
358
|
-
result[
|
|
382
|
+
result[`connector_${this.connectorKey}_${t.name}`] = {
|
|
359
383
|
...tool,
|
|
360
384
|
toModelOutput: async (options) => {
|
|
361
385
|
if (!originalToModelOutput) {
|
|
@@ -375,25 +399,25 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
375
399
|
if (authType) return `${slug}-${authType}`;
|
|
376
400
|
const LEGACY_NULL_AUTH_TYPE_MAP = {
|
|
377
401
|
// user-password
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
402
|
+
postgresql: "user-password",
|
|
403
|
+
mysql: "user-password",
|
|
404
|
+
clickhouse: "user-password",
|
|
405
|
+
kintone: "user-password",
|
|
382
406
|
"squadbase-db": "user-password",
|
|
383
407
|
// service-account
|
|
384
|
-
|
|
385
|
-
|
|
408
|
+
snowflake: "service-account",
|
|
409
|
+
bigquery: "service-account",
|
|
386
410
|
"google-analytics": "service-account",
|
|
387
411
|
"google-calendar": "service-account",
|
|
388
412
|
"aws-athena": "service-account",
|
|
389
|
-
|
|
413
|
+
redshift: "service-account",
|
|
390
414
|
// api-key
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
415
|
+
databricks: "api-key",
|
|
416
|
+
dbt: "api-key",
|
|
417
|
+
airtable: "api-key",
|
|
418
|
+
openai: "api-key",
|
|
419
|
+
gemini: "api-key",
|
|
420
|
+
anthropic: "api-key",
|
|
397
421
|
"wix-store": "api-key"
|
|
398
422
|
};
|
|
399
423
|
const fallbackAuthType = LEGACY_NULL_AUTH_TYPE_MAP[slug];
|
|
@@ -495,13 +519,13 @@ function normalizeRequestPath(path2, basePathSegment) {
|
|
|
495
519
|
// ../connectors/src/connectors/freshdesk/setup.ts
|
|
496
520
|
var freshdeskOnboarding = new ConnectorOnboarding({
|
|
497
521
|
dataOverviewInstructions: {
|
|
498
|
-
en: `1. Call
|
|
499
|
-
2. Call
|
|
522
|
+
en: `1. Call connector_freshdesk_request with GET /agents/me to confirm credentials.
|
|
523
|
+
2. Call connector_freshdesk_request with GET /tickets?per_page=10&order_by=created_at&order_type=desc to sample recent tickets. Each ticket carries \`status\`, \`priority\`, \`source\`, \`requester_id\`, \`responder_id\`, and \`created_at\`.
|
|
500
524
|
3. Call GET /contacts?per_page=10 to sample contacts (end users) and GET /companies?per_page=10 for companies.
|
|
501
525
|
4. To enumerate agents and groups, call GET /agents and GET /groups.
|
|
502
526
|
5. Pagination is page-based with \`page\` (1-indexed) and \`per_page\` (max 100). The \`Link\` response header carries the next-page URL when more results exist.`,
|
|
503
|
-
ja: `1.
|
|
504
|
-
2.
|
|
527
|
+
ja: `1. connector_freshdesk_request \u3067 GET /agents/me \u3092\u547C\u3073\u51FA\u3057\u3001\u8A8D\u8A3C\u60C5\u5831\u3092\u78BA\u8A8D\u3057\u307E\u3059\u3002
|
|
528
|
+
2. connector_freshdesk_request \u3067 GET /tickets?per_page=10&order_by=created_at&order_type=desc \u3092\u547C\u3073\u51FA\u3057\u3066\u6700\u8FD1\u306E\u30C1\u30B1\u30C3\u30C8\u3092\u30B5\u30F3\u30D7\u30EA\u30F3\u30B0\u3057\u307E\u3059\u3002\u5404\u30C1\u30B1\u30C3\u30C8\u306B\u306F \`status\`, \`priority\`, \`source\`, \`requester_id\`, \`responder_id\`, \`created_at\` \u306A\u3069\u304C\u542B\u307E\u308C\u307E\u3059\u3002
|
|
505
529
|
3. GET /contacts?per_page=10 \u3067\u9023\u7D61\u5148\uFF08\u30A8\u30F3\u30C9\u30E6\u30FC\u30B6\u30FC\uFF09\u3001GET /companies?per_page=10 \u3067\u4F1A\u793E\u60C5\u5831\u3092\u30B5\u30F3\u30D7\u30EA\u30F3\u30B0\u3057\u307E\u3059\u3002
|
|
506
530
|
4. \u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u3084\u30B0\u30EB\u30FC\u30D7\u306F GET /agents\u3001GET /groups \u3067\u53D6\u5F97\u3057\u307E\u3059\u3002
|
|
507
531
|
5. \u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\u306F1\u59CB\u307E\u308A\u306E \`page\` \u3068 \`per_page\`\uFF08\u6700\u5927100\uFF09\u3002\u6B21\u30DA\u30FC\u30B8\u304C\u5B58\u5728\u3059\u308B\u5834\u5408\u306F \`Link\` \u30EC\u30B9\u30DD\u30F3\u30B9\u30D8\u30C3\u30C0\u306B\u6B21URL\u304C\u542B\u307E\u308C\u307E\u3059\u3002`
|
|
@@ -628,6 +652,80 @@ var freshdeskSetupFlow = {
|
|
|
628
652
|
);
|
|
629
653
|
}
|
|
630
654
|
sections.push("");
|
|
655
|
+
if (targetEntities.includes("tickets")) {
|
|
656
|
+
try {
|
|
657
|
+
const ticketRes = await apiFetch(
|
|
658
|
+
rt.params,
|
|
659
|
+
"/tickets?per_page=30&order_by=created_at&order_type=desc"
|
|
660
|
+
);
|
|
661
|
+
if (ticketRes.ok) {
|
|
662
|
+
const tickets = await ticketRes.json();
|
|
663
|
+
if (Array.isArray(tickets) && tickets.length > 0) {
|
|
664
|
+
const STATUS_MAP = {
|
|
665
|
+
2: "Open",
|
|
666
|
+
3: "Pending",
|
|
667
|
+
4: "Resolved",
|
|
668
|
+
5: "Closed"
|
|
669
|
+
};
|
|
670
|
+
const PRIORITY_MAP = {
|
|
671
|
+
1: "Low",
|
|
672
|
+
2: "Medium",
|
|
673
|
+
3: "High",
|
|
674
|
+
4: "Urgent"
|
|
675
|
+
};
|
|
676
|
+
const statusCounts = {};
|
|
677
|
+
for (const t of tickets) {
|
|
678
|
+
const s = t.status != null && STATUS_MAP[t.status] || String(t.status ?? "unknown");
|
|
679
|
+
statusCounts[s] = (statusCounts[s] ?? 0) + 1;
|
|
680
|
+
}
|
|
681
|
+
sections.push(
|
|
682
|
+
"### Ticket status breakdown (from recent tickets)",
|
|
683
|
+
""
|
|
684
|
+
);
|
|
685
|
+
sections.push("| Status | Count |");
|
|
686
|
+
sections.push("|--------|-------|");
|
|
687
|
+
for (const [status, cnt] of Object.entries(statusCounts).sort(
|
|
688
|
+
(a, b) => b[1] - a[1]
|
|
689
|
+
)) {
|
|
690
|
+
sections.push(`| ${status} | ${cnt} |`);
|
|
691
|
+
}
|
|
692
|
+
sections.push("");
|
|
693
|
+
const priorityCounts = {};
|
|
694
|
+
for (const t of tickets) {
|
|
695
|
+
const p = t.priority != null && PRIORITY_MAP[t.priority] || String(t.priority ?? "unknown");
|
|
696
|
+
priorityCounts[p] = (priorityCounts[p] ?? 0) + 1;
|
|
697
|
+
}
|
|
698
|
+
sections.push(
|
|
699
|
+
"### Ticket priority breakdown (from recent tickets)",
|
|
700
|
+
""
|
|
701
|
+
);
|
|
702
|
+
sections.push("| Priority | Count |");
|
|
703
|
+
sections.push("|----------|-------|");
|
|
704
|
+
for (const [priority, cnt] of Object.entries(priorityCounts).sort(
|
|
705
|
+
(a, b) => b[1] - a[1]
|
|
706
|
+
)) {
|
|
707
|
+
sections.push(`| ${priority} | ${cnt} |`);
|
|
708
|
+
}
|
|
709
|
+
sections.push("");
|
|
710
|
+
sections.push("### Recent tickets (sample)", "");
|
|
711
|
+
sections.push("| ID | Subject | Status | Priority | Created |");
|
|
712
|
+
sections.push("|----|---------|--------|----------|---------|");
|
|
713
|
+
for (const t of tickets.slice(0, 5)) {
|
|
714
|
+
const id = t.id != null ? String(t.id) : "-";
|
|
715
|
+
const subject = (t.subject ?? "-").replace(/\|/g, "\\|").slice(0, 60);
|
|
716
|
+
const status = t.status != null && STATUS_MAP[t.status] || String(t.status ?? "-");
|
|
717
|
+
const priority = t.priority != null && PRIORITY_MAP[t.priority] || String(t.priority ?? "-");
|
|
718
|
+
const created = t.created_at ? t.created_at.slice(0, 10) : "-";
|
|
719
|
+
sections.push(
|
|
720
|
+
`| ${id} | ${subject} | ${status} | ${priority} | ${created} |`
|
|
721
|
+
);
|
|
722
|
+
}
|
|
723
|
+
sections.push("");
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
} catch {
|
|
727
|
+
}
|
|
728
|
+
}
|
|
631
729
|
return sections.join("\n");
|
|
632
730
|
}
|
|
633
731
|
};
|
|
@@ -769,7 +867,7 @@ var freshdeskConnector = new ConnectorPlugin({
|
|
|
769
867
|
systemPrompt: {
|
|
770
868
|
en: `### Tools
|
|
771
869
|
|
|
772
|
-
- \`
|
|
870
|
+
- \`connector_freshdesk_request\`: The only way to call the Freshdesk REST API v2. Use it to list tickets, contacts, companies, agents, groups, and more. Authentication (HTTP Basic Auth using the API key as username) and the base URL (https://<domain>.freshdesk.com/api/v2) are configured automatically.
|
|
773
871
|
|
|
774
872
|
### Business Logic
|
|
775
873
|
|
|
@@ -846,7 +944,7 @@ export default async function handler(c: Context) {
|
|
|
846
944
|
- \`source\`: 1=Email, 2=Portal, 3=Phone, 7=Chat, 9=Feedback widget, 10=Outbound email`,
|
|
847
945
|
ja: `### \u30C4\u30FC\u30EB
|
|
848
946
|
|
|
849
|
-
- \`
|
|
947
|
+
- \`connector_freshdesk_request\`: Freshdesk REST API v2 \u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u30C1\u30B1\u30C3\u30C8\u3001\u9023\u7D61\u5148\u3001\u4F1A\u793E\u3001\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u3001\u30B0\u30EB\u30FC\u30D7\u306A\u3069\u306E\u53D6\u5F97\u30FB\u66F4\u65B0\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u8A8D\u8A3C\uFF08API \u30AD\u30FC\u3092\u30E6\u30FC\u30B6\u30FC\u540D\u3068\u3057\u305F HTTP Basic Auth\uFF09\u3068\u30D9\u30FC\u30B9URL\uFF08https://<\u30C9\u30E1\u30A4\u30F3>.freshdesk.com/api/v2\uFF09\u306F\u81EA\u52D5\u3067\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002
|
|
850
948
|
|
|
851
949
|
### Business Logic
|
|
852
950
|
|
|
@@ -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
|
|
@@ -321,6 +326,15 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
321
326
|
* `runSetupFlow` from `setup-flow.ts`.
|
|
322
327
|
*/
|
|
323
328
|
setup;
|
|
329
|
+
/**
|
|
330
|
+
* 統一 introspection。SQL DB の `information_schema` / `SHOW` / `DESCRIBE` や SaaS の
|
|
331
|
+
* メタデータ API といった取得経路の差を吸収し、tables / columns / PK / FK を共通型
|
|
332
|
+
* {@link IntrospectedSchema} へ正規化して返す。取得経路は {@link IntrospectContext} で
|
|
333
|
+
* 抽象化され、SQL DB は `ctx.query`、SaaS は `ctx.proxyFetch` + `ctx.params` を使う。
|
|
334
|
+
* `ctx.profile === true` のときは L2 プロファイル(行数・NULL 率等)も best-effort で埋める。
|
|
335
|
+
* coding-agent の `DataContextIndex` がデータ地図を構築する際に使う。
|
|
336
|
+
*/
|
|
337
|
+
introspect;
|
|
324
338
|
/**
|
|
325
339
|
* Opt-out of the default "verify before save" behavior on connection
|
|
326
340
|
* creation. The backend invokes `checkConnection` synchronously while
|
|
@@ -335,6 +349,14 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
335
349
|
* the default verify-on-create behavior without opt-in.
|
|
336
350
|
*/
|
|
337
351
|
skipConnectionCheckOnCreate;
|
|
352
|
+
/**
|
|
353
|
+
* 決定論的な「立ち上げ survey」レシピ(ルールベース prewarm 基盤)。実装した connector は、LLM を使わずに
|
|
354
|
+
* read-only で自分を survey する probe 列(テーブル/列メタデータ → 小サンプル)を宣言する。coding-agent の
|
|
355
|
+
* recon driver がこれを読み、connector ツールの `execute` を直接呼んで結果を seed にする。未実装の connector は
|
|
356
|
+
* driver 側で safely skip される(その connection は listConnections のみ seed)。標準 `information_schema` を
|
|
357
|
+
* 持つ SQL connector は `makeStandardSqlSurveyProbes` を使える。**probe は必ず read-only**。
|
|
358
|
+
*/
|
|
359
|
+
surveyProbes;
|
|
338
360
|
constructor(config) {
|
|
339
361
|
this.slug = config.slug;
|
|
340
362
|
this.authType = config.authType;
|
|
@@ -352,7 +374,9 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
352
374
|
this.query = config.query;
|
|
353
375
|
this.checkConnection = config.checkConnection;
|
|
354
376
|
this.setup = config.setup;
|
|
377
|
+
this.introspect = config.introspect;
|
|
355
378
|
this.skipConnectionCheckOnCreate = config.skipConnectionCheckOnCreate;
|
|
379
|
+
this.surveyProbes = config.surveyProbes;
|
|
356
380
|
}
|
|
357
381
|
get connectorKey() {
|
|
358
382
|
return _ConnectorPlugin.deriveKey(this.slug, this.authType);
|
|
@@ -360,7 +384,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
360
384
|
/**
|
|
361
385
|
* Create tools for connections that belong to this connector.
|
|
362
386
|
* Filters connections by connectorKey internally.
|
|
363
|
-
* Returns tools keyed as
|
|
387
|
+
* Returns tools keyed as `connector_${connectorKey}_${toolName}`.
|
|
364
388
|
*/
|
|
365
389
|
createTools(connections, config, opts) {
|
|
366
390
|
const myConnections = connections.filter(
|
|
@@ -370,7 +394,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
370
394
|
for (const t of Object.values(this.tools)) {
|
|
371
395
|
const tool = t.createTool(myConnections, config);
|
|
372
396
|
const originalToModelOutput = tool.toModelOutput;
|
|
373
|
-
result[
|
|
397
|
+
result[`connector_${this.connectorKey}_${t.name}`] = {
|
|
374
398
|
...tool,
|
|
375
399
|
toModelOutput: async (options) => {
|
|
376
400
|
if (!originalToModelOutput) {
|
|
@@ -390,25 +414,25 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
390
414
|
if (authType) return `${slug}-${authType}`;
|
|
391
415
|
const LEGACY_NULL_AUTH_TYPE_MAP = {
|
|
392
416
|
// user-password
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
417
|
+
postgresql: "user-password",
|
|
418
|
+
mysql: "user-password",
|
|
419
|
+
clickhouse: "user-password",
|
|
420
|
+
kintone: "user-password",
|
|
397
421
|
"squadbase-db": "user-password",
|
|
398
422
|
// service-account
|
|
399
|
-
|
|
400
|
-
|
|
423
|
+
snowflake: "service-account",
|
|
424
|
+
bigquery: "service-account",
|
|
401
425
|
"google-analytics": "service-account",
|
|
402
426
|
"google-calendar": "service-account",
|
|
403
427
|
"aws-athena": "service-account",
|
|
404
|
-
|
|
428
|
+
redshift: "service-account",
|
|
405
429
|
// api-key
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
430
|
+
databricks: "api-key",
|
|
431
|
+
dbt: "api-key",
|
|
432
|
+
airtable: "api-key",
|
|
433
|
+
openai: "api-key",
|
|
434
|
+
gemini: "api-key",
|
|
435
|
+
anthropic: "api-key",
|
|
412
436
|
"wix-store": "api-key"
|
|
413
437
|
};
|
|
414
438
|
const fallbackAuthType = LEGACY_NULL_AUTH_TYPE_MAP[slug];
|
|
@@ -510,13 +534,13 @@ function normalizeRequestPath(path2, basePathSegment) {
|
|
|
510
534
|
// ../connectors/src/connectors/freshsales/setup.ts
|
|
511
535
|
var freshsalesOnboarding = new ConnectorOnboarding({
|
|
512
536
|
dataOverviewInstructions: {
|
|
513
|
-
en: `1. Call
|
|
514
|
-
2. Call
|
|
537
|
+
en: `1. Call connector_freshsales_request with GET /selector/owners to confirm credentials and discover sales team members.
|
|
538
|
+
2. Call connector_freshsales_request with GET /contacts/filters to list available contact views (filters), then GET /contacts/view/{view_id} to fetch contacts in a view (paginated with \`page\` and \`per_page\`, default 25, max 100).
|
|
515
539
|
3. Repeat the same pattern for accounts (GET /sales_accounts/filters \u2192 /sales_accounts/view/{view_id}) and deals (GET /deals/filters \u2192 /deals/view/{view_id}).
|
|
516
540
|
4. To inspect deal pipeline metadata, call GET /selector/deal_pipelines and GET /selector/deal_stages.
|
|
517
541
|
5. Use GET /lookup to find specific records by attribute (e.g., look up a contact by email).`,
|
|
518
|
-
ja: `1.
|
|
519
|
-
2.
|
|
542
|
+
ja: `1. connector_freshsales_request \u3067 GET /selector/owners \u3092\u547C\u3073\u51FA\u3057\u3001\u8A8D\u8A3C\u60C5\u5831\u306E\u78BA\u8A8D\u3068\u55B6\u696D\u30E1\u30F3\u30D0\u30FC\u306E\u4E00\u89A7\u3092\u53D6\u5F97\u3057\u307E\u3059\u3002
|
|
543
|
+
2. connector_freshsales_request \u3067 GET /contacts/filters \u3092\u547C\u3073\u51FA\u3057\u3066\u30D3\u30E5\u30FC\uFF08filters\uFF09\u4E00\u89A7\u3092\u53D6\u5F97\u3057\u3001GET /contacts/view/{view_id} \u3067\u5404\u30D3\u30E5\u30FC\u306E\u9023\u7D61\u5148\u3092\u53D6\u5F97\u3057\u307E\u3059\uFF08\`page\` \u3068 \`per_page\` \u3067\u30DA\u30FC\u30B8\u30F3\u30B0\u3001\u30C7\u30D5\u30A9\u30EB\u30C825\u3001\u6700\u5927100\uFF09\u3002
|
|
520
544
|
3. \u540C\u3058\u30D1\u30BF\u30FC\u30F3\u3092\u53D6\u5F15\u5148\uFF08GET /sales_accounts/filters \u2192 /sales_accounts/view/{view_id}\uFF09\u3001\u5546\u8AC7\uFF08GET /deals/filters \u2192 /deals/view/{view_id}\uFF09\u306B\u3082\u9069\u7528\u3057\u307E\u3059\u3002
|
|
521
545
|
4. \u5546\u8AC7\u30D1\u30A4\u30D7\u30E9\u30A4\u30F3\u306E\u30E1\u30BF\u60C5\u5831\u306F GET /selector/deal_pipelines \u304A\u3088\u3073 GET /selector/deal_stages \u3067\u53D6\u5F97\u3057\u307E\u3059\u3002
|
|
522
546
|
5. \u7279\u5B9A\u30EC\u30B3\u30FC\u30C9\u3092\u5C5E\u6027\u3067\u691C\u7D22\u3059\u308B\u306B\u306F GET /lookup \u3092\u4F7F\u7528\u3057\u307E\u3059\uFF08\u4F8B: \u30E1\u30FC\u30EB\u3067\u9023\u7D61\u5148\u3092\u691C\u7D22\uFF09\u3002`
|
|
@@ -777,7 +801,7 @@ var freshsalesConnector = new ConnectorPlugin({
|
|
|
777
801
|
systemPrompt: {
|
|
778
802
|
en: `### Tools
|
|
779
803
|
|
|
780
|
-
- \`
|
|
804
|
+
- \`connector_freshsales_request\`: The only way to call the Freshsales / Freshworks CRM REST API. Use it to list and update contacts, accounts, deals, leads, sales activities, and selector metadata. Authentication (\`Authorization: Token token=<API_KEY>\` header \u2014 note: NOT HTTP Basic Auth) and the base URL (https://<bundle>.myfreshworks.com/crm/sales/api) are configured automatically.
|
|
781
805
|
|
|
782
806
|
### Business Logic
|
|
783
807
|
|
|
@@ -860,7 +884,7 @@ export default async function handler(c: Context) {
|
|
|
860
884
|
- GET \`/selector/territories\` / \`/selector/business_types\` / \`/selector/industry_types\` / \`/selector/contact_statuses\` / \`/selector/sales_activity_types\``,
|
|
861
885
|
ja: `### \u30C4\u30FC\u30EB
|
|
862
886
|
|
|
863
|
-
- \`
|
|
887
|
+
- \`connector_freshsales_request\`: Freshsales / Freshworks CRM REST API \u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u9023\u7D61\u5148\u3001\u53D6\u5F15\u5148\u3001\u5546\u8AC7\u3001\u30EA\u30FC\u30C9\u3001\u55B6\u696D\u6D3B\u52D5\u3001\u5404\u7A2E\u30BB\u30EC\u30AF\u30BF\u30FC\u30E1\u30BF\u60C5\u5831\u306E\u53D6\u5F97\u30FB\u66F4\u65B0\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u8A8D\u8A3C\uFF08\`Authorization: Token token=<API_KEY>\` \u30D8\u30C3\u30C0\u30FC \u2014 Freshdesk/Freshservice \u3068\u7570\u306A\u308A HTTP Basic Auth \u3067\u306F\u3042\u308A\u307E\u305B\u3093\uFF09\u3068\u30D9\u30FC\u30B9URL\uFF08https://<bundle>.myfreshworks.com/crm/sales/api\uFF09\u306F\u81EA\u52D5\u3067\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002
|
|
864
888
|
|
|
865
889
|
### Business Logic
|
|
866
890
|
|
|
@@ -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
|
|
@@ -276,6 +281,15 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
276
281
|
* `runSetupFlow` from `setup-flow.ts`.
|
|
277
282
|
*/
|
|
278
283
|
setup;
|
|
284
|
+
/**
|
|
285
|
+
* 統一 introspection。SQL DB の `information_schema` / `SHOW` / `DESCRIBE` や SaaS の
|
|
286
|
+
* メタデータ API といった取得経路の差を吸収し、tables / columns / PK / FK を共通型
|
|
287
|
+
* {@link IntrospectedSchema} へ正規化して返す。取得経路は {@link IntrospectContext} で
|
|
288
|
+
* 抽象化され、SQL DB は `ctx.query`、SaaS は `ctx.proxyFetch` + `ctx.params` を使う。
|
|
289
|
+
* `ctx.profile === true` のときは L2 プロファイル(行数・NULL 率等)も best-effort で埋める。
|
|
290
|
+
* coding-agent の `DataContextIndex` がデータ地図を構築する際に使う。
|
|
291
|
+
*/
|
|
292
|
+
introspect;
|
|
279
293
|
/**
|
|
280
294
|
* Opt-out of the default "verify before save" behavior on connection
|
|
281
295
|
* creation. The backend invokes `checkConnection` synchronously while
|
|
@@ -290,6 +304,14 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
290
304
|
* the default verify-on-create behavior without opt-in.
|
|
291
305
|
*/
|
|
292
306
|
skipConnectionCheckOnCreate;
|
|
307
|
+
/**
|
|
308
|
+
* 決定論的な「立ち上げ survey」レシピ(ルールベース prewarm 基盤)。実装した connector は、LLM を使わずに
|
|
309
|
+
* read-only で自分を survey する probe 列(テーブル/列メタデータ → 小サンプル)を宣言する。coding-agent の
|
|
310
|
+
* recon driver がこれを読み、connector ツールの `execute` を直接呼んで結果を seed にする。未実装の connector は
|
|
311
|
+
* driver 側で safely skip される(その connection は listConnections のみ seed)。標準 `information_schema` を
|
|
312
|
+
* 持つ SQL connector は `makeStandardSqlSurveyProbes` を使える。**probe は必ず read-only**。
|
|
313
|
+
*/
|
|
314
|
+
surveyProbes;
|
|
293
315
|
constructor(config) {
|
|
294
316
|
this.slug = config.slug;
|
|
295
317
|
this.authType = config.authType;
|
|
@@ -307,7 +329,9 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
307
329
|
this.query = config.query;
|
|
308
330
|
this.checkConnection = config.checkConnection;
|
|
309
331
|
this.setup = config.setup;
|
|
332
|
+
this.introspect = config.introspect;
|
|
310
333
|
this.skipConnectionCheckOnCreate = config.skipConnectionCheckOnCreate;
|
|
334
|
+
this.surveyProbes = config.surveyProbes;
|
|
311
335
|
}
|
|
312
336
|
get connectorKey() {
|
|
313
337
|
return _ConnectorPlugin.deriveKey(this.slug, this.authType);
|
|
@@ -315,7 +339,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
315
339
|
/**
|
|
316
340
|
* Create tools for connections that belong to this connector.
|
|
317
341
|
* Filters connections by connectorKey internally.
|
|
318
|
-
* Returns tools keyed as
|
|
342
|
+
* Returns tools keyed as `connector_${connectorKey}_${toolName}`.
|
|
319
343
|
*/
|
|
320
344
|
createTools(connections, config, opts) {
|
|
321
345
|
const myConnections = connections.filter(
|
|
@@ -325,7 +349,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
325
349
|
for (const t of Object.values(this.tools)) {
|
|
326
350
|
const tool = t.createTool(myConnections, config);
|
|
327
351
|
const originalToModelOutput = tool.toModelOutput;
|
|
328
|
-
result[
|
|
352
|
+
result[`connector_${this.connectorKey}_${t.name}`] = {
|
|
329
353
|
...tool,
|
|
330
354
|
toModelOutput: async (options) => {
|
|
331
355
|
if (!originalToModelOutput) {
|
|
@@ -345,25 +369,25 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
345
369
|
if (authType) return `${slug}-${authType}`;
|
|
346
370
|
const LEGACY_NULL_AUTH_TYPE_MAP = {
|
|
347
371
|
// user-password
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
372
|
+
postgresql: "user-password",
|
|
373
|
+
mysql: "user-password",
|
|
374
|
+
clickhouse: "user-password",
|
|
375
|
+
kintone: "user-password",
|
|
352
376
|
"squadbase-db": "user-password",
|
|
353
377
|
// service-account
|
|
354
|
-
|
|
355
|
-
|
|
378
|
+
snowflake: "service-account",
|
|
379
|
+
bigquery: "service-account",
|
|
356
380
|
"google-analytics": "service-account",
|
|
357
381
|
"google-calendar": "service-account",
|
|
358
382
|
"aws-athena": "service-account",
|
|
359
|
-
|
|
383
|
+
redshift: "service-account",
|
|
360
384
|
// api-key
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
385
|
+
databricks: "api-key",
|
|
386
|
+
dbt: "api-key",
|
|
387
|
+
airtable: "api-key",
|
|
388
|
+
openai: "api-key",
|
|
389
|
+
gemini: "api-key",
|
|
390
|
+
anthropic: "api-key",
|
|
367
391
|
"wix-store": "api-key"
|
|
368
392
|
};
|
|
369
393
|
const fallbackAuthType = LEGACY_NULL_AUTH_TYPE_MAP[slug];
|
|
@@ -465,13 +489,13 @@ function normalizeRequestPath(path2, basePathSegment) {
|
|
|
465
489
|
// ../connectors/src/connectors/freshservice/setup.ts
|
|
466
490
|
var freshserviceOnboarding = new ConnectorOnboarding({
|
|
467
491
|
dataOverviewInstructions: {
|
|
468
|
-
en: `1. Call
|
|
469
|
-
2. Call
|
|
492
|
+
en: `1. Call connector_freshservice_request with GET /agents to confirm credentials and view available agents.
|
|
493
|
+
2. Call connector_freshservice_request with GET /tickets?per_page=10 to sample recent tickets. Each ticket has \`status\`, \`priority\`, \`source\`, \`responder_id\`, \`requester_id\`, and \`created_at\`.
|
|
470
494
|
3. To enumerate organisational structure, call GET /departments and GET /locations.
|
|
471
495
|
4. For asset inventory, call GET /assets?per_page=10 \u2014 note that ITAM endpoints require the asset module to be enabled.
|
|
472
496
|
5. Pagination is page-based with \`page\` (1-indexed) and \`per_page\` (max 100). The \`Link\` response header carries the next-page URL when more results exist.`,
|
|
473
|
-
ja: `1.
|
|
474
|
-
2.
|
|
497
|
+
ja: `1. connector_freshservice_request \u3067 GET /agents \u3092\u547C\u3073\u51FA\u3057\u3001\u8A8D\u8A3C\u60C5\u5831\u306E\u78BA\u8A8D\u3068\u5229\u7528\u53EF\u80FD\u306A\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u4E00\u89A7\u3092\u53D6\u5F97\u3057\u307E\u3059\u3002
|
|
498
|
+
2. connector_freshservice_request \u3067 GET /tickets?per_page=10 \u3092\u547C\u3073\u51FA\u3057\u3066\u6700\u8FD1\u306E\u30C1\u30B1\u30C3\u30C8\u3092\u30B5\u30F3\u30D7\u30EA\u30F3\u30B0\u3057\u307E\u3059\u3002\u5404\u30C1\u30B1\u30C3\u30C8\u306B\u306F \`status\`, \`priority\`, \`source\`, \`responder_id\`, \`requester_id\`, \`created_at\` \u306A\u3069\u304C\u542B\u307E\u308C\u307E\u3059\u3002
|
|
475
499
|
3. \u7D44\u7E54\u69CB\u9020\u3092\u628A\u63E1\u3059\u308B\u306B\u306F GET /departments \u304A\u3088\u3073 GET /locations \u3092\u547C\u3073\u51FA\u3057\u307E\u3059\u3002
|
|
476
500
|
4. \u8CC7\u7523\u30A4\u30F3\u30D9\u30F3\u30C8\u30EA\u306F GET /assets?per_page=10 \u3067\u53D6\u5F97\u3067\u304D\u307E\u3059\uFF08ITAM \u30E2\u30B8\u30E5\u30FC\u30EB\u304C\u6709\u52B9\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\uFF09\u3002
|
|
477
501
|
5. \u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\u306F1\u59CB\u307E\u308A\u306E \`page\` \u3068 \`per_page\`\uFF08\u6700\u5927100\uFF09\u3002\u6B21\u30DA\u30FC\u30B8\u304C\u5B58\u5728\u3059\u308B\u5834\u5408\u306F \`Link\` \u30EC\u30B9\u30DD\u30F3\u30B9\u30D8\u30C3\u30C0\u306B\u6B21URL\u304C\u542B\u307E\u308C\u307E\u3059\u3002`
|
|
@@ -758,7 +782,7 @@ var freshserviceConnector = new ConnectorPlugin({
|
|
|
758
782
|
systemPrompt: {
|
|
759
783
|
en: `### Tools
|
|
760
784
|
|
|
761
|
-
- \`
|
|
785
|
+
- \`connector_freshservice_request\`: The only way to call the Freshservice REST API v2. Use it to list tickets, agents, requesters, departments, locations, assets, problems, changes, releases, and more. Authentication (HTTP Basic Auth using the API key as username) and the base URL (https://<domain>.freshservice.com/api/v2) are configured automatically.
|
|
762
786
|
|
|
763
787
|
### Business Logic
|
|
764
788
|
|
|
@@ -834,7 +858,7 @@ export default async function handler(c: Context) {
|
|
|
834
858
|
- \`source\`: 1=Email, 2=Portal, 3=Phone, 4=Chat, 5=Feedback widget, 7=Yammer, 8=AwsCloudwatch, 9=Pagerduty, 10=Walkup, 11=Slack`,
|
|
835
859
|
ja: `### \u30C4\u30FC\u30EB
|
|
836
860
|
|
|
837
|
-
- \`
|
|
861
|
+
- \`connector_freshservice_request\`: Freshservice REST API v2 \u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u30C1\u30B1\u30C3\u30C8\u3001\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u3001\u8981\u6C42\u8005\u3001\u90E8\u7F72\u3001\u30ED\u30B1\u30FC\u30B7\u30E7\u30F3\u3001\u8CC7\u7523\u3001\u554F\u984C\u7BA1\u7406\u3001\u5909\u66F4\u7BA1\u7406\u3001\u30EA\u30EA\u30FC\u30B9\u306A\u3069\u306E\u53D6\u5F97\u30FB\u66F4\u65B0\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u8A8D\u8A3C\uFF08API \u30AD\u30FC\u3092\u30E6\u30FC\u30B6\u30FC\u540D\u3068\u3057\u305F HTTP Basic Auth\uFF09\u3068\u30D9\u30FC\u30B9URL\uFF08https://<\u30C9\u30E1\u30A4\u30F3>.freshservice.com/api/v2\uFF09\u306F\u81EA\u52D5\u3067\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002
|
|
838
862
|
|
|
839
863
|
### Business Logic
|
|
840
864
|
|