@opencow-ai/opencow-agent-sdk 0.4.19 → 0.4.20
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/capabilities/tools/AgentTool/AgentTool.d.ts +49 -4
- package/dist/capabilities/tools/AgentTool/agentInvocationDedupe.d.ts +7 -0
- package/dist/capabilities/tools/AgentTool/inputSchema.d.ts +36 -0
- package/dist/capabilities/tools/AgentTool/worktreeIsolation.d.ts +4 -0
- package/dist/capabilities/worktree.d.ts +10 -0
- package/dist/capabilities/worktreeAvailability.d.ts +20 -0
- package/dist/cli.mjs +770 -505
- package/dist/client.js +471 -234
- package/dist/lib/errors.d.ts +8 -0
- package/dist/sdk.js +471 -234
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -5556,7 +5556,7 @@ function classifyAxiosError(e) {
|
|
|
5556
5556
|
}
|
|
5557
5557
|
return { kind: "http", status, message };
|
|
5558
5558
|
}
|
|
5559
|
-
var ClaudeError, MalformedCommandError, AbortError, ConfigParseError, ShellError, TeleportOperationError, TelemetrySafeError_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS;
|
|
5559
|
+
var ClaudeError, MalformedCommandError, AbortError, ToolContinuationStopError, ConfigParseError, ShellError, TeleportOperationError, TelemetrySafeError_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS;
|
|
5560
5560
|
var init_errors2 = __esm(() => {
|
|
5561
5561
|
init_canonical();
|
|
5562
5562
|
ClaudeError = class ClaudeError extends Error {
|
|
@@ -5573,6 +5573,12 @@ var init_errors2 = __esm(() => {
|
|
|
5573
5573
|
this.name = "AbortError";
|
|
5574
5574
|
}
|
|
5575
5575
|
};
|
|
5576
|
+
ToolContinuationStopError = class ToolContinuationStopError extends Error {
|
|
5577
|
+
constructor(message, options) {
|
|
5578
|
+
super(message, options);
|
|
5579
|
+
this.name = "ToolContinuationStopError";
|
|
5580
|
+
}
|
|
5581
|
+
};
|
|
5576
5582
|
ConfigParseError = class ConfigParseError extends Error {
|
|
5577
5583
|
filePath;
|
|
5578
5584
|
defaultConfig;
|
|
@@ -32091,6 +32097,21 @@ import { createHash } from "crypto";
|
|
|
32091
32097
|
import { readFileSync as readFileSync5, realpathSync as realpathSync2, statSync as statSync4 } from "fs";
|
|
32092
32098
|
import { open as open2, readFile as readFile3, realpath as realpath3, stat as stat4 } from "fs/promises";
|
|
32093
32099
|
import { basename as basename3, dirname as dirname7, join as join12, resolve as resolve6, sep as sep4 } from "path";
|
|
32100
|
+
function hasValidGitMarker(gitPath) {
|
|
32101
|
+
const markerStat = statSync4(gitPath);
|
|
32102
|
+
if (markerStat.isDirectory()) {
|
|
32103
|
+
return statSync4(join12(gitPath, "HEAD")).isFile();
|
|
32104
|
+
}
|
|
32105
|
+
if (!markerStat.isFile()) {
|
|
32106
|
+
return false;
|
|
32107
|
+
}
|
|
32108
|
+
const marker = readFileSync5(gitPath, "utf-8").trim();
|
|
32109
|
+
if (!marker.startsWith("gitdir:")) {
|
|
32110
|
+
return false;
|
|
32111
|
+
}
|
|
32112
|
+
const gitDir = resolve6(dirname7(gitPath), marker.slice("gitdir:".length).trim());
|
|
32113
|
+
return statSync4(join12(gitDir, "HEAD")).isFile();
|
|
32114
|
+
}
|
|
32094
32115
|
function createFindGitRoot() {
|
|
32095
32116
|
function wrapper(startPath) {
|
|
32096
32117
|
const result = findGitRootImpl(startPath);
|
|
@@ -32512,8 +32533,7 @@ var init_git = __esm(() => {
|
|
|
32512
32533
|
try {
|
|
32513
32534
|
const gitPath = join12(current, ".git");
|
|
32514
32535
|
statCount++;
|
|
32515
|
-
|
|
32516
|
-
if (stat5.isDirectory() || stat5.isFile()) {
|
|
32536
|
+
if (hasValidGitMarker(gitPath)) {
|
|
32517
32537
|
logForDiagnosticsNoPII("info", "find_git_root_completed", {
|
|
32518
32538
|
duration_ms: Date.now() - startTime,
|
|
32519
32539
|
stat_count: statCount,
|
|
@@ -32531,8 +32551,7 @@ var init_git = __esm(() => {
|
|
|
32531
32551
|
try {
|
|
32532
32552
|
const gitPath = join12(root2, ".git");
|
|
32533
32553
|
statCount++;
|
|
32534
|
-
|
|
32535
|
-
if (stat5.isDirectory() || stat5.isFile()) {
|
|
32554
|
+
if (hasValidGitMarker(gitPath)) {
|
|
32536
32555
|
logForDiagnosticsNoPII("info", "find_git_root_completed", {
|
|
32537
32556
|
duration_ms: Date.now() - startTime,
|
|
32538
32557
|
stat_count: statCount,
|
|
@@ -94620,7 +94639,7 @@ function printStartupScreen() {
|
|
|
94620
94639
|
const sLen = ` ● ${sL} Ready — type /help to begin`.length;
|
|
94621
94640
|
out.push(boxRow(sRow, W2, sLen));
|
|
94622
94641
|
out.push(`${rgb(...BORDER)}╚${"═".repeat(W2 - 2)}╝${RESET}`);
|
|
94623
|
-
out.push(` ${DIM}${rgb(...DIMCOL)}opencow ${RESET}${rgb(...ACCENT)}v${"0.4.
|
|
94642
|
+
out.push(` ${DIM}${rgb(...DIMCOL)}opencow ${RESET}${rgb(...ACCENT)}v${"0.4.20"}${RESET}`);
|
|
94624
94643
|
out.push("");
|
|
94625
94644
|
process.stdout.write(out.join(`
|
|
94626
94645
|
`) + `
|
|
@@ -241833,19 +241852,24 @@ async function checkPermissionsAndCallTool(tool, toolUseID, input, toolUseContex
|
|
|
241833
241852
|
}
|
|
241834
241853
|
return [
|
|
241835
241854
|
{
|
|
241836
|
-
message:
|
|
241837
|
-
|
|
241838
|
-
|
|
241839
|
-
|
|
241840
|
-
|
|
241841
|
-
|
|
241842
|
-
|
|
241843
|
-
|
|
241844
|
-
|
|
241845
|
-
|
|
241846
|
-
|
|
241847
|
-
|
|
241848
|
-
|
|
241855
|
+
message: {
|
|
241856
|
+
...createUserMessage({
|
|
241857
|
+
content: [
|
|
241858
|
+
{
|
|
241859
|
+
type: "tool_result",
|
|
241860
|
+
content,
|
|
241861
|
+
is_error: true,
|
|
241862
|
+
tool_use_id: toolUseID
|
|
241863
|
+
}
|
|
241864
|
+
],
|
|
241865
|
+
toolUseResult: `Error: ${content}`,
|
|
241866
|
+
mcpMeta: toolUseContext.agentId ? undefined : error41 instanceof McpToolCallError_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS ? error41.mcpMeta : undefined,
|
|
241867
|
+
sourceToolAssistantUUID: assistantMessage.uuid
|
|
241868
|
+
}),
|
|
241869
|
+
...error41 instanceof ToolContinuationStopError && {
|
|
241870
|
+
preventContinuation: true
|
|
241871
|
+
}
|
|
241872
|
+
}
|
|
241849
241873
|
},
|
|
241850
241874
|
...hookMessages
|
|
241851
241875
|
];
|
|
@@ -243673,6 +243697,9 @@ function* yieldMissingToolResultBlocks(assistantMessages, errorMessage2) {
|
|
|
243673
243697
|
function isWithheldMaxOutputTokens(msg) {
|
|
243674
243698
|
return msg?.type === "assistant" && msg.apiError === "max_output_tokens";
|
|
243675
243699
|
}
|
|
243700
|
+
function messagePreventsContinuation(message) {
|
|
243701
|
+
return message.type === "user" && message.preventContinuation === true || message.type === "attachment" && message.attachment.type === "hook_stopped_continuation";
|
|
243702
|
+
}
|
|
243676
243703
|
async function* query(params) {
|
|
243677
243704
|
const consumedCommandUuids = [];
|
|
243678
243705
|
const terminal = yield* queryLoop(params, consumedCommandUuids);
|
|
@@ -243840,6 +243867,7 @@ async function* queryLoop(params, consumedCommandUuids) {
|
|
|
243840
243867
|
const toolResults = [];
|
|
243841
243868
|
const toolUseBlocks = [];
|
|
243842
243869
|
let needsFollowUp = false;
|
|
243870
|
+
let shouldPreventContinuation = false;
|
|
243843
243871
|
queryCheckpoint("query_setup_start");
|
|
243844
243872
|
const useStreamingToolExecution = config2.gates.streamingToolExecution;
|
|
243845
243873
|
let streamingToolExecutor = useStreamingToolExecution ? new StreamingToolExecutor(toolUseContext.options.tools, canUseTool, toolUseContext) : null;
|
|
@@ -243937,6 +243965,7 @@ async function* queryLoop(params, consumedCommandUuids) {
|
|
|
243937
243965
|
toolResults.length = 0;
|
|
243938
243966
|
toolUseBlocks.length = 0;
|
|
243939
243967
|
needsFollowUp = false;
|
|
243968
|
+
shouldPreventContinuation = false;
|
|
243940
243969
|
if (streamingToolExecutor) {
|
|
243941
243970
|
streamingToolExecutor.discard();
|
|
243942
243971
|
streamingToolExecutor = new StreamingToolExecutor(toolUseContext.options.tools, canUseTool, toolUseContext);
|
|
@@ -243999,6 +244028,9 @@ async function* queryLoop(params, consumedCommandUuids) {
|
|
|
243999
244028
|
for (const result of streamingToolExecutor.getCompletedResults()) {
|
|
244000
244029
|
if (result.message) {
|
|
244001
244030
|
yield result.message;
|
|
244031
|
+
if (messagePreventsContinuation(result.message)) {
|
|
244032
|
+
shouldPreventContinuation = true;
|
|
244033
|
+
}
|
|
244002
244034
|
toolResults.push(...normalizeMessagesForAPI([result.message], toolUseContext.options.tools).filter((_) => _.type === "user"));
|
|
244003
244035
|
}
|
|
244004
244036
|
}
|
|
@@ -244015,6 +244047,7 @@ async function* queryLoop(params, consumedCommandUuids) {
|
|
|
244015
244047
|
toolResults.length = 0;
|
|
244016
244048
|
toolUseBlocks.length = 0;
|
|
244017
244049
|
needsFollowUp = false;
|
|
244050
|
+
shouldPreventContinuation = false;
|
|
244018
244051
|
if (streamingToolExecutor) {
|
|
244019
244052
|
streamingToolExecutor.discard();
|
|
244020
244053
|
streamingToolExecutor = new StreamingToolExecutor(toolUseContext.options.tools, canUseTool, toolUseContext);
|
|
@@ -244212,7 +244245,6 @@ async function* queryLoop(params, consumedCommandUuids) {
|
|
|
244212
244245
|
if (false) {}
|
|
244213
244246
|
return { reason: "completed" };
|
|
244214
244247
|
}
|
|
244215
|
-
let shouldPreventContinuation = false;
|
|
244216
244248
|
let updatedToolRuntimeContext = toolUseContext;
|
|
244217
244249
|
queryCheckpoint("query_tool_execution_start");
|
|
244218
244250
|
if (streamingToolExecutor) {
|
|
@@ -244232,7 +244264,7 @@ async function* queryLoop(params, consumedCommandUuids) {
|
|
|
244232
244264
|
for await (const update of toolUpdates) {
|
|
244233
244265
|
if (update.message) {
|
|
244234
244266
|
yield update.message;
|
|
244235
|
-
if (update.message
|
|
244267
|
+
if (messagePreventsContinuation(update.message)) {
|
|
244236
244268
|
shouldPreventContinuation = true;
|
|
244237
244269
|
}
|
|
244238
244270
|
toolResults.push(...normalizeMessagesForAPI([update.message], toolUseContext.options.tools).filter((_) => _.type === "user"));
|
|
@@ -244246,7 +244278,7 @@ async function* queryLoop(params, consumedCommandUuids) {
|
|
|
244246
244278
|
}
|
|
244247
244279
|
queryCheckpoint("query_tool_execution_end");
|
|
244248
244280
|
let nextPendingToolUseSummary;
|
|
244249
|
-
if (config2.gates.emitToolUseSummaries && toolUseBlocks.length > 0 && !toolUseContext.abortController.signal.aborted && !toolUseContext.agentId) {
|
|
244281
|
+
if (!shouldPreventContinuation && config2.gates.emitToolUseSummaries && toolUseBlocks.length > 0 && !toolUseContext.abortController.signal.aborted && !toolUseContext.agentId) {
|
|
244250
244282
|
const lastAssistantMessage = assistantMessages.at(-1);
|
|
244251
244283
|
let lastAssistantText;
|
|
244252
244284
|
if (lastAssistantMessage) {
|
|
@@ -244613,7 +244645,7 @@ function getAnthropicEnvMetadata() {
|
|
|
244613
244645
|
function getBuildAgeMinutes() {
|
|
244614
244646
|
if (false)
|
|
244615
244647
|
;
|
|
244616
|
-
const buildTime = new Date("2026-07-
|
|
244648
|
+
const buildTime = new Date("2026-07-21T10:56:17.312Z").getTime();
|
|
244617
244649
|
if (isNaN(buildTime))
|
|
244618
244650
|
return;
|
|
244619
244651
|
return Math.floor((Date.now() - buildTime) / 60000);
|
|
@@ -250591,6 +250623,21 @@ var init_RemoteAgentTask = __esm(() => {
|
|
|
250591
250623
|
};
|
|
250592
250624
|
});
|
|
250593
250625
|
|
|
250626
|
+
// src/lib/zodToJsonSchema.ts
|
|
250627
|
+
function zodToJsonSchema3(schema) {
|
|
250628
|
+
const hit = cache2.get(schema);
|
|
250629
|
+
if (hit)
|
|
250630
|
+
return hit;
|
|
250631
|
+
const result = toJSONSchema(schema);
|
|
250632
|
+
cache2.set(schema, result);
|
|
250633
|
+
return result;
|
|
250634
|
+
}
|
|
250635
|
+
var cache2;
|
|
250636
|
+
var init_zodToJsonSchema2 = __esm(() => {
|
|
250637
|
+
init_v4();
|
|
250638
|
+
cache2 = new WeakMap;
|
|
250639
|
+
});
|
|
250640
|
+
|
|
250594
250641
|
// src/session/systemPrompt.ts
|
|
250595
250642
|
function buildEffectiveSystemPrompt({
|
|
250596
250643
|
mainThreadAgentDefinition,
|
|
@@ -250634,6 +250681,67 @@ function getTeleportLauncher() {
|
|
|
250634
250681
|
}
|
|
250635
250682
|
var _launcher = null;
|
|
250636
250683
|
|
|
250684
|
+
// src/capabilities/worktreeAvailability.ts
|
|
250685
|
+
import { spawnSync as spawnSync2 } from "child_process";
|
|
250686
|
+
import { resolve as resolve18 } from "path";
|
|
250687
|
+
function resolveGitWorktreeAvailability(cwd, gitExecutable = "git") {
|
|
250688
|
+
try {
|
|
250689
|
+
const rootResult = spawnSync2(gitExecutable, ["rev-parse", "--show-toplevel"], {
|
|
250690
|
+
cwd,
|
|
250691
|
+
encoding: "utf8",
|
|
250692
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
250693
|
+
windowsHide: true
|
|
250694
|
+
});
|
|
250695
|
+
if (rootResult.error) {
|
|
250696
|
+
return { available: false, reason: "git_unavailable" };
|
|
250697
|
+
}
|
|
250698
|
+
const gitRoot = rootResult.stdout.trim();
|
|
250699
|
+
if (rootResult.status !== 0 || !gitRoot) {
|
|
250700
|
+
return { available: false, reason: "not_git_repository" };
|
|
250701
|
+
}
|
|
250702
|
+
const headResult = spawnSync2(gitExecutable, ["rev-parse", "--verify", "HEAD^{commit}"], {
|
|
250703
|
+
cwd: gitRoot,
|
|
250704
|
+
encoding: "utf8",
|
|
250705
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
250706
|
+
windowsHide: true
|
|
250707
|
+
});
|
|
250708
|
+
if (headResult.error) {
|
|
250709
|
+
return { available: false, reason: "git_unavailable" };
|
|
250710
|
+
}
|
|
250711
|
+
const headCommit = headResult.stdout.trim();
|
|
250712
|
+
if (headResult.status !== 0 || !headCommit) {
|
|
250713
|
+
return { available: false, reason: "unborn_head" };
|
|
250714
|
+
}
|
|
250715
|
+
return {
|
|
250716
|
+
available: true,
|
|
250717
|
+
gitRoot: resolve18(gitRoot).normalize("NFC"),
|
|
250718
|
+
headCommit
|
|
250719
|
+
};
|
|
250720
|
+
} catch {
|
|
250721
|
+
return { available: false, reason: "git_unavailable" };
|
|
250722
|
+
}
|
|
250723
|
+
}
|
|
250724
|
+
function isGitWorktreeIsolationAvailable(cwd, gitExecutable = "git", cache3) {
|
|
250725
|
+
const cacheKey = `${resolve18(cwd).normalize("NFC")}\x00${gitExecutable}`;
|
|
250726
|
+
const cached3 = cache3?.get(cacheKey);
|
|
250727
|
+
if (cached3 !== undefined)
|
|
250728
|
+
return cached3;
|
|
250729
|
+
const available = resolveGitWorktreeAvailability(cwd, gitExecutable).available;
|
|
250730
|
+
cache3?.set(cacheKey, available);
|
|
250731
|
+
return available;
|
|
250732
|
+
}
|
|
250733
|
+
var WorktreeUnavailableError;
|
|
250734
|
+
var init_worktreeAvailability = __esm(() => {
|
|
250735
|
+
WorktreeUnavailableError = class WorktreeUnavailableError extends Error {
|
|
250736
|
+
reason;
|
|
250737
|
+
constructor(reason) {
|
|
250738
|
+
super(`Agent worktree is unavailable (${reason})`);
|
|
250739
|
+
this.reason = reason;
|
|
250740
|
+
this.name = "WorktreeUnavailableError";
|
|
250741
|
+
}
|
|
250742
|
+
};
|
|
250743
|
+
});
|
|
250744
|
+
|
|
250637
250745
|
// src/session/agentId.ts
|
|
250638
250746
|
function formatAgentId(agentName, teamName) {
|
|
250639
250747
|
return `${agentName}@${teamName}`;
|
|
@@ -258008,13 +258116,13 @@ var init_sedValidation = __esm(() => {
|
|
|
258008
258116
|
|
|
258009
258117
|
// src/capabilities/tools/BashTool/pathValidation.ts
|
|
258010
258118
|
import { homedir as homedir18 } from "os";
|
|
258011
|
-
import { isAbsolute as isAbsolute13, resolve as
|
|
258119
|
+
import { isAbsolute as isAbsolute13, resolve as resolve19 } from "path";
|
|
258012
258120
|
function checkDangerousRemovalPaths(command, args, cwd) {
|
|
258013
258121
|
const extractor = PATH_EXTRACTORS[command];
|
|
258014
258122
|
const paths2 = extractor(args);
|
|
258015
258123
|
for (const path11 of paths2) {
|
|
258016
258124
|
const cleanPath = expandTilde(path11.replace(/^['"]|['"]$/g, ""));
|
|
258017
|
-
const absolutePath = isAbsolute13(cleanPath) ? cleanPath :
|
|
258125
|
+
const absolutePath = isAbsolute13(cleanPath) ? cleanPath : resolve19(cwd, cleanPath);
|
|
258018
258126
|
if (isDangerousRemovalPath(absolutePath)) {
|
|
258019
258127
|
return {
|
|
258020
258128
|
behavior: "ask",
|
|
@@ -261742,7 +261850,7 @@ function createInProcessCanUseTool(identity4, abortController, onPermissionWaitM
|
|
|
261742
261850
|
}
|
|
261743
261851
|
const setToolUseConfirmQueue = getLeaderToolUseConfirmQueue();
|
|
261744
261852
|
if (setToolUseConfirmQueue) {
|
|
261745
|
-
return new Promise((
|
|
261853
|
+
return new Promise((resolve20) => {
|
|
261746
261854
|
let decisionMade = false;
|
|
261747
261855
|
const permissionStartMs = Date.now();
|
|
261748
261856
|
const reportPermissionWait = () => {
|
|
@@ -261753,7 +261861,7 @@ function createInProcessCanUseTool(identity4, abortController, onPermissionWaitM
|
|
|
261753
261861
|
return;
|
|
261754
261862
|
decisionMade = true;
|
|
261755
261863
|
reportPermissionWait();
|
|
261756
|
-
|
|
261864
|
+
resolve20({ behavior: "ask", message: SUBAGENT_REJECT_MESSAGE });
|
|
261757
261865
|
setToolUseConfirmQueue((queue3) => queue3.filter((item) => item.toolUseID !== toolUseID));
|
|
261758
261866
|
};
|
|
261759
261867
|
abortController.signal.addEventListener("abort", onAbortListener, {
|
|
@@ -261778,7 +261886,7 @@ function createInProcessCanUseTool(identity4, abortController, onPermissionWaitM
|
|
|
261778
261886
|
decisionMade = true;
|
|
261779
261887
|
abortController.signal.removeEventListener("abort", onAbortListener);
|
|
261780
261888
|
reportPermissionWait();
|
|
261781
|
-
|
|
261889
|
+
resolve20({ behavior: "ask", message: SUBAGENT_REJECT_MESSAGE });
|
|
261782
261890
|
},
|
|
261783
261891
|
async onAllow(updatedInput, permissionUpdates, feedback, contentBlocks) {
|
|
261784
261892
|
if (decisionMade)
|
|
@@ -261798,7 +261906,7 @@ function createInProcessCanUseTool(identity4, abortController, onPermissionWaitM
|
|
|
261798
261906
|
}
|
|
261799
261907
|
}
|
|
261800
261908
|
const trimmedFeedback = feedback?.trim();
|
|
261801
|
-
|
|
261909
|
+
resolve20({
|
|
261802
261910
|
behavior: "allow",
|
|
261803
261911
|
updatedInput,
|
|
261804
261912
|
userModified: false,
|
|
@@ -261813,7 +261921,7 @@ function createInProcessCanUseTool(identity4, abortController, onPermissionWaitM
|
|
|
261813
261921
|
abortController.signal.removeEventListener("abort", onAbortListener);
|
|
261814
261922
|
reportPermissionWait();
|
|
261815
261923
|
const message = feedback ? `${SUBAGENT_REJECT_MESSAGE_WITH_REASON_PREFIX}${feedback}` : SUBAGENT_REJECT_MESSAGE;
|
|
261816
|
-
|
|
261924
|
+
resolve20({ behavior: "ask", message, contentBlocks });
|
|
261817
261925
|
},
|
|
261818
261926
|
async recheckPermission() {
|
|
261819
261927
|
if (decisionMade)
|
|
@@ -261824,7 +261932,7 @@ function createInProcessCanUseTool(identity4, abortController, onPermissionWaitM
|
|
|
261824
261932
|
abortController.signal.removeEventListener("abort", onAbortListener);
|
|
261825
261933
|
reportPermissionWait();
|
|
261826
261934
|
setToolUseConfirmQueue((queue4) => queue4.filter((item) => item.toolUseID !== toolUseID));
|
|
261827
|
-
|
|
261935
|
+
resolve20({
|
|
261828
261936
|
...freshResult,
|
|
261829
261937
|
updatedInput: input,
|
|
261830
261938
|
userModified: false
|
|
@@ -261835,7 +261943,7 @@ function createInProcessCanUseTool(identity4, abortController, onPermissionWaitM
|
|
|
261835
261943
|
]);
|
|
261836
261944
|
});
|
|
261837
261945
|
}
|
|
261838
|
-
return new Promise((
|
|
261946
|
+
return new Promise((resolve20) => {
|
|
261839
261947
|
const request = createPermissionRequest({
|
|
261840
261948
|
toolName: tool.name,
|
|
261841
261949
|
toolUseId: toolUseID,
|
|
@@ -261854,7 +261962,7 @@ function createInProcessCanUseTool(identity4, abortController, onPermissionWaitM
|
|
|
261854
261962
|
cleanup();
|
|
261855
261963
|
persistPermissionUpdates(permissionUpdates);
|
|
261856
261964
|
const finalInput = updatedInput && Object.keys(updatedInput).length > 0 ? updatedInput : input;
|
|
261857
|
-
|
|
261965
|
+
resolve20({
|
|
261858
261966
|
behavior: "allow",
|
|
261859
261967
|
updatedInput: finalInput,
|
|
261860
261968
|
userModified: false,
|
|
@@ -261864,14 +261972,14 @@ function createInProcessCanUseTool(identity4, abortController, onPermissionWaitM
|
|
|
261864
261972
|
onReject(feedback, contentBlocks) {
|
|
261865
261973
|
cleanup();
|
|
261866
261974
|
const message = feedback ? `${SUBAGENT_REJECT_MESSAGE_WITH_REASON_PREFIX}${feedback}` : SUBAGENT_REJECT_MESSAGE;
|
|
261867
|
-
|
|
261975
|
+
resolve20({ behavior: "ask", message, contentBlocks });
|
|
261868
261976
|
}
|
|
261869
261977
|
});
|
|
261870
261978
|
sendPermissionRequestViaMailbox(request);
|
|
261871
|
-
const pollInterval = setInterval(async (abortController2, cleanup2,
|
|
261979
|
+
const pollInterval = setInterval(async (abortController2, cleanup2, resolve21, identity5, request2) => {
|
|
261872
261980
|
if (abortController2.signal.aborted) {
|
|
261873
261981
|
cleanup2();
|
|
261874
|
-
|
|
261982
|
+
resolve21({ behavior: "ask", message: SUBAGENT_REJECT_MESSAGE });
|
|
261875
261983
|
return;
|
|
261876
261984
|
}
|
|
261877
261985
|
const allMessages = await readMailbox(identity5.agentName, identity5.teamName);
|
|
@@ -261899,10 +262007,10 @@ function createInProcessCanUseTool(identity4, abortController, onPermissionWaitM
|
|
|
261899
262007
|
}
|
|
261900
262008
|
}
|
|
261901
262009
|
}
|
|
261902
|
-
}, PERMISSION_POLL_INTERVAL_MS, abortController, cleanup,
|
|
262010
|
+
}, PERMISSION_POLL_INTERVAL_MS, abortController, cleanup, resolve20, identity4, request);
|
|
261903
262011
|
const onAbortListener = () => {
|
|
261904
262012
|
cleanup();
|
|
261905
|
-
|
|
262013
|
+
resolve20({ behavior: "ask", message: SUBAGENT_REJECT_MESSAGE });
|
|
261906
262014
|
};
|
|
261907
262015
|
abortController.signal.addEventListener("abort", onAbortListener, {
|
|
261908
262016
|
once: true
|
|
@@ -263124,8 +263232,8 @@ function waitForPaneShellReady() {
|
|
|
263124
263232
|
}
|
|
263125
263233
|
function acquirePaneCreationLock() {
|
|
263126
263234
|
let release;
|
|
263127
|
-
const newLock = new Promise((
|
|
263128
|
-
release =
|
|
263235
|
+
const newLock = new Promise((resolve20) => {
|
|
263236
|
+
release = resolve20;
|
|
263129
263237
|
});
|
|
263130
263238
|
const previousLock = paneCreationLock;
|
|
263131
263239
|
paneCreationLock = newLock;
|
|
@@ -263572,8 +263680,8 @@ __export(exports_ITermBackend, {
|
|
|
263572
263680
|
});
|
|
263573
263681
|
function acquirePaneCreationLock2() {
|
|
263574
263682
|
let release;
|
|
263575
|
-
const newLock = new Promise((
|
|
263576
|
-
release =
|
|
263683
|
+
const newLock = new Promise((resolve20) => {
|
|
263684
|
+
release = resolve20;
|
|
263577
263685
|
});
|
|
263578
263686
|
const previousLock = paneCreationLock2;
|
|
263579
263687
|
paneCreationLock2 = newLock;
|
|
@@ -264604,6 +264712,96 @@ var init_spawnMultiAgent = __esm(() => {
|
|
|
264604
264712
|
init_loadAgentsDir();
|
|
264605
264713
|
});
|
|
264606
264714
|
|
|
264715
|
+
// src/capabilities/tools/AgentTool/agentInvocationDedupe.ts
|
|
264716
|
+
import { isDeepStrictEqual } from "node:util";
|
|
264717
|
+
function isToolUseBlock(value) {
|
|
264718
|
+
if (!value || typeof value !== "object")
|
|
264719
|
+
return false;
|
|
264720
|
+
const block2 = value;
|
|
264721
|
+
return block2.type === "tool_use" && typeof block2.id === "string" && typeof block2.name === "string";
|
|
264722
|
+
}
|
|
264723
|
+
function isAgentToolUseBlock(block2) {
|
|
264724
|
+
return block2.name === AGENT_TOOL_NAME2 || block2.name === LEGACY_AGENT_TOOL_NAME2;
|
|
264725
|
+
}
|
|
264726
|
+
function findEarlierDuplicateAgentToolUse(assistantMessage, currentToolUseId) {
|
|
264727
|
+
if (!currentToolUseId || !Array.isArray(assistantMessage?.message?.content)) {
|
|
264728
|
+
return;
|
|
264729
|
+
}
|
|
264730
|
+
const earlierAgentToolUses = [];
|
|
264731
|
+
for (const block2 of assistantMessage.message.content) {
|
|
264732
|
+
if (!isToolUseBlock(block2))
|
|
264733
|
+
continue;
|
|
264734
|
+
if (block2.id === currentToolUseId) {
|
|
264735
|
+
if (!isAgentToolUseBlock(block2))
|
|
264736
|
+
return;
|
|
264737
|
+
return earlierAgentToolUses.find((candidate) => isDeepStrictEqual(candidate.input, block2.input))?.id;
|
|
264738
|
+
}
|
|
264739
|
+
if (isAgentToolUseBlock(block2))
|
|
264740
|
+
earlierAgentToolUses.push(block2);
|
|
264741
|
+
}
|
|
264742
|
+
return;
|
|
264743
|
+
}
|
|
264744
|
+
var init_agentInvocationDedupe = __esm(() => {
|
|
264745
|
+
init_constants4();
|
|
264746
|
+
});
|
|
264747
|
+
|
|
264748
|
+
// src/capabilities/tools/AgentTool/worktreeIsolation.ts
|
|
264749
|
+
function getWorktreeIsolationUnavailableMessage(reason) {
|
|
264750
|
+
switch (reason) {
|
|
264751
|
+
case "not_git_repository":
|
|
264752
|
+
return "Worktree isolation is unavailable: the current directory is not a Git repository and no WorktreeCreate hook is configured. This model continuation has been stopped. Run the Agent task again without `isolation` only if using the current directory is safe; otherwise select a Git repository or configure a WorktreeCreate hook.";
|
|
264753
|
+
case "unborn_head":
|
|
264754
|
+
return "Worktree isolation is unavailable: the Git repository has no resolvable HEAD commit. This model continuation has been stopped. Run the Agent task again without `isolation` only if using the current directory is safe; otherwise create the initial commit.";
|
|
264755
|
+
case "git_unavailable":
|
|
264756
|
+
return "Worktree isolation is unavailable because Git could not be inspected. This model continuation has been stopped. Check that Git is installed and accessible, or run the Agent task again without `isolation` only if using the current directory is safe.";
|
|
264757
|
+
default: {
|
|
264758
|
+
const exhaustive = reason;
|
|
264759
|
+
return exhaustive;
|
|
264760
|
+
}
|
|
264761
|
+
}
|
|
264762
|
+
}
|
|
264763
|
+
var WORKTREE_ISOLATION_SCHEMA_DESCRIPTION = 'Isolation mode. Set "worktree" only when the user explicitly requests worktree isolation. It requires a Git repository with a resolvable HEAD commit or a configured WorktreeCreate hook; omit it for ordinary tasks, including read-only research.', WORKTREE_ISOLATION_USAGE_GUIDANCE = 'Only set `isolation: "worktree"` when the user explicitly requests worktree isolation. Omit it for ordinary tasks, including read-only research. Worktree isolation requires a Git repository with a resolvable HEAD commit or a configured WorktreeCreate hook.';
|
|
264764
|
+
|
|
264765
|
+
// src/capabilities/tools/AgentTool/inputSchema.ts
|
|
264766
|
+
function buildAgentInputSchema(options2) {
|
|
264767
|
+
const capabilityAwareSchema = options2.worktreeIsolationAvailable ? fullInputSchema() : inputSchemaWithoutWorktreeIsolation();
|
|
264768
|
+
const schema = options2.includeCwd ? capabilityAwareSchema : capabilityAwareSchema.omit({
|
|
264769
|
+
cwd: true
|
|
264770
|
+
});
|
|
264771
|
+
return options2.includeRunInBackground ? schema : schema.omit({
|
|
264772
|
+
run_in_background: true
|
|
264773
|
+
});
|
|
264774
|
+
}
|
|
264775
|
+
var baseInputSchema, fullInputSchema, inputSchemaWithoutWorktreeIsolation;
|
|
264776
|
+
var init_inputSchema = __esm(() => {
|
|
264777
|
+
init_v4();
|
|
264778
|
+
init_PermissionMode();
|
|
264779
|
+
baseInputSchema = lazySchema(() => exports_external.object({
|
|
264780
|
+
description: exports_external.string().describe("A short (3-5 word) description of the task"),
|
|
264781
|
+
prompt: exports_external.string().describe("The task for the agent to perform"),
|
|
264782
|
+
subagent_type: exports_external.string().optional().describe("The type of specialized agent to use for this task"),
|
|
264783
|
+
model: exports_external.enum(["sonnet", "opus", "haiku"]).optional().describe("Optional model override for this agent. Takes precedence over the agent definition's model frontmatter. If omitted, uses the agent definition's model, or inherits from the parent."),
|
|
264784
|
+
run_in_background: exports_external.boolean().optional().describe("Set to true to run this agent in the background. You will be notified when it completes.")
|
|
264785
|
+
}));
|
|
264786
|
+
fullInputSchema = lazySchema(() => {
|
|
264787
|
+
const multiAgentInputSchema = exports_external.object({
|
|
264788
|
+
name: exports_external.string().optional().describe("Name for the spawned agent. Makes it addressable via SendMessage({to: name}) while running."),
|
|
264789
|
+
team_name: exports_external.string().optional().describe("Team name for spawning. Uses current team context if omitted."),
|
|
264790
|
+
mode: permissionModeSchema().optional().describe('Permission mode for spawned teammate (e.g., "plan" to require plan approval).')
|
|
264791
|
+
});
|
|
264792
|
+
const isolationInputSchema = exports_external.object({
|
|
264793
|
+
isolation: exports_external.enum(["worktree"]).optional().describe(WORKTREE_ISOLATION_SCHEMA_DESCRIPTION)
|
|
264794
|
+
});
|
|
264795
|
+
return baseInputSchema().merge(multiAgentInputSchema).extend({
|
|
264796
|
+
cwd: exports_external.string().optional().describe('Absolute path to run the agent in. Overrides the working directory for all filesystem and shell operations within this agent. Mutually exclusive with isolation: "worktree".')
|
|
264797
|
+
}).merge(isolationInputSchema);
|
|
264798
|
+
});
|
|
264799
|
+
inputSchemaWithoutWorktreeIsolation = lazySchema(() => {
|
|
264800
|
+
const schema = fullInputSchema().omit({ isolation: true });
|
|
264801
|
+
return schema;
|
|
264802
|
+
});
|
|
264803
|
+
});
|
|
264804
|
+
|
|
264607
264805
|
// src/capabilities/tools/AgentTool/forkSubagent.ts
|
|
264608
264806
|
import { randomUUID as randomUUID12 } from "crypto";
|
|
264609
264807
|
function isForkSubagentEnabled() {
|
|
@@ -264849,7 +265047,11 @@ The ${AGENT_TOOL_NAME2} tool launches specialized agents (subprocesses) that aut
|
|
|
264849
265047
|
|
|
264850
265048
|
${agentListSection}
|
|
264851
265049
|
|
|
264852
|
-
${forkEnabled ? `When using the ${AGENT_TOOL_NAME2} tool, specify a subagent_type to use a specialized agent, or omit it to fork yourself — a fork inherits your full conversation context. Only use subagent_type values that appear in the available agent types; never invent an agent type from an example.` : `When using the ${AGENT_TOOL_NAME2} tool, specify a subagent_type parameter to select which agent type to use. If omitted, the general-purpose agent is used. Only use subagent_type values that appear in the available agent types; never invent an agent type from an example.`}
|
|
265050
|
+
${forkEnabled ? `When using the ${AGENT_TOOL_NAME2} tool, specify a subagent_type to use a specialized agent, or omit it to fork yourself — a fork inherits your full conversation context. Only use subagent_type values that appear in the available agent types; never invent an agent type from an example.` : `When using the ${AGENT_TOOL_NAME2} tool, specify a subagent_type parameter to select which agent type to use. If omitted, the general-purpose agent is used. Only use subagent_type values that appear in the available agent types; never invent an agent type from an example.`}
|
|
265051
|
+
|
|
265052
|
+
Do not launch multiple Agent calls with exactly the same input.
|
|
265053
|
+
|
|
265054
|
+
${WORKTREE_ISOLATION_USAGE_GUIDANCE}`;
|
|
264853
265055
|
if (isCoordinator) {
|
|
264854
265056
|
return shared2;
|
|
264855
265057
|
}
|
|
@@ -264864,7 +265066,7 @@ When NOT to use the ${AGENT_TOOL_NAME2} tool:
|
|
|
264864
265066
|
- Other tasks that are not related to the agent descriptions above
|
|
264865
265067
|
`;
|
|
264866
265068
|
const concurrencyNote = !listViaAttachment && getSubscriptionType() !== "pro" ? `
|
|
264867
|
-
- Launch multiple agents concurrently
|
|
265069
|
+
- Launch multiple agents concurrently for independent, non-overlapping tasks; to do that, use a single message with multiple tool uses` : "";
|
|
264868
265070
|
return `${shared2}
|
|
264869
265071
|
${whenNotToUseSection}
|
|
264870
265072
|
|
|
@@ -264878,7 +265080,7 @@ Usage notes:
|
|
|
264878
265080
|
- Clearly tell the agent whether you expect it to write code or just to do research (search, file reads, web fetches, etc.)${forkEnabled ? "" : ", since it is not aware of the user's intent"}
|
|
264879
265081
|
- If the agent description mentions that it should be used proactively, then you should try your best to use it without the user having to ask for it first. Use your judgement.
|
|
264880
265082
|
- If the user specifies that they want you to run agents "in parallel", you MUST send a single message with multiple ${AGENT_TOOL_NAME2} tool use content blocks. Each call must either omit subagent_type or use an exact type from the available agent list.
|
|
264881
|
-
|
|
265083
|
+
${process.env.USER_TYPE === "ant" ? `
|
|
264882
265084
|
- You can set \`isolation: "remote"\` to run the agent in a remote CCR environment. This is always a background task; you'll be notified when it completes. Use for long-running tasks that need a fresh sandbox.` : ""}${isInProcessTeammate() ? `
|
|
264883
265085
|
- The run_in_background, name, team_name, and mode parameters are not available in this context. Only synchronous subagents are supported.` : isTeammate() ? `
|
|
264884
265086
|
- The name, team_name, and mode parameters are not available in this context — teammates cannot spawn other teammates. Omit them to spawn a subagent.` : ""}${whenToForkSection}${writingThePromptSection}
|
|
@@ -264904,12 +265106,57 @@ function getAutoBackgroundMs() {
|
|
|
264904
265106
|
}
|
|
264905
265107
|
return 0;
|
|
264906
265108
|
}
|
|
265109
|
+
function buildConfiguredAgentInputSchema(worktreeIsolationAvailable) {
|
|
265110
|
+
const options2 = {
|
|
265111
|
+
worktreeIsolationAvailable,
|
|
265112
|
+
includeRunInBackground: !isBackgroundTasksDisabled && !isForkSubagentEnabled()
|
|
265113
|
+
};
|
|
265114
|
+
return buildAgentInputSchema({
|
|
265115
|
+
...options2,
|
|
265116
|
+
includeCwd: false
|
|
265117
|
+
});
|
|
265118
|
+
}
|
|
265119
|
+
function getAdvertisedWorktreeAvailabilityCache() {
|
|
265120
|
+
try {
|
|
265121
|
+
const queryContext = getQueryContext();
|
|
265122
|
+
const now = Date.now();
|
|
265123
|
+
let cache3 = advertisedWorktreeAvailabilityByQuery.get(queryContext);
|
|
265124
|
+
if (!cache3 || cache3.expiresAt <= now || cache3.totalToolDuration !== queryContext.cost.totalToolDuration) {
|
|
265125
|
+
cache3 = {
|
|
265126
|
+
expiresAt: now + WORKTREE_AVAILABILITY_CACHE_TTL_MS,
|
|
265127
|
+
totalToolDuration: queryContext.cost.totalToolDuration,
|
|
265128
|
+
values: new Map
|
|
265129
|
+
};
|
|
265130
|
+
advertisedWorktreeAvailabilityByQuery.set(queryContext, cache3);
|
|
265131
|
+
}
|
|
265132
|
+
return cache3.values;
|
|
265133
|
+
} catch {
|
|
265134
|
+
return;
|
|
265135
|
+
}
|
|
265136
|
+
}
|
|
265137
|
+
function getAdvertisedAgentInputJSONSchema() {
|
|
265138
|
+
const worktreeIsolationAvailable = isAgentWorktreeIsolationAvailable({
|
|
265139
|
+
gitAvailabilityCache: getAdvertisedWorktreeAvailabilityCache()
|
|
265140
|
+
});
|
|
265141
|
+
const schemaVariant = "standard";
|
|
265142
|
+
const includeRunInBackground = !isBackgroundTasksDisabled && !isForkSubagentEnabled();
|
|
265143
|
+
const cacheKey = `${worktreeIsolationAvailable}:${schemaVariant}:${includeRunInBackground}`;
|
|
265144
|
+
const cached3 = advertisedInputJSONSchemaCache.get(cacheKey);
|
|
265145
|
+
if (cached3)
|
|
265146
|
+
return cached3;
|
|
265147
|
+
const schema = {
|
|
265148
|
+
...zodToJsonSchema3(buildConfiguredAgentInputSchema(worktreeIsolationAvailable)),
|
|
265149
|
+
type: "object"
|
|
265150
|
+
};
|
|
265151
|
+
advertisedInputJSONSchemaCache.set(cacheKey, schema);
|
|
265152
|
+
return schema;
|
|
265153
|
+
}
|
|
264907
265154
|
function resolveTeamName(input, appState) {
|
|
264908
265155
|
if (!isAgentSwarmsEnabled())
|
|
264909
265156
|
return;
|
|
264910
265157
|
return input.team_name || appState.teamContext?.teamName;
|
|
264911
265158
|
}
|
|
264912
|
-
var getBackgroundHintJSX, renderGroupedAgentToolUse, renderToolResultMessage4, renderToolUseErrorMessage2, renderToolUseMessage4, renderToolUseProgressMessage2, renderToolUseRejectedMessage, renderToolUseTag2, userFacingName2, userFacingNameBackgroundColor, proactiveModule = null, PROGRESS_THRESHOLD_MS = 2000, isBackgroundTasksDisabled,
|
|
265159
|
+
var getBackgroundHintJSX, renderGroupedAgentToolUse, renderToolResultMessage4, renderToolUseErrorMessage2, renderToolUseMessage4, renderToolUseProgressMessage2, renderToolUseRejectedMessage, renderToolUseTag2, userFacingName2, userFacingNameBackgroundColor, proactiveModule = null, PROGRESS_THRESHOLD_MS = 2000, isBackgroundTasksDisabled, inputSchema7 = () => buildConfiguredAgentInputSchema(true), outputSchema6, advertisedInputJSONSchemaCache, WORKTREE_AVAILABILITY_CACHE_TTL_MS = 30000, advertisedWorktreeAvailabilityByQuery, agentToolRuntime, AgentTool;
|
|
264913
265160
|
var init_AgentTool = __esm(() => {
|
|
264914
265161
|
init_toolRuntime();
|
|
264915
265162
|
init_promptCategory();
|
|
@@ -264928,9 +265175,9 @@ var init_AgentTool = __esm(() => {
|
|
|
264928
265175
|
init_debug();
|
|
264929
265176
|
init_envUtils();
|
|
264930
265177
|
init_errors2();
|
|
265178
|
+
init_zodToJsonSchema2();
|
|
264931
265179
|
init_messages4();
|
|
264932
265180
|
init_agent();
|
|
264933
|
-
init_PermissionMode();
|
|
264934
265181
|
init_permissions2();
|
|
264935
265182
|
init_sdkEventQueue();
|
|
264936
265183
|
init_sessionStorage();
|
|
@@ -264941,11 +265188,14 @@ var init_AgentTool = __esm(() => {
|
|
|
264941
265188
|
init_tokens();
|
|
264942
265189
|
init_uuid();
|
|
264943
265190
|
init_worktree();
|
|
265191
|
+
init_worktreeAvailability();
|
|
264944
265192
|
init_toolUIRegistry();
|
|
264945
265193
|
init_prompt();
|
|
264946
265194
|
init_spawnMultiAgent();
|
|
264947
265195
|
init_agentColorManager();
|
|
265196
|
+
init_agentInvocationDedupe();
|
|
264948
265197
|
init_agentToolUtils();
|
|
265198
|
+
init_inputSchema();
|
|
264949
265199
|
init_generalPurposeAgent();
|
|
264950
265200
|
init_constants4();
|
|
264951
265201
|
init_forkSubagent();
|
|
@@ -264966,32 +265216,6 @@ var init_AgentTool = __esm(() => {
|
|
|
264966
265216
|
userFacingNameBackgroundColor
|
|
264967
265217
|
} = lazyUI("Agent"));
|
|
264968
265218
|
isBackgroundTasksDisabled = isEnvTruthy(resolveEnvVar("DISABLE_BACKGROUND_TASKS"));
|
|
264969
|
-
baseInputSchema = lazySchema(() => exports_external.object({
|
|
264970
|
-
description: exports_external.string().describe("A short (3-5 word) description of the task"),
|
|
264971
|
-
prompt: exports_external.string().describe("The task for the agent to perform"),
|
|
264972
|
-
subagent_type: exports_external.string().optional().describe("The type of specialized agent to use for this task"),
|
|
264973
|
-
model: exports_external.enum(["sonnet", "opus", "haiku"]).optional().describe("Optional model override for this agent. Takes precedence over the agent definition's model frontmatter. If omitted, uses the agent definition's model, or inherits from the parent."),
|
|
264974
|
-
run_in_background: exports_external.boolean().optional().describe("Set to true to run this agent in the background. You will be notified when it completes.")
|
|
264975
|
-
}));
|
|
264976
|
-
fullInputSchema = lazySchema(() => {
|
|
264977
|
-
const multiAgentInputSchema = exports_external.object({
|
|
264978
|
-
name: exports_external.string().optional().describe("Name for the spawned agent. Makes it addressable via SendMessage({to: name}) while running."),
|
|
264979
|
-
team_name: exports_external.string().optional().describe("Team name for spawning. Uses current team context if omitted."),
|
|
264980
|
-
mode: permissionModeSchema().optional().describe('Permission mode for spawned teammate (e.g., "plan" to require plan approval).')
|
|
264981
|
-
});
|
|
264982
|
-
return baseInputSchema().merge(multiAgentInputSchema).extend({
|
|
264983
|
-
isolation: exports_external.enum(["worktree"]).optional().describe('Isolation mode. "worktree" creates a temporary git worktree so the agent works on an isolated copy of the repo.'),
|
|
264984
|
-
cwd: exports_external.string().optional().describe('Absolute path to run the agent in. Overrides the working directory for all filesystem and shell operations within this agent. Mutually exclusive with isolation: "worktree".')
|
|
264985
|
-
});
|
|
264986
|
-
});
|
|
264987
|
-
inputSchema7 = lazySchema(() => {
|
|
264988
|
-
const schema = fullInputSchema().omit({
|
|
264989
|
-
cwd: true
|
|
264990
|
-
});
|
|
264991
|
-
return isBackgroundTasksDisabled || isForkSubagentEnabled() ? schema.omit({
|
|
264992
|
-
run_in_background: true
|
|
264993
|
-
}) : schema;
|
|
264994
|
-
});
|
|
264995
265219
|
outputSchema6 = lazySchema(() => {
|
|
264996
265220
|
const syncOutputSchema = agentToolResultSchema().extend({
|
|
264997
265221
|
status: exports_external.literal("completed"),
|
|
@@ -265007,7 +265231,9 @@ var init_AgentTool = __esm(() => {
|
|
|
265007
265231
|
});
|
|
265008
265232
|
return exports_external.union([syncOutputSchema, asyncOutputSchema]);
|
|
265009
265233
|
});
|
|
265010
|
-
|
|
265234
|
+
advertisedInputJSONSchemaCache = new Map;
|
|
265235
|
+
advertisedWorktreeAvailabilityByQuery = new WeakMap;
|
|
265236
|
+
agentToolRuntime = buildToolRuntime({
|
|
265011
265237
|
async prompt({
|
|
265012
265238
|
agents,
|
|
265013
265239
|
tools,
|
|
@@ -265037,9 +265263,7 @@ var init_AgentTool = __esm(() => {
|
|
|
265037
265263
|
async description() {
|
|
265038
265264
|
return "Launch a new agent";
|
|
265039
265265
|
},
|
|
265040
|
-
|
|
265041
|
-
return inputSchema7();
|
|
265042
|
-
},
|
|
265266
|
+
inputSchema: inputSchema7(),
|
|
265043
265267
|
get outputSchema() {
|
|
265044
265268
|
return outputSchema6();
|
|
265045
265269
|
},
|
|
@@ -265055,6 +265279,10 @@ var init_AgentTool = __esm(() => {
|
|
|
265055
265279
|
isolation,
|
|
265056
265280
|
cwd
|
|
265057
265281
|
}, toolUseContext, canUseTool, assistantMessage, onProgress) {
|
|
265282
|
+
const earlierDuplicateId = findEarlierDuplicateAgentToolUse(assistantMessage, toolUseContext.toolUseId);
|
|
265283
|
+
if (earlierDuplicateId) {
|
|
265284
|
+
throw new Error(`Duplicate Agent call skipped: this input duplicates earlier call ${earlierDuplicateId}. Do not retry it; wait for the earlier Agent result.`);
|
|
265285
|
+
}
|
|
265058
265286
|
const startTime = Date.now();
|
|
265059
265287
|
const model = isCoordinatorMode() ? undefined : modelParam;
|
|
265060
265288
|
const appState = toolUseContext.getAppState();
|
|
@@ -265291,15 +265519,16 @@ ${reasons}`);
|
|
|
265291
265519
|
try {
|
|
265292
265520
|
worktreeInfo = await createAgentWorktree(slug);
|
|
265293
265521
|
} catch (error41) {
|
|
265294
|
-
|
|
265295
|
-
if (message.includes("Cannot create agent worktree: not in a git repository")) {
|
|
265296
|
-
if (isolation === "worktree") {
|
|
265297
|
-
throw error41;
|
|
265298
|
-
}
|
|
265299
|
-
logForDebugging2("Agent worktree isolation unavailable outside a git repository; falling back to the current working directory.");
|
|
265300
|
-
} else {
|
|
265522
|
+
if (!(error41 instanceof WorktreeUnavailableError)) {
|
|
265301
265523
|
throw error41;
|
|
265302
265524
|
}
|
|
265525
|
+
const unavailableMessage = getWorktreeIsolationUnavailableMessage(error41.reason);
|
|
265526
|
+
if (isolation === "worktree") {
|
|
265527
|
+
throw new ToolContinuationStopError(unavailableMessage, {
|
|
265528
|
+
cause: error41
|
|
265529
|
+
});
|
|
265530
|
+
}
|
|
265531
|
+
logForDebugging2(`${unavailableMessage} Falling back to the current working directory.`);
|
|
265303
265532
|
}
|
|
265304
265533
|
}
|
|
265305
265534
|
if (isForkPath && worktreeInfo) {
|
|
@@ -265892,6 +266121,15 @@ duration_ms: ${data.totalDurationMs}</usage>`
|
|
|
265892
266121
|
renderToolUseErrorMessage: renderToolUseErrorMessage2,
|
|
265893
266122
|
renderGroupedToolUse: renderGroupedAgentToolUse
|
|
265894
266123
|
});
|
|
266124
|
+
AgentTool = {
|
|
266125
|
+
...agentToolRuntime,
|
|
266126
|
+
get inputSchema() {
|
|
266127
|
+
return inputSchema7();
|
|
266128
|
+
},
|
|
266129
|
+
get inputJSONSchema() {
|
|
266130
|
+
return getAdvertisedAgentInputJSONSchema();
|
|
266131
|
+
}
|
|
266132
|
+
};
|
|
265895
266133
|
});
|
|
265896
266134
|
|
|
265897
266135
|
// src/capabilities/diagnostics.ts
|
|
@@ -266270,12 +266508,12 @@ var init_LSPDiagnosticRegistry = __esm(() => {
|
|
|
266270
266508
|
});
|
|
266271
266509
|
|
|
266272
266510
|
// src/capabilities/plugins/lspPluginIntegration.ts
|
|
266273
|
-
import { join as join57, relative as relative7, resolve as
|
|
266511
|
+
import { join as join57, relative as relative7, resolve as resolve20 } from "path";
|
|
266274
266512
|
function validatePathWithinPlugin(pluginPath, relativePath) {
|
|
266275
|
-
const resolvedPluginPath =
|
|
266276
|
-
const resolvedFilePath =
|
|
266513
|
+
const resolvedPluginPath = resolve20(pluginPath);
|
|
266514
|
+
const resolvedFilePath = resolve20(pluginPath, relativePath);
|
|
266277
266515
|
const rel = relative7(resolvedPluginPath, resolvedFilePath);
|
|
266278
|
-
if (rel.startsWith("..") ||
|
|
266516
|
+
if (rel.startsWith("..") || resolve20(rel) === rel) {
|
|
266279
266517
|
return null;
|
|
266280
266518
|
}
|
|
266281
266519
|
return resolvedFilePath;
|
|
@@ -267509,8 +267747,8 @@ var require_semaphore = __commonJS((exports) => {
|
|
|
267509
267747
|
this._waiting = [];
|
|
267510
267748
|
}
|
|
267511
267749
|
lock(thunk) {
|
|
267512
|
-
return new Promise((
|
|
267513
|
-
this._waiting.push({ thunk, resolve:
|
|
267750
|
+
return new Promise((resolve21, reject2) => {
|
|
267751
|
+
this._waiting.push({ thunk, resolve: resolve21, reject: reject2 });
|
|
267514
267752
|
this.runNext();
|
|
267515
267753
|
});
|
|
267516
267754
|
}
|
|
@@ -269001,9 +269239,9 @@ ${JSON.stringify(message, null, 4)}`);
|
|
|
269001
269239
|
if (typeof cancellationStrategy.sender.enableCancellation === "function") {
|
|
269002
269240
|
cancellationStrategy.sender.enableCancellation(requestMessage);
|
|
269003
269241
|
}
|
|
269004
|
-
return new Promise(async (
|
|
269242
|
+
return new Promise(async (resolve21, reject2) => {
|
|
269005
269243
|
const resolveWithCleanup = (r) => {
|
|
269006
|
-
|
|
269244
|
+
resolve21(r);
|
|
269007
269245
|
cancellationStrategy.sender.cleanup(id);
|
|
269008
269246
|
disposable?.dispose();
|
|
269009
269247
|
};
|
|
@@ -269412,10 +269650,10 @@ var require_ril = __commonJS((exports) => {
|
|
|
269412
269650
|
return api_1.Disposable.create(() => this.stream.off("end", listener2));
|
|
269413
269651
|
}
|
|
269414
269652
|
write(data, encoding) {
|
|
269415
|
-
return new Promise((
|
|
269653
|
+
return new Promise((resolve21, reject2) => {
|
|
269416
269654
|
const callback = (error41) => {
|
|
269417
269655
|
if (error41 === undefined || error41 === null) {
|
|
269418
|
-
|
|
269656
|
+
resolve21();
|
|
269419
269657
|
} else {
|
|
269420
269658
|
reject2(error41);
|
|
269421
269659
|
}
|
|
@@ -269674,10 +269912,10 @@ var require_main = __commonJS((exports) => {
|
|
|
269674
269912
|
exports.generateRandomPipeName = generateRandomPipeName;
|
|
269675
269913
|
function createClientPipeTransport(pipeName, encoding = "utf-8") {
|
|
269676
269914
|
let connectResolve;
|
|
269677
|
-
const connected = new Promise((
|
|
269678
|
-
connectResolve =
|
|
269915
|
+
const connected = new Promise((resolve21, _reject) => {
|
|
269916
|
+
connectResolve = resolve21;
|
|
269679
269917
|
});
|
|
269680
|
-
return new Promise((
|
|
269918
|
+
return new Promise((resolve21, reject2) => {
|
|
269681
269919
|
let server = (0, net_1.createServer)((socket) => {
|
|
269682
269920
|
server.close();
|
|
269683
269921
|
connectResolve([
|
|
@@ -269688,7 +269926,7 @@ var require_main = __commonJS((exports) => {
|
|
|
269688
269926
|
server.on("error", reject2);
|
|
269689
269927
|
server.listen(pipeName, () => {
|
|
269690
269928
|
server.removeListener("error", reject2);
|
|
269691
|
-
|
|
269929
|
+
resolve21({
|
|
269692
269930
|
onConnected: () => {
|
|
269693
269931
|
return connected;
|
|
269694
269932
|
}
|
|
@@ -269707,10 +269945,10 @@ var require_main = __commonJS((exports) => {
|
|
|
269707
269945
|
exports.createServerPipeTransport = createServerPipeTransport;
|
|
269708
269946
|
function createClientSocketTransport(port, encoding = "utf-8") {
|
|
269709
269947
|
let connectResolve;
|
|
269710
|
-
const connected = new Promise((
|
|
269711
|
-
connectResolve =
|
|
269948
|
+
const connected = new Promise((resolve21, _reject) => {
|
|
269949
|
+
connectResolve = resolve21;
|
|
269712
269950
|
});
|
|
269713
|
-
return new Promise((
|
|
269951
|
+
return new Promise((resolve21, reject2) => {
|
|
269714
269952
|
const server = (0, net_1.createServer)((socket) => {
|
|
269715
269953
|
server.close();
|
|
269716
269954
|
connectResolve([
|
|
@@ -269721,7 +269959,7 @@ var require_main = __commonJS((exports) => {
|
|
|
269721
269959
|
server.on("error", reject2);
|
|
269722
269960
|
server.listen(port, "127.0.0.1", () => {
|
|
269723
269961
|
server.removeListener("error", reject2);
|
|
269724
|
-
|
|
269962
|
+
resolve21({
|
|
269725
269963
|
onConnected: () => {
|
|
269726
269964
|
return connected;
|
|
269727
269965
|
}
|
|
@@ -269800,10 +270038,10 @@ function createLSPClient(serverName, onCrash) {
|
|
|
269800
270038
|
throw new Error("LSP server process stdio not available");
|
|
269801
270039
|
}
|
|
269802
270040
|
const spawnedProcess = process14;
|
|
269803
|
-
await new Promise((
|
|
270041
|
+
await new Promise((resolve21, reject2) => {
|
|
269804
270042
|
const onSpawn = () => {
|
|
269805
270043
|
cleanup();
|
|
269806
|
-
|
|
270044
|
+
resolve21();
|
|
269807
270045
|
};
|
|
269808
270046
|
const onError = (error41) => {
|
|
269809
270047
|
cleanup();
|
|
@@ -273668,7 +273906,7 @@ ${filenames.join(`
|
|
|
273668
273906
|
var DESCRIPTION6 = "Replace the contents of a specific cell in a Jupyter notebook.", PROMPT4 = `Completely replaces the contents of a specific cell in a Jupyter notebook (.ipynb file) with new source. Jupyter notebooks are interactive documents that combine code, text, and visualizations, commonly used for data analysis and scientific computing. The notebook_path parameter must be an absolute path, not a relative path. The cell_number is 0-indexed. Use edit_mode=insert to add a new cell at the index specified by cell_number. Use edit_mode=delete to delete the cell at the index specified by cell_number.`;
|
|
273669
273907
|
|
|
273670
273908
|
// src/capabilities/tools/NotebookEditTool/NotebookEditTool.ts
|
|
273671
|
-
import { extname as extname7, isAbsolute as isAbsolute18, resolve as
|
|
273909
|
+
import { extname as extname7, isAbsolute as isAbsolute18, resolve as resolve22 } from "path";
|
|
273672
273910
|
var getToolUseSummary6, renderToolResultMessage9, renderToolUseErrorMessage7, renderToolUseMessage9, renderToolUseRejectedMessage4, inputSchema12, outputSchema11, NotebookEditTool;
|
|
273673
273911
|
var init_NotebookEditTool = __esm(() => {
|
|
273674
273912
|
init_fileHistory();
|
|
@@ -273783,7 +274021,7 @@ var init_NotebookEditTool = __esm(() => {
|
|
|
273783
274021
|
renderToolUseErrorMessage: renderToolUseErrorMessage7,
|
|
273784
274022
|
renderToolResultMessage: renderToolResultMessage9,
|
|
273785
274023
|
async validateInput({ notebook_path, cell_type, cell_id, edit_mode = "replace" }, toolUseContext) {
|
|
273786
|
-
const fullPath = isAbsolute18(notebook_path) ? notebook_path :
|
|
274024
|
+
const fullPath = isAbsolute18(notebook_path) ? notebook_path : resolve22(getCwd3(), notebook_path);
|
|
273787
274025
|
if (fullPath.startsWith("\\\\") || fullPath.startsWith("//")) {
|
|
273788
274026
|
return { result: true };
|
|
273789
274027
|
}
|
|
@@ -273882,7 +274120,7 @@ var init_NotebookEditTool = __esm(() => {
|
|
|
273882
274120
|
cell_type,
|
|
273883
274121
|
edit_mode: originalEditMode
|
|
273884
274122
|
}, { readFileState, updateFileHistoryState }, _, parentMessage) {
|
|
273885
|
-
const fullPath = isAbsolute18(notebook_path) ? notebook_path :
|
|
274123
|
+
const fullPath = isAbsolute18(notebook_path) ? notebook_path : resolve22(getCwd3(), notebook_path);
|
|
273886
274124
|
if (fileHistoryEnabled()) {
|
|
273887
274125
|
await fileHistoryTrackEdit(updateFileHistoryState, fullPath, parentMessage.uuid);
|
|
273888
274126
|
}
|
|
@@ -274213,7 +274451,7 @@ var init_gitOperationTracking = __esm(() => {
|
|
|
274213
274451
|
});
|
|
274214
274452
|
|
|
274215
274453
|
// src/session/fullscreen.ts
|
|
274216
|
-
import { spawnSync as
|
|
274454
|
+
import { spawnSync as spawnSync3 } from "child_process";
|
|
274217
274455
|
function isTmuxControlModeEnvHeuristic() {
|
|
274218
274456
|
if (!process.env.TMUX)
|
|
274219
274457
|
return false;
|
|
@@ -274232,7 +274470,7 @@ function probeTmuxControlModeSync() {
|
|
|
274232
274470
|
return;
|
|
274233
274471
|
let result;
|
|
274234
274472
|
try {
|
|
274235
|
-
result =
|
|
274473
|
+
result = spawnSync3("tmux", ["display-message", "-p", "#{client_control_mode}"], { encoding: "utf8", timeout: 2000 });
|
|
274236
274474
|
} catch {
|
|
274237
274475
|
return;
|
|
274238
274476
|
}
|
|
@@ -275189,8 +275427,8 @@ function registerAgentForeground({
|
|
|
275189
275427
|
diskLoaded: false
|
|
275190
275428
|
};
|
|
275191
275429
|
let resolveBackgroundSignal;
|
|
275192
|
-
const backgroundSignal = new Promise((
|
|
275193
|
-
resolveBackgroundSignal =
|
|
275430
|
+
const backgroundSignal = new Promise((resolve23) => {
|
|
275431
|
+
resolveBackgroundSignal = resolve23;
|
|
275194
275432
|
});
|
|
275195
275433
|
backgroundSignalResolvers.set(agentId, resolveBackgroundSignal);
|
|
275196
275434
|
registerTask(taskState, setAppState);
|
|
@@ -276846,8 +277084,8 @@ async function* runShellCommand({
|
|
|
276846
277084
|
let assistantAutoBackgrounded = false;
|
|
276847
277085
|
let resolveProgress = null;
|
|
276848
277086
|
function createProgressSignal() {
|
|
276849
|
-
return new Promise((
|
|
276850
|
-
resolveProgress = () =>
|
|
277087
|
+
return new Promise((resolve23) => {
|
|
277088
|
+
resolveProgress = () => resolve23(null);
|
|
276851
277089
|
});
|
|
276852
277090
|
}
|
|
276853
277091
|
const shouldAutoBackground = !isBackgroundTasksDisabled2 && isAutobackgroundingAllowed(command);
|
|
@@ -276858,10 +277096,10 @@ async function* runShellCommand({
|
|
|
276858
277096
|
fullOutput = allLines;
|
|
276859
277097
|
lastTotalLines = totalLines;
|
|
276860
277098
|
lastTotalBytes = isIncomplete ? totalBytes : 0;
|
|
276861
|
-
const
|
|
276862
|
-
if (
|
|
277099
|
+
const resolve23 = resolveProgress;
|
|
277100
|
+
if (resolve23) {
|
|
276863
277101
|
resolveProgress = null;
|
|
276864
|
-
|
|
277102
|
+
resolve23();
|
|
276865
277103
|
}
|
|
276866
277104
|
},
|
|
276867
277105
|
preventCwdChanges,
|
|
@@ -276899,10 +277137,10 @@ async function* runShellCommand({
|
|
|
276899
277137
|
}
|
|
276900
277138
|
spawnBackgroundTask().then((shellId) => {
|
|
276901
277139
|
backgroundShellId = shellId;
|
|
276902
|
-
const
|
|
276903
|
-
if (
|
|
277140
|
+
const resolve23 = resolveProgress;
|
|
277141
|
+
if (resolve23) {
|
|
276904
277142
|
resolveProgress = null;
|
|
276905
|
-
|
|
277143
|
+
resolve23();
|
|
276906
277144
|
}
|
|
276907
277145
|
logEvent(eventName, {
|
|
276908
277146
|
command_type: getCommandTypeForLogging(command)
|
|
@@ -276934,8 +277172,8 @@ async function* runShellCommand({
|
|
|
276934
277172
|
const startTime = Date.now();
|
|
276935
277173
|
let foregroundTaskId = undefined;
|
|
276936
277174
|
{
|
|
276937
|
-
const initialResult = await Promise.race([resultPromise, new Promise((
|
|
276938
|
-
const t = setTimeout((r) => r(null), PROGRESS_THRESHOLD_MS2,
|
|
277175
|
+
const initialResult = await Promise.race([resultPromise, new Promise((resolve23) => {
|
|
277176
|
+
const t = setTimeout((r) => r(null), PROGRESS_THRESHOLD_MS2, resolve23);
|
|
276939
277177
|
t.unref();
|
|
276940
277178
|
})]);
|
|
276941
277179
|
if (initialResult !== null) {
|
|
@@ -278458,7 +278696,7 @@ var init_parser5 = __esm(() => {
|
|
|
278458
278696
|
});
|
|
278459
278697
|
|
|
278460
278698
|
// src/capabilities/tools/PowerShellTool/gitSafety.ts
|
|
278461
|
-
import { basename as basename15, posix as posix5, resolve as
|
|
278699
|
+
import { basename as basename15, posix as posix5, resolve as resolve23, sep as sep15 } from "path";
|
|
278462
278700
|
function resolveCwdReentry(normalized) {
|
|
278463
278701
|
if (!normalized.startsWith("../../../tools"))
|
|
278464
278702
|
return normalized;
|
|
@@ -278506,7 +278744,7 @@ function normalizeGitPathArg(arg) {
|
|
|
278506
278744
|
}
|
|
278507
278745
|
function resolveEscapingPathToCwdRelative(n2) {
|
|
278508
278746
|
const cwd = getCwd3();
|
|
278509
|
-
const abs =
|
|
278747
|
+
const abs = resolve23(cwd, n2);
|
|
278510
278748
|
const cwdWithSep = cwd.endsWith(sep15) ? cwd : cwd + sep15;
|
|
278511
278749
|
const absLower = abs.toLowerCase();
|
|
278512
278750
|
const cwdLower = cwd.toLowerCase();
|
|
@@ -279779,7 +280017,7 @@ var init_modeValidation2 = __esm(() => {
|
|
|
279779
280017
|
|
|
279780
280018
|
// src/capabilities/tools/PowerShellTool/pathValidation.ts
|
|
279781
280019
|
import { homedir as homedir20 } from "os";
|
|
279782
|
-
import { isAbsolute as isAbsolute19, resolve as
|
|
280020
|
+
import { isAbsolute as isAbsolute19, resolve as resolve24 } from "path";
|
|
279783
280021
|
function matchesParam(paramLower, paramList) {
|
|
279784
280022
|
for (const p of paramList) {
|
|
279785
280023
|
if (p === paramLower || paramLower.length > 1 && p.startsWith(paramLower)) {
|
|
@@ -279887,7 +280125,7 @@ function checkDenyRuleForGuessedPath(strippedPath, cwd, toolPermissionContext, o
|
|
|
279887
280125
|
if (!strippedPath || strippedPath.includes("\x00"))
|
|
279888
280126
|
return null;
|
|
279889
280127
|
const tildeExpanded = expandTilde2(strippedPath);
|
|
279890
|
-
const abs = isAbsolute19(tildeExpanded) ? tildeExpanded :
|
|
280128
|
+
const abs = isAbsolute19(tildeExpanded) ? tildeExpanded : resolve24(cwd, tildeExpanded);
|
|
279891
280129
|
const { resolvedPath } = safeResolvePath(getFsImplementation(), abs);
|
|
279892
280130
|
const permissionType = operationType === "read" ? "read" : "edit";
|
|
279893
280131
|
const denyRule = matchingRuleForInput(resolvedPath, toolPermissionContext, permissionType, "deny");
|
|
@@ -279977,7 +280215,7 @@ function validatePath2(filePath, cwd, toolPermissionContext, operationType) {
|
|
|
279977
280215
|
};
|
|
279978
280216
|
}
|
|
279979
280217
|
if (containsPathTraversal(normalizedPath)) {
|
|
279980
|
-
const absolutePath2 = isAbsolute19(normalizedPath) ? normalizedPath :
|
|
280218
|
+
const absolutePath2 = isAbsolute19(normalizedPath) ? normalizedPath : resolve24(cwd, normalizedPath);
|
|
279981
280219
|
const { resolvedPath: resolvedPath3, isCanonical: isCanonical2 } = safeResolvePath(getFsImplementation(), absolutePath2);
|
|
279982
280220
|
const result2 = isPathAllowed2(resolvedPath3, toolPermissionContext, operationType, isCanonical2 ? [resolvedPath3] : undefined);
|
|
279983
280221
|
return {
|
|
@@ -279987,7 +280225,7 @@ function validatePath2(filePath, cwd, toolPermissionContext, operationType) {
|
|
|
279987
280225
|
};
|
|
279988
280226
|
}
|
|
279989
280227
|
const basePath = getGlobBaseDirectory2(normalizedPath);
|
|
279990
|
-
const absoluteBasePath = isAbsolute19(basePath) ? basePath :
|
|
280228
|
+
const absoluteBasePath = isAbsolute19(basePath) ? basePath : resolve24(cwd, basePath);
|
|
279991
280229
|
const { resolvedPath: resolvedPath2 } = safeResolvePath(getFsImplementation(), absoluteBasePath);
|
|
279992
280230
|
const permissionType = operationType === "read" ? "read" : "edit";
|
|
279993
280231
|
const denyRule = matchingRuleForInput(resolvedPath2, toolPermissionContext, permissionType, "deny");
|
|
@@ -280007,7 +280245,7 @@ function validatePath2(filePath, cwd, toolPermissionContext, operationType) {
|
|
|
280007
280245
|
}
|
|
280008
280246
|
};
|
|
280009
280247
|
}
|
|
280010
|
-
const absolutePath = isAbsolute19(normalizedPath) ? normalizedPath :
|
|
280248
|
+
const absolutePath = isAbsolute19(normalizedPath) ? normalizedPath : resolve24(cwd, normalizedPath);
|
|
280011
280249
|
const { resolvedPath, isCanonical } = safeResolvePath(getFsImplementation(), absolutePath);
|
|
280012
280250
|
const result = isPathAllowed2(resolvedPath, toolPermissionContext, operationType, isCanonical ? [resolvedPath] : undefined);
|
|
280013
280251
|
return {
|
|
@@ -281937,7 +282175,7 @@ var init_powershellSecurity = __esm(() => {
|
|
|
281937
282175
|
var POWERSHELL_TOOL_NAME3 = "PowerShell";
|
|
281938
282176
|
|
|
281939
282177
|
// src/capabilities/tools/PowerShellTool/powershellPermissions.ts
|
|
281940
|
-
import { resolve as
|
|
282178
|
+
import { resolve as resolve25 } from "path";
|
|
281941
282179
|
async function extractCommandName(command) {
|
|
281942
282180
|
const trimmed = command.trim();
|
|
281943
282181
|
if (!trimmed) {
|
|
@@ -282550,7 +282788,7 @@ async function powershellToolHasPermission(input, context4) {
|
|
|
282550
282788
|
const canonical = resolveToCanonical(element.name);
|
|
282551
282789
|
if (canonical === "set-location" && element.args.length > 0) {
|
|
282552
282790
|
const target = element.args.find((a2) => a2.length === 0 || !PS_TOKENIZER_DASH_CHARS.has(a2[0]));
|
|
282553
|
-
if (target &&
|
|
282791
|
+
if (target && resolve25(getCwd3(), target) === getCwd3()) {
|
|
282554
282792
|
return false;
|
|
282555
282793
|
}
|
|
282556
282794
|
}
|
|
@@ -282946,8 +283184,8 @@ async function* runPowerShellCommand({
|
|
|
282946
283184
|
let assistantAutoBackgrounded = false;
|
|
282947
283185
|
let resolveProgress = null;
|
|
282948
283186
|
function createProgressSignal() {
|
|
282949
|
-
return new Promise((
|
|
282950
|
-
resolveProgress = () =>
|
|
283187
|
+
return new Promise((resolve26) => {
|
|
283188
|
+
resolveProgress = () => resolve26(null);
|
|
282951
283189
|
});
|
|
282952
283190
|
}
|
|
282953
283191
|
const shouldAutoBackground = !isBackgroundTasksDisabled3 && isAutobackgroundingAllowed2(command);
|
|
@@ -283017,10 +283255,10 @@ async function* runPowerShellCommand({
|
|
|
283017
283255
|
}
|
|
283018
283256
|
spawnBackgroundTask().then((shellId) => {
|
|
283019
283257
|
backgroundShellId = shellId;
|
|
283020
|
-
const
|
|
283021
|
-
if (
|
|
283258
|
+
const resolve26 = resolveProgress;
|
|
283259
|
+
if (resolve26) {
|
|
283022
283260
|
resolveProgress = null;
|
|
283023
|
-
|
|
283261
|
+
resolve26();
|
|
283024
283262
|
}
|
|
283025
283263
|
logEvent(eventName, {
|
|
283026
283264
|
command_type: getCommandTypeForLogging2(command)
|
|
@@ -283058,7 +283296,7 @@ async function* runPowerShellCommand({
|
|
|
283058
283296
|
const now = Date.now();
|
|
283059
283297
|
const timeUntilNextProgress = Math.max(0, nextProgressTime - now);
|
|
283060
283298
|
const progressSignal = createProgressSignal();
|
|
283061
|
-
const result = await Promise.race([resultPromise, new Promise((
|
|
283299
|
+
const result = await Promise.race([resultPromise, new Promise((resolve26) => setTimeout((r) => r(null), timeUntilNextProgress, resolve26).unref()), progressSignal]);
|
|
283062
283300
|
if (result !== null) {
|
|
283063
283301
|
if (result.backgroundTaskId !== undefined) {
|
|
283064
283302
|
markTaskNotified2(result.backgroundTaskId, setAppState);
|
|
@@ -285027,10 +285265,10 @@ var init_marketplaceHelpers = __esm(() => {
|
|
|
285027
285265
|
});
|
|
285028
285266
|
|
|
285029
285267
|
// src/capabilities/plugins/officialMarketplaceGcs.ts
|
|
285030
|
-
import { dirname as dirname31, join as join65, resolve as
|
|
285268
|
+
import { dirname as dirname31, join as join65, resolve as resolve26, sep as sep16 } from "path";
|
|
285031
285269
|
async function fetchOfficialMarketplaceFromGcs(installLocation, marketplacesCacheDir) {
|
|
285032
|
-
const cacheDir =
|
|
285033
|
-
const resolvedLoc =
|
|
285270
|
+
const cacheDir = resolve26(marketplacesCacheDir);
|
|
285271
|
+
const resolvedLoc = resolve26(installLocation);
|
|
285034
285272
|
if (resolvedLoc !== cacheDir && !resolvedLoc.startsWith(cacheDir + sep16)) {
|
|
285035
285273
|
logForDebugging2(`fetchOfficialMarketplaceFromGcs: refusing path outside cache dir: ${installLocation}`, { level: "error" });
|
|
285036
285274
|
return null;
|
|
@@ -285147,7 +285385,7 @@ var init_officialMarketplaceGcs = __esm(() => {
|
|
|
285147
285385
|
});
|
|
285148
285386
|
|
|
285149
285387
|
// src/capabilities/plugins/marketplaceManager.ts
|
|
285150
|
-
import { basename as basename19, dirname as dirname32, isAbsolute as isAbsolute20, join as join66, resolve as
|
|
285388
|
+
import { basename as basename19, dirname as dirname32, isAbsolute as isAbsolute20, join as join66, resolve as resolve27, sep as sep17 } from "path";
|
|
285151
285389
|
function getKnownMarketplacesFile() {
|
|
285152
285390
|
return join66(getPluginsDirectory(), "known_marketplaces.json");
|
|
285153
285391
|
}
|
|
@@ -285825,14 +286063,14 @@ async function loadAndCacheMarketplace(source, onProgress) {
|
|
|
285825
286063
|
throw new Error("NPM marketplace sources not yet implemented");
|
|
285826
286064
|
}
|
|
285827
286065
|
case "file": {
|
|
285828
|
-
const absPath =
|
|
286066
|
+
const absPath = resolve27(source.path);
|
|
285829
286067
|
marketplacePath = absPath;
|
|
285830
286068
|
temporaryCachePath = dirname32(dirname32(absPath));
|
|
285831
286069
|
cleanupNeeded = false;
|
|
285832
286070
|
break;
|
|
285833
286071
|
}
|
|
285834
286072
|
case "directory": {
|
|
285835
|
-
const absPath =
|
|
286073
|
+
const absPath = resolve27(source.path);
|
|
285836
286074
|
marketplacePath = join66(absPath, ".claude-plugin", "marketplace.json");
|
|
285837
286075
|
temporaryCachePath = absPath;
|
|
285838
286076
|
cleanupNeeded = false;
|
|
@@ -285864,8 +286102,8 @@ async function loadAndCacheMarketplace(source, onProgress) {
|
|
|
285864
286102
|
throw new Error(`Failed to parse marketplace file at ${marketplacePath}: ${errorMessage(e)}`);
|
|
285865
286103
|
}
|
|
285866
286104
|
const finalCachePath = join66(cacheDir, marketplace.name);
|
|
285867
|
-
const resolvedFinal =
|
|
285868
|
-
const resolvedCacheDir =
|
|
286105
|
+
const resolvedFinal = resolve27(finalCachePath);
|
|
286106
|
+
const resolvedCacheDir = resolve27(cacheDir);
|
|
285869
286107
|
if (!resolvedFinal.startsWith(resolvedCacheDir + sep17)) {
|
|
285870
286108
|
throw new Error(`Marketplace name '${marketplace.name}' resolves to a path outside the cache directory`);
|
|
285871
286109
|
}
|
|
@@ -285902,7 +286140,7 @@ Technical details: ${errorMsg}`);
|
|
|
285902
286140
|
async function addMarketplaceSource(source, onProgress) {
|
|
285903
286141
|
let resolvedSource = source;
|
|
285904
286142
|
if (isLocalMarketplaceSource(source) && !isAbsolute20(source.path)) {
|
|
285905
|
-
resolvedSource = { ...source, path:
|
|
286143
|
+
resolvedSource = { ...source, path: resolve27(source.path) };
|
|
285906
286144
|
}
|
|
285907
286145
|
if (!isSourceAllowedByPolicy(resolvedSource)) {
|
|
285908
286146
|
if (isSourceInBlocklist(resolvedSource)) {
|
|
@@ -285950,9 +286188,9 @@ Tip: The shorthand "${resolvedSource.repo}" assumes github.com. ` + `For interna
|
|
|
285950
286188
|
}
|
|
285951
286189
|
logForDebugging2(`Marketplace '${marketplace.name}' exists with different source — overwriting`);
|
|
285952
286190
|
if (!isLocalMarketplaceSource(oldEntry.source)) {
|
|
285953
|
-
const cacheDir =
|
|
285954
|
-
const resolvedOld =
|
|
285955
|
-
const resolvedNew =
|
|
286191
|
+
const cacheDir = resolve27(getMarketplacesCacheDir());
|
|
286192
|
+
const resolvedOld = resolve27(oldEntry.installLocation);
|
|
286193
|
+
const resolvedNew = resolve27(cachePath);
|
|
285956
286194
|
if (resolvedOld === resolvedNew) {} else if (resolvedOld === cacheDir || resolvedOld.startsWith(cacheDir + sep17)) {
|
|
285957
286195
|
const fs2 = getFsImplementation();
|
|
285958
286196
|
await fs2.rm(oldEntry.installLocation, { recursive: true, force: true });
|
|
@@ -286179,8 +286417,8 @@ async function refreshMarketplace(name, onProgress, options2) {
|
|
|
286179
286417
|
throw new Error(`Marketplace '${name}' is seed-managed (${seedDir}) and its content is ` + `controlled by the seed image. To update: ask your admin to update the seed.`);
|
|
286180
286418
|
}
|
|
286181
286419
|
if (!isLocalMarketplaceSource(source)) {
|
|
286182
|
-
const cacheDir =
|
|
286183
|
-
const resolvedLoc =
|
|
286420
|
+
const cacheDir = resolve27(getMarketplacesCacheDir());
|
|
286421
|
+
const resolvedLoc = resolve27(installLocation);
|
|
286184
286422
|
if (resolvedLoc !== cacheDir && !resolvedLoc.startsWith(cacheDir + sep17)) {
|
|
286185
286423
|
throw new Error(`Marketplace '${name}' has a corrupted installLocation ` + `(${installLocation}) — expected a path inside ${cacheDir}. ` + `This can happen after cross-platform path writes or manual edits ` + `to known_marketplaces.json. ` + `Run: claude plugin marketplace remove "${name}" and re-add it.`);
|
|
286186
286424
|
}
|
|
@@ -286998,14 +287236,14 @@ var init_pluginVersioning = __esm(() => {
|
|
|
286998
287236
|
|
|
286999
287237
|
// src/capabilities/plugins/pluginInstallationHelpers.ts
|
|
287000
287238
|
import { randomBytes as randomBytes7 } from "crypto";
|
|
287001
|
-
import { dirname as dirname34, join as join68, resolve as
|
|
287239
|
+
import { dirname as dirname34, join as join68, resolve as resolve28, sep as sep19 } from "path";
|
|
287002
287240
|
function getCurrentTimestamp() {
|
|
287003
287241
|
return new Date().toISOString();
|
|
287004
287242
|
}
|
|
287005
287243
|
function validatePathWithinBase(basePath, relativePath) {
|
|
287006
|
-
const resolvedPath =
|
|
287007
|
-
const normalizedBase =
|
|
287008
|
-
if (!resolvedPath.startsWith(normalizedBase) && resolvedPath !==
|
|
287244
|
+
const resolvedPath = resolve28(basePath, relativePath);
|
|
287245
|
+
const normalizedBase = resolve28(basePath) + sep19;
|
|
287246
|
+
if (!resolvedPath.startsWith(normalizedBase) && resolvedPath !== resolve28(basePath)) {
|
|
287009
287247
|
throw new Error(`Path traversal detected: "${relativePath}" would escape the base directory`);
|
|
287010
287248
|
}
|
|
287011
287249
|
return resolvedPath;
|
|
@@ -287245,7 +287483,7 @@ var init_pluginInstallationHelpers = __esm(() => {
|
|
|
287245
287483
|
});
|
|
287246
287484
|
|
|
287247
287485
|
// src/capabilities/plugins/pluginLoader.ts
|
|
287248
|
-
import { basename as basename20, dirname as dirname35, join as join69, relative as relative11, resolve as
|
|
287486
|
+
import { basename as basename20, dirname as dirname35, join as join69, relative as relative11, resolve as resolve29, sep as sep20 } from "path";
|
|
287249
287487
|
function getPluginCachePath() {
|
|
287250
287488
|
return join69(getPluginsDirectory(), "cache");
|
|
287251
287489
|
}
|
|
@@ -288599,7 +288837,7 @@ async function loadSessionOnlyPlugins(sessionPluginPaths) {
|
|
|
288599
288837
|
const errors4 = [];
|
|
288600
288838
|
for (const [index, pluginPath] of sessionPluginPaths.entries()) {
|
|
288601
288839
|
try {
|
|
288602
|
-
const resolvedPath =
|
|
288840
|
+
const resolvedPath = resolve29(pluginPath);
|
|
288603
288841
|
if (!await pathExists(resolvedPath)) {
|
|
288604
288842
|
logForDebugging2(`Plugin path does not exist: ${resolvedPath}, skipping`, { level: "warn" });
|
|
288605
288843
|
errors4.push({
|
|
@@ -290457,14 +290695,14 @@ function waitForCallback(port, expectedState, abortSignal, onListening) {
|
|
|
290457
290695
|
abortHandler = null;
|
|
290458
290696
|
}
|
|
290459
290697
|
};
|
|
290460
|
-
return new Promise((
|
|
290698
|
+
return new Promise((resolve30, reject2) => {
|
|
290461
290699
|
let resolved = false;
|
|
290462
290700
|
const resolveOnce = (v) => {
|
|
290463
290701
|
if (resolved)
|
|
290464
290702
|
return;
|
|
290465
290703
|
resolved = true;
|
|
290466
290704
|
cleanup();
|
|
290467
|
-
|
|
290705
|
+
resolve30(v);
|
|
290468
290706
|
};
|
|
290469
290707
|
const rejectOnce = (e) => {
|
|
290470
290708
|
if (resolved)
|
|
@@ -291070,13 +291308,13 @@ async function performMCPOAuthFlow(serverName, serverConfig, onAuthorizationUrl,
|
|
|
291070
291308
|
}
|
|
291071
291309
|
logMCPDebug(serverName, `MCP OAuth server cleaned up`);
|
|
291072
291310
|
};
|
|
291073
|
-
const authorizationCode = await new Promise((
|
|
291311
|
+
const authorizationCode = await new Promise((resolve30, reject2) => {
|
|
291074
291312
|
let resolved = false;
|
|
291075
291313
|
const resolveOnce = (code) => {
|
|
291076
291314
|
if (resolved)
|
|
291077
291315
|
return;
|
|
291078
291316
|
resolved = true;
|
|
291079
|
-
|
|
291317
|
+
resolve30(code);
|
|
291080
291318
|
};
|
|
291081
291319
|
const rejectOnce = (error41) => {
|
|
291082
291320
|
if (resolved)
|
|
@@ -291891,7 +292129,7 @@ async function readClientSecret() {
|
|
|
291891
292129
|
if (!process.stdin.isTTY) {
|
|
291892
292130
|
throw new Error("No TTY available to prompt for client secret. Set MCP_CLIENT_SECRET env var instead.");
|
|
291893
292131
|
}
|
|
291894
|
-
return new Promise((
|
|
292132
|
+
return new Promise((resolve30, reject2) => {
|
|
291895
292133
|
process.stderr.write("Enter OAuth client secret: ");
|
|
291896
292134
|
process.stdin.setRawMode?.(true);
|
|
291897
292135
|
let secret = "";
|
|
@@ -291903,7 +292141,7 @@ async function readClientSecret() {
|
|
|
291903
292141
|
process.stdin.removeListener("data", onData);
|
|
291904
292142
|
process.stderr.write(`
|
|
291905
292143
|
`);
|
|
291906
|
-
|
|
292144
|
+
resolve30(secret);
|
|
291907
292145
|
} else if (c6 === "\x03") {
|
|
291908
292146
|
process.stdin.setRawMode?.(false);
|
|
291909
292147
|
process.stdin.removeListener("data", onData);
|
|
@@ -292054,8 +292292,8 @@ function createMcpAuthTool(serverName, config2) {
|
|
|
292054
292292
|
}
|
|
292055
292293
|
const sseOrHttpConfig = config2;
|
|
292056
292294
|
let resolveAuthUrl;
|
|
292057
|
-
const authUrlPromise = new Promise((
|
|
292058
|
-
resolveAuthUrl =
|
|
292295
|
+
const authUrlPromise = new Promise((resolve30) => {
|
|
292296
|
+
resolveAuthUrl = resolve30;
|
|
292059
292297
|
});
|
|
292060
292298
|
const controller = new AbortController;
|
|
292061
292299
|
const { setAppState } = context4;
|
|
@@ -292537,15 +292775,15 @@ class WebSocketTransport {
|
|
|
292537
292775
|
isBun = typeof Bun !== "undefined";
|
|
292538
292776
|
constructor(ws) {
|
|
292539
292777
|
this.ws = ws;
|
|
292540
|
-
this.opened = new Promise((
|
|
292778
|
+
this.opened = new Promise((resolve30, reject2) => {
|
|
292541
292779
|
if (this.ws.readyState === WS_OPEN) {
|
|
292542
|
-
|
|
292780
|
+
resolve30();
|
|
292543
292781
|
} else if (this.isBun) {
|
|
292544
292782
|
const nws = this.ws;
|
|
292545
292783
|
const onOpen = () => {
|
|
292546
292784
|
nws.removeEventListener("open", onOpen);
|
|
292547
292785
|
nws.removeEventListener("error", onError);
|
|
292548
|
-
|
|
292786
|
+
resolve30();
|
|
292549
292787
|
};
|
|
292550
292788
|
const onError = (event) => {
|
|
292551
292789
|
nws.removeEventListener("open", onOpen);
|
|
@@ -292558,7 +292796,7 @@ class WebSocketTransport {
|
|
|
292558
292796
|
} else {
|
|
292559
292797
|
const nws = this.ws;
|
|
292560
292798
|
nws.on("open", () => {
|
|
292561
|
-
|
|
292799
|
+
resolve30();
|
|
292562
292800
|
});
|
|
292563
292801
|
nws.on("error", (error41) => {
|
|
292564
292802
|
logForDiagnosticsNoPII("error", "mcp_websocket_connect_fail");
|
|
@@ -292657,12 +292895,12 @@ class WebSocketTransport {
|
|
|
292657
292895
|
if (this.isBun) {
|
|
292658
292896
|
this.ws.send(json2);
|
|
292659
292897
|
} else {
|
|
292660
|
-
await new Promise((
|
|
292898
|
+
await new Promise((resolve30, reject2) => {
|
|
292661
292899
|
this.ws.send(json2, (error41) => {
|
|
292662
292900
|
if (error41) {
|
|
292663
292901
|
reject2(error41);
|
|
292664
292902
|
} else {
|
|
292665
|
-
|
|
292903
|
+
resolve30();
|
|
292666
292904
|
}
|
|
292667
292905
|
});
|
|
292668
292906
|
});
|
|
@@ -292924,9 +293162,9 @@ function registerElicitationHandler(client, serverName, setAppState) {
|
|
|
292924
293162
|
return hookResponse;
|
|
292925
293163
|
}
|
|
292926
293164
|
const elicitationId = mode === "url" && "elicitationId" in request.params ? request.params.elicitationId : undefined;
|
|
292927
|
-
const response = new Promise((
|
|
293165
|
+
const response = new Promise((resolve30) => {
|
|
292928
293166
|
const onAbort = () => {
|
|
292929
|
-
|
|
293167
|
+
resolve30({ action: "cancel" });
|
|
292930
293168
|
};
|
|
292931
293169
|
if (extra.signal.aborted) {
|
|
292932
293170
|
onAbort();
|
|
@@ -292950,7 +293188,7 @@ function registerElicitationHandler(client, serverName, setAppState) {
|
|
|
292950
293188
|
mode,
|
|
292951
293189
|
action: result2.action
|
|
292952
293190
|
});
|
|
292953
|
-
|
|
293191
|
+
resolve30(result2);
|
|
292954
293192
|
}
|
|
292955
293193
|
}
|
|
292956
293194
|
]
|
|
@@ -296636,8 +296874,8 @@ function getMcpAuthCache() {
|
|
|
296636
296874
|
return authCachePromise;
|
|
296637
296875
|
}
|
|
296638
296876
|
async function isMcpAuthCached(serverId) {
|
|
296639
|
-
const
|
|
296640
|
-
const entry =
|
|
296877
|
+
const cache3 = await getMcpAuthCache();
|
|
296878
|
+
const entry = cache3[serverId];
|
|
296641
296879
|
if (!entry) {
|
|
296642
296880
|
return false;
|
|
296643
296881
|
}
|
|
@@ -296645,11 +296883,11 @@ async function isMcpAuthCached(serverId) {
|
|
|
296645
296883
|
}
|
|
296646
296884
|
function setMcpAuthCacheEntry(serverId) {
|
|
296647
296885
|
writeChain = writeChain.then(async () => {
|
|
296648
|
-
const
|
|
296649
|
-
|
|
296886
|
+
const cache3 = await getMcpAuthCache();
|
|
296887
|
+
cache3[serverId] = { timestamp: Date.now() };
|
|
296650
296888
|
const cachePath = getMcpAuthCachePath();
|
|
296651
296889
|
await getFsImplementation().mkdir(dirname37(cachePath), { recursive: true });
|
|
296652
|
-
await getFsImplementation().writeFile(cachePath, jsonStringify(
|
|
296890
|
+
await getFsImplementation().writeFile(cachePath, jsonStringify(cache3));
|
|
296653
296891
|
authCachePromise = null;
|
|
296654
296892
|
}).catch(() => {});
|
|
296655
296893
|
}
|
|
@@ -296969,12 +297207,12 @@ async function getMcpToolsCommandsAndResources(onConnectionAttempt, mcpConfigs)
|
|
|
296969
297207
|
]);
|
|
296970
297208
|
}
|
|
296971
297209
|
function prefetchAllMcpResources(mcpConfigs) {
|
|
296972
|
-
return new Promise((
|
|
297210
|
+
return new Promise((resolve30) => {
|
|
296973
297211
|
let pendingCount = 0;
|
|
296974
297212
|
let completedCount = 0;
|
|
296975
297213
|
pendingCount = Object.keys(mcpConfigs).length;
|
|
296976
297214
|
if (pendingCount === 0) {
|
|
296977
|
-
|
|
297215
|
+
resolve30({
|
|
296978
297216
|
clients: [],
|
|
296979
297217
|
tools: [],
|
|
296980
297218
|
commands: []
|
|
@@ -296999,7 +297237,7 @@ function prefetchAllMcpResources(mcpConfigs) {
|
|
|
296999
297237
|
commands_count: commands.length,
|
|
297000
297238
|
commands_metadata_length: commandsMetadataLength
|
|
297001
297239
|
});
|
|
297002
|
-
|
|
297240
|
+
resolve30({
|
|
297003
297241
|
clients,
|
|
297004
297242
|
tools,
|
|
297005
297243
|
commands
|
|
@@ -297007,7 +297245,7 @@ function prefetchAllMcpResources(mcpConfigs) {
|
|
|
297007
297245
|
}
|
|
297008
297246
|
}, mcpConfigs).catch((error41) => {
|
|
297009
297247
|
logMCPError("prefetchAllMcpResources", `Failed to get MCP resources: ${errorMessage(error41)}`);
|
|
297010
|
-
|
|
297248
|
+
resolve30({
|
|
297011
297249
|
clients: [],
|
|
297012
297250
|
tools: [],
|
|
297013
297251
|
commands: []
|
|
@@ -297187,9 +297425,9 @@ async function callMCPToolWithUrlElicitationRetry({
|
|
|
297187
297425
|
actionLabel: "Retry now",
|
|
297188
297426
|
showCancel: true
|
|
297189
297427
|
};
|
|
297190
|
-
userResult = await new Promise((
|
|
297428
|
+
userResult = await new Promise((resolve30) => {
|
|
297191
297429
|
const onAbort = () => {
|
|
297192
|
-
|
|
297430
|
+
resolve30({ action: "cancel" });
|
|
297193
297431
|
};
|
|
297194
297432
|
if (signal.aborted) {
|
|
297195
297433
|
onAbort();
|
|
@@ -297212,14 +297450,14 @@ async function callMCPToolWithUrlElicitationRetry({
|
|
|
297212
297450
|
return;
|
|
297213
297451
|
}
|
|
297214
297452
|
signal.removeEventListener("abort", onAbort);
|
|
297215
|
-
|
|
297453
|
+
resolve30(result);
|
|
297216
297454
|
},
|
|
297217
297455
|
onWaitingDismiss: (action) => {
|
|
297218
297456
|
signal.removeEventListener("abort", onAbort);
|
|
297219
297457
|
if (action === "retry") {
|
|
297220
|
-
|
|
297458
|
+
resolve30({ action: "accept" });
|
|
297221
297459
|
} else {
|
|
297222
|
-
|
|
297460
|
+
resolve30({ action: "cancel" });
|
|
297223
297461
|
}
|
|
297224
297462
|
}
|
|
297225
297463
|
}
|
|
@@ -297973,7 +298211,7 @@ var init_client5 = __esm(() => {
|
|
|
297973
298211
|
logMCPDebug(name, `Error sending SIGINT: ${error41}`);
|
|
297974
298212
|
return;
|
|
297975
298213
|
}
|
|
297976
|
-
await new Promise(async (
|
|
298214
|
+
await new Promise(async (resolve30) => {
|
|
297977
298215
|
let resolved = false;
|
|
297978
298216
|
const checkInterval = setInterval(() => {
|
|
297979
298217
|
try {
|
|
@@ -297984,7 +298222,7 @@ var init_client5 = __esm(() => {
|
|
|
297984
298222
|
clearInterval(checkInterval);
|
|
297985
298223
|
clearTimeout(failsafeTimeout);
|
|
297986
298224
|
logMCPDebug(name, "MCP server process exited cleanly");
|
|
297987
|
-
|
|
298225
|
+
resolve30();
|
|
297988
298226
|
}
|
|
297989
298227
|
}
|
|
297990
298228
|
}, 50);
|
|
@@ -297993,7 +298231,7 @@ var init_client5 = __esm(() => {
|
|
|
297993
298231
|
resolved = true;
|
|
297994
298232
|
clearInterval(checkInterval);
|
|
297995
298233
|
logMCPDebug(name, "Cleanup timeout reached, stopping process monitoring");
|
|
297996
|
-
|
|
298234
|
+
resolve30();
|
|
297997
298235
|
}
|
|
297998
298236
|
}, 600);
|
|
297999
298237
|
try {
|
|
@@ -298009,14 +298247,14 @@ var init_client5 = __esm(() => {
|
|
|
298009
298247
|
resolved = true;
|
|
298010
298248
|
clearInterval(checkInterval);
|
|
298011
298249
|
clearTimeout(failsafeTimeout);
|
|
298012
|
-
|
|
298250
|
+
resolve30();
|
|
298013
298251
|
return;
|
|
298014
298252
|
}
|
|
298015
298253
|
} catch {
|
|
298016
298254
|
resolved = true;
|
|
298017
298255
|
clearInterval(checkInterval);
|
|
298018
298256
|
clearTimeout(failsafeTimeout);
|
|
298019
|
-
|
|
298257
|
+
resolve30();
|
|
298020
298258
|
return;
|
|
298021
298259
|
}
|
|
298022
298260
|
await sleep2(400);
|
|
@@ -298033,7 +298271,7 @@ var init_client5 = __esm(() => {
|
|
|
298033
298271
|
resolved = true;
|
|
298034
298272
|
clearInterval(checkInterval);
|
|
298035
298273
|
clearTimeout(failsafeTimeout);
|
|
298036
|
-
|
|
298274
|
+
resolve30();
|
|
298037
298275
|
}
|
|
298038
298276
|
}
|
|
298039
298277
|
}
|
|
@@ -298041,14 +298279,14 @@ var init_client5 = __esm(() => {
|
|
|
298041
298279
|
resolved = true;
|
|
298042
298280
|
clearInterval(checkInterval);
|
|
298043
298281
|
clearTimeout(failsafeTimeout);
|
|
298044
|
-
|
|
298282
|
+
resolve30();
|
|
298045
298283
|
}
|
|
298046
298284
|
} catch {
|
|
298047
298285
|
if (!resolved) {
|
|
298048
298286
|
resolved = true;
|
|
298049
298287
|
clearInterval(checkInterval);
|
|
298050
298288
|
clearTimeout(failsafeTimeout);
|
|
298051
|
-
|
|
298289
|
+
resolve30();
|
|
298052
298290
|
}
|
|
298053
298291
|
}
|
|
298054
298292
|
});
|
|
@@ -298551,7 +298789,7 @@ var init_idePathConversion = () => {};
|
|
|
298551
298789
|
// src/capabilities/ide.ts
|
|
298552
298790
|
import { createConnection } from "net";
|
|
298553
298791
|
import * as os4 from "os";
|
|
298554
|
-
import { basename as basename21, join as join76, sep as pathSeparator, resolve as
|
|
298792
|
+
import { basename as basename21, join as join76, sep as pathSeparator, resolve as resolve30 } from "path";
|
|
298555
298793
|
function isProcessRunning2(pid) {
|
|
298556
298794
|
try {
|
|
298557
298795
|
process.kill(pid, 0);
|
|
@@ -298662,7 +298900,7 @@ async function readIdeLockfile(path13) {
|
|
|
298662
298900
|
}
|
|
298663
298901
|
async function checkIdeConnection(host, port, timeout = 500) {
|
|
298664
298902
|
try {
|
|
298665
|
-
return new Promise((
|
|
298903
|
+
return new Promise((resolve31) => {
|
|
298666
298904
|
const socket = createConnection({
|
|
298667
298905
|
host,
|
|
298668
298906
|
port,
|
|
@@ -298670,14 +298908,14 @@ async function checkIdeConnection(host, port, timeout = 500) {
|
|
|
298670
298908
|
});
|
|
298671
298909
|
socket.on("connect", () => {
|
|
298672
298910
|
socket.destroy();
|
|
298673
|
-
|
|
298911
|
+
resolve31(true);
|
|
298674
298912
|
});
|
|
298675
298913
|
socket.on("error", () => {
|
|
298676
|
-
|
|
298914
|
+
resolve31(false);
|
|
298677
298915
|
});
|
|
298678
298916
|
socket.on("timeout", () => {
|
|
298679
298917
|
socket.destroy();
|
|
298680
|
-
|
|
298918
|
+
resolve31(false);
|
|
298681
298919
|
});
|
|
298682
298920
|
});
|
|
298683
298921
|
} catch (_) {
|
|
@@ -298695,7 +298933,7 @@ async function getIdeLockfilesPaths() {
|
|
|
298695
298933
|
if (windowsHome) {
|
|
298696
298934
|
const converter = new WindowsToWSLConverter(process.env.WSL_DISTRO_NAME);
|
|
298697
298935
|
const wslPath = converter.toLocalPath(windowsHome);
|
|
298698
|
-
paths2.push(
|
|
298936
|
+
paths2.push(resolve30(wslPath, BUILT_IN_BINDINGS.claude.configDir, PATH_SEGMENTS.runtime.ideDir));
|
|
298699
298937
|
}
|
|
298700
298938
|
try {
|
|
298701
298939
|
const usersDir = "/mnt/c/Users";
|
|
@@ -298839,14 +299077,14 @@ async function detectIDEs(includeInvalid) {
|
|
|
298839
299077
|
if (!checkWSLDistroMatch(idePath, process.env.WSL_DISTRO_NAME)) {
|
|
298840
299078
|
return false;
|
|
298841
299079
|
}
|
|
298842
|
-
const resolvedOriginal =
|
|
299080
|
+
const resolvedOriginal = resolve30(localPath).normalize("NFC");
|
|
298843
299081
|
if (cwd === resolvedOriginal || cwd.startsWith(resolvedOriginal + pathSeparator)) {
|
|
298844
299082
|
return true;
|
|
298845
299083
|
}
|
|
298846
299084
|
const converter = new WindowsToWSLConverter(process.env.WSL_DISTRO_NAME);
|
|
298847
299085
|
localPath = converter.toLocalPath(idePath);
|
|
298848
299086
|
}
|
|
298849
|
-
const resolvedPath =
|
|
299087
|
+
const resolvedPath = resolve30(localPath).normalize("NFC");
|
|
298850
299088
|
if (getPlatform() === "windows") {
|
|
298851
299089
|
const normalizedCwd = cwd.replace(/^[a-zA-Z]:/, (match) => match.toUpperCase());
|
|
298852
299090
|
const normalizedResolvedPath = resolvedPath.replace(/^[a-zA-Z]:/, (match) => match.toUpperCase());
|
|
@@ -299239,9 +299477,9 @@ async function installFromArtifactory(command) {
|
|
|
299239
299477
|
responseType: "stream"
|
|
299240
299478
|
});
|
|
299241
299479
|
const writeStream = getFsImplementation().createWriteStream(tempVsixPath);
|
|
299242
|
-
await new Promise((
|
|
299480
|
+
await new Promise((resolve31, reject2) => {
|
|
299243
299481
|
vsixResponse.data.pipe(writeStream);
|
|
299244
|
-
writeStream.on("finish",
|
|
299482
|
+
writeStream.on("finish", resolve31);
|
|
299245
299483
|
writeStream.on("error", reject2);
|
|
299246
299484
|
});
|
|
299247
299485
|
await sleep2(500);
|
|
@@ -299957,7 +300195,7 @@ var init_findRelevantMemories = __esm(() => {
|
|
|
299957
300195
|
});
|
|
299958
300196
|
|
|
299959
300197
|
// src/session/attachments.ts
|
|
299960
|
-
import { dirname as dirname38, parse as parse12, relative as relative12, resolve as
|
|
300198
|
+
import { dirname as dirname38, parse as parse12, relative as relative12, resolve as resolve31 } from "path";
|
|
299961
300199
|
import { randomUUID as randomUUID16 } from "crypto";
|
|
299962
300200
|
async function getAttachments(input, toolUseContext, ideSelection, queuedCommands, messages, querySource, options2) {
|
|
299963
300201
|
if (isEnvTruthy(resolveEnvVar("DISABLE_ATTACHMENTS")) || isEnvTruthy(resolveEnvVar("SIMPLE"))) {
|
|
@@ -300335,7 +300573,7 @@ async function getSelectedLinesFromIDE(ideSelection, toolUseContext) {
|
|
|
300335
300573
|
];
|
|
300336
300574
|
}
|
|
300337
300575
|
function getDirectoriesToProcess(targetPath, originalCwd) {
|
|
300338
|
-
const targetDir = dirname38(
|
|
300576
|
+
const targetDir = dirname38(resolve31(targetPath));
|
|
300339
300577
|
const nestedDirs = [];
|
|
300340
300578
|
let currentDir = targetDir;
|
|
300341
300579
|
while (currentDir !== originalCwd && currentDir !== parse12(currentDir).root) {
|
|
@@ -300791,7 +301029,7 @@ async function getDynamicSkillAttachments(toolUseContext) {
|
|
|
300791
301029
|
const candidates = entries.filter((e) => e.isDirectory() || e.isSymbolicLink()).map((e) => e.name);
|
|
300792
301030
|
const checked = await Promise.all(candidates.map(async (name) => {
|
|
300793
301031
|
try {
|
|
300794
|
-
await getFsImplementation().stat(
|
|
301032
|
+
await getFsImplementation().stat(resolve31(skillDir, name, "SKILL.md"));
|
|
300795
301033
|
return name;
|
|
300796
301034
|
} catch {
|
|
300797
301035
|
return null;
|
|
@@ -303130,10 +303368,10 @@ function DANGEROUS_uncachedSystemPromptSection(name, compute, _reason) {
|
|
|
303130
303368
|
return { name, compute, cacheBreak: true };
|
|
303131
303369
|
}
|
|
303132
303370
|
async function resolveSystemPromptSections(sections) {
|
|
303133
|
-
const
|
|
303371
|
+
const cache3 = getSystemPromptSectionCache();
|
|
303134
303372
|
return Promise.all(sections.map(async (s) => {
|
|
303135
|
-
if (!s.cacheBreak &&
|
|
303136
|
-
return
|
|
303373
|
+
if (!s.cacheBreak && cache3.has(s.name)) {
|
|
303374
|
+
return cache3.get(s.name) ?? null;
|
|
303137
303375
|
}
|
|
303138
303376
|
const value = await s.compute();
|
|
303139
303377
|
setSystemPromptSectionCacheEntry(s.name, value);
|
|
@@ -304620,21 +304858,6 @@ var init_analyzeContext = __esm(() => {
|
|
|
304620
304858
|
init_state2();
|
|
304621
304859
|
});
|
|
304622
304860
|
|
|
304623
|
-
// src/lib/zodToJsonSchema.ts
|
|
304624
|
-
function zodToJsonSchema3(schema) {
|
|
304625
|
-
const hit = cache2.get(schema);
|
|
304626
|
-
if (hit)
|
|
304627
|
-
return hit;
|
|
304628
|
-
const result = toJSONSchema(schema);
|
|
304629
|
-
cache2.set(schema, result);
|
|
304630
|
-
return result;
|
|
304631
|
-
}
|
|
304632
|
-
var cache2;
|
|
304633
|
-
var init_zodToJsonSchema2 = __esm(() => {
|
|
304634
|
-
init_v4();
|
|
304635
|
-
cache2 = new WeakMap;
|
|
304636
|
-
});
|
|
304637
|
-
|
|
304638
304861
|
// src/controller/toolSearch.ts
|
|
304639
304862
|
var exports_toolSearch = {};
|
|
304640
304863
|
__export(exports_toolSearch, {
|
|
@@ -304764,7 +304987,8 @@ async function calculateDeferredToolDescriptionChars(tools, getToolPermissionCon
|
|
|
304764
304987
|
tools,
|
|
304765
304988
|
agents
|
|
304766
304989
|
});
|
|
304767
|
-
const
|
|
304990
|
+
const inputJSONSchema = tool.inputJSONSchema;
|
|
304991
|
+
const inputSchema17 = inputJSONSchema ? jsonStringify(inputJSONSchema) : tool.inputSchema ? jsonStringify(zodToJsonSchema3(tool.inputSchema)) : "";
|
|
304768
304992
|
return tool.name.length + description.length + inputSchema17.length;
|
|
304769
304993
|
}));
|
|
304770
304994
|
return sizes.reduce((total, size) => total + size, 0);
|
|
@@ -306463,12 +306687,13 @@ function filterSwarmFieldsFromSchema(toolName, schema) {
|
|
|
306463
306687
|
return filtered;
|
|
306464
306688
|
}
|
|
306465
306689
|
async function toolToAPISchema(tool, options2) {
|
|
306466
|
-
const
|
|
306690
|
+
const inputJSONSchema = tool.inputJSONSchema;
|
|
306691
|
+
const cacheKey = inputJSONSchema ? `${tool.name}:${jsonStringify(inputJSONSchema)}` : tool.name;
|
|
306467
306692
|
const cache3 = getToolSchemaCache();
|
|
306468
306693
|
let base2 = cache3.get(cacheKey);
|
|
306469
306694
|
if (!base2) {
|
|
306470
306695
|
const strictToolsEnabled = checkStatsigFeatureGate_CACHED_MAY_BE_STALE("tengu_tool_pear");
|
|
306471
|
-
let input_schema =
|
|
306696
|
+
let input_schema = inputJSONSchema ?? zodToJsonSchema3(tool.inputSchema);
|
|
306472
306697
|
if (!isAgentSwarmsEnabled()) {
|
|
306473
306698
|
input_schema = filterSwarmFieldsFromSchema(tool.name, input_schema);
|
|
306474
306699
|
}
|
|
@@ -306711,11 +306936,13 @@ async function logContextMetrics(mcpConfigs, toolPermissionContext) {
|
|
|
306711
306936
|
}
|
|
306712
306937
|
mcpServersCount = serverNames.size;
|
|
306713
306938
|
for (const tool of mcpTools) {
|
|
306714
|
-
const
|
|
306939
|
+
const inputJSONSchema = tool.inputJSONSchema;
|
|
306940
|
+
const schema = inputJSONSchema ?? zodToJsonSchema3(tool.inputSchema);
|
|
306715
306941
|
mcpToolsTokens += roughTokenCountEstimation(jsonStringify(schema));
|
|
306716
306942
|
}
|
|
306717
306943
|
for (const tool of nonMcpTools) {
|
|
306718
|
-
const
|
|
306944
|
+
const inputJSONSchema = tool.inputJSONSchema;
|
|
306945
|
+
const schema = inputJSONSchema ?? zodToJsonSchema3(tool.inputSchema);
|
|
306719
306946
|
nonMcpToolsTokens += roughTokenCountEstimation(jsonStringify(schema));
|
|
306720
306947
|
}
|
|
306721
306948
|
logEvent("tengu_context_size", {
|
|
@@ -309669,14 +309896,14 @@ var init_permissions2 = __esm(() => {
|
|
|
309669
309896
|
});
|
|
309670
309897
|
|
|
309671
309898
|
// src/lib/addDirValidation.ts
|
|
309672
|
-
import { dirname as dirname40, resolve as
|
|
309899
|
+
import { dirname as dirname40, resolve as resolve32 } from "path";
|
|
309673
309900
|
async function validateDirectoryForWorkspace(directoryPath, permissionContext) {
|
|
309674
309901
|
if (!directoryPath) {
|
|
309675
309902
|
return {
|
|
309676
309903
|
resultType: "emptyPath"
|
|
309677
309904
|
};
|
|
309678
309905
|
}
|
|
309679
|
-
const absolutePath =
|
|
309906
|
+
const absolutePath = resolve32(expandPath(directoryPath));
|
|
309680
309907
|
try {
|
|
309681
309908
|
const stats = await getFsImplementation().stat(absolutePath);
|
|
309682
309909
|
if (!stats.isDirectory()) {
|
|
@@ -309738,7 +309965,7 @@ var init_addDirValidation = __esm(() => {
|
|
|
309738
309965
|
|
|
309739
309966
|
// src/permissions/permissionSetup.ts
|
|
309740
309967
|
import { relative as relative14 } from "path";
|
|
309741
|
-
import { resolve as
|
|
309968
|
+
import { resolve as resolve33 } from "path";
|
|
309742
309969
|
function isDangerousBashPermission(toolName, ruleContent) {
|
|
309743
309970
|
if (toolName !== BASH_TOOL_NAME) {
|
|
309744
309971
|
return false;
|
|
@@ -310053,7 +310280,7 @@ function isSymlinkTo({
|
|
|
310053
310280
|
originalCwd
|
|
310054
310281
|
}) {
|
|
310055
310282
|
const { resolvedPath: resolvedProcessPwd, isSymlink: isProcessPwdSymlink } = safeResolvePath(getFsImplementation(), processPwd);
|
|
310056
|
-
return isProcessPwdSymlink ? resolvedProcessPwd ===
|
|
310283
|
+
return isProcessPwdSymlink ? resolvedProcessPwd === resolve33(originalCwd) : false;
|
|
310057
310284
|
}
|
|
310058
310285
|
function initialPermissionModeFromCLI({
|
|
310059
310286
|
permissionModeCli,
|
|
@@ -310359,7 +310586,7 @@ var init_permissionSetup = __esm(() => {
|
|
|
310359
310586
|
|
|
310360
310587
|
// src/capabilities/markdownConfigLoader.ts
|
|
310361
310588
|
import { homedir as homedir23 } from "os";
|
|
310362
|
-
import { dirname as dirname41, join as join79, resolve as
|
|
310589
|
+
import { dirname as dirname41, join as join79, resolve as resolve34, sep as sep21 } from "path";
|
|
310363
310590
|
function extractDescriptionFromMarkdown(content, defaultDescription = "Custom item") {
|
|
310364
310591
|
const lines = content.split(`
|
|
310365
310592
|
`);
|
|
@@ -310441,9 +310668,9 @@ function resolveStopBoundary(cwd) {
|
|
|
310441
310668
|
return cwdGitRoot;
|
|
310442
310669
|
}
|
|
310443
310670
|
function getProjectDirsUpToHome(subdir, cwd) {
|
|
310444
|
-
const home =
|
|
310671
|
+
const home = resolve34(homedir23()).normalize("NFC");
|
|
310445
310672
|
const gitRoot = resolveStopBoundary(cwd);
|
|
310446
|
-
let current =
|
|
310673
|
+
let current = resolve34(cwd);
|
|
310447
310674
|
const dirs = [];
|
|
310448
310675
|
while (true) {
|
|
310449
310676
|
if (normalizePathForComparison(current) === normalizePathForComparison(home)) {
|
|
@@ -314724,8 +314951,8 @@ class Project {
|
|
|
314724
314951
|
decrementPendingWrites() {
|
|
314725
314952
|
this.pendingWriteCount--;
|
|
314726
314953
|
if (this.pendingWriteCount === 0) {
|
|
314727
|
-
for (const
|
|
314728
|
-
|
|
314954
|
+
for (const resolve35 of this.flushResolvers) {
|
|
314955
|
+
resolve35();
|
|
314729
314956
|
}
|
|
314730
314957
|
this.flushResolvers = [];
|
|
314731
314958
|
}
|
|
@@ -314739,13 +314966,13 @@ class Project {
|
|
|
314739
314966
|
}
|
|
314740
314967
|
}
|
|
314741
314968
|
enqueueWrite(filePath, entry) {
|
|
314742
|
-
return new Promise((
|
|
314969
|
+
return new Promise((resolve35) => {
|
|
314743
314970
|
let queue3 = this.writeQueues.get(filePath);
|
|
314744
314971
|
if (!queue3) {
|
|
314745
314972
|
queue3 = [];
|
|
314746
314973
|
this.writeQueues.set(filePath, queue3);
|
|
314747
314974
|
}
|
|
314748
|
-
queue3.push({ entry, resolve:
|
|
314975
|
+
queue3.push({ entry, resolve: resolve35 });
|
|
314749
314976
|
this.scheduleDrain();
|
|
314750
314977
|
});
|
|
314751
314978
|
}
|
|
@@ -314779,7 +315006,7 @@ class Project {
|
|
|
314779
315006
|
const batch = queue3.splice(0);
|
|
314780
315007
|
let content = "";
|
|
314781
315008
|
const resolvers = [];
|
|
314782
|
-
for (const { entry, resolve:
|
|
315009
|
+
for (const { entry, resolve: resolve35 } of batch) {
|
|
314783
315010
|
const line = jsonStringify(entry) + `
|
|
314784
315011
|
`;
|
|
314785
315012
|
if (content.length + line.length >= this.MAX_CHUNK_BYTES) {
|
|
@@ -314791,7 +315018,7 @@ class Project {
|
|
|
314791
315018
|
content = "";
|
|
314792
315019
|
}
|
|
314793
315020
|
content += line;
|
|
314794
|
-
resolvers.push(
|
|
315021
|
+
resolvers.push(resolve35);
|
|
314795
315022
|
}
|
|
314796
315023
|
if (content.length > 0) {
|
|
314797
315024
|
await this.appendToFile(filePath, content);
|
|
@@ -314914,8 +315141,8 @@ class Project {
|
|
|
314914
315141
|
if (this.pendingWriteCount === 0) {
|
|
314915
315142
|
return;
|
|
314916
315143
|
}
|
|
314917
|
-
return new Promise((
|
|
314918
|
-
this.flushResolvers.push(
|
|
315144
|
+
return new Promise((resolve35) => {
|
|
315145
|
+
this.flushResolvers.push(resolve35);
|
|
314919
315146
|
});
|
|
314920
315147
|
}
|
|
314921
315148
|
async removeMessageByUuid(targetUuid) {
|
|
@@ -315767,7 +315994,7 @@ function applySnipRemovals(messages) {
|
|
|
315767
315994
|
messages.delete(uuid3);
|
|
315768
315995
|
removedCount++;
|
|
315769
315996
|
}
|
|
315770
|
-
const
|
|
315997
|
+
const resolve35 = (start) => {
|
|
315771
315998
|
const path13 = [];
|
|
315772
315999
|
let cur = start;
|
|
315773
316000
|
while (cur && toDelete.has(cur)) {
|
|
@@ -315786,7 +316013,7 @@ function applySnipRemovals(messages) {
|
|
|
315786
316013
|
for (const [uuid3, msg] of messages) {
|
|
315787
316014
|
if (!msg.parentUuid || !toDelete.has(msg.parentUuid))
|
|
315788
316015
|
continue;
|
|
315789
|
-
messages.set(uuid3, { ...msg, parentUuid:
|
|
316016
|
+
messages.set(uuid3, { ...msg, parentUuid: resolve35(msg.parentUuid) });
|
|
315790
316017
|
relinkedCount++;
|
|
315791
316018
|
}
|
|
315792
316019
|
logEvent("tengu_snip_resume_filtered", {
|
|
@@ -318787,8 +319014,8 @@ class DiskTaskOutput {
|
|
|
318787
319014
|
this.#queue.push(content);
|
|
318788
319015
|
}
|
|
318789
319016
|
if (!this.#flushPromise) {
|
|
318790
|
-
this.#flushPromise = new Promise((
|
|
318791
|
-
this.#flushResolve =
|
|
319017
|
+
this.#flushPromise = new Promise((resolve35) => {
|
|
319018
|
+
this.#flushResolve = resolve35;
|
|
318792
319019
|
});
|
|
318793
319020
|
track(this.#drain());
|
|
318794
319021
|
}
|
|
@@ -318854,10 +319081,10 @@ class DiskTaskOutput {
|
|
|
318854
319081
|
}
|
|
318855
319082
|
}
|
|
318856
319083
|
} finally {
|
|
318857
|
-
const
|
|
319084
|
+
const resolve35 = this.#flushResolve;
|
|
318858
319085
|
this.#flushPromise = null;
|
|
318859
319086
|
this.#flushResolve = null;
|
|
318860
|
-
|
|
319087
|
+
resolve35();
|
|
318861
319088
|
}
|
|
318862
319089
|
}
|
|
318863
319090
|
}
|
|
@@ -319143,17 +319370,17 @@ class ShellCommandImpl {
|
|
|
319143
319370
|
});
|
|
319144
319371
|
this.#childProcess.once("exit", this.#exitHandler.bind(this));
|
|
319145
319372
|
this.#childProcess.once("error", this.#errorHandler.bind(this));
|
|
319146
|
-
this.#stdioClosedPromise = new Promise((
|
|
319373
|
+
this.#stdioClosedPromise = new Promise((resolve35) => {
|
|
319147
319374
|
this.#childProcess.once("close", () => {
|
|
319148
|
-
|
|
319375
|
+
resolve35();
|
|
319149
319376
|
});
|
|
319150
319377
|
});
|
|
319151
319378
|
this.#timeoutId = setTimeout(ShellCommandImpl.#handleTimeout, this.#timeout, this);
|
|
319152
|
-
const exitPromise = new Promise((
|
|
319153
|
-
this.#exitCodeResolver =
|
|
319379
|
+
const exitPromise = new Promise((resolve35) => {
|
|
319380
|
+
this.#exitCodeResolver = resolve35;
|
|
319154
319381
|
});
|
|
319155
|
-
return new Promise((
|
|
319156
|
-
this.#resultResolver =
|
|
319382
|
+
return new Promise((resolve35) => {
|
|
319383
|
+
this.#resultResolver = resolve35;
|
|
319157
319384
|
exitPromise.then(this.#handleExit.bind(this));
|
|
319158
319385
|
});
|
|
319159
319386
|
}
|
|
@@ -319201,8 +319428,8 @@ class ShellCommandImpl {
|
|
|
319201
319428
|
const graceMs = code === 0 ? OUTPUT_CLOSE_GRACE_MS : ERROR_OUTPUT_CLOSE_GRACE_MS;
|
|
319202
319429
|
await Promise.race([
|
|
319203
319430
|
stdioClosedPromise,
|
|
319204
|
-
new Promise((
|
|
319205
|
-
const timeout = setTimeout(
|
|
319431
|
+
new Promise((resolve35) => {
|
|
319432
|
+
const timeout = setTimeout(resolve35, graceMs);
|
|
319206
319433
|
timeout.unref();
|
|
319207
319434
|
})
|
|
319208
319435
|
]);
|
|
@@ -320325,7 +320552,7 @@ function executeInBackground({
|
|
|
320325
320552
|
}) {
|
|
320326
320553
|
if (asyncRewake) {
|
|
320327
320554
|
shellCommand.result.then(async (result) => {
|
|
320328
|
-
await new Promise((
|
|
320555
|
+
await new Promise((resolve35) => setImmediate(resolve35));
|
|
320329
320556
|
const stdout = await shellCommand.taskOutput.getStdout();
|
|
320330
320557
|
const stderr = shellCommand.taskOutput.getStderr();
|
|
320331
320558
|
shellCommand.cleanup();
|
|
@@ -320768,8 +320995,8 @@ async function execCommandHook(hook, hookEvent, hookName, jsonInput, signal, hoo
|
|
|
320768
320995
|
child.stderr.setEncoding("utf8");
|
|
320769
320996
|
let initialResponseChecked = false;
|
|
320770
320997
|
let asyncResolve = null;
|
|
320771
|
-
const childIsAsyncPromise = new Promise((
|
|
320772
|
-
asyncResolve =
|
|
320998
|
+
const childIsAsyncPromise = new Promise((resolve35) => {
|
|
320999
|
+
asyncResolve = resolve35;
|
|
320773
321000
|
});
|
|
320774
321001
|
const processedPromptLines = new Set;
|
|
320775
321002
|
let promptChain = Promise.resolve();
|
|
@@ -320860,13 +321087,13 @@ async function execCommandHook(hook, hookEvent, hookName, jsonInput, signal, hoo
|
|
|
320860
321087
|
hookEvent,
|
|
320861
321088
|
getOutput: async () => ({ stdout, stderr, output })
|
|
320862
321089
|
});
|
|
320863
|
-
const stdoutEndPromise = new Promise((
|
|
320864
|
-
child.stdout.on("end", () =>
|
|
321090
|
+
const stdoutEndPromise = new Promise((resolve35) => {
|
|
321091
|
+
child.stdout.on("end", () => resolve35());
|
|
320865
321092
|
});
|
|
320866
|
-
const stderrEndPromise = new Promise((
|
|
320867
|
-
child.stderr.on("end", () =>
|
|
321093
|
+
const stderrEndPromise = new Promise((resolve35) => {
|
|
321094
|
+
child.stderr.on("end", () => resolve35());
|
|
320868
321095
|
});
|
|
320869
|
-
const stdinWritePromise = stdinWritten ? Promise.resolve() : new Promise((
|
|
321096
|
+
const stdinWritePromise = stdinWritten ? Promise.resolve() : new Promise((resolve35, reject2) => {
|
|
320870
321097
|
child.stdin.on("error", (err2) => {
|
|
320871
321098
|
if (!requestPrompt) {
|
|
320872
321099
|
reject2(err2);
|
|
@@ -320879,12 +321106,12 @@ async function execCommandHook(hook, hookEvent, hookName, jsonInput, signal, hoo
|
|
|
320879
321106
|
if (!requestPrompt) {
|
|
320880
321107
|
child.stdin.end();
|
|
320881
321108
|
}
|
|
320882
|
-
|
|
321109
|
+
resolve35();
|
|
320883
321110
|
});
|
|
320884
321111
|
const childErrorPromise = new Promise((_, reject2) => {
|
|
320885
321112
|
child.on("error", reject2);
|
|
320886
321113
|
});
|
|
320887
|
-
const childClosePromise = new Promise((
|
|
321114
|
+
const childClosePromise = new Promise((resolve35) => {
|
|
320888
321115
|
let exitCode = null;
|
|
320889
321116
|
child.on("close", (code) => {
|
|
320890
321117
|
exitCode = code ?? 1;
|
|
@@ -320892,7 +321119,7 @@ async function execCommandHook(hook, hookEvent, hookName, jsonInput, signal, hoo
|
|
|
320892
321119
|
const finalStdout = processedPromptLines.size === 0 ? stdout : stdout.split(`
|
|
320893
321120
|
`).filter((line) => !processedPromptLines.has(line.trim())).join(`
|
|
320894
321121
|
`);
|
|
320895
|
-
|
|
321122
|
+
resolve35({
|
|
320896
321123
|
stdout: finalStdout,
|
|
320897
321124
|
stderr,
|
|
320898
321125
|
output,
|
|
@@ -322947,12 +323174,12 @@ async function executeFunctionHook({
|
|
|
322947
323174
|
hook
|
|
322948
323175
|
};
|
|
322949
323176
|
}
|
|
322950
|
-
const passed = await new Promise((
|
|
323177
|
+
const passed = await new Promise((resolve35, reject2) => {
|
|
322951
323178
|
const onAbort = () => reject2(new Error("Function hook cancelled"));
|
|
322952
323179
|
abortSignal.addEventListener("abort", onAbort);
|
|
322953
323180
|
Promise.resolve(hook.callback(messages, abortSignal)).then((result) => {
|
|
322954
323181
|
abortSignal.removeEventListener("abort", onAbort);
|
|
322955
|
-
|
|
323182
|
+
resolve35(result);
|
|
322956
323183
|
}).catch((error41) => {
|
|
322957
323184
|
abortSignal.removeEventListener("abort", onAbort);
|
|
322958
323185
|
reject2(error41);
|
|
@@ -323164,6 +323391,7 @@ __export(exports_worktree, {
|
|
|
323164
323391
|
killTmuxSession: () => killTmuxSession,
|
|
323165
323392
|
keepWorktree: () => keepWorktree,
|
|
323166
323393
|
isTmuxAvailable: () => isTmuxAvailable2,
|
|
323394
|
+
isAgentWorktreeIsolationAvailable: () => isAgentWorktreeIsolationAvailable,
|
|
323167
323395
|
hasWorktreeChanges: () => hasWorktreeChanges,
|
|
323168
323396
|
getTmuxInstallInstructions: () => getTmuxInstallInstructions2,
|
|
323169
323397
|
getCurrentWorktreeSession: () => getCurrentWorktreeSession,
|
|
@@ -323176,7 +323404,7 @@ __export(exports_worktree, {
|
|
|
323176
323404
|
cleanupWorktree: () => cleanupWorktree,
|
|
323177
323405
|
cleanupStaleAgentWorktrees: () => cleanupStaleAgentWorktrees
|
|
323178
323406
|
});
|
|
323179
|
-
import { spawnSync as
|
|
323407
|
+
import { spawnSync as spawnSync4 } from "child_process";
|
|
323180
323408
|
import { basename as basename26, dirname as dirname43, join as join84 } from "path";
|
|
323181
323409
|
function validateWorktreeSlug(slug) {
|
|
323182
323410
|
if (slug.length > MAX_WORKTREE_SLUG_LENGTH) {
|
|
@@ -323605,10 +323833,11 @@ async function createAgentWorktree(slug) {
|
|
|
323605
323833
|
logForDebugging2(`Created hook-based agent worktree at: ${hookResult.worktreePath}`);
|
|
323606
323834
|
return { worktreePath: hookResult.worktreePath, hookBased: true };
|
|
323607
323835
|
}
|
|
323608
|
-
const
|
|
323609
|
-
if (!
|
|
323610
|
-
throw new
|
|
323836
|
+
const availability = resolveGitWorktreeAvailability(getCwd3(), gitExe());
|
|
323837
|
+
if (!availability.available) {
|
|
323838
|
+
throw new WorktreeUnavailableError(availability.reason);
|
|
323611
323839
|
}
|
|
323840
|
+
const gitRoot = findCanonicalGitRoot(availability.gitRoot) ?? availability.gitRoot;
|
|
323612
323841
|
const { worktreePath, worktreeBranch, headCommit, existed } = await getOrCreateWorktree(gitRoot, slug);
|
|
323613
323842
|
if (!existed) {
|
|
323614
323843
|
logForDebugging2(`Created agent worktree at: ${worktreePath} on branch: ${worktreeBranch}`);
|
|
@@ -323620,6 +323849,16 @@ async function createAgentWorktree(slug) {
|
|
|
323620
323849
|
}
|
|
323621
323850
|
return { worktreePath, worktreeBranch, headCommit, gitRoot };
|
|
323622
323851
|
}
|
|
323852
|
+
function isAgentWorktreeIsolationAvailable(options2 = {}) {
|
|
323853
|
+
try {
|
|
323854
|
+
if (options2.hasCreateHook ?? hasWorktreeCreateHook()) {
|
|
323855
|
+
return true;
|
|
323856
|
+
}
|
|
323857
|
+
return isGitWorktreeIsolationAvailable(options2.cwd ?? getCwd3(), gitExe(), options2.gitAvailabilityCache);
|
|
323858
|
+
} catch {
|
|
323859
|
+
return false;
|
|
323860
|
+
}
|
|
323861
|
+
}
|
|
323623
323862
|
async function removeAgentWorktree(worktreePath, worktreeBranch, gitRoot, hookBased) {
|
|
323624
323863
|
if (hookBased) {
|
|
323625
323864
|
const hookRan = await executeWorktreeRemoveHook(worktreePath);
|
|
@@ -323735,7 +323974,7 @@ async function execIntoTmuxWorktree(args) {
|
|
|
323735
323974
|
error: "Error: --tmux is not supported on Windows"
|
|
323736
323975
|
};
|
|
323737
323976
|
}
|
|
323738
|
-
const tmuxCheck =
|
|
323977
|
+
const tmuxCheck = spawnSync4("tmux", ["-V"], { encoding: "utf-8" });
|
|
323739
323978
|
if (tmuxCheck.status !== 0) {
|
|
323740
323979
|
const installHint = process.platform === "darwin" ? "Install tmux with: brew install tmux" : "Install tmux with: sudo apt install tmux";
|
|
323741
323980
|
return {
|
|
@@ -323840,7 +324079,7 @@ async function execIntoTmuxWorktree(args) {
|
|
|
323840
324079
|
newArgs.push(arg);
|
|
323841
324080
|
}
|
|
323842
324081
|
let tmuxPrefix = "C-b";
|
|
323843
|
-
const prefixResult =
|
|
324082
|
+
const prefixResult = spawnSync4("tmux", ["show-options", "-g", "prefix"], {
|
|
323844
324083
|
encoding: "utf-8"
|
|
323845
324084
|
});
|
|
323846
324085
|
if (prefixResult.status === 0 && prefixResult.stdout) {
|
|
@@ -323867,7 +324106,7 @@ async function execIntoTmuxWorktree(args) {
|
|
|
323867
324106
|
CLAUDE_CODE_TMUX_PREFIX: tmuxPrefix,
|
|
323868
324107
|
CLAUDE_CODE_TMUX_PREFIX_CONFLICTS: prefixConflicts ? "1" : ""
|
|
323869
324108
|
};
|
|
323870
|
-
const hasSessionResult =
|
|
324109
|
+
const hasSessionResult = spawnSync4("tmux", ["has-session", "-t", tmuxSessionName], { encoding: "utf-8" });
|
|
323871
324110
|
const sessionExists = hasSessionResult.status === 0;
|
|
323872
324111
|
const isAlreadyInTmux = Boolean(process.env.TMUX);
|
|
323873
324112
|
const useControlMode = isInITerm2() && !forceClassicTmux && !isAlreadyInTmux;
|
|
@@ -323885,7 +324124,7 @@ ${y2("╭─ iTerm2 Tip ──────────────────
|
|
|
323885
324124
|
const isClaudeCliInternal = repoName === "claude-cli-internal";
|
|
323886
324125
|
const shouldSetupDevPanes = isAnt && isClaudeCliInternal && !sessionExists;
|
|
323887
324126
|
if (shouldSetupDevPanes) {
|
|
323888
|
-
|
|
324127
|
+
spawnSync4("tmux", [
|
|
323889
324128
|
"new-session",
|
|
323890
324129
|
"-d",
|
|
323891
324130
|
"-s",
|
|
@@ -323896,21 +324135,21 @@ ${y2("╭─ iTerm2 Tip ──────────────────
|
|
|
323896
324135
|
process.execPath,
|
|
323897
324136
|
...newArgs
|
|
323898
324137
|
], { cwd: worktreeDir, env: tmuxEnv });
|
|
323899
|
-
|
|
323900
|
-
|
|
323901
|
-
|
|
323902
|
-
|
|
324138
|
+
spawnSync4("tmux", ["split-window", "-h", "-t", tmuxSessionName, "-c", worktreeDir], { cwd: worktreeDir });
|
|
324139
|
+
spawnSync4("tmux", ["send-keys", "-t", tmuxSessionName, "bun run watch", "Enter"], { cwd: worktreeDir });
|
|
324140
|
+
spawnSync4("tmux", ["split-window", "-v", "-t", tmuxSessionName, "-c", worktreeDir], { cwd: worktreeDir });
|
|
324141
|
+
spawnSync4("tmux", ["send-keys", "-t", tmuxSessionName, "bun run start"], {
|
|
323903
324142
|
cwd: worktreeDir
|
|
323904
324143
|
});
|
|
323905
|
-
|
|
324144
|
+
spawnSync4("tmux", ["select-pane", "-t", `${tmuxSessionName}:0.0`], {
|
|
323906
324145
|
cwd: worktreeDir
|
|
323907
324146
|
});
|
|
323908
324147
|
if (isAlreadyInTmux) {
|
|
323909
|
-
|
|
324148
|
+
spawnSync4("tmux", ["switch-client", "-t", tmuxSessionName], {
|
|
323910
324149
|
stdio: "inherit"
|
|
323911
324150
|
});
|
|
323912
324151
|
} else {
|
|
323913
|
-
|
|
324152
|
+
spawnSync4("tmux", [...tmuxGlobalArgs, "attach-session", "-t", tmuxSessionName], {
|
|
323914
324153
|
stdio: "inherit",
|
|
323915
324154
|
cwd: worktreeDir
|
|
323916
324155
|
});
|
|
@@ -323918,11 +324157,11 @@ ${y2("╭─ iTerm2 Tip ──────────────────
|
|
|
323918
324157
|
} else {
|
|
323919
324158
|
if (isAlreadyInTmux) {
|
|
323920
324159
|
if (sessionExists) {
|
|
323921
|
-
|
|
324160
|
+
spawnSync4("tmux", ["switch-client", "-t", tmuxSessionName], {
|
|
323922
324161
|
stdio: "inherit"
|
|
323923
324162
|
});
|
|
323924
324163
|
} else {
|
|
323925
|
-
|
|
324164
|
+
spawnSync4("tmux", [
|
|
323926
324165
|
"new-session",
|
|
323927
324166
|
"-d",
|
|
323928
324167
|
"-s",
|
|
@@ -323933,7 +324172,7 @@ ${y2("╭─ iTerm2 Tip ──────────────────
|
|
|
323933
324172
|
process.execPath,
|
|
323934
324173
|
...newArgs
|
|
323935
324174
|
], { cwd: worktreeDir, env: tmuxEnv });
|
|
323936
|
-
|
|
324175
|
+
spawnSync4("tmux", ["switch-client", "-t", tmuxSessionName], {
|
|
323937
324176
|
stdio: "inherit"
|
|
323938
324177
|
});
|
|
323939
324178
|
}
|
|
@@ -323950,7 +324189,7 @@ ${y2("╭─ iTerm2 Tip ──────────────────
|
|
|
323950
324189
|
process.execPath,
|
|
323951
324190
|
...newArgs
|
|
323952
324191
|
];
|
|
323953
|
-
|
|
324192
|
+
spawnSync4("tmux", tmuxArgs, {
|
|
323954
324193
|
stdio: "inherit",
|
|
323955
324194
|
cwd: worktreeDir,
|
|
323956
324195
|
env: tmuxEnv
|
|
@@ -323977,6 +324216,7 @@ var init_worktree = __esm(() => {
|
|
|
323977
324216
|
init_settings2();
|
|
323978
324217
|
init_detection();
|
|
323979
324218
|
init_fsOperations();
|
|
324219
|
+
init_worktreeAvailability();
|
|
323980
324220
|
import_ignore4 = __toESM(require_ignore(), 1);
|
|
323981
324221
|
VALID_WORKTREE_SLUG_SEGMENT = /^[a-zA-Z0-9._-]+$/;
|
|
323982
324222
|
GIT_NO_PROMPT_ENV2 = {
|
|
@@ -324206,10 +324446,10 @@ function sequential(fn) {
|
|
|
324206
324446
|
return;
|
|
324207
324447
|
processing = true;
|
|
324208
324448
|
while (queue3.length > 0) {
|
|
324209
|
-
const { args, resolve:
|
|
324449
|
+
const { args, resolve: resolve35, reject: reject2, context: context4 } = queue3.shift();
|
|
324210
324450
|
try {
|
|
324211
324451
|
const result = await fn.apply(context4, args);
|
|
324212
|
-
|
|
324452
|
+
resolve35(result);
|
|
324213
324453
|
} catch (error41) {
|
|
324214
324454
|
reject2(error41);
|
|
324215
324455
|
}
|
|
@@ -324220,8 +324460,8 @@ function sequential(fn) {
|
|
|
324220
324460
|
}
|
|
324221
324461
|
}
|
|
324222
324462
|
return function(...args) {
|
|
324223
|
-
return new Promise((
|
|
324224
|
-
queue3.push({ args, resolve:
|
|
324463
|
+
return new Promise((resolve35, reject2) => {
|
|
324464
|
+
queue3.push({ args, resolve: resolve35, reject: reject2, context: this });
|
|
324225
324465
|
processQueue();
|
|
324226
324466
|
});
|
|
324227
324467
|
};
|
|
@@ -326749,14 +326989,14 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
|
|
|
326749
326989
|
prevActScopeDepth !== actScopeDepth - 1 && console.error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. ");
|
|
326750
326990
|
actScopeDepth = prevActScopeDepth;
|
|
326751
326991
|
}
|
|
326752
|
-
function recursivelyFlushAsyncActWork(returnValue2,
|
|
326992
|
+
function recursivelyFlushAsyncActWork(returnValue2, resolve35, reject2) {
|
|
326753
326993
|
var queue3 = ReactSharedInternals.actQueue;
|
|
326754
326994
|
if (queue3 !== null)
|
|
326755
326995
|
if (queue3.length !== 0)
|
|
326756
326996
|
try {
|
|
326757
326997
|
flushActQueue(queue3);
|
|
326758
326998
|
enqueueTask(function() {
|
|
326759
|
-
return recursivelyFlushAsyncActWork(returnValue2,
|
|
326999
|
+
return recursivelyFlushAsyncActWork(returnValue2, resolve35, reject2);
|
|
326760
327000
|
});
|
|
326761
327001
|
return;
|
|
326762
327002
|
} catch (error41) {
|
|
@@ -326764,7 +327004,7 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
|
|
|
326764
327004
|
}
|
|
326765
327005
|
else
|
|
326766
327006
|
ReactSharedInternals.actQueue = null;
|
|
326767
|
-
0 < ReactSharedInternals.thrownErrors.length ? (queue3 = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject2(queue3)) :
|
|
327007
|
+
0 < ReactSharedInternals.thrownErrors.length ? (queue3 = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject2(queue3)) : resolve35(returnValue2);
|
|
326768
327008
|
}
|
|
326769
327009
|
function flushActQueue(queue3) {
|
|
326770
327010
|
if (!isFlushing) {
|
|
@@ -326940,14 +327180,14 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
|
|
|
326940
327180
|
didAwaitActCall || didWarnNoAwaitAct || (didWarnNoAwaitAct = true, console.error("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"));
|
|
326941
327181
|
});
|
|
326942
327182
|
return {
|
|
326943
|
-
then: function(
|
|
327183
|
+
then: function(resolve35, reject2) {
|
|
326944
327184
|
didAwaitActCall = true;
|
|
326945
327185
|
thenable.then(function(returnValue2) {
|
|
326946
327186
|
popActScope(prevActQueue, prevActScopeDepth);
|
|
326947
327187
|
if (prevActScopeDepth === 0) {
|
|
326948
327188
|
try {
|
|
326949
327189
|
flushActQueue(queue3), enqueueTask(function() {
|
|
326950
|
-
return recursivelyFlushAsyncActWork(returnValue2,
|
|
327190
|
+
return recursivelyFlushAsyncActWork(returnValue2, resolve35, reject2);
|
|
326951
327191
|
});
|
|
326952
327192
|
} catch (error$0) {
|
|
326953
327193
|
ReactSharedInternals.thrownErrors.push(error$0);
|
|
@@ -326958,7 +327198,7 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
|
|
|
326958
327198
|
reject2(_thrownError);
|
|
326959
327199
|
}
|
|
326960
327200
|
} else
|
|
326961
|
-
|
|
327201
|
+
resolve35(returnValue2);
|
|
326962
327202
|
}, function(error41) {
|
|
326963
327203
|
popActScope(prevActQueue, prevActScopeDepth);
|
|
326964
327204
|
0 < ReactSharedInternals.thrownErrors.length ? (error41 = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject2(error41)) : reject2(error41);
|
|
@@ -326974,11 +327214,11 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
|
|
|
326974
327214
|
if (0 < ReactSharedInternals.thrownErrors.length)
|
|
326975
327215
|
throw callback = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, callback;
|
|
326976
327216
|
return {
|
|
326977
|
-
then: function(
|
|
327217
|
+
then: function(resolve35, reject2) {
|
|
326978
327218
|
didAwaitActCall = true;
|
|
326979
327219
|
prevActScopeDepth === 0 ? (ReactSharedInternals.actQueue = queue3, enqueueTask(function() {
|
|
326980
|
-
return recursivelyFlushAsyncActWork(returnValue$jscomp$0,
|
|
326981
|
-
})) :
|
|
327220
|
+
return recursivelyFlushAsyncActWork(returnValue$jscomp$0, resolve35, reject2);
|
|
327221
|
+
})) : resolve35(returnValue$jscomp$0);
|
|
326982
327222
|
}
|
|
326983
327223
|
};
|
|
326984
327224
|
};
|
|
@@ -333605,8 +333845,8 @@ It can also happen if the client has a browser extension installed which messes
|
|
|
333605
333845
|
currentEntangledActionThenable = {
|
|
333606
333846
|
status: "pending",
|
|
333607
333847
|
value: undefined,
|
|
333608
|
-
then: function(
|
|
333609
|
-
entangledListeners.push(
|
|
333848
|
+
then: function(resolve35) {
|
|
333849
|
+
entangledListeners.push(resolve35);
|
|
333610
333850
|
}
|
|
333611
333851
|
};
|
|
333612
333852
|
}
|
|
@@ -333630,8 +333870,8 @@ It can also happen if the client has a browser extension installed which messes
|
|
|
333630
333870
|
status: "pending",
|
|
333631
333871
|
value: null,
|
|
333632
333872
|
reason: null,
|
|
333633
|
-
then: function(
|
|
333634
|
-
listeners.push(
|
|
333873
|
+
then: function(resolve35) {
|
|
333874
|
+
listeners.push(resolve35);
|
|
333635
333875
|
}
|
|
333636
333876
|
};
|
|
333637
333877
|
thenable.then(function() {
|
|
@@ -342966,13 +343206,13 @@ function getEventPriority(eventType) {
|
|
|
342966
343206
|
case "focus":
|
|
342967
343207
|
case "blur":
|
|
342968
343208
|
case "paste":
|
|
342969
|
-
return
|
|
343209
|
+
return import_constants53.DiscreteEventPriority;
|
|
342970
343210
|
case "resize":
|
|
342971
343211
|
case "scroll":
|
|
342972
343212
|
case "mousemove":
|
|
342973
|
-
return
|
|
343213
|
+
return import_constants53.ContinuousEventPriority;
|
|
342974
343214
|
default:
|
|
342975
|
-
return
|
|
343215
|
+
return import_constants53.DefaultEventPriority;
|
|
342976
343216
|
}
|
|
342977
343217
|
}
|
|
342978
343218
|
|
|
@@ -342987,7 +343227,7 @@ class Dispatcher {
|
|
|
342987
343227
|
if (this.currentEvent) {
|
|
342988
343228
|
return getEventPriority(this.currentEvent.type);
|
|
342989
343229
|
}
|
|
342990
|
-
return
|
|
343230
|
+
return import_constants53.DefaultEventPriority;
|
|
342991
343231
|
}
|
|
342992
343232
|
dispatch(target, event) {
|
|
342993
343233
|
const previousEvent = this.currentEvent;
|
|
@@ -343012,18 +343252,18 @@ class Dispatcher {
|
|
|
343012
343252
|
dispatchContinuous(target, event) {
|
|
343013
343253
|
const previousPriority = this.currentUpdatePriority;
|
|
343014
343254
|
try {
|
|
343015
|
-
this.currentUpdatePriority =
|
|
343255
|
+
this.currentUpdatePriority = import_constants53.ContinuousEventPriority;
|
|
343016
343256
|
return this.dispatch(target, event);
|
|
343017
343257
|
} finally {
|
|
343018
343258
|
this.currentUpdatePriority = previousPriority;
|
|
343019
343259
|
}
|
|
343020
343260
|
}
|
|
343021
343261
|
}
|
|
343022
|
-
var
|
|
343262
|
+
var import_constants53, NO_EVENT_PRIORITY = 0;
|
|
343023
343263
|
var init_dispatcher = __esm(() => {
|
|
343024
343264
|
init_log2();
|
|
343025
343265
|
init_event_handlers();
|
|
343026
|
-
|
|
343266
|
+
import_constants53 = __toESM(require_constants9(), 1);
|
|
343027
343267
|
});
|
|
343028
343268
|
|
|
343029
343269
|
// src/cli/events/terminal-event.ts
|
|
@@ -345325,8 +345565,8 @@ function setTerminalFocused(v) {
|
|
|
345325
345565
|
cb();
|
|
345326
345566
|
}
|
|
345327
345567
|
if (!v) {
|
|
345328
|
-
for (const
|
|
345329
|
-
|
|
345568
|
+
for (const resolve35 of resolvers) {
|
|
345569
|
+
resolve35();
|
|
345330
345570
|
}
|
|
345331
345571
|
resolvers.clear();
|
|
345332
345572
|
}
|
|
@@ -345364,18 +345604,18 @@ class TerminalQuerier {
|
|
|
345364
345604
|
this.stdout = stdout;
|
|
345365
345605
|
}
|
|
345366
345606
|
send(query2) {
|
|
345367
|
-
return new Promise((
|
|
345607
|
+
return new Promise((resolve35) => {
|
|
345368
345608
|
this.queue.push({
|
|
345369
345609
|
kind: "query",
|
|
345370
345610
|
match: query2.match,
|
|
345371
|
-
resolve: (r) =>
|
|
345611
|
+
resolve: (r) => resolve35(r)
|
|
345372
345612
|
});
|
|
345373
345613
|
this.stdout.write(query2.request);
|
|
345374
345614
|
});
|
|
345375
345615
|
}
|
|
345376
345616
|
flush() {
|
|
345377
|
-
return new Promise((
|
|
345378
|
-
this.queue.push({ kind: "sentinel", resolve:
|
|
345617
|
+
return new Promise((resolve35) => {
|
|
345618
|
+
this.queue.push({ kind: "sentinel", resolve: resolve35 });
|
|
345379
345619
|
this.stdout.write(SENTINEL);
|
|
345380
345620
|
});
|
|
345381
345621
|
}
|
|
@@ -349325,7 +349565,7 @@ function applyPositionedHighlight(screen, stylePool, positions, rowOffset, curre
|
|
|
349325
349565
|
}
|
|
349326
349566
|
return true;
|
|
349327
349567
|
}
|
|
349328
|
-
var
|
|
349568
|
+
var import_constants55, timing;
|
|
349329
349569
|
var init_render_to_screen = __esm(() => {
|
|
349330
349570
|
init_debug();
|
|
349331
349571
|
init_dom();
|
|
@@ -349334,7 +349574,7 @@ var init_render_to_screen = __esm(() => {
|
|
|
349334
349574
|
init_reconciler();
|
|
349335
349575
|
init_render_node_to_output();
|
|
349336
349576
|
init_screen();
|
|
349337
|
-
|
|
349577
|
+
import_constants55 = __toESM(require_constants9(), 1);
|
|
349338
349578
|
timing = { reconcile: 0, yoga: 0, paint: 0, scan: 0, calls: 0 };
|
|
349339
349579
|
});
|
|
349340
349580
|
|
|
@@ -349651,7 +349891,7 @@ class Ink {
|
|
|
349651
349891
|
};
|
|
349652
349892
|
}
|
|
349653
349893
|
};
|
|
349654
|
-
this.container = reconciler_default.createContainer(this.rootNode,
|
|
349894
|
+
this.container = reconciler_default.createContainer(this.rootNode, import_constants56.LegacyRoot, null, false, null, "id", noop_default, (error41) => {
|
|
349655
349895
|
this.reportRenderError("uncaught", error41);
|
|
349656
349896
|
}, (error41) => {
|
|
349657
349897
|
this.reportRenderError("caught", error41);
|
|
@@ -350364,8 +350604,8 @@ class Ink {
|
|
|
350364
350604
|
}
|
|
350365
350605
|
}
|
|
350366
350606
|
async waitUntilExit() {
|
|
350367
|
-
this.exitPromise ||= new Promise((
|
|
350368
|
-
this.resolveExitPromise =
|
|
350607
|
+
this.exitPromise ||= new Promise((resolve35, reject2) => {
|
|
350608
|
+
this.resolveExitPromise = resolve35;
|
|
350369
350609
|
this.rejectExitPromise = reject2;
|
|
350370
350610
|
});
|
|
350371
350611
|
return this.exitPromise;
|
|
@@ -350472,7 +350712,7 @@ function drainStdin(stdin = process.stdin) {
|
|
|
350472
350712
|
}
|
|
350473
350713
|
}
|
|
350474
350714
|
}
|
|
350475
|
-
var
|
|
350715
|
+
var import_constants56, jsx_dev_runtime9, ALT_SCREEN_ANCHOR_CURSOR, CURSOR_HOME_PATCH, ERASE_THEN_HOME_PATCH, CONSOLE_STDOUT_METHODS, CONSOLE_STDERR_METHODS;
|
|
350476
350716
|
var init_ink = __esm(() => {
|
|
350477
350717
|
init_noop();
|
|
350478
350718
|
init_throttle2();
|
|
@@ -350504,7 +350744,7 @@ var init_ink = __esm(() => {
|
|
|
350504
350744
|
init_dec2();
|
|
350505
350745
|
init_osc2();
|
|
350506
350746
|
init_useTerminalNotification();
|
|
350507
|
-
|
|
350747
|
+
import_constants56 = __toESM(require_constants9(), 1);
|
|
350508
350748
|
jsx_dev_runtime9 = __toESM(require_jsx_dev_runtime(), 1);
|
|
350509
350749
|
ALT_SCREEN_ANCHOR_CURSOR = Object.freeze({
|
|
350510
350750
|
x: 0,
|
|
@@ -353938,8 +354178,8 @@ class Mailbox {
|
|
|
353938
354178
|
return Promise.resolve(msg);
|
|
353939
354179
|
}
|
|
353940
354180
|
}
|
|
353941
|
-
return new Promise((
|
|
353942
|
-
this.waiters.push({ fn, resolve:
|
|
354181
|
+
return new Promise((resolve35) => {
|
|
354182
|
+
this.waiters.push({ fn, resolve: resolve35 });
|
|
353943
354183
|
});
|
|
353944
354184
|
}
|
|
353945
354185
|
subscribe = this.changed.subscribe;
|
|
@@ -358577,7 +358817,7 @@ var init_option_map = __esm(() => {
|
|
|
358577
358817
|
});
|
|
358578
358818
|
|
|
358579
358819
|
// src/cli/components/CustomSelect/use-select-navigation.ts
|
|
358580
|
-
import { isDeepStrictEqual } from "util";
|
|
358820
|
+
import { isDeepStrictEqual as isDeepStrictEqual2 } from "util";
|
|
358581
358821
|
function useSelectNavigation({
|
|
358582
358822
|
visibleOptionCount = 5,
|
|
358583
358823
|
options: options2,
|
|
@@ -358593,7 +358833,7 @@ function useSelectNavigation({
|
|
|
358593
358833
|
const onFocusRef = import_react46.useRef(onFocus);
|
|
358594
358834
|
onFocusRef.current = onFocus;
|
|
358595
358835
|
const [lastOptions, setLastOptions] = import_react46.useState(options2);
|
|
358596
|
-
if (options2 !== lastOptions && !
|
|
358836
|
+
if (options2 !== lastOptions && !isDeepStrictEqual2(options2, lastOptions)) {
|
|
358597
358837
|
dispatch({
|
|
358598
358838
|
type: "reset",
|
|
358599
358839
|
state: createDefaultState({
|
|
@@ -358907,7 +359147,7 @@ var init_use_select_navigation = __esm(() => {
|
|
|
358907
359147
|
});
|
|
358908
359148
|
|
|
358909
359149
|
// src/cli/components/CustomSelect/use-multi-select-state.ts
|
|
358910
|
-
import { isDeepStrictEqual as
|
|
359150
|
+
import { isDeepStrictEqual as isDeepStrictEqual3 } from "util";
|
|
358911
359151
|
function useMultiSelectState({
|
|
358912
359152
|
isDisabled = false,
|
|
358913
359153
|
visibleOptionCount = 5,
|
|
@@ -358927,7 +359167,7 @@ function useMultiSelectState({
|
|
|
358927
359167
|
const [selectedValues, setSelectedValues] = import_react47.useState(defaultValue);
|
|
358928
359168
|
const [isSubmitFocused, setIsSubmitFocused] = import_react47.useState(false);
|
|
358929
359169
|
const [lastOptions, setLastOptions] = import_react47.useState(options2);
|
|
358930
|
-
if (options2 !== lastOptions && !
|
|
359170
|
+
if (options2 !== lastOptions && !isDeepStrictEqual3(options2, lastOptions)) {
|
|
358931
359171
|
setSelectedValues(defaultValue);
|
|
358932
359172
|
setLastOptions(options2);
|
|
358933
359173
|
}
|
|
@@ -361112,7 +361352,7 @@ async function checkManagedSettingsSecurity(cachedSettings, newSettings) {
|
|
|
361112
361352
|
return "no_check_needed";
|
|
361113
361353
|
}
|
|
361114
361354
|
logEvent("tengu_managed_settings_security_dialog_shown", {});
|
|
361115
|
-
return new Promise((
|
|
361355
|
+
return new Promise((resolve35) => {
|
|
361116
361356
|
(async () => {
|
|
361117
361357
|
const {
|
|
361118
361358
|
unmount
|
|
@@ -361123,12 +361363,12 @@ async function checkManagedSettingsSecurity(cachedSettings, newSettings) {
|
|
|
361123
361363
|
onAccept: () => {
|
|
361124
361364
|
logEvent("tengu_managed_settings_security_dialog_accepted", {});
|
|
361125
361365
|
unmount();
|
|
361126
|
-
|
|
361366
|
+
resolve35("approved");
|
|
361127
361367
|
},
|
|
361128
361368
|
onReject: () => {
|
|
361129
361369
|
logEvent("tengu_managed_settings_security_dialog_rejected", {});
|
|
361130
361370
|
unmount();
|
|
361131
|
-
|
|
361371
|
+
resolve35("rejected");
|
|
361132
361372
|
}
|
|
361133
361373
|
}, undefined, false, undefined, this)
|
|
361134
361374
|
}, undefined, false, undefined, this)
|
|
@@ -361167,8 +361407,8 @@ function initializeRemoteManagedSettingsLoadingPromise() {
|
|
|
361167
361407
|
return;
|
|
361168
361408
|
}
|
|
361169
361409
|
if (isRemoteManagedSettingsEligible()) {
|
|
361170
|
-
loadingCompletePromise2 = new Promise((
|
|
361171
|
-
loadingCompleteResolve2 =
|
|
361410
|
+
loadingCompletePromise2 = new Promise((resolve35) => {
|
|
361411
|
+
loadingCompleteResolve2 = resolve35;
|
|
361172
361412
|
setTimeout(() => {
|
|
361173
361413
|
if (loadingCompleteResolve2) {
|
|
361174
361414
|
logForDebugging2("Remote settings: Loading promise timed out, resolving anyway");
|
|
@@ -361423,8 +361663,8 @@ async function fetchAndLoadRemoteManagedSettings() {
|
|
|
361423
361663
|
}
|
|
361424
361664
|
async function loadRemoteManagedSettings() {
|
|
361425
361665
|
if (isRemoteManagedSettingsEligible() && !loadingCompletePromise2) {
|
|
361426
|
-
loadingCompletePromise2 = new Promise((
|
|
361427
|
-
loadingCompleteResolve2 =
|
|
361666
|
+
loadingCompletePromise2 = new Promise((resolve35) => {
|
|
361667
|
+
loadingCompleteResolve2 = resolve35;
|
|
361428
361668
|
});
|
|
361429
361669
|
}
|
|
361430
361670
|
if (getRemoteManagedSettingsSyncFromCache() && loadingCompleteResolve2) {
|
|
@@ -361696,7 +361936,7 @@ async function startNodeRelay(wsUrl, authHeader, wsAuthHeader) {
|
|
|
361696
361936
|
cleanupConn(states.get(sock));
|
|
361697
361937
|
});
|
|
361698
361938
|
});
|
|
361699
|
-
return new Promise((
|
|
361939
|
+
return new Promise((resolve35, reject2) => {
|
|
361700
361940
|
server.once("error", reject2);
|
|
361701
361941
|
server.listen(0, "127.0.0.1", () => {
|
|
361702
361942
|
const addr = server.address();
|
|
@@ -361704,7 +361944,7 @@ async function startNodeRelay(wsUrl, authHeader, wsAuthHeader) {
|
|
|
361704
361944
|
reject2(new Error("upstreamproxy: server has no TCP address"));
|
|
361705
361945
|
return;
|
|
361706
361946
|
}
|
|
361707
|
-
|
|
361947
|
+
resolve35({
|
|
361708
361948
|
port: addr.port,
|
|
361709
361949
|
stop: () => server.close()
|
|
361710
361950
|
});
|
|
@@ -381497,7 +381737,7 @@ var HttpClient = class {
|
|
|
381497
381737
|
} else if (extractStatus.status === "failed" || extractStatus.status === "cancelled") {
|
|
381498
381738
|
throw new FirecrawlError(`Extract job ${extractStatus.status}. Error: ${extractStatus.error}`, statusResponse.status);
|
|
381499
381739
|
}
|
|
381500
|
-
await new Promise((
|
|
381740
|
+
await new Promise((resolve35) => setTimeout(resolve35, 1000));
|
|
381501
381741
|
} while (extractStatus.status !== "completed");
|
|
381502
381742
|
} else {
|
|
381503
381743
|
this.handleError(response, "extract");
|
|
@@ -381596,7 +381836,7 @@ var HttpClient = class {
|
|
|
381596
381836
|
}
|
|
381597
381837
|
} else if (["active", "paused", "pending", "queued", "waiting", "scraping"].includes(statusData.status)) {
|
|
381598
381838
|
checkInterval = Math.max(checkInterval, 2);
|
|
381599
|
-
await new Promise((
|
|
381839
|
+
await new Promise((resolve35) => setTimeout(resolve35, checkInterval * 1000));
|
|
381600
381840
|
} else {
|
|
381601
381841
|
throw new FirecrawlError(`Crawl job failed or was stopped. Status: ${statusData.status}`, 500);
|
|
381602
381842
|
}
|
|
@@ -381610,7 +381850,7 @@ var HttpClient = class {
|
|
|
381610
381850
|
if (this.isRetryableError(error41) && networkRetries < maxNetworkRetries) {
|
|
381611
381851
|
networkRetries++;
|
|
381612
381852
|
const backoffDelay = Math.min(1000 * Math.pow(2, networkRetries - 1), 1e4);
|
|
381613
|
-
await new Promise((
|
|
381853
|
+
await new Promise((resolve35) => setTimeout(resolve35, backoffDelay));
|
|
381614
381854
|
continue;
|
|
381615
381855
|
}
|
|
381616
381856
|
throw new FirecrawlError(error41, 500);
|
|
@@ -381693,7 +381933,7 @@ var HttpClient = class {
|
|
|
381693
381933
|
if (researchStatus.status !== "processing") {
|
|
381694
381934
|
break;
|
|
381695
381935
|
}
|
|
381696
|
-
await new Promise((
|
|
381936
|
+
await new Promise((resolve35) => setTimeout(resolve35, 2000));
|
|
381697
381937
|
}
|
|
381698
381938
|
return { success: false, error: "Research job terminated unexpectedly" };
|
|
381699
381939
|
} catch (error41) {
|
|
@@ -381781,7 +382021,7 @@ var HttpClient = class {
|
|
|
381781
382021
|
if (researchStatus.status !== "processing") {
|
|
381782
382022
|
break;
|
|
381783
382023
|
}
|
|
381784
|
-
await new Promise((
|
|
382024
|
+
await new Promise((resolve35) => setTimeout(resolve35, 2000));
|
|
381785
382025
|
}
|
|
381786
382026
|
return { success: false, error: "Research job terminated unexpectedly" };
|
|
381787
382027
|
} catch (error41) {
|
|
@@ -381852,7 +382092,7 @@ var HttpClient = class {
|
|
|
381852
382092
|
if (generationStatus.status !== "processing") {
|
|
381853
382093
|
break;
|
|
381854
382094
|
}
|
|
381855
|
-
await new Promise((
|
|
382095
|
+
await new Promise((resolve35) => setTimeout(resolve35, 2000));
|
|
381856
382096
|
}
|
|
381857
382097
|
return { success: false, error: "LLMs.txt generation job terminated unexpectedly" };
|
|
381858
382098
|
} catch (error41) {
|
|
@@ -389689,9 +389929,9 @@ var require_needle = __commonJS((exports, module) => {
|
|
|
389689
389929
|
verb = args.shift();
|
|
389690
389930
|
if (verb.match(/get|head/i) && args.length == 2)
|
|
389691
389931
|
args.splice(1, 0, null);
|
|
389692
|
-
return new Promise(function(
|
|
389932
|
+
return new Promise(function(resolve35, reject2) {
|
|
389693
389933
|
module.exports.request(verb, args[0], args[1], args[2], function(err2, resp) {
|
|
389694
|
-
return err2 ? reject2(err2) :
|
|
389934
|
+
return err2 ? reject2(err2) : resolve35(resp);
|
|
389695
389935
|
});
|
|
389696
389936
|
});
|
|
389697
389937
|
};
|
|
@@ -397092,7 +397332,7 @@ async function showInvalidConfigDialog({
|
|
|
397092
397332
|
...getBaseRenderOptions(false),
|
|
397093
397333
|
theme: SAFE_ERROR_THEME_NAME
|
|
397094
397334
|
};
|
|
397095
|
-
await new Promise(async (
|
|
397335
|
+
await new Promise(async (resolve35) => {
|
|
397096
397336
|
const {
|
|
397097
397337
|
unmount
|
|
397098
397338
|
} = await render(/* @__PURE__ */ jsx_dev_runtime44.jsxDEV(AppStateProvider, {
|
|
@@ -397102,7 +397342,7 @@ async function showInvalidConfigDialog({
|
|
|
397102
397342
|
errorDescription: error41.message,
|
|
397103
397343
|
onExit: () => {
|
|
397104
397344
|
unmount();
|
|
397105
|
-
|
|
397345
|
+
resolve35();
|
|
397106
397346
|
process.exit(1);
|
|
397107
397347
|
},
|
|
397108
397348
|
onReset: () => {
|
|
@@ -397111,7 +397351,7 @@ async function showInvalidConfigDialog({
|
|
|
397111
397351
|
encoding: "utf8"
|
|
397112
397352
|
});
|
|
397113
397353
|
unmount();
|
|
397114
|
-
|
|
397354
|
+
resolve35();
|
|
397115
397355
|
process.exit(0);
|
|
397116
397356
|
}
|
|
397117
397357
|
}, undefined, false, undefined, this)
|
|
@@ -401470,14 +401710,14 @@ class AuthCodeListener {
|
|
|
401470
401710
|
this.callbackPath = callbackPath;
|
|
401471
401711
|
}
|
|
401472
401712
|
async start(port) {
|
|
401473
|
-
return new Promise((
|
|
401713
|
+
return new Promise((resolve35, reject2) => {
|
|
401474
401714
|
this.localServer.once("error", (err2) => {
|
|
401475
401715
|
reject2(new Error(`Failed to start OAuth callback server: ${err2.message}`));
|
|
401476
401716
|
});
|
|
401477
401717
|
this.localServer.listen({ port: port ?? 0, host: "::", ipv6Only: false }, () => {
|
|
401478
401718
|
const address = this.localServer.address();
|
|
401479
401719
|
this.port = address.port;
|
|
401480
|
-
|
|
401720
|
+
resolve35(this.port);
|
|
401481
401721
|
});
|
|
401482
401722
|
});
|
|
401483
401723
|
}
|
|
@@ -401488,8 +401728,8 @@ class AuthCodeListener {
|
|
|
401488
401728
|
return this.pendingResponse !== null;
|
|
401489
401729
|
}
|
|
401490
401730
|
async waitForAuthorization(state4, onReady) {
|
|
401491
|
-
return new Promise((
|
|
401492
|
-
this.promiseResolver =
|
|
401731
|
+
return new Promise((resolve35, reject2) => {
|
|
401732
|
+
this.promiseResolver = resolve35;
|
|
401493
401733
|
this.promiseRejecter = reject2;
|
|
401494
401734
|
this.expectedState = state4;
|
|
401495
401735
|
this.startLocalListener(onReady);
|
|
@@ -401658,11 +401898,11 @@ class OAuthService {
|
|
|
401658
401898
|
}
|
|
401659
401899
|
}
|
|
401660
401900
|
async waitForAuthorizationCode(state4, onReady) {
|
|
401661
|
-
return new Promise((
|
|
401662
|
-
this.manualAuthCodeResolver =
|
|
401901
|
+
return new Promise((resolve35, reject2) => {
|
|
401902
|
+
this.manualAuthCodeResolver = resolve35;
|
|
401663
401903
|
this.authCodeListener?.waitForAuthorization(state4, onReady).then((authorizationCode) => {
|
|
401664
401904
|
this.manualAuthCodeResolver = null;
|
|
401665
|
-
|
|
401905
|
+
resolve35(authorizationCode);
|
|
401666
401906
|
}).catch((error41) => {
|
|
401667
401907
|
this.manualAuthCodeResolver = null;
|
|
401668
401908
|
reject2(error41);
|
|
@@ -419277,7 +419517,7 @@ function extractFirstFrame(output) {
|
|
|
419277
419517
|
return output.slice(contentStart, endIndex);
|
|
419278
419518
|
}
|
|
419279
419519
|
function renderToAnsiString(node, columns) {
|
|
419280
|
-
return new Promise(async (
|
|
419520
|
+
return new Promise(async (resolve35) => {
|
|
419281
419521
|
let output = "";
|
|
419282
419522
|
const stream4 = new PassThrough3;
|
|
419283
419523
|
if (columns !== undefined) {
|
|
@@ -419293,7 +419533,7 @@ function renderToAnsiString(node, columns) {
|
|
|
419293
419533
|
patchConsole: false
|
|
419294
419534
|
});
|
|
419295
419535
|
await instance.waitUntilExit();
|
|
419296
|
-
await
|
|
419536
|
+
await resolve35(extractFirstFrame(output));
|
|
419297
419537
|
});
|
|
419298
419538
|
}
|
|
419299
419539
|
async function renderToString(node, columns) {
|
|
@@ -419396,7 +419636,7 @@ var init_exportRenderer = __esm(() => {
|
|
|
419396
419636
|
// src/lib/editor.ts
|
|
419397
419637
|
import {
|
|
419398
419638
|
spawn as spawn8,
|
|
419399
|
-
spawnSync as
|
|
419639
|
+
spawnSync as spawnSync5
|
|
419400
419640
|
} from "child_process";
|
|
419401
419641
|
import { basename as basename32 } from "path";
|
|
419402
419642
|
function isCommandAvailable3(command) {
|
|
@@ -419447,7 +419687,7 @@ function openFileInExternalEditor(filePath, line) {
|
|
|
419447
419687
|
let result;
|
|
419448
419688
|
if (process.platform === "win32") {
|
|
419449
419689
|
const lineArg = useGotoLine ? `+${line} ` : "";
|
|
419450
|
-
result =
|
|
419690
|
+
result = spawnSync5(`${editor} ${lineArg}"${filePath}"`, {
|
|
419451
419691
|
...syncOpts,
|
|
419452
419692
|
shell: true
|
|
419453
419693
|
});
|
|
@@ -419456,7 +419696,7 @@ function openFileInExternalEditor(filePath, line) {
|
|
|
419456
419696
|
...editorArgs,
|
|
419457
419697
|
...useGotoLine ? [`+${line}`, filePath] : [filePath]
|
|
419458
419698
|
];
|
|
419459
|
-
result =
|
|
419699
|
+
result = spawnSync5(base2, args, syncOpts);
|
|
419460
419700
|
}
|
|
419461
419701
|
if (result.error) {
|
|
419462
419702
|
logForDebugging2(`editor spawn failed: ${result.error}`, {
|
|
@@ -431012,10 +431252,28 @@ function deserializeMessagesWithInterruptDetection(serializedMessages) {
|
|
|
431012
431252
|
throw error41;
|
|
431013
431253
|
}
|
|
431014
431254
|
}
|
|
431255
|
+
function hasTerminalContinuationStop(messages) {
|
|
431256
|
+
let lastToolUseIdx = -1;
|
|
431257
|
+
for (let index = messages.length - 1;index >= 0; index--) {
|
|
431258
|
+
const message = messages[index];
|
|
431259
|
+
if (message.type === "assistant" && !message.isApiErrorMessage && message.message.content.some((block2) => block2.type === "tool_use")) {
|
|
431260
|
+
lastToolUseIdx = index;
|
|
431261
|
+
break;
|
|
431262
|
+
}
|
|
431263
|
+
}
|
|
431264
|
+
if (lastToolUseIdx === -1)
|
|
431265
|
+
return false;
|
|
431266
|
+
const terminalBatch = messages.slice(lastToolUseIdx + 1);
|
|
431267
|
+
const hasLaterHumanPrompt = terminalBatch.some((message) => message.type === "user" && !message.isMeta && !message.isCompactSummary && !isToolUseResultMessage(message));
|
|
431268
|
+
return !hasLaterHumanPrompt && terminalBatch.some((message) => message.type === "user" && message.preventContinuation === true);
|
|
431269
|
+
}
|
|
431015
431270
|
function detectTurnInterruption(messages) {
|
|
431016
431271
|
if (messages.length === 0) {
|
|
431017
431272
|
return { kind: "none" };
|
|
431018
431273
|
}
|
|
431274
|
+
if (hasTerminalContinuationStop(messages)) {
|
|
431275
|
+
return { kind: "none" };
|
|
431276
|
+
}
|
|
431019
431277
|
const lastMessageIdx = messages.findLastIndex((m) => m.type !== "system" && m.type !== "progress" && !(m.type === "assistant" && m.isApiErrorMessage));
|
|
431020
431278
|
const lastMessage = lastMessageIdx !== -1 ? messages[lastMessageIdx] : undefined;
|
|
431021
431279
|
if (!lastMessage) {
|
|
@@ -431995,7 +432253,7 @@ async function handleTeleportPrerequisites(root2, errorsToIgnore) {
|
|
|
431995
432253
|
error_types: Array.from(errors4).join(","),
|
|
431996
432254
|
errors_ignored: Array.from(errorsToIgnore || []).join(",")
|
|
431997
432255
|
});
|
|
431998
|
-
await new Promise((
|
|
432256
|
+
await new Promise((resolve35) => {
|
|
431999
432257
|
root2.render(/* @__PURE__ */ jsx_dev_runtime160.jsxDEV(AppStateProvider, {
|
|
432000
432258
|
children: /* @__PURE__ */ jsx_dev_runtime160.jsxDEV(KeybindingSetup, {
|
|
432001
432259
|
children: /* @__PURE__ */ jsx_dev_runtime160.jsxDEV(TeleportError, {
|
|
@@ -432004,7 +432262,7 @@ async function handleTeleportPrerequisites(root2, errorsToIgnore) {
|
|
|
432004
432262
|
logEvent("tengu_teleport_errors_resolved", {
|
|
432005
432263
|
error_types: Array.from(errors4).join(",")
|
|
432006
432264
|
});
|
|
432007
|
-
|
|
432265
|
+
resolve35();
|
|
432008
432266
|
}
|
|
432009
432267
|
}, undefined, false, undefined, this)
|
|
432010
432268
|
}, undefined, false, undefined, this)
|
|
@@ -442303,7 +442561,7 @@ import {
|
|
|
442303
442561
|
writeFile as writeFile7
|
|
442304
442562
|
} from "fs/promises";
|
|
442305
442563
|
import { homedir as homedir32 } from "os";
|
|
442306
|
-
import { basename as basename45, delimiter as delimiter3, dirname as dirname47, join as join103, resolve as
|
|
442564
|
+
import { basename as basename45, delimiter as delimiter3, dirname as dirname47, join as join103, resolve as resolve35 } from "path";
|
|
442307
442565
|
function getPlatform3() {
|
|
442308
442566
|
const os5 = env3.platform;
|
|
442309
442567
|
const arch = process.arch === "x64" ? "x64" : process.arch === "arm64" ? "arm64" : null;
|
|
@@ -442717,8 +442975,8 @@ async function updateSymlink(symlinkPath, targetPath) {
|
|
|
442717
442975
|
if (symlinkExists) {
|
|
442718
442976
|
try {
|
|
442719
442977
|
const currentTarget = await readlink(symlinkPath);
|
|
442720
|
-
const resolvedCurrentTarget =
|
|
442721
|
-
const resolvedTargetPath =
|
|
442978
|
+
const resolvedCurrentTarget = resolve35(dirname47(symlinkPath), currentTarget);
|
|
442979
|
+
const resolvedTargetPath = resolve35(targetPath);
|
|
442722
442980
|
if (resolvedCurrentTarget === resolvedTargetPath) {
|
|
442723
442981
|
return false;
|
|
442724
442982
|
}
|
|
@@ -442758,7 +443016,7 @@ async function checkInstall(force = false) {
|
|
|
442758
443016
|
const dirs = getBaseDirectories();
|
|
442759
443017
|
const messages = [];
|
|
442760
443018
|
const localBinDir = dirname47(dirs.executable);
|
|
442761
|
-
const resolvedLocalBinPath =
|
|
443019
|
+
const resolvedLocalBinPath = resolve35(localBinDir);
|
|
442762
443020
|
const platform6 = getPlatform3();
|
|
442763
443021
|
const isWindows2 = platform6.startsWith("win32");
|
|
442764
443022
|
try {
|
|
@@ -442781,7 +443039,7 @@ async function checkInstall(force = false) {
|
|
|
442781
443039
|
} else {
|
|
442782
443040
|
try {
|
|
442783
443041
|
const target = await readlink(dirs.executable);
|
|
442784
|
-
const absoluteTarget =
|
|
443042
|
+
const absoluteTarget = resolve35(dirname47(dirs.executable), target);
|
|
442785
443043
|
if (!await isPossibleClaudeBinary(absoluteTarget)) {
|
|
442786
443044
|
messages.push({
|
|
442787
443045
|
message: `Claude symlink points to missing or invalid binary: ${target}`,
|
|
@@ -442809,7 +443067,7 @@ async function checkInstall(force = false) {
|
|
|
442809
443067
|
}
|
|
442810
443068
|
const isInCurrentPath = (process.env.PATH || "").split(delimiter3).some((entry) => {
|
|
442811
443069
|
try {
|
|
442812
|
-
const resolvedEntry =
|
|
443070
|
+
const resolvedEntry = resolve35(entry);
|
|
442813
443071
|
if (isWindows2) {
|
|
442814
443072
|
return resolvedEntry.toLowerCase() === resolvedLocalBinPath.toLowerCase();
|
|
442815
443073
|
}
|
|
@@ -442888,7 +443146,7 @@ async function installLatestImpl(channelOrVersion, forceReinstall = false) {
|
|
|
442888
443146
|
async function getVersionFromSymlink(symlinkPath) {
|
|
442889
443147
|
try {
|
|
442890
443148
|
const target = await readlink(symlinkPath);
|
|
442891
|
-
const absoluteTarget =
|
|
443149
|
+
const absoluteTarget = resolve35(dirname47(symlinkPath), target);
|
|
442892
443150
|
if (await isPossibleClaudeBinary(absoluteTarget)) {
|
|
442893
443151
|
return absoluteTarget;
|
|
442894
443152
|
}
|
|
@@ -442904,7 +443162,7 @@ async function lockCurrentVersion() {
|
|
|
442904
443162
|
if (!process.execPath.includes(dirs.versions)) {
|
|
442905
443163
|
return;
|
|
442906
443164
|
}
|
|
442907
|
-
const versionPath =
|
|
443165
|
+
const versionPath = resolve35(process.execPath);
|
|
442908
443166
|
try {
|
|
442909
443167
|
const lockfilePath = getLockFilePathFromVersionPath(dirs, versionPath);
|
|
442910
443168
|
await mkdir11(dirs.locks, { recursive: true });
|
|
@@ -443072,7 +443330,7 @@ async function cleanupOldVersions() {
|
|
|
443072
443330
|
versionFiles.push({
|
|
443073
443331
|
name: entry,
|
|
443074
443332
|
path: entryPath,
|
|
443075
|
-
resolvedPath:
|
|
443333
|
+
resolvedPath: resolve35(entryPath),
|
|
443076
443334
|
mtime: stats.mtime
|
|
443077
443335
|
});
|
|
443078
443336
|
} catch {}
|
|
@@ -443090,7 +443348,7 @@ async function cleanupOldVersions() {
|
|
|
443090
443348
|
const currentBinaryPath = process.execPath;
|
|
443091
443349
|
const protectedVersions = new Set;
|
|
443092
443350
|
if (currentBinaryPath && currentBinaryPath.includes(dirs.versions)) {
|
|
443093
|
-
protectedVersions.add(
|
|
443351
|
+
protectedVersions.add(resolve35(currentBinaryPath));
|
|
443094
443352
|
}
|
|
443095
443353
|
const currentSymlinkVersion = await getVersionFromSymlink(dirs.executable);
|
|
443096
443354
|
if (currentSymlinkVersion) {
|
|
@@ -447297,8 +447555,8 @@ class FileIndex {
|
|
|
447297
447555
|
}
|
|
447298
447556
|
loadFromFileListAsync(fileList) {
|
|
447299
447557
|
let markQueryable = () => {};
|
|
447300
|
-
const queryable = new Promise((
|
|
447301
|
-
markQueryable =
|
|
447558
|
+
const queryable = new Promise((resolve36) => {
|
|
447559
|
+
markQueryable = resolve36;
|
|
447302
447560
|
});
|
|
447303
447561
|
const done = this.buildAsync(fileList, markQueryable);
|
|
447304
447562
|
return { queryable, done };
|
|
@@ -447479,7 +447737,7 @@ function isUpper(code) {
|
|
|
447479
447737
|
return code >= 65 && code <= 90;
|
|
447480
447738
|
}
|
|
447481
447739
|
function yieldToEventLoop() {
|
|
447482
|
-
return new Promise((
|
|
447740
|
+
return new Promise((resolve36) => setImmediate(resolve36));
|
|
447483
447741
|
}
|
|
447484
447742
|
function computeTopLevelEntries(paths2, limit) {
|
|
447485
447743
|
const topLevel = new Set;
|
|
@@ -453573,10 +453831,10 @@ var require_browser2 = __commonJS((exports) => {
|
|
|
453573
453831
|
text = canvas;
|
|
453574
453832
|
canvas = undefined;
|
|
453575
453833
|
}
|
|
453576
|
-
return new Promise(function(
|
|
453834
|
+
return new Promise(function(resolve36, reject2) {
|
|
453577
453835
|
try {
|
|
453578
453836
|
const data = QRCode.create(text, opts);
|
|
453579
|
-
|
|
453837
|
+
resolve36(renderFunc(data, canvas, opts));
|
|
453580
453838
|
} catch (e2) {
|
|
453581
453839
|
reject2(e2);
|
|
453582
453840
|
}
|
|
@@ -453632,11 +453890,11 @@ function getStringRendererFromType(type) {
|
|
|
453632
453890
|
}
|
|
453633
453891
|
function render2(renderFunc, text, params) {
|
|
453634
453892
|
if (!params.cb) {
|
|
453635
|
-
return new Promise(function(
|
|
453893
|
+
return new Promise(function(resolve36, reject2) {
|
|
453636
453894
|
try {
|
|
453637
453895
|
const data = QRCode.create(text, params.opts);
|
|
453638
453896
|
return renderFunc(data, params.opts, function(err2, data2) {
|
|
453639
|
-
return err2 ? reject2(err2) :
|
|
453897
|
+
return err2 ? reject2(err2) : resolve36(data2);
|
|
453640
453898
|
});
|
|
453641
453899
|
} catch (e2) {
|
|
453642
453900
|
reject2(e2);
|
|
@@ -471653,7 +471911,7 @@ var init_channelPermissions = __esm(() => {
|
|
|
471653
471911
|
});
|
|
471654
471912
|
|
|
471655
471913
|
// src/cli/hooks/toolPermission/PermissionContext.ts
|
|
471656
|
-
function createResolveOnce(
|
|
471914
|
+
function createResolveOnce(resolve36) {
|
|
471657
471915
|
let claimed = false;
|
|
471658
471916
|
let delivered = false;
|
|
471659
471917
|
return {
|
|
@@ -471662,7 +471920,7 @@ function createResolveOnce(resolve35) {
|
|
|
471662
471920
|
return;
|
|
471663
471921
|
delivered = true;
|
|
471664
471922
|
claimed = true;
|
|
471665
|
-
|
|
471923
|
+
resolve36(value);
|
|
471666
471924
|
},
|
|
471667
471925
|
isResolved() {
|
|
471668
471926
|
return claimed;
|
|
@@ -471707,11 +471965,11 @@ function createPermissionContext(tool, input, toolUseContext, assistantMessage,
|
|
|
471707
471965
|
setToolPermissionContext(applyPermissionUpdates(appState.toolPermissionContext, updates));
|
|
471708
471966
|
return updates.some((update) => supportsPersistence(update.destination));
|
|
471709
471967
|
},
|
|
471710
|
-
resolveIfAborted(
|
|
471968
|
+
resolveIfAborted(resolve36) {
|
|
471711
471969
|
if (!toolUseContext.abortController.signal.aborted)
|
|
471712
471970
|
return false;
|
|
471713
471971
|
this.logCancelled();
|
|
471714
|
-
|
|
471972
|
+
resolve36(this.cancelAndAbort(undefined, true));
|
|
471715
471973
|
return true;
|
|
471716
471974
|
},
|
|
471717
471975
|
cancelAndAbort(feedback, isAbort, contentBlocks) {
|
|
@@ -471825,7 +472083,7 @@ var init_PermissionContext = __esm(() => {
|
|
|
471825
472083
|
|
|
471826
472084
|
// src/cli/hooks/toolPermission/handlers/interactiveHandler.ts
|
|
471827
472085
|
import { randomUUID as randomUUID34 } from "crypto";
|
|
471828
|
-
function handleInteractivePermission(params,
|
|
472086
|
+
function handleInteractivePermission(params, resolve36) {
|
|
471829
472087
|
const {
|
|
471830
472088
|
ctx,
|
|
471831
472089
|
description,
|
|
@@ -471834,7 +472092,7 @@ function handleInteractivePermission(params, resolve35) {
|
|
|
471834
472092
|
bridgeCallbacks,
|
|
471835
472093
|
channelCallbacks
|
|
471836
472094
|
} = params;
|
|
471837
|
-
const { resolve: resolveOnce, isResolved, claim } = createResolveOnce(
|
|
472095
|
+
const { resolve: resolveOnce, isResolved, claim } = createResolveOnce(resolve36);
|
|
471838
472096
|
let userInteracted = false;
|
|
471839
472097
|
let checkmarkTransitionTimer;
|
|
471840
472098
|
let checkmarkAbortHandler;
|
|
@@ -472021,8 +472279,8 @@ async function handleSwarmWorkerPermission(params) {
|
|
|
472021
472279
|
...prev,
|
|
472022
472280
|
pendingWorkerRequest: null
|
|
472023
472281
|
}));
|
|
472024
|
-
const decision = await new Promise((
|
|
472025
|
-
const { resolve: resolveOnce, claim } = createResolveOnce(
|
|
472282
|
+
const decision = await new Promise((resolve36) => {
|
|
472283
|
+
const { resolve: resolveOnce, claim } = createResolveOnce(resolve36);
|
|
472026
472284
|
const request = createPermissionRequest({
|
|
472027
472285
|
toolName: ctx.tool.name,
|
|
472028
472286
|
toolUseId: ctx.toolUseID,
|
|
@@ -472088,15 +472346,15 @@ function useCanUseTool(setToolUseConfirmQueue, setToolPermissionContext) {
|
|
|
472088
472346
|
const $2 = import_react_compiler_runtime191.c(3);
|
|
472089
472347
|
let t0;
|
|
472090
472348
|
if ($2[0] !== setToolPermissionContext || $2[1] !== setToolUseConfirmQueue) {
|
|
472091
|
-
t0 = async (tool, input, toolUseContext, assistantMessage, toolUseID, forceDecision) => new Promise((
|
|
472349
|
+
t0 = async (tool, input, toolUseContext, assistantMessage, toolUseID, forceDecision) => new Promise((resolve36) => {
|
|
472092
472350
|
const ctx = createPermissionContext(tool, input, toolUseContext, assistantMessage, toolUseID, setToolPermissionContext, createPermissionQueueOps(setToolUseConfirmQueue));
|
|
472093
|
-
if (ctx.resolveIfAborted(
|
|
472351
|
+
if (ctx.resolveIfAborted(resolve36)) {
|
|
472094
472352
|
return;
|
|
472095
472353
|
}
|
|
472096
472354
|
const decisionPromise = forceDecision !== undefined ? Promise.resolve(forceDecision) : hasPermissionsToUseTool(tool, input, toolUseContext, assistantMessage, toolUseID);
|
|
472097
472355
|
return decisionPromise.then(async (result) => {
|
|
472098
472356
|
if (result.behavior === "allow") {
|
|
472099
|
-
if (ctx.resolveIfAborted(
|
|
472357
|
+
if (ctx.resolveIfAborted(resolve36)) {
|
|
472100
472358
|
return;
|
|
472101
472359
|
}
|
|
472102
472360
|
if (false) {}
|
|
@@ -472104,7 +472362,7 @@ function useCanUseTool(setToolUseConfirmQueue, setToolPermissionContext) {
|
|
|
472104
472362
|
decision: "accept",
|
|
472105
472363
|
source: "config"
|
|
472106
472364
|
});
|
|
472107
|
-
|
|
472365
|
+
resolve36(ctx.buildAllow(result.updatedInput ?? input, {
|
|
472108
472366
|
decisionReason: result.decisionReason
|
|
472109
472367
|
}));
|
|
472110
472368
|
return;
|
|
@@ -472115,7 +472373,7 @@ function useCanUseTool(setToolUseConfirmQueue, setToolPermissionContext) {
|
|
|
472115
472373
|
toolPermissionContext: appState.toolPermissionContext,
|
|
472116
472374
|
tools: toolUseContext.options.tools
|
|
472117
472375
|
});
|
|
472118
|
-
if (ctx.resolveIfAborted(
|
|
472376
|
+
if (ctx.resolveIfAborted(resolve36)) {
|
|
472119
472377
|
return;
|
|
472120
472378
|
}
|
|
472121
472379
|
switch (result.behavior) {
|
|
@@ -472131,7 +472389,7 @@ function useCanUseTool(setToolUseConfirmQueue, setToolPermissionContext) {
|
|
|
472131
472389
|
source: "config"
|
|
472132
472390
|
});
|
|
472133
472391
|
if (false) {}
|
|
472134
|
-
|
|
472392
|
+
resolve36(result);
|
|
472135
472393
|
return;
|
|
472136
472394
|
}
|
|
472137
472395
|
case "ask": {
|
|
@@ -472144,11 +472402,11 @@ function useCanUseTool(setToolUseConfirmQueue, setToolPermissionContext) {
|
|
|
472144
472402
|
permissionMode: appState.toolPermissionContext.mode
|
|
472145
472403
|
});
|
|
472146
472404
|
if (coordinatorDecision) {
|
|
472147
|
-
|
|
472405
|
+
resolve36(coordinatorDecision);
|
|
472148
472406
|
return;
|
|
472149
472407
|
}
|
|
472150
472408
|
}
|
|
472151
|
-
if (ctx.resolveIfAborted(
|
|
472409
|
+
if (ctx.resolveIfAborted(resolve36)) {
|
|
472152
472410
|
return;
|
|
472153
472411
|
}
|
|
472154
472412
|
const swarmDecision = await handleSwarmWorkerPermission({
|
|
@@ -472159,7 +472417,7 @@ function useCanUseTool(setToolUseConfirmQueue, setToolPermissionContext) {
|
|
|
472159
472417
|
suggestions: result.suggestions
|
|
472160
472418
|
});
|
|
472161
472419
|
if (swarmDecision) {
|
|
472162
|
-
|
|
472420
|
+
resolve36(swarmDecision);
|
|
472163
472421
|
return;
|
|
472164
472422
|
}
|
|
472165
472423
|
if (false) {}
|
|
@@ -472170,7 +472428,7 @@ function useCanUseTool(setToolUseConfirmQueue, setToolPermissionContext) {
|
|
|
472170
472428
|
awaitAutomatedChecksBeforeDialog: appState.toolPermissionContext.awaitAutomatedChecksBeforeDialog,
|
|
472171
472429
|
bridgeCallbacks: undefined,
|
|
472172
472430
|
channelCallbacks: undefined
|
|
472173
|
-
},
|
|
472431
|
+
}, resolve36);
|
|
472174
472432
|
return;
|
|
472175
472433
|
}
|
|
472176
472434
|
}
|
|
@@ -472178,10 +472436,10 @@ function useCanUseTool(setToolUseConfirmQueue, setToolPermissionContext) {
|
|
|
472178
472436
|
if (error41 instanceof AbortError || error41 instanceof CanonicalUserAbortError) {
|
|
472179
472437
|
logForDebugging2(`Permission check threw ${error41.constructor.name} for tool=${tool.name}: ${error41.message}`);
|
|
472180
472438
|
ctx.logCancelled();
|
|
472181
|
-
|
|
472439
|
+
resolve36(ctx.cancelAndAbort(undefined, true));
|
|
472182
472440
|
} else {
|
|
472183
472441
|
logError(error41);
|
|
472184
|
-
|
|
472442
|
+
resolve36(ctx.cancelAndAbort(undefined, true));
|
|
472185
472443
|
}
|
|
472186
472444
|
}).finally(() => {
|
|
472187
472445
|
clearClassifierChecking(toolUseID);
|
|
@@ -476306,8 +476564,8 @@ function useManageMCPConnections(dynamicMcpConfig, isStrictMcpConfig = false) {
|
|
|
476306
476564
|
}
|
|
476307
476565
|
const backoffMs = Math.min(INITIAL_BACKOFF_MS * Math.pow(2, attempt - 1), MAX_BACKOFF_MS);
|
|
476308
476566
|
logMCPDebug(client.name, `Scheduling reconnection attempt ${attempt + 1} in ${backoffMs}ms`);
|
|
476309
|
-
await new Promise((
|
|
476310
|
-
const timer = setTimeout(
|
|
476567
|
+
await new Promise((resolve37) => {
|
|
476568
|
+
const timer = setTimeout(resolve37, backoffMs);
|
|
476311
476569
|
reconnectTimersRef.current.set(client.name, timer);
|
|
476312
476570
|
});
|
|
476313
476571
|
}
|
|
@@ -479411,7 +479669,7 @@ class StructuredIO {
|
|
|
479411
479669
|
});
|
|
479412
479670
|
}
|
|
479413
479671
|
try {
|
|
479414
|
-
return await new Promise((
|
|
479672
|
+
return await new Promise((resolve37, reject2) => {
|
|
479415
479673
|
this.pendingRequests.set(requestId, {
|
|
479416
479674
|
request: {
|
|
479417
479675
|
type: "control_request",
|
|
@@ -479419,7 +479677,7 @@ class StructuredIO {
|
|
|
479419
479677
|
request
|
|
479420
479678
|
},
|
|
479421
479679
|
resolve: (result) => {
|
|
479422
|
-
|
|
479680
|
+
resolve37(result);
|
|
479423
479681
|
},
|
|
479424
479682
|
reject: reject2,
|
|
479425
479683
|
schema
|
|
@@ -480624,7 +480882,7 @@ function usePluginRecommendationBase() {
|
|
|
480624
480882
|
const isCheckingRef = React95.useRef(false);
|
|
480625
480883
|
let t0;
|
|
480626
480884
|
if ($2[0] !== recommendation) {
|
|
480627
|
-
t0 = (
|
|
480885
|
+
t0 = (resolve37) => {
|
|
480628
480886
|
if (getIsRemoteMode()) {
|
|
480629
480887
|
return;
|
|
480630
480888
|
}
|
|
@@ -480635,7 +480893,7 @@ function usePluginRecommendationBase() {
|
|
|
480635
480893
|
return;
|
|
480636
480894
|
}
|
|
480637
480895
|
isCheckingRef.current = true;
|
|
480638
|
-
|
|
480896
|
+
resolve37().then((rec) => {
|
|
480639
480897
|
if (rec) {
|
|
480640
480898
|
setRecommendation(rec);
|
|
480641
480899
|
}
|
|
@@ -482074,7 +482332,7 @@ var init_usePluginAutoupdateNotification = __esm(() => {
|
|
|
482074
482332
|
});
|
|
482075
482333
|
|
|
482076
482334
|
// src/capabilities/plugins/reconciler.ts
|
|
482077
|
-
import { isAbsolute as isAbsolute23, resolve as
|
|
482335
|
+
import { isAbsolute as isAbsolute23, resolve as resolve37 } from "path";
|
|
482078
482336
|
function diffMarketplaces(declared, materialized, opts) {
|
|
482079
482337
|
const missing = [];
|
|
482080
482338
|
const sourceChanged = [];
|
|
@@ -482187,7 +482445,7 @@ function normalizeSource(source, projectRoot) {
|
|
|
482187
482445
|
const canonicalRoot = findCanonicalGitRoot(base2);
|
|
482188
482446
|
return {
|
|
482189
482447
|
...source,
|
|
482190
|
-
path:
|
|
482448
|
+
path: resolve37(canonicalRoot ?? base2, source.path)
|
|
482191
482449
|
};
|
|
482192
482450
|
}
|
|
482193
482451
|
return source;
|
|
@@ -485843,12 +486101,12 @@ Error: sandbox required but unavailable: ${reason}
|
|
|
485843
486101
|
return () => unregisterLeaderSetToolPermissionContext();
|
|
485844
486102
|
}, [setToolPermissionContext]);
|
|
485845
486103
|
const canUseTool = useCanUseTool_default(setToolUseConfirmQueue, setToolPermissionContext);
|
|
485846
|
-
const requestPrompt = import_react234.useCallback((title, toolInputSummary) => (request) => new Promise((
|
|
486104
|
+
const requestPrompt = import_react234.useCallback((title, toolInputSummary) => (request) => new Promise((resolve38, reject2) => {
|
|
485847
486105
|
setPromptQueue((prev) => [...prev, {
|
|
485848
486106
|
request,
|
|
485849
486107
|
title,
|
|
485850
486108
|
toolInputSummary,
|
|
485851
|
-
resolve:
|
|
486109
|
+
resolve: resolve38,
|
|
485852
486110
|
reject: reject2
|
|
485853
486111
|
}]);
|
|
485854
486112
|
}), []);
|
|
@@ -491827,7 +492085,7 @@ function buildPrimarySection() {
|
|
|
491827
492085
|
}, undefined, false, undefined, this);
|
|
491828
492086
|
return [{
|
|
491829
492087
|
label: "Version",
|
|
491830
|
-
value: "0.4.
|
|
492088
|
+
value: "0.4.20"
|
|
491831
492089
|
}, {
|
|
491832
492090
|
label: "Session name",
|
|
491833
492091
|
value: nameValue
|
|
@@ -497951,7 +498209,7 @@ var init_useTurnDiffs = __esm(() => {
|
|
|
497951
498209
|
});
|
|
497952
498210
|
|
|
497953
498211
|
// src/cli/components/diff/DiffDetailView.tsx
|
|
497954
|
-
import { resolve as
|
|
498212
|
+
import { resolve as resolve38 } from "path";
|
|
497955
498213
|
function DiffDetailView(t0) {
|
|
497956
498214
|
const $2 = import_react_compiler_runtime243.c(53);
|
|
497957
498215
|
const {
|
|
@@ -497984,7 +498242,7 @@ function DiffDetailView(t0) {
|
|
|
497984
498242
|
let content;
|
|
497985
498243
|
let t22;
|
|
497986
498244
|
if ($2[1] !== filePath) {
|
|
497987
|
-
const fullPath =
|
|
498245
|
+
const fullPath = resolve38(getCwd3(), filePath);
|
|
497988
498246
|
content = readFileSafe(fullPath);
|
|
497989
498247
|
t22 = content?.split(`
|
|
497990
498248
|
`)[0] ?? null;
|
|
@@ -501367,7 +501625,7 @@ function getGithubDeviceFlowClientId() {
|
|
|
501367
501625
|
return process.env.GITHUB_DEVICE_FLOW_CLIENT_ID?.trim() || DEFAULT_GITHUB_DEVICE_FLOW_CLIENT_ID;
|
|
501368
501626
|
}
|
|
501369
501627
|
function sleep4(ms) {
|
|
501370
|
-
return new Promise((
|
|
501628
|
+
return new Promise((resolve39) => setTimeout(resolve39, ms));
|
|
501371
501629
|
}
|
|
501372
501630
|
async function requestDeviceCode(options2) {
|
|
501373
501631
|
const clientId = options2?.clientId ?? getGithubDeviceFlowClientId();
|
|
@@ -511007,7 +511265,7 @@ var init_mcp = __esm(() => {
|
|
|
511007
511265
|
|
|
511008
511266
|
// src/capabilities/plugins/parseMarketplaceInput.ts
|
|
511009
511267
|
import { homedir as homedir36 } from "os";
|
|
511010
|
-
import { resolve as
|
|
511268
|
+
import { resolve as resolve39 } from "path";
|
|
511011
511269
|
async function parseMarketplaceInput(input) {
|
|
511012
511270
|
const trimmed = input.trim();
|
|
511013
511271
|
const fs4 = getFsImplementation();
|
|
@@ -511042,7 +511300,7 @@ async function parseMarketplaceInput(input) {
|
|
|
511042
511300
|
const isWindows2 = process.platform === "win32";
|
|
511043
511301
|
const isWindowsPath = isWindows2 && (trimmed.startsWith(".\\") || trimmed.startsWith("..\\") || /^[a-zA-Z]:[/\\]/.test(trimmed));
|
|
511044
511302
|
if (trimmed.startsWith("../../utils/plugins") || trimmed.startsWith("../../utils") || trimmed.startsWith("/") || trimmed.startsWith("~") || isWindowsPath) {
|
|
511045
|
-
const resolvedPath =
|
|
511303
|
+
const resolvedPath = resolve39(trimmed.startsWith("~") ? trimmed.replace(/^~/, homedir36()) : trimmed);
|
|
511046
511304
|
let stats;
|
|
511047
511305
|
try {
|
|
511048
511306
|
stats = await fs4.stat(resolvedPath);
|
|
@@ -539970,7 +540228,7 @@ var init_bridge_kick = __esm(() => {
|
|
|
539970
540228
|
var call58 = async () => {
|
|
539971
540229
|
return {
|
|
539972
540230
|
type: "text",
|
|
539973
|
-
value: `${"99.0.0"} (built ${"2026-07-
|
|
540231
|
+
value: `${"99.0.0"} (built ${"2026-07-21T10:56:17.312Z"})`
|
|
539974
540232
|
};
|
|
539975
540233
|
}, version2, version_default;
|
|
539976
540234
|
var init_version = __esm(() => {
|
|
@@ -544107,8 +544365,8 @@ async function withStatsCacheLock(fn) {
|
|
|
544107
544365
|
await statsCacheLockPromise;
|
|
544108
544366
|
}
|
|
544109
544367
|
let releaseLock2;
|
|
544110
|
-
statsCacheLockPromise = new Promise((
|
|
544111
|
-
releaseLock2 =
|
|
544368
|
+
statsCacheLockPromise = new Promise((resolve41) => {
|
|
544369
|
+
releaseLock2 = resolve41;
|
|
544112
544370
|
});
|
|
544113
544371
|
try {
|
|
544114
544372
|
return await fn();
|
|
@@ -548454,7 +548712,7 @@ async function scanAllSessions() {
|
|
|
548454
548712
|
});
|
|
548455
548713
|
}
|
|
548456
548714
|
if (i3 % 10 === 9) {
|
|
548457
|
-
await new Promise((
|
|
548715
|
+
await new Promise((resolve41) => setImmediate(resolve41));
|
|
548458
548716
|
}
|
|
548459
548717
|
}
|
|
548460
548718
|
allSessions.sort((a2, b) => b.mtime - a2.mtime);
|
|
@@ -552653,7 +552911,7 @@ __export(exports_UI12, {
|
|
|
552653
552911
|
getToolUseSummary: () => getToolUseSummary11,
|
|
552654
552912
|
countLines: () => countLines
|
|
552655
552913
|
});
|
|
552656
|
-
import { isAbsolute as isAbsolute24, relative as relative31, resolve as
|
|
552914
|
+
import { isAbsolute as isAbsolute24, relative as relative31, resolve as resolve41 } from "path";
|
|
552657
552915
|
function countLines(content) {
|
|
552658
552916
|
const parts = content.split(EOL5);
|
|
552659
552917
|
return content.endsWith(EOL5) ? parts.length - 1 : parts.length;
|
|
@@ -552977,7 +553235,7 @@ function WriteRejectionBody(t0) {
|
|
|
552977
553235
|
}
|
|
552978
553236
|
async function loadRejectionDiff2(filePath, content) {
|
|
552979
553237
|
try {
|
|
552980
|
-
const fullFilePath = isAbsolute24(filePath) ? filePath :
|
|
553238
|
+
const fullFilePath = isAbsolute24(filePath) ? filePath : resolve41(getCwd3(), filePath);
|
|
552981
553239
|
const handle = await openForScan(fullFilePath);
|
|
552982
553240
|
if (handle === null)
|
|
552983
553241
|
return {
|
|
@@ -555735,12 +555993,12 @@ async function getMessagesForSlashCommand(commandName, args, setToolJSX, context
|
|
|
555735
555993
|
try {
|
|
555736
555994
|
switch (command9.type) {
|
|
555737
555995
|
case "local-jsx": {
|
|
555738
|
-
return new Promise((
|
|
555996
|
+
return new Promise((resolve42) => {
|
|
555739
555997
|
let doneWasCalled = false;
|
|
555740
555998
|
const onDone = (result, options2) => {
|
|
555741
555999
|
doneWasCalled = true;
|
|
555742
556000
|
if (options2?.display === "skip") {
|
|
555743
|
-
|
|
556001
|
+
resolve42({
|
|
555744
556002
|
messages: [],
|
|
555745
556003
|
shouldQuery: false,
|
|
555746
556004
|
command: command9,
|
|
@@ -555754,7 +556012,7 @@ async function getMessagesForSlashCommand(commandName, args, setToolJSX, context
|
|
|
555754
556012
|
isMeta: true
|
|
555755
556013
|
}));
|
|
555756
556014
|
const skipTranscript = isFullscreenEnvEnabled() && typeof result === "string" && result.endsWith(" dismissed");
|
|
555757
|
-
|
|
556015
|
+
resolve42({
|
|
555758
556016
|
messages: options2?.display === "system" ? skipTranscript ? metaMessages : [createCommandInputMessage(formatCommandInput(command9, args)), createCommandInputMessage(`<local-command-stdout>${result}</local-command-stdout>`), ...metaMessages] : [createUserMessage({
|
|
555759
556017
|
content: prepareUserContent({
|
|
555760
556018
|
inputString: formatCommandInput(command9, args),
|
|
@@ -555778,7 +556036,7 @@ async function getMessagesForSlashCommand(commandName, args, setToolJSX, context
|
|
|
555778
556036
|
if (jsx == null)
|
|
555779
556037
|
return;
|
|
555780
556038
|
if (context7.options.isNonInteractiveSession) {
|
|
555781
|
-
|
|
556039
|
+
resolve42({
|
|
555782
556040
|
messages: [],
|
|
555783
556041
|
shouldQuery: false,
|
|
555784
556042
|
command: command9
|
|
@@ -555804,7 +556062,7 @@ async function getMessagesForSlashCommand(commandName, args, setToolJSX, context
|
|
|
555804
556062
|
shouldHidePromptInput: false,
|
|
555805
556063
|
clearLocalJSX: true
|
|
555806
556064
|
});
|
|
555807
|
-
|
|
556065
|
+
resolve42({
|
|
555808
556066
|
messages: [],
|
|
555809
556067
|
shouldQuery: false,
|
|
555810
556068
|
command: command9
|
|
@@ -556788,12 +557046,12 @@ var init_It2SetupPrompt = __esm(() => {
|
|
|
556788
557046
|
});
|
|
556789
557047
|
|
|
556790
557048
|
// src/cli/utils/swarm/it2SetupLauncherImpl.tsx
|
|
556791
|
-
var React161, launchIt2Setup = ({ setToolJSX, tmuxAvailable: tmuxAvailable2 }) => new Promise((
|
|
557049
|
+
var React161, launchIt2Setup = ({ setToolJSX, tmuxAvailable: tmuxAvailable2 }) => new Promise((resolve42) => {
|
|
556792
557050
|
setToolJSX({
|
|
556793
557051
|
jsx: React161.createElement(It2SetupPrompt, {
|
|
556794
557052
|
onDone: (result) => {
|
|
556795
557053
|
setToolJSX(null);
|
|
556796
|
-
|
|
557054
|
+
resolve42(result);
|
|
556797
557055
|
},
|
|
556798
557056
|
tmuxAvailable: tmuxAvailable2
|
|
556799
557057
|
}),
|
|
@@ -557145,8 +557403,8 @@ async function handleMcpjsonServerApprovals(root2) {
|
|
|
557145
557403
|
if (pendingServers.length === 0) {
|
|
557146
557404
|
return;
|
|
557147
557405
|
}
|
|
557148
|
-
await new Promise((
|
|
557149
|
-
const done = () => void
|
|
557406
|
+
await new Promise((resolve42) => {
|
|
557407
|
+
const done = () => void resolve42();
|
|
557150
557408
|
if (pendingServers.length === 1 && pendingServers[0] !== undefined) {
|
|
557151
557409
|
const serverName = pendingServers[0];
|
|
557152
557410
|
root2.render(/* @__PURE__ */ jsx_dev_runtime465.jsxDEV(AppStateProvider, {
|
|
@@ -557737,7 +557995,7 @@ function WelcomeV2() {
|
|
|
557737
557995
|
dimColor: true,
|
|
557738
557996
|
children: [
|
|
557739
557997
|
"v",
|
|
557740
|
-
"0.4.
|
|
557998
|
+
"0.4.20",
|
|
557741
557999
|
" "
|
|
557742
558000
|
]
|
|
557743
558001
|
}, undefined, true, undefined, this)
|
|
@@ -557937,7 +558195,7 @@ function WelcomeV2() {
|
|
|
557937
558195
|
dimColor: true,
|
|
557938
558196
|
children: [
|
|
557939
558197
|
"v",
|
|
557940
|
-
"0.4.
|
|
558198
|
+
"0.4.20",
|
|
557941
558199
|
" "
|
|
557942
558200
|
]
|
|
557943
558201
|
}, undefined, true, undefined, this)
|
|
@@ -558163,7 +558421,7 @@ function AppleTerminalWelcomeV2(t0) {
|
|
|
558163
558421
|
dimColor: true,
|
|
558164
558422
|
children: [
|
|
558165
558423
|
"v",
|
|
558166
|
-
"0.4.
|
|
558424
|
+
"0.4.20",
|
|
558167
558425
|
" "
|
|
558168
558426
|
]
|
|
558169
558427
|
}, undefined, true, undefined, this);
|
|
@@ -558417,7 +558675,7 @@ function AppleTerminalWelcomeV2(t0) {
|
|
|
558417
558675
|
dimColor: true,
|
|
558418
558676
|
children: [
|
|
558419
558677
|
"v",
|
|
558420
|
-
"0.4.
|
|
558678
|
+
"0.4.20",
|
|
558421
558679
|
" "
|
|
558422
558680
|
]
|
|
558423
558681
|
}, undefined, true, undefined, this);
|
|
@@ -559921,8 +560179,8 @@ function completeOnboarding() {
|
|
|
559921
560179
|
}));
|
|
559922
560180
|
}
|
|
559923
560181
|
function showDialog(root2, renderer) {
|
|
559924
|
-
return new Promise((
|
|
559925
|
-
const done = (result) => void
|
|
560182
|
+
return new Promise((resolve42) => {
|
|
560183
|
+
const done = (result) => void resolve42(result);
|
|
559926
560184
|
root2.render(renderer(done));
|
|
559927
560185
|
});
|
|
559928
560186
|
}
|
|
@@ -565065,6 +565323,27 @@ var init_server3 = __esm(() => {
|
|
|
565065
565323
|
};
|
|
565066
565324
|
});
|
|
565067
565325
|
|
|
565326
|
+
// src/cli/entrypoints/mcpToolDefinition.ts
|
|
565327
|
+
async function toMCPToolDefinition(tool, promptOptions) {
|
|
565328
|
+
const inputJSONSchema = tool.inputJSONSchema;
|
|
565329
|
+
let outputSchema32;
|
|
565330
|
+
if (tool.outputSchema) {
|
|
565331
|
+
const convertedSchema = zodToJsonSchema3(tool.outputSchema);
|
|
565332
|
+
if (typeof convertedSchema === "object" && convertedSchema !== null && "type" in convertedSchema && convertedSchema.type === "object") {
|
|
565333
|
+
outputSchema32 = convertedSchema;
|
|
565334
|
+
}
|
|
565335
|
+
}
|
|
565336
|
+
return {
|
|
565337
|
+
name: tool.name,
|
|
565338
|
+
description: await tool.prompt(promptOptions),
|
|
565339
|
+
inputSchema: inputJSONSchema ?? zodToJsonSchema3(tool.inputSchema),
|
|
565340
|
+
...outputSchema32 && { outputSchema: outputSchema32 }
|
|
565341
|
+
};
|
|
565342
|
+
}
|
|
565343
|
+
var init_mcpToolDefinition = __esm(() => {
|
|
565344
|
+
init_zodToJsonSchema2();
|
|
565345
|
+
});
|
|
565346
|
+
|
|
565068
565347
|
// src/cli/entrypoints/mcp.ts
|
|
565069
565348
|
var exports_mcp2 = {};
|
|
565070
565349
|
__export(exports_mcp2, {
|
|
@@ -565086,25 +565365,11 @@ async function startMCPServer(cwd, debug, verbose) {
|
|
|
565086
565365
|
const toolPermissionContext = getEmptyToolPermissionContext2();
|
|
565087
565366
|
const tools = getTools(toolPermissionContext);
|
|
565088
565367
|
return {
|
|
565089
|
-
tools: await Promise.all(tools.map(
|
|
565090
|
-
|
|
565091
|
-
|
|
565092
|
-
|
|
565093
|
-
|
|
565094
|
-
outputSchema32 = convertedSchema;
|
|
565095
|
-
}
|
|
565096
|
-
}
|
|
565097
|
-
return {
|
|
565098
|
-
...tool,
|
|
565099
|
-
description: await tool.prompt({
|
|
565100
|
-
getToolPermissionContext: async () => toolPermissionContext,
|
|
565101
|
-
tools,
|
|
565102
|
-
agents: []
|
|
565103
|
-
}),
|
|
565104
|
-
inputSchema: zodToJsonSchema3(tool.inputSchema),
|
|
565105
|
-
outputSchema: outputSchema32
|
|
565106
|
-
};
|
|
565107
|
-
}))
|
|
565368
|
+
tools: await Promise.all(tools.map((tool) => toMCPToolDefinition(tool, {
|
|
565369
|
+
getToolPermissionContext: async () => toolPermissionContext,
|
|
565370
|
+
tools,
|
|
565371
|
+
agents: []
|
|
565372
|
+
})))
|
|
565108
565373
|
};
|
|
565109
565374
|
});
|
|
565110
565375
|
server.setRequestHandler(CallToolRequestSchema, async ({ params: { name, arguments: args } }) => {
|
|
@@ -565196,7 +565461,7 @@ var init_mcp4 = __esm(() => {
|
|
|
565196
565461
|
init_Shell();
|
|
565197
565462
|
init_slowOperations();
|
|
565198
565463
|
init_toolErrors();
|
|
565199
|
-
|
|
565464
|
+
init_mcpToolDefinition();
|
|
565200
565465
|
if (resolveEnvVar("DISABLE_EXPERIMENTAL_BETAS") === undefined) {
|
|
565201
565466
|
setEnvVar("DISABLE_EXPERIMENTAL_BETAS", "true");
|
|
565202
565467
|
}
|
|
@@ -565377,7 +565642,7 @@ async function mcpDoctorHandler(name, options2) {
|
|
|
565377
565642
|
process.stdout.write(`${formatDoctorReport(report)}
|
|
565378
565643
|
`);
|
|
565379
565644
|
}
|
|
565380
|
-
await new Promise((
|
|
565645
|
+
await new Promise((resolve42) => setTimeout(resolve42, 50));
|
|
565381
565646
|
process.exit(report.summary.blocking > 0 ? 1 : 0);
|
|
565382
565647
|
return;
|
|
565383
565648
|
} catch (error41) {
|
|
@@ -567033,8 +567298,8 @@ class SerialBatchEventUploader {
|
|
|
567033
567298
|
if (items.length === 0)
|
|
567034
567299
|
return;
|
|
567035
567300
|
while (this.pending.length + items.length > this.config.maxQueueSize && !this.closed) {
|
|
567036
|
-
await new Promise((
|
|
567037
|
-
this.backpressureResolvers.push(
|
|
567301
|
+
await new Promise((resolve42) => {
|
|
567302
|
+
this.backpressureResolvers.push(resolve42);
|
|
567038
567303
|
});
|
|
567039
567304
|
}
|
|
567040
567305
|
if (this.closed)
|
|
@@ -567047,8 +567312,8 @@ class SerialBatchEventUploader {
|
|
|
567047
567312
|
return Promise.resolve();
|
|
567048
567313
|
}
|
|
567049
567314
|
this.drain();
|
|
567050
|
-
return new Promise((
|
|
567051
|
-
this.flushResolvers.push(
|
|
567315
|
+
return new Promise((resolve42) => {
|
|
567316
|
+
this.flushResolvers.push(resolve42);
|
|
567052
567317
|
});
|
|
567053
567318
|
}
|
|
567054
567319
|
close() {
|
|
@@ -567059,11 +567324,11 @@ class SerialBatchEventUploader {
|
|
|
567059
567324
|
this.pending = [];
|
|
567060
567325
|
this.sleepResolve?.();
|
|
567061
567326
|
this.sleepResolve = null;
|
|
567062
|
-
for (const
|
|
567063
|
-
|
|
567327
|
+
for (const resolve42 of this.backpressureResolvers)
|
|
567328
|
+
resolve42();
|
|
567064
567329
|
this.backpressureResolvers = [];
|
|
567065
|
-
for (const
|
|
567066
|
-
|
|
567330
|
+
for (const resolve42 of this.flushResolvers)
|
|
567331
|
+
resolve42();
|
|
567067
567332
|
this.flushResolvers = [];
|
|
567068
567333
|
}
|
|
567069
567334
|
async drain() {
|
|
@@ -567098,8 +567363,8 @@ class SerialBatchEventUploader {
|
|
|
567098
567363
|
} finally {
|
|
567099
567364
|
this.draining = false;
|
|
567100
567365
|
if (this.pending.length === 0) {
|
|
567101
|
-
for (const
|
|
567102
|
-
|
|
567366
|
+
for (const resolve42 of this.flushResolvers)
|
|
567367
|
+
resolve42();
|
|
567103
567368
|
this.flushResolvers = [];
|
|
567104
567369
|
}
|
|
567105
567370
|
}
|
|
@@ -567138,16 +567403,16 @@ class SerialBatchEventUploader {
|
|
|
567138
567403
|
releaseBackpressure() {
|
|
567139
567404
|
const resolvers2 = this.backpressureResolvers;
|
|
567140
567405
|
this.backpressureResolvers = [];
|
|
567141
|
-
for (const
|
|
567142
|
-
|
|
567406
|
+
for (const resolve42 of resolvers2)
|
|
567407
|
+
resolve42();
|
|
567143
567408
|
}
|
|
567144
567409
|
sleep(ms) {
|
|
567145
|
-
return new Promise((
|
|
567146
|
-
this.sleepResolve =
|
|
567147
|
-
setTimeout((self2,
|
|
567410
|
+
return new Promise((resolve42) => {
|
|
567411
|
+
this.sleepResolve = resolve42;
|
|
567412
|
+
setTimeout((self2, resolve43) => {
|
|
567148
567413
|
self2.sleepResolve = null;
|
|
567149
|
-
|
|
567150
|
-
}, ms, this,
|
|
567414
|
+
resolve43();
|
|
567415
|
+
}, ms, this, resolve42);
|
|
567151
567416
|
});
|
|
567152
567417
|
}
|
|
567153
567418
|
}
|
|
@@ -574202,8 +574467,8 @@ ${m.text}
|
|
|
574202
574467
|
const controller = new AbortController;
|
|
574203
574468
|
activeOAuthFlows.set(serverName, controller);
|
|
574204
574469
|
let resolveAuthUrl;
|
|
574205
|
-
const authUrlPromise = new Promise((
|
|
574206
|
-
resolveAuthUrl =
|
|
574470
|
+
const authUrlPromise = new Promise((resolve42) => {
|
|
574471
|
+
resolveAuthUrl = resolve42;
|
|
574207
574472
|
});
|
|
574208
574473
|
const oauthPromise = performMCPOAuthFlow(serverName, config3, (url3) => resolveAuthUrl(url3), controller.signal, {
|
|
574209
574474
|
skipBrowserOpen: true,
|
|
@@ -574316,8 +574581,8 @@ ${m.text}
|
|
|
574316
574581
|
});
|
|
574317
574582
|
const service = new OAuthService;
|
|
574318
574583
|
let urlResolver;
|
|
574319
|
-
const urlPromise = new Promise((
|
|
574320
|
-
urlResolver =
|
|
574584
|
+
const urlPromise = new Promise((resolve42) => {
|
|
574585
|
+
urlResolver = resolve42;
|
|
574321
574586
|
});
|
|
574322
574587
|
const flow = service.startOAuthFlow(async (manualUrl, automaticUrl) => {
|
|
574323
574588
|
urlResolver({ manualUrl, automaticUrl });
|
|
@@ -574703,8 +574968,8 @@ function createCanUseToolWithPermissionPrompt(permissionPromptTool) {
|
|
|
574703
574968
|
}
|
|
574704
574969
|
};
|
|
574705
574970
|
}
|
|
574706
|
-
const abortPromise = new Promise((
|
|
574707
|
-
combinedSignal.addEventListener("abort", () =>
|
|
574971
|
+
const abortPromise = new Promise((resolve42) => {
|
|
574972
|
+
combinedSignal.addEventListener("abort", () => resolve42("aborted"), {
|
|
574708
574973
|
once: true
|
|
574709
574974
|
});
|
|
574710
574975
|
});
|
|
@@ -576864,7 +577129,7 @@ async function setupTokenHandler(root2) {
|
|
|
576864
577129
|
const {
|
|
576865
577130
|
ConsoleOAuthFlow: ConsoleOAuthFlow2
|
|
576866
577131
|
} = await Promise.resolve().then(() => (init_ConsoleOAuthFlow(), exports_ConsoleOAuthFlow));
|
|
576867
|
-
await new Promise((
|
|
577132
|
+
await new Promise((resolve42) => {
|
|
576868
577133
|
root2.render(/* @__PURE__ */ jsx_dev_runtime486.jsxDEV(AppStateProvider, {
|
|
576869
577134
|
onChangeAppState,
|
|
576870
577135
|
children: /* @__PURE__ */ jsx_dev_runtime486.jsxDEV(KeybindingSetup, {
|
|
@@ -576888,7 +577153,7 @@ async function setupTokenHandler(root2) {
|
|
|
576888
577153
|
}, undefined, true, undefined, this),
|
|
576889
577154
|
/* @__PURE__ */ jsx_dev_runtime486.jsxDEV(ConsoleOAuthFlow2, {
|
|
576890
577155
|
onDone: () => {
|
|
576891
|
-
|
|
577156
|
+
resolve42();
|
|
576892
577157
|
},
|
|
576893
577158
|
mode: "setup-token",
|
|
576894
577159
|
startingMessage: "This will guide you through long-lived (1-year) auth token setup for your Claude account. Claude subscription required."
|
|
@@ -576924,7 +577189,7 @@ function DoctorWithPlugins(t0) {
|
|
|
576924
577189
|
}
|
|
576925
577190
|
async function doctorHandler(root2) {
|
|
576926
577191
|
logEvent("tengu_doctor_command", {});
|
|
576927
|
-
await new Promise((
|
|
577192
|
+
await new Promise((resolve42) => {
|
|
576928
577193
|
root2.render(/* @__PURE__ */ jsx_dev_runtime486.jsxDEV(AppStateProvider, {
|
|
576929
577194
|
children: /* @__PURE__ */ jsx_dev_runtime486.jsxDEV(KeybindingSetup, {
|
|
576930
577195
|
children: /* @__PURE__ */ jsx_dev_runtime486.jsxDEV(MCPConnectionManager, {
|
|
@@ -576932,7 +577197,7 @@ async function doctorHandler(root2) {
|
|
|
576932
577197
|
isStrictMcpConfig: false,
|
|
576933
577198
|
children: /* @__PURE__ */ jsx_dev_runtime486.jsxDEV(DoctorWithPlugins, {
|
|
576934
577199
|
onDone: () => {
|
|
576935
|
-
|
|
577200
|
+
resolve42();
|
|
576936
577201
|
}
|
|
576937
577202
|
}, undefined, false, undefined, this)
|
|
576938
577203
|
}, undefined, false, undefined, this)
|
|
@@ -576950,14 +577215,14 @@ async function installHandler(target, options2) {
|
|
|
576950
577215
|
const {
|
|
576951
577216
|
install: install2
|
|
576952
577217
|
} = await Promise.resolve().then(() => (init_install(), exports_install));
|
|
576953
|
-
await new Promise((
|
|
577218
|
+
await new Promise((resolve42) => {
|
|
576954
577219
|
const args = [];
|
|
576955
577220
|
if (target)
|
|
576956
577221
|
args.push(target);
|
|
576957
577222
|
if (options2.force)
|
|
576958
577223
|
args.push("--force");
|
|
576959
577224
|
install2.call((result) => {
|
|
576960
|
-
|
|
577225
|
+
resolve42();
|
|
576961
577226
|
process.exit(result.includes("failed") ? 1 : 0);
|
|
576962
577227
|
}, {}, args);
|
|
576963
577228
|
});
|
|
@@ -577403,7 +577668,7 @@ __export(exports_main, {
|
|
|
577403
577668
|
main: () => main
|
|
577404
577669
|
});
|
|
577405
577670
|
import { readFileSync as readFileSync7 } from "fs";
|
|
577406
|
-
import { resolve as
|
|
577671
|
+
import { resolve as resolve42 } from "path";
|
|
577407
577672
|
function logManagedSettings() {
|
|
577408
577673
|
try {
|
|
577409
577674
|
const policySettings = getSettingsForSource("policySettings");
|
|
@@ -577960,12 +578225,12 @@ ${getTmuxInstallInstructions2()}
|
|
|
577960
578225
|
process.exit(1);
|
|
577961
578226
|
}
|
|
577962
578227
|
try {
|
|
577963
|
-
const filePath =
|
|
578228
|
+
const filePath = resolve42(options2.systemPromptFile);
|
|
577964
578229
|
systemPrompt = readFileSync7(filePath, "utf8");
|
|
577965
578230
|
} catch (error41) {
|
|
577966
578231
|
const code = getErrnoCode(error41);
|
|
577967
578232
|
if (code === "ENOENT") {
|
|
577968
|
-
process.stderr.write(source_default.red(`Error: System prompt file not found: ${
|
|
578233
|
+
process.stderr.write(source_default.red(`Error: System prompt file not found: ${resolve42(options2.systemPromptFile)}
|
|
577969
578234
|
`));
|
|
577970
578235
|
process.exit(1);
|
|
577971
578236
|
}
|
|
@@ -577982,12 +578247,12 @@ ${getTmuxInstallInstructions2()}
|
|
|
577982
578247
|
process.exit(1);
|
|
577983
578248
|
}
|
|
577984
578249
|
try {
|
|
577985
|
-
const filePath =
|
|
578250
|
+
const filePath = resolve42(options2.appendSystemPromptFile);
|
|
577986
578251
|
appendSystemPrompt = readFileSync7(filePath, "utf8");
|
|
577987
578252
|
} catch (error41) {
|
|
577988
578253
|
const code = getErrnoCode(error41);
|
|
577989
578254
|
if (code === "ENOENT") {
|
|
577990
|
-
process.stderr.write(source_default.red(`Error: Append system prompt file not found: ${
|
|
578255
|
+
process.stderr.write(source_default.red(`Error: Append system prompt file not found: ${resolve42(options2.appendSystemPromptFile)}
|
|
577991
578256
|
`));
|
|
577992
578257
|
process.exit(1);
|
|
577993
578258
|
}
|
|
@@ -578033,7 +578298,7 @@ ${addendum}` : addendum;
|
|
|
578033
578298
|
errors4 = result.errors;
|
|
578034
578299
|
}
|
|
578035
578300
|
} else {
|
|
578036
|
-
const configPath =
|
|
578301
|
+
const configPath = resolve42(configItem);
|
|
578037
578302
|
const result = parseMcpConfigFromFilePath({
|
|
578038
578303
|
filePath: configPath,
|
|
578039
578304
|
expandVars: true,
|
|
@@ -578783,8 +579048,8 @@ ${customInstructions}` : customInstructions;
|
|
|
578783
579048
|
return connectMcpBatch(dedupedClaudeAi, "claudeai");
|
|
578784
579049
|
});
|
|
578785
579050
|
let claudeaiTimer;
|
|
578786
|
-
const claudeaiTimedOut = await Promise.race([claudeaiConnect.then(() => false), new Promise((
|
|
578787
|
-
claudeaiTimer = setTimeout((r) => r(true), CLAUDE_AI_MCP_TIMEOUT_MS,
|
|
579051
|
+
const claudeaiTimedOut = await Promise.race([claudeaiConnect.then(() => false), new Promise((resolve43) => {
|
|
579052
|
+
claudeaiTimer = setTimeout((r) => r(true), CLAUDE_AI_MCP_TIMEOUT_MS, resolve43);
|
|
578788
579053
|
})]);
|
|
578789
579054
|
if (claudeaiTimer)
|
|
578790
579055
|
clearTimeout(claudeaiTimer);
|
|
@@ -579255,7 +579520,7 @@ Usage: claude --remote "your task description"`, () => gracefulShutdown(1));
|
|
|
579255
579520
|
}
|
|
579256
579521
|
}
|
|
579257
579522
|
if (options2.resume && typeof options2.resume === "string" && !maybeSessionId) {
|
|
579258
|
-
const resolvedPath =
|
|
579523
|
+
const resolvedPath = resolve42(options2.resume);
|
|
579259
579524
|
try {
|
|
579260
579525
|
const resumeStart = performance.now();
|
|
579261
579526
|
let logOption;
|
|
@@ -579399,7 +579664,7 @@ Usage: claude --remote "your task description"`, () => gracefulShutdown(1));
|
|
|
579399
579664
|
pendingHookMessages
|
|
579400
579665
|
}, renderAndRun);
|
|
579401
579666
|
}
|
|
579402
|
-
}).version("0.4.
|
|
579667
|
+
}).version("0.4.20 (OpenCow)", "-v, --version", "Output the version number");
|
|
579403
579668
|
program2.option("-w, --worktree [name]", "Create a new git worktree for this session (optionally specify a name)");
|
|
579404
579669
|
program2.option("--tmux", "Create a tmux session for the worktree (requires --worktree). Uses iTerm2 native panes when available; use --tmux=classic for traditional tmux.");
|
|
579405
579670
|
if (canUserConfigureAdvisor()) {
|
|
@@ -580044,7 +580309,7 @@ if (false) {}
|
|
|
580044
580309
|
async function main2() {
|
|
580045
580310
|
const args = process.argv.slice(2);
|
|
580046
580311
|
if (args.length === 1 && (args[0] === "--version" || args[0] === "-v" || args[0] === "-V")) {
|
|
580047
|
-
console.log(`${"0.4.
|
|
580312
|
+
console.log(`${"0.4.20"} (OpenCow)`);
|
|
580048
580313
|
return;
|
|
580049
580314
|
}
|
|
580050
580315
|
if (args.includes("--provider")) {
|
|
@@ -580162,4 +580427,4 @@ async function main2() {
|
|
|
580162
580427
|
}
|
|
580163
580428
|
main2();
|
|
580164
580429
|
|
|
580165
|
-
//# debugId=
|
|
580430
|
+
//# debugId=ED002285A2B093B464756E2164756E21
|