context-mode 2.0.0-next.16 → 2.0.0-next.18
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/SHA256SUMS +15 -15
- package/cli.mjs +55 -44
- package/copilot/plugin.json +1 -1
- package/fixtures/hook-roundtrip.json +20 -3
- package/gemini-extension.json +1 -1
- package/hook.mjs +92 -88
- package/opencode/plugin.js +518 -106
- package/package.json +1 -1
- package/pi/index.js +575 -136
- package/qwen-extension.json +1 -1
- package/run.mjs +369 -22
- package/search.mjs +369 -22
- package/server.mjs +164 -69
package/SHA256SUMS
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
fa9376d5f77c34e0b6a12280a826333a96768bb8a17e576958aef0f6502e466f .claude-plugin/marketplace.json
|
|
2
|
+
c8b8c128e95ddff655078c9b3d9e296ee50b6bfa14f3b982c32769d10c3404f5 .claude-plugin/plugin.json
|
|
3
3
|
187503e1455560d4ab5a72e3b8cd2f274abd4ccc5faa60dd66c37e44bb5f10c2 .codex-plugin/hooks.json
|
|
4
4
|
4edea851775bc3f0418f8d9cf6ead74f2767c3a9e3b8c05749eacb78ebb3b896 .codex-plugin/mcp.json
|
|
5
|
-
|
|
5
|
+
49e4e0561b7bb072c50eb225a16f0884cbb29f8d5a003d3acbad8e87eb61212d .codex-plugin/plugin.json
|
|
6
6
|
1773e40a89384dd1af9023ba533da1908f3e2435dbaaa7cc941edf0514148313 claude-code/skills/ctx-doctor/SKILL.md
|
|
7
7
|
34fffb9c76d69c551f07036230bec0fbaca7a69177a5a47f89ddb9a9990a1fa2 claude-code/skills/ctx-stats/SKILL.md
|
|
8
8
|
d8f835d2f2b3eb70c5902f8707e7c5857977cec9e20ace76c499378a04e178e0 claude-code/skills/ctx-upgrade/SKILL.md
|
|
9
|
-
|
|
9
|
+
a05eca0e2ef3846dece2be2da496fd4594e8d01017003af866020008f03595ae cli.mjs
|
|
10
10
|
83c297020ed0c592fc68c9c482546a6999d41df5d06d8a329498f10edb1bd38e codex/skills/ctx-doctor/SKILL.md
|
|
11
11
|
adc2c374f699d3698110920bb48411965de09fc6e7232ce59c913f6d58c0d738 codex/skills/ctx-stats/SKILL.md
|
|
12
12
|
5c12cdd19a5e3ed7d9ba3a47b24d03864a28d36cf7006876284ee07cd4221ec4 codex/skills/ctx-upgrade/SKILL.md
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
0580b0661427021abb16f74f219775db2adc63d0fa0c10141ab80a847636e273 copilot/plugin.json
|
|
14
|
+
e3bc6cae0bd51b806d81631879711bbc48c679fc929b2642ed4634438364167d fixtures/hook-roundtrip.json
|
|
15
|
+
ef70a0db91076959e51a28ab48ab0072b97b35b6604d4c72152a6a0212826b21 gemini-extension.json
|
|
16
|
+
77ad72252ee33c80977f820ba5572c0cd898e141ae698a631379706edcada51d hook.mjs
|
|
17
17
|
1f8d8650d2b38737522cab6b875878e8baf84a74acf98cd924c7af22852d873f hooks/claude-code.json
|
|
18
18
|
2524a0eb52683b65c65943c5097db513e9845ba14e84324b39e9a8ea2bb43193 hooks/codex.json
|
|
19
19
|
b656fed2b754ebcfd4c156bee81d5879c21a8083fc0d6b8e3241462b63a214b6 hooks/copilot-cli.json
|
|
@@ -22,16 +22,16 @@ f336d1db67de49e641687bbd41ba1a9424e31dfe2377b2284bf44358288ebd8b hooks/kiro.jso
|
|
|
22
22
|
017c9cc3997dd53231b8548b1a1609fddc51177af53501565a4f334602039860 hooks/qwen.json
|
|
23
23
|
33f69267645338d0dc392ce551dcd7c69a0b508113469d6ea637d3f34239ef1d hooks/vscode.json
|
|
24
24
|
085630bccf2073ac9a62be24ef91dfc47d106092dc82c822db70890b7d3ae1c0 hooks/zcode.json
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
63c2293f34fe8c778b558255cbbd2cd15b11b5c930b6900e1f936494b734a12c opencode/plugin.js
|
|
26
|
+
2d9442994723137eb6bc983c2476c3fdc3d46042155c20d61c3ed5b4c447419f package.json
|
|
27
|
+
5ff9e02c6ea5700ce790f26e13934e4887595802a56c670cefc435d2e5347281 pi/index.js
|
|
28
28
|
8712881622c9905aa4836af50d903042d34a91506264e459bc7839331f6f0192 pi/skills/ctx-doctor/SKILL.md
|
|
29
29
|
8d6e8e2a82eb079bddc60727f52d9f9a6e0bf9e15391357fed82ee76ab5fe76c pi/skills/ctx-stats/SKILL.md
|
|
30
30
|
db6f9c006bc864a7271f1eeffb1e316ebb537a3414f1c22f8b9de0a896e8e3c5 pi/skills/ctx-upgrade/SKILL.md
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
3c4cf805a7b49196cd647a4731b87ec8e88cb4314a0b9e4533f65d39ca10cb34 qwen-extension.json
|
|
32
|
+
2100fc1015fc5346a57da56c7c43f8cba6a0e57d4ce32a45b70ae0baa4987b00 run.mjs
|
|
33
|
+
2100fc1015fc5346a57da56c7c43f8cba6a0e57d4ce32a45b70ae0baa4987b00 search.mjs
|
|
34
|
+
b67d546eed2e9d862c7c287496d9f47f1351be06fe7c1b8502e038ba9c36422c server.mjs
|
|
35
35
|
e5503a22a6238901484d123efc11d2d933aa9a54c6ac2018812cfa65ec4e53e3 skills/ctx-doctor/SKILL.md
|
|
36
36
|
1044587a1906c69f2467c089a25e19819a290ea5728389bd1f086c6dfc0d0c51 skills/ctx-stats/SKILL.md
|
|
37
37
|
c1cac75b7506ee0d06089ce611ac6dc9314cf12435da318ce88ad50e2c5debbf skills/ctx-upgrade/SKILL.md
|
package/cli.mjs
CHANGED
|
@@ -782,7 +782,8 @@ var RESULT_SUCCESS = "success";
|
|
|
782
782
|
function isRecord(v) {
|
|
783
783
|
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
784
784
|
}
|
|
785
|
-
var
|
|
785
|
+
var SHELL_TOOL_NAMES = Object.freeze(["bash", "powershell"]);
|
|
786
|
+
var NATIVE_TO_CANONICAL3 = Object.fromEntries(SHELL_TOOL_NAMES.map((n3) => [n3, "Bash"]));
|
|
786
787
|
function canonicalName3(name) {
|
|
787
788
|
if (name.startsWith(TOOL_NAME_PREFIX5)) return name.slice(TOOL_NAME_PREFIX5.length);
|
|
788
789
|
if (Object.hasOwn(NATIVE_TO_CANONICAL3, name)) return NATIVE_TO_CANONICAL3[name];
|
|
@@ -863,11 +864,11 @@ var VSCODE_EVENTS = ["SessionStart", "UserPromptSubmit", "PreToolUse", "PostTool
|
|
|
863
864
|
var MCP_PREFIX2 = "mcp_";
|
|
864
865
|
var MCP_SEP2 = "_";
|
|
865
866
|
var SESSION_START_NEW = "new";
|
|
866
|
-
var
|
|
867
|
+
var SHELL_TOOL_NAMES2 = Object.freeze(["run_in_terminal", "runTerminalCommand", "bash", "powershell"]);
|
|
867
868
|
var READ_TOOL_NAMES = Object.freeze(["read_file", "view"]);
|
|
868
869
|
var WEBFETCH_TOOL_NAMES = Object.freeze(["fetch_webpage", "web_fetch"]);
|
|
869
870
|
var NATIVE_TO_CANONICAL4 = Object.fromEntries([
|
|
870
|
-
...
|
|
871
|
+
...SHELL_TOOL_NAMES2.map((n3) => [n3, "Bash"]),
|
|
871
872
|
...READ_TOOL_NAMES.map((n3) => [n3, "Read"]),
|
|
872
873
|
...WEBFETCH_TOOL_NAMES.map((n3) => [n3, "WebFetch"])
|
|
873
874
|
]);
|
|
@@ -995,8 +996,8 @@ var KIRO_EVENTS = {
|
|
|
995
996
|
};
|
|
996
997
|
var PROMPT_ENV = "USER_PROMPT";
|
|
997
998
|
var MCP_PREFIX3 = "mcp_";
|
|
998
|
-
var
|
|
999
|
-
var NATIVE_TO_CANONICAL5 = Object.fromEntries(
|
|
999
|
+
var SHELL_TOOL_NAMES3 = Object.freeze(["execute_bash", "execute_pwsh", "shell"]);
|
|
1000
|
+
var NATIVE_TO_CANONICAL5 = Object.fromEntries(SHELL_TOOL_NAMES3.map((n3) => [n3, "Bash"]));
|
|
1000
1001
|
var MCP_SEP3 = "_";
|
|
1001
1002
|
var KIRO_SOURCES = { startup: "startup", resume: "resume", clear: "clear", compact: "compact" };
|
|
1002
1003
|
function canonicalName5(name) {
|
|
@@ -1268,8 +1269,9 @@ var ADAPTERS = Object.freeze([
|
|
|
1268
1269
|
installMode: "plugin",
|
|
1269
1270
|
projectSource: "arg:--agent+cwd",
|
|
1270
1271
|
toolNamePrefix: TOOL_NAME_PREFIX5,
|
|
1271
|
-
nativeTools: { shell: [
|
|
1272
|
+
nativeTools: { shell: [...SHELL_TOOL_NAMES] },
|
|
1272
1273
|
execReadOnlyHint: false,
|
|
1274
|
+
// D-PWSH-DUMP-1
|
|
1273
1275
|
eventMap: { SessionStart: "sessionStart", UserPromptSubmit: "userPromptSubmitted", PreToolUse: "preToolUse", PostToolUse: "postToolUse" },
|
|
1274
1276
|
compactDelivery: "pending-flag",
|
|
1275
1277
|
compactSummary: "none",
|
|
@@ -1287,7 +1289,7 @@ var ADAPTERS = Object.freeze([
|
|
|
1287
1289
|
projectSource: "arg:workspaceFolder",
|
|
1288
1290
|
toolNamePrefix: TOOL_NAME_PREFIX6,
|
|
1289
1291
|
// PreCompact sets the pending flag (ADR-0009 §6, DEVIATIONS D-M3-A4-1).
|
|
1290
|
-
nativeTools: { shell: [...
|
|
1292
|
+
nativeTools: { shell: [...SHELL_TOOL_NAMES2], read: [...READ_TOOL_NAMES], webfetch: [...WEBFETCH_TOOL_NAMES] },
|
|
1291
1293
|
// D-HF-VSCODE-PROJECT-1, D-N7-VSCODE-TOOLS-1
|
|
1292
1294
|
execReadOnlyHint: false,
|
|
1293
1295
|
eventMap: { ...CLAUDE_EVENTS, PreCompact: "PreCompact" },
|
|
@@ -1306,7 +1308,7 @@ var ADAPTERS = Object.freeze([
|
|
|
1306
1308
|
installMode: "mcp-entry",
|
|
1307
1309
|
projectSource: "arg:--agent+cwd",
|
|
1308
1310
|
toolNamePrefix: TOOL_NAME_PREFIX7,
|
|
1309
|
-
nativeTools: { shell: [...
|
|
1311
|
+
nativeTools: { shell: [...SHELL_TOOL_NAMES3] },
|
|
1310
1312
|
execReadOnlyHint: false,
|
|
1311
1313
|
// D-HF-KIRO-SHELL-1, D-N7-KIRO-1
|
|
1312
1314
|
eventMap: { SessionStart: "SessionStart", UserPromptSubmit: "UserPromptSubmit", PreToolUse: "PreToolUse", PostToolUse: "PostToolUse" },
|
|
@@ -1595,7 +1597,7 @@ Examples:
|
|
|
1595
1597
|
// src/cli/commands.ts
|
|
1596
1598
|
import { spawnSync as spawnSync3 } from "node:child_process";
|
|
1597
1599
|
import { createHash as createHash2 } from "node:crypto";
|
|
1598
|
-
import { existsSync as
|
|
1600
|
+
import { existsSync as existsSync13, mkdirSync as mkdirSync4, writeFileSync as writeFileSync3 } from "node:fs";
|
|
1599
1601
|
import os from "node:os";
|
|
1600
1602
|
import path13 from "node:path";
|
|
1601
1603
|
|
|
@@ -7054,6 +7056,7 @@ function editHostConfigText(agent, path15, text2, format, wanted) {
|
|
|
7054
7056
|
}
|
|
7055
7057
|
|
|
7056
7058
|
// src/core/ops/doctor-config.ts
|
|
7059
|
+
import { existsSync as existsSync5, readdirSync as readdirSync4 } from "node:fs";
|
|
7057
7060
|
import { join as join6 } from "node:path";
|
|
7058
7061
|
|
|
7059
7062
|
// src/core/ops/detect-v1.ts
|
|
@@ -7380,6 +7383,7 @@ function composeMatcher(row, event) {
|
|
|
7380
7383
|
if (event === POST_TOOL_USE && hasReplace(row)) alts.push(MCP_ANY_MATCH);
|
|
7381
7384
|
return MATCHER_OPEN + alts.join(MATCHER_ALT) + MATCHER_CLOSE;
|
|
7382
7385
|
}
|
|
7386
|
+
var CODEX_PLUGIN_KEY = `${SERVER_KEY}@${SERVER_KEY}`;
|
|
7383
7387
|
|
|
7384
7388
|
// src/setup/hook-shapes.ts
|
|
7385
7389
|
var MS_PER_SECOND = 1e3;
|
|
@@ -7508,7 +7512,7 @@ function serverCmd(ctx, id) {
|
|
|
7508
7512
|
}
|
|
7509
7513
|
function hookCommandString(row) {
|
|
7510
7514
|
const [node, file, flag, id] = row.hookCommand ?? [];
|
|
7511
|
-
return `"${node}" "${file}" ${flag} ${id}`;
|
|
7515
|
+
return `${node === HOST_NODE_COMMAND ? node : `"${node}"`} "${file}" ${flag} ${id}`;
|
|
7512
7516
|
}
|
|
7513
7517
|
function golden(row, home) {
|
|
7514
7518
|
const shell = row.nativeTools.shell?.[0];
|
|
@@ -7630,8 +7634,10 @@ function buildRegistry(ctx) {
|
|
|
7630
7634
|
const id = row.id;
|
|
7631
7635
|
const config = configFor(ctx, id);
|
|
7632
7636
|
const hookFiles = hookFilesFor(ctx, id);
|
|
7633
|
-
const
|
|
7634
|
-
const
|
|
7637
|
+
const runCommand2 = [process.execPath, path3.join(ctx.pkgDir, HOOK_BUNDLE), AGENT_FLAG, id];
|
|
7638
|
+
const bareNode = id === "codex" && (ctx.platform ?? process.platform) === "win32";
|
|
7639
|
+
const hookCommand = bareNode ? [HOST_NODE_COMMAND, ...runCommand2.slice(1)] : runCommand2;
|
|
7640
|
+
const command = `${bareNode ? HOST_NODE_COMMAND : `"${hookCommand[0]}"`} "${hookCommand[1]}" ${AGENT_FLAG} ${id}`;
|
|
7635
7641
|
const hookInstall = hookInstallFor(ctx, getAdapter(id), command);
|
|
7636
7642
|
const skillInstall = skillInstallFor(ctx, row);
|
|
7637
7643
|
const copilotSettings = id === "copilot-cli" ? agentPath(ctx, id, [COPILOT_DIR, "settings.json"]) : void 0;
|
|
@@ -7653,7 +7659,7 @@ function buildRegistry(ctx) {
|
|
|
7653
7659
|
hookFiles,
|
|
7654
7660
|
hookInstall,
|
|
7655
7661
|
skillInstall,
|
|
7656
|
-
hookRunCommand:
|
|
7662
|
+
hookRunCommand: runCommand2,
|
|
7657
7663
|
allowedWrites: [...new Set(writes.map((f2) => path3.resolve(f2)))],
|
|
7658
7664
|
goldenPayload: golden(row, ctx.home)
|
|
7659
7665
|
};
|
|
@@ -7674,7 +7680,7 @@ function assertWritable(row, file) {
|
|
|
7674
7680
|
}
|
|
7675
7681
|
|
|
7676
7682
|
// src/setup/gemini-gate.ts
|
|
7677
|
-
import { existsSync as
|
|
7683
|
+
import { existsSync as existsSync6, readFileSync as readFileSync4 } from "node:fs";
|
|
7678
7684
|
import path4 from "node:path";
|
|
7679
7685
|
var GEMINI_DIR = ".gemini";
|
|
7680
7686
|
var SETTINGS_FILE2 = "settings.json";
|
|
@@ -7688,7 +7694,7 @@ function systemSettingsPath(env) {
|
|
|
7688
7694
|
return "/etc/gemini-cli/settings.json";
|
|
7689
7695
|
}
|
|
7690
7696
|
function load(file) {
|
|
7691
|
-
if (!
|
|
7697
|
+
if (!existsSync6(file)) return void 0;
|
|
7692
7698
|
try {
|
|
7693
7699
|
return { file, doc: parseHostConfig(OWN_AGENT, file, hostText(readFileSync4(file, "utf8")), "jsonc") };
|
|
7694
7700
|
} catch {
|
|
@@ -7722,7 +7728,7 @@ function geminiSettingsGate(env, home, cwd) {
|
|
|
7722
7728
|
}
|
|
7723
7729
|
|
|
7724
7730
|
// src/setup/zcode-gate.ts
|
|
7725
|
-
import { existsSync as
|
|
7731
|
+
import { existsSync as existsSync7, readFileSync as readFileSync5 } from "node:fs";
|
|
7726
7732
|
import path5 from "node:path";
|
|
7727
7733
|
var OWN_AGENT2 = "zcode";
|
|
7728
7734
|
var EVENTS = ["SessionStart", "UserPromptSubmit", "PreToolUse", "PermissionRequest", "PostToolUse", "PostToolUseFailure", "Stop"];
|
|
@@ -7814,7 +7820,7 @@ function zcodeSchemaBad(doc) {
|
|
|
7814
7820
|
}
|
|
7815
7821
|
function zcodeConfigGate(home) {
|
|
7816
7822
|
const file = path5.join(home, ".zcode", "cli", "config.json");
|
|
7817
|
-
if (!
|
|
7823
|
+
if (!existsSync7(file)) return void 0;
|
|
7818
7824
|
let doc;
|
|
7819
7825
|
try {
|
|
7820
7826
|
doc = parseHostConfig(OWN_AGENT2, file, hostText(readFileSync5(file, "utf8")), "json");
|
|
@@ -7827,7 +7833,7 @@ function zcodeConfigGate(home) {
|
|
|
7827
7833
|
}
|
|
7828
7834
|
|
|
7829
7835
|
// src/setup/pi-gate.ts
|
|
7830
|
-
import { existsSync as
|
|
7836
|
+
import { existsSync as existsSync8, readFileSync as readFileSync6, realpathSync as realpathSync3 } from "node:fs";
|
|
7831
7837
|
import path6 from "node:path";
|
|
7832
7838
|
var OWN_FILE = "pi/index.js";
|
|
7833
7839
|
var EXTENSIONS_KEY = "extensions";
|
|
@@ -7836,7 +7842,7 @@ var TRUST_FILE = "trust.json";
|
|
|
7836
7842
|
var ALWAYS = "always";
|
|
7837
7843
|
var SOURCE_PREFIXES = ["npm:", "git:"];
|
|
7838
7844
|
function load2(file) {
|
|
7839
|
-
if (!
|
|
7845
|
+
if (!existsSync8(file)) return void 0;
|
|
7840
7846
|
try {
|
|
7841
7847
|
return { file, doc: parseHostConfig("pi", file, hostText(readFileSync6(file, "utf8")), "json") };
|
|
7842
7848
|
} catch {
|
|
@@ -7927,7 +7933,7 @@ function piSettingsGate(env, home, pkgDir, cwd) {
|
|
|
7927
7933
|
}
|
|
7928
7934
|
|
|
7929
7935
|
// src/setup/vscode-gate.ts
|
|
7930
|
-
import { existsSync as
|
|
7936
|
+
import { existsSync as existsSync9, readFileSync as readFileSync7 } from "node:fs";
|
|
7931
7937
|
import path7 from "node:path";
|
|
7932
7938
|
var SETTINGS_FILE3 = "settings.json";
|
|
7933
7939
|
var WORKSPACE_DIR = ".vscode";
|
|
@@ -7936,7 +7942,7 @@ var LOCATIONS_KEY = "chat.hookFilesLocations";
|
|
|
7936
7942
|
var OWN_LOCATION = "~/.copilot/hooks";
|
|
7937
7943
|
var MANAGED_KEYS = ["allowManagedHooksOnly", "strictPluginOnlyCustomization"];
|
|
7938
7944
|
function load3(file) {
|
|
7939
|
-
if (!
|
|
7945
|
+
if (!existsSync9(file)) return void 0;
|
|
7940
7946
|
try {
|
|
7941
7947
|
return { file, doc: parseHostConfig("vscode", file, hostText(readFileSync7(file, "utf8")), "jsonc") };
|
|
7942
7948
|
} catch {
|
|
@@ -7978,7 +7984,7 @@ function vscodeSettingsGate(env, home, cwd, managedFile = managedSettingsPath(en
|
|
|
7978
7984
|
}
|
|
7979
7985
|
|
|
7980
7986
|
// src/setup/qwen-gate.ts
|
|
7981
|
-
import { existsSync as
|
|
7987
|
+
import { existsSync as existsSync10, readFileSync as readFileSync8 } from "node:fs";
|
|
7982
7988
|
import path8 from "node:path";
|
|
7983
7989
|
var KEY = "disableAllHooks";
|
|
7984
7990
|
var SETTINGS = "settings.json";
|
|
@@ -7994,7 +8000,7 @@ function settingsFiles(env, home, cwd, platform) {
|
|
|
7994
8000
|
}
|
|
7995
8001
|
function qwenHooksOff(env, home, cwd = process.cwd(), platform = process.platform) {
|
|
7996
8002
|
for (const file of settingsFiles(env, home, cwd, platform)) {
|
|
7997
|
-
if (!
|
|
8003
|
+
if (!existsSync10(file)) continue;
|
|
7998
8004
|
let value;
|
|
7999
8005
|
try {
|
|
8000
8006
|
value = hostConfigValueAt(parseHostConfig("qwen", file, hostText(readFileSync8(file, "utf8")), "jsonc"), [KEY]);
|
|
@@ -8008,7 +8014,7 @@ function qwenHooksOff(env, home, cwd = process.cwd(), platform = process.platfor
|
|
|
8008
8014
|
|
|
8009
8015
|
// src/setup/codex-trust.ts
|
|
8010
8016
|
import { createHash } from "node:crypto";
|
|
8011
|
-
import { existsSync as
|
|
8017
|
+
import { existsSync as existsSync11, realpathSync as realpathSync4 } from "node:fs";
|
|
8012
8018
|
import path10 from "node:path";
|
|
8013
8019
|
import { spawn } from "node:child_process";
|
|
8014
8020
|
|
|
@@ -8116,7 +8122,7 @@ function snake(name) {
|
|
|
8116
8122
|
function realFile(file) {
|
|
8117
8123
|
let dir = path10.resolve(file);
|
|
8118
8124
|
const rest = [];
|
|
8119
|
-
while (!
|
|
8125
|
+
while (!existsSync11(dir) && path10.dirname(dir) !== dir) {
|
|
8120
8126
|
rest.unshift(path10.basename(dir));
|
|
8121
8127
|
dir = path10.dirname(dir);
|
|
8122
8128
|
}
|
|
@@ -8253,8 +8259,13 @@ function listPluginHooks(env, pluginId, cwd) {
|
|
|
8253
8259
|
send({ id: 1, method: "initialize", params: { clientInfo: { name: "context-mode-setup", version: "2.0.0" } } });
|
|
8254
8260
|
});
|
|
8255
8261
|
}
|
|
8262
|
+
var HASH_PART_SEP = "/";
|
|
8263
|
+
function hookHashOf(currentHash) {
|
|
8264
|
+
const cut = currentHash.indexOf(HASH_PART_SEP);
|
|
8265
|
+
return cut < 0 ? currentHash : currentHash.slice(0, cut);
|
|
8266
|
+
}
|
|
8256
8267
|
function pluginTrustEntries(hooks) {
|
|
8257
|
-
return hooks.filter((h2) => !h2.trusted).map((h2) => [[...TRUST_KEY, h2.key], { [HASH_FIELD]: h2.hash }]);
|
|
8268
|
+
return hooks.filter((h2) => !h2.trusted).map((h2) => [[...TRUST_KEY, h2.key], { [HASH_FIELD]: hookHashOf(h2.hash) }]);
|
|
8258
8269
|
}
|
|
8259
8270
|
|
|
8260
8271
|
// src/setup/copilot-hooks.ts
|
|
@@ -8354,7 +8365,7 @@ function listCopilotHooks(env, file, cwd) {
|
|
|
8354
8365
|
|
|
8355
8366
|
// src/setup/engine.ts
|
|
8356
8367
|
import { spawn as spawn3, spawnSync as spawnSync2 } from "node:child_process";
|
|
8357
|
-
import { closeSync, existsSync as
|
|
8368
|
+
import { closeSync, existsSync as existsSync12, mkdirSync as mkdirSync3, mkdtempSync, openSync, readFileSync as readFileSync9, readSync, readdirSync as readdirSync5, realpathSync as realpathSync6, rmSync, statSync as statSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
8358
8369
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
8359
8370
|
import path12 from "node:path";
|
|
8360
8371
|
|
|
@@ -8451,7 +8462,7 @@ function isNativeBinary(file) {
|
|
|
8451
8462
|
function owningPackage(dir) {
|
|
8452
8463
|
for (let d = dir; ; d = path12.dirname(d)) {
|
|
8453
8464
|
const f2 = path12.join(d, "package.json");
|
|
8454
|
-
if (
|
|
8465
|
+
if (existsSync12(f2)) {
|
|
8455
8466
|
try {
|
|
8456
8467
|
return String(JSON.parse(hostText(readFileSync9(f2, "utf8"))).name);
|
|
8457
8468
|
} catch {
|
|
@@ -8469,7 +8480,7 @@ function hostBin(bin, env, platform = process.platform) {
|
|
|
8469
8480
|
for (const dir of pathEntries(get("PATH") ?? "", platform)) {
|
|
8470
8481
|
const own2 = which(bin, { PATH: dir, ...get("PATHEXT") ? { PATHEXT: get("PATHEXT") } : {} }, platform);
|
|
8471
8482
|
for (const f2 of [own2, ...real2.extra.map((p3) => path12.join(dir, ...p3))]) {
|
|
8472
|
-
if (!f2 || !
|
|
8483
|
+
if (!f2 || !existsSync12(f2) || !statSync2(f2).isFile()) continue;
|
|
8473
8484
|
const file = realpathSync6(f2);
|
|
8474
8485
|
if (isNativeBinary(file) || owningPackage(path12.dirname(file)) === real2.pkg) return { file, shims };
|
|
8475
8486
|
shims.push(f2);
|
|
@@ -8486,10 +8497,10 @@ function runBin(bin, args, env, input) {
|
|
|
8486
8497
|
return spawnShim(hostBin(bin, env).file ?? bin, args, env, { encoding: "utf8", input, timeout: VERIFY_TIMEOUT_MS });
|
|
8487
8498
|
}
|
|
8488
8499
|
function readOr(file) {
|
|
8489
|
-
return
|
|
8500
|
+
return existsSync12(file) ? hostText(readFileSync9(file, "utf8")) : void 0;
|
|
8490
8501
|
}
|
|
8491
8502
|
function readRaw(file) {
|
|
8492
|
-
return
|
|
8503
|
+
return existsSync12(file) ? readFileSync9(file, "utf8") : void 0;
|
|
8493
8504
|
}
|
|
8494
8505
|
var atomicWrite = atomicWriteFile;
|
|
8495
8506
|
function pidAlive(pid) {
|
|
@@ -8632,7 +8643,7 @@ function isNativeSpec(e) {
|
|
|
8632
8643
|
return typeof e === "string" && e.startsWith(NATIVE_PLUGIN_PREFIX);
|
|
8633
8644
|
}
|
|
8634
8645
|
function isStaleOwnPlugin(e, entry2) {
|
|
8635
|
-
if (typeof e !== "string" || e === entry2 || !path12.isAbsolute(e) ||
|
|
8646
|
+
if (typeof e !== "string" || e === entry2 || !path12.isAbsolute(e) || existsSync12(e)) return false;
|
|
8636
8647
|
const seg = e.split("\\").join("/").split("/");
|
|
8637
8648
|
const n3 = seg.length;
|
|
8638
8649
|
return n3 >= 3 && seg[n3 - 1] === "plugin.js" && seg[n3 - 2] === "opencode" && seg[n3 - 3] === "context-mode";
|
|
@@ -8689,7 +8700,7 @@ function planSkills(row, edits) {
|
|
|
8689
8700
|
const s = row.skillInstall;
|
|
8690
8701
|
if (s.kind !== "dir") return;
|
|
8691
8702
|
for (const f2 of s.files) {
|
|
8692
|
-
if (!
|
|
8703
|
+
if (!existsSync12(f2.src)) throw new Error(`preflight: ${f2.src} is missing`);
|
|
8693
8704
|
const after = renderSkill(readFileSync9(f2.src, "utf8"), s.prefixes);
|
|
8694
8705
|
const before = readRaw(f2.file);
|
|
8695
8706
|
if (before !== after) edits.push({ plain: true, file: f2.file, before, after, changes: [{ file: f2.file, path: f2.name, before: before === void 0 ? null : "old", after: "SKILL.md" }] });
|
|
@@ -8860,7 +8871,7 @@ function mcpCheck(cmd, env) {
|
|
|
8860
8871
|
});
|
|
8861
8872
|
}
|
|
8862
8873
|
function hookRound(row, env) {
|
|
8863
|
-
const cmd = row.
|
|
8874
|
+
const cmd = row.hookRunCommand;
|
|
8864
8875
|
const input = JSON.stringify(row.goldenPayload);
|
|
8865
8876
|
const wall = [];
|
|
8866
8877
|
const bare = [];
|
|
@@ -8953,7 +8964,7 @@ var SEEN_SQL = "SELECT 1 FROM events WHERE agent = ? LIMIT 1";
|
|
|
8953
8964
|
var NOT_SEEN_LINE = "not seen yet, run one tool call";
|
|
8954
8965
|
function hookSeenCheck(row, home) {
|
|
8955
8966
|
const base = path12.join(home, STATE_DIR, PROJECTS_DIR_NAME);
|
|
8956
|
-
const dirs =
|
|
8967
|
+
const dirs = existsSync12(base) ? readdirSync5(base) : [];
|
|
8957
8968
|
let sqlite;
|
|
8958
8969
|
try {
|
|
8959
8970
|
sqlite = process.getBuiltinModule("node:sqlite");
|
|
@@ -8962,7 +8973,7 @@ function hookSeenCheck(row, home) {
|
|
|
8962
8973
|
}
|
|
8963
8974
|
for (const d of dirs) {
|
|
8964
8975
|
const file = path12.join(base, d, DB_FILE_NAME);
|
|
8965
|
-
if (!sqlite || !
|
|
8976
|
+
if (!sqlite || !existsSync12(file)) continue;
|
|
8966
8977
|
let db;
|
|
8967
8978
|
try {
|
|
8968
8979
|
db = new sqlite.DatabaseSync(file, { readOnly: true });
|
|
@@ -8977,10 +8988,10 @@ function hookSeenCheck(row, home) {
|
|
|
8977
8988
|
function skillsCheck(row, pkgDir) {
|
|
8978
8989
|
const s = row.skillInstall;
|
|
8979
8990
|
if (s.kind === "package") {
|
|
8980
|
-
const miss = COMMAND_SKILLS.map((n3) => path12.join(pkgDir, s.via, n3, SKILL_FILE)).filter((f2) => !
|
|
8991
|
+
const miss = COMMAND_SKILLS.map((n3) => path12.join(pkgDir, s.via, n3, SKILL_FILE)).filter((f2) => !existsSync12(f2));
|
|
8981
8992
|
return { name: "skills", ok: miss.length === 0, detail: miss.length ? `missing ${miss.join(", ")}` : void 0 };
|
|
8982
8993
|
}
|
|
8983
|
-
const bad = s.files.filter((f2) => readRaw(f2.file) !== (
|
|
8994
|
+
const bad = s.files.filter((f2) => readRaw(f2.file) !== (existsSync12(f2.src) ? renderSkill(readFileSync9(f2.src, "utf8"), s.prefixes) : void 0));
|
|
8984
8995
|
return { name: "skills", ok: bad.length === 0, detail: bad.length ? `${bad.map((f2) => f2.file).join(", ")} missing or without the ${s.prefixes.join(" / ") || "plain"} tool prefix` : void 0 };
|
|
8985
8996
|
}
|
|
8986
8997
|
var PLUGIN_ENABLED = "enabled";
|
|
@@ -9265,14 +9276,14 @@ function agentHomeDir(id, ctx) {
|
|
|
9265
9276
|
return path12.join(ctx.home, ...AGENT_HOME_DIR[id]);
|
|
9266
9277
|
}
|
|
9267
9278
|
function detectAgents(reg, ctx) {
|
|
9268
|
-
return reg.filter((r2) =>
|
|
9279
|
+
return reg.filter((r2) => existsSync12(agentHomeDir(r2.id, ctx)) || r2.listCommand && which(r2.listCommand.bin, ctx.env)).map((r2) => r2.id);
|
|
9269
9280
|
}
|
|
9270
9281
|
async function runSetup(opts) {
|
|
9271
9282
|
const ctx = { home: opts.home, pkgDir: opts.pkgDir, env: opts.env };
|
|
9272
9283
|
const runId = opts.runId ?? (/* @__PURE__ */ new Date()).toISOString().split(":").join("-").split(".").join("-");
|
|
9273
9284
|
const reg = buildRegistry(ctx);
|
|
9274
9285
|
for (const f2 of ["server.mjs", "hook.mjs"]) {
|
|
9275
|
-
if (!
|
|
9286
|
+
if (!existsSync12(path12.join(ctx.pkgDir, f2))) return { exitCode: 1, agents: [], error: `preflight: ${path12.join(ctx.pkgDir, f2)} is missing` };
|
|
9276
9287
|
}
|
|
9277
9288
|
const ids = opts.agents ?? detectAgents(reg, ctx);
|
|
9278
9289
|
const root = path12.join(ctx.home, STATE_DIR);
|
|
@@ -9363,7 +9374,7 @@ async function runDoctor(opts) {
|
|
|
9363
9374
|
const ctx = { home: opts.home, pkgDir: opts.pkgDir, env: opts.env };
|
|
9364
9375
|
const reg = buildRegistry(ctx);
|
|
9365
9376
|
for (const f2 of ["server.mjs", "hook.mjs"]) {
|
|
9366
|
-
if (!
|
|
9377
|
+
if (!existsSync12(path12.join(ctx.pkgDir, f2))) return { exitCode: 1, agents: [], error: `preflight: ${path12.join(ctx.pkgDir, f2)} is missing` };
|
|
9367
9378
|
}
|
|
9368
9379
|
const ids = opts.agents ?? detectAgents(reg, ctx);
|
|
9369
9380
|
const run = new Run(path12.join(ctx.home, STATE_DIR), "doctor");
|
|
@@ -9425,12 +9436,12 @@ function runRemove(opts) {
|
|
|
9425
9436
|
const env = opts.env ?? process.env;
|
|
9426
9437
|
const root = path12.join(opts.home, STATE_DIR);
|
|
9427
9438
|
const base = path12.join(root, BACKUP_DIR);
|
|
9428
|
-
if (!
|
|
9439
|
+
if (!existsSync12(base)) return { exitCode: 0, restored: 0 };
|
|
9429
9440
|
const held = takeLock(root, "remove");
|
|
9430
9441
|
if (held) return { exitCode: 1, restored: 0, error: held };
|
|
9431
9442
|
let restored = 0;
|
|
9432
9443
|
try {
|
|
9433
|
-
const runs =
|
|
9444
|
+
const runs = readdirSync5(base).map((r2) => path12.join(base, r2)).filter((d) => existsSync12(path12.join(d, MANIFEST))).sort().reverse();
|
|
9434
9445
|
for (const dir of runs) {
|
|
9435
9446
|
const m3 = JSON.parse(readFileSync9(path12.join(dir, MANIFEST), "utf8"));
|
|
9436
9447
|
undo(dir, m3.entries, env);
|
|
@@ -9895,7 +9906,7 @@ async function upgrade(ui) {
|
|
|
9895
9906
|
}
|
|
9896
9907
|
const root = `${spawnSync3(npm, ["root", "-g"], { env: ui.ctx.env, encoding: "utf8", shell, windowsHide: true }).stdout ?? ""}`.trim();
|
|
9897
9908
|
const cli = path13.join(root, "context-mode", "cli.mjs");
|
|
9898
|
-
if (!root || !
|
|
9909
|
+
if (!root || !existsSync13(cli)) {
|
|
9899
9910
|
err(`FAIL upgrade: ${cli} not found after ${install}. Fix: ${install}`);
|
|
9900
9911
|
return EXIT_FAIL;
|
|
9901
9912
|
}
|
package/copilot/plugin.json
CHANGED
|
@@ -5,18 +5,35 @@
|
|
|
5
5
|
"session_id": "11111111-1111-1111-1111-111111111111",
|
|
6
6
|
"transcript_path": "/tmp/transcript.jsonl",
|
|
7
7
|
"cwd": "/tmp/project",
|
|
8
|
+
"prompt_id": "33333333-3333-3333-3333-333333333333",
|
|
9
|
+
"permission_mode": "default",
|
|
10
|
+
"effort": {
|
|
11
|
+
"level": "low"
|
|
12
|
+
},
|
|
8
13
|
"hook_event_name": "PreToolUse",
|
|
9
14
|
"tool_name": "Bash",
|
|
10
|
-
"tool_input": {
|
|
15
|
+
"tool_input": {
|
|
16
|
+
"command": "echo gp3-fixture-probe",
|
|
17
|
+
"description": "Echo probe string"
|
|
18
|
+
},
|
|
19
|
+
"tool_use_id": "toolu_01KiGwzUtjjgbHVTtADJu5a9"
|
|
11
20
|
}
|
|
12
21
|
},
|
|
13
22
|
"codex": {
|
|
14
23
|
"event": "PreToolUse",
|
|
15
24
|
"payload": {
|
|
16
25
|
"session_id": "22222222-2222-2222-2222-222222222222",
|
|
26
|
+
"turn_id": "33333333-3333-3333-3333-333333333333",
|
|
27
|
+
"transcript_path": "/tmp/transcript.jsonl",
|
|
17
28
|
"cwd": "/tmp/project",
|
|
18
|
-
"
|
|
19
|
-
"
|
|
29
|
+
"hook_event_name": "PreToolUse",
|
|
30
|
+
"model": "gpt-6-astra",
|
|
31
|
+
"permission_mode": "bypassPermissions",
|
|
32
|
+
"tool_name": "Bash",
|
|
33
|
+
"tool_input": {
|
|
34
|
+
"command": "echo gp3-fixture-probe"
|
|
35
|
+
},
|
|
36
|
+
"tool_use_id": "exec-44444444-4444-4444-4444-444444444444"
|
|
20
37
|
}
|
|
21
38
|
}
|
|
22
39
|
}
|
package/gemini-extension.json
CHANGED