@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.
- package/dist/cli/index.js +3266 -730
- package/dist/connectors/airtable-oauth.js +48 -8
- package/dist/connectors/airtable.js +44 -8
- package/dist/connectors/amplitude.js +8 -8
- package/dist/connectors/anthropic.js +2 -2
- package/dist/connectors/asana.js +37 -10
- package/dist/connectors/attio.js +30 -13
- package/dist/connectors/aws-billing.js +8 -8
- package/dist/connectors/azure-sql.js +31 -7
- package/dist/connectors/backlog-api-key.js +40 -15
- package/dist/connectors/clickup.js +50 -10
- package/dist/connectors/cosmosdb.js +12 -12
- package/dist/connectors/customerio.js +8 -8
- package/dist/connectors/dbt.js +686 -25
- package/dist/connectors/freshdesk.js +82 -8
- package/dist/connectors/freshsales.js +8 -8
- package/dist/connectors/freshservice.js +8 -8
- package/dist/connectors/gamma.js +15 -15
- package/dist/connectors/gemini.js +2 -2
- package/dist/connectors/github.js +12 -12
- package/dist/connectors/gmail-oauth.js +10 -10
- package/dist/connectors/gmail.js +4 -4
- package/dist/connectors/google-ads.js +8 -8
- package/dist/connectors/google-analytics-oauth.js +152 -25
- package/dist/connectors/google-analytics.js +475 -95
- package/dist/connectors/google-audit-log.js +4 -4
- package/dist/connectors/google-calendar-oauth.js +61 -15
- package/dist/connectors/google-calendar.js +61 -11
- package/dist/connectors/google-docs.js +10 -10
- package/dist/connectors/google-drive.js +32 -10
- package/dist/connectors/google-search-console-oauth.js +126 -17
- package/dist/connectors/google-sheets.js +6 -6
- package/dist/connectors/google-slides.js +10 -10
- package/dist/connectors/grafana.js +45 -10
- package/dist/connectors/hubspot-oauth.js +41 -9
- package/dist/connectors/hubspot.js +25 -9
- package/dist/connectors/influxdb.js +8 -8
- package/dist/connectors/intercom-oauth.js +72 -12
- package/dist/connectors/intercom.js +12 -12
- package/dist/connectors/jdbc.js +6 -6
- package/dist/connectors/jira-api-key.js +68 -11
- package/dist/connectors/kintone-api-token.js +66 -18
- package/dist/connectors/kintone.js +54 -11
- package/dist/connectors/linear.js +54 -12
- package/dist/connectors/linkedin-ads.js +41 -14
- package/dist/connectors/mailchimp-oauth.js +6 -6
- package/dist/connectors/mailchimp.js +6 -6
- package/dist/connectors/meta-ads-oauth.js +33 -14
- package/dist/connectors/meta-ads.js +35 -14
- package/dist/connectors/mixpanel.js +8 -8
- package/dist/connectors/monday.js +9 -9
- package/dist/connectors/mongodb.js +8 -8
- package/dist/connectors/notion-oauth.js +60 -11
- package/dist/connectors/notion.js +60 -11
- package/dist/connectors/openai.js +2 -2
- package/dist/connectors/oracle.js +23 -7
- package/dist/connectors/outlook-oauth.js +20 -20
- package/dist/connectors/powerbi-oauth.js +12 -12
- package/dist/connectors/salesforce.js +42 -9
- package/dist/connectors/semrush.js +6 -6
- package/dist/connectors/sentry.js +36 -10
- package/dist/connectors/shopify-oauth.js +43 -10
- package/dist/connectors/shopify.js +8 -8
- package/dist/connectors/sqlserver.js +31 -7
- package/dist/connectors/stripe-api-key.js +66 -15
- package/dist/connectors/stripe-oauth.js +70 -19
- package/dist/connectors/supabase.js +22 -5
- package/dist/connectors/tableau.js +14 -14
- package/dist/connectors/tiktok-ads.js +37 -16
- package/dist/connectors/wix-store.js +8 -8
- package/dist/connectors/zendesk-oauth.js +55 -12
- package/dist/connectors/zendesk.js +12 -12
- package/dist/index.js +3284 -728
- package/dist/main.js +3284 -728
- package/dist/vite-plugin.js +3264 -728
- package/package.json +1 -1
|
@@ -364,7 +364,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
364
364
|
/**
|
|
365
365
|
* Create tools for connections that belong to this connector.
|
|
366
366
|
* Filters connections by connectorKey internally.
|
|
367
|
-
* Returns tools keyed as
|
|
367
|
+
* Returns tools keyed as `connector_${connectorKey}_${toolName}`.
|
|
368
368
|
*/
|
|
369
369
|
createTools(connections, config, opts) {
|
|
370
370
|
const myConnections = connections.filter(
|
|
@@ -374,7 +374,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
374
374
|
for (const t of Object.values(this.tools)) {
|
|
375
375
|
const tool = t.createTool(myConnections, config);
|
|
376
376
|
const originalToModelOutput = tool.toModelOutput;
|
|
377
|
-
result[
|
|
377
|
+
result[`connector_${this.connectorKey}_${t.name}`] = {
|
|
378
378
|
...tool,
|
|
379
379
|
toModelOutput: async (options) => {
|
|
380
380
|
if (!originalToModelOutput) {
|
|
@@ -504,13 +504,13 @@ var AUTH_TYPES = {
|
|
|
504
504
|
// ../connectors/src/connectors/monday/setup.ts
|
|
505
505
|
var mondayOnboarding = new ConnectorOnboarding({
|
|
506
506
|
dataOverviewInstructions: {
|
|
507
|
-
en: `1. Call
|
|
508
|
-
2. Call
|
|
509
|
-
3. For a target board, call
|
|
507
|
+
en: `1. Call connector_monday_request with query \`{ me { id name email account { id name } } }\` to verify the token and identify the account
|
|
508
|
+
2. Call connector_monday_request with query \`{ boards(limit: 10) { id name state board_kind workspace { id name } } }\` to list boards
|
|
509
|
+
3. For a target board, call connector_monday_request with query \`{ boards(ids: [BOARD_ID]) { id name columns { id title type settings_str } } }\` to inspect column definitions
|
|
510
510
|
4. Sample items with \`{ boards(ids: [BOARD_ID]) { items_page(limit: 5) { cursor items { id name created_at updated_at column_values { id text value } } } } }\`
|
|
511
511
|
5. Explore other resources (workspaces, users, tags) as needed`,
|
|
512
|
-
ja: `1.
|
|
513
|
-
2.
|
|
512
|
+
ja: `1. connector_monday_request \u3067\u30AF\u30A8\u30EA \`{ me { id name email account { id name } } }\` \u3092\u547C\u3073\u51FA\u3057\u3001\u30C8\u30FC\u30AF\u30F3\u306E\u691C\u8A3C\u3068\u30A2\u30AB\u30A6\u30F3\u30C8\u306E\u78BA\u8A8D
|
|
513
|
+
2. connector_monday_request \u3067\u30AF\u30A8\u30EA \`{ boards(limit: 10) { id name state board_kind workspace { id name } } }\` \u3092\u547C\u3073\u51FA\u3057\u3001\u30DC\u30FC\u30C9\u4E00\u89A7\u3092\u53D6\u5F97
|
|
514
514
|
3. \u5BFE\u8C61\u30DC\u30FC\u30C9\u306B\u5BFE\u3057\u3066 \`{ boards(ids: [BOARD_ID]) { id name columns { id title type settings_str } } }\` \u3092\u547C\u3073\u51FA\u3057\u3001\u30AB\u30E9\u30E0\u5B9A\u7FA9\u3092\u78BA\u8A8D
|
|
515
515
|
4. \`{ boards(ids: [BOARD_ID]) { items_page(limit: 5) { cursor items { id name created_at updated_at column_values { id text value } } } } }\` \u3067\u30A2\u30A4\u30C6\u30E0\u3092\u30B5\u30F3\u30D7\u30EA\u30F3\u30B0
|
|
516
516
|
5. \u5FC5\u8981\u306B\u5FDC\u3058\u3066\u4ED6\u306E\u30EA\u30BD\u30FC\u30B9\uFF08workspaces\u3001users\u3001tags\uFF09\u3092\u63A2\u7D22`
|
|
@@ -773,7 +773,7 @@ var mondayConnector = new ConnectorPlugin({
|
|
|
773
773
|
systemPrompt: {
|
|
774
774
|
en: `### Tools
|
|
775
775
|
|
|
776
|
-
- \`
|
|
776
|
+
- \`connector_monday_request\`: The only way to call the monday.com GraphQL API. Use it to query and mutate all monday.com resources: boards, items, groups, columns, column values, users, workspaces, tags, teams, and updates. Authentication is configured automatically. monday.com's API is GraphQL-only \u2014 send a query string and optional variables. Items on a board are paginated with cursor-based \`items_page(limit, cursor)\`; boards/users/workspaces use page-based \`limit\`/\`page\`. IDs are passed as the GraphQL \`ID\` scalar (string).
|
|
777
777
|
|
|
778
778
|
### Business Logic
|
|
779
779
|
|
|
@@ -863,7 +863,7 @@ const items = res.data?.boards?.[0]?.items_page?.items; // always undefined!
|
|
|
863
863
|
- Some fields (e.g. \`board.tags\`) are only populated for boards that explicitly use them.`,
|
|
864
864
|
ja: `### \u30C4\u30FC\u30EB
|
|
865
865
|
|
|
866
|
-
- \`
|
|
866
|
+
- \`connector_monday_request\`: monday.com GraphQL API\u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u30DC\u30FC\u30C9\u3001\u30A2\u30A4\u30C6\u30E0\u3001\u30B0\u30EB\u30FC\u30D7\u3001\u30AB\u30E9\u30E0\u3001\u30AB\u30E9\u30E0\u5024\u3001\u30E6\u30FC\u30B6\u30FC\u3001\u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u3001\u30BF\u30B0\u3001\u30C1\u30FC\u30E0\u3001\u30A2\u30C3\u30D7\u30C7\u30FC\u30C8\u306A\u3069\u3059\u3079\u3066\u306E\u30EA\u30BD\u30FC\u30B9\u306E\u30AF\u30A8\u30EA\u3068\u30DF\u30E5\u30FC\u30C6\u30FC\u30B7\u30E7\u30F3\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u8A8D\u8A3C\u306F\u81EA\u52D5\u7684\u306B\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002monday.com \u306E API \u306F GraphQL \u306E\u307F\u3067\u3001\u30AF\u30A8\u30EA\u6587\u5B57\u5217\u3068\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u5909\u6570\u3092\u9001\u4FE1\u3057\u307E\u3059\u3002\u30DC\u30FC\u30C9\u4E0A\u306E\u30A2\u30A4\u30C6\u30E0\u306F\u30AB\u30FC\u30BD\u30EB\u30D9\u30FC\u30B9\u306E \`items_page(limit, cursor)\` \u3067\u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\u3055\u308C\u3001\u30DC\u30FC\u30C9\uFF0F\u30E6\u30FC\u30B6\u30FC\uFF0F\u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u306F\u30DA\u30FC\u30B8\u30D9\u30FC\u30B9\u306E \`limit\`/\`page\` \u3092\u4F7F\u7528\u3057\u307E\u3059\u3002ID \u306F GraphQL \u306E \`ID\` \u30B9\u30AB\u30E9\u30FC\uFF08\u6587\u5B57\u5217\uFF09\u3068\u3057\u3066\u6E21\u3057\u3066\u304F\u3060\u3055\u3044\u3002
|
|
867
867
|
|
|
868
868
|
### Business Logic
|
|
869
869
|
|
|
@@ -269,7 +269,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
269
269
|
/**
|
|
270
270
|
* Create tools for connections that belong to this connector.
|
|
271
271
|
* Filters connections by connectorKey internally.
|
|
272
|
-
* Returns tools keyed as
|
|
272
|
+
* Returns tools keyed as `connector_${connectorKey}_${toolName}`.
|
|
273
273
|
*/
|
|
274
274
|
createTools(connections, config, opts) {
|
|
275
275
|
const myConnections = connections.filter(
|
|
@@ -279,7 +279,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
279
279
|
for (const t of Object.values(this.tools)) {
|
|
280
280
|
const tool = t.createTool(myConnections, config);
|
|
281
281
|
const originalToModelOutput = tool.toModelOutput;
|
|
282
|
-
result[
|
|
282
|
+
result[`connector_${this.connectorKey}_${t.name}`] = {
|
|
283
283
|
...tool,
|
|
284
284
|
toModelOutput: async (options) => {
|
|
285
285
|
if (!originalToModelOutput) {
|
|
@@ -842,9 +842,9 @@ var mongodbConnector = new ConnectorPlugin({
|
|
|
842
842
|
systemPrompt: {
|
|
843
843
|
en: `### Tools
|
|
844
844
|
|
|
845
|
-
- \`
|
|
846
|
-
- \`
|
|
847
|
-
- \`
|
|
845
|
+
- \`connector_mongodb_listCollections\`: Lists all collections in the database. Use this first to explore available data.
|
|
846
|
+
- \`connector_mongodb_find\`: Finds documents in a collection with optional filter, projection, sort, and limit. Use for data sampling and querying specific documents. Pass filter, projection, and sort as JSON strings.
|
|
847
|
+
- \`connector_mongodb_aggregate\`: Runs a MongoDB aggregation pipeline on a collection. Use for complex data analysis, grouping, joining, and transformations. Pass pipeline as a JSON string.
|
|
848
848
|
|
|
849
849
|
### Business Logic
|
|
850
850
|
|
|
@@ -897,9 +897,9 @@ export default async function handler(_c: Context) {
|
|
|
897
897
|
- Always include limit in find queries and $limit in aggregation pipelines`,
|
|
898
898
|
ja: `### \u30C4\u30FC\u30EB
|
|
899
899
|
|
|
900
|
-
- \`
|
|
901
|
-
- \`
|
|
902
|
-
- \`
|
|
900
|
+
- \`connector_mongodb_listCollections\`: \u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u5185\u306E\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u4E00\u89A7\u3092\u53D6\u5F97\u3057\u307E\u3059\u3002\u30C7\u30FC\u30BF\u63A2\u7D22\u306E\u6700\u521D\u306E\u30B9\u30C6\u30C3\u30D7\u3068\u3057\u3066\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002
|
|
901
|
+
- \`connector_mongodb_find\`: \u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u5185\u306E\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u3092\u691C\u7D22\u3057\u307E\u3059\u3002\u30D5\u30A3\u30EB\u30BF\u30FC\u3001\u30D7\u30ED\u30B8\u30A7\u30AF\u30B7\u30E7\u30F3\u3001\u30BD\u30FC\u30C8\u3001\u5236\u9650\u3092\u30AA\u30D7\u30B7\u30E7\u30F3\u3067\u6307\u5B9A\u53EF\u80FD\u3002\u30C7\u30FC\u30BF\u306E\u30B5\u30F3\u30D7\u30EA\u30F3\u30B0\u3084\u7279\u5B9A\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306E\u30AF\u30A8\u30EA\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002filter\u3001projection\u3001sort\u306FJSON\u6587\u5B57\u5217\u3067\u6E21\u3057\u3066\u304F\u3060\u3055\u3044\u3002
|
|
902
|
+
- \`connector_mongodb_aggregate\`: \u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u4E0A\u3067MongoDB\u96C6\u7D04\u30D1\u30A4\u30D7\u30E9\u30A4\u30F3\u3092\u5B9F\u884C\u3057\u307E\u3059\u3002\u8907\u96D1\u306A\u30C7\u30FC\u30BF\u5206\u6790\u3001\u30B0\u30EB\u30FC\u30D7\u5316\u3001\u7D50\u5408\u3001\u5909\u63DB\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002pipeline\u306FJSON\u6587\u5B57\u5217\u3067\u6E21\u3057\u3066\u304F\u3060\u3055\u3044\u3002
|
|
903
903
|
|
|
904
904
|
### Business Logic
|
|
905
905
|
|
|
@@ -118,7 +118,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
118
118
|
/**
|
|
119
119
|
* Create tools for connections that belong to this connector.
|
|
120
120
|
* Filters connections by connectorKey internally.
|
|
121
|
-
* Returns tools keyed as
|
|
121
|
+
* Returns tools keyed as `connector_${connectorKey}_${toolName}`.
|
|
122
122
|
*/
|
|
123
123
|
createTools(connections, config, opts) {
|
|
124
124
|
const myConnections = connections.filter(
|
|
@@ -128,7 +128,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
128
128
|
for (const t of Object.values(this.tools)) {
|
|
129
129
|
const tool = t.createTool(myConnections, config);
|
|
130
130
|
const originalToModelOutput = tool.toModelOutput;
|
|
131
|
-
result[
|
|
131
|
+
result[`connector_${this.connectorKey}_${t.name}`] = {
|
|
132
132
|
...tool,
|
|
133
133
|
toModelOutput: async (options) => {
|
|
134
134
|
if (!originalToModelOutput) {
|
|
@@ -395,13 +395,13 @@ var notionOauthOnboarding = new ConnectorOnboarding({
|
|
|
395
395
|
- Write only 1 sentence between tool calls, then immediately call the next tool. Skip unnecessary explanations and proceed efficiently`
|
|
396
396
|
},
|
|
397
397
|
dataOverviewInstructions: {
|
|
398
|
-
en: `1. Call
|
|
399
|
-
2. For each database found, call
|
|
400
|
-
3. Call
|
|
398
|
+
en: `1. Call connector_notion-oauth_request with POST /search and { "page_size": 5 } to discover available pages and databases
|
|
399
|
+
2. For each database found, call connector_notion-oauth_request with POST /databases/{database_id}/query and { "page_size": 5 } to sample records
|
|
400
|
+
3. Call connector_notion-oauth_request with GET /users to list workspace members
|
|
401
401
|
4. Explore page content with GET /blocks/{page_id}/children as needed`,
|
|
402
|
-
ja: `1.
|
|
403
|
-
2. \u898B\u3064\u304B\u3063\u305F\u5404\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u306B\u3064\u3044\u3066\
|
|
404
|
-
3.
|
|
402
|
+
ja: `1. connector_notion-oauth_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
|
|
403
|
+
2. \u898B\u3064\u304B\u3063\u305F\u5404\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u306B\u3064\u3044\u3066\u3001connector_notion-oauth_request \u3067 POST /databases/{database_id}/query \u3092 { "page_size": 5 } \u3067\u547C\u3073\u51FA\u3057\u3001\u30EC\u30B3\u30FC\u30C9\u3092\u30B5\u30F3\u30D7\u30EA\u30F3\u30B0
|
|
404
|
+
3. connector_notion-oauth_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
|
|
405
405
|
4. \u5FC5\u8981\u306B\u5FDC\u3058\u3066 GET /blocks/{page_id}/children \u3067\u30DA\u30FC\u30B8\u30B3\u30F3\u30C6\u30F3\u30C4\u3092\u63A2\u7D22`
|
|
406
406
|
}
|
|
407
407
|
});
|
|
@@ -465,6 +465,38 @@ async function getDatabase(proxyFetch, databaseId) {
|
|
|
465
465
|
}
|
|
466
466
|
return await res.json();
|
|
467
467
|
}
|
|
468
|
+
async function queryDatabaseSample(proxyFetch, databaseId) {
|
|
469
|
+
try {
|
|
470
|
+
const res = await apiFetch(proxyFetch, `/databases/${databaseId}/query`, {
|
|
471
|
+
method: "POST",
|
|
472
|
+
body: JSON.stringify({ page_size: 3 })
|
|
473
|
+
});
|
|
474
|
+
if (!res.ok) return [];
|
|
475
|
+
const data = await res.json();
|
|
476
|
+
return data.results ?? [];
|
|
477
|
+
} catch {
|
|
478
|
+
return [];
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
function formatPropertyValue(prop) {
|
|
482
|
+
if (prop == null || typeof prop !== "object") return "";
|
|
483
|
+
const p = prop;
|
|
484
|
+
const t = p.type ?? "";
|
|
485
|
+
const v = p[t];
|
|
486
|
+
if (v == null) return "";
|
|
487
|
+
if (typeof v === "string" || typeof v === "number" || typeof v === "boolean")
|
|
488
|
+
return String(v);
|
|
489
|
+
if (Array.isArray(v)) {
|
|
490
|
+
if (v.length === 0) return "";
|
|
491
|
+
const first = v[0];
|
|
492
|
+
return first.plain_text ?? first.name ?? `[${v.length} items]`;
|
|
493
|
+
}
|
|
494
|
+
if (typeof v === "object") {
|
|
495
|
+
const o = v;
|
|
496
|
+
return o.name ?? o.plain_text ?? o.start ?? JSON.stringify(v).slice(0, 30);
|
|
497
|
+
}
|
|
498
|
+
return String(v);
|
|
499
|
+
}
|
|
468
500
|
var notionOauthSetupFlow = {
|
|
469
501
|
initialState: () => ({}),
|
|
470
502
|
steps: [
|
|
@@ -509,11 +541,28 @@ var notionOauthSetupFlow = {
|
|
|
509
541
|
sections.push(`### Database: ${title}`, "", `- id: \`${db.id}\``, "");
|
|
510
542
|
sections.push("| Property | Type |");
|
|
511
543
|
sections.push("|----------|------|");
|
|
512
|
-
|
|
544
|
+
const propEntries = Object.entries(db.properties ?? {});
|
|
545
|
+
for (const [name, def] of propEntries) {
|
|
513
546
|
const escapedName = name.replace(/\|/g, "\\|");
|
|
514
547
|
sections.push(`| ${escapedName} | ${def?.type ?? "-"} |`);
|
|
515
548
|
}
|
|
516
549
|
sections.push("");
|
|
550
|
+
const pages = await queryDatabaseSample(rt.config.proxyFetch, dbId);
|
|
551
|
+
if (pages.length > 0) {
|
|
552
|
+
const sampleProps = propEntries.slice(0, 5).map(([n]) => n);
|
|
553
|
+
if (sampleProps.length > 0) {
|
|
554
|
+
sections.push(`#### Sample pages (${pages.length})`, "");
|
|
555
|
+
sections.push(`| ${sampleProps.join(" | ")} |`);
|
|
556
|
+
sections.push(`| ${sampleProps.map(() => "---").join(" | ")} |`);
|
|
557
|
+
for (const page of pages) {
|
|
558
|
+
const cells = sampleProps.map(
|
|
559
|
+
(n) => formatPropertyValue(page.properties?.[n]).replace(/\|/g, "\\|")
|
|
560
|
+
);
|
|
561
|
+
sections.push(`| ${cells.join(" | ")} |`);
|
|
562
|
+
}
|
|
563
|
+
sections.push("");
|
|
564
|
+
}
|
|
565
|
+
}
|
|
517
566
|
}
|
|
518
567
|
return sections.join("\n");
|
|
519
568
|
}
|
|
@@ -543,7 +592,7 @@ var notionOauthConnector = new ConnectorPlugin({
|
|
|
543
592
|
systemPrompt: {
|
|
544
593
|
en: `### Tools
|
|
545
594
|
|
|
546
|
-
- \`
|
|
595
|
+
- \`connector_notion-oauth_request\`: The only way to call the Notion API. Use it to search pages and databases, query database records, retrieve page content and blocks, and manage workspace data. Authentication is configured automatically via OAuth. Notion-Version header is set automatically. Pagination uses cursor-based \`start_cursor\` and \`page_size\` (max 100) with \`has_more\` and \`next_cursor\` in the response.
|
|
547
596
|
|
|
548
597
|
### Notion API Reference
|
|
549
598
|
|
|
@@ -593,7 +642,7 @@ const data = await res.json();
|
|
|
593
642
|
\`\`\``,
|
|
594
643
|
ja: `### \u30C4\u30FC\u30EB
|
|
595
644
|
|
|
596
|
-
- \`
|
|
645
|
+
- \`connector_notion-oauth_request\`: Notion 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\u3002OAuth\u7D4C\u7531\u3067\u8A8D\u8A3C\u306F\u81EA\u52D5\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002Notion-Version\u30D8\u30C3\u30C0\u30FC\u3082\u81EA\u52D5\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
|
|
597
646
|
|
|
598
647
|
### Notion API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
599
648
|
|
|
@@ -284,7 +284,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
284
284
|
/**
|
|
285
285
|
* Create tools for connections that belong to this connector.
|
|
286
286
|
* Filters connections by connectorKey internally.
|
|
287
|
-
* Returns tools keyed as
|
|
287
|
+
* Returns tools keyed as `connector_${connectorKey}_${toolName}`.
|
|
288
288
|
*/
|
|
289
289
|
createTools(connections, config, opts) {
|
|
290
290
|
const myConnections = connections.filter(
|
|
@@ -294,7 +294,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
294
294
|
for (const t of Object.values(this.tools)) {
|
|
295
295
|
const tool = t.createTool(myConnections, config);
|
|
296
296
|
const originalToModelOutput = tool.toModelOutput;
|
|
297
|
-
result[
|
|
297
|
+
result[`connector_${this.connectorKey}_${t.name}`] = {
|
|
298
298
|
...tool,
|
|
299
299
|
toModelOutput: async (options) => {
|
|
300
300
|
if (!originalToModelOutput) {
|
|
@@ -424,13 +424,13 @@ var AUTH_TYPES = {
|
|
|
424
424
|
// ../connectors/src/connectors/notion/setup.ts
|
|
425
425
|
var notionOnboarding = new ConnectorOnboarding({
|
|
426
426
|
dataOverviewInstructions: {
|
|
427
|
-
en: `1. Call
|
|
428
|
-
2. For each database found, call
|
|
429
|
-
3. Call
|
|
427
|
+
en: `1. Call connector_notion_request with POST /search and { "page_size": 5 } to discover available pages and databases
|
|
428
|
+
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
|
|
429
|
+
3. Call connector_notion_request with GET /users to list workspace members
|
|
430
430
|
4. Explore page content with GET /blocks/{page_id}/children as needed`,
|
|
431
|
-
ja: `1.
|
|
432
|
-
2. \u898B\u3064\u304B\u3063\u305F\u5404\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u306B\u3064\u3044\u3066\
|
|
433
|
-
3.
|
|
431
|
+
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
|
|
432
|
+
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
|
|
433
|
+
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
434
|
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
435
|
}
|
|
436
436
|
});
|
|
@@ -494,6 +494,38 @@ async function getDatabase(params, databaseId) {
|
|
|
494
494
|
}
|
|
495
495
|
return await res.json();
|
|
496
496
|
}
|
|
497
|
+
async function queryDatabaseSample(params, databaseId) {
|
|
498
|
+
try {
|
|
499
|
+
const res = await apiFetch(params, `/databases/${databaseId}/query`, {
|
|
500
|
+
method: "POST",
|
|
501
|
+
body: JSON.stringify({ page_size: 3 })
|
|
502
|
+
});
|
|
503
|
+
if (!res.ok) return [];
|
|
504
|
+
const data = await res.json();
|
|
505
|
+
return data.results ?? [];
|
|
506
|
+
} catch {
|
|
507
|
+
return [];
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
function formatPropertyValue(prop) {
|
|
511
|
+
if (prop == null || typeof prop !== "object") return "";
|
|
512
|
+
const p = prop;
|
|
513
|
+
const t = p.type ?? "";
|
|
514
|
+
const v = p[t];
|
|
515
|
+
if (v == null) return "";
|
|
516
|
+
if (typeof v === "string" || typeof v === "number" || typeof v === "boolean")
|
|
517
|
+
return String(v);
|
|
518
|
+
if (Array.isArray(v)) {
|
|
519
|
+
if (v.length === 0) return "";
|
|
520
|
+
const first = v[0];
|
|
521
|
+
return first.plain_text ?? first.name ?? `[${v.length} items]`;
|
|
522
|
+
}
|
|
523
|
+
if (typeof v === "object") {
|
|
524
|
+
const o = v;
|
|
525
|
+
return o.name ?? o.plain_text ?? o.start ?? JSON.stringify(v).slice(0, 30);
|
|
526
|
+
}
|
|
527
|
+
return String(v);
|
|
528
|
+
}
|
|
497
529
|
var notionSetupFlow = {
|
|
498
530
|
initialState: () => ({}),
|
|
499
531
|
steps: [
|
|
@@ -538,11 +570,28 @@ var notionSetupFlow = {
|
|
|
538
570
|
sections.push(`### Database: ${title}`, "", `- id: \`${db.id}\``, "");
|
|
539
571
|
sections.push("| Property | Type |");
|
|
540
572
|
sections.push("|----------|------|");
|
|
541
|
-
|
|
573
|
+
const propEntries = Object.entries(db.properties ?? {});
|
|
574
|
+
for (const [name, def] of propEntries) {
|
|
542
575
|
const escapedName = name.replace(/\|/g, "\\|");
|
|
543
576
|
sections.push(`| ${escapedName} | ${def?.type ?? "-"} |`);
|
|
544
577
|
}
|
|
545
578
|
sections.push("");
|
|
579
|
+
const pages = await queryDatabaseSample(rt.params, dbId);
|
|
580
|
+
if (pages.length > 0) {
|
|
581
|
+
const sampleProps = propEntries.slice(0, 5).map(([n]) => n);
|
|
582
|
+
if (sampleProps.length > 0) {
|
|
583
|
+
sections.push(`#### Sample pages (${pages.length})`, "");
|
|
584
|
+
sections.push(`| ${sampleProps.join(" | ")} |`);
|
|
585
|
+
sections.push(`| ${sampleProps.map(() => "---").join(" | ")} |`);
|
|
586
|
+
for (const page of pages) {
|
|
587
|
+
const cells = sampleProps.map(
|
|
588
|
+
(n) => formatPropertyValue(page.properties?.[n]).replace(/\|/g, "\\|")
|
|
589
|
+
);
|
|
590
|
+
sections.push(`| ${cells.join(" | ")} |`);
|
|
591
|
+
}
|
|
592
|
+
sections.push("");
|
|
593
|
+
}
|
|
594
|
+
}
|
|
546
595
|
}
|
|
547
596
|
return sections.join("\n");
|
|
548
597
|
}
|
|
@@ -643,7 +692,7 @@ var notionConnector = new ConnectorPlugin({
|
|
|
643
692
|
systemPrompt: {
|
|
644
693
|
en: `### Tools
|
|
645
694
|
|
|
646
|
-
- \`
|
|
695
|
+
- \`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
696
|
|
|
648
697
|
### Business Logic
|
|
649
698
|
|
|
@@ -713,7 +762,7 @@ export default async function handler(c: Context) {
|
|
|
713
762
|
- Properties with more than 25 items (e.g., people, relation) need the property endpoint for full data`,
|
|
714
763
|
ja: `### \u30C4\u30FC\u30EB
|
|
715
764
|
|
|
716
|
-
- \`
|
|
765
|
+
- \`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
766
|
|
|
718
767
|
### Business Logic
|
|
719
768
|
|
|
@@ -144,7 +144,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
144
144
|
/**
|
|
145
145
|
* Create tools for connections that belong to this connector.
|
|
146
146
|
* Filters connections by connectorKey internally.
|
|
147
|
-
* Returns tools keyed as
|
|
147
|
+
* Returns tools keyed as `connector_${connectorKey}_${toolName}`.
|
|
148
148
|
*/
|
|
149
149
|
createTools(connections, config, opts) {
|
|
150
150
|
const myConnections = connections.filter(
|
|
@@ -154,7 +154,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
154
154
|
for (const t of Object.values(this.tools)) {
|
|
155
155
|
const tool = t.createTool(myConnections, config);
|
|
156
156
|
const originalToModelOutput = tool.toModelOutput;
|
|
157
|
-
result[
|
|
157
|
+
result[`connector_${this.connectorKey}_${t.name}`] = {
|
|
158
158
|
...tool,
|
|
159
159
|
toModelOutput: async (options) => {
|
|
160
160
|
if (!originalToModelOutput) {
|
|
@@ -547,7 +547,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
547
547
|
/**
|
|
548
548
|
* Create tools for connections that belong to this connector.
|
|
549
549
|
* Filters connections by connectorKey internally.
|
|
550
|
-
* Returns tools keyed as
|
|
550
|
+
* Returns tools keyed as `connector_${connectorKey}_${toolName}`.
|
|
551
551
|
*/
|
|
552
552
|
createTools(connections, config, opts) {
|
|
553
553
|
const myConnections = connections.filter(
|
|
@@ -557,7 +557,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
557
557
|
for (const t of Object.values(this.tools)) {
|
|
558
558
|
const tool = t.createTool(myConnections, config);
|
|
559
559
|
const originalToModelOutput = tool.toModelOutput;
|
|
560
|
-
result[
|
|
560
|
+
result[`connector_${this.connectorKey}_${t.name}`] = {
|
|
561
561
|
...tool,
|
|
562
562
|
toModelOutput: async (options) => {
|
|
563
563
|
if (!originalToModelOutput) {
|
|
@@ -706,12 +706,12 @@ init_oracle_runner();
|
|
|
706
706
|
// ../connectors/src/connectors/oracle/setup.ts
|
|
707
707
|
var oracleOnboarding = new ConnectorOnboarding({
|
|
708
708
|
dataOverviewInstructions: {
|
|
709
|
-
en: `1. Use
|
|
709
|
+
en: `1. Use connector_oracle_executeQuery to confirm the version: \`SELECT BANNER FROM V$VERSION\`
|
|
710
710
|
2. Identify the current schema (Oracle treats users as schemas): \`SELECT USER FROM DUAL\`
|
|
711
711
|
3. List user tables: \`SELECT TABLE_NAME FROM USER_TABLES\`. To explore other schemas the connection has access to, use \`ALL_TABLES\` filtered by \`OWNER\`.
|
|
712
712
|
4. For key tables, fetch column info: \`SELECT COLUMN_NAME, DATA_TYPE FROM USER_TAB_COLUMNS WHERE TABLE_NAME = UPPER('xxx')\` (Oracle stores unquoted identifiers as upper-case).
|
|
713
713
|
5. Sample up to 3 tables. Oracle has no \`LIMIT\` keyword: use \`FETCH FIRST n ROWS ONLY\` or \`ROWNUM\`: \`SELECT * FROM <table> FETCH FIRST 5 ROWS ONLY\``,
|
|
714
|
-
ja: `1.
|
|
714
|
+
ja: `1. connector_oracle_executeQuery \u3067\u30D0\u30FC\u30B8\u30E7\u30F3\u3092\u78BA\u8A8D: \`SELECT BANNER FROM V$VERSION\`
|
|
715
715
|
2. \u73FE\u5728\u306E\u30B9\u30AD\u30FC\u30DE\uFF08Oracle\u3067\u306F\u30E6\u30FC\u30B6\u30FC\uFF1D\u30B9\u30AD\u30FC\u30DE\uFF09\u3092\u78BA\u8A8D: \`SELECT USER FROM DUAL\`
|
|
716
716
|
3. \u30E6\u30FC\u30B6\u30FC\u30C6\u30FC\u30D6\u30EB\u4E00\u89A7\u3092\u53D6\u5F97: \`SELECT TABLE_NAME FROM USER_TABLES\`\u3002\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306A\u4ED6\u30B9\u30AD\u30FC\u30DE\u3092\u53C2\u7167\u3059\u308B\u5834\u5408\u306F \`ALL_TABLES\` \u3092 \`OWNER\` \u3067\u30D5\u30A3\u30EB\u30BF\u30EA\u30F3\u30B0\u3002
|
|
717
717
|
4. \u4E3B\u8981\u30C6\u30FC\u30D6\u30EB\u306E\u30AB\u30E9\u30E0\u60C5\u5831\u3092\u53D6\u5F97: \`SELECT COLUMN_NAME, DATA_TYPE FROM USER_TAB_COLUMNS WHERE TABLE_NAME = UPPER('xxx')\`\uFF08Oracle \u306F\u30AF\u30A9\u30FC\u30C8\u306A\u3057\u8B58\u5225\u5B50\u3092\u5927\u6587\u5B57\u3067\u4FDD\u5B58\uFF09\u3002
|
|
@@ -840,6 +840,20 @@ var oracleSetupFlow = {
|
|
|
840
840
|
fetchAll: () => fetchTableAndViewNames(rt.params, owner),
|
|
841
841
|
limit: ORACLE_SETUP_MAX_TABLES
|
|
842
842
|
});
|
|
843
|
+
let rowCounts = /* @__PURE__ */ new Map();
|
|
844
|
+
try {
|
|
845
|
+
const countRows = await runOracleSetupQuery(
|
|
846
|
+
rt.params,
|
|
847
|
+
`SELECT TABLE_NAME, NUM_ROWS FROM ALL_TABLES WHERE OWNER = ${quoteLiteral(owner)}`
|
|
848
|
+
);
|
|
849
|
+
rowCounts = new Map(
|
|
850
|
+
countRows.filter((r) => r["NUM_ROWS"] != null).map((r) => [
|
|
851
|
+
String(r["TABLE_NAME"] ?? ""),
|
|
852
|
+
Number(r["NUM_ROWS"])
|
|
853
|
+
])
|
|
854
|
+
);
|
|
855
|
+
} catch {
|
|
856
|
+
}
|
|
843
857
|
const typeRows = targetTables.length > 0 ? await runOracleSetupQuery(
|
|
844
858
|
rt.params,
|
|
845
859
|
`SELECT OBJECT_NAME, OBJECT_TYPE FROM ALL_OBJECTS
|
|
@@ -869,7 +883,9 @@ var oracleSetupFlow = {
|
|
|
869
883
|
AND TABLE_NAME = ${quoteLiteral(table)}
|
|
870
884
|
ORDER BY COLUMN_ID`
|
|
871
885
|
);
|
|
872
|
-
|
|
886
|
+
const rowCount = rowCounts.get(table);
|
|
887
|
+
const rowCountSuffix = typeof rowCount === "number" ? ` (~${rowCount.toLocaleString()} rows)` : "";
|
|
888
|
+
sections.push(`#### ${heading}: ${table}${rowCountSuffix}`, "");
|
|
873
889
|
sections.push("| Column | Type | Nullable | Default |");
|
|
874
890
|
sections.push("|--------|------|----------|---------|");
|
|
875
891
|
for (const c of cols) {
|
|
@@ -983,7 +999,7 @@ var oracleConnector = new ConnectorPlugin({
|
|
|
983
999
|
systemPrompt: {
|
|
984
1000
|
en: `### Tools
|
|
985
1001
|
|
|
986
|
-
- \`
|
|
1002
|
+
- \`connector_oracle_executeQuery\`: Executes a SQL query against an Oracle Database and returns rows. Use it for schema exploration via \`USER_TABLES\` / \`USER_TAB_COLUMNS\` / \`ALL_TABLES\` and for sampling data. See the SQL Reference below for Oracle-specific syntax.
|
|
987
1003
|
|
|
988
1004
|
### Business Logic
|
|
989
1005
|
|
|
@@ -1002,7 +1018,7 @@ The business logic type for this connector is "sql".
|
|
|
1002
1018
|
- Row-limit compatibility: the platform's server-logic schema inference may wrap your query as \`SELECT * FROM (<inner>) AS _sq LIMIT N\`. Oracle has no \`LIMIT\` keyword, so the connector detects this exact wrapper at \`query()\` time, executes \`<inner>\` directly, and slices the first N rows in JS. You do not need to handle this \u2014 but do not author your own \`LIMIT\` clauses; use \`FETCH FIRST N ROWS ONLY\`, \`OFFSET m ROWS FETCH NEXT N ROWS ONLY\`, or \`ROWNUM\` filters.`,
|
|
1003
1019
|
ja: `### \u30C4\u30FC\u30EB
|
|
1004
1020
|
|
|
1005
|
-
- \`
|
|
1021
|
+
- \`connector_oracle_executeQuery\`: Oracle Database \u306B\u5BFE\u3057\u3066 SQL \u3092\u5B9F\u884C\u3057\u3001\u884C\u30C7\u30FC\u30BF\u3092\u8FD4\u3057\u307E\u3059\u3002\`USER_TABLES\` / \`USER_TAB_COLUMNS\` / \`ALL_TABLES\` \u3092\u4F7F\u3063\u305F\u30B9\u30AD\u30FC\u30DE\u63A2\u7D22\u3084\u30C7\u30FC\u30BF\u306E\u30B5\u30F3\u30D7\u30EA\u30F3\u30B0\u306B\u4F7F\u3044\u307E\u3059\u3002Oracle \u56FA\u6709\u306E\u69CB\u6587\u306F\u4E0B\u90E8\u306E\u300CSQL \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9\u300D\u3092\u53C2\u7167\u3057\u3066\u304F\u3060\u3055\u3044\u3002
|
|
1006
1022
|
|
|
1007
1023
|
### Business Logic
|
|
1008
1024
|
|
|
@@ -232,7 +232,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
232
232
|
/**
|
|
233
233
|
* Create tools for connections that belong to this connector.
|
|
234
234
|
* Filters connections by connectorKey internally.
|
|
235
|
-
* Returns tools keyed as
|
|
235
|
+
* Returns tools keyed as `connector_${connectorKey}_${toolName}`.
|
|
236
236
|
*/
|
|
237
237
|
createTools(connections, config, opts) {
|
|
238
238
|
const myConnections = connections.filter(
|
|
@@ -242,7 +242,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
242
242
|
for (const t of Object.values(this.tools)) {
|
|
243
243
|
const tool = t.createTool(myConnections, config);
|
|
244
244
|
const originalToModelOutput = tool.toModelOutput;
|
|
245
|
-
result[
|
|
245
|
+
result[`connector_${this.connectorKey}_${t.name}`] = {
|
|
246
246
|
...tool,
|
|
247
247
|
toModelOutput: async (options) => {
|
|
248
248
|
if (!originalToModelOutput) {
|
|
@@ -533,27 +533,27 @@ var outlookOnboarding = new ConnectorOnboarding({
|
|
|
533
533
|
},
|
|
534
534
|
dataOverviewInstructions: {
|
|
535
535
|
en: `Mail
|
|
536
|
-
1. Call
|
|
537
|
-
2. Call
|
|
538
|
-
3. Call
|
|
539
|
-
4. Call
|
|
540
|
-
5. For threading, call
|
|
536
|
+
1. Call connector_outlook-oauth_request with GET /me/mailFolders to list mail folders
|
|
537
|
+
2. Call connector_outlook-oauth_request with GET /me/messages?$top=5&$select=id,subject,from,receivedDateTime,conversationId to sample recent messages
|
|
538
|
+
3. Call connector_outlook-oauth_request with GET /me/messages/{id} for an interesting message to inspect the full payload
|
|
539
|
+
4. Call connector_outlook-oauth_request with GET /me/mailFolders/{folderId}/messages?$top=5 to drill into a specific folder
|
|
540
|
+
5. For threading, call connector_outlook-oauth_request with GET /me/messages?$filter=conversationId%20eq%20'<id>'&$orderby=receivedDateTime%20asc to pull every message in a conversation
|
|
541
541
|
|
|
542
542
|
Calendar
|
|
543
|
-
6. Call
|
|
544
|
-
7. Call
|
|
545
|
-
8. Call
|
|
543
|
+
6. Call connector_outlook-oauth_request with GET /me/calendars to list calendars (default + shared)
|
|
544
|
+
7. Call connector_outlook-oauth_request with GET /me/calendarView?startDateTime=<startISO>&endDateTime=<endISO>&$top=5&$select=id,subject,start,end,attendees to sample upcoming occurrences (expands recurring events)
|
|
545
|
+
8. Call connector_outlook-oauth_request with GET /me/events/{eventId} for an interesting event to inspect attendees, body, and location`,
|
|
546
546
|
ja: `\u30E1\u30FC\u30EB
|
|
547
|
-
1.
|
|
548
|
-
2.
|
|
549
|
-
3. \u8208\u5473\u306E\u3042\u308B\u30E1\u30C3\u30BB\u30FC\u30B8\u306B\u3064\u3044\u3066
|
|
550
|
-
4.
|
|
551
|
-
5. \u30B9\u30EC\u30C3\u30C9\u3092\u8FFD\u3046\u5834\u5408\u306F
|
|
547
|
+
1. connector_outlook-oauth_request \u3067 GET /me/mailFolders \u3092\u547C\u3073\u51FA\u3057\u3001\u30E1\u30FC\u30EB\u30D5\u30A9\u30EB\u30C0\u4E00\u89A7\u3092\u53D6\u5F97
|
|
548
|
+
2. connector_outlook-oauth_request \u3067 GET /me/messages?$top=5&$select=id,subject,from,receivedDateTime,conversationId \u3092\u547C\u3073\u51FA\u3057\u3001\u6700\u65B0\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u30B5\u30F3\u30D7\u30EA\u30F3\u30B0
|
|
549
|
+
3. \u8208\u5473\u306E\u3042\u308B\u30E1\u30C3\u30BB\u30FC\u30B8\u306B\u3064\u3044\u3066 connector_outlook-oauth_request \u3067 GET /me/messages/{id} \u3092\u547C\u3073\u51FA\u3057\u3001\u30DA\u30A4\u30ED\u30FC\u30C9\u5168\u4F53\u3092\u78BA\u8A8D
|
|
550
|
+
4. connector_outlook-oauth_request \u3067 GET /me/mailFolders/{folderId}/messages?$top=5 \u3092\u547C\u3073\u51FA\u3057\u3001\u7279\u5B9A\u30D5\u30A9\u30EB\u30C0\u306E\u4E2D\u8EAB\u3092\u78BA\u8A8D
|
|
551
|
+
5. \u30B9\u30EC\u30C3\u30C9\u3092\u8FFD\u3046\u5834\u5408\u306F connector_outlook-oauth_request \u3067 GET /me/messages?$filter=conversationId%20eq%20'<id>'&$orderby=receivedDateTime%20asc \u3092\u547C\u3073\u51FA\u3057\u3001\u4F1A\u8A71\u306B\u542B\u307E\u308C\u308B\u5168\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u53D6\u5F97
|
|
552
552
|
|
|
553
553
|
\u30AB\u30EC\u30F3\u30C0\u30FC
|
|
554
|
-
6.
|
|
555
|
-
7.
|
|
556
|
-
8. \u8208\u5473\u306E\u3042\u308B\u30A4\u30D9\u30F3\u30C8\u306B\u3064\u3044\u3066
|
|
554
|
+
6. connector_outlook-oauth_request \u3067 GET /me/calendars \u3092\u547C\u3073\u51FA\u3057\u3001\u30AB\u30EC\u30F3\u30C0\u30FC\u4E00\u89A7 (\u30C7\u30D5\u30A9\u30EB\u30C8 + \u5171\u6709) \u3092\u53D6\u5F97
|
|
555
|
+
7. connector_outlook-oauth_request \u3067 GET /me/calendarView?startDateTime=<startISO>&endDateTime=<endISO>&$top=5&$select=id,subject,start,end,attendees \u3092\u547C\u3073\u51FA\u3057\u3001\u76F4\u8FD1\u306E occurrence \u3092\u30B5\u30F3\u30D7\u30EA\u30F3\u30B0 (\u7E70\u308A\u8FD4\u3057\u30A4\u30D9\u30F3\u30C8\u3092\u5C55\u958B)
|
|
556
|
+
8. \u8208\u5473\u306E\u3042\u308B\u30A4\u30D9\u30F3\u30C8\u306B\u3064\u3044\u3066 connector_outlook-oauth_request \u3067 GET /me/events/{eventId} \u3092\u547C\u3073\u51FA\u3057\u3001\u53C2\u52A0\u8005\u30FB\u672C\u6587\u30FB\u5834\u6240\u3092\u78BA\u8A8D`
|
|
557
557
|
}
|
|
558
558
|
});
|
|
559
559
|
|
|
@@ -667,7 +667,7 @@ var outlookOauthConnector = new ConnectorPlugin({
|
|
|
667
667
|
systemPrompt: {
|
|
668
668
|
en: `### Tools
|
|
669
669
|
|
|
670
|
-
- \`
|
|
670
|
+
- \`connector_outlook-oauth_request\`: The only way to call Microsoft Graph for Outlook (read-only). Use it to fetch the user profile (\`/me\`), list mail folders (\`/me/mailFolders\`), read messages (\`/me/messages\`, \`/me/messages/{id}\`), fetch attachments (\`/me/messages/{id}/attachments\`), list calendars (\`/me/calendars\`), and read events (\`/me/events\`, \`/me/calendarView\`). Authentication is configured automatically via OAuth.
|
|
671
671
|
|
|
672
672
|
### Microsoft Graph Reference (Outlook Mail)
|
|
673
673
|
|
|
@@ -800,7 +800,7 @@ events.value.forEach(e => console.log(e.start.dateTime, e.subject));
|
|
|
800
800
|
\`\`\``,
|
|
801
801
|
ja: `### \u30C4\u30FC\u30EB
|
|
802
802
|
|
|
803
|
-
- \`
|
|
803
|
+
- \`connector_outlook-oauth_request\`: Outlook \u5411\u3051\u306E Microsoft Graph \u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\uFF08\u8AAD\u307F\u53D6\u308A\u5C02\u7528\uFF09\u3002\u30E6\u30FC\u30B6\u30FC\u30D7\u30ED\u30D5\u30A3\u30FC\u30EB (\`/me\`)\u3001\u30E1\u30FC\u30EB\u30D5\u30A9\u30EB\u30C0 (\`/me/mailFolders\`)\u3001\u30E1\u30C3\u30BB\u30FC\u30B8 (\`/me/messages\`)\u3001\u6DFB\u4ED8\u30D5\u30A1\u30A4\u30EB (\`/me/messages/{id}/attachments\`)\u3001\u30AB\u30EC\u30F3\u30C0\u30FC (\`/me/calendars\`)\u3001\u30A4\u30D9\u30F3\u30C8 (\`/me/events\`, \`/me/calendarView\`) \u306E\u53D6\u5F97\u306B\u4F7F\u3044\u307E\u3059\u3002OAuth \u7D4C\u7531\u3067\u8A8D\u8A3C\u306F\u81EA\u52D5\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002
|
|
804
804
|
|
|
805
805
|
### Microsoft Graph \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9 (Outlook \u30E1\u30FC\u30EB)
|
|
806
806
|
|
|
@@ -190,7 +190,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
190
190
|
/**
|
|
191
191
|
* Create tools for connections that belong to this connector.
|
|
192
192
|
* Filters connections by connectorKey internally.
|
|
193
|
-
* Returns tools keyed as
|
|
193
|
+
* Returns tools keyed as `connector_${connectorKey}_${toolName}`.
|
|
194
194
|
*/
|
|
195
195
|
createTools(connections, config, opts) {
|
|
196
196
|
const myConnections = connections.filter(
|
|
@@ -200,7 +200,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
200
200
|
for (const t of Object.values(this.tools)) {
|
|
201
201
|
const tool = t.createTool(myConnections, config);
|
|
202
202
|
const originalToModelOutput = tool.toModelOutput;
|
|
203
|
-
result[
|
|
203
|
+
result[`connector_${this.connectorKey}_${t.name}`] = {
|
|
204
204
|
...tool,
|
|
205
205
|
toModelOutput: async (options) => {
|
|
206
206
|
if (!originalToModelOutput) {
|
|
@@ -491,14 +491,14 @@ var powerbiOauthOnboarding = new ConnectorOnboarding({
|
|
|
491
491
|
- Write only 1 sentence between tool calls, then immediately call the next tool`
|
|
492
492
|
},
|
|
493
493
|
dataOverviewInstructions: {
|
|
494
|
-
en: `1. Call
|
|
495
|
-
2. For a target workspace, call
|
|
496
|
-
3. Call
|
|
497
|
-
4. For each interesting dataset call
|
|
498
|
-
ja: `1.
|
|
499
|
-
2. \u5BFE\u8C61\u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u306B\u5BFE\u3057\u3066
|
|
500
|
-
3.
|
|
501
|
-
4. \u8208\u5473\u306E\u3042\u308B\u30C7\u30FC\u30BF\u30BB\u30C3\u30C8\u306B\u3064\u3044\u3066
|
|
494
|
+
en: `1. Call connector_powerbi-oauth_request with GET /groups to list accessible workspaces
|
|
495
|
+
2. For a target workspace, call connector_powerbi-oauth_request with GET /groups/{groupId}/datasets to list datasets
|
|
496
|
+
3. Call connector_powerbi-oauth_request with GET /groups/{groupId}/reports to list reports
|
|
497
|
+
4. For each interesting dataset call connector_powerbi-oauth_request with GET /groups/{groupId}/datasets/{datasetId}/tables to inspect tables`,
|
|
498
|
+
ja: `1. connector_powerbi-oauth_request \u3067 GET /groups \u3092\u547C\u3073\u51FA\u3057\u3001\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306A\u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u4E00\u89A7\u3092\u53D6\u5F97
|
|
499
|
+
2. \u5BFE\u8C61\u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u306B\u5BFE\u3057\u3066 connector_powerbi-oauth_request \u3067 GET /groups/{groupId}/datasets \u3092\u547C\u3073\u51FA\u3057\u3001\u30C7\u30FC\u30BF\u30BB\u30C3\u30C8\u4E00\u89A7\u3092\u53D6\u5F97
|
|
500
|
+
3. connector_powerbi-oauth_request \u3067 GET /groups/{groupId}/reports \u3092\u547C\u3073\u51FA\u3057\u3001\u30EC\u30DD\u30FC\u30C8\u4E00\u89A7\u3092\u53D6\u5F97
|
|
501
|
+
4. \u8208\u5473\u306E\u3042\u308B\u30C7\u30FC\u30BF\u30BB\u30C3\u30C8\u306B\u3064\u3044\u3066 connector_powerbi-oauth_request \u3067 GET /groups/{groupId}/datasets/{datasetId}/tables \u3092\u547C\u3073\u51FA\u3057\u3001\u30C6\u30FC\u30D6\u30EB\u69CB\u9020\u3092\u78BA\u8A8D`
|
|
502
502
|
}
|
|
503
503
|
});
|
|
504
504
|
|
|
@@ -906,7 +906,7 @@ var powerbiOauthConnector = new ConnectorPlugin({
|
|
|
906
906
|
systemPrompt: {
|
|
907
907
|
en: `### Tools
|
|
908
908
|
|
|
909
|
-
- \`
|
|
909
|
+
- \`connector_powerbi-oauth_request\`: The only way to call the Power BI REST API v1.0. Use it to list workspaces (\`/groups\`), datasets, reports, and to run DAX via the \`executeQueries\` endpoint. Authentication is configured automatically via OAuth (Microsoft Entra ID).
|
|
910
910
|
|
|
911
911
|
### Business Logic
|
|
912
912
|
|
|
@@ -962,7 +962,7 @@ export default async function handler(c: Context) {
|
|
|
962
962
|
- Each \`executeQueries\` call accepts one query in the \`queries\` array (per current Power BI API limits)`,
|
|
963
963
|
ja: `### \u30C4\u30FC\u30EB
|
|
964
964
|
|
|
965
|
-
- \`
|
|
965
|
+
- \`connector_powerbi-oauth_request\`: Power BI REST API v1.0 \u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9 (\`/groups\`)\u3001\u30C7\u30FC\u30BF\u30BB\u30C3\u30C8\u3001\u30EC\u30DD\u30FC\u30C8\u306E\u4E00\u89A7\u53D6\u5F97\u3084\u3001\`executeQueries\` \u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\u306B\u3088\u308B DAX \u306E\u5B9F\u884C\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002OAuth (Microsoft Entra ID) \u7D4C\u7531\u3067\u8A8D\u8A3C\u306F\u81EA\u52D5\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002
|
|
966
966
|
|
|
967
967
|
### Business Logic
|
|
968
968
|
|