orkestrator 2.34.4-beta → 2.34.5-beta
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/README.md +12 -0
- package/bin/orkestrator-launcher.js +42 -3
- package/dist/client.js +1800 -147
- package/dist/main.js +180427 -168862
- package/package.json +4 -4
- package/resources/acp-bridge/dist/index.js +22719 -0
- package/resources/claude-bridge/dist/index.js +140 -27
- package/resources/codex-bridge/dist/index.js +558 -48
- package/resources/cursor-bridge/dist/index.js +36696 -0
- package/resources/cursor-bridge/runtime/bun.lock +40 -0
- package/resources/cursor-bridge/runtime/install.json +4 -0
- package/resources/cursor-bridge/runtime/package.json +11 -0
- package/resources/cursor-bridge/runtime/patches/@cursor%2Fsdk@1.2.0.patch +19 -0
- package/resources/pi-bridge/dist/index.js +36035 -0
- package/resources/pi-bridge/runtime/bun.lock +259 -0
- package/resources/pi-bridge/runtime/install.json +4 -0
- package/resources/pi-bridge/runtime/package.json +10 -0
|
@@ -2666,14 +2666,30 @@ import { join as join2 } from "node:path";
|
|
|
2666
2666
|
|
|
2667
2667
|
// ../../bridges/claude-bridge/src/services/claude-home.ts
|
|
2668
2668
|
import { homedir } from "node:os";
|
|
2669
|
-
import { join } from "node:path";
|
|
2669
|
+
import { join, resolve } from "node:path";
|
|
2670
2670
|
var overrideHome = null;
|
|
2671
|
+
var overrideAccountHome;
|
|
2672
|
+
var CLAUDE_ACCOUNT_HOME_ENV = "ORKESTRATOR_CLAUDE_ACCOUNT_HOME";
|
|
2671
2673
|
function claudeHome() {
|
|
2672
2674
|
return overrideHome ?? homedir();
|
|
2673
2675
|
}
|
|
2674
2676
|
function claudeJsonPath() {
|
|
2675
2677
|
return join(claudeHome(), ".claude.json");
|
|
2676
2678
|
}
|
|
2679
|
+
function claudeAccountJsonPath() {
|
|
2680
|
+
let home = overrideAccountHome;
|
|
2681
|
+
if (home === undefined) {
|
|
2682
|
+
if (overrideHome !== null)
|
|
2683
|
+
return null;
|
|
2684
|
+
const marked = process.env[CLAUDE_ACCOUNT_HOME_ENV]?.trim();
|
|
2685
|
+
const configDir = process.env.CLAUDE_CONFIG_DIR?.trim();
|
|
2686
|
+
home = marked && configDir && resolve(marked) === resolve(configDir) ? configDir : null;
|
|
2687
|
+
}
|
|
2688
|
+
if (!home)
|
|
2689
|
+
return null;
|
|
2690
|
+
const file = join(home, ".claude.json");
|
|
2691
|
+
return resolve(file) === resolve(claudeJsonPath()) ? null : file;
|
|
2692
|
+
}
|
|
2677
2693
|
function claudeUserSettingsPath() {
|
|
2678
2694
|
const configDir = overrideHome === null ? process.env.CLAUDE_CONFIG_DIR?.trim() : undefined;
|
|
2679
2695
|
return join(configDir || join(claudeHome(), ".claude"), "settings.json");
|
|
@@ -4117,6 +4133,43 @@ import { tmpdir } from "node:os";
|
|
|
4117
4133
|
import path from "node:path";
|
|
4118
4134
|
import { promisify } from "node:util";
|
|
4119
4135
|
|
|
4136
|
+
// ../protocol/src/native-agent-goal.ts
|
|
4137
|
+
var NATIVE_AGENT_GOAL_LIMITS = Object.freeze({
|
|
4138
|
+
objectiveMaxChars: 4000,
|
|
4139
|
+
checkMaxBytes: 4 * 1024,
|
|
4140
|
+
reportMessageMaxBytes: 2 * 1024,
|
|
4141
|
+
checkOutputMaxBytes: 8 * 1024,
|
|
4142
|
+
statusDetailMaxBytes: 1024,
|
|
4143
|
+
maxIterationsDefault: 20,
|
|
4144
|
+
maxIterationsLimit: 100,
|
|
4145
|
+
noProgressLimit: 3,
|
|
4146
|
+
checkTimeoutDefaultMs: 10 * 60000,
|
|
4147
|
+
checkTimeoutMaxMs: 30 * 60000,
|
|
4148
|
+
verifierModelMaxChars: 200,
|
|
4149
|
+
verifierTimeoutDefaultMs: 30 * 60000,
|
|
4150
|
+
verdictSummaryMaxBytes: 2 * 1024,
|
|
4151
|
+
verdictReasonsMax: 16,
|
|
4152
|
+
verdictReasonMaxBytes: 512,
|
|
4153
|
+
historyLimit: 5
|
|
4154
|
+
});
|
|
4155
|
+
var AGENT_GOAL_TOOL_NAMES = Object.freeze(["report_goal"]);
|
|
4156
|
+
var GOAL_QUALIFIED_PLATFORMS = Object.freeze([
|
|
4157
|
+
"claude",
|
|
4158
|
+
"codex",
|
|
4159
|
+
"opencode",
|
|
4160
|
+
"cursor",
|
|
4161
|
+
"grok",
|
|
4162
|
+
"pi"
|
|
4163
|
+
]);
|
|
4164
|
+
var GOAL_TOKEN_BUDGET_PLATFORMS = Object.freeze([
|
|
4165
|
+
"claude",
|
|
4166
|
+
"codex",
|
|
4167
|
+
"opencode",
|
|
4168
|
+
"cursor",
|
|
4169
|
+
"grok",
|
|
4170
|
+
"pi"
|
|
4171
|
+
]);
|
|
4172
|
+
|
|
4120
4173
|
// ../protocol/src/native-agent-transcript-patch.ts
|
|
4121
4174
|
var FORBIDDEN_KEYS = new Set(["__proto__", "constructor", "prototype"]);
|
|
4122
4175
|
|
|
@@ -4517,6 +4570,7 @@ var PROJECTION_FIELD_SET = new Set([
|
|
|
4517
4570
|
"queue",
|
|
4518
4571
|
"asyncQuestionResponses",
|
|
4519
4572
|
"contextUsage",
|
|
4573
|
+
"goal",
|
|
4520
4574
|
"rateLimits",
|
|
4521
4575
|
"runtime",
|
|
4522
4576
|
"runtimeHealthAuthoritative",
|
|
@@ -4541,6 +4595,7 @@ var OPTIONAL_PROJECTION_FIELD_SET = new Set([
|
|
|
4541
4595
|
"queue",
|
|
4542
4596
|
"asyncQuestionResponses",
|
|
4543
4597
|
"contextUsage",
|
|
4598
|
+
"goal",
|
|
4544
4599
|
"rateLimits",
|
|
4545
4600
|
"runtime",
|
|
4546
4601
|
"runtimeHealthAuthoritative",
|
|
@@ -4642,6 +4697,15 @@ async function runtimeEnvironmentForSessionQuery(policy, env = process.env, opti
|
|
|
4642
4697
|
const ghConfigDir = await (options.ghConfigDir ?? emptyGhConfigDir)();
|
|
4643
4698
|
return withheldGitHubCredentialEnvironment(env, { ghConfigDir });
|
|
4644
4699
|
}
|
|
4700
|
+
var UNATTENDED_OVERLOAD_RETRY_ENV = {
|
|
4701
|
+
CLAUDE_CODE_OVERLOADED_RETRY_BASE_DELAY_MS: "4000",
|
|
4702
|
+
CLAUDE_CODE_OVERLOADED_RETRY_MAX_DELAY_MS: "64000"
|
|
4703
|
+
};
|
|
4704
|
+
function withUnattendedOverloadRetry(sessionPolicy, environment) {
|
|
4705
|
+
if (sessionPolicy?.id !== "pipeline")
|
|
4706
|
+
return environment;
|
|
4707
|
+
return { ...UNATTENDED_OVERLOAD_RETRY_ENV, ...environment };
|
|
4708
|
+
}
|
|
4645
4709
|
|
|
4646
4710
|
// ../../bridges/claude-bridge/src/services/coordinator-skills.ts
|
|
4647
4711
|
import { createHash as createHash4, randomBytes } from "node:crypto";
|
|
@@ -4669,16 +4733,19 @@ var COORDINATOR_CONTROL_TOOL_NAMES = Object.freeze([
|
|
|
4669
4733
|
"add_ticket_comment",
|
|
4670
4734
|
"address_multi_review",
|
|
4671
4735
|
"adopt_workflow",
|
|
4736
|
+
"answer_worker_question",
|
|
4672
4737
|
"cancel_build_pipeline",
|
|
4673
4738
|
"cancel_graph_run",
|
|
4674
4739
|
"cancel_multi_review",
|
|
4675
4740
|
"cancel_schedule",
|
|
4741
|
+
"clear_worker_goal",
|
|
4676
4742
|
"compare_project_files",
|
|
4677
4743
|
"create_pr",
|
|
4678
4744
|
"create_schedule",
|
|
4679
4745
|
"create_ticket",
|
|
4680
4746
|
"custom_fix_multi_review",
|
|
4681
4747
|
"edit_worker_tab",
|
|
4748
|
+
"fork_worker",
|
|
4682
4749
|
"get_build_pipeline",
|
|
4683
4750
|
"get_environment",
|
|
4684
4751
|
"get_feature_plan",
|
|
@@ -4691,6 +4758,9 @@ var COORDINATOR_CONTROL_TOOL_NAMES = Object.freeze([
|
|
|
4691
4758
|
"get_tab_state",
|
|
4692
4759
|
"get_tab_transcript",
|
|
4693
4760
|
"get_ticket",
|
|
4761
|
+
"get_usage_limits",
|
|
4762
|
+
"get_worker_changes",
|
|
4763
|
+
"get_worker_goal",
|
|
4694
4764
|
"launch_environment",
|
|
4695
4765
|
"launch_feature_plan",
|
|
4696
4766
|
"launch_graph",
|
|
@@ -4705,14 +4775,18 @@ var COORDINATOR_CONTROL_TOOL_NAMES = Object.freeze([
|
|
|
4705
4775
|
"list_node_environments",
|
|
4706
4776
|
"list_nodes",
|
|
4707
4777
|
"list_projects",
|
|
4778
|
+
"list_provider_accounts",
|
|
4708
4779
|
"list_schedules",
|
|
4709
4780
|
"list_tabs",
|
|
4710
4781
|
"list_tickets",
|
|
4782
|
+
"list_worker_commands",
|
|
4711
4783
|
"list_workflows",
|
|
4712
4784
|
"open_multi_review",
|
|
4713
4785
|
"open_multi_review_fix",
|
|
4714
4786
|
"open_worker_browser",
|
|
4715
4787
|
"pause_build_pipeline",
|
|
4788
|
+
"pause_schedule",
|
|
4789
|
+
"pause_worker_goal",
|
|
4716
4790
|
"propose_agents_md_update",
|
|
4717
4791
|
"read_messages",
|
|
4718
4792
|
"read_node_environment",
|
|
@@ -4721,18 +4795,25 @@ var COORDINATOR_CONTROL_TOOL_NAMES = Object.freeze([
|
|
|
4721
4795
|
"request_project_file_update",
|
|
4722
4796
|
"request_project_on_node",
|
|
4723
4797
|
"request_root_changes",
|
|
4798
|
+
"resolve_conflicts",
|
|
4724
4799
|
"resume_build_pipeline",
|
|
4800
|
+
"resume_schedule",
|
|
4801
|
+
"run_worker_command",
|
|
4725
4802
|
"send_message",
|
|
4726
4803
|
"send_node_message",
|
|
4727
4804
|
"send_prompt_to_node_tab",
|
|
4728
4805
|
"send_prompt_to_tab",
|
|
4806
|
+
"set_worker_goal",
|
|
4729
4807
|
"start_build_pipeline",
|
|
4730
4808
|
"start_environment",
|
|
4731
4809
|
"start_multi_review",
|
|
4732
4810
|
"start_node_environment",
|
|
4733
4811
|
"stop_environment",
|
|
4734
4812
|
"stop_node_environment",
|
|
4813
|
+
"stop_worker_turn",
|
|
4814
|
+
"switch_provider_account",
|
|
4735
4815
|
"transfer_files",
|
|
4816
|
+
"update_schedule",
|
|
4736
4817
|
"update_ticket"
|
|
4737
4818
|
]);
|
|
4738
4819
|
|
|
@@ -8931,7 +9012,7 @@ function noMessages() {
|
|
|
8931
9012
|
// ../../bridges/claude-bridge/src/services/session-manager-persistence.ts
|
|
8932
9013
|
import { constants as constants2 } from "node:fs";
|
|
8933
9014
|
import { lstat as lstat2, open as open2, realpath as realpath2 } from "node:fs/promises";
|
|
8934
|
-
import { isAbsolute as isAbsolute3, join as join10, relative, resolve as
|
|
9015
|
+
import { isAbsolute as isAbsolute3, join as join10, relative, resolve as resolve3, sep } from "node:path";
|
|
8935
9016
|
|
|
8936
9017
|
// ../protocol/src/node/command-change-journal.ts
|
|
8937
9018
|
import { appendFile, mkdir as mkdir3, readFile as readFile5, rename as rename3, rm as rm3, stat as stat4, writeFile as writeFile3 } from "node:fs/promises";
|
|
@@ -9088,7 +9169,7 @@ import { randomUUID as randomUUID2 } from "node:crypto";
|
|
|
9088
9169
|
import { rmSync } from "node:fs";
|
|
9089
9170
|
import { copyFile, lstat, mkdtemp as mkdtemp2, rm as rm4 } from "node:fs/promises";
|
|
9090
9171
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
9091
|
-
import { delimiter as delimiter2, isAbsolute as isAbsolute2, join as join6, resolve } from "node:path";
|
|
9172
|
+
import { delimiter as delimiter2, isAbsolute as isAbsolute2, join as join6, resolve as resolve2 } from "node:path";
|
|
9092
9173
|
var DEFAULT_MAX_UNTRACKED_FILE_BYTES = 2 * 1024 * 1024;
|
|
9093
9174
|
var DEFAULT_MAX_UNTRACKED_FILES = 5000;
|
|
9094
9175
|
var DEFAULT_SLOW_SNAPSHOT_MS = 500;
|
|
@@ -9370,8 +9451,8 @@ class WorkspaceChangeProbe {
|
|
|
9370
9451
|
return;
|
|
9371
9452
|
return {
|
|
9372
9453
|
root,
|
|
9373
|
-
indexPath: isAbsolute2(index) ? index :
|
|
9374
|
-
objectsPath: isAbsolute2(objects) ? objects :
|
|
9454
|
+
indexPath: isAbsolute2(index) ? index : resolve2(cwd, index),
|
|
9455
|
+
objectsPath: isAbsolute2(objects) ? objects : resolve2(cwd, objects)
|
|
9375
9456
|
};
|
|
9376
9457
|
}).catch(() => {
|
|
9377
9458
|
return;
|
|
@@ -11777,13 +11858,13 @@ class ClaudeAttachmentError extends Error {
|
|
|
11777
11858
|
var BRIDGE_ATTACHMENT_ROOT_ENV = "ORKESTRATOR_BRIDGE_ATTACHMENT_ROOT";
|
|
11778
11859
|
function configuredAttachmentRoot(env = process.env) {
|
|
11779
11860
|
const value = env[BRIDGE_ATTACHMENT_ROOT_ENV]?.trim();
|
|
11780
|
-
return value && isAbsolute3(value) ?
|
|
11861
|
+
return value && isAbsolute3(value) ? resolve3(value) : undefined;
|
|
11781
11862
|
}
|
|
11782
11863
|
function attachmentContainmentRoot(filePath, cwd, extraRoot = configuredAttachmentRoot()) {
|
|
11783
|
-
if (extraRoot && isAbsolute3(filePath) && isPathWithin2(extraRoot,
|
|
11864
|
+
if (extraRoot && isAbsolute3(filePath) && isPathWithin2(extraRoot, resolve3(filePath))) {
|
|
11784
11865
|
return extraRoot;
|
|
11785
11866
|
}
|
|
11786
|
-
return
|
|
11867
|
+
return resolve3(cwd);
|
|
11787
11868
|
}
|
|
11788
11869
|
function isPathWithin2(rootPath, targetPath) {
|
|
11789
11870
|
const childPath = relative(rootPath, targetPath);
|
|
@@ -11831,7 +11912,7 @@ async function assertOpenedWorkspaceFile(targetPath, canonicalRoot, openedStats)
|
|
|
11831
11912
|
}
|
|
11832
11913
|
async function readWorkspaceImageAttachment(filePath, cwd, afterSymlinkValidation, afterCanonicalValidation, afterInitialValidation) {
|
|
11833
11914
|
const lexicalRoot = attachmentContainmentRoot(filePath, cwd);
|
|
11834
|
-
const targetPath = isAbsolute3(filePath) ?
|
|
11915
|
+
const targetPath = isAbsolute3(filePath) ? resolve3(filePath) : resolve3(lexicalRoot, filePath);
|
|
11835
11916
|
if (!isPathWithin2(lexicalRoot, targetPath)) {
|
|
11836
11917
|
throw new ClaudeAttachmentError("attachment_outside_workspace", "Image attachment must be contained in the current workspace.");
|
|
11837
11918
|
}
|
|
@@ -13624,6 +13705,17 @@ async function loadScopedMcpServers(cwd, scope) {
|
|
|
13624
13705
|
};
|
|
13625
13706
|
return { configs, revision: { fingerprint: revisionFingerprint(sources), sources, scope } };
|
|
13626
13707
|
}
|
|
13708
|
+
async function claudeAccountOnlyMcpServerNames(cwd, settingSources, declared, strictMcpConfig = false) {
|
|
13709
|
+
const path = claudeAccountJsonPath();
|
|
13710
|
+
if (!path || strictMcpConfig)
|
|
13711
|
+
return [];
|
|
13712
|
+
const [user, local] = await Promise.all([
|
|
13713
|
+
settingSources.includes("user") ? readJsonSliceCached(path, "mcpServers", (config) => config?.mcpServers) : undefined,
|
|
13714
|
+
settingSources.includes("local") ? readJsonSliceCached(path, `projects:${cwd}:mcpServers`, (config) => config?.projects?.[cwd]?.mcpServers) : undefined
|
|
13715
|
+
]);
|
|
13716
|
+
const names = new Set([...Object.keys(user ?? {}), ...Object.keys(local ?? {})]);
|
|
13717
|
+
return Array.from(names).filter((name) => !declared.has(name)).sort();
|
|
13718
|
+
}
|
|
13627
13719
|
function revisionFingerprint(sources) {
|
|
13628
13720
|
return createHash9("sha256").update(`user=${sources.user}\x00project=${sources.project}`).digest("base64url");
|
|
13629
13721
|
}
|
|
@@ -15229,8 +15321,16 @@ function appendLocalCommandResult(session, content, key) {
|
|
|
15229
15321
|
}
|
|
15230
15322
|
|
|
15231
15323
|
// ../../bridges/claude-bridge/src/services/session-manager-prompt-mcp-sync.ts
|
|
15232
|
-
function createClaudeRuntimeMcp(servers, declared) {
|
|
15233
|
-
|
|
15324
|
+
function createClaudeRuntimeMcp(servers, declared, accountOnly = []) {
|
|
15325
|
+
const declaredNames = new Set(declared);
|
|
15326
|
+
const loadedOnlyByAccount = new Set(Array.from(accountOnly).filter((name) => !declaredNames.has(name)));
|
|
15327
|
+
return {
|
|
15328
|
+
servers,
|
|
15329
|
+
claimed: false,
|
|
15330
|
+
declared: declaredNames,
|
|
15331
|
+
stale: new Set(loadedOnlyByAccount),
|
|
15332
|
+
accountOnly: loadedOnlyByAccount
|
|
15333
|
+
};
|
|
15234
15334
|
}
|
|
15235
15335
|
var FOREIGN_SOURCES = new Set(["plugin", "sdk", "claudeai"]);
|
|
15236
15336
|
var MAX_REPORTED_STALE_SERVERS = 256;
|
|
@@ -15289,8 +15389,10 @@ async function syncClaudeRuntimeMcp(runtime, next) {
|
|
|
15289
15389
|
}
|
|
15290
15390
|
const stillRuns = (name) => statuses ? statuses.some((server) => server.name === name && server.status !== "disabled" && !FOREIGN_SOURCES.has(server.source ?? "")) : !removed?.has(name);
|
|
15291
15391
|
for (const name of Array.from(mcp.stale)) {
|
|
15292
|
-
if (next.names.has(name) || !stillRuns(name))
|
|
15392
|
+
if (next.names.has(name) || !stillRuns(name)) {
|
|
15293
15393
|
mcp.stale.delete(name);
|
|
15394
|
+
mcp.accountOnly.delete(name);
|
|
15395
|
+
}
|
|
15294
15396
|
}
|
|
15295
15397
|
for (const name of undeclared)
|
|
15296
15398
|
if (stillRuns(name))
|
|
@@ -15332,7 +15434,7 @@ function createStaleMcpServerHook(mcp) {
|
|
|
15332
15434
|
hookSpecificOutput: {
|
|
15333
15435
|
hookEventName: "PreToolUse",
|
|
15334
15436
|
permissionDecision: "deny",
|
|
15335
|
-
permissionDecisionReason: `The MCP server "${server}" was removed from this session's configuration, so ${input.tool_name} is not available. This Claude process loaded it at launch and cannot unload it; it is gone once the process closes after an idle period, or when the session is stopped.`
|
|
15437
|
+
permissionDecisionReason: mcp.accountOnly.has(server) ? `The MCP server "${server}" is only in this Claude account's own configuration, not in the user's Claude configuration, so ${input.tool_name} is not available. Orkestrator replaces an account's MCP servers with the user's when the account's Claude starts; add the server to the user's Claude configuration to use it.` : `The MCP server "${server}" was removed from this session's configuration, so ${input.tool_name} is not available. This Claude process loaded it at launch and cannot unload it; it is gone once the process closes after an idle period, or when the session is stopped.`
|
|
15336
15438
|
}
|
|
15337
15439
|
};
|
|
15338
15440
|
};
|
|
@@ -15777,7 +15879,7 @@ function canAdmitInteraction(candidate, family) {
|
|
|
15777
15879
|
// ../../bridges/claude-bridge/src/services/session-manager-interactions.ts
|
|
15778
15880
|
import { readFile as readFile7 } from "node:fs/promises";
|
|
15779
15881
|
|
|
15780
|
-
//
|
|
15882
|
+
// ../protocol/src/mcp-elicitation-form.ts
|
|
15781
15883
|
function record2(value) {
|
|
15782
15884
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
15783
15885
|
}
|
|
@@ -15802,7 +15904,7 @@ var FIELD_KEYS = new Set([
|
|
|
15802
15904
|
"minimum",
|
|
15803
15905
|
"maximum"
|
|
15804
15906
|
]);
|
|
15805
|
-
function
|
|
15907
|
+
function isSupportedMcpForm(schema) {
|
|
15806
15908
|
if (!record2(schema) || schema.type !== "object" || Object.keys(schema).some((key) => !ROOT_KEYS.has(key)))
|
|
15807
15909
|
return false;
|
|
15808
15910
|
if (schema.additionalProperties !== undefined && schema.additionalProperties !== false)
|
|
@@ -15832,8 +15934,8 @@ function isSupportedClaudeForm(schema) {
|
|
|
15832
15934
|
return true;
|
|
15833
15935
|
});
|
|
15834
15936
|
}
|
|
15835
|
-
function
|
|
15836
|
-
if (!
|
|
15937
|
+
function isValidMcpFormContent(schema, content) {
|
|
15938
|
+
if (!isSupportedMcpForm(schema) || !record2(content))
|
|
15837
15939
|
return false;
|
|
15838
15940
|
const properties = schema.properties ?? {};
|
|
15839
15941
|
if (schema.required?.some((key) => !Object.hasOwn(content, key)))
|
|
@@ -15954,7 +16056,7 @@ function respondToInteraction(requestId, response, sessionId) {
|
|
|
15954
16056
|
const resolve = interactionResolvers.get(key);
|
|
15955
16057
|
if (!resolve)
|
|
15956
16058
|
return false;
|
|
15957
|
-
if (response.action === "accept" && request.kind === "mcp-form" && !
|
|
16059
|
+
if (response.action === "accept" && request.kind === "mcp-form" && !isValidMcpFormContent(request.schema, response.content))
|
|
15958
16060
|
return false;
|
|
15959
16061
|
pendingInteractions.delete(key);
|
|
15960
16062
|
interactionResolvers.delete(key);
|
|
@@ -16182,7 +16284,7 @@ async function answerClaudeElicitation(session, sessionId, request, options) {
|
|
|
16182
16284
|
const url = request.mode === "url" ? bounded2(request.url) : undefined;
|
|
16183
16285
|
const schema = request.mode === "url" ? undefined : request.requestedSchema ?? { type: "object" };
|
|
16184
16286
|
const schemaText = schema === undefined ? "" : JSON.stringify(schema);
|
|
16185
|
-
if (request.mode === "url" && (!url || url !== request.url) || new TextEncoder().encode(schemaText).byteLength > AGENT_INTERACTION_LIMITS.maxTextLength || schema !== undefined && !
|
|
16287
|
+
if (request.mode === "url" && (!url || url !== request.url) || new TextEncoder().encode(schemaText).byteLength > AGENT_INTERACTION_LIMITS.maxTextLength || schema !== undefined && !isSupportedMcpForm(schema)) {
|
|
16186
16288
|
appendTranscriptNotice(session, sessionId, (event) => eventEmitter.emit(event), {
|
|
16187
16289
|
type: "status",
|
|
16188
16290
|
severity: "warning",
|
|
@@ -16230,9 +16332,9 @@ function proposedBashPrefix(suggestions) {
|
|
|
16230
16332
|
const { toolName, ruleContent } = rule;
|
|
16231
16333
|
if (toolName !== "Bash" || typeof ruleContent !== "string")
|
|
16232
16334
|
continue;
|
|
16233
|
-
const prefix = ruleContent.
|
|
16335
|
+
const prefix = ruleContent.replace(/(?::| )\*$/, "");
|
|
16234
16336
|
const words = prefix.trim().split(/\s+/);
|
|
16235
|
-
if (words.length === 0 || words.length > MAX_PROPOSED_PREFIX_TOKENS || words.some((word) => word.length === 0 || word.length > MAX_PROPOSED_PREFIX_TOKEN_LENGTH)) {
|
|
16337
|
+
if (words.length === 0 || words.length > MAX_PROPOSED_PREFIX_TOKENS || words.some((word) => word.length === 0 || word.length > MAX_PROPOSED_PREFIX_TOKEN_LENGTH || word.includes("*"))) {
|
|
16236
16338
|
continue;
|
|
16237
16339
|
}
|
|
16238
16340
|
return words;
|
|
@@ -16443,6 +16545,9 @@ function turnHook(turn, hook) {
|
|
|
16443
16545
|
}
|
|
16444
16546
|
|
|
16445
16547
|
// ../../bridges/claude-bridge/src/services/session-manager-prompt-query.ts
|
|
16548
|
+
function withNativeGoalClosed(disallowed) {
|
|
16549
|
+
return [...disallowed ?? [], "ProposeGoal"];
|
|
16550
|
+
}
|
|
16446
16551
|
var PLAN_MODE_INSTRUCTIONS = `The user has enabled planning mode. Use this phase to:
|
|
16447
16552
|
1. Thoroughly explore the codebase and its existing patterns.
|
|
16448
16553
|
2. Consider viable approaches and their trade-offs.
|
|
@@ -16472,6 +16577,7 @@ async function resolveQueryPlan(turn, sdkTextPrompt, testHooks) {
|
|
|
16472
16577
|
resolveClaudeTurnPlugins(cwd, policy, settingSources)
|
|
16473
16578
|
]);
|
|
16474
16579
|
turn.mcpServerNames = mcpServerNames;
|
|
16580
|
+
const accountOnlyMcpServers = await claudeAccountOnlyMcpServerNames(cwd, settingSources, mcpServerNames, claudeUserMcpQueryOptions(policy).strictMcpConfig === true);
|
|
16475
16581
|
const mcpServerCount = Object.keys(mcpServers).length;
|
|
16476
16582
|
const pluginCount = plugins.length;
|
|
16477
16583
|
const policyPermissionMode = claudePolicyPermissionMode(policy);
|
|
@@ -16492,7 +16598,7 @@ async function resolveQueryPlan(turn, sdkTextPrompt, testHooks) {
|
|
|
16492
16598
|
];
|
|
16493
16599
|
const coordinatorReadOnly = isCoordinatorReadOnlyPolicy(policy);
|
|
16494
16600
|
const grantedMcpServerNames = claudeAsksForApproval(policy, options) ? [] : claudeGrantedMcpServerNames(policy, mcpServerNames);
|
|
16495
|
-
const agentMailTools = mcpServerNames.has(AGENT_MCP_SERVER_NAME) ? [...AGENT_MAIL_TOOL_NAMES, ...ARTIFACT_TOOL_NAMES].map((name) => `mcp__${AGENT_MCP_SERVER_NAME}__${name}`) : [];
|
|
16601
|
+
const agentMailTools = mcpServerNames.has(AGENT_MCP_SERVER_NAME) ? [...AGENT_MAIL_TOOL_NAMES, ...ARTIFACT_TOOL_NAMES, ...AGENT_GOAL_TOOL_NAMES].map((name) => `mcp__${AGENT_MCP_SERVER_NAME}__${name}`) : [];
|
|
16496
16602
|
const allowedTools = coordinatorReadOnly ? claudeReadOnlyAllowedTools({
|
|
16497
16603
|
agentMcpServerNames: mcpServerNames.has(AGENT_MCP_SERVER_NAME) ? [AGENT_MCP_SERVER_NAME] : [],
|
|
16498
16604
|
policy,
|
|
@@ -16506,7 +16612,7 @@ async function resolveQueryPlan(turn, sdkTextPrompt, testHooks) {
|
|
|
16506
16612
|
...claudeArtifactServerTools(mcpServerNames),
|
|
16507
16613
|
...grantedMcpServerNames.map((name) => `${claudeMcpToolPrefix(name)}*`)
|
|
16508
16614
|
];
|
|
16509
|
-
const disallowedTools = coordinatorReadOnly ? claudeDeniedTools(policy) : claudeDisallowedTools(policy);
|
|
16615
|
+
const disallowedTools = withNativeGoalClosed(coordinatorReadOnly ? claudeDeniedTools(policy) : claudeDisallowedTools(policy));
|
|
16510
16616
|
const fastMode = options?.fastMode === true;
|
|
16511
16617
|
const ultracode = requestsUltracode(options?.parameterValues);
|
|
16512
16618
|
session.ultracode = ultracode;
|
|
@@ -16528,7 +16634,7 @@ async function resolveQueryPlan(turn, sdkTextPrompt, testHooks) {
|
|
|
16528
16634
|
const envPath = process.env.PATH;
|
|
16529
16635
|
debugLog("[session-manager] SDK env PATH", { path: envPath });
|
|
16530
16636
|
const sdkPrompt = await buildSdkPrompt(sdkTextPrompt, options?.attachments, cwd, testHooks?.afterAttachmentSymlinkValidation, testHooks?.afterAttachmentCanonicalValidation, testHooks?.afterAttachmentInitialValidation);
|
|
16531
|
-
const queryEnvironment = await runtimeEnvironmentForSessionQuery(policy);
|
|
16637
|
+
const queryEnvironment = withUnattendedOverloadRetry(session.executionPolicy, await runtimeEnvironmentForSessionQuery(policy));
|
|
16532
16638
|
const liveSettings = claudeLiveSettings({
|
|
16533
16639
|
model: options?.model,
|
|
16534
16640
|
permissionMode,
|
|
@@ -16544,6 +16650,7 @@ async function resolveQueryPlan(turn, sdkTextPrompt, testHooks) {
|
|
|
16544
16650
|
effortLevel,
|
|
16545
16651
|
mcpServers,
|
|
16546
16652
|
mcpServerNames,
|
|
16653
|
+
accountOnlyMcpServers,
|
|
16547
16654
|
mcpConfigRevision,
|
|
16548
16655
|
plugins,
|
|
16549
16656
|
mcpServerCount,
|
|
@@ -17213,6 +17320,8 @@ function claudeStartupFailureMessage(reason) {
|
|
|
17213
17320
|
return "Claude could not load the policy limits and managed settings your organization requires. Check connectivity and any proxy, then retry.";
|
|
17214
17321
|
case "org_config_refused":
|
|
17215
17322
|
return "Anthropic refused your organization's required Claude settings for this sign-in. Sign in to Claude again; if that does not help, ask an administrator to allow Claude Code for this account.";
|
|
17323
|
+
case "sandbox_required_unavailable":
|
|
17324
|
+
return "Claude requires a working command sandbox, and it cannot run here (for example, bubblewrap is missing or the platform is unsupported). Make the sandbox available or have the requirement changed, then retry.";
|
|
17216
17325
|
}
|
|
17217
17326
|
}
|
|
17218
17327
|
var STOPPED_TERMINAL_REASONS = new Set([
|
|
@@ -18321,7 +18430,7 @@ function launchClaudeRuntime(turn, plan) {
|
|
|
18321
18430
|
const { session, options, abortController, stream } = turn;
|
|
18322
18431
|
const { plugins, sdkPrompt, queryEnvironment, mcpServers, mcpServerNames, mcpServersKey } = plan;
|
|
18323
18432
|
const heldSdkPrompt = holdSdkPromptOpen(sdkPrompt, abortController.signal, turn.promptUuid);
|
|
18324
|
-
const mcp = createClaudeRuntimeMcp(mcpServers, mcpServerNames);
|
|
18433
|
+
const mcp = createClaudeRuntimeMcp(mcpServers, mcpServerNames, plan.accountOnlyMcpServers);
|
|
18325
18434
|
const turnFor = (toolUseId) => (toolUseId ? turn.runtime?.toolOwners.get(toolUseId) : undefined) ?? turn.runtime?.latestTurn ?? turn.thisTurn;
|
|
18326
18435
|
const queryIterator = query2({
|
|
18327
18436
|
prompt: heldSdkPrompt.prompt,
|
|
@@ -19093,7 +19202,7 @@ function parseSessionActivityObservation(value) {
|
|
|
19093
19202
|
if (!isRecord4(value))
|
|
19094
19203
|
return;
|
|
19095
19204
|
const { activity, readyForInput, completionPending, asyncQuestionItemIds, closing } = value;
|
|
19096
|
-
const { contentRevision } = value;
|
|
19205
|
+
const { contentRevision, turnFailed } = value;
|
|
19097
19206
|
if (typeof activity !== "string" || !SESSION_ACTIVITY_STATES.has(activity))
|
|
19098
19207
|
return;
|
|
19099
19208
|
if (readyForInput !== undefined && typeof readyForInput !== "boolean")
|
|
@@ -19102,6 +19211,8 @@ function parseSessionActivityObservation(value) {
|
|
|
19102
19211
|
return;
|
|
19103
19212
|
if (closing !== undefined && typeof closing !== "boolean")
|
|
19104
19213
|
return;
|
|
19214
|
+
if (turnFailed !== undefined && typeof turnFailed !== "boolean")
|
|
19215
|
+
return;
|
|
19105
19216
|
if (contentRevision !== undefined && !isContentRevision(contentRevision))
|
|
19106
19217
|
return;
|
|
19107
19218
|
let itemIds;
|
|
@@ -19117,6 +19228,7 @@ function parseSessionActivityObservation(value) {
|
|
|
19117
19228
|
...completionPending !== undefined ? { completionPending } : {},
|
|
19118
19229
|
...itemIds !== undefined ? { asyncQuestionItemIds: itemIds } : {},
|
|
19119
19230
|
...closing !== undefined ? { closing } : {},
|
|
19231
|
+
...turnFailed === true ? { turnFailed } : {},
|
|
19120
19232
|
...contentRevision !== undefined ? { contentRevision } : {}
|
|
19121
19233
|
};
|
|
19122
19234
|
}
|
|
@@ -19248,6 +19360,7 @@ async function readSessionActivityObservation(sessionId) {
|
|
|
19248
19360
|
return {
|
|
19249
19361
|
activity: activity === "idle" && completionPending ? "working" : activity,
|
|
19250
19362
|
...resident?.status === "idle" ? { readyForInput: true, completionPending } : {},
|
|
19363
|
+
...resident?.status === "error" ? { turnFailed: true } : {},
|
|
19251
19364
|
...activity === "missing" ? {} : contentRevisionField(resident)
|
|
19252
19365
|
};
|
|
19253
19366
|
}
|
|
@@ -20725,7 +20838,7 @@ session.post("/:id/interactions/:interactionId", interactionBodyLimit, async (c)
|
|
|
20725
20838
|
} else if (action === "accept" && pending.kind === "mcp-form") {
|
|
20726
20839
|
return c.json({ error: "An MCP form answer requires 'content'" }, 400);
|
|
20727
20840
|
}
|
|
20728
|
-
if (action === "accept" && pending.kind === "mcp-form" && !
|
|
20841
|
+
if (action === "accept" && pending.kind === "mcp-form" && !isValidMcpFormContent(pending.schema, content)) {
|
|
20729
20842
|
return c.json({ error: "The answer does not match the MCP form schema" }, 400);
|
|
20730
20843
|
}
|
|
20731
20844
|
const response = action === "accept" ? content ? { action, content } : { action } : { action };
|