context-mode 2.2.2 → 2.2.3
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 +35 -16
- package/copilot/plugin.json +1 -1
- package/gemini-extension.json +1 -1
- package/hook.mjs +106 -99
- package/opencode/plugin.js +311 -69
- package/package.json +1 -1
- package/pi/index.js +373 -69
- package/qwen-extension.json +1 -1
- package/run.mjs +14 -12
- package/search.mjs +14 -12
- package/server.mjs +270 -42
package/cli.mjs
CHANGED
|
@@ -16,14 +16,6 @@ import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
|
16
16
|
var SERVER_KEY = "context-mode";
|
|
17
17
|
var TOOL_ORDER = Object.freeze(["ctx_execute", "ctx_batch", "ctx_index", "ctx_search", "ctx_resume", "ctx_stats", "ctx_doctor", "ctx_upgrade", "ctx_purge"]);
|
|
18
18
|
var OUTPUT_CAP = 16384;
|
|
19
|
-
var REPLACE_TRIGGER_BYTES_DEFAULT = 4096;
|
|
20
|
-
var REPLACE_TRIGGER_ENV = "CTX_REPLACE_TRIGGER_BYTES";
|
|
21
|
-
function readReplaceTrigger(raw) {
|
|
22
|
-
if (raw === void 0 || raw.trim() === "") return REPLACE_TRIGGER_BYTES_DEFAULT;
|
|
23
|
-
const n3 = Number(raw);
|
|
24
|
-
return Number.isSafeInteger(n3) && n3 > 0 ? n3 : REPLACE_TRIGGER_BYTES_DEFAULT;
|
|
25
|
-
}
|
|
26
|
-
var REPLACE_TRIGGER_BYTES = readReplaceTrigger(process.env[REPLACE_TRIGGER_ENV]);
|
|
27
19
|
var RANGE_READ_TOOLS = Object.freeze(["Read", "view"]);
|
|
28
20
|
var READ_RANGE_KEYS = Object.freeze(["offset", "limit", "view_range"]);
|
|
29
21
|
var SKILL_LOAD_TOOLS = Object.freeze(["Skill"]);
|
|
@@ -517,6 +509,7 @@ var OPENCODE_CONFIG_DIR_ENV = "OPENCODE_CONFIG_DIR";
|
|
|
517
509
|
var APPDATA_ENV = "APPDATA";
|
|
518
510
|
var VSCODE_USER_DIR_SEGMENTS = Object.freeze(["Code", "User"]);
|
|
519
511
|
var XDG_CONFIG_HOME_ENV = "XDG_CONFIG_HOME";
|
|
512
|
+
var PI_CONFIG_DIR_ENV = "PI_CONFIG_DIR";
|
|
520
513
|
var CONFIG_TOML_FILE = "config.toml";
|
|
521
514
|
var CONFIG_JSON_FILE = "config.json";
|
|
522
515
|
var ZCODE_CLI_DIR = "cli";
|
|
@@ -4921,7 +4914,8 @@ var ERROR_TEXT = Object.freeze({
|
|
|
4921
4914
|
NO_RUNTIME: "No <lang> runtime on PATH. Fix: install it or pick another language.",
|
|
4922
4915
|
FETCH_FAILED: "Fetch failed: <code>. Fix: check the URL or proxy.",
|
|
4923
4916
|
SSRF: "Blocked private address <host>. Fix: use a public URL.",
|
|
4924
|
-
OUTSIDE_ROOT: "Path <p> is outside the project. Fix: use a path inside <root
|
|
4917
|
+
OUTSIDE_ROOT: "Path <p> is outside the project and the folders added to this session. Fix: use a path inside <root>, or add its folder to the session (Claude Code /add-dir, Codex --add-dir).",
|
|
4918
|
+
// #1398 D-1398-HOST-ROOTS-1
|
|
4925
4919
|
INVALID_ARGS: "Invalid argument <field>. Fix: <action>.",
|
|
4926
4920
|
ONE_OF_INPUT: "Pass exactly one of <names>. Fix: drop the extra field.",
|
|
4927
4921
|
SPAWN_FAILED: "Failed to start the process: <detail>. Fix: check the command and PATH.",
|
|
@@ -5058,6 +5052,13 @@ function piAgentDirOf(env, home) {
|
|
|
5058
5052
|
const dir = env[PI_AGENT_DIR_ENV];
|
|
5059
5053
|
return dir !== void 0 && dir !== "" ? dir : join2(home, ...AGENT_HOME_DIR.pi, PI_AGENT_DIR);
|
|
5060
5054
|
}
|
|
5055
|
+
function ompConfigRootOf(env, home) {
|
|
5056
|
+
const dir = env[PI_CONFIG_DIR_ENV];
|
|
5057
|
+
return dir !== void 0 && dir !== "" ? join2(home, dir) : join2(home, ...AGENT_HOME_DIR.omp);
|
|
5058
|
+
}
|
|
5059
|
+
function ompAgentDirOf(env, home) {
|
|
5060
|
+
return join2(ompConfigRootOf(env, home), PI_AGENT_DIR);
|
|
5061
|
+
}
|
|
5061
5062
|
function vscodeUserDirOf(env, home, platform = process.platform) {
|
|
5062
5063
|
const set2 = (v) => v !== void 0 && v !== "";
|
|
5063
5064
|
const p3 = platform === "win32" ? win32 : posix;
|
|
@@ -8211,8 +8212,8 @@ var ENABLED_PROVIDERS = "enabledProviders";
|
|
|
8211
8212
|
var DISABLED_PROVIDERS = "disabledProviders";
|
|
8212
8213
|
var CLAUDE_PROVIDER = "claude";
|
|
8213
8214
|
var ALL_PROVIDERS = ["*", "all"];
|
|
8214
|
-
function ompImportFiles(home) {
|
|
8215
|
-
const agentDir =
|
|
8215
|
+
function ompImportFiles(env, home) {
|
|
8216
|
+
const agentDir = ompAgentDirOf(env, home);
|
|
8216
8217
|
return { config: join11(agentDir, OMP_CONFIG_FILE), mcp: join11(agentDir, OMP_MCP_FILE), claude: join11(home, CLAUDE_USER_CONFIG_FILE) };
|
|
8217
8218
|
}
|
|
8218
8219
|
function readText2(file) {
|
|
@@ -8634,7 +8635,9 @@ function copyFor(ctx, id) {
|
|
|
8634
8635
|
}
|
|
8635
8636
|
var LIST = {
|
|
8636
8637
|
"claude-code": { bin: "claude", args: ["plugin", "list"] },
|
|
8637
|
-
|
|
8638
|
+
// D-1413-CODEX-LIST-1 (#1413): `mcp list` runs OAuth discovery (network, 5 s cap per server) and keyring reads for every
|
|
8639
|
+
// server; `mcp get <name> --json` loads the same servers, plugin servers too, and looks up the exact name (no auth).
|
|
8640
|
+
codex: { bin: "codex", args: ["mcp", "get", SERVER_KEY, "--json"], reader: "codex-mcp-get" },
|
|
8638
8641
|
gemini: { bin: "gemini", args: ["extensions", "list"] },
|
|
8639
8642
|
qwen: { bin: "qwen", args: ["extensions", "list"] },
|
|
8640
8643
|
"copilot-cli": { bin: "copilot", args: ["mcp", "list"] },
|
|
@@ -8718,7 +8721,7 @@ function buildRegistry(ctx) {
|
|
|
8718
8721
|
...hookInstall.kind === "package" ? [] : [hookInstall.file],
|
|
8719
8722
|
...hookInstall.kind === "file" && hookInstall.trust ? [hookInstall.trust] : [],
|
|
8720
8723
|
...skillInstall.kind === "dir" ? skillInstall.files.map((f2) => f2.file) : [],
|
|
8721
|
-
...id === "omp" ? [ompImportFiles(ctx.home).mcp] : []
|
|
8724
|
+
...id === "omp" ? [ompImportFiles(ctx.env, ctx.home).mcp] : []
|
|
8722
8725
|
// ADR-0026 decision 11: disabledServers, only when OMP imports us
|
|
8723
8726
|
];
|
|
8724
8727
|
const out2 = {
|
|
@@ -9769,7 +9772,7 @@ function planSkills(row, edits) {
|
|
|
9769
9772
|
}
|
|
9770
9773
|
}
|
|
9771
9774
|
function planOmpImport(row, edits, ctx) {
|
|
9772
|
-
const files = ompImportFiles(ctx.home);
|
|
9775
|
+
const files = ompImportFiles(ctx.env, ctx.home);
|
|
9773
9776
|
if (!ompImportsUs(files, ctx.env)) return;
|
|
9774
9777
|
planJsonKeys(row, edits, files.mcp, "json", (doc) => {
|
|
9775
9778
|
const cur = Array.isArray(doc[OMP_DISABLED_SERVERS_KEY]) ? doc[OMP_DISABLED_SERVERS_KEY] : [];
|
|
@@ -9875,6 +9878,17 @@ function hostBroken(bin, out2) {
|
|
|
9875
9878
|
const lines = out2.trim().split("\n");
|
|
9876
9879
|
return `${b3.prefix}${b3.fix} (${(lines.find((l) => l.includes(b3.text)) ?? lines[0]).trim()})`;
|
|
9877
9880
|
}
|
|
9881
|
+
function codexGetCheck(what, r2) {
|
|
9882
|
+
let doc;
|
|
9883
|
+
try {
|
|
9884
|
+
doc = JSON.parse(`${r2.stdout}`);
|
|
9885
|
+
} catch {
|
|
9886
|
+
doc = void 0;
|
|
9887
|
+
}
|
|
9888
|
+
if (r2.status === 0 && isObj5(doc) && doc.name === SERVER_KEY) return { name: "list", ok: true };
|
|
9889
|
+
const host = `${r2.stderr}`.split("\n").map((l) => l.trim()).filter(Boolean).slice(0, 3).join(" ") || `${r2.stdout}`.trim().split("\n")[0] || `exit ${r2.status}`;
|
|
9890
|
+
return { name: "list", ok: false, detail: `${what} does not find ${SERVER_KEY}: ${host}` };
|
|
9891
|
+
}
|
|
9878
9892
|
function listState(row, env) {
|
|
9879
9893
|
const l = row.listCommand;
|
|
9880
9894
|
if (!l || !hostBin(l.bin, env).file) return { status: void 0 };
|
|
@@ -9883,9 +9897,14 @@ function listState(row, env) {
|
|
|
9883
9897
|
return { check: "major" in v ? opencodeListCheck(l.bin, v.major, env) : { name: "list", ok: false, detail: v.error }, status: void 0 };
|
|
9884
9898
|
}
|
|
9885
9899
|
const r2 = runBin(l.bin, l.args, env);
|
|
9900
|
+
const what = `${l.bin} ${l.args.join(" ")}`;
|
|
9901
|
+
if (r2.error?.code === "ETIMEDOUT") {
|
|
9902
|
+
return { check: { name: "list", ok: false, detail: `${what} did not answer in ${VERIFY_TIMEOUT_MS / 1e3} s (${r2.signal ?? "timeout"}); run it in a terminal` }, status: void 0 };
|
|
9903
|
+
}
|
|
9904
|
+
if (l.reader === "codex-mcp-get") return { check: codexGetCheck(what, r2), status: void 0 };
|
|
9886
9905
|
const out2 = `${r2.stdout}${r2.stderr}`;
|
|
9887
9906
|
const ok = r2.status === 0 && out2.includes("context-mode");
|
|
9888
|
-
const check = { name: "list", ok, detail: ok ? void 0 : `${
|
|
9907
|
+
const check = { name: "list", ok, detail: ok ? void 0 : `${what} does not list context-mode` };
|
|
9889
9908
|
return { check, status: r2.status === 0 ? statusOf(row, `${r2.stdout}`) : void 0, broken: r2.status === 0 ? void 0 : hostBroken(l.bin, out2) };
|
|
9890
9909
|
}
|
|
9891
9910
|
var DISABLE_ALL_HOOKS = "disableAllHooks";
|
|
@@ -10092,7 +10111,7 @@ function hookRegisteredCheck(row, env, list2) {
|
|
|
10092
10111
|
const l = row.listCommand;
|
|
10093
10112
|
if (!l) return { name: "hook-registered", ok: false, detail: `no list command for ${row.id}` };
|
|
10094
10113
|
if (!list2) return { name: "hook-registered", ok: false, detail: `${l.bin} is not on PATH, so the hooks cannot be checked` };
|
|
10095
|
-
return { name: "hook-registered", ok: list2.ok, detail: list2.ok ? void 0 : `${l.bin} ${l.args.join(" ")} does not list context-mode (hooks ship in ${h2.via})` };
|
|
10114
|
+
return { name: "hook-registered", ok: list2.ok, detail: list2.ok ? void 0 : `${list2.detail ?? `${l.bin} ${l.args.join(" ")} does not list context-mode`} (hooks ship in ${h2.via})` };
|
|
10096
10115
|
}
|
|
10097
10116
|
const edits = [];
|
|
10098
10117
|
try {
|
package/copilot/plugin.json
CHANGED
package/gemini-extension.json
CHANGED