@daex-dev/sdk 0.7.1 → 0.8.0

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.
@@ -1,5 +1,5 @@
1
- import { A as AgentChatEventEnvelope, P as ProviderStatus, D as DaexClientEvent, a as DaexClientEventMap, T as ThreadModelSelection, M as McpCapabilityReport, I as InstructionsCapability, S as SettingSourcesCapability, b as PermissionCapability, c as DaexChatClient, d as ThreadSummary, e as ThreadOpenOptions, f as ThreadResumeOptions } from '../client-C0KQKP8O.cjs';
2
- export { g as AdeError, h as AdeErrorCode, i as DaexError, j as DaexErrorCode } from '../client-C0KQKP8O.cjs';
1
+ import { A as AgentChatEventEnvelope, P as ProviderStatus, D as DaexClientEvent, a as DaexClientEventMap, T as ThreadModelSelection, M as McpCapabilityReport, I as InstructionsCapability, S as SettingSourcesCapability, b as PermissionCapability, c as DaexChatClient, d as ThreadSummary, e as ThreadOpenOptions, f as ThreadResumeOptions } from '../client-DVZHOtg6.cjs';
2
+ export { g as AdeError, h as AdeErrorCode, i as DaexError, j as DaexErrorCode } from '../client-DVZHOtg6.cjs';
3
3
 
4
4
  /**
5
5
  * The wire contract shared by the three Electron entry points.
@@ -1,5 +1,5 @@
1
- import { A as AgentChatEventEnvelope, P as ProviderStatus, D as DaexClientEvent, a as DaexClientEventMap, T as ThreadModelSelection, M as McpCapabilityReport, I as InstructionsCapability, S as SettingSourcesCapability, b as PermissionCapability, c as DaexChatClient, d as ThreadSummary, e as ThreadOpenOptions, f as ThreadResumeOptions } from '../client-C0KQKP8O.js';
2
- export { g as AdeError, h as AdeErrorCode, i as DaexError, j as DaexErrorCode } from '../client-C0KQKP8O.js';
1
+ import { A as AgentChatEventEnvelope, P as ProviderStatus, D as DaexClientEvent, a as DaexClientEventMap, T as ThreadModelSelection, M as McpCapabilityReport, I as InstructionsCapability, S as SettingSourcesCapability, b as PermissionCapability, c as DaexChatClient, d as ThreadSummary, e as ThreadOpenOptions, f as ThreadResumeOptions } from '../client-DVZHOtg6.js';
2
+ export { g as AdeError, h as AdeErrorCode, i as DaexError, j as DaexErrorCode } from '../client-DVZHOtg6.js';
3
3
 
4
4
  /**
5
5
  * The wire contract shared by the three Electron entry points.
package/dist/index.cjs CHANGED
@@ -497,7 +497,7 @@ function resolveTrustedWindowsTool(tool, deps = {}) {
497
497
 
498
498
  // src/download.ts
499
499
  var execFileAsync = (0, import_node_util.promisify)(import_node_child_process.execFile);
500
- var DEFAULT_RELEASE_REPO = "arul28/ADE";
500
+ var DEFAULT_RELEASE_REPO = "arul28/DAEX";
501
501
  function resolveRuntimeTarget(platform = process.platform, arch = process.arch) {
502
502
  const os3 = platform === "darwin" ? "darwin" : platform === "linux" ? "linux" : platform === "win32" ? "win32" : null;
503
503
  if (!os3) {
@@ -511,8 +511,24 @@ function resolveRuntimeTarget(platform = process.platform, arch = process.arch)
511
511
  throw new DaexError("binary_not_found", "DAEX only publishes a Windows x64 runtime.");
512
512
  }
513
513
  const target = `${os3}-${cpu}`;
514
- const binaryAsset = os3 === "win32" ? `ade-${target}.exe` : `ade-${target}`;
515
- return { target, binaryAsset, archiveAsset: `${binaryAsset}.native.tar.gz` };
514
+ const exe = os3 === "win32" ? ".exe" : "";
515
+ return {
516
+ target,
517
+ binaryAsset: `daex-${target}${exe}`,
518
+ archiveAsset: `daex-${target}.native.tar.gz`,
519
+ legacyBinaryAsset: `ade-${target}${exe}`,
520
+ legacyArchiveAsset: `ade-${target}.native.tar.gz`
521
+ };
522
+ }
523
+ function assetNamesFor(target, checksums) {
524
+ const current = { binary: target.binaryAsset, archive: target.archiveAsset };
525
+ const legacy = target.legacyBinaryAsset && target.legacyArchiveAsset ? { binary: target.legacyBinaryAsset, archive: target.legacyArchiveAsset } : null;
526
+ if (!legacy) return { primary: current, fallback: null };
527
+ if (checksums) {
528
+ const useLegacy = !checksums.has(current.binary) && checksums.has(legacy.binary);
529
+ return { primary: useLegacy ? legacy : current, fallback: null };
530
+ }
531
+ return { primary: current, fallback: legacy };
516
532
  }
517
533
  function assetUrl(repo, channel, asset) {
518
534
  const normalized = channel.trim() || "latest";
@@ -533,8 +549,9 @@ function parseChecksums(body) {
533
549
  function runtimeSpawnEnv(runtimeRoot, base = process.env, nodeModulesPath) {
534
550
  const nodeModules = nodeModulesPath?.trim() ? import_node_path2.default.resolve(nodeModulesPath.trim()) : import_node_path2.default.join(runtimeRoot, "node_modules");
535
551
  const previous = base.NODE_PATH?.trim();
552
+ const { DAEX_RUNTIME_ROOT: _hostRoot, DAEX_RUNTIME_NODE_MODULES: _hostModules, ...rest } = base;
536
553
  return {
537
- ...base,
554
+ ...rest,
538
555
  ADE_RUNTIME_ROOT: runtimeRoot,
539
556
  ADE_RUNTIME_NODE_MODULES: nodeModules,
540
557
  NODE_PATH: previous ? `${nodeModules}${import_node_path2.default.delimiter}${previous}` : nodeModules
@@ -551,31 +568,43 @@ var downloadRuntime = async (request) => {
551
568
  const { binaryPath, runtimeRoot } = runtimePaths(home, target);
552
569
  const cachedMarker = readChannelMarker(runtimeRoot);
553
570
  if (isUsableCachedRuntime(binaryPath, runtimeRoot) && cachedMarker != null && cachedMarker.channel === channel.trim()) {
554
- logger(`ade sdk: reusing cached runtime at ${binaryPath}`);
571
+ logger(`daex sdk: reusing cached runtime at ${binaryPath}`);
555
572
  return { binaryPath, runtimeRoot, checksumVerified: cachedMarker.checksumVerified };
556
573
  }
557
574
  const staging = import_node_path2.default.join(home, "cache", `download-${process.pid}-${Date.now()}`);
558
575
  await import_node_fs2.default.promises.mkdir(staging, { recursive: true });
559
576
  try {
560
- logger(`ade sdk: downloading ${target.binaryAsset} (${channel}) from ${repo}`);
561
- const binaryBytes = await fetchAsset(assetUrl(repo, channel, target.binaryAsset), signal);
562
- const archiveBytes = await fetchAsset(assetUrl(repo, channel, target.archiveAsset), signal);
563
- let checksumVerified = false;
564
577
  const checksums = await fetchChecksums(assetUrl(repo, channel, "SHA256SUMS"), signal);
565
- if (checksums) {
566
- verifyChecksum(target.binaryAsset, binaryBytes, checksums);
567
- verifyChecksum(target.archiveAsset, archiveBytes, checksums);
568
- checksumVerified = true;
569
- } else if (requireChecksum) {
578
+ if (!checksums && requireChecksum) {
570
579
  throw new DaexError(
571
580
  "checksum_mismatch",
572
581
  `The ${channel} channel published no SHA256SUMS, so the DAEX runtime download could not be verified. Pass requireChecksum: false to install it unverified.`
573
582
  );
583
+ }
584
+ const names = assetNamesFor(target, checksums);
585
+ let assets = names.primary;
586
+ logger(`daex sdk: downloading ${assets.binary} (${channel}) from ${repo}`);
587
+ const firstUrl = assetUrl(repo, channel, assets.binary);
588
+ const firstTry = await fetchAssetIfPresent(firstUrl, signal);
589
+ if (!firstTry && !names.fallback) {
590
+ throw new DaexError("download_failed", `Downloading ${firstUrl} failed with HTTP 404.`);
591
+ }
592
+ if (!firstTry && names.fallback) {
593
+ assets = names.fallback;
594
+ logger(`daex sdk: downloading ${assets.binary} (${channel}) from ${repo}`);
595
+ }
596
+ const binaryBytes = firstTry ?? await fetchAsset(assetUrl(repo, channel, assets.binary), signal);
597
+ const archiveBytes = await fetchAsset(assetUrl(repo, channel, assets.archive), signal);
598
+ let checksumVerified = false;
599
+ if (checksums) {
600
+ verifyChecksum(assets.binary, binaryBytes, checksums);
601
+ verifyChecksum(assets.archive, archiveBytes, checksums);
602
+ checksumVerified = true;
574
603
  } else {
575
- assertPlausibleSize(target.binaryAsset, binaryBytes);
576
- assertPlausibleSize(target.archiveAsset, archiveBytes);
604
+ assertPlausibleSize(assets.binary, binaryBytes);
605
+ assertPlausibleSize(assets.archive, archiveBytes);
577
606
  logger(
578
- `ade sdk: ${channel} published no SHA256SUMS and requireChecksum is off; verified download size only`
607
+ `daex sdk: ${channel} published no SHA256SUMS and requireChecksum is off; verified download size only`
579
608
  );
580
609
  }
581
610
  const stagedBinary = import_node_path2.default.join(staging, "ade");
@@ -598,7 +627,7 @@ var downloadRuntime = async (request) => {
598
627
  await import_node_fs2.default.promises.chmod(binaryPath, 493).catch(() => {
599
628
  });
600
629
  await writeChannelMarker(runtimeRoot, channel, checksumVerified);
601
- logger(`ade sdk: installed ADE runtime at ${binaryPath}`);
630
+ logger(`daex sdk: installed DAEX runtime at ${binaryPath}`);
602
631
  return { binaryPath, runtimeRoot, checksumVerified };
603
632
  } finally {
604
633
  await import_node_fs2.default.promises.rm(staging, { recursive: true, force: true }).catch(() => {
@@ -609,6 +638,13 @@ function isUsableCachedRuntime(binaryPath, runtimeRoot) {
609
638
  return import_node_fs2.default.existsSync(binaryPath) && import_node_fs2.default.existsSync(import_node_path2.default.join(runtimeRoot, "node_modules"));
610
639
  }
611
640
  async function fetchAsset(url, signal) {
641
+ const bytes = await fetchAssetIfPresent(url, signal);
642
+ if (!bytes) {
643
+ throw new DaexError("download_failed", `Downloading ${url} failed with HTTP 404.`);
644
+ }
645
+ return bytes;
646
+ }
647
+ async function fetchAssetIfPresent(url, signal) {
612
648
  let response;
613
649
  try {
614
650
  response = await fetch(url, { redirect: "follow", ...signal ? { signal } : {} });
@@ -617,6 +653,11 @@ async function fetchAsset(url, signal) {
617
653
  cause: error
618
654
  });
619
655
  }
656
+ if (response.status === 404) {
657
+ await response.body?.cancel().catch(() => {
658
+ });
659
+ return null;
660
+ }
620
661
  if (!response.ok) {
621
662
  throw new DaexError(
622
663
  "download_failed",
@@ -784,6 +825,9 @@ function runtimeBinaryIn(dir, platform, fileExists = isFile) {
784
825
  // src/bundledRuntime.ts
785
826
  var import_meta = {};
786
827
  function bundledRuntimePackageName(target) {
828
+ return `@daex-dev/runtime-${target}`;
829
+ }
830
+ function legacyBundledRuntimePackageName(target) {
787
831
  return `@ade-dev/runtime-${target}`;
788
832
  }
789
833
  function defaultResolveAnchor() {
@@ -820,14 +864,19 @@ function resolveBundledRuntime(options = {}) {
820
864
  } catch {
821
865
  return null;
822
866
  }
823
- const packageName = bundledRuntimePackageName(target);
824
867
  const anchor = options.resolveFrom ? anchorFile(options.resolveFrom) : defaultResolveAnchor();
825
- let manifestPath;
826
- try {
827
- manifestPath = (0, import_node_module.createRequire)(anchor).resolve(`${packageName}/package.json`);
828
- } catch {
829
- return null;
868
+ const requireFromAnchor = (0, import_node_module.createRequire)(anchor);
869
+ let packageName = "";
870
+ let manifestPath = "";
871
+ for (const candidate of [bundledRuntimePackageName(target), legacyBundledRuntimePackageName(target)]) {
872
+ try {
873
+ manifestPath = requireFromAnchor.resolve(`${candidate}/package.json`);
874
+ packageName = candidate;
875
+ break;
876
+ } catch {
877
+ }
830
878
  }
879
+ if (!packageName) return null;
831
880
  const packageRoot = import_node_path4.default.dirname(manifestPath);
832
881
  const { binaryPath, found } = runtimeBinaryIn(import_node_path4.default.join(packageRoot, "bin"), platform);
833
882
  const runtimeRoot = import_node_path4.default.join(packageRoot, "native");
@@ -953,7 +1002,7 @@ async function resolveBinary(options) {
953
1002
  const bundled = resolveBundled({ platform, arch });
954
1003
  if (bundled) {
955
1004
  logger(
956
- `ade sdk: using the runtime bundled in ${bundled.packageName}` + (bundled.version ? `@${bundled.version}` : "")
1005
+ `daex sdk: using the runtime bundled in ${bundled.packageName}` + (bundled.version ? `@${bundled.version}` : "")
957
1006
  );
958
1007
  return {
959
1008
  binaryPath: bundled.binaryPath,
@@ -963,7 +1012,7 @@ async function resolveBinary(options) {
963
1012
  checksumVerified: false
964
1013
  };
965
1014
  }
966
- tried.push("no @ade-dev/runtime-* platform package is installed");
1015
+ tried.push("no @daex-dev/runtime-* (or @ade-dev/runtime-*) platform package is installed");
967
1016
  const target = resolveRuntimeTarget(platform, arch);
968
1017
  const cached = runtimePaths(home, target, platform);
969
1018
  const cachedNodeModules = import_node_path6.default.join(cached.runtimeRoot, "node_modules");
@@ -980,7 +1029,7 @@ async function resolveBinary(options) {
980
1029
  for (const command of RUNTIME_COMMANDS) {
981
1030
  const onPath = discoverOnPath(command, env, platform);
982
1031
  if (onPath) {
983
- logger(`ade sdk: using the ${command} already installed at ${onPath}`);
1032
+ logger(`daex sdk: using the ${command} already installed at ${onPath}`);
984
1033
  return {
985
1034
  binaryPath: onPath,
986
1035
  runtimeRoot: null,
@@ -997,7 +1046,7 @@ async function resolveBinary(options) {
997
1046
  if (!allowDownload) {
998
1047
  throw new DaexError(
999
1048
  "runtime_unavailable",
1000
- `No DAEX runtime is available for ${target.target} and allowDownload is false, so none was fetched. Tried, in order: ${tried.join("; ")}. Install @ade-dev/runtime-${target.target}, or pass binaryPath (with runtimeNodeModules when the native modules are not beside the binary).`
1049
+ `No DAEX runtime is available for ${target.target} and allowDownload is false, so none was fetched. Tried, in order: ${tried.join("; ")}. Install @daex-dev/runtime-${target.target}, or pass binaryPath (with runtimeNodeModules when the native modules are not beside the binary).`
1001
1050
  );
1002
1051
  }
1003
1052
  const result = await download({ home, channel, repo, target, logger });
@@ -1055,7 +1104,7 @@ async function readBinaryVersion(binary, env = process.env) {
1055
1104
  const { binaryPath, runtimeRoot, nodeModulesPath } = binary;
1056
1105
  try {
1057
1106
  const spawnEnv = runtimeRoot ? runtimeSpawnEnv(runtimeRoot, env, nodeModulesPath ?? void 0) : env;
1058
- const resolvedEnv = { ...spawnEnv, ADE_CLI_NO_DELEGATE: "1" };
1107
+ const resolvedEnv = { ...spawnEnv, ADE_CLI_NO_DELEGATE: "1", DAEX_CLI_NO_DELEGATE: "1" };
1059
1108
  const invocation = resolveSpawnInvocation(binaryPath, ["--version"], resolvedEnv);
1060
1109
  const { stdout } = await execFileAsync2(invocation.command, invocation.args, {
1061
1110
  env: resolvedEnv,
@@ -1080,7 +1129,7 @@ function isAdeClientEvent(value) {
1080
1129
  var ADE_CLIENT_EVENTS = DAEX_CLIENT_EVENTS;
1081
1130
 
1082
1131
  // src/version.ts
1083
- var SDK_VERSION = true ? "0.7.1" : "0.7.1";
1132
+ var SDK_VERSION = true ? "0.8.0" : "0.8.0";
1084
1133
 
1085
1134
  // src/doctorReport.ts
1086
1135
  function legacyBinarySource(source) {
@@ -1203,7 +1252,7 @@ var ChatEventStream = class {
1203
1252
  return;
1204
1253
  } catch (error) {
1205
1254
  this.logger(
1206
- `ade sdk: push events unavailable (${errorMessage(error)}); falling back to polling`
1255
+ `daex sdk: push events unavailable (${errorMessage(error)}); falling back to polling`
1207
1256
  );
1208
1257
  this.mode = "drain";
1209
1258
  }
@@ -1256,11 +1305,11 @@ var ChatEventStream = class {
1256
1305
  if (this.disposed) return;
1257
1306
  this.mode = "unavailable";
1258
1307
  this.subscriptionId = null;
1259
- this.logger("ade sdk: chat event stream lost its connection");
1308
+ this.logger("daex sdk: chat event stream lost its connection");
1260
1309
  });
1261
1310
  this.applyBufferMetadata(result);
1262
1311
  for (const payload of pending.splice(0)) this.consumeNotification(payload);
1263
- this.logger(`ade sdk: chat events streaming (push, subscription ${result.subscriptionId})`);
1312
+ this.logger(`daex sdk: chat events streaming (push, subscription ${result.subscriptionId})`);
1264
1313
  }
1265
1314
  consumeNotification(payload) {
1266
1315
  if (payload.subscriptionId !== this.subscriptionId) return;
@@ -1272,7 +1321,7 @@ var ChatEventStream = class {
1272
1321
  this.emit(event);
1273
1322
  }
1274
1323
  startDrain() {
1275
- this.logger("ade sdk: chat events streaming (drain fallback)");
1324
+ this.logger("daex sdk: chat events streaming (drain fallback)");
1276
1325
  this.scheduleDrain(0);
1277
1326
  }
1278
1327
  scheduleDrain(delayMs) {
@@ -1887,7 +1936,7 @@ function createProviderStatusPublisher(options) {
1887
1936
  if (!warnedAboutDerived) {
1888
1937
  warnedAboutDerived = true;
1889
1938
  logger(
1890
- 'ade sdk: this runtime has no providers.status RPC, so provider records are derived from the model catalog (source "derived"): installed is modelCount > 0, and binaryPath, version and the remediation commands are null'
1939
+ 'daex sdk: this runtime has no providers.status RPC, so provider records are derived from the model catalog (source "derived"): installed is modelCount > 0, and binaryPath, version and the remediation commands are null'
1891
1940
  );
1892
1941
  }
1893
1942
  return null;
@@ -1899,7 +1948,7 @@ function createProviderStatusPublisher(options) {
1899
1948
  if (!warnedAboutDerived) {
1900
1949
  warnedAboutDerived = true;
1901
1950
  logger(
1902
- `ade sdk: the runtime advertised providers.status but the call failed (${errorMessage(error)}); provider records fall back to catalog derivation with source "derived"`
1951
+ `daex sdk: the runtime advertised providers.status but the call failed (${errorMessage(error)}); provider records fall back to catalog derivation with source "derived"`
1903
1952
  );
1904
1953
  }
1905
1954
  return null;
@@ -2491,11 +2540,11 @@ async function reclaimStaleRuntime(options) {
2491
2540
  if (answered) {
2492
2541
  const ownerAlive = record3.parentPid === process.pid || record3.parentPid > 0 && isAlive(record3.parentPid);
2493
2542
  if (ownerAlive) {
2494
- logger(`ade sdk: reusing the runtime already listening on ${socketPath} (pid ${record3.pid})`);
2543
+ logger(`daex sdk: reusing the runtime already listening on ${socketPath} (pid ${record3.pid})`);
2495
2544
  return { action: "reused", pid: record3.pid };
2496
2545
  }
2497
2546
  logger(
2498
- `ade sdk: the runtime on ${socketPath} (pid ${record3.pid}) is answering but its owner (pid ${record3.parentPid}) is gone, so its watchdog is about to end it; reclaiming instead of adopting`
2547
+ `daex sdk: the runtime on ${socketPath} (pid ${record3.pid}) is answering but its owner (pid ${record3.parentPid}) is gone, so its watchdog is about to end it; reclaiming instead of adopting`
2499
2548
  );
2500
2549
  }
2501
2550
  }
@@ -2517,7 +2566,7 @@ async function reclaimStaleRuntime(options) {
2517
2566
  };
2518
2567
  }
2519
2568
  logger(
2520
- `ade sdk: reclaiming a stale ADE runtime for this home (pid ${record3.pid}, ${socketPath})`
2569
+ `daex sdk: reclaiming a stale ADE runtime for this home (pid ${record3.pid}, ${socketPath})`
2521
2570
  );
2522
2571
  try {
2523
2572
  kill(record3.pid, "SIGTERM");
@@ -2613,6 +2662,7 @@ var FORWARDED_ADE_ENV_VARS = /* @__PURE__ */ new Set([
2613
2662
  function scrubAdeEnv(env) {
2614
2663
  const result = {};
2615
2664
  for (const [key, value] of Object.entries(env)) {
2665
+ if (key.startsWith("DAEX_")) continue;
2616
2666
  if (key.startsWith("ADE_") && !FORWARDED_ADE_ENV_VARS.has(key)) continue;
2617
2667
  result[key] = value;
2618
2668
  }
@@ -2719,7 +2769,7 @@ async function startSidecar(options) {
2719
2769
  };
2720
2770
  const args = ["runtime", "run", "--socket", socketPath, "--profile", "embedded"];
2721
2771
  const invocation = resolveSpawnInvocation(binaryPath, args, childEnv);
2722
- logger(`ade sdk: spawning ${binaryPath} ${args.join(" ")}`);
2772
+ logger(`daex sdk: spawning ${binaryPath} ${args.join(" ")}`);
2723
2773
  let child;
2724
2774
  try {
2725
2775
  child = (0, import_node_child_process5.spawn)(invocation.command, invocation.args, {
@@ -2801,7 +2851,7 @@ ${stderrTail.join("\n")}` : ""}`
2801
2851
  startedAt: (/* @__PURE__ */ new Date()).toISOString()
2802
2852
  });
2803
2853
  } catch (error) {
2804
- logger(`ade sdk: could not record the runtime pidfile: ${errorMessage(error)}`);
2854
+ logger(`daex sdk: could not record the runtime pidfile: ${errorMessage(error)}`);
2805
2855
  }
2806
2856
  }
2807
2857
  return {
@@ -2971,7 +3021,7 @@ var RuntimeSupervisor = class _RuntimeSupervisor {
2971
3021
  supervisor.handshaken = await supervisor.handshake(supervisor.bound);
2972
3022
  const capabilities = supervisor.capabilities();
2973
3023
  if (capabilities && Array.isArray(capabilities.actions) && capabilities.actions.length === 0) {
2974
- deps.logger("ade sdk: the runtime reports no personal chat actions; calls will fail");
3024
+ deps.logger("daex sdk: the runtime reports no personal chat actions; calls will fail");
2975
3025
  }
2976
3026
  supervisor.stream = await supervisor.startEvents();
2977
3027
  supervisor.watch();
@@ -3123,7 +3173,7 @@ var RuntimeSupervisor = class _RuntimeSupervisor {
3123
3173
  }
3124
3174
  const verdict = checkRuntimeCompatibility(result.runtimeInfo?.version ?? null);
3125
3175
  if (!verdict.supported) {
3126
- const line = `ade sdk: runtime ${verdict.version ?? "(unknown version)"} is outside the range this SDK supports (${SUPPORTED_RUNTIME_RANGE})` + (verdict.note ? ` \u2014 ${verdict.note}` : "");
3176
+ const line = `daex sdk: runtime ${verdict.version ?? "(unknown version)"} is outside the range this SDK supports (${SUPPORTED_RUNTIME_RANGE})` + (verdict.note ? ` \u2014 ${verdict.note}` : "");
3127
3177
  if (options.requireCompatibleRuntime) {
3128
3178
  bound.connection.close();
3129
3179
  await bound.sidecar?.stop();
@@ -3225,7 +3275,7 @@ var RuntimeSupervisor = class _RuntimeSupervisor {
3225
3275
  this.stream = await this.startEvents();
3226
3276
  this.watch();
3227
3277
  await this.deps.onRebound();
3228
- logger(`ade sdk: runtime restarted (attempt ${attempt})`);
3278
+ logger(`daex sdk: runtime restarted (attempt ${attempt})`);
3229
3279
  emitClient("restart", { attempt, ok: true, error: null, final: true });
3230
3280
  emitClient("transport", { state: "reconnected", error: null });
3231
3281
  return;
@@ -3239,7 +3289,7 @@ var RuntimeSupervisor = class _RuntimeSupervisor {
3239
3289
  });
3240
3290
  }
3241
3291
  }
3242
- logger(`ade sdk: gave up restarting the runtime after ${policy.maxAttempts} attempts`);
3292
+ logger(`daex sdk: gave up restarting the runtime after ${policy.maxAttempts} attempts`);
3243
3293
  }
3244
3294
  };
3245
3295
 
@@ -3825,7 +3875,7 @@ async function withResolvedHeaders(key, servers, resolve) {
3825
3875
  function missingHeadersWarning(key, missing) {
3826
3876
  if (missing.length === 0) return null;
3827
3877
  const list = missing.map((entry) => `${entry.server} (${entry.headerNames.join(", ")})`).join("; ");
3828
- return `ade sdk: thread "${key}" MCP servers need header values the SDK does not persist: ${list}. They were sent without them. Pass refresh.mcpServers to threads.open, or an mcpHeaders callback to createDaexChat, so the host supplies current credentials.`;
3878
+ return `daex sdk: thread "${key}" MCP servers need header values the SDK does not persist: ${list}. They were sent without them. Pass refresh.mcpServers to threads.open, or an mcpHeaders callback to createDaexChat, so the host supplies current credentials.`;
3829
3879
  }
3830
3880
  function mcpServersFingerprint(servers) {
3831
3881
  const canonical = (value) => {
@@ -4275,7 +4325,7 @@ var ApprovalTracker = class {
4275
4325
  if (!this.observed.has(observed.itemId)) return;
4276
4326
  const { key, chats, logger } = this.deps;
4277
4327
  logger(
4278
- `ade sdk: thread "${key}" approval "${observed.itemId}" was unanswered for ${timeoutMs}ms; declining it (approvalTimeoutMs)`
4328
+ `daex sdk: thread "${key}" approval "${observed.itemId}" was unanswered for ${timeoutMs}ms; declining it (approvalTimeoutMs)`
4279
4329
  );
4280
4330
  void chats.approve({
4281
4331
  sessionId: this.deps.sessionId(),
@@ -4286,7 +4336,7 @@ var ApprovalTracker = class {
4286
4336
  this.observed.delete(observed.itemId);
4287
4337
  }).catch((error) => {
4288
4338
  logger(
4289
- `ade sdk: thread "${key}" could not decline timed-out approval "${observed.itemId}": ${errorMessage(error)}`
4339
+ `daex sdk: thread "${key}" could not decline timed-out approval "${observed.itemId}": ${errorMessage(error)}`
4290
4340
  );
4291
4341
  });
4292
4342
  }, timeoutMs);
@@ -4646,13 +4696,13 @@ var Thread = class {
4646
4696
  }
4647
4697
  });
4648
4698
  void this.chats.interrupt(this.id).catch((error) => {
4649
- this.logger(`ade sdk: could not interrupt thread "${this.key}" after its budget was exceeded: ${String(error)}`);
4699
+ this.logger(`daex sdk: could not interrupt thread "${this.key}" after its budget was exceeded: ${String(error)}`);
4650
4700
  });
4651
4701
  }
4652
4702
  }
4653
4703
  }).catch((error) => {
4654
4704
  this.usageInitializationError = error instanceof Error ? error : new Error(String(error));
4655
- this.logger(`ade sdk: could not load usage history for thread "${this.key}": ${this.usageInitializationError.message}`);
4705
+ this.logger(`daex sdk: could not load usage history for thread "${this.key}": ${this.usageInitializationError.message}`);
4656
4706
  });
4657
4707
  await this.usageInitialization;
4658
4708
  }
@@ -4694,7 +4744,7 @@ var Thread = class {
4694
4744
  });
4695
4745
  if (type !== "done" && type !== "status" && this.currentTurnId) {
4696
4746
  void this.chats.interrupt(this.id).catch((error) => {
4697
- this.logger(`ade sdk: could not interrupt thread "${this.key}" after its budget was exceeded: ${String(error)}`);
4747
+ this.logger(`daex sdk: could not interrupt thread "${this.key}" after its budget was exceeded: ${String(error)}`);
4698
4748
  });
4699
4749
  }
4700
4750
  }
@@ -5031,7 +5081,7 @@ var Thread = class {
5031
5081
  if (problem === this.lastMcpRefreshProblem) return;
5032
5082
  this.lastMcpRefreshProblem = problem;
5033
5083
  this.logger(
5034
- `ade sdk: thread "${this.key}" could not refresh its MCP headers before the turn: ${problem}. The turn runs with the headers the session already has.`
5084
+ `daex sdk: thread "${this.key}" could not refresh its MCP headers before the turn: ${problem}. The turn runs with the headers the session already has.`
5035
5085
  );
5036
5086
  }
5037
5087
  }
@@ -5098,7 +5148,7 @@ var Thread = class {
5098
5148
  if (!this.warnedAboutDerivedApprovals) {
5099
5149
  this.warnedAboutDerivedApprovals = true;
5100
5150
  this.logger(
5101
- `ade sdk: this runtime has no pendingInputs action, so pendingApprovals() for "${this.key}" is derived from the events this client observed; approvals raised before it connected are not listed`
5151
+ `daex sdk: this runtime has no pendingInputs action, so pendingApprovals() for "${this.key}" is derived from the events this client observed; approvals raised before it connected are not listed`
5102
5152
  );
5103
5153
  }
5104
5154
  return this.approvals.values().map(
@@ -5248,7 +5298,7 @@ var Thread = class {
5248
5298
  if (this.warnedAboutHistoryPage) return;
5249
5299
  this.warnedAboutHistoryPage = true;
5250
5300
  this.logger(
5251
- `ade sdk: this runtime has no getEventHistoryPage action, so historyPage() for "${this.key}" can only return the newest page; older pages come back empty`
5301
+ `daex sdk: this runtime has no getEventHistoryPage action, so historyPage() for "${this.key}" can only return the newest page; older pages come back empty`
5252
5302
  );
5253
5303
  }
5254
5304
  });
@@ -5283,40 +5333,40 @@ function threadOpenWarnings(input) {
5283
5333
  const expectsCapabilityReport = suppliedServers || loadUserMcpServers === false;
5284
5334
  if (expectsCapabilityReport && !mcpCapability) {
5285
5335
  lines.push(
5286
- `ade sdk: thread "${key}" requested MCP but the runtime reported no capability; treat the guarantee as unverified`
5336
+ `daex sdk: thread "${key}" requested MCP but the runtime reported no capability; treat the guarantee as unverified`
5287
5337
  );
5288
5338
  }
5289
5339
  if (suppliedServers && mcpCapability?.level === "unsupported") {
5290
5340
  lines.push(
5291
- `ade sdk: thread "${key}" opened WITHOUT the requested MCP servers (${mcpCapability.mechanism})`
5341
+ `daex sdk: thread "${key}" opened WITHOUT the requested MCP servers (${mcpCapability.mechanism})`
5292
5342
  );
5293
5343
  }
5294
5344
  if (mcpCapability?.residual) {
5295
- lines.push(`ade sdk: thread "${key}" MCP strict mode is best-effort: ${mcpCapability.residual}`);
5345
+ lines.push(`daex sdk: thread "${key}" MCP strict mode is best-effort: ${mcpCapability.residual}`);
5296
5346
  }
5297
5347
  if (instructions && !instructionsCapability) {
5298
5348
  lines.push(
5299
- `ade sdk: thread "${key}" sent instructions but the runtime reported no capability; treat the text as possibly not delivered`
5349
+ `daex sdk: thread "${key}" sent instructions but the runtime reported no capability; treat the text as possibly not delivered`
5300
5350
  );
5301
5351
  }
5302
5352
  if (settingSources && !settingSourcesCapability) {
5303
5353
  lines.push(
5304
- `ade sdk: thread "${key}" sent settingSources but the runtime reported no capability; the provider's configuration layers are unknown`
5354
+ `daex sdk: thread "${key}" sent settingSources but the runtime reported no capability; the provider's configuration layers are unknown`
5305
5355
  );
5306
5356
  }
5307
5357
  if (permissionPolicy && !permissionCapability) {
5308
5358
  lines.push(
5309
- `ade sdk: thread "${key}" sent a permission policy but the runtime reported no capability; treat the policy as unenforced`
5359
+ `daex sdk: thread "${key}" sent a permission policy but the runtime reported no capability; treat the policy as unenforced`
5310
5360
  );
5311
5361
  }
5312
5362
  if (instructionsCapability && instructionsCapability.level !== "applied") {
5313
5363
  lines.push(
5314
- `ade sdk: thread "${key}" instructions are ${instructionsCapability.level}${instructionsCapability.detail ? `: ${instructionsCapability.detail}` : ""}`
5364
+ `daex sdk: thread "${key}" instructions are ${instructionsCapability.level}${instructionsCapability.detail ? `: ${instructionsCapability.detail}` : ""}`
5315
5365
  );
5316
5366
  }
5317
5367
  if (settingSourcesCapability && settingSourcesCapability.level === "ignored") {
5318
5368
  lines.push(
5319
- `ade sdk: thread "${key}" settingSources was ignored by this provider${settingSourcesCapability.detail ? `: ${settingSourcesCapability.detail}` : ""}`
5369
+ `daex sdk: thread "${key}" settingSources was ignored by this provider${settingSourcesCapability.detail ? `: ${settingSourcesCapability.detail}` : ""}`
5320
5370
  );
5321
5371
  }
5322
5372
  if (permissionPolicy?.fallback === "deny") {
@@ -5324,20 +5374,20 @@ function threadOpenWarnings(input) {
5324
5374
  const blocked = mcpServersNotCoveredByPolicy(permissionPolicy, Object.keys(mcpServers));
5325
5375
  if (blocked.length > 0) {
5326
5376
  lines.push(
5327
- `ade sdk: thread "${key}" fallback: deny blocks every tool of MCP servers not named by the policy: ${blocked.join(", ")}`
5377
+ `daex sdk: thread "${key}" fallback: deny blocks every tool of MCP servers not named by the policy: ${blocked.join(", ")}`
5328
5378
  );
5329
5379
  }
5330
5380
  }
5331
5381
  const toolEntries = individualMcpToolEntries(permissionPolicy);
5332
5382
  if (toolEntries.length > 0) {
5333
5383
  lines.push(
5334
- `ade sdk: thread "${key}" names individual MCP tools (${toolEntries.join(", ")}); on Claude an individual MCP tool entry admits the whole server; read permissionCapability.residual`
5384
+ `daex sdk: thread "${key}" names individual MCP tools (${toolEntries.join(", ")}); on Claude an individual MCP tool entry admits the whole server; read permissionCapability.residual`
5335
5385
  );
5336
5386
  }
5337
5387
  }
5338
5388
  if (permissionCapability && permissionCapability.level !== "enforced") {
5339
5389
  lines.push(
5340
- `ade sdk: thread "${key}" permission policy is ${permissionCapability.level}${permissionCapability.residual ? `: ${permissionCapability.residual}` : ""}`
5390
+ `daex sdk: thread "${key}" permission policy is ${permissionCapability.level}${permissionCapability.residual ? `: ${permissionCapability.residual}` : ""}`
5341
5391
  );
5342
5392
  }
5343
5393
  return lines;
@@ -5355,7 +5405,7 @@ function threadResumeMismatchWarnings(input) {
5355
5405
  const { key, supplied, stored } = input;
5356
5406
  const verb = input.verb ?? "resumed";
5357
5407
  const lines = [];
5358
- const ignored = (field, storedValue) => `ade sdk: thread "${key}" ${verb} with its stored ${field} (${storedValue}); the ${field} passed to open() was ignored`;
5408
+ const ignored = (field, storedValue) => `daex sdk: thread "${key}" ${verb} with its stored ${field} (${storedValue}); the ${field} passed to open() was ignored`;
5359
5409
  if (supplied.cwd !== void 0 && supplied.cwd !== stored.cwd) {
5360
5410
  lines.push(ignored("cwd", stored.cwd ?? "the runtime's default workspace"));
5361
5411
  }
@@ -5514,7 +5564,7 @@ function createThreadOpener(ctx) {
5514
5564
  const needing = Object.values(source).filter(isRemoteWithHeaders).length;
5515
5565
  if (resolved.missing.length >= needing) {
5516
5566
  logger(
5517
- `ade sdk: thread "${key}" did not re-send its MCP servers: the mcpHeaders callback supplied no header values for ${resolved.missing.map((entry) => entry.server).join(", ")}, and re-sending would replace the session's current credentials with none`
5567
+ `daex sdk: thread "${key}" did not re-send its MCP servers: the mcpHeaders callback supplied no header values for ${resolved.missing.map((entry) => entry.server).join(", ")}, and re-sending would replace the session's current credentials with none`
5518
5568
  );
5519
5569
  return null;
5520
5570
  }
@@ -5523,13 +5573,13 @@ function createThreadOpener(ctx) {
5523
5573
  if (warning) logger(warning);
5524
5574
  if (!ctx.runtime.updateMcpServers()) {
5525
5575
  logger(
5526
- `ade sdk: thread "${key}" could not refresh its MCP servers: this runtime does not advertise capabilities.personalChats.updateMcpServers, so it keeps the servers it already has`
5576
+ `daex sdk: thread "${key}" could not refresh its MCP servers: this runtime does not advertise capabilities.personalChats.updateMcpServers, so it keeps the servers it already has`
5527
5577
  );
5528
5578
  return null;
5529
5579
  }
5530
5580
  if (hasMcpToolFilters(resolved.servers) && !ctx.runtime.mcpToolFilters()) {
5531
5581
  logger(
5532
- `ade sdk: thread "${key}" could not refresh its MCP servers: they carry allowedTools / disallowedTools and this runtime does not advertise capabilities.personalChats.mcpToolFilters, so it would drop them`
5582
+ `daex sdk: thread "${key}" could not refresh its MCP servers: they carry allowedTools / disallowedTools and this runtime does not advertise capabilities.personalChats.mcpToolFilters, so it would drop them`
5533
5583
  );
5534
5584
  return null;
5535
5585
  }
@@ -5549,7 +5599,7 @@ function createThreadOpener(ctx) {
5549
5599
  const budget = validateThreadBudget(record3.budget ?? opts.budget);
5550
5600
  if (!record3.budget && budget) await persistThread(key)({ budget });
5551
5601
  else if (record3.budget && opts.budget && !sameJson(record3.budget, opts.budget)) {
5552
- logger(`ade sdk: thread "${key}" ignored a different budget on resume; the stored budget remains in force`);
5602
+ logger(`daex sdk: thread "${key}" ignored a different budget on resume; the stored budget remains in force`);
5553
5603
  }
5554
5604
  await pushResolvedSecret(summary.sessionId, record3.provider || summary.provider, record3.credentialId);
5555
5605
  await persistThread(key)({ title: summary.title ?? record3.title ?? null });
@@ -5641,7 +5691,7 @@ function createThreadOpener(ctx) {
5641
5691
  recordError("getSummary", error);
5642
5692
  }
5643
5693
  if (summary?.sessionId) return resumeThread(key, record3, summary, opts, { supplied, stored });
5644
- logger(`ade sdk: thread "${key}" pointed at a session the runtime no longer has; creating a new one`);
5694
+ logger(`daex sdk: thread "${key}" pointed at a session the runtime no longer has; creating a new one`);
5645
5695
  for (const line of threadResumeMismatchWarnings({ key, verb: "recreated", supplied, stored })) logger(line);
5646
5696
  }
5647
5697
  return createThread(key, opts, record3);
@@ -5663,7 +5713,7 @@ function createThreadOpener(ctx) {
5663
5713
  const value = stored ?? requested;
5664
5714
  if (value === void 0 || !providerCapabilities || supported(value)) return value;
5665
5715
  if (stored === void 0) throw new DaexError("invalid_option", refusal(value));
5666
- logger(`ade sdk: thread "${key}" dropped a stored setting its provider no longer supports: ${refusal(value)}`);
5716
+ logger(`daex sdk: thread "${key}" dropped a stored setting its provider no longer supports: ${refusal(value)}`);
5667
5717
  return void 0;
5668
5718
  };
5669
5719
  const permissionMode = fits(
@@ -5949,10 +5999,10 @@ var ThreadStore = class _ThreadStore {
5949
5999
  if (migrated) {
5950
6000
  try {
5951
6001
  await this.writeFile(file);
5952
- this.logger(`ade sdk: removed stored MCP header values from ${this.filePath}; only header names are kept`);
6002
+ this.logger(`daex sdk: removed stored MCP header values from ${this.filePath}; only header names are kept`);
5953
6003
  } catch (error) {
5954
6004
  this.logger(
5955
- `ade sdk: could not rewrite ${this.filePath} to remove stored MCP header values (${errorMessage(error)})`
6005
+ `daex sdk: could not rewrite ${this.filePath} to remove stored MCP header values (${errorMessage(error)})`
5956
6006
  );
5957
6007
  }
5958
6008
  }
@@ -5961,7 +6011,7 @@ var ThreadStore = class _ThreadStore {
5961
6011
  const code = error.code;
5962
6012
  if (code !== "ENOENT") {
5963
6013
  this.logger(
5964
- `ade sdk: ${this.filePath} was unreadable (${errorMessage(error)}); starting a new thread map`
6014
+ `daex sdk: ${this.filePath} was unreadable (${errorMessage(error)}); starting a new thread map`
5965
6015
  );
5966
6016
  }
5967
6017
  this.cache = { version: 1, threads: {} };
@@ -6074,7 +6124,7 @@ async function createDaexChat(options) {
6074
6124
  const recordError = (scope, error) => {
6075
6125
  recentErrors.push({ at: (/* @__PURE__ */ new Date()).toISOString(), scope, message: errorMessage(error) });
6076
6126
  while (recentErrors.length > MAX_RECENT_ERRORS) recentErrors.shift();
6077
- logger(`ade sdk: ${scope} failed: ${errorMessage(error)}`);
6127
+ logger(`daex sdk: ${scope} failed: ${errorMessage(error)}`);
6078
6128
  };
6079
6129
  let disposed = false;
6080
6130
  const assertUsable = () => {
@@ -6086,7 +6136,7 @@ async function createDaexChat(options) {
6086
6136
  try {
6087
6137
  listener(payload);
6088
6138
  } catch (error) {
6089
- logger(`ade sdk: a "${event}" listener threw: ${errorMessage(error)}`);
6139
+ logger(`daex sdk: a "${event}" listener threw: ${errorMessage(error)}`);
6090
6140
  }
6091
6141
  }
6092
6142
  };
@@ -6275,7 +6325,7 @@ async function createDaexChat(options) {
6275
6325
  }
6276
6326
  if (refresh.mcpServers) {
6277
6327
  await existing.updateMcpServers(refresh.mcpServers).catch((error) => {
6278
- logger(`ade sdk: thread "${trimmedKey}" could not apply refresh.mcpServers: ${errorMessage(error)}`);
6328
+ logger(`daex sdk: thread "${trimmedKey}" could not apply refresh.mcpServers: ${errorMessage(error)}`);
6279
6329
  });
6280
6330
  }
6281
6331
  return existing;
@@ -6338,7 +6388,7 @@ async function createDaexChat(options) {
6338
6388
  try {
6339
6389
  listener(models);
6340
6390
  } catch (error) {
6341
- logger(`ade sdk: a models.onChange listener threw: ${errorMessage(error)}`);
6391
+ logger(`daex sdk: a models.onChange listener threw: ${errorMessage(error)}`);
6342
6392
  }
6343
6393
  }
6344
6394
  }).catch((error) => recordError("models.onChange", error));
@@ -6545,7 +6595,7 @@ async function createDaexChat(options) {
6545
6595
  clientListeners.clear();
6546
6596
  await runtime.dispose();
6547
6597
  hub.clear();
6548
- logger("ade sdk: disposed");
6598
+ logger("daex sdk: disposed");
6549
6599
  }
6550
6600
  };
6551
6601
  return client;