@squadbase/vite-server 0.1.7 → 0.1.8-dev.468a970
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/cpufeatures-ORCDQN2Y.node +0 -0
- package/dist/cli/index.js +676 -623
- package/dist/cli/sshcrypto-P3UBA7BP.node +0 -0
- package/dist/connectors/gmail.js +214 -348
- package/dist/connectors/google-calendar.js +398 -449
- package/dist/connectors/salesforce.js +1 -1
- package/dist/cpufeatures-ORCDQN2Y.node +0 -0
- package/dist/index.js +676 -623
- package/dist/main.js +676 -623
- package/dist/sshcrypto-P3UBA7BP.node +0 -0
- package/dist/vite-plugin.js +676 -623
- package/package.json +4 -3
- package/dist/cli/cpufeatures-FL6HDURN.node +0 -0
- package/dist/cli/sshcrypto-XARBAYLB.node +0 -0
- package/dist/cpufeatures-FL6HDURN.node +0 -0
- package/dist/sshcrypto-XARBAYLB.node +0 -0
package/dist/vite-plugin.js
CHANGED
|
@@ -2805,22 +2805,22 @@ var require_nacl_fast = __commonJS({
|
|
|
2805
2805
|
randombytes = fn;
|
|
2806
2806
|
};
|
|
2807
2807
|
(function() {
|
|
2808
|
-
var
|
|
2809
|
-
if (
|
|
2808
|
+
var crypto8 = typeof self !== "undefined" ? self.crypto || self.msCrypto : null;
|
|
2809
|
+
if (crypto8 && crypto8.getRandomValues) {
|
|
2810
2810
|
var QUOTA = 65536;
|
|
2811
2811
|
nacl.setPRNG(function(x6, n6) {
|
|
2812
2812
|
var i6, v7 = new Uint8Array(n6);
|
|
2813
2813
|
for (i6 = 0; i6 < n6; i6 += QUOTA) {
|
|
2814
|
-
|
|
2814
|
+
crypto8.getRandomValues(v7.subarray(i6, i6 + Math.min(n6 - i6, QUOTA)));
|
|
2815
2815
|
}
|
|
2816
2816
|
for (i6 = 0; i6 < n6; i6++) x6[i6] = v7[i6];
|
|
2817
2817
|
cleanup(v7);
|
|
2818
2818
|
});
|
|
2819
2819
|
} else if (typeof __require !== "undefined") {
|
|
2820
|
-
|
|
2821
|
-
if (
|
|
2820
|
+
crypto8 = __require("crypto");
|
|
2821
|
+
if (crypto8 && crypto8.randomBytes) {
|
|
2822
2822
|
nacl.setPRNG(function(x6, n6) {
|
|
2823
|
-
var i6, v7 =
|
|
2823
|
+
var i6, v7 = crypto8.randomBytes(n6);
|
|
2824
2824
|
for (i6 = 0; i6 < n6; i6++) x6[i6] = v7[i6];
|
|
2825
2825
|
cleanup(v7);
|
|
2826
2826
|
});
|
|
@@ -4088,13 +4088,13 @@ var require_bcrypt_pbkdf = __commonJS({
|
|
|
4088
4088
|
var cpufeatures_default;
|
|
4089
4089
|
var init_cpufeatures = __esm({
|
|
4090
4090
|
"../../node_modules/cpu-features/build/Release/cpufeatures.node"() {
|
|
4091
|
-
cpufeatures_default = "./cpufeatures-
|
|
4091
|
+
cpufeatures_default = "./cpufeatures-ORCDQN2Y.node";
|
|
4092
4092
|
}
|
|
4093
4093
|
});
|
|
4094
4094
|
|
|
4095
|
-
// node-file:/
|
|
4095
|
+
// node-file:/home/runner/work/squadbase-monorepo/squadbase-monorepo/node_modules/cpu-features/build/Release/cpufeatures.node
|
|
4096
4096
|
var require_cpufeatures = __commonJS({
|
|
4097
|
-
"node-file:/
|
|
4097
|
+
"node-file:/home/runner/work/squadbase-monorepo/squadbase-monorepo/node_modules/cpu-features/build/Release/cpufeatures.node"(exports2, module) {
|
|
4098
4098
|
"use strict";
|
|
4099
4099
|
init_cpufeatures();
|
|
4100
4100
|
try {
|
|
@@ -4117,7 +4117,7 @@ var require_lib2 = __commonJS({
|
|
|
4117
4117
|
var require_constants = __commonJS({
|
|
4118
4118
|
"../../node_modules/ssh2/lib/protocol/constants.js"(exports2, module) {
|
|
4119
4119
|
"use strict";
|
|
4120
|
-
var
|
|
4120
|
+
var crypto8 = __require("crypto");
|
|
4121
4121
|
var cpuInfo;
|
|
4122
4122
|
try {
|
|
4123
4123
|
cpuInfo = require_lib2()();
|
|
@@ -4125,21 +4125,21 @@ var require_constants = __commonJS({
|
|
|
4125
4125
|
}
|
|
4126
4126
|
var { bindingAvailable, CIPHER_INFO, MAC_INFO } = require_crypto();
|
|
4127
4127
|
var eddsaSupported = (() => {
|
|
4128
|
-
if (typeof
|
|
4128
|
+
if (typeof crypto8.sign === "function" && typeof crypto8.verify === "function") {
|
|
4129
4129
|
const key = "-----BEGIN PRIVATE KEY-----\r\nMC4CAQAwBQYDK2VwBCIEIHKj+sVa9WcD/q2DJUJaf43Kptc8xYuUQA4bOFj9vC8T\r\n-----END PRIVATE KEY-----";
|
|
4130
4130
|
const data = Buffer.from("a");
|
|
4131
4131
|
let sig;
|
|
4132
4132
|
let verified;
|
|
4133
4133
|
try {
|
|
4134
|
-
sig =
|
|
4135
|
-
verified =
|
|
4134
|
+
sig = crypto8.sign(null, data, key);
|
|
4135
|
+
verified = crypto8.verify(null, data, key, sig);
|
|
4136
4136
|
} catch {
|
|
4137
4137
|
}
|
|
4138
4138
|
return Buffer.isBuffer(sig) && sig.length === 64 && verified === true;
|
|
4139
4139
|
}
|
|
4140
4140
|
return false;
|
|
4141
4141
|
})();
|
|
4142
|
-
var curve25519Supported = typeof
|
|
4142
|
+
var curve25519Supported = typeof crypto8.diffieHellman === "function" && typeof crypto8.generateKeyPairSync === "function" && typeof crypto8.createPublicKey === "function";
|
|
4143
4143
|
var DEFAULT_KEX = [
|
|
4144
4144
|
// https://tools.ietf.org/html/rfc5656#section-10.1
|
|
4145
4145
|
"ecdh-sha2-nistp256",
|
|
@@ -4182,7 +4182,7 @@ var require_constants = __commonJS({
|
|
|
4182
4182
|
"ssh-dss"
|
|
4183
4183
|
]);
|
|
4184
4184
|
var canUseCipher = (() => {
|
|
4185
|
-
const ciphers =
|
|
4185
|
+
const ciphers = crypto8.getCiphers();
|
|
4186
4186
|
return (name) => ciphers.includes(CIPHER_INFO[name].sslName);
|
|
4187
4187
|
})();
|
|
4188
4188
|
var DEFAULT_CIPHER = [
|
|
@@ -4220,7 +4220,7 @@ var require_constants = __commonJS({
|
|
|
4220
4220
|
"arcfour"
|
|
4221
4221
|
].filter(canUseCipher));
|
|
4222
4222
|
var canUseMAC = (() => {
|
|
4223
|
-
const hashes =
|
|
4223
|
+
const hashes = crypto8.getHashes();
|
|
4224
4224
|
return (name) => hashes.includes(MAC_INFO[name].sslName);
|
|
4225
4225
|
})();
|
|
4226
4226
|
var DEFAULT_MAC = [
|
|
@@ -4826,13 +4826,13 @@ var require_utils = __commonJS({
|
|
|
4826
4826
|
var sshcrypto_default;
|
|
4827
4827
|
var init_sshcrypto = __esm({
|
|
4828
4828
|
"../../node_modules/ssh2/lib/protocol/crypto/build/Release/sshcrypto.node"() {
|
|
4829
|
-
sshcrypto_default = "./sshcrypto-
|
|
4829
|
+
sshcrypto_default = "./sshcrypto-P3UBA7BP.node";
|
|
4830
4830
|
}
|
|
4831
4831
|
});
|
|
4832
4832
|
|
|
4833
|
-
// node-file:/
|
|
4833
|
+
// node-file:/home/runner/work/squadbase-monorepo/squadbase-monorepo/node_modules/ssh2/lib/protocol/crypto/build/Release/sshcrypto.node
|
|
4834
4834
|
var require_sshcrypto = __commonJS({
|
|
4835
|
-
"node-file:/
|
|
4835
|
+
"node-file:/home/runner/work/squadbase-monorepo/squadbase-monorepo/node_modules/ssh2/lib/protocol/crypto/build/Release/sshcrypto.node"(exports2, module) {
|
|
4836
4836
|
"use strict";
|
|
4837
4837
|
init_sshcrypto();
|
|
4838
4838
|
try {
|
|
@@ -6604,7 +6604,7 @@ var require_keyParser = __commonJS({
|
|
|
6604
6604
|
createECDH,
|
|
6605
6605
|
createHash: createHash4,
|
|
6606
6606
|
createHmac: createHmac2,
|
|
6607
|
-
createSign
|
|
6607
|
+
createSign,
|
|
6608
6608
|
createVerify,
|
|
6609
6609
|
getCiphers,
|
|
6610
6610
|
sign: sign_,
|
|
@@ -6905,7 +6905,7 @@ ${formatted}-----END ${type} KEY-----`;
|
|
|
6905
6905
|
return new Error("No private key available");
|
|
6906
6906
|
if (!algo || typeof algo !== "string")
|
|
6907
6907
|
algo = this[SYM_HASH_ALGO];
|
|
6908
|
-
const signature =
|
|
6908
|
+
const signature = createSign(algo);
|
|
6909
6909
|
signature.update(data);
|
|
6910
6910
|
try {
|
|
6911
6911
|
return signature.sign(pem);
|
|
@@ -20414,8 +20414,8 @@ var require_bson = __commonJS({
|
|
|
20414
20414
|
return crypto.getRandomValues(nodeJsByteUtils.allocate(byteLength));
|
|
20415
20415
|
}
|
|
20416
20416
|
var nodejsRandomBytes = (() => {
|
|
20417
|
-
const { crypto:
|
|
20418
|
-
if (
|
|
20417
|
+
const { crypto: crypto8 } = globalThis;
|
|
20418
|
+
if (crypto8 != null && typeof crypto8.getRandomValues === "function") {
|
|
20419
20419
|
return nodejsSecureRandomBytes;
|
|
20420
20420
|
} else {
|
|
20421
20421
|
return nodejsMathRandomBytes;
|
|
@@ -20520,10 +20520,10 @@ var require_bson = __commonJS({
|
|
|
20520
20520
|
return webByteUtils.fromNumberArray(Array.from({ length: byteLength }, () => Math.floor(Math.random() * 256)));
|
|
20521
20521
|
}
|
|
20522
20522
|
var webRandomBytes = (() => {
|
|
20523
|
-
const { crypto:
|
|
20524
|
-
if (
|
|
20523
|
+
const { crypto: crypto8 } = globalThis;
|
|
20524
|
+
if (crypto8 != null && typeof crypto8.getRandomValues === "function") {
|
|
20525
20525
|
return (byteLength) => {
|
|
20526
|
-
return
|
|
20526
|
+
return crypto8.getRandomValues(webByteUtils.allocate(byteLength));
|
|
20527
20527
|
};
|
|
20528
20528
|
} else {
|
|
20529
20529
|
if (isReactNative()) {
|
|
@@ -27025,7 +27025,7 @@ var require_utils3 = __commonJS({
|
|
|
27025
27025
|
exports2.decorateDecryptionResult = decorateDecryptionResult;
|
|
27026
27026
|
exports2.addAbortListener = addAbortListener;
|
|
27027
27027
|
exports2.abortable = abortable;
|
|
27028
|
-
var
|
|
27028
|
+
var crypto8 = __require("crypto");
|
|
27029
27029
|
var fs_1 = __require("fs");
|
|
27030
27030
|
var http2 = __require("http");
|
|
27031
27031
|
var process2 = __require("process");
|
|
@@ -27185,7 +27185,7 @@ var require_utils3 = __commonJS({
|
|
|
27185
27185
|
}
|
|
27186
27186
|
}
|
|
27187
27187
|
function uuidV4() {
|
|
27188
|
-
const result =
|
|
27188
|
+
const result = crypto8.randomBytes(16);
|
|
27189
27189
|
result[6] = result[6] & 15 | 64;
|
|
27190
27190
|
result[8] = result[8] & 63 | 128;
|
|
27191
27191
|
return result;
|
|
@@ -27737,7 +27737,7 @@ var require_utils3 = __commonJS({
|
|
|
27737
27737
|
}
|
|
27738
27738
|
var randomBytes = (size) => {
|
|
27739
27739
|
return new Promise((resolve, reject) => {
|
|
27740
|
-
|
|
27740
|
+
crypto8.randomBytes(size, (error2, buf) => {
|
|
27741
27741
|
if (error2)
|
|
27742
27742
|
return reject(error2);
|
|
27743
27743
|
resolve(buf);
|
|
@@ -39490,12 +39490,12 @@ var init_date_utils = __esm({
|
|
|
39490
39490
|
});
|
|
39491
39491
|
|
|
39492
39492
|
// ../../node_modules/@smithy/uuid/dist-es/randomUUID.js
|
|
39493
|
-
import
|
|
39493
|
+
import crypto3 from "crypto";
|
|
39494
39494
|
var randomUUID;
|
|
39495
39495
|
var init_randomUUID = __esm({
|
|
39496
39496
|
"../../node_modules/@smithy/uuid/dist-es/randomUUID.js"() {
|
|
39497
39497
|
"use strict";
|
|
39498
|
-
randomUUID =
|
|
39498
|
+
randomUUID = crypto3.randomUUID.bind(crypto3);
|
|
39499
39499
|
}
|
|
39500
39500
|
});
|
|
39501
39501
|
|
|
@@ -61429,10 +61429,10 @@ var require_retry = __commonJS({
|
|
|
61429
61429
|
});
|
|
61430
61430
|
|
|
61431
61431
|
// ../../node_modules/gaxios/node_modules/uuid/dist/esm-node/rng.js
|
|
61432
|
-
import
|
|
61432
|
+
import crypto4 from "crypto";
|
|
61433
61433
|
function rng() {
|
|
61434
61434
|
if (poolPtr > rnds8Pool.length - 16) {
|
|
61435
|
-
|
|
61435
|
+
crypto4.randomFillSync(rnds8Pool);
|
|
61436
61436
|
poolPtr = 0;
|
|
61437
61437
|
}
|
|
61438
61438
|
return rnds8Pool.slice(poolPtr, poolPtr += 16);
|
|
@@ -61643,14 +61643,14 @@ var init_v35 = __esm({
|
|
|
61643
61643
|
});
|
|
61644
61644
|
|
|
61645
61645
|
// ../../node_modules/gaxios/node_modules/uuid/dist/esm-node/md5.js
|
|
61646
|
-
import
|
|
61646
|
+
import crypto5 from "crypto";
|
|
61647
61647
|
function md5(bytes) {
|
|
61648
61648
|
if (Array.isArray(bytes)) {
|
|
61649
61649
|
bytes = Buffer.from(bytes);
|
|
61650
61650
|
} else if (typeof bytes === "string") {
|
|
61651
61651
|
bytes = Buffer.from(bytes, "utf8");
|
|
61652
61652
|
}
|
|
61653
|
-
return
|
|
61653
|
+
return crypto5.createHash("md5").update(bytes).digest();
|
|
61654
61654
|
}
|
|
61655
61655
|
var md5_default;
|
|
61656
61656
|
var init_md5 = __esm({
|
|
@@ -61673,13 +61673,13 @@ var init_v3 = __esm({
|
|
|
61673
61673
|
});
|
|
61674
61674
|
|
|
61675
61675
|
// ../../node_modules/gaxios/node_modules/uuid/dist/esm-node/native.js
|
|
61676
|
-
import
|
|
61676
|
+
import crypto6 from "crypto";
|
|
61677
61677
|
var native_default;
|
|
61678
61678
|
var init_native = __esm({
|
|
61679
61679
|
"../../node_modules/gaxios/node_modules/uuid/dist/esm-node/native.js"() {
|
|
61680
61680
|
"use strict";
|
|
61681
61681
|
native_default = {
|
|
61682
|
-
randomUUID:
|
|
61682
|
+
randomUUID: crypto6.randomUUID
|
|
61683
61683
|
};
|
|
61684
61684
|
}
|
|
61685
61685
|
});
|
|
@@ -61714,14 +61714,14 @@ var init_v42 = __esm({
|
|
|
61714
61714
|
});
|
|
61715
61715
|
|
|
61716
61716
|
// ../../node_modules/gaxios/node_modules/uuid/dist/esm-node/sha1.js
|
|
61717
|
-
import
|
|
61717
|
+
import crypto7 from "crypto";
|
|
61718
61718
|
function sha1(bytes) {
|
|
61719
61719
|
if (Array.isArray(bytes)) {
|
|
61720
61720
|
bytes = Buffer.from(bytes);
|
|
61721
61721
|
} else if (typeof bytes === "string") {
|
|
61722
61722
|
bytes = Buffer.from(bytes, "utf8");
|
|
61723
61723
|
}
|
|
61724
|
-
return
|
|
61724
|
+
return crypto7.createHash("sha1").update(bytes).digest();
|
|
61725
61725
|
}
|
|
61726
61726
|
var sha1_default;
|
|
61727
61727
|
var init_sha1 = __esm({
|
|
@@ -82405,7 +82405,7 @@ var require_scram = __commonJS({
|
|
|
82405
82405
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
82406
82406
|
exports2.ScramSHA256 = exports2.ScramSHA1 = void 0;
|
|
82407
82407
|
var saslprep_1 = require_node2();
|
|
82408
|
-
var
|
|
82408
|
+
var crypto8 = __require("crypto");
|
|
82409
82409
|
var bson_1 = require_bson2();
|
|
82410
82410
|
var error_1 = require_error();
|
|
82411
82411
|
var utils_1 = require_utils3();
|
|
@@ -82558,9 +82558,9 @@ var require_scram = __commonJS({
|
|
|
82558
82558
|
}
|
|
82559
82559
|
let md52;
|
|
82560
82560
|
try {
|
|
82561
|
-
md52 =
|
|
82561
|
+
md52 = crypto8.createHash("md5");
|
|
82562
82562
|
} catch (err) {
|
|
82563
|
-
if (
|
|
82563
|
+
if (crypto8.getFips()) {
|
|
82564
82564
|
throw new Error("Auth mechanism SCRAM-SHA-1 is not supported in FIPS mode");
|
|
82565
82565
|
}
|
|
82566
82566
|
throw err;
|
|
@@ -82583,10 +82583,10 @@ var require_scram = __commonJS({
|
|
|
82583
82583
|
return Buffer.from(res).toString("base64");
|
|
82584
82584
|
}
|
|
82585
82585
|
function H2(method, text) {
|
|
82586
|
-
return
|
|
82586
|
+
return crypto8.createHash(method).update(text).digest();
|
|
82587
82587
|
}
|
|
82588
82588
|
function HMAC(method, key, text) {
|
|
82589
|
-
return
|
|
82589
|
+
return crypto8.createHmac(method, key).update(text).digest();
|
|
82590
82590
|
}
|
|
82591
82591
|
var _hiCache = {};
|
|
82592
82592
|
var _hiCacheCount = 0;
|
|
@@ -82603,7 +82603,7 @@ var require_scram = __commonJS({
|
|
|
82603
82603
|
if (_hiCache[key] != null) {
|
|
82604
82604
|
return _hiCache[key];
|
|
82605
82605
|
}
|
|
82606
|
-
const saltedData =
|
|
82606
|
+
const saltedData = crypto8.pbkdf2Sync(data, salt, iterations, hiLengthMap[cryptoMethod], cryptoMethod);
|
|
82607
82607
|
if (_hiCacheCount >= 200) {
|
|
82608
82608
|
_hiCachePurge();
|
|
82609
82609
|
}
|
|
@@ -82615,8 +82615,8 @@ var require_scram = __commonJS({
|
|
|
82615
82615
|
if (lhs.length !== rhs.length) {
|
|
82616
82616
|
return false;
|
|
82617
82617
|
}
|
|
82618
|
-
if (typeof
|
|
82619
|
-
return
|
|
82618
|
+
if (typeof crypto8.timingSafeEqual === "function") {
|
|
82619
|
+
return crypto8.timingSafeEqual(lhs, rhs);
|
|
82620
82620
|
}
|
|
82621
82621
|
let result = 0;
|
|
82622
82622
|
for (let i6 = 0; i6 < lhs.length; i6++) {
|
|
@@ -91268,8 +91268,7 @@ const realtime = await ga.runRealtimeReport({
|
|
|
91268
91268
|
}
|
|
91269
91269
|
});
|
|
91270
91270
|
|
|
91271
|
-
// ../connectors/src/connectors/google-calendar/tools/
|
|
91272
|
-
import * as crypto3 from "crypto";
|
|
91271
|
+
// ../connectors/src/connectors/google-calendar/tools/request.ts
|
|
91273
91272
|
import { z as z21 } from "zod";
|
|
91274
91273
|
|
|
91275
91274
|
// ../connectors/src/connectors/google-calendar/parameters.ts
|
|
@@ -91277,121 +91276,54 @@ var parameters14 = {
|
|
|
91277
91276
|
serviceAccountKeyJsonBase64: new ParameterDefinition({
|
|
91278
91277
|
slug: "service-account-key-json-base64",
|
|
91279
91278
|
name: "Google Cloud Service Account JSON",
|
|
91280
|
-
description: "The service account JSON key
|
|
91279
|
+
description: "The service account JSON key. Used for both Domain-wide Delegation (impersonating a Workspace user) and direct service-account access (calendars explicitly shared with the SA email). The authentication path is selected per call by the tool used.",
|
|
91281
91280
|
envVarBaseKey: "GOOGLE_CALENDAR_SERVICE_ACCOUNT_JSON_BASE64",
|
|
91282
91281
|
type: "base64EncodedJson",
|
|
91283
91282
|
secret: true,
|
|
91284
91283
|
required: true
|
|
91285
91284
|
})
|
|
91286
91285
|
};
|
|
91287
|
-
|
|
91288
|
-
|
|
91289
|
-
name: "User Email Address(es)",
|
|
91290
|
-
description: "The email address(es) of the Google Workspace user(s) whose calendar is accessed via Domain-wide Delegation. Collected during the setup flow.",
|
|
91291
|
-
envVarBaseKey: "GOOGLE_CALENDAR_IMPERSONATE_EMAIL",
|
|
91292
|
-
type: "text",
|
|
91293
|
-
secret: false,
|
|
91294
|
-
required: false
|
|
91295
|
-
});
|
|
91296
|
-
var calendarIdParameter = new ParameterDefinition({
|
|
91297
|
-
slug: "calendar-id",
|
|
91298
|
-
name: "Default Calendar ID",
|
|
91299
|
-
description: "The default Google Calendar ID to use (e.g., 'primary' or an email address like 'user@example.com'). If not set, 'primary' is used.",
|
|
91300
|
-
envVarBaseKey: "GOOGLE_CALENDAR_CALENDAR_ID",
|
|
91301
|
-
type: "text",
|
|
91302
|
-
secret: false,
|
|
91303
|
-
required: false
|
|
91304
|
-
});
|
|
91305
|
-
|
|
91306
|
-
// ../connectors/src/connectors/google-calendar/tools/list-calendars.ts
|
|
91307
|
-
var TOKEN_URL = "https://oauth2.googleapis.com/token";
|
|
91286
|
+
|
|
91287
|
+
// ../connectors/src/connectors/google-calendar/tools/request.ts
|
|
91308
91288
|
var BASE_URL6 = "https://www.googleapis.com/calendar/v3";
|
|
91309
|
-
var SCOPE = "https://www.googleapis.com/auth/calendar.readonly https://www.googleapis.com/auth/calendar.events.readonly";
|
|
91310
91289
|
var REQUEST_TIMEOUT_MS11 = 6e4;
|
|
91311
|
-
function
|
|
91312
|
-
const
|
|
91313
|
-
return
|
|
91314
|
-
}
|
|
91315
|
-
function buildJwt(clientEmail, privateKey, nowSec, subject) {
|
|
91316
|
-
const header = base64url(JSON.stringify({ alg: "RS256", typ: "JWT" }));
|
|
91317
|
-
const payload = base64url(
|
|
91318
|
-
JSON.stringify({
|
|
91319
|
-
iss: clientEmail,
|
|
91320
|
-
sub: subject,
|
|
91321
|
-
scope: SCOPE,
|
|
91322
|
-
aud: TOKEN_URL,
|
|
91323
|
-
iat: nowSec,
|
|
91324
|
-
exp: nowSec + 3600
|
|
91325
|
-
})
|
|
91326
|
-
);
|
|
91327
|
-
const signingInput = `${header}.${payload}`;
|
|
91328
|
-
const sign2 = crypto3.createSign("RSA-SHA256");
|
|
91329
|
-
sign2.update(signingInput);
|
|
91330
|
-
sign2.end();
|
|
91331
|
-
const signature = base64url(sign2.sign(privateKey));
|
|
91332
|
-
return `${signingInput}.${signature}`;
|
|
91333
|
-
}
|
|
91334
|
-
async function getAccessToken(serviceAccount, subject) {
|
|
91335
|
-
const nowSec = Math.floor(Date.now() / 1e3);
|
|
91336
|
-
const jwt = buildJwt(
|
|
91337
|
-
serviceAccount.client_email,
|
|
91338
|
-
serviceAccount.private_key,
|
|
91339
|
-
nowSec,
|
|
91340
|
-
subject
|
|
91341
|
-
);
|
|
91342
|
-
const response = await fetch(TOKEN_URL, {
|
|
91343
|
-
method: "POST",
|
|
91344
|
-
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
91345
|
-
body: new URLSearchParams({
|
|
91346
|
-
grant_type: "urn:ietf:params:oauth:grant-type:jwt-bearer",
|
|
91347
|
-
assertion: jwt
|
|
91348
|
-
})
|
|
91349
|
-
});
|
|
91350
|
-
if (!response.ok) {
|
|
91351
|
-
const text = await response.text();
|
|
91352
|
-
throw new Error(
|
|
91353
|
-
`token exchange failed for ${subject} (${response.status}): ${text}`
|
|
91354
|
-
);
|
|
91355
|
-
}
|
|
91356
|
-
const data = await response.json();
|
|
91357
|
-
return data.access_token;
|
|
91290
|
+
function decodeServiceAccount(keyJsonBase64) {
|
|
91291
|
+
const decoded = Buffer.from(keyJsonBase64, "base64").toString("utf-8");
|
|
91292
|
+
return JSON.parse(decoded);
|
|
91358
91293
|
}
|
|
91359
91294
|
var inputSchema21 = z21.object({
|
|
91360
91295
|
toolUseIntent: z21.string().optional().describe(
|
|
91361
91296
|
"Brief description of what you intend to accomplish with this tool call"
|
|
91362
91297
|
),
|
|
91363
|
-
connectionId: z21.string().describe("ID of the Google Calendar connection to use")
|
|
91298
|
+
connectionId: z21.string().describe("ID of the Google Calendar connection to use"),
|
|
91299
|
+
method: z21.enum(["GET", "POST", "PUT", "PATCH", "DELETE"]).describe("HTTP method"),
|
|
91300
|
+
path: z21.string().describe(
|
|
91301
|
+
"API path appended to https://www.googleapis.com/calendar/v3 (e.g., '/users/me/calendarList', '/calendars/team@example.com/events'). Write the calendar ID directly into the path \u2014 there is no placeholder substitution."
|
|
91302
|
+
),
|
|
91303
|
+
scopes: z21.array(z21.string()).describe(
|
|
91304
|
+
"OAuth scopes the token must include. This connector currently supports read-only operations only \u2014 pass one of ['https://www.googleapis.com/auth/calendar.readonly'] (calendars + events read), ['https://www.googleapis.com/auth/calendar.events.readonly'] (events read only), or ['https://www.googleapis.com/auth/calendar.freebusy'] (busy/free queries only). Per-endpoint scope reference: https://developers.google.com/calendar/api/auth"
|
|
91305
|
+
),
|
|
91306
|
+
queryParams: z21.record(z21.string(), z21.string()).optional().describe("Query parameters to append to the URL"),
|
|
91307
|
+
body: z21.record(z21.string(), z21.unknown()).optional().describe("JSON request body for POST/PUT/PATCH")
|
|
91364
91308
|
});
|
|
91365
91309
|
var outputSchema21 = z21.discriminatedUnion("success", [
|
|
91366
91310
|
z21.object({
|
|
91367
91311
|
success: z21.literal(true),
|
|
91368
|
-
|
|
91369
|
-
|
|
91370
|
-
impersonateEmail: z21.string(),
|
|
91371
|
-
id: z21.string(),
|
|
91372
|
-
summary: z21.string(),
|
|
91373
|
-
primary: z21.boolean().optional(),
|
|
91374
|
-
accessRole: z21.string()
|
|
91375
|
-
})
|
|
91376
|
-
),
|
|
91377
|
-
errors: z21.array(
|
|
91378
|
-
z21.object({
|
|
91379
|
-
impersonateEmail: z21.string(),
|
|
91380
|
-
error: z21.string()
|
|
91381
|
-
})
|
|
91382
|
-
)
|
|
91312
|
+
status: z21.number(),
|
|
91313
|
+
data: z21.record(z21.string(), z21.unknown())
|
|
91383
91314
|
}),
|
|
91384
91315
|
z21.object({
|
|
91385
91316
|
success: z21.literal(false),
|
|
91386
|
-
error: z21.string()
|
|
91317
|
+
error: z21.string(),
|
|
91318
|
+
serviceAccountEmail: z21.string().optional()
|
|
91387
91319
|
})
|
|
91388
91320
|
]);
|
|
91389
|
-
var
|
|
91390
|
-
name: "
|
|
91391
|
-
description: "
|
|
91321
|
+
var requestTool5 = new ConnectorTool({
|
|
91322
|
+
name: "request",
|
|
91323
|
+
description: "Call the Google Calendar API as the service account itself (no delegation). Read-only operations only. Only calendars explicitly shared with the service account email are accessible. Pass `scopes` as a read-only Calendar scope (e.g., ['https://www.googleapis.com/auth/calendar.readonly']). Use this tool when the project knowledge records the calendar with `(service-account, ...)` (no `subject`).",
|
|
91392
91324
|
inputSchema: inputSchema21,
|
|
91393
91325
|
outputSchema: outputSchema21,
|
|
91394
|
-
async execute({ connectionId }, connections) {
|
|
91326
|
+
async execute({ connectionId, method, path: path4, scopes, queryParams, body }, connections) {
|
|
91395
91327
|
const connection = connections.find((c6) => c6.id === connectionId);
|
|
91396
91328
|
if (!connection) {
|
|
91397
91329
|
return {
|
|
@@ -91399,144 +91331,89 @@ var listCalendarsTool = new ConnectorTool({
|
|
|
91399
91331
|
error: `Connection ${connectionId} not found`
|
|
91400
91332
|
};
|
|
91401
91333
|
}
|
|
91402
|
-
const
|
|
91403
|
-
const emails = impersonateEmailRaw.split(",").map((e6) => e6.trim()).filter((e6) => e6.length > 0);
|
|
91404
|
-
if (emails.length === 0) {
|
|
91405
|
-
return {
|
|
91406
|
-
success: false,
|
|
91407
|
-
error: "impersonate-email parameter is empty"
|
|
91408
|
-
};
|
|
91409
|
-
}
|
|
91410
|
-
console.log(
|
|
91411
|
-
`[connector-request] google-calendar/${connection.name}: listCalendars for ${emails.join(",")}`
|
|
91412
|
-
);
|
|
91334
|
+
const keyJsonBase64 = parameters14.serviceAccountKeyJsonBase64.getValue(connection);
|
|
91413
91335
|
let serviceAccount;
|
|
91414
91336
|
try {
|
|
91415
|
-
|
|
91416
|
-
const decoded = Buffer.from(keyJsonBase64, "base64").toString("utf-8");
|
|
91417
|
-
serviceAccount = JSON.parse(decoded);
|
|
91337
|
+
serviceAccount = decodeServiceAccount(keyJsonBase64);
|
|
91418
91338
|
} catch (err) {
|
|
91419
91339
|
const msg = err instanceof Error ? err.message : String(err);
|
|
91420
91340
|
return {
|
|
91421
91341
|
success: false,
|
|
91422
|
-
error: `
|
|
91342
|
+
error: `Failed to decode service account key: ${msg}`
|
|
91423
91343
|
};
|
|
91424
91344
|
}
|
|
91425
|
-
|
|
91426
|
-
|
|
91427
|
-
|
|
91428
|
-
|
|
91429
|
-
|
|
91430
|
-
|
|
91431
|
-
|
|
91432
|
-
|
|
91433
|
-
|
|
91345
|
+
const serviceAccountEmail = serviceAccount.client_email;
|
|
91346
|
+
console.log(
|
|
91347
|
+
`[connector-request] google-calendar/${connection.name}: ${method} ${path4} (service account)`
|
|
91348
|
+
);
|
|
91349
|
+
try {
|
|
91350
|
+
const { GoogleAuth } = await import("google-auth-library");
|
|
91351
|
+
const auth = new GoogleAuth({
|
|
91352
|
+
credentials: {
|
|
91353
|
+
client_email: serviceAccount.client_email,
|
|
91354
|
+
private_key: serviceAccount.private_key
|
|
91355
|
+
},
|
|
91356
|
+
scopes
|
|
91357
|
+
});
|
|
91358
|
+
const token = await auth.getAccessToken();
|
|
91359
|
+
if (!token) {
|
|
91360
|
+
return {
|
|
91361
|
+
success: false,
|
|
91362
|
+
error: "Failed to obtain access token",
|
|
91363
|
+
serviceAccountEmail
|
|
91364
|
+
};
|
|
91365
|
+
}
|
|
91366
|
+
let url = `${BASE_URL6}${path4.startsWith("/") ? "" : "/"}${path4}`;
|
|
91367
|
+
if (queryParams) {
|
|
91368
|
+
const searchParams = new URLSearchParams(queryParams);
|
|
91369
|
+
url += `?${searchParams.toString()}`;
|
|
91370
|
+
}
|
|
91434
91371
|
const controller = new AbortController();
|
|
91435
91372
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS11);
|
|
91436
91373
|
try {
|
|
91437
|
-
const
|
|
91438
|
-
const response = await fetch(
|
|
91439
|
-
method
|
|
91440
|
-
headers: {
|
|
91374
|
+
const hasBody = body != null && ["POST", "PUT", "PATCH"].includes(method);
|
|
91375
|
+
const response = await fetch(url, {
|
|
91376
|
+
method,
|
|
91377
|
+
headers: {
|
|
91378
|
+
Authorization: `Bearer ${token}`,
|
|
91379
|
+
"Content-Type": "application/json"
|
|
91380
|
+
},
|
|
91381
|
+
body: hasBody ? JSON.stringify(body) : void 0,
|
|
91441
91382
|
signal: controller.signal
|
|
91442
91383
|
});
|
|
91443
|
-
const data = await response.json();
|
|
91384
|
+
const data = await response.json().catch(() => ({}));
|
|
91444
91385
|
if (!response.ok) {
|
|
91445
91386
|
const errorObj = data?.error;
|
|
91446
|
-
|
|
91447
|
-
|
|
91448
|
-
|
|
91449
|
-
|
|
91450
|
-
|
|
91451
|
-
|
|
91452
|
-
const items = data.items ?? [];
|
|
91453
|
-
for (const c6 of items) {
|
|
91454
|
-
aggregated.push({
|
|
91455
|
-
impersonateEmail: email,
|
|
91456
|
-
id: c6.id,
|
|
91457
|
-
summary: c6.summary,
|
|
91458
|
-
primary: c6.primary,
|
|
91459
|
-
accessRole: c6.accessRole
|
|
91460
|
-
});
|
|
91387
|
+
const errorMessage = errorObj?.message ?? (typeof data?.message === "string" ? data.message : `HTTP ${response.status} ${response.statusText}`);
|
|
91388
|
+
return {
|
|
91389
|
+
success: false,
|
|
91390
|
+
error: errorMessage,
|
|
91391
|
+
serviceAccountEmail
|
|
91392
|
+
};
|
|
91461
91393
|
}
|
|
91462
|
-
|
|
91463
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
91464
|
-
errors2.push({ impersonateEmail: email, error: msg });
|
|
91394
|
+
return { success: true, status: response.status, data };
|
|
91465
91395
|
} finally {
|
|
91466
91396
|
clearTimeout(timeout);
|
|
91467
91397
|
}
|
|
91398
|
+
} catch (err) {
|
|
91399
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
91400
|
+
return {
|
|
91401
|
+
success: false,
|
|
91402
|
+
error: msg,
|
|
91403
|
+
serviceAccountEmail
|
|
91404
|
+
};
|
|
91468
91405
|
}
|
|
91469
|
-
return {
|
|
91470
|
-
success: true,
|
|
91471
|
-
calendars: aggregated,
|
|
91472
|
-
errors: errors2
|
|
91473
|
-
};
|
|
91474
|
-
}
|
|
91475
|
-
});
|
|
91476
|
-
|
|
91477
|
-
// ../connectors/src/connectors/google-calendar/setup.ts
|
|
91478
|
-
var listCalendarsToolName = `google-calendar-service-account_${listCalendarsTool.name}`;
|
|
91479
|
-
var googleCalendarOnboarding = new ConnectorOnboarding({
|
|
91480
|
-
connectionSetupInstructions: {
|
|
91481
|
-
ja: `\u4EE5\u4E0B\u306E\u624B\u9806\u3067Google Calendar\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306E\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002\u63A5\u7D9A\u4F5C\u6210\u6642\u306B\u306F\u30B5\u30FC\u30D3\u30B9\u30A2\u30AB\u30A6\u30F3\u30C8JSON\u306E\u307F\u304C\u8A2D\u5B9A\u6E08\u307F\u3067\u3001\u5BFE\u8C61\u30E6\u30FC\u30B6\u30FC\u306E\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3084\u30AB\u30EC\u30F3\u30C0\u30FCID\u306F\u3053\u306E\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u4E2D\u306B\u53D6\u5F97\u3057\u307E\u3059\u3002
|
|
91482
|
-
|
|
91483
|
-
1. \`askUserQuestion\` \u3067\u30E6\u30FC\u30B6\u30FC\u306B\u3001\u30B5\u30FC\u30D3\u30B9\u30A2\u30AB\u30A6\u30F3\u30C8\u304CDomain-wide Delegation\u3067\u4EE3\u7406\u30A2\u30AF\u30BB\u30B9\u3059\u308BGoogle Workspace\u30E6\u30FC\u30B6\u30FC\u306E\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092\u30D2\u30A2\u30EA\u30F3\u30B0\u3059\u308B:
|
|
91484
|
-
- \`type\`: \`"freeText"\`
|
|
91485
|
-
- \`question\`: \u300C\u30A2\u30AF\u30BB\u30B9\u3057\u305F\u3044\u30AB\u30EC\u30F3\u30C0\u30FC\u3092\u6301\u3064\u30E6\u30FC\u30B6\u30FC\u306E\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\uFF08\u8907\u6570\u3042\u308B\u5834\u5408\u306F\u30AB\u30F3\u30DE\u533A\u5207\u308A\u3067\u5165\u529B\u53EF\uFF09\u300D
|
|
91486
|
-
- \`placeholder\`: \`"user@example.com, admin@example.com"\`
|
|
91487
|
-
2. \u30E6\u30FC\u30B6\u30FC\u304B\u3089\u53D7\u3051\u53D6\u3063\u305F\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\uFF08\u30AB\u30F3\u30DE\u533A\u5207\u308A\u5BFE\u5FDC\uFF09\u3092 \`updateConnectionParameters\` \u3067\u4FDD\u5B58\u3059\u308B:
|
|
91488
|
-
- \`parameterSlug\`: \`"impersonate-email"\`
|
|
91489
|
-
- \`options\`: \`[{ value: <\u5165\u529B\u3055\u308C\u305F\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u6587\u5B57\u5217>, label: <\u540C\u3058\u5024> }]\`\uFF081\u4EF6\u306E\u307F\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\u81EA\u52D5\u9078\u629E\u3055\u308C\u308B\uFF09
|
|
91490
|
-
3. \`${listCalendarsToolName}\` \u3092\u547C\u3073\u51FA\u3057\u3001\u4FDD\u5B58\u3057\u305F\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3067\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306A\u30AB\u30EC\u30F3\u30C0\u30FC\u4E00\u89A7\u3092\u53D6\u5F97\u3059\u308B\u3002
|
|
91491
|
-
- \`errors\` \u306B\u30A8\u30E9\u30FC\u304C\u3042\u308A \`calendars\` \u304C\u7A7A\u306E\u5834\u5408\uFF08\u3059\u3079\u3066\u306E\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3067\u5931\u6557\uFF09\u3001\u5165\u529B\u3055\u308C\u305F\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u304C\u5B58\u5728\u3057\u306A\u3044\u53EF\u80FD\u6027\u304C\u3042\u308B\u3002\`askUserQuestion\` \u3067\u300C{\u5165\u529B\u3057\u305F\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9} \u306E\u30AB\u30EC\u30F3\u30C0\u30FC\u306B\u30A2\u30AF\u30BB\u30B9\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u30A2\u30C9\u30EC\u30B9\u306B\u8AA4\u308A\u304C\u3042\u308B\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059\u3002\u4F3C\u305F\u30A2\u30C9\u30EC\u30B9\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u304B\uFF1F\u300D\u3068\u805E\u304D\u8FD4\u3057\u3001\u30B9\u30C6\u30C3\u30D72\u304B\u3089\u518D\u5EA6\u5B9F\u884C\u3059\u308B
|
|
91492
|
-
4. \u8FD4\u5374\u3055\u308C\u305F \`calendars\` \u914D\u5217\uFF08\u5404\u8981\u7D20: \`{ impersonateEmail, id, summary, primary, accessRole }\`\uFF09\u3092\u5143\u306B\u300C\u4F7F\u7528\u3059\u308B\u30AB\u30EC\u30F3\u30C0\u30FC\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u300D\u3068\u77ED\u304F\u4F1D\u3048\u305F\u4E0A\u3067\u3001\`updateConnectionParameters\` \u3092\u547C\u3073\u51FA\u3059:
|
|
91493
|
-
- \`parameterSlug\`: \`"calendar-id"\`
|
|
91494
|
-
- \`options\`: \u5404 option \u306E \`label\` \u306F \`\u30AB\u30EC\u30F3\u30C0\u30FC\u540D (owner: impersonateEmail)\` \u306E\u5F62\u5F0F\u3001\`value\` \u306F\u30AB\u30EC\u30F3\u30C0\u30FCID
|
|
91495
|
-
- \`errors\` \u306B\u5931\u6557\u3057\u305F\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u304C\u3042\u308B\u5834\u5408\u306F\u3001\u305D\u306E\u65E8\u3092\u77ED\u304F\u4F1D\u3048\u308B
|
|
91496
|
-
5. \u30E6\u30FC\u30B6\u30FC\u304C\u9078\u629E\u3057\u305F\u30AB\u30EC\u30F3\u30C0\u30FC\u306E \`label\` \u304B\u3089 owner \u306E\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092\u62BD\u51FA\u3057\u3001\`updateConnectionParameters\` \u3092\u547C\u3073\u51FA\u3057\u3066 \`impersonate-email\` \u3092\u6700\u7D42\u5024\u3067\u4E0A\u66F8\u304D\u3059\u308B:
|
|
91497
|
-
- \`parameterSlug\`: \`"impersonate-email"\`
|
|
91498
|
-
- \`options\`: \`[{ value: <ownerEmail>, label: <ownerEmail> }]\`
|
|
91499
|
-
|
|
91500
|
-
#### \u5236\u7D04
|
|
91501
|
-
- **\u30B5\u30FC\u30D3\u30B9\u30A2\u30AB\u30A6\u30F3\u30C8\u306E\u30C9\u30E1\u30A4\u30F3\u5168\u4F53\u306E\u59D4\u4EFB\u8A2D\u5B9A\u304C\u5FC5\u8981\u3067\u3059**\u3002\`${listCalendarsToolName}\` \u306E \`errors\` \u306B\u6A29\u9650\u30A8\u30E9\u30FC\u304C\u51FA\u308B\u5834\u5408\u3001Google Workspace\u7BA1\u7406\u8005\u306BDomain-wide Delegation\u306E\u8A2D\u5B9A\u78BA\u8A8D\u3092\u4FC3\u3057\u3066\u304F\u3060\u3055\u3044
|
|
91502
|
-
- \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`,
|
|
91503
|
-
en: `Follow these steps to set up the Google Calendar connection. Only the service account JSON is provided at connection creation time \u2014 the target user email and calendar ID are collected during this setup flow.
|
|
91504
|
-
|
|
91505
|
-
1. Call \`askUserQuestion\` to ask the user for the Google Workspace user email the service account will impersonate via Domain-wide Delegation:
|
|
91506
|
-
- \`type\`: \`"freeText"\`
|
|
91507
|
-
- \`question\`: "Please enter the email address of the user whose calendar you want to access (comma-separated list allowed for multiple users)"
|
|
91508
|
-
- \`placeholder\`: \`"user@example.com, admin@example.com"\`
|
|
91509
|
-
2. Save the email(s) the user provided (comma-separated supported) via \`updateConnectionParameters\`:
|
|
91510
|
-
- \`parameterSlug\`: \`"impersonate-email"\`
|
|
91511
|
-
- \`options\`: \`[{ value: <the email string entered>, label: <same value> }]\` (a single option is auto-selected)
|
|
91512
|
-
3. Call \`${listCalendarsToolName}\` to list calendars accessible via the saved email(s).
|
|
91513
|
-
- If \`errors\` is non-empty and \`calendars\` is empty (all emails failed), the entered address may not exist. Use \`askUserQuestion\` to ask: "Could not access the calendar for {entered email}. The address may be incorrect \u2014 did you mean a similar address?" Then re-run from step 2 with the new input
|
|
91514
|
-
4. Using the returned \`calendars\` array (each item: \`{ impersonateEmail, id, summary, primary, accessRole }\`), briefly say "Please select a calendar." then call \`updateConnectionParameters\`:
|
|
91515
|
-
- \`parameterSlug\`: \`"calendar-id"\`
|
|
91516
|
-
- \`options\`: Each option's \`label\` should be \`Calendar Name (owner: impersonateEmail)\`, \`value\` should be the calendar ID
|
|
91517
|
-
- If \`errors\` contains failing email addresses, briefly mention them
|
|
91518
|
-
5. Extract the owner email from the \`label\` of the user's selected calendar, then call \`updateConnectionParameters\` to overwrite \`impersonate-email\` with the final value:
|
|
91519
|
-
- \`parameterSlug\`: \`"impersonate-email"\`
|
|
91520
|
-
- \`options\`: \`[{ value: <ownerEmail>, label: <ownerEmail> }]\`
|
|
91521
|
-
|
|
91522
|
-
#### Constraints
|
|
91523
|
-
- **Domain-wide Delegation must be configured on the service account**. If \`${listCalendarsToolName}\` returns permission errors in the \`errors\` field, ask the user to verify the Domain-wide Delegation setup with their Google Workspace administrator
|
|
91524
|
-
- Write only 1 sentence between tool calls, then immediately call the next tool. Skip unnecessary explanations and proceed efficiently`
|
|
91525
|
-
},
|
|
91526
|
-
dataOverviewInstructions: {
|
|
91527
|
-
en: `1. Call google-calendar-service-account_request with GET /calendars/{calendarId} to get the default calendar's metadata
|
|
91528
|
-
2. Call google-calendar-service-account_request with GET /users/me/calendarList to list all accessible calendars
|
|
91529
|
-
3. Call google-calendar-service-account_request with GET /calendars/{calendarId}/events with query params timeMin (RFC3339) and maxResults=10 to sample upcoming events`,
|
|
91530
|
-
ja: `1. google-calendar-service-account_request \u3067 GET /calendars/{calendarId} \u3092\u547C\u3073\u51FA\u3057\u3001\u30C7\u30D5\u30A9\u30EB\u30C8\u30AB\u30EC\u30F3\u30C0\u30FC\u306E\u30E1\u30BF\u30C7\u30FC\u30BF\u3092\u53D6\u5F97
|
|
91531
|
-
2. google-calendar-service-account_request \u3067 GET /users/me/calendarList \u3092\u547C\u3073\u51FA\u3057\u3001\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306A\u5168\u30AB\u30EC\u30F3\u30C0\u30FC\u306E\u4E00\u89A7\u3092\u53D6\u5F97
|
|
91532
|
-
3. google-calendar-service-account_request \u3067 GET /calendars/{calendarId}/events \u3092\u30AF\u30A8\u30EA\u30D1\u30E9\u30E1\u30FC\u30BF timeMin\uFF08RFC3339\u5F62\u5F0F\uFF09\u3068 maxResults=10 \u3067\u547C\u3073\u51FA\u3057\u3001\u76F4\u8FD1\u306E\u30A4\u30D9\u30F3\u30C8\u3092\u30B5\u30F3\u30D7\u30EA\u30F3\u30B0`
|
|
91533
91406
|
}
|
|
91534
91407
|
});
|
|
91535
91408
|
|
|
91536
|
-
// ../connectors/src/connectors/google-calendar/tools/request.ts
|
|
91409
|
+
// ../connectors/src/connectors/google-calendar/tools/request-with-delegation.ts
|
|
91537
91410
|
import { z as z22 } from "zod";
|
|
91538
91411
|
var BASE_URL7 = "https://www.googleapis.com/calendar/v3";
|
|
91539
91412
|
var REQUEST_TIMEOUT_MS12 = 6e4;
|
|
91413
|
+
function decodeServiceAccount2(keyJsonBase64) {
|
|
91414
|
+
const decoded = Buffer.from(keyJsonBase64, "base64").toString("utf-8");
|
|
91415
|
+
return JSON.parse(decoded);
|
|
91416
|
+
}
|
|
91540
91417
|
var inputSchema22 = z22.object({
|
|
91541
91418
|
toolUseIntent: z22.string().optional().describe(
|
|
91542
91419
|
"Brief description of what you intend to accomplish with this tool call"
|
|
@@ -91544,13 +91421,18 @@ var inputSchema22 = z22.object({
|
|
|
91544
91421
|
connectionId: z22.string().describe("ID of the Google Calendar connection to use"),
|
|
91545
91422
|
method: z22.enum(["GET", "POST", "PUT", "PATCH", "DELETE"]).describe("HTTP method"),
|
|
91546
91423
|
path: z22.string().describe(
|
|
91547
|
-
"API path appended to https://www.googleapis.com/calendar/v3 (e.g., '/calendars/
|
|
91424
|
+
"API path appended to https://www.googleapis.com/calendar/v3 (e.g., '/users/me/calendarList', '/calendars/alice@example.com/events'). Write the calendar ID directly into the path \u2014 there is no placeholder substitution."
|
|
91548
91425
|
),
|
|
91549
|
-
|
|
91550
|
-
|
|
91551
|
-
|
|
91552
|
-
|
|
91553
|
-
|
|
91426
|
+
subject: z22.string().describe(
|
|
91427
|
+
"Email of the Workspace user to impersonate via Domain-wide Delegation. The token will be issued as this user."
|
|
91428
|
+
),
|
|
91429
|
+
scopes: z22.array(z22.string()).describe(
|
|
91430
|
+
"OAuth scopes the token must include. This connector currently supports read-only operations only \u2014 pass one of ['https://www.googleapis.com/auth/calendar.readonly'] (calendars + events read), ['https://www.googleapis.com/auth/calendar.events.readonly'] (events read only), or ['https://www.googleapis.com/auth/calendar.freebusy'] (busy/free queries only). Per-endpoint scope reference: https://developers.google.com/calendar/api/auth"
|
|
91431
|
+
),
|
|
91432
|
+
queryParams: z22.record(z22.string(), z22.string()).optional().describe(
|
|
91433
|
+
"Query parameters to append to the URL (e.g., { timeMin: '2025-01-01T00:00:00Z', maxResults: '10' })"
|
|
91434
|
+
),
|
|
91435
|
+
body: z22.record(z22.string(), z22.unknown()).optional().describe("JSON request body for POST/PUT/PATCH")
|
|
91554
91436
|
});
|
|
91555
91437
|
var outputSchema22 = z22.discriminatedUnion("success", [
|
|
91556
91438
|
z22.object({
|
|
@@ -91560,17 +91442,16 @@ var outputSchema22 = z22.discriminatedUnion("success", [
|
|
|
91560
91442
|
}),
|
|
91561
91443
|
z22.object({
|
|
91562
91444
|
success: z22.literal(false),
|
|
91563
|
-
error: z22.string()
|
|
91445
|
+
error: z22.string(),
|
|
91446
|
+
serviceAccountEmail: z22.string().optional()
|
|
91564
91447
|
})
|
|
91565
91448
|
]);
|
|
91566
|
-
var
|
|
91567
|
-
name: "
|
|
91568
|
-
description: `
|
|
91569
|
-
Authentication is handled automatically using a service account.
|
|
91570
|
-
{calendarId} in the path is automatically replaced with the connection's default calendar ID.`,
|
|
91449
|
+
var requestWithDelegationTool = new ConnectorTool({
|
|
91450
|
+
name: "request_with_delegation",
|
|
91451
|
+
description: "Call the Google Calendar API on behalf of the specified Workspace user via Domain-wide Delegation. Read-only operations only. Pass `subject` as the target user email and `scopes` as a read-only Calendar scope (e.g., ['https://www.googleapis.com/auth/calendar.readonly']). Use this tool when the project knowledge records the calendar with `(delegation, subject: <email>, ...)`. Requires DwD to be authorized for the service account in the Workspace admin console.",
|
|
91571
91452
|
inputSchema: inputSchema22,
|
|
91572
91453
|
outputSchema: outputSchema22,
|
|
91573
|
-
async execute({ connectionId, method, path: path4, queryParams, body
|
|
91454
|
+
async execute({ connectionId, method, path: path4, subject, scopes, queryParams, body }, connections) {
|
|
91574
91455
|
const connection = connections.find((c6) => c6.id === connectionId);
|
|
91575
91456
|
if (!connection) {
|
|
91576
91457
|
return {
|
|
@@ -91578,41 +91459,40 @@ Authentication is handled automatically using a service account.
|
|
|
91578
91459
|
error: `Connection ${connectionId} not found`
|
|
91579
91460
|
};
|
|
91580
91461
|
}
|
|
91462
|
+
const keyJsonBase64 = parameters14.serviceAccountKeyJsonBase64.getValue(connection);
|
|
91463
|
+
let serviceAccount;
|
|
91464
|
+
try {
|
|
91465
|
+
serviceAccount = decodeServiceAccount2(keyJsonBase64);
|
|
91466
|
+
} catch (err) {
|
|
91467
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
91468
|
+
return {
|
|
91469
|
+
success: false,
|
|
91470
|
+
error: `Failed to decode service account key: ${msg}`
|
|
91471
|
+
};
|
|
91472
|
+
}
|
|
91473
|
+
const serviceAccountEmail = serviceAccount.client_email;
|
|
91581
91474
|
console.log(
|
|
91582
|
-
`[connector-request] google-calendar/${connection.name}: ${method} ${path4}`
|
|
91475
|
+
`[connector-request] google-calendar/${connection.name}: ${method} ${path4} subject=${subject}`
|
|
91583
91476
|
);
|
|
91584
91477
|
try {
|
|
91585
91478
|
const { GoogleAuth } = await import("google-auth-library");
|
|
91586
|
-
const keyJsonBase64 = parameters14.serviceAccountKeyJsonBase64.getValue(connection);
|
|
91587
|
-
const impersonateEmail = impersonateEmailParameter.tryGetValue(connection);
|
|
91588
|
-
const calendarId = calendarIdParameter.tryGetValue(connection) ?? "primary";
|
|
91589
|
-
const resolvedSubject = subject ?? impersonateEmail;
|
|
91590
|
-
if (!resolvedSubject) {
|
|
91591
|
-
return {
|
|
91592
|
-
success: false,
|
|
91593
|
-
error: `Missing required parameter: ${impersonateEmailParameter.slug}. Configure the user email for this connection.`
|
|
91594
|
-
};
|
|
91595
|
-
}
|
|
91596
|
-
const credentials = JSON.parse(
|
|
91597
|
-
Buffer.from(keyJsonBase64, "base64").toString("utf-8")
|
|
91598
|
-
);
|
|
91599
91479
|
const auth = new GoogleAuth({
|
|
91600
|
-
credentials
|
|
91601
|
-
|
|
91602
|
-
|
|
91603
|
-
|
|
91604
|
-
|
|
91605
|
-
clientOptions: { subject
|
|
91480
|
+
credentials: {
|
|
91481
|
+
client_email: serviceAccount.client_email,
|
|
91482
|
+
private_key: serviceAccount.private_key
|
|
91483
|
+
},
|
|
91484
|
+
scopes,
|
|
91485
|
+
clientOptions: { subject }
|
|
91606
91486
|
});
|
|
91607
91487
|
const token = await auth.getAccessToken();
|
|
91608
91488
|
if (!token) {
|
|
91609
91489
|
return {
|
|
91610
91490
|
success: false,
|
|
91611
|
-
error: "Failed to obtain access token"
|
|
91491
|
+
error: "Failed to obtain access token",
|
|
91492
|
+
serviceAccountEmail
|
|
91612
91493
|
};
|
|
91613
91494
|
}
|
|
91614
|
-
|
|
91615
|
-
let url = `${BASE_URL7}${resolvedPath.startsWith("/") ? "" : "/"}${resolvedPath}`;
|
|
91495
|
+
let url = `${BASE_URL7}${path4.startsWith("/") ? "" : "/"}${path4}`;
|
|
91616
91496
|
if (queryParams) {
|
|
91617
91497
|
const searchParams = new URLSearchParams(queryParams);
|
|
91618
91498
|
url += `?${searchParams.toString()}`;
|
|
@@ -91620,28 +91500,24 @@ Authentication is handled automatically using a service account.
|
|
|
91620
91500
|
const controller = new AbortController();
|
|
91621
91501
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS12);
|
|
91622
91502
|
try {
|
|
91503
|
+
const hasBody = body != null && ["POST", "PUT", "PATCH"].includes(method);
|
|
91623
91504
|
const response = await fetch(url, {
|
|
91624
91505
|
method,
|
|
91625
91506
|
headers: {
|
|
91626
91507
|
Authorization: `Bearer ${token}`,
|
|
91627
91508
|
"Content-Type": "application/json"
|
|
91628
91509
|
},
|
|
91629
|
-
body:
|
|
91510
|
+
body: hasBody ? JSON.stringify(body) : void 0,
|
|
91630
91511
|
signal: controller.signal
|
|
91631
91512
|
});
|
|
91632
|
-
|
|
91633
|
-
return {
|
|
91634
|
-
success: true,
|
|
91635
|
-
status: 204,
|
|
91636
|
-
data: { message: "Deleted successfully" }
|
|
91637
|
-
};
|
|
91638
|
-
}
|
|
91639
|
-
const data = await response.json();
|
|
91513
|
+
const data = await response.json().catch(() => ({}));
|
|
91640
91514
|
if (!response.ok) {
|
|
91641
91515
|
const errorObj = data?.error;
|
|
91516
|
+
const errorMessage = errorObj?.message ?? (typeof data?.message === "string" ? data.message : `HTTP ${response.status} ${response.statusText}`);
|
|
91642
91517
|
return {
|
|
91643
91518
|
success: false,
|
|
91644
|
-
error:
|
|
91519
|
+
error: errorMessage,
|
|
91520
|
+
serviceAccountEmail
|
|
91645
91521
|
};
|
|
91646
91522
|
}
|
|
91647
91523
|
return { success: true, status: response.status, data };
|
|
@@ -91650,13 +91526,121 @@ Authentication is handled automatically using a service account.
|
|
|
91650
91526
|
}
|
|
91651
91527
|
} catch (err) {
|
|
91652
91528
|
const msg = err instanceof Error ? err.message : String(err);
|
|
91653
|
-
return {
|
|
91529
|
+
return {
|
|
91530
|
+
success: false,
|
|
91531
|
+
error: msg,
|
|
91532
|
+
serviceAccountEmail
|
|
91533
|
+
};
|
|
91654
91534
|
}
|
|
91655
91535
|
}
|
|
91656
91536
|
});
|
|
91657
91537
|
|
|
91538
|
+
// ../connectors/src/connectors/google-calendar/setup.ts
|
|
91539
|
+
var requestToolName = `google-calendar-service-account_${requestTool5.name}`;
|
|
91540
|
+
var requestWithDelegationToolName = `google-calendar-service-account_${requestWithDelegationTool.name}`;
|
|
91541
|
+
var READONLY_SCOPES = '["https://www.googleapis.com/auth/calendar.readonly"]';
|
|
91542
|
+
var googleCalendarOnboarding = new ConnectorOnboarding({
|
|
91543
|
+
connectionSetupInstructions: {
|
|
91544
|
+
ja: `Google Calendar \u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306E\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3092\u884C\u3044\u307E\u3059\u3002\u30A2\u30AF\u30BB\u30B9\u3057\u305F\u3044\u30AB\u30EC\u30F3\u30C0\u30FC\u3092\u30E6\u30FC\u30B6\u30FC\u304B\u3089\u805E\u304D\u3001\u5229\u7528\u53EF\u80FD\u306A\u3082\u306E\u3092\u767A\u898B\u3057\u3066 Project Knowledge \u306B\u8A18\u9332\u3057\u307E\u3059\u3002
|
|
91545
|
+
|
|
91546
|
+
1. \`askUserQuestion\` \u3067\u5BFE\u8C61\u30E6\u30FC\u30B6\u30FC\u306E\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092\u805E\u304F:
|
|
91547
|
+
- \`type\`: \`"freeText"\`
|
|
91548
|
+
- \`question\`: \u300C\u30A2\u30AF\u30BB\u30B9\u3057\u305F\u3044\u30AB\u30EC\u30F3\u30C0\u30FC\u306E\u6240\u6709\u8005\u306E\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\uFF08\u8907\u6570\u53EF\u3001\u30AB\u30F3\u30DE\u533A\u5207\u308A\uFF09\u300D
|
|
91549
|
+
- \`placeholder\`: \`"alice@example.com, bob@example.com"\`
|
|
91550
|
+
|
|
91551
|
+
2. \u30E6\u30FC\u30B6\u30FC\u304B\u3089\u53D7\u3051\u53D6\u3063\u305F\u6587\u5B57\u5217\u304B\u3089\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092\u62BD\u51FA\u3059\u308B\u3002\u4E26\u884C\u3057\u3066\u4E21\u65B9\u306E\u30C4\u30FC\u30EB\u3067\u30AB\u30EC\u30F3\u30C0\u30FC\u3092\u767A\u898B\u3059\u308B:
|
|
91552
|
+
a. \`${requestToolName}\` \u3092\u4EE5\u4E0B\u306E\u5F15\u6570\u3067\u547C\u3073\u3001Service Account \u81EA\u8EAB\u306B\u5171\u6709\u3055\u308C\u3066\u3044\u308B\u30AB\u30EC\u30F3\u30C0\u30FC\u3092\u53D6\u5F97\u3059\u308B\u3002\`success: false\` \u306A\u3089\u305D\u306E\u65E8\u8A18\u9332\u3057\u3066\u6B21\u3078:
|
|
91553
|
+
- \`method\`: \`"GET"\`
|
|
91554
|
+
- \`path\`: \`"/users/me/calendarList"\`
|
|
91555
|
+
- \`scopes\`: \`${READONLY_SCOPES}\`
|
|
91556
|
+
b. \u5404\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9 \`<email>\` \u306B\u3064\u3044\u3066 \`${requestWithDelegationToolName}\` \u3092\u4EE5\u4E0B\u306E\u5F15\u6570\u3067\u547C\u3073\u3001\u305D\u306E\u30E6\u30FC\u30B6\u30FC\u304C\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306A\u30AB\u30EC\u30F3\u30C0\u30FC\u3092\u53D6\u5F97\u3059\u308B:
|
|
91557
|
+
- \`method\`: \`"GET"\`
|
|
91558
|
+
- \`path\`: \`"/users/me/calendarList"\`
|
|
91559
|
+
- \`subject\`: \`<email>\`
|
|
91560
|
+
- \`scopes\`: \`${READONLY_SCOPES}\`
|
|
91561
|
+
|
|
91562
|
+
3. \u30B9\u30C6\u30C3\u30D7 2 \u306E\u767A\u898B\u7D50\u679C (a \u3068 b \u306E\u5168\u30AB\u30EC\u30F3\u30C0\u30FC) \u3092\u7D71\u5408\u3057\u3001\`askUserQuestion\` \u3067\u30AB\u30EC\u30F3\u30C0\u30FC\u9078\u629E\u3092\u6C42\u3081\u308B:
|
|
91563
|
+
- 1 \u4EF6\u3082\u898B\u3064\u304B\u3089\u306A\u304B\u3063\u305F\u5834\u5408: \u5931\u6557\u3057\u305F\u30C4\u30FC\u30EB\u306E\u30A8\u30E9\u30FC\u30EC\u30B9\u30DD\u30F3\u30B9\u304B\u3089 \`serviceAccountEmail\` \u3092\u53D6\u308A\u51FA\u3057\u3001\`askUserQuestion\` \u3067\u6B21\u306E\u9078\u629E\u80A2\u3092\u63D0\u793A\u3059\u308B\u3002\`question\` \u306B\u306F\u6B21\u306E\u6848\u5185\u6587\u3092\u542B\u3081\u308B: \u300C\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306A\u30AB\u30EC\u30F3\u30C0\u30FC\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u30B5\u30FC\u30D3\u30B9\u30A2\u30AB\u30A6\u30F3\u30C8 \`<serviceAccountEmail>\` \u3067\u6B21\u306E\u3044\u305A\u308C\u304B\u3092\u884C\u3063\u3066\u304B\u3089\u7D9A\u884C\u3057\u3066\u304F\u3060\u3055\u3044: (1) Workspace \u7BA1\u7406\u8005\u306B Domain-wide Delegation \u306E\u8A2D\u5B9A\u3092\u4F9D\u983C\u3059\u308B\uFF08[\u8A2D\u5B9A\u30AC\u30A4\u30C9](https://support.google.com/a/answer/162106)\uFF09\u3001(2) \u5BFE\u8C61\u30AB\u30EC\u30F3\u30C0\u30FC\u3092 \`<serviceAccountEmail>\` \u306B\u5171\u6709\u8A2D\u5B9A\u3067\u62DB\u5F85\u3059\u308B\uFF08[\u5171\u6709\u624B\u9806](https://support.google.com/calendar/answer/37082)\uFF09\u300D\u3002
|
|
91564
|
+
- \`options\`: \`[{ label: "\u6E96\u5099\u3067\u304D\u305F\u306E\u3067\u30EA\u30C8\u30E9\u30A4", value: "retry" }, { label: "\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092\u5165\u529B\u3057\u76F4\u3059", value: "restart" }]\`
|
|
91565
|
+
- \u300C\u30EA\u30C8\u30E9\u30A4\u300D: \u76F4\u524D\u306E\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u30EA\u30B9\u30C8\u3067\u30B9\u30C6\u30C3\u30D7 2 \u3092\u518D\u5B9F\u884C
|
|
91566
|
+
- \u300C\u5165\u529B\u3057\u76F4\u3059\u300D: \u30B9\u30C6\u30C3\u30D7 1 \u304B\u3089\u518D\u5B9F\u884C
|
|
91567
|
+
- \u5931\u6557\u304C\u3042\u3063\u305F\u5834\u5408: \u305D\u306E\u65E8\u3092 1 \u6587\u3067\u4F1D\u3048\u3066\u304B\u3089\u6B21\u306B\u9032\u3080
|
|
91568
|
+
- \u30AB\u30EC\u30F3\u30C0\u30FC\u9078\u629E:
|
|
91569
|
+
- \`type\`: \`"multiSelect"\`
|
|
91570
|
+
- \`question\`: \u300C\u4F7F\u7528\u3059\u308B\u30AB\u30EC\u30F3\u30C0\u30FC\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\uFF08\u8907\u6570\u53EF\uFF09\u300D
|
|
91571
|
+
- \`options\`: \u5404\u30AB\u30EC\u30F3\u30C0\u30FC\u306B\u3064\u3044\u3066 \`label\`: \`"<\u30AB\u30EC\u30F3\u30C0\u30FC\u540D> (\u30A2\u30AF\u30BB\u30B9\u7D4C\u8DEF)"\`\u3001\`value\`: \`"<calendarId>"\` \u306E\u5F62\u5F0F\u3067\u69CB\u7BC9\u3002\u30A2\u30AF\u30BB\u30B9\u7D4C\u8DEF\u306F a \u3067\u898B\u3064\u304B\u3063\u305F\u3082\u306E\u306F \`"\u5171\u6709"\`\u3001b \u3067\u898B\u3064\u304B\u3063\u305F\u3082\u306E\u306F \`"DwD: <\u305D\u306E\u3068\u304D\u306E subject>"\` \u306E\u3088\u3046\u306B\u4EBA\u9593\u304C\u5224\u5225\u3067\u304D\u308B\u6587\u5B57\u5217\u306B\u3059\u308B
|
|
91572
|
+
|
|
91573
|
+
4. \u30E6\u30FC\u30B6\u30FC\u304C\u9078\u629E\u3057\u305F calendarId \u96C6\u5408\u3092\u3001\u30B9\u30C6\u30C3\u30D7 2 \u306E\u30C7\u30A3\u30B9\u30AB\u30D0\u30EA\u7D50\u679C\u3068\u7A81\u304D\u5408\u308F\u305B\u3066\u7D4C\u8DEF\u3068 subject \u3092\u7279\u5B9A\u3059\u308B\u3002\`finalizeSetup\` \u3092\u547C\u3073\u3001\`projectKnowledge\` \u306E \`#### \u30B9\u30B3\u30FC\u30D7\` \u7BC0\u306B\u5404\u30AB\u30EC\u30F3\u30C0\u30FC\u3092 1 \u884C\u305A\u3064\u5217\u6319\u3059\u308B:
|
|
91574
|
+
- DwD \u7D4C\u7531\u3067\u30A2\u30AF\u30BB\u30B9\u3059\u308B\u5834\u5408: \`- calendar: <calendarId> (delegation, subject: <subject>, name: "<\u30AB\u30EC\u30F3\u30C0\u30FC\u540D>")\`
|
|
91575
|
+
- Service Account \u81EA\u8EAB\u306B\u5171\u6709\u3055\u308C\u3066\u3044\u308B\u5834\u5408: \`- calendar: <calendarId> (service-account, name: "<\u30AB\u30EC\u30F3\u30C0\u30FC\u540D>")\`
|
|
91576
|
+
|
|
91577
|
+
#### \u5236\u7D04
|
|
91578
|
+
- \u4E0A\u8A18\u4EE5\u5916\u306E API \u547C\u3073\u51FA\u3057\u3092 setup \u4E2D\u306B\u884C\u308F\u306A\u3044
|
|
91579
|
+
- \u30C4\u30FC\u30EB\u547C\u3073\u51FA\u3057\u306E\u9593\u306F 1 \u6587\u3060\u3051\u66F8\u3044\u3066\u5373\u6B21\u306E\u30C4\u30FC\u30EB\u547C\u3073\u51FA\u3057`,
|
|
91580
|
+
en: `Set up the Google Calendar connection. Ask the user which calendars they want to access, discover the available ones, and record them in Project Knowledge.
|
|
91581
|
+
|
|
91582
|
+
1. Call \`askUserQuestion\` to collect target user emails:
|
|
91583
|
+
- \`type\`: \`"freeText"\`
|
|
91584
|
+
- \`question\`: "Enter the email addresses of the calendar owners you want to access (comma-separated for multiple)"
|
|
91585
|
+
- \`placeholder\`: \`"alice@example.com, bob@example.com"\`
|
|
91586
|
+
|
|
91587
|
+
2. Extract individual emails from the response. Discover calendars using both tools in parallel:
|
|
91588
|
+
a. Call \`${requestToolName}\` to list calendars shared directly with the service account. If \`success: false\`, record the failure and continue:
|
|
91589
|
+
- \`method\`: \`"GET"\`
|
|
91590
|
+
- \`path\`: \`"/users/me/calendarList"\`
|
|
91591
|
+
- \`scopes\`: \`${READONLY_SCOPES}\`
|
|
91592
|
+
b. For each email \`<email>\`, call \`${requestWithDelegationToolName}\` to list calendars accessible by that user via Domain-wide Delegation:
|
|
91593
|
+
- \`method\`: \`"GET"\`
|
|
91594
|
+
- \`path\`: \`"/users/me/calendarList"\`
|
|
91595
|
+
- \`subject\`: \`<email>\`
|
|
91596
|
+
- \`scopes\`: \`${READONLY_SCOPES}\`
|
|
91597
|
+
|
|
91598
|
+
3. Aggregate the discovery results from step 2 and call \`askUserQuestion\` for calendar selection:
|
|
91599
|
+
- If no calendars were found: take \`serviceAccountEmail\` from any failed tool response and call \`askUserQuestion\`. Include this guidance in \`question\`: "No accessible calendars found. With service account \`<serviceAccountEmail>\`, please do one of the following before continuing: (1) Ask your Workspace admin to authorize Domain-wide Delegation ([setup guide](https://support.google.com/a/answer/162106)), or (2) Share the target calendars with \`<serviceAccountEmail>\` ([sharing guide](https://support.google.com/calendar/answer/37082))".
|
|
91600
|
+
- \`options\`: \`[{ label: "Ready \u2014 retry", value: "retry" }, { label: "Re-enter the email addresses", value: "restart" }]\`
|
|
91601
|
+
- On "retry" \u2192 re-run step 2 with the previously entered email list
|
|
91602
|
+
- On "Re-enter" \u2192 re-run step 1
|
|
91603
|
+
- If there were partial failures: briefly mention them and proceed.
|
|
91604
|
+
- Calendar selection:
|
|
91605
|
+
- \`type\`: \`"multiSelect"\`
|
|
91606
|
+
- \`question\`: "Select the calendars to use (multiple allowed)"
|
|
91607
|
+
- \`options\`: For each calendar, \`label\`: \`"<calendar name> (access path)"\`, \`value\`: \`"<calendarId>"\`. Make the access path human-readable: \`"shared"\` for calendars found via 2a, \`"DwD: <the subject used>"\` for calendars found via 2b
|
|
91608
|
+
|
|
91609
|
+
4. Cross-reference the selected calendarIds with the step 2 discovery results to recover each calendar's access path and subject. Call \`finalizeSetup\`. Under \`#### \u30B9\u30B3\u30FC\u30D7\` in \`projectKnowledge\`, list each calendar on its own line:
|
|
91610
|
+
- Accessed via Domain-wide Delegation: \`- calendar: <calendarId> (delegation, subject: <subject>, name: "<calendar name>")\`
|
|
91611
|
+
- Shared directly with the service account: \`- calendar: <calendarId> (service-account, name: "<calendar name>")\`
|
|
91612
|
+
|
|
91613
|
+
#### Constraints
|
|
91614
|
+
- Do not call any other API endpoints during setup
|
|
91615
|
+
- Write at most 1 sentence between tool calls`
|
|
91616
|
+
},
|
|
91617
|
+
dataOverviewInstructions: {
|
|
91618
|
+
en: `For each calendar recorded under \`#### \u30B9\u30B3\u30FC\u30D7\`, fetch metadata and a small sample of upcoming events. The annotation on each line tells you which tool to use:
|
|
91619
|
+
- \`(delegation, subject: <email>, ...)\` \u2192 \`${requestWithDelegationToolName}\` with \`subject: <email>\`
|
|
91620
|
+
- \`(service-account, ...)\` \u2192 \`${requestToolName}\`
|
|
91621
|
+
|
|
91622
|
+
Pass \`scopes: ${READONLY_SCOPES}\` for every call.
|
|
91623
|
+
|
|
91624
|
+
For each calendar:
|
|
91625
|
+
1. \`method=GET\`, \`path=/calendars/<id>\` to fetch metadata.
|
|
91626
|
+
2. \`method=GET\`, \`path=/calendars/<id>/events\`, \`queryParams={ timeMin: <RFC3339 now>, maxResults: "10", singleEvents: "true", orderBy: "startTime" }\`.`,
|
|
91627
|
+
ja: `\`#### \u30B9\u30B3\u30FC\u30D7\` \u306E\u5404\u30AB\u30EC\u30F3\u30C0\u30FC\u306B\u3064\u3044\u3066\u3001\u30E1\u30BF\u30C7\u30FC\u30BF\u3068\u76F4\u8FD1\u306E\u30A4\u30D9\u30F3\u30C8\u3092\u5C11\u91CF\u53D6\u5F97\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u5404\u884C\u306E\u6CE8\u91C8\u3067\u4F7F\u7528\u3059\u308B\u30C4\u30FC\u30EB\u3092\u9078\u3073\u307E\u3059:
|
|
91628
|
+
- \`(delegation, subject: <email>, ...)\` \u2192 \`${requestWithDelegationToolName}\` \u3092 \`subject: <email>\` \u4ED8\u304D\u3067\u547C\u3076
|
|
91629
|
+
- \`(service-account, ...)\` \u2192 \`${requestToolName}\` \u3092\u547C\u3076
|
|
91630
|
+
|
|
91631
|
+
\`scopes\` \u306F\u6BCE\u56DE \`${READONLY_SCOPES}\` \u3092\u6E21\u3057\u3066\u304F\u3060\u3055\u3044\u3002
|
|
91632
|
+
|
|
91633
|
+
\u5404\u30AB\u30EC\u30F3\u30C0\u30FC\u306B\u3064\u3044\u3066:
|
|
91634
|
+
1. \`method=GET\`\u3001\`path=/calendars/<id>\` \u3067\u30E1\u30BF\u30C7\u30FC\u30BF\u3092\u53D6\u5F97
|
|
91635
|
+
2. \`method=GET\`\u3001\`path=/calendars/<id>/events\`\u3001\`queryParams={ timeMin: <RFC3339 \u306E\u73FE\u5728\u6642\u523B>, maxResults: "10", singleEvents: "true", orderBy: "startTime" }\``
|
|
91636
|
+
}
|
|
91637
|
+
});
|
|
91638
|
+
|
|
91658
91639
|
// ../connectors/src/connectors/google-calendar/index.ts
|
|
91659
|
-
var tools14 = {
|
|
91640
|
+
var tools14 = {
|
|
91641
|
+
request: requestTool5,
|
|
91642
|
+
request_with_delegation: requestWithDelegationTool
|
|
91643
|
+
};
|
|
91660
91644
|
var googleCalendarConnector = new ConnectorPlugin({
|
|
91661
91645
|
slug: "google-calendar",
|
|
91662
91646
|
authType: AUTH_TYPES.SERVICE_ACCOUNT,
|
|
@@ -91669,58 +91653,45 @@ var googleCalendarConnector = new ConnectorPlugin({
|
|
|
91669
91653
|
systemPrompt: {
|
|
91670
91654
|
en: `### Tools
|
|
91671
91655
|
|
|
91672
|
-
|
|
91656
|
+
This connector exposes two request tools that correspond to the two ways a Service Account can authenticate against the Google Calendar API:
|
|
91673
91657
|
|
|
91674
|
-
|
|
91658
|
+
- \`google-calendar-service-account_request_with_delegation\`: Call the Calendar API on behalf of the specified Workspace user via Domain-wide Delegation. Pass \`subject\` as the target user email. Requires DwD to be authorized for the service account in the Workspace admin console.
|
|
91659
|
+
- \`google-calendar-service-account_request\`: Call the Calendar API as the service account itself (no delegation). Only calendars explicitly shared with the service account email are accessible.
|
|
91675
91660
|
|
|
91676
|
-
|
|
91661
|
+
Both tools require a \`scopes\` argument.
|
|
91677
91662
|
|
|
91678
|
-
|
|
91679
|
-
- \`client.listCalendars()\` \u2014 list all accessible calendars
|
|
91680
|
-
- \`client.listEvents(options?, calendarId?)\` \u2014 list events with optional filters
|
|
91681
|
-
- \`client.getEvent(eventId, calendarId?)\` \u2014 get a single event by ID
|
|
91682
|
-
- \`client.request(path, init?)\` \u2014 low-level authenticated fetch
|
|
91663
|
+
### OAuth Scopes (pass as \`scopes\` argument)
|
|
91683
91664
|
|
|
91684
|
-
|
|
91665
|
+
This connector is currently read-only. Pass one of:
|
|
91685
91666
|
|
|
91686
|
-
|
|
91667
|
+
- \`https://www.googleapis.com/auth/calendar.readonly\` \u2014 read-only on calendars and events
|
|
91668
|
+
- \`https://www.googleapis.com/auth/calendar.events.readonly\` \u2014 read-only on events (no calendar metadata)
|
|
91669
|
+
- \`https://www.googleapis.com/auth/calendar.freebusy\` \u2014 busy/free time queries only
|
|
91687
91670
|
|
|
91688
|
-
|
|
91689
|
-
const calendar = connection("<connectionId>", { subject: "other-user@example.com" });
|
|
91690
|
-
\`\`\`
|
|
91671
|
+
For \`request_with_delegation\`, the Workspace admin must have authorized the requested scope for the service account in the Domain-wide Delegation settings, otherwise token issuance will fail with \`unauthorized_client\`.
|
|
91691
91672
|
|
|
91692
|
-
|
|
91693
|
-
import type { Context } from "hono";
|
|
91694
|
-
import { connection } from "@squadbase/vite-server/connectors/google-calendar";
|
|
91673
|
+
Per-endpoint scope reference: https://developers.google.com/calendar/api/auth
|
|
91695
91674
|
|
|
91696
|
-
|
|
91675
|
+
### Choosing the right tool
|
|
91697
91676
|
|
|
91698
|
-
|
|
91699
|
-
const now = new Date().toISOString();
|
|
91700
|
-
const { items } = await calendar.listEvents({
|
|
91701
|
-
timeMin: now,
|
|
91702
|
-
maxResults: 10,
|
|
91703
|
-
singleEvents: true,
|
|
91704
|
-
orderBy: "startTime",
|
|
91705
|
-
});
|
|
91677
|
+
Read \`#### \u30B9\u30B3\u30FC\u30D7\` in the project knowledge for this connection. Each calendar appears as a \`- calendar: <id> (...)\` line whose annotation tells you which tool to use:
|
|
91706
91678
|
|
|
91707
|
-
|
|
91708
|
-
|
|
91709
|
-
|
|
91710
|
-
|
|
91711
|
-
|
|
91712
|
-
|
|
91713
|
-
|
|
91714
|
-
|
|
91715
|
-
|
|
91716
|
-
|
|
91717
|
-
\`\`\`
|
|
91679
|
+
- \`(delegation, subject: <email>, name: "...")\` \u2192 use \`request_with_delegation\` and pass \`subject: <email>\`
|
|
91680
|
+
- \`(service-account, name: "...")\` \u2192 use \`request\` (no \`subject\`)
|
|
91681
|
+
|
|
91682
|
+
### Path conventions
|
|
91683
|
+
|
|
91684
|
+
Write the calendar ID directly into the path \u2014 there is no placeholder substitution. Examples:
|
|
91685
|
+
|
|
91686
|
+
- \`/users/me/calendarList\` \u2014 list calendars accessible to the authenticated identity
|
|
91687
|
+
- \`/calendars/alice@example.com/events\` \u2014 events on alice's primary calendar
|
|
91688
|
+
- \`/calendars/c_abc123@group.calendar.google.com/events\` \u2014 events on a secondary calendar
|
|
91718
91689
|
|
|
91719
91690
|
### Google Calendar API v3 Reference
|
|
91720
91691
|
|
|
91721
91692
|
#### Available Endpoints
|
|
91722
91693
|
- GET \`/calendars/{calendarId}\` \u2014 Get calendar metadata
|
|
91723
|
-
- GET \`/users/me/calendarList\` \u2014 List all calendars accessible by the authenticated
|
|
91694
|
+
- GET \`/users/me/calendarList\` \u2014 List all calendars accessible by the authenticated identity
|
|
91724
91695
|
- GET \`/calendars/{calendarId}/events\` \u2014 List events on a calendar
|
|
91725
91696
|
- GET \`/calendars/{calendarId}/events/{eventId}\` \u2014 Get a single event
|
|
91726
91697
|
|
|
@@ -91732,66 +91703,93 @@ export default async function handler(c: Context) {
|
|
|
91732
91703
|
- \`orderBy=startTime\` \u2014 Order by start time (requires singleEvents=true)
|
|
91733
91704
|
- \`q\` \u2014 Free text search terms
|
|
91734
91705
|
|
|
91735
|
-
#### Tips
|
|
91736
|
-
- Use \`{calendarId}\` placeholder in paths \u2014 it is automatically replaced with the configured default calendar ID
|
|
91737
|
-
- Set \`singleEvents=true\` to expand recurring events into individual instances
|
|
91738
|
-
- When using \`orderBy=startTime\`, you must also set \`singleEvents=true\`
|
|
91739
|
-
- Use RFC3339 format for time parameters (e.g., "2024-01-15T09:00:00Z" or "2024-01-15T09:00:00+09:00")
|
|
91740
|
-
- The default calendar ID is "primary" if not configured`,
|
|
91741
|
-
ja: `### \u30C4\u30FC\u30EB
|
|
91742
|
-
|
|
91743
|
-
- \`google-calendar-service-account_request\`: Google Calendar API\u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u30AB\u30EC\u30F3\u30C0\u30FC\u306E\u4E00\u89A7\u53D6\u5F97\u3001\u30A4\u30D9\u30F3\u30C8\u306E\u53D6\u5F97\u3001\u30AB\u30EC\u30F3\u30C0\u30FC\u30C7\u30FC\u30BF\u306E\u7BA1\u7406\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u30B5\u30FC\u30D3\u30B9\u30A2\u30AB\u30A6\u30F3\u30C8\uFF0BDomain-wide Delegation\u3067\u8A8D\u8A3C\u304C\u81EA\u52D5\u7684\u306B\u51E6\u7406\u3055\u308C\u3001\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306B\u8A2D\u5B9A\u3055\u308C\u305F\u30E6\u30FC\u30B6\u30FC\uFF08\`impersonate-email\`\u30D1\u30E9\u30E1\u30FC\u30BF\uFF09\u3068\u3057\u3066\u52D5\u4F5C\u3057\u307E\u3059\u3002\u30D1\u30B9\u5185\u306E{calendarId}\u30D7\u30EC\u30FC\u30B9\u30DB\u30EB\u30C0\u30FC\u306F\u8A2D\u5B9A\u6E08\u307F\u306E\u30C7\u30D5\u30A9\u30EB\u30C8\u30AB\u30EC\u30F3\u30C0\u30FCID\u3067\u81EA\u52D5\u7684\u306B\u7F6E\u63DB\u3055\u308C\u307E\u3059\u3002\u7279\u5B9A\u30EA\u30AF\u30A8\u30B9\u30C8\u3067\u8A2D\u5B9A\u30E6\u30FC\u30B6\u30FC\u3092\u4E0A\u66F8\u304D\u3057\u305F\u3044\u5834\u5408\u306E\u307F\u3001\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\`subject\`\u30D1\u30E9\u30E1\u30FC\u30BF\u3092\u6E21\u3057\u3066\u304F\u3060\u3055\u3044\u3002
|
|
91744
|
-
|
|
91745
91706
|
### Business Logic
|
|
91746
91707
|
|
|
91747
|
-
|
|
91708
|
+
The business logic type for this connector is "typescript". Use the connector SDK in your handler. Do NOT read credentials from environment variables.
|
|
91748
91709
|
|
|
91749
|
-
SDK
|
|
91750
|
-
- \`client.listCalendars()\` \u2014 \u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306A\u5168\u30AB\u30EC\u30F3\u30C0\u30FC\u306E\u4E00\u89A7\u53D6\u5F97
|
|
91751
|
-
- \`client.listEvents(options?, calendarId?)\` \u2014 \u30D5\u30A3\u30EB\u30BF\u30FC\u4ED8\u304D\u30A4\u30D9\u30F3\u30C8\u4E00\u89A7\u53D6\u5F97
|
|
91752
|
-
- \`client.getEvent(eventId, calendarId?)\` \u2014 ID\u306B\u3088\u308B\u5358\u4E00\u30A4\u30D9\u30F3\u30C8\u53D6\u5F97
|
|
91753
|
-
- \`client.request(path, init?)\` \u2014 \u4F4E\u30EC\u30D9\u30EB\u306E\u8A8D\u8A3C\u4ED8\u304Dfetch
|
|
91710
|
+
SDK methods (client created via \`connection(connectionId)\`):
|
|
91754
91711
|
|
|
91755
|
-
|
|
91712
|
+
- \`client.requestWithDelegation(path, { subject, scopes, init? })\` \u2014 call the API as the impersonated Workspace user via Domain-wide Delegation
|
|
91713
|
+
- \`client.request(path, { scopes, init? })\` \u2014 call the API as the service account itself (only calendars shared with the SA email are accessible)
|
|
91756
91714
|
|
|
91757
|
-
|
|
91715
|
+
Both methods take \`scopes\` \u2014 pass the minimum scope(s) for the endpoint. Both return a standard \`Response\`. Read the body with \`.json()\`. Same path conventions as the tools.
|
|
91758
91716
|
|
|
91759
|
-
|
|
91760
|
-
const calendar = connection("<connectionId>", { subject: "other-user@example.com" });
|
|
91761
|
-
\`\`\`
|
|
91717
|
+
#### Example
|
|
91762
91718
|
|
|
91763
91719
|
\`\`\`ts
|
|
91764
91720
|
import type { Context } from "hono";
|
|
91765
91721
|
import { connection } from "@squadbase/vite-server/connectors/google-calendar";
|
|
91766
91722
|
|
|
91767
91723
|
const calendar = connection("<connectionId>");
|
|
91724
|
+
const READ = ["https://www.googleapis.com/auth/calendar.readonly"];
|
|
91768
91725
|
|
|
91769
91726
|
export default async function handler(c: Context) {
|
|
91770
91727
|
const now = new Date().toISOString();
|
|
91771
|
-
const
|
|
91728
|
+
const qs = new URLSearchParams({
|
|
91772
91729
|
timeMin: now,
|
|
91773
|
-
maxResults: 10,
|
|
91774
|
-
singleEvents: true,
|
|
91730
|
+
maxResults: "10",
|
|
91731
|
+
singleEvents: "true",
|
|
91775
91732
|
orderBy: "startTime",
|
|
91776
91733
|
});
|
|
91777
91734
|
|
|
91778
|
-
|
|
91779
|
-
|
|
91780
|
-
|
|
91781
|
-
|
|
91782
|
-
start: event.start.dateTime ?? event.start.date,
|
|
91783
|
-
end: event.end.dateTime ?? event.end.date,
|
|
91784
|
-
location: event.location,
|
|
91785
|
-
})),
|
|
91735
|
+
// Project knowledge says: alice@example.com is reachable via delegation
|
|
91736
|
+
const aliceRes = await calendar.requestWithDelegation(
|
|
91737
|
+
\`/calendars/alice@example.com/events?\${qs}\`,
|
|
91738
|
+
{ subject: "alice@example.com", scopes: READ },
|
|
91786
91739
|
);
|
|
91740
|
+
const alice = await aliceRes.json();
|
|
91741
|
+
|
|
91742
|
+
// Project knowledge says: team@example.com is shared with the SA
|
|
91743
|
+
const teamRes = await calendar.request(
|
|
91744
|
+
\`/calendars/team@example.com/events?\${qs}\`,
|
|
91745
|
+
{ scopes: READ },
|
|
91746
|
+
);
|
|
91747
|
+
const team = await teamRes.json();
|
|
91748
|
+
|
|
91749
|
+
return c.json({ alice: alice.items, team: team.items });
|
|
91787
91750
|
}
|
|
91788
|
-
|
|
91751
|
+
\`\`\``,
|
|
91752
|
+
ja: `### \u30C4\u30FC\u30EB
|
|
91753
|
+
|
|
91754
|
+
\u3053\u306E\u30B3\u30CD\u30AF\u30BF\u30FC\u306F\u3001Service Account \u304C Google Calendar API \u306B\u8A8D\u8A3C\u3059\u308B 2 \u3064\u306E\u65B9\u6CD5\u306B\u5BFE\u5FDC\u3059\u308B 2 \u3064\u306E request \u30C4\u30FC\u30EB\u3092\u516C\u958B\u3057\u307E\u3059:
|
|
91755
|
+
|
|
91756
|
+
- \`google-calendar-service-account_request_with_delegation\`: \u6307\u5B9A\u3055\u308C\u305F Workspace \u30E6\u30FC\u30B6\u30FC\u306B\u4EE3\u308F\u3063\u3066 Domain-wide Delegation \u7D4C\u7531\u3067 Calendar API \u3092\u547C\u3073\u51FA\u3057\u307E\u3059\u3002\u4EE3\u7406\u5BFE\u8C61\u306E\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092 \`subject\` \u3068\u3057\u3066\u6E21\u3057\u3066\u304F\u3060\u3055\u3044\u3002Workspace \u7BA1\u7406\u30B3\u30F3\u30BD\u30FC\u30EB\u3067 Service Account \u306E DwD \u304C\u627F\u8A8D\u3055\u308C\u3066\u3044\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
|
|
91757
|
+
- \`google-calendar-service-account_request\`: Service Account \u81EA\u8EAB\u3068\u3057\u3066 Calendar API \u3092\u547C\u3073\u51FA\u3057\u307E\u3059\uFF08DwD \u306A\u3057\uFF09\u3002Service Account \u306E\u30E1\u30A2\u30C9\u306B\u660E\u793A\u7684\u306B\u5171\u6709\u3055\u308C\u3066\u3044\u308B\u30AB\u30EC\u30F3\u30C0\u30FC\u306E\u307F\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u3067\u3059\u3002
|
|
91758
|
+
|
|
91759
|
+
\u4E21\u30C4\u30FC\u30EB\u3068\u3082 \`scopes\` \u5F15\u6570\u304C\u5FC5\u9808\u3067\u3059\u3002
|
|
91760
|
+
|
|
91761
|
+
### OAuth \u30B9\u30B3\u30FC\u30D7 (\`scopes\` \u5F15\u6570\u3067\u6E21\u3059)
|
|
91762
|
+
|
|
91763
|
+
\u3053\u306E\u30B3\u30CD\u30AF\u30BF\u30FC\u306F\u73FE\u72B6\u8AAD\u307F\u53D6\u308A\u5C02\u7528\u3067\u3059\u3002\u6B21\u306E\u3044\u305A\u308C\u304B\u3092\u6E21\u3057\u3066\u304F\u3060\u3055\u3044:
|
|
91764
|
+
|
|
91765
|
+
- \`https://www.googleapis.com/auth/calendar.readonly\` \u2014 \u30AB\u30EC\u30F3\u30C0\u30FC\u3068\u30A4\u30D9\u30F3\u30C8\u306E\u8AAD\u307F\u53D6\u308A
|
|
91766
|
+
- \`https://www.googleapis.com/auth/calendar.events.readonly\` \u2014 \u30A4\u30D9\u30F3\u30C8\u306E\u307F\u8AAD\u307F\u53D6\u308A\uFF08\u30AB\u30EC\u30F3\u30C0\u30FC\u30E1\u30BF\u30C7\u30FC\u30BF\u4E0D\u53EF\uFF09
|
|
91767
|
+
- \`https://www.googleapis.com/auth/calendar.freebusy\` \u2014 \u7A7A\u304D\u72B6\u6CC1\u30AF\u30A8\u30EA\u306E\u307F
|
|
91768
|
+
|
|
91769
|
+
\`request_with_delegation\` \u306E\u5834\u5408\u3001\u8981\u6C42\u3059\u308B scope \u306F Workspace \u7BA1\u7406\u8005\u304C Domain-wide Delegation \u8A2D\u5B9A\u3067\u5F53\u8A72 Service Account \u306B\u5BFE\u3057\u3066\u627F\u8A8D\u3057\u3066\u3044\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\u627F\u8A8D\u3055\u308C\u3066\u3044\u306A\u3044\u5834\u5408\u30C8\u30FC\u30AF\u30F3\u767A\u884C\u304C \`unauthorized_client\` \u3067\u5931\u6557\u3057\u307E\u3059\u3002
|
|
91770
|
+
|
|
91771
|
+
\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\u5225\u306E\u6B63\u78BA\u306A scope \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9: https://developers.google.com/calendar/api/auth
|
|
91772
|
+
|
|
91773
|
+
### \u9069\u5207\u306A\u30C4\u30FC\u30EB\u306E\u9078\u3073\u65B9
|
|
91774
|
+
|
|
91775
|
+
\u3053\u306E\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306E Project Knowledge \u306E \`#### \u30B9\u30B3\u30FC\u30D7\` \u3092\u8AAD\u3093\u3067\u304F\u3060\u3055\u3044\u3002\u5404\u30AB\u30EC\u30F3\u30C0\u30FC\u306F \`- calendar: <id> (...)\` \u5F62\u5F0F\u306E\u884C\u3068\u3057\u3066\u8A18\u9332\u3055\u308C\u3066\u304A\u308A\u3001\u6CE8\u91C8\u304C\u3069\u3061\u3089\u306E\u30C4\u30FC\u30EB\u3092\u4F7F\u3046\u3079\u304D\u304B\u3092\u793A\u3057\u307E\u3059:
|
|
91776
|
+
|
|
91777
|
+
- \`(delegation, subject: <email>, name: "...")\` \u2192 \`request_with_delegation\` \u3092\u4F7F\u3044\u3001\`subject: <email>\` \u3092\u6E21\u3059
|
|
91778
|
+
- \`(service-account, name: "...")\` \u2192 \`request\` \u3092\u4F7F\u3046\uFF08\`subject\` \u4E0D\u8981\uFF09
|
|
91779
|
+
|
|
91780
|
+
### \u30D1\u30B9\u306E\u66F8\u304D\u65B9
|
|
91781
|
+
|
|
91782
|
+
calendar ID \u3092\u30D1\u30B9\u306B\u76F4\u63A5\u66F8\u3044\u3066\u304F\u3060\u3055\u3044\u3002\u30D7\u30EC\u30FC\u30B9\u30DB\u30EB\u30C0\u30FC\u306E\u7F6E\u63DB\u306F\u3042\u308A\u307E\u305B\u3093\u3002\u4F8B:
|
|
91783
|
+
|
|
91784
|
+
- \`/users/me/calendarList\` \u2014 \u8A8D\u8A3C\u3055\u308C\u305F\u8B58\u5225\u5B50\u304C\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306A\u30AB\u30EC\u30F3\u30C0\u30FC\u4E00\u89A7
|
|
91785
|
+
- \`/calendars/alice@example.com/events\` \u2014 alice \u306E\u30D7\u30E9\u30A4\u30DE\u30EA\u30AB\u30EC\u30F3\u30C0\u30FC\u306E\u30A4\u30D9\u30F3\u30C8
|
|
91786
|
+
- \`/calendars/c_abc123@group.calendar.google.com/events\` \u2014 \u4E8C\u6B21\u30AB\u30EC\u30F3\u30C0\u30FC\u306E\u30A4\u30D9\u30F3\u30C8
|
|
91789
91787
|
|
|
91790
91788
|
### Google Calendar API v3 \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
91791
91789
|
|
|
91792
91790
|
#### \u5229\u7528\u53EF\u80FD\u306A\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8
|
|
91793
91791
|
- GET \`/calendars/{calendarId}\` \u2014 \u30AB\u30EC\u30F3\u30C0\u30FC\u306E\u30E1\u30BF\u30C7\u30FC\u30BF\u3092\u53D6\u5F97
|
|
91794
|
-
- GET \`/users/me/calendarList\` \u2014 \u8A8D\u8A3C\
|
|
91792
|
+
- GET \`/users/me/calendarList\` \u2014 \u8A8D\u8A3C\u3055\u308C\u305F\u8B58\u5225\u5B50\u304C\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306A\u5168\u30AB\u30EC\u30F3\u30C0\u30FC\u306E\u4E00\u89A7
|
|
91795
91793
|
- GET \`/calendars/{calendarId}/events\` \u2014 \u30AB\u30EC\u30F3\u30C0\u30FC\u4E0A\u306E\u30A4\u30D9\u30F3\u30C8\u4E00\u89A7
|
|
91796
91794
|
- GET \`/calendars/{calendarId}/events/{eventId}\` \u2014 \u5358\u4E00\u30A4\u30D9\u30F3\u30C8\u306E\u53D6\u5F97
|
|
91797
91795
|
|
|
@@ -91803,12 +91801,52 @@ export default async function handler(c: Context) {
|
|
|
91803
91801
|
- \`orderBy=startTime\` \u2014 \u958B\u59CB\u6642\u9593\u9806\u306B\u4E26\u3079\u66FF\u3048\uFF08singleEvents=true\u304C\u5FC5\u8981\uFF09
|
|
91804
91802
|
- \`q\` \u2014 \u30D5\u30EA\u30FC\u30C6\u30AD\u30B9\u30C8\u691C\u7D22\u8A9E
|
|
91805
91803
|
|
|
91806
|
-
|
|
91807
|
-
|
|
91808
|
-
|
|
91809
|
-
|
|
91810
|
-
|
|
91811
|
-
|
|
91804
|
+
### Business Logic
|
|
91805
|
+
|
|
91806
|
+
\u3053\u306E\u30B3\u30CD\u30AF\u30BF\u306E\u30D3\u30B8\u30CD\u30B9\u30ED\u30B8\u30C3\u30AF\u30BF\u30A4\u30D7\u306F "typescript" \u3067\u3059\u3002\u30CF\u30F3\u30C9\u30E9\u5185\u3067\u306F\u30B3\u30CD\u30AF\u30BFSDK\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u74B0\u5883\u5909\u6570\u304B\u3089\u8A8D\u8A3C\u60C5\u5831\u3092\u8AAD\u307F\u53D6\u3089\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002
|
|
91807
|
+
|
|
91808
|
+
SDK\u30E1\u30BD\u30C3\u30C9 (\`connection(connectionId)\` \u3067\u4F5C\u6210\u3057\u305F\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8):
|
|
91809
|
+
|
|
91810
|
+
- \`client.requestWithDelegation(path, { subject, scopes, init? })\` \u2014 DwD \u3067 Workspace \u30E6\u30FC\u30B6\u30FC\u306B\u306A\u308A\u3059\u307E\u3057\u3066 API \u3092\u547C\u3076
|
|
91811
|
+
- \`client.request(path, { scopes, init? })\` \u2014 SA \u81EA\u8EAB\u3068\u3057\u3066 API \u3092\u547C\u3076\uFF08SA \u306B\u5171\u6709\u3055\u308C\u305F\u30AB\u30EC\u30F3\u30C0\u30FC\u306E\u307F\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\uFF09
|
|
91812
|
+
|
|
91813
|
+
\u4E21\u30E1\u30BD\u30C3\u30C9\u3068\u3082 \`scopes\` \u3092\u53D7\u3051\u53D6\u308A\u307E\u3059\u3002\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\u306B\u5FC5\u8981\u306A\u6700\u5C0F scope \u3092\u6E21\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u6A19\u6E96\u306E \`Response\` \u3092\u8FD4\u3059\u306E\u3067 \`response.json()\` \u3067\u30DC\u30C7\u30A3\u3092\u53D6\u5F97\u3057\u307E\u3059\u3002\u30D1\u30B9\u306E\u66F8\u304D\u65B9\u306F\u30C4\u30FC\u30EB\u3068\u540C\u3058\u3002
|
|
91814
|
+
|
|
91815
|
+
#### Example
|
|
91816
|
+
|
|
91817
|
+
\`\`\`ts
|
|
91818
|
+
import type { Context } from "hono";
|
|
91819
|
+
import { connection } from "@squadbase/vite-server/connectors/google-calendar";
|
|
91820
|
+
|
|
91821
|
+
const calendar = connection("<connectionId>");
|
|
91822
|
+
const READ = ["https://www.googleapis.com/auth/calendar.readonly"];
|
|
91823
|
+
|
|
91824
|
+
export default async function handler(c: Context) {
|
|
91825
|
+
const now = new Date().toISOString();
|
|
91826
|
+
const qs = new URLSearchParams({
|
|
91827
|
+
timeMin: now,
|
|
91828
|
+
maxResults: "10",
|
|
91829
|
+
singleEvents: "true",
|
|
91830
|
+
orderBy: "startTime",
|
|
91831
|
+
});
|
|
91832
|
+
|
|
91833
|
+
// Project Knowledge: alice@example.com \u306F delegation \u7D4C\u8DEF\u3067\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD
|
|
91834
|
+
const aliceRes = await calendar.requestWithDelegation(
|
|
91835
|
+
\`/calendars/alice@example.com/events?\${qs}\`,
|
|
91836
|
+
{ subject: "alice@example.com", scopes: READ },
|
|
91837
|
+
);
|
|
91838
|
+
const alice = await aliceRes.json();
|
|
91839
|
+
|
|
91840
|
+
// Project Knowledge: team@example.com \u306F SA \u306B\u5171\u6709\u3055\u308C\u3066\u3044\u308B
|
|
91841
|
+
const teamRes = await calendar.request(
|
|
91842
|
+
\`/calendars/team@example.com/events?\${qs}\`,
|
|
91843
|
+
{ scopes: READ },
|
|
91844
|
+
);
|
|
91845
|
+
const team = await teamRes.json();
|
|
91846
|
+
|
|
91847
|
+
return c.json({ alice: alice.items, team: team.items });
|
|
91848
|
+
}
|
|
91849
|
+
\`\`\``
|
|
91812
91850
|
},
|
|
91813
91851
|
tools: tools14
|
|
91814
91852
|
});
|
|
@@ -91871,7 +91909,7 @@ var outputSchema23 = z23.discriminatedUnion("success", [
|
|
|
91871
91909
|
error: z23.string()
|
|
91872
91910
|
})
|
|
91873
91911
|
]);
|
|
91874
|
-
var
|
|
91912
|
+
var listCalendarsTool = new ConnectorTool({
|
|
91875
91913
|
name: "listCalendars",
|
|
91876
91914
|
description: "List all Google Calendars accessible with the OAuth credentials. Use during setup to discover available calendars.",
|
|
91877
91915
|
inputSchema: inputSchema23,
|
|
@@ -91932,12 +91970,12 @@ var listCalendarsTool2 = new ConnectorTool({
|
|
|
91932
91970
|
});
|
|
91933
91971
|
|
|
91934
91972
|
// ../connectors/src/connectors/google-calendar-oauth/setup.ts
|
|
91935
|
-
var
|
|
91973
|
+
var listCalendarsToolName = `google-calendar-oauth_${listCalendarsTool.name}`;
|
|
91936
91974
|
var googleCalendarOauthOnboarding = new ConnectorOnboarding({
|
|
91937
91975
|
connectionSetupInstructions: {
|
|
91938
91976
|
ja: `\u4EE5\u4E0B\u306E\u624B\u9806\u3067Google Calendar (OAuth) \u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306E\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002
|
|
91939
91977
|
|
|
91940
|
-
1. \`${
|
|
91978
|
+
1. \`${listCalendarsToolName}\` \u3092\u547C\u3073\u51FA\u3057\u3066\u3001OAuth\u3067\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306A\u30AB\u30EC\u30F3\u30C0\u30FC\u4E00\u89A7\u3092\u53D6\u5F97\u3059\u308B
|
|
91941
91979
|
2. \u300C\u4F7F\u7528\u3059\u308B\u30AB\u30EC\u30F3\u30C0\u30FC\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u300D\u3068\u30E6\u30FC\u30B6\u30FC\u306B\u4F1D\u3048\u305F\u4E0A\u3067\u3001\`askUserQuestion\` \u3092\u547C\u3073\u51FA\u3059:
|
|
91942
91980
|
- \`options\`: \u30AB\u30EC\u30F3\u30C0\u30FC\u4E00\u89A7\u3002\u5404 option \u306E \`label\` \u306F \`\u30AB\u30EC\u30F3\u30C0\u30FC\u540D (id: \u30AB\u30EC\u30F3\u30C0\u30FCID)\` \u306E\u5F62\u5F0F\u3001\`value\` \u306F\u30AB\u30EC\u30F3\u30C0\u30FCID
|
|
91943
91981
|
3. \`updateConnectionParameters\` \u3092\u547C\u3073\u51FA\u3059:
|
|
@@ -91949,7 +91987,7 @@ var googleCalendarOauthOnboarding = new ConnectorOnboarding({
|
|
|
91949
91987
|
- \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`,
|
|
91950
91988
|
en: `Follow these steps to set up the Google Calendar (OAuth) connection.
|
|
91951
91989
|
|
|
91952
|
-
1. Call \`${
|
|
91990
|
+
1. Call \`${listCalendarsToolName}\` to get the list of calendars accessible with the OAuth credentials
|
|
91953
91991
|
2. Tell the user "Please select a calendar.", then call \`askUserQuestion\`:
|
|
91954
91992
|
- \`options\`: The calendar list. Each option's \`label\` should be \`Calendar Name (id: calendarId)\`, \`value\` should be the calendar ID
|
|
91955
91993
|
3. Call \`updateConnectionParameters\`:
|
|
@@ -92105,7 +92143,7 @@ Authentication is handled automatically via OAuth proxy.
|
|
|
92105
92143
|
// ../connectors/src/connectors/google-calendar-oauth/index.ts
|
|
92106
92144
|
var tools15 = {
|
|
92107
92145
|
request: requestTool6,
|
|
92108
|
-
listCalendars:
|
|
92146
|
+
listCalendars: listCalendarsTool
|
|
92109
92147
|
};
|
|
92110
92148
|
var googleCalendarOauthConnector = new ConnectorPlugin({
|
|
92111
92149
|
slug: "google-calendar",
|
|
@@ -93141,7 +93179,7 @@ Authentication is handled automatically via OAuth proxy.`,
|
|
|
93141
93179
|
});
|
|
93142
93180
|
|
|
93143
93181
|
// ../connectors/src/connectors/google-sheets/setup.ts
|
|
93144
|
-
var
|
|
93182
|
+
var requestToolName2 = `google-sheets-oauth_${requestTool9.name}`;
|
|
93145
93183
|
var googleSheetsOnboarding = new ConnectorOnboarding({
|
|
93146
93184
|
connectionSetupInstructions: {
|
|
93147
93185
|
ja: `\u4EE5\u4E0B\u306E\u624B\u9806\u3067Google Sheets (OAuth) \u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306E\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002\u3053\u306E\u30B3\u30CD\u30AF\u30BF\u306F\u8AAD\u307F\u66F8\u304D\u53EF\u80FD\u306A\u30B9\u30B3\u30FC\u30D7 (\`spreadsheets\`) \u3067\u63A5\u7D9A\u3055\u308C\u3001OAuth\u8A8D\u8A3C\u3057\u305FGoogle\u30A2\u30AB\u30A6\u30F3\u30C8\u304C\u6A29\u9650\u3092\u6301\u3064\u4EFB\u610F\u306E\u30B9\u30D7\u30EC\u30C3\u30C9\u30B7\u30FC\u30C8\u306B\u5BFE\u3057\u3066\u8AAD\u307F\u66F8\u304D\u3067\u304D\u307E\u3059\u3002
|
|
@@ -93151,12 +93189,12 @@ var googleSheetsOnboarding = new ConnectorOnboarding({
|
|
|
93151
93189
|
- \`question\`: \u300C\u64CD\u4F5C\u3057\u305F\u3044Google Sheets\u306EURL\u3092\u8CBC\u308A\u4ED8\u3051\u3066\u304F\u3060\u3055\u3044\uFF08\u8AAD\u307F\u53D6\u308A\u30FB\u7DE8\u96C6\u3069\u3061\u3089\u3082\u53EF\u80FD\u3067\u3059\uFF09\u300D
|
|
93152
93190
|
- \`placeholder\`: \`"https://docs.google.com/spreadsheets/d/.../edit"\`
|
|
93153
93191
|
2. \u53D7\u3051\u53D6\u3063\u305FURL\u304B\u3089\u30B9\u30D7\u30EC\u30C3\u30C9\u30B7\u30FC\u30C8ID\u3092\u62BD\u51FA\u3059\u308B\u3002URL\u306E \`/d/\` \u3068 \`/edit\`\uFF08\u307E\u305F\u306F\u672B\u5C3E\uFF09\u306E\u9593\u306B\u3042\u308B\u6587\u5B57\u5217\u304C\u30B9\u30D7\u30EC\u30C3\u30C9\u30B7\u30FC\u30C8ID\u3067\u3059\uFF08\u4F8B: \`https://docs.google.com/spreadsheets/d/1AbCxyz.../edit\` \u2192 \`1AbCxyz...\`\uFF09\u3002URL\u3067\u306F\u306A\u304FID\u3060\u3051\u304C\u6E21\u3055\u308C\u305F\u5834\u5408\u306F\u305D\u306E\u307E\u307E\u5229\u7528\u3057\u307E\u3059\u3002
|
|
93154
|
-
3. \`${
|
|
93192
|
+
3. \`${requestToolName2}\` \u3067\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u6027\u3092\u78BA\u8A8D\u3059\u308B:
|
|
93155
93193
|
- \`method\`: \`"GET"\`
|
|
93156
93194
|
- \`path\`: \`"/<\u62BD\u51FA\u3057\u305FspreadsheetId>"\`
|
|
93157
93195
|
4. **\u691C\u8A3C\u5931\u6557\u6642\u306E\u518D\u30D2\u30A2\u30EA\u30F3\u30B0**: \u30B9\u30C6\u30C3\u30D73\u304C \`success: false\` \u3092\u8FD4\u3057\u305F\u5834\u5408\uFF08404/403/\u898B\u3064\u304B\u3089\u306A\u3044\u7B49\uFF09\u3001\u4EE5\u4E0B\u306E\u624B\u9806\u3067\u518D\u8A66\u884C\u3059\u308B:
|
|
93158
93196
|
a. \u30E6\u30FC\u30B6\u30FC\u306B\u539F\u56E0\u306E\u53EF\u80FD\u6027\u3092\u4F1D\u3048\u308B\uFF08URL\u304C\u9593\u9055\u3063\u3066\u3044\u308B\u3001OAuth\u9023\u643A\u3057\u305FGoogle\u30A2\u30AB\u30A6\u30F3\u30C8\u306B\u30A2\u30AF\u30BB\u30B9\u6A29\u9650\u304C\u306A\u3044\u3001\u30D7\u30E9\u30A4\u30D9\u30FC\u30C8\u30B7\u30FC\u30C8\u3067\u5225\u30A2\u30AB\u30A6\u30F3\u30C8\u3068\u5171\u6709\u3055\u308C\u3066\u3044\u308B \u7B49\uFF09
|
|
93159
|
-
b. \`askUserQuestion\` \u3067\u3082\u3046\u4E00\u5EA6URL\u3092\u805E\u304D\u76F4\u3057\u3001\u518D\u5EA6 \`${
|
|
93197
|
+
b. \`askUserQuestion\` \u3067\u3082\u3046\u4E00\u5EA6URL\u3092\u805E\u304D\u76F4\u3057\u3001\u518D\u5EA6 \`${requestToolName2}\` \u3067\u691C\u8A3C
|
|
93160
93198
|
c. \u6210\u529F\u3059\u308B\u307E\u3067\uFF08\u307E\u305F\u306F\u30E6\u30FC\u30B6\u30FC\u304C\u4E2D\u65AD\u3059\u308B\u307E\u3067\uFF09\u3053\u306E\u30EB\u30FC\u30D7\u3092\u7E70\u308A\u8FD4\u3059
|
|
93161
93199
|
|
|
93162
93200
|
#### \u5236\u7D04
|
|
@@ -93170,12 +93208,12 @@ var googleSheetsOnboarding = new ConnectorOnboarding({
|
|
|
93170
93208
|
- \`question\`: "Please paste the URL of the Google Sheet you want to work with (both read and edit are supported)."
|
|
93171
93209
|
- \`placeholder\`: \`"https://docs.google.com/spreadsheets/d/.../edit"\`
|
|
93172
93210
|
2. Extract the spreadsheet ID from the URL. It is the segment between \`/d/\` and \`/edit\` (or the end of the URL), e.g. \`https://docs.google.com/spreadsheets/d/1AbCxyz.../edit\` \u2192 \`1AbCxyz...\`. If the user pasted just the ID, use it as-is.
|
|
93173
|
-
3. Verify accessibility by calling \`${
|
|
93211
|
+
3. Verify accessibility by calling \`${requestToolName2}\`:
|
|
93174
93212
|
- \`method\`: \`"GET"\`
|
|
93175
93213
|
- \`path\`: \`"/<extracted spreadsheetId>"\`
|
|
93176
93214
|
4. **Retry on verification failure**: If step 3 returns \`success: false\` (404/403/not found or any other error):
|
|
93177
93215
|
a. Tell the user the likely causes (wrong URL, OAuth-connected Google account lacks access, private sheet shared with a different account, etc.)
|
|
93178
|
-
b. Call \`askUserQuestion\` again to re-ask for the URL and re-verify with \`${
|
|
93216
|
+
b. Call \`askUserQuestion\` again to re-ask for the URL and re-verify with \`${requestToolName2}\`
|
|
93179
93217
|
c. Repeat until verification succeeds (or the user aborts)
|
|
93180
93218
|
|
|
93181
93219
|
#### Constraints
|
|
@@ -93184,10 +93222,10 @@ var googleSheetsOnboarding = new ConnectorOnboarding({
|
|
|
93184
93222
|
- Write only 1 sentence between tool calls, then immediately call the next tool. Skip unnecessary explanations and proceed efficiently.`
|
|
93185
93223
|
},
|
|
93186
93224
|
dataOverviewInstructions: {
|
|
93187
|
-
en: `1. Call ${
|
|
93188
|
-
2. For each sheet of interest, call ${
|
|
93189
|
-
ja: `1. ${
|
|
93190
|
-
2. \u4E3B\u8981\u306A\u30B7\u30FC\u30C8\u306B\u3064\u3044\u3066 ${
|
|
93225
|
+
en: `1. Call ${requestToolName2} with GET /<spreadsheetId> to fetch spreadsheet metadata (sheet names, grid properties)
|
|
93226
|
+
2. For each sheet of interest, call ${requestToolName2} with GET /<spreadsheetId>/values/<SheetName>!A1:Z5 to sample the first rows and understand the column layout`,
|
|
93227
|
+
ja: `1. ${requestToolName2} \u3067 GET /<spreadsheetId> \u3092\u547C\u3073\u51FA\u3057\u3001\u30B9\u30D7\u30EC\u30C3\u30C9\u30B7\u30FC\u30C8\u306E\u30E1\u30BF\u30C7\u30FC\u30BF\uFF08\u30B7\u30FC\u30C8\u540D\u3001\u30B0\u30EA\u30C3\u30C9\u30D7\u30ED\u30D1\u30C6\u30A3\uFF09\u3092\u53D6\u5F97
|
|
93228
|
+
2. \u4E3B\u8981\u306A\u30B7\u30FC\u30C8\u306B\u3064\u3044\u3066 ${requestToolName2} \u3067 GET /<spreadsheetId>/values/<\u30B7\u30FC\u30C8\u540D>!A1:Z5 \u3092\u547C\u3073\u51FA\u3057\u3001\u5148\u982D\u6570\u884C\u3092\u30B5\u30F3\u30D7\u30EA\u30F3\u30B0\u3057\u3066\u30AB\u30E9\u30E0\u69CB\u9020\u3092\u628A\u63E1`
|
|
93191
93229
|
}
|
|
93192
93230
|
});
|
|
93193
93231
|
|
|
@@ -93803,12 +93841,12 @@ Authentication is handled automatically via OAuth proxy.`,
|
|
|
93803
93841
|
});
|
|
93804
93842
|
|
|
93805
93843
|
// ../connectors/src/connectors/hubspot-oauth/setup.ts
|
|
93806
|
-
var
|
|
93844
|
+
var requestToolName3 = `hubspot-oauth_${requestTool11.name}`;
|
|
93807
93845
|
var hubspotOnboarding = new ConnectorOnboarding({
|
|
93808
93846
|
connectionSetupInstructions: {
|
|
93809
93847
|
ja: `\u4EE5\u4E0B\u306E\u624B\u9806\u3067HubSpot\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306E\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002
|
|
93810
93848
|
|
|
93811
|
-
1. \`${
|
|
93849
|
+
1. \`${requestToolName3}\` \u3092\u547C\u3073\u51FA\u3057\u3066\u3001\u30A2\u30AB\u30A6\u30F3\u30C8\u60C5\u5831\u3092\u53D6\u5F97\u3059\u308B:
|
|
93812
93850
|
- \`method\`: \`"GET"\`
|
|
93813
93851
|
- \`path\`: \`"/account-info/v3/details"\`
|
|
93814
93852
|
2. \u30A8\u30E9\u30FC\u304C\u8FD4\u3055\u308C\u305F\u5834\u5408\u3001\u30E6\u30FC\u30B6\u30FC\u306BOAuth\u63A5\u7D9A\u306E\u8A2D\u5B9A\u3092\u78BA\u8A8D\u3059\u308B\u3088\u3046\u4F1D\u3048\u308B
|
|
@@ -93818,7 +93856,7 @@ var hubspotOnboarding = new ConnectorOnboarding({
|
|
|
93818
93856
|
- \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`,
|
|
93819
93857
|
en: `Follow these steps to set up the HubSpot connection.
|
|
93820
93858
|
|
|
93821
|
-
1. Call \`${
|
|
93859
|
+
1. Call \`${requestToolName3}\` to fetch account info:
|
|
93822
93860
|
- \`method\`: \`"GET"\`
|
|
93823
93861
|
- \`path\`: \`"/account-info/v3/details"\`
|
|
93824
93862
|
2. If an error is returned, ask the user to check the OAuth connection settings
|
|
@@ -94092,12 +94130,12 @@ Authentication is handled automatically via OAuth proxy.`,
|
|
|
94092
94130
|
});
|
|
94093
94131
|
|
|
94094
94132
|
// ../connectors/src/connectors/stripe-oauth/setup.ts
|
|
94095
|
-
var
|
|
94133
|
+
var requestToolName4 = `stripe-oauth_${requestTool12.name}`;
|
|
94096
94134
|
var stripeOnboarding = new ConnectorOnboarding({
|
|
94097
94135
|
connectionSetupInstructions: {
|
|
94098
94136
|
ja: `\u4EE5\u4E0B\u306E\u624B\u9806\u3067Stripe\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306E\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002
|
|
94099
94137
|
|
|
94100
|
-
1. \`${
|
|
94138
|
+
1. \`${requestToolName4}\` \u3092\u547C\u3073\u51FA\u3057\u3066\u3001\u30A2\u30AB\u30A6\u30F3\u30C8\u60C5\u5831\u3092\u53D6\u5F97\u3059\u308B:
|
|
94101
94139
|
- \`method\`: \`"GET"\`
|
|
94102
94140
|
- \`path\`: \`"/v1/accounts"\`
|
|
94103
94141
|
2. \u30A8\u30E9\u30FC\u304C\u8FD4\u3055\u308C\u305F\u5834\u5408\u3001\u30E6\u30FC\u30B6\u30FC\u306BOAuth\u63A5\u7D9A\u306E\u8A2D\u5B9A\u3092\u78BA\u8A8D\u3059\u308B\u3088\u3046\u4F1D\u3048\u308B
|
|
@@ -94107,7 +94145,7 @@ var stripeOnboarding = new ConnectorOnboarding({
|
|
|
94107
94145
|
- \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`,
|
|
94108
94146
|
en: `Follow these steps to set up the Stripe connection.
|
|
94109
94147
|
|
|
94110
|
-
1. Call \`${
|
|
94148
|
+
1. Call \`${requestToolName4}\` to fetch account info:
|
|
94111
94149
|
- \`method\`: \`"GET"\`
|
|
94112
94150
|
- \`path\`: \`"/v1/accounts"\`
|
|
94113
94151
|
2. If an error is returned, ask the user to check the OAuth connection settings
|
|
@@ -94382,12 +94420,12 @@ Use this tool for all Stripe API interactions: querying charges, customers, invo
|
|
|
94382
94420
|
});
|
|
94383
94421
|
|
|
94384
94422
|
// ../connectors/src/connectors/stripe-api-key/setup.ts
|
|
94385
|
-
var
|
|
94423
|
+
var requestToolName5 = `stripe-api-key_${requestTool13.name}`;
|
|
94386
94424
|
var stripeApiKeyOnboarding = new ConnectorOnboarding({
|
|
94387
94425
|
connectionSetupInstructions: {
|
|
94388
94426
|
ja: `\u4EE5\u4E0B\u306E\u624B\u9806\u3067Stripe\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306E\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002
|
|
94389
94427
|
|
|
94390
|
-
1. \`${
|
|
94428
|
+
1. \`${requestToolName5}\` \u3092\u547C\u3073\u51FA\u3057\u3066\u3001\u30A2\u30AB\u30A6\u30F3\u30C8\u6B8B\u9AD8\u3092\u53D6\u5F97\u3059\u308B:
|
|
94391
94429
|
- \`method\`: \`"GET"\`
|
|
94392
94430
|
- \`path\`: \`"/v1/balance"\`
|
|
94393
94431
|
2. \u30A8\u30E9\u30FC\u304C\u8FD4\u3055\u308C\u305F\u5834\u5408\u3001\u30E6\u30FC\u30B6\u30FC\u306BAPI\u30AD\u30FC\u306E\u8A2D\u5B9A\u3092\u78BA\u8A8D\u3059\u308B\u3088\u3046\u4F1D\u3048\u308B\uFF08Secret API Key\u307E\u305F\u306FRestricted API Key\u304C\u6B63\u3057\u304F\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u308B\u304B\uFF09
|
|
@@ -94397,7 +94435,7 @@ var stripeApiKeyOnboarding = new ConnectorOnboarding({
|
|
|
94397
94435
|
- \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`,
|
|
94398
94436
|
en: `Follow these steps to set up the Stripe connection.
|
|
94399
94437
|
|
|
94400
|
-
1. Call \`${
|
|
94438
|
+
1. Call \`${requestToolName5}\` to fetch account balance:
|
|
94401
94439
|
- \`method\`: \`"GET"\`
|
|
94402
94440
|
- \`path\`: \`"/v1/balance"\`
|
|
94403
94441
|
2. If an error is returned, ask the user to check the API key settings (verify that the Secret API Key or Restricted API Key is configured correctly)
|
|
@@ -94407,11 +94445,11 @@ var stripeApiKeyOnboarding = new ConnectorOnboarding({
|
|
|
94407
94445
|
- Write only 1 sentence between tool calls, then immediately call the next tool. Skip unnecessary explanations and proceed efficiently`
|
|
94408
94446
|
},
|
|
94409
94447
|
dataOverviewInstructions: {
|
|
94410
|
-
en: `1. Call ${
|
|
94411
|
-
2. Call ${
|
|
94448
|
+
en: `1. Call ${requestToolName5} with GET /v1/customers?limit=5 to explore customers structure
|
|
94449
|
+
2. Call ${requestToolName5} with GET /v1/charges?limit=5 to explore charges structure
|
|
94412
94450
|
3. Explore other endpoints (invoices, subscriptions, products) as needed`,
|
|
94413
|
-
ja: `1. ${
|
|
94414
|
-
2. ${
|
|
94451
|
+
ja: `1. ${requestToolName5} \u3067 GET /v1/customers?limit=5 \u3092\u547C\u3073\u51FA\u3057\u3001\u9867\u5BA2\u306E\u69CB\u9020\u3092\u78BA\u8A8D
|
|
94452
|
+
2. ${requestToolName5} \u3067 GET /v1/charges?limit=5 \u3092\u547C\u3073\u51FA\u3057\u3001\u8AB2\u91D1\u306E\u69CB\u9020\u3092\u78BA\u8A8D
|
|
94415
94453
|
3. \u5FC5\u8981\u306B\u5FDC\u3058\u3066\u4ED6\u306E\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\uFF08\u8ACB\u6C42\u66F8\u3001\u30B5\u30D6\u30B9\u30AF\u30EA\u30D7\u30B7\u30E7\u30F3\u3001\u5546\u54C1\uFF09\u3092\u63A2\u7D22`
|
|
94416
94454
|
}
|
|
94417
94455
|
});
|
|
@@ -94696,7 +94734,7 @@ Authentication is handled automatically via OAuth proxy.
|
|
|
94696
94734
|
});
|
|
94697
94735
|
|
|
94698
94736
|
// ../connectors/src/connectors/airtable-oauth/setup.ts
|
|
94699
|
-
var
|
|
94737
|
+
var requestToolName6 = `airtable-oauth_${requestTool14.name}`;
|
|
94700
94738
|
var airtableOauthOnboarding = new ConnectorOnboarding({
|
|
94701
94739
|
connectionSetupInstructions: {
|
|
94702
94740
|
ja: `\u4EE5\u4E0B\u306E\u624B\u9806\u3067Airtable OAuth\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306E\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002
|
|
@@ -94706,7 +94744,7 @@ var airtableOauthOnboarding = new ConnectorOnboarding({
|
|
|
94706
94744
|
3. \`updateConnectionParameters\` \u3092\u547C\u3073\u51FA\u3059:
|
|
94707
94745
|
- \`parameterSlug\`: \`"base-id"\`
|
|
94708
94746
|
- \`value\`: \u62BD\u51FA\u3057\u305F\u30D9\u30FC\u30B9ID
|
|
94709
|
-
4. \`${
|
|
94747
|
+
4. \`${requestToolName6}\` \u3092\u547C\u3073\u51FA\u3057\u3066\u3001\u30D9\u30FC\u30B9\u306E\u30C6\u30FC\u30D6\u30EB\u4E00\u89A7\u3092\u53D6\u5F97\u3059\u308B:
|
|
94710
94748
|
- \`method\`: \`"GET"\`
|
|
94711
94749
|
- \`path\`: \`"/meta/bases/{baseId}/tables"\`
|
|
94712
94750
|
5. \u30A8\u30E9\u30FC\u304C\u8FD4\u3055\u308C\u305F\u5834\u5408\u3001\u30E6\u30FC\u30B6\u30FC\u306B\u30D9\u30FC\u30B9\u306E\u5171\u6709\u8A2D\u5B9A\u3092\u78BA\u8A8D\u3059\u308B\u3088\u3046\u4F1D\u3048\u308B
|
|
@@ -94721,7 +94759,7 @@ var airtableOauthOnboarding = new ConnectorOnboarding({
|
|
|
94721
94759
|
3. Call \`updateConnectionParameters\`:
|
|
94722
94760
|
- \`parameterSlug\`: \`"base-id"\`
|
|
94723
94761
|
- \`value\`: The extracted base ID
|
|
94724
|
-
4. Call \`${
|
|
94762
|
+
4. Call \`${requestToolName6}\` to fetch the base's table list:
|
|
94725
94763
|
- \`method\`: \`"GET"\`
|
|
94726
94764
|
- \`path\`: \`"/meta/bases/{baseId}/tables"\`
|
|
94727
94765
|
5. If an error is returned, ask the user to check the base sharing settings
|
|
@@ -97623,12 +97661,12 @@ Authentication is handled automatically via OAuth proxy.`,
|
|
|
97623
97661
|
});
|
|
97624
97662
|
|
|
97625
97663
|
// ../connectors/src/connectors/shopify-oauth/setup.ts
|
|
97626
|
-
var
|
|
97664
|
+
var requestToolName7 = `shopify-oauth_${requestTool22.name}`;
|
|
97627
97665
|
var shopifyOauthOnboarding = new ConnectorOnboarding({
|
|
97628
97666
|
connectionSetupInstructions: {
|
|
97629
97667
|
ja: `\u4EE5\u4E0B\u306E\u624B\u9806\u3067Shopify\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306E\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002
|
|
97630
97668
|
|
|
97631
|
-
1. \`${
|
|
97669
|
+
1. \`${requestToolName7}\` \u3092\u547C\u3073\u51FA\u3057\u3066\u3001\u30B7\u30E7\u30C3\u30D7\u60C5\u5831\u3092\u53D6\u5F97\u3059\u308B:
|
|
97632
97670
|
- \`method\`: \`"GET"\`
|
|
97633
97671
|
- \`path\`: \`"/admin/api/2024-10/shop.json"\`
|
|
97634
97672
|
2. \u30A8\u30E9\u30FC\u304C\u8FD4\u3055\u308C\u305F\u5834\u5408\u3001\u30E6\u30FC\u30B6\u30FC\u306BOAuth\u63A5\u7D9A\u306E\u8A2D\u5B9A\u3092\u78BA\u8A8D\u3059\u308B\u3088\u3046\u4F1D\u3048\u308B
|
|
@@ -97638,7 +97676,7 @@ var shopifyOauthOnboarding = new ConnectorOnboarding({
|
|
|
97638
97676
|
- \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`,
|
|
97639
97677
|
en: `Follow these steps to set up the Shopify connection.
|
|
97640
97678
|
|
|
97641
|
-
1. Call \`${
|
|
97679
|
+
1. Call \`${requestToolName7}\` to fetch shop info:
|
|
97642
97680
|
- \`method\`: \`"GET"\`
|
|
97643
97681
|
- \`path\`: \`"/admin/api/2024-10/shop.json"\`
|
|
97644
97682
|
2. If an error is returned, ask the user to check the OAuth connection settings
|
|
@@ -99895,12 +99933,12 @@ Pagination uses cursor-based start_cursor and page_size (max 100).`,
|
|
|
99895
99933
|
});
|
|
99896
99934
|
|
|
99897
99935
|
// ../connectors/src/connectors/notion-oauth/setup.ts
|
|
99898
|
-
var
|
|
99936
|
+
var requestToolName8 = `notion-oauth_${requestTool28.name}`;
|
|
99899
99937
|
var notionOauthOnboarding = new ConnectorOnboarding({
|
|
99900
99938
|
connectionSetupInstructions: {
|
|
99901
99939
|
ja: `\u4EE5\u4E0B\u306E\u624B\u9806\u3067Notion\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306E\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002
|
|
99902
99940
|
|
|
99903
|
-
1. \`${
|
|
99941
|
+
1. \`${requestToolName8}\` \u3092\u547C\u3073\u51FA\u3057\u3066\u3001\u30DC\u30C3\u30C8\u30E6\u30FC\u30B6\u30FC\u60C5\u5831\u3092\u53D6\u5F97\u3059\u308B:
|
|
99904
99942
|
- \`method\`: \`"GET"\`
|
|
99905
99943
|
- \`path\`: \`"/users/me"\`
|
|
99906
99944
|
2. \u30A8\u30E9\u30FC\u304C\u8FD4\u3055\u308C\u305F\u5834\u5408\u3001\u30E6\u30FC\u30B6\u30FC\u306BOAuth\u63A5\u7D9A\u306E\u8A2D\u5B9A\u3092\u78BA\u8A8D\u3059\u308B\u3088\u3046\u4F1D\u3048\u308B
|
|
@@ -99910,7 +99948,7 @@ var notionOauthOnboarding = new ConnectorOnboarding({
|
|
|
99910
99948
|
- \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`,
|
|
99911
99949
|
en: `Follow these steps to set up the Notion connection.
|
|
99912
99950
|
|
|
99913
|
-
1. Call \`${
|
|
99951
|
+
1. Call \`${requestToolName8}\` to fetch bot user info:
|
|
99914
99952
|
- \`method\`: \`"GET"\`
|
|
99915
99953
|
- \`path\`: \`"/users/me"\`
|
|
99916
99954
|
2. If an error is returned, ask the user to check the OAuth connection settings
|
|
@@ -102353,7 +102391,7 @@ export default async function handler(c: Context) {
|
|
|
102353
102391
|
tools: tools49
|
|
102354
102392
|
});
|
|
102355
102393
|
|
|
102356
|
-
// ../connectors/src/connectors/gmail/tools/request.ts
|
|
102394
|
+
// ../connectors/src/connectors/gmail/tools/request-with-delegation.ts
|
|
102357
102395
|
import { z as z63 } from "zod";
|
|
102358
102396
|
|
|
102359
102397
|
// ../connectors/src/connectors/gmail/parameters.ts
|
|
@@ -102361,38 +102399,40 @@ var parameters50 = {
|
|
|
102361
102399
|
serviceAccountKeyJsonBase64: new ParameterDefinition({
|
|
102362
102400
|
slug: "service-account-key-json-base64",
|
|
102363
102401
|
name: "Google Cloud Service Account JSON",
|
|
102364
|
-
description: "The service account JSON key
|
|
102402
|
+
description: "The service account JSON key. Domain-wide Delegation must be authorized in the Google Workspace admin console for the Gmail API scope. The user to impersonate is supplied per call as the `subject` argument.",
|
|
102365
102403
|
envVarBaseKey: "GMAIL_SERVICE_ACCOUNT_JSON_BASE64",
|
|
102366
102404
|
type: "base64EncodedJson",
|
|
102367
102405
|
secret: true,
|
|
102368
102406
|
required: true
|
|
102369
102407
|
})
|
|
102370
102408
|
};
|
|
102371
|
-
var delegatedUserEmailParameter = new ParameterDefinition({
|
|
102372
|
-
slug: "delegated-user-email",
|
|
102373
|
-
name: "Delegated User Email",
|
|
102374
|
-
description: "The email address of the Google Workspace user whose Gmail mailbox the service account will access via domain-wide delegation. Collected during the setup flow.",
|
|
102375
|
-
envVarBaseKey: "GMAIL_DELEGATED_USER_EMAIL",
|
|
102376
|
-
type: "text",
|
|
102377
|
-
secret: false,
|
|
102378
|
-
required: false
|
|
102379
|
-
});
|
|
102380
102409
|
|
|
102381
|
-
// ../connectors/src/connectors/gmail/tools/request.ts
|
|
102410
|
+
// ../connectors/src/connectors/gmail/tools/request-with-delegation.ts
|
|
102382
102411
|
var BASE_URL28 = "https://gmail.googleapis.com/gmail/v1/users";
|
|
102383
102412
|
var REQUEST_TIMEOUT_MS46 = 6e4;
|
|
102413
|
+
function decodeServiceAccount3(keyJsonBase64) {
|
|
102414
|
+
const decoded = Buffer.from(keyJsonBase64, "base64").toString("utf-8");
|
|
102415
|
+
return JSON.parse(decoded);
|
|
102416
|
+
}
|
|
102384
102417
|
var inputSchema61 = z63.object({
|
|
102385
102418
|
toolUseIntent: z63.string().optional().describe(
|
|
102386
102419
|
"Brief description of what you intend to accomplish with this tool call"
|
|
102387
102420
|
),
|
|
102388
102421
|
connectionId: z63.string().describe("ID of the Gmail service account connection to use"),
|
|
102389
|
-
method: z63.enum(["GET"]).describe("HTTP method
|
|
102422
|
+
method: z63.enum(["GET", "POST", "PUT", "PATCH", "DELETE"]).describe("HTTP method"),
|
|
102390
102423
|
path: z63.string().describe(
|
|
102391
|
-
"API path appended to https://gmail.googleapis.com/gmail/v1/users (e.g., '/me/messages', '/me/messages/{id}', '/me/labels'). Use '/me' as the userId."
|
|
102424
|
+
"API path appended to https://gmail.googleapis.com/gmail/v1/users (e.g., '/me/messages', '/me/messages/{id}', '/me/labels'). Use '/me' as the userId \u2014 the impersonated user."
|
|
102425
|
+
),
|
|
102426
|
+
subject: z63.string().describe(
|
|
102427
|
+
"Email of the Workspace user to impersonate via Domain-wide Delegation. The token will be issued as this user."
|
|
102428
|
+
),
|
|
102429
|
+
scopes: z63.array(z63.string()).describe(
|
|
102430
|
+
"OAuth scopes the token must include. This connector currently supports read-only operations only \u2014 pass ['https://www.googleapis.com/auth/gmail.readonly']. Per-endpoint scope reference: https://developers.google.com/gmail/api/auth/scopes"
|
|
102392
102431
|
),
|
|
102393
102432
|
queryParams: z63.record(z63.string(), z63.string()).optional().describe(
|
|
102394
102433
|
"Query parameters to append to the URL (e.g., { q: 'from:example@gmail.com', maxResults: '10' })"
|
|
102395
|
-
)
|
|
102434
|
+
),
|
|
102435
|
+
body: z63.record(z63.string(), z63.unknown()).optional().describe("JSON request body for POST/PUT/PATCH")
|
|
102396
102436
|
});
|
|
102397
102437
|
var outputSchema61 = z63.discriminatedUnion("success", [
|
|
102398
102438
|
z63.object({
|
|
@@ -102402,17 +102442,16 @@ var outputSchema61 = z63.discriminatedUnion("success", [
|
|
|
102402
102442
|
}),
|
|
102403
102443
|
z63.object({
|
|
102404
102444
|
success: z63.literal(false),
|
|
102405
|
-
error: z63.string()
|
|
102445
|
+
error: z63.string(),
|
|
102446
|
+
serviceAccountEmail: z63.string().optional()
|
|
102406
102447
|
})
|
|
102407
102448
|
]);
|
|
102408
|
-
var
|
|
102409
|
-
name: "
|
|
102410
|
-
description: `
|
|
102411
|
-
Authentication is handled automatically using a service account with domain-wide delegation.
|
|
102412
|
-
All paths are relative to https://gmail.googleapis.com/gmail/v1/users. Use '/me' as the userId prefix (e.g., '/me/messages').`,
|
|
102449
|
+
var requestWithDelegationTool2 = new ConnectorTool({
|
|
102450
|
+
name: "request_with_delegation",
|
|
102451
|
+
description: "Call the Gmail API on behalf of the specified Workspace user via Domain-wide Delegation. Read-only operations only. Pass `subject` as the target user email and `scopes` as ['https://www.googleapis.com/auth/gmail.readonly']. Paths are relative to https://gmail.googleapis.com/gmail/v1/users \u2014 use '/me' as the userId prefix (e.g., '/me/messages'). Requires DwD to be authorized for the service account in the Workspace admin console.",
|
|
102413
102452
|
inputSchema: inputSchema61,
|
|
102414
102453
|
outputSchema: outputSchema61,
|
|
102415
|
-
async execute({ connectionId, method, path: path4, queryParams }, connections) {
|
|
102454
|
+
async execute({ connectionId, method, path: path4, subject, scopes, queryParams, body }, connections) {
|
|
102416
102455
|
const connection = connections.find((c6) => c6.id === connectionId);
|
|
102417
102456
|
if (!connection) {
|
|
102418
102457
|
return {
|
|
@@ -102420,28 +102459,37 @@ All paths are relative to https://gmail.googleapis.com/gmail/v1/users. Use '/me'
|
|
|
102420
102459
|
error: `Connection ${connectionId} not found`
|
|
102421
102460
|
};
|
|
102422
102461
|
}
|
|
102462
|
+
const keyJsonBase64 = parameters50.serviceAccountKeyJsonBase64.getValue(connection);
|
|
102463
|
+
let serviceAccount;
|
|
102464
|
+
try {
|
|
102465
|
+
serviceAccount = decodeServiceAccount3(keyJsonBase64);
|
|
102466
|
+
} catch (err) {
|
|
102467
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
102468
|
+
return {
|
|
102469
|
+
success: false,
|
|
102470
|
+
error: `Failed to decode service account key: ${msg}`
|
|
102471
|
+
};
|
|
102472
|
+
}
|
|
102473
|
+
const serviceAccountEmail = serviceAccount.client_email;
|
|
102423
102474
|
console.log(
|
|
102424
|
-
`[connector-request] gmail/${connection.name}: ${method} ${path4}`
|
|
102475
|
+
`[connector-request] gmail/${connection.name}: ${method} ${path4} subject=${subject}`
|
|
102425
102476
|
);
|
|
102426
102477
|
try {
|
|
102427
102478
|
const { GoogleAuth } = await import("google-auth-library");
|
|
102428
|
-
const keyJsonBase64 = parameters50.serviceAccountKeyJsonBase64.getValue(connection);
|
|
102429
|
-
const delegatedUserEmail = delegatedUserEmailParameter.getValue(connection);
|
|
102430
|
-
const credentials = JSON.parse(
|
|
102431
|
-
Buffer.from(keyJsonBase64, "base64").toString("utf-8")
|
|
102432
|
-
);
|
|
102433
102479
|
const auth = new GoogleAuth({
|
|
102434
|
-
credentials
|
|
102435
|
-
|
|
102436
|
-
|
|
102437
|
-
|
|
102438
|
-
|
|
102480
|
+
credentials: {
|
|
102481
|
+
client_email: serviceAccount.client_email,
|
|
102482
|
+
private_key: serviceAccount.private_key
|
|
102483
|
+
},
|
|
102484
|
+
scopes,
|
|
102485
|
+
clientOptions: { subject }
|
|
102439
102486
|
});
|
|
102440
102487
|
const token = await auth.getAccessToken();
|
|
102441
102488
|
if (!token) {
|
|
102442
102489
|
return {
|
|
102443
102490
|
success: false,
|
|
102444
|
-
error: "Failed to obtain access token"
|
|
102491
|
+
error: "Failed to obtain access token",
|
|
102492
|
+
serviceAccountEmail
|
|
102445
102493
|
};
|
|
102446
102494
|
}
|
|
102447
102495
|
let url = `${BASE_URL28}${path4.startsWith("/") ? "" : "/"}${path4}`;
|
|
@@ -102452,18 +102500,25 @@ All paths are relative to https://gmail.googleapis.com/gmail/v1/users. Use '/me'
|
|
|
102452
102500
|
const controller = new AbortController();
|
|
102453
102501
|
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS46);
|
|
102454
102502
|
try {
|
|
102503
|
+
const hasBody = body != null && ["POST", "PUT", "PATCH"].includes(method);
|
|
102455
102504
|
const response = await fetch(url, {
|
|
102456
102505
|
method,
|
|
102457
102506
|
headers: {
|
|
102458
102507
|
Authorization: `Bearer ${token}`,
|
|
102459
102508
|
"Content-Type": "application/json"
|
|
102460
102509
|
},
|
|
102510
|
+
body: hasBody ? JSON.stringify(body) : void 0,
|
|
102461
102511
|
signal: controller.signal
|
|
102462
102512
|
});
|
|
102463
|
-
const data = await response.json();
|
|
102513
|
+
const data = await response.json().catch(() => ({}));
|
|
102464
102514
|
if (!response.ok) {
|
|
102465
|
-
const
|
|
102466
|
-
|
|
102515
|
+
const errorObj = data?.error;
|
|
102516
|
+
const errorMessage = errorObj?.message ?? (typeof data?.message === "string" ? data.message : `HTTP ${response.status} ${response.statusText}`);
|
|
102517
|
+
return {
|
|
102518
|
+
success: false,
|
|
102519
|
+
error: errorMessage,
|
|
102520
|
+
serviceAccountEmail
|
|
102521
|
+
};
|
|
102467
102522
|
}
|
|
102468
102523
|
return { success: true, status: response.status, data };
|
|
102469
102524
|
} finally {
|
|
@@ -102471,79 +102526,92 @@ All paths are relative to https://gmail.googleapis.com/gmail/v1/users. Use '/me'
|
|
|
102471
102526
|
}
|
|
102472
102527
|
} catch (err) {
|
|
102473
102528
|
const msg = err instanceof Error ? err.message : String(err);
|
|
102474
|
-
return {
|
|
102529
|
+
return {
|
|
102530
|
+
success: false,
|
|
102531
|
+
error: msg,
|
|
102532
|
+
serviceAccountEmail
|
|
102533
|
+
};
|
|
102475
102534
|
}
|
|
102476
102535
|
}
|
|
102477
102536
|
});
|
|
102478
102537
|
|
|
102479
102538
|
// ../connectors/src/connectors/gmail/setup.ts
|
|
102480
|
-
var
|
|
102539
|
+
var requestWithDelegationToolName2 = `gmail-service-account_${requestWithDelegationTool2.name}`;
|
|
102540
|
+
var READONLY_SCOPES2 = '["https://www.googleapis.com/auth/gmail.readonly"]';
|
|
102481
102541
|
var gmailOnboarding = new ConnectorOnboarding({
|
|
102482
102542
|
connectionSetupInstructions: {
|
|
102483
|
-
ja:
|
|
102543
|
+
ja: `Gmail\uFF08\u30B5\u30FC\u30D3\u30B9\u30A2\u30AB\u30A6\u30F3\u30C8\uFF09\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306E\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3092\u884C\u3044\u307E\u3059\u3002\u30A2\u30AF\u30BB\u30B9\u5BFE\u8C61\u306E Workspace \u30E6\u30FC\u30B6\u30FC\u3092\u30E6\u30FC\u30B6\u30FC\u304B\u3089\u805E\u304D\u3001Project Knowledge \u306B\u8A18\u9332\u3057\u307E\u3059\u3002
|
|
102484
102544
|
|
|
102485
|
-
1. \`askUserQuestion\` \u3067\
|
|
102545
|
+
1. \`askUserQuestion\` \u3067\u5BFE\u8C61\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092\u805E\u304F:
|
|
102486
102546
|
- \`type\`: \`"freeText"\`
|
|
102487
|
-
- \`question\`: \u300CGmail\u3092\u53C2\u7167\u3059\
|
|
102488
|
-
- \`placeholder\`: \`"
|
|
102489
|
-
|
|
102490
|
-
|
|
102491
|
-
- \`options\`: \`[{ value: <\u5165\u529B\u3055\u308C\u305F\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9>, label: <\u540C\u3058\u5024> }]\`\uFF081\u4EF6\u306E\u307F\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\u81EA\u52D5\u9078\u629E\u3055\u308C\u308B\uFF09
|
|
102492
|
-
3. \`${requestToolName8}\` \u3092\u547C\u3073\u51FA\u3057\u3066\u30E6\u30FC\u30B6\u30FC\u306E\u30D7\u30ED\u30D5\u30A3\u30FC\u30EB\u3092\u53D6\u5F97\u3059\u308B:
|
|
102547
|
+
- \`question\`: \u300CGmail \u3092\u53C2\u7167\u3059\u308B Google Workspace \u30E6\u30FC\u30B6\u30FC\u306E\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\uFF08\u8907\u6570\u53EF\u3001\u30AB\u30F3\u30DE\u533A\u5207\u308A\uFF09\u300D
|
|
102548
|
+
- \`placeholder\`: \`"alice@example.com, bob@example.com"\`
|
|
102549
|
+
|
|
102550
|
+
2. \u30E6\u30FC\u30B6\u30FC\u304B\u3089\u53D7\u3051\u53D6\u3063\u305F\u6587\u5B57\u5217\u304B\u3089\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092\u62BD\u51FA\u3059\u308B\u3002\u5404 \`<email>\` \u306B\u3064\u3044\u3066 \`${requestWithDelegationToolName2}\` \u3092\u4EE5\u4E0B\u306E\u5F15\u6570\u3067\u547C\u3073\u3001Domain-wide Delegation \u7D4C\u7531\u3067\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u304B\u3092\u78BA\u8A8D\u3059\u308B:
|
|
102493
102551
|
- \`method\`: \`"GET"\`
|
|
102494
102552
|
- \`path\`: \`"/me/profile"\`
|
|
102495
|
-
|
|
102496
|
-
-
|
|
102497
|
-
|
|
102498
|
-
|
|
102499
|
-
|
|
102500
|
-
-
|
|
102501
|
-
-
|
|
102553
|
+
- \`subject\`: \`<email>\`
|
|
102554
|
+
- \`scopes\`: \`${READONLY_SCOPES2}\`
|
|
102555
|
+
|
|
102556
|
+
3. \u5931\u6557\u3057\u305F\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u304C\u3042\u308C\u3070\u3001\u30A8\u30E9\u30FC\u30EC\u30B9\u30DD\u30F3\u30B9\u306E \`serviceAccountEmail\` \u30D5\u30A3\u30FC\u30EB\u30C9\u304B\u3089\u30B5\u30FC\u30D3\u30B9\u30A2\u30AB\u30A6\u30F3\u30C8\u306E\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092\u53D6\u308A\u51FA\u3057\u3001\`askUserQuestion\` \u3067\u6B21\u306E\u9078\u629E\u80A2\u3092\u63D0\u793A\u3059\u308B\u3002\`question\` \u306B\u306F\u6B21\u306E\u6848\u5185\u6587\u3092\u542B\u3081\u308B: \u300C\u6B21\u306E\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u306B\u30A2\u30AF\u30BB\u30B9\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F: {\u5931\u6557\u30A2\u30C9\u30EC\u30B9\u4E00\u89A7}\u3002\u30B5\u30FC\u30D3\u30B9\u30A2\u30AB\u30A6\u30F3\u30C8 \`<serviceAccountEmail>\` \u306E Domain-wide Delegation \u304C Workspace \u7BA1\u7406\u30B3\u30F3\u30BD\u30FC\u30EB\u3067\u627F\u8A8D\u3055\u308C\u3066\u3044\u308B\u304B\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\uFF08[\u8A2D\u5B9A\u30AC\u30A4\u30C9](https://support.google.com/a/answer/162106)\uFF09\u300D\u3002
|
|
102557
|
+
- \`options\`: \`[{ label: "DwD \u3092\u627F\u8A8D\u3057\u305F\u306E\u3067\u30EA\u30C8\u30E9\u30A4", value: "retry" }, { label: "\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092\u5165\u529B\u3057\u76F4\u3059", value: "restart" }]\`
|
|
102558
|
+
- \u300C\u30EA\u30C8\u30E9\u30A4\u300D: \u76F4\u524D\u306E\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u30EA\u30B9\u30C8\u3067\u30B9\u30C6\u30C3\u30D7 2 \u3092\u518D\u5B9F\u884C
|
|
102559
|
+
- \u300C\u5165\u529B\u3057\u76F4\u3059\u300D: \u30B9\u30C6\u30C3\u30D7 1 \u304B\u3089\u518D\u5B9F\u884C
|
|
102560
|
+
|
|
102561
|
+
4. \u5168\u30A2\u30C9\u30EC\u30B9\u304C\u6210\u529F\u3057\u305F\u3089 \`finalizeSetup\` \u3092\u547C\u3076\u3002\`projectKnowledge\` \u306E \`#### \u30B9\u30B3\u30FC\u30D7\` \u7BC0\u306B\u5404\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092 1 \u884C\u305A\u3064\u5217\u6319\u3059\u308B:
|
|
102562
|
+
- \`- subject: alice@example.com\`
|
|
102563
|
+
- \`- subject: bob@example.com\`
|
|
102502
102564
|
|
|
102503
102565
|
#### \u5236\u7D04
|
|
102504
|
-
-
|
|
102505
|
-
- \u30C4\u30FC\u30EB\u9593\
|
|
102506
|
-
en: `
|
|
102566
|
+
- \u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u4E2D\u306B\u30E1\u30C3\u30BB\u30FC\u30B8\u672C\u6587\u3092\u8AAD\u307F\u53D6\u3089\u306A\u3044\u3053\u3068\u3002\u8A31\u53EF\u3055\u308C\u3066\u3044\u308B\u306E\u306F\u30B9\u30C6\u30C3\u30D7 2 \u306E \`/me/profile\` \u78BA\u8A8D\u306E\u307F
|
|
102567
|
+
- \u30C4\u30FC\u30EB\u547C\u3073\u51FA\u3057\u306E\u9593\u306F 1 \u6587\u3060\u3051\u66F8\u3044\u3066\u5373\u6B21\u306E\u30C4\u30FC\u30EB\u547C\u3073\u51FA\u3057`,
|
|
102568
|
+
en: `Set up the Gmail (Service Account) connection. Ask the user which Workspace users to access, verify each via Domain-wide Delegation, and record them in Project Knowledge.
|
|
102507
102569
|
|
|
102508
|
-
1. Call \`askUserQuestion\` to
|
|
102570
|
+
1. Call \`askUserQuestion\` to collect target emails:
|
|
102509
102571
|
- \`type\`: \`"freeText"\`
|
|
102510
|
-
- \`question\`: "
|
|
102511
|
-
- \`placeholder\`: \`"
|
|
102512
|
-
|
|
102513
|
-
|
|
102514
|
-
- \`options\`: \`[{ value: <entered email>, label: <same value> }]\` (a single option is auto-selected)
|
|
102515
|
-
3. Call \`${requestToolName8}\` to get the user's profile:
|
|
102572
|
+
- \`question\`: "Enter the Google Workspace user email(s) whose Gmail mailbox you want to access (comma-separated for multiple)"
|
|
102573
|
+
- \`placeholder\`: \`"alice@example.com, bob@example.com"\`
|
|
102574
|
+
|
|
102575
|
+
2. Extract individual emails from the response. For each \`<email>\`, verify Domain-wide Delegation access by calling \`${requestWithDelegationToolName2}\`:
|
|
102516
102576
|
- \`method\`: \`"GET"\`
|
|
102517
102577
|
- \`path\`: \`"/me/profile"\`
|
|
102518
|
-
|
|
102519
|
-
-
|
|
102520
|
-
|
|
102521
|
-
|
|
102522
|
-
|
|
102523
|
-
-
|
|
102524
|
-
-
|
|
102578
|
+
- \`subject\`: \`<email>\`
|
|
102579
|
+
- \`scopes\`: \`${READONLY_SCOPES2}\`
|
|
102580
|
+
|
|
102581
|
+
3. For any failed email, take \`serviceAccountEmail\` from the error response and call \`askUserQuestion\`. Include this guidance in \`question\`: "Could not access Gmail for {failed emails}. Verify Domain-wide Delegation for service account \`<serviceAccountEmail>\` in the Workspace admin console ([setup guide](https://support.google.com/a/answer/162106))".
|
|
102582
|
+
- \`options\`: \`[{ label: "Authorized DwD \u2014 retry", value: "retry" }, { label: "Re-enter the email addresses", value: "restart" }]\`
|
|
102583
|
+
- On "retry" \u2192 re-run step 2 with the previously entered email list
|
|
102584
|
+
- On "Re-enter" \u2192 re-run step 1
|
|
102585
|
+
|
|
102586
|
+
4. Once every email succeeds, call \`finalizeSetup\`. Under \`#### \u30B9\u30B3\u30FC\u30D7\` in \`projectKnowledge\`, list each email on its own line:
|
|
102587
|
+
- \`- subject: alice@example.com\`
|
|
102588
|
+
- \`- subject: bob@example.com\`
|
|
102525
102589
|
|
|
102526
102590
|
#### Constraints
|
|
102527
|
-
-
|
|
102528
|
-
- Write
|
|
102591
|
+
- Do NOT read message bodies during setup. Only the \`/me/profile\` verification is permitted
|
|
102592
|
+
- Write at most 1 sentence between tool calls`
|
|
102529
102593
|
},
|
|
102530
102594
|
dataOverviewInstructions: {
|
|
102531
|
-
en: `
|
|
102532
|
-
|
|
102533
|
-
|
|
102534
|
-
|
|
102535
|
-
|
|
102536
|
-
|
|
102595
|
+
en: `Pick ONE email from \`#### \u30B9\u30B3\u30FC\u30D7\` (a \`- subject: <email>\` line) and use it as \`subject\` for every call below. Pass \`scopes: ${READONLY_SCOPES2}\` every time.
|
|
102596
|
+
|
|
102597
|
+
1. \`method=GET\`, \`path=/me/labels\` to list labels.
|
|
102598
|
+
2. \`method=GET\`, \`path=/me/messages?maxResults=5\` to fetch recent message IDs.
|
|
102599
|
+
3. For each message id, \`method=GET\`, \`path=/me/messages/{id}?format=metadata\`.`,
|
|
102600
|
+
ja: `\`#### \u30B9\u30B3\u30FC\u30D7\` \u306E \`- subject: <email>\` \u884C\u304B\u3089 1 \u3064\u9078\u3073\u3001\u4EE5\u4E0B\u306E\u30B9\u30C6\u30C3\u30D7\u3067 \`subject\` \u5F15\u6570\u3068\u3057\u3066\u4F7F\u3063\u3066\u304F\u3060\u3055\u3044\u3002\`scopes\` \u306F\u6BCE\u56DE \`${READONLY_SCOPES2}\` \u3092\u6E21\u3057\u307E\u3059\u3002
|
|
102601
|
+
|
|
102602
|
+
1. \`method=GET\`\u3001\`path=/me/labels\` \u3067\u30E9\u30D9\u30EB\u4E00\u89A7\u3092\u53D6\u5F97
|
|
102603
|
+
2. \`method=GET\`\u3001\`path=/me/messages?maxResults=5\` \u3067\u6700\u8FD1\u306E\u30E1\u30C3\u30BB\u30FC\u30B8 ID \u3092\u53D6\u5F97
|
|
102604
|
+
3. \u5404\u30E1\u30C3\u30BB\u30FC\u30B8 ID \u306B\u3064\u3044\u3066 \`method=GET\`\u3001\`path=/me/messages/{id}?format=metadata\``
|
|
102537
102605
|
}
|
|
102538
102606
|
});
|
|
102539
102607
|
|
|
102540
102608
|
// ../connectors/src/connectors/gmail/index.ts
|
|
102541
|
-
var tools50 = {
|
|
102609
|
+
var tools50 = { request_with_delegation: requestWithDelegationTool2 };
|
|
102542
102610
|
var gmailConnector = new ConnectorPlugin({
|
|
102543
102611
|
slug: "gmail",
|
|
102544
102612
|
authType: AUTH_TYPES.SERVICE_ACCOUNT,
|
|
102545
102613
|
name: "Gmail",
|
|
102546
|
-
description: "Connect to Gmail for email data access using a service account with domain-wide delegation.
|
|
102614
|
+
description: "Connect to Gmail for email data access using a service account with domain-wide delegation. Currently read-only (messages, threads, labels).",
|
|
102547
102615
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/4V3rfaSc1ksFIt2eHBNIwJ/7f3be41a154a6d96dcf229ed0e5858c9/Gmail_icon__2020_.svg.png",
|
|
102548
102616
|
parameters: parameters50,
|
|
102549
102617
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
@@ -102551,12 +102619,22 @@ var gmailConnector = new ConnectorPlugin({
|
|
|
102551
102619
|
systemPrompt: {
|
|
102552
102620
|
en: `### Tools
|
|
102553
102621
|
|
|
102554
|
-
- \`gmail-service-
|
|
102622
|
+
- \`gmail-service-account_request_with_delegation\`: Call the Gmail API on behalf of the specified Workspace user via Domain-wide Delegation. Pass \`subject\` as the target user email; the token will be issued as that user. The set of users this connection works with is recorded in the project knowledge under "#### \u30B9\u30B3\u30FC\u30D7" as \`- subject: <email>\` lines \u2014 read those and pick a subject before calling. Always pass \`scopes\`.
|
|
102623
|
+
|
|
102624
|
+
### OAuth Scopes (pass as \`scopes\` argument)
|
|
102625
|
+
|
|
102626
|
+
This connector is currently read-only. Pass:
|
|
102627
|
+
|
|
102628
|
+
- \`https://www.googleapis.com/auth/gmail.readonly\` \u2014 read-only access (profile, labels, messages, threads)
|
|
102629
|
+
|
|
102630
|
+
The Workspace admin must have authorized this scope for the service account in the Domain-wide Delegation settings, otherwise token issuance will fail with \`unauthorized_client\`.
|
|
102631
|
+
|
|
102632
|
+
Per-endpoint scope reference: https://developers.google.com/gmail/api/auth/scopes
|
|
102555
102633
|
|
|
102556
102634
|
### Gmail API Reference
|
|
102557
102635
|
|
|
102558
102636
|
#### Available Endpoints
|
|
102559
|
-
- GET \`/me/profile\` \u2014 Get the
|
|
102637
|
+
- GET \`/me/profile\` \u2014 Get the impersonated user's profile (email address, total messages/threads)
|
|
102560
102638
|
- GET \`/me/labels\` \u2014 List all labels in the mailbox
|
|
102561
102639
|
- GET \`/me/labels/{id}\` \u2014 Get details for a specific label
|
|
102562
102640
|
- GET \`/me/messages\` \u2014 List messages (returns IDs only; use format param on individual messages)
|
|
@@ -102581,7 +102659,7 @@ var gmailConnector = new ConnectorPlugin({
|
|
|
102581
102659
|
- \`raw\` \u2014 Full RFC 2822 formatted message in base64url
|
|
102582
102660
|
|
|
102583
102661
|
#### Tips
|
|
102584
|
-
- Always use \`/me\` as the userId \u2014 it refers to the
|
|
102662
|
+
- Always use \`/me\` as the userId in the path \u2014 it refers to the user you passed as \`subject\`
|
|
102585
102663
|
- List endpoints return only IDs; fetch individual resources for details
|
|
102586
102664
|
- Use \`format=metadata\` to efficiently get subject/sender without full body
|
|
102587
102665
|
- Message body content is base64url encoded in \`payload.body.data\` or nested \`payload.parts[].body.data\`
|
|
@@ -102592,6 +102670,12 @@ var gmailConnector = new ConnectorPlugin({
|
|
|
102592
102670
|
|
|
102593
102671
|
The business logic type for this connector is "typescript". Write handler code using the connector SDK shown below. Do NOT access credentials directly from environment variables.
|
|
102594
102672
|
|
|
102673
|
+
SDK methods (client created via \`connection(connectionId)\`):
|
|
102674
|
+
|
|
102675
|
+
- \`client.requestWithDelegation(path, { subject, scopes, init? })\` \u2014 call the Gmail API as the impersonated Workspace user via Domain-wide Delegation. Pass the minimum scopes required by the endpoint.
|
|
102676
|
+
|
|
102677
|
+
The method returns a standard \`Response\`. Read the body with \`.json()\`. Same path conventions as the tool.
|
|
102678
|
+
|
|
102595
102679
|
#### Example
|
|
102596
102680
|
|
|
102597
102681
|
\`\`\`ts
|
|
@@ -102599,37 +102683,51 @@ import { connection } from "@squadbase/vite-server/connectors/gmail";
|
|
|
102599
102683
|
|
|
102600
102684
|
const gmail = connection("<connectionId>");
|
|
102601
102685
|
|
|
102602
|
-
//
|
|
102603
|
-
const
|
|
102686
|
+
// Pick the impersonated user from project knowledge ("#### \u30B9\u30B3\u30FC\u30D7").
|
|
102687
|
+
const subject = "alice@example.com";
|
|
102688
|
+
const READ = ["https://www.googleapis.com/auth/gmail.readonly"];
|
|
102689
|
+
|
|
102690
|
+
const profileRes = await gmail.requestWithDelegation("/me/profile", {
|
|
102691
|
+
subject,
|
|
102692
|
+
scopes: READ,
|
|
102693
|
+
});
|
|
102694
|
+
const profile = await profileRes.json();
|
|
102604
102695
|
console.log(profile.emailAddress, profile.messagesTotal);
|
|
102605
102696
|
|
|
102606
|
-
|
|
102607
|
-
|
|
102608
|
-
|
|
102609
|
-
|
|
102610
|
-
|
|
102611
|
-
|
|
102697
|
+
const messagesRes = await gmail.requestWithDelegation(
|
|
102698
|
+
"/me/messages?maxResults=10",
|
|
102699
|
+
{ subject, scopes: READ },
|
|
102700
|
+
);
|
|
102701
|
+
const messages = await messagesRes.json();
|
|
102702
|
+
|
|
102703
|
+
for (const msg of messages.messages ?? []) {
|
|
102704
|
+
const detailRes = await gmail.requestWithDelegation(
|
|
102705
|
+
\`/me/messages/\${msg.id}?format=metadata\`,
|
|
102706
|
+
{ subject, scopes: READ },
|
|
102707
|
+
);
|
|
102708
|
+
const detail = await detailRes.json();
|
|
102709
|
+
const subjectHeader = detail.payload.headers.find(h => h.name === "Subject")?.value;
|
|
102710
|
+
console.log(subjectHeader, detail.snippet);
|
|
102612
102711
|
}
|
|
102712
|
+
\`\`\``,
|
|
102713
|
+
ja: `### \u30C4\u30FC\u30EB
|
|
102613
102714
|
|
|
102614
|
-
|
|
102615
|
-
const results = await gmail.listMessages({ q: "from:boss@company.com is:unread" });
|
|
102715
|
+
- \`gmail-service-account_request_with_delegation\`: \u6307\u5B9A\u3055\u308C\u305F Workspace \u30E6\u30FC\u30B6\u30FC\u306B\u4EE3\u308F\u3063\u3066 Domain-wide Delegation \u7D4C\u7531\u3067 Gmail API \u3092\u547C\u3073\u51FA\u3057\u307E\u3059\u3002\u4EE3\u7406\u5BFE\u8C61\u306E\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092 \`subject\` \u3068\u3057\u3066\u6E21\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u30C8\u30FC\u30AF\u30F3\u306F\u305D\u306E\u30E6\u30FC\u30B6\u30FC\u3068\u3057\u3066\u767A\u884C\u3055\u308C\u307E\u3059\u3002\u3053\u306E\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u304C\u5BFE\u8C61\u3068\u3059\u308B\u30E6\u30FC\u30B6\u30FC\u306F Project Knowledge \u306E "#### \u30B9\u30B3\u30FC\u30D7" \u306B \`- subject: <email>\` \u5F62\u5F0F\u3067\u8A18\u9332\u3055\u308C\u3066\u3044\u308B\u305F\u3081\u3001\u547C\u3073\u51FA\u3057\u524D\u306B\u305D\u3053\u3092\u8AAD\u3093\u3067 subject \u3092\u6C7A\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002\`scopes\` \u3082\u6BCE\u56DE\u6E21\u3057\u3066\u304F\u3060\u3055\u3044\u3002
|
|
102616
102716
|
|
|
102617
|
-
|
|
102618
|
-
const labels = await gmail.listLabels();
|
|
102619
|
-
labels.labels.forEach(l => console.log(l.name, l.messagesTotal));
|
|
102717
|
+
### OAuth \u30B9\u30B3\u30FC\u30D7 (\`scopes\` \u5F15\u6570\u3067\u6E21\u3059)
|
|
102620
102718
|
|
|
102621
|
-
|
|
102622
|
-
|
|
102623
|
-
|
|
102624
|
-
\`\`\``,
|
|
102625
|
-
ja: `### \u30C4\u30FC\u30EB
|
|
102719
|
+
\u3053\u306E\u30B3\u30CD\u30AF\u30BF\u30FC\u306F\u73FE\u72B6\u8AAD\u307F\u53D6\u308A\u5C02\u7528\u3067\u3059\u3002\u6B21\u3092\u6E21\u3057\u3066\u304F\u3060\u3055\u3044:
|
|
102720
|
+
|
|
102721
|
+
- \`https://www.googleapis.com/auth/gmail.readonly\` \u2014 \u8AAD\u307F\u53D6\u308A\uFF08\u30D7\u30ED\u30D5\u30A3\u30FC\u30EB\u3001\u30E9\u30D9\u30EB\u3001\u30E1\u30C3\u30BB\u30FC\u30B8\u3001\u30B9\u30EC\u30C3\u30C9\uFF09
|
|
102626
102722
|
|
|
102627
|
-
|
|
102723
|
+
\u8981\u6C42\u3059\u308B scope \u306F Workspace \u7BA1\u7406\u8005\u304C Domain-wide Delegation \u8A2D\u5B9A\u3067\u5F53\u8A72 Service Account \u306B\u5BFE\u3057\u3066\u627F\u8A8D\u3057\u3066\u3044\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\u627F\u8A8D\u3055\u308C\u3066\u3044\u306A\u3044\u5834\u5408\u30C8\u30FC\u30AF\u30F3\u767A\u884C\u304C \`unauthorized_client\` \u3067\u5931\u6557\u3057\u307E\u3059\u3002
|
|
102724
|
+
|
|
102725
|
+
\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\u5225\u306E\u6B63\u78BA\u306A scope \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9: https://developers.google.com/gmail/api/auth/scopes
|
|
102628
102726
|
|
|
102629
102727
|
### Gmail API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
102630
102728
|
|
|
102631
102729
|
#### \u5229\u7528\u53EF\u80FD\u306A\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8
|
|
102632
|
-
- GET \`/me/profile\` \u2014 \
|
|
102730
|
+
- GET \`/me/profile\` \u2014 \u4EE3\u7406\u5BFE\u8C61\u30E6\u30FC\u30B6\u30FC\u306E\u30D7\u30ED\u30D5\u30A3\u30FC\u30EB\u3092\u53D6\u5F97\uFF08\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3001\u30E1\u30C3\u30BB\u30FC\u30B8/\u30B9\u30EC\u30C3\u30C9\u7DCF\u6570\uFF09
|
|
102633
102731
|
- GET \`/me/labels\` \u2014 \u30E1\u30FC\u30EB\u30DC\u30C3\u30AF\u30B9\u306E\u5168\u30E9\u30D9\u30EB\u3092\u4E00\u89A7
|
|
102634
102732
|
- GET \`/me/labels/{id}\` \u2014 \u7279\u5B9A\u30E9\u30D9\u30EB\u306E\u8A73\u7D30\u3092\u53D6\u5F97
|
|
102635
102733
|
- GET \`/me/messages\` \u2014 \u30E1\u30C3\u30BB\u30FC\u30B8\u4E00\u89A7\uFF08ID\u306E\u307F\u8FD4\u5374\u3002\u500B\u5225\u30E1\u30C3\u30BB\u30FC\u30B8\u3067format\u30D1\u30E9\u30E1\u30FC\u30BF\u3092\u4F7F\u7528\uFF09
|
|
@@ -102654,7 +102752,7 @@ thread.messages.forEach(m => console.log(m.snippet));
|
|
|
102654
102752
|
- \`raw\` \u2014 base64url\u30A8\u30F3\u30B3\u30FC\u30C9\u3055\u308C\u305F\u5B8C\u5168\u306ARFC 2822\u30D5\u30A9\u30FC\u30DE\u30C3\u30C8\u30E1\u30C3\u30BB\u30FC\u30B8
|
|
102655
102753
|
|
|
102656
102754
|
#### \u30D2\u30F3\u30C8
|
|
102657
|
-
- userId\u306B\u306F\u5E38\u306B \`/me\` \u3092\u4F7F\u7528 \u2014 \
|
|
102755
|
+
- \u30D1\u30B9\u306E userId \u306B\u306F\u5E38\u306B \`/me\` \u3092\u4F7F\u7528 \u2014 \`subject\` \u306B\u6E21\u3057\u305F\u30E6\u30FC\u30B6\u30FC\u3092\u6307\u3057\u307E\u3059
|
|
102658
102756
|
- \u4E00\u89A7\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\u306FID\u306E\u307F\u8FD4\u5374\u3057\u307E\u3059\u3002\u8A73\u7D30\u306F\u500B\u5225\u30EA\u30BD\u30FC\u30B9\u3092\u53D6\u5F97\u3057\u3066\u304F\u3060\u3055\u3044
|
|
102659
102757
|
- \u4EF6\u540D/\u9001\u4FE1\u8005\u3092\u52B9\u7387\u7684\u306B\u53D6\u5F97\u3059\u308B\u306B\u306F \`format=metadata\` \u3092\u4F7F\u7528\u3057\u307E\u3059
|
|
102660
102758
|
- \u30E1\u30C3\u30BB\u30FC\u30B8\u672C\u6587\u306F \`payload.body.data\` \u307E\u305F\u306F\u30CD\u30B9\u30C8\u3055\u308C\u305F \`payload.parts[].body.data\` \u306Bbase64url\u30A8\u30F3\u30B3\u30FC\u30C9\u3067\u683C\u7D0D\u3055\u308C\u3066\u3044\u307E\u3059
|
|
@@ -102665,6 +102763,12 @@ thread.messages.forEach(m => console.log(m.snippet));
|
|
|
102665
102763
|
|
|
102666
102764
|
\u3053\u306E\u30B3\u30CD\u30AF\u30BF\u306E\u30D3\u30B8\u30CD\u30B9\u30ED\u30B8\u30C3\u30AF\u30BF\u30A4\u30D7\u306F "typescript" \u3067\u3059\u3002\u4EE5\u4E0B\u306B\u793A\u3059\u30B3\u30CD\u30AF\u30BFSDK\u3092\u4F7F\u7528\u3057\u3066\u30CF\u30F3\u30C9\u30E9\u30B3\u30FC\u30C9\u3092\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u74B0\u5883\u5909\u6570\u304B\u3089\u76F4\u63A5\u8A8D\u8A3C\u60C5\u5831\u306B\u30A2\u30AF\u30BB\u30B9\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002
|
|
102667
102765
|
|
|
102766
|
+
SDK\u30E1\u30BD\u30C3\u30C9 (\`connection(connectionId)\` \u3067\u4F5C\u6210\u3057\u305F\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8):
|
|
102767
|
+
|
|
102768
|
+
- \`client.requestWithDelegation(path, { subject, scopes, init? })\` \u2014 DwD \u3067 Workspace \u30E6\u30FC\u30B6\u30FC\u306B\u306A\u308A\u3059\u307E\u3057\u3066 Gmail API \u3092\u547C\u3076\u3002\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\u306B\u5FC5\u8981\u306A\u6700\u5C0F scope \u3092\u6E21\u3059\u3002
|
|
102769
|
+
|
|
102770
|
+
\u30E1\u30BD\u30C3\u30C9\u306F\u6A19\u6E96\u306E \`Response\` \u3092\u8FD4\u3057\u307E\u3059\u3002\`response.json()\` \u3067\u30DC\u30C7\u30A3\u3092\u53D6\u5F97\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u30D1\u30B9\u306E\u66F8\u304D\u65B9\u306F\u30C4\u30FC\u30EB\u3068\u540C\u3058\u3002
|
|
102771
|
+
|
|
102668
102772
|
#### Example
|
|
102669
102773
|
|
|
102670
102774
|
\`\`\`ts
|
|
@@ -102672,86 +102776,35 @@ import { connection } from "@squadbase/vite-server/connectors/gmail";
|
|
|
102672
102776
|
|
|
102673
102777
|
const gmail = connection("<connectionId>");
|
|
102674
102778
|
|
|
102675
|
-
//
|
|
102676
|
-
const
|
|
102677
|
-
|
|
102779
|
+
// \u4EE3\u7406\u5BFE\u8C61\u30E6\u30FC\u30B6\u30FC\u306F Project Knowledge ("#### \u30B9\u30B3\u30FC\u30D7") \u304B\u3089\u9078\u3076
|
|
102780
|
+
const subject = "alice@example.com";
|
|
102781
|
+
const READ = ["https://www.googleapis.com/auth/gmail.readonly"];
|
|
102678
102782
|
|
|
102679
|
-
|
|
102680
|
-
|
|
102681
|
-
|
|
102682
|
-
|
|
102683
|
-
|
|
102684
|
-
|
|
102685
|
-
}
|
|
102686
|
-
|
|
102687
|
-
// Search messages
|
|
102688
|
-
const results = await gmail.listMessages({ q: "from:boss@company.com is:unread" });
|
|
102783
|
+
const profileRes = await gmail.requestWithDelegation("/me/profile", {
|
|
102784
|
+
subject,
|
|
102785
|
+
scopes: READ,
|
|
102786
|
+
});
|
|
102787
|
+
const profile = await profileRes.json();
|
|
102788
|
+
console.log(profile.emailAddress, profile.messagesTotal);
|
|
102689
102789
|
|
|
102690
|
-
|
|
102691
|
-
|
|
102692
|
-
|
|
102790
|
+
const messagesRes = await gmail.requestWithDelegation(
|
|
102791
|
+
"/me/messages?maxResults=10",
|
|
102792
|
+
{ subject, scopes: READ },
|
|
102793
|
+
);
|
|
102794
|
+
const messages = await messagesRes.json();
|
|
102693
102795
|
|
|
102694
|
-
|
|
102695
|
-
const
|
|
102696
|
-
|
|
102796
|
+
for (const msg of messages.messages ?? []) {
|
|
102797
|
+
const detailRes = await gmail.requestWithDelegation(
|
|
102798
|
+
\`/me/messages/\${msg.id}?format=metadata\`,
|
|
102799
|
+
{ subject, scopes: READ },
|
|
102800
|
+
);
|
|
102801
|
+
const detail = await detailRes.json();
|
|
102802
|
+
const subjectHeader = detail.payload.headers.find(h => h.name === "Subject")?.value;
|
|
102803
|
+
console.log(subjectHeader, detail.snippet);
|
|
102804
|
+
}
|
|
102697
102805
|
\`\`\``
|
|
102698
102806
|
},
|
|
102699
|
-
tools: tools50
|
|
102700
|
-
async checkConnection(params, _config) {
|
|
102701
|
-
const { GoogleAuth } = await import("google-auth-library");
|
|
102702
|
-
const credentials = JSON.parse(
|
|
102703
|
-
Buffer.from(
|
|
102704
|
-
params[parameters50.serviceAccountKeyJsonBase64.slug],
|
|
102705
|
-
"base64"
|
|
102706
|
-
).toString("utf-8")
|
|
102707
|
-
);
|
|
102708
|
-
const delegatedUserEmail = params[delegatedUserEmailParameter.slug];
|
|
102709
|
-
if (!delegatedUserEmail) {
|
|
102710
|
-
if (!credentials.client_email || !credentials.private_key) {
|
|
102711
|
-
return {
|
|
102712
|
-
success: false,
|
|
102713
|
-
error: "Service account JSON must contain client_email and private_key"
|
|
102714
|
-
};
|
|
102715
|
-
}
|
|
102716
|
-
return { success: true };
|
|
102717
|
-
}
|
|
102718
|
-
const auth = new GoogleAuth({
|
|
102719
|
-
credentials,
|
|
102720
|
-
scopes: ["https://www.googleapis.com/auth/gmail.readonly"],
|
|
102721
|
-
clientOptions: {
|
|
102722
|
-
subject: delegatedUserEmail
|
|
102723
|
-
}
|
|
102724
|
-
});
|
|
102725
|
-
try {
|
|
102726
|
-
const token = await auth.getAccessToken();
|
|
102727
|
-
if (!token) {
|
|
102728
|
-
return {
|
|
102729
|
-
success: false,
|
|
102730
|
-
error: "Failed to obtain access token"
|
|
102731
|
-
};
|
|
102732
|
-
}
|
|
102733
|
-
const res = await fetch(
|
|
102734
|
-
"https://gmail.googleapis.com/gmail/v1/users/me/profile",
|
|
102735
|
-
{
|
|
102736
|
-
method: "GET",
|
|
102737
|
-
headers: { Authorization: `Bearer ${token}` }
|
|
102738
|
-
}
|
|
102739
|
-
);
|
|
102740
|
-
if (!res.ok) {
|
|
102741
|
-
const errorText = await res.text().catch(() => res.statusText);
|
|
102742
|
-
return {
|
|
102743
|
-
success: false,
|
|
102744
|
-
error: `Gmail API failed: HTTP ${res.status} ${errorText}`
|
|
102745
|
-
};
|
|
102746
|
-
}
|
|
102747
|
-
return { success: true };
|
|
102748
|
-
} catch (error2) {
|
|
102749
|
-
return {
|
|
102750
|
-
success: false,
|
|
102751
|
-
error: error2 instanceof Error ? error2.message : String(error2)
|
|
102752
|
-
};
|
|
102753
|
-
}
|
|
102754
|
-
}
|
|
102807
|
+
tools: tools50
|
|
102755
102808
|
});
|
|
102756
102809
|
|
|
102757
102810
|
// ../connectors/src/connectors/gmail-oauth/tools/request.ts
|
|
@@ -102813,7 +102866,7 @@ var outputSchema62 = z64.discriminatedUnion("success", [
|
|
|
102813
102866
|
error: z64.string()
|
|
102814
102867
|
})
|
|
102815
102868
|
]);
|
|
102816
|
-
var
|
|
102869
|
+
var requestTool35 = new ConnectorTool({
|
|
102817
102870
|
name: "request",
|
|
102818
102871
|
description: `Send authenticated GET requests to the Gmail API v1.
|
|
102819
102872
|
Authentication is handled automatically via OAuth proxy.
|
|
@@ -102871,7 +102924,7 @@ All paths are relative to https://gmail.googleapis.com/gmail/v1/users. Use '/me'
|
|
|
102871
102924
|
});
|
|
102872
102925
|
|
|
102873
102926
|
// ../connectors/src/connectors/gmail-oauth/setup.ts
|
|
102874
|
-
var requestToolName9 = `gmail-oauth_${
|
|
102927
|
+
var requestToolName9 = `gmail-oauth_${requestTool35.name}`;
|
|
102875
102928
|
var gmailOnboarding2 = new ConnectorOnboarding({
|
|
102876
102929
|
connectionSetupInstructions: {
|
|
102877
102930
|
ja: `\u4EE5\u4E0B\u306E\u624B\u9806\u3067Gmail\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306E\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002
|
|
@@ -102915,7 +102968,7 @@ var gmailOnboarding2 = new ConnectorOnboarding({
|
|
|
102915
102968
|
var parameters51 = {};
|
|
102916
102969
|
|
|
102917
102970
|
// ../connectors/src/connectors/gmail-oauth/index.ts
|
|
102918
|
-
var tools51 = { request:
|
|
102971
|
+
var tools51 = { request: requestTool35 };
|
|
102919
102972
|
var gmailOauthConnector = new ConnectorPlugin({
|
|
102920
102973
|
slug: "gmail",
|
|
102921
102974
|
authType: AUTH_TYPES.OAUTH,
|
|
@@ -103350,7 +103403,7 @@ var outputSchema64 = z66.discriminatedUnion("success", [
|
|
|
103350
103403
|
error: z66.string()
|
|
103351
103404
|
})
|
|
103352
103405
|
]);
|
|
103353
|
-
var
|
|
103406
|
+
var requestTool36 = new ConnectorTool({
|
|
103354
103407
|
name: "request",
|
|
103355
103408
|
description: `Send authenticated requests to the LinkedIn Marketing API (REST).
|
|
103356
103409
|
Authentication is handled automatically via OAuth proxy.
|
|
@@ -103426,7 +103479,7 @@ Required headers (LinkedIn-Version, X-Restli-Protocol-Version) are set automatic
|
|
|
103426
103479
|
|
|
103427
103480
|
// ../connectors/src/connectors/linkedin-ads/index.ts
|
|
103428
103481
|
var tools52 = {
|
|
103429
|
-
request:
|
|
103482
|
+
request: requestTool36,
|
|
103430
103483
|
listAdAccounts: listAdAccountsTool3
|
|
103431
103484
|
};
|
|
103432
103485
|
var linkedinAdsConnector = new ConnectorPlugin({
|
|
@@ -103735,7 +103788,7 @@ var outputSchema65 = z67.discriminatedUnion("success", [
|
|
|
103735
103788
|
error: z67.string()
|
|
103736
103789
|
})
|
|
103737
103790
|
]);
|
|
103738
|
-
var
|
|
103791
|
+
var requestTool37 = new ConnectorTool({
|
|
103739
103792
|
name: "request",
|
|
103740
103793
|
description: `Send authenticated requests to the Zendesk Support API.
|
|
103741
103794
|
Authentication is handled automatically using email/token Basic auth.
|
|
@@ -103791,7 +103844,7 @@ Zendesk uses cursor-based pagination with page[size] and page[after] parameters.
|
|
|
103791
103844
|
});
|
|
103792
103845
|
|
|
103793
103846
|
// ../connectors/src/connectors/zendesk/index.ts
|
|
103794
|
-
var tools53 = { request:
|
|
103847
|
+
var tools53 = { request: requestTool37 };
|
|
103795
103848
|
var zendeskConnector = new ConnectorPlugin({
|
|
103796
103849
|
slug: "zendesk",
|
|
103797
103850
|
authType: AUTH_TYPES.API_KEY,
|
|
@@ -104035,7 +104088,7 @@ var outputSchema66 = z68.discriminatedUnion("success", [
|
|
|
104035
104088
|
error: z68.string()
|
|
104036
104089
|
})
|
|
104037
104090
|
]);
|
|
104038
|
-
var
|
|
104091
|
+
var requestTool38 = new ConnectorTool({
|
|
104039
104092
|
name: "request",
|
|
104040
104093
|
description: `Send authenticated requests to the Zendesk Support API.
|
|
104041
104094
|
Authentication is handled automatically via OAuth proxy.
|
|
@@ -104096,7 +104149,7 @@ Zendesk uses cursor-based pagination with page[size] and page[after] parameters.
|
|
|
104096
104149
|
});
|
|
104097
104150
|
|
|
104098
104151
|
// ../connectors/src/connectors/zendesk-oauth/setup.ts
|
|
104099
|
-
var requestToolName10 = `zendesk-oauth_${
|
|
104152
|
+
var requestToolName10 = `zendesk-oauth_${requestTool38.name}`;
|
|
104100
104153
|
var zendeskOauthOnboarding = new ConnectorOnboarding({
|
|
104101
104154
|
connectionSetupInstructions: {
|
|
104102
104155
|
en: `Follow these steps to set up the Zendesk connection.
|
|
@@ -104136,7 +104189,7 @@ var zendeskOauthOnboarding = new ConnectorOnboarding({
|
|
|
104136
104189
|
var parameters54 = {};
|
|
104137
104190
|
|
|
104138
104191
|
// ../connectors/src/connectors/zendesk-oauth/index.ts
|
|
104139
|
-
var tools54 = { request:
|
|
104192
|
+
var tools54 = { request: requestTool38 };
|
|
104140
104193
|
var zendeskOauthConnector = new ConnectorPlugin({
|
|
104141
104194
|
slug: "zendesk",
|
|
104142
104195
|
authType: AUTH_TYPES.OAUTH,
|
|
@@ -104352,7 +104405,7 @@ var outputSchema67 = z69.discriminatedUnion("success", [
|
|
|
104352
104405
|
error: z69.string()
|
|
104353
104406
|
})
|
|
104354
104407
|
]);
|
|
104355
|
-
var
|
|
104408
|
+
var requestTool39 = new ConnectorTool({
|
|
104356
104409
|
name: "request",
|
|
104357
104410
|
description: `Send authenticated requests to the Intercom API.
|
|
104358
104411
|
Authentication is handled automatically using the Access Token (Bearer token).
|
|
@@ -104408,7 +104461,7 @@ The Intercom-Version header is set to 2.11 automatically.`,
|
|
|
104408
104461
|
});
|
|
104409
104462
|
|
|
104410
104463
|
// ../connectors/src/connectors/intercom/index.ts
|
|
104411
|
-
var tools55 = { request:
|
|
104464
|
+
var tools55 = { request: requestTool39 };
|
|
104412
104465
|
var intercomConnector = new ConnectorPlugin({
|
|
104413
104466
|
slug: "intercom",
|
|
104414
104467
|
authType: AUTH_TYPES.API_KEY,
|
|
@@ -104673,7 +104726,7 @@ var outputSchema68 = z70.discriminatedUnion("success", [
|
|
|
104673
104726
|
error: z70.string()
|
|
104674
104727
|
})
|
|
104675
104728
|
]);
|
|
104676
|
-
var
|
|
104729
|
+
var requestTool40 = new ConnectorTool({
|
|
104677
104730
|
name: "request",
|
|
104678
104731
|
description: `Send authenticated requests to the Intercom API.
|
|
104679
104732
|
Authentication is handled automatically via OAuth proxy.
|
|
@@ -104736,7 +104789,7 @@ Search endpoints (contacts/search, conversations/search) use POST with a query o
|
|
|
104736
104789
|
});
|
|
104737
104790
|
|
|
104738
104791
|
// ../connectors/src/connectors/intercom-oauth/setup.ts
|
|
104739
|
-
var requestToolName11 = `intercom-oauth_${
|
|
104792
|
+
var requestToolName11 = `intercom-oauth_${requestTool40.name}`;
|
|
104740
104793
|
var intercomOauthOnboarding = new ConnectorOnboarding({
|
|
104741
104794
|
connectionSetupInstructions: {
|
|
104742
104795
|
en: `Follow these steps to set up the Intercom connection.
|
|
@@ -104776,7 +104829,7 @@ var intercomOauthOnboarding = new ConnectorOnboarding({
|
|
|
104776
104829
|
var parameters56 = {};
|
|
104777
104830
|
|
|
104778
104831
|
// ../connectors/src/connectors/intercom-oauth/index.ts
|
|
104779
|
-
var tools56 = { request:
|
|
104832
|
+
var tools56 = { request: requestTool40 };
|
|
104780
104833
|
var intercomOauthConnector = new ConnectorPlugin({
|
|
104781
104834
|
slug: "intercom",
|
|
104782
104835
|
authType: AUTH_TYPES.OAUTH,
|
|
@@ -105028,7 +105081,7 @@ var outputSchema69 = z71.discriminatedUnion("success", [
|
|
|
105028
105081
|
error: z71.string()
|
|
105029
105082
|
})
|
|
105030
105083
|
]);
|
|
105031
|
-
var
|
|
105084
|
+
var requestTool41 = new ConnectorTool({
|
|
105032
105085
|
name: "request",
|
|
105033
105086
|
description: `Send authenticated requests to the Mixpanel REST API.
|
|
105034
105087
|
Authentication is handled automatically using Basic auth (Service Account username + secret).
|
|
@@ -105122,7 +105175,7 @@ Rate limit: 60 queries/hour, 5 concurrent queries for Query API.`,
|
|
|
105122
105175
|
});
|
|
105123
105176
|
|
|
105124
105177
|
// ../connectors/src/connectors/mixpanel/index.ts
|
|
105125
|
-
var tools57 = { request:
|
|
105178
|
+
var tools57 = { request: requestTool41 };
|
|
105126
105179
|
var mixpanelConnector = new ConnectorPlugin({
|
|
105127
105180
|
slug: "mixpanel",
|
|
105128
105181
|
authType: AUTH_TYPES.API_KEY,
|
|
@@ -105316,7 +105369,7 @@ var outputSchema70 = z72.discriminatedUnion("success", [
|
|
|
105316
105369
|
error: z72.string()
|
|
105317
105370
|
})
|
|
105318
105371
|
]);
|
|
105319
|
-
var
|
|
105372
|
+
var requestTool42 = new ConnectorTool({
|
|
105320
105373
|
name: "request",
|
|
105321
105374
|
description: `Send authenticated requests to the Grafana HTTP API.
|
|
105322
105375
|
Authentication is handled automatically using the configured API Key or Service Account Token via Bearer token.
|
|
@@ -105372,7 +105425,7 @@ The path must start with '/' and is appended to the configured Grafana instance
|
|
|
105372
105425
|
});
|
|
105373
105426
|
|
|
105374
105427
|
// ../connectors/src/connectors/grafana/index.ts
|
|
105375
|
-
var tools58 = { request:
|
|
105428
|
+
var tools58 = { request: requestTool42 };
|
|
105376
105429
|
var grafanaConnector = new ConnectorPlugin({
|
|
105377
105430
|
slug: "grafana",
|
|
105378
105431
|
authType: AUTH_TYPES.API_KEY,
|
|
@@ -105560,7 +105613,7 @@ var outputSchema71 = z73.discriminatedUnion("success", [
|
|
|
105560
105613
|
error: z73.string()
|
|
105561
105614
|
})
|
|
105562
105615
|
]);
|
|
105563
|
-
var
|
|
105616
|
+
var requestTool43 = new ConnectorTool({
|
|
105564
105617
|
name: "request",
|
|
105565
105618
|
description: `Send authenticated requests to the Backlog REST API (v2).
|
|
105566
105619
|
Authentication is handled automatically by appending the apiKey query parameter to every request.
|
|
@@ -105617,7 +105670,7 @@ Do NOT include the apiKey parameter yourself; it is injected automatically.`,
|
|
|
105617
105670
|
});
|
|
105618
105671
|
|
|
105619
105672
|
// ../connectors/src/connectors/backlog/index.ts
|
|
105620
|
-
var tools59 = { request:
|
|
105673
|
+
var tools59 = { request: requestTool43 };
|
|
105621
105674
|
var backlogConnector = new ConnectorPlugin({
|
|
105622
105675
|
slug: "backlog",
|
|
105623
105676
|
authType: AUTH_TYPES.API_KEY,
|
|
@@ -105827,7 +105880,7 @@ var outputSchema72 = z74.discriminatedUnion("success", [
|
|
|
105827
105880
|
error: z74.string()
|
|
105828
105881
|
})
|
|
105829
105882
|
]);
|
|
105830
|
-
var
|
|
105883
|
+
var requestTool44 = new ConnectorTool({
|
|
105831
105884
|
name: "request",
|
|
105832
105885
|
description: `Send authenticated requests to the Gamma REST API.
|
|
105833
105886
|
Authentication is handled automatically using the API Key (X-API-KEY header).
|
|
@@ -106055,7 +106108,7 @@ Gamma does NOT support image uploads. To visualize data, embed raw numbers direc
|
|
|
106055
106108
|
});
|
|
106056
106109
|
|
|
106057
106110
|
// ../connectors/src/connectors/gamma/index.ts
|
|
106058
|
-
var tools60 = { request:
|
|
106111
|
+
var tools60 = { request: requestTool44, generate: generateTool };
|
|
106059
106112
|
var gammaConnector = new ConnectorPlugin({
|
|
106060
106113
|
slug: "gamma",
|
|
106061
106114
|
authType: AUTH_TYPES.API_KEY,
|
|
@@ -106278,7 +106331,7 @@ var outputSchema74 = z76.discriminatedUnion("success", [
|
|
|
106278
106331
|
error: z76.string()
|
|
106279
106332
|
})
|
|
106280
106333
|
]);
|
|
106281
|
-
var
|
|
106334
|
+
var requestTool45 = new ConnectorTool({
|
|
106282
106335
|
name: "request",
|
|
106283
106336
|
description: `Send authenticated requests to the Sentry API.
|
|
106284
106337
|
Supports GET, POST, PUT, and DELETE methods.
|
|
@@ -106335,7 +106388,7 @@ Authentication is handled automatically via Bearer token.
|
|
|
106335
106388
|
});
|
|
106336
106389
|
|
|
106337
106390
|
// ../connectors/src/connectors/sentry/index.ts
|
|
106338
|
-
var tools61 = { request:
|
|
106391
|
+
var tools61 = { request: requestTool45 };
|
|
106339
106392
|
var sentryConnector = new ConnectorPlugin({
|
|
106340
106393
|
slug: "sentry",
|
|
106341
106394
|
authType: AUTH_TYPES.API_KEY,
|
|
@@ -106624,7 +106677,7 @@ function normalizeInstanceUrl(raw) {
|
|
|
106624
106677
|
}
|
|
106625
106678
|
return trimmed;
|
|
106626
106679
|
}
|
|
106627
|
-
var
|
|
106680
|
+
var requestTool46 = new ConnectorTool({
|
|
106628
106681
|
name: "request",
|
|
106629
106682
|
description: `Send authenticated requests to the Salesforce REST API.
|
|
106630
106683
|
Authentication is handled automatically using the OAuth 2.0 Client Credentials Flow (External Client App or Connected App Consumer Key + Secret). An access token is obtained on each request, so the tool user only provides the API path.
|
|
@@ -106721,7 +106774,7 @@ Prefer SOQL via the /query endpoint for filtered, joined, or aggregated reads ra
|
|
|
106721
106774
|
});
|
|
106722
106775
|
|
|
106723
106776
|
// ../connectors/src/connectors/salesforce/index.ts
|
|
106724
|
-
var tools62 = { request:
|
|
106777
|
+
var tools62 = { request: requestTool46 };
|
|
106725
106778
|
var salesforceConnector = new ConnectorPlugin({
|
|
106726
106779
|
slug: "salesforce",
|
|
106727
106780
|
authType: AUTH_TYPES.API_KEY,
|
|
@@ -106729,7 +106782,7 @@ var salesforceConnector = new ConnectorPlugin({
|
|
|
106729
106782
|
description: "Connect to Salesforce CRM for accounts, contacts, opportunities, leads, cases, and custom objects via SOQL and the REST API.",
|
|
106730
106783
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/6vZlbrUKhxXIiuvWJlb8YB/bbc5e08b88de46c8ed338a74c7d0abb3/salesforce-icon.png",
|
|
106731
106784
|
parameters: parameters62,
|
|
106732
|
-
releaseFlag: { dev1: true, dev2:
|
|
106785
|
+
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
106733
106786
|
onboarding: salesforceOnboarding,
|
|
106734
106787
|
systemPrompt: {
|
|
106735
106788
|
en: `### Tools
|
|
@@ -107008,7 +107061,7 @@ var outputSchema76 = z78.discriminatedUnion("success", [
|
|
|
107008
107061
|
error: z78.string()
|
|
107009
107062
|
})
|
|
107010
107063
|
]);
|
|
107011
|
-
var
|
|
107064
|
+
var requestTool47 = new ConnectorTool({
|
|
107012
107065
|
name: "request",
|
|
107013
107066
|
description: `Send authenticated requests to the InfluxDB HTTP API.
|
|
107014
107067
|
Authentication is handled automatically using the API token (\`Authorization: Token {token}\`). The instance URL is resolved from the connection.
|
|
@@ -107086,7 +107139,7 @@ For read-only data exploration prefer SQL (InfluxDB 3) or InfluxQL queries \u201
|
|
|
107086
107139
|
});
|
|
107087
107140
|
|
|
107088
107141
|
// ../connectors/src/connectors/influxdb/index.ts
|
|
107089
|
-
var tools63 = { request:
|
|
107142
|
+
var tools63 = { request: requestTool47 };
|
|
107090
107143
|
var influxdbConnector = new ConnectorPlugin({
|
|
107091
107144
|
slug: "influxdb",
|
|
107092
107145
|
authType: AUTH_TYPES.API_KEY,
|