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/opencode/plugin.js
CHANGED
|
@@ -188,6 +188,8 @@ var RRF_K = 60;
|
|
|
188
188
|
var SOURCE_HANDLE_MAX_DIGITS = 10;
|
|
189
189
|
var EXEC_TIMEOUT_MS = 6e5;
|
|
190
190
|
var KILL_GRACE_MS = 1e3;
|
|
191
|
+
var PIPE_EOF_GRACE_MS = 250;
|
|
192
|
+
var PIPE_DRAIN_MAX_MS = 2e3;
|
|
191
193
|
var DB_TIMEOUT_MS = 5e3;
|
|
192
194
|
var DB_WAL_SUFFIX = "-wal";
|
|
193
195
|
var DB_SHM_SUFFIX = "-shm";
|
|
@@ -217,6 +219,7 @@ var SHELL_FAMILY = Object.freeze(["sh", "bash", "zsh", "dash", "ksh", "fish"]);
|
|
|
217
219
|
var PATHEXT_DEFAULT = ".COM;.EXE;.BAT;.CMD";
|
|
218
220
|
var FETCH_MAX_HOPS = 5;
|
|
219
221
|
var SOURCE_LABEL_MAX_CHARS = 80;
|
|
222
|
+
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.";
|
|
220
223
|
var CANCELLED_LINE = "Cancelled.";
|
|
221
224
|
var BACKGROUND_REPLY_PREFIX = "started in background, pid ";
|
|
222
225
|
var PLAIN_OUTPUT_ENV = Object.freeze({ NO_COLOR: "1", FORCE_COLOR: "0" });
|
|
@@ -465,7 +468,7 @@ var DECISION_ANSWERS_KEY = "answers";
|
|
|
465
468
|
var DECISION_OPTION_KEY = "option";
|
|
466
469
|
var DECISION_LABEL_JOIN = " | ";
|
|
467
470
|
var RELEASE_REPO_URL = "https://github.com/mksglu/context-mode.git";
|
|
468
|
-
var BUNDLE_SHA = true ? "
|
|
471
|
+
var BUNDLE_SHA = true ? "5539b632975049a99de986448417a10bd246e506" : void 0;
|
|
469
472
|
var DOCTOR_CHECK_ORDER = Object.freeze(["D1", "D2", "D3", "D4", "D5", "D5b", "D6", "D7", "D8", "D9", "D10", "D11"]);
|
|
470
473
|
var DOCTOR_LABEL = Object.freeze({
|
|
471
474
|
D1: "version",
|
|
@@ -571,6 +574,7 @@ var D5B_FIX = "disable chat.useClaudeHooks or the Claude Code hooks block";
|
|
|
571
574
|
var VSCODE_CLAUDE_HOOKS_SETTING = "chat.useClaudeHooks";
|
|
572
575
|
var VSCODE_SETTINGS_FILE = "settings.json";
|
|
573
576
|
var D6_UNKNOWN_DETAIL = "no clientInfo or protocolVersion on the request";
|
|
577
|
+
var D6_IN_PROCESS_DETAIL = "in-process plugin: this call ran inside the agent, no MCP session to read";
|
|
574
578
|
function D7_DETAIL(got) {
|
|
575
579
|
return `resolved project source ${got} does not match the host's actual cwd`;
|
|
576
580
|
}
|
|
@@ -682,6 +686,90 @@ function D3_DETAIL(parts) {
|
|
|
682
686
|
function D3_ROOT_DETAIL(paths) {
|
|
683
687
|
return `pick one install for this project: ${paths.join(D3_PART_JOIN)}`;
|
|
684
688
|
}
|
|
689
|
+
var unsupported = (h) => Object.freeze(h);
|
|
690
|
+
var UNSUPPORTED_HOSTS = Object.freeze([
|
|
691
|
+
unsupported({
|
|
692
|
+
id: "antigravity",
|
|
693
|
+
name: "Antigravity",
|
|
694
|
+
clientNames: ["antigravity", "antigravity-client", "antigravity-cli", "agy"],
|
|
695
|
+
envVars: ["ANTIGRAVITY_CLI_ALIAS"],
|
|
696
|
+
pluginPaths: [[".gemini", "config", "plugins"], [".gemini", "antigravity", "plugins"], [".gemini", "antigravity-cli", "plugins"], [".gemini", "antigravity-ide", "plugins"]],
|
|
697
|
+
configDirs: [".gemini/antigravity", ".gemini/antigravity-cli", ".gemini/config"],
|
|
698
|
+
binaries: ["agy"],
|
|
699
|
+
source: "v1.0.169:src/adapters/client-map.ts:15-17; detect.ts:156,481-483; #1340"
|
|
700
|
+
}),
|
|
701
|
+
unsupported({
|
|
702
|
+
id: "cursor",
|
|
703
|
+
name: "Cursor",
|
|
704
|
+
clientNames: ["cursor-vscode"],
|
|
705
|
+
envVars: ["CURSOR_TRACE_ID", "CURSOR_CLI", "CURSOR_CWD"],
|
|
706
|
+
pluginPaths: [],
|
|
707
|
+
configDirs: [".cursor"],
|
|
708
|
+
binaries: [],
|
|
709
|
+
source: "v1.0.169:src/adapters/client-map.ts:18; detect.ts:163-165,584"
|
|
710
|
+
}),
|
|
711
|
+
unsupported({
|
|
712
|
+
id: "omp",
|
|
713
|
+
name: "OMP (oh-my-pi)",
|
|
714
|
+
clientNames: ["omp-coding-agent"],
|
|
715
|
+
envVars: [],
|
|
716
|
+
pluginPaths: [],
|
|
717
|
+
configDirs: [".omp"],
|
|
718
|
+
binaries: ["omp"],
|
|
719
|
+
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)"
|
|
720
|
+
}),
|
|
721
|
+
unsupported({
|
|
722
|
+
id: "openclaw",
|
|
723
|
+
name: "OpenClaw",
|
|
724
|
+
clientNames: [],
|
|
725
|
+
envVars: [],
|
|
726
|
+
pluginPaths: [],
|
|
727
|
+
configDirs: [".openclaw"],
|
|
728
|
+
binaries: [],
|
|
729
|
+
source: "v1.0.169:src/adapters/detect.ts:252,575 (the runtime sets no env var)"
|
|
730
|
+
}),
|
|
731
|
+
unsupported({
|
|
732
|
+
id: "kimi",
|
|
733
|
+
name: "Kimi Code",
|
|
734
|
+
clientNames: ["kimi-code", "kimi"],
|
|
735
|
+
envVars: [],
|
|
736
|
+
pluginPaths: [],
|
|
737
|
+
configDirs: [".kimi-code"],
|
|
738
|
+
binaries: ["kimi"],
|
|
739
|
+
source: "v1.0.169:src/adapters/client-map.ts:42-44; detect.ts:567; adapters/kimi/index.ts:127"
|
|
740
|
+
}),
|
|
741
|
+
unsupported({
|
|
742
|
+
id: "kilo",
|
|
743
|
+
name: "Kilo Code",
|
|
744
|
+
clientNames: ["kilo code"],
|
|
745
|
+
envVars: ["KILO", "KILO_PID"],
|
|
746
|
+
pluginPaths: [],
|
|
747
|
+
configDirs: [".config/kilo"],
|
|
748
|
+
binaries: [],
|
|
749
|
+
source: "v1.0.169:src/adapters/client-map.ts:28; detect.ts:170-171,592"
|
|
750
|
+
}),
|
|
751
|
+
unsupported({
|
|
752
|
+
id: "zed",
|
|
753
|
+
name: "Zed",
|
|
754
|
+
clientNames: ["zed"],
|
|
755
|
+
envVars: ["ZED_SESSION_ID", "ZED_TERM"],
|
|
756
|
+
pluginPaths: [],
|
|
757
|
+
configDirs: [".config/zed"],
|
|
758
|
+
binaries: [],
|
|
759
|
+
source: "v1.0.169:src/adapters/client-map.ts:38-39; detect.ts:189-190,616"
|
|
760
|
+
}),
|
|
761
|
+
unsupported({
|
|
762
|
+
id: "jetbrains-copilot",
|
|
763
|
+
name: "JetBrains Copilot",
|
|
764
|
+
clientNames: ["jetbrains client", "intellij idea", "pycharm"],
|
|
765
|
+
envVars: ["IDEA_INITIAL_DIRECTORY"],
|
|
766
|
+
pluginPaths: [],
|
|
767
|
+
configDirs: [".config/JetBrains"],
|
|
768
|
+
binaries: [],
|
|
769
|
+
source: "v1.0.169:src/adapters/client-map.ts:23-25; detect.ts:213,600"
|
|
770
|
+
})
|
|
771
|
+
]);
|
|
772
|
+
var SUPPORTED_AGENTS_DOCS_URL = "https://github.com/mksglu/context-mode/blob/main/docs/install/README.md";
|
|
685
773
|
var D3_ROOT_FIX_JOIN = " or ";
|
|
686
774
|
function D3_ROOT_FIX(installs) {
|
|
687
775
|
return `remove the extra install: ${installs.map((i) => `claude plugin uninstall ${i.key} --scope ${i.scope}`).join(D3_ROOT_FIX_JOIN)}`;
|
|
@@ -3530,6 +3618,17 @@ function claudeDirOf(env, home) {
|
|
|
3530
3618
|
const dir = env[CLAUDE_CONFIG_DIR_ENV];
|
|
3531
3619
|
return dir !== void 0 && dir !== "" ? dir : join(home, ...AGENT_HOME_DIR["claude-code"]);
|
|
3532
3620
|
}
|
|
3621
|
+
function claudeProfileEnv(env, platform = process.platform) {
|
|
3622
|
+
const dir = env[CLAUDE_CONFIG_DIR_ENV];
|
|
3623
|
+
if (dir === void 0 || dir === "" || platform === "win32") return "";
|
|
3624
|
+
return `${CLAUDE_CONFIG_DIR_ENV}='${dir.split("'").join(`'"'"'`)}' `;
|
|
3625
|
+
}
|
|
3626
|
+
function hostUpdateCommand(agent, env, platform = process.platform) {
|
|
3627
|
+
const cmd = UPGRADE_HOST_COMMAND[agent];
|
|
3628
|
+
if (agent !== "claude-code") return cmd;
|
|
3629
|
+
const profile = claudeProfileEnv(env, platform);
|
|
3630
|
+
return profile === "" ? cmd : cmd.split(" && ").map((c) => profile + c).join(" && ");
|
|
3631
|
+
}
|
|
3533
3632
|
function opencodeDirOf(env, home) {
|
|
3534
3633
|
const own2 = env[OPENCODE_CONFIG_DIR_ENV];
|
|
3535
3634
|
if (own2 !== void 0 && own2 !== "") return own2;
|
|
@@ -20620,11 +20719,11 @@ function noRuntimeError(lang) {
|
|
|
20620
20719
|
}
|
|
20621
20720
|
|
|
20622
20721
|
// src/core/sandbox/spawn.ts
|
|
20623
|
-
import { spawn } from "node:child_process";
|
|
20722
|
+
import { spawn as spawn2 } from "node:child_process";
|
|
20624
20723
|
import path2 from "node:path";
|
|
20625
20724
|
|
|
20626
20725
|
// src/core/sandbox/kill.ts
|
|
20627
|
-
import {
|
|
20726
|
+
import { spawn } from "node:child_process";
|
|
20628
20727
|
function signalGroup(pid, signal) {
|
|
20629
20728
|
try {
|
|
20630
20729
|
process.kill(-pid, signal);
|
|
@@ -20638,7 +20737,10 @@ function killTree(pid) {
|
|
|
20638
20737
|
return;
|
|
20639
20738
|
}
|
|
20640
20739
|
try {
|
|
20641
|
-
|
|
20740
|
+
const t = spawn("taskkill", ["/F", "/T", "/PID", String(pid)], { stdio: "ignore", windowsHide: true });
|
|
20741
|
+
t.on("error", () => {
|
|
20742
|
+
});
|
|
20743
|
+
t.unref();
|
|
20642
20744
|
} catch {
|
|
20643
20745
|
}
|
|
20644
20746
|
}
|
|
@@ -20657,7 +20759,7 @@ function runProcess(argv, o) {
|
|
|
20657
20759
|
if (start === null) return resolve11(NOT_STARTED);
|
|
20658
20760
|
let child;
|
|
20659
20761
|
try {
|
|
20660
|
-
child =
|
|
20762
|
+
child = spawn2(start[0], start.slice(1), {
|
|
20661
20763
|
cwd: o.cwd,
|
|
20662
20764
|
env: o.env,
|
|
20663
20765
|
stdio: ["pipe", "pipe", "pipe"],
|
|
@@ -20674,8 +20776,14 @@ function runProcess(argv, o) {
|
|
|
20674
20776
|
const stderrChunks = [];
|
|
20675
20777
|
let killedBy = null;
|
|
20676
20778
|
let settled = false;
|
|
20779
|
+
let held = false;
|
|
20780
|
+
let exited = false;
|
|
20781
|
+
let graceTimer;
|
|
20782
|
+
let drainTimer;
|
|
20783
|
+
let stopTimer;
|
|
20677
20784
|
const kill = () => {
|
|
20678
20785
|
if (child.pid !== void 0) killTree(child.pid);
|
|
20786
|
+
if (stopTimer === void 0) stopTimer = setTimeout(() => finishHeld(), KILL_GRACE_MS);
|
|
20679
20787
|
};
|
|
20680
20788
|
const onAbort = () => {
|
|
20681
20789
|
if (killedBy !== null || settled) return;
|
|
@@ -20692,17 +20800,46 @@ function runProcess(argv, o) {
|
|
|
20692
20800
|
if (settled) return;
|
|
20693
20801
|
settled = true;
|
|
20694
20802
|
clearTimeout(timer);
|
|
20803
|
+
clearTimeout(graceTimer);
|
|
20804
|
+
clearTimeout(drainTimer);
|
|
20805
|
+
clearTimeout(stopTimer);
|
|
20695
20806
|
o.signal.removeEventListener("abort", onAbort);
|
|
20696
20807
|
resolve11({
|
|
20697
20808
|
stdout: Buffer.concat(stdoutChunks),
|
|
20698
20809
|
stderr: Buffer.concat(stderrChunks),
|
|
20699
20810
|
exitCode,
|
|
20700
|
-
killed: killedBy
|
|
20811
|
+
killed: killedBy,
|
|
20812
|
+
...held ? { held: true } : {}
|
|
20701
20813
|
});
|
|
20702
20814
|
};
|
|
20703
|
-
|
|
20704
|
-
|
|
20815
|
+
const finishHeld = () => {
|
|
20816
|
+
if (settled) return;
|
|
20817
|
+
held = exited && killedBy === null;
|
|
20818
|
+
child.stdout.destroy();
|
|
20819
|
+
child.stderr.destroy();
|
|
20820
|
+
if (child.pid !== void 0) killTree(child.pid);
|
|
20821
|
+
settle(child.exitCode);
|
|
20822
|
+
};
|
|
20823
|
+
const bump = () => {
|
|
20824
|
+
if (!exited || settled) return;
|
|
20825
|
+
clearTimeout(graceTimer);
|
|
20826
|
+
graceTimer = setTimeout(finishHeld, PIPE_EOF_GRACE_MS);
|
|
20827
|
+
};
|
|
20828
|
+
child.stdout.on("data", (chunk) => {
|
|
20829
|
+
stdoutChunks.push(chunk);
|
|
20830
|
+
bump();
|
|
20831
|
+
});
|
|
20832
|
+
child.stderr.on("data", (chunk) => {
|
|
20833
|
+
stderrChunks.push(chunk);
|
|
20834
|
+
bump();
|
|
20835
|
+
});
|
|
20705
20836
|
child.on("close", (code) => settle(code));
|
|
20837
|
+
child.on("exit", () => {
|
|
20838
|
+
if (settled) return;
|
|
20839
|
+
exited = true;
|
|
20840
|
+
graceTimer = setTimeout(finishHeld, PIPE_EOF_GRACE_MS);
|
|
20841
|
+
drainTimer = setTimeout(finishHeld, PIPE_DRAIN_MAX_MS);
|
|
20842
|
+
});
|
|
20706
20843
|
child.on("error", () => settle(null));
|
|
20707
20844
|
child.stdin.on("error", () => {
|
|
20708
20845
|
});
|
|
@@ -21319,7 +21456,7 @@ var ctxBatch = Object.freeze({
|
|
|
21319
21456
|
});
|
|
21320
21457
|
|
|
21321
21458
|
// src/core/tools/doctor.ts
|
|
21322
|
-
import { readdirSync as readdirSync7, readFileSync as
|
|
21459
|
+
import { readdirSync as readdirSync7, readFileSync as readFileSync16, existsSync as existsSync16 } from "node:fs";
|
|
21323
21460
|
import { basename as basename5, join as join19 } from "node:path";
|
|
21324
21461
|
|
|
21325
21462
|
// src/core/ops/bundle-dir.ts
|
|
@@ -21345,8 +21482,8 @@ function ownBundleDir() {
|
|
|
21345
21482
|
}
|
|
21346
21483
|
|
|
21347
21484
|
// src/core/ops/doctor-config.ts
|
|
21348
|
-
import { existsSync as existsSync9, readdirSync as readdirSync5 } from "node:fs";
|
|
21349
|
-
import { join as join14 } from "node:path";
|
|
21485
|
+
import { existsSync as existsSync9, readdirSync as readdirSync5, readFileSync as readFileSync11 } from "node:fs";
|
|
21486
|
+
import { dirname as dirname8, join as join14 } from "node:path";
|
|
21350
21487
|
|
|
21351
21488
|
// src/core/ops/detect-v1.ts
|
|
21352
21489
|
import { existsSync as existsSync6, opendirSync, readdirSync as readdirSync3, readFileSync as readFileSync8 } from "node:fs";
|
|
@@ -24554,7 +24691,7 @@ function nativeMcpWrong(dir, row5) {
|
|
|
24554
24691
|
}
|
|
24555
24692
|
}
|
|
24556
24693
|
function isOwnOpencodeEntry(entry, key, own2) {
|
|
24557
|
-
const spec = isObject4(entry) ? entry[OPENCODE_PACKAGE_FIELD] : entry;
|
|
24694
|
+
const spec = isObject4(entry) ? entry[OPENCODE_PACKAGE_FIELD] : Array.isArray(entry) ? entry[0] : entry;
|
|
24558
24695
|
if (typeof spec !== "string") return false;
|
|
24559
24696
|
if (spec === OPENCODE_GIT_SPEC || spec.startsWith(OPENCODE_NPM_SPEC_PREFIX) || own2.includes(spec)) return true;
|
|
24560
24697
|
return key === OPENCODE_PLUGINS_KEY && spec === SERVER_KEY;
|
|
@@ -24565,14 +24702,21 @@ function opencodeMcpOwn(entry) {
|
|
|
24565
24702
|
const [node, script, flag, agent] = cmd;
|
|
24566
24703
|
return isNodeCommand(node) && typeof script === "string" && lastSegment(script) === SERVER_ENTRY_FILE && flag === AGENT_ARG && agent === "opencode";
|
|
24567
24704
|
}
|
|
24568
|
-
function
|
|
24569
|
-
|
|
24705
|
+
function opencodeFileValue(file2) {
|
|
24706
|
+
if (!existsSync9(file2)) return {};
|
|
24707
|
+
return parseHostConfig("opencode", file2, hostText(readFileSync11(file2, "utf8")), "jsonc");
|
|
24708
|
+
}
|
|
24709
|
+
function opencodeValueListed(value) {
|
|
24570
24710
|
const bundle = opencodePluginFile();
|
|
24571
24711
|
const own2 = [bundle, join14(bundle, ...OPENCODE_PLUGIN_PATH)];
|
|
24572
24712
|
if ([OPENCODE_PLUGIN_KEY, OPENCODE_PLUGINS_KEY].some((key) => list2(isObject4(value) ? value[key] : void 0).some((e) => isOwnOpencodeEntry(e, key, own2)))) return true;
|
|
24573
24713
|
const mcp = isObject4(value) && isObject4(value.mcp) ? value.mcp : {};
|
|
24574
24714
|
return opencodeMcpOwn(mcp[SERVER_KEY]) || isObject4(mcp.servers) && opencodeMcpOwn(mcp.servers[SERVER_KEY]);
|
|
24575
24715
|
}
|
|
24716
|
+
function opencodeListed(file2, worktree) {
|
|
24717
|
+
const dirs = [dirname8(file2), worktree];
|
|
24718
|
+
return dirs.some((dir) => OPENCODE_CONFIG_FILES.some((name) => opencodeValueListed(opencodeFileValue(join14(dir, name)))));
|
|
24719
|
+
}
|
|
24576
24720
|
function mcpWrong(row5, home, env, worktree) {
|
|
24577
24721
|
const native = row5.id === "codex" ? codexNativeDir(env, home) : null;
|
|
24578
24722
|
if (native !== null) return nativeMcpWrong(native, row5);
|
|
@@ -24582,7 +24726,7 @@ function mcpWrong(row5, home, env, worktree) {
|
|
|
24582
24726
|
resolvePluginRoot(row5, env, worktree);
|
|
24583
24727
|
return false;
|
|
24584
24728
|
}
|
|
24585
|
-
if (row5.id === "opencode") return !opencodeListed(file2);
|
|
24729
|
+
if (row5.id === "opencode") return !opencodeListed(file2, worktree);
|
|
24586
24730
|
const cur = readHostConfig(row5.id, file2);
|
|
24587
24731
|
return mergeOwnEntries(row5.id, cur.text, cur.format, row5, { nodePath: true, listEntries: [opencodePluginFile()] }).edits.length > 0;
|
|
24588
24732
|
} catch {
|
|
@@ -24793,7 +24937,7 @@ async function checkIndex(project) {
|
|
|
24793
24937
|
}
|
|
24794
24938
|
|
|
24795
24939
|
// src/core/ops/doctor-env.ts
|
|
24796
|
-
import { existsSync as existsSync11, readFileSync as
|
|
24940
|
+
import { existsSync as existsSync11, readFileSync as readFileSync12, realpathSync as realpathSync6 } from "node:fs";
|
|
24797
24941
|
import { isAbsolute as isAbsolute3, join as join15, relative as relative4 } from "node:path";
|
|
24798
24942
|
function pass3(id2, detail = DOCTOR_PASS_DETAIL) {
|
|
24799
24943
|
return { id: id2, label: DOCTOR_LABEL[id2], status: "PASS", detail };
|
|
@@ -24804,9 +24948,12 @@ function unknown3(id2, detail, fixCommand) {
|
|
|
24804
24948
|
function fail4(id2, detail, fixCommand) {
|
|
24805
24949
|
return { id: id2, label: DOCTOR_LABEL[id2], status: "FAIL", detail, fixCommand };
|
|
24806
24950
|
}
|
|
24951
|
+
function warn(id2, detail, fixCommand) {
|
|
24952
|
+
return { id: id2, label: DOCTOR_LABEL[id2], status: "WARN", detail, fixCommand };
|
|
24953
|
+
}
|
|
24807
24954
|
function bundleVersion(bundleDir2) {
|
|
24808
24955
|
try {
|
|
24809
|
-
const v = JSON.parse(
|
|
24956
|
+
const v = JSON.parse(readFileSync12(join15(bundleDir2, D1_PACKAGE_FILE), "utf8")).version;
|
|
24810
24957
|
return typeof v === "string" && v !== "" ? v : void 0;
|
|
24811
24958
|
} catch {
|
|
24812
24959
|
return void 0;
|
|
@@ -24890,20 +25037,21 @@ function highestTag(stdout, tag2) {
|
|
|
24890
25037
|
}
|
|
24891
25038
|
return best;
|
|
24892
25039
|
}
|
|
24893
|
-
function versionRow(head2, installed, tag2, source, latest, tail) {
|
|
25040
|
+
function versionRow(head2, installed, tag2, source, latest, tail, update) {
|
|
24894
25041
|
const cmp = compareVersions(installed, latest) ?? (installed === latest ? 0 : -1);
|
|
24895
25042
|
if (cmp === 0) return pass3("D1", head2 + D1_LATEST_PASS(tag2, source) + tail);
|
|
24896
25043
|
if (cmp > 0) return pass3("D1", head2 + D1_LATEST_AHEAD(tag2, source, latest) + tail);
|
|
24897
|
-
return
|
|
25044
|
+
return warn("D1", head2 + D1_LATEST_UPDATE(tag2, source, latest) + tail, update);
|
|
24898
25045
|
}
|
|
24899
25046
|
async function checkVersion(i) {
|
|
24900
25047
|
if (i.bundleSha === void 0) return unknown3("D1", D1_DEV_BUILD_DETAIL);
|
|
24901
25048
|
const head2 = D1_PREFIX(i.version, i.bundleSha) + ": ";
|
|
24902
25049
|
if (i.version === void 0) return unknown3("D1", head2 + D1_LATEST_UNKNOWN + ", " + D1_NO_VERSION, D1_NPM_CHECK_FIX);
|
|
24903
25050
|
const tag2 = channelOf(i.version);
|
|
25051
|
+
const update = i.updateCommand ?? DOCTOR_FIX_UPGRADE;
|
|
24904
25052
|
const git2 = findRuntime(GIT_BIN, i.env);
|
|
24905
25053
|
const npm = await npmLatest(i.registryUrl, tag2, i.signal, i.timeoutMs);
|
|
24906
|
-
if (npm.ok) return versionRow(head2, i.version, tag2, D1_SOURCE_NPM, npm.version, "");
|
|
25054
|
+
if (npm.ok) return versionRow(head2, i.version, tag2, D1_SOURCE_NPM, npm.version, "", update);
|
|
24907
25055
|
let cause = D1_GIT_MISSING;
|
|
24908
25056
|
if (git2 !== null) {
|
|
24909
25057
|
const r = await runProcess([git2, GIT_LS_REMOTE, ...GIT_LS_REMOTE_TAG_ARGS, RELEASE_REPO_URL, RELEASE_TAG_PATTERN], {
|
|
@@ -24914,7 +25062,7 @@ async function checkVersion(i) {
|
|
|
24914
25062
|
});
|
|
24915
25063
|
if (r.exitCode === 0 && r.killed === null) {
|
|
24916
25064
|
const latest = highestTag(r.stdout.toString("utf8"), tag2);
|
|
24917
|
-
if (latest !== void 0) return versionRow(head2, i.version, tag2, D1_SOURCE_TAGS, latest, D1_CAUSE_JOIN + npm.cause);
|
|
25065
|
+
if (latest !== void 0) return versionRow(head2, i.version, tag2, D1_SOURCE_TAGS, latest, D1_CAUSE_JOIN + npm.cause, update);
|
|
24918
25066
|
cause = D1_GIT_NO_TAG(tag2);
|
|
24919
25067
|
} else {
|
|
24920
25068
|
cause = gitCause(r, i.timeoutMs);
|
|
@@ -24950,10 +25098,11 @@ async function checkNode(i) {
|
|
|
24950
25098
|
if (!await sqliteLoads()) return fail4("D2", withBun(D2_SQLITE_DETAIL), D2_SQLITE_FIX);
|
|
24951
25099
|
return pass3("D2", bun.length === 0 ? DOCTOR_PASS_DETAIL : bun.join(D4_REASON_JOIN));
|
|
24952
25100
|
}
|
|
24953
|
-
function checkMcp(ctx) {
|
|
25101
|
+
function checkMcp(ctx, adapter) {
|
|
24954
25102
|
const named2 = ctx.clientInfo !== void 0 && ctx.clientInfo.name !== "";
|
|
24955
25103
|
const versioned = ctx.protocolVersion !== void 0 && ctx.protocolVersion !== "";
|
|
24956
|
-
|
|
25104
|
+
if (named2 || versioned) return pass3("D6");
|
|
25105
|
+
return adapter?.installMode === "in-process" ? pass3("D6", D6_IN_PROCESS_DETAIL) : unknown3("D6", D6_UNKNOWN_DETAIL);
|
|
24957
25106
|
}
|
|
24958
25107
|
function piCwdInside(worktree, piCwd) {
|
|
24959
25108
|
if (piCwd === void 0 || !existsSync11(piCwd)) return false;
|
|
@@ -24979,7 +25128,7 @@ function checkShell(env) {
|
|
|
24979
25128
|
}
|
|
24980
25129
|
|
|
24981
25130
|
// src/core/ops/doctor-hook.ts
|
|
24982
|
-
import { existsSync as existsSync13, mkdirSync as mkdirSync4, mkdtempSync, readFileSync as
|
|
25131
|
+
import { existsSync as existsSync13, mkdirSync as mkdirSync4, mkdtempSync, readFileSync as readFileSync13, realpathSync as realpathSync8, rmSync as rmSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
24983
25132
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
24984
25133
|
import path7 from "node:path";
|
|
24985
25134
|
|
|
@@ -26807,7 +26956,7 @@ function nodeLaunch(env, host = { bun: process.versions.bun, execPath: process.e
|
|
|
26807
26956
|
import { createHash } from "node:crypto";
|
|
26808
26957
|
import { existsSync as existsSync12, realpathSync as realpathSync7 } from "node:fs";
|
|
26809
26958
|
import path6 from "node:path";
|
|
26810
|
-
import { spawn as
|
|
26959
|
+
import { spawn as spawn3, spawnSync as spawnSync2 } from "node:child_process";
|
|
26811
26960
|
|
|
26812
26961
|
// src/setup/spawn-bin.ts
|
|
26813
26962
|
import { spawnSync } from "node:child_process";
|
|
@@ -26932,7 +27081,7 @@ function askPluginHooks(env, pluginId, cwd) {
|
|
|
26932
27081
|
resolve11({ kind: "silent" });
|
|
26933
27082
|
return;
|
|
26934
27083
|
}
|
|
26935
|
-
const child =
|
|
27084
|
+
const child = spawn3(f.command, f.args, { env, cwd, stdio: ["pipe", "pipe", "ignore"], windowsVerbatimArguments: f.windowsVerbatimArguments, windowsHide: true });
|
|
26936
27085
|
let buf = "";
|
|
26937
27086
|
let done = false;
|
|
26938
27087
|
let exited = false;
|
|
@@ -27031,7 +27180,7 @@ function loadFixture(bundleDir2, agent) {
|
|
|
27031
27180
|
if (!existsSync13(file2)) return { cause: D5_FIXTURE_FILE_ABSENT(file2) };
|
|
27032
27181
|
let all;
|
|
27033
27182
|
try {
|
|
27034
|
-
all = JSON.parse(hostText(
|
|
27183
|
+
all = JSON.parse(hostText(readFileSync13(file2, "utf8")));
|
|
27035
27184
|
} catch (err) {
|
|
27036
27185
|
return { cause: D5_FIXTURE_PARSE(file2, err instanceof Error ? err.message : String(err)) };
|
|
27037
27186
|
}
|
|
@@ -27299,10 +27448,10 @@ async function checkHookRoundTrip(i) {
|
|
|
27299
27448
|
|
|
27300
27449
|
// src/core/ops/db-heal.ts
|
|
27301
27450
|
import { existsSync as existsSync14, mkdirSync as mkdirSync6, rmSync as rmSync4 } from "node:fs";
|
|
27302
|
-
import { basename as basename4, dirname as
|
|
27451
|
+
import { basename as basename4, dirname as dirname9, join as join17 } from "node:path";
|
|
27303
27452
|
|
|
27304
27453
|
// src/core/store/owners.ts
|
|
27305
|
-
import { mkdirSync as mkdirSync5, readdirSync as readdirSync6, readFileSync as
|
|
27454
|
+
import { mkdirSync as mkdirSync5, readdirSync as readdirSync6, readFileSync as readFileSync14, rmSync as rmSync3, writeFileSync as writeFileSync3 } from "node:fs";
|
|
27306
27455
|
import { basename as basename3, join as join16 } from "node:path";
|
|
27307
27456
|
function ownersDir(configDir, projectKey) {
|
|
27308
27457
|
return join16(configDir, PROJECTS_DIR_NAME, projectKey, OWNERS_DIR_NAME);
|
|
@@ -27336,7 +27485,7 @@ function listLiveOwners(configDir, projectKey) {
|
|
|
27336
27485
|
const file2 = join16(dir, name);
|
|
27337
27486
|
let text;
|
|
27338
27487
|
try {
|
|
27339
|
-
text =
|
|
27488
|
+
text = readFileSync14(file2, "utf8");
|
|
27340
27489
|
} catch (err) {
|
|
27341
27490
|
if (errCode2(err) === "ENOENT") continue;
|
|
27342
27491
|
throw err;
|
|
@@ -27420,7 +27569,7 @@ async function healOrphan(project, files, row5) {
|
|
|
27420
27569
|
const moved = [];
|
|
27421
27570
|
let dir = "";
|
|
27422
27571
|
try {
|
|
27423
|
-
dir = makeOrphanDir(
|
|
27572
|
+
dir = makeOrphanDir(dirname9(project.dbPath));
|
|
27424
27573
|
for (const f of files) {
|
|
27425
27574
|
const to = join17(dir, basename4(f.path));
|
|
27426
27575
|
renameWithRetry(f.path, to);
|
|
@@ -27487,9 +27636,40 @@ function buildReportHead(input) {
|
|
|
27487
27636
|
return lines.concat(tail).join("\n");
|
|
27488
27637
|
}
|
|
27489
27638
|
|
|
27639
|
+
// src/core/ops/unsupported-host.ts
|
|
27640
|
+
var SUPPORTED_AGENTS_LINE = `Supported agents: ${AGENT_IDS.join(", ")} (${SUPPORTED_AGENTS_DOCS_URL}).`;
|
|
27641
|
+
function UNSUPPORTED_HOST_LINE(name) {
|
|
27642
|
+
return `${name} is not a supported host today. The MCP server runs here; hooks are not checked. ${SUPPORTED_AGENTS_LINE}`;
|
|
27643
|
+
}
|
|
27644
|
+
function segmentsOf(dir) {
|
|
27645
|
+
let parts = [dir];
|
|
27646
|
+
for (const sep5 of V1_PATH_SEPS) parts = parts.flatMap((p) => p.split(sep5));
|
|
27647
|
+
return parts;
|
|
27648
|
+
}
|
|
27649
|
+
function hasRun(parts, run) {
|
|
27650
|
+
for (let i = 0; i + run.length <= parts.length; i++) if (run.every((seg, k) => parts[i + k] === seg)) return true;
|
|
27651
|
+
return false;
|
|
27652
|
+
}
|
|
27653
|
+
function unsupportedHostOf(sig) {
|
|
27654
|
+
if (sig.clientName !== void 0 && sig.clientName !== "") {
|
|
27655
|
+
const n = sig.clientName.toLowerCase();
|
|
27656
|
+
const hit = UNSUPPORTED_HOSTS.find((h) => h.clientNames.includes(n));
|
|
27657
|
+
if (hit !== void 0) return hit;
|
|
27658
|
+
}
|
|
27659
|
+
if (sig.bundleDir !== void 0) {
|
|
27660
|
+
const parts = segmentsOf(sig.bundleDir);
|
|
27661
|
+
const hit = UNSUPPORTED_HOSTS.find((h) => h.pluginPaths.some((p) => hasRun(parts, p)));
|
|
27662
|
+
if (hit !== void 0) return hit;
|
|
27663
|
+
}
|
|
27664
|
+
if (sig.clientName !== void 0 && sig.clientName !== "") return void 0;
|
|
27665
|
+
const env = sig.env;
|
|
27666
|
+
if (env === void 0) return void 0;
|
|
27667
|
+
return UNSUPPORTED_HOSTS.find((h) => h.envVars.some((v) => env[v] !== void 0 && env[v] !== ""));
|
|
27668
|
+
}
|
|
27669
|
+
|
|
27490
27670
|
// src/core/ops/doctor-issue.ts
|
|
27491
27671
|
import { spawnSync as spawnSync3 } from "node:child_process";
|
|
27492
|
-
import { closeSync as closeSync2, existsSync as existsSync15, fstatSync, mkdirSync as mkdirSync7, openSync as openSync2, readFileSync as
|
|
27672
|
+
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";
|
|
27493
27673
|
import { delimiter, join as join18 } from "node:path";
|
|
27494
27674
|
var TOKEN_PREFIXES = ["ghp_", "gho_", "github_pat_", "sk-", "xoxb-", "AKIA"];
|
|
27495
27675
|
function tildeOf(env) {
|
|
@@ -27592,7 +27772,7 @@ function agentConfig(adapter, env, worktree) {
|
|
|
27592
27772
|
}
|
|
27593
27773
|
let text = "";
|
|
27594
27774
|
try {
|
|
27595
|
-
text =
|
|
27775
|
+
text = readFileSync15(f.path, "utf8");
|
|
27596
27776
|
} catch (err) {
|
|
27597
27777
|
out.push(`${f.label}: ${f.path} (read: ${err instanceof Error ? err.message : String(err)})`);
|
|
27598
27778
|
continue;
|
|
@@ -27606,12 +27786,13 @@ function agentConfig(adapter, env, worktree) {
|
|
|
27606
27786
|
function failing(rows) {
|
|
27607
27787
|
return rows.filter((r) => r.status === "FAIL");
|
|
27608
27788
|
}
|
|
27609
|
-
function issueTitle(agent, rows) {
|
|
27610
|
-
return `ctx_doctor ${agent}: ${failing(rows).map((r) => `${r.id} ${r.label}`).join(", ")} FAIL`;
|
|
27789
|
+
function issueTitle(agent, rows, other) {
|
|
27790
|
+
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`;
|
|
27611
27791
|
}
|
|
27612
|
-
function summaryOf(agent, rows) {
|
|
27792
|
+
function summaryOf(agent, rows, other) {
|
|
27613
27793
|
const f = failing(rows)[0];
|
|
27614
|
-
|
|
27794
|
+
const tag2 = other === void 0 ? "" : `${other.name} is not a supported host today. `;
|
|
27795
|
+
return tag2 + (f === void 0 ? `ctx_doctor ${agent}` : `${f.id} ${f.label} FAIL on ${agent}: ${f.detail}`);
|
|
27615
27796
|
}
|
|
27616
27797
|
async function buildIssueBody(i) {
|
|
27617
27798
|
const tilde = tildeOf(i.env);
|
|
@@ -27621,7 +27802,7 @@ async function buildIssueBody(i) {
|
|
|
27621
27802
|
const envNames = DOCTOR_ENV_NAMES.map((n) => i.env[n] === void 0 ? `${n} (unset)` : `${n}=${i.env[n]}`);
|
|
27622
27803
|
const pathTools = DOCTOR_PATH_TOOLS.map((t) => `PATH holds ${t}: ${onPath(i.env, t).join(", ") || "(absent)"}`);
|
|
27623
27804
|
const sections = {
|
|
27624
|
-
"Summary": [summaryOf(agent, i.rows)],
|
|
27805
|
+
"Summary": [summaryOf(agent, i.rows, i.unsupported)],
|
|
27625
27806
|
"ctx-report": [i.table],
|
|
27626
27807
|
"What happened": [
|
|
27627
27808
|
"Rows that need a look:",
|
|
@@ -27667,9 +27848,9 @@ async function writeIssueReport(i) {
|
|
|
27667
27848
|
const file2 = join18(dir, `${DOCTOR_REPORT_FILE_PREFIX}${(/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-")}.md`);
|
|
27668
27849
|
writeFileSync4(file2, body);
|
|
27669
27850
|
const shown2 = tilde(file2);
|
|
27670
|
-
const title = issueTitle(i.adapter.id, i.rows);
|
|
27851
|
+
const title = issueTitle(i.adapter.id, i.rows, i.unsupported);
|
|
27671
27852
|
const gh = [`gh issue create --repo ${ISSUE_REPO_SLUG} --label bug \\`, `${DOCTOR_GH_NEXT}title ${JSON.stringify(title)} \\`, `${DOCTOR_GH_NEXT}body-file ${shown2}`];
|
|
27672
|
-
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];
|
|
27853
|
+
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];
|
|
27673
27854
|
}
|
|
27674
27855
|
function formUrl(title, summary) {
|
|
27675
27856
|
const base = `${ISSUE_FORM_URL}&title=${encodeURIComponent(title)}`;
|
|
@@ -27698,6 +27879,12 @@ async function codexDb(ctx, adapter) {
|
|
|
27698
27879
|
return null;
|
|
27699
27880
|
}
|
|
27700
27881
|
}
|
|
27882
|
+
function d1UpdateCommand(agent, env, other) {
|
|
27883
|
+
return other === void 0 ? hostUpdateCommand(agent, env) : UNSUPPORTED_HOST_LINE(other.name);
|
|
27884
|
+
}
|
|
27885
|
+
function unsupportedRow(id2, h) {
|
|
27886
|
+
return { id: id2, label: DOCTOR_LABEL[id2], status: "WARN", detail: UNSUPPORTED_HOST_LINE(h.name) };
|
|
27887
|
+
}
|
|
27701
27888
|
async function hookRow(ctx, adapter, host) {
|
|
27702
27889
|
const db = await codexDb(ctx, adapter);
|
|
27703
27890
|
const runStart = Date.now();
|
|
@@ -27725,7 +27912,7 @@ function ownServerId(configDir, projectKey) {
|
|
|
27725
27912
|
if (!existsSync16(dir)) return "";
|
|
27726
27913
|
for (const name of readdirSync7(dir)) {
|
|
27727
27914
|
if (!name.endsWith(OWNER_PID_EXT)) continue;
|
|
27728
|
-
if (
|
|
27915
|
+
if (readFileSync16(join19(dir, name), "utf8").trim() === String(process.pid)) return basename5(name, OWNER_PID_EXT);
|
|
27729
27916
|
}
|
|
27730
27917
|
return "";
|
|
27731
27918
|
}
|
|
@@ -27733,16 +27920,18 @@ async function runDoctorChecks(ctx, adapter, host0) {
|
|
|
27733
27920
|
const host = adapter.id === "codex" ? { ...host0, env: { ...host0.env, CODEX_HOME: codexRunDirOf(host0.env, homeDirOf(host0.env) ?? "", host0.bundleDir) } } : host0;
|
|
27734
27921
|
const env = host.env;
|
|
27735
27922
|
const project = ctx.project;
|
|
27923
|
+
const other = adapter.installMode === "in-process" ? void 0 : unsupportedHostOf({ clientName: ctx.clientInfo?.name, bundleDir: host.bundleDir, env });
|
|
27736
27924
|
let integrityFailed = false;
|
|
27737
27925
|
let orphan = [];
|
|
27738
27926
|
const checks = {
|
|
27739
|
-
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 }),
|
|
27927
|
+
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) }),
|
|
27740
27928
|
D2: () => checkNode({ nodeVersion: process.version, bunVersion: process.versions.bun }),
|
|
27741
|
-
D3: () => checkHostConfig(adapter, env, project.worktree),
|
|
27929
|
+
D3: () => other !== void 0 ? unsupportedRow("D3", other) : checkHostConfig(adapter, env, project.worktree),
|
|
27930
|
+
// D-UNSUPPORTED-HOSTS-1
|
|
27742
27931
|
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)) }),
|
|
27743
|
-
D5: () => hookRow(ctx, adapter, host),
|
|
27932
|
+
D5: () => other !== void 0 ? unsupportedRow("D5", other) : hookRow(ctx, adapter, host),
|
|
27744
27933
|
D5b: () => checkDoubleFire(adapter.id, project.worktree),
|
|
27745
|
-
D6: () => checkMcp(ctx),
|
|
27934
|
+
D6: () => checkMcp(ctx, adapter),
|
|
27746
27935
|
D7: () => checkProject({ project, adapter, piCwd: host.piCwd }),
|
|
27747
27936
|
D8: async () => {
|
|
27748
27937
|
const r = await checkDb(project);
|
|
@@ -27789,7 +27978,7 @@ async function doctorReply(ctx, host) {
|
|
|
27789
27978
|
let notes = [];
|
|
27790
27979
|
if (failed) {
|
|
27791
27980
|
try {
|
|
27792
|
-
notes = await writeIssueReport({ ctx, adapter, env: host.env, bundleDir: host.bundleDir, rows, envLine: envLine2, table: table3 });
|
|
27981
|
+
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 });
|
|
27793
27982
|
} catch (err) {
|
|
27794
27983
|
notes = [`Report file: ${lineOf2(err)}`];
|
|
27795
27984
|
}
|
|
@@ -27823,7 +28012,7 @@ var ctxDoctor = Object.freeze({
|
|
|
27823
28012
|
// src/core/tools/execute.ts
|
|
27824
28013
|
import { existsSync as existsSync17, mkdtempSync as mkdtempSync2, rmSync as rmSync5, writeFileSync as writeFileSync5 } from "node:fs";
|
|
27825
28014
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
27826
|
-
import { dirname as
|
|
28015
|
+
import { dirname as dirname11, join as join20, parse as parse3, resolve as resolve8 } from "node:path";
|
|
27827
28016
|
|
|
27828
28017
|
// src/core/sandbox/win-build.ts
|
|
27829
28018
|
var SEPARATORS2 = ";&|(\n";
|
|
@@ -27906,7 +28095,7 @@ function schemaLine(issue2) {
|
|
|
27906
28095
|
}
|
|
27907
28096
|
function fileError(given, abs, root) {
|
|
27908
28097
|
let dir = abs;
|
|
27909
|
-
while (!existsSync17(dir) &&
|
|
28098
|
+
while (!existsSync17(dir) && dirname11(dir) !== dir) dir = dirname11(dir);
|
|
27910
28099
|
if (isInside(root, dir)) return null;
|
|
27911
28100
|
return new CtxError("OUTSIDE_ROOT", { p: given, root }).toLine();
|
|
27912
28101
|
}
|
|
@@ -27940,7 +28129,7 @@ function spawnFailed(argv0, cwd) {
|
|
|
27940
28129
|
}
|
|
27941
28130
|
async function finish(input, ctx, r, exitCode, journal) {
|
|
27942
28131
|
const isError = exitCode !== 0 && !(input.language === "shell" && exitCode === SOFT_EXIT && r.stderr.length === 0);
|
|
27943
|
-
const combined = r.stdout.toString("utf8") + (exitCode !== 0 ? r.stderr.toString("utf8") : "");
|
|
28132
|
+
const combined = r.stdout.toString("utf8") + (exitCode !== 0 ? r.stderr.toString("utf8") : "") + (r.held === true ? "\n" + BACKGROUND_HOLD_NOTE + "\n" : "");
|
|
27944
28133
|
const fullBytes = Buffer.byteLength(combined, "utf8");
|
|
27945
28134
|
const head2 = summaryLine(exitCode, fullBytes);
|
|
27946
28135
|
const intent = input.intent ?? "";
|
|
@@ -28024,11 +28213,11 @@ var ctxExecute = {
|
|
|
28024
28213
|
};
|
|
28025
28214
|
|
|
28026
28215
|
// src/core/tools/index.ts
|
|
28027
|
-
import { existsSync as existsSync18, readFileSync as
|
|
28028
|
-
import { dirname as
|
|
28216
|
+
import { existsSync as existsSync18, readFileSync as readFileSync18, statSync as statSync8 } from "node:fs";
|
|
28217
|
+
import { dirname as dirname12, extname as extname3, join as join22, relative as relative5, resolve as resolve9 } from "node:path";
|
|
28029
28218
|
|
|
28030
28219
|
// src/core/index/walk.ts
|
|
28031
|
-
import { readdirSync as readdirSync8, readFileSync as
|
|
28220
|
+
import { readdirSync as readdirSync8, readFileSync as readFileSync17, realpathSync as realpathSync10, statSync as statSync7 } from "node:fs";
|
|
28032
28221
|
import { join as join21 } from "node:path";
|
|
28033
28222
|
var GITIGNORE = ".gitignore";
|
|
28034
28223
|
var GIT_DIR = ".git";
|
|
@@ -28090,7 +28279,7 @@ function compareFound(a, b) {
|
|
|
28090
28279
|
function readRules(file2, base) {
|
|
28091
28280
|
let body;
|
|
28092
28281
|
try {
|
|
28093
|
-
body =
|
|
28282
|
+
body = readFileSync17(file2, "utf8");
|
|
28094
28283
|
} catch {
|
|
28095
28284
|
return [];
|
|
28096
28285
|
}
|
|
@@ -32218,14 +32407,14 @@ function kindOfType(contentType) {
|
|
|
32218
32407
|
}
|
|
32219
32408
|
function readUtf8(absPath) {
|
|
32220
32409
|
try {
|
|
32221
|
-
return utf8.decode(
|
|
32410
|
+
return utf8.decode(readFileSync18(absPath));
|
|
32222
32411
|
} catch {
|
|
32223
32412
|
return void 0;
|
|
32224
32413
|
}
|
|
32225
32414
|
}
|
|
32226
32415
|
function missingOrOutside(given, abs, root) {
|
|
32227
32416
|
let dir = abs;
|
|
32228
|
-
while (!existsSync18(dir) &&
|
|
32417
|
+
while (!existsSync18(dir) && dirname12(dir) !== dir) dir = dirname12(dir);
|
|
32229
32418
|
if (dir !== abs && isInside(root, dir)) return new CtxError("INVALID_ARGS", { field: "path", action: "pass an existing file or folder" });
|
|
32230
32419
|
return new CtxError("OUTSIDE_ROOT", { p: given, root });
|
|
32231
32420
|
}
|
|
@@ -32776,7 +32965,7 @@ var ctxStats = Object.freeze({
|
|
|
32776
32965
|
|
|
32777
32966
|
// src/core/ops/host-write.ts
|
|
32778
32967
|
import { copyFileSync, existsSync as existsSync19, mkdirSync as mkdirSync8, writeFileSync as writeFileSync6 } from "node:fs";
|
|
32779
|
-
import { dirname as
|
|
32968
|
+
import { dirname as dirname13, join as join23 } from "node:path";
|
|
32780
32969
|
function defaultWrite(file2, text) {
|
|
32781
32970
|
writeFileSync6(file2, text, "utf8");
|
|
32782
32971
|
}
|
|
@@ -32808,7 +32997,7 @@ function writeWithRollback(file2, text, write2, atomic) {
|
|
|
32808
32997
|
const trash = file2 + UPGRADE_TRASH_SUFFIX;
|
|
32809
32998
|
const tmp = `${file2}${HOST_CONFIG_TMP_SUFFIX}.${process.pid}`;
|
|
32810
32999
|
const had = existsSync19(file2);
|
|
32811
|
-
mkdirSync8(
|
|
33000
|
+
mkdirSync8(dirname13(file2), { recursive: true });
|
|
32812
33001
|
if (had) copyFileSync(file2, trash);
|
|
32813
33002
|
try {
|
|
32814
33003
|
write2(tmp, text);
|
|
@@ -32975,7 +33164,7 @@ function runUninstall(input) {
|
|
|
32975
33164
|
}
|
|
32976
33165
|
|
|
32977
33166
|
// src/core/ops/v1-remove.ts
|
|
32978
|
-
import { copyFileSync as copyFileSync2, existsSync as existsSync21, readFileSync as
|
|
33167
|
+
import { copyFileSync as copyFileSync2, existsSync as existsSync21, readFileSync as readFileSync19, rmSync as rmSync7 } from "node:fs";
|
|
32979
33168
|
var isObj4 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
32980
33169
|
var areaOf = (f) => f.path === "" ? f.file : f.file + UPGRADE_AREA_KEY_SEP + f.path;
|
|
32981
33170
|
var row3 = (f, after) => ({ area: areaOf(f), before: f.reason, after });
|
|
@@ -33026,8 +33215,8 @@ function locate(doc, path8) {
|
|
|
33026
33215
|
return null;
|
|
33027
33216
|
}
|
|
33028
33217
|
function stripJsonEntries(agent, file2, findings, kept, undo) {
|
|
33029
|
-
const layout = hostLayout(
|
|
33030
|
-
const text = hostText(
|
|
33218
|
+
const layout = hostLayout(readFileSync19(file2, "utf8"));
|
|
33219
|
+
const text = hostText(readFileSync19(file2, "utf8"));
|
|
33031
33220
|
const doc = parseHostConfig(agent, file2, text, "jsonc");
|
|
33032
33221
|
const hit = /* @__PURE__ */ new Set();
|
|
33033
33222
|
const byContainer = /* @__PURE__ */ new Map();
|
|
@@ -33077,7 +33266,7 @@ function removeV1(agent, findings, project) {
|
|
|
33077
33266
|
continue;
|
|
33078
33267
|
}
|
|
33079
33268
|
if (file2.endsWith(TOML_EXT)) {
|
|
33080
|
-
const rawToml =
|
|
33269
|
+
const rawToml = readFileSync19(file2, "utf8");
|
|
33081
33270
|
const tomlLayout = hostLayout(rawToml);
|
|
33082
33271
|
let text = hostText(rawToml);
|
|
33083
33272
|
for (const f of list4) {
|
|
@@ -33135,8 +33324,8 @@ function pluginRootRow(adapter, env) {
|
|
|
33135
33324
|
}
|
|
33136
33325
|
return root === own2 ? [] : [row4(UPGRADE_PLUGIN_ROOT_AREA, root, own2)];
|
|
33137
33326
|
}
|
|
33138
|
-
function hostRow(adapter) {
|
|
33139
|
-
return row4(UPGRADE_HOST_AREA, "",
|
|
33327
|
+
function hostRow(adapter, env) {
|
|
33328
|
+
return row4(UPGRADE_HOST_AREA, "", hostUpdateCommand(adapter.id, env));
|
|
33140
33329
|
}
|
|
33141
33330
|
function upgrade(adapter, deps, home) {
|
|
33142
33331
|
let removal = null;
|
|
@@ -33144,7 +33333,7 @@ function upgrade(adapter, deps, home) {
|
|
|
33144
33333
|
const step5 = regenerateHostConfig(adapter, home, { env: deps.env, write: deps.write });
|
|
33145
33334
|
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) });
|
|
33146
33335
|
removal = removeV1(adapter.id, findings, deps.project.worktree);
|
|
33147
|
-
const rows = [hostRow(adapter), ...step5, ...removal.rows];
|
|
33336
|
+
const rows = [hostRow(adapter, deps.env), ...step5, ...removal.rows];
|
|
33148
33337
|
removal.commit();
|
|
33149
33338
|
return rows;
|
|
33150
33339
|
} catch (err) {
|