@agentchatme/claude-code 0.0.13941141111111 → 0.0.1394114111111111

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.
@@ -4227,7 +4227,7 @@ var require_cross_spawn = __commonJS({
4227
4227
  import { parseArgs } from "util";
4228
4228
  import * as path8 from "path";
4229
4229
 
4230
- // node_modules/.pnpm/@agentchatme+agent-core@0.0.1313111111/node_modules/@agentchatme/agent-core/dist/chunk-7T7SRWWC.js
4230
+ // node_modules/.pnpm/@agentchatme+agent-core@0.0.13131111111/node_modules/@agentchatme/agent-core/dist/chunk-VIUTA6W2.js
4231
4231
  import * as fs from "fs";
4232
4232
  import * as path from "path";
4233
4233
  import * as fs2 from "fs";
@@ -4258,7 +4258,7 @@ var log = {
4258
4258
  info: (msg) => emit("info", msg),
4259
4259
  debug: (msg) => emit("debug", msg)
4260
4260
  };
4261
- var VERSION = "0.0.1313111111";
4261
+ var VERSION = "0.0.13131111111";
4262
4262
  var CODING_AGENTS_CLIENT_IDENTITY = {
4263
4263
  name: "coding_agents",
4264
4264
  version: VERSION
@@ -8511,7 +8511,7 @@ function idle(home) {
8511
8511
  }
8512
8512
  }
8513
8513
 
8514
- // node_modules/.pnpm/@agentchatme+agent-core@0.0.1313111111/node_modules/@agentchatme/agent-core/dist/daemon-entry.js
8514
+ // node_modules/.pnpm/@agentchatme+agent-core@0.0.13131111111/node_modules/@agentchatme/agent-core/dist/daemon-entry.js
8515
8515
  init_wrapper();
8516
8516
  import { EventEmitter } from "events";
8517
8517
  import * as path32 from "path";
@@ -9525,10 +9525,11 @@ async function runDaemon(opts) {
9525
9525
 
9526
9526
  // src/adapter.ts
9527
9527
  import * as fs5 from "fs";
9528
+ import * as os from "os";
9528
9529
  import * as path6 from "path";
9529
9530
  import * as crypto2 from "crypto";
9530
9531
 
9531
- // node_modules/.pnpm/@agentchatme+agent-core@0.0.1313111111/node_modules/@agentchatme/agent-core/dist/index.js
9532
+ // node_modules/.pnpm/@agentchatme+agent-core@0.0.13131111111/node_modules/@agentchatme/agent-core/dist/index.js
9532
9533
  var import_cross_spawn = __toESM(require_cross_spawn(), 1);
9533
9534
  var SESSION_TTL_MS = 48 * 60 * 60 * 1e3;
9534
9535
  var SessionStateSchema = external_exports.object({
@@ -9560,7 +9561,7 @@ var spawnCommand = import_cross_spawn.default;
9560
9561
  var spawnCommandSync = import_cross_spawn.default.sync;
9561
9562
 
9562
9563
  // src/version.ts
9563
- var VERSION2 = "0.0.13941141111111";
9564
+ var VERSION2 = "0.0.1394114111111111";
9564
9565
 
9565
9566
  // src/runtime-version.ts
9566
9567
  var MIN_CLAUDE_CODE_VERSION = "2.1.219";
@@ -9594,13 +9595,20 @@ var PARENT_ENV_KEYS = [
9594
9595
  "CLAUDE_EFFORT",
9595
9596
  "AI_AGENT"
9596
9597
  ];
9597
- function claudeIsLoggedIn(configDir) {
9598
+ function claudeProcessEnv(configDirOverride, source = process.env) {
9599
+ const env = { ...source };
9600
+ if (configDirOverride === void 0) delete env["CLAUDE_CONFIG_DIR"];
9601
+ else env["CLAUDE_CONFIG_DIR"] = configDirOverride;
9602
+ return env;
9603
+ }
9604
+ function claudeIsLoggedIn(configDirOverride) {
9598
9605
  const status = spawnCommandSync("claude", ["auth", "status"], {
9599
9606
  encoding: "utf-8",
9600
9607
  timeout: 1e4,
9601
- env: { ...process.env, CLAUDE_CONFIG_DIR: configDir }
9608
+ env: claudeProcessEnv(configDirOverride)
9602
9609
  });
9603
9610
  if (!status.error && status.status === 0) return true;
9611
+ const configDir = configDirOverride ?? path6.join(os.homedir(), ".claude");
9604
9612
  if (fs5.existsSync(path6.join(configDir, ".credentials.json"))) return true;
9605
9613
  if (process.platform !== "darwin") return false;
9606
9614
  const keychain = spawnCommandSync(
@@ -9610,10 +9618,9 @@ function claudeIsLoggedIn(configDir) {
9610
9618
  );
9611
9619
  return !keychain.error && keychain.status === 0;
9612
9620
  }
9613
- function buildClaudeEnv(configDir, source = process.env) {
9614
- const env = { ...source };
9621
+ function buildClaudeEnv(configDirOverride, source = process.env) {
9622
+ const env = claudeProcessEnv(configDirOverride, source);
9615
9623
  for (const key of PARENT_ENV_KEYS) delete env[key];
9616
- env["CLAUDE_CONFIG_DIR"] = configDir;
9617
9624
  env["DISABLE_AUTOUPDATER"] = "1";
9618
9625
  const configuredConnectTimeout = Number(env["MCP_CONNECT_TIMEOUT_MS"]);
9619
9626
  if (!Number.isFinite(configuredConnectTimeout) || configuredConnectTimeout < 3e4) {
@@ -9670,6 +9677,7 @@ var ClaudeTurnEvents = class {
9670
9677
  pending = /* @__PURE__ */ new Set();
9671
9678
  successfulSends = 0;
9672
9679
  sendFailure = null;
9680
+ runtimeAuthFailure = null;
9673
9681
  consume(event) {
9674
9682
  if (typeof event !== "object" || event === null) return;
9675
9683
  const record = event;
@@ -9699,6 +9707,9 @@ var ClaudeTurnEvents = class {
9699
9707
  for (const block of content) {
9700
9708
  if (typeof block !== "object" || block === null) continue;
9701
9709
  const tool = block;
9710
+ if (tool["type"] === "text" && typeof tool["text"] === "string" && fatalRuntimeError(tool["text"])) {
9711
+ this.runtimeAuthFailure = tool["text"].trim().slice(0, 500);
9712
+ }
9702
9713
  if (tool["type"] === "tool_use" && tool["name"] === SEND_TOOL && typeof tool["id"] === "string") {
9703
9714
  this.pending.add(tool["id"]);
9704
9715
  }
@@ -9761,6 +9772,12 @@ var ClaudeTurnEvents = class {
9761
9772
  }
9762
9773
  return { ok: true, sent: this.successfulSends > 0 };
9763
9774
  }
9775
+ /** Claude reports host-auth failures as assistant text on stdout rather than
9776
+ * stderr. Keep only the matching bounded diagnostic; ordinary model text is
9777
+ * never surfaced as a runtime error. */
9778
+ fatalDetail() {
9779
+ return this.runtimeAuthFailure;
9780
+ }
9764
9781
  };
9765
9782
  function killProcessTree(child) {
9766
9783
  if (child.pid === void 0) return;
@@ -9783,6 +9800,16 @@ function killProcessTree(child) {
9783
9800
  function fatalRuntimeError(detail) {
9784
9801
  return /not logged in|authentication|unauthorized|invalid api key|login required/i.test(detail);
9785
9802
  }
9803
+ function classifyClaudeExit(code, stderr, events) {
9804
+ const structured = events.fatalDetail();
9805
+ const diagnostic = structured ?? stderr.trim().slice(0, 500);
9806
+ const detail = `claude exited ${code ?? "without a status"}${diagnostic ? `: ${diagnostic}` : ""}`;
9807
+ return {
9808
+ ok: false,
9809
+ fatal: structured !== null || fatalRuntimeError(detail),
9810
+ detail
9811
+ };
9812
+ }
9786
9813
  var ClaudeAdapter = class {
9787
9814
  constructor(claudeConfigDir, identityHome2, workdir) {
9788
9815
  this.claudeConfigDir = claudeConfigDir;
@@ -9916,8 +9943,7 @@ var ClaudeAdapter = class {
9916
9943
  log.info(`claude turn done for ${ctx.conversationId} (sent=${outcome.sent})`);
9917
9944
  finish({ ok: true, detail: outcome.sent ? "replied" : "silent" });
9918
9945
  } else {
9919
- const detail = `claude exited ${code}${stderr ? `: ${stderr.slice(0, 500)}` : ""}`;
9920
- finish({ ok: false, fatal: fatalRuntimeError(detail), detail });
9946
+ finish(classifyClaudeExit(code, stderr, events));
9921
9947
  }
9922
9948
  });
9923
9949
  });
@@ -9933,12 +9959,14 @@ function buildPrompt(ctx) {
9933
9959
  }
9934
9960
 
9935
9961
  // src/host.ts
9936
- import * as os from "os";
9962
+ import * as os2 from "os";
9937
9963
  import * as path7 from "path";
9938
- function claudeHome() {
9964
+ function claudeConfigOverride() {
9939
9965
  const override = process.env["CLAUDE_CONFIG_DIR"];
9940
- if (override !== void 0 && override.trim().length > 0) return path7.resolve(override);
9941
- return path7.join(os.homedir(), ".claude");
9966
+ return override !== void 0 && override.trim().length > 0 ? path7.resolve(override) : void 0;
9967
+ }
9968
+ function claudeHome() {
9969
+ return claudeConfigOverride() ?? path7.join(os2.homedir(), ".claude");
9942
9970
  }
9943
9971
  function identityHome() {
9944
9972
  return path7.join(claudeHome(), "agentchat");
@@ -9964,7 +9992,7 @@ async function main(argv = process.argv.slice(2)) {
9964
9992
  return await runDaemon({
9965
9993
  home,
9966
9994
  workdir,
9967
- adapter: new ClaudeAdapter(claudeHome(), home, workdir)
9995
+ adapter: new ClaudeAdapter(claudeConfigOverride(), home, workdir)
9968
9996
  });
9969
9997
  }
9970
9998
  main().then(