context-mode 2.0.0-next.5 → 2.0.0-next.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/hooks.json +50 -0
- package/.codex-plugin/mcp.json +14 -0
- package/.codex-plugin/plugin.json +12 -0
- package/SHA256SUMS +22 -16
- package/cli.mjs +196 -24
- package/codex/skills/ctx-doctor/SKILL.md +6 -0
- package/codex/skills/ctx-stats/SKILL.md +6 -0
- package/codex/skills/ctx-upgrade/SKILL.md +6 -0
- package/copilot/plugin.json +1 -1
- package/gemini-extension.json +1 -1
- package/hook.mjs +81 -81
- package/opencode/plugin.js +122 -30
- package/package.json +4 -1
- package/pi/index.js +122 -30
- package/qwen-extension.json +1 -1
- package/run.mjs +79 -16
- package/search.mjs +79 -16
- package/server.mjs +99 -26
- package/skills/ctx-doctor/SKILL.md +1 -1
- package/skills/ctx-stats/SKILL.md +1 -1
- package/skills/ctx-upgrade/SKILL.md +1 -1
package/search.mjs
CHANGED
|
@@ -354,8 +354,12 @@ var V1_REASON = Object.freeze({
|
|
|
354
354
|
var UPGRADE_REPORT_ONLY_REASONS = Object.freeze([V1_REASON.statusLine, V1_REASON.vscodeMcp, V1_REASON.dataDirShared, V1_REASON.tmpFile, V1_REASON.kiroSteering]);
|
|
355
355
|
var OPENCODE_TOOL_PREFIX = SERVER_KEY + "_";
|
|
356
356
|
var ZCODE_MCP_FEATURE_KEY = Object.freeze(["features", "mcp"]);
|
|
357
|
+
var CODEX_OMIT_TOOLS_FROM_FIELD = "omit_tools_from";
|
|
358
|
+
var CODEX_OMIT_DEFERRED = Object.freeze(["deferred"]);
|
|
359
|
+
var CODEX_APPROVAL_MODE_FIELD = "default_tools_approval_mode";
|
|
360
|
+
var CODEX_APPROVAL_APPROVE = "approve";
|
|
357
361
|
var OWN_MCP_ENTRY = Object.freeze({
|
|
358
|
-
codex: { file: [".codex", "config.toml"], key: ["mcp_servers", SERVER_KEY] },
|
|
362
|
+
codex: { file: [".codex", "config.toml"], key: ["mcp_servers", SERVER_KEY], fields: { [CODEX_OMIT_TOOLS_FROM_FIELD]: CODEX_OMIT_DEFERRED, [CODEX_APPROVAL_MODE_FIELD]: CODEX_APPROVAL_APPROVE } },
|
|
359
363
|
vscode: { file: [".vscode", "mcp.json"], key: ["servers", SERVER_KEY] },
|
|
360
364
|
kiro: { file: [".kiro", "settings", "mcp.json"], key: ["mcpServers", SERVER_KEY] },
|
|
361
365
|
zcode: {
|
|
@@ -746,9 +750,62 @@ function readResult4(resp) {
|
|
|
746
750
|
const isError = typeof resp === "object" && resp !== null && resp.is_error === true;
|
|
747
751
|
return { isError, bytes: Buffer.byteLength(text), text };
|
|
748
752
|
}
|
|
753
|
+
var CAMEL_EVENTS = {
|
|
754
|
+
sessionStart: "SessionStart",
|
|
755
|
+
userPromptSubmitted: "UserPromptSubmit",
|
|
756
|
+
preToolUse: "PreToolUse",
|
|
757
|
+
postToolUse: "PostToolUse",
|
|
758
|
+
preCompact: "PreCompact"
|
|
759
|
+
};
|
|
760
|
+
var EVENT_BY_KEY2 = [
|
|
761
|
+
["toolResult", "postToolUse"],
|
|
762
|
+
["toolName", "preToolUse"],
|
|
763
|
+
["prompt", "userPromptSubmitted"],
|
|
764
|
+
["source", "sessionStart"],
|
|
765
|
+
["trigger", "preCompact"]
|
|
766
|
+
];
|
|
767
|
+
var SESSION_SOURCES = { new: "startup", startup: "startup", resume: "resume" };
|
|
768
|
+
var RESULT_SUCCESS2 = "success";
|
|
769
|
+
function isRecord2(v) {
|
|
770
|
+
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
771
|
+
}
|
|
772
|
+
function readArgs2(v) {
|
|
773
|
+
if (isRecord2(v)) return v;
|
|
774
|
+
if (typeof v !== "string") return {};
|
|
775
|
+
try {
|
|
776
|
+
const parsed = JSON.parse(v);
|
|
777
|
+
return isRecord2(parsed) ? parsed : {};
|
|
778
|
+
} catch {
|
|
779
|
+
return {};
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
function readCamelResult(v) {
|
|
783
|
+
const r = isRecord2(v) ? v : {};
|
|
784
|
+
const text = typeof r.textResultForLlm === "string" ? r.textResultForLlm : "";
|
|
785
|
+
return { isError: typeof r.resultType === "string" && r.resultType !== RESULT_SUCCESS2, bytes: Buffer.byteLength(text), text };
|
|
786
|
+
}
|
|
787
|
+
function decodeCamel(p, name) {
|
|
788
|
+
const event = typeof name === "string" ? CAMEL_EVENTS[name] ?? VSCODE_EVENTS.find((e) => e === name) : void 0;
|
|
789
|
+
if (event === void 0) throw new Error("vscode: unknown hook event " + String(name));
|
|
790
|
+
const ev = { event, agent: "vscode", sessionId: String(p.sessionId ?? ""), cwd: String(p.cwd ?? "") };
|
|
791
|
+
if (event === "SessionStart" && typeof p.source === "string" && SESSION_SOURCES[p.source] !== void 0) ev.source = SESSION_SOURCES[p.source];
|
|
792
|
+
if (event === "UserPromptSubmit" && typeof p.prompt === "string") ev.prompt = p.prompt;
|
|
793
|
+
if (event === "PreToolUse" || event === "PostToolUse") {
|
|
794
|
+
const toolName = String(p.toolName ?? "");
|
|
795
|
+
ev.tool = { name: toolName, canonicalName: canonicalName4(toolName), input: readArgs2(p.toolArgs) };
|
|
796
|
+
}
|
|
797
|
+
if (event === "PostToolUse") ev.result = readCamelResult(p.toolResult);
|
|
798
|
+
return ev;
|
|
799
|
+
}
|
|
749
800
|
function decode6(raw) {
|
|
750
801
|
if (typeof raw !== "object" || raw === null || Array.isArray(raw)) throw new Error("vscode: hook payload is not a JSON object");
|
|
751
802
|
const p = raw;
|
|
803
|
+
if (p.hookEventName !== void 0) return decodeCamel(p, p.hookEventName);
|
|
804
|
+
if (p.hook_event_name === void 0) {
|
|
805
|
+
const byKey = EVENT_BY_KEY2.find(([key]) => Object.hasOwn(p, key))?.[1];
|
|
806
|
+
if (byKey === void 0) throw new Error("vscode: missing required field hook_event_name");
|
|
807
|
+
return decodeCamel(p, byKey);
|
|
808
|
+
}
|
|
752
809
|
const event = VSCODE_EVENTS.find((e) => e === p.hook_event_name);
|
|
753
810
|
if (event === void 0) throw new Error("vscode: unknown hook event " + String(p.hook_event_name));
|
|
754
811
|
const ev = { event, agent: "vscode", sessionId: String(p.session_id ?? ""), cwd: String(p.cwd ?? "") };
|
|
@@ -756,7 +813,7 @@ function decode6(raw) {
|
|
|
756
813
|
if (event === "UserPromptSubmit" && typeof p.prompt === "string") ev.prompt = p.prompt;
|
|
757
814
|
if (event === "PreToolUse" || event === "PostToolUse") {
|
|
758
815
|
const name = String(p.tool_name ?? "");
|
|
759
|
-
const input =
|
|
816
|
+
const input = isRecord2(p.tool_input) ? p.tool_input : {};
|
|
760
817
|
ev.tool = { name, canonicalName: canonicalName4(name), input };
|
|
761
818
|
}
|
|
762
819
|
if (event === "PostToolUse") ev.result = readResult4(p.tool_response);
|
|
@@ -775,12 +832,14 @@ var KIRO_EVENTS = {
|
|
|
775
832
|
PromptSubmit: "UserPromptSubmit",
|
|
776
833
|
userPromptSubmit: "UserPromptSubmit",
|
|
777
834
|
PreToolUse: "PreToolUse",
|
|
778
|
-
|
|
835
|
+
preToolUse: "PreToolUse",
|
|
836
|
+
PostToolUse: "PostToolUse",
|
|
837
|
+
postToolUse: "PostToolUse"
|
|
779
838
|
};
|
|
780
839
|
var PROMPT_ENV = "USER_PROMPT";
|
|
781
840
|
var MCP_PREFIX3 = "mcp_";
|
|
782
|
-
var
|
|
783
|
-
var NATIVE_TO_CANONICAL5 =
|
|
841
|
+
var SHELL_TOOL_NAMES = Object.freeze(["execute_bash", "execute_pwsh", "shell"]);
|
|
842
|
+
var NATIVE_TO_CANONICAL5 = Object.fromEntries(SHELL_TOOL_NAMES.map((n) => [n, "Bash"]));
|
|
784
843
|
var MCP_SEP3 = "_";
|
|
785
844
|
var KIRO_SOURCES = { startup: "startup", resume: "resume", clear: "clear", compact: "compact" };
|
|
786
845
|
function canonicalName5(name) {
|
|
@@ -921,8 +980,8 @@ var OPENCODE_EVENTS = {
|
|
|
921
980
|
compaction: "PreCompact",
|
|
922
981
|
"step-finish": "Usage"
|
|
923
982
|
};
|
|
924
|
-
var
|
|
925
|
-
var NATIVE_TO_CANONICAL7 = { webfetch: "WebFetch", [
|
|
983
|
+
var SHELL_TOOL_NAME2 = "bash";
|
|
984
|
+
var NATIVE_TO_CANONICAL7 = { webfetch: "WebFetch", [SHELL_TOOL_NAME2]: "Bash" };
|
|
926
985
|
function toCanonicalTool(name) {
|
|
927
986
|
if (name.startsWith(OWN_WIRE_PREFIX)) return name.slice(OWN_WIRE_PREFIX.length);
|
|
928
987
|
return Object.prototype.hasOwnProperty.call(NATIVE_TO_CANONICAL7, name) ? NATIVE_TO_CANONICAL7[name] : name;
|
|
@@ -1042,8 +1101,8 @@ var ADAPTERS = Object.freeze([
|
|
|
1042
1101
|
hookTimeoutMs: HOOK_TIMEOUT_MS,
|
|
1043
1102
|
denyChannel: "deny-reason",
|
|
1044
1103
|
hookChannel: { kind: "package", path: "hooks/qwen.json" },
|
|
1045
|
-
skillChannel: { kind: "
|
|
1046
|
-
// ADR-0020
|
|
1104
|
+
skillChannel: { kind: "package", path: "skills" },
|
|
1105
|
+
// ADR-0020, D-HQ-SKILLS-3: qwen loads <extension>/skills, shared with gemini
|
|
1047
1106
|
decode: decode4,
|
|
1048
1107
|
encode: encode4
|
|
1049
1108
|
},
|
|
@@ -1079,8 +1138,8 @@ var ADAPTERS = Object.freeze([
|
|
|
1079
1138
|
hookTimeoutMs: HOOK_TIMEOUT_MS,
|
|
1080
1139
|
denyChannel: "deny-reason",
|
|
1081
1140
|
hookChannel: { kind: "home-file", path: ".copilot/hooks/context-mode-vscode.json" },
|
|
1082
|
-
skillChannel: { kind: "home-dir", path: ".
|
|
1083
|
-
// ADR-0020
|
|
1141
|
+
skillChannel: { kind: "home-dir", path: ".agents/skills" },
|
|
1142
|
+
// ADR-0020, D-HQ-COPILOT-NAMES-3: Copilot CLI owns ~/.copilot/skills
|
|
1084
1143
|
decode: decode6,
|
|
1085
1144
|
encode: encode6
|
|
1086
1145
|
},
|
|
@@ -1089,9 +1148,9 @@ var ADAPTERS = Object.freeze([
|
|
|
1089
1148
|
installMode: "mcp-entry",
|
|
1090
1149
|
projectSource: "arg:--agent+cwd",
|
|
1091
1150
|
toolNamePrefix: TOOL_NAME_PREFIX7,
|
|
1092
|
-
nativeTools: { shell: [
|
|
1151
|
+
nativeTools: { shell: [...SHELL_TOOL_NAMES] },
|
|
1093
1152
|
execReadOnlyHint: false,
|
|
1094
|
-
// D-HF-KIRO-SHELL-1
|
|
1153
|
+
// D-HF-KIRO-SHELL-1, D-N7-KIRO-1
|
|
1095
1154
|
eventMap: { SessionStart: "SessionStart", UserPromptSubmit: "UserPromptSubmit", PreToolUse: "PreToolUse", PostToolUse: "PostToolUse" },
|
|
1096
1155
|
compactDelivery: "none",
|
|
1097
1156
|
compactSummary: "none",
|
|
@@ -1104,7 +1163,7 @@ var ADAPTERS = Object.freeze([
|
|
|
1104
1163
|
encode: encode7
|
|
1105
1164
|
},
|
|
1106
1165
|
{
|
|
1107
|
-
// toolNamePrefix
|
|
1166
|
+
// toolNamePrefix is the documented ZCode name mcp__<server>__<tool> (D-N7-ZCODE-NAMES-1); nativeTools are Claude names.
|
|
1108
1167
|
id: "zcode",
|
|
1109
1168
|
installMode: "hooks+mcp",
|
|
1110
1169
|
projectSource: "spawn-cwd",
|
|
@@ -1146,7 +1205,7 @@ var ADAPTERS = Object.freeze([
|
|
|
1146
1205
|
installMode: "in-process",
|
|
1147
1206
|
projectSource: "spawn-cwd",
|
|
1148
1207
|
toolNamePrefix: TOOL_NAME_PREFIX10,
|
|
1149
|
-
nativeTools: { shell: [
|
|
1208
|
+
nativeTools: { shell: [SHELL_TOOL_NAME2] },
|
|
1150
1209
|
execReadOnlyHint: false,
|
|
1151
1210
|
// D-HF-OPENCODE-SHELL-1
|
|
1152
1211
|
// Usage: step-finish cost row (DEVIATIONS D-M5-arch-2).
|
|
@@ -1168,6 +1227,10 @@ var REPLACE_ROWS = /* @__PURE__ */ new Set(["claude-code", "gemini", "copilot-cl
|
|
|
1168
1227
|
function hasReplace(row) {
|
|
1169
1228
|
return REPLACE_ROWS.has(row.id);
|
|
1170
1229
|
}
|
|
1230
|
+
var DUMP_REPLACE_ROWS = /* @__PURE__ */ new Set(["claude-code", "copilot-cli", "pi"]);
|
|
1231
|
+
function dumpRunsThenReplaces(row) {
|
|
1232
|
+
return DUMP_REPLACE_ROWS.has(row.id) && hasReplace(row);
|
|
1233
|
+
}
|
|
1171
1234
|
function getAdapter(id) {
|
|
1172
1235
|
return BY_ID.get(id);
|
|
1173
1236
|
}
|
|
@@ -4642,7 +4705,7 @@ function read(ev, row, input) {
|
|
|
4642
4705
|
return ALLOW;
|
|
4643
4706
|
}
|
|
4644
4707
|
function shellDump(cmds, cwd, row) {
|
|
4645
|
-
if (row.nativeTools.read !== void 0 && row.nativeTools.read.length > 0 &&
|
|
4708
|
+
if (row.nativeTools.read !== void 0 && row.nativeTools.read.length > 0 && dumpRunsThenReplaces(row)) return null;
|
|
4646
4709
|
if (cmds.length !== 1) return null;
|
|
4647
4710
|
const c = cmds[0];
|
|
4648
4711
|
if (c.redirectsToFile || c.endsInBoundedSink) return null;
|
package/server.mjs
CHANGED
|
@@ -28312,7 +28312,7 @@ var DECISION_SOURCE = "decision";
|
|
|
28312
28312
|
var DECISION_USER_LABEL = "decision (user)";
|
|
28313
28313
|
var RELEASE_REPO_URL = "https://github.com/mksglu/context-mode.git";
|
|
28314
28314
|
var RELEASE_BRANCH = "release";
|
|
28315
|
-
var BUNDLE_SHA = true ? "
|
|
28315
|
+
var BUNDLE_SHA = true ? "f61b6973877b47851ac5938c46fee1399946289e" : void 0;
|
|
28316
28316
|
var DOCTOR_CHECK_ORDER = Object.freeze(["D1", "D2", "D3", "D4", "D5", "D5b", "D6", "D7", "D8", "D9", "D10"]);
|
|
28317
28317
|
var DOCTOR_LABEL = Object.freeze({
|
|
28318
28318
|
D1: "version",
|
|
@@ -28551,6 +28551,7 @@ var V1_HOOKS_DIR_NAME = "hooks";
|
|
|
28551
28551
|
var SETTINGS_FILE = "settings.json";
|
|
28552
28552
|
var CLAUDE_USER_CONFIG_FILE = ".claude.json";
|
|
28553
28553
|
var HOOKS_JSON_FILE = "hooks.json";
|
|
28554
|
+
var CODEX_HOME_ENV = "CODEX_HOME";
|
|
28554
28555
|
var CONFIG_TOML_FILE = "config.toml";
|
|
28555
28556
|
var CONFIG_JSON_FILE = "config.json";
|
|
28556
28557
|
var ZCODE_CLI_DIR = "cli";
|
|
@@ -28616,8 +28617,12 @@ var JSON_INDENT_UNIT = " ";
|
|
|
28616
28617
|
var MCP_COMMAND_FIELD = "command";
|
|
28617
28618
|
var MCP_ARGS_FIELD = "args";
|
|
28618
28619
|
var ZCODE_MCP_FEATURE_KEY = Object.freeze(["features", "mcp"]);
|
|
28620
|
+
var CODEX_OMIT_TOOLS_FROM_FIELD = "omit_tools_from";
|
|
28621
|
+
var CODEX_OMIT_DEFERRED = Object.freeze(["deferred"]);
|
|
28622
|
+
var CODEX_APPROVAL_MODE_FIELD = "default_tools_approval_mode";
|
|
28623
|
+
var CODEX_APPROVAL_APPROVE = "approve";
|
|
28619
28624
|
var OWN_MCP_ENTRY = Object.freeze({
|
|
28620
|
-
codex: { file: [".codex", "config.toml"], key: ["mcp_servers", SERVER_KEY] },
|
|
28625
|
+
codex: { file: [".codex", "config.toml"], key: ["mcp_servers", SERVER_KEY], fields: { [CODEX_OMIT_TOOLS_FROM_FIELD]: CODEX_OMIT_DEFERRED, [CODEX_APPROVAL_MODE_FIELD]: CODEX_APPROVAL_APPROVE } },
|
|
28621
28626
|
vscode: { file: [".vscode", "mcp.json"], key: ["servers", SERVER_KEY] },
|
|
28622
28627
|
kiro: { file: [".kiro", "settings", "mcp.json"], key: ["mcpServers", SERVER_KEY] },
|
|
28623
28628
|
zcode: {
|
|
@@ -29057,6 +29062,10 @@ function homeDirOf(env) {
|
|
|
29057
29062
|
if (profile !== void 0 && profile !== "") return profile;
|
|
29058
29063
|
return null;
|
|
29059
29064
|
}
|
|
29065
|
+
function codexDirOf(env, home) {
|
|
29066
|
+
const dir = env[CODEX_HOME_ENV];
|
|
29067
|
+
return dir !== void 0 && dir !== "" ? dir : join(home, ...AGENT_HOME_DIR.codex);
|
|
29068
|
+
}
|
|
29060
29069
|
function homeOf(env) {
|
|
29061
29070
|
const home = homeDirOf(env);
|
|
29062
29071
|
if (home !== null) return home;
|
|
@@ -31536,16 +31545,23 @@ var TYPO_MIN_LEN = 5;
|
|
|
31536
31545
|
var TYPO_MAX_DIST = 2;
|
|
31537
31546
|
function typoTerms(db, words) {
|
|
31538
31547
|
const has = stmt(db.raw, "SELECT 1 AS x FROM chunks_vocab WHERE term = ?");
|
|
31539
|
-
const near = stmt(db.raw, "SELECT term, doc FROM chunks_vocab WHERE length(term) BETWEEN ? AND ?");
|
|
31548
|
+
const near = stmt(db.raw, "SELECT term, doc, length(term) AS n FROM chunks_vocab WHERE length(term) BETWEEN ? AND ?");
|
|
31549
|
+
const stems = queryStems(words.join(" "));
|
|
31550
|
+
const miss = stems.map((stem) => has.get(stem) === void 0 && [...stem].length >= TYPO_MIN_LEN);
|
|
31551
|
+
if (!miss.includes(true)) return null;
|
|
31552
|
+
const lens = stems.filter((_, i) => miss[i]).map((stem) => stem.length);
|
|
31553
|
+
const rows = near.all(Math.min(...lens) - TYPO_MAX_DIST, Math.max(...lens) + TYPO_MAX_DIST);
|
|
31540
31554
|
let changed = false;
|
|
31541
31555
|
const out = [];
|
|
31542
|
-
|
|
31543
|
-
if (
|
|
31556
|
+
stems.forEach((stem, i) => {
|
|
31557
|
+
if (!miss[i]) {
|
|
31544
31558
|
out.push(stem);
|
|
31545
|
-
|
|
31559
|
+
return;
|
|
31546
31560
|
}
|
|
31547
31561
|
let best = null;
|
|
31548
|
-
for (const r of
|
|
31562
|
+
for (const r of rows) {
|
|
31563
|
+
const n = Number(r.n);
|
|
31564
|
+
if (n < stem.length - TYPO_MAX_DIST || n > stem.length + TYPO_MAX_DIST) continue;
|
|
31549
31565
|
const d = editDistance(stem, r.term, TYPO_MAX_DIST);
|
|
31550
31566
|
if (d > TYPO_MAX_DIST) continue;
|
|
31551
31567
|
if (best === null || d < best.d || d === best.d && (r.doc > best.doc || r.doc === best.doc && r.term < best.term)) {
|
|
@@ -31556,7 +31572,7 @@ function typoTerms(db, words) {
|
|
|
31556
31572
|
out.push(best.term);
|
|
31557
31573
|
changed = true;
|
|
31558
31574
|
}
|
|
31559
|
-
}
|
|
31575
|
+
});
|
|
31560
31576
|
return changed ? out.map((t) => `"${t.replaceAll('"', '""')}"*`) : null;
|
|
31561
31577
|
}
|
|
31562
31578
|
function ftsQuery(db, q, scope, ctx, sessionId, limit, offset, source) {
|
|
@@ -44492,9 +44508,62 @@ function readResult4(resp) {
|
|
|
44492
44508
|
const isError = typeof resp === "object" && resp !== null && resp.is_error === true;
|
|
44493
44509
|
return { isError, bytes: Buffer.byteLength(text), text };
|
|
44494
44510
|
}
|
|
44511
|
+
var CAMEL_EVENTS = {
|
|
44512
|
+
sessionStart: "SessionStart",
|
|
44513
|
+
userPromptSubmitted: "UserPromptSubmit",
|
|
44514
|
+
preToolUse: "PreToolUse",
|
|
44515
|
+
postToolUse: "PostToolUse",
|
|
44516
|
+
preCompact: "PreCompact"
|
|
44517
|
+
};
|
|
44518
|
+
var EVENT_BY_KEY2 = [
|
|
44519
|
+
["toolResult", "postToolUse"],
|
|
44520
|
+
["toolName", "preToolUse"],
|
|
44521
|
+
["prompt", "userPromptSubmitted"],
|
|
44522
|
+
["source", "sessionStart"],
|
|
44523
|
+
["trigger", "preCompact"]
|
|
44524
|
+
];
|
|
44525
|
+
var SESSION_SOURCES = { new: "startup", startup: "startup", resume: "resume" };
|
|
44526
|
+
var RESULT_SUCCESS2 = "success";
|
|
44527
|
+
function isRecord2(v) {
|
|
44528
|
+
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
44529
|
+
}
|
|
44530
|
+
function readArgs2(v) {
|
|
44531
|
+
if (isRecord2(v)) return v;
|
|
44532
|
+
if (typeof v !== "string") return {};
|
|
44533
|
+
try {
|
|
44534
|
+
const parsed = JSON.parse(v);
|
|
44535
|
+
return isRecord2(parsed) ? parsed : {};
|
|
44536
|
+
} catch {
|
|
44537
|
+
return {};
|
|
44538
|
+
}
|
|
44539
|
+
}
|
|
44540
|
+
function readCamelResult(v) {
|
|
44541
|
+
const r = isRecord2(v) ? v : {};
|
|
44542
|
+
const text = typeof r.textResultForLlm === "string" ? r.textResultForLlm : "";
|
|
44543
|
+
return { isError: typeof r.resultType === "string" && r.resultType !== RESULT_SUCCESS2, bytes: Buffer.byteLength(text), text };
|
|
44544
|
+
}
|
|
44545
|
+
function decodeCamel(p, name) {
|
|
44546
|
+
const event = typeof name === "string" ? CAMEL_EVENTS[name] ?? VSCODE_EVENTS.find((e) => e === name) : void 0;
|
|
44547
|
+
if (event === void 0) throw new Error("vscode: unknown hook event " + String(name));
|
|
44548
|
+
const ev = { event, agent: "vscode", sessionId: String(p.sessionId ?? ""), cwd: String(p.cwd ?? "") };
|
|
44549
|
+
if (event === "SessionStart" && typeof p.source === "string" && SESSION_SOURCES[p.source] !== void 0) ev.source = SESSION_SOURCES[p.source];
|
|
44550
|
+
if (event === "UserPromptSubmit" && typeof p.prompt === "string") ev.prompt = p.prompt;
|
|
44551
|
+
if (event === "PreToolUse" || event === "PostToolUse") {
|
|
44552
|
+
const toolName = String(p.toolName ?? "");
|
|
44553
|
+
ev.tool = { name: toolName, canonicalName: canonicalName4(toolName), input: readArgs2(p.toolArgs) };
|
|
44554
|
+
}
|
|
44555
|
+
if (event === "PostToolUse") ev.result = readCamelResult(p.toolResult);
|
|
44556
|
+
return ev;
|
|
44557
|
+
}
|
|
44495
44558
|
function decode8(raw) {
|
|
44496
44559
|
if (typeof raw !== "object" || raw === null || Array.isArray(raw)) throw new Error("vscode: hook payload is not a JSON object");
|
|
44497
44560
|
const p = raw;
|
|
44561
|
+
if (p.hookEventName !== void 0) return decodeCamel(p, p.hookEventName);
|
|
44562
|
+
if (p.hook_event_name === void 0) {
|
|
44563
|
+
const byKey = EVENT_BY_KEY2.find(([key]) => Object.hasOwn(p, key))?.[1];
|
|
44564
|
+
if (byKey === void 0) throw new Error("vscode: missing required field hook_event_name");
|
|
44565
|
+
return decodeCamel(p, byKey);
|
|
44566
|
+
}
|
|
44498
44567
|
const event = VSCODE_EVENTS.find((e) => e === p.hook_event_name);
|
|
44499
44568
|
if (event === void 0) throw new Error("vscode: unknown hook event " + String(p.hook_event_name));
|
|
44500
44569
|
const ev = { event, agent: "vscode", sessionId: String(p.session_id ?? ""), cwd: String(p.cwd ?? "") };
|
|
@@ -44502,7 +44571,7 @@ function decode8(raw) {
|
|
|
44502
44571
|
if (event === "UserPromptSubmit" && typeof p.prompt === "string") ev.prompt = p.prompt;
|
|
44503
44572
|
if (event === "PreToolUse" || event === "PostToolUse") {
|
|
44504
44573
|
const name = String(p.tool_name ?? "");
|
|
44505
|
-
const input =
|
|
44574
|
+
const input = isRecord2(p.tool_input) ? p.tool_input : {};
|
|
44506
44575
|
ev.tool = { name, canonicalName: canonicalName4(name), input };
|
|
44507
44576
|
}
|
|
44508
44577
|
if (event === "PostToolUse") ev.result = readResult4(p.tool_response);
|
|
@@ -44521,12 +44590,14 @@ var KIRO_EVENTS = {
|
|
|
44521
44590
|
PromptSubmit: "UserPromptSubmit",
|
|
44522
44591
|
userPromptSubmit: "UserPromptSubmit",
|
|
44523
44592
|
PreToolUse: "PreToolUse",
|
|
44524
|
-
|
|
44593
|
+
preToolUse: "PreToolUse",
|
|
44594
|
+
PostToolUse: "PostToolUse",
|
|
44595
|
+
postToolUse: "PostToolUse"
|
|
44525
44596
|
};
|
|
44526
44597
|
var PROMPT_ENV = "USER_PROMPT";
|
|
44527
44598
|
var MCP_PREFIX3 = "mcp_";
|
|
44528
|
-
var
|
|
44529
|
-
var NATIVE_TO_CANONICAL5 =
|
|
44599
|
+
var SHELL_TOOL_NAMES = Object.freeze(["execute_bash", "execute_pwsh", "shell"]);
|
|
44600
|
+
var NATIVE_TO_CANONICAL5 = Object.fromEntries(SHELL_TOOL_NAMES.map((n) => [n, "Bash"]));
|
|
44530
44601
|
var MCP_SEP3 = "_";
|
|
44531
44602
|
var KIRO_SOURCES = { startup: "startup", resume: "resume", clear: "clear", compact: "compact" };
|
|
44532
44603
|
function canonicalName5(name) {
|
|
@@ -44667,8 +44738,8 @@ var OPENCODE_EVENTS = {
|
|
|
44667
44738
|
compaction: "PreCompact",
|
|
44668
44739
|
"step-finish": "Usage"
|
|
44669
44740
|
};
|
|
44670
|
-
var
|
|
44671
|
-
var NATIVE_TO_CANONICAL7 = { webfetch: "WebFetch", [
|
|
44741
|
+
var SHELL_TOOL_NAME2 = "bash";
|
|
44742
|
+
var NATIVE_TO_CANONICAL7 = { webfetch: "WebFetch", [SHELL_TOOL_NAME2]: "Bash" };
|
|
44672
44743
|
function toCanonicalTool(name) {
|
|
44673
44744
|
if (name.startsWith(OWN_WIRE_PREFIX)) return name.slice(OWN_WIRE_PREFIX.length);
|
|
44674
44745
|
return Object.prototype.hasOwnProperty.call(NATIVE_TO_CANONICAL7, name) ? NATIVE_TO_CANONICAL7[name] : name;
|
|
@@ -44788,8 +44859,8 @@ var ADAPTERS = Object.freeze([
|
|
|
44788
44859
|
hookTimeoutMs: HOOK_TIMEOUT_MS,
|
|
44789
44860
|
denyChannel: "deny-reason",
|
|
44790
44861
|
hookChannel: { kind: "package", path: "hooks/qwen.json" },
|
|
44791
|
-
skillChannel: { kind: "
|
|
44792
|
-
// ADR-0020
|
|
44862
|
+
skillChannel: { kind: "package", path: "skills" },
|
|
44863
|
+
// ADR-0020, D-HQ-SKILLS-3: qwen loads <extension>/skills, shared with gemini
|
|
44793
44864
|
decode: decode6,
|
|
44794
44865
|
encode: encode6
|
|
44795
44866
|
},
|
|
@@ -44825,8 +44896,8 @@ var ADAPTERS = Object.freeze([
|
|
|
44825
44896
|
hookTimeoutMs: HOOK_TIMEOUT_MS,
|
|
44826
44897
|
denyChannel: "deny-reason",
|
|
44827
44898
|
hookChannel: { kind: "home-file", path: ".copilot/hooks/context-mode-vscode.json" },
|
|
44828
|
-
skillChannel: { kind: "home-dir", path: ".
|
|
44829
|
-
// ADR-0020
|
|
44899
|
+
skillChannel: { kind: "home-dir", path: ".agents/skills" },
|
|
44900
|
+
// ADR-0020, D-HQ-COPILOT-NAMES-3: Copilot CLI owns ~/.copilot/skills
|
|
44830
44901
|
decode: decode8,
|
|
44831
44902
|
encode: encode8
|
|
44832
44903
|
},
|
|
@@ -44835,9 +44906,9 @@ var ADAPTERS = Object.freeze([
|
|
|
44835
44906
|
installMode: "mcp-entry",
|
|
44836
44907
|
projectSource: "arg:--agent+cwd",
|
|
44837
44908
|
toolNamePrefix: TOOL_NAME_PREFIX7,
|
|
44838
|
-
nativeTools: { shell: [
|
|
44909
|
+
nativeTools: { shell: [...SHELL_TOOL_NAMES] },
|
|
44839
44910
|
execReadOnlyHint: false,
|
|
44840
|
-
// D-HF-KIRO-SHELL-1
|
|
44911
|
+
// D-HF-KIRO-SHELL-1, D-N7-KIRO-1
|
|
44841
44912
|
eventMap: { SessionStart: "SessionStart", UserPromptSubmit: "UserPromptSubmit", PreToolUse: "PreToolUse", PostToolUse: "PostToolUse" },
|
|
44842
44913
|
compactDelivery: "none",
|
|
44843
44914
|
compactSummary: "none",
|
|
@@ -44850,7 +44921,7 @@ var ADAPTERS = Object.freeze([
|
|
|
44850
44921
|
encode: encode9
|
|
44851
44922
|
},
|
|
44852
44923
|
{
|
|
44853
|
-
// toolNamePrefix
|
|
44924
|
+
// toolNamePrefix is the documented ZCode name mcp__<server>__<tool> (D-N7-ZCODE-NAMES-1); nativeTools are Claude names.
|
|
44854
44925
|
id: "zcode",
|
|
44855
44926
|
installMode: "hooks+mcp",
|
|
44856
44927
|
projectSource: "spawn-cwd",
|
|
@@ -44892,7 +44963,7 @@ var ADAPTERS = Object.freeze([
|
|
|
44892
44963
|
installMode: "in-process",
|
|
44893
44964
|
projectSource: "spawn-cwd",
|
|
44894
44965
|
toolNamePrefix: TOOL_NAME_PREFIX10,
|
|
44895
|
-
nativeTools: { shell: [
|
|
44966
|
+
nativeTools: { shell: [SHELL_TOOL_NAME2] },
|
|
44896
44967
|
execReadOnlyHint: false,
|
|
44897
44968
|
// D-HF-OPENCODE-SHELL-1
|
|
44898
44969
|
// Usage: step-finish cost row (DEVIATIONS D-M5-arch-2).
|
|
@@ -45805,6 +45876,7 @@ function ownHooks(block, shape, timeoutKey, native, agent) {
|
|
|
45805
45876
|
var validTimeout = (v) => typeof v === "number" && Number.isFinite(v) && v > 0;
|
|
45806
45877
|
function mcpFile(row5, home, env) {
|
|
45807
45878
|
const spec = OWN_MCP_ENTRY[row5.id];
|
|
45879
|
+
if (row5.id === "codex") return join9(codexDirOf(env, home), CONFIG_TOML_FILE);
|
|
45808
45880
|
if (spec !== void 0) return join9(home, ...spec.file);
|
|
45809
45881
|
if (row5.id === "opencode") return join9(home, ...AGENT_HOME_DIR.opencode, OPENCODE_BASE_CONFIG_FILE);
|
|
45810
45882
|
if (row5.id === "pi") {
|
|
@@ -45832,9 +45904,10 @@ function hookParts(row5, home, env, worktree) {
|
|
|
45832
45904
|
let block;
|
|
45833
45905
|
try {
|
|
45834
45906
|
const root = spec.root === "plugin" ? resolvePluginRoot(row5, env) : spec.root === "home" ? home : worktree;
|
|
45835
|
-
|
|
45907
|
+
const file2 = row5.id === "codex" ? join9(codexDirOf(env, home), HOOKS_JSON_FILE) : join9(root, ...spec.file);
|
|
45908
|
+
block = hostConfigValueAt(readParsed(row5.id, file2).value, spec.key);
|
|
45836
45909
|
if (row5.id === "codex") {
|
|
45837
|
-
const config4 = readParsed(row5.id, join9(
|
|
45910
|
+
const config4 = readParsed(row5.id, join9(codexDirOf(env, home), CONFIG_TOML_FILE)).value;
|
|
45838
45911
|
if (hostConfigValueAt(config4, CODEX_FEATURES_HOOKS_KEY) === false) return [PART_HOOKS];
|
|
45839
45912
|
}
|
|
45840
45913
|
} catch {
|
|
@@ -46230,8 +46303,8 @@ async function hookRow(ctx, adapter, host) {
|
|
|
46230
46303
|
bundleDir: host.bundleDir,
|
|
46231
46304
|
env: buildChildEnv(host.env),
|
|
46232
46305
|
signal: ctx.signal,
|
|
46233
|
-
codexConfigDir:
|
|
46234
|
-
// same Codex dir D3 reads
|
|
46306
|
+
codexConfigDir: codexDirOf(host.env, needHome(host.env)),
|
|
46307
|
+
// same Codex dir D3 reads (D-N6-CODEX-HOME-2)
|
|
46235
46308
|
db
|
|
46236
46309
|
});
|
|
46237
46310
|
} finally {
|
|
@@ -3,4 +3,4 @@ name: ctx-doctor
|
|
|
3
3
|
description: Check that context-mode is installed and working, as a table.
|
|
4
4
|
disable-model-invocation: true
|
|
5
5
|
---
|
|
6
|
-
Call the mcp_context-mode_ctx_doctor tool and show its table to the user unchanged. If a row failed, list the fixes it names, in order.
|
|
6
|
+
Call the mcp_context-mode_ctx_doctor or mcp__context-mode__ctx_doctor tool and show its table to the user unchanged. If a row failed, list the fixes it names, in order.
|
|
@@ -3,4 +3,4 @@ name: ctx-stats
|
|
|
3
3
|
description: Show how much context context-mode saved, as a table.
|
|
4
4
|
disable-model-invocation: true
|
|
5
5
|
---
|
|
6
|
-
Call the mcp_context-mode_ctx_stats tool and show its table to the user unchanged. Add one sentence under the table that names the largest saving.
|
|
6
|
+
Call the mcp_context-mode_ctx_stats or mcp__context-mode__ctx_stats tool and show its table to the user unchanged. Add one sentence under the table that names the largest saving.
|
|
@@ -3,4 +3,4 @@ name: ctx-upgrade
|
|
|
3
3
|
description: Update context-mode to the latest release.
|
|
4
4
|
disable-model-invocation: true
|
|
5
5
|
---
|
|
6
|
-
Call the mcp_context-mode_ctx_upgrade tool and show its table to the user. Then call mcp_context-mode_ctx_doctor and show its table. If a restart is needed, say so in one sentence.
|
|
6
|
+
Call the mcp_context-mode_ctx_upgrade or mcp__context-mode__ctx_upgrade tool and show its table to the user. Then call mcp_context-mode_ctx_doctor or mcp__context-mode__ctx_doctor and show its table. If a restart is needed, say so in one sentence.
|