@squadbase/vite-server 0.1.17-dev.3b633bb → 0.1.17-dev.423ee34
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 +3307 -739
- package/dist/connectors/airtable-oauth.js +50 -8
- package/dist/connectors/airtable.js +46 -8
- package/dist/connectors/amplitude.js +10 -8
- package/dist/connectors/anthropic.js +4 -2
- package/dist/connectors/asana.js +39 -10
- package/dist/connectors/attio.js +32 -13
- package/dist/connectors/aws-billing.js +10 -8
- package/dist/connectors/azure-sql.js +33 -7
- package/dist/connectors/backlog-api-key.js +42 -15
- package/dist/connectors/clickup.js +52 -10
- package/dist/connectors/cosmosdb.js +14 -12
- package/dist/connectors/customerio.js +10 -8
- package/dist/connectors/dbt.js +688 -25
- package/dist/connectors/freshdesk.js +84 -8
- package/dist/connectors/freshsales.js +10 -8
- package/dist/connectors/freshservice.js +10 -8
- package/dist/connectors/gamma.js +17 -15
- package/dist/connectors/gemini.js +4 -2
- package/dist/connectors/github.js +14 -12
- package/dist/connectors/gmail-oauth.js +10 -10
- package/dist/connectors/gmail.js +6 -4
- package/dist/connectors/google-ads.js +10 -8
- package/dist/connectors/google-analytics-oauth.js +154 -25
- package/dist/connectors/google-analytics.js +536 -109
- package/dist/connectors/google-audit-log.js +6 -4
- package/dist/connectors/google-calendar-oauth.js +63 -15
- package/dist/connectors/google-calendar.js +63 -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 +128 -17
- package/dist/connectors/google-sheets.js +8 -6
- package/dist/connectors/google-slides.js +10 -10
- package/dist/connectors/grafana.js +47 -10
- package/dist/connectors/hubspot-oauth.js +41 -9
- package/dist/connectors/hubspot.js +27 -9
- package/dist/connectors/influxdb.js +10 -8
- package/dist/connectors/intercom-oauth.js +72 -12
- package/dist/connectors/intercom.js +14 -12
- package/dist/connectors/jdbc.js +8 -6
- package/dist/connectors/jira-api-key.js +70 -11
- package/dist/connectors/kintone-api-token.js +68 -18
- package/dist/connectors/kintone.js +56 -11
- package/dist/connectors/linear.js +56 -12
- package/dist/connectors/linkedin-ads.js +43 -14
- package/dist/connectors/mailchimp-oauth.js +8 -6
- package/dist/connectors/mailchimp.js +8 -6
- package/dist/connectors/meta-ads-oauth.js +35 -14
- package/dist/connectors/meta-ads.js +37 -14
- package/dist/connectors/mixpanel.js +10 -8
- package/dist/connectors/monday.js +11 -9
- package/dist/connectors/mongodb.js +10 -8
- package/dist/connectors/notion-oauth.js +60 -11
- package/dist/connectors/notion.js +62 -11
- package/dist/connectors/openai.js +4 -2
- package/dist/connectors/oracle.js +25 -7
- package/dist/connectors/outlook-oauth.js +20 -20
- package/dist/connectors/powerbi-oauth.js +12 -12
- package/dist/connectors/salesforce.js +44 -9
- package/dist/connectors/semrush.js +8 -6
- package/dist/connectors/sentry.js +38 -10
- package/dist/connectors/shopify-oauth.js +43 -10
- package/dist/connectors/shopify.js +10 -8
- package/dist/connectors/sqlserver.js +33 -7
- package/dist/connectors/stripe-api-key.js +68 -15
- package/dist/connectors/stripe-oauth.js +70 -19
- package/dist/connectors/supabase.js +24 -5
- package/dist/connectors/tableau.js +16 -14
- package/dist/connectors/tiktok-ads.js +39 -16
- package/dist/connectors/wix-store.js +10 -8
- package/dist/connectors/zendesk-oauth.js +55 -12
- package/dist/connectors/zendesk.js +14 -12
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3336 -743
- package/dist/main.js +3325 -737
- package/dist/vite-plugin.js +3305 -737
- package/package.json +1 -1
|
@@ -16,6 +16,7 @@ var init_parameter_definition = __esm({
|
|
|
16
16
|
type;
|
|
17
17
|
secret;
|
|
18
18
|
required;
|
|
19
|
+
isDeprecated;
|
|
19
20
|
constructor(config) {
|
|
20
21
|
this.slug = config.slug;
|
|
21
22
|
this.name = config.name;
|
|
@@ -24,6 +25,7 @@ var init_parameter_definition = __esm({
|
|
|
24
25
|
this.type = config.type;
|
|
25
26
|
this.secret = config.secret;
|
|
26
27
|
this.required = config.required;
|
|
28
|
+
this.isDeprecated = config.isDeprecated ?? false;
|
|
27
29
|
}
|
|
28
30
|
/**
|
|
29
31
|
* Get the parameter value from a ConnectorConnectionObject.
|
|
@@ -255,7 +257,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
255
257
|
/**
|
|
256
258
|
* Create tools for connections that belong to this connector.
|
|
257
259
|
* Filters connections by connectorKey internally.
|
|
258
|
-
* Returns tools keyed as
|
|
260
|
+
* Returns tools keyed as `connector_${connectorKey}_${toolName}`.
|
|
259
261
|
*/
|
|
260
262
|
createTools(connections, config, opts) {
|
|
261
263
|
const myConnections = connections.filter(
|
|
@@ -265,7 +267,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
265
267
|
for (const t of Object.values(this.tools)) {
|
|
266
268
|
const tool = t.createTool(myConnections, config);
|
|
267
269
|
const originalToModelOutput = tool.toModelOutput;
|
|
268
|
-
result[
|
|
270
|
+
result[`connector_${this.connectorKey}_${t.name}`] = {
|
|
269
271
|
...tool,
|
|
270
272
|
toModelOutput: async (options) => {
|
|
271
273
|
if (!originalToModelOutput) {
|
|
@@ -395,11 +397,11 @@ var AUTH_TYPES = {
|
|
|
395
397
|
// ../connectors/src/connectors/hubspot/setup.ts
|
|
396
398
|
var hubspotOnboarding = new ConnectorOnboarding({
|
|
397
399
|
dataOverviewInstructions: {
|
|
398
|
-
en: `1. Call
|
|
399
|
-
2. Call
|
|
400
|
+
en: `1. Call connector_hubspot_request with GET /crm/v3/objects/contacts?limit=5 to explore contacts structure
|
|
401
|
+
2. Call connector_hubspot_request with GET /crm/v3/objects/deals?limit=5 to explore deals structure
|
|
400
402
|
3. Explore other object types (companies, tickets, etc.) as needed to understand available data`,
|
|
401
|
-
ja: `1.
|
|
402
|
-
2.
|
|
403
|
+
ja: `1. connector_hubspot_request \u3067 GET /crm/v3/objects/contacts?limit=5 \u3092\u547C\u3073\u51FA\u3057\u3001\u30B3\u30F3\u30BF\u30AF\u30C8\u306E\u69CB\u9020\u3092\u78BA\u8A8D
|
|
404
|
+
2. connector_hubspot_request \u3067 GET /crm/v3/objects/deals?limit=5 \u3092\u547C\u3073\u51FA\u3057\u3001\u53D6\u5F15\u306E\u69CB\u9020\u3092\u78BA\u8A8D
|
|
403
405
|
3. \u5FC5\u8981\u306B\u5FDC\u3058\u3066\u4ED6\u306E\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u30BF\u30A4\u30D7\uFF08\u4F01\u696D\u3001\u30C1\u30B1\u30C3\u30C8\u306A\u3069\uFF09\u3092\u63A2\u7D22\u3057\u3001\u5229\u7528\u53EF\u80FD\u306A\u30C7\u30FC\u30BF\u3092\u628A\u63E1`
|
|
404
406
|
}
|
|
405
407
|
});
|
|
@@ -433,6 +435,20 @@ var HUBSPOT_OBJECT_TYPES = [
|
|
|
433
435
|
{ value: "meetings", label: "Meetings" },
|
|
434
436
|
{ value: "tasks", label: "Tasks" }
|
|
435
437
|
];
|
|
438
|
+
async function countObjects(params, objectType) {
|
|
439
|
+
try {
|
|
440
|
+
const res = await apiFetch(params, `/crm/v3/objects/${objectType}/search`, {
|
|
441
|
+
method: "POST",
|
|
442
|
+
headers: { "Content-Type": "application/json" },
|
|
443
|
+
body: JSON.stringify({ limit: 1 })
|
|
444
|
+
});
|
|
445
|
+
if (!res.ok) return null;
|
|
446
|
+
const data = await res.json();
|
|
447
|
+
return typeof data.total === "number" ? data.total : null;
|
|
448
|
+
} catch {
|
|
449
|
+
return null;
|
|
450
|
+
}
|
|
451
|
+
}
|
|
436
452
|
async function listProperties(params, objectType) {
|
|
437
453
|
const res = await apiFetch(params, `/crm/v3/properties/${objectType}`);
|
|
438
454
|
if (!res.ok) {
|
|
@@ -477,7 +493,9 @@ var hubspotSetupFlow = {
|
|
|
477
493
|
});
|
|
478
494
|
const sections = ["## HubSpot", ""];
|
|
479
495
|
for (const objectType of targetObjectTypes) {
|
|
480
|
-
|
|
496
|
+
const count = await countObjects(rt.params, objectType);
|
|
497
|
+
const heading = count != null ? `### Object: ${objectType} (${count.toLocaleString()} records)` : `### Object: ${objectType}`;
|
|
498
|
+
sections.push(heading, "");
|
|
481
499
|
const props = await listProperties(rt.params, objectType);
|
|
482
500
|
const limited = props.slice(0, HUBSPOT_SETUP_MAX_PROPERTIES);
|
|
483
501
|
sections.push("| Property | Type | Label |");
|
|
@@ -593,7 +611,7 @@ var hubspotConnector = new ConnectorPlugin({
|
|
|
593
611
|
systemPrompt: {
|
|
594
612
|
en: `### Tools
|
|
595
613
|
|
|
596
|
-
- \`
|
|
614
|
+
- \`connector_hubspot_request\`: The only way to call the HubSpot API. Use it to query contacts, deals, companies, tickets, and other CRM objects. Authentication (Bearer token) is configured automatically. HubSpot uses cursor-based pagination with the \`after\` parameter from \`paging.next.after\` in the response. Use the search endpoint for complex queries with filters.
|
|
597
615
|
|
|
598
616
|
### Business Logic
|
|
599
617
|
|
|
@@ -659,7 +677,7 @@ export default async function handler(c: Context) {
|
|
|
659
677
|
- \`after\` \u2014 Pagination offset`,
|
|
660
678
|
ja: `### \u30C4\u30FC\u30EB
|
|
661
679
|
|
|
662
|
-
- \`
|
|
680
|
+
- \`connector_hubspot_request\`: HubSpot API\u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u30B3\u30F3\u30BF\u30AF\u30C8\u3001\u53D6\u5F15\u3001\u4F1A\u793E\u3001\u30C1\u30B1\u30C3\u30C8\u3001\u305D\u306E\u4ED6\u306ECRM\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306E\u30AF\u30A8\u30EA\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u8A8D\u8A3C\uFF08Bearer\u30C8\u30FC\u30AF\u30F3\uFF09\u306F\u81EA\u52D5\u7684\u306B\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002HubSpot\u306F\u30EC\u30B9\u30DD\u30F3\u30B9\u306E \`paging.next.after\` \u304B\u3089\u306E \`after\` \u30D1\u30E9\u30E1\u30FC\u30BF\u306B\u3088\u308B\u30AB\u30FC\u30BD\u30EB\u30D9\u30FC\u30B9\u306E\u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\u3092\u4F7F\u7528\u3057\u307E\u3059\u3002\u8907\u96D1\u306A\u30AF\u30A8\u30EA\u306B\u306F\u30D5\u30A3\u30EB\u30BF\u4ED8\u304D\u306Esearch\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\u3092\u4F7F\u7528\u3057\u307E\u3059\u3002
|
|
663
681
|
|
|
664
682
|
### Business Logic
|
|
665
683
|
|
|
@@ -16,6 +16,7 @@ var init_parameter_definition = __esm({
|
|
|
16
16
|
type;
|
|
17
17
|
secret;
|
|
18
18
|
required;
|
|
19
|
+
isDeprecated;
|
|
19
20
|
constructor(config) {
|
|
20
21
|
this.slug = config.slug;
|
|
21
22
|
this.name = config.name;
|
|
@@ -24,6 +25,7 @@ var init_parameter_definition = __esm({
|
|
|
24
25
|
this.type = config.type;
|
|
25
26
|
this.secret = config.secret;
|
|
26
27
|
this.required = config.required;
|
|
28
|
+
this.isDeprecated = config.isDeprecated ?? false;
|
|
27
29
|
}
|
|
28
30
|
/**
|
|
29
31
|
* Get the parameter value from a ConnectorConnectionObject.
|
|
@@ -314,7 +316,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
314
316
|
/**
|
|
315
317
|
* Create tools for connections that belong to this connector.
|
|
316
318
|
* Filters connections by connectorKey internally.
|
|
317
|
-
* Returns tools keyed as
|
|
319
|
+
* Returns tools keyed as `connector_${connectorKey}_${toolName}`.
|
|
318
320
|
*/
|
|
319
321
|
createTools(connections, config, opts) {
|
|
320
322
|
const myConnections = connections.filter(
|
|
@@ -324,7 +326,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
324
326
|
for (const t of Object.values(this.tools)) {
|
|
325
327
|
const tool = t.createTool(myConnections, config);
|
|
326
328
|
const originalToModelOutput = tool.toModelOutput;
|
|
327
|
-
result[
|
|
329
|
+
result[`connector_${this.connectorKey}_${t.name}`] = {
|
|
328
330
|
...tool,
|
|
329
331
|
toModelOutput: async (options) => {
|
|
330
332
|
if (!originalToModelOutput) {
|
|
@@ -484,7 +486,7 @@ var influxdbOnboarding = new ConnectorOnboarding({
|
|
|
484
486
|
dataOverviewInstructions: {
|
|
485
487
|
en: `The instance may be either InfluxDB 3 (supports SQL) or InfluxDB 2 (Flux only; includes InfluxDB Cloud on '*.cloud2.influxdata.com'). Detect the variant first, then pick the matching endpoints.
|
|
486
488
|
|
|
487
|
-
1. Probe for InfluxDB 3: call
|
|
489
|
+
1. Probe for InfluxDB 3: call connector_influxdb_request with POST /api/v3/query_sql, body { "db": "<database>", "q": "SELECT 1" }
|
|
488
490
|
- 200 with JSON rows \u2192 InfluxDB 3. Continue with SQL.
|
|
489
491
|
- 405 Method Not Allowed, or an HTML body like "<html>...405 Not Allowed..." \u2192 InfluxDB 2. Fall back to Flux (step 3).
|
|
490
492
|
2. InfluxDB 3 data overview:
|
|
@@ -496,7 +498,7 @@ var influxdbOnboarding = new ConnectorOnboarding({
|
|
|
496
498
|
- If the Organization parameter was not provided but v3 probing failed, ask the user to set it using updateConnectionParameters before continuing.`,
|
|
497
499
|
ja: `\u63A5\u7D9A\u5148\u306F InfluxDB 3\uFF08SQL \u5BFE\u5FDC\uFF09\u3068 InfluxDB 2\uFF08Flux \u306E\u307F\u3002\`*.cloud2.influxdata.com\` \u306E InfluxDB Cloud \u3092\u542B\u3080\uFF09\u306E\u3069\u3061\u3089\u306E\u53EF\u80FD\u6027\u3082\u3042\u308A\u307E\u3059\u3002\u307E\u305A\u30D0\u30EA\u30A2\u30F3\u30C8\u3092\u5224\u5225\u3057\u3001\u305D\u308C\u306B\u5408\u3046\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002
|
|
498
500
|
|
|
499
|
-
1. InfluxDB 3 \u306E\u5224\u5225:
|
|
501
|
+
1. InfluxDB 3 \u306E\u5224\u5225: connector_influxdb_request \u3067 POST /api/v3/query_sql\u3001body { "db": "<database>", "q": "SELECT 1" } \u3092\u5B9F\u884C
|
|
500
502
|
- 200 + JSON \u884C\u304C\u8FD4\u308B \u2192 InfluxDB 3\u3002\u305D\u306E\u307E\u307E SQL \u3067\u7D9A\u884C\u3002
|
|
501
503
|
- 405 Method Not Allowed\u3001\u307E\u305F\u306F "<html>...405 Not Allowed..." \u306E\u3088\u3046\u306A HTML \u672C\u6587\u304C\u8FD4\u308B \u2192 InfluxDB 2\u3002Flux \u306B\u30D5\u30A9\u30FC\u30EB\u30D0\u30C3\u30AF\uFF08\u624B\u9806 3\uFF09\u3002
|
|
502
504
|
2. InfluxDB 3 \u306E\u5834\u5408\u306E\u30C7\u30FC\u30BF\u6982\u8981:
|
|
@@ -873,13 +875,13 @@ var influxdbConnector = new ConnectorPlugin({
|
|
|
873
875
|
|
|
874
876
|
The configured instance may be **InfluxDB 3** (supports SQL via \`/api/v3/query_sql\`) or **InfluxDB 2** (Flux only; includes InfluxDB Cloud on \`*.cloud2.influxdata.com\`). Always probe first, then use the matching endpoints:
|
|
875
877
|
|
|
876
|
-
1. Call \`
|
|
878
|
+
1. Call \`connector_influxdb_request\` POST \`/api/v3/query_sql\` with body \`{ "db": "<database>", "q": "SELECT 1" }\`
|
|
877
879
|
2. 200 + JSON rows \u2192 InfluxDB 3. Use SQL endpoints.
|
|
878
880
|
3. 405 Method Not Allowed or HTML body (e.g. \`<html>...405 Not Allowed...</html>\`) \u2192 InfluxDB 2. Use Flux via \`/api/v2/query?org={org}\`. Require the \`org\` parameter; if missing, ask the user via \`updateConnectionParameters\`.
|
|
879
881
|
|
|
880
882
|
### Tools
|
|
881
883
|
|
|
882
|
-
- \`
|
|
884
|
+
- \`connector_influxdb_request\`: The only way to call the InfluxDB HTTP API. Use it to run SQL / InfluxQL / Flux queries, write line protocol, and inspect buckets / databases. Authentication (\`Authorization: Token {token}\`) and the instance URL are configured automatically. On InfluxDB 3 prefer SQL (\`POST /api/v3/query_sql\`) \u2014 it returns JSON rows that are directly usable. On InfluxDB 2 use Flux (\`POST /api/v2/query?org={org}\`) \u2014 the response is annotated CSV. Writes use \`POST /api/v3/write_lp?db={db}\` (v3) or \`POST /api/v2/write?org={org}&bucket={bucket}\` (v2) with a line-protocol body and \`contentType\` set to \`text/plain; charset=utf-8\`.
|
|
883
885
|
|
|
884
886
|
### Business Logic
|
|
885
887
|
|
|
@@ -944,13 +946,13 @@ export default async function handler(c: Context) {
|
|
|
944
946
|
|
|
945
947
|
\u63A5\u7D9A\u5148\u306F **InfluxDB 3**\uFF08\`/api/v3/query_sql\` \u306E SQL \u5BFE\u5FDC\uFF09\u3068 **InfluxDB 2**\uFF08Flux \u306E\u307F\u3002\`*.cloud2.influxdata.com\` \u306E InfluxDB Cloud \u3092\u542B\u3080\uFF09\u306E\u3069\u3061\u3089\u306E\u53EF\u80FD\u6027\u3082\u3042\u308A\u307E\u3059\u3002\u5FC5\u305A\u6700\u521D\u306B\u30D7\u30ED\u30FC\u30D6\u3057\u3066\u304B\u3089\u3001\u5BFE\u5FDC\u3059\u308B\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044:
|
|
946
948
|
|
|
947
|
-
1. \`
|
|
949
|
+
1. \`connector_influxdb_request\` \u3067 POST \`/api/v3/query_sql\`\u3001body \`{ "db": "<database>", "q": "SELECT 1" }\` \u3092\u547C\u3073\u51FA\u3059
|
|
948
950
|
2. 200 + JSON \u884C \u2192 InfluxDB 3\u3002SQL \u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\u3092\u4F7F\u7528\u3002
|
|
949
951
|
3. 405 Method Not Allowed\u3001\u307E\u305F\u306F HTML \u672C\u6587\uFF08\u4F8B: \`<html>...405 Not Allowed...</html>\`\uFF09\u2192 InfluxDB 2\u3002\`/api/v2/query?org={org}\` \u304B\u3089 Flux \u3092\u4F7F\u7528\u3002\`org\` \u30D1\u30E9\u30E1\u30FC\u30BF\u5FC5\u9808\u3002\u672A\u8A2D\u5B9A\u306A\u3089 \`updateConnectionParameters\` \u3067\u30E6\u30FC\u30B6\u30FC\u306B\u8A2D\u5B9A\u3092\u4F9D\u983C\u3059\u308B\u3002
|
|
950
952
|
|
|
951
953
|
### \u30C4\u30FC\u30EB
|
|
952
954
|
|
|
953
|
-
- \`
|
|
955
|
+
- \`connector_influxdb_request\`: InfluxDB HTTP API \u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002SQL / InfluxQL / Flux \u30AF\u30A8\u30EA\u306E\u5B9F\u884C\u3001line protocol \u66F8\u304D\u8FBC\u307F\u3001bucket / database \u306E\u78BA\u8A8D\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u8A8D\u8A3C\uFF08\`Authorization: Token {token}\`\uFF09\u3068 instance URL \u306F\u81EA\u52D5\u3067\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002InfluxDB 3 \u3067\u306F SQL (\`POST /api/v3/query_sql\`) \u304C JSON \u884C\u3092\u8FD4\u3059\u305F\u3081\u6700\u3082\u6271\u3044\u3084\u3059\u3044\u3067\u3059\u3002InfluxDB 2 \u3067\u306F Flux (\`POST /api/v2/query?org={org}\`) \u3092\u4F7F\u7528\u3057\u3001\u30EC\u30B9\u30DD\u30F3\u30B9\u306F\u6CE8\u91C8\u4ED8\u304D CSV \u3067\u3059\u3002\u66F8\u304D\u8FBC\u307F\u306F \`POST /api/v3/write_lp?db={db}\` (v3) \u307E\u305F\u306F \`POST /api/v2/write?org={org}&bucket={bucket}\` (v2) \u306B line protocol \u3092\u9001\u308A\u307E\u3059\uFF08\`contentType\` \u306F \`text/plain; charset=utf-8\`\uFF09\u3002
|
|
954
956
|
|
|
955
957
|
### Business Logic
|
|
956
958
|
|
|
@@ -114,7 +114,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
114
114
|
/**
|
|
115
115
|
* Create tools for connections that belong to this connector.
|
|
116
116
|
* Filters connections by connectorKey internally.
|
|
117
|
-
* Returns tools keyed as
|
|
117
|
+
* Returns tools keyed as `connector_${connectorKey}_${toolName}`.
|
|
118
118
|
*/
|
|
119
119
|
createTools(connections, config, opts) {
|
|
120
120
|
const myConnections = connections.filter(
|
|
@@ -124,7 +124,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
124
124
|
for (const t of Object.values(this.tools)) {
|
|
125
125
|
const tool = t.createTool(myConnections, config);
|
|
126
126
|
const originalToModelOutput = tool.toModelOutput;
|
|
127
|
-
result[
|
|
127
|
+
result[`connector_${this.connectorKey}_${t.name}`] = {
|
|
128
128
|
...tool,
|
|
129
129
|
toModelOutput: async (options) => {
|
|
130
130
|
if (!originalToModelOutput) {
|
|
@@ -397,14 +397,14 @@ var intercomOauthOnboarding = new ConnectorOnboarding({
|
|
|
397
397
|
- \u30C4\u30FC\u30EB\u9593\u306F1\u6587\u3060\u3051\u66F8\u3044\u3066\u5373\u6B21\u306E\u30C4\u30FC\u30EB\u547C\u3073\u51FA\u3057\u3002\u4E0D\u8981\u306A\u8AAC\u660E\u306F\u7701\u7565\u3057\u3001\u52B9\u7387\u7684\u306B\u9032\u3081\u308B`
|
|
398
398
|
},
|
|
399
399
|
dataOverviewInstructions: {
|
|
400
|
-
en: `1. Call
|
|
401
|
-
2. Call
|
|
402
|
-
3. Call
|
|
403
|
-
4. Call
|
|
404
|
-
ja: `1.
|
|
405
|
-
2.
|
|
406
|
-
3.
|
|
407
|
-
4.
|
|
400
|
+
en: `1. Call connector_intercom-oauth_request with GET /contacts?per_page=5 to explore contacts structure
|
|
401
|
+
2. Call connector_intercom-oauth_request with GET /conversations?per_page=5 to explore conversations structure
|
|
402
|
+
3. Call connector_intercom-oauth_request with GET /data_attributes?model=contact to list contact data attributes
|
|
403
|
+
4. Call connector_intercom-oauth_request with GET /companies?per_page=5 to explore company structure`,
|
|
404
|
+
ja: `1. connector_intercom-oauth_request \u3067 GET /contacts?per_page=5 \u3092\u547C\u3073\u51FA\u3057\u3001\u30B3\u30F3\u30BF\u30AF\u30C8\u306E\u69CB\u9020\u3092\u78BA\u8A8D
|
|
405
|
+
2. connector_intercom-oauth_request \u3067 GET /conversations?per_page=5 \u3092\u547C\u3073\u51FA\u3057\u3001\u4F1A\u8A71\u306E\u69CB\u9020\u3092\u78BA\u8A8D
|
|
406
|
+
3. connector_intercom-oauth_request \u3067 GET /data_attributes?model=contact \u3092\u547C\u3073\u51FA\u3057\u3001\u30B3\u30F3\u30BF\u30AF\u30C8\u306E\u30C7\u30FC\u30BF\u5C5E\u6027\u3092\u78BA\u8A8D
|
|
407
|
+
4. connector_intercom-oauth_request \u3067 GET /companies?per_page=5 \u3092\u547C\u3073\u51FA\u3057\u3001\u4F01\u696D\u306E\u69CB\u9020\u3092\u78BA\u8A8D`
|
|
408
408
|
}
|
|
409
409
|
});
|
|
410
410
|
|
|
@@ -493,6 +493,66 @@ var intercomOauthSetupFlow = {
|
|
|
493
493
|
);
|
|
494
494
|
}
|
|
495
495
|
sections.push("");
|
|
496
|
+
if (targetScopes.includes("conversations")) {
|
|
497
|
+
try {
|
|
498
|
+
const convRes = await apiFetch(
|
|
499
|
+
rt.config.proxyFetch,
|
|
500
|
+
"/conversations?per_page=5&order=desc&sort=updated_at"
|
|
501
|
+
);
|
|
502
|
+
if (convRes.ok) {
|
|
503
|
+
const convData = await convRes.json();
|
|
504
|
+
const conversations = convData.conversations ?? [];
|
|
505
|
+
if (conversations.length > 0) {
|
|
506
|
+
sections.push("### Recent conversations (sample)", "");
|
|
507
|
+
sections.push("| ID | State | Subject | Created |");
|
|
508
|
+
sections.push("|----|-------|---------|---------|");
|
|
509
|
+
for (const c of conversations.slice(0, 5)) {
|
|
510
|
+
const id = c.id ?? "-";
|
|
511
|
+
const state2 = c.state ?? (c.open ? "open" : "closed");
|
|
512
|
+
const subject = (c.source?.subject ?? "-").replace(/\|/g, "\\|").slice(0, 50);
|
|
513
|
+
const created = typeof c.created_at === "number" ? new Date(c.created_at * 1e3).toISOString().slice(0, 10) : "-";
|
|
514
|
+
sections.push(
|
|
515
|
+
`| ${id} | ${state2} | ${subject} | ${created} |`
|
|
516
|
+
);
|
|
517
|
+
}
|
|
518
|
+
sections.push("");
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
} catch {
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
if (targetScopes.includes("contacts")) {
|
|
525
|
+
try {
|
|
526
|
+
const contactRes = await apiFetch(
|
|
527
|
+
rt.config.proxyFetch,
|
|
528
|
+
"/contacts?per_page=50"
|
|
529
|
+
);
|
|
530
|
+
if (contactRes.ok) {
|
|
531
|
+
const contactData = await contactRes.json();
|
|
532
|
+
const contacts = contactData.data ?? [];
|
|
533
|
+
if (contacts.length > 0) {
|
|
534
|
+
const roleCounts = {};
|
|
535
|
+
for (const c of contacts) {
|
|
536
|
+
const role = c.role ?? "unknown";
|
|
537
|
+
roleCounts[role] = (roleCounts[role] ?? 0) + 1;
|
|
538
|
+
}
|
|
539
|
+
sections.push(
|
|
540
|
+
"### Contact type breakdown (from recent contacts)",
|
|
541
|
+
""
|
|
542
|
+
);
|
|
543
|
+
sections.push("| Role | Count |");
|
|
544
|
+
sections.push("|------|-------|");
|
|
545
|
+
for (const [role, cnt] of Object.entries(roleCounts).sort(
|
|
546
|
+
(a, b) => b[1] - a[1]
|
|
547
|
+
)) {
|
|
548
|
+
sections.push(`| ${role} | ${cnt} |`);
|
|
549
|
+
}
|
|
550
|
+
sections.push("");
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
} catch {
|
|
554
|
+
}
|
|
555
|
+
}
|
|
496
556
|
return sections.join("\n");
|
|
497
557
|
}
|
|
498
558
|
};
|
|
@@ -524,7 +584,7 @@ var intercomOauthConnector = new ConnectorPlugin({
|
|
|
524
584
|
systemPrompt: {
|
|
525
585
|
en: `### Tools
|
|
526
586
|
|
|
527
|
-
- \`
|
|
587
|
+
- \`connector_intercom-oauth_request\`: The only way to call the Intercom API. Use it to query contacts, conversations, companies, articles, tags, segments, and more. Authentication is configured automatically via OAuth. The Intercom-Version header is set automatically. Intercom uses cursor-based pagination with the \`starting_after\` parameter from \`pages.next.starting_after\` in the response.
|
|
528
588
|
|
|
529
589
|
### Intercom API Reference
|
|
530
590
|
|
|
@@ -582,7 +642,7 @@ const data = await res.json();
|
|
|
582
642
|
\`\`\``,
|
|
583
643
|
ja: `### \u30C4\u30FC\u30EB
|
|
584
644
|
|
|
585
|
-
- \`
|
|
645
|
+
- \`connector_intercom-oauth_request\`: Intercom API\u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u30B3\u30F3\u30BF\u30AF\u30C8\u3001\u4F1A\u8A71\u3001\u4F01\u696D\u3001\u8A18\u4E8B\u3001\u30BF\u30B0\u3001\u30BB\u30B0\u30E1\u30F3\u30C8\u306A\u3069\u306E\u30AF\u30A8\u30EA\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002OAuth\u7D4C\u7531\u3067\u8A8D\u8A3C\u306F\u81EA\u52D5\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002Intercom-Version\u30D8\u30C3\u30C0\u30FC\u3082\u81EA\u52D5\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002Intercom\u306F\u30EC\u30B9\u30DD\u30F3\u30B9\u306E \`pages.next.starting_after\` \u304B\u3089\u306E \`starting_after\` \u30D1\u30E9\u30E1\u30FC\u30BF\u306B\u3088\u308B\u30AB\u30FC\u30BD\u30EB\u30D9\u30FC\u30B9\u306E\u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\u3092\u4F7F\u7528\u3057\u307E\u3059\u3002
|
|
586
646
|
|
|
587
647
|
### Intercom API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
588
648
|
|
|
@@ -16,6 +16,7 @@ var init_parameter_definition = __esm({
|
|
|
16
16
|
type;
|
|
17
17
|
secret;
|
|
18
18
|
required;
|
|
19
|
+
isDeprecated;
|
|
19
20
|
constructor(config) {
|
|
20
21
|
this.slug = config.slug;
|
|
21
22
|
this.name = config.name;
|
|
@@ -24,6 +25,7 @@ var init_parameter_definition = __esm({
|
|
|
24
25
|
this.type = config.type;
|
|
25
26
|
this.secret = config.secret;
|
|
26
27
|
this.required = config.required;
|
|
28
|
+
this.isDeprecated = config.isDeprecated ?? false;
|
|
27
29
|
}
|
|
28
30
|
/**
|
|
29
31
|
* Get the parameter value from a ConnectorConnectionObject.
|
|
@@ -273,7 +275,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
273
275
|
/**
|
|
274
276
|
* Create tools for connections that belong to this connector.
|
|
275
277
|
* Filters connections by connectorKey internally.
|
|
276
|
-
* Returns tools keyed as
|
|
278
|
+
* Returns tools keyed as `connector_${connectorKey}_${toolName}`.
|
|
277
279
|
*/
|
|
278
280
|
createTools(connections, config, opts) {
|
|
279
281
|
const myConnections = connections.filter(
|
|
@@ -283,7 +285,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
283
285
|
for (const t of Object.values(this.tools)) {
|
|
284
286
|
const tool = t.createTool(myConnections, config);
|
|
285
287
|
const originalToModelOutput = tool.toModelOutput;
|
|
286
|
-
result[
|
|
288
|
+
result[`connector_${this.connectorKey}_${t.name}`] = {
|
|
287
289
|
...tool,
|
|
288
290
|
toModelOutput: async (options) => {
|
|
289
291
|
if (!originalToModelOutput) {
|
|
@@ -413,14 +415,14 @@ var AUTH_TYPES = {
|
|
|
413
415
|
// ../connectors/src/connectors/intercom/setup.ts
|
|
414
416
|
var intercomOnboarding = new ConnectorOnboarding({
|
|
415
417
|
dataOverviewInstructions: {
|
|
416
|
-
en: `1. Call
|
|
417
|
-
2. Call
|
|
418
|
-
3. Call
|
|
419
|
-
4. Call
|
|
420
|
-
ja: `1.
|
|
421
|
-
2.
|
|
422
|
-
3.
|
|
423
|
-
4.
|
|
418
|
+
en: `1. Call connector_intercom_request with GET /contacts?per_page=5 to explore contacts structure
|
|
419
|
+
2. Call connector_intercom_request with GET /conversations?per_page=5 to explore conversations structure
|
|
420
|
+
3. Call connector_intercom_request with GET /data_attributes?model=contact to list contact data attributes
|
|
421
|
+
4. Call connector_intercom_request with GET /companies?per_page=5 to explore company structure`,
|
|
422
|
+
ja: `1. connector_intercom_request \u3067 GET /contacts?per_page=5 \u3092\u547C\u3073\u51FA\u3057\u3001\u30B3\u30F3\u30BF\u30AF\u30C8\u306E\u69CB\u9020\u3092\u78BA\u8A8D
|
|
423
|
+
2. connector_intercom_request \u3067 GET /conversations?per_page=5 \u3092\u547C\u3073\u51FA\u3057\u3001\u4F1A\u8A71\u306E\u69CB\u9020\u3092\u78BA\u8A8D
|
|
424
|
+
3. connector_intercom_request \u3067 GET /data_attributes?model=contact \u3092\u547C\u3073\u51FA\u3057\u3001\u30B3\u30F3\u30BF\u30AF\u30C8\u306E\u30C7\u30FC\u30BF\u5C5E\u6027\u3092\u78BA\u8A8D
|
|
425
|
+
4. connector_intercom_request \u3067 GET /companies?per_page=5 \u3092\u547C\u3073\u51FA\u3057\u3001\u4F01\u696D\u306E\u69CB\u9020\u3092\u78BA\u8A8D`
|
|
424
426
|
}
|
|
425
427
|
});
|
|
426
428
|
|
|
@@ -617,7 +619,7 @@ var intercomConnector = new ConnectorPlugin({
|
|
|
617
619
|
systemPrompt: {
|
|
618
620
|
en: `### Tools
|
|
619
621
|
|
|
620
|
-
- \`
|
|
622
|
+
- \`connector_intercom_request\`: The only way to call the Intercom API. Use it to query contacts, conversations, companies, articles, tags, segments, and more. Authentication (Bearer token) and API version header (Intercom-Version: 2.11) are configured automatically. Intercom uses cursor-based pagination with the \`starting_after\` parameter from \`pages.next.starting_after\` in the response. Use search endpoints (POST) for complex queries with filters.
|
|
621
623
|
|
|
622
624
|
### Business Logic
|
|
623
625
|
|
|
@@ -713,7 +715,7 @@ export default async function handler(c: Context) {
|
|
|
713
715
|
- Date fields use Unix timestamps`,
|
|
714
716
|
ja: `### \u30C4\u30FC\u30EB
|
|
715
717
|
|
|
716
|
-
- \`
|
|
718
|
+
- \`connector_intercom_request\`: Intercom API\u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u30B3\u30F3\u30BF\u30AF\u30C8\u3001\u4F1A\u8A71\u3001\u4F01\u696D\u3001\u8A18\u4E8B\u3001\u30BF\u30B0\u3001\u30BB\u30B0\u30E1\u30F3\u30C8\u306A\u3069\u306E\u30AF\u30A8\u30EA\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u8A8D\u8A3C\uFF08Bearer\u30C8\u30FC\u30AF\u30F3\uFF09\u3068API\u30D0\u30FC\u30B8\u30E7\u30F3\u30D8\u30C3\u30C0\u30FC\uFF08Intercom-Version: 2.11\uFF09\u306F\u81EA\u52D5\u7684\u306B\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002Intercom\u306F\u30EC\u30B9\u30DD\u30F3\u30B9\u306E \`pages.next.starting_after\` \u304B\u3089\u306E \`starting_after\` \u30D1\u30E9\u30E1\u30FC\u30BF\u306B\u3088\u308B\u30AB\u30FC\u30BD\u30EB\u30D9\u30FC\u30B9\u306E\u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\u3092\u4F7F\u7528\u3057\u307E\u3059\u3002\u8907\u96D1\u306A\u30AF\u30A8\u30EA\u306B\u306Fsearch\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\uFF08POST\uFF09\u3092\u4F7F\u7528\u3057\u307E\u3059\u3002
|
|
717
719
|
|
|
718
720
|
### Business Logic
|
|
719
721
|
|
package/dist/connectors/jdbc.js
CHANGED
|
@@ -21,6 +21,7 @@ var init_parameter_definition = __esm({
|
|
|
21
21
|
type;
|
|
22
22
|
secret;
|
|
23
23
|
required;
|
|
24
|
+
isDeprecated;
|
|
24
25
|
constructor(config) {
|
|
25
26
|
this.slug = config.slug;
|
|
26
27
|
this.name = config.name;
|
|
@@ -29,6 +30,7 @@ var init_parameter_definition = __esm({
|
|
|
29
30
|
this.type = config.type;
|
|
30
31
|
this.secret = config.secret;
|
|
31
32
|
this.required = config.required;
|
|
33
|
+
this.isDeprecated = config.isDeprecated ?? false;
|
|
32
34
|
}
|
|
33
35
|
/**
|
|
34
36
|
* Get the parameter value from a ConnectorConnectionObject.
|
|
@@ -1021,7 +1023,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
1021
1023
|
/**
|
|
1022
1024
|
* Create tools for connections that belong to this connector.
|
|
1023
1025
|
* Filters connections by connectorKey internally.
|
|
1024
|
-
* Returns tools keyed as
|
|
1026
|
+
* Returns tools keyed as `connector_${connectorKey}_${toolName}`.
|
|
1025
1027
|
*/
|
|
1026
1028
|
createTools(connections, config, opts) {
|
|
1027
1029
|
const myConnections = connections.filter(
|
|
@@ -1031,7 +1033,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
1031
1033
|
for (const t of Object.values(this.tools)) {
|
|
1032
1034
|
const tool = t.createTool(myConnections, config);
|
|
1033
1035
|
const originalToModelOutput = tool.toModelOutput;
|
|
1034
|
-
result[
|
|
1036
|
+
result[`connector_${this.connectorKey}_${t.name}`] = {
|
|
1035
1037
|
...tool,
|
|
1036
1038
|
toModelOutput: async (options) => {
|
|
1037
1039
|
if (!originalToModelOutput) {
|
|
@@ -1169,13 +1171,13 @@ init_utils2();
|
|
|
1169
1171
|
// ../connectors/src/connectors/jdbc/setup.ts
|
|
1170
1172
|
var jdbcOnboarding = new ConnectorOnboarding({
|
|
1171
1173
|
dataOverviewInstructions: {
|
|
1172
|
-
en: `1. Use \`
|
|
1174
|
+
en: `1. Use \`connector_jdbc_executeQuery\` to detect the database flavor: \`SELECT version()\` (works on PostgreSQL/MySQL/MariaDB)
|
|
1173
1175
|
2. List tables:
|
|
1174
1176
|
- PostgreSQL: \`SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'\`
|
|
1175
1177
|
- MySQL/MariaDB: \`SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE()\`
|
|
1176
1178
|
3. For key tables, fetch column info from \`information_schema.columns\`
|
|
1177
1179
|
4. Sample up to 3 tables with \`SELECT * FROM <table_name> LIMIT 5\` if column info alone is insufficient`,
|
|
1178
|
-
ja: `1. \`
|
|
1180
|
+
ja: `1. \`connector_jdbc_executeQuery\` \u3067DB\u30D5\u30EC\u30FC\u30D0\u30FC\u3092\u5224\u5B9A: \`SELECT version()\` (PostgreSQL/MySQL/MariaDB \u3067\u52D5\u4F5C)
|
|
1179
1181
|
2. \u30C6\u30FC\u30D6\u30EB\u4E00\u89A7\u3092\u53D6\u5F97:
|
|
1180
1182
|
- PostgreSQL: \`SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'\`
|
|
1181
1183
|
- MySQL/MariaDB: \`SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE()\`
|
|
@@ -1695,7 +1697,7 @@ var jdbcConnector = new ConnectorPlugin({
|
|
|
1695
1697
|
systemPrompt: {
|
|
1696
1698
|
en: `### Tools
|
|
1697
1699
|
|
|
1698
|
-
- \`
|
|
1700
|
+
- \`connector_jdbc_executeQuery\`: Executes a SQL query through a JDBC URL and returns rows. The connector dispatches by URL prefix to the matching native driver, so use the dialect that matches the connection. Use this for schema exploration via \`information_schema\` (or vendor equivalent) and for sampling data. See the SQL Reference below.
|
|
1699
1701
|
|
|
1700
1702
|
### Business Logic
|
|
1701
1703
|
|
|
@@ -1727,7 +1729,7 @@ Explicitly **not** supported via this connector \u2014 use the dedicated connect
|
|
|
1727
1729
|
The platform's server-logic schema inference may wrap your query as \`SELECT * FROM (<inner>) AS _sq LIMIT N\` (PostgreSQL/MySQL syntax). For PostgreSQL / Redshift / MySQL routes this executes natively. For \`jdbc:sqlserver://\` and \`jdbc:oracle:thin:\` routes, the connector detects this exact wrapper at \`query()\` time, executes \`<inner>\` directly via the dialect-specific driver, and slices the first N rows in JS. You do not need to handle this \u2014 but in queries **you author**, do not use \`LIMIT\` for the SQL Server / Oracle routes; use \`TOP\` / \`FETCH FIRST\` as listed above.`,
|
|
1728
1730
|
ja: `### \u30C4\u30FC\u30EB
|
|
1729
1731
|
|
|
1730
|
-
- \`
|
|
1732
|
+
- \`connector_jdbc_executeQuery\`: JDBC URL \u7D4C\u7531\u3067 SQL \u30AF\u30A8\u30EA\u3092\u5B9F\u884C\u3057\u3001\u884C\u30C7\u30FC\u30BF\u3092\u8FD4\u3057\u307E\u3059\u3002\u30B3\u30CD\u30AF\u30BF\u306F URL \u30D7\u30EC\u30D5\u30A3\u30C3\u30AF\u30B9\u304B\u3089\u5BFE\u5FDC\u3059\u308B\u30CD\u30A4\u30C6\u30A3\u30D6\u30C9\u30E9\u30A4\u30D0\u3078\u632F\u308A\u5206\u3051\u308B\u305F\u3081\u3001\u63A5\u7D9A\u5148\u306B\u5408\u3063\u305F\u65B9\u8A00\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002\`information_schema\`\uFF08\u307E\u305F\u306F\u5404 DB \u306E\u540C\u7B49\u306E\u30E1\u30BF\u30C7\u30FC\u30BF\u30D3\u30E5\u30FC\uFF09\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\u3002\u4E0B\u90E8\u306E\u300CSQL \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9\u300D\u3092\u53C2\u7167\u3057\u3066\u304F\u3060\u3055\u3044\u3002
|
|
1731
1733
|
|
|
1732
1734
|
### Business Logic
|
|
1733
1735
|
|
|
@@ -16,6 +16,7 @@ var init_parameter_definition = __esm({
|
|
|
16
16
|
type;
|
|
17
17
|
secret;
|
|
18
18
|
required;
|
|
19
|
+
isDeprecated;
|
|
19
20
|
constructor(config) {
|
|
20
21
|
this.slug = config.slug;
|
|
21
22
|
this.name = config.name;
|
|
@@ -24,6 +25,7 @@ var init_parameter_definition = __esm({
|
|
|
24
25
|
this.type = config.type;
|
|
25
26
|
this.secret = config.secret;
|
|
26
27
|
this.required = config.required;
|
|
28
|
+
this.isDeprecated = config.isDeprecated ?? false;
|
|
27
29
|
}
|
|
28
30
|
/**
|
|
29
31
|
* Get the parameter value from a ConnectorConnectionObject.
|
|
@@ -222,7 +224,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
222
224
|
/**
|
|
223
225
|
* Create tools for connections that belong to this connector.
|
|
224
226
|
* Filters connections by connectorKey internally.
|
|
225
|
-
* Returns tools keyed as
|
|
227
|
+
* Returns tools keyed as `connector_${connectorKey}_${toolName}`.
|
|
226
228
|
*/
|
|
227
229
|
createTools(connections, config, opts) {
|
|
228
230
|
const myConnections = connections.filter(
|
|
@@ -232,7 +234,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
232
234
|
for (const t of Object.values(this.tools)) {
|
|
233
235
|
const tool = t.createTool(myConnections, config);
|
|
234
236
|
const originalToModelOutput = tool.toModelOutput;
|
|
235
|
-
result[
|
|
237
|
+
result[`connector_${this.connectorKey}_${t.name}`] = {
|
|
236
238
|
...tool,
|
|
237
239
|
toModelOutput: async (options) => {
|
|
238
240
|
if (!originalToModelOutput) {
|
|
@@ -362,12 +364,12 @@ var AUTH_TYPES = {
|
|
|
362
364
|
// ../connectors/src/connectors/jira/setup.ts
|
|
363
365
|
var jiraOnboarding = new ConnectorOnboarding({
|
|
364
366
|
dataOverviewInstructions: {
|
|
365
|
-
en: `1. Call
|
|
366
|
-
2. For key projects, call
|
|
367
|
-
3. Call
|
|
368
|
-
ja: `1.
|
|
369
|
-
2. \u4E3B\u8981\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306B\u3064\u3044\u3066
|
|
370
|
-
3.
|
|
367
|
+
en: `1. Call connector_jira-api-key_request with GET project to list all accessible projects
|
|
368
|
+
2. For key projects, call connector_jira-api-key_request with POST search to search issues using JQL (e.g., body: { "jql": "project = PROJ order by created DESC", "maxResults": 5, "fields": ["summary", "status", "assignee", "priority", "created"] })
|
|
369
|
+
3. Call connector_jira-api-key_request with GET issue/{issueKey} to inspect a sample issue's full details`,
|
|
370
|
+
ja: `1. connector_jira-api-key_request \u3067 GET project \u3092\u547C\u3073\u51FA\u3057\u3001\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306A\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u4E00\u89A7\u3092\u53D6\u5F97
|
|
371
|
+
2. \u4E3B\u8981\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306B\u3064\u3044\u3066 connector_jira-api-key_request \u3067 POST search \u3092\u4F7F\u7528\u3057\u3066JQL\u3067\u30A4\u30B7\u30E5\u30FC\u3092\u691C\u7D22\uFF08\u4F8B: body: { "jql": "project = PROJ order by created DESC", "maxResults": 5, "fields": ["summary", "status", "assignee", "priority", "created"] }\uFF09
|
|
372
|
+
3. connector_jira-api-key_request \u3067 GET issue/{issueKey} \u3092\u547C\u3073\u51FA\u3057\u3001\u30B5\u30F3\u30D7\u30EB\u30A4\u30B7\u30E5\u30FC\u306E\u8A73\u7D30\u3092\u78BA\u8A8D`
|
|
371
373
|
}
|
|
372
374
|
});
|
|
373
375
|
|
|
@@ -429,6 +431,43 @@ async function getProject(params, keyOrId) {
|
|
|
429
431
|
}
|
|
430
432
|
return await res.json();
|
|
431
433
|
}
|
|
434
|
+
async function fetchProjectIssueCount(params, projectKey) {
|
|
435
|
+
try {
|
|
436
|
+
const jql = encodeURIComponent(`project = ${projectKey}`);
|
|
437
|
+
const res = await apiFetch(
|
|
438
|
+
params,
|
|
439
|
+
`search?jql=${jql}&maxResults=0`
|
|
440
|
+
);
|
|
441
|
+
if (!res.ok) return null;
|
|
442
|
+
const data = await res.json();
|
|
443
|
+
return typeof data.total === "number" ? data.total : null;
|
|
444
|
+
} catch {
|
|
445
|
+
return null;
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
async function fetchStatusBreakdown(params, projectKey) {
|
|
449
|
+
try {
|
|
450
|
+
const jql = encodeURIComponent(
|
|
451
|
+
`project = ${projectKey} ORDER BY created DESC`
|
|
452
|
+
);
|
|
453
|
+
const res = await apiFetch(
|
|
454
|
+
params,
|
|
455
|
+
`search?jql=${jql}&maxResults=100&fields=status`
|
|
456
|
+
);
|
|
457
|
+
if (!res.ok) return null;
|
|
458
|
+
const data = await res.json();
|
|
459
|
+
const issues = data.issues ?? [];
|
|
460
|
+
if (issues.length === 0) return null;
|
|
461
|
+
const breakdown = {};
|
|
462
|
+
for (const issue of issues) {
|
|
463
|
+
const category = issue.fields?.status?.statusCategory?.name ?? "Unknown";
|
|
464
|
+
breakdown[category] = (breakdown[category] ?? 0) + 1;
|
|
465
|
+
}
|
|
466
|
+
return breakdown;
|
|
467
|
+
} catch {
|
|
468
|
+
return null;
|
|
469
|
+
}
|
|
470
|
+
}
|
|
432
471
|
var jiraSetupFlow = {
|
|
433
472
|
initialState: () => ({}),
|
|
434
473
|
steps: [
|
|
@@ -469,17 +508,37 @@ var jiraSetupFlow = {
|
|
|
469
508
|
const sections = ["## Jira", ""];
|
|
470
509
|
for (const key of targetKeys) {
|
|
471
510
|
const project = await getProject(rt.params, key);
|
|
472
|
-
|
|
511
|
+
const issueCount = await fetchProjectIssueCount(rt.params, key);
|
|
512
|
+
const countLabel = issueCount == null ? "" : ` - ${issueCount.toLocaleString()} issues`;
|
|
513
|
+
sections.push(
|
|
514
|
+
`### Project: ${project.name} (${project.key})${countLabel}`,
|
|
515
|
+
""
|
|
516
|
+
);
|
|
473
517
|
const lead = project.lead?.displayName ?? "-";
|
|
474
518
|
const typeKey = project.projectTypeKey ?? "-";
|
|
475
519
|
sections.push(`- Lead: ${lead}`);
|
|
476
520
|
sections.push(`- Project type: ${typeKey}`);
|
|
521
|
+
if (issueCount != null) {
|
|
522
|
+
sections.push(`- Total issues: ${issueCount.toLocaleString()}`);
|
|
523
|
+
}
|
|
477
524
|
const issueTypes = project.issueTypes ?? [];
|
|
478
525
|
sections.push(`- Issue types (${issueTypes.length}):`);
|
|
479
526
|
for (const it of issueTypes) {
|
|
480
527
|
const suffix = it.subtask ? " (sub-task)" : "";
|
|
481
528
|
sections.push(` - ${it.name}${suffix}`);
|
|
482
529
|
}
|
|
530
|
+
const breakdown = await fetchStatusBreakdown(rt.params, key);
|
|
531
|
+
if (breakdown && Object.keys(breakdown).length > 0) {
|
|
532
|
+
sections.push("");
|
|
533
|
+
sections.push("**Status category breakdown (from recent 100 issues):**", "");
|
|
534
|
+
sections.push("| Status category | Count |");
|
|
535
|
+
sections.push("|-----------------|-------|");
|
|
536
|
+
for (const [category, count] of Object.entries(breakdown).sort(
|
|
537
|
+
(a, b) => b[1] - a[1]
|
|
538
|
+
)) {
|
|
539
|
+
sections.push(`| ${category} | ${count} |`);
|
|
540
|
+
}
|
|
541
|
+
}
|
|
483
542
|
sections.push("");
|
|
484
543
|
}
|
|
485
544
|
return sections.join("\n");
|
|
@@ -578,7 +637,7 @@ var jiraConnector = new ConnectorPlugin({
|
|
|
578
637
|
systemPrompt: {
|
|
579
638
|
en: `### Tools
|
|
580
639
|
|
|
581
|
-
- \`
|
|
640
|
+
- \`connector_jira-api-key_request\`: The only way to call the Jira Cloud REST API (v3). Use it to list projects, search issues with JQL, get issue details, create/update issues, manage transitions, and add comments. Authentication (Basic Auth with email + API token) and instance URL are configured automatically.
|
|
582
641
|
|
|
583
642
|
### Business Logic
|
|
584
643
|
|
|
@@ -648,7 +707,7 @@ await jira.request("/rest/api/3/issue", {
|
|
|
648
707
|
- Text search: summary ~ "keyword"`,
|
|
649
708
|
ja: `### \u30C4\u30FC\u30EB
|
|
650
709
|
|
|
651
|
-
- \`
|
|
710
|
+
- \`connector_jira-api-key_request\`: Jira Cloud REST API\uFF08v3\uFF09\u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u4E00\u89A7\u306E\u53D6\u5F97\u3001JQL\u306B\u3088\u308B\u30A4\u30B7\u30E5\u30FC\u691C\u7D22\u3001\u30A4\u30B7\u30E5\u30FC\u8A73\u7D30\u306E\u53D6\u5F97\u3001\u30A4\u30B7\u30E5\u30FC\u306E\u4F5C\u6210\u30FB\u66F4\u65B0\u3001\u30C8\u30E9\u30F3\u30B8\u30B7\u30E7\u30F3\u7BA1\u7406\u3001\u30B3\u30E1\u30F3\u30C8\u8FFD\u52A0\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u8A8D\u8A3C\uFF08Basic Auth: \u30E1\u30FC\u30EB + API\u30C8\u30FC\u30AF\u30F3\uFF09\u3068\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9URL\u306F\u81EA\u52D5\u7684\u306B\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002
|
|
652
711
|
|
|
653
712
|
### Business Logic
|
|
654
713
|
|