@cnwenf/occ 2.1.274 → 2.1.276
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/README.zh-CN.md +2 -2
- package/dist/cli.js +1001 -575
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
globalThis.MACRO={"VERSION":"2.1.
|
|
2
|
+
globalThis.MACRO={"VERSION":"2.1.276","BUILD_TIME":"2026-07-19T13:44:59.054Z","FEEDBACK_CHANNEL":"","ISSUES_EXPLAINER":"","NATIVE_PACKAGE_URL":"","PACKAGE_URL":"@cnwenf/occ","VERSION_CHANGELOG":""};
|
|
3
3
|
// @bun
|
|
4
4
|
var __create = Object.create;
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
@@ -60197,6 +60197,31 @@ function parseSettingsFile(path9) {
|
|
|
60197
60197
|
function parseSettingsFileUncached(path9) {
|
|
60198
60198
|
try {
|
|
60199
60199
|
const { resolvedPath } = safeResolvePath(getFsImplementation(), path9);
|
|
60200
|
+
const stats = getFsImplementation().statSync(resolvedPath);
|
|
60201
|
+
if (!stats.isFile()) {
|
|
60202
|
+
return {
|
|
60203
|
+
settings: null,
|
|
60204
|
+
errors: [
|
|
60205
|
+
{
|
|
60206
|
+
file: path9,
|
|
60207
|
+
path: "",
|
|
60208
|
+
message: `Cannot use settings file (Not a regular file (device, FIFO, or socket)): ${path9}`
|
|
60209
|
+
}
|
|
60210
|
+
]
|
|
60211
|
+
};
|
|
60212
|
+
}
|
|
60213
|
+
if (stats.size > MAX_SETTINGS_FILE_BYTES) {
|
|
60214
|
+
return {
|
|
60215
|
+
settings: null,
|
|
60216
|
+
errors: [
|
|
60217
|
+
{
|
|
60218
|
+
file: path9,
|
|
60219
|
+
path: "",
|
|
60220
|
+
message: `Settings file exceeds the 2MiB limit: ${path9}`
|
|
60221
|
+
}
|
|
60222
|
+
]
|
|
60223
|
+
};
|
|
60224
|
+
}
|
|
60200
60225
|
const content = readFileSync4(resolvedPath);
|
|
60201
60226
|
if (content.trim() === "") {
|
|
60202
60227
|
return { settings: {}, errors: [] };
|
|
@@ -60807,7 +60832,7 @@ function isClientPresenceFileActive() {
|
|
|
60807
60832
|
return false;
|
|
60808
60833
|
}
|
|
60809
60834
|
}
|
|
60810
|
-
var isLoadingSettings = false, getSettings_DEPRECATED, autoModeUntrustedSourceWarningEmitted = false, VERSION_GATE_SKIP_COMMANDS, ORG_DEFAULT_MODEL_LABEL = " \xB7 Org default", ORG_MODEL_RESTRICTION_REASON = "is not permitted by the org model restrictions (availableModels allowlist or model_access entitlement)", scriptCapsCache;
|
|
60835
|
+
var MAX_SETTINGS_FILE_BYTES, isLoadingSettings = false, getSettings_DEPRECATED, autoModeUntrustedSourceWarningEmitted = false, VERSION_GATE_SKIP_COMMANDS, ORG_DEFAULT_MODEL_LABEL = " \xB7 Org default", ORG_MODEL_RESTRICTION_REASON = "is not permitted by the org model restrictions (availableModels allowlist or model_access entitlement)", scriptCapsCache;
|
|
60811
60836
|
var init_settings2 = __esm(() => {
|
|
60812
60837
|
init_featureFlags();
|
|
60813
60838
|
init_mergeWith();
|
|
@@ -60836,6 +60861,7 @@ var init_settings2 = __esm(() => {
|
|
|
60836
60861
|
init_settingsCache();
|
|
60837
60862
|
init_types2();
|
|
60838
60863
|
init_validation2();
|
|
60864
|
+
MAX_SETTINGS_FILE_BYTES = 2 * 1024 * 1024;
|
|
60839
60865
|
getSettings_DEPRECATED = getInitialSettings;
|
|
60840
60866
|
VERSION_GATE_SKIP_COMMANDS = new Set(["update", "install", "doctor"]);
|
|
60841
60867
|
});
|
|
@@ -162083,6 +162109,29 @@ function quoteProblematicValues(frontmatterText) {
|
|
|
162083
162109
|
return result.join(`
|
|
162084
162110
|
`);
|
|
162085
162111
|
}
|
|
162112
|
+
function quoteHashCommentValues(frontmatterText) {
|
|
162113
|
+
const lines = frontmatterText.split(`
|
|
162114
|
+
`);
|
|
162115
|
+
const result = [];
|
|
162116
|
+
for (const line of lines) {
|
|
162117
|
+
const match = line.match(/^([a-zA-Z_-]+):\s+(.+)$/);
|
|
162118
|
+
if (match) {
|
|
162119
|
+
const [, key, value] = match;
|
|
162120
|
+
if (key && value) {
|
|
162121
|
+
const alreadyQuoted = value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'");
|
|
162122
|
+
const hasCommentHash = value.startsWith("#") || /\s#/.test(value);
|
|
162123
|
+
if (!alreadyQuoted && hasCommentHash) {
|
|
162124
|
+
const escaped = value.replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
|
|
162125
|
+
result.push(`${key}: "${escaped}"`);
|
|
162126
|
+
continue;
|
|
162127
|
+
}
|
|
162128
|
+
}
|
|
162129
|
+
}
|
|
162130
|
+
result.push(line);
|
|
162131
|
+
}
|
|
162132
|
+
return result.join(`
|
|
162133
|
+
`);
|
|
162134
|
+
}
|
|
162086
162135
|
function parseFrontmatter(markdown, sourcePath) {
|
|
162087
162136
|
const match = markdown.match(FRONTMATTER_REGEX);
|
|
162088
162137
|
if (!match) {
|
|
@@ -162094,8 +162143,9 @@ function parseFrontmatter(markdown, sourcePath) {
|
|
|
162094
162143
|
const frontmatterText = match[1] || "";
|
|
162095
162144
|
const content = markdown.slice(match[0].length);
|
|
162096
162145
|
let frontmatter = {};
|
|
162146
|
+
const preprocessedText = quoteHashCommentValues(frontmatterText);
|
|
162097
162147
|
try {
|
|
162098
|
-
const parsed = parseYaml(
|
|
162148
|
+
const parsed = parseYaml(preprocessedText);
|
|
162099
162149
|
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
162100
162150
|
frontmatter = parsed;
|
|
162101
162151
|
}
|
|
@@ -252192,6 +252242,7 @@ function subprocessEnv() {
|
|
|
252192
252242
|
process.env.CLAUDE_CODE_SESSION_ID = sid;
|
|
252193
252243
|
}
|
|
252194
252244
|
}
|
|
252245
|
+
process.env.CLAUDE_PID = String(process.pid);
|
|
252195
252246
|
const proxyEnv = _getUpstreamProxyEnv?.() ?? {};
|
|
252196
252247
|
if (!isEnvTruthy(process.env.CLAUDE_CODE_SUBPROCESS_ENV_SCRUB)) {
|
|
252197
252248
|
const baseEnv = Object.keys(proxyEnv).length > 0 ? { ...process.env, ...proxyEnv } : { ...process.env };
|
|
@@ -252411,6 +252462,37 @@ ${findGrepIntegration}
|
|
|
252411
252462
|
FIND_GREP_FUNC_END
|
|
252412
252463
|
`;
|
|
252413
252464
|
}
|
|
252465
|
+
content += `
|
|
252466
|
+
# M8 (2.1.214): pkill -f self-match shim
|
|
252467
|
+
cat >> "$SNAPSHOT_FILE" << 'PKILL_SHIM_END'
|
|
252468
|
+
function pkill() {
|
|
252469
|
+
local _pattern=""
|
|
252470
|
+
local _arg
|
|
252471
|
+
local _skip_next=0
|
|
252472
|
+
for _arg in "$@"; do
|
|
252473
|
+
if [ "$_skip_next" -eq 1 ]; then
|
|
252474
|
+
_skip_next=0
|
|
252475
|
+
continue
|
|
252476
|
+
fi
|
|
252477
|
+
case "$_arg" in
|
|
252478
|
+
--signal) _skip_next=1 ;;
|
|
252479
|
+
--signal=*) ;;
|
|
252480
|
+
-[0-9]*) ;;
|
|
252481
|
+
-[PUGOF]*) ;;
|
|
252482
|
+
-[A-Z]*) ;;
|
|
252483
|
+
--*) ;;
|
|
252484
|
+
-*) ;;
|
|
252485
|
+
*) if [ -z "$_pattern" ]; then _pattern="$_arg"; fi ;;
|
|
252486
|
+
esac
|
|
252487
|
+
done
|
|
252488
|
+
if [ -n "\${CLAUDE_PID}" ] && [ -n "$_pattern" ] && pgrep -f "$_pattern" 2>/dev/null | grep -qx "$CLAUDE_PID"; then
|
|
252489
|
+
printf 'pkill: refusing to run \xE2\x80\x94 this pattern matches the Claude CLI process (PID %s). Narrow the pattern, or target your own children with \`pkill -P $$ ...\`.\\n' "$CLAUDE_PID" >&2
|
|
252490
|
+
return 1
|
|
252491
|
+
fi
|
|
252492
|
+
command pkill "$@"
|
|
252493
|
+
}
|
|
252494
|
+
PKILL_SHIM_END
|
|
252495
|
+
`;
|
|
252414
252496
|
content += `
|
|
252415
252497
|
|
|
252416
252498
|
# Add PATH to the file
|
|
@@ -379162,7 +379244,6 @@ var init_readOnlyValidation = __esm(() => {
|
|
|
379162
379244
|
"--exclude-quiet": "string",
|
|
379163
379245
|
"--print0": "none",
|
|
379164
379246
|
"-0": "none",
|
|
379165
|
-
"-f": "string",
|
|
379166
379247
|
"-F": "string",
|
|
379167
379248
|
"--separator": "string",
|
|
379168
379249
|
"--help": "none",
|
|
@@ -379172,8 +379253,6 @@ var init_readOnlyValidation = __esm(() => {
|
|
|
379172
379253
|
"-h": "none",
|
|
379173
379254
|
"--dereference": "none",
|
|
379174
379255
|
"-L": "none",
|
|
379175
|
-
"--magic-file": "string",
|
|
379176
|
-
"-m": "string",
|
|
379177
379256
|
"--keep-going": "none",
|
|
379178
379257
|
"-k": "none",
|
|
379179
379258
|
"--list": "none",
|
|
@@ -382559,7 +382638,7 @@ function checkBashRedirectAndPatternSafety(input, toolPermissionContext, astRedi
|
|
|
382559
382638
|
let outputRedirects;
|
|
382560
382639
|
let inputRedirects;
|
|
382561
382640
|
if (astRedirects && astRedirects.length > 0) {
|
|
382562
|
-
const isOutput =
|
|
382641
|
+
const isOutput = isOutputRedirectOp;
|
|
382563
382642
|
outputRedirects = astRedirects.filter((r4) => isOutput(r4.op)).map((r4) => ({ op: r4.op, target: r4.target }));
|
|
382564
382643
|
inputRedirects = astRedirects.filter((r4) => r4.op === "<" || r4.op === "<&" || r4.op === "<>").map((r4) => ({ op: r4.op, target: r4.target }));
|
|
382565
382644
|
} else {
|
|
@@ -382898,6 +382977,85 @@ function filterRulesByContentsMatchingInput(input, rules, matchMode, {
|
|
|
382898
382977
|
});
|
|
382899
382978
|
}).map(([, rule]) => rule);
|
|
382900
382979
|
}
|
|
382980
|
+
function tokenizeForFlags(command4) {
|
|
382981
|
+
const tokens = [];
|
|
382982
|
+
let cur = "";
|
|
382983
|
+
let quote2 = "";
|
|
382984
|
+
for (let i6 = 0;i6 < command4.length; i6++) {
|
|
382985
|
+
const c9 = command4[i6];
|
|
382986
|
+
if (quote2) {
|
|
382987
|
+
if (c9 === quote2)
|
|
382988
|
+
quote2 = "";
|
|
382989
|
+
else
|
|
382990
|
+
cur += c9;
|
|
382991
|
+
continue;
|
|
382992
|
+
}
|
|
382993
|
+
if (c9 === "'" || c9 === '"') {
|
|
382994
|
+
quote2 = c9;
|
|
382995
|
+
continue;
|
|
382996
|
+
}
|
|
382997
|
+
if (c9 === "&" && command4[i6 + 1] === "&") {
|
|
382998
|
+
if (cur) {
|
|
382999
|
+
tokens.push(cur);
|
|
383000
|
+
cur = "";
|
|
383001
|
+
}
|
|
383002
|
+
tokens.push("&&");
|
|
383003
|
+
i6++;
|
|
383004
|
+
continue;
|
|
383005
|
+
}
|
|
383006
|
+
if (c9 === ";" || c9 === "|" || c9 === "(") {
|
|
383007
|
+
if (cur) {
|
|
383008
|
+
tokens.push(cur);
|
|
383009
|
+
cur = "";
|
|
383010
|
+
}
|
|
383011
|
+
tokens.push(c9);
|
|
383012
|
+
continue;
|
|
383013
|
+
}
|
|
383014
|
+
if (c9 === " " || c9 === "\t" || c9 === `
|
|
383015
|
+
`) {
|
|
383016
|
+
if (cur) {
|
|
383017
|
+
tokens.push(cur);
|
|
383018
|
+
cur = "";
|
|
383019
|
+
}
|
|
383020
|
+
continue;
|
|
383021
|
+
}
|
|
383022
|
+
cur += c9;
|
|
383023
|
+
}
|
|
383024
|
+
if (cur)
|
|
383025
|
+
tokens.push(cur);
|
|
383026
|
+
return tokens;
|
|
383027
|
+
}
|
|
383028
|
+
function hasDockerDaemonRedirectFlag(command4) {
|
|
383029
|
+
if (!command4)
|
|
383030
|
+
return false;
|
|
383031
|
+
const tokens = tokenizeForFlags(command4);
|
|
383032
|
+
let commandStart = true;
|
|
383033
|
+
for (let i6 = 0;i6 < tokens.length; i6++) {
|
|
383034
|
+
const t4 = tokens[i6];
|
|
383035
|
+
if (SEPARATOR_TOKENS.has(t4)) {
|
|
383036
|
+
commandStart = true;
|
|
383037
|
+
continue;
|
|
383038
|
+
}
|
|
383039
|
+
if (commandStart && (t4 === "docker" || t4 === "podman")) {
|
|
383040
|
+
for (let j5 = i6 + 1;j5 < tokens.length; j5++) {
|
|
383041
|
+
const a5 = tokens[j5];
|
|
383042
|
+
if (SEPARATOR_TOKENS.has(a5))
|
|
383043
|
+
break;
|
|
383044
|
+
if (a5 === "--url" || a5.startsWith("--url="))
|
|
383045
|
+
return true;
|
|
383046
|
+
if (a5 === "--connection" || a5.startsWith("--connection="))
|
|
383047
|
+
return true;
|
|
383048
|
+
if (a5 === "--identity" || a5.startsWith("--identity="))
|
|
383049
|
+
return true;
|
|
383050
|
+
if (t4 === "podman" && (a5 === "--remote" || a5.startsWith("--remote="))) {
|
|
383051
|
+
return true;
|
|
383052
|
+
}
|
|
383053
|
+
}
|
|
383054
|
+
}
|
|
383055
|
+
commandStart = false;
|
|
383056
|
+
}
|
|
383057
|
+
return false;
|
|
383058
|
+
}
|
|
382901
383059
|
function matchingRulesForInput(input, toolPermissionContext, matchMode, { skipCompoundCheck = false } = {}) {
|
|
382902
383060
|
const denyRuleByContents = getRuleByContentsForTool(toolPermissionContext, BashTool, "deny");
|
|
382903
383061
|
const matchingDenyRules = filterRulesByContentsMatchingInput(input, denyRuleByContents, matchMode, { stripAllEnvVars: true, skipCompoundCheck: true });
|
|
@@ -382906,10 +383064,11 @@ function matchingRulesForInput(input, toolPermissionContext, matchMode, { skipCo
|
|
|
382906
383064
|
const allowRuleByContents = getRuleByContentsForTool(toolPermissionContext, BashTool, "allow");
|
|
382907
383065
|
const suspendAllowRules = toolPermissionContext.mode === "auto" && isAutoModeClassifyAllShellEnabled();
|
|
382908
383066
|
const matchingAllowRules = suspendAllowRules ? [] : filterRulesByContentsMatchingInput(input, allowRuleByContents, matchMode, { skipCompoundCheck });
|
|
383067
|
+
const dockerRedirectOverridesAllow = matchingAllowRules.length > 0 && hasDockerDaemonRedirectFlag(input.command);
|
|
382909
383068
|
return {
|
|
382910
383069
|
matchingDenyRules,
|
|
382911
383070
|
matchingAskRules,
|
|
382912
|
-
matchingAllowRules
|
|
383071
|
+
matchingAllowRules: dockerRedirectOverridesAllow ? [] : matchingAllowRules
|
|
382913
383072
|
};
|
|
382914
383073
|
}
|
|
382915
383074
|
async function checkCommandAndSuggestRules(input, toolPermissionContext, commandPrefixResult, compoundCommandHasCd, astParseSucceeded) {
|
|
@@ -383135,6 +383294,42 @@ async function executeAsyncClassifierCheck(pendingCheck, signal, isNonInteractiv
|
|
|
383135
383294
|
callbacks.onComplete?.();
|
|
383136
383295
|
}
|
|
383137
383296
|
}
|
|
383297
|
+
function shouldPromptForCommandLength(command4) {
|
|
383298
|
+
return command4.length > MAX_COMMAND_LENGTH_PROMPT;
|
|
383299
|
+
}
|
|
383300
|
+
function isOutputRedirectOp(op) {
|
|
383301
|
+
return op.includes(">") && !op.includes("<");
|
|
383302
|
+
}
|
|
383303
|
+
function hasZshSubscriptInConditional(command4) {
|
|
383304
|
+
if (!command4.includes("[["))
|
|
383305
|
+
return false;
|
|
383306
|
+
if (/\$\{[^}]*\[/.test(command4))
|
|
383307
|
+
return true;
|
|
383308
|
+
if (/\$\{#/.test(command4))
|
|
383309
|
+
return true;
|
|
383310
|
+
if (/\$\{[^}]*:[^}]*:/.test(command4))
|
|
383311
|
+
return true;
|
|
383312
|
+
return false;
|
|
383313
|
+
}
|
|
383314
|
+
function hasUnsafeHelpManForm(command4) {
|
|
383315
|
+
if (!command4)
|
|
383316
|
+
return false;
|
|
383317
|
+
const tokens = tokenizeForFlags(command4);
|
|
383318
|
+
let commandStart = true;
|
|
383319
|
+
for (const t4 of tokens) {
|
|
383320
|
+
if (SEPARATOR_TOKENS.has(t4)) {
|
|
383321
|
+
commandStart = true;
|
|
383322
|
+
continue;
|
|
383323
|
+
}
|
|
383324
|
+
if (commandStart && (t4 === "help" || t4 === "man")) {
|
|
383325
|
+
if (command4.includes("$(") || command4.includes("`") || /\\/.test(command4))
|
|
383326
|
+
return true;
|
|
383327
|
+
return false;
|
|
383328
|
+
}
|
|
383329
|
+
commandStart = false;
|
|
383330
|
+
}
|
|
383331
|
+
return false;
|
|
383332
|
+
}
|
|
383138
383333
|
async function bashToolHasPermission(input, context4, getCommandSubcommandPrefixFn = getCommandSubcommandPrefix) {
|
|
383139
383334
|
let appState = context4.getAppState();
|
|
383140
383335
|
{
|
|
@@ -383178,6 +383373,33 @@ async function bashToolHasPermission(input, context4, getCommandSubcommandPrefix
|
|
|
383178
383373
|
}
|
|
383179
383374
|
}
|
|
383180
383375
|
}
|
|
383376
|
+
{
|
|
383377
|
+
const mode = appState.toolPermissionContext.mode;
|
|
383378
|
+
if (mode !== "bypassPermissions" && shouldPromptForCommandLength(input.command)) {
|
|
383379
|
+
return {
|
|
383380
|
+
behavior: "ask",
|
|
383381
|
+
message: `Command exceeds ${MAX_COMMAND_LENGTH_PROMPT} characters; please confirm before running.`
|
|
383382
|
+
};
|
|
383383
|
+
}
|
|
383384
|
+
}
|
|
383385
|
+
{
|
|
383386
|
+
const mode = appState.toolPermissionContext.mode;
|
|
383387
|
+
if (mode !== "bypassPermissions" && hasZshSubscriptInConditional(input.command)) {
|
|
383388
|
+
return {
|
|
383389
|
+
behavior: "ask",
|
|
383390
|
+
message: "zsh subscript/modifier in [[ ]] conditional requires confirmation."
|
|
383391
|
+
};
|
|
383392
|
+
}
|
|
383393
|
+
}
|
|
383394
|
+
{
|
|
383395
|
+
const mode = appState.toolPermissionContext.mode;
|
|
383396
|
+
if (mode !== "bypassPermissions" && hasUnsafeHelpManForm(input.command)) {
|
|
383397
|
+
return {
|
|
383398
|
+
behavior: "ask",
|
|
383399
|
+
message: "help/man with command substitution or backslash path requires confirmation."
|
|
383400
|
+
};
|
|
383401
|
+
}
|
|
383402
|
+
}
|
|
383181
383403
|
const injectionCheckDisabled = isEnvTruthy(process.env.CLAUDE_CODE_DISABLE_COMMAND_INJECTION_CHECK);
|
|
383182
383404
|
const shadowEnabled = feature("TREE_SITTER_BASH_SHADOW") ? getFeatureValue_CACHED_MAY_BE_STALE("tengu_birch_trellis", true) : false;
|
|
383183
383405
|
let astRoot = injectionCheckDisabled ? null : feature("TREE_SITTER_BASH_SHADOW") && !shadowEnabled ? null : await parseCommandRaw(input.command);
|
|
@@ -383622,7 +383844,7 @@ function isNormalizedCdCommand(command4) {
|
|
|
383622
383844
|
function commandHasAnyCd(command4) {
|
|
383623
383845
|
return splitCommand(command4).some((subcmd) => isNormalizedCdCommand(subcmd.trim()));
|
|
383624
383846
|
}
|
|
383625
|
-
var bashCommandIsSafeAsync, splitCommand, ENV_VAR_ASSIGN_RE, SHELL_STARTUP_FILES, DEV_NETWORK_REDIRECT_RE, BUILD_TOOL_CONFIG_FILES, MAX_SUBCOMMANDS_FOR_SECURITY_CHECK = 50, MAX_SUGGESTED_RULES_FOR_COMPOUND = 5, BARE_SHELL_PREFIXES, permissionRuleExtractPrefix3, bashPermissionRule, SAFE_ENV_VARS2, ANT_ONLY_SAFE_ENV_VARS, BINARY_HIJACK_VARS, bashToolCheckExactMatchPermission = (input, toolPermissionContext) => {
|
|
383847
|
+
var bashCommandIsSafeAsync, splitCommand, ENV_VAR_ASSIGN_RE, SHELL_STARTUP_FILES, DEV_NETWORK_REDIRECT_RE, BUILD_TOOL_CONFIG_FILES, MAX_SUBCOMMANDS_FOR_SECURITY_CHECK = 50, MAX_SUGGESTED_RULES_FOR_COMPOUND = 5, BARE_SHELL_PREFIXES, permissionRuleExtractPrefix3, bashPermissionRule, SAFE_ENV_VARS2, ANT_ONLY_SAFE_ENV_VARS, BINARY_HIJACK_VARS, SEPARATOR_TOKENS, bashToolCheckExactMatchPermission = (input, toolPermissionContext) => {
|
|
383626
383848
|
const command4 = input.command.trim();
|
|
383627
383849
|
const { matchingDenyRules, matchingAskRules, matchingAllowRules } = matchingRulesForInput(input, toolPermissionContext, "exact");
|
|
383628
383850
|
if (matchingDenyRules[0] !== undefined) {
|
|
@@ -383743,7 +383965,7 @@ var bashCommandIsSafeAsync, splitCommand, ENV_VAR_ASSIGN_RE, SHELL_STARTUP_FILES
|
|
|
383743
383965
|
decisionReason,
|
|
383744
383966
|
suggestions: suggestionForExactCommand2(command4)
|
|
383745
383967
|
};
|
|
383746
|
-
}, speculativeChecks;
|
|
383968
|
+
}, speculativeChecks, MAX_COMMAND_LENGTH_PROMPT = 1e4;
|
|
383747
383969
|
var init_bashPermissions = __esm(() => {
|
|
383748
383970
|
init_featureFlags();
|
|
383749
383971
|
init_sdk();
|
|
@@ -383908,6 +384130,7 @@ var init_bashPermissions = __esm(() => {
|
|
|
383908
384130
|
"GROWTHBOOK_API_KEY"
|
|
383909
384131
|
]);
|
|
383910
384132
|
BINARY_HIJACK_VARS = /^(LD_|DYLD_|PATH$)/;
|
|
384133
|
+
SEPARATOR_TOKENS = new Set(["&&", ";", "|", "("]);
|
|
383911
384134
|
speculativeChecks = new Map;
|
|
383912
384135
|
});
|
|
383913
384136
|
|
|
@@ -589820,6 +590043,131 @@ var init_toolErrors = __esm(() => {
|
|
|
589820
590043
|
init_messages3();
|
|
589821
590044
|
});
|
|
589822
590045
|
|
|
590046
|
+
// src/memdir/memorySaveNormalizer.ts
|
|
590047
|
+
import { readFileSync as readFileSync28, writeFileSync as writeFileSync12 } from "fs";
|
|
590048
|
+
import { dirname as dirname45, normalize as normalize13, relative as relative21, resolve as resolve45, sep as sep32 } from "path";
|
|
590049
|
+
function injectModifiedFrontmatter(raw, iso) {
|
|
590050
|
+
const m5 = raw.match(FRONTMATTER_REGEX);
|
|
590051
|
+
if (!m5 || m5.index === undefined) {
|
|
590052
|
+
return `---
|
|
590053
|
+
modified: ${iso}
|
|
590054
|
+
---
|
|
590055
|
+
|
|
590056
|
+
${raw}`;
|
|
590057
|
+
}
|
|
590058
|
+
const fullBlock = m5[0];
|
|
590059
|
+
const inner = m5[1] ?? "";
|
|
590060
|
+
const newInner = replaceOrInsertModifiedLine(inner, iso);
|
|
590061
|
+
if (newInner === inner) {
|
|
590062
|
+
return raw;
|
|
590063
|
+
}
|
|
590064
|
+
const newBlock = fullBlock.replace(inner, newInner);
|
|
590065
|
+
return raw.slice(0, m5.index) + newBlock + raw.slice(m5.index + fullBlock.length);
|
|
590066
|
+
}
|
|
590067
|
+
function replaceOrInsertModifiedLine(fmText, iso) {
|
|
590068
|
+
const lines2 = fmText.split(`
|
|
590069
|
+
`);
|
|
590070
|
+
for (let i6 = 0;i6 < lines2.length; i6++) {
|
|
590071
|
+
const m5 = lines2[i6].match(/^(\s*modified:\s*)(.*)$/);
|
|
590072
|
+
if (!m5 || m5[1] === undefined || m5[2] === undefined) {
|
|
590073
|
+
continue;
|
|
590074
|
+
}
|
|
590075
|
+
const prefix = m5[1];
|
|
590076
|
+
const rest = m5[2];
|
|
590077
|
+
let valuePart = rest;
|
|
590078
|
+
let commentPart = "";
|
|
590079
|
+
const commentIdx = rest.startsWith("#") ? 0 : rest.search(/\s#/);
|
|
590080
|
+
if (commentIdx >= 0) {
|
|
590081
|
+
valuePart = rest.slice(0, commentIdx);
|
|
590082
|
+
commentPart = rest.slice(commentIdx);
|
|
590083
|
+
}
|
|
590084
|
+
const trimmed = valuePart.trim();
|
|
590085
|
+
const isQuoted = trimmed.startsWith('"') && trimmed.endsWith('"') && trimmed.length >= 2 || trimmed.startsWith("'") && trimmed.endsWith("'") && trimmed.length >= 2;
|
|
590086
|
+
const newValue = isQuoted ? `"${iso}"` : iso;
|
|
590087
|
+
lines2[i6] = `${prefix}${newValue}${commentPart ? ` ${commentPart.trimStart()}` : ""}`;
|
|
590088
|
+
return lines2.join(`
|
|
590089
|
+
`);
|
|
590090
|
+
}
|
|
590091
|
+
lines2.unshift(`modified: ${iso}`);
|
|
590092
|
+
return lines2.join(`
|
|
590093
|
+
`);
|
|
590094
|
+
}
|
|
590095
|
+
function isMemoryFileToNormalize(filePath) {
|
|
590096
|
+
try {
|
|
590097
|
+
const entrypoint = getAutoMemEntrypoint();
|
|
590098
|
+
const memDir = dirname45(entrypoint);
|
|
590099
|
+
const abs = resolve45(filePath);
|
|
590100
|
+
if (normalize13(abs) === normalize13(entrypoint)) {
|
|
590101
|
+
return false;
|
|
590102
|
+
}
|
|
590103
|
+
const rel = relative21(memDir, abs);
|
|
590104
|
+
return rel !== "" && !rel.startsWith("..") && !rel.startsWith(`..${sep32}`);
|
|
590105
|
+
} catch {
|
|
590106
|
+
return false;
|
|
590107
|
+
}
|
|
590108
|
+
}
|
|
590109
|
+
function normalizeMemoryFileModified(filePath) {
|
|
590110
|
+
if (!filePath || !isMemoryFileToNormalize(filePath)) {
|
|
590111
|
+
return;
|
|
590112
|
+
}
|
|
590113
|
+
const key3 = normalize13(resolve45(filePath));
|
|
590114
|
+
if (normalizingPaths.has(key3)) {
|
|
590115
|
+
return;
|
|
590116
|
+
}
|
|
590117
|
+
normalizingPaths.add(key3);
|
|
590118
|
+
try {
|
|
590119
|
+
let raw;
|
|
590120
|
+
try {
|
|
590121
|
+
raw = readFileSync28(filePath, "utf8");
|
|
590122
|
+
} catch {
|
|
590123
|
+
return;
|
|
590124
|
+
}
|
|
590125
|
+
const iso = new Date().toISOString();
|
|
590126
|
+
if (hasCurrentModified(raw, iso)) {
|
|
590127
|
+
return;
|
|
590128
|
+
}
|
|
590129
|
+
const next2 = injectModifiedFrontmatter(raw, iso);
|
|
590130
|
+
if (next2 === raw) {
|
|
590131
|
+
return;
|
|
590132
|
+
}
|
|
590133
|
+
writeFileSync12(filePath, next2, "utf8");
|
|
590134
|
+
} catch (error52) {
|
|
590135
|
+
logForDebugging(`memory save-normalizer failed for ${filePath}: ${error52 instanceof Error ? error52.message : String(error52)}`, { level: "debug" });
|
|
590136
|
+
} finally {
|
|
590137
|
+
normalizingPaths.delete(key3);
|
|
590138
|
+
}
|
|
590139
|
+
}
|
|
590140
|
+
function hasCurrentModified(raw, iso) {
|
|
590141
|
+
const m5 = raw.match(FRONTMATTER_REGEX);
|
|
590142
|
+
if (!m5 || m5[1] === undefined) {
|
|
590143
|
+
return false;
|
|
590144
|
+
}
|
|
590145
|
+
const fmText = m5[1];
|
|
590146
|
+
for (const line of fmText.split(`
|
|
590147
|
+
`)) {
|
|
590148
|
+
const lm = line.match(/^\s*modified:\s*(.*)$/);
|
|
590149
|
+
if (!lm || lm[1] === undefined) {
|
|
590150
|
+
continue;
|
|
590151
|
+
}
|
|
590152
|
+
let rest = lm[1];
|
|
590153
|
+
const commentIdx = rest.startsWith("#") ? 0 : rest.search(/\s#/);
|
|
590154
|
+
if (commentIdx >= 0) {
|
|
590155
|
+
rest = rest.slice(0, commentIdx);
|
|
590156
|
+
}
|
|
590157
|
+
const trimmed = rest.trim();
|
|
590158
|
+
const unquoted = trimmed.startsWith('"') && trimmed.endsWith('"') || trimmed.startsWith("'") && trimmed.endsWith("'") ? trimmed.slice(1, -1) : trimmed;
|
|
590159
|
+
return unquoted === iso;
|
|
590160
|
+
}
|
|
590161
|
+
return false;
|
|
590162
|
+
}
|
|
590163
|
+
var normalizingPaths;
|
|
590164
|
+
var init_memorySaveNormalizer = __esm(() => {
|
|
590165
|
+
init_debug();
|
|
590166
|
+
init_frontmatterParser();
|
|
590167
|
+
init_paths();
|
|
590168
|
+
normalizingPaths = new Set;
|
|
590169
|
+
});
|
|
590170
|
+
|
|
589823
590171
|
// src/utils/permissions/PermissionResult.ts
|
|
589824
590172
|
function getRuleBehaviorDescription(permissionResult) {
|
|
589825
590173
|
switch (permissionResult) {
|
|
@@ -589947,6 +590295,11 @@ async function* runPostToolUseHooks(toolUseContext, tool, toolUseID, messageId,
|
|
|
589947
590295
|
} catch (error52) {
|
|
589948
590296
|
logForDebugging(`memory entrypoint over-cap check failed for ${toolInput.file_path}: ${formatError3(error52)}`, { level: "debug" });
|
|
589949
590297
|
}
|
|
590298
|
+
try {
|
|
590299
|
+
normalizeMemoryFileModified(toolInput.file_path);
|
|
590300
|
+
} catch (error52) {
|
|
590301
|
+
logForDebugging(`memory save-normalizer failed for ${toolInput.file_path}: ${formatError3(error52)}`, { level: "debug" });
|
|
590302
|
+
}
|
|
589950
590303
|
}
|
|
589951
590304
|
} catch (error52) {
|
|
589952
590305
|
logError2(error52);
|
|
@@ -590233,6 +590586,7 @@ var init_toolHooks = __esm(() => {
|
|
|
590233
590586
|
init_analytics();
|
|
590234
590587
|
init_metadata();
|
|
590235
590588
|
init_memdir();
|
|
590589
|
+
init_memorySaveNormalizer();
|
|
590236
590590
|
init_prompt4();
|
|
590237
590591
|
init_attachments2();
|
|
590238
590592
|
init_debug();
|
|
@@ -591480,8 +591834,8 @@ class StreamingToolExecutor {
|
|
|
591480
591834
|
}
|
|
591481
591835
|
if (this.hasExecutingTools() && !this.hasCompletedResults() && !this.hasPendingProgress()) {
|
|
591482
591836
|
const executingPromises = this.tools.filter((t4) => t4.status === "executing" && t4.promise).map((t4) => t4.promise);
|
|
591483
|
-
const progressPromise = new Promise((
|
|
591484
|
-
this.progressAvailableResolve =
|
|
591837
|
+
const progressPromise = new Promise((resolve46) => {
|
|
591838
|
+
this.progressAvailableResolve = resolve46;
|
|
591485
591839
|
});
|
|
591486
591840
|
if (executingPromises.length > 0) {
|
|
591487
591841
|
await Promise.race([...executingPromises, progressPromise]);
|
|
@@ -592708,13 +593062,13 @@ var init_classifier = () => {};
|
|
|
592708
593062
|
|
|
592709
593063
|
// src/utils/withResolvers.ts
|
|
592710
593064
|
function withResolvers() {
|
|
592711
|
-
let
|
|
593065
|
+
let resolve46;
|
|
592712
593066
|
let reject;
|
|
592713
593067
|
const promise2 = new Promise((res, rej) => {
|
|
592714
|
-
|
|
593068
|
+
resolve46 = res;
|
|
592715
593069
|
reject = rej;
|
|
592716
593070
|
});
|
|
592717
|
-
return { promise: promise2, resolve:
|
|
593071
|
+
return { promise: promise2, resolve: resolve46, reject };
|
|
592718
593072
|
}
|
|
592719
593073
|
|
|
592720
593074
|
// src/utils/computerUse/computerUseLock.ts
|
|
@@ -592842,7 +593196,7 @@ var exports_src3 = {};
|
|
|
592842
593196
|
__export(exports_src3, {
|
|
592843
593197
|
ComputerUseAPI: () => ComputerUseAPI
|
|
592844
593198
|
});
|
|
592845
|
-
import { readFileSync as
|
|
593199
|
+
import { readFileSync as readFileSync29, unlinkSync as unlinkSync5 } from "fs";
|
|
592846
593200
|
import { tmpdir as tmpdir11 } from "os";
|
|
592847
593201
|
import { join as join112 } from "path";
|
|
592848
593202
|
function jxaSync(script) {
|
|
@@ -592879,7 +593233,7 @@ async function captureScreenToBase64(args) {
|
|
|
592879
593233
|
});
|
|
592880
593234
|
await proc.exited;
|
|
592881
593235
|
try {
|
|
592882
|
-
const buf =
|
|
593236
|
+
const buf = readFileSync29(tmpFile);
|
|
592883
593237
|
const base644 = buf.toString("base64");
|
|
592884
593238
|
const width = buf.readUInt32BE(16);
|
|
592885
593239
|
const height2 = buf.readUInt32BE(20);
|
|
@@ -596881,7 +597235,7 @@ var init_queryHelpers = __esm(() => {
|
|
|
596881
597235
|
import { randomUUID as randomUUID27 } from "crypto";
|
|
596882
597236
|
import { rm as rm7 } from "fs";
|
|
596883
597237
|
import { appendFile as appendFile5, copyFile as copyFile7, mkdir as mkdir34 } from "fs/promises";
|
|
596884
|
-
import { dirname as
|
|
597238
|
+
import { dirname as dirname46, isAbsolute as isAbsolute26, join as join113, relative as relative22 } from "path";
|
|
596885
597239
|
function safeRemoveOverlay(overlayPath) {
|
|
596886
597240
|
rm7(overlayPath, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 }, () => {});
|
|
596887
597241
|
}
|
|
@@ -596901,7 +597255,7 @@ async function copyOverlayToMain(overlayPath, writtenPaths, cwd2) {
|
|
|
596901
597255
|
const src = join113(overlayPath, rel);
|
|
596902
597256
|
const dest = join113(cwd2, rel);
|
|
596903
597257
|
try {
|
|
596904
|
-
await mkdir34(
|
|
597258
|
+
await mkdir34(dirname46(dest), { recursive: true });
|
|
596905
597259
|
await copyFile7(src, dest);
|
|
596906
597260
|
} catch {
|
|
596907
597261
|
allCopied = false;
|
|
@@ -597132,7 +597486,7 @@ async function startSpeculation(suggestionText, context7, setAppState, isPipelin
|
|
|
597132
597486
|
const pathKey2 = "notebook_path" in input2 ? "notebook_path" : ("path" in input2) ? "path" : "file_path";
|
|
597133
597487
|
const filePath = input2[pathKey2];
|
|
597134
597488
|
if (filePath) {
|
|
597135
|
-
const rel =
|
|
597489
|
+
const rel = relative22(cwd2, filePath);
|
|
597136
597490
|
if (isAbsolute26(rel) || rel.startsWith("..")) {
|
|
597137
597491
|
if (isWriteTool) {
|
|
597138
597492
|
logForDebugging(`[Speculation] Denied ${tool.name}: path outside cwd: ${filePath}`);
|
|
@@ -597150,7 +597504,7 @@ async function startSpeculation(suggestionText, context7, setAppState, isPipelin
|
|
|
597150
597504
|
if (isWriteTool) {
|
|
597151
597505
|
if (!writtenPathsRef.current.has(rel)) {
|
|
597152
597506
|
const overlayFile = join113(overlayPath, rel);
|
|
597153
|
-
await mkdir34(
|
|
597507
|
+
await mkdir34(dirname46(overlayFile), { recursive: true });
|
|
597154
597508
|
try {
|
|
597155
597509
|
await copyFile7(join113(cwd2, rel), overlayFile);
|
|
597156
597510
|
} catch {}
|
|
@@ -597790,8 +598144,8 @@ function registerAgentForeground({
|
|
|
597790
598144
|
diskLoaded: false
|
|
597791
598145
|
};
|
|
597792
598146
|
let resolveBackgroundSignal;
|
|
597793
|
-
const backgroundSignal = new Promise((
|
|
597794
|
-
resolveBackgroundSignal =
|
|
598147
|
+
const backgroundSignal = new Promise((resolve46) => {
|
|
598148
|
+
resolveBackgroundSignal = resolve46;
|
|
597795
598149
|
});
|
|
597796
598150
|
backgroundSignalResolvers.set(agentId, resolveBackgroundSignal);
|
|
597797
598151
|
registerTask(taskState, setAppState);
|
|
@@ -598451,7 +598805,7 @@ var init_sessionTranscript = () => {};
|
|
|
598451
598805
|
|
|
598452
598806
|
// src/utils/attachments.ts
|
|
598453
598807
|
import { readdir as readdir23, stat as stat35 } from "fs/promises";
|
|
598454
|
-
import { dirname as
|
|
598808
|
+
import { dirname as dirname47, parse as parse11, relative as relative23, resolve as resolve46 } from "path";
|
|
598455
598809
|
import { randomUUID as randomUUID28 } from "crypto";
|
|
598456
598810
|
async function getAttachments(input2, toolUseContext, ideSelection, queuedCommands, messages, querySource, options) {
|
|
598457
598811
|
if (isEnvTruthy(process.env.CLAUDE_CODE_DISABLE_ATTACHMENTS) || isEnvTruthy(process.env.CLAUDE_CODE_SIMPLE)) {
|
|
@@ -598901,26 +599255,26 @@ async function getSelectedLinesFromIDE(ideSelection, toolUseContext) {
|
|
|
598901
599255
|
lineEnd: ideSelection.lineStart + ideSelection.lineCount - 1,
|
|
598902
599256
|
filename: ideSelection.filePath,
|
|
598903
599257
|
content: ideSelection.text,
|
|
598904
|
-
displayPath:
|
|
599258
|
+
displayPath: relative23(getCwd(), ideSelection.filePath)
|
|
598905
599259
|
}
|
|
598906
599260
|
];
|
|
598907
599261
|
}
|
|
598908
599262
|
function getDirectoriesToProcess(targetPath, originalCwd) {
|
|
598909
|
-
const targetDir =
|
|
599263
|
+
const targetDir = dirname47(resolve46(targetPath));
|
|
598910
599264
|
const nestedDirs = [];
|
|
598911
599265
|
let currentDir = targetDir;
|
|
598912
599266
|
while (currentDir !== originalCwd && currentDir !== parse11(currentDir).root) {
|
|
598913
599267
|
if (currentDir.startsWith(originalCwd)) {
|
|
598914
599268
|
nestedDirs.push(currentDir);
|
|
598915
599269
|
}
|
|
598916
|
-
currentDir =
|
|
599270
|
+
currentDir = dirname47(currentDir);
|
|
598917
599271
|
}
|
|
598918
599272
|
nestedDirs.reverse();
|
|
598919
599273
|
const cwdLevelDirs = [];
|
|
598920
599274
|
currentDir = originalCwd;
|
|
598921
599275
|
while (currentDir !== parse11(currentDir).root) {
|
|
598922
599276
|
cwdLevelDirs.push(currentDir);
|
|
598923
|
-
currentDir =
|
|
599277
|
+
currentDir = dirname47(currentDir);
|
|
598924
599278
|
}
|
|
598925
599279
|
cwdLevelDirs.reverse();
|
|
598926
599280
|
return { nestedDirs, cwdLevelDirs };
|
|
@@ -598940,7 +599294,7 @@ function memoryFilesToAttachments(memoryFiles, toolUseContext, triggerFilePath)
|
|
|
598940
599294
|
type: "nested_memory",
|
|
598941
599295
|
path: memoryFile.path,
|
|
598942
599296
|
content: memoryFile,
|
|
598943
|
-
displayPath:
|
|
599297
|
+
displayPath: relative23(getCwd(), memoryFile.path)
|
|
598944
599298
|
});
|
|
598945
599299
|
toolUseContext.loadedNestedMemoryPaths?.add(memoryFile.path);
|
|
598946
599300
|
toolUseContext.readFileState.set(memoryFile.path, {
|
|
@@ -599043,7 +599397,7 @@ async function processAtMentionedFiles(input2, toolUseContext) {
|
|
|
599043
599397
|
type: "directory",
|
|
599044
599398
|
path: absoluteFilename,
|
|
599045
599399
|
content: stdout,
|
|
599046
|
-
displayPath:
|
|
599400
|
+
displayPath: relative23(getCwd(), absoluteFilename)
|
|
599047
599401
|
};
|
|
599048
599402
|
} catch {
|
|
599049
599403
|
return null;
|
|
@@ -599378,7 +599732,7 @@ async function getDynamicSkillAttachments(toolUseContext) {
|
|
|
599378
599732
|
const candidates = entries.filter((e4) => e4.isDirectory() || e4.isSymbolicLink()).map((e4) => e4.name);
|
|
599379
599733
|
const checked = await Promise.all(candidates.map(async (name3) => {
|
|
599380
599734
|
try {
|
|
599381
|
-
await stat35(
|
|
599735
|
+
await stat35(resolve46(skillDir, name3, "SKILL.md"));
|
|
599382
599736
|
return name3;
|
|
599383
599737
|
} catch {
|
|
599384
599738
|
return null;
|
|
@@ -599398,7 +599752,7 @@ async function getDynamicSkillAttachments(toolUseContext) {
|
|
|
599398
599752
|
type: "dynamic_skill",
|
|
599399
599753
|
skillDir,
|
|
599400
599754
|
skillNames,
|
|
599401
|
-
displayPath:
|
|
599755
|
+
displayPath: relative23(getCwd(), skillDir)
|
|
599402
599756
|
});
|
|
599403
599757
|
}
|
|
599404
599758
|
}
|
|
@@ -599594,7 +599948,7 @@ async function tryGetPDFReference(filename) {
|
|
|
599594
599948
|
filename,
|
|
599595
599949
|
pageCount: effectivePageCount,
|
|
599596
599950
|
fileSize: stats.size,
|
|
599597
|
-
displayPath:
|
|
599951
|
+
displayPath: relative23(getCwd(), filename)
|
|
599598
599952
|
};
|
|
599599
599953
|
}
|
|
599600
599954
|
} catch {}
|
|
@@ -599635,7 +599989,7 @@ async function generateFileAttachment(filename, toolUseContext, successEventName
|
|
|
599635
599989
|
return {
|
|
599636
599990
|
type: "already_read_file",
|
|
599637
599991
|
filename,
|
|
599638
|
-
displayPath:
|
|
599992
|
+
displayPath: relative23(getCwd(), filename),
|
|
599639
599993
|
content: {
|
|
599640
599994
|
type: "text",
|
|
599641
599995
|
file: {
|
|
@@ -599663,7 +600017,7 @@ async function generateFileAttachment(filename, toolUseContext, successEventName
|
|
|
599663
600017
|
return {
|
|
599664
600018
|
type: "compact_file_reference",
|
|
599665
600019
|
filename,
|
|
599666
|
-
displayPath:
|
|
600020
|
+
displayPath: relative23(getCwd(), filename)
|
|
599667
600021
|
};
|
|
599668
600022
|
}
|
|
599669
600023
|
const appState2 = toolUseContext.getAppState();
|
|
@@ -599685,7 +600039,7 @@ async function generateFileAttachment(filename, toolUseContext, successEventName
|
|
|
599685
600039
|
filename,
|
|
599686
600040
|
content: result.data,
|
|
599687
600041
|
truncated: true,
|
|
599688
|
-
displayPath:
|
|
600042
|
+
displayPath: relative23(getCwd(), filename)
|
|
599689
600043
|
};
|
|
599690
600044
|
} catch {
|
|
599691
600045
|
logEvent2(errorEventName, {});
|
|
@@ -599707,7 +600061,7 @@ async function generateFileAttachment(filename, toolUseContext, successEventName
|
|
|
599707
600061
|
type: "file",
|
|
599708
600062
|
filename,
|
|
599709
600063
|
content: result.data,
|
|
599710
|
-
displayPath:
|
|
600064
|
+
displayPath: relative23(getCwd(), filename)
|
|
599711
600065
|
};
|
|
599712
600066
|
} catch (error52) {
|
|
599713
600067
|
if (error52 instanceof MaxFileReadTokenExceededError || error52 instanceof FileTooLargeError) {
|
|
@@ -603481,7 +603835,7 @@ var init_toolSearch = __esm(() => {
|
|
|
603481
603835
|
// src/services/vcr.ts
|
|
603482
603836
|
import { createHash as createHash25, randomUUID as randomUUID29 } from "crypto";
|
|
603483
603837
|
import { mkdir as mkdir35, readFile as readFile43, writeFile as writeFile35 } from "fs/promises";
|
|
603484
|
-
import { dirname as
|
|
603838
|
+
import { dirname as dirname48, join as join115 } from "path";
|
|
603485
603839
|
function shouldUseVCR() {
|
|
603486
603840
|
if (false) {}
|
|
603487
603841
|
if (process.env.USER_TYPE === "ant" && isEnvTruthy(process.env.FORCE_VCR)) {
|
|
@@ -603508,7 +603862,7 @@ async function withFixture(input2, fixtureName, f4) {
|
|
|
603508
603862
|
throw new Error(`Fixture missing: ${filename}. Re-run tests with VCR_RECORD=1, then commit the result.`);
|
|
603509
603863
|
}
|
|
603510
603864
|
const result = await f4();
|
|
603511
|
-
await mkdir35(
|
|
603865
|
+
await mkdir35(dirname48(filename), { recursive: true });
|
|
603512
603866
|
await writeFile35(filename, jsonStringify(result, null, 2), {
|
|
603513
603867
|
encoding: "utf8"
|
|
603514
603868
|
});
|
|
@@ -603547,7 +603901,7 @@ ${jsonStringify(dehydratedInput, null, 2)}`);
|
|
|
603547
603901
|
if (env4.isCI && !isEnvTruthy(process.env.VCR_RECORD)) {
|
|
603548
603902
|
return results;
|
|
603549
603903
|
}
|
|
603550
|
-
await mkdir35(
|
|
603904
|
+
await mkdir35(dirname48(filename), { recursive: true });
|
|
603551
603905
|
await writeFile35(filename, jsonStringify({
|
|
603552
603906
|
input: dehydratedInput,
|
|
603553
603907
|
output: results.map((message, index2) => mapMessage(message, dehydrateValue, index2))
|
|
@@ -604168,11 +604522,11 @@ import { createHash as createHash26 } from "crypto";
|
|
|
604168
604522
|
import { realpath as realpath13 } from "fs/promises";
|
|
604169
604523
|
import {
|
|
604170
604524
|
basename as basename33,
|
|
604171
|
-
dirname as
|
|
604525
|
+
dirname as dirname49,
|
|
604172
604526
|
isAbsolute as isAbsolute27,
|
|
604173
604527
|
join as join116,
|
|
604174
604528
|
sep as pathSep,
|
|
604175
|
-
relative as
|
|
604529
|
+
relative as relative24
|
|
604176
604530
|
} from "path";
|
|
604177
604531
|
function getSkillsPath(source2, dir) {
|
|
604178
604532
|
switch (source2) {
|
|
@@ -604479,7 +604833,7 @@ function isSkillFile(filePath) {
|
|
|
604479
604833
|
function transformSkillFiles(files2) {
|
|
604480
604834
|
const filesByDir = new Map;
|
|
604481
604835
|
for (const file2 of files2) {
|
|
604482
|
-
const dir =
|
|
604836
|
+
const dir = dirname49(file2.filePath);
|
|
604483
604837
|
const dirFiles = filesByDir.get(dir) ?? [];
|
|
604484
604838
|
dirFiles.push(file2);
|
|
604485
604839
|
filesByDir.set(dir, dirFiles);
|
|
@@ -604508,15 +604862,15 @@ function buildNamespace(targetDir, baseDir) {
|
|
|
604508
604862
|
return relativePath ? relativePath.split(pathSep).join(":") : "";
|
|
604509
604863
|
}
|
|
604510
604864
|
function getSkillCommandName(filePath, baseDir) {
|
|
604511
|
-
const skillDirectory =
|
|
604512
|
-
const parentOfSkillDir =
|
|
604865
|
+
const skillDirectory = dirname49(filePath);
|
|
604866
|
+
const parentOfSkillDir = dirname49(skillDirectory);
|
|
604513
604867
|
const commandBaseName = basename33(skillDirectory);
|
|
604514
604868
|
const namespace = buildNamespace(parentOfSkillDir, baseDir);
|
|
604515
604869
|
return namespace ? `${namespace}:${commandBaseName}` : commandBaseName;
|
|
604516
604870
|
}
|
|
604517
604871
|
function getRegularCommandName(filePath, baseDir) {
|
|
604518
604872
|
const fileName = basename33(filePath);
|
|
604519
|
-
const fileDirectory =
|
|
604873
|
+
const fileDirectory = dirname49(filePath);
|
|
604520
604874
|
const commandBaseName = fileName.replace(/\.md$/, "");
|
|
604521
604875
|
const namespace = buildNamespace(fileDirectory, baseDir);
|
|
604522
604876
|
return namespace ? `${namespace}:${commandBaseName}` : commandBaseName;
|
|
@@ -604539,7 +604893,7 @@ async function loadSkillsFromCommandsDir(cwd2) {
|
|
|
604539
604893
|
} of processedFiles) {
|
|
604540
604894
|
try {
|
|
604541
604895
|
const isSkillFormat = isSkillFile(filePath);
|
|
604542
|
-
const skillDirectory = isSkillFormat ?
|
|
604896
|
+
const skillDirectory = isSkillFormat ? dirname49(filePath) : undefined;
|
|
604543
604897
|
const cmdName = getCommandName3({
|
|
604544
604898
|
baseDir,
|
|
604545
604899
|
filePath,
|
|
@@ -604598,7 +604952,7 @@ async function discoverSkillDirsForPaths(filePaths, cwd2) {
|
|
|
604598
604952
|
const resolvedCwd = cwd2.endsWith(pathSep) ? cwd2.slice(0, -1) : cwd2;
|
|
604599
604953
|
const newDirs = [];
|
|
604600
604954
|
for (const filePath of filePaths) {
|
|
604601
|
-
let currentDir =
|
|
604955
|
+
let currentDir = dirname49(filePath);
|
|
604602
604956
|
while (currentDir.startsWith(resolvedCwd + pathSep)) {
|
|
604603
604957
|
const skillDir = join116(currentDir, ".claude", "skills");
|
|
604604
604958
|
if (!dynamicSkillDirs.has(skillDir)) {
|
|
@@ -604612,7 +604966,7 @@ async function discoverSkillDirsForPaths(filePaths, cwd2) {
|
|
|
604612
604966
|
newDirs.push(skillDir);
|
|
604613
604967
|
} catch {}
|
|
604614
604968
|
}
|
|
604615
|
-
const parent =
|
|
604969
|
+
const parent = dirname49(currentDir);
|
|
604616
604970
|
if (parent === currentDir)
|
|
604617
604971
|
break;
|
|
604618
604972
|
currentDir = parent;
|
|
@@ -604667,7 +605021,7 @@ function activateConditionalSkillsForPaths(filePaths, cwd2) {
|
|
|
604667
605021
|
}
|
|
604668
605022
|
const skillIgnore = import_ignore4.default().add(filterValidIgnorePatterns(skill.paths, "skill_paths"));
|
|
604669
605023
|
for (const filePath of filePaths) {
|
|
604670
|
-
const relativePath = isAbsolute27(filePath) ?
|
|
605024
|
+
const relativePath = isAbsolute27(filePath) ? relative24(cwd2, filePath) : filePath;
|
|
604671
605025
|
if (!relativePath || relativePath.startsWith("..") || isAbsolute27(relativePath)) {
|
|
604672
605026
|
continue;
|
|
604673
605027
|
}
|
|
@@ -605002,21 +605356,21 @@ Important:
|
|
|
605002
605356
|
});
|
|
605003
605357
|
|
|
605004
605358
|
// src/utils/plugins/loadPluginCommands.ts
|
|
605005
|
-
import { basename as basename34, dirname as
|
|
605359
|
+
import { basename as basename34, dirname as dirname50, join as join117 } from "path";
|
|
605006
605360
|
function isSkillFile2(filePath) {
|
|
605007
605361
|
return /^skill\.md$/i.test(basename34(filePath));
|
|
605008
605362
|
}
|
|
605009
605363
|
function getCommandNameFromFile(filePath, baseDir, pluginName) {
|
|
605010
605364
|
const isSkill = isSkillFile2(filePath);
|
|
605011
605365
|
if (isSkill) {
|
|
605012
|
-
const skillDirectory =
|
|
605013
|
-
const parentOfSkillDir =
|
|
605366
|
+
const skillDirectory = dirname50(filePath);
|
|
605367
|
+
const parentOfSkillDir = dirname50(skillDirectory);
|
|
605014
605368
|
const commandBaseName = basename34(skillDirectory);
|
|
605015
605369
|
const relativePath = parentOfSkillDir.startsWith(baseDir) ? parentOfSkillDir.slice(baseDir.length).replace(/^\//, "") : "";
|
|
605016
605370
|
const namespace = relativePath ? relativePath.split("/").join(":") : "";
|
|
605017
605371
|
return namespace ? `${pluginName}:${namespace}:${commandBaseName}` : `${pluginName}:${commandBaseName}`;
|
|
605018
605372
|
} else {
|
|
605019
|
-
const fileDirectory =
|
|
605373
|
+
const fileDirectory = dirname50(filePath);
|
|
605020
605374
|
const commandBaseName = basename34(filePath).replace(/\.md$/, "");
|
|
605021
605375
|
const relativePath = fileDirectory.startsWith(baseDir) ? fileDirectory.slice(baseDir.length).replace(/^\//, "") : "";
|
|
605022
605376
|
const namespace = relativePath ? relativePath.split("/").join(":") : "";
|
|
@@ -605043,7 +605397,7 @@ async function collectMarkdownFiles(dirPath, baseDir, loadedPaths) {
|
|
|
605043
605397
|
function transformPluginSkillFiles(files2) {
|
|
605044
605398
|
const filesByDir = new Map;
|
|
605045
605399
|
for (const file2 of files2) {
|
|
605046
|
-
const dir =
|
|
605400
|
+
const dir = dirname50(file2.filePath);
|
|
605047
605401
|
const dirFiles = filesByDir.get(dir) ?? [];
|
|
605048
605402
|
dirFiles.push(file2);
|
|
605049
605403
|
filesByDir.set(dir, dirFiles);
|
|
@@ -605132,7 +605486,7 @@ function createPluginCommand(commandName, file2, sourceName, pluginManifest, plu
|
|
|
605132
605486
|
return displayName || commandName;
|
|
605133
605487
|
},
|
|
605134
605488
|
async getPromptForCommand(args, context7) {
|
|
605135
|
-
let finalContent = config7.isSkillMode ? `Base directory for this skill: ${
|
|
605489
|
+
let finalContent = config7.isSkillMode ? `Base directory for this skill: ${dirname50(file2.filePath)}
|
|
605136
605490
|
|
|
605137
605491
|
${content}` : content;
|
|
605138
605492
|
finalContent = substituteArguments(finalContent, args, true, argumentNames);
|
|
@@ -605144,7 +605498,7 @@ ${content}` : content;
|
|
|
605144
605498
|
finalContent = substituteUserConfigInContent(finalContent, loadPluginOptions(sourceName), pluginManifest.userConfig);
|
|
605145
605499
|
}
|
|
605146
605500
|
if (config7.isSkillMode) {
|
|
605147
|
-
const rawSkillDir =
|
|
605501
|
+
const rawSkillDir = dirname50(file2.filePath);
|
|
605148
605502
|
const skillDir = process.platform === "win32" ? rawSkillDir.replace(/\\/g, "/") : rawSkillDir;
|
|
605149
605503
|
finalContent = finalContent.replace(/\$\{CLAUDE_SKILL_DIR\}/g, skillDir);
|
|
605150
605504
|
}
|
|
@@ -605208,7 +605562,7 @@ async function loadSkillsFromDirectory(skillsPath, pluginName, sourceName, plugi
|
|
|
605208
605562
|
const skillName = `${pluginName}:${basename34(skillsPath)}`;
|
|
605209
605563
|
const file2 = {
|
|
605210
605564
|
filePath: directSkillPath,
|
|
605211
|
-
baseDir:
|
|
605565
|
+
baseDir: dirname50(directSkillPath),
|
|
605212
605566
|
frontmatter,
|
|
605213
605567
|
content: markdownContent
|
|
605214
605568
|
};
|
|
@@ -605257,7 +605611,7 @@ async function loadSkillsFromDirectory(skillsPath, pluginName, sourceName, plugi
|
|
|
605257
605611
|
const skillName = `${pluginName}:${entry.name}`;
|
|
605258
605612
|
const file2 = {
|
|
605259
605613
|
filePath: skillFilePath,
|
|
605260
|
-
baseDir:
|
|
605614
|
+
baseDir: dirname50(skillFilePath),
|
|
605261
605615
|
frontmatter,
|
|
605262
605616
|
content: markdownContent
|
|
605263
605617
|
};
|
|
@@ -605370,7 +605724,7 @@ var init_loadPluginCommands = __esm(() => {
|
|
|
605370
605724
|
} : frontmatter;
|
|
605371
605725
|
const file2 = {
|
|
605372
605726
|
filePath: commandPath,
|
|
605373
|
-
baseDir:
|
|
605727
|
+
baseDir: dirname50(commandPath),
|
|
605374
605728
|
frontmatter: finalFrontmatter,
|
|
605375
605729
|
content: markdownContent
|
|
605376
605730
|
};
|
|
@@ -605495,7 +605849,7 @@ import {
|
|
|
605495
605849
|
writeFile as writeFile36
|
|
605496
605850
|
} from "fs/promises";
|
|
605497
605851
|
import { tmpdir as tmpdir12 } from "os";
|
|
605498
|
-
import { basename as basename35, dirname as
|
|
605852
|
+
import { basename as basename35, dirname as dirname51, join as join118 } from "path";
|
|
605499
605853
|
function isPluginZipCacheEnabled() {
|
|
605500
605854
|
return isEnvTruthy(process.env.CLAUDE_CODE_PLUGIN_USE_ZIP_CACHE);
|
|
605501
605855
|
}
|
|
@@ -605558,7 +605912,7 @@ async function cleanupSessionPluginCache() {
|
|
|
605558
605912
|
}
|
|
605559
605913
|
}
|
|
605560
605914
|
async function atomicWriteToZipCache(targetPath, data) {
|
|
605561
|
-
const dir =
|
|
605915
|
+
const dir = dirname51(targetPath);
|
|
605562
605916
|
await getFsImplementation().mkdir(dir);
|
|
605563
605917
|
const tmpName = `.${basename35(targetPath)}.tmp.${randomBytes10(4).toString("hex")}`;
|
|
605564
605918
|
const tmpPath = join118(dir, tmpName);
|
|
@@ -605655,7 +606009,7 @@ async function extractZipToDirectory(zipPath, targetDir) {
|
|
|
605655
606009
|
continue;
|
|
605656
606010
|
}
|
|
605657
606011
|
const fullPath = join118(targetDir, relPath);
|
|
605658
|
-
await getFsImplementation().mkdir(
|
|
606012
|
+
await getFsImplementation().mkdir(dirname51(fullPath));
|
|
605659
606013
|
await writeFile36(fullPath, data);
|
|
605660
606014
|
const mode = modes[relPath];
|
|
605661
606015
|
if (mode && mode & 73) {
|
|
@@ -606145,11 +606499,11 @@ var init_marketplaceHelpers = __esm(() => {
|
|
|
606145
606499
|
|
|
606146
606500
|
// src/utils/plugins/officialMarketplaceGcs.ts
|
|
606147
606501
|
import { chmod as chmod9, mkdir as mkdir36, readFile as readFile45, rename as rename5, rm as rm10, writeFile as writeFile38 } from "fs/promises";
|
|
606148
|
-
import { dirname as
|
|
606502
|
+
import { dirname as dirname52, join as join120, resolve as resolve47, sep as sep33 } from "path";
|
|
606149
606503
|
async function fetchOfficialMarketplaceFromGcs(installLocation, marketplacesCacheDir) {
|
|
606150
|
-
const cacheDir =
|
|
606151
|
-
const resolvedLoc =
|
|
606152
|
-
if (resolvedLoc !== cacheDir && !resolvedLoc.startsWith(cacheDir +
|
|
606504
|
+
const cacheDir = resolve47(marketplacesCacheDir);
|
|
606505
|
+
const resolvedLoc = resolve47(installLocation);
|
|
606506
|
+
if (resolvedLoc !== cacheDir && !resolvedLoc.startsWith(cacheDir + sep33)) {
|
|
606153
606507
|
logForDebugging(`fetchOfficialMarketplaceFromGcs: refusing path outside cache dir: ${installLocation}`, { level: "error" });
|
|
606154
606508
|
return null;
|
|
606155
606509
|
}
|
|
@@ -606192,7 +606546,7 @@ async function fetchOfficialMarketplaceFromGcs(installLocation, marketplacesCach
|
|
|
606192
606546
|
if (!rel || rel.endsWith("/"))
|
|
606193
606547
|
continue;
|
|
606194
606548
|
const dest = join120(staging, rel);
|
|
606195
|
-
await mkdir36(
|
|
606549
|
+
await mkdir36(dirname52(dest), { recursive: true });
|
|
606196
606550
|
await writeFile38(dest, data);
|
|
606197
606551
|
const mode = modes[arcPath];
|
|
606198
606552
|
if (mode && mode & 73) {
|
|
@@ -606266,7 +606620,7 @@ var init_officialMarketplaceGcs = __esm(() => {
|
|
|
606266
606620
|
|
|
606267
606621
|
// src/utils/plugins/marketplaceManager.ts
|
|
606268
606622
|
import { writeFile as writeFile39 } from "fs/promises";
|
|
606269
|
-
import { basename as basename36, dirname as
|
|
606623
|
+
import { basename as basename36, dirname as dirname53, isAbsolute as isAbsolute28, join as join121, resolve as resolve48, sep as sep34 } from "path";
|
|
606270
606624
|
function getKnownMarketplacesFile() {
|
|
606271
606625
|
return join121(getPluginsDirectory(), "known_marketplaces.json");
|
|
606272
606626
|
}
|
|
@@ -606435,7 +606789,7 @@ async function findSeedMarketplaceLocation(seedDir, name3) {
|
|
|
606435
606789
|
return null;
|
|
606436
606790
|
}
|
|
606437
606791
|
function seedDirFor(installLocation) {
|
|
606438
|
-
return getPluginSeedDirs().find((d4) => installLocation === d4 || installLocation.startsWith(d4 +
|
|
606792
|
+
return getPluginSeedDirs().find((d4) => installLocation === d4 || installLocation.startsWith(d4 + sep34));
|
|
606439
606793
|
}
|
|
606440
606794
|
function getPluginGitTimeoutMs() {
|
|
606441
606795
|
const envValue = process.env.CLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MS;
|
|
@@ -606948,14 +607302,14 @@ async function loadAndCacheMarketplace(source2, onProgress) {
|
|
|
606948
607302
|
throw new Error("NPM marketplace sources not yet implemented");
|
|
606949
607303
|
}
|
|
606950
607304
|
case "file": {
|
|
606951
|
-
const absPath =
|
|
607305
|
+
const absPath = resolve48(source2.path);
|
|
606952
607306
|
marketplacePath = absPath;
|
|
606953
|
-
temporaryCachePath =
|
|
607307
|
+
temporaryCachePath = dirname53(dirname53(absPath));
|
|
606954
607308
|
cleanupNeeded = false;
|
|
606955
607309
|
break;
|
|
606956
607310
|
}
|
|
606957
607311
|
case "directory": {
|
|
606958
|
-
const absPath =
|
|
607312
|
+
const absPath = resolve48(source2.path);
|
|
606959
607313
|
marketplacePath = join121(absPath, ".claude-plugin", "marketplace.json");
|
|
606960
607314
|
temporaryCachePath = absPath;
|
|
606961
607315
|
cleanupNeeded = false;
|
|
@@ -606965,7 +607319,7 @@ async function loadAndCacheMarketplace(source2, onProgress) {
|
|
|
606965
607319
|
temporaryCachePath = join121(cacheDir, source2.name);
|
|
606966
607320
|
marketplacePath = join121(temporaryCachePath, ".claude-plugin", "marketplace.json");
|
|
606967
607321
|
cleanupNeeded = false;
|
|
606968
|
-
await fs24.mkdir(
|
|
607322
|
+
await fs24.mkdir(dirname53(marketplacePath));
|
|
606969
607323
|
await writeFile39(marketplacePath, jsonStringify({
|
|
606970
607324
|
name: source2.name,
|
|
606971
607325
|
owner: source2.owner ?? { name: "settings" },
|
|
@@ -606987,9 +607341,9 @@ async function loadAndCacheMarketplace(source2, onProgress) {
|
|
|
606987
607341
|
throw new Error(`Failed to parse marketplace file at ${marketplacePath}: ${errorMessage(e4)}`);
|
|
606988
607342
|
}
|
|
606989
607343
|
const finalCachePath = join121(cacheDir, marketplace.name);
|
|
606990
|
-
const resolvedFinal =
|
|
606991
|
-
const resolvedCacheDir =
|
|
606992
|
-
if (!resolvedFinal.startsWith(resolvedCacheDir +
|
|
607344
|
+
const resolvedFinal = resolve48(finalCachePath);
|
|
607345
|
+
const resolvedCacheDir = resolve48(cacheDir);
|
|
607346
|
+
if (!resolvedFinal.startsWith(resolvedCacheDir + sep34)) {
|
|
606993
607347
|
throw new Error(`Marketplace name '${marketplace.name}' resolves to a path outside the cache directory`);
|
|
606994
607348
|
}
|
|
606995
607349
|
if (temporaryCachePath !== finalCachePath && !isLocalMarketplaceSource(source2)) {
|
|
@@ -607025,7 +607379,7 @@ Technical details: ${errorMsg}`);
|
|
|
607025
607379
|
async function addMarketplaceSource(source2, onProgress) {
|
|
607026
607380
|
let resolvedSource = source2;
|
|
607027
607381
|
if (isLocalMarketplaceSource(source2) && !isAbsolute28(source2.path)) {
|
|
607028
|
-
resolvedSource = { ...source2, path:
|
|
607382
|
+
resolvedSource = { ...source2, path: resolve48(source2.path) };
|
|
607029
607383
|
}
|
|
607030
607384
|
if (!isSourceAllowedByPolicy(resolvedSource)) {
|
|
607031
607385
|
if (isSourceInBlocklist(resolvedSource)) {
|
|
@@ -607073,10 +607427,10 @@ Tip: The shorthand "${resolvedSource.repo}" assumes github.com. ` + `For interna
|
|
|
607073
607427
|
}
|
|
607074
607428
|
logForDebugging(`Marketplace '${marketplace.name}' exists with different source \u2014 overwriting`);
|
|
607075
607429
|
if (!isLocalMarketplaceSource(oldEntry.source)) {
|
|
607076
|
-
const cacheDir =
|
|
607077
|
-
const resolvedOld =
|
|
607078
|
-
const resolvedNew =
|
|
607079
|
-
if (resolvedOld === resolvedNew) {} else if (resolvedOld === cacheDir || resolvedOld.startsWith(cacheDir +
|
|
607430
|
+
const cacheDir = resolve48(getMarketplacesCacheDir());
|
|
607431
|
+
const resolvedOld = resolve48(oldEntry.installLocation);
|
|
607432
|
+
const resolvedNew = resolve48(cachePath);
|
|
607433
|
+
if (resolvedOld === resolvedNew) {} else if (resolvedOld === cacheDir || resolvedOld.startsWith(cacheDir + sep34)) {
|
|
607080
607434
|
const fs24 = getFsImplementation();
|
|
607081
607435
|
await fs24.rm(oldEntry.installLocation, { recursive: true, force: true });
|
|
607082
607436
|
} else {
|
|
@@ -607302,9 +607656,9 @@ async function refreshMarketplace(name3, onProgress, options) {
|
|
|
607302
607656
|
throw new Error(`Marketplace '${name3}' is seed-managed (${seedDir}) and its content is ` + `controlled by the seed image. To update: ask your admin to update the seed.`);
|
|
607303
607657
|
}
|
|
607304
607658
|
if (!isLocalMarketplaceSource(source2)) {
|
|
607305
|
-
const cacheDir =
|
|
607306
|
-
const resolvedLoc =
|
|
607307
|
-
if (resolvedLoc !== cacheDir && !resolvedLoc.startsWith(cacheDir +
|
|
607659
|
+
const cacheDir = resolve48(getMarketplacesCacheDir());
|
|
607660
|
+
const resolvedLoc = resolve48(installLocation);
|
|
607661
|
+
if (resolvedLoc !== cacheDir && !resolvedLoc.startsWith(cacheDir + sep34)) {
|
|
607308
607662
|
throw new Error(`Marketplace '${name3}' has a corrupted installLocation ` + `(${installLocation}) \u2014 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 "${name3}" and re-add it.`);
|
|
607309
607663
|
}
|
|
607310
607664
|
}
|
|
@@ -607460,7 +607814,7 @@ var init_marketplaceManager = __esm(() => {
|
|
|
607460
607814
|
});
|
|
607461
607815
|
|
|
607462
607816
|
// src/utils/plugins/installedPluginsManager.ts
|
|
607463
|
-
import { dirname as
|
|
607817
|
+
import { dirname as dirname54, join as join122 } from "path";
|
|
607464
607818
|
function getInstalledPluginsFilePath() {
|
|
607465
607819
|
return join122(getPluginsDirectory(), "installed_plugins.json");
|
|
607466
607820
|
}
|
|
@@ -608026,14 +608380,14 @@ var init_pluginVersioning = __esm(() => {
|
|
|
608026
608380
|
// src/utils/plugins/pluginInstallationHelpers.ts
|
|
608027
608381
|
import { randomBytes as randomBytes11 } from "crypto";
|
|
608028
608382
|
import { rename as rename6, rm as rm11 } from "fs/promises";
|
|
608029
|
-
import { dirname as
|
|
608383
|
+
import { dirname as dirname55, join as join123, resolve as resolve49, sep as sep35 } from "path";
|
|
608030
608384
|
function getCurrentTimestamp() {
|
|
608031
608385
|
return new Date().toISOString();
|
|
608032
608386
|
}
|
|
608033
608387
|
function validatePathWithinBase(basePath, relativePath) {
|
|
608034
|
-
const resolvedPath =
|
|
608035
|
-
const normalizedBase =
|
|
608036
|
-
if (!resolvedPath.startsWith(normalizedBase) && resolvedPath !==
|
|
608388
|
+
const resolvedPath = resolve49(basePath, relativePath);
|
|
608389
|
+
const normalizedBase = resolve49(basePath) + sep35;
|
|
608390
|
+
if (!resolvedPath.startsWith(normalizedBase) && resolvedPath !== resolve49(basePath)) {
|
|
608037
608391
|
throw new Error(`Path traversal detected: "${relativePath}" would escape the base directory`);
|
|
608038
608392
|
}
|
|
608039
608393
|
return resolvedPath;
|
|
@@ -608050,14 +608404,14 @@ async function cacheAndRegisterPlugin(pluginId, entry, scope = "user", projectPa
|
|
|
608050
608404
|
const versionedPath = getVersionedCachePath(pluginId, version5);
|
|
608051
608405
|
let finalPath = cacheResult.path;
|
|
608052
608406
|
if (cacheResult.path !== versionedPath) {
|
|
608053
|
-
await getFsImplementation().mkdir(
|
|
608407
|
+
await getFsImplementation().mkdir(dirname55(versionedPath));
|
|
608054
608408
|
await rm11(versionedPath, { recursive: true, force: true });
|
|
608055
|
-
const normalizedCachePath = cacheResult.path.endsWith(
|
|
608409
|
+
const normalizedCachePath = cacheResult.path.endsWith(sep35) ? cacheResult.path : cacheResult.path + sep35;
|
|
608056
608410
|
const isSubdirectory = versionedPath.startsWith(normalizedCachePath);
|
|
608057
608411
|
if (isSubdirectory) {
|
|
608058
|
-
const tempPath = join123(
|
|
608412
|
+
const tempPath = join123(dirname55(cacheResult.path), `.claude-plugin-temp-${Date.now()}-${randomBytes11(4).toString("hex")}`);
|
|
608059
608413
|
await rename6(cacheResult.path, tempPath);
|
|
608060
|
-
await getFsImplementation().mkdir(
|
|
608414
|
+
await getFsImplementation().mkdir(dirname55(versionedPath));
|
|
608061
608415
|
await rename6(tempPath, versionedPath);
|
|
608062
608416
|
} else {
|
|
608063
608417
|
await rename6(cacheResult.path, versionedPath);
|
|
@@ -608287,7 +608641,7 @@ import {
|
|
|
608287
608641
|
stat as stat38,
|
|
608288
608642
|
symlink as symlink3
|
|
608289
608643
|
} from "fs/promises";
|
|
608290
|
-
import { basename as basename37, dirname as
|
|
608644
|
+
import { basename as basename37, dirname as dirname56, join as join124, relative as relative25, resolve as resolve50, sep as sep36 } from "path";
|
|
608291
608645
|
function getPluginCachePath() {
|
|
608292
608646
|
return join124(getPluginsDirectory(), "cache");
|
|
608293
608647
|
}
|
|
@@ -608317,7 +608671,7 @@ async function probeSeedCache(pluginId, version5) {
|
|
|
608317
608671
|
}
|
|
608318
608672
|
async function probeSeedCacheAnyVersion(pluginId) {
|
|
608319
608673
|
for (const seedDir of getPluginSeedDirs()) {
|
|
608320
|
-
const pluginDir =
|
|
608674
|
+
const pluginDir = dirname56(getVersionedCachePathIn(seedDir, pluginId, "_"));
|
|
608321
608675
|
try {
|
|
608322
608676
|
const versions2 = await readdir26(pluginDir);
|
|
608323
608677
|
if (versions2.length !== 1)
|
|
@@ -608355,11 +608709,11 @@ async function copyDir(src, dest) {
|
|
|
608355
608709
|
} catch {
|
|
608356
608710
|
resolvedSrc = src;
|
|
608357
608711
|
}
|
|
608358
|
-
const srcPrefix = resolvedSrc.endsWith(
|
|
608712
|
+
const srcPrefix = resolvedSrc.endsWith(sep36) ? resolvedSrc : resolvedSrc + sep36;
|
|
608359
608713
|
if (resolvedTarget.startsWith(srcPrefix) || resolvedTarget === resolvedSrc) {
|
|
608360
|
-
const targetRelativeToSrc =
|
|
608714
|
+
const targetRelativeToSrc = relative25(resolvedSrc, resolvedTarget);
|
|
608361
608715
|
const destTargetPath = join124(dest, targetRelativeToSrc);
|
|
608362
|
-
const relativeLinkPath =
|
|
608716
|
+
const relativeLinkPath = relative25(dirname56(destPath), destTargetPath);
|
|
608363
608717
|
await symlink3(relativeLinkPath, destPath);
|
|
608364
608718
|
} else {
|
|
608365
608719
|
await symlink3(resolvedTarget, destPath);
|
|
@@ -608390,7 +608744,7 @@ async function copyPluginToVersionedCache(sourcePath, pluginId, version5, entry,
|
|
|
608390
608744
|
logForDebugging(`Using seed cache for ${pluginId}@${version5} at ${seedPath}`);
|
|
608391
608745
|
return seedPath;
|
|
608392
608746
|
}
|
|
608393
|
-
await getFsImplementation().mkdir(
|
|
608747
|
+
await getFsImplementation().mkdir(dirname56(cachePath));
|
|
608394
608748
|
if (entry && typeof entry.source === "string" && marketplaceDir) {
|
|
608395
608749
|
const sourceDir = validatePathWithinBase(marketplaceDir, entry.source);
|
|
608396
608750
|
logForDebugging(`Copying source directory ${entry.source} for plugin ${pluginId}`);
|
|
@@ -609641,7 +609995,7 @@ async function loadSessionOnlyPlugins(sessionPluginPaths) {
|
|
|
609641
609995
|
const errors8 = [];
|
|
609642
609996
|
for (const [index2, pluginPath] of sessionPluginPaths.entries()) {
|
|
609643
609997
|
try {
|
|
609644
|
-
const resolvedPath =
|
|
609998
|
+
const resolvedPath = resolve50(pluginPath);
|
|
609645
609999
|
if (!await pathExists(resolvedPath)) {
|
|
609646
610000
|
logForDebugging(`Plugin path does not exist: ${resolvedPath}, skipping`, { level: "warn" });
|
|
609647
610001
|
errors8.push({
|
|
@@ -614072,18 +614426,18 @@ function isPipeNonInteractiveModeDefault() {
|
|
|
614072
614426
|
return isPipeNonInteractiveMode();
|
|
614073
614427
|
}
|
|
614074
614428
|
function sleepWithAbort(ms, signal) {
|
|
614075
|
-
return new Promise((
|
|
614429
|
+
return new Promise((resolve51) => {
|
|
614076
614430
|
if (signal.aborted) {
|
|
614077
|
-
|
|
614431
|
+
resolve51("timeout");
|
|
614078
614432
|
return;
|
|
614079
614433
|
}
|
|
614080
614434
|
const timer2 = setTimeout(() => {
|
|
614081
614435
|
signal.removeEventListener("abort", onAbort);
|
|
614082
|
-
|
|
614436
|
+
resolve51("timeout");
|
|
614083
614437
|
}, ms);
|
|
614084
614438
|
const onAbort = () => {
|
|
614085
614439
|
clearTimeout(timer2);
|
|
614086
|
-
|
|
614440
|
+
resolve51("timeout");
|
|
614087
614441
|
};
|
|
614088
614442
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
614089
614443
|
});
|
|
@@ -614978,7 +615332,7 @@ class Protocol {
|
|
|
614978
615332
|
return;
|
|
614979
615333
|
}
|
|
614980
615334
|
const pollInterval = task2.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1000;
|
|
614981
|
-
await new Promise((
|
|
615335
|
+
await new Promise((resolve51) => setTimeout(resolve51, pollInterval));
|
|
614982
615336
|
options?.signal?.throwIfAborted();
|
|
614983
615337
|
}
|
|
614984
615338
|
} catch (error52) {
|
|
@@ -614990,7 +615344,7 @@ class Protocol {
|
|
|
614990
615344
|
}
|
|
614991
615345
|
request(request4, resultSchema, options) {
|
|
614992
615346
|
const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {};
|
|
614993
|
-
return new Promise((
|
|
615347
|
+
return new Promise((resolve51, reject) => {
|
|
614994
615348
|
const earlyReject = (error52) => {
|
|
614995
615349
|
reject(error52);
|
|
614996
615350
|
};
|
|
@@ -615068,7 +615422,7 @@ class Protocol {
|
|
|
615068
615422
|
if (!parseResult.success) {
|
|
615069
615423
|
reject(parseResult.error);
|
|
615070
615424
|
} else {
|
|
615071
|
-
|
|
615425
|
+
resolve51(parseResult.data);
|
|
615072
615426
|
}
|
|
615073
615427
|
} catch (error52) {
|
|
615074
615428
|
reject(error52);
|
|
@@ -615259,12 +615613,12 @@ class Protocol {
|
|
|
615259
615613
|
interval = task.pollInterval;
|
|
615260
615614
|
}
|
|
615261
615615
|
} catch {}
|
|
615262
|
-
return new Promise((
|
|
615616
|
+
return new Promise((resolve51, reject) => {
|
|
615263
615617
|
if (signal.aborted) {
|
|
615264
615618
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
615265
615619
|
return;
|
|
615266
615620
|
}
|
|
615267
|
-
const timeoutId = setTimeout(
|
|
615621
|
+
const timeoutId = setTimeout(resolve51, interval);
|
|
615268
615622
|
signal.addEventListener("abort", () => {
|
|
615269
615623
|
clearTimeout(timeoutId);
|
|
615270
615624
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
@@ -617185,7 +617539,7 @@ class SSEClientTransport {
|
|
|
617185
617539
|
}
|
|
617186
617540
|
_startOrAuth() {
|
|
617187
617541
|
const fetchImpl = this?._eventSourceInit?.fetch ?? this._fetch ?? fetch;
|
|
617188
|
-
return new Promise((
|
|
617542
|
+
return new Promise((resolve51, reject) => {
|
|
617189
617543
|
this._eventSource = new EventSource(this._url.href, {
|
|
617190
617544
|
...this._eventSourceInit,
|
|
617191
617545
|
fetch: async (url3, init2) => {
|
|
@@ -617206,7 +617560,7 @@ class SSEClientTransport {
|
|
|
617206
617560
|
this._abortController = new AbortController;
|
|
617207
617561
|
this._eventSource.onerror = (event) => {
|
|
617208
617562
|
if (event.code === 401 && this._authProvider) {
|
|
617209
|
-
this._authThenStart().then(
|
|
617563
|
+
this._authThenStart().then(resolve51, reject);
|
|
617210
617564
|
return;
|
|
617211
617565
|
}
|
|
617212
617566
|
const error52 = new SseError(event.code, event.message, event);
|
|
@@ -617227,7 +617581,7 @@ class SSEClientTransport {
|
|
|
617227
617581
|
this.close();
|
|
617228
617582
|
return;
|
|
617229
617583
|
}
|
|
617230
|
-
|
|
617584
|
+
resolve51();
|
|
617231
617585
|
});
|
|
617232
617586
|
this._eventSource.onmessage = (event) => {
|
|
617233
617587
|
const messageEvent = event;
|
|
@@ -617390,7 +617744,7 @@ class StdioClientTransport {
|
|
|
617390
617744
|
if (this._process) {
|
|
617391
617745
|
throw new Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");
|
|
617392
617746
|
}
|
|
617393
|
-
return new Promise((
|
|
617747
|
+
return new Promise((resolve51, reject) => {
|
|
617394
617748
|
this._process = import_cross_spawn2.default(this._serverParams.command, this._serverParams.args ?? [], {
|
|
617395
617749
|
env: {
|
|
617396
617750
|
...getDefaultEnvironment(),
|
|
@@ -617406,7 +617760,7 @@ class StdioClientTransport {
|
|
|
617406
617760
|
this.onerror?.(error52);
|
|
617407
617761
|
});
|
|
617408
617762
|
this._process.on("spawn", () => {
|
|
617409
|
-
|
|
617763
|
+
resolve51();
|
|
617410
617764
|
});
|
|
617411
617765
|
this._process.on("close", (_code) => {
|
|
617412
617766
|
this._process = undefined;
|
|
@@ -617453,20 +617807,20 @@ class StdioClientTransport {
|
|
|
617453
617807
|
if (this._process) {
|
|
617454
617808
|
const processToClose = this._process;
|
|
617455
617809
|
this._process = undefined;
|
|
617456
|
-
const closePromise = new Promise((
|
|
617810
|
+
const closePromise = new Promise((resolve51) => {
|
|
617457
617811
|
processToClose.once("close", () => {
|
|
617458
|
-
|
|
617812
|
+
resolve51();
|
|
617459
617813
|
});
|
|
617460
617814
|
});
|
|
617461
617815
|
try {
|
|
617462
617816
|
processToClose.stdin?.end();
|
|
617463
617817
|
} catch {}
|
|
617464
|
-
await Promise.race([closePromise, new Promise((
|
|
617818
|
+
await Promise.race([closePromise, new Promise((resolve51) => setTimeout(resolve51, 2000).unref())]);
|
|
617465
617819
|
if (processToClose.exitCode === null) {
|
|
617466
617820
|
try {
|
|
617467
617821
|
processToClose.kill("SIGTERM");
|
|
617468
617822
|
} catch {}
|
|
617469
|
-
await Promise.race([closePromise, new Promise((
|
|
617823
|
+
await Promise.race([closePromise, new Promise((resolve51) => setTimeout(resolve51, 2000).unref())]);
|
|
617470
617824
|
}
|
|
617471
617825
|
if (processToClose.exitCode === null) {
|
|
617472
617826
|
try {
|
|
@@ -617477,15 +617831,15 @@ class StdioClientTransport {
|
|
|
617477
617831
|
this._readBuffer.clear();
|
|
617478
617832
|
}
|
|
617479
617833
|
send(message) {
|
|
617480
|
-
return new Promise((
|
|
617834
|
+
return new Promise((resolve51) => {
|
|
617481
617835
|
if (!this._process?.stdin) {
|
|
617482
617836
|
throw new Error("Not connected");
|
|
617483
617837
|
}
|
|
617484
617838
|
const json2 = serializeMessage(message);
|
|
617485
617839
|
if (this._process.stdin.write(json2)) {
|
|
617486
|
-
|
|
617840
|
+
resolve51();
|
|
617487
617841
|
} else {
|
|
617488
|
-
this._process.stdin.once("drain",
|
|
617842
|
+
this._process.stdin.once("drain", resolve51);
|
|
617489
617843
|
}
|
|
617490
617844
|
});
|
|
617491
617845
|
}
|
|
@@ -617969,7 +618323,7 @@ async function pMap(iterable, mapper, {
|
|
|
617969
618323
|
const cleanup2 = () => {
|
|
617970
618324
|
signal?.removeEventListener("abort", signalListener);
|
|
617971
618325
|
};
|
|
617972
|
-
const
|
|
618326
|
+
const resolve51 = (value) => {
|
|
617973
618327
|
resolve_(value);
|
|
617974
618328
|
cleanup2();
|
|
617975
618329
|
};
|
|
@@ -618001,7 +618355,7 @@ async function pMap(iterable, mapper, {
|
|
|
618001
618355
|
}
|
|
618002
618356
|
isResolved = true;
|
|
618003
618357
|
if (skippedIndexesMap.size === 0) {
|
|
618004
|
-
|
|
618358
|
+
resolve51(result);
|
|
618005
618359
|
return;
|
|
618006
618360
|
}
|
|
618007
618361
|
const pureResult = [];
|
|
@@ -618011,7 +618365,7 @@ async function pMap(iterable, mapper, {
|
|
|
618011
618365
|
}
|
|
618012
618366
|
pureResult.push(value);
|
|
618013
618367
|
}
|
|
618014
|
-
|
|
618368
|
+
resolve51(pureResult);
|
|
618015
618369
|
}
|
|
618016
618370
|
return;
|
|
618017
618371
|
}
|
|
@@ -620218,11 +620572,11 @@ async function findAvailablePort() {
|
|
|
620218
620572
|
for (let attempt = 0;attempt < maxAttempts; attempt++) {
|
|
620219
620573
|
const port2 = min + Math.floor(Math.random() * range);
|
|
620220
620574
|
try {
|
|
620221
|
-
await new Promise((
|
|
620575
|
+
await new Promise((resolve51, reject2) => {
|
|
620222
620576
|
const testServer = createServer4();
|
|
620223
620577
|
testServer.once("error", reject2);
|
|
620224
620578
|
testServer.listen(port2, () => {
|
|
620225
|
-
testServer.close(() =>
|
|
620579
|
+
testServer.close(() => resolve51());
|
|
620226
620580
|
});
|
|
620227
620581
|
});
|
|
620228
620582
|
return port2;
|
|
@@ -620231,11 +620585,11 @@ async function findAvailablePort() {
|
|
|
620231
620585
|
}
|
|
620232
620586
|
}
|
|
620233
620587
|
try {
|
|
620234
|
-
await new Promise((
|
|
620588
|
+
await new Promise((resolve51, reject2) => {
|
|
620235
620589
|
const testServer = createServer4();
|
|
620236
620590
|
testServer.once("error", reject2);
|
|
620237
620591
|
testServer.listen(REDIRECT_PORT_FALLBACK, () => {
|
|
620238
|
-
testServer.close(() =>
|
|
620592
|
+
testServer.close(() => resolve51());
|
|
620239
620593
|
});
|
|
620240
620594
|
});
|
|
620241
620595
|
return REDIRECT_PORT_FALLBACK;
|
|
@@ -620618,14 +620972,14 @@ function waitForCallback(port2, expectedState, abortSignal, onListening) {
|
|
|
620618
620972
|
abortHandler = null;
|
|
620619
620973
|
}
|
|
620620
620974
|
};
|
|
620621
|
-
return new Promise((
|
|
620975
|
+
return new Promise((resolve51, reject2) => {
|
|
620622
620976
|
let resolved = false;
|
|
620623
620977
|
const resolveOnce = (v6) => {
|
|
620624
620978
|
if (resolved)
|
|
620625
620979
|
return;
|
|
620626
620980
|
resolved = true;
|
|
620627
620981
|
cleanup2();
|
|
620628
|
-
|
|
620982
|
+
resolve51(v6);
|
|
620629
620983
|
};
|
|
620630
620984
|
const rejectOnce = (e4) => {
|
|
620631
620985
|
if (resolved)
|
|
@@ -621231,13 +621585,13 @@ async function performMCPOAuthFlow(serverName, serverConfig, onAuthorizationUrl,
|
|
|
621231
621585
|
}
|
|
621232
621586
|
logMCPDebug(serverName, `MCP OAuth server cleaned up`);
|
|
621233
621587
|
};
|
|
621234
|
-
const authorizationCode = await new Promise((
|
|
621588
|
+
const authorizationCode = await new Promise((resolve51, reject2) => {
|
|
621235
621589
|
let resolved = false;
|
|
621236
621590
|
const resolveOnce = (code) => {
|
|
621237
621591
|
if (resolved)
|
|
621238
621592
|
return;
|
|
621239
621593
|
resolved = true;
|
|
621240
|
-
|
|
621594
|
+
resolve51(code);
|
|
621241
621595
|
};
|
|
621242
621596
|
const rejectOnce = (error52) => {
|
|
621243
621597
|
if (resolved)
|
|
@@ -622052,7 +622406,7 @@ async function readClientSecret() {
|
|
|
622052
622406
|
if (!process.stdin.isTTY) {
|
|
622053
622407
|
throw new Error("No TTY available to prompt for client secret. Set MCP_CLIENT_SECRET env var instead.");
|
|
622054
622408
|
}
|
|
622055
|
-
return new Promise((
|
|
622409
|
+
return new Promise((resolve51, reject2) => {
|
|
622056
622410
|
process.stderr.write("Enter OAuth client secret: ");
|
|
622057
622411
|
process.stdin.setRawMode?.(true);
|
|
622058
622412
|
let secret = "";
|
|
@@ -622064,7 +622418,7 @@ async function readClientSecret() {
|
|
|
622064
622418
|
process.stdin.removeListener("data", onData);
|
|
622065
622419
|
process.stderr.write(`
|
|
622066
622420
|
`);
|
|
622067
|
-
|
|
622421
|
+
resolve51(secret);
|
|
622068
622422
|
} else if (c9 === "\x03") {
|
|
622069
622423
|
process.stdin.setRawMode?.(false);
|
|
622070
622424
|
process.stdin.removeListener("data", onData);
|
|
@@ -622216,8 +622570,8 @@ function createMcpAuthTool(serverName, config7) {
|
|
|
622216
622570
|
}
|
|
622217
622571
|
const sseOrHttpConfig = config7;
|
|
622218
622572
|
let resolveAuthUrl;
|
|
622219
|
-
const authUrlPromise = new Promise((
|
|
622220
|
-
resolveAuthUrl =
|
|
622573
|
+
const authUrlPromise = new Promise((resolve51) => {
|
|
622574
|
+
resolveAuthUrl = resolve51;
|
|
622221
622575
|
});
|
|
622222
622576
|
const controller = new AbortController;
|
|
622223
622577
|
const { setAppState } = context7;
|
|
@@ -622308,15 +622662,15 @@ class WebSocketTransport {
|
|
|
622308
622662
|
isBun = typeof Bun !== "undefined";
|
|
622309
622663
|
constructor(ws) {
|
|
622310
622664
|
this.ws = ws;
|
|
622311
|
-
this.opened = new Promise((
|
|
622665
|
+
this.opened = new Promise((resolve51, reject2) => {
|
|
622312
622666
|
if (this.ws.readyState === WS_OPEN) {
|
|
622313
|
-
|
|
622667
|
+
resolve51();
|
|
622314
622668
|
} else if (this.isBun) {
|
|
622315
622669
|
const nws = this.ws;
|
|
622316
622670
|
const onOpen = () => {
|
|
622317
622671
|
nws.removeEventListener("open", onOpen);
|
|
622318
622672
|
nws.removeEventListener("error", onError);
|
|
622319
|
-
|
|
622673
|
+
resolve51();
|
|
622320
622674
|
};
|
|
622321
622675
|
const onError = (event) => {
|
|
622322
622676
|
nws.removeEventListener("open", onOpen);
|
|
@@ -622329,7 +622683,7 @@ class WebSocketTransport {
|
|
|
622329
622683
|
} else {
|
|
622330
622684
|
const nws = this.ws;
|
|
622331
622685
|
nws.on("open", () => {
|
|
622332
|
-
|
|
622686
|
+
resolve51();
|
|
622333
622687
|
});
|
|
622334
622688
|
nws.on("error", (error52) => {
|
|
622335
622689
|
logForDiagnosticsNoPII("error", "mcp_websocket_connect_fail");
|
|
@@ -622428,12 +622782,12 @@ class WebSocketTransport {
|
|
|
622428
622782
|
if (this.isBun) {
|
|
622429
622783
|
this.ws.send(json2);
|
|
622430
622784
|
} else {
|
|
622431
|
-
await new Promise((
|
|
622785
|
+
await new Promise((resolve51, reject2) => {
|
|
622432
622786
|
this.ws.send(json2, (error52) => {
|
|
622433
622787
|
if (error52) {
|
|
622434
622788
|
reject2(error52);
|
|
622435
622789
|
} else {
|
|
622436
|
-
|
|
622790
|
+
resolve51();
|
|
622437
622791
|
}
|
|
622438
622792
|
});
|
|
622439
622793
|
});
|
|
@@ -622513,9 +622867,9 @@ function registerElicitationHandler(client8, serverName, setAppState) {
|
|
|
622513
622867
|
return hookResponse;
|
|
622514
622868
|
}
|
|
622515
622869
|
const elicitationId = mode === "url" && "elicitationId" in request4.params ? request4.params.elicitationId : undefined;
|
|
622516
|
-
const response3 = new Promise((
|
|
622870
|
+
const response3 = new Promise((resolve51) => {
|
|
622517
622871
|
const onAbort = () => {
|
|
622518
|
-
|
|
622872
|
+
resolve51({ action: "cancel" });
|
|
622519
622873
|
};
|
|
622520
622874
|
if (extra.signal.aborted) {
|
|
622521
622875
|
onAbort();
|
|
@@ -622539,7 +622893,7 @@ function registerElicitationHandler(client8, serverName, setAppState) {
|
|
|
622539
622893
|
mode,
|
|
622540
622894
|
action: result2.action
|
|
622541
622895
|
});
|
|
622542
|
-
|
|
622896
|
+
resolve51(result2);
|
|
622543
622897
|
}
|
|
622544
622898
|
}
|
|
622545
622899
|
]
|
|
@@ -622668,11 +623022,11 @@ var init_roots = __esm(() => {
|
|
|
622668
623022
|
});
|
|
622669
623023
|
|
|
622670
623024
|
// src/tools/MCPTool/classifyForCollapse.ts
|
|
622671
|
-
function
|
|
623025
|
+
function normalize14(name3) {
|
|
622672
623026
|
return name3.replace(/([a-z])([A-Z])/g, "$1_$2").replace(/-/g, "_").toLowerCase();
|
|
622673
623027
|
}
|
|
622674
623028
|
function classifyMcpToolForCollapse(_serverName, toolName) {
|
|
622675
|
-
const normalized =
|
|
623029
|
+
const normalized = normalize14(toolName);
|
|
622676
623030
|
return {
|
|
622677
623031
|
isSearch: SEARCH_TOOLS.has(normalized),
|
|
622678
623032
|
isRead: READ_TOOLS.has(normalized)
|
|
@@ -624528,7 +624882,7 @@ async function runPermissionDialog(req) {
|
|
|
624528
624882
|
};
|
|
624529
624883
|
}
|
|
624530
624884
|
try {
|
|
624531
|
-
return await new Promise((
|
|
624885
|
+
return await new Promise((resolve51, reject2) => {
|
|
624532
624886
|
const signal = context7.abortController.signal;
|
|
624533
624887
|
if (signal.aborted) {
|
|
624534
624888
|
reject2(new Error("Computer Use permission dialog aborted"));
|
|
@@ -624544,7 +624898,7 @@ async function runPermissionDialog(req) {
|
|
|
624544
624898
|
request: req,
|
|
624545
624899
|
onDone: (resp) => {
|
|
624546
624900
|
signal.removeEventListener("abort", onAbort);
|
|
624547
|
-
|
|
624901
|
+
resolve51(resp);
|
|
624548
624902
|
}
|
|
624549
624903
|
}),
|
|
624550
624904
|
shouldHidePromptInput: true
|
|
@@ -624639,12 +624993,12 @@ class StdioServerTransport {
|
|
|
624639
624993
|
this.onclose?.();
|
|
624640
624994
|
}
|
|
624641
624995
|
send(message) {
|
|
624642
|
-
return new Promise((
|
|
624996
|
+
return new Promise((resolve51) => {
|
|
624643
624997
|
const json2 = serializeMessage(message);
|
|
624644
624998
|
if (this._stdout.write(json2)) {
|
|
624645
|
-
|
|
624999
|
+
resolve51();
|
|
624646
625000
|
} else {
|
|
624647
|
-
this._stdout.once("drain",
|
|
625001
|
+
this._stdout.once("drain", resolve51);
|
|
624648
625002
|
}
|
|
624649
625003
|
});
|
|
624650
625004
|
}
|
|
@@ -625056,8 +625410,8 @@ async function tryGetInstalledAppNames() {
|
|
|
625056
625410
|
const adapter2 = getComputerUseHostAdapter();
|
|
625057
625411
|
const enumP = adapter2.executor.listInstalledApps();
|
|
625058
625412
|
let timer2;
|
|
625059
|
-
const timeoutP = new Promise((
|
|
625060
|
-
timer2 = setTimeout(
|
|
625413
|
+
const timeoutP = new Promise((resolve51) => {
|
|
625414
|
+
timer2 = setTimeout(resolve51, APP_ENUM_TIMEOUT_MS, undefined);
|
|
625061
625415
|
});
|
|
625062
625416
|
const installed = await Promise.race([enumP, timeoutP]).catch(() => {
|
|
625063
625417
|
return;
|
|
@@ -625115,7 +625469,7 @@ var init_mcpServer2 = __esm(() => {
|
|
|
625115
625469
|
// src/services/mcp/client.ts
|
|
625116
625470
|
import { Readable as Readable10 } from "stream";
|
|
625117
625471
|
import { mkdir as mkdir38, readFile as readFile47, unlink as unlink20, writeFile as writeFile40 } from "fs/promises";
|
|
625118
|
-
import { dirname as
|
|
625472
|
+
import { dirname as dirname57, join as join126 } from "path";
|
|
625119
625473
|
function isMcpSessionExpiredError(error52) {
|
|
625120
625474
|
const httpStatus = "code" in error52 ? error52.code : undefined;
|
|
625121
625475
|
if (httpStatus !== 404) {
|
|
@@ -625154,7 +625508,7 @@ function setMcpAuthCacheEntry(serverId) {
|
|
|
625154
625508
|
const cache7 = await getMcpAuthCache();
|
|
625155
625509
|
cache7[serverId] = { timestamp: Date.now() };
|
|
625156
625510
|
const cachePath = getMcpAuthCachePath();
|
|
625157
|
-
await mkdir38(
|
|
625511
|
+
await mkdir38(dirname57(cachePath), { recursive: true });
|
|
625158
625512
|
await writeFile40(cachePath, jsonStringify(cache7));
|
|
625159
625513
|
authCachePromise = null;
|
|
625160
625514
|
}).catch(() => {});
|
|
@@ -625556,8 +625910,8 @@ async function waitForMcpConnectionBatch(connectionPromise, label) {
|
|
|
625556
625910
|
let timer2;
|
|
625557
625911
|
const timedOut = await Promise.race([
|
|
625558
625912
|
connectionPromise.then(() => false),
|
|
625559
|
-
new Promise((
|
|
625560
|
-
timer2 = setTimeout(() =>
|
|
625913
|
+
new Promise((resolve51) => {
|
|
625914
|
+
timer2 = setTimeout(() => resolve51(true), MCP_CONNECTION_TIMEOUT_MS);
|
|
625561
625915
|
})
|
|
625562
625916
|
]);
|
|
625563
625917
|
if (timer2)
|
|
@@ -625569,12 +625923,12 @@ async function waitForMcpConnectionBatch(connectionPromise, label) {
|
|
|
625569
625923
|
return "connected";
|
|
625570
625924
|
}
|
|
625571
625925
|
function prefetchAllMcpResources(mcpConfigs) {
|
|
625572
|
-
return new Promise((
|
|
625926
|
+
return new Promise((resolve51) => {
|
|
625573
625927
|
let pendingCount = 0;
|
|
625574
625928
|
let completedCount = 0;
|
|
625575
625929
|
pendingCount = Object.keys(mcpConfigs).length;
|
|
625576
625930
|
if (pendingCount === 0) {
|
|
625577
|
-
|
|
625931
|
+
resolve51({
|
|
625578
625932
|
clients: [],
|
|
625579
625933
|
tools: [],
|
|
625580
625934
|
commands: []
|
|
@@ -625599,7 +625953,7 @@ function prefetchAllMcpResources(mcpConfigs) {
|
|
|
625599
625953
|
commands_count: commands7.length,
|
|
625600
625954
|
commands_metadata_length: commandsMetadataLength
|
|
625601
625955
|
});
|
|
625602
|
-
|
|
625956
|
+
resolve51({
|
|
625603
625957
|
clients,
|
|
625604
625958
|
tools,
|
|
625605
625959
|
commands: commands7
|
|
@@ -625607,7 +625961,7 @@ function prefetchAllMcpResources(mcpConfigs) {
|
|
|
625607
625961
|
}
|
|
625608
625962
|
}, mcpConfigs).catch((error52) => {
|
|
625609
625963
|
logMCPError("prefetchAllMcpResources", `Failed to get MCP resources: ${errorMessage(error52)}`);
|
|
625610
|
-
|
|
625964
|
+
resolve51({
|
|
625611
625965
|
clients: [],
|
|
625612
625966
|
tools: [],
|
|
625613
625967
|
commands: []
|
|
@@ -625882,9 +626236,9 @@ async function callMCPToolWithUrlElicitationRetry({
|
|
|
625882
626236
|
actionLabel: "Retry now",
|
|
625883
626237
|
showCancel: true
|
|
625884
626238
|
};
|
|
625885
|
-
userResult = await new Promise((
|
|
626239
|
+
userResult = await new Promise((resolve51) => {
|
|
625886
626240
|
const onAbort = () => {
|
|
625887
|
-
|
|
626241
|
+
resolve51({ action: "cancel" });
|
|
625888
626242
|
};
|
|
625889
626243
|
if (signal.aborted) {
|
|
625890
626244
|
onAbort();
|
|
@@ -625907,14 +626261,14 @@ async function callMCPToolWithUrlElicitationRetry({
|
|
|
625907
626261
|
return;
|
|
625908
626262
|
}
|
|
625909
626263
|
signal.removeEventListener("abort", onAbort);
|
|
625910
|
-
|
|
626264
|
+
resolve51(result);
|
|
625911
626265
|
},
|
|
625912
626266
|
onWaitingDismiss: (action2) => {
|
|
625913
626267
|
signal.removeEventListener("abort", onAbort);
|
|
625914
626268
|
if (action2 === "retry") {
|
|
625915
|
-
|
|
626269
|
+
resolve51({ action: "accept" });
|
|
625916
626270
|
} else {
|
|
625917
|
-
|
|
626271
|
+
resolve51({ action: "cancel" });
|
|
625918
626272
|
}
|
|
625919
626273
|
}
|
|
625920
626274
|
}
|
|
@@ -626713,7 +627067,7 @@ var init_client12 = __esm(() => {
|
|
|
626713
627067
|
logMCPDebug(name3, `Error sending SIGINT: ${error52}`);
|
|
626714
627068
|
return;
|
|
626715
627069
|
}
|
|
626716
|
-
await new Promise((
|
|
627070
|
+
await new Promise((resolve51, reject2) => {
|
|
626717
627071
|
(async () => {
|
|
626718
627072
|
let resolved = false;
|
|
626719
627073
|
const checkInterval = setInterval(() => {
|
|
@@ -626725,7 +627079,7 @@ var init_client12 = __esm(() => {
|
|
|
626725
627079
|
clearInterval(checkInterval);
|
|
626726
627080
|
clearTimeout(failsafeTimeout);
|
|
626727
627081
|
logMCPDebug(name3, "MCP server process exited cleanly");
|
|
626728
|
-
|
|
627082
|
+
resolve51();
|
|
626729
627083
|
}
|
|
626730
627084
|
}
|
|
626731
627085
|
}, 50);
|
|
@@ -626734,7 +627088,7 @@ var init_client12 = __esm(() => {
|
|
|
626734
627088
|
resolved = true;
|
|
626735
627089
|
clearInterval(checkInterval);
|
|
626736
627090
|
logMCPDebug(name3, "Cleanup timeout reached, stopping process monitoring");
|
|
626737
|
-
|
|
627091
|
+
resolve51();
|
|
626738
627092
|
}
|
|
626739
627093
|
}, 600);
|
|
626740
627094
|
try {
|
|
@@ -626750,14 +627104,14 @@ var init_client12 = __esm(() => {
|
|
|
626750
627104
|
resolved = true;
|
|
626751
627105
|
clearInterval(checkInterval);
|
|
626752
627106
|
clearTimeout(failsafeTimeout);
|
|
626753
|
-
|
|
627107
|
+
resolve51();
|
|
626754
627108
|
return;
|
|
626755
627109
|
}
|
|
626756
627110
|
} catch {
|
|
626757
627111
|
resolved = true;
|
|
626758
627112
|
clearInterval(checkInterval);
|
|
626759
627113
|
clearTimeout(failsafeTimeout);
|
|
626760
|
-
|
|
627114
|
+
resolve51();
|
|
626761
627115
|
return;
|
|
626762
627116
|
}
|
|
626763
627117
|
await sleep2(400);
|
|
@@ -626774,7 +627128,7 @@ var init_client12 = __esm(() => {
|
|
|
626774
627128
|
resolved = true;
|
|
626775
627129
|
clearInterval(checkInterval);
|
|
626776
627130
|
clearTimeout(failsafeTimeout);
|
|
626777
|
-
|
|
627131
|
+
resolve51();
|
|
626778
627132
|
}
|
|
626779
627133
|
}
|
|
626780
627134
|
}
|
|
@@ -626782,17 +627136,17 @@ var init_client12 = __esm(() => {
|
|
|
626782
627136
|
resolved = true;
|
|
626783
627137
|
clearInterval(checkInterval);
|
|
626784
627138
|
clearTimeout(failsafeTimeout);
|
|
626785
|
-
|
|
627139
|
+
resolve51();
|
|
626786
627140
|
}
|
|
626787
627141
|
} catch {
|
|
626788
627142
|
if (!resolved) {
|
|
626789
627143
|
resolved = true;
|
|
626790
627144
|
clearInterval(checkInterval);
|
|
626791
627145
|
clearTimeout(failsafeTimeout);
|
|
626792
|
-
|
|
627146
|
+
resolve51();
|
|
626793
627147
|
}
|
|
626794
627148
|
}
|
|
626795
|
-
})().then(
|
|
627149
|
+
})().then(resolve51, reject2);
|
|
626796
627150
|
});
|
|
626797
627151
|
}
|
|
626798
627152
|
} catch (processError) {
|
|
@@ -631453,8 +631807,8 @@ __export(exports_permissionSetup, {
|
|
|
631453
631807
|
createDisabledBypassPermissionsContext: () => createDisabledBypassPermissionsContext,
|
|
631454
631808
|
checkAndDisableBypassPermissions: () => checkAndDisableBypassPermissions
|
|
631455
631809
|
});
|
|
631456
|
-
import { relative as
|
|
631457
|
-
import { resolve as
|
|
631810
|
+
import { relative as relative26 } from "path";
|
|
631811
|
+
import { resolve as resolve51 } from "path";
|
|
631458
631812
|
function isDangerousBashPermission(toolName, ruleContent) {
|
|
631459
631813
|
if (toolName !== BASH_TOOL_NAME) {
|
|
631460
631814
|
return false;
|
|
@@ -631557,7 +631911,7 @@ function formatPermissionSource(source2) {
|
|
|
631557
631911
|
if (SETTING_SOURCES.includes(source2)) {
|
|
631558
631912
|
const filePath = getSettingsFilePathForSource(source2);
|
|
631559
631913
|
if (filePath) {
|
|
631560
|
-
const relativePath =
|
|
631914
|
+
const relativePath = relative26(getCwd(), filePath);
|
|
631561
631915
|
return relativePath.length < filePath.length ? relativePath : filePath;
|
|
631562
631916
|
}
|
|
631563
631917
|
}
|
|
@@ -631786,7 +632140,7 @@ function isSymlinkTo({
|
|
|
631786
632140
|
originalCwd
|
|
631787
632141
|
}) {
|
|
631788
632142
|
const { resolvedPath: resolvedProcessPwd, isSymlink: isProcessPwdSymlink } = safeResolvePath(getFsImplementation(), processPwd);
|
|
631789
|
-
return isProcessPwdSymlink ? resolvedProcessPwd ===
|
|
632143
|
+
return isProcessPwdSymlink ? resolvedProcessPwd === resolve51(originalCwd) : false;
|
|
631790
632144
|
}
|
|
631791
632145
|
function initialPermissionModeFromCLI({
|
|
631792
632146
|
permissionModeCli,
|
|
@@ -632873,7 +633227,7 @@ var init_appleTerminalBackup = __esm(() => {
|
|
|
632873
633227
|
|
|
632874
633228
|
// src/utils/completionCache.ts
|
|
632875
633229
|
import { homedir as homedir34 } from "os";
|
|
632876
|
-
import { dirname as
|
|
633230
|
+
import { dirname as dirname58, join as join129 } from "path";
|
|
632877
633231
|
function detectShell() {
|
|
632878
633232
|
const shell = process.env.SHELL || "";
|
|
632879
633233
|
const home = homedir34();
|
|
@@ -632954,7 +633308,7 @@ __export(exports_terminalSetup, {
|
|
|
632954
633308
|
import { randomBytes as randomBytes15 } from "crypto";
|
|
632955
633309
|
import { copyFile as copyFile9, mkdir as mkdir39, readFile as readFile48, writeFile as writeFile41 } from "fs/promises";
|
|
632956
633310
|
import { homedir as homedir35, platform as platform5 } from "os";
|
|
632957
|
-
import { dirname as
|
|
633311
|
+
import { dirname as dirname59, join as join130 } from "path";
|
|
632958
633312
|
import { pathToFileURL as pathToFileURL7 } from "url";
|
|
632959
633313
|
function isVSCodeRemoteSSH() {
|
|
632960
633314
|
const askpassMain = process.env.VSCODE_GIT_ASKPASS_MAIN ?? "";
|
|
@@ -633285,7 +633639,7 @@ chars = "\\u001B\\r"`;
|
|
|
633285
633639
|
return `${color("warning", theme)("Error backing up existing Alacritty config. Bailing out.")}${EOL7}${source_default.dim(`See ${formatPathLink(configPath)}`)}${EOL7}${source_default.dim(`Backup path: ${formatPathLink(backupPath)}`)}${EOL7}`;
|
|
633286
633640
|
}
|
|
633287
633641
|
} else {
|
|
633288
|
-
await mkdir39(
|
|
633642
|
+
await mkdir39(dirname59(configPath), {
|
|
633289
633643
|
recursive: true
|
|
633290
633644
|
});
|
|
633291
633645
|
}
|
|
@@ -635852,17 +636206,17 @@ var init_TextInput = __esm(() => {
|
|
|
635852
636206
|
});
|
|
635853
636207
|
|
|
635854
636208
|
// src/utils/suggestions/directoryCompletion.ts
|
|
635855
|
-
import { basename as basename41, dirname as
|
|
636209
|
+
import { basename as basename41, dirname as dirname60, join as join133, sep as sep37 } from "path";
|
|
635856
636210
|
function parsePartialPath(partialPath, basePath) {
|
|
635857
636211
|
if (!partialPath) {
|
|
635858
636212
|
const directory2 = basePath || getCwd();
|
|
635859
636213
|
return { directory: directory2, prefix: "" };
|
|
635860
636214
|
}
|
|
635861
636215
|
const resolved = expandPath(partialPath, basePath);
|
|
635862
|
-
if (partialPath.endsWith("/") || partialPath.endsWith(
|
|
636216
|
+
if (partialPath.endsWith("/") || partialPath.endsWith(sep37)) {
|
|
635863
636217
|
return { directory: resolved, prefix: "" };
|
|
635864
636218
|
}
|
|
635865
|
-
const directory =
|
|
636219
|
+
const directory = dirname60(resolved);
|
|
635866
636220
|
const prefix = basename41(partialPath);
|
|
635867
636221
|
return { directory, prefix };
|
|
635868
636222
|
}
|
|
@@ -635944,15 +636298,15 @@ async function getPathCompletions(partialPath, options = {}) {
|
|
|
635944
636298
|
return false;
|
|
635945
636299
|
return entry.name.toLowerCase().startsWith(prefixLower);
|
|
635946
636300
|
}).slice(0, maxResults);
|
|
635947
|
-
const hasSeparator = partialPath.includes("/") || partialPath.includes(
|
|
636301
|
+
const hasSeparator = partialPath.includes("/") || partialPath.includes(sep37);
|
|
635948
636302
|
let dirPortion = "";
|
|
635949
636303
|
if (hasSeparator) {
|
|
635950
636304
|
const lastSlash = partialPath.lastIndexOf("/");
|
|
635951
|
-
const lastSep = partialPath.lastIndexOf(
|
|
636305
|
+
const lastSep = partialPath.lastIndexOf(sep37);
|
|
635952
636306
|
const lastSeparatorPos = Math.max(lastSlash, lastSep);
|
|
635953
636307
|
dirPortion = partialPath.substring(0, lastSeparatorPos + 1);
|
|
635954
636308
|
}
|
|
635955
|
-
if (dirPortion.startsWith("./") || dirPortion.startsWith("." +
|
|
636309
|
+
if (dirPortion.startsWith("./") || dirPortion.startsWith("." + sep37)) {
|
|
635956
636310
|
dirPortion = dirPortion.slice(2);
|
|
635957
636311
|
}
|
|
635958
636312
|
return matches.map((entry) => {
|
|
@@ -637646,7 +638000,7 @@ __export(exports_workerRegistry, {
|
|
|
637646
638000
|
DEFAULT_PREWARM_PER_SWEEP: () => DEFAULT_PREWARM_PER_SWEEP
|
|
637647
638001
|
});
|
|
637648
638002
|
import { spawn as spawn13 } from "child_process";
|
|
637649
|
-
import { existsSync as existsSync19, readFileSync as
|
|
638003
|
+
import { existsSync as existsSync19, readFileSync as readFileSync30, writeFileSync as writeFileSync13 } from "fs";
|
|
637650
638004
|
import { join as join135 } from "path";
|
|
637651
638005
|
function getDaemonJsonPath() {
|
|
637652
638006
|
return join135(getClaudeConfigHomeDir(), "daemon.json");
|
|
@@ -637661,7 +638015,7 @@ function readDaemonJson() {
|
|
|
637661
638015
|
}
|
|
637662
638016
|
let raw;
|
|
637663
638017
|
try {
|
|
637664
|
-
raw =
|
|
638018
|
+
raw = readFileSync30(path35, { encoding: "utf-8" });
|
|
637665
638019
|
} catch {
|
|
637666
638020
|
return { prewarmPerSweep: DEFAULT_PREWARM_PER_SWEEP };
|
|
637667
638021
|
}
|
|
@@ -637689,7 +638043,7 @@ function readDaemonStatus() {
|
|
|
637689
638043
|
return [];
|
|
637690
638044
|
let raw;
|
|
637691
638045
|
try {
|
|
637692
|
-
raw =
|
|
638046
|
+
raw = readFileSync30(path35, { encoding: "utf-8" });
|
|
637693
638047
|
} catch {
|
|
637694
638048
|
return [];
|
|
637695
638049
|
}
|
|
@@ -637716,12 +638070,12 @@ function writeDaemonStatus() {
|
|
|
637716
638070
|
id: r4.id,
|
|
637717
638071
|
exitCode: r4.exitCode
|
|
637718
638072
|
}));
|
|
637719
|
-
|
|
638073
|
+
writeFileSync13(getDaemonStatusPath(), JSON.stringify(snapshot2), { encoding: "utf-8" });
|
|
637720
638074
|
} catch {}
|
|
637721
638075
|
}
|
|
637722
638076
|
function writeDaemonJson(config7) {
|
|
637723
638077
|
try {
|
|
637724
|
-
|
|
638078
|
+
writeFileSync13(getDaemonJsonPath(), JSON.stringify(config7, null, 2), {
|
|
637725
638079
|
encoding: "utf-8"
|
|
637726
638080
|
});
|
|
637727
638081
|
} catch {}
|
|
@@ -638011,7 +638365,7 @@ var init_respawn = __esm(() => {
|
|
|
638011
638365
|
});
|
|
638012
638366
|
|
|
638013
638367
|
// src/daemon/install.ts
|
|
638014
|
-
import { existsSync as existsSync20, mkdirSync as mkdirSync10, writeFileSync as
|
|
638368
|
+
import { existsSync as existsSync20, mkdirSync as mkdirSync10, writeFileSync as writeFileSync14, unlinkSync as unlinkSync6 } from "fs";
|
|
638015
638369
|
import { homedir as homedir36 } from "os";
|
|
638016
638370
|
import { join as join136 } from "path";
|
|
638017
638371
|
import { spawnSync as spawnSync9 } from "child_process";
|
|
@@ -638072,7 +638426,7 @@ function installLaunchd() {
|
|
|
638072
638426
|
</dict>
|
|
638073
638427
|
</plist>
|
|
638074
638428
|
`;
|
|
638075
|
-
|
|
638429
|
+
writeFileSync14(plistPath, plist, { encoding: "utf-8" });
|
|
638076
638430
|
spawnSync9("launchctl", ["unload", plistPath], { stdio: "ignore" });
|
|
638077
638431
|
const res = spawnSync9("launchctl", ["load", plistPath], { encoding: "utf-8" });
|
|
638078
638432
|
logEvent2("daemon_install_launchd", { ok: res.status === 0 });
|
|
@@ -638096,7 +638450,7 @@ StandardError=append:${join136(homedir36(), ".claude", "daemon.log")}
|
|
|
638096
638450
|
[Install]
|
|
638097
638451
|
WantedBy=default.target
|
|
638098
638452
|
`;
|
|
638099
|
-
|
|
638453
|
+
writeFileSync14(unitPath, unit, { encoding: "utf-8" });
|
|
638100
638454
|
spawnSync9("systemctl", ["--user", "daemon-reload"], { stdio: "ignore" });
|
|
638101
638455
|
spawnSync9("systemctl", ["--user", "enable", "claude-daemon.service"], { stdio: "ignore" });
|
|
638102
638456
|
spawnSync9("loginctl", ["enable-linger", process.env.USER ?? "root"], {
|
|
@@ -638137,7 +638491,7 @@ var init_install2 = __esm(() => {
|
|
|
638137
638491
|
import { createServer as createServer7 } from "http";
|
|
638138
638492
|
import { randomBytes as randomBytes16 } from "crypto";
|
|
638139
638493
|
import { join as join137 } from "path";
|
|
638140
|
-
import { existsSync as existsSync21, readFileSync as
|
|
638494
|
+
import { existsSync as existsSync21, readFileSync as readFileSync31, writeFileSync as writeFileSync15, unlinkSync as unlinkSync7 } from "fs";
|
|
638141
638495
|
function getRemoteControlSocketPath() {
|
|
638142
638496
|
return join137(getClaudeConfigHomeDir(), REMOTE_SOCKET_NAME);
|
|
638143
638497
|
}
|
|
@@ -638155,7 +638509,7 @@ function loadPromptMirror() {
|
|
|
638155
638509
|
try {
|
|
638156
638510
|
if (!existsSync21(getRemoteControlPromptsPath()))
|
|
638157
638511
|
return;
|
|
638158
|
-
const raw =
|
|
638512
|
+
const raw = readFileSync31(getRemoteControlPromptsPath(), { encoding: "utf-8" });
|
|
638159
638513
|
const parsed = JSON.parse(raw);
|
|
638160
638514
|
if (Array.isArray(parsed)) {
|
|
638161
638515
|
for (const p4 of parsed) {
|
|
@@ -638173,7 +638527,7 @@ function loadPromptMirror() {
|
|
|
638173
638527
|
}
|
|
638174
638528
|
function savePromptMirror() {
|
|
638175
638529
|
try {
|
|
638176
|
-
|
|
638530
|
+
writeFileSync15(getRemoteControlPromptsPath(), JSON.stringify(promptQueue), {
|
|
638177
638531
|
encoding: "utf-8"
|
|
638178
638532
|
});
|
|
638179
638533
|
} catch {}
|
|
@@ -638191,7 +638545,7 @@ function loadChannelMirror() {
|
|
|
638191
638545
|
try {
|
|
638192
638546
|
if (!existsSync21(getRemoteControlChannelPath()))
|
|
638193
638547
|
return;
|
|
638194
|
-
const raw =
|
|
638548
|
+
const raw = readFileSync31(getRemoteControlChannelPath(), { encoding: "utf-8" });
|
|
638195
638549
|
const parsed = JSON.parse(raw);
|
|
638196
638550
|
if (parsed && typeof parsed.name === "string" && parsed.name.length > 0) {
|
|
638197
638551
|
activeChannel = {
|
|
@@ -638207,7 +638561,7 @@ function loadChannelMirror() {
|
|
|
638207
638561
|
}
|
|
638208
638562
|
function saveChannelMirror() {
|
|
638209
638563
|
try {
|
|
638210
|
-
|
|
638564
|
+
writeFileSync15(getRemoteControlChannelPath(), activeChannel ? JSON.stringify(activeChannel) : "null", { encoding: "utf-8" });
|
|
638211
638565
|
} catch {}
|
|
638212
638566
|
}
|
|
638213
638567
|
function getActiveChannel() {
|
|
@@ -638222,7 +638576,7 @@ function setActiveChannel(channel2) {
|
|
|
638222
638576
|
saveChannelMirror();
|
|
638223
638577
|
}
|
|
638224
638578
|
function readBody(req) {
|
|
638225
|
-
return new Promise((
|
|
638579
|
+
return new Promise((resolve52, reject2) => {
|
|
638226
638580
|
let len = 0;
|
|
638227
638581
|
const chunks = [];
|
|
638228
638582
|
req.on("data", (chunk) => {
|
|
@@ -638234,7 +638588,7 @@ function readBody(req) {
|
|
|
638234
638588
|
}
|
|
638235
638589
|
chunks.push(chunk);
|
|
638236
638590
|
});
|
|
638237
|
-
req.on("end", () =>
|
|
638591
|
+
req.on("end", () => resolve52(Buffer.concat(chunks).toString("utf-8")));
|
|
638238
638592
|
req.on("error", reject2);
|
|
638239
638593
|
});
|
|
638240
638594
|
}
|
|
@@ -638404,11 +638758,11 @@ async function startRemoteControlServer(token) {
|
|
|
638404
638758
|
});
|
|
638405
638759
|
const MAX_SOCKET_PATH = 100;
|
|
638406
638760
|
const listenTarget = socketPath2.length > MAX_SOCKET_PATH ? { port: 0, host: "127.0.0.1" } : { path: socketPath2 };
|
|
638407
|
-
await new Promise((
|
|
638761
|
+
await new Promise((resolve52, reject2) => {
|
|
638408
638762
|
server.on("error", (err2) => {
|
|
638409
638763
|
reject2(err2);
|
|
638410
638764
|
});
|
|
638411
|
-
server.listen(listenTarget, () =>
|
|
638765
|
+
server.listen(listenTarget, () => resolve52());
|
|
638412
638766
|
}).catch(() => null);
|
|
638413
638767
|
if (!server.listening) {
|
|
638414
638768
|
return null;
|
|
@@ -638419,9 +638773,9 @@ async function startRemoteControlServer(token) {
|
|
|
638419
638773
|
return { server, token, socketPath: resolvedSocketPath };
|
|
638420
638774
|
}
|
|
638421
638775
|
async function stopRemoteControlServer(handle2) {
|
|
638422
|
-
await new Promise((
|
|
638423
|
-
handle2.server.close(() =>
|
|
638424
|
-
setTimeout(
|
|
638776
|
+
await new Promise((resolve52) => {
|
|
638777
|
+
handle2.server.close(() => resolve52());
|
|
638778
|
+
setTimeout(resolve52, 500);
|
|
638425
638779
|
});
|
|
638426
638780
|
try {
|
|
638427
638781
|
if (existsSync21(handle2.socketPath)) {
|
|
@@ -638658,7 +639012,7 @@ var exports_daemon = {};
|
|
|
638658
639012
|
__export(exports_daemon, {
|
|
638659
639013
|
call: () => call11
|
|
638660
639014
|
});
|
|
638661
|
-
import { existsSync as existsSync23, readFileSync as
|
|
639015
|
+
import { existsSync as existsSync23, readFileSync as readFileSync32 } from "fs";
|
|
638662
639016
|
import { execSync as execSync3 } from "child_process";
|
|
638663
639017
|
import { join as join138 } from "path";
|
|
638664
639018
|
function daemonLogPath() {
|
|
@@ -638738,7 +639092,7 @@ function handleLogs() {
|
|
|
638738
639092
|
});
|
|
638739
639093
|
return out;
|
|
638740
639094
|
} catch {
|
|
638741
|
-
const raw =
|
|
639095
|
+
const raw = readFileSync32(path35, { encoding: "utf-8" });
|
|
638742
639096
|
return raw.split(`
|
|
638743
639097
|
`).slice(-200).join(`
|
|
638744
639098
|
`);
|
|
@@ -640227,8 +640581,8 @@ class FileIndex {
|
|
|
640227
640581
|
}
|
|
640228
640582
|
loadFromFileListAsync(fileList) {
|
|
640229
640583
|
let markQueryable = () => {};
|
|
640230
|
-
const queryable = new Promise((
|
|
640231
|
-
markQueryable =
|
|
640584
|
+
const queryable = new Promise((resolve52) => {
|
|
640585
|
+
markQueryable = resolve52;
|
|
640232
640586
|
});
|
|
640233
640587
|
const done = this.buildAsync(fileList, markQueryable);
|
|
640234
640588
|
return { queryable, done };
|
|
@@ -640409,7 +640763,7 @@ function isUpper(code) {
|
|
|
640409
640763
|
return code >= 65 && code <= 90;
|
|
640410
640764
|
}
|
|
640411
640765
|
function yieldToEventLoop() {
|
|
640412
|
-
return new Promise((
|
|
640766
|
+
return new Promise((resolve52) => setImmediate(resolve52));
|
|
640413
640767
|
}
|
|
640414
640768
|
function computeTopLevelEntries(paths2, limit) {
|
|
640415
640769
|
const topLevel = new Set;
|
|
@@ -650344,7 +650698,7 @@ function extractFirstFrame(output2) {
|
|
|
650344
650698
|
return output2.slice(contentStart, endIndex);
|
|
650345
650699
|
}
|
|
650346
650700
|
function renderToAnsiString(node2, columns) {
|
|
650347
|
-
return new Promise(async (
|
|
650701
|
+
return new Promise(async (resolve52) => {
|
|
650348
650702
|
let output2 = "";
|
|
650349
650703
|
const stream6 = new PassThrough6;
|
|
650350
650704
|
if (columns !== undefined) {
|
|
@@ -650360,7 +650714,7 @@ function renderToAnsiString(node2, columns) {
|
|
|
650360
650714
|
patchConsole: false
|
|
650361
650715
|
});
|
|
650362
650716
|
await instance.waitUntilExit();
|
|
650363
|
-
await
|
|
650717
|
+
await resolve52(extractFirstFrame(output2));
|
|
650364
650718
|
});
|
|
650365
650719
|
}
|
|
650366
650720
|
async function renderToString(node2, columns) {
|
|
@@ -650660,7 +651014,7 @@ var init_useTurnDiffs = __esm(() => {
|
|
|
650660
651014
|
});
|
|
650661
651015
|
|
|
650662
651016
|
// src/components/diff/DiffDetailView.tsx
|
|
650663
|
-
import { resolve as
|
|
651017
|
+
import { resolve as resolve52 } from "path";
|
|
650664
651018
|
function DiffDetailView(t0) {
|
|
650665
651019
|
const $4 = import_compiler_runtime148.c(53);
|
|
650666
651020
|
const {
|
|
@@ -650693,7 +651047,7 @@ function DiffDetailView(t0) {
|
|
|
650693
651047
|
let content;
|
|
650694
651048
|
let t23;
|
|
650695
651049
|
if ($4[1] !== filePath) {
|
|
650696
|
-
const fullPath =
|
|
651050
|
+
const fullPath = resolve52(getCwd(), filePath);
|
|
650697
651051
|
content = readFileSafe(fullPath);
|
|
650698
651052
|
t23 = content?.split(`
|
|
650699
651053
|
`)[0] ?? null;
|
|
@@ -654731,12 +655085,12 @@ var init_MemoryFileSelector = __esm(() => {
|
|
|
654731
655085
|
|
|
654732
655086
|
// src/components/memory/MemoryUpdateNotification.tsx
|
|
654733
655087
|
import { homedir as homedir37 } from "os";
|
|
654734
|
-
import { relative as
|
|
655088
|
+
import { relative as relative28 } from "path";
|
|
654735
655089
|
function getRelativeMemoryPath(path36) {
|
|
654736
655090
|
const homeDir = homedir37();
|
|
654737
655091
|
const cwd2 = getCwd();
|
|
654738
655092
|
const relativeToHome = path36.startsWith(homeDir) ? "~" + path36.slice(homeDir.length) : null;
|
|
654739
|
-
const relativeToCwd = path36.startsWith(cwd2) ? "./" +
|
|
655093
|
+
const relativeToCwd = path36.startsWith(cwd2) ? "./" + relative28(cwd2, path36) : null;
|
|
654740
655094
|
if (relativeToHome && relativeToCwd) {
|
|
654741
655095
|
return relativeToHome.length <= relativeToCwd.length ? relativeToHome : relativeToCwd;
|
|
654742
655096
|
}
|
|
@@ -657532,7 +657886,7 @@ __export(exports_keybindings, {
|
|
|
657532
657886
|
call: () => call29
|
|
657533
657887
|
});
|
|
657534
657888
|
import { mkdir as mkdir44, writeFile as writeFile47 } from "fs/promises";
|
|
657535
|
-
import { dirname as
|
|
657889
|
+
import { dirname as dirname62 } from "path";
|
|
657536
657890
|
async function call29() {
|
|
657537
657891
|
if (!isKeybindingCustomizationEnabled()) {
|
|
657538
657892
|
return {
|
|
@@ -657542,7 +657896,7 @@ async function call29() {
|
|
|
657542
657896
|
}
|
|
657543
657897
|
const keybindingsPath = getKeybindingsPath();
|
|
657544
657898
|
let fileExists = false;
|
|
657545
|
-
await mkdir44(
|
|
657899
|
+
await mkdir44(dirname62(keybindingsPath), { recursive: true });
|
|
657546
657900
|
try {
|
|
657547
657901
|
await writeFile47(keybindingsPath, generateKeybindingsTemplate(), {
|
|
657548
657902
|
encoding: "utf-8",
|
|
@@ -662579,8 +662933,8 @@ function useManageMCPConnections(dynamicMcpConfig, isStrictMcpConfig = false) {
|
|
|
662579
662933
|
}
|
|
662580
662934
|
const backoffMs = Math.min(INITIAL_BACKOFF_MS * Math.pow(2, attempt - 1), MAX_BACKOFF_MS);
|
|
662581
662935
|
logMCPDebug(client8.name, `Scheduling reconnection attempt ${attempt + 1} in ${backoffMs}ms`);
|
|
662582
|
-
await new Promise((
|
|
662583
|
-
const timer2 = setTimeout(
|
|
662936
|
+
await new Promise((resolve53) => {
|
|
662937
|
+
const timer2 = setTimeout(resolve53, backoffMs);
|
|
662584
662938
|
reconnectTimersRef.current.set(client8.name, timer2);
|
|
662585
662939
|
});
|
|
662586
662940
|
}
|
|
@@ -665697,7 +666051,7 @@ var init_pluginStartupCheck = __esm(() => {
|
|
|
665697
666051
|
|
|
665698
666052
|
// src/utils/plugins/parseMarketplaceInput.ts
|
|
665699
666053
|
import { homedir as homedir38 } from "os";
|
|
665700
|
-
import { resolve as
|
|
666054
|
+
import { resolve as resolve53 } from "path";
|
|
665701
666055
|
async function parseMarketplaceInput(input2) {
|
|
665702
666056
|
const trimmed = input2.trim();
|
|
665703
666057
|
const fs24 = getFsImplementation();
|
|
@@ -665732,7 +666086,7 @@ async function parseMarketplaceInput(input2) {
|
|
|
665732
666086
|
const isWindows3 = process.platform === "win32";
|
|
665733
666087
|
const isWindowsPath = isWindows3 && (trimmed.startsWith(".\\") || trimmed.startsWith("..\\") || /^[a-zA-Z]:[/\\]/.test(trimmed));
|
|
665734
666088
|
if (trimmed.startsWith("./") || trimmed.startsWith("../") || trimmed.startsWith("/") || trimmed.startsWith("~") || isWindowsPath) {
|
|
665735
|
-
const resolvedPath =
|
|
666089
|
+
const resolvedPath = resolve53(trimmed.startsWith("~") ? trimmed.replace(/^~/, homedir38()) : trimmed);
|
|
665736
666090
|
let stats;
|
|
665737
666091
|
try {
|
|
665738
666092
|
stats = await fs24.stat(resolvedPath);
|
|
@@ -668732,7 +669086,7 @@ var init_DiscoverPlugins = __esm(() => {
|
|
|
668732
669086
|
});
|
|
668733
669087
|
|
|
668734
669088
|
// src/services/plugins/pluginOperations.ts
|
|
668735
|
-
import { dirname as
|
|
669089
|
+
import { dirname as dirname63, join as join147 } from "path";
|
|
668736
669090
|
function assertInstallableScope(scope) {
|
|
668737
669091
|
if (!VALID_INSTALLABLE_SCOPES.includes(scope)) {
|
|
668738
669092
|
throw new Error(`Invalid scope "${scope}". Must be one of: ${VALID_INSTALLABLE_SCOPES.join(", ")}`);
|
|
@@ -669210,7 +669564,7 @@ async function performPluginUpdate({
|
|
|
669210
669564
|
}
|
|
669211
669565
|
throw e4;
|
|
669212
669566
|
}
|
|
669213
|
-
const marketplaceDir = marketplaceStats.isDirectory() ? marketplaceInstallLocation :
|
|
669567
|
+
const marketplaceDir = marketplaceStats.isDirectory() ? marketplaceInstallLocation : dirname63(marketplaceInstallLocation);
|
|
669214
669568
|
sourcePath = join147(marketplaceDir, entry.source);
|
|
669215
669569
|
try {
|
|
669216
669570
|
await fs24.stat(sourcePath);
|
|
@@ -680003,10 +680357,10 @@ var require_browser2 = __commonJS((exports) => {
|
|
|
680003
680357
|
text2 = canvas;
|
|
680004
680358
|
canvas = undefined;
|
|
680005
680359
|
}
|
|
680006
|
-
return new Promise(function(
|
|
680360
|
+
return new Promise(function(resolve55, reject2) {
|
|
680007
680361
|
try {
|
|
680008
680362
|
const data = QRCode.create(text2, opts);
|
|
680009
|
-
|
|
680363
|
+
resolve55(renderFunc(data, canvas, opts));
|
|
680010
680364
|
} catch (e4) {
|
|
680011
680365
|
reject2(e4);
|
|
680012
680366
|
}
|
|
@@ -680062,11 +680416,11 @@ function getStringRendererFromType(type) {
|
|
|
680062
680416
|
}
|
|
680063
680417
|
function render2(renderFunc, text2, params) {
|
|
680064
680418
|
if (!params.cb) {
|
|
680065
|
-
return new Promise(function(
|
|
680419
|
+
return new Promise(function(resolve55, reject2) {
|
|
680066
680420
|
try {
|
|
680067
680421
|
const data = QRCode.create(text2, params.opts);
|
|
680068
680422
|
return renderFunc(data, params.opts, function(err2, data2) {
|
|
680069
|
-
return err2 ? reject2(err2) :
|
|
680423
|
+
return err2 ? reject2(err2) : resolve55(data2);
|
|
680070
680424
|
});
|
|
680071
680425
|
} catch (e4) {
|
|
680072
680426
|
reject2(e4);
|
|
@@ -680546,7 +680900,7 @@ ${args ? "Additional user input: " + args : ""}
|
|
|
680546
680900
|
|
|
680547
680901
|
// src/utils/releaseNotes.ts
|
|
680548
680902
|
import { mkdir as mkdir45, readFile as readFile55, writeFile as writeFile50 } from "fs/promises";
|
|
680549
|
-
import { dirname as
|
|
680903
|
+
import { dirname as dirname65, join as join151 } from "path";
|
|
680550
680904
|
function getChangelogCachePath() {
|
|
680551
680905
|
return join151(getClaudeConfigHomeDir(), "cache", "changelog.md");
|
|
680552
680906
|
}
|
|
@@ -680557,7 +680911,7 @@ async function migrateChangelogFromConfig() {
|
|
|
680557
680911
|
}
|
|
680558
680912
|
const cachePath = getChangelogCachePath();
|
|
680559
680913
|
try {
|
|
680560
|
-
await mkdir45(
|
|
680914
|
+
await mkdir45(dirname65(cachePath), { recursive: true });
|
|
680561
680915
|
await writeFile50(cachePath, config8.cachedChangelog, {
|
|
680562
680916
|
encoding: "utf-8",
|
|
680563
680917
|
flag: "wx"
|
|
@@ -680579,7 +680933,7 @@ async function fetchAndStoreChangelog() {
|
|
|
680579
680933
|
return;
|
|
680580
680934
|
}
|
|
680581
680935
|
const cachePath = getChangelogCachePath();
|
|
680582
|
-
await mkdir45(
|
|
680936
|
+
await mkdir45(dirname65(cachePath), { recursive: true });
|
|
680583
680937
|
await writeFile50(cachePath, changelogContent, { encoding: "utf-8" });
|
|
680584
680938
|
changelogMemoryCache = changelogContent;
|
|
680585
680939
|
const changelogLastFetched = Date.now();
|
|
@@ -681343,7 +681697,7 @@ var init_rename2 = __esm(() => {
|
|
|
681343
681697
|
});
|
|
681344
681698
|
|
|
681345
681699
|
// src/utils/getWorktreePaths.ts
|
|
681346
|
-
import { sep as
|
|
681700
|
+
import { sep as sep40 } from "path";
|
|
681347
681701
|
async function getWorktreePaths(cwd2) {
|
|
681348
681702
|
const startTime2 = Date.now();
|
|
681349
681703
|
const { stdout, code } = await execFileNoThrowWithCwd(gitExe(), ["worktree", "list", "--porcelain"], {
|
|
@@ -681366,7 +681720,7 @@ async function getWorktreePaths(cwd2) {
|
|
|
681366
681720
|
worktree_count: worktreePaths.length,
|
|
681367
681721
|
success: true
|
|
681368
681722
|
});
|
|
681369
|
-
const currentWorktree = worktreePaths.find((path39) => cwd2 === path39 || cwd2.startsWith(path39 +
|
|
681723
|
+
const currentWorktree = worktreePaths.find((path39) => cwd2 === path39 || cwd2.startsWith(path39 + sep40));
|
|
681370
681724
|
const otherWorktrees = worktreePaths.filter((path39) => path39 !== currentWorktree).sort((a6, b6) => a6.localeCompare(b6));
|
|
681371
681725
|
return currentWorktree ? [currentWorktree, ...otherWorktrees] : otherWorktrees;
|
|
681372
681726
|
}
|
|
@@ -684788,7 +685142,7 @@ var init_nullRenderingAttachments = __esm(() => {
|
|
|
684788
685142
|
});
|
|
684789
685143
|
|
|
684790
685144
|
// src/utils/statusNoticeDefinitions.tsx
|
|
684791
|
-
import { relative as
|
|
685145
|
+
import { relative as relative29 } from "path";
|
|
684792
685146
|
function getActiveNotices(context8) {
|
|
684793
685147
|
return statusNoticeDefinitions.filter((notice) => notice.isActive(context8));
|
|
684794
685148
|
}
|
|
@@ -684815,7 +685169,7 @@ var init_statusNoticeDefinitions = __esm(() => {
|
|
|
684815
685169
|
const largeMemoryFiles = getLargeMemoryFiles(ctx.memoryFiles, threshold);
|
|
684816
685170
|
return /* @__PURE__ */ jsx_runtime274.jsx(jsx_runtime274.Fragment, {
|
|
684817
685171
|
children: largeMemoryFiles.map((file2) => {
|
|
684818
|
-
const displayPath = file2.path.startsWith(getCwd()) ?
|
|
685172
|
+
const displayPath = file2.path.startsWith(getCwd()) ? relative29(getCwd(), file2.path) : file2.path;
|
|
684819
685173
|
return /* @__PURE__ */ jsx_runtime274.jsxs(ThemedBox_default, {
|
|
684820
685174
|
flexDirection: "row",
|
|
684821
685175
|
children: [
|
|
@@ -690062,7 +690416,7 @@ var init_agenticSessionSearch = __esm(() => {
|
|
|
690062
690416
|
});
|
|
690063
690417
|
|
|
690064
690418
|
// src/utils/crossProjectResume.ts
|
|
690065
|
-
import { sep as
|
|
690419
|
+
import { sep as sep41 } from "path";
|
|
690066
690420
|
function checkCrossProjectResume(log3, showAllProjects, worktreePaths) {
|
|
690067
690421
|
const currentCwd2 = getOriginalCwd();
|
|
690068
690422
|
if (!showAllProjects || !log3.projectPath || log3.projectPath === currentCwd2) {
|
|
@@ -690078,7 +690432,7 @@ function checkCrossProjectResume(log3, showAllProjects, worktreePaths) {
|
|
|
690078
690432
|
projectPath: log3.projectPath
|
|
690079
690433
|
};
|
|
690080
690434
|
}
|
|
690081
|
-
const isSameRepo = worktreePaths.some((wt) => log3.projectPath === wt || log3.projectPath.startsWith(wt +
|
|
690435
|
+
const isSameRepo = worktreePaths.some((wt) => log3.projectPath === wt || log3.projectPath.startsWith(wt + sep41));
|
|
690082
690436
|
if (isSameRepo) {
|
|
690083
690437
|
return {
|
|
690084
690438
|
isCrossProject: true,
|
|
@@ -697413,9 +697767,9 @@ var init_autocompact2 = __esm(() => {
|
|
|
697413
697767
|
|
|
697414
697768
|
// src/commands/cd/cdLogic.ts
|
|
697415
697769
|
import { realpathSync as realpathSync7, statSync as statSync18 } from "fs";
|
|
697416
|
-
import { resolve as
|
|
697770
|
+
import { resolve as resolve55 } from "path";
|
|
697417
697771
|
function resolveDirectoryTarget(target) {
|
|
697418
|
-
const resolved =
|
|
697772
|
+
const resolved = resolve55(target);
|
|
697419
697773
|
let physical;
|
|
697420
697774
|
try {
|
|
697421
697775
|
physical = realpathSync7(resolved);
|
|
@@ -705092,13 +705446,13 @@ var exports_files2 = {};
|
|
|
705092
705446
|
__export(exports_files2, {
|
|
705093
705447
|
call: () => call62
|
|
705094
705448
|
});
|
|
705095
|
-
import { relative as
|
|
705449
|
+
import { relative as relative30 } from "path";
|
|
705096
705450
|
async function call62(_args, context8) {
|
|
705097
705451
|
const files2 = context8.readFileState ? cacheKeys(context8.readFileState) : [];
|
|
705098
705452
|
if (files2.length === 0) {
|
|
705099
705453
|
return { type: "text", value: "No files in context" };
|
|
705100
705454
|
}
|
|
705101
|
-
const fileList = files2.map((file2) =>
|
|
705455
|
+
const fileList = files2.map((file2) => relative30(getCwd(), file2)).join(`
|
|
705102
705456
|
`);
|
|
705103
705457
|
return { type: "text", value: `Files in context:
|
|
705104
705458
|
${fileList}` };
|
|
@@ -705411,7 +705765,7 @@ __export(exports_settingsSync, {
|
|
|
705411
705765
|
_resetDownloadPromiseForTesting: () => _resetDownloadPromiseForTesting
|
|
705412
705766
|
});
|
|
705413
705767
|
import { mkdir as mkdir47, readFile as readFile58, stat as stat43, writeFile as writeFile52 } from "fs/promises";
|
|
705414
|
-
import { dirname as
|
|
705768
|
+
import { dirname as dirname66 } from "path";
|
|
705415
705769
|
async function uploadUserSettingsInBackground() {
|
|
705416
705770
|
try {
|
|
705417
705771
|
if (!feature("UPLOAD_USER_SETTINGS") || !getFeatureValue_CACHED_MAY_BE_STALE("tengu_enable_settings_sync_push", false) || !getIsInteractive() || !isUsingOAuth2()) {
|
|
@@ -705691,7 +706045,7 @@ async function buildEntriesFromLocalFiles(projectId) {
|
|
|
705691
706045
|
}
|
|
705692
706046
|
async function writeFileForSync(filePath, content) {
|
|
705693
706047
|
try {
|
|
705694
|
-
const parentDir =
|
|
706048
|
+
const parentDir = dirname66(filePath);
|
|
705695
706049
|
if (parentDir) {
|
|
705696
706050
|
await mkdir47(parentDir, { recursive: true });
|
|
705697
706051
|
}
|
|
@@ -705991,7 +706345,7 @@ var init_rewind = __esm(() => {
|
|
|
705991
706345
|
});
|
|
705992
706346
|
|
|
705993
706347
|
// src/utils/heapDumpService.ts
|
|
705994
|
-
import { createWriteStream as createWriteStream5, writeFileSync as
|
|
706348
|
+
import { createWriteStream as createWriteStream5, writeFileSync as writeFileSync16 } from "fs";
|
|
705995
706349
|
import { readdir as readdir31, readFile as readFile59, writeFile as writeFile53 } from "fs/promises";
|
|
705996
706350
|
import { join as join154 } from "path";
|
|
705997
706351
|
import { pipeline as pipeline4 } from "stream/promises";
|
|
@@ -706130,7 +706484,7 @@ async function performHeapDump(trigger = "manual", dumpNumber = 0) {
|
|
|
706130
706484
|
}
|
|
706131
706485
|
async function writeHeapSnapshot(filepath) {
|
|
706132
706486
|
if (typeof Bun !== "undefined") {
|
|
706133
|
-
|
|
706487
|
+
writeFileSync16(filepath, Bun.generateHeapSnapshot("v8", "arraybuffer"), {
|
|
706134
706488
|
mode: 384
|
|
706135
706489
|
});
|
|
706136
706490
|
Bun.gc(true);
|
|
@@ -707841,7 +708195,7 @@ var exports_sandbox_toggle = {};
|
|
|
707841
708195
|
__export(exports_sandbox_toggle, {
|
|
707842
708196
|
call: () => call71
|
|
707843
708197
|
});
|
|
707844
|
-
import { relative as
|
|
708198
|
+
import { relative as relative31 } from "path";
|
|
707845
708199
|
async function call71(onDone, _context, args) {
|
|
707846
708200
|
const settings = getSettings_DEPRECATED();
|
|
707847
708201
|
const themeName = settings.theme || "light";
|
|
@@ -707883,7 +708237,7 @@ async function call71(onDone, _context, args) {
|
|
|
707883
708237
|
const cleanPattern = commandPattern.replace(/^["']|["']$/g, "");
|
|
707884
708238
|
addToExcludedCommands(cleanPattern);
|
|
707885
708239
|
const localSettingsPath = getSettingsFilePathForSource("localSettings");
|
|
707886
|
-
const relativePath = localSettingsPath ?
|
|
708240
|
+
const relativePath = localSettingsPath ? relative31(getCwdState(), localSettingsPath) : ".claude/settings.local.json";
|
|
707887
708241
|
const message = color("success", themeName)(`Added "${cleanPattern}" to excluded commands in ${relativePath}`);
|
|
707888
708242
|
onDone(message);
|
|
707889
708243
|
return null;
|
|
@@ -708772,7 +709126,7 @@ var init_advisor2 = __esm(() => {
|
|
|
708772
709126
|
// src/skills/bundledSkills.ts
|
|
708773
709127
|
import { constants as fsConstants7 } from "fs";
|
|
708774
709128
|
import { mkdir as mkdir49, open as open14 } from "fs/promises";
|
|
708775
|
-
import { dirname as
|
|
709129
|
+
import { dirname as dirname67, isAbsolute as isAbsolute29, join as join157, normalize as normalize15, sep as pathSep2 } from "path";
|
|
708776
709130
|
function registerBundledSkill(definition) {
|
|
708777
709131
|
const { files: files3 } = definition;
|
|
708778
709132
|
let skillRoot;
|
|
@@ -708837,7 +709191,7 @@ async function writeSkillFiles(dir, files3) {
|
|
|
708837
709191
|
const byParent = new Map;
|
|
708838
709192
|
for (const [relPath, content] of Object.entries(files3)) {
|
|
708839
709193
|
const target = resolveSkillFilePath(dir, relPath);
|
|
708840
|
-
const parent2 =
|
|
709194
|
+
const parent2 = dirname67(target);
|
|
708841
709195
|
const entry = [target, content];
|
|
708842
709196
|
const group = byParent.get(parent2);
|
|
708843
709197
|
if (group)
|
|
@@ -708859,7 +709213,7 @@ async function safeWriteFile(p4, content) {
|
|
|
708859
709213
|
}
|
|
708860
709214
|
}
|
|
708861
709215
|
function resolveSkillFilePath(baseDir, relPath) {
|
|
708862
|
-
const normalized =
|
|
709216
|
+
const normalized = normalize15(relPath);
|
|
708863
709217
|
if (isAbsolute29(normalized) || normalized.split(pathSep2).includes("..") || normalized.split("/").includes("..")) {
|
|
708864
709218
|
throw new Error(`bundled skill file path escapes skill dir: ${relPath}`);
|
|
708865
709219
|
}
|
|
@@ -709232,7 +709586,7 @@ var init_exit2 = __esm(() => {
|
|
|
709232
709586
|
});
|
|
709233
709587
|
|
|
709234
709588
|
// src/components/ExportDialog.tsx
|
|
709235
|
-
import { dirname as
|
|
709589
|
+
import { dirname as dirname68 } from "path";
|
|
709236
709590
|
import { mkdirSync as mkdirSync11 } from "fs";
|
|
709237
709591
|
function ExportDialog({
|
|
709238
709592
|
content,
|
|
@@ -709267,7 +709621,7 @@ function ExportDialog({
|
|
|
709267
709621
|
const handleFilenameSubmit = () => {
|
|
709268
709622
|
const filepath = resolveExportFilepath(filename);
|
|
709269
709623
|
try {
|
|
709270
|
-
mkdirSync11(
|
|
709624
|
+
mkdirSync11(dirname68(filepath), { recursive: true });
|
|
709271
709625
|
writeFileSync_DEPRECATED(filepath, content, {
|
|
709272
709626
|
encoding: "utf-8",
|
|
709273
709627
|
flush: true
|
|
@@ -709490,7 +709844,7 @@ __export(exports_export, {
|
|
|
709490
709844
|
extractFirstPrompt: () => extractFirstPrompt,
|
|
709491
709845
|
call: () => call76
|
|
709492
709846
|
});
|
|
709493
|
-
import { dirname as
|
|
709847
|
+
import { dirname as dirname69 } from "path";
|
|
709494
709848
|
import { mkdirSync as mkdirSync12 } from "fs";
|
|
709495
709849
|
function formatTimestamp(date6) {
|
|
709496
709850
|
const year = date6.getFullYear();
|
|
@@ -709541,7 +709895,7 @@ async function call76(onDone, context8, args) {
|
|
|
709541
709895
|
if (filename) {
|
|
709542
709896
|
const filepath = resolveExportFilepath(filename);
|
|
709543
709897
|
try {
|
|
709544
|
-
mkdirSync12(
|
|
709898
|
+
mkdirSync12(dirname69(filepath), { recursive: true });
|
|
709545
709899
|
writeFileSync_DEPRECATED(filepath, content, {
|
|
709546
709900
|
encoding: "utf-8",
|
|
709547
709901
|
flush: true
|
|
@@ -712548,7 +712902,7 @@ function useVoice({
|
|
|
712548
712902
|
const keyterms = await getVoiceKeyterms();
|
|
712549
712903
|
if (isStale())
|
|
712550
712904
|
return;
|
|
712551
|
-
await new Promise((
|
|
712905
|
+
await new Promise((resolve56) => {
|
|
712552
712906
|
connectVoiceStream({
|
|
712553
712907
|
onTranscript: (t4, isFinal) => {
|
|
712554
712908
|
if (isStale())
|
|
@@ -712559,12 +712913,12 @@ function useVoice({
|
|
|
712559
712913
|
accumulatedRef.current += t4.trim();
|
|
712560
712914
|
}
|
|
712561
712915
|
},
|
|
712562
|
-
onError: () =>
|
|
712916
|
+
onError: () => resolve56(),
|
|
712563
712917
|
onClose: () => {},
|
|
712564
712918
|
onReady: (conn) => {
|
|
712565
712919
|
if (isStale()) {
|
|
712566
712920
|
conn.close();
|
|
712567
|
-
|
|
712921
|
+
resolve56();
|
|
712568
712922
|
return;
|
|
712569
712923
|
}
|
|
712570
712924
|
connectionRef.current = conn;
|
|
@@ -712584,13 +712938,13 @@ function useVoice({
|
|
|
712584
712938
|
conn.send(Buffer.concat(slice));
|
|
712585
712939
|
conn.finalize().then(() => {
|
|
712586
712940
|
conn.close();
|
|
712587
|
-
|
|
712941
|
+
resolve56();
|
|
712588
712942
|
});
|
|
712589
712943
|
}
|
|
712590
712944
|
}, { language: stt.code, keyterms }).then((c9) => {
|
|
712591
712945
|
if (!c9)
|
|
712592
|
-
|
|
712593
|
-
}, () =>
|
|
712946
|
+
resolve56();
|
|
712947
|
+
}, () => resolve56());
|
|
712594
712948
|
});
|
|
712595
712949
|
if (isStale())
|
|
712596
712950
|
return;
|
|
@@ -713228,7 +713582,7 @@ var init_force_snip = __esm(() => {
|
|
|
713228
713582
|
|
|
713229
713583
|
// src/utils/effort/workflowSavePath.ts
|
|
713230
713584
|
import { homedir as homedir41 } from "os";
|
|
713231
|
-
import { join as join158, sep as
|
|
713585
|
+
import { join as join158, sep as sep42 } from "path";
|
|
713232
713586
|
function userWorkflowsDir2() {
|
|
713233
713587
|
return join158(getClaudeConfigHomeDir(), "workflows");
|
|
713234
713588
|
}
|
|
@@ -713242,7 +713596,7 @@ function tildeShortenPath(absPath) {
|
|
|
713242
713596
|
const home = homedir41();
|
|
713243
713597
|
if (absPath === home)
|
|
713244
713598
|
return "~";
|
|
713245
|
-
if (absPath.startsWith(home +
|
|
713599
|
+
if (absPath.startsWith(home + sep42))
|
|
713246
713600
|
return "~" + absPath.slice(home.length);
|
|
713247
713601
|
return absPath;
|
|
713248
713602
|
}
|
|
@@ -713260,7 +713614,7 @@ var init_workflowSavePath = __esm(() => {
|
|
|
713260
713614
|
});
|
|
713261
713615
|
|
|
713262
713616
|
// src/components/WorkflowDetailDialog.tsx
|
|
713263
|
-
import { existsSync as existsSync25, mkdirSync as mkdirSync13, readFileSync as
|
|
713617
|
+
import { existsSync as existsSync25, mkdirSync as mkdirSync13, readFileSync as readFileSync33, writeFileSync as writeFileSync17 } from "fs";
|
|
713264
713618
|
function launchTypeOf(_task) {
|
|
713265
713619
|
return "background";
|
|
713266
713620
|
}
|
|
@@ -713299,7 +713653,7 @@ function saveDynamicWorkflow(task, scope, overwrite) {
|
|
|
713299
713653
|
}
|
|
713300
713654
|
let source2;
|
|
713301
713655
|
try {
|
|
713302
|
-
source2 =
|
|
713656
|
+
source2 = readFileSync33(task.scriptPath, "utf8");
|
|
713303
713657
|
} catch {
|
|
713304
713658
|
return {
|
|
713305
713659
|
ok: false,
|
|
@@ -713317,7 +713671,7 @@ function saveDynamicWorkflow(task, scope, overwrite) {
|
|
|
713317
713671
|
}
|
|
713318
713672
|
try {
|
|
713319
713673
|
mkdirSync13(targetDir, { recursive: true });
|
|
713320
|
-
|
|
713674
|
+
writeFileSync17(targetPath, source2, {
|
|
713321
713675
|
encoding: "utf8",
|
|
713322
713676
|
flag: overwrite ? "w" : "wx"
|
|
713323
713677
|
});
|
|
@@ -714215,7 +714569,7 @@ var init_peers = __esm(() => {
|
|
|
714215
714569
|
|
|
714216
714570
|
// src/commands/fork/pointer.ts
|
|
714217
714571
|
import { appendFile as appendFile7, mkdir as mkdir50 } from "fs/promises";
|
|
714218
|
-
import { dirname as
|
|
714572
|
+
import { dirname as dirname70 } from "path";
|
|
714219
714573
|
async function writeForkPointer(args) {
|
|
714220
714574
|
const forkPath = getTranscriptPathForSession(args.forkedSessionId);
|
|
714221
714575
|
const entry = {
|
|
@@ -714224,7 +714578,7 @@ async function writeForkPointer(args) {
|
|
|
714224
714578
|
parentLastUuid: args.parentLastUuid,
|
|
714225
714579
|
...args.agentId ? { agentId: args.agentId } : {}
|
|
714226
714580
|
};
|
|
714227
|
-
await mkdir50(
|
|
714581
|
+
await mkdir50(dirname70(forkPath), { recursive: true });
|
|
714228
714582
|
await appendFile7(forkPath, `${JSON.stringify(entry)}
|
|
714229
714583
|
`, "utf8");
|
|
714230
714584
|
}
|
|
@@ -715894,7 +716248,7 @@ async function scanAllSessions() {
|
|
|
715894
716248
|
});
|
|
715895
716249
|
}
|
|
715896
716250
|
if (i6 % 10 === 9) {
|
|
715897
|
-
await new Promise((
|
|
716251
|
+
await new Promise((resolve56) => setImmediate(resolve56));
|
|
715898
716252
|
}
|
|
715899
716253
|
}
|
|
715900
716254
|
allSessions.sort((a6, b6) => b6.mtime - a6.mtime);
|
|
@@ -717184,7 +717538,7 @@ import {
|
|
|
717184
717538
|
unlink as unlink26,
|
|
717185
717539
|
writeFile as writeFile56
|
|
717186
717540
|
} from "fs/promises";
|
|
717187
|
-
import { basename as basename47, dirname as
|
|
717541
|
+
import { basename as basename47, dirname as dirname71, join as join160 } from "path";
|
|
717188
717542
|
function isTranscriptMessage(entry) {
|
|
717189
717543
|
return entry.type === "user" || entry.type === "assistant" || entry.type === "attachment" || entry.type === "system";
|
|
717190
717544
|
}
|
|
@@ -717229,7 +717583,7 @@ function getAgentMetadataPath(agentId) {
|
|
|
717229
717583
|
}
|
|
717230
717584
|
async function writeAgentMetadata(agentId, metadata) {
|
|
717231
717585
|
const path39 = getAgentMetadataPath(agentId);
|
|
717232
|
-
await mkdir52(
|
|
717586
|
+
await mkdir52(dirname71(path39), { recursive: true });
|
|
717233
717587
|
await writeFile56(path39, JSON.stringify(metadata));
|
|
717234
717588
|
}
|
|
717235
717589
|
async function readAgentMetadata(agentId) {
|
|
@@ -717252,7 +717606,7 @@ function getRemoteAgentMetadataPath(taskId) {
|
|
|
717252
717606
|
}
|
|
717253
717607
|
async function writeRemoteAgentMetadata(taskId, metadata) {
|
|
717254
717608
|
const path39 = getRemoteAgentMetadataPath(taskId);
|
|
717255
|
-
await mkdir52(
|
|
717609
|
+
await mkdir52(dirname71(path39), { recursive: true });
|
|
717256
717610
|
await writeFile56(path39, JSON.stringify(metadata));
|
|
717257
717611
|
}
|
|
717258
717612
|
async function readRemoteAgentMetadata(taskId) {
|
|
@@ -717398,8 +717752,8 @@ class Project {
|
|
|
717398
717752
|
decrementPendingWrites() {
|
|
717399
717753
|
this.pendingWriteCount--;
|
|
717400
717754
|
if (this.pendingWriteCount === 0) {
|
|
717401
|
-
for (const
|
|
717402
|
-
|
|
717755
|
+
for (const resolve56 of this.flushResolvers) {
|
|
717756
|
+
resolve56();
|
|
717403
717757
|
}
|
|
717404
717758
|
this.flushResolvers = [];
|
|
717405
717759
|
}
|
|
@@ -717413,13 +717767,13 @@ class Project {
|
|
|
717413
717767
|
}
|
|
717414
717768
|
}
|
|
717415
717769
|
enqueueWrite(filePath, entry) {
|
|
717416
|
-
return new Promise((
|
|
717770
|
+
return new Promise((resolve56) => {
|
|
717417
717771
|
let queue2 = this.writeQueues.get(filePath);
|
|
717418
717772
|
if (!queue2) {
|
|
717419
717773
|
queue2 = [];
|
|
717420
717774
|
this.writeQueues.set(filePath, queue2);
|
|
717421
717775
|
}
|
|
717422
|
-
queue2.push({ entry, resolve:
|
|
717776
|
+
queue2.push({ entry, resolve: resolve56 });
|
|
717423
717777
|
this.scheduleDrain();
|
|
717424
717778
|
});
|
|
717425
717779
|
}
|
|
@@ -717441,7 +717795,7 @@ class Project {
|
|
|
717441
717795
|
try {
|
|
717442
717796
|
await fsAppendFile(filePath, data, { mode: 384 });
|
|
717443
717797
|
} catch {
|
|
717444
|
-
await mkdir52(
|
|
717798
|
+
await mkdir52(dirname71(filePath), { recursive: true, mode: 448 });
|
|
717445
717799
|
await fsAppendFile(filePath, data, { mode: 384 });
|
|
717446
717800
|
}
|
|
717447
717801
|
}
|
|
@@ -717453,7 +717807,7 @@ class Project {
|
|
|
717453
717807
|
const batch = queue2.splice(0);
|
|
717454
717808
|
let content = "";
|
|
717455
717809
|
const resolvers2 = [];
|
|
717456
|
-
for (const { entry, resolve:
|
|
717810
|
+
for (const { entry, resolve: resolve56 } of batch) {
|
|
717457
717811
|
const line = jsonStringify(entry) + `
|
|
717458
717812
|
`;
|
|
717459
717813
|
if (content.length + line.length >= this.MAX_CHUNK_BYTES) {
|
|
@@ -717465,7 +717819,7 @@ class Project {
|
|
|
717465
717819
|
content = "";
|
|
717466
717820
|
}
|
|
717467
717821
|
content += line;
|
|
717468
|
-
resolvers2.push(
|
|
717822
|
+
resolvers2.push(resolve56);
|
|
717469
717823
|
}
|
|
717470
717824
|
if (content.length > 0) {
|
|
717471
717825
|
await this.appendToFile(filePath, content);
|
|
@@ -717588,8 +717942,8 @@ class Project {
|
|
|
717588
717942
|
if (this.pendingWriteCount === 0) {
|
|
717589
717943
|
return;
|
|
717590
717944
|
}
|
|
717591
|
-
return new Promise((
|
|
717592
|
-
this.flushResolvers.push(
|
|
717945
|
+
return new Promise((resolve56) => {
|
|
717946
|
+
this.flushResolvers.push(resolve56);
|
|
717593
717947
|
});
|
|
717594
717948
|
}
|
|
717595
717949
|
async removeMessageByUuid(targetUuid) {
|
|
@@ -718041,7 +718395,7 @@ async function hydrateFromCCRv2InternalEvents(sessionId) {
|
|
|
718041
718395
|
}
|
|
718042
718396
|
for (const [agentId, entries] of byAgent) {
|
|
718043
718397
|
const agentFile = getAgentTranscriptPath(asAgentId(agentId));
|
|
718044
|
-
await mkdir52(
|
|
718398
|
+
await mkdir52(dirname71(agentFile), { recursive: true, mode: 448 });
|
|
718045
718399
|
const agentContent = entries.map((p4) => jsonStringify(p4) + `
|
|
718046
718400
|
`).join("");
|
|
718047
718401
|
await writeFile56(agentFile, agentContent, {
|
|
@@ -718240,7 +718594,7 @@ function applySnipRemovals(messages) {
|
|
|
718240
718594
|
messages.delete(uuid5);
|
|
718241
718595
|
removedCount++;
|
|
718242
718596
|
}
|
|
718243
|
-
const
|
|
718597
|
+
const resolve56 = (start) => {
|
|
718244
718598
|
const path39 = [];
|
|
718245
718599
|
let cur = start;
|
|
718246
718600
|
while (cur && toDelete.has(cur)) {
|
|
@@ -718259,7 +718613,7 @@ function applySnipRemovals(messages) {
|
|
|
718259
718613
|
for (const [uuid5, msg] of messages) {
|
|
718260
718614
|
if (!msg.parentUuid || !toDelete.has(msg.parentUuid))
|
|
718261
718615
|
continue;
|
|
718262
|
-
messages.set(uuid5, { ...msg, parentUuid:
|
|
718616
|
+
messages.set(uuid5, { ...msg, parentUuid: resolve56(msg.parentUuid) });
|
|
718263
718617
|
relinkedCount++;
|
|
718264
718618
|
}
|
|
718265
718619
|
logEvent2("tengu_snip_resume_filtered", {
|
|
@@ -718578,7 +718932,7 @@ function appendEntryToFile(fullPath, entry) {
|
|
|
718578
718932
|
try {
|
|
718579
718933
|
fs25.appendFileSync(fullPath, line, { mode: 384 });
|
|
718580
718934
|
} catch {
|
|
718581
|
-
fs25.mkdirSync(
|
|
718935
|
+
fs25.mkdirSync(dirname71(fullPath), { mode: 448 });
|
|
718582
718936
|
fs25.appendFileSync(fullPath, line, { mode: 384 });
|
|
718583
718937
|
}
|
|
718584
718938
|
}
|
|
@@ -720169,7 +720523,7 @@ var init_teamMemPrompts = __esm(() => {
|
|
|
720169
720523
|
});
|
|
720170
720524
|
|
|
720171
720525
|
// src/memdir/memdir.ts
|
|
720172
|
-
import { basename as basename48, join as join161, resolve as
|
|
720526
|
+
import { basename as basename48, join as join161, resolve as resolve56 } from "path";
|
|
720173
720527
|
function stripNonLoadedContent(raw) {
|
|
720174
720528
|
const withoutFrontmatter = raw.replace(FRONTMATTER_REGEX, "");
|
|
720175
720529
|
if (!withoutFrontmatter.includes("<!--")) {
|
|
@@ -720265,7 +720619,7 @@ function getMemoryIndexOverCapMessage(params) {
|
|
|
720265
720619
|
async function checkMemoryEntrypointOverCap(filePath) {
|
|
720266
720620
|
if (!isAutoMemoryEnabled())
|
|
720267
720621
|
return null;
|
|
720268
|
-
const isAutoMemIndex =
|
|
720622
|
+
const isAutoMemIndex = resolve56(filePath) === resolve56(getAutoMemEntrypoint()) || basename48(filePath) === ENTRYPOINT_NAME && isAutoMemPath(filePath);
|
|
720269
720623
|
if (!isAutoMemIndex)
|
|
720270
720624
|
return null;
|
|
720271
720625
|
const fs25 = getFsImplementation();
|
|
@@ -720565,41 +720919,41 @@ var init_memdir = __esm(() => {
|
|
|
720565
720919
|
});
|
|
720566
720920
|
|
|
720567
720921
|
// src/tools/AgentTool/agentMemory.ts
|
|
720568
|
-
import { join as join162, normalize as
|
|
720922
|
+
import { join as join162, normalize as normalize16, sep as sep43 } from "path";
|
|
720569
720923
|
function sanitizeAgentTypeForPath(agentType) {
|
|
720570
720924
|
return agentType.replace(/:/g, "-");
|
|
720571
720925
|
}
|
|
720572
720926
|
function getLocalAgentMemoryDir(dirName) {
|
|
720573
720927
|
if (process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR) {
|
|
720574
|
-
return join162(process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR, "projects", sanitizePath2(findCanonicalGitRoot(getProjectRoot()) ?? getProjectRoot()), "agent-memory-local", dirName) +
|
|
720928
|
+
return join162(process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR, "projects", sanitizePath2(findCanonicalGitRoot(getProjectRoot()) ?? getProjectRoot()), "agent-memory-local", dirName) + sep43;
|
|
720575
720929
|
}
|
|
720576
|
-
return join162(getCwd(), ".claude", "agent-memory-local", dirName) +
|
|
720930
|
+
return join162(getCwd(), ".claude", "agent-memory-local", dirName) + sep43;
|
|
720577
720931
|
}
|
|
720578
720932
|
function getAgentMemoryDir(agentType, scope) {
|
|
720579
720933
|
const dirName = sanitizeAgentTypeForPath(agentType);
|
|
720580
720934
|
switch (scope) {
|
|
720581
720935
|
case "project":
|
|
720582
|
-
return join162(getCwd(), ".claude", "agent-memory", dirName) +
|
|
720936
|
+
return join162(getCwd(), ".claude", "agent-memory", dirName) + sep43;
|
|
720583
720937
|
case "local":
|
|
720584
720938
|
return getLocalAgentMemoryDir(dirName);
|
|
720585
720939
|
case "user":
|
|
720586
|
-
return join162(getMemoryBaseDir(), "agent-memory", dirName) +
|
|
720940
|
+
return join162(getMemoryBaseDir(), "agent-memory", dirName) + sep43;
|
|
720587
720941
|
}
|
|
720588
720942
|
}
|
|
720589
720943
|
function isAgentMemoryPath(absolutePath) {
|
|
720590
|
-
const normalizedPath =
|
|
720944
|
+
const normalizedPath = normalize16(absolutePath);
|
|
720591
720945
|
const memoryBase = getMemoryBaseDir();
|
|
720592
|
-
if (normalizedPath.startsWith(join162(memoryBase, "agent-memory") +
|
|
720946
|
+
if (normalizedPath.startsWith(join162(memoryBase, "agent-memory") + sep43)) {
|
|
720593
720947
|
return true;
|
|
720594
720948
|
}
|
|
720595
|
-
if (normalizedPath.startsWith(join162(getCwd(), ".claude", "agent-memory") +
|
|
720949
|
+
if (normalizedPath.startsWith(join162(getCwd(), ".claude", "agent-memory") + sep43)) {
|
|
720596
720950
|
return true;
|
|
720597
720951
|
}
|
|
720598
720952
|
if (process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR) {
|
|
720599
|
-
if (normalizedPath.includes(
|
|
720953
|
+
if (normalizedPath.includes(sep43 + "agent-memory-local" + sep43) && normalizedPath.startsWith(join162(process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR, "projects") + sep43)) {
|
|
720600
720954
|
return true;
|
|
720601
720955
|
}
|
|
720602
|
-
} else if (normalizedPath.startsWith(join162(getCwd(), ".claude", "agent-memory-local") +
|
|
720956
|
+
} else if (normalizedPath.startsWith(join162(getCwd(), ".claude", "agent-memory-local") + sep43)) {
|
|
720603
720957
|
return true;
|
|
720604
720958
|
}
|
|
720605
720959
|
return false;
|
|
@@ -720638,7 +720992,7 @@ var init_agentMemory = __esm(() => {
|
|
|
720638
720992
|
// src/utils/permissions/filesystem.ts
|
|
720639
720993
|
import { randomBytes as randomBytes19 } from "crypto";
|
|
720640
720994
|
import { homedir as homedir42, tmpdir as tmpdir15 } from "os";
|
|
720641
|
-
import { join as join163, normalize as
|
|
720995
|
+
import { join as join163, normalize as normalize17, posix as posix8, sep as sep44 } from "path";
|
|
720642
720996
|
function normalizeCaseForComparison2(path39) {
|
|
720643
720997
|
return path39.toLowerCase();
|
|
720644
720998
|
}
|
|
@@ -720657,11 +721011,11 @@ function getClaudeSkillScope(filePath) {
|
|
|
720657
721011
|
];
|
|
720658
721012
|
for (const { dir, prefix } of bases) {
|
|
720659
721013
|
const dirLower = normalizeCaseForComparison2(dir);
|
|
720660
|
-
for (const s4 of [
|
|
721014
|
+
for (const s4 of [sep44, "/"]) {
|
|
720661
721015
|
if (absolutePathLower.startsWith(dirLower + s4.toLowerCase())) {
|
|
720662
721016
|
const rest = absolutePath.slice(dir.length + s4.length);
|
|
720663
721017
|
const slash = rest.indexOf("/");
|
|
720664
|
-
const bslash =
|
|
721018
|
+
const bslash = sep44 === "\\" ? rest.indexOf("\\") : -1;
|
|
720665
721019
|
const cut = slash === -1 ? bslash : bslash === -1 ? slash : Math.min(slash, bslash);
|
|
720666
721020
|
if (cut <= 0)
|
|
720667
721021
|
return null;
|
|
@@ -720697,7 +721051,7 @@ function getSettingsPaths() {
|
|
|
720697
721051
|
function isClaudeSettingsPath(filePath) {
|
|
720698
721052
|
const expandedPath = expandPath(filePath);
|
|
720699
721053
|
const normalizedPath = normalizeCaseForComparison2(expandedPath);
|
|
720700
|
-
if (normalizedPath.endsWith(`${
|
|
721054
|
+
if (normalizedPath.endsWith(`${sep44}.claude${sep44}settings.json`) || normalizedPath.endsWith(`${sep44}.claude${sep44}settings.local.json`)) {
|
|
720701
721055
|
return true;
|
|
720702
721056
|
}
|
|
720703
721057
|
return getSettingsPaths().some((settingsPath) => normalizeCaseForComparison2(settingsPath) === normalizedPath);
|
|
@@ -720713,23 +721067,23 @@ function isClaudeConfigFilePath(filePath) {
|
|
|
720713
721067
|
}
|
|
720714
721068
|
function isSessionPlanFile(absolutePath) {
|
|
720715
721069
|
const expectedPrefix = join163(getPlansDirectory(), getPlanSlug());
|
|
720716
|
-
const normalizedPath =
|
|
721070
|
+
const normalizedPath = normalize17(absolutePath);
|
|
720717
721071
|
return normalizedPath.startsWith(expectedPrefix) && normalizedPath.endsWith(".md");
|
|
720718
721072
|
}
|
|
720719
721073
|
function getSessionMemoryDir() {
|
|
720720
|
-
return join163(getProjectDir2(getCwd()), getSessionId(), "session-memory") +
|
|
721074
|
+
return join163(getProjectDir2(getCwd()), getSessionId(), "session-memory") + sep44;
|
|
720721
721075
|
}
|
|
720722
721076
|
function getSessionMemoryPath() {
|
|
720723
721077
|
return join163(getSessionMemoryDir(), "summary.md");
|
|
720724
721078
|
}
|
|
720725
721079
|
function isSessionMemoryPath(absolutePath) {
|
|
720726
|
-
const normalizedPath =
|
|
721080
|
+
const normalizedPath = normalize17(absolutePath);
|
|
720727
721081
|
return normalizedPath.startsWith(getSessionMemoryDir());
|
|
720728
721082
|
}
|
|
720729
721083
|
function isProjectDirPath(absolutePath) {
|
|
720730
721084
|
const projectDir = getProjectDir2(getCwd());
|
|
720731
|
-
const normalizedPath =
|
|
720732
|
-
return normalizedPath === projectDir || normalizedPath.startsWith(projectDir +
|
|
721085
|
+
const normalizedPath = normalize17(absolutePath);
|
|
721086
|
+
return normalizedPath === projectDir || normalizedPath.startsWith(projectDir + sep44);
|
|
720733
721087
|
}
|
|
720734
721088
|
function isScratchpadEnabled() {
|
|
720735
721089
|
return checkStatsigFeatureGate_CACHED_MAY_BE_STALE("tengu_scratch");
|
|
@@ -720742,7 +721096,7 @@ function getClaudeTempDirName() {
|
|
|
720742
721096
|
return `claude-${uid}`;
|
|
720743
721097
|
}
|
|
720744
721098
|
function getProjectTempDir() {
|
|
720745
|
-
return join163(getClaudeTempDir(), sanitizePath2(getOriginalCwd())) +
|
|
721099
|
+
return join163(getClaudeTempDir(), sanitizePath2(getOriginalCwd())) + sep44;
|
|
720746
721100
|
}
|
|
720747
721101
|
function getScratchpadDir() {
|
|
720748
721102
|
return join163(getProjectTempDir(), getSessionId(), "scratchpad");
|
|
@@ -720761,12 +721115,12 @@ function isScratchpadPath(absolutePath) {
|
|
|
720761
721115
|
return false;
|
|
720762
721116
|
}
|
|
720763
721117
|
const scratchpadDir = getScratchpadDir();
|
|
720764
|
-
const normalizedPath =
|
|
720765
|
-
return normalizedPath === scratchpadDir || normalizedPath.startsWith(scratchpadDir +
|
|
721118
|
+
const normalizedPath = normalize17(absolutePath);
|
|
721119
|
+
return normalizedPath === scratchpadDir || normalizedPath.startsWith(scratchpadDir + sep44);
|
|
720766
721120
|
}
|
|
720767
721121
|
function isDangerousFilePathToAutoEdit(path39) {
|
|
720768
721122
|
const absolutePath = expandPath(path39);
|
|
720769
|
-
const pathSegments = absolutePath.split(
|
|
721123
|
+
const pathSegments = absolutePath.split(sep44);
|
|
720770
721124
|
const fileName = pathSegments.at(-1);
|
|
720771
721125
|
if (path39.startsWith("\\\\") || path39.startsWith("//")) {
|
|
720772
721126
|
return true;
|
|
@@ -720871,14 +721225,14 @@ function pathInWorkingPath(path39, workingPath) {
|
|
|
720871
721225
|
const normalizedWorkingPath = absoluteWorkingPath.replace(/^\/private\/var\//, "/var/").replace(/^\/private\/tmp(\/|$)/, "/tmp$1");
|
|
720872
721226
|
const caseNormalizedPath = normalizeCaseForComparison2(normalizedPath);
|
|
720873
721227
|
const caseNormalizedWorkingPath = normalizeCaseForComparison2(normalizedWorkingPath);
|
|
720874
|
-
const
|
|
720875
|
-
if (
|
|
721228
|
+
const relative32 = relativePath(caseNormalizedWorkingPath, caseNormalizedPath);
|
|
721229
|
+
if (relative32 === "") {
|
|
720876
721230
|
return true;
|
|
720877
721231
|
}
|
|
720878
|
-
if (containsPathTraversal(
|
|
721232
|
+
if (containsPathTraversal(relative32)) {
|
|
720879
721233
|
return false;
|
|
720880
721234
|
}
|
|
720881
|
-
return !posix8.isAbsolute(
|
|
721235
|
+
return !posix8.isAbsolute(relative32);
|
|
720882
721236
|
}
|
|
720883
721237
|
function rootPathForSource(source2) {
|
|
720884
721238
|
switch (source2) {
|
|
@@ -721022,7 +721376,8 @@ function getCachedPatternMatchers(toolPermissionContext, toolType, behavior) {
|
|
|
721022
721376
|
getIg: () => {
|
|
721023
721377
|
if (ig === undefined || ++useCount > MATCHER_RECOMPILE_THRESHOLD) {
|
|
721024
721378
|
useCount = 1;
|
|
721025
|
-
|
|
721379
|
+
const patternsToAdd = behavior === "allow" ? Array.from(patternMap.keys()) : Array.from(patternMap.keys(), normalizeIgnorePattern);
|
|
721380
|
+
ig = import_ignore6.default().add(patternsToAdd);
|
|
721026
721381
|
}
|
|
721027
721382
|
return ig;
|
|
721028
721383
|
}
|
|
@@ -721337,7 +721692,7 @@ function generateSuggestions(filePath, operationType, toolPermissionContext, pre
|
|
|
721337
721692
|
return shouldSuggestAcceptEdits ? [{ type: "setMode", mode: "acceptEdits", destination: "session" }] : [];
|
|
721338
721693
|
}
|
|
721339
721694
|
function checkEditableInternalPath(absolutePath, input2) {
|
|
721340
|
-
const normalizedPath =
|
|
721695
|
+
const normalizedPath = normalize17(absolutePath);
|
|
721341
721696
|
if (isSessionPlanFile(normalizedPath)) {
|
|
721342
721697
|
return {
|
|
721343
721698
|
behavior: "allow",
|
|
@@ -721362,14 +721717,14 @@ function checkEditableInternalPath(absolutePath, input2) {
|
|
|
721362
721717
|
const jobDir = process.env.CLAUDE_JOB_DIR;
|
|
721363
721718
|
if (jobDir) {
|
|
721364
721719
|
const jobsRoot = join163(getClaudeConfigHomeDir(), "jobs");
|
|
721365
|
-
const jobDirForms = getPathsForPermissionCheck(jobDir).map(
|
|
721366
|
-
const jobsRootForms = getPathsForPermissionCheck(jobsRoot).map(
|
|
721367
|
-
const isUnderJobsRoot = jobDirForms.every((jd) => jobsRootForms.some((jr) => jd.startsWith(jr +
|
|
721720
|
+
const jobDirForms = getPathsForPermissionCheck(jobDir).map(normalize17);
|
|
721721
|
+
const jobsRootForms = getPathsForPermissionCheck(jobsRoot).map(normalize17);
|
|
721722
|
+
const isUnderJobsRoot = jobDirForms.every((jd) => jobsRootForms.some((jr) => jd.startsWith(jr + sep44)));
|
|
721368
721723
|
if (isUnderJobsRoot) {
|
|
721369
721724
|
const targetForms = getPathsForPermissionCheck(absolutePath);
|
|
721370
721725
|
const allInsideJobDir = targetForms.every((p4) => {
|
|
721371
|
-
const np =
|
|
721372
|
-
return jobDirForms.some((jd) => np === jd || np.startsWith(jd +
|
|
721726
|
+
const np = normalize17(p4);
|
|
721727
|
+
return jobDirForms.some((jd) => np === jd || np.startsWith(jd + sep44));
|
|
721373
721728
|
});
|
|
721374
721729
|
if (allInsideJobDir) {
|
|
721375
721730
|
return {
|
|
@@ -721417,7 +721772,7 @@ function checkEditableInternalPath(absolutePath, input2) {
|
|
|
721417
721772
|
return { behavior: "passthrough", message: "" };
|
|
721418
721773
|
}
|
|
721419
721774
|
function checkReadableInternalPath(absolutePath, input2) {
|
|
721420
|
-
const normalizedPath =
|
|
721775
|
+
const normalizedPath = normalize17(absolutePath);
|
|
721421
721776
|
if (isSessionMemoryPath(normalizedPath)) {
|
|
721422
721777
|
return {
|
|
721423
721778
|
behavior: "allow",
|
|
@@ -721449,7 +721804,7 @@ function checkReadableInternalPath(absolutePath, input2) {
|
|
|
721449
721804
|
};
|
|
721450
721805
|
}
|
|
721451
721806
|
const toolResultsDir = getToolResultsDir();
|
|
721452
|
-
const toolResultsDirWithSep = toolResultsDir.endsWith(
|
|
721807
|
+
const toolResultsDirWithSep = toolResultsDir.endsWith(sep44) ? toolResultsDir : toolResultsDir + sep44;
|
|
721453
721808
|
if (normalizedPath === toolResultsDir || normalizedPath.startsWith(toolResultsDirWithSep)) {
|
|
721454
721809
|
return {
|
|
721455
721810
|
behavior: "allow",
|
|
@@ -721501,7 +721856,7 @@ function checkReadableInternalPath(absolutePath, input2) {
|
|
|
721501
721856
|
}
|
|
721502
721857
|
};
|
|
721503
721858
|
}
|
|
721504
|
-
const tasksDir = join163(getClaudeConfigHomeDir(), "tasks") +
|
|
721859
|
+
const tasksDir = join163(getClaudeConfigHomeDir(), "tasks") + sep44;
|
|
721505
721860
|
if (normalizedPath === tasksDir.slice(0, -1) || normalizedPath.startsWith(tasksDir)) {
|
|
721506
721861
|
return {
|
|
721507
721862
|
behavior: "allow",
|
|
@@ -721512,7 +721867,7 @@ function checkReadableInternalPath(absolutePath, input2) {
|
|
|
721512
721867
|
}
|
|
721513
721868
|
};
|
|
721514
721869
|
}
|
|
721515
|
-
const teamsReadDir = join163(getClaudeConfigHomeDir(), "teams") +
|
|
721870
|
+
const teamsReadDir = join163(getClaudeConfigHomeDir(), "teams") + sep44;
|
|
721516
721871
|
if (normalizedPath === teamsReadDir.slice(0, -1) || normalizedPath.startsWith(teamsReadDir)) {
|
|
721517
721872
|
return {
|
|
721518
721873
|
behavior: "allow",
|
|
@@ -721523,7 +721878,7 @@ function checkReadableInternalPath(absolutePath, input2) {
|
|
|
721523
721878
|
}
|
|
721524
721879
|
};
|
|
721525
721880
|
}
|
|
721526
|
-
const bundledSkillsRoot = getBundledSkillsRoot() +
|
|
721881
|
+
const bundledSkillsRoot = getBundledSkillsRoot() + sep44;
|
|
721527
721882
|
if (normalizedPath.startsWith(bundledSkillsRoot)) {
|
|
721528
721883
|
return {
|
|
721529
721884
|
behavior: "allow",
|
|
@@ -721587,7 +721942,7 @@ var init_filesystem = __esm(() => {
|
|
|
721587
721942
|
try {
|
|
721588
721943
|
resolvedBaseTmpDir = fs25.realpathSync(baseTmpDir);
|
|
721589
721944
|
} catch {}
|
|
721590
|
-
return join163(resolvedBaseTmpDir, getClaudeTempDirName()) +
|
|
721945
|
+
return join163(resolvedBaseTmpDir, getClaudeTempDirName()) + sep44;
|
|
721591
721946
|
});
|
|
721592
721947
|
getBundledSkillsRoot = memoize_default(function getBundledSkillsRoot2() {
|
|
721593
721948
|
const nonce = randomBytes19(16).toString("hex");
|
|
@@ -721672,8 +722027,8 @@ class DiskTaskOutput {
|
|
|
721672
722027
|
this.#queue.push(content);
|
|
721673
722028
|
}
|
|
721674
722029
|
if (!this.#flushPromise) {
|
|
721675
|
-
this.#flushPromise = new Promise((
|
|
721676
|
-
this.#flushResolve =
|
|
722030
|
+
this.#flushPromise = new Promise((resolve57) => {
|
|
722031
|
+
this.#flushResolve = resolve57;
|
|
721677
722032
|
});
|
|
721678
722033
|
track(this.#drain());
|
|
721679
722034
|
}
|
|
@@ -721739,10 +722094,10 @@ class DiskTaskOutput {
|
|
|
721739
722094
|
}
|
|
721740
722095
|
}
|
|
721741
722096
|
} finally {
|
|
721742
|
-
const
|
|
722097
|
+
const resolve57 = this.#flushResolve;
|
|
721743
722098
|
this.#flushPromise = null;
|
|
721744
722099
|
this.#flushResolve = null;
|
|
721745
|
-
|
|
722100
|
+
resolve57();
|
|
721746
722101
|
}
|
|
721747
722102
|
}
|
|
721748
722103
|
}
|
|
@@ -722074,11 +722429,11 @@ class ShellCommandImpl {
|
|
|
722074
722429
|
this.#childProcess.once("exit", this.#exitHandler.bind(this));
|
|
722075
722430
|
this.#childProcess.once("error", this.#errorHandler.bind(this));
|
|
722076
722431
|
this.#timeoutId = setTimeout(ShellCommandImpl.#handleTimeout, this.#timeout, this);
|
|
722077
|
-
const exitPromise = new Promise((
|
|
722078
|
-
this.#exitCodeResolver =
|
|
722432
|
+
const exitPromise = new Promise((resolve57) => {
|
|
722433
|
+
this.#exitCodeResolver = resolve57;
|
|
722079
722434
|
});
|
|
722080
|
-
return new Promise((
|
|
722081
|
-
this.#resultResolver =
|
|
722435
|
+
return new Promise((resolve57) => {
|
|
722436
|
+
this.#resultResolver = resolve57;
|
|
722082
722437
|
exitPromise.then(this.#handleExit.bind(this));
|
|
722083
722438
|
});
|
|
722084
722439
|
}
|
|
@@ -722591,6 +722946,21 @@ var init_execPromptHook = __esm(() => {
|
|
|
722591
722946
|
init_hookHelpers();
|
|
722592
722947
|
});
|
|
722593
722948
|
|
|
722949
|
+
// src/utils/hooks/hookExit2Block.ts
|
|
722950
|
+
function exit2BlockReason(params) {
|
|
722951
|
+
const { status: status2, validationError, hasJson, stderr, command: command11 } = params;
|
|
722952
|
+
if (status2 !== 2) {
|
|
722953
|
+
return null;
|
|
722954
|
+
}
|
|
722955
|
+
if (hasJson && !validationError) {
|
|
722956
|
+
return null;
|
|
722957
|
+
}
|
|
722958
|
+
return {
|
|
722959
|
+
blockingError: `[${command11}]: ${stderr || "No stderr output"}`,
|
|
722960
|
+
command: command11
|
|
722961
|
+
};
|
|
722962
|
+
}
|
|
722963
|
+
|
|
722594
722964
|
// src/utils/hooks/execAgentHook.ts
|
|
722595
722965
|
import { randomUUID as randomUUID40 } from "crypto";
|
|
722596
722966
|
async function execAgentHook(hook, hookName, hookEvent, jsonInput, signal, toolUseContext, toolUseID, _messages, agentName) {
|
|
@@ -723272,7 +723642,7 @@ function executeInBackground({
|
|
|
723272
723642
|
}) {
|
|
723273
723643
|
if (asyncRewake) {
|
|
723274
723644
|
shellCommand.result.then(async (result) => {
|
|
723275
|
-
await new Promise((
|
|
723645
|
+
await new Promise((resolve57) => setImmediate(resolve57));
|
|
723276
723646
|
const stdout = await shellCommand.taskOutput.getStdout();
|
|
723277
723647
|
const stderr = shellCommand.taskOutput.getStderr();
|
|
723278
723648
|
shellCommand.cleanup();
|
|
@@ -723827,8 +724197,8 @@ async function execCommandHook(hook, hookEvent, hookName, jsonInput, signal, hoo
|
|
|
723827
724197
|
child.stderr.setEncoding("utf8");
|
|
723828
724198
|
let initialResponseChecked = false;
|
|
723829
724199
|
let asyncResolve = null;
|
|
723830
|
-
const childIsAsyncPromise = new Promise((
|
|
723831
|
-
asyncResolve =
|
|
724200
|
+
const childIsAsyncPromise = new Promise((resolve57) => {
|
|
724201
|
+
asyncResolve = resolve57;
|
|
723832
724202
|
});
|
|
723833
724203
|
const processedPromptLines = new Set;
|
|
723834
724204
|
let promptChain = Promise.resolve();
|
|
@@ -723918,13 +724288,13 @@ async function execCommandHook(hook, hookEvent, hookName, jsonInput, signal, hoo
|
|
|
723918
724288
|
hookEvent,
|
|
723919
724289
|
getOutput: async () => ({ stdout, stderr, output: output2 })
|
|
723920
724290
|
});
|
|
723921
|
-
const stdoutEndPromise = new Promise((
|
|
723922
|
-
child.stdout.on("end", () =>
|
|
724291
|
+
const stdoutEndPromise = new Promise((resolve57) => {
|
|
724292
|
+
child.stdout.on("end", () => resolve57());
|
|
723923
724293
|
});
|
|
723924
|
-
const stderrEndPromise = new Promise((
|
|
723925
|
-
child.stderr.on("end", () =>
|
|
724294
|
+
const stderrEndPromise = new Promise((resolve57) => {
|
|
724295
|
+
child.stderr.on("end", () => resolve57());
|
|
723926
724296
|
});
|
|
723927
|
-
const stdinWritePromise = stdinWritten ? Promise.resolve() : new Promise((
|
|
724297
|
+
const stdinWritePromise = stdinWritten ? Promise.resolve() : new Promise((resolve57, reject2) => {
|
|
723928
724298
|
child.stdin.on("error", (err2) => {
|
|
723929
724299
|
if (!requestPrompt) {
|
|
723930
724300
|
reject2(err2);
|
|
@@ -723937,12 +724307,12 @@ async function execCommandHook(hook, hookEvent, hookName, jsonInput, signal, hoo
|
|
|
723937
724307
|
if (!requestPrompt) {
|
|
723938
724308
|
child.stdin.end();
|
|
723939
724309
|
}
|
|
723940
|
-
|
|
724310
|
+
resolve57();
|
|
723941
724311
|
});
|
|
723942
724312
|
const childErrorPromise = new Promise((_4, reject2) => {
|
|
723943
724313
|
child.on("error", reject2);
|
|
723944
724314
|
});
|
|
723945
|
-
const childClosePromise = new Promise((
|
|
724315
|
+
const childClosePromise = new Promise((resolve57) => {
|
|
723946
724316
|
let exitCode = null;
|
|
723947
724317
|
child.on("close", (code) => {
|
|
723948
724318
|
exitCode = code ?? 1;
|
|
@@ -723950,7 +724320,7 @@ async function execCommandHook(hook, hookEvent, hookName, jsonInput, signal, hoo
|
|
|
723950
724320
|
const finalStdout = processedPromptLines.size === 0 ? stdout : stdout.split(`
|
|
723951
724321
|
`).filter((line) => !processedPromptLines.has(line.trim())).join(`
|
|
723952
724322
|
`);
|
|
723953
|
-
|
|
724323
|
+
resolve57({
|
|
723954
724324
|
stdout: finalStdout,
|
|
723955
724325
|
stderr,
|
|
723956
724326
|
output: output2,
|
|
@@ -724758,6 +725128,34 @@ async function* executeHooks({
|
|
|
724758
725128
|
}
|
|
724759
725129
|
const { json: json2, plainText, validationError } = parseHookOutput(result.stdout);
|
|
724760
725130
|
if (validationError) {
|
|
725131
|
+
const exit2Block = exit2BlockReason({
|
|
725132
|
+
status: result.status,
|
|
725133
|
+
validationError,
|
|
725134
|
+
hasJson: !!json2,
|
|
725135
|
+
stderr: result.stderr,
|
|
725136
|
+
command: hookCommand
|
|
725137
|
+
});
|
|
725138
|
+
if (exit2Block) {
|
|
725139
|
+
emitHookResponse({
|
|
725140
|
+
hookId,
|
|
725141
|
+
hookName,
|
|
725142
|
+
hookEvent,
|
|
725143
|
+
output: result.output,
|
|
725144
|
+
stdout: result.stdout,
|
|
725145
|
+
stderr: result.stderr,
|
|
725146
|
+
exitCode: result.status,
|
|
725147
|
+
outcome: "error"
|
|
725148
|
+
});
|
|
725149
|
+
yield {
|
|
725150
|
+
blockingError: {
|
|
725151
|
+
blockingError: exit2Block.blockingError,
|
|
725152
|
+
command: exit2Block.command
|
|
725153
|
+
},
|
|
725154
|
+
outcome: "blocking",
|
|
725155
|
+
hook
|
|
725156
|
+
};
|
|
725157
|
+
return;
|
|
725158
|
+
}
|
|
724761
725159
|
emitHookResponse({
|
|
724762
725160
|
hookId,
|
|
724763
725161
|
hookName,
|
|
@@ -725337,6 +725735,23 @@ async function executeHooksOutsideREPL({
|
|
|
725337
725735
|
logForDebugging(`${hookName} [${hook.command}] completed with status ${result.status}`);
|
|
725338
725736
|
const { json: json2, validationError } = parseHookOutput(result.stdout);
|
|
725339
725737
|
if (validationError) {
|
|
725738
|
+
const exit2Block = exit2BlockReason({
|
|
725739
|
+
status: result.status,
|
|
725740
|
+
validationError,
|
|
725741
|
+
hasJson: !!json2,
|
|
725742
|
+
stderr: result.stderr,
|
|
725743
|
+
command: hook.command
|
|
725744
|
+
});
|
|
725745
|
+
if (exit2Block) {
|
|
725746
|
+
return {
|
|
725747
|
+
command: hook.command,
|
|
725748
|
+
succeeded: false,
|
|
725749
|
+
output: result.stderr || "",
|
|
725750
|
+
blocked: true,
|
|
725751
|
+
watchPaths: undefined,
|
|
725752
|
+
systemMessage: undefined
|
|
725753
|
+
};
|
|
725754
|
+
}
|
|
725340
725755
|
throw new Error(validationError);
|
|
725341
725756
|
}
|
|
725342
725757
|
if (json2 && !isAsyncHookJSONOutput(json2)) {
|
|
@@ -726128,12 +726543,12 @@ async function executeFunctionHook({
|
|
|
726128
726543
|
hook
|
|
726129
726544
|
};
|
|
726130
726545
|
}
|
|
726131
|
-
const passed = await new Promise((
|
|
726546
|
+
const passed = await new Promise((resolve57, reject2) => {
|
|
726132
726547
|
const onAbort = () => reject2(new Error("Function hook cancelled"));
|
|
726133
726548
|
abortSignal.addEventListener("abort", onAbort);
|
|
726134
726549
|
Promise.resolve(hook.callback(messages, abortSignal)).then((result) => {
|
|
726135
726550
|
abortSignal.removeEventListener("abort", onAbort);
|
|
726136
|
-
|
|
726551
|
+
resolve57(result);
|
|
726137
726552
|
}).catch((error52) => {
|
|
726138
726553
|
abortSignal.removeEventListener("abort", onAbort);
|
|
726139
726554
|
reject2(error52);
|
|
@@ -726475,8 +726890,8 @@ import {
|
|
|
726475
726890
|
symlink as symlink5,
|
|
726476
726891
|
utimes as utimes2
|
|
726477
726892
|
} from "fs/promises";
|
|
726478
|
-
import { existsSync as existsSync26, readFileSync as
|
|
726479
|
-
import { basename as basename50, dirname as
|
|
726893
|
+
import { existsSync as existsSync26, readFileSync as readFileSync34, statSync as statSync19 } from "fs";
|
|
726894
|
+
import { basename as basename50, dirname as dirname72, join as join165 } from "path";
|
|
726480
726895
|
function validateWorktreeSlug(slug) {
|
|
726481
726896
|
if (slug.length > MAX_WORKTREE_SLUG_LENGTH) {
|
|
726482
726897
|
throw new Error(`Invalid worktree name: must be ${MAX_WORKTREE_SLUG_LENGTH} characters or fewer (got ${slug.length})`);
|
|
@@ -726517,14 +726932,14 @@ function getCurrentWorktreeSession() {
|
|
|
726517
726932
|
}
|
|
726518
726933
|
function getLinkedGitWorktreePath() {
|
|
726519
726934
|
let dir = getCwd();
|
|
726520
|
-
const root3 =
|
|
726935
|
+
const root3 = dirname72(getCwd());
|
|
726521
726936
|
for (let i6 = 0;i6 < 40; i6++) {
|
|
726522
726937
|
const dotGit = join165(dir, ".git");
|
|
726523
726938
|
try {
|
|
726524
726939
|
if (existsSync26(dotGit)) {
|
|
726525
726940
|
const stats = statSync19(dotGit);
|
|
726526
726941
|
if (stats.isFile()) {
|
|
726527
|
-
const content =
|
|
726942
|
+
const content = readFileSync34(dotGit, "utf8").trim();
|
|
726528
726943
|
if (content.startsWith("gitdir:")) {
|
|
726529
726944
|
return dir;
|
|
726530
726945
|
}
|
|
@@ -726532,10 +726947,10 @@ function getLinkedGitWorktreePath() {
|
|
|
726532
726947
|
return null;
|
|
726533
726948
|
}
|
|
726534
726949
|
} catch {}
|
|
726535
|
-
if (dir === root3 || dir ===
|
|
726950
|
+
if (dir === root3 || dir === dirname72(dir)) {
|
|
726536
726951
|
break;
|
|
726537
726952
|
}
|
|
726538
|
-
dir =
|
|
726953
|
+
dir = dirname72(dir);
|
|
726539
726954
|
}
|
|
726540
726955
|
return null;
|
|
726541
726956
|
}
|
|
@@ -726696,7 +727111,7 @@ async function copyWorktreeIncludeFiles(repoRoot, worktreePath) {
|
|
|
726696
727111
|
const srcPath = join165(repoRoot, relativePath2);
|
|
726697
727112
|
const destPath = join165(worktreePath, relativePath2);
|
|
726698
727113
|
try {
|
|
726699
|
-
await mkdir54(
|
|
727114
|
+
await mkdir54(dirname72(destPath), { recursive: true });
|
|
726700
727115
|
await copyFile11(srcPath, destPath);
|
|
726701
727116
|
copied.push(relativePath2);
|
|
726702
727117
|
} catch (e4) {
|
|
@@ -726713,7 +727128,7 @@ async function performPostCreationSetup(repoRoot, worktreePath) {
|
|
|
726713
727128
|
const sourceSettingsLocal = join165(repoRoot, localSettingsRelativePath);
|
|
726714
727129
|
try {
|
|
726715
727130
|
const destSettingsLocal = join165(worktreePath, localSettingsRelativePath);
|
|
726716
|
-
await mkdirRecursive(
|
|
727131
|
+
await mkdirRecursive(dirname72(destSettingsLocal));
|
|
726717
727132
|
await copyFile11(sourceSettingsLocal, destSettingsLocal);
|
|
726718
727133
|
logForDebugging(`Copied settings.local.json to worktree: ${destSettingsLocal}`);
|
|
726719
727134
|
} catch (e4) {
|
|
@@ -727908,11 +728323,11 @@ class ChromeNativeHost {
|
|
|
727908
728323
|
}
|
|
727909
728324
|
log3(`Creating socket listener: ${this.socketPath}`);
|
|
727910
728325
|
this.server = createServer8((socket) => this.handleMcpClient(socket));
|
|
727911
|
-
await new Promise((
|
|
728326
|
+
await new Promise((resolve57, reject2) => {
|
|
727912
728327
|
this.server.listen(this.socketPath, () => {
|
|
727913
728328
|
log3("Socket server listening for connections");
|
|
727914
728329
|
this.running = true;
|
|
727915
|
-
|
|
728330
|
+
resolve57();
|
|
727916
728331
|
});
|
|
727917
728332
|
this.server.on("error", (err2) => {
|
|
727918
728333
|
log3("Socket server error:", err2);
|
|
@@ -727937,8 +728352,8 @@ class ChromeNativeHost {
|
|
|
727937
728352
|
}
|
|
727938
728353
|
this.mcpClients.clear();
|
|
727939
728354
|
if (this.server) {
|
|
727940
|
-
await new Promise((
|
|
727941
|
-
this.server.close(() =>
|
|
728355
|
+
await new Promise((resolve57) => {
|
|
728356
|
+
this.server.close(() => resolve57());
|
|
727942
728357
|
});
|
|
727943
728358
|
this.server = null;
|
|
727944
728359
|
}
|
|
@@ -728159,8 +728574,8 @@ class ChromeMessageReader {
|
|
|
728159
728574
|
return messageBytes.toString("utf-8");
|
|
728160
728575
|
}
|
|
728161
728576
|
}
|
|
728162
|
-
return new Promise((
|
|
728163
|
-
this.pendingResolve =
|
|
728577
|
+
return new Promise((resolve57) => {
|
|
728578
|
+
this.pendingResolve = resolve57;
|
|
728164
728579
|
this.tryProcessMessage();
|
|
728165
728580
|
});
|
|
728166
728581
|
}
|
|
@@ -728756,7 +729171,7 @@ var init_pollConfig = __esm(() => {
|
|
|
728756
729171
|
import { spawn as spawn16 } from "child_process";
|
|
728757
729172
|
import { createWriteStream as createWriteStream6 } from "fs";
|
|
728758
729173
|
import { tmpdir as tmpdir16 } from "os";
|
|
728759
|
-
import { dirname as
|
|
729174
|
+
import { dirname as dirname73, join as join167 } from "path";
|
|
728760
729175
|
import { createInterface as createInterface3 } from "readline";
|
|
728761
729176
|
function safeFilenameId(id) {
|
|
728762
729177
|
return id.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
@@ -728894,7 +729309,7 @@ function createSessionSpawner(deps) {
|
|
|
728894
729309
|
let transcriptStream = null;
|
|
728895
729310
|
let transcriptPath;
|
|
728896
729311
|
if (deps.debugFile) {
|
|
728897
|
-
transcriptPath = join167(
|
|
729312
|
+
transcriptPath = join167(dirname73(deps.debugFile), `bridge-transcript-${safeId}.jsonl`);
|
|
728898
729313
|
transcriptStream = createWriteStream6(transcriptPath, { flags: "a" });
|
|
728899
729314
|
transcriptStream.on("error", (err2) => {
|
|
728900
729315
|
deps.onDebug(`[bridge:session] Transcript write error: ${err2.message}`);
|
|
@@ -729004,7 +729419,7 @@ function createSessionSpawner(deps) {
|
|
|
729004
729419
|
}
|
|
729005
729420
|
});
|
|
729006
729421
|
}
|
|
729007
|
-
const done = new Promise((
|
|
729422
|
+
const done = new Promise((resolve57) => {
|
|
729008
729423
|
child.on("close", (code, signal) => {
|
|
729009
729424
|
if (transcriptStream) {
|
|
729010
729425
|
transcriptStream.end();
|
|
@@ -729012,18 +729427,18 @@ function createSessionSpawner(deps) {
|
|
|
729012
729427
|
}
|
|
729013
729428
|
if (signal === "SIGTERM" || signal === "SIGINT") {
|
|
729014
729429
|
deps.onDebug(`[bridge:session] sessionId=${opts.sessionId} interrupted signal=${signal} pid=${child.pid}`);
|
|
729015
|
-
|
|
729430
|
+
resolve57("interrupted");
|
|
729016
729431
|
} else if (code === 0) {
|
|
729017
729432
|
deps.onDebug(`[bridge:session] sessionId=${opts.sessionId} completed exit_code=0 pid=${child.pid}`);
|
|
729018
|
-
|
|
729433
|
+
resolve57("completed");
|
|
729019
729434
|
} else {
|
|
729020
729435
|
deps.onDebug(`[bridge:session] sessionId=${opts.sessionId} failed exit_code=${code} pid=${child.pid}`);
|
|
729021
|
-
|
|
729436
|
+
resolve57("failed");
|
|
729022
729437
|
}
|
|
729023
729438
|
});
|
|
729024
729439
|
child.on("error", (err2) => {
|
|
729025
729440
|
deps.onDebug(`[bridge:session] sessionId=${opts.sessionId} spawn error: ${err2.message}`);
|
|
729026
|
-
|
|
729441
|
+
resolve57("failed");
|
|
729027
729442
|
});
|
|
729028
729443
|
});
|
|
729029
729444
|
const handle2 = {
|
|
@@ -729168,14 +729583,14 @@ __export(exports_bridgePointer, {
|
|
|
729168
729583
|
BRIDGE_POINTER_TTL_MS: () => BRIDGE_POINTER_TTL_MS
|
|
729169
729584
|
});
|
|
729170
729585
|
import { mkdir as mkdir56, readFile as readFile64, stat as stat49, unlink as unlink29, writeFile as writeFile57 } from "fs/promises";
|
|
729171
|
-
import { dirname as
|
|
729586
|
+
import { dirname as dirname74, join as join168 } from "path";
|
|
729172
729587
|
function getBridgePointerPath(dir) {
|
|
729173
729588
|
return join168(getProjectsDir(), sanitizePath2(dir), "bridge-pointer.json");
|
|
729174
729589
|
}
|
|
729175
729590
|
async function writeBridgePointer(dir, pointer) {
|
|
729176
729591
|
const path39 = getBridgePointerPath(dir);
|
|
729177
729592
|
try {
|
|
729178
|
-
await mkdir56(
|
|
729593
|
+
await mkdir56(dirname74(path39), { recursive: true });
|
|
729179
729594
|
await writeFile57(path39, jsonStringify(pointer), "utf8");
|
|
729180
729595
|
logForDebugging(`[bridge:pointer] wrote ${path39}`);
|
|
729181
729596
|
} catch (err2) {
|
|
@@ -729272,7 +729687,7 @@ var init_bridgePointer = __esm(() => {
|
|
|
729272
729687
|
});
|
|
729273
729688
|
|
|
729274
729689
|
// src/utils/errorLogSink.ts
|
|
729275
|
-
import { dirname as
|
|
729690
|
+
import { dirname as dirname75, join as join169 } from "path";
|
|
729276
729691
|
function getErrorsPath() {
|
|
729277
729692
|
return join169(CACHE_PATHS.errors(), DATE + ".jsonl");
|
|
729278
729693
|
}
|
|
@@ -729293,7 +729708,7 @@ function createJsonlWriter(options) {
|
|
|
729293
729708
|
function getLogWriter(path39) {
|
|
729294
729709
|
let writer = logWriters.get(path39);
|
|
729295
729710
|
if (!writer) {
|
|
729296
|
-
const dir =
|
|
729711
|
+
const dir = dirname75(path39);
|
|
729297
729712
|
writer = createJsonlWriter({
|
|
729298
729713
|
writeFn: (content) => {
|
|
729299
729714
|
try {
|
|
@@ -729433,7 +729848,7 @@ __export(exports_bridgeMain, {
|
|
|
729433
729848
|
});
|
|
729434
729849
|
import { randomUUID as randomUUID42 } from "crypto";
|
|
729435
729850
|
import { hostname as hostname4, tmpdir as tmpdir17 } from "os";
|
|
729436
|
-
import { basename as basename51, join as join170, resolve as
|
|
729851
|
+
import { basename as basename51, join as join170, resolve as resolve57 } from "path";
|
|
729437
729852
|
async function isMultiSessionSpawnEnabled() {
|
|
729438
729853
|
return checkGate_CACHED_OR_BLOCKING("tengu_ccr_bridge_multi_session");
|
|
729439
729854
|
}
|
|
@@ -730272,9 +730687,9 @@ function parseArgs(args) {
|
|
|
730272
730687
|
} else if (arg === "--no-sandbox") {
|
|
730273
730688
|
sandbox = false;
|
|
730274
730689
|
} else if (arg === "--debug-file" && i6 + 1 < args.length) {
|
|
730275
|
-
debugFile =
|
|
730690
|
+
debugFile = resolve57(args[++i6]);
|
|
730276
730691
|
} else if (arg.startsWith("--debug-file=")) {
|
|
730277
|
-
debugFile =
|
|
730692
|
+
debugFile = resolve57(arg.slice("--debug-file=".length));
|
|
730278
730693
|
} else if (arg === "--session-timeout" && i6 + 1 < args.length) {
|
|
730279
730694
|
sessionTimeoutMs = parseInt(args[++i6], 10) * 1000;
|
|
730280
730695
|
} else if (arg.startsWith("--session-timeout=")) {
|
|
@@ -730463,7 +730878,7 @@ async function bridgeMain(args) {
|
|
|
730463
730878
|
process.exit(1);
|
|
730464
730879
|
}
|
|
730465
730880
|
}
|
|
730466
|
-
const dir =
|
|
730881
|
+
const dir = resolve57(".");
|
|
730467
730882
|
const { enableConfigs: enableConfigs2, checkHasTrustDialogAccepted: checkHasTrustDialogAccepted2 } = await Promise.resolve().then(() => (init_config4(), exports_config));
|
|
730468
730883
|
enableConfigs2();
|
|
730469
730884
|
const { initSinks: initSinks2 } = await Promise.resolve().then(() => (init_sinks(), exports_sinks));
|
|
@@ -730514,8 +730929,8 @@ or the Claude app, so you can pick up where you left off on any device.
|
|
|
730514
730929
|
|
|
730515
730930
|
You can disconnect remote access anytime by running /remote-control again.
|
|
730516
730931
|
`);
|
|
730517
|
-
const answer = await new Promise((
|
|
730518
|
-
rl.question("Enable Remote Control? (y/n) ",
|
|
730932
|
+
const answer = await new Promise((resolve58) => {
|
|
730933
|
+
rl.question("Enable Remote Control? (y/n) ", resolve58);
|
|
730519
730934
|
});
|
|
730520
730935
|
rl.close();
|
|
730521
730936
|
saveGlobalConfig2((current) => {
|
|
@@ -730576,8 +730991,8 @@ Spawn mode for this project:
|
|
|
730576
730991
|
|
|
730577
730992
|
` + `This can be changed later or explicitly set with --spawn=same-dir or --spawn=worktree.
|
|
730578
730993
|
`);
|
|
730579
|
-
const answer = await new Promise((
|
|
730580
|
-
rl.question("Choose [1/2] (default: 1): ",
|
|
730994
|
+
const answer = await new Promise((resolve58) => {
|
|
730995
|
+
rl.question("Choose [1/2] (default: 1): ", resolve58);
|
|
730581
730996
|
});
|
|
730582
730997
|
rl.close();
|
|
730583
730998
|
const chosen = answer.trim() === "2" ? "worktree" : "same-dir";
|
|
@@ -731090,7 +731505,7 @@ function buildOptions(endpoint3, method, path39) {
|
|
|
731090
731505
|
};
|
|
731091
731506
|
}
|
|
731092
731507
|
function rpc(endpoint3, method, path39, body) {
|
|
731093
|
-
return new Promise((
|
|
731508
|
+
return new Promise((resolve58, reject2) => {
|
|
731094
731509
|
const opts = buildOptions(endpoint3, method, path39);
|
|
731095
731510
|
const req = request4(opts, (res) => {
|
|
731096
731511
|
const chunks = [];
|
|
@@ -731102,11 +731517,11 @@ function rpc(endpoint3, method, path39, body) {
|
|
|
731102
731517
|
return;
|
|
731103
731518
|
}
|
|
731104
731519
|
if (!raw) {
|
|
731105
|
-
|
|
731520
|
+
resolve58(undefined);
|
|
731106
731521
|
return;
|
|
731107
731522
|
}
|
|
731108
731523
|
try {
|
|
731109
|
-
|
|
731524
|
+
resolve58(JSON.parse(raw));
|
|
731110
731525
|
} catch {
|
|
731111
731526
|
reject2(new Error("invalid JSON response"));
|
|
731112
731527
|
}
|
|
@@ -731148,15 +731563,15 @@ async function fetchRemoteControlStatus() {
|
|
|
731148
731563
|
}
|
|
731149
731564
|
}
|
|
731150
731565
|
function isSocketReachable(socketPath2) {
|
|
731151
|
-
return new Promise((
|
|
731566
|
+
return new Promise((resolve58) => {
|
|
731152
731567
|
const conn = connect4(socketPath2, () => {
|
|
731153
731568
|
conn.end();
|
|
731154
|
-
|
|
731569
|
+
resolve58(true);
|
|
731155
731570
|
});
|
|
731156
|
-
conn.on("error", () =>
|
|
731571
|
+
conn.on("error", () => resolve58(false));
|
|
731157
731572
|
conn.setTimeout(2000, () => {
|
|
731158
731573
|
conn.destroy();
|
|
731159
|
-
|
|
731574
|
+
resolve58(false);
|
|
731160
731575
|
});
|
|
731161
731576
|
});
|
|
731162
731577
|
}
|
|
@@ -731174,7 +731589,7 @@ __export(exports_daemon2, {
|
|
|
731174
731589
|
attachHandler: () => attachHandler,
|
|
731175
731590
|
appendDaemonLog: () => appendDaemonLog
|
|
731176
731591
|
});
|
|
731177
|
-
import { existsSync as existsSync27, mkdirSync as mkdirSync14, readFileSync as
|
|
731592
|
+
import { existsSync as existsSync27, mkdirSync as mkdirSync14, readFileSync as readFileSync35, writeFileSync as writeFileSync18, appendFileSync as appendFileSync4 } from "fs";
|
|
731178
731593
|
import { join as join171 } from "path";
|
|
731179
731594
|
import { execSync as execSync4 } from "child_process";
|
|
731180
731595
|
function daemonLogPath2() {
|
|
@@ -731318,7 +731733,7 @@ async function logsHandlerDaemon() {
|
|
|
731318
731733
|
});
|
|
731319
731734
|
process.stdout.write(out);
|
|
731320
731735
|
} catch (err2) {
|
|
731321
|
-
const raw =
|
|
731736
|
+
const raw = readFileSync35(path39, { encoding: "utf-8" });
|
|
731322
731737
|
const lines2 = raw.split(`
|
|
731323
731738
|
`).slice(-200).join(`
|
|
731324
731739
|
`);
|
|
@@ -731380,7 +731795,7 @@ function readScheduledConfig() {
|
|
|
731380
731795
|
if (!existsSync27(path39))
|
|
731381
731796
|
return [];
|
|
731382
731797
|
try {
|
|
731383
|
-
const parsed = JSON.parse(
|
|
731798
|
+
const parsed = JSON.parse(readFileSync35(path39, { encoding: "utf-8" }));
|
|
731384
731799
|
return Array.isArray(parsed?.scheduled) ? parsed.scheduled : [];
|
|
731385
731800
|
} catch {
|
|
731386
731801
|
return [];
|
|
@@ -731391,15 +731806,15 @@ function writeScheduledConfig(tasks2) {
|
|
|
731391
731806
|
let current = {};
|
|
731392
731807
|
if (existsSync27(path39)) {
|
|
731393
731808
|
try {
|
|
731394
|
-
current = JSON.parse(
|
|
731809
|
+
current = JSON.parse(readFileSync35(path39, { encoding: "utf-8" }));
|
|
731395
731810
|
} catch {
|
|
731396
731811
|
current = {};
|
|
731397
731812
|
}
|
|
731398
731813
|
}
|
|
731399
731814
|
current.scheduled = tasks2;
|
|
731400
731815
|
mkdirSync14(join171(path39, ".."), { recursive: true });
|
|
731401
|
-
|
|
731402
|
-
|
|
731816
|
+
writeFileSync18(path39, JSON.stringify(current, null, 2), { encoding: "utf-8" });
|
|
731817
|
+
writeFileSync18(scheduledStatusPath(), JSON.stringify({ tasks: tasks2, updatedAt: Date.now() }, null, 2), {
|
|
731403
731818
|
encoding: "utf-8"
|
|
731404
731819
|
});
|
|
731405
731820
|
}
|
|
@@ -731456,7 +731871,7 @@ async function logsHandler(id) {
|
|
|
731456
731871
|
const out = execSync4(cmd, { encoding: "utf-8", stdio: ["ignore", "pipe", "pipe"] });
|
|
731457
731872
|
process.stdout.write(out);
|
|
731458
731873
|
} catch {
|
|
731459
|
-
const raw =
|
|
731874
|
+
const raw = readFileSync35(path39, { encoding: "utf-8" });
|
|
731460
731875
|
process.stdout.write(raw.split(`
|
|
731461
731876
|
`).slice(-200).join(`
|
|
731462
731877
|
`));
|
|
@@ -734027,7 +734442,7 @@ async function startNodeRelay(wsUrl, authHeader, wsAuthHeader) {
|
|
|
734027
734442
|
cleanupConn(states.get(sock));
|
|
734028
734443
|
});
|
|
734029
734444
|
});
|
|
734030
|
-
return new Promise((
|
|
734445
|
+
return new Promise((resolve58, reject2) => {
|
|
734031
734446
|
server.once("error", reject2);
|
|
734032
734447
|
server.listen(0, "127.0.0.1", () => {
|
|
734033
734448
|
const addr = server.address();
|
|
@@ -734035,7 +734450,7 @@ async function startNodeRelay(wsUrl, authHeader, wsAuthHeader) {
|
|
|
734035
734450
|
reject2(new Error("upstreamproxy: server has no TCP address"));
|
|
734036
734451
|
return;
|
|
734037
734452
|
}
|
|
734038
|
-
|
|
734453
|
+
resolve58({
|
|
734039
734454
|
port: addr.port,
|
|
734040
734455
|
stop: () => server.close()
|
|
734041
734456
|
});
|
|
@@ -734540,7 +734955,7 @@ async function showInvalidConfigDialog({
|
|
|
734540
734955
|
...getBaseRenderOptions(false),
|
|
734541
734956
|
theme: SAFE_ERROR_THEME_NAME
|
|
734542
734957
|
};
|
|
734543
|
-
await new Promise(async (
|
|
734958
|
+
await new Promise(async (resolve58) => {
|
|
734544
734959
|
const {
|
|
734545
734960
|
unmount
|
|
734546
734961
|
} = await render(/* @__PURE__ */ jsx_runtime358.jsx(AppStateProvider, {
|
|
@@ -734550,7 +734965,7 @@ async function showInvalidConfigDialog({
|
|
|
734550
734965
|
errorDescription: error52.message,
|
|
734551
734966
|
onExit: () => {
|
|
734552
734967
|
unmount();
|
|
734553
|
-
|
|
734968
|
+
resolve58();
|
|
734554
734969
|
process.exit(1);
|
|
734555
734970
|
},
|
|
734556
734971
|
onReset: () => {
|
|
@@ -734559,7 +734974,7 @@ async function showInvalidConfigDialog({
|
|
|
734559
734974
|
encoding: "utf8"
|
|
734560
734975
|
});
|
|
734561
734976
|
unmount();
|
|
734562
|
-
|
|
734977
|
+
resolve58();
|
|
734563
734978
|
process.exit(0);
|
|
734564
734979
|
}
|
|
734565
734980
|
})
|
|
@@ -736203,8 +736618,8 @@ class SerialBatchEventUploader {
|
|
|
736203
736618
|
if (items.length === 0)
|
|
736204
736619
|
return;
|
|
736205
736620
|
while (this.pending.length + items.length > this.config.maxQueueSize && !this.closed) {
|
|
736206
|
-
await new Promise((
|
|
736207
|
-
this.backpressureResolvers.push(
|
|
736621
|
+
await new Promise((resolve58) => {
|
|
736622
|
+
this.backpressureResolvers.push(resolve58);
|
|
736208
736623
|
});
|
|
736209
736624
|
}
|
|
736210
736625
|
if (this.closed)
|
|
@@ -736217,8 +736632,8 @@ class SerialBatchEventUploader {
|
|
|
736217
736632
|
return Promise.resolve();
|
|
736218
736633
|
}
|
|
736219
736634
|
this.drain();
|
|
736220
|
-
return new Promise((
|
|
736221
|
-
this.flushResolvers.push(
|
|
736635
|
+
return new Promise((resolve58) => {
|
|
736636
|
+
this.flushResolvers.push(resolve58);
|
|
736222
736637
|
});
|
|
736223
736638
|
}
|
|
736224
736639
|
close() {
|
|
@@ -736229,11 +736644,11 @@ class SerialBatchEventUploader {
|
|
|
736229
736644
|
this.pending = [];
|
|
736230
736645
|
this.sleepResolve?.();
|
|
736231
736646
|
this.sleepResolve = null;
|
|
736232
|
-
for (const
|
|
736233
|
-
|
|
736647
|
+
for (const resolve58 of this.backpressureResolvers)
|
|
736648
|
+
resolve58();
|
|
736234
736649
|
this.backpressureResolvers = [];
|
|
736235
|
-
for (const
|
|
736236
|
-
|
|
736650
|
+
for (const resolve58 of this.flushResolvers)
|
|
736651
|
+
resolve58();
|
|
736237
736652
|
this.flushResolvers = [];
|
|
736238
736653
|
}
|
|
736239
736654
|
async drain() {
|
|
@@ -736268,8 +736683,8 @@ class SerialBatchEventUploader {
|
|
|
736268
736683
|
} finally {
|
|
736269
736684
|
this.draining = false;
|
|
736270
736685
|
if (this.pending.length === 0) {
|
|
736271
|
-
for (const
|
|
736272
|
-
|
|
736686
|
+
for (const resolve58 of this.flushResolvers)
|
|
736687
|
+
resolve58();
|
|
736273
736688
|
this.flushResolvers = [];
|
|
736274
736689
|
}
|
|
736275
736690
|
}
|
|
@@ -736308,16 +736723,16 @@ class SerialBatchEventUploader {
|
|
|
736308
736723
|
releaseBackpressure() {
|
|
736309
736724
|
const resolvers2 = this.backpressureResolvers;
|
|
736310
736725
|
this.backpressureResolvers = [];
|
|
736311
|
-
for (const
|
|
736312
|
-
|
|
736726
|
+
for (const resolve58 of resolvers2)
|
|
736727
|
+
resolve58();
|
|
736313
736728
|
}
|
|
736314
736729
|
sleep(ms) {
|
|
736315
|
-
return new Promise((
|
|
736316
|
-
this.sleepResolve =
|
|
736317
|
-
setTimeout((self2,
|
|
736730
|
+
return new Promise((resolve58) => {
|
|
736731
|
+
this.sleepResolve = resolve58;
|
|
736732
|
+
setTimeout((self2, resolve59) => {
|
|
736318
736733
|
self2.sleepResolve = null;
|
|
736319
|
-
|
|
736320
|
-
}, ms, this,
|
|
736734
|
+
resolve59();
|
|
736735
|
+
}, ms, this, resolve58);
|
|
736321
736736
|
});
|
|
736322
736737
|
}
|
|
736323
736738
|
}
|
|
@@ -746960,7 +747375,7 @@ var init_useDiffInIDE = __esm(() => {
|
|
|
746960
747375
|
});
|
|
746961
747376
|
|
|
746962
747377
|
// src/components/ShowInIDEPrompt.tsx
|
|
746963
|
-
import { basename as basename55, relative as
|
|
747378
|
+
import { basename as basename55, relative as relative32 } from "path";
|
|
746964
747379
|
function ShowInIDEPrompt(t0) {
|
|
746965
747380
|
const $4 = import_compiler_runtime274.c(36);
|
|
746966
747381
|
const {
|
|
@@ -746998,7 +747413,7 @@ function ShowInIDEPrompt(t0) {
|
|
|
746998
747413
|
if ($4[2] !== symlinkTarget) {
|
|
746999
747414
|
t22 = symlinkTarget && /* @__PURE__ */ jsx_runtime378.jsx(ThemedText, {
|
|
747000
747415
|
color: "warning",
|
|
747001
|
-
children:
|
|
747416
|
+
children: relative32(getCwd(), symlinkTarget).startsWith("..") ? `This will modify ${symlinkTarget} (outside working directory) via a symlink` : `Symlink target: ${symlinkTarget}`
|
|
747002
747417
|
});
|
|
747003
747418
|
$4[2] = symlinkTarget;
|
|
747004
747419
|
$4[3] = t22;
|
|
@@ -747178,20 +747593,20 @@ var init_ShowInIDEPrompt = __esm(() => {
|
|
|
747178
747593
|
|
|
747179
747594
|
// src/components/permissions/FilePermissionDialog/permissionOptions.tsx
|
|
747180
747595
|
import { homedir as homedir45 } from "os";
|
|
747181
|
-
import { basename as basename56, join as join174, sep as
|
|
747596
|
+
import { basename as basename56, join as join174, sep as sep45 } from "path";
|
|
747182
747597
|
function isInClaudeFolder(filePath) {
|
|
747183
747598
|
const absolutePath = expandPath(filePath);
|
|
747184
747599
|
const claudeFolderPath = expandPath(`${getOriginalCwd()}/.claude`);
|
|
747185
747600
|
const normalizedAbsolutePath = normalizeCaseForComparison2(absolutePath);
|
|
747186
747601
|
const normalizedClaudeFolderPath = normalizeCaseForComparison2(claudeFolderPath);
|
|
747187
|
-
return normalizedAbsolutePath.startsWith(normalizedClaudeFolderPath +
|
|
747602
|
+
return normalizedAbsolutePath.startsWith(normalizedClaudeFolderPath + sep45.toLowerCase()) || normalizedAbsolutePath.startsWith(normalizedClaudeFolderPath + "/");
|
|
747188
747603
|
}
|
|
747189
747604
|
function isInGlobalClaudeFolder(filePath) {
|
|
747190
747605
|
const absolutePath = expandPath(filePath);
|
|
747191
747606
|
const globalClaudeFolderPath = join174(homedir45(), ".claude");
|
|
747192
747607
|
const normalizedAbsolutePath = normalizeCaseForComparison2(absolutePath);
|
|
747193
747608
|
const normalizedGlobalClaudeFolderPath = normalizeCaseForComparison2(globalClaudeFolderPath);
|
|
747194
|
-
return normalizedAbsolutePath.startsWith(normalizedGlobalClaudeFolderPath +
|
|
747609
|
+
return normalizedAbsolutePath.startsWith(normalizedGlobalClaudeFolderPath + sep45.toLowerCase()) || normalizedAbsolutePath.startsWith(normalizedGlobalClaudeFolderPath + "/");
|
|
747195
747610
|
}
|
|
747196
747611
|
function getFilePermissionOptions({
|
|
747197
747612
|
filePath,
|
|
@@ -747565,7 +747980,7 @@ var init_useFilePermissionDialog = __esm(() => {
|
|
|
747565
747980
|
});
|
|
747566
747981
|
|
|
747567
747982
|
// src/components/permissions/FilePermissionDialog/FilePermissionDialog.tsx
|
|
747568
|
-
import { relative as
|
|
747983
|
+
import { relative as relative33 } from "path";
|
|
747569
747984
|
function FilePermissionDialog({
|
|
747570
747985
|
toolUseConfirm,
|
|
747571
747986
|
toolUseContext,
|
|
@@ -747672,7 +748087,7 @@ function FilePermissionDialog({
|
|
|
747672
748087
|
noInputMode
|
|
747673
748088
|
});
|
|
747674
748089
|
}
|
|
747675
|
-
const isSymlinkOutsideCwd = symlinkTarget != null &&
|
|
748090
|
+
const isSymlinkOutsideCwd = symlinkTarget != null && relative33(getCwd(), symlinkTarget).startsWith("..");
|
|
747676
748091
|
const symlinkWarning = symlinkTarget ? /* @__PURE__ */ jsx_runtime380.jsx(ThemedBox_default, {
|
|
747677
748092
|
paddingX: 1,
|
|
747678
748093
|
marginBottom: 1,
|
|
@@ -747759,7 +748174,7 @@ var init_FilePermissionDialog = __esm(() => {
|
|
|
747759
748174
|
});
|
|
747760
748175
|
|
|
747761
748176
|
// src/components/permissions/SedEditPermissionRequest/SedEditPermissionRequest.tsx
|
|
747762
|
-
import { basename as basename57, relative as
|
|
748177
|
+
import { basename as basename57, relative as relative34 } from "path";
|
|
747763
748178
|
function SedEditPermissionRequest(t0) {
|
|
747764
748179
|
const $4 = import_compiler_runtime275.c(9);
|
|
747765
748180
|
let props;
|
|
@@ -747927,7 +748342,7 @@ function SedEditPermissionRequestInner(t0) {
|
|
|
747927
748342
|
const t8 = props.onReject;
|
|
747928
748343
|
let t9;
|
|
747929
748344
|
if ($4[14] !== filePath) {
|
|
747930
|
-
t9 =
|
|
748345
|
+
t9 = relative34(getCwd(), filePath);
|
|
747931
748346
|
$4[14] = filePath;
|
|
747932
748347
|
$4[15] = t9;
|
|
747933
748348
|
} else {
|
|
@@ -748147,7 +748562,7 @@ var init_useShellPermissionFeedback = __esm(() => {
|
|
|
748147
748562
|
});
|
|
748148
748563
|
|
|
748149
748564
|
// src/components/permissions/shellPermissionHelpers.tsx
|
|
748150
|
-
import { basename as basename58, sep as
|
|
748565
|
+
import { basename as basename58, sep as sep46 } from "path";
|
|
748151
748566
|
function commandListDisplay(commands7) {
|
|
748152
748567
|
switch (commands7.length) {
|
|
748153
748568
|
case 0:
|
|
@@ -748206,7 +748621,7 @@ function formatPathList(paths2) {
|
|
|
748206
748621
|
bold: true,
|
|
748207
748622
|
children: names[0]
|
|
748208
748623
|
}),
|
|
748209
|
-
|
|
748624
|
+
sep46
|
|
748210
748625
|
]
|
|
748211
748626
|
});
|
|
748212
748627
|
}
|
|
@@ -748217,13 +748632,13 @@ function formatPathList(paths2) {
|
|
|
748217
748632
|
bold: true,
|
|
748218
748633
|
children: names[0]
|
|
748219
748634
|
}),
|
|
748220
|
-
|
|
748635
|
+
sep46,
|
|
748221
748636
|
" and ",
|
|
748222
748637
|
/* @__PURE__ */ jsx_runtime382.jsx(ThemedText, {
|
|
748223
748638
|
bold: true,
|
|
748224
748639
|
children: names[1]
|
|
748225
748640
|
}),
|
|
748226
|
-
|
|
748641
|
+
sep46
|
|
748227
748642
|
]
|
|
748228
748643
|
});
|
|
748229
748644
|
}
|
|
@@ -748233,13 +748648,13 @@ function formatPathList(paths2) {
|
|
|
748233
748648
|
bold: true,
|
|
748234
748649
|
children: names[0]
|
|
748235
748650
|
}),
|
|
748236
|
-
|
|
748651
|
+
sep46,
|
|
748237
748652
|
", ",
|
|
748238
748653
|
/* @__PURE__ */ jsx_runtime382.jsx(ThemedText, {
|
|
748239
748654
|
bold: true,
|
|
748240
748655
|
children: names[1]
|
|
748241
748656
|
}),
|
|
748242
|
-
|
|
748657
|
+
sep46,
|
|
748243
748658
|
" and ",
|
|
748244
748659
|
paths2.length - 2,
|
|
748245
748660
|
" more"
|
|
@@ -748272,7 +748687,7 @@ function generateShellSuggestionsLabel(suggestions, shellToolName, commandTransf
|
|
|
748272
748687
|
bold: true,
|
|
748273
748688
|
children: dirName
|
|
748274
748689
|
}),
|
|
748275
|
-
|
|
748690
|
+
sep46,
|
|
748276
748691
|
" from this project"
|
|
748277
748692
|
]
|
|
748278
748693
|
});
|
|
@@ -748296,7 +748711,7 @@ function generateShellSuggestionsLabel(suggestions, shellToolName, commandTransf
|
|
|
748296
748711
|
bold: true,
|
|
748297
748712
|
children: dirName
|
|
748298
748713
|
}),
|
|
748299
|
-
|
|
748714
|
+
sep46,
|
|
748300
748715
|
" from this project"
|
|
748301
748716
|
]
|
|
748302
748717
|
});
|
|
@@ -750712,7 +751127,7 @@ function createSingleEditDiffConfig(filePath, oldString, newString, replaceAll2)
|
|
|
750712
751127
|
}
|
|
750713
751128
|
|
|
750714
751129
|
// src/components/permissions/FileEditPermissionRequest/FileEditPermissionRequest.tsx
|
|
750715
|
-
import { basename as basename59, relative as
|
|
751130
|
+
import { basename as basename59, relative as relative35 } from "path";
|
|
750716
751131
|
function FileEditPermissionRequest(props) {
|
|
750717
751132
|
const $4 = import_compiler_runtime280.c(51);
|
|
750718
751133
|
const parseInput = _temp177;
|
|
@@ -750749,7 +751164,7 @@ function FileEditPermissionRequest(props) {
|
|
|
750749
751164
|
t7 = props.onReject;
|
|
750750
751165
|
t8 = props.workerBadge;
|
|
750751
751166
|
t9 = "Edit file";
|
|
750752
|
-
t10 =
|
|
751167
|
+
t10 = relative35(getCwd(), file_path);
|
|
750753
751168
|
T1 = ThemedText;
|
|
750754
751169
|
t22 = "Do you want to make this edit to";
|
|
750755
751170
|
t32 = " ";
|
|
@@ -751182,7 +751597,7 @@ var init_FileWriteToolDiff = __esm(() => {
|
|
|
751182
751597
|
});
|
|
751183
751598
|
|
|
751184
751599
|
// src/components/permissions/FileWritePermissionRequest/FileWritePermissionRequest.tsx
|
|
751185
|
-
import { basename as basename60, relative as
|
|
751600
|
+
import { basename as basename60, relative as relative36 } from "path";
|
|
751186
751601
|
function FileWritePermissionRequest(props) {
|
|
751187
751602
|
const $4 = import_compiler_runtime283.c(30);
|
|
751188
751603
|
const parseInput = _temp180;
|
|
@@ -751241,7 +751656,7 @@ function FileWritePermissionRequest(props) {
|
|
|
751241
751656
|
const t7 = fileExists ? "Overwrite file" : "Create file";
|
|
751242
751657
|
let t8;
|
|
751243
751658
|
if ($4[5] !== file_path) {
|
|
751244
|
-
t8 =
|
|
751659
|
+
t8 = relative36(getCwd(), file_path);
|
|
751245
751660
|
$4[5] = file_path;
|
|
751246
751661
|
$4[6] = t8;
|
|
751247
751662
|
} else {
|
|
@@ -751372,7 +751787,7 @@ var init_FileWritePermissionRequest = __esm(() => {
|
|
|
751372
751787
|
});
|
|
751373
751788
|
|
|
751374
751789
|
// src/components/permissions/NotebookEditPermissionRequest/NotebookEditToolDiff.tsx
|
|
751375
|
-
import { relative as
|
|
751790
|
+
import { relative as relative37 } from "path";
|
|
751376
751791
|
function NotebookEditToolDiff(props) {
|
|
751377
751792
|
const $4 = import_compiler_runtime284.c(5);
|
|
751378
751793
|
let t0;
|
|
@@ -751515,7 +751930,7 @@ function NotebookEditToolDiffInner(t0) {
|
|
|
751515
751930
|
}
|
|
751516
751931
|
let t4;
|
|
751517
751932
|
if ($4[11] !== notebook_path || $4[12] !== verbose) {
|
|
751518
|
-
t4 = verbose ? notebook_path :
|
|
751933
|
+
t4 = verbose ? notebook_path : relative37(getCwd(), notebook_path);
|
|
751519
751934
|
$4[11] = notebook_path;
|
|
751520
751935
|
$4[12] = verbose;
|
|
751521
751936
|
$4[13] = t4;
|
|
@@ -774191,10 +774606,10 @@ var require_commonjs = __commonJS((exports) => {
|
|
|
774191
774606
|
return this[ENCODING] ? buf.join("") : Buffer.concat(buf, buf.dataLength);
|
|
774192
774607
|
}
|
|
774193
774608
|
async promise() {
|
|
774194
|
-
return new Promise((
|
|
774609
|
+
return new Promise((resolve59, reject2) => {
|
|
774195
774610
|
this.on(DESTROYED, () => reject2(new Error("stream destroyed")));
|
|
774196
774611
|
this.on("error", (er) => reject2(er));
|
|
774197
|
-
this.on("end", () =>
|
|
774612
|
+
this.on("end", () => resolve59());
|
|
774198
774613
|
});
|
|
774199
774614
|
}
|
|
774200
774615
|
[Symbol.asyncIterator]() {
|
|
@@ -774213,7 +774628,7 @@ var require_commonjs = __commonJS((exports) => {
|
|
|
774213
774628
|
return Promise.resolve({ done: false, value: res });
|
|
774214
774629
|
if (this[EOF])
|
|
774215
774630
|
return stop2();
|
|
774216
|
-
let
|
|
774631
|
+
let resolve59;
|
|
774217
774632
|
let reject2;
|
|
774218
774633
|
const onerr = (er) => {
|
|
774219
774634
|
this.off("data", ondata);
|
|
@@ -774227,19 +774642,19 @@ var require_commonjs = __commonJS((exports) => {
|
|
|
774227
774642
|
this.off("end", onend);
|
|
774228
774643
|
this.off(DESTROYED, ondestroy);
|
|
774229
774644
|
this.pause();
|
|
774230
|
-
|
|
774645
|
+
resolve59({ value, done: !!this[EOF] });
|
|
774231
774646
|
};
|
|
774232
774647
|
const onend = () => {
|
|
774233
774648
|
this.off("error", onerr);
|
|
774234
774649
|
this.off("data", ondata);
|
|
774235
774650
|
this.off(DESTROYED, ondestroy);
|
|
774236
774651
|
stop2();
|
|
774237
|
-
|
|
774652
|
+
resolve59({ done: true, value: undefined });
|
|
774238
774653
|
};
|
|
774239
774654
|
const ondestroy = () => onerr(new Error("stream destroyed"));
|
|
774240
774655
|
return new Promise((res2, rej) => {
|
|
774241
774656
|
reject2 = rej;
|
|
774242
|
-
|
|
774657
|
+
resolve59 = res2;
|
|
774243
774658
|
this.once(DESTROYED, ondestroy);
|
|
774244
774659
|
this.once("error", onerr);
|
|
774245
774660
|
this.once("end", onend);
|
|
@@ -774816,10 +775231,10 @@ var require_minipass = __commonJS((exports, module) => {
|
|
|
774816
775231
|
return this[OBJECTMODE] ? Promise.reject(new Error("cannot concat in objectMode")) : this.collect().then((buf) => this[OBJECTMODE] ? Promise.reject(new Error("cannot concat in objectMode")) : this[ENCODING] ? buf.join("") : Buffer.concat(buf, buf.dataLength));
|
|
774817
775232
|
}
|
|
774818
775233
|
promise() {
|
|
774819
|
-
return new Promise((
|
|
775234
|
+
return new Promise((resolve59, reject2) => {
|
|
774820
775235
|
this.on(DESTROYED, () => reject2(new Error("stream destroyed")));
|
|
774821
775236
|
this.on("error", (er) => reject2(er));
|
|
774822
|
-
this.on("end", () =>
|
|
775237
|
+
this.on("end", () => resolve59());
|
|
774823
775238
|
});
|
|
774824
775239
|
}
|
|
774825
775240
|
[ASYNCITERATOR]() {
|
|
@@ -774829,7 +775244,7 @@ var require_minipass = __commonJS((exports, module) => {
|
|
|
774829
775244
|
return Promise.resolve({ done: false, value: res });
|
|
774830
775245
|
if (this[EOF])
|
|
774831
775246
|
return Promise.resolve({ done: true });
|
|
774832
|
-
let
|
|
775247
|
+
let resolve59 = null;
|
|
774833
775248
|
let reject2 = null;
|
|
774834
775249
|
const onerr = (er) => {
|
|
774835
775250
|
this.removeListener("data", ondata);
|
|
@@ -774840,17 +775255,17 @@ var require_minipass = __commonJS((exports, module) => {
|
|
|
774840
775255
|
this.removeListener("error", onerr);
|
|
774841
775256
|
this.removeListener("end", onend);
|
|
774842
775257
|
this.pause();
|
|
774843
|
-
|
|
775258
|
+
resolve59({ value, done: !!this[EOF] });
|
|
774844
775259
|
};
|
|
774845
775260
|
const onend = () => {
|
|
774846
775261
|
this.removeListener("error", onerr);
|
|
774847
775262
|
this.removeListener("data", ondata);
|
|
774848
|
-
|
|
775263
|
+
resolve59({ done: true });
|
|
774849
775264
|
};
|
|
774850
775265
|
const ondestroy = () => onerr(new Error("stream destroyed"));
|
|
774851
775266
|
return new Promise((res2, rej) => {
|
|
774852
775267
|
reject2 = rej;
|
|
774853
|
-
|
|
775268
|
+
resolve59 = res2;
|
|
774854
775269
|
this.once(DESTROYED, ondestroy);
|
|
774855
775270
|
this.once("error", onerr);
|
|
774856
775271
|
this.once("end", onend);
|
|
@@ -775179,7 +775594,7 @@ var require_lib17 = __commonJS((exports, module) => {
|
|
|
775179
775594
|
return `${this.algorithm}-${this.digest}${getOptString(this.options)}`;
|
|
775180
775595
|
}
|
|
775181
775596
|
}
|
|
775182
|
-
function integrityHashToString(toString8,
|
|
775597
|
+
function integrityHashToString(toString8, sep48, opts, hashes) {
|
|
775183
775598
|
const toStringIsNotEmpty = toString8 !== "";
|
|
775184
775599
|
let shouldAddFirstSep = false;
|
|
775185
775600
|
let complement = "";
|
|
@@ -775189,7 +775604,7 @@ var require_lib17 = __commonJS((exports, module) => {
|
|
|
775189
775604
|
if (hashString4) {
|
|
775190
775605
|
shouldAddFirstSep = true;
|
|
775191
775606
|
complement += hashString4;
|
|
775192
|
-
complement +=
|
|
775607
|
+
complement += sep48;
|
|
775193
775608
|
}
|
|
775194
775609
|
}
|
|
775195
775610
|
const finalHashString = Hash6.prototype.toString.call(hashes[lastIndex], opts);
|
|
@@ -775198,7 +775613,7 @@ var require_lib17 = __commonJS((exports, module) => {
|
|
|
775198
775613
|
complement += finalHashString;
|
|
775199
775614
|
}
|
|
775200
775615
|
if (toStringIsNotEmpty && shouldAddFirstSep) {
|
|
775201
|
-
return toString8 +
|
|
775616
|
+
return toString8 + sep48 + complement;
|
|
775202
775617
|
}
|
|
775203
775618
|
return toString8 + complement;
|
|
775204
775619
|
}
|
|
@@ -775214,18 +775629,18 @@ var require_lib17 = __commonJS((exports, module) => {
|
|
|
775214
775629
|
return Object.keys(this).length === 0;
|
|
775215
775630
|
}
|
|
775216
775631
|
toString(opts) {
|
|
775217
|
-
let
|
|
775632
|
+
let sep48 = opts?.sep || " ";
|
|
775218
775633
|
let toString8 = "";
|
|
775219
775634
|
if (opts?.strict) {
|
|
775220
|
-
|
|
775635
|
+
sep48 = sep48.replace(/\S+/g, " ");
|
|
775221
775636
|
for (const hash3 of SPEC_ALGORITHMS) {
|
|
775222
775637
|
if (this[hash3]) {
|
|
775223
|
-
toString8 = integrityHashToString(toString8,
|
|
775638
|
+
toString8 = integrityHashToString(toString8, sep48, opts, this[hash3]);
|
|
775224
775639
|
}
|
|
775225
775640
|
}
|
|
775226
775641
|
} else {
|
|
775227
775642
|
for (const hash3 of Object.keys(this)) {
|
|
775228
|
-
toString8 = integrityHashToString(toString8,
|
|
775643
|
+
toString8 = integrityHashToString(toString8, sep48, opts, this[hash3]);
|
|
775229
775644
|
}
|
|
775230
775645
|
}
|
|
775231
775646
|
return toString8;
|
|
@@ -775336,7 +775751,7 @@ var require_lib17 = __commonJS((exports, module) => {
|
|
|
775336
775751
|
exports.fromStream = fromStream;
|
|
775337
775752
|
function fromStream(stream6, opts) {
|
|
775338
775753
|
const istream = integrityStream(opts);
|
|
775339
|
-
return new Promise((
|
|
775754
|
+
return new Promise((resolve59, reject2) => {
|
|
775340
775755
|
stream6.pipe(istream);
|
|
775341
775756
|
stream6.on("error", reject2);
|
|
775342
775757
|
istream.on("error", reject2);
|
|
@@ -775344,7 +775759,7 @@ var require_lib17 = __commonJS((exports, module) => {
|
|
|
775344
775759
|
istream.on("integrity", (s4) => {
|
|
775345
775760
|
sri = s4;
|
|
775346
775761
|
});
|
|
775347
|
-
istream.on("end", () =>
|
|
775762
|
+
istream.on("end", () => resolve59(sri));
|
|
775348
775763
|
istream.resume();
|
|
775349
775764
|
});
|
|
775350
775765
|
}
|
|
@@ -775397,7 +775812,7 @@ var require_lib17 = __commonJS((exports, module) => {
|
|
|
775397
775812
|
}));
|
|
775398
775813
|
}
|
|
775399
775814
|
const checker = integrityStream(opts);
|
|
775400
|
-
return new Promise((
|
|
775815
|
+
return new Promise((resolve59, reject2) => {
|
|
775401
775816
|
stream6.pipe(checker);
|
|
775402
775817
|
stream6.on("error", reject2);
|
|
775403
775818
|
checker.on("error", reject2);
|
|
@@ -775405,7 +775820,7 @@ var require_lib17 = __commonJS((exports, module) => {
|
|
|
775405
775820
|
checker.on("verified", (s4) => {
|
|
775406
775821
|
verified = s4;
|
|
775407
775822
|
});
|
|
775408
|
-
checker.on("end", () =>
|
|
775823
|
+
checker.on("end", () => resolve59(verified));
|
|
775409
775824
|
checker.resume();
|
|
775410
775825
|
});
|
|
775411
775826
|
}
|
|
@@ -775623,12 +776038,12 @@ var require_polyfill = __commonJS((exports, module) => {
|
|
|
775623
776038
|
utimes: utimes3
|
|
775624
776039
|
} = __require("fs/promises");
|
|
775625
776040
|
var {
|
|
775626
|
-
dirname:
|
|
776041
|
+
dirname: dirname76,
|
|
775627
776042
|
isAbsolute: isAbsolute30,
|
|
775628
776043
|
join: join175,
|
|
775629
776044
|
parse: parse16,
|
|
775630
|
-
resolve:
|
|
775631
|
-
sep:
|
|
776045
|
+
resolve: resolve59,
|
|
776046
|
+
sep: sep48,
|
|
775632
776047
|
toNamespacedPath
|
|
775633
776048
|
} = __require("path");
|
|
775634
776049
|
var { fileURLToPath: fileURLToPath10 } = __require("url");
|
|
@@ -775717,7 +776132,7 @@ var require_polyfill = __commonJS((exports, module) => {
|
|
|
775717
776132
|
]);
|
|
775718
776133
|
}
|
|
775719
776134
|
async function checkParentDir(destStat, src, dest, opts) {
|
|
775720
|
-
const destParent =
|
|
776135
|
+
const destParent = dirname76(dest);
|
|
775721
776136
|
const dirExists = await pathExists2(destParent);
|
|
775722
776137
|
if (dirExists) {
|
|
775723
776138
|
return getStatsForCopy(destStat, src, dest, opts);
|
|
@@ -775729,8 +776144,8 @@ var require_polyfill = __commonJS((exports, module) => {
|
|
|
775729
776144
|
return stat50(dest).then(() => true, (err2) => err2.code === "ENOENT" ? false : Promise.reject(err2));
|
|
775730
776145
|
}
|
|
775731
776146
|
async function checkParentPaths(src, srcStat, dest) {
|
|
775732
|
-
const srcParent =
|
|
775733
|
-
const destParent =
|
|
776147
|
+
const srcParent = resolve59(dirname76(src));
|
|
776148
|
+
const destParent = resolve59(dirname76(dest));
|
|
775734
776149
|
if (destParent === srcParent || destParent === parse16(destParent).root) {
|
|
775735
776150
|
return;
|
|
775736
776151
|
}
|
|
@@ -775753,7 +776168,7 @@ var require_polyfill = __commonJS((exports, module) => {
|
|
|
775753
776168
|
}
|
|
775754
776169
|
return checkParentPaths(src, srcStat, destParent);
|
|
775755
776170
|
}
|
|
775756
|
-
var normalizePathToArray = (path42) =>
|
|
776171
|
+
var normalizePathToArray = (path42) => resolve59(path42).split(sep48).filter(Boolean);
|
|
775757
776172
|
function isSrcSubdir(src, dest) {
|
|
775758
776173
|
const srcArr = normalizePathToArray(src);
|
|
775759
776174
|
const destArr = normalizePathToArray(dest);
|
|
@@ -775883,7 +776298,7 @@ var require_polyfill = __commonJS((exports, module) => {
|
|
|
775883
776298
|
async function onLink(destStat, src, dest) {
|
|
775884
776299
|
let resolvedSrc = await readlink4(src);
|
|
775885
776300
|
if (!isAbsolute30(resolvedSrc)) {
|
|
775886
|
-
resolvedSrc =
|
|
776301
|
+
resolvedSrc = resolve59(dirname76(src), resolvedSrc);
|
|
775887
776302
|
}
|
|
775888
776303
|
if (!destStat) {
|
|
775889
776304
|
return symlink6(resolvedSrc, dest);
|
|
@@ -775898,7 +776313,7 @@ var require_polyfill = __commonJS((exports, module) => {
|
|
|
775898
776313
|
throw err2;
|
|
775899
776314
|
}
|
|
775900
776315
|
if (!isAbsolute30(resolvedDest)) {
|
|
775901
|
-
resolvedDest =
|
|
776316
|
+
resolvedDest = resolve59(dirname76(dest), resolvedDest);
|
|
775902
776317
|
}
|
|
775903
776318
|
if (isSrcSubdir(resolvedSrc, resolvedDest)) {
|
|
775904
776319
|
throw new ERR_FS_CP_EINVAL({
|
|
@@ -775944,7 +776359,7 @@ var require_cp = __commonJS((exports, module) => {
|
|
|
775944
776359
|
|
|
775945
776360
|
// node_modules/.bun/@npmcli+fs@5.0.0/node_modules/@npmcli/fs/lib/with-temp-dir.js
|
|
775946
776361
|
var require_with_temp_dir = __commonJS((exports, module) => {
|
|
775947
|
-
var { join: join175, sep:
|
|
776362
|
+
var { join: join175, sep: sep48 } = __require("path");
|
|
775948
776363
|
var getOptions2 = require_get_options();
|
|
775949
776364
|
var { mkdir: mkdir59, mkdtemp: mkdtemp6, rm: rm14 } = __require("fs/promises");
|
|
775950
776365
|
var withTempDir = async (root3, fn, opts) => {
|
|
@@ -775952,7 +776367,7 @@ var require_with_temp_dir = __commonJS((exports, module) => {
|
|
|
775952
776367
|
copy: ["tmpPrefix"]
|
|
775953
776368
|
});
|
|
775954
776369
|
await mkdir59(root3, { recursive: true });
|
|
775955
|
-
const target = await mkdtemp6(join175(`${root3}${
|
|
776370
|
+
const target = await mkdtemp6(join175(`${root3}${sep48}`, options.tmpPrefix || ""));
|
|
775956
776371
|
let err2;
|
|
775957
776372
|
let result;
|
|
775958
776373
|
try {
|
|
@@ -775993,7 +776408,7 @@ var require_readdir_scoped = __commonJS((exports, module) => {
|
|
|
775993
776408
|
|
|
775994
776409
|
// node_modules/.bun/@npmcli+fs@5.0.0/node_modules/@npmcli/fs/lib/move-file.js
|
|
775995
776410
|
var require_move_file = __commonJS((exports, module) => {
|
|
775996
|
-
var { dirname:
|
|
776411
|
+
var { dirname: dirname76, join: join175, resolve: resolve59, relative: relative39, isAbsolute: isAbsolute30 } = __require("path");
|
|
775997
776412
|
var fs25 = __require("fs/promises");
|
|
775998
776413
|
var pathExists2 = async (path42) => {
|
|
775999
776414
|
try {
|
|
@@ -776014,7 +776429,7 @@ var require_move_file = __commonJS((exports, module) => {
|
|
|
776014
776429
|
if (!options.overwrite && await pathExists2(destination)) {
|
|
776015
776430
|
throw new Error(`The destination file exists: ${destination}`);
|
|
776016
776431
|
}
|
|
776017
|
-
await fs25.mkdir(
|
|
776432
|
+
await fs25.mkdir(dirname76(destination), { recursive: true });
|
|
776018
776433
|
try {
|
|
776019
776434
|
await fs25.rename(source2, destination);
|
|
776020
776435
|
} catch (error52) {
|
|
@@ -776036,11 +776451,11 @@ var require_move_file = __commonJS((exports, module) => {
|
|
|
776036
776451
|
await Promise.all(symlinks.map(async ({ source: symSource, destination: symDestination }) => {
|
|
776037
776452
|
let target = await fs25.readlink(symSource);
|
|
776038
776453
|
if (isAbsolute30(target)) {
|
|
776039
|
-
target =
|
|
776454
|
+
target = resolve59(symDestination, relative39(symSource, target));
|
|
776040
776455
|
}
|
|
776041
776456
|
let targetStat = "file";
|
|
776042
776457
|
try {
|
|
776043
|
-
targetStat = await fs25.stat(
|
|
776458
|
+
targetStat = await fs25.stat(resolve59(dirname76(symSource), target));
|
|
776044
776459
|
if (targetStat.isDirectory()) {
|
|
776045
776460
|
targetStat = "junction";
|
|
776046
776461
|
}
|
|
@@ -781466,8 +781881,8 @@ var require_verify2 = __commonJS((exports, module) => {
|
|
|
781466
781881
|
liveContent.add(integrity[algo].toString());
|
|
781467
781882
|
}
|
|
781468
781883
|
});
|
|
781469
|
-
await new Promise((
|
|
781470
|
-
indexStream.on("end",
|
|
781884
|
+
await new Promise((resolve59, reject2) => {
|
|
781885
|
+
indexStream.on("end", resolve59).on("error", reject2);
|
|
781471
781886
|
});
|
|
781472
781887
|
const contentDir = contentPath.contentDir(cache9);
|
|
781473
781888
|
const files3 = await glob2(path42.join(contentDir, "**"), {
|
|
@@ -783490,7 +783905,7 @@ var init_coordinatorHandler = __esm(() => {
|
|
|
783490
783905
|
});
|
|
783491
783906
|
|
|
783492
783907
|
// src/hooks/toolPermission/PermissionContext.ts
|
|
783493
|
-
function createResolveOnce(
|
|
783908
|
+
function createResolveOnce(resolve59) {
|
|
783494
783909
|
let claimed = false;
|
|
783495
783910
|
let delivered = false;
|
|
783496
783911
|
return {
|
|
@@ -783499,7 +783914,7 @@ function createResolveOnce(resolve58) {
|
|
|
783499
783914
|
return;
|
|
783500
783915
|
delivered = true;
|
|
783501
783916
|
claimed = true;
|
|
783502
|
-
|
|
783917
|
+
resolve59(value);
|
|
783503
783918
|
},
|
|
783504
783919
|
isResolved() {
|
|
783505
783920
|
return claimed;
|
|
@@ -783544,11 +783959,11 @@ function createPermissionContext(tool, input2, toolUseContext, assistantMessage,
|
|
|
783544
783959
|
setToolPermissionContext(applyPermissionUpdates(appState.toolPermissionContext, updates));
|
|
783545
783960
|
return updates.some((update2) => supportsPersistence(update2.destination));
|
|
783546
783961
|
},
|
|
783547
|
-
resolveIfAborted(
|
|
783962
|
+
resolveIfAborted(resolve59) {
|
|
783548
783963
|
if (!toolUseContext.abortController.signal.aborted)
|
|
783549
783964
|
return false;
|
|
783550
783965
|
this.logCancelled();
|
|
783551
|
-
|
|
783966
|
+
resolve59(this.cancelAndAbort(undefined, true));
|
|
783552
783967
|
return true;
|
|
783553
783968
|
},
|
|
783554
783969
|
cancelAndAbort(feedback2, isAbort, contentBlocks) {
|
|
@@ -783688,7 +784103,7 @@ var init_PermissionContext = __esm(() => {
|
|
|
783688
784103
|
|
|
783689
784104
|
// src/hooks/toolPermission/handlers/interactiveHandler.ts
|
|
783690
784105
|
import { randomUUID as randomUUID56 } from "crypto";
|
|
783691
|
-
function handleInteractivePermission(params,
|
|
784106
|
+
function handleInteractivePermission(params, resolve59) {
|
|
783692
784107
|
const {
|
|
783693
784108
|
ctx,
|
|
783694
784109
|
description,
|
|
@@ -783697,7 +784112,7 @@ function handleInteractivePermission(params, resolve58) {
|
|
|
783697
784112
|
bridgeCallbacks,
|
|
783698
784113
|
channelCallbacks
|
|
783699
784114
|
} = params;
|
|
783700
|
-
const { resolve: resolveOnce, isResolved, claim } = createResolveOnce(
|
|
784115
|
+
const { resolve: resolveOnce, isResolved, claim } = createResolveOnce(resolve59);
|
|
783701
784116
|
let userInteracted = false;
|
|
783702
784117
|
let checkmarkTransitionTimer;
|
|
783703
784118
|
let checkmarkAbortHandler;
|
|
@@ -784002,8 +784417,8 @@ async function handleSwarmWorkerPermission(params) {
|
|
|
784002
784417
|
...prev,
|
|
784003
784418
|
pendingWorkerRequest: null
|
|
784004
784419
|
}));
|
|
784005
|
-
const decision = await new Promise((
|
|
784006
|
-
const { resolve: resolveOnce, claim } = createResolveOnce(
|
|
784420
|
+
const decision = await new Promise((resolve59) => {
|
|
784421
|
+
const { resolve: resolveOnce, claim } = createResolveOnce(resolve59);
|
|
784007
784422
|
const request5 = createPermissionRequest({
|
|
784008
784423
|
toolName: ctx.tool.name,
|
|
784009
784424
|
toolUseId: ctx.toolUseID,
|
|
@@ -784070,15 +784485,15 @@ function useCanUseTool(setToolUseConfirmQueue, setToolPermissionContext) {
|
|
|
784070
784485
|
const $4 = import_compiler_runtime318.c(3);
|
|
784071
784486
|
let t0;
|
|
784072
784487
|
if ($4[0] !== setToolPermissionContext || $4[1] !== setToolUseConfirmQueue) {
|
|
784073
|
-
t0 = async (tool, input2, toolUseContext, assistantMessage, toolUseID, forceDecision, hookAskFloor) => new Promise((
|
|
784488
|
+
t0 = async (tool, input2, toolUseContext, assistantMessage, toolUseID, forceDecision, hookAskFloor) => new Promise((resolve59) => {
|
|
784074
784489
|
const ctx = createPermissionContext(tool, input2, toolUseContext, assistantMessage, toolUseID, setToolPermissionContext, createPermissionQueueOps(setToolUseConfirmQueue));
|
|
784075
|
-
if (ctx.resolveIfAborted(
|
|
784490
|
+
if (ctx.resolveIfAborted(resolve59)) {
|
|
784076
784491
|
return;
|
|
784077
784492
|
}
|
|
784078
784493
|
const decisionPromise = forceDecision !== undefined ? Promise.resolve(forceDecision) : hasPermissionsToUseTool(tool, input2, toolUseContext, assistantMessage, toolUseID, hookAskFloor);
|
|
784079
784494
|
return decisionPromise.then(async (result) => {
|
|
784080
784495
|
if (result.behavior === "allow") {
|
|
784081
|
-
if (ctx.resolveIfAborted(
|
|
784496
|
+
if (ctx.resolveIfAborted(resolve59)) {
|
|
784082
784497
|
return;
|
|
784083
784498
|
}
|
|
784084
784499
|
if (feature("TRANSCRIPT_CLASSIFIER") && result.decisionReason?.type === "classifier" && result.decisionReason.classifier === "auto-mode") {
|
|
@@ -784088,7 +784503,7 @@ function useCanUseTool(setToolUseConfirmQueue, setToolPermissionContext) {
|
|
|
784088
784503
|
decision: "accept",
|
|
784089
784504
|
source: "config"
|
|
784090
784505
|
});
|
|
784091
|
-
|
|
784506
|
+
resolve59(ctx.buildAllow(result.updatedInput ?? input2, {
|
|
784092
784507
|
decisionReason: result.decisionReason
|
|
784093
784508
|
}));
|
|
784094
784509
|
return;
|
|
@@ -784099,7 +784514,7 @@ function useCanUseTool(setToolUseConfirmQueue, setToolPermissionContext) {
|
|
|
784099
784514
|
toolPermissionContext: appState.toolPermissionContext,
|
|
784100
784515
|
tools: toolUseContext.options.tools
|
|
784101
784516
|
});
|
|
784102
|
-
if (ctx.resolveIfAborted(
|
|
784517
|
+
if (ctx.resolveIfAborted(resolve59)) {
|
|
784103
784518
|
return;
|
|
784104
784519
|
}
|
|
784105
784520
|
switch (result.behavior) {
|
|
@@ -784141,7 +784556,7 @@ function useCanUseTool(setToolUseConfirmQueue, setToolPermissionContext) {
|
|
|
784141
784556
|
})
|
|
784142
784557
|
});
|
|
784143
784558
|
}
|
|
784144
|
-
|
|
784559
|
+
resolve59(result);
|
|
784145
784560
|
return;
|
|
784146
784561
|
}
|
|
784147
784562
|
case "ask": {
|
|
@@ -784156,11 +784571,11 @@ function useCanUseTool(setToolUseConfirmQueue, setToolPermissionContext) {
|
|
|
784156
784571
|
permissionMode: appState.toolPermissionContext.mode
|
|
784157
784572
|
});
|
|
784158
784573
|
if (coordinatorDecision) {
|
|
784159
|
-
|
|
784574
|
+
resolve59(coordinatorDecision);
|
|
784160
784575
|
return;
|
|
784161
784576
|
}
|
|
784162
784577
|
}
|
|
784163
|
-
if (ctx.resolveIfAborted(
|
|
784578
|
+
if (ctx.resolveIfAborted(resolve59)) {
|
|
784164
784579
|
return;
|
|
784165
784580
|
}
|
|
784166
784581
|
const swarmDecision = await handleSwarmWorkerPermission({
|
|
@@ -784173,14 +784588,14 @@ function useCanUseTool(setToolUseConfirmQueue, setToolPermissionContext) {
|
|
|
784173
784588
|
suggestions: result.suggestions
|
|
784174
784589
|
});
|
|
784175
784590
|
if (swarmDecision) {
|
|
784176
|
-
|
|
784591
|
+
resolve59(swarmDecision);
|
|
784177
784592
|
return;
|
|
784178
784593
|
}
|
|
784179
784594
|
if (feature("BASH_CLASSIFIER") && result.pendingClassifierCheck && tool.name === BASH_TOOL_NAME && !appState.toolPermissionContext.awaitAutomatedChecksBeforeDialog) {
|
|
784180
784595
|
const speculativePromise = peekSpeculativeClassifierCheck(input2.command);
|
|
784181
784596
|
if (speculativePromise) {
|
|
784182
784597
|
const raceResult = await Promise.race([speculativePromise.then(_temp201), new Promise(_temp282)]);
|
|
784183
|
-
if (ctx.resolveIfAborted(
|
|
784598
|
+
if (ctx.resolveIfAborted(resolve59)) {
|
|
784184
784599
|
return;
|
|
784185
784600
|
}
|
|
784186
784601
|
if (raceResult.type === "result" && raceResult.result.matches && raceResult.result.confidence === "high" && feature("BASH_CLASSIFIER")) {
|
|
@@ -784195,7 +784610,7 @@ function useCanUseTool(setToolUseConfirmQueue, setToolPermissionContext) {
|
|
|
784195
784610
|
type: "classifier"
|
|
784196
784611
|
}
|
|
784197
784612
|
});
|
|
784198
|
-
|
|
784613
|
+
resolve59(ctx.buildAllow(result.updatedInput ?? input2, {
|
|
784199
784614
|
decisionReason: {
|
|
784200
784615
|
type: "classifier",
|
|
784201
784616
|
classifier: "bash_allow",
|
|
@@ -784213,7 +784628,7 @@ function useCanUseTool(setToolUseConfirmQueue, setToolPermissionContext) {
|
|
|
784213
784628
|
awaitAutomatedChecksBeforeDialog: appState.toolPermissionContext.awaitAutomatedChecksBeforeDialog,
|
|
784214
784629
|
bridgeCallbacks: feature("BRIDGE_MODE") ? appState.replBridgePermissionCallbacks : undefined,
|
|
784215
784630
|
channelCallbacks: feature("KAIROS") || feature("KAIROS_CHANNELS") ? appState.channelPermissionCallbacks : undefined
|
|
784216
|
-
},
|
|
784631
|
+
}, resolve59);
|
|
784217
784632
|
return;
|
|
784218
784633
|
}
|
|
784219
784634
|
}
|
|
@@ -784221,10 +784636,10 @@ function useCanUseTool(setToolUseConfirmQueue, setToolPermissionContext) {
|
|
|
784221
784636
|
if (error52 instanceof AbortError || error52 instanceof APIUserAbortError) {
|
|
784222
784637
|
logForDebugging(`Permission check threw ${error52.constructor.name} for tool=${tool.name}: ${error52.message}`);
|
|
784223
784638
|
ctx.logCancelled();
|
|
784224
|
-
|
|
784639
|
+
resolve59(ctx.cancelAndAbort(undefined, true));
|
|
784225
784640
|
} else {
|
|
784226
784641
|
logError2(error52);
|
|
784227
|
-
|
|
784642
|
+
resolve59(ctx.cancelAndAbort(undefined, true));
|
|
784228
784643
|
}
|
|
784229
784644
|
}).finally(() => {
|
|
784230
784645
|
clearClassifierChecking(toolUseID);
|
|
@@ -786080,7 +786495,7 @@ __export(exports_asciicast, {
|
|
|
786080
786495
|
_resetRecordingStateForTesting: () => _resetRecordingStateForTesting
|
|
786081
786496
|
});
|
|
786082
786497
|
import { appendFile as appendFile9, rename as rename11 } from "fs/promises";
|
|
786083
|
-
import { basename as basename65, dirname as
|
|
786498
|
+
import { basename as basename65, dirname as dirname77, join as join178 } from "path";
|
|
786084
786499
|
function getRecordFilePath() {
|
|
786085
786500
|
if (recordingState.filePath !== null) {
|
|
786086
786501
|
return recordingState.filePath;
|
|
@@ -786162,7 +786577,7 @@ function installAsciicastRecorder() {
|
|
|
786162
786577
|
}
|
|
786163
786578
|
});
|
|
786164
786579
|
try {
|
|
786165
|
-
getFsImplementation().mkdirSync(
|
|
786580
|
+
getFsImplementation().mkdirSync(dirname77(filePath));
|
|
786166
786581
|
} catch {}
|
|
786167
786582
|
getFsImplementation().appendFileSync(filePath, header + `
|
|
786168
786583
|
`, { mode: 384 });
|
|
@@ -786239,7 +786654,7 @@ var restoreFromEntries = () => {};
|
|
|
786239
786654
|
var init_persist = () => {};
|
|
786240
786655
|
|
|
786241
786656
|
// src/utils/sessionRestore.ts
|
|
786242
|
-
import { dirname as
|
|
786657
|
+
import { dirname as dirname78 } from "path";
|
|
786243
786658
|
function extractTodosFromTranscript(messages) {
|
|
786244
786659
|
for (let i6 = messages.length - 1;i6 >= 0; i6--) {
|
|
786245
786660
|
const msg = messages[i6];
|
|
@@ -786377,7 +786792,7 @@ async function processResumedConversation(result, opts, context8) {
|
|
|
786377
786792
|
if (!opts.forkSession) {
|
|
786378
786793
|
const sid = opts.sessionIdOverride ?? result.sessionId;
|
|
786379
786794
|
if (sid) {
|
|
786380
|
-
switchSession(asSessionId(sid), opts.transcriptPath ?
|
|
786795
|
+
switchSession(asSessionId(sid), opts.transcriptPath ? dirname78(opts.transcriptPath) : null);
|
|
786381
786796
|
await renameRecordingForSession();
|
|
786382
786797
|
await resetSessionFilePointer();
|
|
786383
786798
|
restoreCostStateForSession(sid);
|
|
@@ -791014,7 +791429,7 @@ class StructuredIO {
|
|
|
791014
791429
|
});
|
|
791015
791430
|
}
|
|
791016
791431
|
try {
|
|
791017
|
-
return await new Promise((
|
|
791432
|
+
return await new Promise((resolve60, reject2) => {
|
|
791018
791433
|
this.pendingRequests.set(requestId, {
|
|
791019
791434
|
request: {
|
|
791020
791435
|
type: "control_request",
|
|
@@ -791022,7 +791437,7 @@ class StructuredIO {
|
|
|
791022
791437
|
request: request5
|
|
791023
791438
|
},
|
|
791024
791439
|
resolve: (result) => {
|
|
791025
|
-
|
|
791440
|
+
resolve60(result);
|
|
791026
791441
|
},
|
|
791027
791442
|
reject: reject2,
|
|
791028
791443
|
schema
|
|
@@ -792150,7 +792565,7 @@ function usePluginRecommendationBase() {
|
|
|
792150
792565
|
const isCheckingRef = React146.useRef(false);
|
|
792151
792566
|
let t0;
|
|
792152
792567
|
if ($4[0] !== recommendation) {
|
|
792153
|
-
t0 = (
|
|
792568
|
+
t0 = (resolve60) => {
|
|
792154
792569
|
if (getIsRemoteMode()) {
|
|
792155
792570
|
return;
|
|
792156
792571
|
}
|
|
@@ -792161,7 +792576,7 @@ function usePluginRecommendationBase() {
|
|
|
792161
792576
|
return;
|
|
792162
792577
|
}
|
|
792163
792578
|
isCheckingRef.current = true;
|
|
792164
|
-
|
|
792579
|
+
resolve60().then((rec) => {
|
|
792165
792580
|
if (rec) {
|
|
792166
792581
|
setRecommendation(rec);
|
|
792167
792582
|
}
|
|
@@ -793037,7 +793452,7 @@ var init_usePluginAutoupdateNotification = __esm(() => {
|
|
|
793037
793452
|
});
|
|
793038
793453
|
|
|
793039
793454
|
// src/utils/plugins/reconciler.ts
|
|
793040
|
-
import { isAbsolute as isAbsolute30, resolve as
|
|
793455
|
+
import { isAbsolute as isAbsolute30, resolve as resolve60 } from "path";
|
|
793041
793456
|
function diffMarketplaces(declared, materialized, opts) {
|
|
793042
793457
|
const missing = [];
|
|
793043
793458
|
const sourceChanged = [];
|
|
@@ -793150,7 +793565,7 @@ function normalizeSource(source2, projectRoot) {
|
|
|
793150
793565
|
const canonicalRoot = findCanonicalGitRoot(base2);
|
|
793151
793566
|
return {
|
|
793152
793567
|
...source2,
|
|
793153
|
-
path:
|
|
793568
|
+
path: resolve60(canonicalRoot ?? base2, source2.path)
|
|
793154
793569
|
};
|
|
793155
793570
|
}
|
|
793156
793571
|
return source2;
|
|
@@ -795876,10 +796291,10 @@ function FleetViewScreen(props) {
|
|
|
795876
796291
|
for (const task of Object.values(tasks2)) {
|
|
795877
796292
|
if (task.status === "running" && task.pid) {
|
|
795878
796293
|
try {
|
|
795879
|
-
const { writeFileSync:
|
|
796294
|
+
const { writeFileSync: writeFileSync19 } = __require("fs");
|
|
795880
796295
|
const { join: join181 } = __require("path");
|
|
795881
796296
|
const heartbeatPath = join181(__require("os").tmpdir(), `.fleetview-heartbeat-${task.pid}`);
|
|
795882
|
-
|
|
796297
|
+
writeFileSync19(heartbeatPath, String(Date.now()));
|
|
795883
796298
|
} catch {}
|
|
795884
796299
|
}
|
|
795885
796300
|
}
|
|
@@ -796472,7 +796887,7 @@ var init_cronJitterConfig = __esm(() => {
|
|
|
796472
796887
|
|
|
796473
796888
|
// src/utils/cronTasksLock.ts
|
|
796474
796889
|
import { mkdir as mkdir59, readFile as readFile67, unlink as unlink31, writeFile as writeFile61 } from "fs/promises";
|
|
796475
|
-
import { dirname as
|
|
796890
|
+
import { dirname as dirname79, join as join181 } from "path";
|
|
796476
796891
|
function getLockPath2(dir) {
|
|
796477
796892
|
return join181(dir ?? getProjectRoot(), LOCK_FILE_REL);
|
|
796478
796893
|
}
|
|
@@ -796497,7 +796912,7 @@ async function tryCreateExclusive2(lock2, dir) {
|
|
|
796497
796912
|
if (code === "EEXIST")
|
|
796498
796913
|
return false;
|
|
796499
796914
|
if (code === "ENOENT") {
|
|
796500
|
-
await mkdir59(
|
|
796915
|
+
await mkdir59(dirname79(path43), { recursive: true });
|
|
796501
796916
|
try {
|
|
796502
796917
|
await writeFile61(path43, body, { flag: "wx" });
|
|
796503
796918
|
return true;
|
|
@@ -796951,7 +797366,7 @@ __export(exports_REPL, {
|
|
|
796951
797366
|
REPL: () => REPL
|
|
796952
797367
|
});
|
|
796953
797368
|
import { spawnSync as spawnSync14 } from "child_process";
|
|
796954
|
-
import { dirname as
|
|
797369
|
+
import { dirname as dirname80, join as join182 } from "path";
|
|
796955
797370
|
import { tmpdir as tmpdir18 } from "os";
|
|
796956
797371
|
import { writeFile as writeFile62 } from "fs/promises";
|
|
796957
797372
|
import { randomUUID as randomUUID63 } from "crypto";
|
|
@@ -797982,7 +798397,7 @@ function REPL({
|
|
|
797982
798397
|
const targetSessionCosts = getStoredSessionCosts(sessionId);
|
|
797983
798398
|
saveCurrentSessionCosts();
|
|
797984
798399
|
resetCostState();
|
|
797985
|
-
switchSession(asSessionId(sessionId), log4.fullPath ?
|
|
798400
|
+
switchSession(asSessionId(sessionId), log4.fullPath ? dirname80(log4.fullPath) : null);
|
|
797986
798401
|
const {
|
|
797987
798402
|
renameRecordingForSession: renameRecordingForSession2
|
|
797988
798403
|
} = await Promise.resolve().then(() => (init_asciicast(), exports_asciicast));
|
|
@@ -798367,12 +798782,12 @@ Error: sandbox required but unavailable: ${reason}
|
|
|
798367
798782
|
return () => unregisterLeaderSetToolPermissionContext();
|
|
798368
798783
|
}, [setToolPermissionContext]);
|
|
798369
798784
|
const canUseTool = useCanUseTool_default(setToolUseConfirmQueue, setToolPermissionContext);
|
|
798370
|
-
const requestPrompt = import_react322.useCallback((title, toolInputSummary) => (request5) => new Promise((
|
|
798785
|
+
const requestPrompt = import_react322.useCallback((title, toolInputSummary) => (request5) => new Promise((resolve61, reject2) => {
|
|
798371
798786
|
setPromptQueue((prev) => [...prev, {
|
|
798372
798787
|
request: request5,
|
|
798373
798788
|
title,
|
|
798374
798789
|
toolInputSummary,
|
|
798375
|
-
resolve:
|
|
798790
|
+
resolve: resolve61,
|
|
798376
798791
|
reject: reject2
|
|
798377
798792
|
}]);
|
|
798378
798793
|
}), []);
|
|
@@ -801352,8 +801767,8 @@ async function handleMcpjsonServerApprovals(root3) {
|
|
|
801352
801767
|
if (pendingServers.length === 0) {
|
|
801353
801768
|
return;
|
|
801354
801769
|
}
|
|
801355
|
-
await new Promise((
|
|
801356
|
-
const done = () => void
|
|
801770
|
+
await new Promise((resolve61) => {
|
|
801771
|
+
const done = () => void resolve61();
|
|
801357
801772
|
if (pendingServers.length === 1 && pendingServers[0] !== undefined) {
|
|
801358
801773
|
const serverName = pendingServers[0];
|
|
801359
801774
|
root3.render(/* @__PURE__ */ jsx_runtime479.jsx(AppStateProvider, {
|
|
@@ -804294,8 +804709,8 @@ function completeOnboarding() {
|
|
|
804294
804709
|
}));
|
|
804295
804710
|
}
|
|
804296
804711
|
function showDialog(root3, renderer) {
|
|
804297
|
-
return new Promise((
|
|
804298
|
-
const done = (result) => void
|
|
804712
|
+
return new Promise((resolve61) => {
|
|
804713
|
+
const done = (result) => void resolve61(result);
|
|
804299
804714
|
root3.render(renderer(done));
|
|
804300
804715
|
});
|
|
804301
804716
|
}
|
|
@@ -805532,7 +805947,7 @@ var exports_ResumeConversation = {};
|
|
|
805532
805947
|
__export(exports_ResumeConversation, {
|
|
805533
805948
|
ResumeConversation: () => ResumeConversation
|
|
805534
805949
|
});
|
|
805535
|
-
import { dirname as
|
|
805950
|
+
import { dirname as dirname81 } from "path";
|
|
805536
805951
|
function parsePrIdentifier(value) {
|
|
805537
805952
|
const directNumber = parseInt(value, 10);
|
|
805538
805953
|
if (!isNaN(directNumber) && directNumber > 0) {
|
|
@@ -805684,7 +806099,7 @@ function ResumeConversation({
|
|
|
805684
806099
|
}
|
|
805685
806100
|
}
|
|
805686
806101
|
if (result_3.sessionId && !forkSession) {
|
|
805687
|
-
switchSession(asSessionId(result_3.sessionId), log_0.fullPath ?
|
|
806102
|
+
switchSession(asSessionId(result_3.sessionId), log_0.fullPath ? dirname81(log_0.fullPath) : null);
|
|
805688
806103
|
await renameRecordingForSession();
|
|
805689
806104
|
await resetSessionFilePointer();
|
|
805690
806105
|
restoreCostStateForSession(result_3.sessionId);
|
|
@@ -809134,7 +809549,7 @@ var init_bundled3 = __esm(() => {
|
|
|
809134
809549
|
// src/utils/deepLink/banner.ts
|
|
809135
809550
|
import { stat as stat53 } from "fs/promises";
|
|
809136
809551
|
import { homedir as homedir49 } from "os";
|
|
809137
|
-
import { join as join183, sep as
|
|
809552
|
+
import { join as join183, sep as sep49 } from "path";
|
|
809138
809553
|
function buildDeepLinkBanner(info) {
|
|
809139
809554
|
const lines2 = [
|
|
809140
809555
|
`This session was opened by an external deep link in ${tildify(info.cwd)}`
|
|
@@ -809175,7 +809590,7 @@ function tildify(p4) {
|
|
|
809175
809590
|
const home = homedir49();
|
|
809176
809591
|
if (p4 === home)
|
|
809177
809592
|
return "~";
|
|
809178
|
-
if (p4.startsWith(home +
|
|
809593
|
+
if (p4.startsWith(home + sep49))
|
|
809179
809594
|
return "~" + p4.slice(home.length);
|
|
809180
809595
|
return p4;
|
|
809181
809596
|
}
|
|
@@ -809188,8 +809603,8 @@ var init_banner = __esm(() => {
|
|
|
809188
809603
|
});
|
|
809189
809604
|
|
|
809190
809605
|
// src/utils/fable/fableConsent.ts
|
|
809191
|
-
import { existsSync as existsSync28, mkdirSync as mkdirSync15, readFileSync as
|
|
809192
|
-
import { dirname as
|
|
809606
|
+
import { existsSync as existsSync28, mkdirSync as mkdirSync15, readFileSync as readFileSync36 } from "fs";
|
|
809607
|
+
import { dirname as dirname82, join as join184 } from "path";
|
|
809193
809608
|
function getConsentFilePath() {
|
|
809194
809609
|
return join184(getClaudeConfigHomeDir(), CONSENT_FILENAME);
|
|
809195
809610
|
}
|
|
@@ -809201,7 +809616,7 @@ function getFableConsent() {
|
|
|
809201
809616
|
const path43 = getConsentFilePath();
|
|
809202
809617
|
if (!existsSync28(path43))
|
|
809203
809618
|
return getNoConsent();
|
|
809204
|
-
const parsed = JSON.parse(
|
|
809619
|
+
const parsed = JSON.parse(readFileSync36(path43, { encoding: "utf-8" }));
|
|
809205
809620
|
return {
|
|
809206
809621
|
consented: parsed.consented === true,
|
|
809207
809622
|
timestamp: typeof parsed.timestamp === "number" ? parsed.timestamp : 0
|
|
@@ -809220,7 +809635,7 @@ function saveFableConsent(consented) {
|
|
|
809220
809635
|
try {
|
|
809221
809636
|
const data = { consented, timestamp: Date.now() };
|
|
809222
809637
|
const path43 = getConsentFilePath();
|
|
809223
|
-
mkdirSync15(
|
|
809638
|
+
mkdirSync15(dirname82(path43), { recursive: true });
|
|
809224
809639
|
writeFileSyncAndFlush_DEPRECATED(path43, JSON.stringify(data, null, 2), {
|
|
809225
809640
|
encoding: "utf-8",
|
|
809226
809641
|
mode: 384
|
|
@@ -810389,7 +810804,7 @@ async function launchWindowsTerminal(terminal, claudePath, claudeArgs, cwd2) {
|
|
|
810389
810804
|
});
|
|
810390
810805
|
}
|
|
810391
810806
|
function spawnDetached(command11, args, opts = {}) {
|
|
810392
|
-
return new Promise((
|
|
810807
|
+
return new Promise((resolve61) => {
|
|
810393
810808
|
const child = spawn19(command11, args, {
|
|
810394
810809
|
detached: true,
|
|
810395
810810
|
stdio: "ignore",
|
|
@@ -810400,11 +810815,11 @@ function spawnDetached(command11, args, opts = {}) {
|
|
|
810400
810815
|
logForDebugging(`Failed to spawn ${command11}: ${err2.message}`, {
|
|
810401
810816
|
level: "error"
|
|
810402
810817
|
});
|
|
810403
|
-
|
|
810818
|
+
resolve61(false);
|
|
810404
810819
|
});
|
|
810405
810820
|
child.once("spawn", () => {
|
|
810406
810821
|
child.unref();
|
|
810407
|
-
|
|
810822
|
+
resolve61(true);
|
|
810408
810823
|
});
|
|
810409
810824
|
});
|
|
810410
810825
|
}
|
|
@@ -812321,7 +812736,7 @@ var init_QueryEngine = __esm(() => {
|
|
|
812321
812736
|
var FILE_COUNT_LIMIT = 1e4, OUTPUTS_SUBDIR = ".claude-code/outputs", DEFAULT_UPLOAD_CONCURRENCY = 5;
|
|
812322
812737
|
|
|
812323
812738
|
// src/utils/filePersistence/filePersistence.ts
|
|
812324
|
-
import { join as join187, relative as
|
|
812739
|
+
import { join as join187, relative as relative39 } from "path";
|
|
812325
812740
|
async function runFilePersistence(turnStartTime, signal) {
|
|
812326
812741
|
const environmentKind = getEnvironmentKind();
|
|
812327
812742
|
if (environmentKind !== "byoc") {
|
|
@@ -812417,7 +812832,7 @@ async function executeBYOCPersistence(turnStartTime, config8, outputsDir, signal
|
|
|
812417
812832
|
}
|
|
812418
812833
|
const filesToProcess = modifiedFiles.map((filePath) => ({
|
|
812419
812834
|
path: filePath,
|
|
812420
|
-
relativePath:
|
|
812835
|
+
relativePath: relative39(outputsDir, filePath)
|
|
812421
812836
|
})).filter(({ relativePath: relativePath2 }) => {
|
|
812422
812837
|
if (relativePath2.startsWith("..")) {
|
|
812423
812838
|
logDebug(`Skipping file outside outputs directory: ${relativePath2}`);
|
|
@@ -812718,7 +813133,7 @@ __export(exports_print, {
|
|
|
812718
813133
|
PERMISSION_PROMPT_TOOL_CONNECT_WAIT_MS: () => PERMISSION_PROMPT_TOOL_CONNECT_WAIT_MS
|
|
812719
813134
|
});
|
|
812720
813135
|
import { readFile as readFile69, stat as stat55 } from "fs/promises";
|
|
812721
|
-
import { dirname as
|
|
813136
|
+
import { dirname as dirname83 } from "path";
|
|
812722
813137
|
import { cwd as cwd2 } from "process";
|
|
812723
813138
|
import { randomUUID as randomUUID66 } from "crypto";
|
|
812724
813139
|
function trackReceivedMessageUuid(uuid5) {
|
|
@@ -814364,8 +814779,8 @@ ${m5.text}
|
|
|
814364
814779
|
const controller = new AbortController;
|
|
814365
814780
|
activeOAuthFlows.set(serverName, controller);
|
|
814366
814781
|
let resolveAuthUrl;
|
|
814367
|
-
const authUrlPromise = new Promise((
|
|
814368
|
-
resolveAuthUrl =
|
|
814782
|
+
const authUrlPromise = new Promise((resolve61) => {
|
|
814783
|
+
resolveAuthUrl = resolve61;
|
|
814369
814784
|
});
|
|
814370
814785
|
const oauthPromise = performMCPOAuthFlow(serverName, config8, (url3) => resolveAuthUrl(url3), controller.signal, {
|
|
814371
814786
|
skipBrowserOpen: true,
|
|
@@ -814478,8 +814893,8 @@ ${m5.text}
|
|
|
814478
814893
|
});
|
|
814479
814894
|
const service = new OAuthService;
|
|
814480
814895
|
let urlResolver;
|
|
814481
|
-
const urlPromise = new Promise((
|
|
814482
|
-
urlResolver =
|
|
814896
|
+
const urlPromise = new Promise((resolve61) => {
|
|
814897
|
+
urlResolver = resolve61;
|
|
814483
814898
|
});
|
|
814484
814899
|
const flow = service.startOAuthFlow(async (manualUrl, automaticUrl) => {
|
|
814485
814900
|
urlResolver({ manualUrl, automaticUrl });
|
|
@@ -814887,8 +815302,8 @@ function createCanUseToolWithPermissionPrompt(permissionPromptTool) {
|
|
|
814887
815302
|
}
|
|
814888
815303
|
};
|
|
814889
815304
|
}
|
|
814890
|
-
const abortPromise = new Promise((
|
|
814891
|
-
combinedSignal.addEventListener("abort", () =>
|
|
815305
|
+
const abortPromise = new Promise((resolve61) => {
|
|
815306
|
+
combinedSignal.addEventListener("abort", () => resolve61("aborted"), {
|
|
814892
815307
|
once: true
|
|
814893
815308
|
});
|
|
814894
815309
|
});
|
|
@@ -815324,7 +815739,7 @@ async function loadInitialMessages(setAppState, options) {
|
|
|
815324
815739
|
}
|
|
815325
815740
|
if (!options.forkSession) {
|
|
815326
815741
|
if (result.sessionId) {
|
|
815327
|
-
switchSession(asSessionId(result.sessionId), result.fullPath ?
|
|
815742
|
+
switchSession(asSessionId(result.sessionId), result.fullPath ? dirname83(result.fullPath) : null);
|
|
815328
815743
|
if (persistSession) {
|
|
815329
815744
|
await resetSessionFilePointer();
|
|
815330
815745
|
}
|
|
@@ -815441,7 +815856,7 @@ async function loadInitialMessages(setAppState, options) {
|
|
|
815441
815856
|
}
|
|
815442
815857
|
}
|
|
815443
815858
|
if (!options.forkSession && result.sessionId) {
|
|
815444
|
-
switchSession(asSessionId(result.sessionId), result.fullPath ?
|
|
815859
|
+
switchSession(asSessionId(result.sessionId), result.fullPath ? dirname83(result.fullPath) : null);
|
|
815445
815860
|
if (persistSession) {
|
|
815446
815861
|
await resetSessionFilePointer();
|
|
815447
815862
|
}
|
|
@@ -817394,7 +817809,7 @@ __export(exports_plugins, {
|
|
|
817394
817809
|
VALID_UPDATE_SCOPES: () => VALID_UPDATE_SCOPES,
|
|
817395
817810
|
VALID_INSTALLABLE_SCOPES: () => VALID_INSTALLABLE_SCOPES
|
|
817396
817811
|
});
|
|
817397
|
-
import { basename as basename67, dirname as
|
|
817812
|
+
import { basename as basename67, dirname as dirname84 } from "path";
|
|
817398
817813
|
function handleMarketplaceError(error52, action2) {
|
|
817399
817814
|
logError2(error52);
|
|
817400
817815
|
cliError(`${figures_default.cross} Failed to ${action2}: ${errorMessage(error52)}`);
|
|
@@ -817427,9 +817842,9 @@ async function pluginValidateHandler(manifestPath, options) {
|
|
|
817427
817842
|
printValidationResult(result);
|
|
817428
817843
|
let contentResults = [];
|
|
817429
817844
|
if (result.fileType === "plugin") {
|
|
817430
|
-
const manifestDir =
|
|
817845
|
+
const manifestDir = dirname84(result.filePath);
|
|
817431
817846
|
if (basename67(manifestDir) === ".claude-plugin") {
|
|
817432
|
-
contentResults = await validatePluginContents(
|
|
817847
|
+
contentResults = await validatePluginContents(dirname84(manifestDir));
|
|
817433
817848
|
for (const r4 of contentResults) {
|
|
817434
817849
|
console.log(`Validating ${r4.fileType}: ${r4.filePath}
|
|
817435
817850
|
`);
|
|
@@ -818273,7 +818688,7 @@ async function setupTokenHandler(root3) {
|
|
|
818273
818688
|
const {
|
|
818274
818689
|
ConsoleOAuthFlow: ConsoleOAuthFlow2
|
|
818275
818690
|
} = await Promise.resolve().then(() => (init_ConsoleOAuthFlow(), exports_ConsoleOAuthFlow));
|
|
818276
|
-
await new Promise((
|
|
818691
|
+
await new Promise((resolve61) => {
|
|
818277
818692
|
root3.render(/* @__PURE__ */ jsx_runtime502.jsx(AppStateProvider, {
|
|
818278
818693
|
onChangeAppState,
|
|
818279
818694
|
children: /* @__PURE__ */ jsx_runtime502.jsx(KeybindingSetup, {
|
|
@@ -818297,7 +818712,7 @@ async function setupTokenHandler(root3) {
|
|
|
818297
818712
|
}),
|
|
818298
818713
|
/* @__PURE__ */ jsx_runtime502.jsx(ConsoleOAuthFlow2, {
|
|
818299
818714
|
onDone: () => {
|
|
818300
|
-
|
|
818715
|
+
resolve61();
|
|
818301
818716
|
},
|
|
818302
818717
|
mode: "setup-token",
|
|
818303
818718
|
startingMessage: "This will guide you through long-lived (1-year) auth token setup for your Claude account. Claude subscription required."
|
|
@@ -818333,7 +818748,7 @@ function DoctorWithPlugins(t0) {
|
|
|
818333
818748
|
}
|
|
818334
818749
|
async function doctorHandler(root3) {
|
|
818335
818750
|
logEvent2("tengu_doctor_command", {});
|
|
818336
|
-
await new Promise((
|
|
818751
|
+
await new Promise((resolve61) => {
|
|
818337
818752
|
root3.render(/* @__PURE__ */ jsx_runtime502.jsx(AppStateProvider, {
|
|
818338
818753
|
children: /* @__PURE__ */ jsx_runtime502.jsx(KeybindingSetup, {
|
|
818339
818754
|
children: /* @__PURE__ */ jsx_runtime502.jsx(MCPConnectionManager, {
|
|
@@ -818341,7 +818756,7 @@ async function doctorHandler(root3) {
|
|
|
818341
818756
|
isStrictMcpConfig: false,
|
|
818342
818757
|
children: /* @__PURE__ */ jsx_runtime502.jsx(DoctorWithPlugins, {
|
|
818343
818758
|
onDone: () => {
|
|
818344
|
-
|
|
818759
|
+
resolve61();
|
|
818345
818760
|
}
|
|
818346
818761
|
})
|
|
818347
818762
|
})
|
|
@@ -818359,14 +818774,14 @@ async function installHandler(target, options) {
|
|
|
818359
818774
|
const {
|
|
818360
818775
|
install: install3
|
|
818361
818776
|
} = await Promise.resolve().then(() => (init_install3(), exports_install));
|
|
818362
|
-
await new Promise((
|
|
818777
|
+
await new Promise((resolve61) => {
|
|
818363
818778
|
const args = [];
|
|
818364
818779
|
if (target)
|
|
818365
818780
|
args.push(target);
|
|
818366
818781
|
if (options.force)
|
|
818367
818782
|
args.push("--force");
|
|
818368
818783
|
install3.call((result) => {
|
|
818369
|
-
|
|
818784
|
+
resolve61();
|
|
818370
818785
|
process.exit(result.includes("failed") ? 1 : 0);
|
|
818371
818786
|
}, {}, args);
|
|
818372
818787
|
});
|
|
@@ -818645,8 +819060,8 @@ function resolveAbsolutePath(input2) {
|
|
|
818645
819060
|
if (!input2) {
|
|
818646
819061
|
return getCwd();
|
|
818647
819062
|
}
|
|
818648
|
-
const { resolve:
|
|
818649
|
-
return
|
|
819063
|
+
const { resolve: resolve61 } = __require("path");
|
|
819064
|
+
return resolve61(input2);
|
|
818650
819065
|
}
|
|
818651
819066
|
async function discoverAllProjectPaths() {
|
|
818652
819067
|
const paths2 = new Set;
|
|
@@ -818862,7 +819277,7 @@ __export(exports_autoMode, {
|
|
|
818862
819277
|
autoModeCritiqueHandler: () => autoModeCritiqueHandler,
|
|
818863
819278
|
autoModeConfigHandler: () => autoModeConfigHandler
|
|
818864
819279
|
});
|
|
818865
|
-
import { readFileSync as
|
|
819280
|
+
import { readFileSync as readFileSync37 } from "fs";
|
|
818866
819281
|
import * as readline5 from "readline/promises";
|
|
818867
819282
|
function writeRules(rules2) {
|
|
818868
819283
|
process.stdout.write(jsonStringify(rules2, null, 2) + `
|
|
@@ -818992,7 +819407,7 @@ function detectUnrecognizedEntries(content) {
|
|
|
818992
819407
|
}
|
|
818993
819408
|
function readUserSettingsRaw(path43) {
|
|
818994
819409
|
try {
|
|
818995
|
-
return
|
|
819410
|
+
return readFileSync37(path43, "utf8");
|
|
818996
819411
|
} catch (error52) {
|
|
818997
819412
|
if (isENOENT(error52))
|
|
818998
819413
|
return null;
|
|
@@ -819486,8 +819901,8 @@ __export(exports_main5, {
|
|
|
819486
819901
|
startDeferredPrefetches: () => startDeferredPrefetches,
|
|
819487
819902
|
main: () => main
|
|
819488
819903
|
});
|
|
819489
|
-
import { readFileSync as
|
|
819490
|
-
import { resolve as
|
|
819904
|
+
import { readFileSync as readFileSync38 } from "fs";
|
|
819905
|
+
import { resolve as resolve61 } from "path";
|
|
819491
819906
|
function logManagedSettings() {
|
|
819492
819907
|
try {
|
|
819493
819908
|
const policySettings = getSettingsForSource("policySettings");
|
|
@@ -819644,7 +820059,18 @@ function loadSettingsFromFlag(settingsFile) {
|
|
|
819644
820059
|
resolvedPath: resolvedSettingsPath
|
|
819645
820060
|
} = safeResolvePath(getFsImplementation(), settingsFile);
|
|
819646
820061
|
try {
|
|
819647
|
-
|
|
820062
|
+
const stats = getFsImplementation().statSync(resolvedSettingsPath);
|
|
820063
|
+
if (!stats.isFile()) {
|
|
820064
|
+
process.stderr.write(source_default.red(`Cannot use settings file (Not a regular file (device, FIFO, or socket)): ${resolvedSettingsPath}
|
|
820065
|
+
`));
|
|
820066
|
+
process.exit(1);
|
|
820067
|
+
}
|
|
820068
|
+
if (stats.size > 2097152) {
|
|
820069
|
+
process.stderr.write(source_default.red(`Error: Settings file exceeds the 2MiB limit: ${resolvedSettingsPath}
|
|
820070
|
+
`));
|
|
820071
|
+
process.exit(1);
|
|
820072
|
+
}
|
|
820073
|
+
readFileSync38(resolvedSettingsPath, "utf8");
|
|
819648
820074
|
} catch (e4) {
|
|
819649
820075
|
if (isENOENT(e4)) {
|
|
819650
820076
|
process.stderr.write(source_default.red(`Error: Settings file not found: ${resolvedSettingsPath}
|
|
@@ -820240,12 +820666,12 @@ ${getTmuxInstallInstructions2()}
|
|
|
820240
820666
|
process.exit(1);
|
|
820241
820667
|
}
|
|
820242
820668
|
try {
|
|
820243
|
-
const filePath =
|
|
820244
|
-
systemPrompt =
|
|
820669
|
+
const filePath = resolve61(options.systemPromptFile);
|
|
820670
|
+
systemPrompt = readFileSync38(filePath, "utf8");
|
|
820245
820671
|
} catch (error52) {
|
|
820246
820672
|
const code = getErrnoCode(error52);
|
|
820247
820673
|
if (code === "ENOENT") {
|
|
820248
|
-
process.stderr.write(source_default.red(`Error: System prompt file not found: ${
|
|
820674
|
+
process.stderr.write(source_default.red(`Error: System prompt file not found: ${resolve61(options.systemPromptFile)}
|
|
820249
820675
|
`));
|
|
820250
820676
|
process.exit(1);
|
|
820251
820677
|
}
|
|
@@ -820262,12 +820688,12 @@ ${getTmuxInstallInstructions2()}
|
|
|
820262
820688
|
process.exit(1);
|
|
820263
820689
|
}
|
|
820264
820690
|
try {
|
|
820265
|
-
const filePath =
|
|
820266
|
-
appendSystemPrompt =
|
|
820691
|
+
const filePath = resolve61(options.appendSystemPromptFile);
|
|
820692
|
+
appendSystemPrompt = readFileSync38(filePath, "utf8");
|
|
820267
820693
|
} catch (error52) {
|
|
820268
820694
|
const code = getErrnoCode(error52);
|
|
820269
820695
|
if (code === "ENOENT") {
|
|
820270
|
-
process.stderr.write(source_default.red(`Error: Append system prompt file not found: ${
|
|
820696
|
+
process.stderr.write(source_default.red(`Error: Append system prompt file not found: ${resolve61(options.appendSystemPromptFile)}
|
|
820271
820697
|
`));
|
|
820272
820698
|
process.exit(1);
|
|
820273
820699
|
}
|
|
@@ -820320,7 +820746,7 @@ ${addendum}` : addendum;
|
|
|
820320
820746
|
errors8 = result.errors;
|
|
820321
820747
|
}
|
|
820322
820748
|
} else {
|
|
820323
|
-
const configPath =
|
|
820749
|
+
const configPath = resolve61(configItem);
|
|
820324
820750
|
const result = parseMcpConfigFromFilePath({
|
|
820325
820751
|
filePath: configPath,
|
|
820326
820752
|
expandVars: true,
|
|
@@ -821267,8 +821693,8 @@ ${inputPrompt}` : mergePrompt;
|
|
|
821267
821693
|
return connectMcpBatch(dedupedClaudeAi, "claudeai");
|
|
821268
821694
|
});
|
|
821269
821695
|
let claudeaiTimer;
|
|
821270
|
-
const claudeaiTimedOut = await Promise.race([claudeaiConnect.then(() => false), new Promise((
|
|
821271
|
-
claudeaiTimer = setTimeout((r4) => r4(true), CLAUDE_AI_MCP_TIMEOUT_MS,
|
|
821696
|
+
const claudeaiTimedOut = await Promise.race([claudeaiConnect.then(() => false), new Promise((resolve62) => {
|
|
821697
|
+
claudeaiTimer = setTimeout((r4) => r4(true), CLAUDE_AI_MCP_TIMEOUT_MS, resolve62);
|
|
821272
821698
|
})]);
|
|
821273
821699
|
if (claudeaiTimer)
|
|
821274
821700
|
clearTimeout(claudeaiTimer);
|