@google/gemini-cli-a2a-server 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.
@@ -33152,14 +33152,14 @@ var require_etag = __commonJS({
33152
33152
  "node_modules/etag/index.js"(exports2, module2) {
33153
33153
  "use strict";
33154
33154
  module2.exports = etag;
33155
- var crypto24 = __require("crypto");
33155
+ var crypto25 = __require("crypto");
33156
33156
  var Stats = __require("fs").Stats;
33157
33157
  var toString3 = Object.prototype.toString;
33158
33158
  function entitytag(entity) {
33159
33159
  if (entity.length === 0) {
33160
33160
  return '"0-2jmj7l5rSw0yVb/vlWAYkK/YBwk"';
33161
33161
  }
33162
- var hash = crypto24.createHash("sha1").update(entity, "utf8").digest("base64").substring(0, 27);
33162
+ var hash = crypto25.createHash("sha1").update(entity, "utf8").digest("base64").substring(0, 27);
33163
33163
  var len = typeof entity === "string" ? Buffer.byteLength(entity, "utf8") : entity.length;
33164
33164
  return '"' + len.toString(16) + "-" + hash + '"';
33165
33165
  }
@@ -36582,17 +36582,17 @@ var require_content_disposition = __commonJS({
36582
36582
  // node_modules/cookie-signature/index.js
36583
36583
  var require_cookie_signature = __commonJS({
36584
36584
  "node_modules/cookie-signature/index.js"(exports2) {
36585
- var crypto24 = __require("crypto");
36585
+ var crypto25 = __require("crypto");
36586
36586
  exports2.sign = function(val, secret) {
36587
36587
  if ("string" != typeof val) throw new TypeError("Cookie value must be provided as a string.");
36588
36588
  if (null == secret) throw new TypeError("Secret key must be provided.");
36589
- return val + "." + crypto24.createHmac("sha256", secret).update(val).digest("base64").replace(/\=+$/, "");
36589
+ return val + "." + crypto25.createHmac("sha256", secret).update(val).digest("base64").replace(/\=+$/, "");
36590
36590
  };
36591
36591
  exports2.unsign = function(input, secret) {
36592
36592
  if ("string" != typeof input) throw new TypeError("Signed cookie string must be provided.");
36593
36593
  if (null == secret) throw new TypeError("Secret key must be provided.");
36594
36594
  var tentativeValue = input.slice(0, input.lastIndexOf(".")), expectedInput = exports2.sign(tentativeValue, secret), expectedBuffer = Buffer.from(expectedInput), inputBuffer = Buffer.from(input);
36595
- return expectedBuffer.length === inputBuffer.length && crypto24.timingSafeEqual(expectedBuffer, inputBuffer) ? tentativeValue : false;
36595
+ return expectedBuffer.length === inputBuffer.length && crypto25.timingSafeEqual(expectedBuffer, inputBuffer) ? tentativeValue : false;
36596
36596
  };
36597
36597
  }
36598
36598
  });
@@ -45558,22 +45558,22 @@ var require_crypto2 = __commonJS({
45558
45558
  "use strict";
45559
45559
  Object.defineProperty(exports2, "__esModule", { value: true });
45560
45560
  exports2.NodeCrypto = void 0;
45561
- var crypto24 = __require("crypto");
45561
+ var crypto25 = __require("crypto");
45562
45562
  var NodeCrypto = class {
45563
45563
  async sha256DigestBase64(str2) {
45564
- return crypto24.createHash("sha256").update(str2).digest("base64");
45564
+ return crypto25.createHash("sha256").update(str2).digest("base64");
45565
45565
  }
45566
45566
  randomBytesBase64(count2) {
45567
- return crypto24.randomBytes(count2).toString("base64");
45567
+ return crypto25.randomBytes(count2).toString("base64");
45568
45568
  }
45569
45569
  async verify(pubkey, data, signature) {
45570
- const verifier = crypto24.createVerify("RSA-SHA256");
45570
+ const verifier = crypto25.createVerify("RSA-SHA256");
45571
45571
  verifier.update(data);
45572
45572
  verifier.end();
45573
45573
  return verifier.verify(pubkey, signature, "base64");
45574
45574
  }
45575
45575
  async sign(privateKey, data) {
45576
- const signer = crypto24.createSign("RSA-SHA256");
45576
+ const signer = crypto25.createSign("RSA-SHA256");
45577
45577
  signer.update(data);
45578
45578
  signer.end();
45579
45579
  return signer.sign(privateKey, "base64");
@@ -45591,7 +45591,7 @@ var require_crypto2 = __commonJS({
45591
45591
  * string in hexadecimal encoding.
45592
45592
  */
45593
45593
  async sha256DigestHex(str2) {
45594
- return crypto24.createHash("sha256").update(str2).digest("hex");
45594
+ return crypto25.createHash("sha256").update(str2).digest("hex");
45595
45595
  }
45596
45596
  /**
45597
45597
  * Computes the HMAC hash of a message using the provided crypto key and the
@@ -45603,7 +45603,7 @@ var require_crypto2 = __commonJS({
45603
45603
  */
45604
45604
  async signWithHmacSha256(key, msg) {
45605
45605
  const cryptoKey = typeof key === "string" ? key : toBuffer(key);
45606
- return toArrayBuffer(crypto24.createHmac("sha256", cryptoKey).update(msg).digest());
45606
+ return toArrayBuffer(crypto25.createHmac("sha256", cryptoKey).update(msg).digest());
45607
45607
  }
45608
45608
  };
45609
45609
  exports2.NodeCrypto = NodeCrypto;
@@ -46323,10 +46323,10 @@ var require_oauth2client = __commonJS({
46323
46323
  * https://github.com/googleapis/google-auth-library-nodejs/blob/main/samples/oauth2-codeVerifier.js
46324
46324
  */
46325
46325
  async generateCodeVerifierAsync() {
46326
- const crypto24 = (0, crypto_1.createCrypto)();
46327
- const randomString2 = crypto24.randomBytesBase64(96);
46326
+ const crypto25 = (0, crypto_1.createCrypto)();
46327
+ const randomString2 = crypto25.randomBytesBase64(96);
46328
46328
  const codeVerifier = randomString2.replace(/\+/g, "~").replace(/=/g, "_").replace(/\//g, "-");
46329
- const unencodedCodeChallenge = await crypto24.sha256DigestBase64(codeVerifier);
46329
+ const unencodedCodeChallenge = await crypto25.sha256DigestBase64(codeVerifier);
46330
46330
  const codeChallenge = unencodedCodeChallenge.split("=")[0].replace(/\+/g, "-").replace(/\//g, "_");
46331
46331
  return { codeVerifier, codeChallenge };
46332
46332
  }
@@ -46770,7 +46770,7 @@ var require_oauth2client = __commonJS({
46770
46770
  * @return Returns a promise resolving to LoginTicket on verification.
46771
46771
  */
46772
46772
  async verifySignedJwtWithCertsAsync(jwt, certs, requiredAudience, issuers, maxExpiry) {
46773
- const crypto24 = (0, crypto_1.createCrypto)();
46773
+ const crypto25 = (0, crypto_1.createCrypto)();
46774
46774
  if (!maxExpiry) {
46775
46775
  maxExpiry = _OAuth2Client.DEFAULT_MAX_TOKEN_LIFETIME_SECS_;
46776
46776
  }
@@ -46783,7 +46783,7 @@ var require_oauth2client = __commonJS({
46783
46783
  let envelope;
46784
46784
  let payload;
46785
46785
  try {
46786
- envelope = JSON.parse(crypto24.decodeBase64StringUtf8(segments[0]));
46786
+ envelope = JSON.parse(crypto25.decodeBase64StringUtf8(segments[0]));
46787
46787
  } catch (err2) {
46788
46788
  if (err2 instanceof Error) {
46789
46789
  err2.message = `Can't parse token envelope: ${segments[0]}': ${err2.message}`;
@@ -46794,7 +46794,7 @@ var require_oauth2client = __commonJS({
46794
46794
  throw new Error("Can't parse token envelope: " + segments[0]);
46795
46795
  }
46796
46796
  try {
46797
- payload = JSON.parse(crypto24.decodeBase64StringUtf8(segments[1]));
46797
+ payload = JSON.parse(crypto25.decodeBase64StringUtf8(segments[1]));
46798
46798
  } catch (err2) {
46799
46799
  if (err2 instanceof Error) {
46800
46800
  err2.message = `Can't parse token payload '${segments[0]}`;
@@ -46811,7 +46811,7 @@ var require_oauth2client = __commonJS({
46811
46811
  if (envelope.alg === "ES256") {
46812
46812
  signature = formatEcdsa.joseToDer(signature, "ES256").toString("base64");
46813
46813
  }
46814
- const verified = await crypto24.verify(cert, signed, signature);
46814
+ const verified = await crypto25.verify(cert, signed, signature);
46815
46815
  if (!verified) {
46816
46816
  throw new Error("Invalid token signature: " + jwt);
46817
46817
  }
@@ -47179,14 +47179,14 @@ var require_buffer_equal_constant_time = __commonJS({
47179
47179
  var require_jwa = __commonJS({
47180
47180
  "node_modules/jwa/index.js"(exports2, module2) {
47181
47181
  var Buffer10 = require_safe_buffer().Buffer;
47182
- var crypto24 = __require("crypto");
47182
+ var crypto25 = __require("crypto");
47183
47183
  var formatEcdsa = require_ecdsa_sig_formatter();
47184
47184
  var util5 = __require("util");
47185
47185
  var MSG_INVALID_ALGORITHM = '"%s" is not a valid algorithm.\n Supported algorithms are:\n "HS256", "HS384", "HS512", "RS256", "RS384", "RS512", "PS256", "PS384", "PS512", "ES256", "ES384", "ES512" and "none".';
47186
47186
  var MSG_INVALID_SECRET = "secret must be a string or buffer";
47187
47187
  var MSG_INVALID_VERIFIER_KEY = "key must be a string or a buffer";
47188
47188
  var MSG_INVALID_SIGNER_KEY = "key must be a string, a buffer or an object";
47189
- var supportsKeyObjects = typeof crypto24.createPublicKey === "function";
47189
+ var supportsKeyObjects = typeof crypto25.createPublicKey === "function";
47190
47190
  if (supportsKeyObjects) {
47191
47191
  MSG_INVALID_VERIFIER_KEY += " or a KeyObject";
47192
47192
  MSG_INVALID_SECRET += "or a KeyObject";
@@ -47276,17 +47276,17 @@ var require_jwa = __commonJS({
47276
47276
  return function sign(thing, secret) {
47277
47277
  checkIsSecretKey(secret);
47278
47278
  thing = normalizeInput(thing);
47279
- var hmac = crypto24.createHmac("sha" + bits, secret);
47279
+ var hmac = crypto25.createHmac("sha" + bits, secret);
47280
47280
  var sig = (hmac.update(thing), hmac.digest("base64"));
47281
47281
  return fromBase64(sig);
47282
47282
  };
47283
47283
  }
47284
47284
  var bufferEqual;
47285
- var timingSafeEqual = "timingSafeEqual" in crypto24 ? function timingSafeEqual2(a2, b2) {
47285
+ var timingSafeEqual = "timingSafeEqual" in crypto25 ? function timingSafeEqual2(a2, b2) {
47286
47286
  if (a2.byteLength !== b2.byteLength) {
47287
47287
  return false;
47288
47288
  }
47289
- return crypto24.timingSafeEqual(a2, b2);
47289
+ return crypto25.timingSafeEqual(a2, b2);
47290
47290
  } : function timingSafeEqual2(a2, b2) {
47291
47291
  if (!bufferEqual) {
47292
47292
  bufferEqual = require_buffer_equal_constant_time();
@@ -47303,7 +47303,7 @@ var require_jwa = __commonJS({
47303
47303
  return function sign(thing, privateKey) {
47304
47304
  checkIsPrivateKey(privateKey);
47305
47305
  thing = normalizeInput(thing);
47306
- var signer = crypto24.createSign("RSA-SHA" + bits);
47306
+ var signer = crypto25.createSign("RSA-SHA" + bits);
47307
47307
  var sig = (signer.update(thing), signer.sign(privateKey, "base64"));
47308
47308
  return fromBase64(sig);
47309
47309
  };
@@ -47313,7 +47313,7 @@ var require_jwa = __commonJS({
47313
47313
  checkIsPublicKey(publicKey);
47314
47314
  thing = normalizeInput(thing);
47315
47315
  signature = toBase64(signature);
47316
- var verifier = crypto24.createVerify("RSA-SHA" + bits);
47316
+ var verifier = crypto25.createVerify("RSA-SHA" + bits);
47317
47317
  verifier.update(thing);
47318
47318
  return verifier.verify(publicKey, signature, "base64");
47319
47319
  };
@@ -47322,11 +47322,11 @@ var require_jwa = __commonJS({
47322
47322
  return function sign(thing, privateKey) {
47323
47323
  checkIsPrivateKey(privateKey);
47324
47324
  thing = normalizeInput(thing);
47325
- var signer = crypto24.createSign("RSA-SHA" + bits);
47325
+ var signer = crypto25.createSign("RSA-SHA" + bits);
47326
47326
  var sig = (signer.update(thing), signer.sign({
47327
47327
  key: privateKey,
47328
- padding: crypto24.constants.RSA_PKCS1_PSS_PADDING,
47329
- saltLength: crypto24.constants.RSA_PSS_SALTLEN_DIGEST
47328
+ padding: crypto25.constants.RSA_PKCS1_PSS_PADDING,
47329
+ saltLength: crypto25.constants.RSA_PSS_SALTLEN_DIGEST
47330
47330
  }, "base64"));
47331
47331
  return fromBase64(sig);
47332
47332
  };
@@ -47336,12 +47336,12 @@ var require_jwa = __commonJS({
47336
47336
  checkIsPublicKey(publicKey);
47337
47337
  thing = normalizeInput(thing);
47338
47338
  signature = toBase64(signature);
47339
- var verifier = crypto24.createVerify("RSA-SHA" + bits);
47339
+ var verifier = crypto25.createVerify("RSA-SHA" + bits);
47340
47340
  verifier.update(thing);
47341
47341
  return verifier.verify({
47342
47342
  key: publicKey,
47343
- padding: crypto24.constants.RSA_PKCS1_PSS_PADDING,
47344
- saltLength: crypto24.constants.RSA_PSS_SALTLEN_DIGEST
47343
+ padding: crypto25.constants.RSA_PKCS1_PSS_PADDING,
47344
+ saltLength: crypto25.constants.RSA_PSS_SALTLEN_DIGEST
47345
47345
  }, signature, "base64");
47346
47346
  };
47347
47347
  }
@@ -49499,14 +49499,14 @@ var require_awsrequestsigner = __commonJS({
49499
49499
  }
49500
49500
  };
49501
49501
  exports2.AwsRequestSigner = AwsRequestSigner;
49502
- async function sign(crypto24, key, msg) {
49503
- return await crypto24.signWithHmacSha256(key, msg);
49504
- }
49505
- async function getSigningKey(crypto24, key, dateStamp, region, serviceName) {
49506
- const kDate = await sign(crypto24, `AWS4${key}`, dateStamp);
49507
- const kRegion = await sign(crypto24, kDate, region);
49508
- const kService = await sign(crypto24, kRegion, serviceName);
49509
- const kSigning = await sign(crypto24, kService, "aws4_request");
49502
+ async function sign(crypto25, key, msg) {
49503
+ return await crypto25.signWithHmacSha256(key, msg);
49504
+ }
49505
+ async function getSigningKey(crypto25, key, dateStamp, region, serviceName) {
49506
+ const kDate = await sign(crypto25, `AWS4${key}`, dateStamp);
49507
+ const kRegion = await sign(crypto25, kDate, region);
49508
+ const kService = await sign(crypto25, kRegion, serviceName);
49509
+ const kSigning = await sign(crypto25, kService, "aws4_request");
49510
49510
  return kSigning;
49511
49511
  }
49512
49512
  async function generateAuthenticationHeaderMap(options) {
@@ -51091,24 +51091,24 @@ var require_googleauth = __commonJS({
51091
51091
  const signed = await client.sign(data);
51092
51092
  return signed.signedBlob;
51093
51093
  }
51094
- const crypto24 = (0, crypto_1.createCrypto)();
51094
+ const crypto25 = (0, crypto_1.createCrypto)();
51095
51095
  if (client instanceof jwtclient_1.JWT && client.key) {
51096
- const sign = await crypto24.sign(client.key, data);
51096
+ const sign = await crypto25.sign(client.key, data);
51097
51097
  return sign;
51098
51098
  }
51099
51099
  const creds = await this.getCredentials();
51100
51100
  if (!creds.client_email) {
51101
51101
  throw new Error("Cannot sign data without `client_email`.");
51102
51102
  }
51103
- return this.signBlob(crypto24, creds.client_email, data, endpoint);
51103
+ return this.signBlob(crypto25, creds.client_email, data, endpoint);
51104
51104
  }
51105
- async signBlob(crypto24, emailOrUniqueId, data, endpoint) {
51105
+ async signBlob(crypto25, emailOrUniqueId, data, endpoint) {
51106
51106
  const url5 = new URL(endpoint + `${emailOrUniqueId}:signBlob`);
51107
51107
  const res = await this.request({
51108
51108
  method: "POST",
51109
51109
  url: url5.href,
51110
51110
  data: {
51111
- payload: crypto24.encodeBase64StringUtf8(data)
51111
+ payload: crypto25.encodeBase64StringUtf8(data)
51112
51112
  },
51113
51113
  retry: true,
51114
51114
  retryConfig: {
@@ -90139,22 +90139,22 @@ var require_crypto5 = __commonJS({
90139
90139
  "use strict";
90140
90140
  Object.defineProperty(exports2, "__esModule", { value: true });
90141
90141
  exports2.NodeCrypto = void 0;
90142
- var crypto24 = __require("crypto");
90142
+ var crypto25 = __require("crypto");
90143
90143
  var NodeCrypto = class {
90144
90144
  async sha256DigestBase64(str2) {
90145
- return crypto24.createHash("sha256").update(str2).digest("base64");
90145
+ return crypto25.createHash("sha256").update(str2).digest("base64");
90146
90146
  }
90147
90147
  randomBytesBase64(count2) {
90148
- return crypto24.randomBytes(count2).toString("base64");
90148
+ return crypto25.randomBytes(count2).toString("base64");
90149
90149
  }
90150
90150
  async verify(pubkey, data, signature) {
90151
- const verifier = crypto24.createVerify("RSA-SHA256");
90151
+ const verifier = crypto25.createVerify("RSA-SHA256");
90152
90152
  verifier.update(data);
90153
90153
  verifier.end();
90154
90154
  return verifier.verify(pubkey, signature, "base64");
90155
90155
  }
90156
90156
  async sign(privateKey, data) {
90157
- const signer = crypto24.createSign("RSA-SHA256");
90157
+ const signer = crypto25.createSign("RSA-SHA256");
90158
90158
  signer.update(data);
90159
90159
  signer.end();
90160
90160
  return signer.sign(privateKey, "base64");
@@ -90172,7 +90172,7 @@ var require_crypto5 = __commonJS({
90172
90172
  * string in hexadecimal encoding.
90173
90173
  */
90174
90174
  async sha256DigestHex(str2) {
90175
- return crypto24.createHash("sha256").update(str2).digest("hex");
90175
+ return crypto25.createHash("sha256").update(str2).digest("hex");
90176
90176
  }
90177
90177
  /**
90178
90178
  * Computes the HMAC hash of a message using the provided crypto key and the
@@ -90184,7 +90184,7 @@ var require_crypto5 = __commonJS({
90184
90184
  */
90185
90185
  async signWithHmacSha256(key, msg) {
90186
90186
  const cryptoKey = typeof key === "string" ? key : toBuffer(key);
90187
- return toArrayBuffer(crypto24.createHmac("sha256", cryptoKey).update(msg).digest());
90187
+ return toArrayBuffer(crypto25.createHmac("sha256", cryptoKey).update(msg).digest());
90188
90188
  }
90189
90189
  };
90190
90190
  exports2.NodeCrypto = NodeCrypto;
@@ -90868,10 +90868,10 @@ var require_oauth2client2 = __commonJS({
90868
90868
  * https://github.com/googleapis/google-auth-library-nodejs/blob/main/samples/oauth2-codeVerifier.js
90869
90869
  */
90870
90870
  async generateCodeVerifierAsync() {
90871
- const crypto24 = (0, crypto_1.createCrypto)();
90872
- const randomString2 = crypto24.randomBytesBase64(96);
90871
+ const crypto25 = (0, crypto_1.createCrypto)();
90872
+ const randomString2 = crypto25.randomBytesBase64(96);
90873
90873
  const codeVerifier = randomString2.replace(/\+/g, "~").replace(/=/g, "_").replace(/\//g, "-");
90874
- const unencodedCodeChallenge = await crypto24.sha256DigestBase64(codeVerifier);
90874
+ const unencodedCodeChallenge = await crypto25.sha256DigestBase64(codeVerifier);
90875
90875
  const codeChallenge = unencodedCodeChallenge.split("=")[0].replace(/\+/g, "-").replace(/\//g, "_");
90876
90876
  return { codeVerifier, codeChallenge };
90877
90877
  }
@@ -91312,7 +91312,7 @@ var require_oauth2client2 = __commonJS({
91312
91312
  * @return Returns a promise resolving to LoginTicket on verification.
91313
91313
  */
91314
91314
  async verifySignedJwtWithCertsAsync(jwt, certs, requiredAudience, issuers, maxExpiry) {
91315
- const crypto24 = (0, crypto_1.createCrypto)();
91315
+ const crypto25 = (0, crypto_1.createCrypto)();
91316
91316
  if (!maxExpiry) {
91317
91317
  maxExpiry = _OAuth2Client.DEFAULT_MAX_TOKEN_LIFETIME_SECS_;
91318
91318
  }
@@ -91325,7 +91325,7 @@ var require_oauth2client2 = __commonJS({
91325
91325
  let envelope;
91326
91326
  let payload;
91327
91327
  try {
91328
- envelope = JSON.parse(crypto24.decodeBase64StringUtf8(segments[0]));
91328
+ envelope = JSON.parse(crypto25.decodeBase64StringUtf8(segments[0]));
91329
91329
  } catch (err2) {
91330
91330
  if (err2 instanceof Error) {
91331
91331
  err2.message = `Can't parse token envelope: ${segments[0]}': ${err2.message}`;
@@ -91336,7 +91336,7 @@ var require_oauth2client2 = __commonJS({
91336
91336
  throw new Error("Can't parse token envelope: " + segments[0]);
91337
91337
  }
91338
91338
  try {
91339
- payload = JSON.parse(crypto24.decodeBase64StringUtf8(segments[1]));
91339
+ payload = JSON.parse(crypto25.decodeBase64StringUtf8(segments[1]));
91340
91340
  } catch (err2) {
91341
91341
  if (err2 instanceof Error) {
91342
91342
  err2.message = `Can't parse token payload '${segments[0]}`;
@@ -91353,7 +91353,7 @@ var require_oauth2client2 = __commonJS({
91353
91353
  if (envelope.alg === "ES256") {
91354
91354
  signature = formatEcdsa.joseToDer(signature, "ES256").toString("base64");
91355
91355
  }
91356
- const verified = await crypto24.verify(cert, signed, signature);
91356
+ const verified = await crypto25.verify(cert, signed, signature);
91357
91357
  if (!verified) {
91358
91358
  throw new Error("Invalid token signature: " + jwt);
91359
91359
  }
@@ -94145,14 +94145,14 @@ var require_awsrequestsigner2 = __commonJS({
94145
94145
  }
94146
94146
  };
94147
94147
  exports2.AwsRequestSigner = AwsRequestSigner;
94148
- async function sign(crypto24, key, msg) {
94149
- return await crypto24.signWithHmacSha256(key, msg);
94150
- }
94151
- async function getSigningKey(crypto24, key, dateStamp, region, serviceName) {
94152
- const kDate = await sign(crypto24, `AWS4${key}`, dateStamp);
94153
- const kRegion = await sign(crypto24, kDate, region);
94154
- const kService = await sign(crypto24, kRegion, serviceName);
94155
- const kSigning = await sign(crypto24, kService, "aws4_request");
94148
+ async function sign(crypto25, key, msg) {
94149
+ return await crypto25.signWithHmacSha256(key, msg);
94150
+ }
94151
+ async function getSigningKey(crypto25, key, dateStamp, region, serviceName) {
94152
+ const kDate = await sign(crypto25, `AWS4${key}`, dateStamp);
94153
+ const kRegion = await sign(crypto25, kDate, region);
94154
+ const kService = await sign(crypto25, kRegion, serviceName);
94155
+ const kSigning = await sign(crypto25, kService, "aws4_request");
94156
94156
  return kSigning;
94157
94157
  }
94158
94158
  async function generateAuthenticationHeaderMap(options) {
@@ -95866,24 +95866,24 @@ var require_googleauth2 = __commonJS({
95866
95866
  const signed = await client.sign(data);
95867
95867
  return signed.signedBlob;
95868
95868
  }
95869
- const crypto24 = (0, crypto_1.createCrypto)();
95869
+ const crypto25 = (0, crypto_1.createCrypto)();
95870
95870
  if (client instanceof jwtclient_1.JWT && client.key) {
95871
- const sign = await crypto24.sign(client.key, data);
95871
+ const sign = await crypto25.sign(client.key, data);
95872
95872
  return sign;
95873
95873
  }
95874
95874
  const creds = await this.getCredentials();
95875
95875
  if (!creds.client_email) {
95876
95876
  throw new Error("Cannot sign data without `client_email`.");
95877
95877
  }
95878
- return this.signBlob(crypto24, creds.client_email, data, endpoint);
95878
+ return this.signBlob(crypto25, creds.client_email, data, endpoint);
95879
95879
  }
95880
- async signBlob(crypto24, emailOrUniqueId, data, endpoint) {
95880
+ async signBlob(crypto25, emailOrUniqueId, data, endpoint) {
95881
95881
  const url5 = new URL(endpoint + `${emailOrUniqueId}:signBlob`);
95882
95882
  const res = await this.request({
95883
95883
  method: "POST",
95884
95884
  url: url5.href,
95885
95885
  data: {
95886
- payload: crypto24.encodeBase64StringUtf8(data)
95886
+ payload: crypto25.encodeBase64StringUtf8(data)
95887
95887
  },
95888
95888
  retry: true,
95889
95889
  retryConfig: {
@@ -98477,7 +98477,7 @@ var require_websocket = __commonJS({
98477
98477
  var http7 = __require("http");
98478
98478
  var net3 = __require("net");
98479
98479
  var tls = __require("tls");
98480
- var { randomBytes: randomBytes5, createHash: createHash15 } = __require("crypto");
98480
+ var { randomBytes: randomBytes5, createHash: createHash16 } = __require("crypto");
98481
98481
  var { Duplex: Duplex5, Readable: Readable10 } = __require("stream");
98482
98482
  var { URL: URL10 } = __require("url");
98483
98483
  var PerMessageDeflate = require_permessage_deflate();
@@ -99134,7 +99134,7 @@ var require_websocket = __commonJS({
99134
99134
  abortHandshake(websocket, socket, "Invalid Upgrade header");
99135
99135
  return;
99136
99136
  }
99137
- const digest = createHash15("sha1").update(key + GUID).digest("base64");
99137
+ const digest = createHash16("sha1").update(key + GUID).digest("base64");
99138
99138
  if (res.headers["sec-websocket-accept"] !== digest) {
99139
99139
  abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
99140
99140
  return;
@@ -99501,7 +99501,7 @@ var require_websocket_server = __commonJS({
99501
99501
  var EventEmitter12 = __require("events");
99502
99502
  var http7 = __require("http");
99503
99503
  var { Duplex: Duplex5 } = __require("stream");
99504
- var { createHash: createHash15 } = __require("crypto");
99504
+ var { createHash: createHash16 } = __require("crypto");
99505
99505
  var extension = require_extension();
99506
99506
  var PerMessageDeflate = require_permessage_deflate();
99507
99507
  var subprotocol = require_subprotocol();
@@ -99798,7 +99798,7 @@ var require_websocket_server = __commonJS({
99798
99798
  );
99799
99799
  }
99800
99800
  if (this._state > RUNNING) return abortHandshake(socket, 503);
99801
- const digest = createHash15("sha1").update(key + GUID).digest("base64");
99801
+ const digest = createHash16("sha1").update(key + GUID).digest("base64");
99802
99802
  const headers = [
99803
99803
  "HTTP/1.1 101 Switching Protocols",
99804
99804
  "Upgrade: websocket",
@@ -209115,8 +209115,8 @@ var GIT_COMMIT_INFO, CLI_VERSION;
209115
209115
  var init_git_commit = __esm({
209116
209116
  "packages/core/dist/src/generated/git-commit.js"() {
209117
209117
  "use strict";
209118
- GIT_COMMIT_INFO = "146442f2a";
209119
- CLI_VERSION = "0.36.0-preview.3";
209118
+ GIT_COMMIT_INFO = "38c706dbb";
209119
+ CLI_VERSION = "0.36.0-preview.4";
209120
209120
  }
209121
209121
  });
209122
209122
 
@@ -220524,7 +220524,7 @@ var require_src53 = __commonJS({
220524
220524
  var require_object_hash = __commonJS({
220525
220525
  "node_modules/object-hash/index.js"(exports2, module2) {
220526
220526
  "use strict";
220527
- var crypto24 = __require("crypto");
220527
+ var crypto25 = __require("crypto");
220528
220528
  exports2 = module2.exports = objectHash;
220529
220529
  function objectHash(object3, options) {
220530
220530
  options = applyDefaults(object3, options);
@@ -220542,7 +220542,7 @@ var require_object_hash = __commonJS({
220542
220542
  exports2.keysMD5 = function(object3) {
220543
220543
  return objectHash(object3, { algorithm: "md5", encoding: "hex", excludeValues: true });
220544
220544
  };
220545
- var hashes = crypto24.getHashes ? crypto24.getHashes().slice() : ["sha1", "md5"];
220545
+ var hashes = crypto25.getHashes ? crypto25.getHashes().slice() : ["sha1", "md5"];
220546
220546
  hashes.push("passthrough");
220547
220547
  var encodings = ["buffer", "hex", "binary", "base64"];
220548
220548
  function applyDefaults(object3, sourceOptions) {
@@ -220588,7 +220588,7 @@ var require_object_hash = __commonJS({
220588
220588
  function hash(object3, options) {
220589
220589
  var hashingStream;
220590
220590
  if (options.algorithm !== "passthrough") {
220591
- hashingStream = crypto24.createHash(options.algorithm);
220591
+ hashingStream = crypto25.createHash(options.algorithm);
220592
220592
  } else {
220593
220593
  hashingStream = new PassThrough6();
220594
220594
  }
@@ -236247,13 +236247,13 @@ var require_context = __commonJS({
236247
236247
  exports2.parseXCloudTraceHeader = parseXCloudTraceHeader;
236248
236248
  exports2.parseTraceParentHeader = parseTraceParentHeader;
236249
236249
  var uuid2 = (init_esm_node(), __toCommonJS(esm_node_exports));
236250
- var crypto24 = __require("crypto");
236250
+ var crypto25 = __require("crypto");
236251
236251
  var api_1 = (init_esm2(), __toCommonJS(esm_exports2));
236252
236252
  exports2.X_CLOUD_TRACE_HEADER = "x-cloud-trace-context";
236253
236253
  var SPAN_ID_RANDOM_BYTES = 8;
236254
236254
  var spanIdBuffer = Buffer.alloc(SPAN_ID_RANDOM_BYTES);
236255
- var randomFillSync4 = crypto24.randomFillSync;
236256
- var randomBytes5 = crypto24.randomBytes;
236255
+ var randomFillSync4 = crypto25.randomFillSync;
236256
+ var randomBytes5 = crypto25.randomBytes;
236257
236257
  var spanRandomBuffer = randomFillSync4 ? () => randomFillSync4(spanIdBuffer) : () => randomBytes5(SPAN_ID_RANDOM_BYTES);
236258
236258
  exports2.W3C_TRACE_PARENT_HEADER = "traceparent";
236259
236259
  function makeHeaderWrapper(req) {
@@ -311956,8 +311956,8 @@ var require_snapshot_utils = __commonJS({
311956
311956
  match: new Set(matchHeaders.map((header) => caseSensitive ? header : header.toLowerCase()))
311957
311957
  };
311958
311958
  }
311959
- var crypto24 = runtimeFeatures.has("crypto") ? __require("node:crypto") : null;
311960
- var hashId = crypto24?.hash ? (value) => crypto24.hash("sha256", value, "base64url") : (value) => Buffer.from(value).toString("base64url");
311959
+ var crypto25 = runtimeFeatures.has("crypto") ? __require("node:crypto") : null;
311960
+ var hashId = crypto25?.hash ? (value) => crypto25.hash("sha256", value, "base64url") : (value) => Buffer.from(value).toString("base64url");
311961
311961
  function isUndiciHeaders(headers) {
311962
311962
  return Array.isArray(headers) && (headers.length & 1) === 0;
311963
311963
  }
@@ -318012,10 +318012,10 @@ var require_subresource_integrity = __commonJS({
318012
318012
  var assert4 = __require("node:assert");
318013
318013
  var { runtimeFeatures } = require_runtime_features();
318014
318014
  var validSRIHashAlgorithmTokenSet = /* @__PURE__ */ new Map([["sha256", 0], ["sha384", 1], ["sha512", 2]]);
318015
- var crypto24;
318015
+ var crypto25;
318016
318016
  if (runtimeFeatures.has("crypto")) {
318017
- crypto24 = __require("node:crypto");
318018
- const cryptoHashes = crypto24.getHashes();
318017
+ crypto25 = __require("node:crypto");
318018
+ const cryptoHashes = crypto25.getHashes();
318019
318019
  if (cryptoHashes.length === 0) {
318020
318020
  validSRIHashAlgorithmTokenSet.clear();
318021
318021
  }
@@ -318105,7 +318105,7 @@ var require_subresource_integrity = __commonJS({
318105
318105
  return result2;
318106
318106
  }
318107
318107
  var applyAlgorithmToBytes = (algorithm, bytes) => {
318108
- return crypto24.hash(algorithm, bytes, "base64");
318108
+ return crypto25.hash(algorithm, bytes, "base64");
318109
318109
  };
318110
318110
  function caseSensitiveMatch(actualValue, expectedValue) {
318111
318111
  let actualValueLength = actualValue.length;
@@ -321039,7 +321039,7 @@ var require_connection = __commonJS({
321039
321039
  var { WebsocketFrameSend } = require_frame();
321040
321040
  var assert4 = __require("node:assert");
321041
321041
  var { runtimeFeatures } = require_runtime_features();
321042
- var crypto24 = runtimeFeatures.has("crypto") ? __require("node:crypto") : null;
321042
+ var crypto25 = runtimeFeatures.has("crypto") ? __require("node:crypto") : null;
321043
321043
  var warningEmitted = false;
321044
321044
  function establishWebSocketConnection(url5, protocols, client, handler, options) {
321045
321045
  const requestURL = url5;
@@ -321059,7 +321059,7 @@ var require_connection = __commonJS({
321059
321059
  const headersList = getHeadersList(new Headers3(options.headers));
321060
321060
  request.headersList = headersList;
321061
321061
  }
321062
- const keyValue = crypto24.randomBytes(16).toString("base64");
321062
+ const keyValue = crypto25.randomBytes(16).toString("base64");
321063
321063
  request.headersList.append("sec-websocket-key", keyValue, true);
321064
321064
  request.headersList.append("sec-websocket-version", "13", true);
321065
321065
  for (const protocol of protocols) {
@@ -321099,7 +321099,7 @@ var require_connection = __commonJS({
321099
321099
  return;
321100
321100
  }
321101
321101
  const secWSAccept = response.headersList.get("Sec-WebSocket-Accept");
321102
- const digest = crypto24.hash("sha1", keyValue + uid, "base64");
321102
+ const digest = crypto25.hash("sha1", keyValue + uid, "base64");
321103
321103
  if (secWSAccept !== digest) {
321104
321104
  failWebsocketConnection(handler, 1002, "Incorrect hash received in Sec-WebSocket-Accept header.");
321105
321105
  return;
@@ -332048,7 +332048,7 @@ function getVersion() {
332048
332048
  }
332049
332049
  versionPromise = (async () => {
332050
332050
  const pkgJson = await getPackageJson(__dirname4);
332051
- return "0.36.0-preview.3";
332051
+ return "0.36.0-preview.4";
332052
332052
  })();
332053
332053
  return versionPromise;
332054
332054
  }
@@ -396383,6 +396383,63 @@ var init_experiments = __esm({
396383
396383
  }
396384
396384
  });
396385
396385
 
396386
+ // packages/core/dist/src/agents/types.js
396387
+ function isSubagentProgress(obj) {
396388
+ return typeof obj === "object" && obj !== null && "isSubagentProgress" in obj && obj.isSubagentProgress === true;
396389
+ }
396390
+ function isToolActivityError(data) {
396391
+ return data !== null && typeof data === "object" && "isError" in data && data.isError === true;
396392
+ }
396393
+ function getAgentCardLoadOptions(def) {
396394
+ if (def.agentCardJson) {
396395
+ return { type: "json", json: def.agentCardJson };
396396
+ }
396397
+ if (def.agentCardUrl) {
396398
+ return { type: "url", url: def.agentCardUrl };
396399
+ }
396400
+ throw new Error(`Remote agent '${def.name}' has neither agentCardUrl nor agentCardJson`);
396401
+ }
396402
+ function getRemoteAgentTargetUrl(def) {
396403
+ if (def.agentCardUrl) {
396404
+ return def.agentCardUrl;
396405
+ }
396406
+ if (def.agentCardJson) {
396407
+ try {
396408
+ const parsed = JSON.parse(def.agentCardJson);
396409
+ const card = parsed;
396410
+ if (card.url) {
396411
+ return card.url;
396412
+ }
396413
+ } catch {
396414
+ }
396415
+ }
396416
+ return void 0;
396417
+ }
396418
+ var AgentTerminateMode, DEFAULT_QUERY_STRING, DEFAULT_MAX_TURNS, DEFAULT_MAX_TIME_MINUTES, SubagentActivityErrorType, SUBAGENT_REJECTED_ERROR_PREFIX, SUBAGENT_CANCELLED_ERROR_MESSAGE;
396419
+ var init_types18 = __esm({
396420
+ "packages/core/dist/src/agents/types.js"() {
396421
+ "use strict";
396422
+ (function(AgentTerminateMode2) {
396423
+ AgentTerminateMode2["ERROR"] = "ERROR";
396424
+ AgentTerminateMode2["TIMEOUT"] = "TIMEOUT";
396425
+ AgentTerminateMode2["GOAL"] = "GOAL";
396426
+ AgentTerminateMode2["MAX_TURNS"] = "MAX_TURNS";
396427
+ AgentTerminateMode2["ABORTED"] = "ABORTED";
396428
+ AgentTerminateMode2["ERROR_NO_COMPLETE_TASK_CALL"] = "ERROR_NO_COMPLETE_TASK_CALL";
396429
+ })(AgentTerminateMode || (AgentTerminateMode = {}));
396430
+ DEFAULT_QUERY_STRING = "Get Started!";
396431
+ DEFAULT_MAX_TURNS = 30;
396432
+ DEFAULT_MAX_TIME_MINUTES = 10;
396433
+ (function(SubagentActivityErrorType2) {
396434
+ SubagentActivityErrorType2["REJECTED"] = "REJECTED";
396435
+ SubagentActivityErrorType2["CANCELLED"] = "CANCELLED";
396436
+ SubagentActivityErrorType2["GENERIC"] = "GENERIC";
396437
+ })(SubagentActivityErrorType || (SubagentActivityErrorType = {}));
396438
+ SUBAGENT_REJECTED_ERROR_PREFIX = "User rejected this operation.";
396439
+ SUBAGENT_CANCELLED_ERROR_MESSAGE = "Request cancelled.";
396440
+ }
396441
+ });
396442
+
396386
396443
  // node_modules/js-yaml/dist/js-yaml.mjs
396387
396444
  function isNothing(subject) {
396388
396445
  return typeof subject === "undefined" || subject === null;
@@ -398973,38 +399030,6 @@ var init_js_yaml = __esm({
398973
399030
  }
398974
399031
  });
398975
399032
 
398976
- // packages/core/dist/src/agents/types.js
398977
- function isSubagentProgress(obj) {
398978
- return typeof obj === "object" && obj !== null && "isSubagentProgress" in obj && obj.isSubagentProgress === true;
398979
- }
398980
- function isToolActivityError(data) {
398981
- return data !== null && typeof data === "object" && "isError" in data && data.isError === true;
398982
- }
398983
- var AgentTerminateMode, DEFAULT_QUERY_STRING, DEFAULT_MAX_TURNS, DEFAULT_MAX_TIME_MINUTES, SubagentActivityErrorType, SUBAGENT_REJECTED_ERROR_PREFIX, SUBAGENT_CANCELLED_ERROR_MESSAGE;
398984
- var init_types18 = __esm({
398985
- "packages/core/dist/src/agents/types.js"() {
398986
- "use strict";
398987
- (function(AgentTerminateMode2) {
398988
- AgentTerminateMode2["ERROR"] = "ERROR";
398989
- AgentTerminateMode2["TIMEOUT"] = "TIMEOUT";
398990
- AgentTerminateMode2["GOAL"] = "GOAL";
398991
- AgentTerminateMode2["MAX_TURNS"] = "MAX_TURNS";
398992
- AgentTerminateMode2["ABORTED"] = "ABORTED";
398993
- AgentTerminateMode2["ERROR_NO_COMPLETE_TASK_CALL"] = "ERROR_NO_COMPLETE_TASK_CALL";
398994
- })(AgentTerminateMode || (AgentTerminateMode = {}));
398995
- DEFAULT_QUERY_STRING = "Get Started!";
398996
- DEFAULT_MAX_TURNS = 30;
398997
- DEFAULT_MAX_TIME_MINUTES = 10;
398998
- (function(SubagentActivityErrorType2) {
398999
- SubagentActivityErrorType2["REJECTED"] = "REJECTED";
399000
- SubagentActivityErrorType2["CANCELLED"] = "CANCELLED";
399001
- SubagentActivityErrorType2["GENERIC"] = "GENERIC";
399002
- })(SubagentActivityErrorType || (SubagentActivityErrorType = {}));
399003
- SUBAGENT_REJECTED_ERROR_PREFIX = "User rejected this operation.";
399004
- SUBAGENT_CANCELLED_ERROR_MESSAGE = "Request cancelled.";
399005
- }
399006
- });
399007
-
399008
399033
  // packages/core/dist/src/skills/skillLoader.js
399009
399034
  import * as fs59 from "node:fs/promises";
399010
399035
  import * as path70 from "node:path";
@@ -399125,19 +399150,42 @@ var init_skillLoader = __esm({
399125
399150
  import * as fs60 from "node:fs/promises";
399126
399151
  import * as path71 from "node:path";
399127
399152
  import * as crypto21 from "node:crypto";
399128
- function formatZodError(error2, context2) {
399129
- const issues = error2.issues.map((i4) => {
399153
+ function guessIntendedKind(rawInput) {
399154
+ if (typeof rawInput !== "object" || rawInput === null)
399155
+ return void 0;
399156
+ const input = rawInput;
399157
+ if (input.kind === "local")
399158
+ return "local";
399159
+ if (input.kind === "remote")
399160
+ return "remote";
399161
+ const hasLocalKeys = "tools" in input || "mcp_servers" in input || "model" in input || "temperature" in input || "max_turns" in input || "timeout_mins" in input;
399162
+ const hasRemoteKeys = "agent_card_url" in input || "auth" in input || "agent_card_json" in input;
399163
+ if (hasLocalKeys && !hasRemoteKeys)
399164
+ return "local";
399165
+ if (hasRemoteKeys && !hasLocalKeys)
399166
+ return "remote";
399167
+ return void 0;
399168
+ }
399169
+ function formatZodError(error2, context2, rawInput) {
399170
+ const intendedKind = rawInput ? guessIntendedKind(rawInput) : void 0;
399171
+ const formatIssues = (issues, unionPrefix) => issues.flatMap((i4) => {
399130
399172
  if (i4.code === external_exports.ZodIssueCode.invalid_union) {
399131
- return i4.unionErrors.map((unionError, index) => {
399132
- const label = agentUnionOptions[index]?.label ?? `Agent type #${index + 1}`;
399133
- const unionIssues = unionError.issues.map((u3) => `${u3.path.join(".")}: ${u3.message}`).join(", ");
399134
- return `(${label}) ${unionIssues}`;
399135
- }).join("\n");
399173
+ return i4.unionErrors.flatMap((unionError, index) => {
399174
+ const label = unionPrefix ? unionPrefix : agentUnionOptions[index]?.label ?? `Branch #${index + 1}`;
399175
+ if (intendedKind === "local" && label === "Remote Agent")
399176
+ return [];
399177
+ if (intendedKind === "remote" && label === "Local Agent")
399178
+ return [];
399179
+ return formatIssues(unionError.issues, label);
399180
+ });
399136
399181
  }
399137
- return `${i4.path.join(".")}: ${i4.message}`;
399138
- }).join("\n");
399182
+ const prefix = unionPrefix ? `(${unionPrefix}) ` : "";
399183
+ const path91 = i4.path.length > 0 ? `${i4.path.join(".")}: ` : "";
399184
+ return `${prefix}${path91}${i4.message}`;
399185
+ });
399186
+ const formatted = Array.from(new Set(formatIssues(error2.issues))).join("\n");
399139
399187
  return `${context2}:
399140
- ${issues}`;
399188
+ ${formatted}`;
399141
399189
  }
399142
399190
  async function parseAgentMarkdown(filePath, content) {
399143
399191
  let fileContent;
@@ -399160,11 +399208,7 @@ async function parseAgentMarkdown(filePath, content) {
399160
399208
  try {
399161
399209
  rawFrontmatter = load2(frontmatterStr);
399162
399210
  } catch (error2) {
399163
- throw new AgentLoadError(
399164
- filePath,
399165
- // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
399166
- `YAML frontmatter parsing failed: ${error2.message}`
399167
- );
399211
+ throw new AgentLoadError(filePath, `YAML frontmatter parsing failed: ${getErrorMessage(error2)}`);
399168
399212
  }
399169
399213
  if (Array.isArray(rawFrontmatter)) {
399170
399214
  const result3 = remoteAgentsListSchema.safeParse(rawFrontmatter);
@@ -399178,7 +399222,7 @@ async function parseAgentMarkdown(filePath, content) {
399178
399222
  }
399179
399223
  const result2 = markdownFrontmatterSchema.safeParse(rawFrontmatter);
399180
399224
  if (!result2.success) {
399181
- throw new AgentLoadError(filePath, `Validation failed: ${formatZodError(result2.error, "Agent Definition")}`);
399225
+ throw new AgentLoadError(filePath, `Validation failed: ${formatZodError(result2.error, "Agent Definition", rawFrontmatter)}`);
399182
399226
  }
399183
399227
  const frontmatter = result2.data;
399184
399228
  if (frontmatter.kind === "remote") {
@@ -399189,39 +399233,30 @@ async function parseAgentMarkdown(filePath, content) {
399189
399233
  }
399190
399234
  ];
399191
399235
  }
399192
- const agentDef = {
399193
- ...frontmatter,
399194
- kind: "local",
399195
- system_prompt: body2.trim()
399196
- };
399197
- return [agentDef];
399236
+ return [
399237
+ {
399238
+ ...frontmatter,
399239
+ kind: "local",
399240
+ system_prompt: body2.trim()
399241
+ }
399242
+ ];
399198
399243
  }
399199
399244
  function convertFrontmatterAuthToConfig(frontmatter) {
399200
- const base = {};
399201
399245
  switch (frontmatter.type) {
399202
399246
  case "apiKey":
399203
- if (!frontmatter.key) {
399204
- throw new Error("Internal error: API key missing after validation.");
399205
- }
399206
399247
  return {
399207
- ...base,
399208
399248
  type: "apiKey",
399209
399249
  key: frontmatter.key,
399210
399250
  name: frontmatter.name
399211
399251
  };
399212
399252
  case "google-credentials":
399213
399253
  return {
399214
- ...base,
399215
399254
  type: "google-credentials",
399216
399255
  scopes: frontmatter.scopes
399217
399256
  };
399218
- case "http": {
399219
- if (!frontmatter.scheme) {
399220
- throw new Error("Internal error: HTTP scheme missing after validation.");
399221
- }
399257
+ case "http":
399222
399258
  if (frontmatter.value) {
399223
399259
  return {
399224
- ...base,
399225
399260
  type: "http",
399226
399261
  scheme: frontmatter.scheme,
399227
399262
  value: frontmatter.value
@@ -399229,34 +399264,23 @@ function convertFrontmatterAuthToConfig(frontmatter) {
399229
399264
  }
399230
399265
  switch (frontmatter.scheme) {
399231
399266
  case "Bearer":
399232
- if (!frontmatter.token) {
399233
- throw new Error("Internal error: Bearer token missing after validation.");
399234
- }
399235
399267
  return {
399236
- ...base,
399237
399268
  type: "http",
399238
399269
  scheme: "Bearer",
399239
399270
  token: frontmatter.token
399240
399271
  };
399241
399272
  case "Basic":
399242
- if (!frontmatter.username || !frontmatter.password) {
399243
- throw new Error("Internal error: Basic auth credentials missing after validation.");
399244
- }
399245
399273
  return {
399246
- ...base,
399247
399274
  type: "http",
399248
399275
  scheme: "Basic",
399249
399276
  username: frontmatter.username,
399250
399277
  password: frontmatter.password
399251
399278
  };
399252
- default: {
399279
+ default:
399253
399280
  throw new Error(`Unknown HTTP scheme: ${frontmatter.scheme}`);
399254
- }
399255
399281
  }
399256
- }
399257
399282
  case "oauth":
399258
399283
  return {
399259
- ...base,
399260
399284
  type: "oauth2",
399261
399285
  client_id: frontmatter.client_id,
399262
399286
  client_secret: frontmatter.client_secret,
@@ -399265,8 +399289,12 @@ function convertFrontmatterAuthToConfig(frontmatter) {
399265
399289
  token_url: frontmatter.token_url
399266
399290
  };
399267
399291
  default: {
399268
- const exhaustive = frontmatter.type;
399269
- throw new Error(`Unknown auth type: ${exhaustive}`);
399292
+ const exhaustive = frontmatter;
399293
+ const raw = exhaustive;
399294
+ if (typeof raw === "object" && raw !== null && "type" in raw) {
399295
+ throw new Error(`Unknown auth type: ${String(raw["type"])}`);
399296
+ }
399297
+ throw new Error("Unknown auth type");
399270
399298
  }
399271
399299
  }
399272
399300
  }
@@ -399285,20 +399313,28 @@ function markdownToAgentDefinition(markdown, metadata2) {
399285
399313
  }
399286
399314
  };
399287
399315
  if (markdown.kind === "remote") {
399288
- return {
399316
+ const base = {
399289
399317
  kind: "remote",
399290
399318
  name: markdown.name,
399291
399319
  description: markdown.description || "",
399292
399320
  displayName: markdown.display_name,
399293
- agentCardUrl: markdown.agent_card_url,
399294
399321
  auth: markdown.auth ? convertFrontmatterAuthToConfig(markdown.auth) : void 0,
399295
399322
  inputConfig,
399296
399323
  metadata: metadata2
399297
399324
  };
399325
+ if ("agent_card_json" in markdown && markdown.agent_card_json !== void 0) {
399326
+ base.agentCardJson = markdown.agent_card_json;
399327
+ return base;
399328
+ }
399329
+ if ("agent_card_url" in markdown && markdown.agent_card_url !== void 0) {
399330
+ base.agentCardUrl = markdown.agent_card_url;
399331
+ return base;
399332
+ }
399333
+ throw new AgentLoadError(metadata2?.filePath || "unknown", "Unexpected state: neither agent_card_json nor agent_card_url present on remote agent");
399298
399334
  }
399299
399335
  const modelName = markdown.model || "inherit";
399300
399336
  const mcpServers = {};
399301
- if (markdown.kind === "local" && markdown.mcp_servers) {
399337
+ if (markdown.mcp_servers) {
399302
399338
  for (const [name3, config3] of Object.entries(markdown.mcp_servers)) {
399303
399339
  mcpServers[name3] = new MCPServerConfig(config3.command, config3.args, config3.env, config3.cwd, config3.url, config3.http_url, config3.headers, config3.tcp, config3.type, config3.timeout, config3.trust, config3.description, config3.include_tools, config3.exclude_tools);
399304
399340
  }
@@ -399340,14 +399376,10 @@ async function loadAgentsFromDirectory(dir) {
399340
399376
  try {
399341
399377
  dirEntries = await fs60.readdir(dir, { withFileTypes: true });
399342
399378
  } catch (error2) {
399343
- if (error2.code === "ENOENT") {
399379
+ if (error2 instanceof Error && "code" in error2 && error2.code === "ENOENT") {
399344
399380
  return result2;
399345
399381
  }
399346
- result2.errors.push(new AgentLoadError(
399347
- dir,
399348
- // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
399349
- `Could not list directory: ${error2.message}`
399350
- ));
399382
+ result2.errors.push(new AgentLoadError(dir, `Could not list directory: ${getErrorMessage(error2)}`));
399351
399383
  return result2;
399352
399384
  }
399353
399385
  const files = dirEntries.filter((entry) => entry.isFile() && !entry.name.startsWith("_") && entry.name.endsWith(".md"));
@@ -399365,17 +399397,13 @@ async function loadAgentsFromDirectory(dir) {
399365
399397
  if (error2 instanceof AgentLoadError) {
399366
399398
  result2.errors.push(error2);
399367
399399
  } else {
399368
- result2.errors.push(new AgentLoadError(
399369
- filePath,
399370
- // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
399371
- `Unexpected error: ${error2.message}`
399372
- ));
399400
+ result2.errors.push(new AgentLoadError(filePath, `Unexpected error: ${getErrorMessage(error2)}`));
399373
399401
  }
399374
399402
  }
399375
399403
  }
399376
399404
  return result2;
399377
399405
  }
399378
- var AgentLoadError, nameSchema, mcpServerSchema, localAgentSchema, baseAuthFields, apiKeyAuthSchema, httpAuthSchema, googleCredentialsAuthSchema, oauth2AuthSchema, authConfigSchema, remoteAgentSchema, agentUnionOptions, remoteAgentsListSchema, markdownFrontmatterSchema;
399406
+ var AgentLoadError, nameSchema, mcpServerSchema, localAgentSchema, baseAuthFields, apiKeyAuthSchema, httpAuthSchema, googleCredentialsAuthSchema, oauth2AuthSchema, authConfigSchema, baseRemoteAgentSchema, remoteAgentUrlSchema, remoteAgentJsonSchema, remoteAgentSchema, agentUnionOptions, remoteAgentsListSchema, markdownFrontmatterSchema;
399379
399407
  var init_agentLoader = __esm({
399380
399408
  "packages/core/dist/src/agents/agentLoader.js"() {
399381
399409
  "use strict";
@@ -399462,17 +399490,17 @@ var init_agentLoader = __esm({
399462
399490
  oauth2AuthSchema
399463
399491
  ]).superRefine((data, ctx) => {
399464
399492
  if (data.type === "http") {
399465
- if (data.value) {
399493
+ if (data.value)
399466
399494
  return;
399467
- }
399468
- if (data.scheme === "Bearer" && !data.token) {
399469
- ctx.addIssue({
399470
- code: external_exports.ZodIssueCode.custom,
399471
- message: 'Bearer scheme requires "token"',
399472
- path: ["token"]
399473
- });
399474
- }
399475
- if (data.scheme === "Basic") {
399495
+ if (data.scheme === "Bearer") {
399496
+ if (!data.token) {
399497
+ ctx.addIssue({
399498
+ code: external_exports.ZodIssueCode.custom,
399499
+ message: 'Bearer scheme requires "token"',
399500
+ path: ["token"]
399501
+ });
399502
+ }
399503
+ } else if (data.scheme === "Basic") {
399476
399504
  if (!data.username) {
399477
399505
  ctx.addIssue({
399478
399506
  code: external_exports.ZodIssueCode.custom,
@@ -399487,25 +399515,51 @@ var init_agentLoader = __esm({
399487
399515
  path: ["password"]
399488
399516
  });
399489
399517
  }
399518
+ } else {
399519
+ ctx.addIssue({
399520
+ code: external_exports.ZodIssueCode.custom,
399521
+ message: `HTTP scheme "${data.scheme}" requires "value"`,
399522
+ path: ["value"]
399523
+ });
399490
399524
  }
399491
399525
  }
399492
399526
  });
399493
- remoteAgentSchema = external_exports.object({
399527
+ baseRemoteAgentSchema = external_exports.object({
399494
399528
  kind: external_exports.literal("remote").optional().default("remote"),
399495
399529
  name: nameSchema,
399496
399530
  description: external_exports.string().optional(),
399497
399531
  display_name: external_exports.string().optional(),
399498
- agent_card_url: external_exports.string().url(),
399499
399532
  auth: authConfigSchema.optional()
399533
+ });
399534
+ remoteAgentUrlSchema = baseRemoteAgentSchema.extend({
399535
+ agent_card_url: external_exports.string().url(),
399536
+ agent_card_json: external_exports.undefined().optional()
399537
+ }).strict();
399538
+ remoteAgentJsonSchema = baseRemoteAgentSchema.extend({
399539
+ agent_card_url: external_exports.undefined().optional(),
399540
+ agent_card_json: external_exports.string().refine((val) => {
399541
+ try {
399542
+ JSON.parse(val);
399543
+ return true;
399544
+ } catch {
399545
+ return false;
399546
+ }
399547
+ }, { message: "agent_card_json must be valid JSON" })
399500
399548
  }).strict();
399549
+ remoteAgentSchema = external_exports.union([
399550
+ remoteAgentUrlSchema,
399551
+ remoteAgentJsonSchema
399552
+ ]);
399501
399553
  agentUnionOptions = [
399502
- { schema: localAgentSchema, label: "Local Agent" },
399503
- { schema: remoteAgentSchema, label: "Remote Agent" }
399554
+ { label: "Local Agent" },
399555
+ { label: "Remote Agent" },
399556
+ { label: "Remote Agent" }
399504
399557
  ];
399505
399558
  remoteAgentsListSchema = external_exports.array(remoteAgentSchema);
399506
399559
  markdownFrontmatterSchema = external_exports.union([
399507
- agentUnionOptions[0].schema,
399508
- agentUnionOptions[1].schema
399560
+ localAgentSchema,
399561
+ remoteAgentUrlSchema,
399562
+ remoteAgentJsonSchema
399509
399563
  ]);
399510
399564
  }
399511
399565
  });
@@ -404827,6 +404881,7 @@ var init_a2a_errors = __esm({
404827
404881
  });
404828
404882
 
404829
404883
  // packages/core/dist/src/agents/registry.js
404884
+ import * as crypto23 from "node:crypto";
404830
404885
  function getModelConfigAlias(definition) {
404831
404886
  return `${definition.name}-config`;
404832
404887
  }
@@ -404836,6 +404891,7 @@ var init_registry = __esm({
404836
404891
  "use strict";
404837
404892
  init_storage();
404838
404893
  init_events();
404894
+ init_types18();
404839
404895
  init_agentLoader();
404840
404896
  init_codebase_investigator();
404841
404897
  init_cli_help_agent();
@@ -404936,7 +404992,7 @@ var init_registry = __esm({
404936
404992
  if (!agent.metadata) {
404937
404993
  agent.metadata = {};
404938
404994
  }
404939
- agent.metadata.hash = agent.agentCardUrl;
404995
+ agent.metadata.hash = agent.agentCardUrl ?? (agent.agentCardJson ? crypto23.createHash("sha256").update(agent.agentCardJson).digest("hex") : void 0);
404940
404996
  }
404941
404997
  if (!agent.metadata?.hash) {
404942
404998
  agentsToRegister.push(agent);
@@ -405106,12 +405162,13 @@ var init_registry = __esm({
405106
405162
  debugLogger.warn(`[AgentRegistry] Skipping remote agent '${definition.name}': A2AClientManager is not available.`);
405107
405163
  return;
405108
405164
  }
405165
+ const targetUrl = getRemoteAgentTargetUrl(remoteDef);
405109
405166
  let authHandler;
405110
405167
  if (definition.auth) {
405111
405168
  const provider = await A2AAuthProviderFactory.create({
405112
405169
  authConfig: definition.auth,
405113
405170
  agentName: definition.name,
405114
- targetUrl: definition.agentCardUrl,
405171
+ targetUrl,
405115
405172
  agentCardUrl: remoteDef.agentCardUrl
405116
405173
  });
405117
405174
  if (!provider) {
@@ -405119,7 +405176,7 @@ var init_registry = __esm({
405119
405176
  }
405120
405177
  authHandler = provider;
405121
405178
  }
405122
- const agentCard = await clientManager.loadAgent(remoteDef.name, remoteDef.agentCardUrl, authHandler);
405179
+ const agentCard = await clientManager.loadAgent(remoteDef.name, getAgentCardLoadOptions(remoteDef), authHandler);
405123
405180
  if (agentCard.securitySchemes) {
405124
405181
  const validation = A2AAuthProviderFactory.validateAuthConfig(definition.auth, agentCard.securitySchemes);
405125
405182
  if (!validation.valid && validation.diff) {
@@ -405147,7 +405204,7 @@ ${skillsList}`);
405147
405204
  definition.description = descriptions.join("\n");
405148
405205
  }
405149
405206
  if (this.config.getDebugMode()) {
405150
- debugLogger.log(`[AgentRegistry] Registered remote agent '${definition.name}' with card: ${definition.agentCardUrl}`);
405207
+ debugLogger.log(`[AgentRegistry] Registered remote agent '${definition.name}' with card: ${definition.agentCardUrl ?? "inline JSON"}`);
405151
405208
  }
405152
405209
  this.agents.set(definition.name, definition);
405153
405210
  this.addAgentPolicy(definition);
@@ -408850,10 +408907,11 @@ var init_remote_invocation = __esm({
408850
408907
  return this.authHandler;
408851
408908
  }
408852
408909
  if (this.definition.auth) {
408910
+ const targetUrl = getRemoteAgentTargetUrl(this.definition);
408853
408911
  const provider = await A2AAuthProviderFactory.create({
408854
408912
  authConfig: this.definition.auth,
408855
408913
  agentName: this.definition.name,
408856
- targetUrl: this.definition.agentCardUrl,
408914
+ targetUrl,
408857
408915
  agentCardUrl: this.definition.agentCardUrl
408858
408916
  });
408859
408917
  if (!provider) {
@@ -408898,7 +408956,7 @@ var init_remote_invocation = __esm({
408898
408956
  }
408899
408957
  const authHandler = await this.getAuthHandler();
408900
408958
  if (!this.clientManager.getClient(this.definition.name)) {
408901
- await this.clientManager.loadAgent(this.definition.name, this.definition.agentCardUrl, authHandler);
408959
+ await this.clientManager.loadAgent(this.definition.name, getAgentCardLoadOptions(this.definition), authHandler);
408902
408960
  }
408903
408961
  const message = this.params.query;
408904
408962
  const stream3 = this.clientManager.sendMessageStream(this.definition.name, message, {
@@ -413366,7 +413424,7 @@ var init_xcode_mcp_fix_transport = __esm({
413366
413424
  });
413367
413425
 
413368
413426
  // packages/core/dist/src/mcp/oauth-provider.js
413369
- import * as crypto23 from "node:crypto";
413427
+ import * as crypto24 from "node:crypto";
413370
413428
  import { URL as URL9 } from "node:url";
413371
413429
  var MCPOAuthProvider;
413372
413430
  var init_oauth_provider = __esm({
@@ -413652,7 +413710,7 @@ ${authUrl}
413652
413710
  debugLogger.debug("\u2713 Authentication successful! Token saved.");
413653
413711
  const savedToken = await this.tokenStorage.getCredentials(serverName);
413654
413712
  if (savedToken && savedToken.token && savedToken.token.accessToken) {
413655
- const tokenFingerprint = crypto23.createHash("sha256").update(savedToken.token.accessToken).digest("hex").slice(0, 8);
413713
+ const tokenFingerprint = crypto24.createHash("sha256").update(savedToken.token.accessToken).digest("hex").slice(0, 8);
413656
413714
  debugLogger.debug(`\u2713 Token verification successful (fingerprint: ${tokenFingerprint})`);
413657
413715
  } else {
413658
413716
  debugLogger.warn("Token verification failed: token not found or invalid after save");
@@ -414940,7 +414998,7 @@ var init_mcp_client = __esm({
414940
414998
  });
414941
414999
 
414942
415000
  // packages/core/dist/src/tools/mcp-client-manager.js
414943
- import { createHash as createHash14 } from "node:crypto";
415001
+ import { createHash as createHash15 } from "node:crypto";
414944
415002
  var McpClientManager;
414945
415003
  var init_mcp_client_manager = __esm({
414946
415004
  "packages/core/dist/src/tools/mcp-client-manager.js"() {
@@ -415137,7 +415195,7 @@ var init_mcp_client_manager = __esm({
415137
415195
  config: rest,
415138
415196
  extensionId: extension?.id
415139
415197
  };
415140
- return createHash14("sha256").update(stableStringify(keyData)).digest("hex");
415198
+ return createHash15("sha256").update(stableStringify(keyData)).digest("hex");
415141
415199
  }
415142
415200
  /**
415143
415201
  * Merges two MCP configurations. The second configuration (override)
@@ -434011,7 +434069,7 @@ var init_a2a_client_manager = __esm({
434011
434069
  * @param authHandler Optional authentication handler to use for this agent.
434012
434070
  * @returns The loaded AgentCard.
434013
434071
  */
434014
- async loadAgent(name3, agentCardUrl, authHandler) {
434072
+ async loadAgent(name3, options, authHandler) {
434015
434073
  if (this.clients.has(name3) && this.agentCards.has(name3)) {
434016
434074
  throw new Error(`Agent with name '${name3}' is already loaded.`);
434017
434075
  }
@@ -434027,7 +434085,19 @@ var init_a2a_client_manager = __esm({
434027
434085
  return response;
434028
434086
  };
434029
434087
  const resolver = new DefaultAgentCardResolver({ fetchImpl: cardFetch });
434030
- const rawCard = await resolver.resolve(agentCardUrl, "");
434088
+ let rawCard;
434089
+ let urlIdentifier = "inline JSON";
434090
+ if (options.type === "json") {
434091
+ try {
434092
+ rawCard = JSON.parse(options.json);
434093
+ } catch (error2) {
434094
+ const msg = error2 instanceof Error ? error2.message : String(error2);
434095
+ throw new Error(`Failed to parse inline agent card JSON for agent '${name3}': ${msg}`);
434096
+ }
434097
+ } else {
434098
+ urlIdentifier = options.url;
434099
+ rawCard = await resolver.resolve(options.url, "");
434100
+ }
434031
434101
  const agentCard = normalizeAgentCard(rawCard);
434032
434102
  const grpcUrl = agentCard.additionalInterfaces?.find((i4) => i4.transport === "GRPC")?.url ?? agentCard.url;
434033
434103
  const clientOptions = ClientFactoryOptions.createFrom(ClientFactoryOptions.default, {
@@ -434045,10 +434115,10 @@ var init_a2a_client_manager = __esm({
434045
434115
  const client = await factory.createFromAgentCard(agentCard);
434046
434116
  this.clients.set(name3, client);
434047
434117
  this.agentCards.set(name3, agentCard);
434048
- debugLogger.debug(`[A2AClientManager] Loaded agent '${name3}' from ${agentCardUrl}`);
434118
+ debugLogger.debug(`[A2AClientManager] Loaded agent '${name3}' from ${urlIdentifier}`);
434049
434119
  return agentCard;
434050
434120
  } catch (error2) {
434051
- throw classifyAgentError(name3, agentCardUrl, error2);
434121
+ throw classifyAgentError(name3, urlIdentifier, error2);
434052
434122
  }
434053
434123
  }
434054
434124
  /**
@@ -440543,7 +440613,7 @@ var require_main2 = __commonJS({
440543
440613
  var fs76 = __require("fs");
440544
440614
  var path91 = __require("path");
440545
440615
  var os32 = __require("os");
440546
- var crypto24 = __require("crypto");
440616
+ var crypto25 = __require("crypto");
440547
440617
  var packageJson4 = require_package14();
440548
440618
  var version4 = packageJson4.version;
440549
440619
  var LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
@@ -440762,7 +440832,7 @@ var require_main2 = __commonJS({
440762
440832
  const authTag = ciphertext.subarray(-16);
440763
440833
  ciphertext = ciphertext.subarray(12, -16);
440764
440834
  try {
440765
- const aesgcm = crypto24.createDecipheriv("aes-256-gcm", key, nonce);
440835
+ const aesgcm = crypto25.createDecipheriv("aes-256-gcm", key, nonce);
440766
440836
  aesgcm.setAuthTag(authTag);
440767
440837
  return `${aesgcm.update(ciphertext)}${aesgcm.final()}`;
440768
440838
  } catch (error2) {