@junctionpanel/server 0.1.94 → 0.1.96

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.
@@ -1054,14 +1054,14 @@ export class ClaudeAgentClient {
1054
1054
  this.defaults = options.defaults;
1055
1055
  this.logger = options.logger.child({ module: "agent", provider: "claude" });
1056
1056
  this.runtimeSettings = options.runtimeSettings;
1057
- this.claudePath = resolveClaudeExecutablePath(this.runtimeSettings);
1058
1057
  }
1059
1058
  async createSession(config) {
1060
1059
  const claudeConfig = this.assertConfig(config);
1060
+ const claudePath = this.resolveCurrentClaudePath();
1061
1061
  const knownModels = await this.discoverKnownModels(claudeConfig.cwd);
1062
1062
  return new ClaudeAgentSession(claudeConfig, {
1063
1063
  defaults: this.defaults,
1064
- claudePath: this.claudePath,
1064
+ claudePath,
1065
1065
  runtimeSettings: this.runtimeSettings,
1066
1066
  logger: this.logger,
1067
1067
  knownModels,
@@ -1075,10 +1075,11 @@ export class ClaudeAgentClient {
1075
1075
  }
1076
1076
  const mergedConfig = { ...merged, provider: "claude", cwd: merged.cwd };
1077
1077
  const claudeConfig = this.assertConfig(mergedConfig);
1078
+ const claudePath = this.resolveCurrentClaudePath();
1078
1079
  const knownModels = await this.discoverKnownModels(claudeConfig.cwd);
1079
1080
  return new ClaudeAgentSession(claudeConfig, {
1080
1081
  defaults: this.defaults,
1081
- claudePath: this.claudePath,
1082
+ claudePath,
1082
1083
  runtimeSettings: this.runtimeSettings,
1083
1084
  handle,
1084
1085
  logger: this.logger,
@@ -1098,11 +1099,12 @@ export class ClaudeAgentClient {
1098
1099
  }
1099
1100
  }
1100
1101
  async discoverLiveKnownModels(cwd) {
1102
+ const claudePath = this.resolveCurrentClaudePath();
1101
1103
  const cacheKey = JSON.stringify({
1102
1104
  provider: "claude",
1103
1105
  cwd: cwd ?? null,
1104
1106
  runtime: getClaudeThinkingCompatibilityCacheKey({
1105
- claudePath: this.claudePath,
1107
+ claudePath,
1106
1108
  runtimeSettings: this.runtimeSettings,
1107
1109
  }),
1108
1110
  });
@@ -1114,7 +1116,7 @@ export class ClaudeAgentClient {
1114
1116
  load: async () => {
1115
1117
  const models = await fetchClaudeSupportedModels({
1116
1118
  cwd,
1117
- claudePath: this.claudePath,
1119
+ claudePath,
1118
1120
  runtimeSettings: this.runtimeSettings,
1119
1121
  logger: this.logger,
1120
1122
  });
@@ -1147,11 +1149,8 @@ export class ClaudeAgentClient {
1147
1149
  return descriptors;
1148
1150
  }
1149
1151
  async isAvailable() {
1150
- const commandConfig = this.runtimeSettings?.command;
1151
- if (commandConfig?.mode === "replace") {
1152
- return isProviderCommandAvailable(commandConfig, resolveClaudeBinary, applyProviderEnv(process.env, this.runtimeSettings));
1153
- }
1154
- return this.claudePath !== null;
1152
+ const env = applyProviderEnv(process.env, this.runtimeSettings);
1153
+ return isProviderCommandAvailable(this.runtimeSettings?.command, () => resolveClaudeExecutablePath(this.runtimeSettings) ?? "claude", env);
1155
1154
  }
1156
1155
  assertConfig(config) {
1157
1156
  if (config.provider !== "claude") {
@@ -1159,6 +1158,17 @@ export class ClaudeAgentClient {
1159
1158
  }
1160
1159
  return { ...config, provider: "claude" };
1161
1160
  }
1161
+ resolveCurrentClaudePath() {
1162
+ const commandConfig = this.runtimeSettings?.command;
1163
+ if (commandConfig?.mode === "replace") {
1164
+ const env = applyProviderEnv(process.env, this.runtimeSettings);
1165
+ const available = isProviderCommandAvailable(commandConfig, resolveClaudeBinary, env);
1166
+ if (!available) {
1167
+ return null;
1168
+ }
1169
+ }
1170
+ return resolveClaudeExecutablePath(this.runtimeSettings);
1171
+ }
1162
1172
  }
1163
1173
  class ClaudeAgentSession {
1164
1174
  constructor(config, options) {