@google/gemini-cli 0.36.0-preview.3 → 0.36.0-preview.4
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/bundle/{chunk-2RPVSGOE.js → chunk-GCWRR5FX.js} +248 -175
- package/bundle/{chunk-OVFZ4PPB.js → chunk-GUQQGCYU.js} +3 -3
- package/bundle/{chunk-4ZPLYY3L.js → chunk-L6SWRWOY.js} +250 -177
- package/bundle/{chunk-SE7S5EFV.js → chunk-LA7NTE7R.js} +3 -3
- package/bundle/{chunk-Y5DDI4MA.js → chunk-NB2KVK55.js} +3 -3
- package/bundle/{chunk-PDS477H6.js → chunk-PCRNOH75.js} +3 -3
- package/bundle/{chunk-FJHYKR2O.js → chunk-QG3DE2NC.js} +250 -177
- package/bundle/{chunk-FACTELEP.js → chunk-RCVLWPH6.js} +253 -175
- package/bundle/{core-RSKPPZFK.js → core-UDWC3JHH.js} +5 -1
- package/bundle/{devtoolsService-VZGEDJ2H.js → devtoolsService-5KPG7MTO.js} +2 -2
- package/bundle/{devtoolsService-F3X4NCW2.js → devtoolsService-F3HNCJ5J.js} +2 -2
- package/bundle/{devtoolsService-Q3IGIXA7.js → devtoolsService-JP7KYM7O.js} +2 -2
- package/bundle/{devtoolsService-SBQKROJQ.js → devtoolsService-WMTAFNHI.js} +2 -2
- package/bundle/{dist-5ZYQVUMO.js → dist-6YQTL2TU.js} +5 -1
- package/bundle/{dist-BYRHFNNX.js → dist-FZZRWINS.js} +5 -1
- package/bundle/{dist-DGLGMJBV.js → dist-WZ5ZCWLQ.js} +5 -1
- package/bundle/gemini.js +6 -6
- package/bundle/{interactiveCli-FJD2UDE7.js → interactiveCli-2MHB7PL6.js} +3 -3
- package/bundle/{interactiveCli-HKCAHWZ2.js → interactiveCli-3FPUSZZF.js} +3 -3
- package/bundle/{interactiveCli-2CPHR4GH.js → interactiveCli-HKHDILWJ.js} +3 -3
- package/bundle/{interactiveCli-J2NVKRYX.js → interactiveCli-MNSUUMCD.js} +3 -3
- package/bundle/node_modules/@google/gemini-cli-devtools/package.json +1 -1
- package/bundle/{oauth2-provider-UMWJMSPF.js → oauth2-provider-GU6JSDXE.js} +1 -1
- package/bundle/{oauth2-provider-VHUD4ICS.js → oauth2-provider-NNYNDNHB.js} +1 -1
- package/bundle/{oauth2-provider-VAAF5BS7.js → oauth2-provider-U2Y3KMJH.js} +1 -1
- package/bundle/{oauth2-provider-ZVPXIEIS.js → oauth2-provider-UFMHKHVW.js} +1 -1
- package/package.json +1 -1
|
@@ -7649,22 +7649,22 @@ var require_crypto2 = __commonJS({
|
|
|
7649
7649
|
"use strict";
|
|
7650
7650
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
7651
7651
|
exports2.NodeCrypto = void 0;
|
|
7652
|
-
var
|
|
7652
|
+
var crypto23 = __require("crypto");
|
|
7653
7653
|
var NodeCrypto = class {
|
|
7654
7654
|
async sha256DigestBase64(str2) {
|
|
7655
|
-
return
|
|
7655
|
+
return crypto23.createHash("sha256").update(str2).digest("base64");
|
|
7656
7656
|
}
|
|
7657
7657
|
randomBytesBase64(count2) {
|
|
7658
|
-
return
|
|
7658
|
+
return crypto23.randomBytes(count2).toString("base64");
|
|
7659
7659
|
}
|
|
7660
7660
|
async verify(pubkey, data, signature) {
|
|
7661
|
-
const verifier =
|
|
7661
|
+
const verifier = crypto23.createVerify("RSA-SHA256");
|
|
7662
7662
|
verifier.update(data);
|
|
7663
7663
|
verifier.end();
|
|
7664
7664
|
return verifier.verify(pubkey, signature, "base64");
|
|
7665
7665
|
}
|
|
7666
7666
|
async sign(privateKey, data) {
|
|
7667
|
-
const signer =
|
|
7667
|
+
const signer = crypto23.createSign("RSA-SHA256");
|
|
7668
7668
|
signer.update(data);
|
|
7669
7669
|
signer.end();
|
|
7670
7670
|
return signer.sign(privateKey, "base64");
|
|
@@ -7682,7 +7682,7 @@ var require_crypto2 = __commonJS({
|
|
|
7682
7682
|
* string in hexadecimal encoding.
|
|
7683
7683
|
*/
|
|
7684
7684
|
async sha256DigestHex(str2) {
|
|
7685
|
-
return
|
|
7685
|
+
return crypto23.createHash("sha256").update(str2).digest("hex");
|
|
7686
7686
|
}
|
|
7687
7687
|
/**
|
|
7688
7688
|
* Computes the HMAC hash of a message using the provided crypto key and the
|
|
@@ -7694,7 +7694,7 @@ var require_crypto2 = __commonJS({
|
|
|
7694
7694
|
*/
|
|
7695
7695
|
async signWithHmacSha256(key, msg) {
|
|
7696
7696
|
const cryptoKey = typeof key === "string" ? key : toBuffer(key);
|
|
7697
|
-
return toArrayBuffer(
|
|
7697
|
+
return toArrayBuffer(crypto23.createHmac("sha256", cryptoKey).update(msg).digest());
|
|
7698
7698
|
}
|
|
7699
7699
|
};
|
|
7700
7700
|
exports2.NodeCrypto = NodeCrypto;
|
|
@@ -8250,10 +8250,10 @@ var require_oauth2client = __commonJS({
|
|
|
8250
8250
|
* https://github.com/googleapis/google-auth-library-nodejs/blob/main/samples/oauth2-codeVerifier.js
|
|
8251
8251
|
*/
|
|
8252
8252
|
async generateCodeVerifierAsync() {
|
|
8253
|
-
const
|
|
8254
|
-
const randomString2 =
|
|
8253
|
+
const crypto23 = (0, crypto_1.createCrypto)();
|
|
8254
|
+
const randomString2 = crypto23.randomBytesBase64(96);
|
|
8255
8255
|
const codeVerifier = randomString2.replace(/\+/g, "~").replace(/=/g, "_").replace(/\//g, "-");
|
|
8256
|
-
const unencodedCodeChallenge = await
|
|
8256
|
+
const unencodedCodeChallenge = await crypto23.sha256DigestBase64(codeVerifier);
|
|
8257
8257
|
const codeChallenge = unencodedCodeChallenge.split("=")[0].replace(/\+/g, "-").replace(/\//g, "_");
|
|
8258
8258
|
return { codeVerifier, codeChallenge };
|
|
8259
8259
|
}
|
|
@@ -8697,7 +8697,7 @@ var require_oauth2client = __commonJS({
|
|
|
8697
8697
|
* @return Returns a promise resolving to LoginTicket on verification.
|
|
8698
8698
|
*/
|
|
8699
8699
|
async verifySignedJwtWithCertsAsync(jwt2, certs, requiredAudience, issuers, maxExpiry) {
|
|
8700
|
-
const
|
|
8700
|
+
const crypto23 = (0, crypto_1.createCrypto)();
|
|
8701
8701
|
if (!maxExpiry) {
|
|
8702
8702
|
maxExpiry = _OAuth2Client.DEFAULT_MAX_TOKEN_LIFETIME_SECS_;
|
|
8703
8703
|
}
|
|
@@ -8710,7 +8710,7 @@ var require_oauth2client = __commonJS({
|
|
|
8710
8710
|
let envelope;
|
|
8711
8711
|
let payload;
|
|
8712
8712
|
try {
|
|
8713
|
-
envelope = JSON.parse(
|
|
8713
|
+
envelope = JSON.parse(crypto23.decodeBase64StringUtf8(segments[0]));
|
|
8714
8714
|
} catch (err2) {
|
|
8715
8715
|
if (err2 instanceof Error) {
|
|
8716
8716
|
err2.message = `Can't parse token envelope: ${segments[0]}': ${err2.message}`;
|
|
@@ -8721,7 +8721,7 @@ var require_oauth2client = __commonJS({
|
|
|
8721
8721
|
throw new Error("Can't parse token envelope: " + segments[0]);
|
|
8722
8722
|
}
|
|
8723
8723
|
try {
|
|
8724
|
-
payload = JSON.parse(
|
|
8724
|
+
payload = JSON.parse(crypto23.decodeBase64StringUtf8(segments[1]));
|
|
8725
8725
|
} catch (err2) {
|
|
8726
8726
|
if (err2 instanceof Error) {
|
|
8727
8727
|
err2.message = `Can't parse token payload '${segments[0]}`;
|
|
@@ -8738,7 +8738,7 @@ var require_oauth2client = __commonJS({
|
|
|
8738
8738
|
if (envelope.alg === "ES256") {
|
|
8739
8739
|
signature = formatEcdsa.joseToDer(signature, "ES256").toString("base64");
|
|
8740
8740
|
}
|
|
8741
|
-
const verified = await
|
|
8741
|
+
const verified = await crypto23.verify(cert, signed, signature);
|
|
8742
8742
|
if (!verified) {
|
|
8743
8743
|
throw new Error("Invalid token signature: " + jwt2);
|
|
8744
8744
|
}
|
|
@@ -10883,14 +10883,14 @@ var require_awsrequestsigner = __commonJS({
|
|
|
10883
10883
|
}
|
|
10884
10884
|
};
|
|
10885
10885
|
exports2.AwsRequestSigner = AwsRequestSigner;
|
|
10886
|
-
async function sign(
|
|
10887
|
-
return await
|
|
10888
|
-
}
|
|
10889
|
-
async function getSigningKey(
|
|
10890
|
-
const kDate = await sign(
|
|
10891
|
-
const kRegion = await sign(
|
|
10892
|
-
const kService = await sign(
|
|
10893
|
-
const kSigning = await sign(
|
|
10886
|
+
async function sign(crypto23, key, msg) {
|
|
10887
|
+
return await crypto23.signWithHmacSha256(key, msg);
|
|
10888
|
+
}
|
|
10889
|
+
async function getSigningKey(crypto23, key, dateStamp, region, serviceName) {
|
|
10890
|
+
const kDate = await sign(crypto23, `AWS4${key}`, dateStamp);
|
|
10891
|
+
const kRegion = await sign(crypto23, kDate, region);
|
|
10892
|
+
const kService = await sign(crypto23, kRegion, serviceName);
|
|
10893
|
+
const kSigning = await sign(crypto23, kService, "aws4_request");
|
|
10894
10894
|
return kSigning;
|
|
10895
10895
|
}
|
|
10896
10896
|
async function generateAuthenticationHeaderMap(options) {
|
|
@@ -12475,24 +12475,24 @@ var require_googleauth = __commonJS({
|
|
|
12475
12475
|
const signed = await client.sign(data);
|
|
12476
12476
|
return signed.signedBlob;
|
|
12477
12477
|
}
|
|
12478
|
-
const
|
|
12478
|
+
const crypto23 = (0, crypto_1.createCrypto)();
|
|
12479
12479
|
if (client instanceof jwtclient_1.JWT && client.key) {
|
|
12480
|
-
const sign = await
|
|
12480
|
+
const sign = await crypto23.sign(client.key, data);
|
|
12481
12481
|
return sign;
|
|
12482
12482
|
}
|
|
12483
12483
|
const creds = await this.getCredentials();
|
|
12484
12484
|
if (!creds.client_email) {
|
|
12485
12485
|
throw new Error("Cannot sign data without `client_email`.");
|
|
12486
12486
|
}
|
|
12487
|
-
return this.signBlob(
|
|
12487
|
+
return this.signBlob(crypto23, creds.client_email, data, endpoint);
|
|
12488
12488
|
}
|
|
12489
|
-
async signBlob(
|
|
12489
|
+
async signBlob(crypto23, emailOrUniqueId, data, endpoint) {
|
|
12490
12490
|
const url3 = new URL(endpoint + `${emailOrUniqueId}:signBlob`);
|
|
12491
12491
|
const res = await this.request({
|
|
12492
12492
|
method: "POST",
|
|
12493
12493
|
url: url3.href,
|
|
12494
12494
|
data: {
|
|
12495
|
-
payload:
|
|
12495
|
+
payload: crypto23.encodeBase64StringUtf8(data)
|
|
12496
12496
|
},
|
|
12497
12497
|
retry: true,
|
|
12498
12498
|
retryConfig: {
|
|
@@ -108730,7 +108730,7 @@ var require_src48 = __commonJS({
|
|
|
108730
108730
|
var require_object_hash = __commonJS({
|
|
108731
108731
|
"node_modules/object-hash/index.js"(exports2, module2) {
|
|
108732
108732
|
"use strict";
|
|
108733
|
-
var
|
|
108733
|
+
var crypto23 = __require("crypto");
|
|
108734
108734
|
exports2 = module2.exports = objectHash;
|
|
108735
108735
|
function objectHash(object3, options) {
|
|
108736
108736
|
options = applyDefaults(object3, options);
|
|
@@ -108748,7 +108748,7 @@ var require_object_hash = __commonJS({
|
|
|
108748
108748
|
exports2.keysMD5 = function(object3) {
|
|
108749
108749
|
return objectHash(object3, { algorithm: "md5", encoding: "hex", excludeValues: true });
|
|
108750
108750
|
};
|
|
108751
|
-
var hashes =
|
|
108751
|
+
var hashes = crypto23.getHashes ? crypto23.getHashes().slice() : ["sha1", "md5"];
|
|
108752
108752
|
hashes.push("passthrough");
|
|
108753
108753
|
var encodings = ["buffer", "hex", "binary", "base64"];
|
|
108754
108754
|
function applyDefaults(object3, sourceOptions) {
|
|
@@ -108794,7 +108794,7 @@ var require_object_hash = __commonJS({
|
|
|
108794
108794
|
function hash(object3, options) {
|
|
108795
108795
|
var hashingStream;
|
|
108796
108796
|
if (options.algorithm !== "passthrough") {
|
|
108797
|
-
hashingStream =
|
|
108797
|
+
hashingStream = crypto23.createHash(options.algorithm);
|
|
108798
108798
|
} else {
|
|
108799
108799
|
hashingStream = new PassThrough3();
|
|
108800
108800
|
}
|
|
@@ -125281,13 +125281,13 @@ var require_context = __commonJS({
|
|
|
125281
125281
|
exports2.parseXCloudTraceHeader = parseXCloudTraceHeader;
|
|
125282
125282
|
exports2.parseTraceParentHeader = parseTraceParentHeader;
|
|
125283
125283
|
var uuid3 = (init_esm_node(), __toCommonJS(esm_node_exports));
|
|
125284
|
-
var
|
|
125284
|
+
var crypto23 = __require("crypto");
|
|
125285
125285
|
var api_1 = (init_esm(), __toCommonJS(esm_exports));
|
|
125286
125286
|
exports2.X_CLOUD_TRACE_HEADER = "x-cloud-trace-context";
|
|
125287
125287
|
var SPAN_ID_RANDOM_BYTES = 8;
|
|
125288
125288
|
var spanIdBuffer = Buffer.alloc(SPAN_ID_RANDOM_BYTES);
|
|
125289
|
-
var randomFillSync2 =
|
|
125290
|
-
var randomBytes7 =
|
|
125289
|
+
var randomFillSync2 = crypto23.randomFillSync;
|
|
125290
|
+
var randomBytes7 = crypto23.randomBytes;
|
|
125291
125291
|
var spanRandomBuffer = randomFillSync2 ? () => randomFillSync2(spanIdBuffer) : () => randomBytes7(SPAN_ID_RANDOM_BYTES);
|
|
125292
125292
|
exports2.W3C_TRACE_PARENT_HEADER = "traceparent";
|
|
125293
125293
|
function makeHeaderWrapper(req) {
|
|
@@ -187690,8 +187690,8 @@ var require_snapshot_utils = __commonJS({
|
|
|
187690
187690
|
match: new Set(matchHeaders.map((header) => caseSensitive ? header : header.toLowerCase()))
|
|
187691
187691
|
};
|
|
187692
187692
|
}
|
|
187693
|
-
var
|
|
187694
|
-
var hashId =
|
|
187693
|
+
var crypto23 = runtimeFeatures.has("crypto") ? __require("node:crypto") : null;
|
|
187694
|
+
var hashId = crypto23?.hash ? (value) => crypto23.hash("sha256", value, "base64url") : (value) => Buffer.from(value).toString("base64url");
|
|
187695
187695
|
function isUndiciHeaders(headers) {
|
|
187696
187696
|
return Array.isArray(headers) && (headers.length & 1) === 0;
|
|
187697
187697
|
}
|
|
@@ -193746,10 +193746,10 @@ var require_subresource_integrity = __commonJS({
|
|
|
193746
193746
|
var assert4 = __require("node:assert");
|
|
193747
193747
|
var { runtimeFeatures } = require_runtime_features();
|
|
193748
193748
|
var validSRIHashAlgorithmTokenSet = /* @__PURE__ */ new Map([["sha256", 0], ["sha384", 1], ["sha512", 2]]);
|
|
193749
|
-
var
|
|
193749
|
+
var crypto23;
|
|
193750
193750
|
if (runtimeFeatures.has("crypto")) {
|
|
193751
|
-
|
|
193752
|
-
const cryptoHashes =
|
|
193751
|
+
crypto23 = __require("node:crypto");
|
|
193752
|
+
const cryptoHashes = crypto23.getHashes();
|
|
193753
193753
|
if (cryptoHashes.length === 0) {
|
|
193754
193754
|
validSRIHashAlgorithmTokenSet.clear();
|
|
193755
193755
|
}
|
|
@@ -193839,7 +193839,7 @@ var require_subresource_integrity = __commonJS({
|
|
|
193839
193839
|
return result2;
|
|
193840
193840
|
}
|
|
193841
193841
|
var applyAlgorithmToBytes = (algorithm, bytes) => {
|
|
193842
|
-
return
|
|
193842
|
+
return crypto23.hash(algorithm, bytes, "base64");
|
|
193843
193843
|
};
|
|
193844
193844
|
function caseSensitiveMatch(actualValue, expectedValue) {
|
|
193845
193845
|
let actualValueLength = actualValue.length;
|
|
@@ -196773,7 +196773,7 @@ var require_connection = __commonJS({
|
|
|
196773
196773
|
var { WebsocketFrameSend } = require_frame();
|
|
196774
196774
|
var assert4 = __require("node:assert");
|
|
196775
196775
|
var { runtimeFeatures } = require_runtime_features();
|
|
196776
|
-
var
|
|
196776
|
+
var crypto23 = runtimeFeatures.has("crypto") ? __require("node:crypto") : null;
|
|
196777
196777
|
var warningEmitted = false;
|
|
196778
196778
|
function establishWebSocketConnection(url3, protocols, client, handler, options) {
|
|
196779
196779
|
const requestURL = url3;
|
|
@@ -196793,7 +196793,7 @@ var require_connection = __commonJS({
|
|
|
196793
196793
|
const headersList = getHeadersList(new Headers2(options.headers));
|
|
196794
196794
|
request.headersList = headersList;
|
|
196795
196795
|
}
|
|
196796
|
-
const keyValue =
|
|
196796
|
+
const keyValue = crypto23.randomBytes(16).toString("base64");
|
|
196797
196797
|
request.headersList.append("sec-websocket-key", keyValue, true);
|
|
196798
196798
|
request.headersList.append("sec-websocket-version", "13", true);
|
|
196799
196799
|
for (const protocol of protocols) {
|
|
@@ -196833,7 +196833,7 @@ var require_connection = __commonJS({
|
|
|
196833
196833
|
return;
|
|
196834
196834
|
}
|
|
196835
196835
|
const secWSAccept = response.headersList.get("Sec-WebSocket-Accept");
|
|
196836
|
-
const digest =
|
|
196836
|
+
const digest = crypto23.hash("sha1", keyValue + uid, "base64");
|
|
196837
196837
|
if (secWSAccept !== digest) {
|
|
196838
196838
|
failWebsocketConnection(handler, 1002, "Incorrect hash received in Sec-WebSocket-Accept header.");
|
|
196839
196839
|
return;
|
|
@@ -249986,7 +249986,7 @@ var Float64Vector = import_vector.default.Float64Vector;
|
|
|
249986
249986
|
var PointerVector = import_vector.default.PointerVector;
|
|
249987
249987
|
|
|
249988
249988
|
// packages/core/dist/src/generated/git-commit.js
|
|
249989
|
-
var GIT_COMMIT_INFO = "
|
|
249989
|
+
var GIT_COMMIT_INFO = "38c706dbb";
|
|
249990
249990
|
var CLI_VERSION = "0.36.0-preview.3";
|
|
249991
249991
|
|
|
249992
249992
|
// packages/core/dist/src/ide/detect-ide.js
|
|
@@ -322903,6 +322903,62 @@ function parseExperiments(response) {
|
|
|
322903
322903
|
};
|
|
322904
322904
|
}
|
|
322905
322905
|
|
|
322906
|
+
// packages/core/dist/src/agents/registry.js
|
|
322907
|
+
import * as crypto17 from "node:crypto";
|
|
322908
|
+
|
|
322909
|
+
// packages/core/dist/src/agents/types.js
|
|
322910
|
+
var AgentTerminateMode;
|
|
322911
|
+
(function(AgentTerminateMode2) {
|
|
322912
|
+
AgentTerminateMode2["ERROR"] = "ERROR";
|
|
322913
|
+
AgentTerminateMode2["TIMEOUT"] = "TIMEOUT";
|
|
322914
|
+
AgentTerminateMode2["GOAL"] = "GOAL";
|
|
322915
|
+
AgentTerminateMode2["MAX_TURNS"] = "MAX_TURNS";
|
|
322916
|
+
AgentTerminateMode2["ABORTED"] = "ABORTED";
|
|
322917
|
+
AgentTerminateMode2["ERROR_NO_COMPLETE_TASK_CALL"] = "ERROR_NO_COMPLETE_TASK_CALL";
|
|
322918
|
+
})(AgentTerminateMode || (AgentTerminateMode = {}));
|
|
322919
|
+
var DEFAULT_QUERY_STRING = "Get Started!";
|
|
322920
|
+
var DEFAULT_MAX_TURNS = 30;
|
|
322921
|
+
var DEFAULT_MAX_TIME_MINUTES = 10;
|
|
322922
|
+
var SubagentActivityErrorType;
|
|
322923
|
+
(function(SubagentActivityErrorType2) {
|
|
322924
|
+
SubagentActivityErrorType2["REJECTED"] = "REJECTED";
|
|
322925
|
+
SubagentActivityErrorType2["CANCELLED"] = "CANCELLED";
|
|
322926
|
+
SubagentActivityErrorType2["GENERIC"] = "GENERIC";
|
|
322927
|
+
})(SubagentActivityErrorType || (SubagentActivityErrorType = {}));
|
|
322928
|
+
var SUBAGENT_REJECTED_ERROR_PREFIX = "User rejected this operation.";
|
|
322929
|
+
var SUBAGENT_CANCELLED_ERROR_MESSAGE = "Request cancelled.";
|
|
322930
|
+
function isSubagentProgress(obj) {
|
|
322931
|
+
return typeof obj === "object" && obj !== null && "isSubagentProgress" in obj && obj.isSubagentProgress === true;
|
|
322932
|
+
}
|
|
322933
|
+
function isToolActivityError(data) {
|
|
322934
|
+
return data !== null && typeof data === "object" && "isError" in data && data.isError === true;
|
|
322935
|
+
}
|
|
322936
|
+
function getAgentCardLoadOptions(def) {
|
|
322937
|
+
if (def.agentCardJson) {
|
|
322938
|
+
return { type: "json", json: def.agentCardJson };
|
|
322939
|
+
}
|
|
322940
|
+
if (def.agentCardUrl) {
|
|
322941
|
+
return { type: "url", url: def.agentCardUrl };
|
|
322942
|
+
}
|
|
322943
|
+
throw new Error(`Remote agent '${def.name}' has neither agentCardUrl nor agentCardJson`);
|
|
322944
|
+
}
|
|
322945
|
+
function getRemoteAgentTargetUrl(def) {
|
|
322946
|
+
if (def.agentCardUrl) {
|
|
322947
|
+
return def.agentCardUrl;
|
|
322948
|
+
}
|
|
322949
|
+
if (def.agentCardJson) {
|
|
322950
|
+
try {
|
|
322951
|
+
const parsed = JSON.parse(def.agentCardJson);
|
|
322952
|
+
const card = parsed;
|
|
322953
|
+
if (card.url) {
|
|
322954
|
+
return card.url;
|
|
322955
|
+
}
|
|
322956
|
+
} catch {
|
|
322957
|
+
}
|
|
322958
|
+
}
|
|
322959
|
+
return void 0;
|
|
322960
|
+
}
|
|
322961
|
+
|
|
322906
322962
|
// node_modules/js-yaml/dist/js-yaml.mjs
|
|
322907
322963
|
function isNothing(subject) {
|
|
322908
322964
|
return typeof subject === "undefined" || subject === null;
|
|
@@ -325494,34 +325550,6 @@ import * as fs46 from "node:fs/promises";
|
|
|
325494
325550
|
import * as path61 from "node:path";
|
|
325495
325551
|
import * as crypto16 from "node:crypto";
|
|
325496
325552
|
|
|
325497
|
-
// packages/core/dist/src/agents/types.js
|
|
325498
|
-
var AgentTerminateMode;
|
|
325499
|
-
(function(AgentTerminateMode2) {
|
|
325500
|
-
AgentTerminateMode2["ERROR"] = "ERROR";
|
|
325501
|
-
AgentTerminateMode2["TIMEOUT"] = "TIMEOUT";
|
|
325502
|
-
AgentTerminateMode2["GOAL"] = "GOAL";
|
|
325503
|
-
AgentTerminateMode2["MAX_TURNS"] = "MAX_TURNS";
|
|
325504
|
-
AgentTerminateMode2["ABORTED"] = "ABORTED";
|
|
325505
|
-
AgentTerminateMode2["ERROR_NO_COMPLETE_TASK_CALL"] = "ERROR_NO_COMPLETE_TASK_CALL";
|
|
325506
|
-
})(AgentTerminateMode || (AgentTerminateMode = {}));
|
|
325507
|
-
var DEFAULT_QUERY_STRING = "Get Started!";
|
|
325508
|
-
var DEFAULT_MAX_TURNS = 30;
|
|
325509
|
-
var DEFAULT_MAX_TIME_MINUTES = 10;
|
|
325510
|
-
var SubagentActivityErrorType;
|
|
325511
|
-
(function(SubagentActivityErrorType2) {
|
|
325512
|
-
SubagentActivityErrorType2["REJECTED"] = "REJECTED";
|
|
325513
|
-
SubagentActivityErrorType2["CANCELLED"] = "CANCELLED";
|
|
325514
|
-
SubagentActivityErrorType2["GENERIC"] = "GENERIC";
|
|
325515
|
-
})(SubagentActivityErrorType || (SubagentActivityErrorType = {}));
|
|
325516
|
-
var SUBAGENT_REJECTED_ERROR_PREFIX = "User rejected this operation.";
|
|
325517
|
-
var SUBAGENT_CANCELLED_ERROR_MESSAGE = "Request cancelled.";
|
|
325518
|
-
function isSubagentProgress(obj) {
|
|
325519
|
-
return typeof obj === "object" && obj !== null && "isSubagentProgress" in obj && obj.isSubagentProgress === true;
|
|
325520
|
-
}
|
|
325521
|
-
function isToolActivityError(data) {
|
|
325522
|
-
return data !== null && typeof data === "object" && "isError" in data && data.isError === true;
|
|
325523
|
-
}
|
|
325524
|
-
|
|
325525
325553
|
// packages/core/dist/src/skills/skillLoader.js
|
|
325526
325554
|
import * as fs45 from "node:fs/promises";
|
|
325527
325555
|
import * as path60 from "node:path";
|
|
@@ -325705,17 +325733,17 @@ var authConfigSchema = external_exports.discriminatedUnion("type", [
|
|
|
325705
325733
|
oauth2AuthSchema
|
|
325706
325734
|
]).superRefine((data, ctx) => {
|
|
325707
325735
|
if (data.type === "http") {
|
|
325708
|
-
if (data.value)
|
|
325736
|
+
if (data.value)
|
|
325709
325737
|
return;
|
|
325710
|
-
|
|
325711
|
-
|
|
325712
|
-
|
|
325713
|
-
|
|
325714
|
-
|
|
325715
|
-
|
|
325716
|
-
|
|
325717
|
-
|
|
325718
|
-
if (data.scheme === "Basic") {
|
|
325738
|
+
if (data.scheme === "Bearer") {
|
|
325739
|
+
if (!data.token) {
|
|
325740
|
+
ctx.addIssue({
|
|
325741
|
+
code: external_exports.ZodIssueCode.custom,
|
|
325742
|
+
message: 'Bearer scheme requires "token"',
|
|
325743
|
+
path: ["token"]
|
|
325744
|
+
});
|
|
325745
|
+
}
|
|
325746
|
+
} else if (data.scheme === "Basic") {
|
|
325719
325747
|
if (!data.username) {
|
|
325720
325748
|
ctx.addIssue({
|
|
325721
325749
|
code: external_exports.ZodIssueCode.custom,
|
|
@@ -325730,39 +325758,88 @@ var authConfigSchema = external_exports.discriminatedUnion("type", [
|
|
|
325730
325758
|
path: ["password"]
|
|
325731
325759
|
});
|
|
325732
325760
|
}
|
|
325761
|
+
} else {
|
|
325762
|
+
ctx.addIssue({
|
|
325763
|
+
code: external_exports.ZodIssueCode.custom,
|
|
325764
|
+
message: `HTTP scheme "${data.scheme}" requires "value"`,
|
|
325765
|
+
path: ["value"]
|
|
325766
|
+
});
|
|
325733
325767
|
}
|
|
325734
325768
|
}
|
|
325735
325769
|
});
|
|
325736
|
-
var
|
|
325770
|
+
var baseRemoteAgentSchema = external_exports.object({
|
|
325737
325771
|
kind: external_exports.literal("remote").optional().default("remote"),
|
|
325738
325772
|
name: nameSchema,
|
|
325739
325773
|
description: external_exports.string().optional(),
|
|
325740
325774
|
display_name: external_exports.string().optional(),
|
|
325741
|
-
agent_card_url: external_exports.string().url(),
|
|
325742
325775
|
auth: authConfigSchema.optional()
|
|
325776
|
+
});
|
|
325777
|
+
var remoteAgentUrlSchema = baseRemoteAgentSchema.extend({
|
|
325778
|
+
agent_card_url: external_exports.string().url(),
|
|
325779
|
+
agent_card_json: external_exports.undefined().optional()
|
|
325743
325780
|
}).strict();
|
|
325781
|
+
var remoteAgentJsonSchema = baseRemoteAgentSchema.extend({
|
|
325782
|
+
agent_card_url: external_exports.undefined().optional(),
|
|
325783
|
+
agent_card_json: external_exports.string().refine((val) => {
|
|
325784
|
+
try {
|
|
325785
|
+
JSON.parse(val);
|
|
325786
|
+
return true;
|
|
325787
|
+
} catch {
|
|
325788
|
+
return false;
|
|
325789
|
+
}
|
|
325790
|
+
}, { message: "agent_card_json must be valid JSON" })
|
|
325791
|
+
}).strict();
|
|
325792
|
+
var remoteAgentSchema = external_exports.union([
|
|
325793
|
+
remoteAgentUrlSchema,
|
|
325794
|
+
remoteAgentJsonSchema
|
|
325795
|
+
]);
|
|
325744
325796
|
var agentUnionOptions = [
|
|
325745
|
-
{
|
|
325746
|
-
{
|
|
325797
|
+
{ label: "Local Agent" },
|
|
325798
|
+
{ label: "Remote Agent" },
|
|
325799
|
+
{ label: "Remote Agent" }
|
|
325747
325800
|
];
|
|
325748
325801
|
var remoteAgentsListSchema = external_exports.array(remoteAgentSchema);
|
|
325749
325802
|
var markdownFrontmatterSchema = external_exports.union([
|
|
325750
|
-
|
|
325751
|
-
|
|
325803
|
+
localAgentSchema,
|
|
325804
|
+
remoteAgentUrlSchema,
|
|
325805
|
+
remoteAgentJsonSchema
|
|
325752
325806
|
]);
|
|
325753
|
-
function
|
|
325754
|
-
|
|
325807
|
+
function guessIntendedKind(rawInput) {
|
|
325808
|
+
if (typeof rawInput !== "object" || rawInput === null)
|
|
325809
|
+
return void 0;
|
|
325810
|
+
const input = rawInput;
|
|
325811
|
+
if (input.kind === "local")
|
|
325812
|
+
return "local";
|
|
325813
|
+
if (input.kind === "remote")
|
|
325814
|
+
return "remote";
|
|
325815
|
+
const hasLocalKeys = "tools" in input || "mcp_servers" in input || "model" in input || "temperature" in input || "max_turns" in input || "timeout_mins" in input;
|
|
325816
|
+
const hasRemoteKeys = "agent_card_url" in input || "auth" in input || "agent_card_json" in input;
|
|
325817
|
+
if (hasLocalKeys && !hasRemoteKeys)
|
|
325818
|
+
return "local";
|
|
325819
|
+
if (hasRemoteKeys && !hasLocalKeys)
|
|
325820
|
+
return "remote";
|
|
325821
|
+
return void 0;
|
|
325822
|
+
}
|
|
325823
|
+
function formatZodError(error40, context2, rawInput) {
|
|
325824
|
+
const intendedKind = rawInput ? guessIntendedKind(rawInput) : void 0;
|
|
325825
|
+
const formatIssues = (issues, unionPrefix) => issues.flatMap((i3) => {
|
|
325755
325826
|
if (i3.code === external_exports.ZodIssueCode.invalid_union) {
|
|
325756
|
-
return i3.unionErrors.
|
|
325757
|
-
const label = agentUnionOptions[index]?.label ?? `
|
|
325758
|
-
|
|
325759
|
-
|
|
325760
|
-
|
|
325827
|
+
return i3.unionErrors.flatMap((unionError, index) => {
|
|
325828
|
+
const label = unionPrefix ? unionPrefix : agentUnionOptions[index]?.label ?? `Branch #${index + 1}`;
|
|
325829
|
+
if (intendedKind === "local" && label === "Remote Agent")
|
|
325830
|
+
return [];
|
|
325831
|
+
if (intendedKind === "remote" && label === "Local Agent")
|
|
325832
|
+
return [];
|
|
325833
|
+
return formatIssues(unionError.issues, label);
|
|
325834
|
+
});
|
|
325761
325835
|
}
|
|
325762
|
-
|
|
325763
|
-
|
|
325836
|
+
const prefix = unionPrefix ? `(${unionPrefix}) ` : "";
|
|
325837
|
+
const path85 = i3.path.length > 0 ? `${i3.path.join(".")}: ` : "";
|
|
325838
|
+
return `${prefix}${path85}${i3.message}`;
|
|
325839
|
+
});
|
|
325840
|
+
const formatted = Array.from(new Set(formatIssues(error40.issues))).join("\n");
|
|
325764
325841
|
return `${context2}:
|
|
325765
|
-
${
|
|
325842
|
+
${formatted}`;
|
|
325766
325843
|
}
|
|
325767
325844
|
async function parseAgentMarkdown(filePath, content) {
|
|
325768
325845
|
let fileContent;
|
|
@@ -325785,11 +325862,7 @@ async function parseAgentMarkdown(filePath, content) {
|
|
|
325785
325862
|
try {
|
|
325786
325863
|
rawFrontmatter = load2(frontmatterStr);
|
|
325787
325864
|
} catch (error40) {
|
|
325788
|
-
throw new AgentLoadError(
|
|
325789
|
-
filePath,
|
|
325790
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
325791
|
-
`YAML frontmatter parsing failed: ${error40.message}`
|
|
325792
|
-
);
|
|
325865
|
+
throw new AgentLoadError(filePath, `YAML frontmatter parsing failed: ${getErrorMessage(error40)}`);
|
|
325793
325866
|
}
|
|
325794
325867
|
if (Array.isArray(rawFrontmatter)) {
|
|
325795
325868
|
const result3 = remoteAgentsListSchema.safeParse(rawFrontmatter);
|
|
@@ -325803,7 +325876,7 @@ async function parseAgentMarkdown(filePath, content) {
|
|
|
325803
325876
|
}
|
|
325804
325877
|
const result2 = markdownFrontmatterSchema.safeParse(rawFrontmatter);
|
|
325805
325878
|
if (!result2.success) {
|
|
325806
|
-
throw new AgentLoadError(filePath, `Validation failed: ${formatZodError(result2.error, "Agent Definition")}`);
|
|
325879
|
+
throw new AgentLoadError(filePath, `Validation failed: ${formatZodError(result2.error, "Agent Definition", rawFrontmatter)}`);
|
|
325807
325880
|
}
|
|
325808
325881
|
const frontmatter = result2.data;
|
|
325809
325882
|
if (frontmatter.kind === "remote") {
|
|
@@ -325814,39 +325887,30 @@ async function parseAgentMarkdown(filePath, content) {
|
|
|
325814
325887
|
}
|
|
325815
325888
|
];
|
|
325816
325889
|
}
|
|
325817
|
-
|
|
325818
|
-
|
|
325819
|
-
|
|
325820
|
-
|
|
325821
|
-
|
|
325822
|
-
|
|
325890
|
+
return [
|
|
325891
|
+
{
|
|
325892
|
+
...frontmatter,
|
|
325893
|
+
kind: "local",
|
|
325894
|
+
system_prompt: body2.trim()
|
|
325895
|
+
}
|
|
325896
|
+
];
|
|
325823
325897
|
}
|
|
325824
325898
|
function convertFrontmatterAuthToConfig(frontmatter) {
|
|
325825
|
-
const base = {};
|
|
325826
325899
|
switch (frontmatter.type) {
|
|
325827
325900
|
case "apiKey":
|
|
325828
|
-
if (!frontmatter.key) {
|
|
325829
|
-
throw new Error("Internal error: API key missing after validation.");
|
|
325830
|
-
}
|
|
325831
325901
|
return {
|
|
325832
|
-
...base,
|
|
325833
325902
|
type: "apiKey",
|
|
325834
325903
|
key: frontmatter.key,
|
|
325835
325904
|
name: frontmatter.name
|
|
325836
325905
|
};
|
|
325837
325906
|
case "google-credentials":
|
|
325838
325907
|
return {
|
|
325839
|
-
...base,
|
|
325840
325908
|
type: "google-credentials",
|
|
325841
325909
|
scopes: frontmatter.scopes
|
|
325842
325910
|
};
|
|
325843
|
-
case "http":
|
|
325844
|
-
if (!frontmatter.scheme) {
|
|
325845
|
-
throw new Error("Internal error: HTTP scheme missing after validation.");
|
|
325846
|
-
}
|
|
325911
|
+
case "http":
|
|
325847
325912
|
if (frontmatter.value) {
|
|
325848
325913
|
return {
|
|
325849
|
-
...base,
|
|
325850
325914
|
type: "http",
|
|
325851
325915
|
scheme: frontmatter.scheme,
|
|
325852
325916
|
value: frontmatter.value
|
|
@@ -325854,34 +325918,23 @@ function convertFrontmatterAuthToConfig(frontmatter) {
|
|
|
325854
325918
|
}
|
|
325855
325919
|
switch (frontmatter.scheme) {
|
|
325856
325920
|
case "Bearer":
|
|
325857
|
-
if (!frontmatter.token) {
|
|
325858
|
-
throw new Error("Internal error: Bearer token missing after validation.");
|
|
325859
|
-
}
|
|
325860
325921
|
return {
|
|
325861
|
-
...base,
|
|
325862
325922
|
type: "http",
|
|
325863
325923
|
scheme: "Bearer",
|
|
325864
325924
|
token: frontmatter.token
|
|
325865
325925
|
};
|
|
325866
325926
|
case "Basic":
|
|
325867
|
-
if (!frontmatter.username || !frontmatter.password) {
|
|
325868
|
-
throw new Error("Internal error: Basic auth credentials missing after validation.");
|
|
325869
|
-
}
|
|
325870
325927
|
return {
|
|
325871
|
-
...base,
|
|
325872
325928
|
type: "http",
|
|
325873
325929
|
scheme: "Basic",
|
|
325874
325930
|
username: frontmatter.username,
|
|
325875
325931
|
password: frontmatter.password
|
|
325876
325932
|
};
|
|
325877
|
-
default:
|
|
325933
|
+
default:
|
|
325878
325934
|
throw new Error(`Unknown HTTP scheme: ${frontmatter.scheme}`);
|
|
325879
|
-
}
|
|
325880
325935
|
}
|
|
325881
|
-
}
|
|
325882
325936
|
case "oauth":
|
|
325883
325937
|
return {
|
|
325884
|
-
...base,
|
|
325885
325938
|
type: "oauth2",
|
|
325886
325939
|
client_id: frontmatter.client_id,
|
|
325887
325940
|
client_secret: frontmatter.client_secret,
|
|
@@ -325890,8 +325943,12 @@ function convertFrontmatterAuthToConfig(frontmatter) {
|
|
|
325890
325943
|
token_url: frontmatter.token_url
|
|
325891
325944
|
};
|
|
325892
325945
|
default: {
|
|
325893
|
-
const exhaustive = frontmatter
|
|
325894
|
-
|
|
325946
|
+
const exhaustive = frontmatter;
|
|
325947
|
+
const raw = exhaustive;
|
|
325948
|
+
if (typeof raw === "object" && raw !== null && "type" in raw) {
|
|
325949
|
+
throw new Error(`Unknown auth type: ${String(raw["type"])}`);
|
|
325950
|
+
}
|
|
325951
|
+
throw new Error("Unknown auth type");
|
|
325895
325952
|
}
|
|
325896
325953
|
}
|
|
325897
325954
|
}
|
|
@@ -325910,20 +325967,28 @@ function markdownToAgentDefinition(markdown, metadata2) {
|
|
|
325910
325967
|
}
|
|
325911
325968
|
};
|
|
325912
325969
|
if (markdown.kind === "remote") {
|
|
325913
|
-
|
|
325970
|
+
const base = {
|
|
325914
325971
|
kind: "remote",
|
|
325915
325972
|
name: markdown.name,
|
|
325916
325973
|
description: markdown.description || "",
|
|
325917
325974
|
displayName: markdown.display_name,
|
|
325918
|
-
agentCardUrl: markdown.agent_card_url,
|
|
325919
325975
|
auth: markdown.auth ? convertFrontmatterAuthToConfig(markdown.auth) : void 0,
|
|
325920
325976
|
inputConfig,
|
|
325921
325977
|
metadata: metadata2
|
|
325922
325978
|
};
|
|
325979
|
+
if ("agent_card_json" in markdown && markdown.agent_card_json !== void 0) {
|
|
325980
|
+
base.agentCardJson = markdown.agent_card_json;
|
|
325981
|
+
return base;
|
|
325982
|
+
}
|
|
325983
|
+
if ("agent_card_url" in markdown && markdown.agent_card_url !== void 0) {
|
|
325984
|
+
base.agentCardUrl = markdown.agent_card_url;
|
|
325985
|
+
return base;
|
|
325986
|
+
}
|
|
325987
|
+
throw new AgentLoadError(metadata2?.filePath || "unknown", "Unexpected state: neither agent_card_json nor agent_card_url present on remote agent");
|
|
325923
325988
|
}
|
|
325924
325989
|
const modelName = markdown.model || "inherit";
|
|
325925
325990
|
const mcpServers = {};
|
|
325926
|
-
if (markdown.
|
|
325991
|
+
if (markdown.mcp_servers) {
|
|
325927
325992
|
for (const [name3, config2] of Object.entries(markdown.mcp_servers)) {
|
|
325928
325993
|
mcpServers[name3] = new MCPServerConfig(config2.command, config2.args, config2.env, config2.cwd, config2.url, config2.http_url, config2.headers, config2.tcp, config2.type, config2.timeout, config2.trust, config2.description, config2.include_tools, config2.exclude_tools);
|
|
325929
325994
|
}
|
|
@@ -325965,14 +326030,10 @@ async function loadAgentsFromDirectory(dir) {
|
|
|
325965
326030
|
try {
|
|
325966
326031
|
dirEntries = await fs46.readdir(dir, { withFileTypes: true });
|
|
325967
326032
|
} catch (error40) {
|
|
325968
|
-
if (error40.code === "ENOENT") {
|
|
326033
|
+
if (error40 instanceof Error && "code" in error40 && error40.code === "ENOENT") {
|
|
325969
326034
|
return result2;
|
|
325970
326035
|
}
|
|
325971
|
-
result2.errors.push(new AgentLoadError(
|
|
325972
|
-
dir,
|
|
325973
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
325974
|
-
`Could not list directory: ${error40.message}`
|
|
325975
|
-
));
|
|
326036
|
+
result2.errors.push(new AgentLoadError(dir, `Could not list directory: ${getErrorMessage(error40)}`));
|
|
325976
326037
|
return result2;
|
|
325977
326038
|
}
|
|
325978
326039
|
const files = dirEntries.filter((entry) => entry.isFile() && !entry.name.startsWith("_") && entry.name.endsWith(".md"));
|
|
@@ -325990,11 +326051,7 @@ async function loadAgentsFromDirectory(dir) {
|
|
|
325990
326051
|
if (error40 instanceof AgentLoadError) {
|
|
325991
326052
|
result2.errors.push(error40);
|
|
325992
326053
|
} else {
|
|
325993
|
-
result2.errors.push(new AgentLoadError(
|
|
325994
|
-
filePath,
|
|
325995
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
325996
|
-
`Unexpected error: ${error40.message}`
|
|
325997
|
-
));
|
|
326054
|
+
result2.errors.push(new AgentLoadError(filePath, `Unexpected error: ${getErrorMessage(error40)}`));
|
|
325998
326055
|
}
|
|
325999
326056
|
}
|
|
326000
326057
|
}
|
|
@@ -327038,7 +327095,7 @@ var A2AAuthProviderFactory = class _A2AAuthProviderFactory {
|
|
|
327038
327095
|
return provider;
|
|
327039
327096
|
}
|
|
327040
327097
|
case "oauth2": {
|
|
327041
|
-
const { OAuth2AuthProvider } = await import("./oauth2-provider-
|
|
327098
|
+
const { OAuth2AuthProvider } = await import("./oauth2-provider-U2Y3KMJH.js");
|
|
327042
327099
|
const provider = new OAuth2AuthProvider(authConfig, options.agentName ?? "unknown", agentCard, options.agentCardUrl);
|
|
327043
327100
|
await provider.initialize();
|
|
327044
327101
|
return provider;
|
|
@@ -327364,7 +327421,7 @@ var AgentRegistry = class {
|
|
|
327364
327421
|
if (!agent.metadata) {
|
|
327365
327422
|
agent.metadata = {};
|
|
327366
327423
|
}
|
|
327367
|
-
agent.metadata.hash = agent.agentCardUrl;
|
|
327424
|
+
agent.metadata.hash = agent.agentCardUrl ?? (agent.agentCardJson ? crypto17.createHash("sha256").update(agent.agentCardJson).digest("hex") : void 0);
|
|
327368
327425
|
}
|
|
327369
327426
|
if (!agent.metadata?.hash) {
|
|
327370
327427
|
agentsToRegister.push(agent);
|
|
@@ -327534,12 +327591,13 @@ var AgentRegistry = class {
|
|
|
327534
327591
|
debugLogger.warn(`[AgentRegistry] Skipping remote agent '${definition.name}': A2AClientManager is not available.`);
|
|
327535
327592
|
return;
|
|
327536
327593
|
}
|
|
327594
|
+
const targetUrl = getRemoteAgentTargetUrl(remoteDef);
|
|
327537
327595
|
let authHandler;
|
|
327538
327596
|
if (definition.auth) {
|
|
327539
327597
|
const provider = await A2AAuthProviderFactory.create({
|
|
327540
327598
|
authConfig: definition.auth,
|
|
327541
327599
|
agentName: definition.name,
|
|
327542
|
-
targetUrl
|
|
327600
|
+
targetUrl,
|
|
327543
327601
|
agentCardUrl: remoteDef.agentCardUrl
|
|
327544
327602
|
});
|
|
327545
327603
|
if (!provider) {
|
|
@@ -327547,7 +327605,7 @@ var AgentRegistry = class {
|
|
|
327547
327605
|
}
|
|
327548
327606
|
authHandler = provider;
|
|
327549
327607
|
}
|
|
327550
|
-
const agentCard = await clientManager.loadAgent(remoteDef.name, remoteDef
|
|
327608
|
+
const agentCard = await clientManager.loadAgent(remoteDef.name, getAgentCardLoadOptions(remoteDef), authHandler);
|
|
327551
327609
|
if (agentCard.securitySchemes) {
|
|
327552
327610
|
const validation = A2AAuthProviderFactory.validateAuthConfig(definition.auth, agentCard.securitySchemes);
|
|
327553
327611
|
if (!validation.valid && validation.diff) {
|
|
@@ -327575,7 +327633,7 @@ ${skillsList}`);
|
|
|
327575
327633
|
definition.description = descriptions.join("\n");
|
|
327576
327634
|
}
|
|
327577
327635
|
if (this.config.getDebugMode()) {
|
|
327578
|
-
debugLogger.log(`[AgentRegistry] Registered remote agent '${definition.name}' with card: ${definition.agentCardUrl}`);
|
|
327636
|
+
debugLogger.log(`[AgentRegistry] Registered remote agent '${definition.name}' with card: ${definition.agentCardUrl ?? "inline JSON"}`);
|
|
327579
327637
|
}
|
|
327580
327638
|
this.agents.set(definition.name, definition);
|
|
327581
327639
|
this.addAgentPolicy(definition);
|
|
@@ -331227,10 +331285,11 @@ var RemoteAgentInvocation = class _RemoteAgentInvocation extends BaseToolInvocat
|
|
|
331227
331285
|
return this.authHandler;
|
|
331228
331286
|
}
|
|
331229
331287
|
if (this.definition.auth) {
|
|
331288
|
+
const targetUrl = getRemoteAgentTargetUrl(this.definition);
|
|
331230
331289
|
const provider = await A2AAuthProviderFactory.create({
|
|
331231
331290
|
authConfig: this.definition.auth,
|
|
331232
331291
|
agentName: this.definition.name,
|
|
331233
|
-
targetUrl
|
|
331292
|
+
targetUrl,
|
|
331234
331293
|
agentCardUrl: this.definition.agentCardUrl
|
|
331235
331294
|
});
|
|
331236
331295
|
if (!provider) {
|
|
@@ -331275,7 +331334,7 @@ var RemoteAgentInvocation = class _RemoteAgentInvocation extends BaseToolInvocat
|
|
|
331275
331334
|
}
|
|
331276
331335
|
const authHandler = await this.getAuthHandler();
|
|
331277
331336
|
if (!this.clientManager.getClient(this.definition.name)) {
|
|
331278
|
-
await this.clientManager.loadAgent(this.definition.name, this.definition
|
|
331337
|
+
await this.clientManager.loadAgent(this.definition.name, getAgentCardLoadOptions(this.definition), authHandler);
|
|
331279
331338
|
}
|
|
331280
331339
|
const message = this.params.query;
|
|
331281
331340
|
const stream3 = this.clientManager.sendMessageStream(this.definition.name, message, {
|
|
@@ -333316,7 +333375,7 @@ var InjectionService = class {
|
|
|
333316
333375
|
// packages/core/dist/src/policy/config.js
|
|
333317
333376
|
import * as fs53 from "node:fs/promises";
|
|
333318
333377
|
import * as path68 from "node:path";
|
|
333319
|
-
import * as
|
|
333378
|
+
import * as crypto18 from "node:crypto";
|
|
333320
333379
|
import { fileURLToPath as fileURLToPath17 } from "node:url";
|
|
333321
333380
|
|
|
333322
333381
|
// packages/core/dist/src/policy/toml-loader.js
|
|
@@ -334191,7 +334250,7 @@ function createPolicyUpdater(policyEngine, messageBus, storage2) {
|
|
|
334191
334250
|
}
|
|
334192
334251
|
existingData.rule.push(newRule);
|
|
334193
334252
|
const newContent = import_toml3.default.stringify(existingData);
|
|
334194
|
-
const tmpSuffix =
|
|
334253
|
+
const tmpSuffix = crypto18.randomBytes(8).toString("hex");
|
|
334195
334254
|
const tmpFile = `${policyFile}.${tmpSuffix}.tmp`;
|
|
334196
334255
|
let handle2;
|
|
334197
334256
|
try {
|
|
@@ -335918,7 +335977,7 @@ import { pathToFileURL } from "node:url";
|
|
|
335918
335977
|
import { randomUUID as randomUUID8 } from "node:crypto";
|
|
335919
335978
|
|
|
335920
335979
|
// packages/core/dist/src/mcp/oauth-provider.js
|
|
335921
|
-
import * as
|
|
335980
|
+
import * as crypto20 from "node:crypto";
|
|
335922
335981
|
import { URL as URL7 } from "node:url";
|
|
335923
335982
|
|
|
335924
335983
|
// packages/core/dist/src/mcp/oauth-token-storage.js
|
|
@@ -336089,14 +336148,14 @@ var MCPOAuthTokenStorage = class {
|
|
|
336089
336148
|
|
|
336090
336149
|
// packages/core/dist/src/utils/oauth-flow.js
|
|
336091
336150
|
import * as http4 from "node:http";
|
|
336092
|
-
import * as
|
|
336151
|
+
import * as crypto19 from "node:crypto";
|
|
336093
336152
|
import { URL as URL6 } from "node:url";
|
|
336094
336153
|
var REDIRECT_PATH = "/oauth/callback";
|
|
336095
336154
|
var HTTP_OK = 200;
|
|
336096
336155
|
function generatePKCEParams() {
|
|
336097
|
-
const codeVerifier =
|
|
336098
|
-
const codeChallenge =
|
|
336099
|
-
const state =
|
|
336156
|
+
const codeVerifier = crypto19.randomBytes(64).toString("base64url");
|
|
336157
|
+
const codeChallenge = crypto19.createHash("sha256").update(codeVerifier).digest("base64url");
|
|
336158
|
+
const state = crypto19.randomBytes(16).toString("base64url");
|
|
336100
336159
|
return { codeVerifier, codeChallenge, state };
|
|
336101
336160
|
}
|
|
336102
336161
|
function startCallbackServer(expectedState, port) {
|
|
@@ -336630,7 +336689,7 @@ ${authUrl}
|
|
|
336630
336689
|
debugLogger.debug("\u2713 Authentication successful! Token saved.");
|
|
336631
336690
|
const savedToken = await this.tokenStorage.getCredentials(serverName);
|
|
336632
336691
|
if (savedToken && savedToken.token && savedToken.token.accessToken) {
|
|
336633
|
-
const tokenFingerprint =
|
|
336692
|
+
const tokenFingerprint = crypto20.createHash("sha256").update(savedToken.token.accessToken).digest("hex").slice(0, 8);
|
|
336634
336693
|
debugLogger.debug(`\u2713 Token verification successful (fingerprint: ${tokenFingerprint})`);
|
|
336635
336694
|
} else {
|
|
336636
336695
|
debugLogger.warn("Token verification failed: token not found or invalid after save");
|
|
@@ -337861,7 +337920,7 @@ function isEnabled(funcDecl, mcpServerName, mcpServerConfig) {
|
|
|
337861
337920
|
}
|
|
337862
337921
|
|
|
337863
337922
|
// packages/core/dist/src/tools/mcp-client-manager.js
|
|
337864
|
-
import { createHash as
|
|
337923
|
+
import { createHash as createHash9 } from "node:crypto";
|
|
337865
337924
|
var McpClientManager = class {
|
|
337866
337925
|
clients = /* @__PURE__ */ new Map();
|
|
337867
337926
|
// Track all configured servers (including disabled ones) for UI display
|
|
@@ -338049,7 +338108,7 @@ var McpClientManager = class {
|
|
|
338049
338108
|
config: rest,
|
|
338050
338109
|
extensionId: extension?.id
|
|
338051
338110
|
};
|
|
338052
|
-
return
|
|
338111
|
+
return createHash9("sha256").update(stableStringify(keyData)).digest("hex");
|
|
338053
338112
|
}
|
|
338054
338113
|
/**
|
|
338055
338114
|
* Merges two MCP configurations. The second configuration (override)
|
|
@@ -345920,7 +345979,7 @@ var A2AClientManager = class {
|
|
|
345920
345979
|
* @param authHandler Optional authentication handler to use for this agent.
|
|
345921
345980
|
* @returns The loaded AgentCard.
|
|
345922
345981
|
*/
|
|
345923
|
-
async loadAgent(name3,
|
|
345982
|
+
async loadAgent(name3, options, authHandler) {
|
|
345924
345983
|
if (this.clients.has(name3) && this.agentCards.has(name3)) {
|
|
345925
345984
|
throw new Error(`Agent with name '${name3}' is already loaded.`);
|
|
345926
345985
|
}
|
|
@@ -345936,7 +345995,19 @@ var A2AClientManager = class {
|
|
|
345936
345995
|
return response;
|
|
345937
345996
|
};
|
|
345938
345997
|
const resolver = new DefaultAgentCardResolver({ fetchImpl: cardFetch });
|
|
345939
|
-
|
|
345998
|
+
let rawCard;
|
|
345999
|
+
let urlIdentifier = "inline JSON";
|
|
346000
|
+
if (options.type === "json") {
|
|
346001
|
+
try {
|
|
346002
|
+
rawCard = JSON.parse(options.json);
|
|
346003
|
+
} catch (error40) {
|
|
346004
|
+
const msg = error40 instanceof Error ? error40.message : String(error40);
|
|
346005
|
+
throw new Error(`Failed to parse inline agent card JSON for agent '${name3}': ${msg}`);
|
|
346006
|
+
}
|
|
346007
|
+
} else {
|
|
346008
|
+
urlIdentifier = options.url;
|
|
346009
|
+
rawCard = await resolver.resolve(options.url, "");
|
|
346010
|
+
}
|
|
345940
346011
|
const agentCard = normalizeAgentCard(rawCard);
|
|
345941
346012
|
const grpcUrl = agentCard.additionalInterfaces?.find((i3) => i3.transport === "GRPC")?.url ?? agentCard.url;
|
|
345942
346013
|
const clientOptions = ClientFactoryOptions.createFrom(ClientFactoryOptions.default, {
|
|
@@ -345954,10 +346025,10 @@ var A2AClientManager = class {
|
|
|
345954
346025
|
const client = await factory.createFromAgentCard(agentCard);
|
|
345955
346026
|
this.clients.set(name3, client);
|
|
345956
346027
|
this.agentCards.set(name3, agentCard);
|
|
345957
|
-
debugLogger.debug(`[A2AClientManager] Loaded agent '${name3}' from ${
|
|
346028
|
+
debugLogger.debug(`[A2AClientManager] Loaded agent '${name3}' from ${urlIdentifier}`);
|
|
345958
346029
|
return agentCard;
|
|
345959
346030
|
} catch (error40) {
|
|
345960
|
-
throw classifyAgentError(name3,
|
|
346031
|
+
throw classifyAgentError(name3, urlIdentifier, error40);
|
|
345961
346032
|
}
|
|
345962
346033
|
}
|
|
345963
346034
|
/**
|
|
@@ -348245,7 +348316,7 @@ var StreamJsonFormatter = class {
|
|
|
348245
348316
|
};
|
|
348246
348317
|
|
|
348247
348318
|
// packages/core/dist/src/policy/integrity.js
|
|
348248
|
-
import * as
|
|
348319
|
+
import * as crypto21 from "node:crypto";
|
|
348249
348320
|
import * as fs58 from "node:fs/promises";
|
|
348250
348321
|
import * as path73 from "node:path";
|
|
348251
348322
|
var IntegrityStatus;
|
|
@@ -348300,7 +348371,7 @@ var PolicyIntegrityManager = class _PolicyIntegrityManager {
|
|
|
348300
348371
|
try {
|
|
348301
348372
|
const files = await readPolicyFiles(policyDir);
|
|
348302
348373
|
files.sort((a2, b) => a2.path.localeCompare(b.path));
|
|
348303
|
-
const hash =
|
|
348374
|
+
const hash = crypto21.createHash("sha256");
|
|
348304
348375
|
for (const file2 of files) {
|
|
348305
348376
|
const relativePath = path73.relative(policyDir, file2.path);
|
|
348306
348377
|
hash.update(relativePath);
|
|
@@ -348350,7 +348421,7 @@ var PolicyIntegrityManager = class _PolicyIntegrityManager {
|
|
|
348350
348421
|
// packages/core/dist/src/config/extensions/integrity.js
|
|
348351
348422
|
import * as fs59 from "node:fs";
|
|
348352
348423
|
import * as path74 from "node:path";
|
|
348353
|
-
import { createHash as
|
|
348424
|
+
import { createHash as createHash11, createHmac, randomBytes as randomBytes6, timingSafeEqual } from "node:crypto";
|
|
348354
348425
|
var import_json_stable_stringify = __toESM(require_json_stable_stringify(), 1);
|
|
348355
348426
|
|
|
348356
348427
|
// packages/core/dist/src/config/extensions/integrityTypes.js
|
|
@@ -348481,7 +348552,7 @@ var ExtensionIntegrityStore = class {
|
|
|
348481
348552
|
*/
|
|
348482
348553
|
generateHash(metadata2) {
|
|
348483
348554
|
const content = (0, import_json_stable_stringify.default)(metadata2) ?? "";
|
|
348484
|
-
return
|
|
348555
|
+
return createHash11("sha256").update(content).digest("hex");
|
|
348485
348556
|
}
|
|
348486
348557
|
/**
|
|
348487
348558
|
* Generates an HMAC-SHA256 signature using the master secret key.
|
|
@@ -349385,11 +349456,11 @@ var import_fdir = __toESM(require_dist9(), 1);
|
|
|
349385
349456
|
import path77 from "node:path";
|
|
349386
349457
|
|
|
349387
349458
|
// packages/core/dist/src/utils/filesearch/crawlCache.js
|
|
349388
|
-
import
|
|
349459
|
+
import crypto22 from "node:crypto";
|
|
349389
349460
|
var crawlCache = /* @__PURE__ */ new Map();
|
|
349390
349461
|
var cacheTimers = /* @__PURE__ */ new Map();
|
|
349391
349462
|
var getCacheKey = (directory, ignoreContent, maxDepth) => {
|
|
349392
|
-
const hash =
|
|
349463
|
+
const hash = crypto22.createHash("sha256");
|
|
349393
349464
|
hash.update(directory);
|
|
349394
349465
|
hash.update(ignoreContent);
|
|
349395
349466
|
if (maxDepth !== void 0) {
|
|
@@ -353489,6 +353560,8 @@ export {
|
|
|
353489
353560
|
SUBAGENT_CANCELLED_ERROR_MESSAGE,
|
|
353490
353561
|
isSubagentProgress,
|
|
353491
353562
|
isToolActivityError,
|
|
353563
|
+
getAgentCardLoadOptions,
|
|
353564
|
+
getRemoteAgentTargetUrl,
|
|
353492
353565
|
FRONTMATTER_REGEX,
|
|
353493
353566
|
loadSkillsFromDir,
|
|
353494
353567
|
loadSkillFromFile,
|