@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
|
@@ -133,6 +133,15 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
133
133
|
* `runSetupFlow` from `setup-flow.ts`.
|
|
134
134
|
*/
|
|
135
135
|
setup;
|
|
136
|
+
/**
|
|
137
|
+
* 統一 introspection。SQL DB の `information_schema` / `SHOW` / `DESCRIBE` や SaaS の
|
|
138
|
+
* メタデータ API といった取得経路の差を吸収し、tables / columns / PK / FK を共通型
|
|
139
|
+
* {@link IntrospectedSchema} へ正規化して返す。取得経路は {@link IntrospectContext} で
|
|
140
|
+
* 抽象化され、SQL DB は `ctx.query`、SaaS は `ctx.proxyFetch` + `ctx.params` を使う。
|
|
141
|
+
* `ctx.profile === true` のときは L2 プロファイル(行数・NULL 率等)も best-effort で埋める。
|
|
142
|
+
* coding-agent の `DataContextIndex` がデータ地図を構築する際に使う。
|
|
143
|
+
*/
|
|
144
|
+
introspect;
|
|
136
145
|
/**
|
|
137
146
|
* Opt-out of the default "verify before save" behavior on connection
|
|
138
147
|
* creation. The backend invokes `checkConnection` synchronously while
|
|
@@ -147,6 +156,14 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
147
156
|
* the default verify-on-create behavior without opt-in.
|
|
148
157
|
*/
|
|
149
158
|
skipConnectionCheckOnCreate;
|
|
159
|
+
/**
|
|
160
|
+
* 決定論的な「立ち上げ survey」レシピ(ルールベース prewarm 基盤)。実装した connector は、LLM を使わずに
|
|
161
|
+
* read-only で自分を survey する probe 列(テーブル/列メタデータ → 小サンプル)を宣言する。coding-agent の
|
|
162
|
+
* recon driver がこれを読み、connector ツールの `execute` を直接呼んで結果を seed にする。未実装の connector は
|
|
163
|
+
* driver 側で safely skip される(その connection は listConnections のみ seed)。標準 `information_schema` を
|
|
164
|
+
* 持つ SQL connector は `makeStandardSqlSurveyProbes` を使える。**probe は必ず read-only**。
|
|
165
|
+
*/
|
|
166
|
+
surveyProbes;
|
|
150
167
|
constructor(config) {
|
|
151
168
|
this.slug = config.slug;
|
|
152
169
|
this.authType = config.authType;
|
|
@@ -164,7 +181,9 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
164
181
|
this.query = config.query;
|
|
165
182
|
this.checkConnection = config.checkConnection;
|
|
166
183
|
this.setup = config.setup;
|
|
184
|
+
this.introspect = config.introspect;
|
|
167
185
|
this.skipConnectionCheckOnCreate = config.skipConnectionCheckOnCreate;
|
|
186
|
+
this.surveyProbes = config.surveyProbes;
|
|
168
187
|
}
|
|
169
188
|
get connectorKey() {
|
|
170
189
|
return _ConnectorPlugin.deriveKey(this.slug, this.authType);
|
|
@@ -172,7 +191,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
172
191
|
/**
|
|
173
192
|
* Create tools for connections that belong to this connector.
|
|
174
193
|
* Filters connections by connectorKey internally.
|
|
175
|
-
* Returns tools keyed as
|
|
194
|
+
* Returns tools keyed as `connector_${connectorKey}_${toolName}`.
|
|
176
195
|
*/
|
|
177
196
|
createTools(connections, config, opts) {
|
|
178
197
|
const myConnections = connections.filter(
|
|
@@ -182,7 +201,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
182
201
|
for (const t of Object.values(this.tools)) {
|
|
183
202
|
const tool = t.createTool(myConnections, config);
|
|
184
203
|
const originalToModelOutput = tool.toModelOutput;
|
|
185
|
-
result[
|
|
204
|
+
result[`connector_${this.connectorKey}_${t.name}`] = {
|
|
186
205
|
...tool,
|
|
187
206
|
toModelOutput: async (options) => {
|
|
188
207
|
if (!originalToModelOutput) {
|
|
@@ -202,25 +221,25 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
202
221
|
if (authType) return `${slug}-${authType}`;
|
|
203
222
|
const LEGACY_NULL_AUTH_TYPE_MAP = {
|
|
204
223
|
// user-password
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
224
|
+
postgresql: "user-password",
|
|
225
|
+
mysql: "user-password",
|
|
226
|
+
clickhouse: "user-password",
|
|
227
|
+
kintone: "user-password",
|
|
209
228
|
"squadbase-db": "user-password",
|
|
210
229
|
// service-account
|
|
211
|
-
|
|
212
|
-
|
|
230
|
+
snowflake: "service-account",
|
|
231
|
+
bigquery: "service-account",
|
|
213
232
|
"google-analytics": "service-account",
|
|
214
233
|
"google-calendar": "service-account",
|
|
215
234
|
"aws-athena": "service-account",
|
|
216
|
-
|
|
235
|
+
redshift: "service-account",
|
|
217
236
|
// api-key
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
237
|
+
databricks: "api-key",
|
|
238
|
+
dbt: "api-key",
|
|
239
|
+
airtable: "api-key",
|
|
240
|
+
openai: "api-key",
|
|
241
|
+
gemini: "api-key",
|
|
242
|
+
anthropic: "api-key",
|
|
224
243
|
"wix-store": "api-key"
|
|
225
244
|
};
|
|
226
245
|
const fallbackAuthType = LEGACY_NULL_AUTH_TYPE_MAP[slug];
|
|
@@ -322,10 +341,10 @@ function normalizeRequestPath(path2, basePathSegment) {
|
|
|
322
341
|
// ../connectors/src/connectors/google-slides/setup.ts
|
|
323
342
|
var googleSlidesOnboarding = new ConnectorOnboarding({
|
|
324
343
|
dataOverviewInstructions: {
|
|
325
|
-
en: `1. Create a new presentation with
|
|
326
|
-
2. Call
|
|
327
|
-
ja: `1.
|
|
328
|
-
2.
|
|
344
|
+
en: `1. Create a new presentation with connector_google-slides-oauth_request (POST with body { title: "..." }) or use an existing presentation ID.
|
|
345
|
+
2. Call connector_google-slides-oauth_request with GET /{presentationId} to fetch presentation metadata (title, slide count, layout info).`,
|
|
346
|
+
ja: `1. connector_google-slides-oauth_request \u3092 POST\uFF08Body: { title: "..." }\uFF09\u3067\u547C\u3073\u51FA\u3057\u3066\u65B0\u3057\u3044\u30D7\u30EC\u30BC\u30F3\u30C6\u30FC\u30B7\u30E7\u30F3\u3092\u4F5C\u6210\u3059\u308B\u304B\u3001\u65E2\u5B58\u306E\u30D7\u30EC\u30BC\u30F3\u30C6\u30FC\u30B7\u30E7\u30F3ID\u3092\u5229\u7528\u3057\u307E\u3059\u3002
|
|
347
|
+
2. connector_google-slides-oauth_request \u3067 GET /{presentationId} \u3092\u547C\u3073\u51FA\u3057\u3001\u30D7\u30EC\u30BC\u30F3\u30C6\u30FC\u30B7\u30E7\u30F3\u306E\u30E1\u30BF\u30C7\u30FC\u30BF\uFF08\u30BF\u30A4\u30C8\u30EB\u3001\u30B9\u30E9\u30A4\u30C9\u6570\u3001\u30EC\u30A4\u30A2\u30A6\u30C8\u60C5\u5831\uFF09\u3092\u53D6\u5F97\u3057\u307E\u3059\u3002`
|
|
329
348
|
}
|
|
330
349
|
});
|
|
331
350
|
|
|
@@ -561,9 +580,9 @@ var googleSlidesConnector = new ConnectorPlugin({
|
|
|
561
580
|
systemPrompt: {
|
|
562
581
|
en: `### Tools (setup-time only)
|
|
563
582
|
|
|
564
|
-
- \`
|
|
583
|
+
- \`connector_google-slides-oauth_request\`: Call the Google Slides API directly during setup / data overview. Supports read and write operations. Use it to get presentation metadata, slide content, create new presentations, and modify slides. Authentication is configured automatically via OAuth.
|
|
565
584
|
|
|
566
|
-
> **Important**: The \`
|
|
585
|
+
> **Important**: The \`connector_google-slides-oauth_request\` tool is only available at setup time. Inside server-logic handlers, use the SDK (\`connection(id).createPresentation\`, 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.
|
|
567
586
|
|
|
568
587
|
### Google Slides API Reference
|
|
569
588
|
|
|
@@ -640,9 +659,9 @@ await slides.batchUpdate(presentationId, [
|
|
|
640
659
|
If a handler test fails with \`Connection proxy is not configured\`, retry \u2014 this usually means the sandbox is still initializing. Do NOT abandon the SDK and construct OAuth proxy URLs manually.`,
|
|
641
660
|
ja: `### \u30C4\u30FC\u30EB\uFF08\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u6642\u306E\u307F\uFF09
|
|
642
661
|
|
|
643
|
-
- \`
|
|
662
|
+
- \`connector_google-slides-oauth_request\`: \u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3084\u30C7\u30FC\u30BF\u6982\u8981\u628A\u63E1\u6642\u306B Google Slides 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\u30D7\u30EC\u30BC\u30F3\u30C6\u30FC\u30B7\u30E7\u30F3\u306E\u30E1\u30BF\u30C7\u30FC\u30BF\u30FB\u30B9\u30E9\u30A4\u30C9\u5185\u5BB9\u306E\u53D6\u5F97\u3001\u65B0\u3057\u3044\u30D7\u30EC\u30BC\u30F3\u30C6\u30FC\u30B7\u30E7\u30F3\u306E\u4F5C\u6210\u3001\u30B9\u30E9\u30A4\u30C9\u306E\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
|
|
644
663
|
|
|
645
|
-
> **\u91CD\u8981**: \`
|
|
664
|
+
> **\u91CD\u8981**: \`connector_google-slides-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).createPresentation\` \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
|
|
646
665
|
|
|
647
666
|
### Google Slides API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
648
667
|
|
|
@@ -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
|
|
@@ -244,6 +249,15 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
244
249
|
* `runSetupFlow` from `setup-flow.ts`.
|
|
245
250
|
*/
|
|
246
251
|
setup;
|
|
252
|
+
/**
|
|
253
|
+
* 統一 introspection。SQL DB の `information_schema` / `SHOW` / `DESCRIBE` や SaaS の
|
|
254
|
+
* メタデータ API といった取得経路の差を吸収し、tables / columns / PK / FK を共通型
|
|
255
|
+
* {@link IntrospectedSchema} へ正規化して返す。取得経路は {@link IntrospectContext} で
|
|
256
|
+
* 抽象化され、SQL DB は `ctx.query`、SaaS は `ctx.proxyFetch` + `ctx.params` を使う。
|
|
257
|
+
* `ctx.profile === true` のときは L2 プロファイル(行数・NULL 率等)も best-effort で埋める。
|
|
258
|
+
* coding-agent の `DataContextIndex` がデータ地図を構築する際に使う。
|
|
259
|
+
*/
|
|
260
|
+
introspect;
|
|
247
261
|
/**
|
|
248
262
|
* Opt-out of the default "verify before save" behavior on connection
|
|
249
263
|
* creation. The backend invokes `checkConnection` synchronously while
|
|
@@ -258,6 +272,14 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
258
272
|
* the default verify-on-create behavior without opt-in.
|
|
259
273
|
*/
|
|
260
274
|
skipConnectionCheckOnCreate;
|
|
275
|
+
/**
|
|
276
|
+
* 決定論的な「立ち上げ survey」レシピ(ルールベース prewarm 基盤)。実装した connector は、LLM を使わずに
|
|
277
|
+
* read-only で自分を survey する probe 列(テーブル/列メタデータ → 小サンプル)を宣言する。coding-agent の
|
|
278
|
+
* recon driver がこれを読み、connector ツールの `execute` を直接呼んで結果を seed にする。未実装の connector は
|
|
279
|
+
* driver 側で safely skip される(その connection は listConnections のみ seed)。標準 `information_schema` を
|
|
280
|
+
* 持つ SQL connector は `makeStandardSqlSurveyProbes` を使える。**probe は必ず read-only**。
|
|
281
|
+
*/
|
|
282
|
+
surveyProbes;
|
|
261
283
|
constructor(config) {
|
|
262
284
|
this.slug = config.slug;
|
|
263
285
|
this.authType = config.authType;
|
|
@@ -275,7 +297,9 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
275
297
|
this.query = config.query;
|
|
276
298
|
this.checkConnection = config.checkConnection;
|
|
277
299
|
this.setup = config.setup;
|
|
300
|
+
this.introspect = config.introspect;
|
|
278
301
|
this.skipConnectionCheckOnCreate = config.skipConnectionCheckOnCreate;
|
|
302
|
+
this.surveyProbes = config.surveyProbes;
|
|
279
303
|
}
|
|
280
304
|
get connectorKey() {
|
|
281
305
|
return _ConnectorPlugin.deriveKey(this.slug, this.authType);
|
|
@@ -283,7 +307,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
283
307
|
/**
|
|
284
308
|
* Create tools for connections that belong to this connector.
|
|
285
309
|
* Filters connections by connectorKey internally.
|
|
286
|
-
* Returns tools keyed as
|
|
310
|
+
* Returns tools keyed as `connector_${connectorKey}_${toolName}`.
|
|
287
311
|
*/
|
|
288
312
|
createTools(connections, config, opts) {
|
|
289
313
|
const myConnections = connections.filter(
|
|
@@ -293,7 +317,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
293
317
|
for (const t of Object.values(this.tools)) {
|
|
294
318
|
const tool = t.createTool(myConnections, config);
|
|
295
319
|
const originalToModelOutput = tool.toModelOutput;
|
|
296
|
-
result[
|
|
320
|
+
result[`connector_${this.connectorKey}_${t.name}`] = {
|
|
297
321
|
...tool,
|
|
298
322
|
toModelOutput: async (options) => {
|
|
299
323
|
if (!originalToModelOutput) {
|
|
@@ -313,25 +337,25 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
313
337
|
if (authType) return `${slug}-${authType}`;
|
|
314
338
|
const LEGACY_NULL_AUTH_TYPE_MAP = {
|
|
315
339
|
// user-password
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
340
|
+
postgresql: "user-password",
|
|
341
|
+
mysql: "user-password",
|
|
342
|
+
clickhouse: "user-password",
|
|
343
|
+
kintone: "user-password",
|
|
320
344
|
"squadbase-db": "user-password",
|
|
321
345
|
// service-account
|
|
322
|
-
|
|
323
|
-
|
|
346
|
+
snowflake: "service-account",
|
|
347
|
+
bigquery: "service-account",
|
|
324
348
|
"google-analytics": "service-account",
|
|
325
349
|
"google-calendar": "service-account",
|
|
326
350
|
"aws-athena": "service-account",
|
|
327
|
-
|
|
351
|
+
redshift: "service-account",
|
|
328
352
|
// api-key
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
353
|
+
databricks: "api-key",
|
|
354
|
+
dbt: "api-key",
|
|
355
|
+
airtable: "api-key",
|
|
356
|
+
openai: "api-key",
|
|
357
|
+
gemini: "api-key",
|
|
358
|
+
anthropic: "api-key",
|
|
335
359
|
"wix-store": "api-key"
|
|
336
360
|
};
|
|
337
361
|
const fallbackAuthType = LEGACY_NULL_AUTH_TYPE_MAP[slug];
|
|
@@ -423,12 +447,12 @@ var AUTH_TYPES = {
|
|
|
423
447
|
// ../connectors/src/connectors/grafana/setup.ts
|
|
424
448
|
var grafanaOnboarding = new ConnectorOnboarding({
|
|
425
449
|
dataOverviewInstructions: {
|
|
426
|
-
en: `1. Call
|
|
427
|
-
2. Call
|
|
428
|
-
3. For a specific datasource, call
|
|
429
|
-
ja: `1.
|
|
430
|
-
2.
|
|
431
|
-
3. \u7279\u5B9A\u306E\u30C7\u30FC\u30BF\u30BD\u30FC\u30B9\u306B\u5BFE\u3057\u3066
|
|
450
|
+
en: `1. Call connector_grafana_request with GET /api/datasources to list all configured datasources
|
|
451
|
+
2. Call connector_grafana_request with GET /api/search?type=dash-db&limit=10 to list dashboards
|
|
452
|
+
3. For a specific datasource, call connector_grafana_request with POST /api/ds/query to run a test query`,
|
|
453
|
+
ja: `1. connector_grafana_request \u3067 GET /api/datasources \u3092\u547C\u3073\u51FA\u3057\u3001\u8A2D\u5B9A\u6E08\u307F\u306E\u30C7\u30FC\u30BF\u30BD\u30FC\u30B9\u4E00\u89A7\u3092\u53D6\u5F97
|
|
454
|
+
2. connector_grafana_request \u3067 GET /api/search?type=dash-db&limit=10 \u3092\u547C\u3073\u51FA\u3057\u3001\u30C0\u30C3\u30B7\u30E5\u30DC\u30FC\u30C9\u4E00\u89A7\u3092\u53D6\u5F97
|
|
455
|
+
3. \u7279\u5B9A\u306E\u30C7\u30FC\u30BF\u30BD\u30FC\u30B9\u306B\u5BFE\u3057\u3066 connector_grafana_request \u3067 POST /api/ds/query \u3092\u547C\u3073\u51FA\u3057\u3001\u30C6\u30B9\u30C8\u30AF\u30A8\u30EA\u3092\u5B9F\u884C`
|
|
432
456
|
}
|
|
433
457
|
});
|
|
434
458
|
|
|
@@ -479,6 +503,26 @@ async function listDatasources(params) {
|
|
|
479
503
|
const data = await res.json();
|
|
480
504
|
return data ?? [];
|
|
481
505
|
}
|
|
506
|
+
async function countDashboards(params) {
|
|
507
|
+
try {
|
|
508
|
+
const res = await apiFetch(params, "/api/search?type=dash-db&limit=5000");
|
|
509
|
+
if (!res.ok) return null;
|
|
510
|
+
const data = await res.json();
|
|
511
|
+
return Array.isArray(data) ? data.length : null;
|
|
512
|
+
} catch {
|
|
513
|
+
return null;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
async function countAlertRules(params) {
|
|
517
|
+
try {
|
|
518
|
+
const res = await apiFetch(params, "/api/alert-rules");
|
|
519
|
+
if (!res.ok) return null;
|
|
520
|
+
const data = await res.json();
|
|
521
|
+
return Array.isArray(data) ? data.length : null;
|
|
522
|
+
} catch {
|
|
523
|
+
return null;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
482
526
|
var grafanaSetupFlow = {
|
|
483
527
|
initialState: () => ({}),
|
|
484
528
|
steps: [
|
|
@@ -551,6 +595,21 @@ var grafanaSetupFlow = {
|
|
|
551
595
|
sections.push(`| Default | ${ds.isDefault ? "yes" : "no"} |`);
|
|
552
596
|
sections.push("");
|
|
553
597
|
}
|
|
598
|
+
const [dashboardCount, alertCount] = await Promise.all([
|
|
599
|
+
countDashboards(rt.params),
|
|
600
|
+
countAlertRules(rt.params)
|
|
601
|
+
]);
|
|
602
|
+
if (dashboardCount != null || alertCount != null) {
|
|
603
|
+
sections.push(
|
|
604
|
+
rt.language === "ja" ? "### \u30B3\u30F3\u30C6\u30F3\u30C4\u6982\u8981" : "### Content overview",
|
|
605
|
+
""
|
|
606
|
+
);
|
|
607
|
+
sections.push("| Resource | Count |");
|
|
608
|
+
sections.push("|----------|-------|");
|
|
609
|
+
sections.push(`| Dashboards | ${dashboardCount ?? "-"} |`);
|
|
610
|
+
sections.push(`| Alert rules | ${alertCount ?? "-"} |`);
|
|
611
|
+
sections.push("");
|
|
612
|
+
}
|
|
554
613
|
return sections.join("\n");
|
|
555
614
|
}
|
|
556
615
|
};
|
|
@@ -652,7 +711,7 @@ var grafanaConnector = new ConnectorPlugin({
|
|
|
652
711
|
systemPrompt: {
|
|
653
712
|
en: `### Tools
|
|
654
713
|
|
|
655
|
-
- \`
|
|
714
|
+
- \`connector_grafana_request\`: The only way to call the Grafana HTTP API. Use it to list datasources, search dashboards, execute datasource queries, manage alerts, and read annotations. Authentication is handled automatically via Bearer token. The path must start with \`/\`.
|
|
656
715
|
|
|
657
716
|
### Business Logic
|
|
658
717
|
|
|
@@ -710,7 +769,7 @@ export default async function handler(c: Context) {
|
|
|
710
769
|
- \`GET /api/health\` \u2014 Health check`,
|
|
711
770
|
ja: `### \u30C4\u30FC\u30EB
|
|
712
771
|
|
|
713
|
-
- \`
|
|
772
|
+
- \`connector_grafana_request\`: Grafana HTTP API\u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u30C7\u30FC\u30BF\u30BD\u30FC\u30B9\u306E\u4E00\u89A7\u53D6\u5F97\u3001\u30C0\u30C3\u30B7\u30E5\u30DC\u30FC\u30C9\u691C\u7D22\u3001\u30C7\u30FC\u30BF\u30BD\u30FC\u30B9\u30AF\u30A8\u30EA\u306E\u5B9F\u884C\u3001\u30A2\u30E9\u30FC\u30C8\u7BA1\u7406\u3001\u30A2\u30CE\u30C6\u30FC\u30B7\u30E7\u30F3\u306E\u8AAD\u307F\u53D6\u308A\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u8A8D\u8A3C\u306FBearer\u30C8\u30FC\u30AF\u30F3\u3067\u81EA\u52D5\u51E6\u7406\u3055\u308C\u307E\u3059\u3002\u30D1\u30B9\u306F \`/\` \u3067\u59CB\u3081\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
|
|
714
773
|
|
|
715
774
|
### Business Logic
|
|
716
775
|
|