context-mode 2.1.8 → 2.1.10
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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/.zcode-plugin/plugin.json +1 -1
- package/README.md +72 -72
- package/SHA256SUMS +16 -16
- package/cli.mjs +198 -178
- package/copilot/plugin.json +1 -1
- package/gemini-extension.json +1 -1
- package/hook.mjs +98 -98
- package/opencode/plugin.js +168 -62
- package/package.json +1 -1
- package/pi/index.js +168 -64
- package/qwen-extension.json +1 -1
- package/run.mjs +43 -8
- package/search.mjs +43 -8
- package/server.mjs +62 -27
package/pi/index.js
CHANGED
|
@@ -11179,6 +11179,15 @@ function REPLACE_HANDLE_LINE(intent, handle, bytes5, prefix = "", asked = "") {
|
|
|
11179
11179
|
const queries = asked === "" ? [intent] : [intent, asked];
|
|
11180
11180
|
return prefix + "ctx_search({queries:[" + queries.map((q) => JSON.stringify(q)).join(",") + "], source:" + JSON.stringify(handle) + "}) searches the whole output (" + bytes5 + " B).";
|
|
11181
11181
|
}
|
|
11182
|
+
function SUBAGENT_HANDLE_LINE(handle, bytes5, read3) {
|
|
11183
|
+
return "The full output (" + bytes5 + " B) is stored as " + handle + "; above is the best-matching part." + (read3 ? " Read the file with offset and limit for other lines." : "");
|
|
11184
|
+
}
|
|
11185
|
+
function SEARCH_TWIN_LINE(searchPath, handle, terms, projectDir) {
|
|
11186
|
+
return " Or run: node " + shellWord(searchPath) + " " + handle + " " + shellWord(terms) + " " + shellWord(projectDir);
|
|
11187
|
+
}
|
|
11188
|
+
function shellWord(s) {
|
|
11189
|
+
return "'" + s.split("'").join("'\\''") + "'";
|
|
11190
|
+
}
|
|
11182
11191
|
var HANDLE_PROMPT_WORDS = 3;
|
|
11183
11192
|
var MAX_CHUNK_BYTES = 4096;
|
|
11184
11193
|
var SEARCH_PAGE_SIZE = 20;
|
|
@@ -11368,6 +11377,8 @@ var CANCELLED_LINE = "Cancelled.";
|
|
|
11368
11377
|
var BACKGROUND_REPLY_PREFIX = "started in background, pid ";
|
|
11369
11378
|
var PLAIN_OUTPUT_ENV = Object.freeze({ NO_COLOR: "1", FORCE_COLOR: "0" });
|
|
11370
11379
|
var RUN_LABEL_PREFIX = "run.mjs:";
|
|
11380
|
+
var SEARCH_WRAPPER_FILE = "search.mjs";
|
|
11381
|
+
var RUN_WRAPPER_AGENT = "claude-code";
|
|
11371
11382
|
var RUN_SESSION_PREFIX = "mcp:";
|
|
11372
11383
|
var HOST_SESSION_ENV = Object.freeze({ "claude-code": "CLAUDE_CODE_SESSION_ID" });
|
|
11373
11384
|
var NODE_MIN = "24.15.0";
|
|
@@ -11378,6 +11389,7 @@ var REQUIRE_SECURITY_ENV = "CONTEXT_MODE_REQUIRE_SECURITY";
|
|
|
11378
11389
|
var HOST_CONFIG_DIR_NAME = ".claude";
|
|
11379
11390
|
var AGENTS_DIR_NAME = "agents";
|
|
11380
11391
|
var AGENT_FILE_EXT = ".md";
|
|
11392
|
+
var SYNCED_PLUGINS_DIR_NAME = "synced";
|
|
11381
11393
|
var HOST_PLUGINS_DIR_NAME = "plugins";
|
|
11382
11394
|
var INSTALLED_PLUGINS_FILE = "installed_plugins.json";
|
|
11383
11395
|
var PLUGIN_AGENT_SEPARATOR = ":";
|
|
@@ -11613,7 +11625,7 @@ var DECISION_ANSWERS_KEY = "answers";
|
|
|
11613
11625
|
var DECISION_OPTION_KEY = "option";
|
|
11614
11626
|
var DECISION_LABEL_JOIN = " | ";
|
|
11615
11627
|
var RELEASE_REPO_URL = "https://github.com/mksglu/context-mode.git";
|
|
11616
|
-
var BUNDLE_SHA = true ? "
|
|
11628
|
+
var BUNDLE_SHA = true ? "877eebcc432f90882c2b5ea04ad22fc95e9dc6c2" : void 0;
|
|
11617
11629
|
var DOCTOR_CHECK_ORDER = Object.freeze(["D1", "D2", "D3", "D4", "D5", "D5b", "D6", "D7", "D8", "D9", "D10", "D11"]);
|
|
11618
11630
|
var DOCTOR_LABEL = Object.freeze({
|
|
11619
11631
|
D1: "version",
|
|
@@ -11959,9 +11971,14 @@ var D5_READ_RANGE_DETAIL = "PostToolUse Read with offset/limit over the replace
|
|
|
11959
11971
|
var D5_READ_OWN_DETAIL = "PreToolUse Read of a skill file over the one-read limit under the agent's own config dir came back denied: skill and rule files must reach the model whole (#1326)";
|
|
11960
11972
|
var D5_READ_MEDIA_DETAIL = "PreToolUse Read of a PNG over the one-read limit came back denied: an image Read must reach the model as an image block (#1321)";
|
|
11961
11973
|
var D5_READ_SHAPE_DETAIL = `PostToolUse Read replace is not Read's output shape {type:"text", file:{filePath, content, numLines, startLine, totalLines}}: Claude Code drops it and shows a hook warning`;
|
|
11962
|
-
|
|
11963
|
-
|
|
11974
|
+
var D5_BARE_SHARE = 0.5;
|
|
11975
|
+
function D5_SLOW_DETAIL(ms, bound = HOOK_P95_MS) {
|
|
11976
|
+
return `hook round trip took ${ms} ms over bare node, over ${bound} ms`;
|
|
11977
|
+
}
|
|
11978
|
+
function D5_SLOW_START_DETAIL(ms, bare2, bound) {
|
|
11979
|
+
return `hook adds ${ms} ms to a ${bare2} ms node start, inside ${bound} ms (half a start): node starts slowly on this machine`;
|
|
11964
11980
|
}
|
|
11981
|
+
var D5_IN_PROCESS_DETAIL = "native shape ok; hooks run inside the host process, so a tool call pays no node start";
|
|
11965
11982
|
var D5_STOP_DETAIL = "Codex Stop event: the hook did not give an empty or Codex Stop reply, or it logged a hook error";
|
|
11966
11983
|
var D5_FIX = "run ctx_upgrade";
|
|
11967
11984
|
var PRAGMA_INTEGRITY_CHECK = "PRAGMA integrity_check";
|
|
@@ -14826,7 +14843,15 @@ function resolveConfigDir(env) {
|
|
|
14826
14843
|
}
|
|
14827
14844
|
|
|
14828
14845
|
// src/core/policy/subagent.ts
|
|
14829
|
-
var { readFileSync: readFileSync2 } = process.getBuiltinModule("node:fs");
|
|
14846
|
+
var { readFileSync: readFileSync2, readdirSync: readdirSync2 } = process.getBuiltinModule("node:fs");
|
|
14847
|
+
var CC_READ_ONLY_DENY = Object.freeze(["Agent", "Artifact", "ArtifactComments", "ArtifactData", "ArtifactCheck", "ExitPlanMode", "Edit", "Write", "NotebookEdit"]);
|
|
14848
|
+
var CLAUDE_CODE_BUILT_INS = Object.freeze({
|
|
14849
|
+
"general-purpose": { tools: null, disallowed: [] },
|
|
14850
|
+
fork: { tools: null, disallowed: [] },
|
|
14851
|
+
Explore: { tools: null, disallowed: [...CC_READ_ONLY_DENY] },
|
|
14852
|
+
Plan: { tools: null, disallowed: [...CC_READ_ONLY_DENY] }
|
|
14853
|
+
});
|
|
14854
|
+
var BUILT_IN_AGENT = "claude-code";
|
|
14830
14855
|
function isSubagentCall(ev) {
|
|
14831
14856
|
return ev.agentId !== void 0 && ev.agentId !== "";
|
|
14832
14857
|
}
|
|
@@ -14843,7 +14868,7 @@ function toolSetForAgentType(ev, src) {
|
|
|
14843
14868
|
const row5 = getAdapter(ev.agent);
|
|
14844
14869
|
if (src.manifestTools !== void 0) return unique(src.manifestTools.map((n) => norm(row5, n)));
|
|
14845
14870
|
const type = ev.agentType ?? "";
|
|
14846
|
-
const def = findDef(type, src);
|
|
14871
|
+
const def = findDef(type, src) ?? builtIn(ev.agent, type);
|
|
14847
14872
|
if (def === null) return null;
|
|
14848
14873
|
const tools = (def.tools ?? allKnownToolNames(row5)).map((n) => norm(row5, n));
|
|
14849
14874
|
const deny2 = def.disallowed.map((n) => norm(row5, n));
|
|
@@ -14871,6 +14896,11 @@ function findDef(type, src) {
|
|
|
14871
14896
|
}
|
|
14872
14897
|
return null;
|
|
14873
14898
|
}
|
|
14899
|
+
function builtIn(agent, type) {
|
|
14900
|
+
if (agent !== BUILT_IN_AGENT || !Object.prototype.hasOwnProperty.call(CLAUDE_CODE_BUILT_INS, type)) return null;
|
|
14901
|
+
const d = CLAUDE_CODE_BUILT_INS[type];
|
|
14902
|
+
return { tools: d.tools, disallowed: [...d.disallowed] };
|
|
14903
|
+
}
|
|
14874
14904
|
function safeType(type) {
|
|
14875
14905
|
if (type === "" || type === "." || type === "..") return false;
|
|
14876
14906
|
if (type.indexOf("/") >= 0 || type.indexOf("\\") >= 0) return false;
|
|
@@ -14885,6 +14915,9 @@ function readPluginAgent(claudeDir, type) {
|
|
|
14885
14915
|
const plugin = type.slice(0, cut);
|
|
14886
14916
|
const agent = type.slice(cut + PLUGIN_AGENT_SEPARATOR.length);
|
|
14887
14917
|
if (agent.indexOf(PLUGIN_AGENT_SEPARATOR) >= 0) return null;
|
|
14918
|
+
return installedPluginAgent(claudeDir, plugin, agent) ?? syncedPluginAgent(claudeDir, plugin, agent);
|
|
14919
|
+
}
|
|
14920
|
+
function installedPluginAgent(claudeDir, plugin, agent) {
|
|
14888
14921
|
let parsed;
|
|
14889
14922
|
try {
|
|
14890
14923
|
parsed = JSON.parse(hostText(readFileSync2(join2(claudeDir, HOST_PLUGINS_DIR_NAME, INSTALLED_PLUGINS_FILE), "utf8")));
|
|
@@ -14907,6 +14940,21 @@ function readPluginAgent(claudeDir, type) {
|
|
|
14907
14940
|
}
|
|
14908
14941
|
return null;
|
|
14909
14942
|
}
|
|
14943
|
+
function syncedPluginAgent(claudeDir, plugin, agent) {
|
|
14944
|
+
const root = join2(claudeDir, HOST_PLUGINS_DIR_NAME, SYNCED_PLUGINS_DIR_NAME);
|
|
14945
|
+
let ids;
|
|
14946
|
+
try {
|
|
14947
|
+
ids = readdirSync2(root).sort();
|
|
14948
|
+
} catch {
|
|
14949
|
+
return null;
|
|
14950
|
+
}
|
|
14951
|
+
for (const id of ids) {
|
|
14952
|
+
if (id.startsWith(".")) continue;
|
|
14953
|
+
const d = readAgentFile(join2(root, id, plugin, AGENTS_DIR_NAME, agent + AGENT_FILE_EXT));
|
|
14954
|
+
if (d !== null) return d;
|
|
14955
|
+
}
|
|
14956
|
+
return null;
|
|
14957
|
+
}
|
|
14910
14958
|
function readAgentFile(path8) {
|
|
14911
14959
|
let text;
|
|
14912
14960
|
try {
|
|
@@ -20144,18 +20192,24 @@ function bigRead(agent, input, cwd) {
|
|
|
20144
20192
|
const many = Array.isArray(input[READ_PATH_LIST_KEY]) ? input[READ_PATH_LIST_KEY].filter((x) => typeof x === "string") : [];
|
|
20145
20193
|
return [firstString(input, READ_PATH_KEYS), ...many].some((p) => p !== "" && bigFile(resolve7(cwd, p)) && !isMediaRead(agent, resolve7(cwd, p)) && !isOwnFile(agent, cwd, p));
|
|
20146
20194
|
}
|
|
20195
|
+
function allowOutput(agent) {
|
|
20196
|
+
try {
|
|
20197
|
+
return getAdapter(agent).encode({ event: "PreToolUse", agent, sessionId: "", cwd: "", turn: 0 }, { kind: "allow" });
|
|
20198
|
+
} catch {
|
|
20199
|
+
return { stdout: "", exitCode: 0 };
|
|
20200
|
+
}
|
|
20201
|
+
}
|
|
20147
20202
|
function failureOutput(agent, raw, err, cwdFallback = "") {
|
|
20148
20203
|
const row5 = getAdapter(agent);
|
|
20149
|
-
const allow = () => row5.encode({ event: "PreToolUse", agent, sessionId: "", cwd: "", turn: 0 }, { kind: "allow" });
|
|
20150
20204
|
try {
|
|
20151
|
-
if (!isRec(raw)) return
|
|
20152
|
-
if (!isPreTool(row5, firstString(raw, HOOK_FAIL_EVENT_KEYS))) return
|
|
20205
|
+
if (!isRec(raw)) return allowOutput(agent);
|
|
20206
|
+
if (!isPreTool(row5, firstString(raw, HOOK_FAIL_EVENT_KEYS))) return allowOutput(agent);
|
|
20153
20207
|
const name = firstString(raw, HOOK_FAIL_TOOL_KEYS);
|
|
20154
|
-
if (name === "" || name.includes(OWN_TOOL_PREFIX)) return
|
|
20208
|
+
if (name === "" || name.includes(OWN_TOOL_PREFIX)) return allowOutput(agent);
|
|
20155
20209
|
const kind = kindOf(row5, name);
|
|
20156
|
-
if (kind === null) return
|
|
20210
|
+
if (kind === null) return allowOutput(agent);
|
|
20157
20211
|
const cwd = firstString(raw, HOOK_FAIL_CWD_KEYS) || cwdFallback;
|
|
20158
|
-
if (kind === "read" && !bigRead(agent, inputOf(raw), cwd)) return
|
|
20212
|
+
if (kind === "read" && !bigRead(agent, inputOf(raw), cwd)) return allowOutput(agent);
|
|
20159
20213
|
const redirect = kind === "read" ? HOOK_FAIL_REDIRECT.read : HOOK_FAIL_REDIRECT[kind];
|
|
20160
20214
|
const reason = prefixToolNames(redirect, row5.toolNamePrefix) + "\n" + HOOK_FAIL_LINE(errorLabel(err), row5.toolNamePrefix);
|
|
20161
20215
|
return row5.encode({ event: "PreToolUse", agent, sessionId: "", cwd, turn: 0 }, { kind: "deny", reason });
|
|
@@ -20187,12 +20241,20 @@ async function handleHook(agent, raw, env) {
|
|
|
20187
20241
|
return EMPTY5;
|
|
20188
20242
|
}
|
|
20189
20243
|
const row5 = getAdapter(agent);
|
|
20190
|
-
const
|
|
20244
|
+
const report2 = (stage, err, line) => {
|
|
20191
20245
|
logHookError(env, agent, stage, err);
|
|
20192
20246
|
process.stderr.write(line ?? "hooks: " + stage + " failed: " + message(err) + "\n");
|
|
20247
|
+
};
|
|
20248
|
+
const fail7 = (stage, err, line) => {
|
|
20249
|
+
report2(stage, err, line);
|
|
20193
20250
|
return failureOutput(agent, raw, err);
|
|
20194
20251
|
};
|
|
20195
|
-
if (nodeTooOld(process.version))
|
|
20252
|
+
if (nodeTooOld(process.version)) {
|
|
20253
|
+
const err = new CtxError("NODE_TOO_OLD", { v: process.version });
|
|
20254
|
+
if (row5.installMode === "in-process") return fail7("node", err);
|
|
20255
|
+
report2("node", err);
|
|
20256
|
+
return allowOutput(agent);
|
|
20257
|
+
}
|
|
20196
20258
|
let ev;
|
|
20197
20259
|
try {
|
|
20198
20260
|
fault(env, "decode");
|
|
@@ -20523,14 +20585,21 @@ async function postReplace(ev, row5, project, env, tool, result, text) {
|
|
|
20523
20585
|
if (result.keep === true) return ALLOW2;
|
|
20524
20586
|
if (!hasReplace(row5)) return ALLOW2;
|
|
20525
20587
|
let label2;
|
|
20588
|
+
let caller = { ctx: true, shell: true, read: false };
|
|
20526
20589
|
if (isSubagentCall(ev)) {
|
|
20527
|
-
const
|
|
20528
|
-
|
|
20529
|
-
|
|
20590
|
+
const set3 = toolSetForAgentType(ev, toolSetSources(ev, project, env));
|
|
20591
|
+
const subCase = pickSubagentCase(ev, set3);
|
|
20592
|
+
const has3 = (names) => set3 !== null && names.some((n) => set3.includes(n));
|
|
20593
|
+
caller = {
|
|
20594
|
+
ctx: subCase === "A",
|
|
20595
|
+
shell: has3(row5.nativeTools.shell),
|
|
20596
|
+
read: RANGE_READ_TOOLS.includes(tool.canonicalName) && has3(row5.nativeTools.read ?? [])
|
|
20597
|
+
};
|
|
20598
|
+
label2 = SUBAGENT_SOURCE_PREFIX + tool.canonicalName + ":" + (tool.callId ?? String(ev.turn ?? 0));
|
|
20530
20599
|
} else {
|
|
20531
20600
|
label2 = mainLabel(tool, ev);
|
|
20532
20601
|
}
|
|
20533
|
-
const intent = [tool.input.description, tool.input.command, tool.input.file_path, tool.input.pattern, tool.input.url].map(str2).find((v) => v.trim() !== "") ??
|
|
20602
|
+
const intent = [tool.input.description, tool.input.command, tool.input.file_path, tool.input.pattern, tool.input.url, tool.name].map(str2).find((v) => v.trim() !== "") ?? tool.canonicalName;
|
|
20534
20603
|
const chunks = chunkText(text, "text", REPLACE_CHUNK_BYTES);
|
|
20535
20604
|
const db = await openDb(project);
|
|
20536
20605
|
let sourceId;
|
|
@@ -20544,12 +20613,17 @@ async function postReplace(ev, row5, project, env, tool, result, text) {
|
|
|
20544
20613
|
const handle = sourceHandle(sourceId);
|
|
20545
20614
|
const prompt = await lastPrompt(project, ev.sessionId);
|
|
20546
20615
|
const rankQuery = prompt.trim() === "" ? void 0 : intent + " " + prompt;
|
|
20547
|
-
const handleLine = REPLACE_HANDLE_LINE(intent, handle, result.bytes, row5.toolNamePrefix, askedWords(intent, prompt, text));
|
|
20616
|
+
const handleLine = caller.ctx ? REPLACE_HANDLE_LINE(intent, handle, result.bytes, row5.toolNamePrefix, askedWords(intent, prompt, text)) : SUBAGENT_HANDLE_LINE(handle, result.bytes, caller.read);
|
|
20548
20617
|
const budget = replaceBudget(handleLine, moreLine2(intent, label2));
|
|
20618
|
+
const pointer = handleLine + (caller.shell && ev.agent === RUN_WRAPPER_AGENT ? searchTwin(handle, intent, project) : "");
|
|
20549
20619
|
const digest = shapeDigest(text, rankQuery ?? intent, SHAPE_RETURN_BYTES);
|
|
20550
|
-
if (digest !== null) return { kind: "replace", output: replaceOutput(digest,
|
|
20620
|
+
if (digest !== null) return { kind: "replace", output: replaceOutput(digest, pointer) };
|
|
20551
20621
|
const selected = selectChunksInMemory(chunks, intent, budget, label2, rankQuery);
|
|
20552
|
-
return { kind: "replace", output: selected.more !== null ? replaceOutput(selected.text,
|
|
20622
|
+
return { kind: "replace", output: selected.more !== null ? replaceOutput(selected.text, pointer) : selected.text };
|
|
20623
|
+
}
|
|
20624
|
+
function searchTwin(handle, intent, project) {
|
|
20625
|
+
const terms = Buffer.byteLength(intent, "utf8") > ECHO_MAX_BYTES ? "" : intent;
|
|
20626
|
+
return SEARCH_TWIN_LINE(join8(dirname4(process.argv[1] ?? ""), SEARCH_WRAPPER_FILE), handle, terms, project.worktree);
|
|
20553
20627
|
}
|
|
20554
20628
|
function boundedRead(tool) {
|
|
20555
20629
|
return RANGE_READ_TOOLS.includes(tool.canonicalName) && READ_RANGE_KEYS.some((k) => tool.input[k] !== void 0 && tool.input[k] !== null);
|
|
@@ -20696,6 +20770,13 @@ function pathEntries(value, platform = process.platform, delimiter2 = platform =
|
|
|
20696
20770
|
const win = platform === "win32";
|
|
20697
20771
|
return value.split(delimiter2).map((e) => win && e.length >= 2 && e.startsWith('"') && e.endsWith('"') ? e.slice(1, -1) : e).filter(Boolean);
|
|
20698
20772
|
}
|
|
20773
|
+
function envValue(env, name, platform = process.platform) {
|
|
20774
|
+
const exact = env[name];
|
|
20775
|
+
if (exact !== void 0 || platform !== "win32") return exact;
|
|
20776
|
+
const upper = name.toUpperCase();
|
|
20777
|
+
const key = Object.keys(env).find((k) => k.toUpperCase() === upper);
|
|
20778
|
+
return key === void 0 ? void 0 : env[key];
|
|
20779
|
+
}
|
|
20699
20780
|
|
|
20700
20781
|
// src/core/sandbox/runtimes.ts
|
|
20701
20782
|
var PATHEXT_SEPARATOR = ";";
|
|
@@ -20739,8 +20820,8 @@ function isRunnable(full) {
|
|
|
20739
20820
|
}
|
|
20740
20821
|
function findRuntime(lang, env = process.env) {
|
|
20741
20822
|
if (isWin() && WIN_SHELL_LANGS.includes(lang)) return findGitBash(env);
|
|
20742
|
-
const dirs = pathEntries(env
|
|
20743
|
-
const pathExt = isWin() ? (env
|
|
20823
|
+
const dirs = pathEntries(envValue(env, "PATH") ?? "", process.platform, path.delimiter);
|
|
20824
|
+
const pathExt = isWin() ? (envValue(env, "PATHEXT") ?? PATHEXT_DEFAULT).split(PATHEXT_SEPARATOR).filter((e) => e !== "") : [];
|
|
20744
20825
|
const names = candidates(lang);
|
|
20745
20826
|
let shim = null;
|
|
20746
20827
|
for (const dir of dirs) {
|
|
@@ -20901,7 +20982,7 @@ function runProcess(argv, o) {
|
|
|
20901
20982
|
}
|
|
20902
20983
|
|
|
20903
20984
|
// src/core/index/auto-memory.ts
|
|
20904
|
-
import { readdirSync as
|
|
20985
|
+
import { readdirSync as readdirSync3, readFileSync as readFileSync6, statSync as statSync4 } from "node:fs";
|
|
20905
20986
|
import { join as join9 } from "node:path";
|
|
20906
20987
|
var MEMORY_FILES = Object.freeze([
|
|
20907
20988
|
Object.freeze(["CLAUDE.md"]),
|
|
@@ -20916,7 +20997,7 @@ var KIRO_STEERING = Object.freeze([".kiro", "steering"]);
|
|
|
20916
20997
|
var MD = ".md";
|
|
20917
20998
|
function steeringFiles(worktree) {
|
|
20918
20999
|
try {
|
|
20919
|
-
return
|
|
21000
|
+
return readdirSync3(join9(worktree, ...KIRO_STEERING)).filter((n) => n.endsWith(MD)).sort().map((n) => [...KIRO_STEERING, n]);
|
|
20920
21001
|
} catch {
|
|
20921
21002
|
return [];
|
|
20922
21003
|
}
|
|
@@ -21510,7 +21591,7 @@ var ctxBatch = Object.freeze({
|
|
|
21510
21591
|
});
|
|
21511
21592
|
|
|
21512
21593
|
// src/core/tools/doctor.ts
|
|
21513
|
-
import { readdirSync as
|
|
21594
|
+
import { readdirSync as readdirSync8, readFileSync as readFileSync16, existsSync as existsSync16 } from "node:fs";
|
|
21514
21595
|
import { basename as basename5, join as join19 } from "node:path";
|
|
21515
21596
|
|
|
21516
21597
|
// src/core/ops/bundle-dir.ts
|
|
@@ -21536,11 +21617,11 @@ function ownBundleDir() {
|
|
|
21536
21617
|
}
|
|
21537
21618
|
|
|
21538
21619
|
// src/core/ops/doctor-config.ts
|
|
21539
|
-
import { existsSync as existsSync9, readdirSync as
|
|
21620
|
+
import { existsSync as existsSync9, readdirSync as readdirSync6, readFileSync as readFileSync11 } from "node:fs";
|
|
21540
21621
|
import { dirname as dirname8, isAbsolute as isAbsolute4, join as join14, resolve as resolve9 } from "node:path";
|
|
21541
21622
|
|
|
21542
21623
|
// src/core/ops/detect-v1.ts
|
|
21543
|
-
import { existsSync as existsSync6, opendirSync, readdirSync as
|
|
21624
|
+
import { existsSync as existsSync6, opendirSync, readdirSync as readdirSync4, readFileSync as readFileSync8 } from "node:fs";
|
|
21544
21625
|
import { tmpdir } from "node:os";
|
|
21545
21626
|
import { join as join12 } from "node:path";
|
|
21546
21627
|
|
|
@@ -24277,7 +24358,7 @@ function scanVscode(agentHome, project, out) {
|
|
|
24277
24358
|
}
|
|
24278
24359
|
function jsonFiles(dir) {
|
|
24279
24360
|
try {
|
|
24280
|
-
return
|
|
24361
|
+
return readdirSync4(dir).filter((name) => name.endsWith(KIRO_AGENT_FILE_EXT)).sort();
|
|
24281
24362
|
} catch {
|
|
24282
24363
|
return [];
|
|
24283
24364
|
}
|
|
@@ -24410,7 +24491,7 @@ function detectV1(agent, home, scope = {}) {
|
|
|
24410
24491
|
}
|
|
24411
24492
|
|
|
24412
24493
|
// src/core/ops/plugin-root.ts
|
|
24413
|
-
import { existsSync as existsSync7, readdirSync as
|
|
24494
|
+
import { existsSync as existsSync7, readdirSync as readdirSync5, readFileSync as readFileSync9, realpathSync as realpathSync4 } from "node:fs";
|
|
24414
24495
|
import { dirname as dirname7, isAbsolute as isAbsolute3, join as join13, sep as sep4 } from "node:path";
|
|
24415
24496
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
24416
24497
|
function missing(agent, path8) {
|
|
@@ -24510,7 +24591,7 @@ function marketplaceRoot(adapter, env, worktree) {
|
|
|
24510
24591
|
if (ownReal !== null && cacheReal !== null && ownReal.startsWith(cacheReal + sep4) && existsSync7(join13(ownReal, SERVER_ENTRY_FILE))) return ownReal;
|
|
24511
24592
|
const pattern = join13(cache, "*", PLUGIN_NAME);
|
|
24512
24593
|
if (!existsSync7(cache)) throw missing(adapter.id, pattern);
|
|
24513
|
-
const found =
|
|
24594
|
+
const found = readdirSync5(cache).sort().map((marketplace) => join13(cache, marketplace, PLUGIN_NAME)).filter((dir) => existsSync7(dir));
|
|
24514
24595
|
if (found.length !== 1) throw missing(adapter.id, found.length === 0 ? pattern : found.join(", "));
|
|
24515
24596
|
return found[0];
|
|
24516
24597
|
}
|
|
@@ -24722,10 +24803,10 @@ function codexNativeDir(env, home) {
|
|
|
24722
24803
|
const cache = join14(codexDir, "plugins", PLUGIN_CACHE_DIR_NAME);
|
|
24723
24804
|
if (!existsSync9(cache)) return null;
|
|
24724
24805
|
const found = [];
|
|
24725
|
-
for (const market of
|
|
24806
|
+
for (const market of readdirSync6(cache)) {
|
|
24726
24807
|
const plugin = join14(cache, market, SERVER_KEY);
|
|
24727
24808
|
if (!existsSync9(plugin)) continue;
|
|
24728
|
-
for (const version4 of
|
|
24809
|
+
for (const version4 of readdirSync6(plugin).sort()) {
|
|
24729
24810
|
const dir = join14(plugin, version4, CODEX_PLUGIN_SUBDIR);
|
|
24730
24811
|
if (existsSync9(join14(dir, CODEX_PLUGIN_MCP_FILE))) found.push(dir);
|
|
24731
24812
|
}
|
|
@@ -24828,7 +24909,7 @@ function opencodeDirPlugins(dirs) {
|
|
|
24828
24909
|
const pdir = join14(dir, OPENCODE_PLUGINS_DIR);
|
|
24829
24910
|
let names;
|
|
24830
24911
|
try {
|
|
24831
|
-
names =
|
|
24912
|
+
names = readdirSync6(pdir);
|
|
24832
24913
|
} catch {
|
|
24833
24914
|
continue;
|
|
24834
24915
|
}
|
|
@@ -27131,7 +27212,7 @@ var WIN_EXT = ".COM;.EXE;.BAT;.CMD";
|
|
|
27131
27212
|
var WIN_SHIM_EXTS = Object.freeze([".cmd", ".bat"]);
|
|
27132
27213
|
var DEFAULT_COMSPEC = "cmd.exe";
|
|
27133
27214
|
function envGet(env, k) {
|
|
27134
|
-
return
|
|
27215
|
+
return envValue(env, k, "win32");
|
|
27135
27216
|
}
|
|
27136
27217
|
function whichBin(bin, env, platform = process.platform) {
|
|
27137
27218
|
const get = (k) => envGet(env, k);
|
|
@@ -27586,10 +27667,13 @@ async function checkHookRoundTrip(i) {
|
|
|
27586
27667
|
await runProcess([node3.file, "-e", ""], { cwd: i.bundleDir, env: node3.env, signal: i.signal, timeoutMs });
|
|
27587
27668
|
return performance.now() - t;
|
|
27588
27669
|
});
|
|
27670
|
+
const inProcess = getAdapter(i.agent).installMode === "in-process";
|
|
27589
27671
|
const hookWalls = [];
|
|
27590
27672
|
const bareWalls = [];
|
|
27591
27673
|
let ms = 0;
|
|
27592
|
-
|
|
27674
|
+
let fastBare = 0;
|
|
27675
|
+
let bound = HOOK_P95_MS;
|
|
27676
|
+
for (let n = 1; n <= (inProcess ? 1 : maxPairs); n++) {
|
|
27593
27677
|
const start = now();
|
|
27594
27678
|
const node3 = nodeLaunch(i.env);
|
|
27595
27679
|
const r = await runProcess([node3.file, path7.join(i.bundleDir, HOOK_ENTRY_FILE), AGENT_ARG, i.agent], {
|
|
@@ -27601,13 +27685,17 @@ async function checkHookRoundTrip(i) {
|
|
|
27601
27685
|
});
|
|
27602
27686
|
hookWalls.push(now() - start);
|
|
27603
27687
|
if (!isNativeShape(i.agent, r.stdout.toString("utf8"), r.exitCode, r.killed, fixture.event)) return row("FAIL", D5_SHAPE_DETAIL, D5_FIX);
|
|
27688
|
+
if (inProcess) return row("PASS", D5_IN_PROCESS_DETAIL);
|
|
27604
27689
|
bareWalls.push(await bareMs());
|
|
27605
|
-
|
|
27606
|
-
|
|
27690
|
+
fastBare = Math.round(Math.min(...bareWalls));
|
|
27691
|
+
ms = Math.max(0, Math.round(Math.min(...hookWalls)) - fastBare);
|
|
27692
|
+
bound = Math.max(HOOK_P95_MS, Math.round(D5_BARE_SHARE * fastBare));
|
|
27693
|
+
if (n >= minPairs && ms <= bound) break;
|
|
27607
27694
|
}
|
|
27608
|
-
if (ms >
|
|
27695
|
+
if (ms > bound) return row("FAIL", D5_SLOW_DETAIL(ms, bound), D5_FIX);
|
|
27609
27696
|
const readDetail = i.agent === "claude-code" ? await readProbeDetail(i, timeoutMs) : i.agent === "zcode" ? await mediaProbeDetail(i, timeoutMs) : i.agent === "codex" ? await codexStopDetail(i, timeoutMs) : null;
|
|
27610
27697
|
if (readDetail !== null) return row("FAIL", readDetail, D5_FIX);
|
|
27698
|
+
if (ms > HOOK_P95_MS) return row("PASS", D5_SLOW_START_DETAIL(ms, fastBare, bound));
|
|
27611
27699
|
return row("PASS", DOCTOR_PASS_DETAIL);
|
|
27612
27700
|
}
|
|
27613
27701
|
|
|
@@ -27616,7 +27704,7 @@ import { existsSync as existsSync14, mkdirSync as mkdirSync6, rmSync as rmSync4
|
|
|
27616
27704
|
import { basename as basename4, dirname as dirname9, join as join17 } from "node:path";
|
|
27617
27705
|
|
|
27618
27706
|
// src/core/store/owners.ts
|
|
27619
|
-
import { mkdirSync as mkdirSync5, readdirSync as
|
|
27707
|
+
import { mkdirSync as mkdirSync5, readdirSync as readdirSync7, readFileSync as readFileSync14, rmSync as rmSync3, writeFileSync as writeFileSync3 } from "node:fs";
|
|
27620
27708
|
import { basename as basename3, join as join16 } from "node:path";
|
|
27621
27709
|
function ownersDir(configDir, projectKey) {
|
|
27622
27710
|
return join16(configDir, PROJECTS_DIR_NAME, projectKey, OWNERS_DIR_NAME);
|
|
@@ -27649,7 +27737,7 @@ function listLiveOwners(configDir, projectKey) {
|
|
|
27649
27737
|
const dir = ownersDir(configDir, projectKey);
|
|
27650
27738
|
let names;
|
|
27651
27739
|
try {
|
|
27652
|
-
names =
|
|
27740
|
+
names = readdirSync7(dir);
|
|
27653
27741
|
} catch (err) {
|
|
27654
27742
|
if (errCode2(err) === "ENOENT") return [];
|
|
27655
27743
|
throw err;
|
|
@@ -27845,7 +27933,7 @@ function unsupportedHostOf(sig) {
|
|
|
27845
27933
|
// src/core/ops/doctor-issue.ts
|
|
27846
27934
|
import { spawnSync as spawnSync3 } from "node:child_process";
|
|
27847
27935
|
import { closeSync as closeSync2, existsSync as existsSync15, fstatSync, mkdirSync as mkdirSync7, openSync as openSync2, readFileSync as readFileSync15, readSync as readSync2, realpathSync as realpathSync9, writeFileSync as writeFileSync4 } from "node:fs";
|
|
27848
|
-
import { delimiter, join as join18 } from "node:path";
|
|
27936
|
+
import { delimiter, dirname as dirname10, join as join18 } from "node:path";
|
|
27849
27937
|
var TOKEN_PREFIXES = ["ghp_", "gho_", "github_pat_", "sk-", "xoxb-", "AKIA"];
|
|
27850
27938
|
function tildeOf(env) {
|
|
27851
27939
|
const home = homeDirOf(env);
|
|
@@ -27868,13 +27956,28 @@ function maskLine(line) {
|
|
|
27868
27956
|
const at2 = Math.max(line.indexOf(":"), line.indexOf("="));
|
|
27869
27957
|
return at2 === -1 ? DOCTOR_MASK : line.slice(0, at2 + 1) + " " + DOCTOR_MASK;
|
|
27870
27958
|
}
|
|
27871
|
-
function
|
|
27959
|
+
async function runtimeInfo(env, signal, host = { bun: process.versions.bun, node: process.version }) {
|
|
27960
|
+
if (host.bun === void 0) return { node: host.node };
|
|
27961
|
+
const node3 = findRuntime("javascript", env);
|
|
27962
|
+
if (node3 === null) return { node: host.node, bun: host.bun, pathNode: null };
|
|
27963
|
+
const childEnv = {};
|
|
27964
|
+
for (const [k, v] of Object.entries(env)) if (v !== void 0) childEnv[k] = v;
|
|
27965
|
+
const r = await runProcess([node3, "--version"], { cwd: dirname10(node3), env: childEnv, signal, timeoutMs: DOCTOR_GIT_VERSION_TIMEOUT_MS });
|
|
27966
|
+
const out = r.stdout.toString("utf8").trim();
|
|
27967
|
+
return { node: host.node, bun: host.bun, pathNode: r.exitCode === 0 && out !== "" ? out : null };
|
|
27968
|
+
}
|
|
27969
|
+
function environmentLine(ctx, adapter, env, version4, rt) {
|
|
27872
27970
|
const sha = BUNDLE_SHA === void 0 ? "dev build" : BUNDLE_SHA.slice(0, 7);
|
|
27873
27971
|
const client = ctx.clientInfo;
|
|
27874
27972
|
const agent = client === void 0 ? adapter.id : client.name === adapter.id ? `${adapter.id} ${client.version}` : `${adapter.id} ${client.version} (client ${client.name})`;
|
|
27875
27973
|
const shell = env.SHELL ?? env.ComSpec ?? "sh";
|
|
27876
|
-
|
|
27877
|
-
|
|
27974
|
+
const what = `${DOCTOR_ENV_PREFIX}context-mode ${version4 ?? "source checkout"} (${sha}), agent ${agent}
|
|
27975
|
+
`;
|
|
27976
|
+
const os = `${DOCTOR_ENV_PREFIX}${process.platform}-${process.arch}`;
|
|
27977
|
+
if (rt.bun === void 0) return what + `${os}, Node ${rt.node}, shell ${shell}`;
|
|
27978
|
+
const pathNode = rt.pathNode === null || rt.pathNode === void 0 ? "ctx_execute node: none on PATH" : `ctx_execute node ${rt.pathNode} (PATH)`;
|
|
27979
|
+
return what + `${os}, host runtime Bun ${rt.bun} (node-compat ${rt.node})
|
|
27980
|
+
${DOCTOR_ENV_PREFIX}${pathNode}, shell ${shell}`;
|
|
27878
27981
|
}
|
|
27879
27982
|
function gitVersion(env) {
|
|
27880
27983
|
const r = spawnSync3("git", ["--version"], { env, encoding: "utf8", timeout: DOCTOR_GIT_VERSION_TIMEOUT_MS, windowsHide: true });
|
|
@@ -27884,7 +27987,7 @@ function gitVersion(env) {
|
|
|
27884
27987
|
function onPath(env, tool) {
|
|
27885
27988
|
const names = process.platform === "win32" ? [tool + EXE_SUFFIX, tool + ".cmd", tool] : [tool];
|
|
27886
27989
|
const out = [];
|
|
27887
|
-
for (const dir of (env
|
|
27990
|
+
for (const dir of (envValue(env, "PATH") ?? "").split(delimiter)) {
|
|
27888
27991
|
if (dir === "") continue;
|
|
27889
27992
|
for (const n of names) if (existsSync15(join18(dir, n))) {
|
|
27890
27993
|
out.push(join18(dir, n));
|
|
@@ -28085,7 +28188,7 @@ async function hookRow(ctx, adapter, host) {
|
|
|
28085
28188
|
function ownServerId(configDir, projectKey) {
|
|
28086
28189
|
const dir = join19(configDir, PROJECTS_DIR_NAME, projectKey, OWNERS_DIR_NAME);
|
|
28087
28190
|
if (!existsSync16(dir)) return "";
|
|
28088
|
-
for (const name of
|
|
28191
|
+
for (const name of readdirSync8(dir)) {
|
|
28089
28192
|
if (!name.endsWith(OWNER_PID_EXT)) continue;
|
|
28090
28193
|
if (readFileSync16(join19(dir, name), "utf8").trim() === String(process.pid)) return basename5(name, OWNER_PID_EXT);
|
|
28091
28194
|
}
|
|
@@ -28144,11 +28247,12 @@ function reportEnv(env) {
|
|
|
28144
28247
|
}
|
|
28145
28248
|
async function doctorReply(ctx, host) {
|
|
28146
28249
|
const adapter = getAdapter(ctx.project.agent);
|
|
28250
|
+
const runtime = runtimeInfo(host.env, ctx.signal);
|
|
28147
28251
|
const rows = await runDoctorChecks(ctx, adapter, host);
|
|
28148
28252
|
const failed = rows.some((r) => r.status === "FAIL");
|
|
28149
28253
|
const command = adapter.id === "pi" ? failed ? NATIVE_INSTALL.pi[0] : PI_LIST_COMMAND : `context-mode ${failed ? "setup" : "doctor"} --agents ${adapter.id}`;
|
|
28150
28254
|
const input = { agent: adapter.id, rows, env: reportEnv(host.env), command };
|
|
28151
|
-
const envLine2 = environmentLine(ctx, adapter, host.env, bundleVersion(host.bundleDir));
|
|
28255
|
+
const envLine2 = environmentLine(ctx, adapter, host.env, bundleVersion(host.bundleDir), await runtime);
|
|
28152
28256
|
const table3 = buildReport(input);
|
|
28153
28257
|
let notes = [];
|
|
28154
28258
|
if (failed) {
|
|
@@ -28187,7 +28291,7 @@ var ctxDoctor = Object.freeze({
|
|
|
28187
28291
|
// src/core/tools/execute.ts
|
|
28188
28292
|
import { existsSync as existsSync17, mkdtempSync as mkdtempSync2, rmSync as rmSync5, writeFileSync as writeFileSync5 } from "node:fs";
|
|
28189
28293
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
28190
|
-
import { dirname as
|
|
28294
|
+
import { dirname as dirname12, join as join20, parse as parse3, resolve as resolve11 } from "node:path";
|
|
28191
28295
|
|
|
28192
28296
|
// src/core/sandbox/win-build.ts
|
|
28193
28297
|
var SEPARATORS2 = ";&|(\n";
|
|
@@ -28270,7 +28374,7 @@ function schemaLine(issue4) {
|
|
|
28270
28374
|
}
|
|
28271
28375
|
function fileError(given, abs, root) {
|
|
28272
28376
|
let dir = abs;
|
|
28273
|
-
while (!existsSync17(dir) &&
|
|
28377
|
+
while (!existsSync17(dir) && dirname12(dir) !== dir) dir = dirname12(dir);
|
|
28274
28378
|
if (isInside(root, dir)) return null;
|
|
28275
28379
|
return new CtxError("OUTSIDE_ROOT", { p: given, root }).toLine();
|
|
28276
28380
|
}
|
|
@@ -28389,10 +28493,10 @@ var ctxExecute = {
|
|
|
28389
28493
|
|
|
28390
28494
|
// src/core/tools/index.ts
|
|
28391
28495
|
import { existsSync as existsSync18, readFileSync as readFileSync18, statSync as statSync8 } from "node:fs";
|
|
28392
|
-
import { dirname as
|
|
28496
|
+
import { dirname as dirname13, extname as extname3, join as join22, relative as relative5, resolve as resolve12 } from "node:path";
|
|
28393
28497
|
|
|
28394
28498
|
// src/core/index/walk.ts
|
|
28395
|
-
import { readdirSync as
|
|
28499
|
+
import { readdirSync as readdirSync9, readFileSync as readFileSync17, realpathSync as realpathSync10, statSync as statSync7 } from "node:fs";
|
|
28396
28500
|
import { join as join21 } from "node:path";
|
|
28397
28501
|
var GITIGNORE = ".gitignore";
|
|
28398
28502
|
var GIT_DIR = ".git";
|
|
@@ -28407,7 +28511,7 @@ function walkDir(root, containmentRoot) {
|
|
|
28407
28511
|
function visit(abs, rel, parent, contain, seen, found) {
|
|
28408
28512
|
let entries;
|
|
28409
28513
|
try {
|
|
28410
|
-
entries =
|
|
28514
|
+
entries = readdirSync9(abs, { withFileTypes: true });
|
|
28411
28515
|
} catch {
|
|
28412
28516
|
return;
|
|
28413
28517
|
}
|
|
@@ -28600,15 +28704,15 @@ function parseUrl(raw) {
|
|
|
28600
28704
|
if (u.protocol !== "http:" && u.protocol !== "https:") throw fail6("ERR_INVALID_PROTOCOL");
|
|
28601
28705
|
return u;
|
|
28602
28706
|
}
|
|
28603
|
-
function
|
|
28707
|
+
function envValue2(upper) {
|
|
28604
28708
|
const v = process.env[upper] ?? process.env[upper.toLowerCase()];
|
|
28605
28709
|
return v === void 0 || v.trim() === "" ? void 0 : v.trim();
|
|
28606
28710
|
}
|
|
28607
28711
|
function pickProxy(u) {
|
|
28608
|
-
const raw =
|
|
28712
|
+
const raw = envValue2(u.protocol === "https:" ? "HTTPS_PROXY" : "HTTP_PROXY");
|
|
28609
28713
|
if (raw === void 0) return void 0;
|
|
28610
28714
|
const host = bare(u.hostname).toLowerCase();
|
|
28611
|
-
for (const item of (
|
|
28715
|
+
for (const item of (envValue2("NO_PROXY") ?? "").split(",")) {
|
|
28612
28716
|
let entry = item.trim().toLowerCase();
|
|
28613
28717
|
if (entry.startsWith(".")) entry = entry.slice(1);
|
|
28614
28718
|
if (entry !== "" && (host === entry || host.endsWith("." + entry))) return void 0;
|
|
@@ -32589,7 +32693,7 @@ function readUtf8(absPath) {
|
|
|
32589
32693
|
}
|
|
32590
32694
|
function missingOrOutside(given, abs, root) {
|
|
32591
32695
|
let dir = abs;
|
|
32592
|
-
while (!existsSync18(dir) &&
|
|
32696
|
+
while (!existsSync18(dir) && dirname13(dir) !== dir) dir = dirname13(dir);
|
|
32593
32697
|
if (dir !== abs && isInside(root, dir)) return new CtxError("INVALID_ARGS", { field: "path", action: "pass an existing file or folder" });
|
|
32594
32698
|
return new CtxError("OUTSIDE_ROOT", { p: given, root });
|
|
32595
32699
|
}
|
|
@@ -33141,7 +33245,7 @@ var ctxStats = Object.freeze({
|
|
|
33141
33245
|
|
|
33142
33246
|
// src/core/ops/host-write.ts
|
|
33143
33247
|
import { copyFileSync, existsSync as existsSync19, mkdirSync as mkdirSync8, writeFileSync as writeFileSync6 } from "node:fs";
|
|
33144
|
-
import { dirname as
|
|
33248
|
+
import { dirname as dirname14, join as join23 } from "node:path";
|
|
33145
33249
|
function defaultWrite(file2, text) {
|
|
33146
33250
|
writeFileSync6(file2, text, "utf8");
|
|
33147
33251
|
}
|
|
@@ -33173,7 +33277,7 @@ function writeWithRollback(file2, text, write2, atomic) {
|
|
|
33173
33277
|
const trash = file2 + UPGRADE_TRASH_SUFFIX;
|
|
33174
33278
|
const tmp = `${file2}${HOST_CONFIG_TMP_SUFFIX}.${process.pid}`;
|
|
33175
33279
|
const had = existsSync19(file2);
|
|
33176
|
-
mkdirSync8(
|
|
33280
|
+
mkdirSync8(dirname14(file2), { recursive: true });
|
|
33177
33281
|
if (had) copyFileSync(file2, trash);
|
|
33178
33282
|
try {
|
|
33179
33283
|
write2(tmp, text);
|
|
@@ -33210,7 +33314,7 @@ function regenerateHostConfig(row5, home, opts = {}) {
|
|
|
33210
33314
|
}
|
|
33211
33315
|
|
|
33212
33316
|
// src/core/ops/uninstall.ts
|
|
33213
|
-
import { existsSync as existsSync20, readdirSync as
|
|
33317
|
+
import { existsSync as existsSync20, readdirSync as readdirSync10, rmSync as rmSync6, writeFileSync as writeFileSync7 } from "node:fs";
|
|
33214
33318
|
import { join as join24 } from "node:path";
|
|
33215
33319
|
function row2(area, before, after) {
|
|
33216
33320
|
return { area, before, after };
|
|
@@ -33326,7 +33430,7 @@ function removeProjectData(configDir, projectKey) {
|
|
|
33326
33430
|
const dir = join24(projects, projectKey);
|
|
33327
33431
|
if (!existsSync20(dir)) return row2(UPGRADE_DATA_AREA, "", UPGRADE_NOT_FOUND);
|
|
33328
33432
|
if (dir === projects || !isInside(projects, dir)) throw new CtxError("OUTSIDE_ROOT", { p: dir, root: projects });
|
|
33329
|
-
for (const name of
|
|
33433
|
+
for (const name of readdirSync10(dir)) {
|
|
33330
33434
|
if (name !== OWNERS_DIR_NAME) rmSync6(join24(dir, name), { recursive: true, force: true });
|
|
33331
33435
|
}
|
|
33332
33436
|
return row2(UPGRADE_DATA_AREA, dir, UPGRADE_DATA_DELETED);
|
|
@@ -33602,7 +33706,7 @@ function checkCall(tool, input) {
|
|
|
33602
33706
|
// src/entries/server.ts
|
|
33603
33707
|
import { randomUUID } from "node:crypto";
|
|
33604
33708
|
import { existsSync as existsSync23, realpathSync as realpathSync12, rmSync as rmSync9 } from "node:fs";
|
|
33605
|
-
import { dirname as
|
|
33709
|
+
import { dirname as dirname15, join as join26 } from "node:path";
|
|
33606
33710
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
33607
33711
|
|
|
33608
33712
|
// node_modules/@modelcontextprotocol/server/dist/chunk-Br0eD_fh.mjs
|
|
@@ -61667,7 +61771,7 @@ function installExitGuard(opts) {
|
|
|
61667
61771
|
}
|
|
61668
61772
|
|
|
61669
61773
|
// src/core/store/cleanup.ts
|
|
61670
|
-
import { existsSync as existsSync22, readdirSync as
|
|
61774
|
+
import { existsSync as existsSync22, readdirSync as readdirSync11, rmSync as rmSync8 } from "node:fs";
|
|
61671
61775
|
import { join as join25 } from "node:path";
|
|
61672
61776
|
function deleteSource(raw, id) {
|
|
61673
61777
|
raw.prepare("DELETE FROM sources WHERE id = ?").run(id);
|
|
@@ -61738,7 +61842,7 @@ function sweepOne(configDir, projectKey, cutoff) {
|
|
|
61738
61842
|
function sweepDeadProjects(configDir) {
|
|
61739
61843
|
let entries;
|
|
61740
61844
|
try {
|
|
61741
|
-
entries =
|
|
61845
|
+
entries = readdirSync11(join25(configDir, PROJECTS_DIR_NAME), { withFileTypes: true });
|
|
61742
61846
|
} catch (err) {
|
|
61743
61847
|
if (err.code === "ENOENT") return [];
|
|
61744
61848
|
throw err;
|
|
@@ -61864,7 +61968,7 @@ function workspaceCwdOf(meta3, spawnCwd, script) {
|
|
|
61864
61968
|
const fromHost = workspaceFromMeta(meta3);
|
|
61865
61969
|
if (fromHost !== void 0) return fromHost;
|
|
61866
61970
|
if (script === void 0 || script === "") return spawnCwd;
|
|
61867
|
-
return realOrSame(spawnCwd) === realOrSame(
|
|
61971
|
+
return realOrSame(spawnCwd) === realOrSame(dirname15(script)) ? "" : spawnCwd;
|
|
61868
61972
|
}
|
|
61869
61973
|
function errorReply(err) {
|
|
61870
61974
|
if (err instanceof CtxError) return { text: err.toLine(), isError: true, sandboxBytes: 0 };
|
package/qwen-extension.json
CHANGED