@trops/dash-core 0.1.688 → 0.1.689

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.
@@ -61023,6 +61023,7 @@ const cliController$2 = {
61023
61023
 
61024
61024
  cliController$3.exports = cliController$2;
61025
61025
  cliController$3.exports.buildClaudeCliArgs = buildClaudeCliArgs;
61026
+ cliController$3.exports.resolveCliBinary = resolveCliBinary;
61026
61027
 
61027
61028
  var cliControllerExports = cliController$3.exports;
61028
61029
 
@@ -75893,6 +75894,32 @@ function __setQueryForTest(fn) {
75893
75894
  _queryImpl = fn;
75894
75895
  }
75895
75896
 
75897
+ // Test seam: injected CLI lookup (see __setCliResolverForTest).
75898
+ let _cliResolver = null;
75899
+
75900
+ /** @param {Function|null} fn */
75901
+ function __setCliResolverForTest(fn) {
75902
+ _cliResolver = fn;
75903
+ }
75904
+
75905
+ function _resolveInstalledCli() {
75906
+ if (_cliResolver) return _cliResolver();
75907
+ // Same lookup the Assistant's CLI backend uses (login-shell PATH + `which`).
75908
+ // Lazy require: keeps this module loadable under plain Node.
75909
+ return cliControllerExports.resolveCliBinary();
75910
+ }
75911
+
75912
+ /**
75913
+ * The user's installed `claude`, if the SDK can spawn it. The SDK spawns the
75914
+ * path directly (no shell), so a Windows .cmd/.ps1 shim won't start — use the
75915
+ * SDK's bundled CLI instead.
75916
+ */
75917
+ function usableCliPath(cliPath, platform = process.platform) {
75918
+ if (!cliPath) return null;
75919
+ if (platform === "win32" && !/\.exe$/i.test(cliPath)) return null;
75920
+ return cliPath;
75921
+ }
75922
+
75896
75923
  async function _loadQuery() {
75897
75924
  if (_queryImpl) return _queryImpl;
75898
75925
  const mod = await import('@anthropic-ai/claude-agent-sdk');
@@ -76024,6 +76051,16 @@ async function _runAgent(ctx, stream) {
76024
76051
  strictMcpConfig: true,
76025
76052
  env,
76026
76053
  };
76054
+ // Run the user's installed Claude Code CLI — the one they chose and logged
76055
+ // into. The SDK's bundled CLI is per-platform and the packaged app only
76056
+ // carries the build machine's (arm64), so it's missing on Intel Macs.
76057
+ let cliPath = null;
76058
+ try {
76059
+ cliPath = usableCliPath(_resolveInstalledCli());
76060
+ } catch (_e) {
76061
+ cliPath = null;
76062
+ }
76063
+ if (cliPath) options.pathToClaudeCodeExecutable = cliPath;
76027
76064
  // Read-only bots (team leads) get none of the SDK's built-ins — no shell,
76028
76065
  // files, or web; only their bridged team tools.
76029
76066
  if (ctx.builtinTools === "none") options.tools = [];
@@ -76111,9 +76148,20 @@ const claudeAgentEngine$1 = {
76111
76148
  try {
76112
76149
  await _runAgent(ctx, stream);
76113
76150
  } catch (err) {
76151
+ const message = (err && err.message) || "";
76152
+ // No installed CLI and no bundled one for this platform.
76153
+ if (/Native CLI binary for .* not found/.test(message)) {
76154
+ stream.push({
76155
+ type: "error",
76156
+ message:
76157
+ "Claude Code CLI not found. Install Claude Code, or choose another AI provider for this bot.",
76158
+ code: "CLAUDE_CLI_NOT_FOUND",
76159
+ });
76160
+ return;
76161
+ }
76114
76162
  stream.push({
76115
76163
  type: "error",
76116
- message: (err && err.message) || "Claude Agent engine error",
76164
+ message: message || "Claude Agent engine error",
76117
76165
  code: (err && err.code) || "CLAUDE_AGENT_ERROR",
76118
76166
  });
76119
76167
  } finally {
@@ -76126,6 +76174,8 @@ const claudeAgentEngine$1 = {
76126
76174
 
76127
76175
  claudeAgentEngine$2.exports = claudeAgentEngine$1;
76128
76176
  claudeAgentEngine$2.exports.__setQueryForTest = __setQueryForTest;
76177
+ claudeAgentEngine$2.exports.__setCliResolverForTest = __setCliResolverForTest;
76178
+ claudeAgentEngine$2.exports.usableCliPath = usableCliPath;
76129
76179
 
76130
76180
  var claudeAgentEngineExports = claudeAgentEngine$2.exports;
76131
76181