context-mode 2.1.6 → 2.1.7
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 +238 -61
- package/copilot/plugin.json +1 -1
- package/gemini-extension.json +1 -1
- package/hook.mjs +98 -98
- package/opencode/plugin.js +253 -64
- package/package.json +1 -1
- package/pi/index.js +262 -73
- package/qwen-extension.json +1 -1
- package/run.mjs +130 -7
- package/search.mjs +130 -7
- package/server.mjs +283 -94
package/pi/index.js
CHANGED
|
@@ -11327,6 +11327,8 @@ var RRF_K = 60;
|
|
|
11327
11327
|
var SOURCE_HANDLE_MAX_DIGITS = 10;
|
|
11328
11328
|
var EXEC_TIMEOUT_MS = 6e5;
|
|
11329
11329
|
var KILL_GRACE_MS = 1e3;
|
|
11330
|
+
var PIPE_EOF_GRACE_MS = 250;
|
|
11331
|
+
var PIPE_DRAIN_MAX_MS = 2e3;
|
|
11330
11332
|
var DB_TIMEOUT_MS = 5e3;
|
|
11331
11333
|
var DB_WAL_SUFFIX = "-wal";
|
|
11332
11334
|
var DB_SHM_SUFFIX = "-shm";
|
|
@@ -11361,6 +11363,7 @@ var SHELL_FAMILY = Object.freeze(["sh", "bash", "zsh", "dash", "ksh", "fish"]);
|
|
|
11361
11363
|
var PATHEXT_DEFAULT = ".COM;.EXE;.BAT;.CMD";
|
|
11362
11364
|
var FETCH_MAX_HOPS = 5;
|
|
11363
11365
|
var SOURCE_LABEL_MAX_CHARS = 80;
|
|
11366
|
+
var BACKGROUND_HOLD_NOTE = "note: the command ended while a background process still held its output; that process was stopped, so output it would write later does not exist.";
|
|
11364
11367
|
var CANCELLED_LINE = "Cancelled.";
|
|
11365
11368
|
var BACKGROUND_REPLY_PREFIX = "started in background, pid ";
|
|
11366
11369
|
var PLAIN_OUTPUT_ENV = Object.freeze({ NO_COLOR: "1", FORCE_COLOR: "0" });
|
|
@@ -11610,7 +11613,7 @@ var DECISION_ANSWERS_KEY = "answers";
|
|
|
11610
11613
|
var DECISION_OPTION_KEY = "option";
|
|
11611
11614
|
var DECISION_LABEL_JOIN = " | ";
|
|
11612
11615
|
var RELEASE_REPO_URL = "https://github.com/mksglu/context-mode.git";
|
|
11613
|
-
var BUNDLE_SHA = true ? "
|
|
11616
|
+
var BUNDLE_SHA = true ? "5539b632975049a99de986448417a10bd246e506" : void 0;
|
|
11614
11617
|
var DOCTOR_CHECK_ORDER = Object.freeze(["D1", "D2", "D3", "D4", "D5", "D5b", "D6", "D7", "D8", "D9", "D10", "D11"]);
|
|
11615
11618
|
var DOCTOR_LABEL = Object.freeze({
|
|
11616
11619
|
D1: "version",
|
|
@@ -11716,6 +11719,7 @@ var D5B_FIX = "disable chat.useClaudeHooks or the Claude Code hooks block";
|
|
|
11716
11719
|
var VSCODE_CLAUDE_HOOKS_SETTING = "chat.useClaudeHooks";
|
|
11717
11720
|
var VSCODE_SETTINGS_FILE = "settings.json";
|
|
11718
11721
|
var D6_UNKNOWN_DETAIL = "no clientInfo or protocolVersion on the request";
|
|
11722
|
+
var D6_IN_PROCESS_DETAIL = "in-process plugin: this call ran inside the agent, no MCP session to read";
|
|
11719
11723
|
function D7_DETAIL(got) {
|
|
11720
11724
|
return `resolved project source ${got} does not match the host's actual cwd`;
|
|
11721
11725
|
}
|
|
@@ -11832,6 +11836,90 @@ function D3_DETAIL(parts) {
|
|
|
11832
11836
|
function D3_ROOT_DETAIL(paths) {
|
|
11833
11837
|
return `pick one install for this project: ${paths.join(D3_PART_JOIN)}`;
|
|
11834
11838
|
}
|
|
11839
|
+
var unsupported = (h) => Object.freeze(h);
|
|
11840
|
+
var UNSUPPORTED_HOSTS = Object.freeze([
|
|
11841
|
+
unsupported({
|
|
11842
|
+
id: "antigravity",
|
|
11843
|
+
name: "Antigravity",
|
|
11844
|
+
clientNames: ["antigravity", "antigravity-client", "antigravity-cli", "agy"],
|
|
11845
|
+
envVars: ["ANTIGRAVITY_CLI_ALIAS"],
|
|
11846
|
+
pluginPaths: [[".gemini", "config", "plugins"], [".gemini", "antigravity", "plugins"], [".gemini", "antigravity-cli", "plugins"], [".gemini", "antigravity-ide", "plugins"]],
|
|
11847
|
+
configDirs: [".gemini/antigravity", ".gemini/antigravity-cli", ".gemini/config"],
|
|
11848
|
+
binaries: ["agy"],
|
|
11849
|
+
source: "v1.0.169:src/adapters/client-map.ts:15-17; detect.ts:156,481-483; #1340"
|
|
11850
|
+
}),
|
|
11851
|
+
unsupported({
|
|
11852
|
+
id: "cursor",
|
|
11853
|
+
name: "Cursor",
|
|
11854
|
+
clientNames: ["cursor-vscode"],
|
|
11855
|
+
envVars: ["CURSOR_TRACE_ID", "CURSOR_CLI", "CURSOR_CWD"],
|
|
11856
|
+
pluginPaths: [],
|
|
11857
|
+
configDirs: [".cursor"],
|
|
11858
|
+
binaries: [],
|
|
11859
|
+
source: "v1.0.169:src/adapters/client-map.ts:18; detect.ts:163-165,584"
|
|
11860
|
+
}),
|
|
11861
|
+
unsupported({
|
|
11862
|
+
id: "omp",
|
|
11863
|
+
name: "OMP (oh-my-pi)",
|
|
11864
|
+
clientNames: ["omp-coding-agent"],
|
|
11865
|
+
envVars: [],
|
|
11866
|
+
pluginPaths: [],
|
|
11867
|
+
configDirs: [".omp"],
|
|
11868
|
+
binaries: ["omp"],
|
|
11869
|
+
source: "v1.0.169:src/adapters/client-map.ts:37; detect.ts:543 (PI_CODING_AGENT_DIR is not a signal: supported Pi reads it too)"
|
|
11870
|
+
}),
|
|
11871
|
+
unsupported({
|
|
11872
|
+
id: "openclaw",
|
|
11873
|
+
name: "OpenClaw",
|
|
11874
|
+
clientNames: [],
|
|
11875
|
+
envVars: [],
|
|
11876
|
+
pluginPaths: [],
|
|
11877
|
+
configDirs: [".openclaw"],
|
|
11878
|
+
binaries: [],
|
|
11879
|
+
source: "v1.0.169:src/adapters/detect.ts:252,575 (the runtime sets no env var)"
|
|
11880
|
+
}),
|
|
11881
|
+
unsupported({
|
|
11882
|
+
id: "kimi",
|
|
11883
|
+
name: "Kimi Code",
|
|
11884
|
+
clientNames: ["kimi-code", "kimi"],
|
|
11885
|
+
envVars: [],
|
|
11886
|
+
pluginPaths: [],
|
|
11887
|
+
configDirs: [".kimi-code"],
|
|
11888
|
+
binaries: ["kimi"],
|
|
11889
|
+
source: "v1.0.169:src/adapters/client-map.ts:42-44; detect.ts:567; adapters/kimi/index.ts:127"
|
|
11890
|
+
}),
|
|
11891
|
+
unsupported({
|
|
11892
|
+
id: "kilo",
|
|
11893
|
+
name: "Kilo Code",
|
|
11894
|
+
clientNames: ["kilo code"],
|
|
11895
|
+
envVars: ["KILO", "KILO_PID"],
|
|
11896
|
+
pluginPaths: [],
|
|
11897
|
+
configDirs: [".config/kilo"],
|
|
11898
|
+
binaries: [],
|
|
11899
|
+
source: "v1.0.169:src/adapters/client-map.ts:28; detect.ts:170-171,592"
|
|
11900
|
+
}),
|
|
11901
|
+
unsupported({
|
|
11902
|
+
id: "zed",
|
|
11903
|
+
name: "Zed",
|
|
11904
|
+
clientNames: ["zed"],
|
|
11905
|
+
envVars: ["ZED_SESSION_ID", "ZED_TERM"],
|
|
11906
|
+
pluginPaths: [],
|
|
11907
|
+
configDirs: [".config/zed"],
|
|
11908
|
+
binaries: [],
|
|
11909
|
+
source: "v1.0.169:src/adapters/client-map.ts:38-39; detect.ts:189-190,616"
|
|
11910
|
+
}),
|
|
11911
|
+
unsupported({
|
|
11912
|
+
id: "jetbrains-copilot",
|
|
11913
|
+
name: "JetBrains Copilot",
|
|
11914
|
+
clientNames: ["jetbrains client", "intellij idea", "pycharm"],
|
|
11915
|
+
envVars: ["IDEA_INITIAL_DIRECTORY"],
|
|
11916
|
+
pluginPaths: [],
|
|
11917
|
+
configDirs: [".config/JetBrains"],
|
|
11918
|
+
binaries: [],
|
|
11919
|
+
source: "v1.0.169:src/adapters/client-map.ts:23-25; detect.ts:213,600"
|
|
11920
|
+
})
|
|
11921
|
+
]);
|
|
11922
|
+
var SUPPORTED_AGENTS_DOCS_URL = "https://github.com/mksglu/context-mode/blob/main/docs/install/README.md";
|
|
11835
11923
|
var D3_ROOT_FIX_JOIN = " or ";
|
|
11836
11924
|
function D3_ROOT_FIX(installs) {
|
|
11837
11925
|
return `remove the extra install: ${installs.map((i) => `claude plugin uninstall ${i.key} --scope ${i.scope}`).join(D3_ROOT_FIX_JOIN)}`;
|
|
@@ -14676,6 +14764,17 @@ function claudeDirOf(env, home) {
|
|
|
14676
14764
|
const dir = env[CLAUDE_CONFIG_DIR_ENV];
|
|
14677
14765
|
return dir !== void 0 && dir !== "" ? dir : join(home, ...AGENT_HOME_DIR["claude-code"]);
|
|
14678
14766
|
}
|
|
14767
|
+
function claudeProfileEnv(env, platform = process.platform) {
|
|
14768
|
+
const dir = env[CLAUDE_CONFIG_DIR_ENV];
|
|
14769
|
+
if (dir === void 0 || dir === "" || platform === "win32") return "";
|
|
14770
|
+
return `${CLAUDE_CONFIG_DIR_ENV}='${dir.split("'").join(`'"'"'`)}' `;
|
|
14771
|
+
}
|
|
14772
|
+
function hostUpdateCommand(agent, env, platform = process.platform) {
|
|
14773
|
+
const cmd = UPGRADE_HOST_COMMAND[agent];
|
|
14774
|
+
if (agent !== "claude-code") return cmd;
|
|
14775
|
+
const profile = claudeProfileEnv(env, platform);
|
|
14776
|
+
return profile === "" ? cmd : cmd.split(" && ").map((c) => profile + c).join(" && ");
|
|
14777
|
+
}
|
|
14679
14778
|
function opencodeDirOf(env, home) {
|
|
14680
14779
|
const own4 = env[OPENCODE_CONFIG_DIR_ENV];
|
|
14681
14780
|
if (own4 !== void 0 && own4 !== "") return own4;
|
|
@@ -20627,11 +20726,11 @@ function noRuntimeError(lang) {
|
|
|
20627
20726
|
}
|
|
20628
20727
|
|
|
20629
20728
|
// src/core/sandbox/spawn.ts
|
|
20630
|
-
import { spawn } from "node:child_process";
|
|
20729
|
+
import { spawn as spawn2 } from "node:child_process";
|
|
20631
20730
|
import path2 from "node:path";
|
|
20632
20731
|
|
|
20633
20732
|
// src/core/sandbox/kill.ts
|
|
20634
|
-
import {
|
|
20733
|
+
import { spawn } from "node:child_process";
|
|
20635
20734
|
function signalGroup(pid, signal) {
|
|
20636
20735
|
try {
|
|
20637
20736
|
process.kill(-pid, signal);
|
|
@@ -20645,7 +20744,10 @@ function killTree(pid) {
|
|
|
20645
20744
|
return;
|
|
20646
20745
|
}
|
|
20647
20746
|
try {
|
|
20648
|
-
|
|
20747
|
+
const t = spawn("taskkill", ["/F", "/T", "/PID", String(pid)], { stdio: "ignore", windowsHide: true });
|
|
20748
|
+
t.on("error", () => {
|
|
20749
|
+
});
|
|
20750
|
+
t.unref();
|
|
20649
20751
|
} catch {
|
|
20650
20752
|
}
|
|
20651
20753
|
}
|
|
@@ -20664,7 +20766,7 @@ function runProcess(argv, o) {
|
|
|
20664
20766
|
if (start === null) return resolve10(NOT_STARTED);
|
|
20665
20767
|
let child;
|
|
20666
20768
|
try {
|
|
20667
|
-
child =
|
|
20769
|
+
child = spawn2(start[0], start.slice(1), {
|
|
20668
20770
|
cwd: o.cwd,
|
|
20669
20771
|
env: o.env,
|
|
20670
20772
|
stdio: ["pipe", "pipe", "pipe"],
|
|
@@ -20681,8 +20783,14 @@ function runProcess(argv, o) {
|
|
|
20681
20783
|
const stderrChunks = [];
|
|
20682
20784
|
let killedBy = null;
|
|
20683
20785
|
let settled = false;
|
|
20786
|
+
let held = false;
|
|
20787
|
+
let exited = false;
|
|
20788
|
+
let graceTimer;
|
|
20789
|
+
let drainTimer;
|
|
20790
|
+
let stopTimer;
|
|
20684
20791
|
const kill = () => {
|
|
20685
20792
|
if (child.pid !== void 0) killTree(child.pid);
|
|
20793
|
+
if (stopTimer === void 0) stopTimer = setTimeout(() => finishHeld(), KILL_GRACE_MS);
|
|
20686
20794
|
};
|
|
20687
20795
|
const onAbort = () => {
|
|
20688
20796
|
if (killedBy !== null || settled) return;
|
|
@@ -20699,17 +20807,46 @@ function runProcess(argv, o) {
|
|
|
20699
20807
|
if (settled) return;
|
|
20700
20808
|
settled = true;
|
|
20701
20809
|
clearTimeout(timer);
|
|
20810
|
+
clearTimeout(graceTimer);
|
|
20811
|
+
clearTimeout(drainTimer);
|
|
20812
|
+
clearTimeout(stopTimer);
|
|
20702
20813
|
o.signal.removeEventListener("abort", onAbort);
|
|
20703
20814
|
resolve10({
|
|
20704
20815
|
stdout: Buffer.concat(stdoutChunks),
|
|
20705
20816
|
stderr: Buffer.concat(stderrChunks),
|
|
20706
20817
|
exitCode,
|
|
20707
|
-
killed: killedBy
|
|
20818
|
+
killed: killedBy,
|
|
20819
|
+
...held ? { held: true } : {}
|
|
20708
20820
|
});
|
|
20709
20821
|
};
|
|
20710
|
-
|
|
20711
|
-
|
|
20822
|
+
const finishHeld = () => {
|
|
20823
|
+
if (settled) return;
|
|
20824
|
+
held = exited && killedBy === null;
|
|
20825
|
+
child.stdout.destroy();
|
|
20826
|
+
child.stderr.destroy();
|
|
20827
|
+
if (child.pid !== void 0) killTree(child.pid);
|
|
20828
|
+
settle3(child.exitCode);
|
|
20829
|
+
};
|
|
20830
|
+
const bump = () => {
|
|
20831
|
+
if (!exited || settled) return;
|
|
20832
|
+
clearTimeout(graceTimer);
|
|
20833
|
+
graceTimer = setTimeout(finishHeld, PIPE_EOF_GRACE_MS);
|
|
20834
|
+
};
|
|
20835
|
+
child.stdout.on("data", (chunk) => {
|
|
20836
|
+
stdoutChunks.push(chunk);
|
|
20837
|
+
bump();
|
|
20838
|
+
});
|
|
20839
|
+
child.stderr.on("data", (chunk) => {
|
|
20840
|
+
stderrChunks.push(chunk);
|
|
20841
|
+
bump();
|
|
20842
|
+
});
|
|
20712
20843
|
child.on("close", (code) => settle3(code));
|
|
20844
|
+
child.on("exit", () => {
|
|
20845
|
+
if (settled) return;
|
|
20846
|
+
exited = true;
|
|
20847
|
+
graceTimer = setTimeout(finishHeld, PIPE_EOF_GRACE_MS);
|
|
20848
|
+
drainTimer = setTimeout(finishHeld, PIPE_DRAIN_MAX_MS);
|
|
20849
|
+
});
|
|
20713
20850
|
child.on("error", () => settle3(null));
|
|
20714
20851
|
child.stdin.on("error", () => {
|
|
20715
20852
|
});
|
|
@@ -21326,7 +21463,7 @@ var ctxBatch = Object.freeze({
|
|
|
21326
21463
|
});
|
|
21327
21464
|
|
|
21328
21465
|
// src/core/tools/doctor.ts
|
|
21329
|
-
import { readdirSync as readdirSync7, readFileSync as
|
|
21466
|
+
import { readdirSync as readdirSync7, readFileSync as readFileSync16, existsSync as existsSync16 } from "node:fs";
|
|
21330
21467
|
import { basename as basename5, join as join19 } from "node:path";
|
|
21331
21468
|
|
|
21332
21469
|
// src/core/ops/bundle-dir.ts
|
|
@@ -21352,8 +21489,8 @@ function ownBundleDir() {
|
|
|
21352
21489
|
}
|
|
21353
21490
|
|
|
21354
21491
|
// src/core/ops/doctor-config.ts
|
|
21355
|
-
import { existsSync as existsSync9, readdirSync as readdirSync5 } from "node:fs";
|
|
21356
|
-
import { join as join14 } from "node:path";
|
|
21492
|
+
import { existsSync as existsSync9, readdirSync as readdirSync5, readFileSync as readFileSync11 } from "node:fs";
|
|
21493
|
+
import { dirname as dirname8, join as join14 } from "node:path";
|
|
21357
21494
|
|
|
21358
21495
|
// src/core/ops/detect-v1.ts
|
|
21359
21496
|
import { existsSync as existsSync6, opendirSync, readdirSync as readdirSync3, readFileSync as readFileSync8 } from "node:fs";
|
|
@@ -24561,7 +24698,7 @@ function nativeMcpWrong(dir, row5) {
|
|
|
24561
24698
|
}
|
|
24562
24699
|
}
|
|
24563
24700
|
function isOwnOpencodeEntry(entry, key, own4) {
|
|
24564
|
-
const spec = isObject4(entry) ? entry[OPENCODE_PACKAGE_FIELD] : entry;
|
|
24701
|
+
const spec = isObject4(entry) ? entry[OPENCODE_PACKAGE_FIELD] : Array.isArray(entry) ? entry[0] : entry;
|
|
24565
24702
|
if (typeof spec !== "string") return false;
|
|
24566
24703
|
if (spec === OPENCODE_GIT_SPEC || spec.startsWith(OPENCODE_NPM_SPEC_PREFIX) || own4.includes(spec)) return true;
|
|
24567
24704
|
return key === OPENCODE_PLUGINS_KEY && spec === SERVER_KEY;
|
|
@@ -24572,14 +24709,21 @@ function opencodeMcpOwn(entry) {
|
|
|
24572
24709
|
const [node3, script, flag, agent] = cmd;
|
|
24573
24710
|
return isNodeCommand(node3) && typeof script === "string" && lastSegment(script) === SERVER_ENTRY_FILE && flag === AGENT_ARG && agent === "opencode";
|
|
24574
24711
|
}
|
|
24575
|
-
function
|
|
24576
|
-
|
|
24712
|
+
function opencodeFileValue(file2) {
|
|
24713
|
+
if (!existsSync9(file2)) return {};
|
|
24714
|
+
return parseHostConfig("opencode", file2, hostText(readFileSync11(file2, "utf8")), "jsonc");
|
|
24715
|
+
}
|
|
24716
|
+
function opencodeValueListed(value) {
|
|
24577
24717
|
const bundle = opencodePluginFile();
|
|
24578
24718
|
const own4 = [bundle, join14(bundle, ...OPENCODE_PLUGIN_PATH)];
|
|
24579
24719
|
if ([OPENCODE_PLUGIN_KEY, OPENCODE_PLUGINS_KEY].some((key) => list2(isObject4(value) ? value[key] : void 0).some((e) => isOwnOpencodeEntry(e, key, own4)))) return true;
|
|
24580
24720
|
const mcp = isObject4(value) && isObject4(value.mcp) ? value.mcp : {};
|
|
24581
24721
|
return opencodeMcpOwn(mcp[SERVER_KEY]) || isObject4(mcp.servers) && opencodeMcpOwn(mcp.servers[SERVER_KEY]);
|
|
24582
24722
|
}
|
|
24723
|
+
function opencodeListed(file2, worktree) {
|
|
24724
|
+
const dirs = [dirname8(file2), worktree];
|
|
24725
|
+
return dirs.some((dir) => OPENCODE_CONFIG_FILES.some((name) => opencodeValueListed(opencodeFileValue(join14(dir, name)))));
|
|
24726
|
+
}
|
|
24583
24727
|
function mcpWrong(row5, home, env, worktree) {
|
|
24584
24728
|
const native = row5.id === "codex" ? codexNativeDir(env, home) : null;
|
|
24585
24729
|
if (native !== null) return nativeMcpWrong(native, row5);
|
|
@@ -24589,7 +24733,7 @@ function mcpWrong(row5, home, env, worktree) {
|
|
|
24589
24733
|
resolvePluginRoot(row5, env, worktree);
|
|
24590
24734
|
return false;
|
|
24591
24735
|
}
|
|
24592
|
-
if (row5.id === "opencode") return !opencodeListed(file2);
|
|
24736
|
+
if (row5.id === "opencode") return !opencodeListed(file2, worktree);
|
|
24593
24737
|
const cur = readHostConfig(row5.id, file2);
|
|
24594
24738
|
return mergeOwnEntries(row5.id, cur.text, cur.format, row5, { nodePath: true, listEntries: [opencodePluginFile()] }).edits.length > 0;
|
|
24595
24739
|
} catch {
|
|
@@ -24800,7 +24944,7 @@ async function checkIndex(project) {
|
|
|
24800
24944
|
}
|
|
24801
24945
|
|
|
24802
24946
|
// src/core/ops/doctor-env.ts
|
|
24803
|
-
import { existsSync as existsSync11, readFileSync as
|
|
24947
|
+
import { existsSync as existsSync11, readFileSync as readFileSync12, realpathSync as realpathSync6 } from "node:fs";
|
|
24804
24948
|
import { isAbsolute as isAbsolute3, join as join15, relative as relative4 } from "node:path";
|
|
24805
24949
|
function pass3(id, detail = DOCTOR_PASS_DETAIL) {
|
|
24806
24950
|
return { id, label: DOCTOR_LABEL[id], status: "PASS", detail };
|
|
@@ -24811,9 +24955,12 @@ function unknown3(id, detail, fixCommand) {
|
|
|
24811
24955
|
function fail4(id, detail, fixCommand) {
|
|
24812
24956
|
return { id, label: DOCTOR_LABEL[id], status: "FAIL", detail, fixCommand };
|
|
24813
24957
|
}
|
|
24958
|
+
function warn(id, detail, fixCommand) {
|
|
24959
|
+
return { id, label: DOCTOR_LABEL[id], status: "WARN", detail, fixCommand };
|
|
24960
|
+
}
|
|
24814
24961
|
function bundleVersion(bundleDir2) {
|
|
24815
24962
|
try {
|
|
24816
|
-
const v = JSON.parse(
|
|
24963
|
+
const v = JSON.parse(readFileSync12(join15(bundleDir2, D1_PACKAGE_FILE), "utf8")).version;
|
|
24817
24964
|
return typeof v === "string" && v !== "" ? v : void 0;
|
|
24818
24965
|
} catch {
|
|
24819
24966
|
return void 0;
|
|
@@ -24897,20 +25044,21 @@ function highestTag(stdout, tag2) {
|
|
|
24897
25044
|
}
|
|
24898
25045
|
return best;
|
|
24899
25046
|
}
|
|
24900
|
-
function versionRow(head2, installed, tag2, source, latest, tail) {
|
|
25047
|
+
function versionRow(head2, installed, tag2, source, latest, tail, update) {
|
|
24901
25048
|
const cmp = compareVersions(installed, latest) ?? (installed === latest ? 0 : -1);
|
|
24902
25049
|
if (cmp === 0) return pass3("D1", head2 + D1_LATEST_PASS(tag2, source) + tail);
|
|
24903
25050
|
if (cmp > 0) return pass3("D1", head2 + D1_LATEST_AHEAD(tag2, source, latest) + tail);
|
|
24904
|
-
return
|
|
25051
|
+
return warn("D1", head2 + D1_LATEST_UPDATE(tag2, source, latest) + tail, update);
|
|
24905
25052
|
}
|
|
24906
25053
|
async function checkVersion(i) {
|
|
24907
25054
|
if (i.bundleSha === void 0) return unknown3("D1", D1_DEV_BUILD_DETAIL);
|
|
24908
25055
|
const head2 = D1_PREFIX(i.version, i.bundleSha) + ": ";
|
|
24909
25056
|
if (i.version === void 0) return unknown3("D1", head2 + D1_LATEST_UNKNOWN + ", " + D1_NO_VERSION, D1_NPM_CHECK_FIX);
|
|
24910
25057
|
const tag2 = channelOf(i.version);
|
|
25058
|
+
const update = i.updateCommand ?? DOCTOR_FIX_UPGRADE;
|
|
24911
25059
|
const git2 = findRuntime(GIT_BIN, i.env);
|
|
24912
25060
|
const npm = await npmLatest(i.registryUrl, tag2, i.signal, i.timeoutMs);
|
|
24913
|
-
if (npm.ok) return versionRow(head2, i.version, tag2, D1_SOURCE_NPM, npm.version, "");
|
|
25061
|
+
if (npm.ok) return versionRow(head2, i.version, tag2, D1_SOURCE_NPM, npm.version, "", update);
|
|
24914
25062
|
let cause = D1_GIT_MISSING;
|
|
24915
25063
|
if (git2 !== null) {
|
|
24916
25064
|
const r = await runProcess([git2, GIT_LS_REMOTE, ...GIT_LS_REMOTE_TAG_ARGS, RELEASE_REPO_URL, RELEASE_TAG_PATTERN], {
|
|
@@ -24921,7 +25069,7 @@ async function checkVersion(i) {
|
|
|
24921
25069
|
});
|
|
24922
25070
|
if (r.exitCode === 0 && r.killed === null) {
|
|
24923
25071
|
const latest = highestTag(r.stdout.toString("utf8"), tag2);
|
|
24924
|
-
if (latest !== void 0) return versionRow(head2, i.version, tag2, D1_SOURCE_TAGS, latest, D1_CAUSE_JOIN + npm.cause);
|
|
25072
|
+
if (latest !== void 0) return versionRow(head2, i.version, tag2, D1_SOURCE_TAGS, latest, D1_CAUSE_JOIN + npm.cause, update);
|
|
24925
25073
|
cause = D1_GIT_NO_TAG(tag2);
|
|
24926
25074
|
} else {
|
|
24927
25075
|
cause = gitCause(r, i.timeoutMs);
|
|
@@ -24957,10 +25105,11 @@ async function checkNode(i) {
|
|
|
24957
25105
|
if (!await sqliteLoads()) return fail4("D2", withBun(D2_SQLITE_DETAIL), D2_SQLITE_FIX);
|
|
24958
25106
|
return pass3("D2", bun.length === 0 ? DOCTOR_PASS_DETAIL : bun.join(D4_REASON_JOIN));
|
|
24959
25107
|
}
|
|
24960
|
-
function checkMcp(ctx) {
|
|
25108
|
+
function checkMcp(ctx, adapter) {
|
|
24961
25109
|
const named2 = ctx.clientInfo !== void 0 && ctx.clientInfo.name !== "";
|
|
24962
25110
|
const versioned = ctx.protocolVersion !== void 0 && ctx.protocolVersion !== "";
|
|
24963
|
-
|
|
25111
|
+
if (named2 || versioned) return pass3("D6");
|
|
25112
|
+
return adapter?.installMode === "in-process" ? pass3("D6", D6_IN_PROCESS_DETAIL) : unknown3("D6", D6_UNKNOWN_DETAIL);
|
|
24964
25113
|
}
|
|
24965
25114
|
function piCwdInside(worktree, piCwd) {
|
|
24966
25115
|
if (piCwd === void 0 || !existsSync11(piCwd)) return false;
|
|
@@ -24986,7 +25135,7 @@ function checkShell(env) {
|
|
|
24986
25135
|
}
|
|
24987
25136
|
|
|
24988
25137
|
// src/core/ops/doctor-hook.ts
|
|
24989
|
-
import { existsSync as existsSync13, mkdirSync as mkdirSync4, mkdtempSync, readFileSync as
|
|
25138
|
+
import { existsSync as existsSync13, mkdirSync as mkdirSync4, mkdtempSync, readFileSync as readFileSync13, realpathSync as realpathSync8, rmSync as rmSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
24990
25139
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
24991
25140
|
import path7 from "node:path";
|
|
24992
25141
|
|
|
@@ -26814,7 +26963,7 @@ function nodeLaunch(env, host = { bun: process.versions.bun, execPath: process.e
|
|
|
26814
26963
|
import { createHash } from "node:crypto";
|
|
26815
26964
|
import { existsSync as existsSync12, realpathSync as realpathSync7 } from "node:fs";
|
|
26816
26965
|
import path6 from "node:path";
|
|
26817
|
-
import { spawn as
|
|
26966
|
+
import { spawn as spawn3, spawnSync as spawnSync2 } from "node:child_process";
|
|
26818
26967
|
|
|
26819
26968
|
// src/setup/spawn-bin.ts
|
|
26820
26969
|
import { spawnSync } from "node:child_process";
|
|
@@ -26939,7 +27088,7 @@ function askPluginHooks(env, pluginId, cwd) {
|
|
|
26939
27088
|
resolve10({ kind: "silent" });
|
|
26940
27089
|
return;
|
|
26941
27090
|
}
|
|
26942
|
-
const child =
|
|
27091
|
+
const child = spawn3(f.command, f.args, { env, cwd, stdio: ["pipe", "pipe", "ignore"], windowsVerbatimArguments: f.windowsVerbatimArguments, windowsHide: true });
|
|
26943
27092
|
let buf = "";
|
|
26944
27093
|
let done = false;
|
|
26945
27094
|
let exited = false;
|
|
@@ -27038,7 +27187,7 @@ function loadFixture(bundleDir2, agent) {
|
|
|
27038
27187
|
if (!existsSync13(file2)) return { cause: D5_FIXTURE_FILE_ABSENT(file2) };
|
|
27039
27188
|
let all;
|
|
27040
27189
|
try {
|
|
27041
|
-
all = JSON.parse(hostText(
|
|
27190
|
+
all = JSON.parse(hostText(readFileSync13(file2, "utf8")));
|
|
27042
27191
|
} catch (err) {
|
|
27043
27192
|
return { cause: D5_FIXTURE_PARSE(file2, err instanceof Error ? err.message : String(err)) };
|
|
27044
27193
|
}
|
|
@@ -27306,10 +27455,10 @@ async function checkHookRoundTrip(i) {
|
|
|
27306
27455
|
|
|
27307
27456
|
// src/core/ops/db-heal.ts
|
|
27308
27457
|
import { existsSync as existsSync14, mkdirSync as mkdirSync6, rmSync as rmSync4 } from "node:fs";
|
|
27309
|
-
import { basename as basename4, dirname as
|
|
27458
|
+
import { basename as basename4, dirname as dirname9, join as join17 } from "node:path";
|
|
27310
27459
|
|
|
27311
27460
|
// src/core/store/owners.ts
|
|
27312
|
-
import { mkdirSync as mkdirSync5, readdirSync as readdirSync6, readFileSync as
|
|
27461
|
+
import { mkdirSync as mkdirSync5, readdirSync as readdirSync6, readFileSync as readFileSync14, rmSync as rmSync3, writeFileSync as writeFileSync3 } from "node:fs";
|
|
27313
27462
|
import { basename as basename3, join as join16 } from "node:path";
|
|
27314
27463
|
function ownersDir(configDir, projectKey) {
|
|
27315
27464
|
return join16(configDir, PROJECTS_DIR_NAME, projectKey, OWNERS_DIR_NAME);
|
|
@@ -27353,7 +27502,7 @@ function listLiveOwners(configDir, projectKey) {
|
|
|
27353
27502
|
const file2 = join16(dir, name);
|
|
27354
27503
|
let text;
|
|
27355
27504
|
try {
|
|
27356
|
-
text =
|
|
27505
|
+
text = readFileSync14(file2, "utf8");
|
|
27357
27506
|
} catch (err) {
|
|
27358
27507
|
if (errCode2(err) === "ENOENT") continue;
|
|
27359
27508
|
throw err;
|
|
@@ -27437,7 +27586,7 @@ async function healOrphan(project, files, row5) {
|
|
|
27437
27586
|
const moved = [];
|
|
27438
27587
|
let dir = "";
|
|
27439
27588
|
try {
|
|
27440
|
-
dir = makeOrphanDir(
|
|
27589
|
+
dir = makeOrphanDir(dirname9(project.dbPath));
|
|
27441
27590
|
for (const f of files) {
|
|
27442
27591
|
const to = join17(dir, basename4(f.path));
|
|
27443
27592
|
renameWithRetry(f.path, to);
|
|
@@ -27504,9 +27653,40 @@ function buildReportHead(input) {
|
|
|
27504
27653
|
return lines.concat(tail).join("\n");
|
|
27505
27654
|
}
|
|
27506
27655
|
|
|
27656
|
+
// src/core/ops/unsupported-host.ts
|
|
27657
|
+
var SUPPORTED_AGENTS_LINE = `Supported agents: ${AGENT_IDS.join(", ")} (${SUPPORTED_AGENTS_DOCS_URL}).`;
|
|
27658
|
+
function UNSUPPORTED_HOST_LINE(name) {
|
|
27659
|
+
return `${name} is not a supported host today. The MCP server runs here; hooks are not checked. ${SUPPORTED_AGENTS_LINE}`;
|
|
27660
|
+
}
|
|
27661
|
+
function segmentsOf(dir) {
|
|
27662
|
+
let parts = [dir];
|
|
27663
|
+
for (const sep5 of V1_PATH_SEPS) parts = parts.flatMap((p) => p.split(sep5));
|
|
27664
|
+
return parts;
|
|
27665
|
+
}
|
|
27666
|
+
function hasRun(parts, run) {
|
|
27667
|
+
for (let i = 0; i + run.length <= parts.length; i++) if (run.every((seg, k) => parts[i + k] === seg)) return true;
|
|
27668
|
+
return false;
|
|
27669
|
+
}
|
|
27670
|
+
function unsupportedHostOf(sig) {
|
|
27671
|
+
if (sig.clientName !== void 0 && sig.clientName !== "") {
|
|
27672
|
+
const n = sig.clientName.toLowerCase();
|
|
27673
|
+
const hit = UNSUPPORTED_HOSTS.find((h) => h.clientNames.includes(n));
|
|
27674
|
+
if (hit !== void 0) return hit;
|
|
27675
|
+
}
|
|
27676
|
+
if (sig.bundleDir !== void 0) {
|
|
27677
|
+
const parts = segmentsOf(sig.bundleDir);
|
|
27678
|
+
const hit = UNSUPPORTED_HOSTS.find((h) => h.pluginPaths.some((p) => hasRun(parts, p)));
|
|
27679
|
+
if (hit !== void 0) return hit;
|
|
27680
|
+
}
|
|
27681
|
+
if (sig.clientName !== void 0 && sig.clientName !== "") return void 0;
|
|
27682
|
+
const env = sig.env;
|
|
27683
|
+
if (env === void 0) return void 0;
|
|
27684
|
+
return UNSUPPORTED_HOSTS.find((h) => h.envVars.some((v) => env[v] !== void 0 && env[v] !== ""));
|
|
27685
|
+
}
|
|
27686
|
+
|
|
27507
27687
|
// src/core/ops/doctor-issue.ts
|
|
27508
27688
|
import { spawnSync as spawnSync3 } from "node:child_process";
|
|
27509
|
-
import { closeSync as closeSync2, existsSync as existsSync15, fstatSync, mkdirSync as mkdirSync7, openSync as openSync2, readFileSync as
|
|
27689
|
+
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";
|
|
27510
27690
|
import { delimiter, join as join18 } from "node:path";
|
|
27511
27691
|
var TOKEN_PREFIXES = ["ghp_", "gho_", "github_pat_", "sk-", "xoxb-", "AKIA"];
|
|
27512
27692
|
function tildeOf(env) {
|
|
@@ -27609,7 +27789,7 @@ function agentConfig(adapter, env, worktree) {
|
|
|
27609
27789
|
}
|
|
27610
27790
|
let text = "";
|
|
27611
27791
|
try {
|
|
27612
|
-
text =
|
|
27792
|
+
text = readFileSync15(f.path, "utf8");
|
|
27613
27793
|
} catch (err) {
|
|
27614
27794
|
out.push(`${f.label}: ${f.path} (read: ${err instanceof Error ? err.message : String(err)})`);
|
|
27615
27795
|
continue;
|
|
@@ -27623,12 +27803,13 @@ function agentConfig(adapter, env, worktree) {
|
|
|
27623
27803
|
function failing(rows) {
|
|
27624
27804
|
return rows.filter((r) => r.status === "FAIL");
|
|
27625
27805
|
}
|
|
27626
|
-
function issueTitle(agent, rows) {
|
|
27627
|
-
return `ctx_doctor ${agent}: ${failing(rows).map((r) => `${r.id} ${r.label}`).join(", ")} FAIL`;
|
|
27806
|
+
function issueTitle(agent, rows, other) {
|
|
27807
|
+
return `ctx_doctor ${agent}${other === void 0 ? "" : ` (${other.name} is not a supported host today)`}: ${failing(rows).map((r) => `${r.id} ${r.label}`).join(", ")} FAIL`;
|
|
27628
27808
|
}
|
|
27629
|
-
function summaryOf(agent, rows) {
|
|
27809
|
+
function summaryOf(agent, rows, other) {
|
|
27630
27810
|
const f = failing(rows)[0];
|
|
27631
|
-
|
|
27811
|
+
const tag2 = other === void 0 ? "" : `${other.name} is not a supported host today. `;
|
|
27812
|
+
return tag2 + (f === void 0 ? `ctx_doctor ${agent}` : `${f.id} ${f.label} FAIL on ${agent}: ${f.detail}`);
|
|
27632
27813
|
}
|
|
27633
27814
|
async function buildIssueBody(i) {
|
|
27634
27815
|
const tilde = tildeOf(i.env);
|
|
@@ -27638,7 +27819,7 @@ async function buildIssueBody(i) {
|
|
|
27638
27819
|
const envNames = DOCTOR_ENV_NAMES.map((n) => i.env[n] === void 0 ? `${n} (unset)` : `${n}=${i.env[n]}`);
|
|
27639
27820
|
const pathTools = DOCTOR_PATH_TOOLS.map((t) => `PATH holds ${t}: ${onPath(i.env, t).join(", ") || "(absent)"}`);
|
|
27640
27821
|
const sections = {
|
|
27641
|
-
"Summary": [summaryOf(agent, i.rows)],
|
|
27822
|
+
"Summary": [summaryOf(agent, i.rows, i.unsupported)],
|
|
27642
27823
|
"ctx-report": [i.table],
|
|
27643
27824
|
"What happened": [
|
|
27644
27825
|
"Rows that need a look:",
|
|
@@ -27684,9 +27865,9 @@ async function writeIssueReport(i) {
|
|
|
27684
27865
|
const file2 = join18(dir, `${DOCTOR_REPORT_FILE_PREFIX}${(/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-")}.md`);
|
|
27685
27866
|
writeFileSync4(file2, body);
|
|
27686
27867
|
const shown2 = tilde(file2);
|
|
27687
|
-
const title = issueTitle(i.adapter.id, i.rows);
|
|
27868
|
+
const title = issueTitle(i.adapter.id, i.rows, i.unsupported);
|
|
27688
27869
|
const gh = [`gh issue create --repo ${ISSUE_REPO_SLUG} --label bug \\`, `${DOCTOR_GH_NEXT}title ${JSON.stringify(title)} \\`, `${DOCTOR_GH_NEXT}body-file ${shown2}`];
|
|
27689
|
-
return [DOCTOR_REPORT_LINE + shown2, DOCTOR_GH_LINE + gh[0], gh[1], gh[2], DOCTOR_URL_LINE + formUrl(title, summaryOf(i.adapter.id, i.rows)), DOCTOR_RULES_LINE + ISSUE_GUIDE_URL];
|
|
27870
|
+
return [DOCTOR_REPORT_LINE + shown2, DOCTOR_GH_LINE + gh[0], gh[1], gh[2], DOCTOR_URL_LINE + formUrl(title, summaryOf(i.adapter.id, i.rows, i.unsupported)), DOCTOR_RULES_LINE + ISSUE_GUIDE_URL];
|
|
27690
27871
|
}
|
|
27691
27872
|
function formUrl(title, summary) {
|
|
27692
27873
|
const base = `${ISSUE_FORM_URL}&title=${encodeURIComponent(title)}`;
|
|
@@ -27715,6 +27896,12 @@ async function codexDb(ctx, adapter) {
|
|
|
27715
27896
|
return null;
|
|
27716
27897
|
}
|
|
27717
27898
|
}
|
|
27899
|
+
function d1UpdateCommand(agent, env, other) {
|
|
27900
|
+
return other === void 0 ? hostUpdateCommand(agent, env) : UNSUPPORTED_HOST_LINE(other.name);
|
|
27901
|
+
}
|
|
27902
|
+
function unsupportedRow(id, h) {
|
|
27903
|
+
return { id, label: DOCTOR_LABEL[id], status: "WARN", detail: UNSUPPORTED_HOST_LINE(h.name) };
|
|
27904
|
+
}
|
|
27718
27905
|
async function hookRow(ctx, adapter, host) {
|
|
27719
27906
|
const db = await codexDb(ctx, adapter);
|
|
27720
27907
|
const runStart = Date.now();
|
|
@@ -27742,7 +27929,7 @@ function ownServerId(configDir, projectKey) {
|
|
|
27742
27929
|
if (!existsSync16(dir)) return "";
|
|
27743
27930
|
for (const name of readdirSync7(dir)) {
|
|
27744
27931
|
if (!name.endsWith(OWNER_PID_EXT)) continue;
|
|
27745
|
-
if (
|
|
27932
|
+
if (readFileSync16(join19(dir, name), "utf8").trim() === String(process.pid)) return basename5(name, OWNER_PID_EXT);
|
|
27746
27933
|
}
|
|
27747
27934
|
return "";
|
|
27748
27935
|
}
|
|
@@ -27750,16 +27937,18 @@ async function runDoctorChecks(ctx, adapter, host0) {
|
|
|
27750
27937
|
const host = adapter.id === "codex" ? { ...host0, env: { ...host0.env, CODEX_HOME: codexRunDirOf(host0.env, homeDirOf(host0.env) ?? "", host0.bundleDir) } } : host0;
|
|
27751
27938
|
const env = host.env;
|
|
27752
27939
|
const project = ctx.project;
|
|
27940
|
+
const other = adapter.installMode === "in-process" ? void 0 : unsupportedHostOf({ clientName: ctx.clientInfo?.name, bundleDir: host.bundleDir, env });
|
|
27753
27941
|
let integrityFailed = false;
|
|
27754
27942
|
let orphan = [];
|
|
27755
27943
|
const checks = {
|
|
27756
|
-
D1: () => checkVersion({ bundleSha: BUNDLE_SHA, version: bundleVersion(host.bundleDir), registryUrl: D1_REGISTRY_URL, timeoutMs: DOCTOR_GIT_TIMEOUT_MS, env: buildChildEnv(env), cwd: project.worktree, signal: ctx.signal }),
|
|
27944
|
+
D1: () => checkVersion({ bundleSha: BUNDLE_SHA, version: bundleVersion(host.bundleDir), registryUrl: D1_REGISTRY_URL, timeoutMs: DOCTOR_GIT_TIMEOUT_MS, env: buildChildEnv(env), cwd: project.worktree, signal: ctx.signal, updateCommand: d1UpdateCommand(adapter.id, env, other) }),
|
|
27757
27945
|
D2: () => checkNode({ nodeVersion: process.version, bunVersion: process.versions.bun }),
|
|
27758
|
-
D3: () => checkHostConfig(adapter, env, project.worktree),
|
|
27946
|
+
D3: () => other !== void 0 ? unsupportedRow("D3", other) : checkHostConfig(adapter, env, project.worktree),
|
|
27947
|
+
// D-UNSUPPORTED-HOSTS-1
|
|
27759
27948
|
D4: () => checkV1Leftovers(adapter.id, requireHomeDir(env), { project: project.worktree, piAgentDir: piAgentDirOf(env, requireHomeDir(env)), claudeDir: claudeDirOf(env, requireHomeDir(env)), codexDir: codexDirOf(env, requireHomeDir(env)), geminiDir: geminiDirOf(env, requireHomeDir(env)), copilotDir: copilotDirOf(env, requireHomeDir(env)), kiroDir: kiroDirOf(env, requireHomeDir(env)), opencodeDir: opencodeDirOf(env, requireHomeDir(env)) }),
|
|
27760
|
-
D5: () => hookRow(ctx, adapter, host),
|
|
27949
|
+
D5: () => other !== void 0 ? unsupportedRow("D5", other) : hookRow(ctx, adapter, host),
|
|
27761
27950
|
D5b: () => checkDoubleFire(adapter.id, project.worktree),
|
|
27762
|
-
D6: () => checkMcp(ctx),
|
|
27951
|
+
D6: () => checkMcp(ctx, adapter),
|
|
27763
27952
|
D7: () => checkProject({ project, adapter, piCwd: host.piCwd }),
|
|
27764
27953
|
D8: async () => {
|
|
27765
27954
|
const r = await checkDb(project);
|
|
@@ -27806,7 +27995,7 @@ async function doctorReply(ctx, host) {
|
|
|
27806
27995
|
let notes = [];
|
|
27807
27996
|
if (failed) {
|
|
27808
27997
|
try {
|
|
27809
|
-
notes = await writeIssueReport({ ctx, adapter, env: host.env, bundleDir: host.bundleDir, rows, envLine: envLine2, table: table3 });
|
|
27998
|
+
notes = await writeIssueReport({ unsupported: adapter.installMode === "in-process" ? void 0 : unsupportedHostOf({ clientName: ctx.clientInfo?.name, bundleDir: host.bundleDir, env: host.env }), ctx, adapter, env: host.env, bundleDir: host.bundleDir, rows, envLine: envLine2, table: table3 });
|
|
27810
27999
|
} catch (err) {
|
|
27811
28000
|
notes = [`Report file: ${lineOf2(err)}`];
|
|
27812
28001
|
}
|
|
@@ -27840,7 +28029,7 @@ var ctxDoctor = Object.freeze({
|
|
|
27840
28029
|
// src/core/tools/execute.ts
|
|
27841
28030
|
import { existsSync as existsSync17, mkdtempSync as mkdtempSync2, rmSync as rmSync5, writeFileSync as writeFileSync5 } from "node:fs";
|
|
27842
28031
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
27843
|
-
import { dirname as
|
|
28032
|
+
import { dirname as dirname11, join as join20, parse as parse3, resolve as resolve8 } from "node:path";
|
|
27844
28033
|
|
|
27845
28034
|
// src/core/sandbox/win-build.ts
|
|
27846
28035
|
var SEPARATORS2 = ";&|(\n";
|
|
@@ -27923,7 +28112,7 @@ function schemaLine(issue4) {
|
|
|
27923
28112
|
}
|
|
27924
28113
|
function fileError(given, abs, root) {
|
|
27925
28114
|
let dir = abs;
|
|
27926
|
-
while (!existsSync17(dir) &&
|
|
28115
|
+
while (!existsSync17(dir) && dirname11(dir) !== dir) dir = dirname11(dir);
|
|
27927
28116
|
if (isInside(root, dir)) return null;
|
|
27928
28117
|
return new CtxError("OUTSIDE_ROOT", { p: given, root }).toLine();
|
|
27929
28118
|
}
|
|
@@ -27957,7 +28146,7 @@ function spawnFailed(argv0, cwd) {
|
|
|
27957
28146
|
}
|
|
27958
28147
|
async function finish(input, ctx, r, exitCode, journal) {
|
|
27959
28148
|
const isError = exitCode !== 0 && !(input.language === "shell" && exitCode === SOFT_EXIT && r.stderr.length === 0);
|
|
27960
|
-
const combined = r.stdout.toString("utf8") + (exitCode !== 0 ? r.stderr.toString("utf8") : "");
|
|
28149
|
+
const combined = r.stdout.toString("utf8") + (exitCode !== 0 ? r.stderr.toString("utf8") : "") + (r.held === true ? "\n" + BACKGROUND_HOLD_NOTE + "\n" : "");
|
|
27961
28150
|
const fullBytes = Buffer.byteLength(combined, "utf8");
|
|
27962
28151
|
const head2 = summaryLine(exitCode, fullBytes);
|
|
27963
28152
|
const intent = input.intent ?? "";
|
|
@@ -28041,11 +28230,11 @@ var ctxExecute = {
|
|
|
28041
28230
|
};
|
|
28042
28231
|
|
|
28043
28232
|
// src/core/tools/index.ts
|
|
28044
|
-
import { existsSync as existsSync18, readFileSync as
|
|
28045
|
-
import { dirname as
|
|
28233
|
+
import { existsSync as existsSync18, readFileSync as readFileSync18, statSync as statSync8 } from "node:fs";
|
|
28234
|
+
import { dirname as dirname12, extname as extname3, join as join22, relative as relative5, resolve as resolve9 } from "node:path";
|
|
28046
28235
|
|
|
28047
28236
|
// src/core/index/walk.ts
|
|
28048
|
-
import { readdirSync as readdirSync8, readFileSync as
|
|
28237
|
+
import { readdirSync as readdirSync8, readFileSync as readFileSync17, realpathSync as realpathSync10, statSync as statSync7 } from "node:fs";
|
|
28049
28238
|
import { join as join21 } from "node:path";
|
|
28050
28239
|
var GITIGNORE = ".gitignore";
|
|
28051
28240
|
var GIT_DIR = ".git";
|
|
@@ -28107,7 +28296,7 @@ function compareFound(a, b) {
|
|
|
28107
28296
|
function readRules(file2, base) {
|
|
28108
28297
|
let body;
|
|
28109
28298
|
try {
|
|
28110
|
-
body =
|
|
28299
|
+
body = readFileSync17(file2, "utf8");
|
|
28111
28300
|
} catch {
|
|
28112
28301
|
return [];
|
|
28113
28302
|
}
|
|
@@ -32235,14 +32424,14 @@ function kindOfType(contentType) {
|
|
|
32235
32424
|
}
|
|
32236
32425
|
function readUtf8(absPath) {
|
|
32237
32426
|
try {
|
|
32238
|
-
return utf8.decode(
|
|
32427
|
+
return utf8.decode(readFileSync18(absPath));
|
|
32239
32428
|
} catch {
|
|
32240
32429
|
return void 0;
|
|
32241
32430
|
}
|
|
32242
32431
|
}
|
|
32243
32432
|
function missingOrOutside(given, abs, root) {
|
|
32244
32433
|
let dir = abs;
|
|
32245
|
-
while (!existsSync18(dir) &&
|
|
32434
|
+
while (!existsSync18(dir) && dirname12(dir) !== dir) dir = dirname12(dir);
|
|
32246
32435
|
if (dir !== abs && isInside(root, dir)) return new CtxError("INVALID_ARGS", { field: "path", action: "pass an existing file or folder" });
|
|
32247
32436
|
return new CtxError("OUTSIDE_ROOT", { p: given, root });
|
|
32248
32437
|
}
|
|
@@ -32793,7 +32982,7 @@ var ctxStats = Object.freeze({
|
|
|
32793
32982
|
|
|
32794
32983
|
// src/core/ops/host-write.ts
|
|
32795
32984
|
import { copyFileSync, existsSync as existsSync19, mkdirSync as mkdirSync8, writeFileSync as writeFileSync6 } from "node:fs";
|
|
32796
|
-
import { dirname as
|
|
32985
|
+
import { dirname as dirname13, join as join23 } from "node:path";
|
|
32797
32986
|
function defaultWrite(file2, text) {
|
|
32798
32987
|
writeFileSync6(file2, text, "utf8");
|
|
32799
32988
|
}
|
|
@@ -32825,7 +33014,7 @@ function writeWithRollback(file2, text, write2, atomic) {
|
|
|
32825
33014
|
const trash = file2 + UPGRADE_TRASH_SUFFIX;
|
|
32826
33015
|
const tmp = `${file2}${HOST_CONFIG_TMP_SUFFIX}.${process.pid}`;
|
|
32827
33016
|
const had = existsSync19(file2);
|
|
32828
|
-
mkdirSync8(
|
|
33017
|
+
mkdirSync8(dirname13(file2), { recursive: true });
|
|
32829
33018
|
if (had) copyFileSync(file2, trash);
|
|
32830
33019
|
try {
|
|
32831
33020
|
write2(tmp, text);
|
|
@@ -32992,7 +33181,7 @@ function runUninstall(input) {
|
|
|
32992
33181
|
}
|
|
32993
33182
|
|
|
32994
33183
|
// src/core/ops/v1-remove.ts
|
|
32995
|
-
import { copyFileSync as copyFileSync2, existsSync as existsSync21, readFileSync as
|
|
33184
|
+
import { copyFileSync as copyFileSync2, existsSync as existsSync21, readFileSync as readFileSync19, rmSync as rmSync7 } from "node:fs";
|
|
32996
33185
|
var isObj4 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
32997
33186
|
var areaOf = (f) => f.path === "" ? f.file : f.file + UPGRADE_AREA_KEY_SEP + f.path;
|
|
32998
33187
|
var row3 = (f, after) => ({ area: areaOf(f), before: f.reason, after });
|
|
@@ -33043,8 +33232,8 @@ function locate(doc, path8) {
|
|
|
33043
33232
|
return null;
|
|
33044
33233
|
}
|
|
33045
33234
|
function stripJsonEntries(agent, file2, findings, kept, undo) {
|
|
33046
|
-
const layout = hostLayout(
|
|
33047
|
-
const text = hostText(
|
|
33235
|
+
const layout = hostLayout(readFileSync19(file2, "utf8"));
|
|
33236
|
+
const text = hostText(readFileSync19(file2, "utf8"));
|
|
33048
33237
|
const doc = parseHostConfig(agent, file2, text, "jsonc");
|
|
33049
33238
|
const hit = /* @__PURE__ */ new Set();
|
|
33050
33239
|
const byContainer = /* @__PURE__ */ new Map();
|
|
@@ -33094,7 +33283,7 @@ function removeV1(agent, findings, project) {
|
|
|
33094
33283
|
continue;
|
|
33095
33284
|
}
|
|
33096
33285
|
if (file2.endsWith(TOML_EXT)) {
|
|
33097
|
-
const rawToml =
|
|
33286
|
+
const rawToml = readFileSync19(file2, "utf8");
|
|
33098
33287
|
const tomlLayout = hostLayout(rawToml);
|
|
33099
33288
|
let text = hostText(rawToml);
|
|
33100
33289
|
for (const f of list4) {
|
|
@@ -33152,8 +33341,8 @@ function pluginRootRow(adapter, env) {
|
|
|
33152
33341
|
}
|
|
33153
33342
|
return root === own4 ? [] : [row4(UPGRADE_PLUGIN_ROOT_AREA, root, own4)];
|
|
33154
33343
|
}
|
|
33155
|
-
function hostRow(adapter) {
|
|
33156
|
-
return row4(UPGRADE_HOST_AREA, "",
|
|
33344
|
+
function hostRow(adapter, env) {
|
|
33345
|
+
return row4(UPGRADE_HOST_AREA, "", hostUpdateCommand(adapter.id, env));
|
|
33157
33346
|
}
|
|
33158
33347
|
function upgrade(adapter, deps, home) {
|
|
33159
33348
|
let removal = null;
|
|
@@ -33161,7 +33350,7 @@ function upgrade(adapter, deps, home) {
|
|
|
33161
33350
|
const step5 = regenerateHostConfig(adapter, home, { env: deps.env, write: deps.write });
|
|
33162
33351
|
const findings = detectV1(adapter.id, home, { project: deps.project.worktree, piAgentDir: piAgentDirOf(deps.env, home), claudeDir: claudeDirOf(deps.env, home), geminiDir: geminiDirOf(deps.env, home), copilotDir: copilotDirOf(deps.env, home), kiroDir: kiroDirOf(deps.env, home), opencodeDir: opencodeDirOf(deps.env, home) });
|
|
33163
33352
|
removal = removeV1(adapter.id, findings, deps.project.worktree);
|
|
33164
|
-
const rows = [hostRow(adapter), ...step5, ...removal.rows];
|
|
33353
|
+
const rows = [hostRow(adapter, deps.env), ...step5, ...removal.rows];
|
|
33165
33354
|
removal.commit();
|
|
33166
33355
|
return rows;
|
|
33167
33356
|
} catch (err) {
|
|
@@ -33254,7 +33443,7 @@ function checkCall(tool, input) {
|
|
|
33254
33443
|
// src/entries/server.ts
|
|
33255
33444
|
import { randomUUID } from "node:crypto";
|
|
33256
33445
|
import { existsSync as existsSync23, realpathSync as realpathSync12, rmSync as rmSync9 } from "node:fs";
|
|
33257
|
-
import { dirname as
|
|
33446
|
+
import { dirname as dirname14, join as join26 } from "node:path";
|
|
33258
33447
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
33259
33448
|
|
|
33260
33449
|
// node_modules/@modelcontextprotocol/server/dist/chunk-Br0eD_fh.mjs
|
|
@@ -50851,7 +51040,7 @@ var PROPERTY_KEYS_BY_TYPE = {
|
|
|
50851
51040
|
array: shapeKeys([UntitledMultiSelectEnumSchemaSchema, TitledMultiSelectEnumSchemaSchema])
|
|
50852
51041
|
};
|
|
50853
51042
|
var SUPPORTED_STRING_FORMATS = new Set(StringSchemaSchema.shape.format.unwrap().options);
|
|
50854
|
-
function walkProperty(node3, path8, vendor,
|
|
51043
|
+
function walkProperty(node3, path8, vendor, unsupported2) {
|
|
50855
51044
|
if (!isJsonObject(node3)) return node3;
|
|
50856
51045
|
const allowedKeys = typeof node3.type === "string" && Object.hasOwn(PROPERTY_KEYS_BY_TYPE, node3.type) ? PROPERTY_KEYS_BY_TYPE[node3.type] : void 0;
|
|
50857
51046
|
if (allowedKeys === void 0) return node3;
|
|
@@ -50859,17 +51048,17 @@ function walkProperty(node3, path8, vendor, unsupported) {
|
|
|
50859
51048
|
for (const [key, value] of Object.entries(node3)) if (allowedKeys.has(key) || isAnnotationOnlyJsonSchemaKeyword(key)) pruned[key] = value;
|
|
50860
51049
|
else if (key === "pattern" && node3.type === "string" && typeof node3.format === "string") {
|
|
50861
51050
|
if (!SUPPORTED_STRING_FORMATS.has(node3.format)) pruned[key] = value;
|
|
50862
|
-
else if (typeof value !== "string" || !isLibraryFormatPattern(node3.format, value, vendor))
|
|
50863
|
-
} else
|
|
51051
|
+
else if (typeof value !== "string" || !isLibraryFormatPattern(node3.format, value, vendor)) unsupported2.push(`${path8}.${key}`);
|
|
51052
|
+
} else unsupported2.push(`${path8}.${key}`);
|
|
50864
51053
|
return pruned;
|
|
50865
51054
|
}
|
|
50866
51055
|
function walkRequestedSchema(converted, vendor) {
|
|
50867
51056
|
const pruned = {};
|
|
50868
|
-
const
|
|
50869
|
-
for (const [key, value] of Object.entries(converted)) if (key === "properties" && isJsonObject(value)) pruned[key] = Object.fromEntries(Object.entries(value).map(([name, node3]) => [name, walkProperty(node3, `properties.${name}`, vendor,
|
|
51057
|
+
const unsupported2 = [];
|
|
51058
|
+
for (const [key, value] of Object.entries(converted)) if (key === "properties" && isJsonObject(value)) pruned[key] = Object.fromEntries(Object.entries(value).map(([name, node3]) => [name, walkProperty(node3, `properties.${name}`, vendor, unsupported2)]));
|
|
50870
51059
|
else if (ROOT_KEYS.has(key)) pruned[key] = value;
|
|
50871
|
-
else if (!isAnnotationOnlyJsonSchemaKeyword(key))
|
|
50872
|
-
if (
|
|
51060
|
+
else if (!isAnnotationOnlyJsonSchemaKeyword(key)) unsupported2.push(key);
|
|
51061
|
+
if (unsupported2.length > 0) throw new ProtocolError(ProtocolErrorCode.InvalidParams, `Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${unsupported2.join(", ")}`);
|
|
50873
51062
|
return pruned;
|
|
50874
51063
|
}
|
|
50875
51064
|
function describeUnsupportedProperties(pruned, fallback) {
|
|
@@ -61516,7 +61705,7 @@ function workspaceCwdOf(meta3, spawnCwd, script) {
|
|
|
61516
61705
|
const fromHost = workspaceFromMeta(meta3);
|
|
61517
61706
|
if (fromHost !== void 0) return fromHost;
|
|
61518
61707
|
if (script === void 0 || script === "") return spawnCwd;
|
|
61519
|
-
return realOrSame(spawnCwd) === realOrSame(
|
|
61708
|
+
return realOrSame(spawnCwd) === realOrSame(dirname14(script)) ? "" : spawnCwd;
|
|
61520
61709
|
}
|
|
61521
61710
|
function errorReply(err) {
|
|
61522
61711
|
if (err instanceof CtxError) return { text: err.toLine(), isError: true, sandboxBytes: 0 };
|