@junctionpanel/server 0.1.34 → 0.1.35
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.
- package/dist/server/server/agent/agent-manager.d.ts.map +1 -1
- package/dist/server/server/agent/agent-manager.js +3 -3
- package/dist/server/server/agent/agent-manager.js.map +1 -1
- package/dist/server/server/agent/agent-sdk-types.d.ts +1 -0
- package/dist/server/server/agent/agent-sdk-types.d.ts.map +1 -1
- package/dist/server/server/agent/providers/claude-agent.d.ts.map +1 -1
- package/dist/server/server/agent/providers/claude-agent.js +38 -90
- package/dist/server/server/agent/providers/claude-agent.js.map +1 -1
- package/dist/server/server/agent/providers/claude-cli-capabilities.d.ts +50 -0
- package/dist/server/server/agent/providers/claude-cli-capabilities.d.ts.map +1 -0
- package/dist/server/server/agent/providers/claude-cli-capabilities.js +247 -0
- package/dist/server/server/agent/providers/claude-cli-capabilities.js.map +1 -0
- package/dist/server/server/agent/providers/gemini-agent.d.ts +287 -1
- package/dist/server/server/agent/providers/gemini-agent.d.ts.map +1 -1
- package/dist/server/server/agent/providers/gemini-agent.js +255 -16
- package/dist/server/server/agent/providers/gemini-agent.js.map +1 -1
- package/dist/server/server/daemon-doctor.d.ts +5 -0
- package/dist/server/server/daemon-doctor.d.ts.map +1 -1
- package/dist/server/server/daemon-doctor.js +26 -0
- package/dist/server/server/daemon-doctor.js.map +1 -1
- package/dist/server/server/file-explorer/service.d.ts +1 -0
- package/dist/server/server/file-explorer/service.d.ts.map +1 -1
- package/dist/server/server/file-explorer/service.js +36 -0
- package/dist/server/server/file-explorer/service.js.map +1 -1
- package/dist/server/server/session.d.ts.map +1 -1
- package/dist/server/server/session.js +5 -2
- package/dist/server/server/session.js.map +1 -1
- package/dist/server/shared/messages.d.ts +147 -0
- package/dist/server/shared/messages.d.ts.map +1 -1
- package/dist/server/shared/messages.js +4 -0
- package/dist/server/shared/messages.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { execSync
|
|
1
|
+
import { execSync } from "node:child_process";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
import fs from "node:fs";
|
|
4
4
|
import { promises } from "node:fs";
|
|
@@ -8,6 +8,7 @@ import { query, } from "@anthropic-ai/claude-agent-sdk";
|
|
|
8
8
|
import { mapClaudeCanceledToolCall, mapClaudeCompletedToolCall, mapClaudeFailedToolCall, mapClaudeRunningToolCall, } from "./claude/tool-call-mapper.js";
|
|
9
9
|
import { isTaskNotificationUserContent, mapTaskNotificationSystemRecordToToolCall, mapTaskNotificationUserContentToToolCall, } from "./claude/task-notification-tool-call.js";
|
|
10
10
|
import { buildClaudeModelDefinitions, buildClaudeModelFamilyAliases, buildClaudeSelectableModelIds, getClaudeFallbackModels, normalizeClaudeThinkingOptionId, resolveClaudeThinkingPreset, } from "./claude/model-catalog.js";
|
|
11
|
+
import { applyRuntimeSettingsToClaudeOptions, detectClaudeThinkingCompatibility, fetchClaudeSupportedModels, } from "./claude-cli-capabilities.js";
|
|
11
12
|
import { buildToolCallDisplayModel } from "../../../shared/tool-call-display.js";
|
|
12
13
|
import { applyProviderEnv, isProviderCommandAvailable, } from "../provider-launch-config.js";
|
|
13
14
|
import { getOrchestratorModeInstructions } from "../orchestrator-instructions.js";
|
|
@@ -226,91 +227,6 @@ function resolveClaudeBinary() {
|
|
|
226
227
|
}
|
|
227
228
|
throw new Error("Claude CLI not found. Install claude or configure agents.providers.claude.command.mode='replace'.");
|
|
228
229
|
}
|
|
229
|
-
function resolveClaudeSpawnCommand(spawnOptions, runtimeSettings) {
|
|
230
|
-
const commandConfig = runtimeSettings?.command;
|
|
231
|
-
if (!commandConfig || commandConfig.mode === "default") {
|
|
232
|
-
return {
|
|
233
|
-
command: spawnOptions.command,
|
|
234
|
-
args: [...spawnOptions.args],
|
|
235
|
-
};
|
|
236
|
-
}
|
|
237
|
-
if (commandConfig.mode === "append") {
|
|
238
|
-
return {
|
|
239
|
-
command: spawnOptions.command,
|
|
240
|
-
args: [...(commandConfig.args ?? []), ...spawnOptions.args],
|
|
241
|
-
};
|
|
242
|
-
}
|
|
243
|
-
return {
|
|
244
|
-
command: commandConfig.argv[0],
|
|
245
|
-
args: [...commandConfig.argv.slice(1), ...spawnOptions.args],
|
|
246
|
-
};
|
|
247
|
-
}
|
|
248
|
-
function applyRuntimeSettingsToClaudeOptions(options, runtimeSettings) {
|
|
249
|
-
const hasEnvOverrides = Object.keys(runtimeSettings?.env ?? {}).length > 0;
|
|
250
|
-
const commandMode = runtimeSettings?.command?.mode;
|
|
251
|
-
const needsCustomSpawn = hasEnvOverrides || commandMode === "append" || commandMode === "replace";
|
|
252
|
-
if (!needsCustomSpawn) {
|
|
253
|
-
return options;
|
|
254
|
-
}
|
|
255
|
-
return {
|
|
256
|
-
...options,
|
|
257
|
-
spawnClaudeCodeProcess: (spawnOptions) => {
|
|
258
|
-
const resolved = resolveClaudeSpawnCommand(spawnOptions, runtimeSettings);
|
|
259
|
-
return spawn(resolved.command, resolved.args, {
|
|
260
|
-
cwd: spawnOptions.cwd,
|
|
261
|
-
env: applyProviderEnv(spawnOptions.env, runtimeSettings),
|
|
262
|
-
signal: spawnOptions.signal,
|
|
263
|
-
stdio: ["pipe", "pipe", "pipe"],
|
|
264
|
-
});
|
|
265
|
-
},
|
|
266
|
-
};
|
|
267
|
-
}
|
|
268
|
-
function buildClaudeControlOptions(params) {
|
|
269
|
-
const baseOptions = {
|
|
270
|
-
...(params.cwd ? { cwd: params.cwd } : {}),
|
|
271
|
-
...(params.claudePath
|
|
272
|
-
? { pathToClaudeCodeExecutable: params.claudePath }
|
|
273
|
-
: {}),
|
|
274
|
-
settingSources: CLAUDE_SETTING_SOURCES,
|
|
275
|
-
includePartialMessages: false,
|
|
276
|
-
stderr: (data) => {
|
|
277
|
-
params.logger.warn({ stderr: data.trim() }, "Claude Agent SDK stderr");
|
|
278
|
-
},
|
|
279
|
-
env: {
|
|
280
|
-
...process.env,
|
|
281
|
-
MCP_TIMEOUT: "600000",
|
|
282
|
-
MCP_TOOL_TIMEOUT: "600000",
|
|
283
|
-
},
|
|
284
|
-
};
|
|
285
|
-
return applyRuntimeSettingsToClaudeOptions(baseOptions, params.runtimeSettings);
|
|
286
|
-
}
|
|
287
|
-
async function fetchClaudeSupportedModels(params) {
|
|
288
|
-
const abortController = new AbortController();
|
|
289
|
-
const controlQuery = query({
|
|
290
|
-
prompt: "",
|
|
291
|
-
options: {
|
|
292
|
-
...buildClaudeControlOptions(params),
|
|
293
|
-
abortController,
|
|
294
|
-
},
|
|
295
|
-
});
|
|
296
|
-
try {
|
|
297
|
-
return await controlQuery.supportedModels();
|
|
298
|
-
}
|
|
299
|
-
finally {
|
|
300
|
-
abortController.abort();
|
|
301
|
-
try {
|
|
302
|
-
await Promise.race([
|
|
303
|
-
controlQuery.interrupt(),
|
|
304
|
-
new Promise((resolve) => {
|
|
305
|
-
setTimeout(resolve, 1000);
|
|
306
|
-
}),
|
|
307
|
-
]);
|
|
308
|
-
}
|
|
309
|
-
catch {
|
|
310
|
-
// Ignore teardown errors for short-lived control queries.
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
230
|
function summarizeClaudeOptionsForLog(options) {
|
|
315
231
|
const systemPromptRaw = options.systemPrompt;
|
|
316
232
|
const systemPromptSummary = (() => {
|
|
@@ -1188,6 +1104,8 @@ class ClaudeAgentSession {
|
|
|
1188
1104
|
this.userMessageIds = [];
|
|
1189
1105
|
this.localUserMessageIds = new Set();
|
|
1190
1106
|
this.suppressLocalReplayActivity = false;
|
|
1107
|
+
this.thinkingCompatibility = null;
|
|
1108
|
+
this.loggedThinkingCompatibilityFallback = false;
|
|
1191
1109
|
this.closed = false;
|
|
1192
1110
|
this.handlePermissionRequest = async (toolName, input, options) => {
|
|
1193
1111
|
const requestId = `permission-${randomUUID()}`;
|
|
@@ -1319,7 +1237,9 @@ class ClaudeAgentSession {
|
|
|
1319
1237
|
if (this.cachedRuntimeInfo) {
|
|
1320
1238
|
return { ...this.cachedRuntimeInfo };
|
|
1321
1239
|
}
|
|
1322
|
-
const thinkingOptionId =
|
|
1240
|
+
const thinkingOptionId = this.shouldDisableThinkingControls()
|
|
1241
|
+
? "off"
|
|
1242
|
+
: normalizeClaudeThinkingOptionId(this.config.thinkingOptionId) ?? "off";
|
|
1323
1243
|
const info = {
|
|
1324
1244
|
provider: "claude",
|
|
1325
1245
|
sessionId: this.claudeSessionId,
|
|
@@ -1328,6 +1248,9 @@ class ClaudeAgentSession {
|
|
|
1328
1248
|
modeId: this.currentMode ?? null,
|
|
1329
1249
|
extra: {
|
|
1330
1250
|
preferredModeId: this.lastNonPlanMode,
|
|
1251
|
+
...(this.thinkingCompatibility
|
|
1252
|
+
? { thinkingCompatibility: this.thinkingCompatibility.status }
|
|
1253
|
+
: {}),
|
|
1331
1254
|
...(this.runtimeReportedModelId
|
|
1332
1255
|
? { reportedModelId: this.runtimeReportedModelId }
|
|
1333
1256
|
: {}),
|
|
@@ -1372,10 +1295,15 @@ class ClaudeAgentSession {
|
|
|
1372
1295
|
provider: "claude",
|
|
1373
1296
|
sessionId: this.claudeSessionId,
|
|
1374
1297
|
model: this.lastOptionsModel,
|
|
1375
|
-
thinkingOptionId:
|
|
1298
|
+
thinkingOptionId: this.shouldDisableThinkingControls()
|
|
1299
|
+
? "off"
|
|
1300
|
+
: normalizeClaudeThinkingOptionId(this.config.thinkingOptionId) ?? "off",
|
|
1376
1301
|
modeId: this.currentMode ?? null,
|
|
1377
1302
|
extra: {
|
|
1378
1303
|
preferredModeId: this.lastNonPlanMode,
|
|
1304
|
+
...(this.thinkingCompatibility
|
|
1305
|
+
? { thinkingCompatibility: this.thinkingCompatibility.status }
|
|
1306
|
+
: {}),
|
|
1379
1307
|
...(this.runtimeReportedModelId
|
|
1380
1308
|
? { reportedModelId: this.runtimeReportedModelId }
|
|
1381
1309
|
: {}),
|
|
@@ -1919,6 +1847,7 @@ class ClaudeAgentSession {
|
|
|
1919
1847
|
this.queryRestartNeeded = false;
|
|
1920
1848
|
}
|
|
1921
1849
|
const input = new Pushable();
|
|
1850
|
+
await this.ensureThinkingCompatibility();
|
|
1922
1851
|
const options = this.buildOptions();
|
|
1923
1852
|
this.logger.debug({ options: summarizeClaudeOptionsForLog(options) }, "claude query");
|
|
1924
1853
|
this.input = input;
|
|
@@ -1949,9 +1878,24 @@ class ClaudeAgentSession {
|
|
|
1949
1878
|
this.logger.warn({ err: error, label }, "Claude query operation did not settle cleanly");
|
|
1950
1879
|
}
|
|
1951
1880
|
}
|
|
1881
|
+
async ensureThinkingCompatibility() {
|
|
1882
|
+
if (this.thinkingCompatibility) {
|
|
1883
|
+
return;
|
|
1884
|
+
}
|
|
1885
|
+
this.thinkingCompatibility = await detectClaudeThinkingCompatibility({
|
|
1886
|
+
claudePath: this.claudePath,
|
|
1887
|
+
runtimeSettings: this.runtimeSettings,
|
|
1888
|
+
logger: this.logger,
|
|
1889
|
+
});
|
|
1890
|
+
}
|
|
1891
|
+
shouldDisableThinkingControls() {
|
|
1892
|
+
return this.thinkingCompatibility?.status === "unsupported";
|
|
1893
|
+
}
|
|
1952
1894
|
buildOptions() {
|
|
1953
|
-
const thinkingPreset =
|
|
1954
|
-
|
|
1895
|
+
const thinkingPreset = this.shouldDisableThinkingControls()
|
|
1896
|
+
? null
|
|
1897
|
+
: resolveClaudeThinkingPreset(this.config.thinkingOptionId) ??
|
|
1898
|
+
resolveClaudeThinkingPreset("off");
|
|
1955
1899
|
const appendedSystemPrompt = [
|
|
1956
1900
|
getOrchestratorModeInstructions(),
|
|
1957
1901
|
this.config.systemPrompt?.trim(),
|
|
@@ -1995,6 +1939,10 @@ class ClaudeAgentSession {
|
|
|
1995
1939
|
...(thinkingPreset?.effort ? { effort: thinkingPreset.effort } : {}),
|
|
1996
1940
|
...getClaudeSdkExtraOptions(this.config.extra),
|
|
1997
1941
|
};
|
|
1942
|
+
if (this.shouldDisableThinkingControls() && !this.loggedThinkingCompatibilityFallback) {
|
|
1943
|
+
this.loggedThinkingCompatibilityFallback = true;
|
|
1944
|
+
this.logger.warn({ compatibility: this.thinkingCompatibility }, "Claude CLI does not support Junction thinking controls; continuing with thinking disabled");
|
|
1945
|
+
}
|
|
1998
1946
|
if (this.config.mcpServers) {
|
|
1999
1947
|
base.mcpServers = this.normalizeMcpServers(this.config.mcpServers);
|
|
2000
1948
|
}
|