visionclaw 0.1.203 → 0.1.204

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.
Files changed (63) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/agent/engine-switch-handler.d.ts +18 -0
  3. package/dist/agent/engine-switch-handler.d.ts.map +1 -0
  4. package/dist/agent/engine-switch-handler.js +78 -0
  5. package/dist/agent/engine-switch-handler.js.map +1 -0
  6. package/dist/agent/engines/claude/session.d.ts +1 -0
  7. package/dist/agent/engines/claude/session.d.ts.map +1 -1
  8. package/dist/agent/engines/claude/session.js +12 -0
  9. package/dist/agent/engines/claude/session.js.map +1 -1
  10. package/dist/agent/engines/session-types.d.ts +2 -0
  11. package/dist/agent/engines/session-types.d.ts.map +1 -1
  12. package/dist/agent/external-context/providers/finapp.d.ts +10 -0
  13. package/dist/agent/external-context/providers/finapp.d.ts.map +1 -0
  14. package/dist/agent/external-context/providers/finapp.js +86 -0
  15. package/dist/agent/external-context/providers/finapp.js.map +1 -0
  16. package/dist/agent/external-context/registry.d.ts +24 -0
  17. package/dist/agent/external-context/registry.d.ts.map +1 -0
  18. package/dist/agent/external-context/registry.js +114 -0
  19. package/dist/agent/external-context/registry.js.map +1 -0
  20. package/dist/agent/external-context/runtime.d.ts +6 -0
  21. package/dist/agent/external-context/runtime.d.ts.map +1 -0
  22. package/dist/agent/external-context/runtime.js +22 -0
  23. package/dist/agent/external-context/runtime.js.map +1 -0
  24. package/dist/agent/external-context/types.d.ts +37 -0
  25. package/dist/agent/external-context/types.d.ts.map +1 -0
  26. package/dist/agent/external-context/types.js +2 -0
  27. package/dist/agent/external-context/types.js.map +1 -0
  28. package/dist/agent/heartbeat-manager.d.ts.map +1 -1
  29. package/dist/agent/heartbeat-manager.js +2 -0
  30. package/dist/agent/heartbeat-manager.js.map +1 -1
  31. package/dist/agent/model-provider.d.ts +2 -2
  32. package/dist/agent/model-provider.d.ts.map +1 -1
  33. package/dist/agent/model-provider.js +5 -18
  34. package/dist/agent/model-provider.js.map +1 -1
  35. package/dist/agent/system-prompt.d.ts.map +1 -1
  36. package/dist/agent/system-prompt.js +3 -2
  37. package/dist/agent/system-prompt.js.map +1 -1
  38. package/dist/agent/wake-cycle-runner.d.ts.map +1 -1
  39. package/dist/agent/wake-cycle-runner.js +11 -1
  40. package/dist/agent/wake-cycle-runner.js.map +1 -1
  41. package/dist/channels/telegram.js +2 -2
  42. package/dist/channels/telegram.js.map +1 -1
  43. package/dist/config/index.d.ts.map +1 -1
  44. package/dist/config/index.js +10 -2
  45. package/dist/config/index.js.map +1 -1
  46. package/dist/config/models.d.ts +6 -6
  47. package/dist/config/models.d.ts.map +1 -1
  48. package/dist/config/models.js +6 -6
  49. package/dist/config/models.js.map +1 -1
  50. package/dist/config/types.d.ts +12 -9
  51. package/dist/config/types.d.ts.map +1 -1
  52. package/dist/config/types.js +9 -7
  53. package/dist/config/types.js.map +1 -1
  54. package/dist/onboarding/bot-profile.d.ts.map +1 -1
  55. package/dist/onboarding/bot-profile.js +1 -2
  56. package/dist/onboarding/bot-profile.js.map +1 -1
  57. package/dist/onboarding/index.js +3 -3
  58. package/dist/onboarding/index.js.map +1 -1
  59. package/dist/reconfigure.d.ts.map +1 -1
  60. package/dist/reconfigure.js +7 -9
  61. package/dist/reconfigure.js.map +1 -1
  62. package/dist-agent/bundle.cjs +592 -264
  63. package/package.json +1 -1
@@ -14351,25 +14351,25 @@ var init_zod = __esm({
14351
14351
  });
14352
14352
 
14353
14353
  // dist/config/models.js
14354
- var CLAUDE_SONNET_MODEL, CLAUDE_OPUS_4_6_MODEL, CLAUDE_OPUS_MODEL, GPT_MODEL, DEFAULT_CLAUDE_MODEL, DEFAULT_PI_MODEL, BEDROCK_CLAUDE_SONNET_MODEL, BEDROCK_CLAUDE_OPUS_4_6_MODEL, BEDROCK_CLAUDE_OPUS_MODEL;
14354
+ var CLAUDE_SONNET_MODEL, CLAUDE_OPUS_MODEL, GPT_HEAVY_MODEL, GPT_BALANCED_MODEL, GPT_FAST_MODEL, DEFAULT_CLAUDE_MODEL, DEFAULT_PI_MODEL, BEDROCK_CLAUDE_SONNET_MODEL, BEDROCK_CLAUDE_OPUS_MODEL;
14355
14355
  var init_models = __esm({
14356
14356
  "dist/config/models.js"() {
14357
14357
  "use strict";
14358
- CLAUDE_SONNET_MODEL = "claude-sonnet-4-6";
14359
- CLAUDE_OPUS_4_6_MODEL = "claude-opus-4-6";
14358
+ CLAUDE_SONNET_MODEL = "claude-sonnet-5";
14360
14359
  CLAUDE_OPUS_MODEL = "claude-opus-4-8";
14361
- GPT_MODEL = "gpt-5.5";
14360
+ GPT_HEAVY_MODEL = "gpt-5.6-sol";
14361
+ GPT_BALANCED_MODEL = "gpt-5.6-terra";
14362
+ GPT_FAST_MODEL = "gpt-5.6-luna";
14362
14363
  DEFAULT_CLAUDE_MODEL = CLAUDE_OPUS_MODEL;
14363
- DEFAULT_PI_MODEL = GPT_MODEL;
14364
- BEDROCK_CLAUDE_SONNET_MODEL = "global.anthropic.claude-sonnet-4-6";
14365
- BEDROCK_CLAUDE_OPUS_4_6_MODEL = "global.anthropic.claude-opus-4-6-v1";
14364
+ DEFAULT_PI_MODEL = GPT_HEAVY_MODEL;
14365
+ BEDROCK_CLAUDE_SONNET_MODEL = "global.anthropic.claude-sonnet-5";
14366
14366
  BEDROCK_CLAUDE_OPUS_MODEL = "global.anthropic.claude-opus-4-8";
14367
14367
  }
14368
14368
  });
14369
14369
 
14370
14370
  // dist/config/types.js
14371
14371
  function inferModelFromProvider(provider) {
14372
- return provider === "llm-gateway" || provider === "openai" || provider === "azure-openai" || provider === "9router" ? GPT_MODEL : CLAUDE_SONNET_MODEL;
14372
+ return provider === "llm-gateway" || provider === "openai" || provider === "azure-openai" || provider === "9router" ? GPT_HEAVY_MODEL : CLAUDE_SONNET_MODEL;
14373
14373
  }
14374
14374
  function getSupportedProvidersForModel(model) {
14375
14375
  return MODEL_PROVIDER_COMPATIBILITY[model];
@@ -14465,16 +14465,18 @@ var init_types = __esm({
14465
14465
  });
14466
14466
  ModelSchema = external_exports.enum([
14467
14467
  CLAUDE_OPUS_MODEL,
14468
- CLAUDE_OPUS_4_6_MODEL,
14469
14468
  CLAUDE_SONNET_MODEL,
14470
- GPT_MODEL
14471
- ]).default(GPT_MODEL);
14469
+ GPT_HEAVY_MODEL,
14470
+ GPT_BALANCED_MODEL,
14471
+ GPT_FAST_MODEL
14472
+ ]).default(GPT_HEAVY_MODEL);
14472
14473
  ProviderSchema = external_exports.enum(["llm-gateway", "anthropic", "bedrock", "vertex", "9router", "openai", "azure-openai"]).default("llm-gateway");
14473
14474
  MODEL_PROVIDER_COMPATIBILITY = {
14474
14475
  [CLAUDE_SONNET_MODEL]: ["llm-gateway", "anthropic", "bedrock", "vertex", "9router"],
14475
14476
  [CLAUDE_OPUS_MODEL]: ["llm-gateway", "anthropic", "bedrock", "vertex", "9router"],
14476
- [CLAUDE_OPUS_4_6_MODEL]: ["llm-gateway", "anthropic", "bedrock", "vertex", "9router"],
14477
- [GPT_MODEL]: ["llm-gateway", "openai", "azure-openai", "9router"]
14477
+ [GPT_HEAVY_MODEL]: ["llm-gateway", "openai", "azure-openai", "9router"],
14478
+ [GPT_BALANCED_MODEL]: ["llm-gateway", "openai", "azure-openai", "9router"],
14479
+ [GPT_FAST_MODEL]: ["llm-gateway", "openai", "azure-openai", "9router"]
14478
14480
  };
14479
14481
  VisionClawConfigBaseSchema = external_exports.object({
14480
14482
  agentName: external_exports.string().default("VisionClaw"),
@@ -14926,9 +14928,15 @@ function normalizeLegacyConfig(raw) {
14926
14928
  if (!("model" in normalized) && parsedProvider.success) {
14927
14929
  normalized.model = inferModelFromProvider(parsedProvider.data);
14928
14930
  }
14929
- if (normalized.model === CLAUDE_OPUS_4_6_MODEL) {
14931
+ if (normalized.model === "claude-opus-4-6") {
14930
14932
  normalized.model = DEFAULT_CLAUDE_MODEL;
14931
14933
  }
14934
+ if (normalized.model === "claude-sonnet-4-6") {
14935
+ normalized.model = CLAUDE_SONNET_MODEL;
14936
+ }
14937
+ if (normalized.model === "gpt-5.5") {
14938
+ normalized.model = GPT_HEAVY_MODEL;
14939
+ }
14932
14940
  if (normalized.heartbeatIntervalMs === LEGACY_HEARTBEAT_INTERVAL_MS) {
14933
14941
  normalized.heartbeatIntervalMs = DEFAULT_HEARTBEAT_INTERVAL_MS;
14934
14942
  }
@@ -20777,7 +20785,7 @@ var require_prompts3 = __commonJS({
20777
20785
 
20778
20786
  // dist/utils/version-check.js
20779
20787
  function isBundled() {
20780
- const v14 = "0.1.203";
20788
+ const v14 = "0.1.204";
20781
20789
  return typeof v14 === "string" && v14 !== "undefined";
20782
20790
  }
20783
20791
  function getPackageRoot() {
@@ -20794,7 +20802,7 @@ function getInstallationInfo() {
20794
20802
  };
20795
20803
  }
20796
20804
  function getCurrentVersion() {
20797
- const bundledVersion = "0.1.203";
20805
+ const bundledVersion = "0.1.204";
20798
20806
  if (bundledVersion && bundledVersion !== "undefined") {
20799
20807
  return bundledVersion;
20800
20808
  }
@@ -41807,22 +41815,22 @@ var require_crypto2 = __commonJS({
41807
41815
  "use strict";
41808
41816
  Object.defineProperty(exports2, "__esModule", { value: true });
41809
41817
  exports2.NodeCrypto = void 0;
41810
- var crypto26 = require("crypto");
41818
+ var crypto27 = require("crypto");
41811
41819
  var NodeCrypto = class {
41812
41820
  async sha256DigestBase64(str4) {
41813
- return crypto26.createHash("sha256").update(str4).digest("base64");
41821
+ return crypto27.createHash("sha256").update(str4).digest("base64");
41814
41822
  }
41815
41823
  randomBytesBase64(count) {
41816
- return crypto26.randomBytes(count).toString("base64");
41824
+ return crypto27.randomBytes(count).toString("base64");
41817
41825
  }
41818
41826
  async verify(pubkey, data3, signature) {
41819
- const verifier = crypto26.createVerify("RSA-SHA256");
41827
+ const verifier = crypto27.createVerify("RSA-SHA256");
41820
41828
  verifier.update(data3);
41821
41829
  verifier.end();
41822
41830
  return verifier.verify(pubkey, signature, "base64");
41823
41831
  }
41824
41832
  async sign(privateKey, data3) {
41825
- const signer = crypto26.createSign("RSA-SHA256");
41833
+ const signer = crypto27.createSign("RSA-SHA256");
41826
41834
  signer.update(data3);
41827
41835
  signer.end();
41828
41836
  return signer.sign(privateKey, "base64");
@@ -41840,7 +41848,7 @@ var require_crypto2 = __commonJS({
41840
41848
  * string in hexadecimal encoding.
41841
41849
  */
41842
41850
  async sha256DigestHex(str4) {
41843
- return crypto26.createHash("sha256").update(str4).digest("hex");
41851
+ return crypto27.createHash("sha256").update(str4).digest("hex");
41844
41852
  }
41845
41853
  /**
41846
41854
  * Computes the HMAC hash of a message using the provided crypto key and the
@@ -41852,7 +41860,7 @@ var require_crypto2 = __commonJS({
41852
41860
  */
41853
41861
  async signWithHmacSha256(key, msg) {
41854
41862
  const cryptoKey = typeof key === "string" ? key : toBuffer(key);
41855
- return toArrayBuffer(crypto26.createHmac("sha256", cryptoKey).update(msg).digest());
41863
+ return toArrayBuffer(crypto27.createHmac("sha256", cryptoKey).update(msg).digest());
41856
41864
  }
41857
41865
  };
41858
41866
  exports2.NodeCrypto = NodeCrypto;
@@ -42630,10 +42638,10 @@ var require_oauth2client = __commonJS({
42630
42638
  * https://github.com/googleapis/google-auth-library-nodejs/blob/main/samples/oauth2-codeVerifier.js
42631
42639
  */
42632
42640
  async generateCodeVerifierAsync() {
42633
- const crypto26 = (0, crypto_1.createCrypto)();
42634
- const randomString3 = crypto26.randomBytesBase64(96);
42641
+ const crypto27 = (0, crypto_1.createCrypto)();
42642
+ const randomString3 = crypto27.randomBytesBase64(96);
42635
42643
  const codeVerifier = randomString3.replace(/\+/g, "~").replace(/=/g, "_").replace(/\//g, "-");
42636
- const unencodedCodeChallenge = await crypto26.sha256DigestBase64(codeVerifier);
42644
+ const unencodedCodeChallenge = await crypto27.sha256DigestBase64(codeVerifier);
42637
42645
  const codeChallenge = unencodedCodeChallenge.split("=")[0].replace(/\+/g, "-").replace(/\//g, "_");
42638
42646
  return { codeVerifier, codeChallenge };
42639
42647
  }
@@ -43077,7 +43085,7 @@ var require_oauth2client = __commonJS({
43077
43085
  * @return Returns a promise resolving to LoginTicket on verification.
43078
43086
  */
43079
43087
  async verifySignedJwtWithCertsAsync(jwt3, certs, requiredAudience, issuers, maxExpiry) {
43080
- const crypto26 = (0, crypto_1.createCrypto)();
43088
+ const crypto27 = (0, crypto_1.createCrypto)();
43081
43089
  if (!maxExpiry) {
43082
43090
  maxExpiry = _OAuth2Client.DEFAULT_MAX_TOKEN_LIFETIME_SECS_;
43083
43091
  }
@@ -43090,7 +43098,7 @@ var require_oauth2client = __commonJS({
43090
43098
  let envelope;
43091
43099
  let payload3;
43092
43100
  try {
43093
- envelope = JSON.parse(crypto26.decodeBase64StringUtf8(segments[0]));
43101
+ envelope = JSON.parse(crypto27.decodeBase64StringUtf8(segments[0]));
43094
43102
  } catch (err9) {
43095
43103
  if (err9 instanceof Error) {
43096
43104
  err9.message = `Can't parse token envelope: ${segments[0]}': ${err9.message}`;
@@ -43101,7 +43109,7 @@ var require_oauth2client = __commonJS({
43101
43109
  throw new Error("Can't parse token envelope: " + segments[0]);
43102
43110
  }
43103
43111
  try {
43104
- payload3 = JSON.parse(crypto26.decodeBase64StringUtf8(segments[1]));
43112
+ payload3 = JSON.parse(crypto27.decodeBase64StringUtf8(segments[1]));
43105
43113
  } catch (err9) {
43106
43114
  if (err9 instanceof Error) {
43107
43115
  err9.message = `Can't parse token payload '${segments[0]}`;
@@ -43118,7 +43126,7 @@ var require_oauth2client = __commonJS({
43118
43126
  if (envelope.alg === "ES256") {
43119
43127
  signature = formatEcdsa.joseToDer(signature, "ES256").toString("base64");
43120
43128
  }
43121
- const verified = await crypto26.verify(cert, signed, signature);
43129
+ const verified = await crypto27.verify(cert, signed, signature);
43122
43130
  if (!verified) {
43123
43131
  throw new Error("Invalid token signature: " + jwt3);
43124
43132
  }
@@ -43486,14 +43494,14 @@ var require_buffer_equal_constant_time = __commonJS({
43486
43494
  var require_jwa = __commonJS({
43487
43495
  "node_modules/.pnpm/jwa@2.0.1/node_modules/jwa/index.js"(exports2, module2) {
43488
43496
  var Buffer5 = require_safe_buffer().Buffer;
43489
- var crypto26 = require("crypto");
43497
+ var crypto27 = require("crypto");
43490
43498
  var formatEcdsa = require_ecdsa_sig_formatter();
43491
43499
  var util3 = require("util");
43492
43500
  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".';
43493
43501
  var MSG_INVALID_SECRET = "secret must be a string or buffer";
43494
43502
  var MSG_INVALID_VERIFIER_KEY = "key must be a string or a buffer";
43495
43503
  var MSG_INVALID_SIGNER_KEY = "key must be a string, a buffer or an object";
43496
- var supportsKeyObjects = typeof crypto26.createPublicKey === "function";
43504
+ var supportsKeyObjects = typeof crypto27.createPublicKey === "function";
43497
43505
  if (supportsKeyObjects) {
43498
43506
  MSG_INVALID_VERIFIER_KEY += " or a KeyObject";
43499
43507
  MSG_INVALID_SECRET += "or a KeyObject";
@@ -43583,17 +43591,17 @@ var require_jwa = __commonJS({
43583
43591
  return function sign(thing, secret) {
43584
43592
  checkIsSecretKey(secret);
43585
43593
  thing = normalizeInput(thing);
43586
- var hmac3 = crypto26.createHmac("sha" + bits, secret);
43594
+ var hmac3 = crypto27.createHmac("sha" + bits, secret);
43587
43595
  var sig = (hmac3.update(thing), hmac3.digest("base64"));
43588
43596
  return fromBase6415(sig);
43589
43597
  };
43590
43598
  }
43591
43599
  var bufferEqual;
43592
- var timingSafeEqual = "timingSafeEqual" in crypto26 ? function timingSafeEqual2(a13, b16) {
43600
+ var timingSafeEqual = "timingSafeEqual" in crypto27 ? function timingSafeEqual2(a13, b16) {
43593
43601
  if (a13.byteLength !== b16.byteLength) {
43594
43602
  return false;
43595
43603
  }
43596
- return crypto26.timingSafeEqual(a13, b16);
43604
+ return crypto27.timingSafeEqual(a13, b16);
43597
43605
  } : function timingSafeEqual2(a13, b16) {
43598
43606
  if (!bufferEqual) {
43599
43607
  bufferEqual = require_buffer_equal_constant_time();
@@ -43610,7 +43618,7 @@ var require_jwa = __commonJS({
43610
43618
  return function sign(thing, privateKey) {
43611
43619
  checkIsPrivateKey(privateKey);
43612
43620
  thing = normalizeInput(thing);
43613
- var signer = crypto26.createSign("RSA-SHA" + bits);
43621
+ var signer = crypto27.createSign("RSA-SHA" + bits);
43614
43622
  var sig = (signer.update(thing), signer.sign(privateKey, "base64"));
43615
43623
  return fromBase6415(sig);
43616
43624
  };
@@ -43620,7 +43628,7 @@ var require_jwa = __commonJS({
43620
43628
  checkIsPublicKey(publicKey);
43621
43629
  thing = normalizeInput(thing);
43622
43630
  signature = toBase6415(signature);
43623
- var verifier = crypto26.createVerify("RSA-SHA" + bits);
43631
+ var verifier = crypto27.createVerify("RSA-SHA" + bits);
43624
43632
  verifier.update(thing);
43625
43633
  return verifier.verify(publicKey, signature, "base64");
43626
43634
  };
@@ -43629,11 +43637,11 @@ var require_jwa = __commonJS({
43629
43637
  return function sign(thing, privateKey) {
43630
43638
  checkIsPrivateKey(privateKey);
43631
43639
  thing = normalizeInput(thing);
43632
- var signer = crypto26.createSign("RSA-SHA" + bits);
43640
+ var signer = crypto27.createSign("RSA-SHA" + bits);
43633
43641
  var sig = (signer.update(thing), signer.sign({
43634
43642
  key: privateKey,
43635
- padding: crypto26.constants.RSA_PKCS1_PSS_PADDING,
43636
- saltLength: crypto26.constants.RSA_PSS_SALTLEN_DIGEST
43643
+ padding: crypto27.constants.RSA_PKCS1_PSS_PADDING,
43644
+ saltLength: crypto27.constants.RSA_PSS_SALTLEN_DIGEST
43637
43645
  }, "base64"));
43638
43646
  return fromBase6415(sig);
43639
43647
  };
@@ -43643,12 +43651,12 @@ var require_jwa = __commonJS({
43643
43651
  checkIsPublicKey(publicKey);
43644
43652
  thing = normalizeInput(thing);
43645
43653
  signature = toBase6415(signature);
43646
- var verifier = crypto26.createVerify("RSA-SHA" + bits);
43654
+ var verifier = crypto27.createVerify("RSA-SHA" + bits);
43647
43655
  verifier.update(thing);
43648
43656
  return verifier.verify({
43649
43657
  key: publicKey,
43650
- padding: crypto26.constants.RSA_PKCS1_PSS_PADDING,
43651
- saltLength: crypto26.constants.RSA_PSS_SALTLEN_DIGEST
43658
+ padding: crypto27.constants.RSA_PKCS1_PSS_PADDING,
43659
+ saltLength: crypto27.constants.RSA_PSS_SALTLEN_DIGEST
43652
43660
  }, signature, "base64");
43653
43661
  };
43654
43662
  }
@@ -45806,14 +45814,14 @@ var require_awsrequestsigner = __commonJS({
45806
45814
  }
45807
45815
  };
45808
45816
  exports2.AwsRequestSigner = AwsRequestSigner;
45809
- async function sign(crypto26, key, msg) {
45810
- return await crypto26.signWithHmacSha256(key, msg);
45811
- }
45812
- async function getSigningKey(crypto26, key, dateStamp, region, serviceName) {
45813
- const kDate = await sign(crypto26, `AWS4${key}`, dateStamp);
45814
- const kRegion = await sign(crypto26, kDate, region);
45815
- const kService = await sign(crypto26, kRegion, serviceName);
45816
- const kSigning = await sign(crypto26, kService, "aws4_request");
45817
+ async function sign(crypto27, key, msg) {
45818
+ return await crypto27.signWithHmacSha256(key, msg);
45819
+ }
45820
+ async function getSigningKey(crypto27, key, dateStamp, region, serviceName) {
45821
+ const kDate = await sign(crypto27, `AWS4${key}`, dateStamp);
45822
+ const kRegion = await sign(crypto27, kDate, region);
45823
+ const kService = await sign(crypto27, kRegion, serviceName);
45824
+ const kSigning = await sign(crypto27, kService, "aws4_request");
45817
45825
  return kSigning;
45818
45826
  }
45819
45827
  async function generateAuthenticationHeaderMap(options2) {
@@ -47398,24 +47406,24 @@ var require_googleauth = __commonJS({
47398
47406
  const signed = await client.sign(data3);
47399
47407
  return signed.signedBlob;
47400
47408
  }
47401
- const crypto26 = (0, crypto_1.createCrypto)();
47409
+ const crypto27 = (0, crypto_1.createCrypto)();
47402
47410
  if (client instanceof jwtclient_1.JWT && client.key) {
47403
- const sign = await crypto26.sign(client.key, data3);
47411
+ const sign = await crypto27.sign(client.key, data3);
47404
47412
  return sign;
47405
47413
  }
47406
47414
  const creds = await this.getCredentials();
47407
47415
  if (!creds.client_email) {
47408
47416
  throw new Error("Cannot sign data without `client_email`.");
47409
47417
  }
47410
- return this.signBlob(crypto26, creds.client_email, data3, endpoint);
47418
+ return this.signBlob(crypto27, creds.client_email, data3, endpoint);
47411
47419
  }
47412
- async signBlob(crypto26, emailOrUniqueId, data3, endpoint) {
47420
+ async signBlob(crypto27, emailOrUniqueId, data3, endpoint) {
47413
47421
  const url3 = new URL(endpoint + `${emailOrUniqueId}:signBlob`);
47414
47422
  const res = await this.request({
47415
47423
  method: "POST",
47416
47424
  url: url3.href,
47417
47425
  data: {
47418
- payload: crypto26.encodeBase64StringUtf8(data3)
47426
+ payload: crypto27.encodeBase64StringUtf8(data3)
47419
47427
  },
47420
47428
  retry: true,
47421
47429
  retryConfig: {
@@ -689063,8 +689071,8 @@ ${success2(`Workspace account ready: ${workspaceAccount.email}`)}`);
689063
689071
  message: "AI model:",
689064
689072
  choices: [
689065
689073
  { title: "Claude Opus 4.8", value: CLAUDE_OPUS_MODEL },
689066
- { title: "Claude Sonnet 4.6", value: CLAUDE_SONNET_MODEL },
689067
- { title: "GPT-5.5", value: GPT_MODEL }
689074
+ { title: "Claude Sonnet 5", value: CLAUDE_SONNET_MODEL },
689075
+ { title: "GPT-5.6 Sol", value: GPT_HEAVY_MODEL }
689068
689076
  ],
689069
689077
  initial: 0
689070
689078
  });
@@ -689203,13 +689211,13 @@ var uuid42;
689203
689211
  var init_uuid2 = __esm({
689204
689212
  "node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.3.6/node_modules/@anthropic-ai/sdk/internal/utils/uuid.mjs"() {
689205
689213
  uuid42 = function() {
689206
- const { crypto: crypto26 } = globalThis;
689207
- if (crypto26?.randomUUID) {
689208
- uuid42 = crypto26.randomUUID.bind(crypto26);
689209
- return crypto26.randomUUID();
689214
+ const { crypto: crypto27 } = globalThis;
689215
+ if (crypto27?.randomUUID) {
689216
+ uuid42 = crypto27.randomUUID.bind(crypto27);
689217
+ return crypto27.randomUUID();
689210
689218
  }
689211
689219
  const u8 = new Uint8Array(1);
689212
- const randomByte = crypto26 ? () => crypto26.getRandomValues(u8)[0] : () => Math.random() * 255 & 255;
689220
+ const randomByte = crypto27 ? () => crypto27.getRandomValues(u8)[0] : () => Math.random() * 255 & 255;
689213
689221
  return "10000000-1000-4000-8000-100000000000".replace(/[018]/g, (c13) => (+c13 ^ randomByte() & 15 >> +c13 / 4).toString(16));
689214
689222
  };
689215
689223
  }
@@ -702622,9 +702630,9 @@ var require_dist_cjs12 = __commonJS({
702622
702630
  httpHandler: httpHandlerExtensionConfiguration.httpHandler()
702623
702631
  };
702624
702632
  }, "resolveHttpHandlerRuntimeConfig");
702625
- var import_types101 = require_dist_cjs11();
702633
+ var import_types102 = require_dist_cjs11();
702626
702634
  var _Field = class _Field {
702627
- constructor({ name, kind = import_types101.FieldPosition.HEADER, values = [] }) {
702635
+ constructor({ name, kind = import_types102.FieldPosition.HEADER, values = [] }) {
702628
702636
  this.name = name;
702629
702637
  this.kind = kind;
702630
702638
  this.values = values;
@@ -702932,8 +702940,8 @@ var require_dist_cjs14 = __commonJS({
702932
702940
  normalizeProvider: () => normalizeProvider10
702933
702941
  });
702934
702942
  module2.exports = __toCommonJS2(src_exports2);
702935
- var import_types101 = require_dist_cjs13();
702936
- var getSmithyContext15 = /* @__PURE__ */ __name((context2) => context2[import_types101.SMITHY_CONTEXT_KEY] || (context2[import_types101.SMITHY_CONTEXT_KEY] = {}), "getSmithyContext");
702943
+ var import_types102 = require_dist_cjs13();
702944
+ var getSmithyContext15 = /* @__PURE__ */ __name((context2) => context2[import_types102.SMITHY_CONTEXT_KEY] || (context2[import_types102.SMITHY_CONTEXT_KEY] = {}), "getSmithyContext");
702937
702945
  var normalizeProvider10 = /* @__PURE__ */ __name((input) => {
702938
702946
  if (typeof input === "function")
702939
702947
  return input;
@@ -738941,7 +738949,7 @@ var require_dist_cjs66 = __commonJS({
738941
738949
  var utilBufferFrom = require_dist_cjs7();
738942
738950
  var utilUtf8 = require_dist_cjs8();
738943
738951
  var buffer = require("buffer");
738944
- var crypto26 = require("crypto");
738952
+ var crypto27 = require("crypto");
738945
738953
  var Hash11 = class {
738946
738954
  algorithmIdentifier;
738947
738955
  secret;
@@ -738958,7 +738966,7 @@ var require_dist_cjs66 = __commonJS({
738958
738966
  return Promise.resolve(this.hash.digest());
738959
738967
  }
738960
738968
  reset() {
738961
- this.hash = this.secret ? crypto26.createHmac(this.algorithmIdentifier, castSourceData2(this.secret)) : crypto26.createHash(this.algorithmIdentifier);
738969
+ this.hash = this.secret ? crypto27.createHmac(this.algorithmIdentifier, castSourceData2(this.secret)) : crypto27.createHash(this.algorithmIdentifier);
738962
738970
  }
738963
738971
  };
738964
738972
  function castSourceData2(toCast, encoding) {
@@ -757551,7 +757559,7 @@ var require_dist_cjs100 = __commonJS({
757551
757559
  const fromContext = context2.streamCollector(streamBody);
757552
757560
  return import_util_stream3.Uint8ArrayBlobAdapter.mutate(await fromContext);
757553
757561
  }, "collectBody");
757554
- var import_types101 = require_dist_cjs11();
757562
+ var import_types102 = require_dist_cjs11();
757555
757563
  var _Command = class _Command {
757556
757564
  constructor() {
757557
757565
  this.middlewareStack = (0, import_middleware_stack.constructStack)();
@@ -757587,7 +757595,7 @@ var require_dist_cjs100 = __commonJS({
757587
757595
  commandName,
757588
757596
  inputFilterSensitiveLog,
757589
757597
  outputFilterSensitiveLog,
757590
- [import_types101.SMITHY_CONTEXT_KEY]: {
757598
+ [import_types102.SMITHY_CONTEXT_KEY]: {
757591
757599
  ...smithyContext
757592
757600
  },
757593
757601
  ...additionalContext
@@ -758273,8 +758281,8 @@ var require_dist_cjs100 = __commonJS({
758273
758281
  }, "emitWarningIfUnsupportedVersion");
758274
758282
  var getChecksumConfiguration2 = /* @__PURE__ */ __name((runtimeConfig) => {
758275
758283
  const checksumAlgorithms = [];
758276
- for (const id3 in import_types101.AlgorithmId) {
758277
- const algorithmId = import_types101.AlgorithmId[id3];
758284
+ for (const id3 in import_types102.AlgorithmId) {
758285
+ const algorithmId = import_types102.AlgorithmId[id3];
758278
758286
  if (runtimeConfig[algorithmId] === void 0) {
758279
758287
  continue;
758280
758288
  }
@@ -765263,13 +765271,13 @@ var uuid43;
765263
765271
  var init_uuid3 = __esm({
765264
765272
  "node_modules/.pnpm/@anthropic-ai+sdk@0.91.1_zod@4.3.6/node_modules/@anthropic-ai/sdk/internal/utils/uuid.mjs"() {
765265
765273
  uuid43 = function() {
765266
- const { crypto: crypto26 } = globalThis;
765267
- if (crypto26?.randomUUID) {
765268
- uuid43 = crypto26.randomUUID.bind(crypto26);
765269
- return crypto26.randomUUID();
765274
+ const { crypto: crypto27 } = globalThis;
765275
+ if (crypto27?.randomUUID) {
765276
+ uuid43 = crypto27.randomUUID.bind(crypto27);
765277
+ return crypto27.randomUUID();
765270
765278
  }
765271
765279
  const u8 = new Uint8Array(1);
765272
- const randomByte = crypto26 ? () => crypto26.getRandomValues(u8)[0] : () => Math.random() * 255 & 255;
765280
+ const randomByte = crypto27 ? () => crypto27.getRandomValues(u8)[0] : () => Math.random() * 255 & 255;
765273
765281
  return "10000000-1000-4000-8000-100000000000".replace(/[018]/g, (c13) => (+c13 ^ randomByte() & 15 >> +c13 / 4).toString(16));
765274
765282
  };
765275
765283
  }
@@ -790780,13 +790788,13 @@ var uuid44;
790780
790788
  var init_uuid4 = __esm({
790781
790789
  "node_modules/.pnpm/openai@6.26.0_ws@8.20.0_zod@4.3.6/node_modules/openai/internal/utils/uuid.mjs"() {
790782
790790
  uuid44 = function() {
790783
- const { crypto: crypto26 } = globalThis;
790784
- if (crypto26?.randomUUID) {
790785
- uuid44 = crypto26.randomUUID.bind(crypto26);
790786
- return crypto26.randomUUID();
790791
+ const { crypto: crypto27 } = globalThis;
790792
+ if (crypto27?.randomUUID) {
790793
+ uuid44 = crypto27.randomUUID.bind(crypto27);
790794
+ return crypto27.randomUUID();
790787
790795
  }
790788
790796
  const u8 = new Uint8Array(1);
790789
- const randomByte = crypto26 ? () => crypto26.getRandomValues(u8)[0] : () => Math.random() * 255 & 255;
790797
+ const randomByte = crypto27 ? () => crypto27.getRandomValues(u8)[0] : () => Math.random() * 255 & 255;
790790
790798
  return "10000000-1000-4000-8000-100000000000".replace(/[018]/g, (c13) => (+c13 ^ randomByte() & 15 >> +c13 / 4).toString(16));
790791
790799
  };
790792
790800
  }
@@ -808011,22 +808019,22 @@ var require_crypto5 = __commonJS({
808011
808019
  "use strict";
808012
808020
  Object.defineProperty(exports2, "__esModule", { value: true });
808013
808021
  exports2.NodeCrypto = void 0;
808014
- var crypto26 = require("crypto");
808022
+ var crypto27 = require("crypto");
808015
808023
  var NodeCrypto = class {
808016
808024
  async sha256DigestBase64(str4) {
808017
- return crypto26.createHash("sha256").update(str4).digest("base64");
808025
+ return crypto27.createHash("sha256").update(str4).digest("base64");
808018
808026
  }
808019
808027
  randomBytesBase64(count) {
808020
- return crypto26.randomBytes(count).toString("base64");
808028
+ return crypto27.randomBytes(count).toString("base64");
808021
808029
  }
808022
808030
  async verify(pubkey, data3, signature) {
808023
- const verifier = crypto26.createVerify("RSA-SHA256");
808031
+ const verifier = crypto27.createVerify("RSA-SHA256");
808024
808032
  verifier.update(data3);
808025
808033
  verifier.end();
808026
808034
  return verifier.verify(pubkey, signature, "base64");
808027
808035
  }
808028
808036
  async sign(privateKey, data3) {
808029
- const signer = crypto26.createSign("RSA-SHA256");
808037
+ const signer = crypto27.createSign("RSA-SHA256");
808030
808038
  signer.update(data3);
808031
808039
  signer.end();
808032
808040
  return signer.sign(privateKey, "base64");
@@ -808044,7 +808052,7 @@ var require_crypto5 = __commonJS({
808044
808052
  * string in hexadecimal encoding.
808045
808053
  */
808046
808054
  async sha256DigestHex(str4) {
808047
- return crypto26.createHash("sha256").update(str4).digest("hex");
808055
+ return crypto27.createHash("sha256").update(str4).digest("hex");
808048
808056
  }
808049
808057
  /**
808050
808058
  * Computes the HMAC hash of a message using the provided crypto key and the
@@ -808056,7 +808064,7 @@ var require_crypto5 = __commonJS({
808056
808064
  */
808057
808065
  async signWithHmacSha256(key, msg) {
808058
808066
  const cryptoKey = typeof key === "string" ? key : toBuffer(key);
808059
- return toArrayBuffer(crypto26.createHmac("sha256", cryptoKey).update(msg).digest());
808067
+ return toArrayBuffer(crypto27.createHmac("sha256", cryptoKey).update(msg).digest());
808060
808068
  }
808061
808069
  };
808062
808070
  exports2.NodeCrypto = NodeCrypto;
@@ -808749,10 +808757,10 @@ var require_oauth2client2 = __commonJS({
808749
808757
  * https://github.com/googleapis/google-auth-library-nodejs/blob/main/samples/oauth2-codeVerifier.js
808750
808758
  */
808751
808759
  async generateCodeVerifierAsync() {
808752
- const crypto26 = (0, crypto_1.createCrypto)();
808753
- const randomString3 = crypto26.randomBytesBase64(96);
808760
+ const crypto27 = (0, crypto_1.createCrypto)();
808761
+ const randomString3 = crypto27.randomBytesBase64(96);
808754
808762
  const codeVerifier = randomString3.replace(/\+/g, "~").replace(/=/g, "_").replace(/\//g, "-");
808755
- const unencodedCodeChallenge = await crypto26.sha256DigestBase64(codeVerifier);
808763
+ const unencodedCodeChallenge = await crypto27.sha256DigestBase64(codeVerifier);
808756
808764
  const codeChallenge = unencodedCodeChallenge.split("=")[0].replace(/\+/g, "-").replace(/\//g, "_");
808757
808765
  return { codeVerifier, codeChallenge };
808758
808766
  }
@@ -809193,7 +809201,7 @@ var require_oauth2client2 = __commonJS({
809193
809201
  * @return Returns a promise resolving to LoginTicket on verification.
809194
809202
  */
809195
809203
  async verifySignedJwtWithCertsAsync(jwt3, certs, requiredAudience, issuers, maxExpiry) {
809196
- const crypto26 = (0, crypto_1.createCrypto)();
809204
+ const crypto27 = (0, crypto_1.createCrypto)();
809197
809205
  if (!maxExpiry) {
809198
809206
  maxExpiry = _OAuth2Client.DEFAULT_MAX_TOKEN_LIFETIME_SECS_;
809199
809207
  }
@@ -809206,7 +809214,7 @@ var require_oauth2client2 = __commonJS({
809206
809214
  let envelope;
809207
809215
  let payload3;
809208
809216
  try {
809209
- envelope = JSON.parse(crypto26.decodeBase64StringUtf8(segments[0]));
809217
+ envelope = JSON.parse(crypto27.decodeBase64StringUtf8(segments[0]));
809210
809218
  } catch (err9) {
809211
809219
  if (err9 instanceof Error) {
809212
809220
  err9.message = `Can't parse token envelope: ${segments[0]}': ${err9.message}`;
@@ -809217,7 +809225,7 @@ var require_oauth2client2 = __commonJS({
809217
809225
  throw new Error("Can't parse token envelope: " + segments[0]);
809218
809226
  }
809219
809227
  try {
809220
- payload3 = JSON.parse(crypto26.decodeBase64StringUtf8(segments[1]));
809228
+ payload3 = JSON.parse(crypto27.decodeBase64StringUtf8(segments[1]));
809221
809229
  } catch (err9) {
809222
809230
  if (err9 instanceof Error) {
809223
809231
  err9.message = `Can't parse token payload '${segments[0]}`;
@@ -809234,7 +809242,7 @@ var require_oauth2client2 = __commonJS({
809234
809242
  if (envelope.alg === "ES256") {
809235
809243
  signature = formatEcdsa.joseToDer(signature, "ES256").toString("base64");
809236
809244
  }
809237
- const verified = await crypto26.verify(cert, signed, signature);
809245
+ const verified = await crypto27.verify(cert, signed, signature);
809238
809246
  if (!verified) {
809239
809247
  throw new Error("Invalid token signature: " + jwt3);
809240
809248
  }
@@ -811804,14 +811812,14 @@ var require_awsrequestsigner2 = __commonJS({
811804
811812
  }
811805
811813
  };
811806
811814
  exports2.AwsRequestSigner = AwsRequestSigner;
811807
- async function sign(crypto26, key, msg) {
811808
- return await crypto26.signWithHmacSha256(key, msg);
811809
- }
811810
- async function getSigningKey(crypto26, key, dateStamp, region, serviceName) {
811811
- const kDate = await sign(crypto26, `AWS4${key}`, dateStamp);
811812
- const kRegion = await sign(crypto26, kDate, region);
811813
- const kService = await sign(crypto26, kRegion, serviceName);
811814
- const kSigning = await sign(crypto26, kService, "aws4_request");
811815
+ async function sign(crypto27, key, msg) {
811816
+ return await crypto27.signWithHmacSha256(key, msg);
811817
+ }
811818
+ async function getSigningKey(crypto27, key, dateStamp, region, serviceName) {
811819
+ const kDate = await sign(crypto27, `AWS4${key}`, dateStamp);
811820
+ const kRegion = await sign(crypto27, kDate, region);
811821
+ const kService = await sign(crypto27, kRegion, serviceName);
811822
+ const kSigning = await sign(crypto27, kService, "aws4_request");
811815
811823
  return kSigning;
811816
811824
  }
811817
811825
  async function generateAuthenticationHeaderMap(options2) {
@@ -813530,24 +813538,24 @@ var require_googleauth2 = __commonJS({
813530
813538
  const signed = await client.sign(data3);
813531
813539
  return signed.signedBlob;
813532
813540
  }
813533
- const crypto26 = (0, crypto_1.createCrypto)();
813541
+ const crypto27 = (0, crypto_1.createCrypto)();
813534
813542
  if (client instanceof jwtclient_1.JWT && client.key) {
813535
- const sign = await crypto26.sign(client.key, data3);
813543
+ const sign = await crypto27.sign(client.key, data3);
813536
813544
  return sign;
813537
813545
  }
813538
813546
  const creds = await this.getCredentials();
813539
813547
  if (!creds.client_email) {
813540
813548
  throw new Error("Cannot sign data without `client_email`.");
813541
813549
  }
813542
- return this.signBlob(crypto26, creds.client_email, data3, endpoint);
813550
+ return this.signBlob(crypto27, creds.client_email, data3, endpoint);
813543
813551
  }
813544
- async signBlob(crypto26, emailOrUniqueId, data3, endpoint) {
813552
+ async signBlob(crypto27, emailOrUniqueId, data3, endpoint) {
813545
813553
  const url3 = new URL(endpoint + `${emailOrUniqueId}:signBlob`);
813546
813554
  const res = await this.request({
813547
813555
  method: "POST",
813548
813556
  url: url3.href,
813549
813557
  data: {
813550
- payload: crypto26.encodeBase64StringUtf8(data3)
813558
+ payload: crypto27.encodeBase64StringUtf8(data3)
813551
813559
  },
813552
813560
  retry: true,
813553
813561
  retryConfig: {
@@ -833679,13 +833687,13 @@ var init_node2 = __esm({
833679
833687
  }
833680
833688
  };
833681
833689
  uuid4Internal = function() {
833682
- const { crypto: crypto26 } = globalThis;
833683
- if (crypto26 === null || crypto26 === void 0 ? void 0 : crypto26.randomUUID) {
833684
- uuid4Internal = crypto26.randomUUID.bind(crypto26);
833685
- return crypto26.randomUUID();
833690
+ const { crypto: crypto27 } = globalThis;
833691
+ if (crypto27 === null || crypto27 === void 0 ? void 0 : crypto27.randomUUID) {
833692
+ uuid4Internal = crypto27.randomUUID.bind(crypto27);
833693
+ return crypto27.randomUUID();
833686
833694
  }
833687
833695
  const u8 = new Uint8Array(1);
833688
- const randomByte = crypto26 ? () => crypto26.getRandomValues(u8)[0] : () => Math.random() * 255 & 255;
833696
+ const randomByte = crypto27 ? () => crypto27.getRandomValues(u8)[0] : () => Math.random() * 255 & 255;
833689
833697
  return "10000000-1000-4000-8000-100000000000".replace(/[018]/g, (c13) => (+c13 ^ randomByte() & 15 >> +c13 / 4).toString(16));
833690
833698
  };
833691
833699
  uuid45 = () => uuid4Internal();
@@ -927738,7 +927746,7 @@ function isOpenAIProvider(provider) {
927738
927746
  return provider === "openai" || provider === "azure-openai";
927739
927747
  }
927740
927748
  function isGptModel(model) {
927741
- return model === "gpt-5.5";
927749
+ return model.startsWith("gpt-");
927742
927750
  }
927743
927751
  function getProviderLabel(provider) {
927744
927752
  switch (provider) {
@@ -927860,13 +927868,6 @@ function getModelId(config3, options2 = {}) {
927860
927868
  return `${NINEROUTER_MODEL_PREFIX}${CLAUDE_OPUS_MODEL}`;
927861
927869
  return CLAUDE_OPUS_MODEL;
927862
927870
  }
927863
- if (config3.model === CLAUDE_OPUS_4_6_MODEL) {
927864
- if (config3.provider === "bedrock")
927865
- return BEDROCK_CLAUDE_OPUS_4_6_MODEL;
927866
- if (config3.provider === "9router")
927867
- return `${NINEROUTER_MODEL_PREFIX}${CLAUDE_OPUS_4_6_MODEL}`;
927868
- return CLAUDE_OPUS_4_6_MODEL;
927869
- }
927870
927871
  return OPENAI_MODEL;
927871
927872
  }
927872
927873
  function getFastResponderModelId(config3) {
@@ -927875,7 +927876,7 @@ function getFastResponderModelId(config3) {
927875
927876
  logRouteSelection(config3, routeSelection.modelId, routeSelection, "fast_responder");
927876
927877
  return routeSelection.modelId;
927877
927878
  }
927878
- if (config3.model === CLAUDE_OPUS_MODEL || config3.model === CLAUDE_OPUS_4_6_MODEL || config3.model === CLAUDE_SONNET_MODEL) {
927879
+ if (config3.model === CLAUDE_OPUS_MODEL || config3.model === CLAUDE_SONNET_MODEL) {
927879
927880
  if (config3.provider === "bedrock")
927880
927881
  return BEDROCK_CLAUDE_SONNET_MODEL;
927881
927882
  if (config3.provider === "9router")
@@ -928048,12 +928049,6 @@ function resolvePiSideCallModel(config3, options2 = {}) {
928048
928049
  apiKey
928049
928050
  };
928050
928051
  }
928051
- if (modelId === "gpt-5.5" || modelId === "gpt-5.5-pro") {
928052
- return {
928053
- model: getModel("openai", modelId),
928054
- apiKey: requireConfigSetting("openaiApiKey", resolveOpenAIApiKey(config3))
928055
- };
928056
- }
928057
928052
  return {
928058
928053
  model: {
928059
928054
  id: modelId,
@@ -928219,7 +928214,7 @@ var init_model_provider = __esm({
928219
928214
  isDevMode = process.argv[1]?.endsWith(".ts") ?? false;
928220
928215
  proxyHandle = null;
928221
928216
  NINEROUTER_MODEL_PREFIX = "";
928222
- OPENAI_MODEL = GPT_MODEL;
928217
+ OPENAI_MODEL = GPT_HEAVY_MODEL;
928223
928218
  activeProviderRoutes = [];
928224
928219
  DEFAULT_TIER_BY_USE_CASE = {
928225
928220
  main_general: "heavy",
@@ -928334,6 +928329,34 @@ var init_event_trigger_credentials = __esm({
928334
928329
  }
928335
928330
  });
928336
928331
 
928332
+ // dist/agent/external-context/runtime.js
928333
+ function setCurrentExternalContext(section, digest) {
928334
+ currentExternalContextSection = section;
928335
+ currentExternalContextDigest = digest;
928336
+ }
928337
+ function clearCurrentExternalContext() {
928338
+ currentExternalContextSection = "";
928339
+ currentExternalContextDigest = null;
928340
+ }
928341
+ function getCurrentExternalContextDigest() {
928342
+ return currentExternalContextDigest;
928343
+ }
928344
+ function appendCurrentExternalContext(basePrompt) {
928345
+ if (!currentExternalContextSection.trim())
928346
+ return basePrompt;
928347
+ return `${basePrompt}
928348
+
928349
+ ${currentExternalContextSection}`;
928350
+ }
928351
+ var currentExternalContextSection, currentExternalContextDigest;
928352
+ var init_runtime = __esm({
928353
+ "dist/agent/external-context/runtime.js"() {
928354
+ "use strict";
928355
+ currentExternalContextSection = "";
928356
+ currentExternalContextDigest = null;
928357
+ }
928358
+ });
928359
+
928337
928360
  // dist/agent/system-prompt.js
928338
928361
  function buildSystemPrompt(config3, ownerConfig) {
928339
928362
  const runtimeName = getRuntimeLabel(config3);
@@ -928348,7 +928371,7 @@ function buildSystemPrompt(config3, ownerConfig) {
928348
928371
  memoryEnabled = state4.memoryEnabled;
928349
928372
  } catch {
928350
928373
  }
928351
- return `# Identity
928374
+ return appendCurrentExternalContext(`# Identity
928352
928375
 
928353
928376
  You are ${config3.displayName ?? config3.agentName}, a personal desktop assistant. You are a long-running autonomous agent that owns and fully controls a computer (${process.platform === "darwin" ? "macOS" : "Windows"}).
928354
928377
 
@@ -928555,7 +928578,7 @@ Your memory files capture what you explicitly saved. But many conversations, dec
928555
928578
  - Check memory files first \u2014 they are curated and fast
928556
928579
  - Use transcript search when memory files don't have what you need, or when the user asks about past conversations specifically
928557
928580
  - Transcript search covers everything discussed, not just what was explicitly saved
928558
- ` : ""}`;
928581
+ ` : ""}`);
928559
928582
  }
928560
928583
  function getEnabledChannels(config3) {
928561
928584
  const channels = [];
@@ -928579,6 +928602,7 @@ var init_system_prompt = __esm({
928579
928602
  init_engine_factory();
928580
928603
  init_financial_tool_credentials();
928581
928604
  init_event_trigger_credentials();
928605
+ init_runtime();
928582
928606
  }
928583
928607
  });
928584
928608
 
@@ -984428,13 +984452,13 @@ var init_node4 = __esm({
984428
984452
  }
984429
984453
  };
984430
984454
  uuid4Internal2 = function() {
984431
- const { crypto: crypto26 } = globalThis;
984432
- if (crypto26 === null || crypto26 === void 0 ? void 0 : crypto26.randomUUID) {
984433
- uuid4Internal2 = crypto26.randomUUID.bind(crypto26);
984434
- return crypto26.randomUUID();
984455
+ const { crypto: crypto27 } = globalThis;
984456
+ if (crypto27 === null || crypto27 === void 0 ? void 0 : crypto27.randomUUID) {
984457
+ uuid4Internal2 = crypto27.randomUUID.bind(crypto27);
984458
+ return crypto27.randomUUID();
984435
984459
  }
984436
984460
  const u8 = new Uint8Array(1);
984437
- const randomByte = crypto26 ? () => crypto26.getRandomValues(u8)[0] : () => Math.random() * 255 & 255;
984461
+ const randomByte = crypto27 ? () => crypto27.getRandomValues(u8)[0] : () => Math.random() * 255 & 255;
984438
984462
  return "10000000-1000-4000-8000-100000000000".replace(/[018]/g, (c13) => (+c13 ^ randomByte() & 15 >> +c13 / 4).toString(16));
984439
984463
  };
984440
984464
  uuid47 = () => uuid4Internal2();
@@ -990793,7 +990817,7 @@ var init_browser_launcher = __esm({
990793
990817
 
990794
990818
  // dist/utils/playwriter-relay.js
990795
990819
  function isBundled2() {
990796
- const v14 = "0.1.203";
990820
+ const v14 = "0.1.204";
990797
990821
  return typeof v14 === "string" && v14 !== "undefined";
990798
990822
  }
990799
990823
  function resolveRelayEntryPath() {
@@ -990828,7 +990852,7 @@ function getPm2RelayProcess() {
990828
990852
  }
990829
990853
  }
990830
990854
  function pm2Start(entryPath, host, port) {
990831
- const versionStr = "0.1.203";
990855
+ const versionStr = "0.1.204";
990832
990856
  (0, import_node_child_process19.execFileSync)("pm2", ["start", entryPath, "--name", PM2_PROCESS_NAME, "--update-env"], {
990833
990857
  encoding: "utf-8",
990834
990858
  stdio: "pipe",
@@ -990854,7 +990878,7 @@ function pm2Delete() {
990854
990878
  }
990855
990879
  }
990856
990880
  function pm2Restart(host, port) {
990857
- const versionStr = "0.1.203";
990881
+ const versionStr = "0.1.204";
990858
990882
  (0, import_node_child_process19.execFileSync)("pm2", ["restart", PM2_PROCESS_NAME, "--update-env"], {
990859
990883
  encoding: "utf-8",
990860
990884
  stdio: "pipe",
@@ -991024,7 +991048,7 @@ function reconcilePlaywriterRelay(host = "127.0.0.1", port = 19988) {
991024
991048
  pm2Restart(host, port);
991025
991049
  return;
991026
991050
  }
991027
- const currentVersion = "0.1.203";
991051
+ const currentVersion = "0.1.204";
991028
991052
  if (currentEnv.VISIONCLAW_VERSION && currentEnv.VISIONCLAW_VERSION !== currentVersion) {
991029
991053
  logger.system(`Playwriter relay: VisionClaw version changed (${currentEnv.VISIONCLAW_VERSION} \u2192 ${currentVersion}), recreating`);
991030
991054
  pm2Delete();
@@ -992603,6 +992627,7 @@ var init_session = __esm({
992603
992627
  init_claude_transcripts();
992604
992628
  init_image_pruner();
992605
992629
  init_session_trimmer();
992630
+ init_runtime();
992606
992631
  imagePruner = image_pruner_exports;
992607
992632
  sessionTrimmer = session_trimmer_exports;
992608
992633
  COMPACT_LARGE_WINDOW_USED_PCT_THRESHOLD = 0.7;
@@ -992632,6 +992657,7 @@ var init_session = __esm({
992632
992657
  warmQuery = null;
992633
992658
  warmUpPromise = null;
992634
992659
  warmReadyAtMs = null;
992660
+ warmExternalContextDigest = null;
992635
992661
  warmGeneration = 0;
992636
992662
  sessionId;
992637
992663
  transcriptPath = null;
@@ -992962,6 +992988,7 @@ var init_session = __esm({
992962
992988
  const oldAgeMs = this.warmReadyAtMs === null ? null : Date.now() - this.warmReadyAtMs;
992963
992989
  this.warmQuery = null;
992964
992990
  this.warmAbortController = null;
992991
+ this.warmExternalContextDigest = null;
992965
992992
  this.warmReadyAtMs = null;
992966
992993
  try {
992967
992994
  oldAbort?.abort();
@@ -993016,6 +993043,7 @@ var init_session = __esm({
993016
993043
  return;
993017
993044
  }
993018
993045
  const savedSessionId = this.sessionId;
993046
+ const externalContextDigest = getCurrentExternalContextDigest();
993019
993047
  const systemPrompt = this.buildSystemPrompt();
993020
993048
  const warmAbortController = new AbortController();
993021
993049
  const warmStartMs = Date.now();
@@ -993036,6 +993064,7 @@ var init_session = __esm({
993036
993064
  }
993037
993065
  this.warmQuery = warmed;
993038
993066
  this.warmAbortController = warmAbortController;
993067
+ this.warmExternalContextDigest = externalContextDigest;
993039
993068
  this.warmReadyAtMs = Date.now();
993040
993069
  logger.debug(`Claude query pre-warm ready in ${this.warmReadyAtMs - warmStartMs}ms (next refresh in ${WARM_REFRESH_TTL_MS}ms)`);
993041
993070
  this.scheduleWarmRefresh(WARM_REFRESH_TTL_MS);
@@ -993044,6 +993073,7 @@ var init_session = __esm({
993044
993073
  if (generation === this.warmGeneration) {
993045
993074
  this.warmQuery = null;
993046
993075
  this.warmAbortController = null;
993076
+ this.warmExternalContextDigest = null;
993047
993077
  this.warmReadyAtMs = null;
993048
993078
  }
993049
993079
  } finally {
@@ -993077,6 +993107,7 @@ var init_session = __esm({
993077
993107
  return;
993078
993108
  this.warmQuery = null;
993079
993109
  this.warmAbortController = null;
993110
+ this.warmExternalContextDigest = null;
993080
993111
  this.warmReadyAtMs = null;
993081
993112
  try {
993082
993113
  oldAbort?.abort();
@@ -993148,12 +993179,17 @@ Review this summary and continue where you left off. Check your memory and todo
993148
993179
  logger.system("Creating new session...");
993149
993180
  }
993150
993181
  const prompt = messageStream();
993182
+ if (this.warmQuery && this.warmExternalContextDigest !== (options2?.externalContextDigest ?? null)) {
993183
+ logger.debug("Claude pre-warmed subprocess discarded because external context digest changed");
993184
+ this.discardWarmQuery();
993185
+ }
993151
993186
  if (this.warmQuery) {
993152
993187
  this.clearWarmRefreshTimer();
993153
993188
  const warmQuery = this.warmQuery;
993154
993189
  this.warmQuery = null;
993155
993190
  this.abortController = this.warmAbortController;
993156
993191
  this.warmAbortController = null;
993192
+ this.warmExternalContextDigest = null;
993157
993193
  const warmAgeMs = this.warmReadyAtMs === null ? null : Date.now() - this.warmReadyAtMs;
993158
993194
  if (effort) {
993159
993195
  logger.debug(`Claude query using pre-warmed subprocess${warmAgeMs === null ? "" : ` (ready ${warmAgeMs}ms ago)`} (effort=${effort} ignored \u2014 warm subprocess uses pre-built options)`);
@@ -1053377,9 +1053413,9 @@ var init_agent_harness = __esm({
1053377
1053413
 
1053378
1053414
  // node_modules/.pnpm/@earendil-works+pi-agent-core@0.79.9_@modelcontextprotocol+sdk@1.29.0_zod@4.3.6__ws@8.20.0_zod@4.3.6/node_modules/@earendil-works/pi-agent-core/dist/harness/session/uuid.js
1053379
1053415
  function fillRandomBytes(bytes2) {
1053380
- const crypto26 = globalThis.crypto;
1053381
- if (crypto26?.getRandomValues) {
1053382
- crypto26.getRandomValues(bytes2);
1053416
+ const crypto27 = globalThis.crypto;
1053417
+ if (crypto27?.getRandomValues) {
1053418
+ crypto27.getRandomValues(bytes2);
1053383
1053419
  return;
1053384
1053420
  }
1053385
1053421
  for (let i14 = 0; i14 < bytes2.length; i14++) {
@@ -1128724,8 +1128760,8 @@ var require_snapshot_utils = __commonJS({
1128724
1128760
  match: new Set(matchHeaders.map((header) => caseSensitive ? header : header.toLowerCase()))
1128725
1128761
  };
1128726
1128762
  }
1128727
- var crypto26 = runtimeFeatures.has("crypto") ? require("node:crypto") : null;
1128728
- var hashId = crypto26?.hash ? (value2) => crypto26.hash("sha256", value2, "base64url") : (value2) => Buffer.from(value2).toString("base64url");
1128763
+ var crypto27 = runtimeFeatures.has("crypto") ? require("node:crypto") : null;
1128764
+ var hashId = crypto27?.hash ? (value2) => crypto27.hash("sha256", value2, "base64url") : (value2) => Buffer.from(value2).toString("base64url");
1128729
1128765
  function isUndiciHeaders(headers) {
1128730
1128766
  return Array.isArray(headers) && (headers.length & 1) === 0;
1128731
1128767
  }
@@ -1134876,10 +1134912,10 @@ var require_subresource_integrity = __commonJS({
1134876
1134912
  var assert5 = require("node:assert");
1134877
1134913
  var { runtimeFeatures } = require_runtime_features();
1134878
1134914
  var validSRIHashAlgorithmTokenSet = /* @__PURE__ */ new Map([["sha256", 0], ["sha384", 1], ["sha512", 2]]);
1134879
- var crypto26;
1134915
+ var crypto27;
1134880
1134916
  if (runtimeFeatures.has("crypto")) {
1134881
- crypto26 = require("node:crypto");
1134882
- const cryptoHashes = crypto26.getHashes();
1134917
+ crypto27 = require("node:crypto");
1134918
+ const cryptoHashes = crypto27.getHashes();
1134883
1134919
  if (cryptoHashes.length === 0) {
1134884
1134920
  validSRIHashAlgorithmTokenSet.clear();
1134885
1134921
  }
@@ -1134969,7 +1135005,7 @@ var require_subresource_integrity = __commonJS({
1134969
1135005
  return result;
1134970
1135006
  }
1134971
1135007
  var applyAlgorithmToBytes = (algorithm, bytes2) => {
1134972
- return crypto26.hash(algorithm, bytes2, "base64");
1135008
+ return crypto27.hash(algorithm, bytes2, "base64");
1134973
1135009
  };
1134974
1135010
  function caseSensitiveMatch(actualValue, expectedValue) {
1134975
1135011
  let actualValueLength = actualValue.length;
@@ -1137907,7 +1137943,7 @@ var require_connection = __commonJS({
1137907
1137943
  var { WebsocketFrameSend } = require_frame();
1137908
1137944
  var assert5 = require("node:assert");
1137909
1137945
  var { runtimeFeatures } = require_runtime_features();
1137910
- var crypto26 = runtimeFeatures.has("crypto") ? require("node:crypto") : null;
1137946
+ var crypto27 = runtimeFeatures.has("crypto") ? require("node:crypto") : null;
1137911
1137947
  var warningEmitted2 = false;
1137912
1137948
  function establishWebSocketConnection(url3, protocols, client, handler, options2) {
1137913
1137949
  const requestURL = url3;
@@ -1137927,7 +1137963,7 @@ var require_connection = __commonJS({
1137927
1137963
  const headersList = getHeadersList(new Headers3(options2.headers));
1137928
1137964
  request2.headersList = headersList;
1137929
1137965
  }
1137930
- const keyValue = crypto26.randomBytes(16).toString("base64");
1137966
+ const keyValue = crypto27.randomBytes(16).toString("base64");
1137931
1137967
  request2.headersList.append("sec-websocket-key", keyValue, true);
1137932
1137968
  request2.headersList.append("sec-websocket-version", "13", true);
1137933
1137969
  for (const protocol of protocols) {
@@ -1137967,7 +1138003,7 @@ var require_connection = __commonJS({
1137967
1138003
  return;
1137968
1138004
  }
1137969
1138005
  const secWSAccept = response.headersList.get("Sec-WebSocket-Accept");
1137970
- const digest = crypto26.hash("sha1", keyValue + uid, "base64");
1138006
+ const digest = crypto27.hash("sha1", keyValue + uid, "base64");
1137971
1138007
  if (secWSAccept !== digest) {
1137972
1138008
  failWebsocketConnection(handler, 1002, "Incorrect hash received in Sec-WebSocket-Accept header.");
1137973
1138009
  return;
@@ -1257536,7 +1257572,7 @@ var require_helpers2 = __commonJS({
1257536
1257572
  "node_modules/.pnpm/@cypress+request@3.0.10/node_modules/@cypress/request/lib/helpers.js"(exports2) {
1257537
1257573
  "use strict";
1257538
1257574
  var jsonSafeStringify = require_stringify4();
1257539
- var crypto26 = require("crypto");
1257575
+ var crypto27 = require("crypto");
1257540
1257576
  var Buffer5 = require_safe_buffer().Buffer;
1257541
1257577
  var defer = typeof setImmediate === "undefined" ? process.nextTick : setImmediate;
1257542
1257578
  function paramsHaveRequestBody(params) {
@@ -1257552,7 +1257588,7 @@ var require_helpers2 = __commonJS({
1257552
1257588
  return ret2;
1257553
1257589
  }
1257554
1257590
  function md53(str4) {
1257555
- return crypto26.createHash("md5").update(str4).digest("hex");
1257591
+ return crypto27.createHash("md5").update(str4).digest("hex");
1257556
1257592
  }
1257557
1257593
  function isReadStream(rs3) {
1257558
1257594
  return rs3.readable && rs3.path && rs3.mode;
@@ -1257589,7 +1257625,7 @@ var require_helpers2 = __commonJS({
1257589
1257625
  // node_modules/.pnpm/aws-sign2@0.7.0/node_modules/aws-sign2/index.js
1257590
1257626
  var require_aws_sign2 = __commonJS({
1257591
1257627
  "node_modules/.pnpm/aws-sign2@0.7.0/node_modules/aws-sign2/index.js"(exports2, module2) {
1257592
- var crypto26 = require("crypto");
1257628
+ var crypto27 = require("crypto");
1257593
1257629
  var parse12 = require("url").parse;
1257594
1257630
  var keys = [
1257595
1257631
  "acl",
@@ -1257613,7 +1257649,7 @@ var require_aws_sign2 = __commonJS({
1257613
1257649
  module2.exports = authorization;
1257614
1257650
  module2.exports.authorization = authorization;
1257615
1257651
  function hmacSha1(options2) {
1257616
- return crypto26.createHmac("sha1", options2.secret).update(options2.message).digest("base64");
1257652
+ return crypto27.createHmac("sha1", options2.secret).update(options2.message).digest("base64");
1257617
1257653
  }
1257618
1257654
  module2.exports.hmacSha1 = hmacSha1;
1257619
1257655
  function sign(options2) {
@@ -1257760,14 +1257796,14 @@ var require_aws4 = __commonJS({
1257760
1257796
  var aws4 = exports2;
1257761
1257797
  var url3 = require("url");
1257762
1257798
  var querystring = require("querystring");
1257763
- var crypto26 = require("crypto");
1257799
+ var crypto27 = require("crypto");
1257764
1257800
  var lru = require_lru();
1257765
1257801
  var credentialsCache = lru(1e3);
1257766
1257802
  function hmac3(key, string7, encoding) {
1257767
- return crypto26.createHmac("sha256", key).update(string7, "utf8").digest(encoding);
1257803
+ return crypto27.createHmac("sha256", key).update(string7, "utf8").digest(encoding);
1257768
1257804
  }
1257769
1257805
  function hash3(string7, encoding) {
1257770
- return crypto26.createHash("sha256").update(string7, "utf8").digest(encoding);
1257806
+ return crypto27.createHash("sha256").update(string7, "utf8").digest(encoding);
1257771
1257807
  }
1257772
1257808
  function encodeRfc3986(urlEncodedString) {
1257773
1257809
  return urlEncodedString.replace(/[!'()*]/g, function(c13) {
@@ -1262810,22 +1262846,22 @@ var require_nacl_fast = __commonJS({
1262810
1262846
  randombytes = fn2;
1262811
1262847
  };
1262812
1262848
  (function() {
1262813
- var crypto26 = typeof self !== "undefined" ? self.crypto || self.msCrypto : null;
1262814
- if (crypto26 && crypto26.getRandomValues) {
1262849
+ var crypto27 = typeof self !== "undefined" ? self.crypto || self.msCrypto : null;
1262850
+ if (crypto27 && crypto27.getRandomValues) {
1262815
1262851
  var QUOTA = 65536;
1262816
1262852
  nacl.setPRNG(function(x12, n13) {
1262817
1262853
  var i14, v14 = new Uint8Array(n13);
1262818
1262854
  for (i14 = 0; i14 < n13; i14 += QUOTA) {
1262819
- crypto26.getRandomValues(v14.subarray(i14, i14 + Math.min(n13 - i14, QUOTA)));
1262855
+ crypto27.getRandomValues(v14.subarray(i14, i14 + Math.min(n13 - i14, QUOTA)));
1262820
1262856
  }
1262821
1262857
  for (i14 = 0; i14 < n13; i14++) x12[i14] = v14[i14];
1262822
1262858
  cleanup(v14);
1262823
1262859
  });
1262824
1262860
  } else if (typeof require !== "undefined") {
1262825
- crypto26 = require("crypto");
1262826
- if (crypto26 && crypto26.randomBytes) {
1262861
+ crypto27 = require("crypto");
1262862
+ if (crypto27 && crypto27.randomBytes) {
1262827
1262863
  nacl.setPRNG(function(x12, n13) {
1262828
- var i14, v14 = crypto26.randomBytes(n13);
1262864
+ var i14, v14 = crypto27.randomBytes(n13);
1262829
1262865
  for (i14 = 0; i14 < n13; i14++) x12[i14] = v14[i14];
1262830
1262866
  cleanup(v14);
1262831
1262867
  });
@@ -1262863,7 +1262899,7 @@ var require_utils8 = __commonJS({
1262863
1262899
  var Buffer5 = require_safer().Buffer;
1262864
1262900
  var PrivateKey = require_private_key();
1262865
1262901
  var Key3 = require_key();
1262866
- var crypto26 = require("crypto");
1262902
+ var crypto27 = require("crypto");
1262867
1262903
  var algs = require_algs();
1262868
1262904
  var asn1 = require_lib8();
1262869
1262905
  var ec = require_ec();
@@ -1262947,7 +1262983,7 @@ var require_utils8 = __commonJS({
1262947
1262983
  bufs.push(salt);
1262948
1262984
  D8 = Buffer5.concat(bufs);
1262949
1262985
  for (var j14 = 0; j14 < count; ++j14)
1262950
- D8 = crypto26.createHash("md5").update(D8).digest();
1262986
+ D8 = crypto27.createHash("md5").update(D8).digest();
1262951
1262987
  material = Buffer5.concat([material, D8]);
1262952
1262988
  D_prev = D8;
1262953
1262989
  }
@@ -1262969,13 +1263005,13 @@ var require_utils8 = __commonJS({
1262969
1263005
  return Buffer5.concat(ts3).slice(0, size);
1262970
1263006
  function T15(I11) {
1262971
1263007
  hkey.writeUInt32BE(I11, hkey.length - 4);
1262972
- var hmac3 = crypto26.createHmac(hashAlg, passphrase);
1263008
+ var hmac3 = crypto27.createHmac(hashAlg, passphrase);
1262973
1263009
  hmac3.update(hkey);
1262974
1263010
  var Ti3 = hmac3.digest();
1262975
1263011
  var Uc2 = Ti3;
1262976
1263012
  var c13 = 1;
1262977
1263013
  while (c13++ < iterations) {
1262978
- hmac3 = crypto26.createHmac(hashAlg, passphrase);
1263014
+ hmac3 = crypto27.createHmac(hashAlg, passphrase);
1262979
1263015
  hmac3.update(Uc2);
1262980
1263016
  Uc2 = hmac3.digest();
1262981
1263017
  for (var x12 = 0; x12 < Ti3.length; ++x12)
@@ -1263344,7 +1263380,7 @@ var require_signature = __commonJS({
1263344
1263380
  var assert5 = require_assert();
1263345
1263381
  var Buffer5 = require_safer().Buffer;
1263346
1263382
  var algs = require_algs();
1263347
- var crypto26 = require("crypto");
1263383
+ var crypto27 = require("crypto");
1263348
1263384
  var errs = require_errors8();
1263349
1263385
  var utils = require_utils8();
1263350
1263386
  var asn1 = require_lib8();
@@ -1263722,7 +1263758,7 @@ var require_sec = __commonJS({
1263722
1263758
  // node_modules/.pnpm/ecc-jsbn@0.1.2/node_modules/ecc-jsbn/index.js
1263723
1263759
  var require_ecc_jsbn = __commonJS({
1263724
1263760
  "node_modules/.pnpm/ecc-jsbn@0.1.2/node_modules/ecc-jsbn/index.js"(exports2) {
1263725
- var crypto26 = require("crypto");
1263761
+ var crypto27 = require("crypto");
1263726
1263762
  var BigInteger = require_jsbn().BigInteger;
1263727
1263763
  var ECPointFp = require_ec().ECPointFp;
1263728
1263764
  var Buffer5 = require_safer().Buffer;
@@ -1263745,7 +1263781,7 @@ var require_ecc_jsbn = __commonJS({
1263745
1263781
  }
1263746
1263782
  } else {
1263747
1263783
  var n14 = n13.subtract(BigInteger.ONE);
1263748
- var r14 = new BigInteger(crypto26.randomBytes(n13.bitLength()));
1263784
+ var r14 = new BigInteger(crypto27.randomBytes(n13.bitLength()));
1263749
1263785
  priv = r14.mod(n14).add(BigInteger.ONE);
1263750
1263786
  this.P = c13.getG().multiply(priv);
1263751
1263787
  }
@@ -1263773,14 +1263809,14 @@ var require_dhe = __commonJS({
1263773
1263809
  generateED25519
1263774
1263810
  };
1263775
1263811
  var assert5 = require_assert();
1263776
- var crypto26 = require("crypto");
1263812
+ var crypto27 = require("crypto");
1263777
1263813
  var Buffer5 = require_safer().Buffer;
1263778
1263814
  var algs = require_algs();
1263779
1263815
  var utils = require_utils8();
1263780
1263816
  var nacl = require_nacl_fast();
1263781
1263817
  var Key3 = require_key();
1263782
1263818
  var PrivateKey = require_private_key();
1263783
- var CRYPTO_HAVE_ECDH = crypto26.createECDH !== void 0;
1263819
+ var CRYPTO_HAVE_ECDH = crypto27.createECDH !== void 0;
1263784
1263820
  var ecdh = require_ecc_jsbn();
1263785
1263821
  var ec = require_ec();
1263786
1263822
  var jsbn = require_jsbn().BigInteger;
@@ -1263794,7 +1263830,7 @@ var require_dhe = __commonJS({
1263794
1263830
  if (!CRYPTO_HAVE_ECDH) {
1263795
1263831
  throw new Error("Due to bugs in the node 0.10 crypto API, node 0.12.x or later is required to use DH");
1263796
1263832
  }
1263797
- this._dh = crypto26.createDiffieHellman(
1263833
+ this._dh = crypto27.createDiffieHellman(
1263798
1263834
  key.part.p.data,
1263799
1263835
  void 0,
1263800
1263836
  key.part.g.data,
@@ -1263821,7 +1263857,7 @@ var require_dhe = __commonJS({
1263821
1263857
  "nistp384": "secp384r1",
1263822
1263858
  "nistp521": "secp521r1"
1263823
1263859
  }[key.curve];
1263824
- this._dh = crypto26.createECDH(curve);
1263860
+ this._dh = crypto27.createECDH(curve);
1263825
1263861
  if (typeof this._dh !== "object" || typeof this._dh.setPrivateKey !== "function") {
1263826
1263862
  CRYPTO_HAVE_ECDH = false;
1263827
1263863
  DiffieHellman.call(this, key);
@@ -1263973,7 +1264009,7 @@ var require_dhe = __commonJS({
1263973
1264009
  return this._key;
1263974
1264010
  } else {
1263975
1264011
  var n13 = this._ecParams.getN();
1263976
- var r14 = new jsbn(crypto26.randomBytes(n13.bitLength()));
1264012
+ var r14 = new jsbn(crypto27.randomBytes(n13.bitLength()));
1263977
1264013
  var n14 = n13.subtract(jsbn.ONE);
1263978
1264014
  priv = r14.mod(n14).add(jsbn.ONE);
1263979
1264015
  pub = this._ecParams.getG().multiply(priv);
@@ -1264079,7 +1264115,7 @@ var require_dhe = __commonJS({
1264079
1264115
  "nistp384": "secp384r1",
1264080
1264116
  "nistp521": "secp521r1"
1264081
1264117
  }[curve];
1264082
- var dh2 = crypto26.createECDH(osCurve);
1264118
+ var dh2 = crypto27.createECDH(osCurve);
1264083
1264119
  dh2.generateKeys();
1264084
1264120
  parts.push({
1264085
1264121
  name: "curve",
@@ -1264097,7 +1264133,7 @@ var require_dhe = __commonJS({
1264097
1264133
  var ecParams = new X9ECParameters(curve);
1264098
1264134
  var n13 = ecParams.getN();
1264099
1264135
  var cByteLen = Math.ceil((n13.bitLength() + 64) / 8);
1264100
- var c13 = new jsbn(crypto26.randomBytes(cByteLen));
1264136
+ var c13 = new jsbn(crypto27.randomBytes(cByteLen));
1264101
1264137
  var n14 = n13.subtract(jsbn.ONE);
1264102
1264138
  var priv = c13.mod(n14).add(jsbn.ONE);
1264103
1264139
  var pub = ecParams.getG().multiply(priv);
@@ -1266446,7 +1266482,7 @@ var require_ssh_private = __commonJS({
1266446
1266482
  var Buffer5 = require_safer().Buffer;
1266447
1266483
  var algs = require_algs();
1266448
1266484
  var utils = require_utils8();
1266449
- var crypto26 = require("crypto");
1266485
+ var crypto27 = require("crypto");
1266450
1266486
  var Key3 = require_key();
1266451
1266487
  var PrivateKey = require_private_key();
1266452
1266488
  var pem = require_pem();
@@ -1266520,7 +1266556,7 @@ var require_ssh_private = __commonJS({
1266520
1266556
  out = Buffer5.from(out);
1266521
1266557
  var ckey = out.slice(0, cinf.keySize);
1266522
1266558
  var iv2 = out.slice(cinf.keySize, cinf.keySize + cinf.blockSize);
1266523
- var cipherStream = crypto26.createDecipheriv(
1266559
+ var cipherStream = crypto27.createDecipheriv(
1266524
1266560
  cinf.opensslName,
1266525
1266561
  ckey,
1266526
1266562
  iv2
@@ -1266585,7 +1266621,7 @@ var require_ssh_private = __commonJS({
1266585
1266621
  var privBuf;
1266586
1266622
  if (PrivateKey.isPrivateKey(key)) {
1266587
1266623
  privBuf = new SSHBuffer({});
1266588
- var checkInt = crypto26.randomBytes(4).readUInt32BE(0);
1266624
+ var checkInt = crypto27.randomBytes(4).readUInt32BE(0);
1266589
1266625
  privBuf.writeInt(checkInt);
1266590
1266626
  privBuf.writeInt(checkInt);
1266591
1266627
  privBuf.write(key.toBuffer("rfc4253"));
@@ -1266599,7 +1266635,7 @@ var require_ssh_private = __commonJS({
1266599
1266635
  case "none":
1266600
1266636
  break;
1266601
1266637
  case "bcrypt":
1266602
- var salt = crypto26.randomBytes(16);
1266638
+ var salt = crypto27.randomBytes(16);
1266603
1266639
  var rounds = 16;
1266604
1266640
  var kdfssh = new SSHBuffer({});
1266605
1266641
  kdfssh.writeBuffer(salt);
@@ -1266626,7 +1266662,7 @@ var require_ssh_private = __commonJS({
1266626
1266662
  out = Buffer5.from(out);
1266627
1266663
  var ckey = out.slice(0, cinf.keySize);
1266628
1266664
  var iv2 = out.slice(cinf.keySize, cinf.keySize + cinf.blockSize);
1266629
- var cipherStream = crypto26.createCipheriv(
1266665
+ var cipherStream = crypto27.createCipheriv(
1266630
1266666
  cinf.opensslName,
1266631
1266667
  ckey,
1266632
1266668
  iv2
@@ -1266688,7 +1266724,7 @@ var require_pem = __commonJS({
1266688
1266724
  };
1266689
1266725
  var assert5 = require_assert();
1266690
1266726
  var asn1 = require_lib8();
1266691
- var crypto26 = require("crypto");
1266727
+ var crypto27 = require("crypto");
1266692
1266728
  var Buffer5 = require_safer().Buffer;
1266693
1266729
  var algs = require_algs();
1266694
1266730
  var utils = require_utils8();
@@ -1266856,7 +1266892,7 @@ var require_pem = __commonJS({
1266856
1266892
  alg = void 0;
1266857
1266893
  }
1266858
1266894
  if (cipher && key && iv2) {
1266859
- var cipherStream = crypto26.createDecipheriv(cipher, key, iv2);
1266895
+ var cipherStream = crypto27.createDecipheriv(cipher, key, iv2);
1266860
1266896
  var chunk, chunks = [];
1266861
1266897
  cipherStream.once("error", function(e13) {
1266862
1266898
  if (e13.toString().indexOf("bad decrypt") !== -1) {
@@ -1267281,7 +1267317,7 @@ var require_putty = __commonJS({
1267281
1267317
  var rfc4253 = require_rfc4253();
1267282
1267318
  var Key3 = require_key();
1267283
1267319
  var SSHBuffer = require_ssh_buffer();
1267284
- var crypto26 = require("crypto");
1267320
+ var crypto27 = require("crypto");
1267285
1267321
  var PrivateKey = require_private_key();
1267286
1267322
  var errors = require_errors8();
1267287
1267323
  function read(buf, options2) {
@@ -1267351,7 +1267387,7 @@ var require_putty = __commonJS({
1267351
1267387
  );
1267352
1267388
  }
1267353
1267389
  var iv2 = Buffer5.alloc(16, 0);
1267354
- var decipher = crypto26.createDecipheriv(
1267390
+ var decipher = crypto27.createDecipheriv(
1267355
1267391
  "aes-256-cbc",
1267356
1267392
  derivePPK2EncryptionKey(options2.passphrase),
1267357
1267393
  iv2
@@ -1267402,11 +1267438,11 @@ var require_putty = __commonJS({
1267402
1267438
  return key;
1267403
1267439
  }
1267404
1267440
  function derivePPK2EncryptionKey(passphrase) {
1267405
- var hash1 = crypto26.createHash("sha1").update(Buffer5.concat([
1267441
+ var hash1 = crypto27.createHash("sha1").update(Buffer5.concat([
1267406
1267442
  Buffer5.from([0, 0, 0, 0]),
1267407
1267443
  Buffer5.from(passphrase)
1267408
1267444
  ])).digest();
1267409
- var hash22 = crypto26.createHash("sha1").update(Buffer5.concat([
1267445
+ var hash22 = crypto27.createHash("sha1").update(Buffer5.concat([
1267410
1267446
  Buffer5.from([0, 0, 0, 1]),
1267411
1267447
  Buffer5.from(passphrase)
1267412
1267448
  ])).digest();
@@ -1267560,7 +1267596,7 @@ var require_private_key = __commonJS({
1267560
1267596
  var assert5 = require_assert();
1267561
1267597
  var Buffer5 = require_safer().Buffer;
1267562
1267598
  var algs = require_algs();
1267563
- var crypto26 = require("crypto");
1267599
+ var crypto27 = require("crypto");
1267564
1267600
  var Fingerprint = require_fingerprint();
1267565
1267601
  var Signature2 = require_signature();
1267566
1267602
  var errs = require_errors8();
@@ -1267671,14 +1267707,14 @@ var require_private_key = __commonJS({
1267671
1267707
  var v14, nm2, err9;
1267672
1267708
  try {
1267673
1267709
  nm2 = hashAlgo.toUpperCase();
1267674
- v14 = crypto26.createSign(nm2);
1267710
+ v14 = crypto27.createSign(nm2);
1267675
1267711
  } catch (e13) {
1267676
1267712
  err9 = e13;
1267677
1267713
  }
1267678
1267714
  if (v14 === void 0 || err9 instanceof Error && err9.message.match(/Unknown message digest/)) {
1267679
1267715
  nm2 = "RSA-";
1267680
1267716
  nm2 += hashAlgo.toUpperCase();
1267681
- v14 = crypto26.createSign(nm2);
1267717
+ v14 = crypto27.createSign(nm2);
1267682
1267718
  }
1267683
1267719
  assert5.ok(v14, "failed to create verifier");
1267684
1267720
  var oldSign = v14.sign.bind(v14);
@@ -1267763,7 +1267799,7 @@ var require_identity2 = __commonJS({
1267763
1267799
  module2.exports = Identity;
1267764
1267800
  var assert5 = require_assert();
1267765
1267801
  var algs = require_algs();
1267766
- var crypto26 = require("crypto");
1267802
+ var crypto27 = require("crypto");
1267767
1267803
  var Fingerprint = require_fingerprint();
1267768
1267804
  var Signature2 = require_signature();
1267769
1267805
  var errs = require_errors8();
@@ -1268080,7 +1268116,7 @@ var require_openssh_cert = __commonJS({
1268080
1268116
  };
1268081
1268117
  var assert5 = require_assert();
1268082
1268118
  var SSHBuffer = require_ssh_buffer();
1268083
- var crypto26 = require("crypto");
1268119
+ var crypto27 = require("crypto");
1268084
1268120
  var Buffer5 = require_safer().Buffer;
1268085
1268121
  var algs = require_algs();
1268086
1268122
  var Key3 = require_key();
@@ -1268269,7 +1268305,7 @@ var require_openssh_cert = __commonJS({
1268269
1268305
  assert5.object(cert.signatures.openssh, "signature for openssh format");
1268270
1268306
  var sig = cert.signatures.openssh;
1268271
1268307
  if (sig.nonce === void 0)
1268272
- sig.nonce = crypto26.randomBytes(16);
1268308
+ sig.nonce = crypto27.randomBytes(16);
1268273
1268309
  var buf = new SSHBuffer({});
1268274
1268310
  buf.writeString(getCertType(cert.subjectKey));
1268275
1268311
  buf.writeBuffer(sig.nonce);
@@ -1269072,7 +1269108,7 @@ var require_certificate = __commonJS({
1269072
1269108
  var assert5 = require_assert();
1269073
1269109
  var Buffer5 = require_safer().Buffer;
1269074
1269110
  var algs = require_algs();
1269075
- var crypto26 = require("crypto");
1269111
+ var crypto27 = require("crypto");
1269076
1269112
  var Fingerprint = require_fingerprint();
1269077
1269113
  var Signature2 = require_signature();
1269078
1269114
  var errs = require_errors8();
@@ -1269159,7 +1269195,7 @@ var require_certificate = __commonJS({
1269159
1269195
  throw new InvalidAlgorithmError(algo);
1269160
1269196
  if (this._hashCache[algo])
1269161
1269197
  return this._hashCache[algo];
1269162
- var hash3 = crypto26.createHash(algo).update(this.toBuffer("x509")).digest();
1269198
+ var hash3 = crypto27.createHash(algo).update(this.toBuffer("x509")).digest();
1269163
1269199
  this._hashCache[algo] = hash3;
1269164
1269200
  return hash3;
1269165
1269201
  };
@@ -1269429,7 +1269465,7 @@ var require_fingerprint = __commonJS({
1269429
1269465
  var assert5 = require_assert();
1269430
1269466
  var Buffer5 = require_safer().Buffer;
1269431
1269467
  var algs = require_algs();
1269432
- var crypto26 = require("crypto");
1269468
+ var crypto27 = require("crypto");
1269433
1269469
  var errs = require_errors8();
1269434
1269470
  var Key3 = require_key();
1269435
1269471
  var PrivateKey = require_private_key();
@@ -1269496,9 +1269532,9 @@ var require_fingerprint = __commonJS({
1269496
1269532
  );
1269497
1269533
  }
1269498
1269534
  var theirHash = other2.hash(this.algorithm, this.hashType);
1269499
- var theirHash2 = crypto26.createHash(this.algorithm).update(theirHash).digest("base64");
1269535
+ var theirHash2 = crypto27.createHash(this.algorithm).update(theirHash).digest("base64");
1269500
1269536
  if (this.hash2 === void 0)
1269501
- this.hash2 = crypto26.createHash(this.algorithm).update(this.hash).digest("base64");
1269537
+ this.hash2 = crypto27.createHash(this.algorithm).update(this.hash).digest("base64");
1269502
1269538
  return this.hash2 === theirHash2;
1269503
1269539
  };
1269504
1269540
  var base64RE = /^[A-Za-z0-9+\/=]+$/;
@@ -1269623,7 +1269659,7 @@ var require_key = __commonJS({
1269623
1269659
  module2.exports = Key3;
1269624
1269660
  var assert5 = require_assert();
1269625
1269661
  var algs = require_algs();
1269626
- var crypto26 = require("crypto");
1269662
+ var crypto27 = require("crypto");
1269627
1269663
  var Fingerprint = require_fingerprint();
1269628
1269664
  var Signature2 = require_signature();
1269629
1269665
  var DiffieHellman = require_dhe().DiffieHellman;
@@ -1269721,7 +1269757,7 @@ var require_key = __commonJS({
1269721
1269757
  } else {
1269722
1269758
  throw new Error("Hash type " + type + " not supported");
1269723
1269759
  }
1269724
- var hash3 = crypto26.createHash(algo).update(buf).digest();
1269760
+ var hash3 = crypto27.createHash(algo).update(buf).digest();
1269725
1269761
  this._hashCache[cacheKey] = hash3;
1269726
1269762
  return hash3;
1269727
1269763
  };
@@ -1269769,14 +1269805,14 @@ var require_key = __commonJS({
1269769
1269805
  var v14, nm2, err9;
1269770
1269806
  try {
1269771
1269807
  nm2 = hashAlgo.toUpperCase();
1269772
- v14 = crypto26.createVerify(nm2);
1269808
+ v14 = crypto27.createVerify(nm2);
1269773
1269809
  } catch (e13) {
1269774
1269810
  err9 = e13;
1269775
1269811
  }
1269776
1269812
  if (v14 === void 0 || err9 instanceof Error && err9.message.match(/Unknown message digest/)) {
1269777
1269813
  nm2 = "RSA-";
1269778
1269814
  nm2 += hashAlgo.toUpperCase();
1269779
- v14 = crypto26.createVerify(nm2);
1269815
+ v14 = crypto27.createVerify(nm2);
1269780
1269816
  }
1269781
1269817
  assert5.ok(v14, "failed to create verifier");
1269782
1269818
  var oldVerify = v14.verify.bind(v14);
@@ -1271446,7 +1271482,7 @@ var require_jsprim = __commonJS({
1271446
1271482
  var require_signer = __commonJS({
1271447
1271483
  "node_modules/.pnpm/http-signature@1.4.0/node_modules/http-signature/lib/signer.js"(exports2, module2) {
1271448
1271484
  var assert5 = require_assert();
1271449
- var crypto26 = require("crypto");
1271485
+ var crypto27 = require("crypto");
1271450
1271486
  var util3 = require("util");
1271451
1271487
  var sshpk = require_lib9();
1271452
1271488
  var jsprim = require_jsprim();
@@ -1271509,7 +1271545,7 @@ var require_signer = __commonJS({
1271509
1271545
  this.rs_keyId = options2.keyId;
1271510
1271546
  if (typeof options2.key !== "string" && !Buffer.isBuffer(options2.key))
1271511
1271547
  throw new TypeError("options.key for HMAC must be a string or Buffer");
1271512
- this.rs_signer = crypto26.createHmac(alg[1].toUpperCase(), options2.key);
1271548
+ this.rs_signer = crypto27.createHmac(alg[1].toUpperCase(), options2.key);
1271513
1271549
  this.rs_signer.sign = function() {
1271514
1271550
  var digest = this.digest("base64");
1271515
1271551
  return {
@@ -1271790,7 +1271826,7 @@ var require_signer = __commonJS({
1271790
1271826
  }
1271791
1271827
  var signature;
1271792
1271828
  if (alg[0] === "hmac") {
1271793
- var hmac3 = crypto26.createHmac(alg[1].toUpperCase(), key);
1271829
+ var hmac3 = crypto27.createHmac(alg[1].toUpperCase(), key);
1271794
1271830
  hmac3.update(stringToSign);
1271795
1271831
  signature = hmac3.digest("base64");
1271796
1271832
  } else {
@@ -1271826,7 +1271862,7 @@ var require_signer = __commonJS({
1271826
1271862
  var require_verify = __commonJS({
1271827
1271863
  "node_modules/.pnpm/http-signature@1.4.0/node_modules/http-signature/lib/verify.js"(exports2, module2) {
1271828
1271864
  var assert5 = require_assert();
1271829
- var crypto26 = require("crypto");
1271865
+ var crypto27 = require("crypto");
1271830
1271866
  var sshpk = require_lib9();
1271831
1271867
  var utils = require_utils9();
1271832
1271868
  var HASH_ALGOS = utils.HASH_ALGOS;
@@ -1271874,12 +1271910,12 @@ var require_verify = __commonJS({
1271874
1271910
  if (alg[0] !== "hmac")
1271875
1271911
  return false;
1271876
1271912
  var hashAlg = alg[1].toUpperCase();
1271877
- var hmac3 = crypto26.createHmac(hashAlg, secret);
1271913
+ var hmac3 = crypto27.createHmac(hashAlg, secret);
1271878
1271914
  hmac3.update(parsedSignature.signingString);
1271879
- var h1 = crypto26.createHmac(hashAlg, secret);
1271915
+ var h1 = crypto27.createHmac(hashAlg, secret);
1271880
1271916
  h1.update(hmac3.digest());
1271881
1271917
  h1 = h1.digest();
1271882
- var h23 = crypto26.createHmac(hashAlg, secret);
1271918
+ var h23 = crypto27.createHmac(hashAlg, secret);
1271883
1271919
  h23.update(new Buffer(parsedSignature.params.signature, "base64"));
1271884
1271920
  h23 = h23.digest();
1271885
1271921
  if (typeof h1 === "string")
@@ -1281250,7 +1281286,7 @@ var require_form_data = __commonJS({
1281250
1281286
  var parseUrl9 = require("url").parse;
1281251
1281287
  var fs126 = require("fs");
1281252
1281288
  var Stream9 = require("stream").Stream;
1281253
- var crypto26 = require("crypto");
1281289
+ var crypto27 = require("crypto");
1281254
1281290
  var mime = require_mime_types();
1281255
1281291
  var asynckit = require_asynckit();
1281256
1281292
  var setToStringTag = require_es_set_tostringtag();
@@ -1281456,7 +1281492,7 @@ var require_form_data = __commonJS({
1281456
1281492
  return Buffer.concat([dataBuffer, Buffer.from(this._lastBoundary())]);
1281457
1281493
  };
1281458
1281494
  FormData4.prototype._generateBoundary = function() {
1281459
- this._boundary = "--------------------------" + crypto26.randomBytes(12).toString("hex");
1281495
+ this._boundary = "--------------------------" + crypto27.randomBytes(12).toString("hex");
1281460
1281496
  };
1281461
1281497
  FormData4.prototype.getLengthSync = function() {
1281462
1281498
  var knownLength = this._overheadLength + this._valueLength;
@@ -1283217,15 +1283253,15 @@ var require_auth = __commonJS({
1283217
1283253
  var require_hawk = __commonJS({
1283218
1283254
  "node_modules/.pnpm/@cypress+request@3.0.10/node_modules/@cypress/request/lib/hawk.js"(exports2) {
1283219
1283255
  "use strict";
1283220
- var crypto26 = require("crypto");
1283256
+ var crypto27 = require("crypto");
1283221
1283257
  function randomString3(size) {
1283222
1283258
  var bits = (size + 1) * 6;
1283223
- var buffer = crypto26.randomBytes(Math.ceil(bits / 8));
1283259
+ var buffer = crypto27.randomBytes(Math.ceil(bits / 8));
1283224
1283260
  var string7 = buffer.toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
1283225
1283261
  return string7.slice(0, size);
1283226
1283262
  }
1283227
1283263
  function calculatePayloadHash(payload3, algorithm, contentType) {
1283228
- var hash3 = crypto26.createHash(algorithm);
1283264
+ var hash3 = crypto27.createHash(algorithm);
1283229
1283265
  hash3.update("hawk.1.payload\n");
1283230
1283266
  hash3.update((contentType ? contentType.split(";")[0].trim().toLowerCase() : "") + "\n");
1283231
1283267
  hash3.update(payload3 || "");
@@ -1283241,7 +1283277,7 @@ var require_hawk = __commonJS({
1283241
1283277
  if (opts.app) {
1283242
1283278
  normalized = normalized + opts.app + "\n" + (opts.dlg || "") + "\n";
1283243
1283279
  }
1283244
- var hmac3 = crypto26.createHmac(credentials.algorithm, credentials.key).update(normalized);
1283280
+ var hmac3 = crypto27.createHmac(credentials.algorithm, credentials.key).update(normalized);
1283245
1283281
  var digest = hmac3.digest("base64");
1283246
1283282
  return digest;
1283247
1283283
  };
@@ -1296938,8 +1296974,7 @@ var init_bot_profile = __esm({
1296938
1296974
  { command: "tasks", description: "Show current task, todos, and recent steps" },
1296939
1296975
  { command: "subscribe", description: "Show subscription status and manage billing" },
1296940
1296976
  { command: "refresh", description: "Compact the agent's context to clear corruption" },
1296941
- { command: "settings", description: "Change language or timezone" },
1296942
- { command: "primary-channel", description: "Show or switch the owner primary channel" }
1296977
+ { command: "settings", description: "Change language or timezone" }
1296943
1296978
  ];
1296944
1296979
  }
1296945
1296980
  });
@@ -1297490,7 +1297525,7 @@ var init_telegram = __esm({
1297490
1297525
  await this.sendAdminReply(msg.chat.id, `Already using ${modelFamily} engine.`);
1297491
1297526
  return;
1297492
1297527
  }
1297493
- const targetModel = modelFamily === "gpt" ? GPT_MODEL : DEFAULT_CLAUDE_MODEL;
1297528
+ const targetModel = modelFamily === "gpt" ? GPT_HEAVY_MODEL : DEFAULT_CLAUDE_MODEL;
1297494
1297529
  const [targetProvider] = getSupportedProvidersForModel(targetModel);
1297495
1297530
  this.config = { ...this.config, model: targetModel, provider: targetProvider };
1297496
1297531
  saveConfig(this.config);
@@ -1302473,11 +1302508,11 @@ var require_util18 = __commonJS({
1302473
1302508
  var { isUint8Array } = require("node:util/types");
1302474
1302509
  var { webidl } = require_webidl2();
1302475
1302510
  var supportedHashes = [];
1302476
- var crypto26;
1302511
+ var crypto27;
1302477
1302512
  try {
1302478
- crypto26 = require("node:crypto");
1302513
+ crypto27 = require("node:crypto");
1302479
1302514
  const possibleRelevantHashes = ["sha256", "sha384", "sha512"];
1302480
- supportedHashes = crypto26.getHashes().filter((hash3) => possibleRelevantHashes.includes(hash3));
1302515
+ supportedHashes = crypto27.getHashes().filter((hash3) => possibleRelevantHashes.includes(hash3));
1302481
1302516
  } catch {
1302482
1302517
  }
1302483
1302518
  function responseURL(response) {
@@ -1302750,7 +1302785,7 @@ var require_util18 = __commonJS({
1302750
1302785
  }
1302751
1302786
  }
1302752
1302787
  function bytesMatch(bytes2, metadataList) {
1302753
- if (crypto26 === void 0) {
1302788
+ if (crypto27 === void 0) {
1302754
1302789
  return true;
1302755
1302790
  }
1302756
1302791
  const parsedMetadata = parseMetadata(metadataList);
@@ -1302765,7 +1302800,7 @@ var require_util18 = __commonJS({
1302765
1302800
  for (const item of metadata) {
1302766
1302801
  const algorithm = item.algo;
1302767
1302802
  const expectedValue = item.hash;
1302768
- let actualValue = crypto26.createHash(algorithm).update(bytes2).digest("base64");
1302803
+ let actualValue = crypto27.createHash(algorithm).update(bytes2).digest("base64");
1302769
1302804
  if (actualValue[actualValue.length - 1] === "=") {
1302770
1302805
  if (actualValue[actualValue.length - 2] === "=") {
1302771
1302806
  actualValue = actualValue.slice(0, -2);
@@ -1303829,8 +1303864,8 @@ var require_body2 = __commonJS({
1303829
1303864
  var { multipartFormDataParser } = require_formdata_parser2();
1303830
1303865
  var random2;
1303831
1303866
  try {
1303832
- const crypto26 = require("node:crypto");
1303833
- random2 = (max) => crypto26.randomInt(0, max);
1303867
+ const crypto27 = require("node:crypto");
1303868
+ random2 = (max) => crypto27.randomInt(0, max);
1303834
1303869
  } catch {
1303835
1303870
  random2 = (max) => Math.floor(Math.random(max));
1303836
1303871
  }
@@ -1315238,13 +1315273,13 @@ var require_frame2 = __commonJS({
1315238
1315273
  "use strict";
1315239
1315274
  var { maxUnsigned16Bit } = require_constants14();
1315240
1315275
  var BUFFER_SIZE = 16386;
1315241
- var crypto26;
1315276
+ var crypto27;
1315242
1315277
  var buffer = null;
1315243
1315278
  var bufIdx = BUFFER_SIZE;
1315244
1315279
  try {
1315245
- crypto26 = require("node:crypto");
1315280
+ crypto27 = require("node:crypto");
1315246
1315281
  } catch {
1315247
- crypto26 = {
1315282
+ crypto27 = {
1315248
1315283
  // not full compatibility, but minimum.
1315249
1315284
  randomFillSync: function randomFillSync(buffer2, _offset3, _size3) {
1315250
1315285
  for (let i14 = 0; i14 < buffer2.length; ++i14) {
@@ -1315257,7 +1315292,7 @@ var require_frame2 = __commonJS({
1315257
1315292
  function generateMask() {
1315258
1315293
  if (bufIdx === BUFFER_SIZE) {
1315259
1315294
  bufIdx = 0;
1315260
- crypto26.randomFillSync(buffer ??= Buffer.allocUnsafe(BUFFER_SIZE), 0, BUFFER_SIZE);
1315295
+ crypto27.randomFillSync(buffer ??= Buffer.allocUnsafe(BUFFER_SIZE), 0, BUFFER_SIZE);
1315261
1315296
  }
1315262
1315297
  return [buffer[bufIdx++], buffer[bufIdx++], buffer[bufIdx++], buffer[bufIdx++]];
1315263
1315298
  }
@@ -1315329,9 +1315364,9 @@ var require_connection2 = __commonJS({
1315329
1315364
  var { Headers: Headers3, getHeadersList } = require_headers2();
1315330
1315365
  var { getDecodeSplit } = require_util18();
1315331
1315366
  var { WebsocketFrameSend } = require_frame2();
1315332
- var crypto26;
1315367
+ var crypto27;
1315333
1315368
  try {
1315334
- crypto26 = require("node:crypto");
1315369
+ crypto27 = require("node:crypto");
1315335
1315370
  } catch {
1315336
1315371
  }
1315337
1315372
  function establishWebSocketConnection(url3, protocols, client, ws2, onEstablish, options2) {
@@ -1315351,7 +1315386,7 @@ var require_connection2 = __commonJS({
1315351
1315386
  const headersList = getHeadersList(new Headers3(options2.headers));
1315352
1315387
  request2.headersList = headersList;
1315353
1315388
  }
1315354
- const keyValue = crypto26.randomBytes(16).toString("base64");
1315389
+ const keyValue = crypto27.randomBytes(16).toString("base64");
1315355
1315390
  request2.headersList.append("sec-websocket-key", keyValue);
1315356
1315391
  request2.headersList.append("sec-websocket-version", "13");
1315357
1315392
  for (const protocol of protocols) {
@@ -1315381,7 +1315416,7 @@ var require_connection2 = __commonJS({
1315381
1315416
  return;
1315382
1315417
  }
1315383
1315418
  const secWSAccept = response.headersList.get("Sec-WebSocket-Accept");
1315384
- const digest = crypto26.createHash("sha1").update(keyValue + uid).digest("base64");
1315419
+ const digest = crypto27.createHash("sha1").update(keyValue + uid).digest("base64");
1315385
1315420
  if (secWSAccept !== digest) {
1315386
1315421
  failWebsocketConnection(ws2, "Incorrect hash received in Sec-WebSocket-Accept header.");
1315387
1315422
  return;
@@ -1388882,6 +1388917,66 @@ var init_upgrade_handler = __esm({
1388882
1388917
  }
1388883
1388918
  });
1388884
1388919
 
1388920
+ // dist/agent/engine-switch-handler.js
1388921
+ function createEngineSwitchHandler(config3) {
1388922
+ return async (commandId, payload3) => {
1388923
+ const parsed = EngineSwitchPayloadSchema.safeParse(payload3);
1388924
+ if (!parsed.success) {
1388925
+ const errMsg = `Invalid switch_engine payload: expected { engine: "gpt" | "claude" }`;
1388926
+ logger.err(`[engine-switch-handler] ${errMsg} (id=${commandId})`);
1388927
+ return {
1388928
+ status: "failed",
1388929
+ result: JSON.stringify({ error: errMsg })
1388930
+ };
1388931
+ }
1388932
+ const targetFamily = parsed.data.engine;
1388933
+ const currentFamily = isClaudeModel(config3.model) ? "claude" : "gpt";
1388934
+ if (currentFamily === targetFamily) {
1388935
+ logger.system(`[engine-switch-handler] Already on ${targetFamily} engine (model=${config3.model}); no-op (id=${commandId})`);
1388936
+ return {
1388937
+ status: "completed",
1388938
+ result: JSON.stringify({ message: `Already using ${targetFamily} engine (model=${config3.model})` })
1388939
+ };
1388940
+ }
1388941
+ const targetModel = targetFamily === "gpt" ? GPT_HEAVY_MODEL : DEFAULT_CLAUDE_MODEL;
1388942
+ const [targetProvider] = getSupportedProvidersForModel(targetModel);
1388943
+ writePendingRestart({
1388944
+ channel: "onboarding-server",
1388945
+ sender: "admin",
1388946
+ requestedAt: (/* @__PURE__ */ new Date()).toISOString()
1388947
+ });
1388948
+ const { scheduleRestart: scheduleRestart2 } = await Promise.resolve().then(() => (init_restart(), restart_exports));
1388949
+ const { runGracefulShutdown: runGracefulShutdown2 } = await Promise.resolve().then(() => (init_state(), state_exports));
1388950
+ config3.model = targetModel;
1388951
+ config3.provider = targetProvider;
1388952
+ saveConfig(config3);
1388953
+ logger.system(`[engine-switch-handler] Engine switch to ${targetFamily} (${targetModel}, provider=${targetProvider}) requested via onboarding server (id=${commandId})`);
1388954
+ scheduleRestart2(RESTART_DELAY2, runGracefulShutdown2);
1388955
+ return {
1388956
+ status: "completed",
1388957
+ result: JSON.stringify({
1388958
+ message: `Switching to ${targetFamily} engine (${targetModel}, provider=${targetProvider}); restarting in ${RESTART_DELAY2 / 1e3}s`
1388959
+ })
1388960
+ };
1388961
+ };
1388962
+ }
1388963
+ var EngineSwitchPayloadSchema, RESTART_DELAY2;
1388964
+ var init_engine_switch_handler = __esm({
1388965
+ "dist/agent/engine-switch-handler.js"() {
1388966
+ "use strict";
1388967
+ init_zod();
1388968
+ init_types();
1388969
+ init_models();
1388970
+ init_engine_factory();
1388971
+ init_config();
1388972
+ init_logger();
1388973
+ EngineSwitchPayloadSchema = external_exports.object({
1388974
+ engine: external_exports.enum(["gpt", "claude"])
1388975
+ });
1388976
+ RESTART_DELAY2 = 5e3;
1388977
+ }
1388978
+ });
1388979
+
1388885
1388980
  // dist/agent/usage/usage-handler.js
1388886
1388981
  function createUsageHandler() {
1388887
1388982
  return async (_commandId, _payload) => {
@@ -1390667,6 +1390762,7 @@ var init_heartbeat_manager = __esm({
1390667
1390762
  init_state();
1390668
1390763
  init_data_collector();
1390669
1390764
  init_upgrade_handler();
1390765
+ init_engine_switch_handler();
1390670
1390766
  init_usage_handler();
1390671
1390767
  init_usage_backfill_handler();
1390672
1390768
  init_billing_handler();
@@ -1390745,6 +1390841,7 @@ var init_heartbeat_manager = __esm({
1390745
1390841
  this.commandDispatcher.registerHandler("usage", createUsageHandler());
1390746
1390842
  this.commandDispatcher.registerHandler("usage_backfill", createUsageBackfillHandler(config3));
1390747
1390843
  this.commandDispatcher.registerHandler("create_rdp_session", createRdpSessionHandler());
1390844
+ this.commandDispatcher.registerHandler("switch_engine", createEngineSwitchHandler(config3));
1390748
1390845
  }
1390749
1390846
  /** Build a base heartbeat payload including owner info for server-side backfill. */
1390750
1390847
  buildPayload(busy) {
@@ -1392230,6 +1392327,229 @@ var init_notify2 = __esm({
1392230
1392327
  }
1392231
1392328
  });
1392232
1392329
 
1392330
+ // dist/agent/external-context/providers/finapp.js
1392331
+ function renderFinAppContext(context2) {
1392332
+ const lines = [];
1392333
+ lines.push(`Current fin-app thread: ${context2.threadKey}`);
1392334
+ if (context2.degradedReason)
1392335
+ lines.push(`Degraded: ${context2.degradedReason}`);
1392336
+ lines.push("Use fin-app MCP tools for full details or authoritative current data.");
1392337
+ lines.push("");
1392338
+ lines.push("#### Local Thread Context");
1392339
+ lines.push(formatJson(context2.local));
1392340
+ lines.push("");
1392341
+ lines.push("#### Global Lite Context");
1392342
+ lines.push(formatJson(context2.globalLite));
1392343
+ return lines.join("\n");
1392344
+ }
1392345
+ function formatJson(value2) {
1392346
+ return `\`\`\`json
1392347
+ ${JSON.stringify(value2, null, 2)}
1392348
+ \`\`\``;
1392349
+ }
1392350
+ function withDegradedReason(block2, reason) {
1392351
+ return {
1392352
+ ...block2,
1392353
+ content: `${block2.content}
1392354
+
1392355
+ Cached context used because fresh fin-app context failed: ${reason}`,
1392356
+ metadata: { ...block2.metadata ?? {}, degradedReason: reason, stale: true }
1392357
+ };
1392358
+ }
1392359
+ var CONTEXT_CACHE_TTL_MS, FinAppExternalContextProvider;
1392360
+ var init_finapp2 = __esm({
1392361
+ "dist/agent/external-context/providers/finapp.js"() {
1392362
+ "use strict";
1392363
+ init_finapp_credentials();
1392364
+ CONTEXT_CACHE_TTL_MS = 45e3;
1392365
+ FinAppExternalContextProvider = class {
1392366
+ config;
1392367
+ source = "fin-app";
1392368
+ cache = /* @__PURE__ */ new Map();
1392369
+ constructor(config3) {
1392370
+ this.config = config3;
1392371
+ }
1392372
+ async build(input) {
1392373
+ if (input.channel !== "finapp")
1392374
+ return [];
1392375
+ const credentials = resolveFinAppCredentials(this.config);
1392376
+ if (!credentials)
1392377
+ return [];
1392378
+ const userId = typeof input.channelMeta.userId === "number" ? input.channelMeta.userId : void 0;
1392379
+ const cacheKey = `${userId ?? "unknown"}:${input.threadId}`;
1392380
+ const cached4 = this.cache.get(cacheKey);
1392381
+ if (cached4 && Date.now() - cached4.fetchedAt < CONTEXT_CACHE_TTL_MS)
1392382
+ return [cached4.block];
1392383
+ try {
1392384
+ const response = await fetch(`${credentials.baseUrl}/api/internal/thread-context`, {
1392385
+ method: "POST",
1392386
+ headers: {
1392387
+ Authorization: `Bearer ${credentials.apiKey}`,
1392388
+ "Content-Type": "application/json"
1392389
+ },
1392390
+ body: JSON.stringify({ threadKey: input.threadId, ...userId !== void 0 ? { userId } : {} }),
1392391
+ signal: AbortSignal.timeout(900)
1392392
+ });
1392393
+ if (!response.ok) {
1392394
+ if (cached4)
1392395
+ return [withDegradedReason(cached4.block, `fin-app context endpoint HTTP ${response.status}`)];
1392396
+ return [];
1392397
+ }
1392398
+ const context2 = await response.json();
1392399
+ const block2 = {
1392400
+ source: "fin-app",
1392401
+ scope: "thread",
1392402
+ threadId: context2.threadKey,
1392403
+ title: "Fin-App",
1392404
+ generatedAt: context2.generatedAt,
1392405
+ asOf: context2.asOf,
1392406
+ digest: context2.digest,
1392407
+ priority: 100,
1392408
+ content: renderFinAppContext(context2),
1392409
+ metadata: {
1392410
+ threadKey: context2.threadKey,
1392411
+ degradedReason: context2.degradedReason
1392412
+ }
1392413
+ };
1392414
+ this.cache.set(cacheKey, { fetchedAt: Date.now(), block: block2 });
1392415
+ return [block2];
1392416
+ } catch (err9) {
1392417
+ if (cached4)
1392418
+ return [withDegradedReason(cached4.block, err9 instanceof Error ? err9.message : String(err9))];
1392419
+ return [];
1392420
+ }
1392421
+ }
1392422
+ };
1392423
+ }
1392424
+ });
1392425
+
1392426
+ // dist/agent/external-context/registry.js
1392427
+ function createDefaultExternalContextRegistry(config3) {
1392428
+ return new ExternalContextRegistry([
1392429
+ new FinAppExternalContextProvider(config3)
1392430
+ ]);
1392431
+ }
1392432
+ function digestExternalContextContent(content) {
1392433
+ return import_node_crypto30.default.createHash("sha256").update(content).digest("hex").slice(0, 16);
1392434
+ }
1392435
+ function normalizeProviderInput(trigger, sessionMode, messages2) {
1392436
+ const primaryMessage = messages2.find((m13) => m13.channel === "finapp") ?? messages2.at(0);
1392437
+ if (!primaryMessage) {
1392438
+ return {
1392439
+ trigger,
1392440
+ threadId: "default",
1392441
+ sessionMode,
1392442
+ messages: messages2,
1392443
+ channel: null,
1392444
+ channelMeta: {}
1392445
+ };
1392446
+ }
1392447
+ return {
1392448
+ trigger,
1392449
+ threadId: resolveThreadId(primaryMessage),
1392450
+ sessionMode,
1392451
+ messages: messages2,
1392452
+ primaryMessage,
1392453
+ channel: primaryMessage.channel,
1392454
+ channelMeta: primaryMessage.meta ?? {}
1392455
+ };
1392456
+ }
1392457
+ function renderExternalContextBlocks(blocks, maxChars = DEFAULT_MAX_CHARS) {
1392458
+ const included = [];
1392459
+ let totalChars = 0;
1392460
+ let truncated = false;
1392461
+ const parts = [];
1392462
+ for (const block2 of blocks) {
1392463
+ const text = renderBlock(block2);
1392464
+ if (totalChars + text.length > maxChars) {
1392465
+ truncated = true;
1392466
+ const remaining = maxChars - totalChars;
1392467
+ if (remaining > 500) {
1392468
+ parts.push(`${text.slice(0, remaining - 80)}
1392469
+
1392470
+ [External context block truncated due to budget.]`);
1392471
+ included.push(block2);
1392472
+ totalChars = maxChars;
1392473
+ }
1392474
+ break;
1392475
+ }
1392476
+ parts.push(text);
1392477
+ included.push(block2);
1392478
+ totalChars += text.length;
1392479
+ }
1392480
+ if (parts.length === 0) {
1392481
+ return { blocks: [], section: "", digest: null, totalChars: 0, truncated };
1392482
+ }
1392483
+ const section = `## Current External Runtime Context
1392484
+
1392485
+ These blocks describe current runtime/app state. They are generated for this wake cycle and may be stale later. Use tools for authoritative current details.
1392486
+
1392487
+ ${parts.join("\n\n")}`;
1392488
+ const digest = digestExternalContextContent(included.map((b16) => `${b16.source}:${b16.scope}:${b16.threadId ?? ""}:${b16.digest}`).join("\n"));
1392489
+ return { blocks: included, section, digest, totalChars: section.length, truncated };
1392490
+ }
1392491
+ function renderBlock(block2) {
1392492
+ const header = [`### ${block2.title}`, `source=${block2.source}`, `scope=${block2.scope}`];
1392493
+ if (block2.threadId)
1392494
+ header.push(`thread=${block2.threadId}`);
1392495
+ header.push(`digest=${block2.digest}`);
1392496
+ if (block2.asOf)
1392497
+ header.push(`asOf=${block2.asOf}`);
1392498
+ return `${header.join(" | ")}
1392499
+
1392500
+ ${block2.content.trim()}`;
1392501
+ }
1392502
+ var import_node_crypto30, DEFAULT_MAX_CHARS, DEFAULT_PROVIDER_TIMEOUT_MS, ExternalContextRegistry;
1392503
+ var init_registry3 = __esm({
1392504
+ "dist/agent/external-context/registry.js"() {
1392505
+ "use strict";
1392506
+ import_node_crypto30 = __toESM(require("node:crypto"), 1);
1392507
+ init_interface3();
1392508
+ init_logger();
1392509
+ init_finapp2();
1392510
+ DEFAULT_MAX_CHARS = 12e3;
1392511
+ DEFAULT_PROVIDER_TIMEOUT_MS = 1e3;
1392512
+ ExternalContextRegistry = class {
1392513
+ providers;
1392514
+ maxChars;
1392515
+ providerTimeoutMs;
1392516
+ constructor(providers, options2 = {}) {
1392517
+ this.providers = providers;
1392518
+ this.maxChars = options2.maxChars ?? DEFAULT_MAX_CHARS;
1392519
+ this.providerTimeoutMs = options2.providerTimeoutMs ?? DEFAULT_PROVIDER_TIMEOUT_MS;
1392520
+ }
1392521
+ async collect(input) {
1392522
+ const providerInput = normalizeProviderInput(input.trigger, input.sessionMode, input.messages);
1392523
+ const settled = await Promise.all(this.providers.map((provider) => this.buildWithTimeout(provider, providerInput)));
1392524
+ const blocks = settled.flat().sort((a13, b16) => b16.priority - a13.priority || a13.source.localeCompare(b16.source));
1392525
+ const rendered = renderExternalContextBlocks(blocks, this.maxChars);
1392526
+ if (rendered.blocks.length > 0) {
1392527
+ logger.system(`external_context_injected sources=${JSON.stringify([...new Set(rendered.blocks.map((b16) => b16.source))])} threadId=${providerInput.threadId} digests=${JSON.stringify(rendered.blocks.map((b16) => b16.digest))} totalChars=${rendered.totalChars} truncated=${rendered.truncated}`);
1392528
+ }
1392529
+ return rendered;
1392530
+ }
1392531
+ async buildWithTimeout(provider, input) {
1392532
+ let timeout;
1392533
+ try {
1392534
+ return await Promise.race([
1392535
+ provider.build(input),
1392536
+ new Promise((resolve23) => {
1392537
+ timeout = setTimeout(() => resolve23([]), this.providerTimeoutMs);
1392538
+ timeout.unref();
1392539
+ })
1392540
+ ]);
1392541
+ } catch (err9) {
1392542
+ logger.warn(`[external-context] provider ${provider.source} failed: ${err9 instanceof Error ? err9.message : String(err9)}`);
1392543
+ return [];
1392544
+ } finally {
1392545
+ if (timeout)
1392546
+ clearTimeout(timeout);
1392547
+ }
1392548
+ }
1392549
+ };
1392550
+ }
1392551
+ });
1392552
+
1392233
1392553
  // dist/agent/wake-cycle-runner.js
1392234
1392554
  function resolveIndexableTranscript(transcriptInfo, fallbackPath) {
1392235
1392555
  if (transcriptInfo.kind === "none")
@@ -1392308,9 +1392628,9 @@ function deriveTranscriptPath(sessionId) {
1392308
1392628
  return import_path128.default.join(dir, `${sessionId}.jsonl`);
1392309
1392629
  }
1392310
1392630
  function generateWakeCycleId() {
1392311
- return `wc_${(0, import_node_crypto30.randomUUID)().replaceAll("-", "")}`;
1392631
+ return `wc_${(0, import_node_crypto31.randomUUID)().replaceAll("-", "")}`;
1392312
1392632
  }
1392313
- var import_path128, import_node_crypto30, AUTH_PATTERNS, FATAL_ENV_PATTERNS, RETRYABLE_PATTERNS, PROVIDER_QUOTA_PATTERNS, PROMPT_TOO_LONG_PATTERNS, CORRUPT_TRANSCRIPT_PATTERNS, TOO_MANY_IMAGES_PATTERN, INVALID_JSON_BODY_PATTERN, MODEL_NOT_FOUND_PATTERN, PROMPT_TOO_LONG_REASONS, TOO_MANY_IMAGES_REASONS, MAX_SUBAGENT_CONTINUATIONS, SUBAGENT_CONTINUATION_WAIT_SECONDS, MAX_RETRIES_BEFORE_NOTIFY, BASE_DELAY_MS3, MAX_DELAY_MS, FATAL_SLEEP_MS, MAX_SILENCE_RETRIES, SILENCE_TIMEOUT_SCHEDULE_MS, EFFORT_SCHEDULE, WakeCycleRunner;
1392633
+ var import_path128, import_node_crypto31, AUTH_PATTERNS, FATAL_ENV_PATTERNS, RETRYABLE_PATTERNS, PROVIDER_QUOTA_PATTERNS, PROMPT_TOO_LONG_PATTERNS, CORRUPT_TRANSCRIPT_PATTERNS, TOO_MANY_IMAGES_PATTERN, INVALID_JSON_BODY_PATTERN, MODEL_NOT_FOUND_PATTERN, PROMPT_TOO_LONG_REASONS, TOO_MANY_IMAGES_REASONS, MAX_SUBAGENT_CONTINUATIONS, SUBAGENT_CONTINUATION_WAIT_SECONDS, MAX_RETRIES_BEFORE_NOTIFY, BASE_DELAY_MS3, MAX_DELAY_MS, FATAL_SLEEP_MS, MAX_SILENCE_RETRIES, SILENCE_TIMEOUT_SCHEDULE_MS, EFFORT_SCHEDULE, WakeCycleRunner;
1392314
1392634
  var init_wake_cycle_runner = __esm({
1392315
1392635
  "dist/agent/wake-cycle-runner.js"() {
1392316
1392636
  "use strict";
@@ -1392326,8 +1392646,10 @@ var init_wake_cycle_runner = __esm({
1392326
1392646
  init_i18n();
1392327
1392647
  init_restart();
1392328
1392648
  init_state();
1392649
+ init_registry3();
1392650
+ init_runtime();
1392329
1392651
  import_path128 = __toESM(require("path"), 1);
1392330
- import_node_crypto30 = require("node:crypto");
1392652
+ import_node_crypto31 = require("node:crypto");
1392331
1392653
  AUTH_PATTERNS = /\b(401|402|403|authentication|billing|unauthorized|forbidden|api.?key)\b/i;
1392332
1392654
  FATAL_ENV_PATTERNS = /Cannot find module.*claude-agent-sdk|claude-agent-sdk.*cli\.js|ENOENT.*claude-agent-sdk|claude-agent-sdk.*ENOENT/i;
1392333
1392655
  RETRYABLE_PATTERNS = /\b(ECONNREFUSED|ETIMEDOUT|ENOTFOUND|EAI_AGAIN|ECONNRESET|UND_ERR_SOCKET|UND_ERR_CONNECT_TIMEOUT|fetch failed|socket hang up|429|529|rate.?limit|overloaded|throttl|timeout|50[0234]|service.?unavailable|bad.?gateway|internal.?server)\b/i;
@@ -1392413,6 +1392735,13 @@ var init_wake_cycle_runner = __esm({
1392413
1392735
  let switchForwardMessage = "";
1392414
1392736
  let pendingMemoAck = true;
1392415
1392737
  let silenceCompactionDone = false;
1392738
+ const externalContextRegistry = createDefaultExternalContextRegistry(config3);
1392739
+ const externalContext = await externalContextRegistry.collect({
1392740
+ trigger,
1392741
+ sessionMode: session.activeMode,
1392742
+ messages: messages2
1392743
+ });
1392744
+ setCurrentExternalContext(externalContext.section, externalContext.digest);
1392416
1392745
  wakeLoop: while (true) {
1392417
1392746
  const activeSession = session.activeSession;
1392418
1392747
  try {
@@ -1392472,7 +1392801,7 @@ var init_wake_cycle_runner = __esm({
1392472
1392801
  const silenceTimeoutMs = SILENCE_TIMEOUT_SCHEDULE_MS[silenceAttempt - 1] ?? SILENCE_TIMEOUT_SCHEDULE_MS[SILENCE_TIMEOUT_SCHEDULE_MS.length - 1];
1392473
1392802
  const effortSchedule = EFFORT_SCHEDULE[session.activeMode];
1392474
1392803
  const effort = effortSchedule[silenceAttempt - 1];
1392475
- const queryStream = activeSession.sendAndStream(messageContent, { effort });
1392804
+ const queryStream = activeSession.sendAndStream(messageContent, { effort, externalContextDigest: externalContext.digest });
1392476
1392805
  if (pendingMemoAck) {
1392477
1392806
  session.ackMemosForActive();
1392478
1392807
  pendingMemoAck = false;
@@ -1392697,6 +1393026,7 @@ var init_wake_cycle_runner = __esm({
1392697
1393026
  logger.warn(`Transcript indexing failed: ${indexErr instanceof Error ? indexErr.message : String(indexErr)}`);
1392698
1393027
  });
1392699
1393028
  }
1393029
+ clearCurrentExternalContext();
1392700
1393030
  return { consecutiveErrors };
1392701
1393031
  }
1392702
1393032
  /**
@@ -1395740,7 +1396070,7 @@ function copyToImagesDir(archiveId, cachedPath, mediaType, cache12) {
1395740
1396070
  return `images/${filename}`;
1395741
1396071
  }
1395742
1396072
  function externalizeBase64Image(base64Data, mediaType, cache12) {
1395743
- const hash3 = (0, import_node_crypto32.createHash)("sha256").update(base64Data).digest("hex").slice(0, 12);
1396073
+ const hash3 = (0, import_node_crypto33.createHash)("sha256").update(base64Data).digest("hex").slice(0, 12);
1395744
1396074
  const ext2 = mediaType === "image/jpeg" ? ".jpg" : mediaType === "image/webp" ? ".webp" : ".png";
1395745
1396075
  const filename = `raw_${hash3}${ext2}`;
1395746
1396076
  if (!cache12.written.has(filename)) {
@@ -1395988,11 +1396318,11 @@ async function recoverImagesInContent(content, sidecarIndex, stats, cache12) {
1395988
1396318
  }
1395989
1396319
  return out;
1395990
1396320
  }
1395991
- var import_node_crypto32, import_node_child_process49, import_node_fs112, import_node_path125, import_node_readline8, DEFAULT_TOSUTIL_PATH, DEFAULT_BUCKET, TEXT_PLACEHOLDER_PREFIX, TEXT_CHUNK_KEYWORD2;
1396321
+ var import_node_crypto33, import_node_child_process49, import_node_fs112, import_node_path125, import_node_readline8, DEFAULT_TOSUTIL_PATH, DEFAULT_BUCKET, TEXT_PLACEHOLDER_PREFIX, TEXT_CHUNK_KEYWORD2;
1395992
1396322
  var init_image_recovery = __esm({
1395993
1396323
  "dist/data-processing/image-recovery.js"() {
1395994
1396324
  "use strict";
1395995
- import_node_crypto32 = require("node:crypto");
1396325
+ import_node_crypto33 = require("node:crypto");
1395996
1396326
  import_node_child_process49 = require("node:child_process");
1395997
1396327
  import_node_fs112 = __toESM(require("node:fs"), 1);
1395998
1396328
  import_node_path125 = __toESM(require("node:path"), 1);
@@ -1398327,7 +1398657,7 @@ function convertRecord(record3, fallbackSystemPrompt, seq) {
1398327
1398657
  if (record3.wake_cycle_id) {
1398328
1398658
  uid = seq === 0 ? record3.wake_cycle_id : `${record3.wake_cycle_id}#${seq}`;
1398329
1398659
  } else {
1398330
- uid = (0, import_node_crypto33.randomUUID)();
1398660
+ uid = (0, import_node_crypto34.randomUUID)();
1398331
1398661
  }
1398332
1398662
  return {
1398333
1398663
  uid,
@@ -1398434,14 +1398764,14 @@ async function convertOpenaiChat(opts) {
1398434
1398764
  }
1398435
1398765
  console.log(` Total: ${totalRecords} records`);
1398436
1398766
  }
1398437
- var import_node_fs118, import_node_path130, import_node_readline11, import_node_crypto33;
1398767
+ var import_node_fs118, import_node_path130, import_node_readline11, import_node_crypto34;
1398438
1398768
  var init_convert_openai_chat = __esm({
1398439
1398769
  "dist/data-processing/convert-openai-chat.js"() {
1398440
1398770
  "use strict";
1398441
1398771
  import_node_fs118 = __toESM(require("node:fs"), 1);
1398442
1398772
  import_node_path130 = __toESM(require("node:path"), 1);
1398443
1398773
  import_node_readline11 = __toESM(require("node:readline"), 1);
1398444
- import_node_crypto33 = require("node:crypto");
1398774
+ import_node_crypto34 = require("node:crypto");
1398445
1398775
  }
1398446
1398776
  });
1398447
1398777
 
@@ -1399124,7 +1399454,7 @@ function convertSubAgentTranscript(transcriptPath, parentUid, subagentIndex, des
1399124
1399454
  chatMessages.push({
1399125
1399455
  role: "tool",
1399126
1399456
  content: resultContent,
1399127
- tool_call_id: tr3.tool_use_id ?? `call_${(0, import_node_crypto34.randomUUID)().slice(0, 8)}`
1399457
+ tool_call_id: tr3.tool_use_id ?? `call_${(0, import_node_crypto35.randomUUID)().slice(0, 8)}`
1399128
1399458
  });
1399129
1399459
  }
1399130
1399460
  } else if (textBlocks.length > 0) {
@@ -1399152,7 +1399482,7 @@ function convertSubAgentTranscript(transcriptPath, parentUid, subagentIndex, des
1399152
1399482
  textBuf += block2.text ?? "";
1399153
1399483
  } else if (block2.type === "tool_use") {
1399154
1399484
  toolCalls.push({
1399155
- id: block2.id ?? `call_${(0, import_node_crypto34.randomUUID)().slice(0, 8)}`,
1399485
+ id: block2.id ?? `call_${(0, import_node_crypto35.randomUUID)().slice(0, 8)}`,
1399156
1399486
  type: "function",
1399157
1399487
  function: {
1399158
1399488
  name: block2.name ?? "unknown",
@@ -1399172,7 +1399502,7 @@ function convertSubAgentTranscript(transcriptPath, parentUid, subagentIndex, des
1399172
1399502
  const lastMsg = chatMessages[chatMessages.length - 1];
1399173
1399503
  const success4 = lastMsg.role === "assistant" && !!lastMsg.content;
1399174
1399504
  return {
1399175
- uid: (0, import_node_crypto34.randomUUID)(),
1399505
+ uid: (0, import_node_crypto35.randomUUID)(),
1399176
1399506
  agent_type: "subagent",
1399177
1399507
  subagent_index: subagentIndex,
1399178
1399508
  parent_uid: parentUid,
@@ -1399306,7 +1399636,7 @@ async function runExpandSubagents(args) {
1399306
1399636
  parent_uid: null
1399307
1399637
  };
1399308
1399638
  if (!mainOutput.uid)
1399309
- mainOutput.uid = (0, import_node_crypto34.randomUUID)();
1399639
+ mainOutput.uid = (0, import_node_crypto35.randomUUID)();
1399310
1399640
  allOutput.push(mainOutput);
1399311
1399641
  const groupSubagents = [];
1399312
1399642
  for (let si3 = 0; si3 < entry.agentCalls.length; si3++) {
@@ -1399382,14 +1399712,14 @@ Wrote output files:`);
1399382
1399712
  console.log(` ${groupsFile} (${groups.length} groups)`);
1399383
1399713
  console.log(` ${summaryFile}`);
1399384
1399714
  }
1399385
- var import_node_fs123, import_node_path135, import_node_readline12, import_node_crypto34;
1399715
+ var import_node_fs123, import_node_path135, import_node_readline12, import_node_crypto35;
1399386
1399716
  var init_subagent_expand = __esm({
1399387
1399717
  "dist/data-processing/subagent-expand.js"() {
1399388
1399718
  "use strict";
1399389
1399719
  import_node_fs123 = __toESM(require("node:fs"), 1);
1399390
1399720
  import_node_path135 = __toESM(require("node:path"), 1);
1399391
1399721
  import_node_readline12 = __toESM(require("node:readline"), 1);
1399392
- import_node_crypto34 = require("node:crypto");
1399722
+ import_node_crypto35 = require("node:crypto");
1399393
1399723
  }
1399394
1399724
  });
1399395
1399725
 
@@ -1402322,14 +1402652,12 @@ function getProviderLabel2(provider) {
1402322
1402652
  }
1402323
1402653
  function getModelLabel(model) {
1402324
1402654
  switch (model) {
1402325
- case "gpt-5.5":
1402326
- return "GPT-5.5";
1402655
+ case "gpt-5.6-sol":
1402656
+ return "GPT-5.6 Sol";
1402327
1402657
  case "claude-opus-4-8":
1402328
1402658
  return "Claude Opus 4.8";
1402329
- case "claude-opus-4-6":
1402330
- return "Claude Opus 4.6";
1402331
1402659
  default:
1402332
- return "Claude Sonnet 4.6";
1402660
+ return "Claude Sonnet 5";
1402333
1402661
  }
1402334
1402662
  }
1402335
1402663
  function getProviderChoices(model) {
@@ -1402794,10 +1403122,10 @@ Updating bot name to "${identityResult.botName}"\u2026`);
1402794
1403122
  message: "AI model:",
1402795
1403123
  choices: [
1402796
1403124
  { title: "Claude Opus 4.8", value: CLAUDE_OPUS_MODEL },
1402797
- { title: "Claude Sonnet 4.6", value: CLAUDE_SONNET_MODEL },
1402798
- { title: "GPT-5.5", value: GPT_MODEL }
1403125
+ { title: "Claude Sonnet 5", value: CLAUDE_SONNET_MODEL },
1403126
+ { title: "GPT-5.6 Sol", value: GPT_HEAVY_MODEL }
1402799
1403127
  ],
1402800
- initial: config3.model === GPT_MODEL ? 2 : config3.model === CLAUDE_SONNET_MODEL ? 1 : 0
1403128
+ initial: config3.model === GPT_HEAVY_MODEL ? 2 : config3.model === CLAUDE_SONNET_MODEL ? 1 : 0
1402801
1403129
  });
1402802
1403130
  const nextModel = modelResult.model ?? config3.model;
1402803
1403131
  const providerChoices = getProviderChoices(nextModel);
@@ -1403248,7 +1403576,7 @@ var import_node_fs108 = __toESM(require("node:fs"), 1);
1403248
1403576
  var import_node_http7 = __toESM(require("node:http"), 1);
1403249
1403577
  var import_node_os52 = __toESM(require("node:os"), 1);
1403250
1403578
  var import_node_path121 = __toESM(require("node:path"), 1);
1403251
- var import_node_crypto31 = __toESM(require("node:crypto"), 1);
1403579
+ var import_node_crypto32 = __toESM(require("node:crypto"), 1);
1403252
1403580
  var import_node_url15 = require("node:url");
1403253
1403581
  init_config();
1403254
1403582
  init_version_check();
@@ -1407153,7 +1407481,7 @@ function startObsServer(options2 = {}) {
1407153
1407481
  const pathname = url3.pathname;
1407154
1407482
  const cookies = parseCookies(req.headers.cookie);
1407155
1407483
  const obsOwnerEmail = getObsOwnerEmail();
1407156
- const obsOwnerEmailHash = obsOwnerEmail ? import_node_crypto31.default.createHash("sha256").update(obsOwnerEmail).digest("hex") : null;
1407484
+ const obsOwnerEmailHash = obsOwnerEmail ? import_node_crypto32.default.createHash("sha256").update(obsOwnerEmail).digest("hex") : null;
1407157
1407485
  const hasObsSession = obsOwnerEmailHash !== null && cookies.get(OBS_AUTH_COOKIE) === obsOwnerEmailHash;
1407158
1407486
  const requireObsAuth = () => {
1407159
1407487
  if (hasObsSession)