context-mode 2.0.0-next.17 → 2.0.0-next.20
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 +59 -43
- 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 +583 -111
- package/package.json +5 -1
- package/pi/index.js +583 -138
- package/qwen-extension.json +1 -1
- package/run.mjs +371 -23
- package/search.mjs +371 -23
- package/server.mjs +172 -71
package/SHA256SUMS
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
1891466a144df85c1f933ef2177ceaa5e7d21d0f27ebce77a0276dffd5490180 .claude-plugin/marketplace.json
|
|
2
|
+
ce0bd4a4136a2ed741048b9b409ec6d7e2e4a6212f6d274a20300b939861b09b .claude-plugin/plugin.json
|
|
3
3
|
187503e1455560d4ab5a72e3b8cd2f274abd4ccc5faa60dd66c37e44bb5f10c2 .codex-plugin/hooks.json
|
|
4
4
|
4edea851775bc3f0418f8d9cf6ead74f2767c3a9e3b8c05749eacb78ebb3b896 .codex-plugin/mcp.json
|
|
5
|
-
|
|
5
|
+
5462e4e6f9cbf7e568ff3b97db119ed872b20fd7a9c4e827925762689b1d9ca2 .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
|
+
f8be0a11f3ffb0fff1555e12824652f8e9617fcd8e48f9ced88166f7f65ed006 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
|
+
fd06e1e104d35319418e62e3c16b81027e022f7f59666c25aad3b2db4090b133 copilot/plugin.json
|
|
14
|
+
e3bc6cae0bd51b806d81631879711bbc48c679fc929b2642ed4634438364167d fixtures/hook-roundtrip.json
|
|
15
|
+
fa093979cbd93b0716b9be153f9f581abd74d2c5a4963a10b7aa63dc386aaf4b gemini-extension.json
|
|
16
|
+
b58303ab9c463e36c85ad20ecf375080c049d82f7dd1e2dd5fbcff4b8830a72c 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
|
+
0587b8de9dcd7c441f8a93c976e72637a6f2a33f5ded4398175df2c2fa3dc20c opencode/plugin.js
|
|
26
|
+
9ac18c9a8856bc75cb7b9a5a67af2650f19204b323cce625dca1ca3d2adfeeab package.json
|
|
27
|
+
8a04b0b071744eb616c24d509a60fe1c734a6f9ca611c4c2c2466cf61e543274 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
|
+
4499d3a8d8ffab03a116a047fb69ad9bc0cd3f104d0d1e24c654878b22fa41ef qwen-extension.json
|
|
32
|
+
28a957921c1dd24aef587fc0f8c6835de1cbbe49eff18104c5d1dd70c0297aad run.mjs
|
|
33
|
+
28a957921c1dd24aef587fc0f8c6835de1cbbe49eff18104c5d1dd70c0297aad search.mjs
|
|
34
|
+
62f166931982ed258bdba4d9ec60fde0296ea39e8033171e42b169cda9acca0c 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) {
|
|
@@ -1138,7 +1139,8 @@ var OPENCODE_EVENTS = {
|
|
|
1138
1139
|
"step-finish": "Usage"
|
|
1139
1140
|
};
|
|
1140
1141
|
var SHELL_TOOL_NAME = "bash";
|
|
1141
|
-
var
|
|
1142
|
+
var SHELL_TOOL_NAMES4 = Object.freeze([SHELL_TOOL_NAME, "shell"]);
|
|
1143
|
+
var NATIVE_TO_CANONICAL7 = { webfetch: "WebFetch", ...Object.fromEntries(SHELL_TOOL_NAMES4.map((n3) => [n3, "Bash"])) };
|
|
1142
1144
|
function toCanonicalTool(name) {
|
|
1143
1145
|
if (name.startsWith(OWN_WIRE_PREFIX)) return name.slice(OWN_WIRE_PREFIX.length);
|
|
1144
1146
|
return Object.prototype.hasOwnProperty.call(NATIVE_TO_CANONICAL7, name) ? NATIVE_TO_CANONICAL7[name] : name;
|
|
@@ -1268,8 +1270,9 @@ var ADAPTERS = Object.freeze([
|
|
|
1268
1270
|
installMode: "plugin",
|
|
1269
1271
|
projectSource: "arg:--agent+cwd",
|
|
1270
1272
|
toolNamePrefix: TOOL_NAME_PREFIX5,
|
|
1271
|
-
nativeTools: { shell: [
|
|
1273
|
+
nativeTools: { shell: [...SHELL_TOOL_NAMES] },
|
|
1272
1274
|
execReadOnlyHint: false,
|
|
1275
|
+
// D-PWSH-DUMP-1
|
|
1273
1276
|
eventMap: { SessionStart: "sessionStart", UserPromptSubmit: "userPromptSubmitted", PreToolUse: "preToolUse", PostToolUse: "postToolUse" },
|
|
1274
1277
|
compactDelivery: "pending-flag",
|
|
1275
1278
|
compactSummary: "none",
|
|
@@ -1287,7 +1290,7 @@ var ADAPTERS = Object.freeze([
|
|
|
1287
1290
|
projectSource: "arg:workspaceFolder",
|
|
1288
1291
|
toolNamePrefix: TOOL_NAME_PREFIX6,
|
|
1289
1292
|
// PreCompact sets the pending flag (ADR-0009 §6, DEVIATIONS D-M3-A4-1).
|
|
1290
|
-
nativeTools: { shell: [...
|
|
1293
|
+
nativeTools: { shell: [...SHELL_TOOL_NAMES2], read: [...READ_TOOL_NAMES], webfetch: [...WEBFETCH_TOOL_NAMES] },
|
|
1291
1294
|
// D-HF-VSCODE-PROJECT-1, D-N7-VSCODE-TOOLS-1
|
|
1292
1295
|
execReadOnlyHint: false,
|
|
1293
1296
|
eventMap: { ...CLAUDE_EVENTS, PreCompact: "PreCompact" },
|
|
@@ -1306,7 +1309,7 @@ var ADAPTERS = Object.freeze([
|
|
|
1306
1309
|
installMode: "mcp-entry",
|
|
1307
1310
|
projectSource: "arg:--agent+cwd",
|
|
1308
1311
|
toolNamePrefix: TOOL_NAME_PREFIX7,
|
|
1309
|
-
nativeTools: { shell: [...
|
|
1312
|
+
nativeTools: { shell: [...SHELL_TOOL_NAMES3] },
|
|
1310
1313
|
execReadOnlyHint: false,
|
|
1311
1314
|
// D-HF-KIRO-SHELL-1, D-N7-KIRO-1
|
|
1312
1315
|
eventMap: { SessionStart: "SessionStart", UserPromptSubmit: "UserPromptSubmit", PreToolUse: "PreToolUse", PostToolUse: "PostToolUse" },
|
|
@@ -1595,7 +1598,7 @@ Examples:
|
|
|
1595
1598
|
// src/cli/commands.ts
|
|
1596
1599
|
import { spawnSync as spawnSync3 } from "node:child_process";
|
|
1597
1600
|
import { createHash as createHash2 } from "node:crypto";
|
|
1598
|
-
import { existsSync as
|
|
1601
|
+
import { existsSync as existsSync13, mkdirSync as mkdirSync4, writeFileSync as writeFileSync3 } from "node:fs";
|
|
1599
1602
|
import os from "node:os";
|
|
1600
1603
|
import path13 from "node:path";
|
|
1601
1604
|
|
|
@@ -7054,6 +7057,7 @@ function editHostConfigText(agent, path15, text2, format, wanted) {
|
|
|
7054
7057
|
}
|
|
7055
7058
|
|
|
7056
7059
|
// src/core/ops/doctor-config.ts
|
|
7060
|
+
import { existsSync as existsSync5, readdirSync as readdirSync4 } from "node:fs";
|
|
7057
7061
|
import { join as join6 } from "node:path";
|
|
7058
7062
|
|
|
7059
7063
|
// src/core/ops/detect-v1.ts
|
|
@@ -7380,6 +7384,7 @@ function composeMatcher(row, event) {
|
|
|
7380
7384
|
if (event === POST_TOOL_USE && hasReplace(row)) alts.push(MCP_ANY_MATCH);
|
|
7381
7385
|
return MATCHER_OPEN + alts.join(MATCHER_ALT) + MATCHER_CLOSE;
|
|
7382
7386
|
}
|
|
7387
|
+
var CODEX_PLUGIN_KEY = `${SERVER_KEY}@${SERVER_KEY}`;
|
|
7383
7388
|
|
|
7384
7389
|
// src/setup/hook-shapes.ts
|
|
7385
7390
|
var MS_PER_SECOND = 1e3;
|
|
@@ -7604,7 +7609,7 @@ function hookInstallFor(ctx, row, command) {
|
|
|
7604
7609
|
kind: "plugin-list",
|
|
7605
7610
|
file: path3.join(opencodeDirOf(ctx.env, ctx.home), OPENCODE_BASE_CONFIG_FILE),
|
|
7606
7611
|
key: ["plugin"],
|
|
7607
|
-
entry:
|
|
7612
|
+
entry: ctx.pkgDir
|
|
7608
7613
|
};
|
|
7609
7614
|
}
|
|
7610
7615
|
return { kind: "package", via: ch.path };
|
|
@@ -7676,7 +7681,7 @@ function assertWritable(row, file) {
|
|
|
7676
7681
|
}
|
|
7677
7682
|
|
|
7678
7683
|
// src/setup/gemini-gate.ts
|
|
7679
|
-
import { existsSync as
|
|
7684
|
+
import { existsSync as existsSync6, readFileSync as readFileSync4 } from "node:fs";
|
|
7680
7685
|
import path4 from "node:path";
|
|
7681
7686
|
var GEMINI_DIR = ".gemini";
|
|
7682
7687
|
var SETTINGS_FILE2 = "settings.json";
|
|
@@ -7690,7 +7695,7 @@ function systemSettingsPath(env) {
|
|
|
7690
7695
|
return "/etc/gemini-cli/settings.json";
|
|
7691
7696
|
}
|
|
7692
7697
|
function load(file) {
|
|
7693
|
-
if (!
|
|
7698
|
+
if (!existsSync6(file)) return void 0;
|
|
7694
7699
|
try {
|
|
7695
7700
|
return { file, doc: parseHostConfig(OWN_AGENT, file, hostText(readFileSync4(file, "utf8")), "jsonc") };
|
|
7696
7701
|
} catch {
|
|
@@ -7724,7 +7729,7 @@ function geminiSettingsGate(env, home, cwd) {
|
|
|
7724
7729
|
}
|
|
7725
7730
|
|
|
7726
7731
|
// src/setup/zcode-gate.ts
|
|
7727
|
-
import { existsSync as
|
|
7732
|
+
import { existsSync as existsSync7, readFileSync as readFileSync5 } from "node:fs";
|
|
7728
7733
|
import path5 from "node:path";
|
|
7729
7734
|
var OWN_AGENT2 = "zcode";
|
|
7730
7735
|
var EVENTS = ["SessionStart", "UserPromptSubmit", "PreToolUse", "PermissionRequest", "PostToolUse", "PostToolUseFailure", "Stop"];
|
|
@@ -7816,7 +7821,7 @@ function zcodeSchemaBad(doc) {
|
|
|
7816
7821
|
}
|
|
7817
7822
|
function zcodeConfigGate(home) {
|
|
7818
7823
|
const file = path5.join(home, ".zcode", "cli", "config.json");
|
|
7819
|
-
if (!
|
|
7824
|
+
if (!existsSync7(file)) return void 0;
|
|
7820
7825
|
let doc;
|
|
7821
7826
|
try {
|
|
7822
7827
|
doc = parseHostConfig(OWN_AGENT2, file, hostText(readFileSync5(file, "utf8")), "json");
|
|
@@ -7829,7 +7834,7 @@ function zcodeConfigGate(home) {
|
|
|
7829
7834
|
}
|
|
7830
7835
|
|
|
7831
7836
|
// src/setup/pi-gate.ts
|
|
7832
|
-
import { existsSync as
|
|
7837
|
+
import { existsSync as existsSync8, readFileSync as readFileSync6, realpathSync as realpathSync3 } from "node:fs";
|
|
7833
7838
|
import path6 from "node:path";
|
|
7834
7839
|
var OWN_FILE = "pi/index.js";
|
|
7835
7840
|
var EXTENSIONS_KEY = "extensions";
|
|
@@ -7838,7 +7843,7 @@ var TRUST_FILE = "trust.json";
|
|
|
7838
7843
|
var ALWAYS = "always";
|
|
7839
7844
|
var SOURCE_PREFIXES = ["npm:", "git:"];
|
|
7840
7845
|
function load2(file) {
|
|
7841
|
-
if (!
|
|
7846
|
+
if (!existsSync8(file)) return void 0;
|
|
7842
7847
|
try {
|
|
7843
7848
|
return { file, doc: parseHostConfig("pi", file, hostText(readFileSync6(file, "utf8")), "json") };
|
|
7844
7849
|
} catch {
|
|
@@ -7929,7 +7934,7 @@ function piSettingsGate(env, home, pkgDir, cwd) {
|
|
|
7929
7934
|
}
|
|
7930
7935
|
|
|
7931
7936
|
// src/setup/vscode-gate.ts
|
|
7932
|
-
import { existsSync as
|
|
7937
|
+
import { existsSync as existsSync9, readFileSync as readFileSync7 } from "node:fs";
|
|
7933
7938
|
import path7 from "node:path";
|
|
7934
7939
|
var SETTINGS_FILE3 = "settings.json";
|
|
7935
7940
|
var WORKSPACE_DIR = ".vscode";
|
|
@@ -7938,7 +7943,7 @@ var LOCATIONS_KEY = "chat.hookFilesLocations";
|
|
|
7938
7943
|
var OWN_LOCATION = "~/.copilot/hooks";
|
|
7939
7944
|
var MANAGED_KEYS = ["allowManagedHooksOnly", "strictPluginOnlyCustomization"];
|
|
7940
7945
|
function load3(file) {
|
|
7941
|
-
if (!
|
|
7946
|
+
if (!existsSync9(file)) return void 0;
|
|
7942
7947
|
try {
|
|
7943
7948
|
return { file, doc: parseHostConfig("vscode", file, hostText(readFileSync7(file, "utf8")), "jsonc") };
|
|
7944
7949
|
} catch {
|
|
@@ -7980,7 +7985,7 @@ function vscodeSettingsGate(env, home, cwd, managedFile = managedSettingsPath(en
|
|
|
7980
7985
|
}
|
|
7981
7986
|
|
|
7982
7987
|
// src/setup/qwen-gate.ts
|
|
7983
|
-
import { existsSync as
|
|
7988
|
+
import { existsSync as existsSync10, readFileSync as readFileSync8 } from "node:fs";
|
|
7984
7989
|
import path8 from "node:path";
|
|
7985
7990
|
var KEY = "disableAllHooks";
|
|
7986
7991
|
var SETTINGS = "settings.json";
|
|
@@ -7996,7 +8001,7 @@ function settingsFiles(env, home, cwd, platform) {
|
|
|
7996
8001
|
}
|
|
7997
8002
|
function qwenHooksOff(env, home, cwd = process.cwd(), platform = process.platform) {
|
|
7998
8003
|
for (const file of settingsFiles(env, home, cwd, platform)) {
|
|
7999
|
-
if (!
|
|
8004
|
+
if (!existsSync10(file)) continue;
|
|
8000
8005
|
let value;
|
|
8001
8006
|
try {
|
|
8002
8007
|
value = hostConfigValueAt(parseHostConfig("qwen", file, hostText(readFileSync8(file, "utf8")), "jsonc"), [KEY]);
|
|
@@ -8010,7 +8015,7 @@ function qwenHooksOff(env, home, cwd = process.cwd(), platform = process.platfor
|
|
|
8010
8015
|
|
|
8011
8016
|
// src/setup/codex-trust.ts
|
|
8012
8017
|
import { createHash } from "node:crypto";
|
|
8013
|
-
import { existsSync as
|
|
8018
|
+
import { existsSync as existsSync11, realpathSync as realpathSync4 } from "node:fs";
|
|
8014
8019
|
import path10 from "node:path";
|
|
8015
8020
|
import { spawn } from "node:child_process";
|
|
8016
8021
|
|
|
@@ -8118,7 +8123,7 @@ function snake(name) {
|
|
|
8118
8123
|
function realFile(file) {
|
|
8119
8124
|
let dir = path10.resolve(file);
|
|
8120
8125
|
const rest = [];
|
|
8121
|
-
while (!
|
|
8126
|
+
while (!existsSync11(dir) && path10.dirname(dir) !== dir) {
|
|
8122
8127
|
rest.unshift(path10.basename(dir));
|
|
8123
8128
|
dir = path10.dirname(dir);
|
|
8124
8129
|
}
|
|
@@ -8361,7 +8366,7 @@ function listCopilotHooks(env, file, cwd) {
|
|
|
8361
8366
|
|
|
8362
8367
|
// src/setup/engine.ts
|
|
8363
8368
|
import { spawn as spawn3, spawnSync as spawnSync2 } from "node:child_process";
|
|
8364
|
-
import { closeSync, existsSync as
|
|
8369
|
+
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";
|
|
8365
8370
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
8366
8371
|
import path12 from "node:path";
|
|
8367
8372
|
|
|
@@ -8458,7 +8463,7 @@ function isNativeBinary(file) {
|
|
|
8458
8463
|
function owningPackage(dir) {
|
|
8459
8464
|
for (let d = dir; ; d = path12.dirname(d)) {
|
|
8460
8465
|
const f2 = path12.join(d, "package.json");
|
|
8461
|
-
if (
|
|
8466
|
+
if (existsSync12(f2)) {
|
|
8462
8467
|
try {
|
|
8463
8468
|
return String(JSON.parse(hostText(readFileSync9(f2, "utf8"))).name);
|
|
8464
8469
|
} catch {
|
|
@@ -8476,7 +8481,7 @@ function hostBin(bin, env, platform = process.platform) {
|
|
|
8476
8481
|
for (const dir of pathEntries(get("PATH") ?? "", platform)) {
|
|
8477
8482
|
const own2 = which(bin, { PATH: dir, ...get("PATHEXT") ? { PATHEXT: get("PATHEXT") } : {} }, platform);
|
|
8478
8483
|
for (const f2 of [own2, ...real2.extra.map((p3) => path12.join(dir, ...p3))]) {
|
|
8479
|
-
if (!f2 || !
|
|
8484
|
+
if (!f2 || !existsSync12(f2) || !statSync2(f2).isFile()) continue;
|
|
8480
8485
|
const file = realpathSync6(f2);
|
|
8481
8486
|
if (isNativeBinary(file) || owningPackage(path12.dirname(file)) === real2.pkg) return { file, shims };
|
|
8482
8487
|
shims.push(f2);
|
|
@@ -8493,10 +8498,10 @@ function runBin(bin, args, env, input) {
|
|
|
8493
8498
|
return spawnShim(hostBin(bin, env).file ?? bin, args, env, { encoding: "utf8", input, timeout: VERIFY_TIMEOUT_MS });
|
|
8494
8499
|
}
|
|
8495
8500
|
function readOr(file) {
|
|
8496
|
-
return
|
|
8501
|
+
return existsSync12(file) ? hostText(readFileSync9(file, "utf8")) : void 0;
|
|
8497
8502
|
}
|
|
8498
8503
|
function readRaw(file) {
|
|
8499
|
-
return
|
|
8504
|
+
return existsSync12(file) ? readFileSync9(file, "utf8") : void 0;
|
|
8500
8505
|
}
|
|
8501
8506
|
var atomicWrite = atomicWriteFile;
|
|
8502
8507
|
function pidAlive(pid) {
|
|
@@ -8639,10 +8644,13 @@ function isNativeSpec(e) {
|
|
|
8639
8644
|
return typeof e === "string" && e.startsWith(NATIVE_PLUGIN_PREFIX);
|
|
8640
8645
|
}
|
|
8641
8646
|
function isStaleOwnPlugin(e, entry2) {
|
|
8642
|
-
if (typeof e !== "string" || e === entry2 || !path12.isAbsolute(e)
|
|
8647
|
+
if (typeof e !== "string" || e === entry2 || !path12.isAbsolute(e)) return false;
|
|
8648
|
+
if (e === path12.join(entry2, ...OPENCODE_PLUGIN_PATH)) return true;
|
|
8649
|
+
if (existsSync12(e)) return false;
|
|
8643
8650
|
const seg = e.split("\\").join("/").split("/");
|
|
8644
8651
|
const n3 = seg.length;
|
|
8645
|
-
|
|
8652
|
+
if (n3 >= 3 && seg[n3 - 1] === "plugin.js" && seg[n3 - 2] === "opencode" && seg[n3 - 3] === "context-mode") return true;
|
|
8653
|
+
return n3 >= 2 && seg[n3 - 1] === "context-mode" && seg[n3 - 2] === "node_modules";
|
|
8646
8654
|
}
|
|
8647
8655
|
function wantedPluginList(list2, entry2) {
|
|
8648
8656
|
const native = list2.some(isNativeSpec);
|
|
@@ -8696,7 +8704,7 @@ function planSkills(row, edits) {
|
|
|
8696
8704
|
const s = row.skillInstall;
|
|
8697
8705
|
if (s.kind !== "dir") return;
|
|
8698
8706
|
for (const f2 of s.files) {
|
|
8699
|
-
if (!
|
|
8707
|
+
if (!existsSync12(f2.src)) throw new Error(`preflight: ${f2.src} is missing`);
|
|
8700
8708
|
const after = renderSkill(readFileSync9(f2.src, "utf8"), s.prefixes);
|
|
8701
8709
|
const before = readRaw(f2.file);
|
|
8702
8710
|
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" }] });
|
|
@@ -8750,9 +8758,17 @@ function statusOf(row, text2) {
|
|
|
8750
8758
|
}
|
|
8751
8759
|
return void 0;
|
|
8752
8760
|
}
|
|
8761
|
+
function opencodeListArgs(bin, env) {
|
|
8762
|
+
const r2 = runBin(bin, ["--version"], env);
|
|
8763
|
+
const text2 = `${r2.stdout}${r2.stderr}`;
|
|
8764
|
+
const digits = text2.split("").filter((c3) => c3 >= "0" && c3 <= "9" || c3 === ".").join("");
|
|
8765
|
+
const major = Number(digits.split(".")[0]);
|
|
8766
|
+
return major >= 2 ? ["mcp", "list", "--standalone"] : ["mcp", "list", "--pure"];
|
|
8767
|
+
}
|
|
8753
8768
|
function listState(row, env) {
|
|
8754
|
-
const
|
|
8755
|
-
if (!
|
|
8769
|
+
const l0 = row.listCommand;
|
|
8770
|
+
if (!l0 || !hostBin(l0.bin, env).file) return { status: void 0 };
|
|
8771
|
+
const l2 = row.id === "opencode" ? { bin: l0.bin, args: opencodeListArgs(l0.bin, env) } : l0;
|
|
8756
8772
|
const r2 = runBin(l2.bin, l2.args, env);
|
|
8757
8773
|
const ok = r2.status === 0 && `${r2.stdout}${r2.stderr}`.includes("context-mode");
|
|
8758
8774
|
const check = { name: "list", ok, detail: ok ? void 0 : `${l2.bin} ${l2.args.join(" ")} does not list context-mode` };
|
|
@@ -8960,7 +8976,7 @@ var SEEN_SQL = "SELECT 1 FROM events WHERE agent = ? LIMIT 1";
|
|
|
8960
8976
|
var NOT_SEEN_LINE = "not seen yet, run one tool call";
|
|
8961
8977
|
function hookSeenCheck(row, home) {
|
|
8962
8978
|
const base = path12.join(home, STATE_DIR, PROJECTS_DIR_NAME);
|
|
8963
|
-
const dirs =
|
|
8979
|
+
const dirs = existsSync12(base) ? readdirSync5(base) : [];
|
|
8964
8980
|
let sqlite;
|
|
8965
8981
|
try {
|
|
8966
8982
|
sqlite = process.getBuiltinModule("node:sqlite");
|
|
@@ -8969,7 +8985,7 @@ function hookSeenCheck(row, home) {
|
|
|
8969
8985
|
}
|
|
8970
8986
|
for (const d of dirs) {
|
|
8971
8987
|
const file = path12.join(base, d, DB_FILE_NAME);
|
|
8972
|
-
if (!sqlite || !
|
|
8988
|
+
if (!sqlite || !existsSync12(file)) continue;
|
|
8973
8989
|
let db;
|
|
8974
8990
|
try {
|
|
8975
8991
|
db = new sqlite.DatabaseSync(file, { readOnly: true });
|
|
@@ -8984,10 +9000,10 @@ function hookSeenCheck(row, home) {
|
|
|
8984
9000
|
function skillsCheck(row, pkgDir) {
|
|
8985
9001
|
const s = row.skillInstall;
|
|
8986
9002
|
if (s.kind === "package") {
|
|
8987
|
-
const miss = COMMAND_SKILLS.map((n3) => path12.join(pkgDir, s.via, n3, SKILL_FILE)).filter((f2) => !
|
|
9003
|
+
const miss = COMMAND_SKILLS.map((n3) => path12.join(pkgDir, s.via, n3, SKILL_FILE)).filter((f2) => !existsSync12(f2));
|
|
8988
9004
|
return { name: "skills", ok: miss.length === 0, detail: miss.length ? `missing ${miss.join(", ")}` : void 0 };
|
|
8989
9005
|
}
|
|
8990
|
-
const bad = s.files.filter((f2) => readRaw(f2.file) !== (
|
|
9006
|
+
const bad = s.files.filter((f2) => readRaw(f2.file) !== (existsSync12(f2.src) ? renderSkill(readFileSync9(f2.src, "utf8"), s.prefixes) : void 0));
|
|
8991
9007
|
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 };
|
|
8992
9008
|
}
|
|
8993
9009
|
var PLUGIN_ENABLED = "enabled";
|
|
@@ -9272,14 +9288,14 @@ function agentHomeDir(id, ctx) {
|
|
|
9272
9288
|
return path12.join(ctx.home, ...AGENT_HOME_DIR[id]);
|
|
9273
9289
|
}
|
|
9274
9290
|
function detectAgents(reg, ctx) {
|
|
9275
|
-
return reg.filter((r2) =>
|
|
9291
|
+
return reg.filter((r2) => existsSync12(agentHomeDir(r2.id, ctx)) || r2.listCommand && which(r2.listCommand.bin, ctx.env)).map((r2) => r2.id);
|
|
9276
9292
|
}
|
|
9277
9293
|
async function runSetup(opts) {
|
|
9278
9294
|
const ctx = { home: opts.home, pkgDir: opts.pkgDir, env: opts.env };
|
|
9279
9295
|
const runId = opts.runId ?? (/* @__PURE__ */ new Date()).toISOString().split(":").join("-").split(".").join("-");
|
|
9280
9296
|
const reg = buildRegistry(ctx);
|
|
9281
9297
|
for (const f2 of ["server.mjs", "hook.mjs"]) {
|
|
9282
|
-
if (!
|
|
9298
|
+
if (!existsSync12(path12.join(ctx.pkgDir, f2))) return { exitCode: 1, agents: [], error: `preflight: ${path12.join(ctx.pkgDir, f2)} is missing` };
|
|
9283
9299
|
}
|
|
9284
9300
|
const ids = opts.agents ?? detectAgents(reg, ctx);
|
|
9285
9301
|
const root = path12.join(ctx.home, STATE_DIR);
|
|
@@ -9370,7 +9386,7 @@ async function runDoctor(opts) {
|
|
|
9370
9386
|
const ctx = { home: opts.home, pkgDir: opts.pkgDir, env: opts.env };
|
|
9371
9387
|
const reg = buildRegistry(ctx);
|
|
9372
9388
|
for (const f2 of ["server.mjs", "hook.mjs"]) {
|
|
9373
|
-
if (!
|
|
9389
|
+
if (!existsSync12(path12.join(ctx.pkgDir, f2))) return { exitCode: 1, agents: [], error: `preflight: ${path12.join(ctx.pkgDir, f2)} is missing` };
|
|
9374
9390
|
}
|
|
9375
9391
|
const ids = opts.agents ?? detectAgents(reg, ctx);
|
|
9376
9392
|
const run = new Run(path12.join(ctx.home, STATE_DIR), "doctor");
|
|
@@ -9432,12 +9448,12 @@ function runRemove(opts) {
|
|
|
9432
9448
|
const env = opts.env ?? process.env;
|
|
9433
9449
|
const root = path12.join(opts.home, STATE_DIR);
|
|
9434
9450
|
const base = path12.join(root, BACKUP_DIR);
|
|
9435
|
-
if (!
|
|
9451
|
+
if (!existsSync12(base)) return { exitCode: 0, restored: 0 };
|
|
9436
9452
|
const held = takeLock(root, "remove");
|
|
9437
9453
|
if (held) return { exitCode: 1, restored: 0, error: held };
|
|
9438
9454
|
let restored = 0;
|
|
9439
9455
|
try {
|
|
9440
|
-
const runs =
|
|
9456
|
+
const runs = readdirSync5(base).map((r2) => path12.join(base, r2)).filter((d) => existsSync12(path12.join(d, MANIFEST))).sort().reverse();
|
|
9441
9457
|
for (const dir of runs) {
|
|
9442
9458
|
const m3 = JSON.parse(readFileSync9(path12.join(dir, MANIFEST), "utf8"));
|
|
9443
9459
|
undo(dir, m3.entries, env);
|
|
@@ -9902,7 +9918,7 @@ async function upgrade(ui) {
|
|
|
9902
9918
|
}
|
|
9903
9919
|
const root = `${spawnSync3(npm, ["root", "-g"], { env: ui.ctx.env, encoding: "utf8", shell, windowsHide: true }).stdout ?? ""}`.trim();
|
|
9904
9920
|
const cli = path13.join(root, "context-mode", "cli.mjs");
|
|
9905
|
-
if (!root || !
|
|
9921
|
+
if (!root || !existsSync13(cli)) {
|
|
9906
9922
|
err(`FAIL upgrade: ${cli} not found after ${install}. Fix: ${install}`);
|
|
9907
9923
|
return EXIT_FAIL;
|
|
9908
9924
|
}
|
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