context-mode 2.0.0-next.17 → 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 +42 -38
- 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;
|
|
@@ -7676,7 +7680,7 @@ function assertWritable(row, file) {
|
|
|
7676
7680
|
}
|
|
7677
7681
|
|
|
7678
7682
|
// src/setup/gemini-gate.ts
|
|
7679
|
-
import { existsSync as
|
|
7683
|
+
import { existsSync as existsSync6, readFileSync as readFileSync4 } from "node:fs";
|
|
7680
7684
|
import path4 from "node:path";
|
|
7681
7685
|
var GEMINI_DIR = ".gemini";
|
|
7682
7686
|
var SETTINGS_FILE2 = "settings.json";
|
|
@@ -7690,7 +7694,7 @@ function systemSettingsPath(env) {
|
|
|
7690
7694
|
return "/etc/gemini-cli/settings.json";
|
|
7691
7695
|
}
|
|
7692
7696
|
function load(file) {
|
|
7693
|
-
if (!
|
|
7697
|
+
if (!existsSync6(file)) return void 0;
|
|
7694
7698
|
try {
|
|
7695
7699
|
return { file, doc: parseHostConfig(OWN_AGENT, file, hostText(readFileSync4(file, "utf8")), "jsonc") };
|
|
7696
7700
|
} catch {
|
|
@@ -7724,7 +7728,7 @@ function geminiSettingsGate(env, home, cwd) {
|
|
|
7724
7728
|
}
|
|
7725
7729
|
|
|
7726
7730
|
// src/setup/zcode-gate.ts
|
|
7727
|
-
import { existsSync as
|
|
7731
|
+
import { existsSync as existsSync7, readFileSync as readFileSync5 } from "node:fs";
|
|
7728
7732
|
import path5 from "node:path";
|
|
7729
7733
|
var OWN_AGENT2 = "zcode";
|
|
7730
7734
|
var EVENTS = ["SessionStart", "UserPromptSubmit", "PreToolUse", "PermissionRequest", "PostToolUse", "PostToolUseFailure", "Stop"];
|
|
@@ -7816,7 +7820,7 @@ function zcodeSchemaBad(doc) {
|
|
|
7816
7820
|
}
|
|
7817
7821
|
function zcodeConfigGate(home) {
|
|
7818
7822
|
const file = path5.join(home, ".zcode", "cli", "config.json");
|
|
7819
|
-
if (!
|
|
7823
|
+
if (!existsSync7(file)) return void 0;
|
|
7820
7824
|
let doc;
|
|
7821
7825
|
try {
|
|
7822
7826
|
doc = parseHostConfig(OWN_AGENT2, file, hostText(readFileSync5(file, "utf8")), "json");
|
|
@@ -7829,7 +7833,7 @@ function zcodeConfigGate(home) {
|
|
|
7829
7833
|
}
|
|
7830
7834
|
|
|
7831
7835
|
// src/setup/pi-gate.ts
|
|
7832
|
-
import { existsSync as
|
|
7836
|
+
import { existsSync as existsSync8, readFileSync as readFileSync6, realpathSync as realpathSync3 } from "node:fs";
|
|
7833
7837
|
import path6 from "node:path";
|
|
7834
7838
|
var OWN_FILE = "pi/index.js";
|
|
7835
7839
|
var EXTENSIONS_KEY = "extensions";
|
|
@@ -7838,7 +7842,7 @@ var TRUST_FILE = "trust.json";
|
|
|
7838
7842
|
var ALWAYS = "always";
|
|
7839
7843
|
var SOURCE_PREFIXES = ["npm:", "git:"];
|
|
7840
7844
|
function load2(file) {
|
|
7841
|
-
if (!
|
|
7845
|
+
if (!existsSync8(file)) return void 0;
|
|
7842
7846
|
try {
|
|
7843
7847
|
return { file, doc: parseHostConfig("pi", file, hostText(readFileSync6(file, "utf8")), "json") };
|
|
7844
7848
|
} catch {
|
|
@@ -7929,7 +7933,7 @@ function piSettingsGate(env, home, pkgDir, cwd) {
|
|
|
7929
7933
|
}
|
|
7930
7934
|
|
|
7931
7935
|
// src/setup/vscode-gate.ts
|
|
7932
|
-
import { existsSync as
|
|
7936
|
+
import { existsSync as existsSync9, readFileSync as readFileSync7 } from "node:fs";
|
|
7933
7937
|
import path7 from "node:path";
|
|
7934
7938
|
var SETTINGS_FILE3 = "settings.json";
|
|
7935
7939
|
var WORKSPACE_DIR = ".vscode";
|
|
@@ -7938,7 +7942,7 @@ var LOCATIONS_KEY = "chat.hookFilesLocations";
|
|
|
7938
7942
|
var OWN_LOCATION = "~/.copilot/hooks";
|
|
7939
7943
|
var MANAGED_KEYS = ["allowManagedHooksOnly", "strictPluginOnlyCustomization"];
|
|
7940
7944
|
function load3(file) {
|
|
7941
|
-
if (!
|
|
7945
|
+
if (!existsSync9(file)) return void 0;
|
|
7942
7946
|
try {
|
|
7943
7947
|
return { file, doc: parseHostConfig("vscode", file, hostText(readFileSync7(file, "utf8")), "jsonc") };
|
|
7944
7948
|
} catch {
|
|
@@ -7980,7 +7984,7 @@ function vscodeSettingsGate(env, home, cwd, managedFile = managedSettingsPath(en
|
|
|
7980
7984
|
}
|
|
7981
7985
|
|
|
7982
7986
|
// src/setup/qwen-gate.ts
|
|
7983
|
-
import { existsSync as
|
|
7987
|
+
import { existsSync as existsSync10, readFileSync as readFileSync8 } from "node:fs";
|
|
7984
7988
|
import path8 from "node:path";
|
|
7985
7989
|
var KEY = "disableAllHooks";
|
|
7986
7990
|
var SETTINGS = "settings.json";
|
|
@@ -7996,7 +8000,7 @@ function settingsFiles(env, home, cwd, platform) {
|
|
|
7996
8000
|
}
|
|
7997
8001
|
function qwenHooksOff(env, home, cwd = process.cwd(), platform = process.platform) {
|
|
7998
8002
|
for (const file of settingsFiles(env, home, cwd, platform)) {
|
|
7999
|
-
if (!
|
|
8003
|
+
if (!existsSync10(file)) continue;
|
|
8000
8004
|
let value;
|
|
8001
8005
|
try {
|
|
8002
8006
|
value = hostConfigValueAt(parseHostConfig("qwen", file, hostText(readFileSync8(file, "utf8")), "jsonc"), [KEY]);
|
|
@@ -8010,7 +8014,7 @@ function qwenHooksOff(env, home, cwd = process.cwd(), platform = process.platfor
|
|
|
8010
8014
|
|
|
8011
8015
|
// src/setup/codex-trust.ts
|
|
8012
8016
|
import { createHash } from "node:crypto";
|
|
8013
|
-
import { existsSync as
|
|
8017
|
+
import { existsSync as existsSync11, realpathSync as realpathSync4 } from "node:fs";
|
|
8014
8018
|
import path10 from "node:path";
|
|
8015
8019
|
import { spawn } from "node:child_process";
|
|
8016
8020
|
|
|
@@ -8118,7 +8122,7 @@ function snake(name) {
|
|
|
8118
8122
|
function realFile(file) {
|
|
8119
8123
|
let dir = path10.resolve(file);
|
|
8120
8124
|
const rest = [];
|
|
8121
|
-
while (!
|
|
8125
|
+
while (!existsSync11(dir) && path10.dirname(dir) !== dir) {
|
|
8122
8126
|
rest.unshift(path10.basename(dir));
|
|
8123
8127
|
dir = path10.dirname(dir);
|
|
8124
8128
|
}
|
|
@@ -8361,7 +8365,7 @@ function listCopilotHooks(env, file, cwd) {
|
|
|
8361
8365
|
|
|
8362
8366
|
// src/setup/engine.ts
|
|
8363
8367
|
import { spawn as spawn3, spawnSync as spawnSync2 } from "node:child_process";
|
|
8364
|
-
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";
|
|
8365
8369
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
8366
8370
|
import path12 from "node:path";
|
|
8367
8371
|
|
|
@@ -8458,7 +8462,7 @@ function isNativeBinary(file) {
|
|
|
8458
8462
|
function owningPackage(dir) {
|
|
8459
8463
|
for (let d = dir; ; d = path12.dirname(d)) {
|
|
8460
8464
|
const f2 = path12.join(d, "package.json");
|
|
8461
|
-
if (
|
|
8465
|
+
if (existsSync12(f2)) {
|
|
8462
8466
|
try {
|
|
8463
8467
|
return String(JSON.parse(hostText(readFileSync9(f2, "utf8"))).name);
|
|
8464
8468
|
} catch {
|
|
@@ -8476,7 +8480,7 @@ function hostBin(bin, env, platform = process.platform) {
|
|
|
8476
8480
|
for (const dir of pathEntries(get("PATH") ?? "", platform)) {
|
|
8477
8481
|
const own2 = which(bin, { PATH: dir, ...get("PATHEXT") ? { PATHEXT: get("PATHEXT") } : {} }, platform);
|
|
8478
8482
|
for (const f2 of [own2, ...real2.extra.map((p3) => path12.join(dir, ...p3))]) {
|
|
8479
|
-
if (!f2 || !
|
|
8483
|
+
if (!f2 || !existsSync12(f2) || !statSync2(f2).isFile()) continue;
|
|
8480
8484
|
const file = realpathSync6(f2);
|
|
8481
8485
|
if (isNativeBinary(file) || owningPackage(path12.dirname(file)) === real2.pkg) return { file, shims };
|
|
8482
8486
|
shims.push(f2);
|
|
@@ -8493,10 +8497,10 @@ function runBin(bin, args, env, input) {
|
|
|
8493
8497
|
return spawnShim(hostBin(bin, env).file ?? bin, args, env, { encoding: "utf8", input, timeout: VERIFY_TIMEOUT_MS });
|
|
8494
8498
|
}
|
|
8495
8499
|
function readOr(file) {
|
|
8496
|
-
return
|
|
8500
|
+
return existsSync12(file) ? hostText(readFileSync9(file, "utf8")) : void 0;
|
|
8497
8501
|
}
|
|
8498
8502
|
function readRaw(file) {
|
|
8499
|
-
return
|
|
8503
|
+
return existsSync12(file) ? readFileSync9(file, "utf8") : void 0;
|
|
8500
8504
|
}
|
|
8501
8505
|
var atomicWrite = atomicWriteFile;
|
|
8502
8506
|
function pidAlive(pid) {
|
|
@@ -8639,7 +8643,7 @@ function isNativeSpec(e) {
|
|
|
8639
8643
|
return typeof e === "string" && e.startsWith(NATIVE_PLUGIN_PREFIX);
|
|
8640
8644
|
}
|
|
8641
8645
|
function isStaleOwnPlugin(e, entry2) {
|
|
8642
|
-
if (typeof e !== "string" || e === entry2 || !path12.isAbsolute(e) ||
|
|
8646
|
+
if (typeof e !== "string" || e === entry2 || !path12.isAbsolute(e) || existsSync12(e)) return false;
|
|
8643
8647
|
const seg = e.split("\\").join("/").split("/");
|
|
8644
8648
|
const n3 = seg.length;
|
|
8645
8649
|
return n3 >= 3 && seg[n3 - 1] === "plugin.js" && seg[n3 - 2] === "opencode" && seg[n3 - 3] === "context-mode";
|
|
@@ -8696,7 +8700,7 @@ function planSkills(row, edits) {
|
|
|
8696
8700
|
const s = row.skillInstall;
|
|
8697
8701
|
if (s.kind !== "dir") return;
|
|
8698
8702
|
for (const f2 of s.files) {
|
|
8699
|
-
if (!
|
|
8703
|
+
if (!existsSync12(f2.src)) throw new Error(`preflight: ${f2.src} is missing`);
|
|
8700
8704
|
const after = renderSkill(readFileSync9(f2.src, "utf8"), s.prefixes);
|
|
8701
8705
|
const before = readRaw(f2.file);
|
|
8702
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" }] });
|
|
@@ -8960,7 +8964,7 @@ var SEEN_SQL = "SELECT 1 FROM events WHERE agent = ? LIMIT 1";
|
|
|
8960
8964
|
var NOT_SEEN_LINE = "not seen yet, run one tool call";
|
|
8961
8965
|
function hookSeenCheck(row, home) {
|
|
8962
8966
|
const base = path12.join(home, STATE_DIR, PROJECTS_DIR_NAME);
|
|
8963
|
-
const dirs =
|
|
8967
|
+
const dirs = existsSync12(base) ? readdirSync5(base) : [];
|
|
8964
8968
|
let sqlite;
|
|
8965
8969
|
try {
|
|
8966
8970
|
sqlite = process.getBuiltinModule("node:sqlite");
|
|
@@ -8969,7 +8973,7 @@ function hookSeenCheck(row, home) {
|
|
|
8969
8973
|
}
|
|
8970
8974
|
for (const d of dirs) {
|
|
8971
8975
|
const file = path12.join(base, d, DB_FILE_NAME);
|
|
8972
|
-
if (!sqlite || !
|
|
8976
|
+
if (!sqlite || !existsSync12(file)) continue;
|
|
8973
8977
|
let db;
|
|
8974
8978
|
try {
|
|
8975
8979
|
db = new sqlite.DatabaseSync(file, { readOnly: true });
|
|
@@ -8984,10 +8988,10 @@ function hookSeenCheck(row, home) {
|
|
|
8984
8988
|
function skillsCheck(row, pkgDir) {
|
|
8985
8989
|
const s = row.skillInstall;
|
|
8986
8990
|
if (s.kind === "package") {
|
|
8987
|
-
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));
|
|
8988
8992
|
return { name: "skills", ok: miss.length === 0, detail: miss.length ? `missing ${miss.join(", ")}` : void 0 };
|
|
8989
8993
|
}
|
|
8990
|
-
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));
|
|
8991
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 };
|
|
8992
8996
|
}
|
|
8993
8997
|
var PLUGIN_ENABLED = "enabled";
|
|
@@ -9272,14 +9276,14 @@ function agentHomeDir(id, ctx) {
|
|
|
9272
9276
|
return path12.join(ctx.home, ...AGENT_HOME_DIR[id]);
|
|
9273
9277
|
}
|
|
9274
9278
|
function detectAgents(reg, ctx) {
|
|
9275
|
-
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);
|
|
9276
9280
|
}
|
|
9277
9281
|
async function runSetup(opts) {
|
|
9278
9282
|
const ctx = { home: opts.home, pkgDir: opts.pkgDir, env: opts.env };
|
|
9279
9283
|
const runId = opts.runId ?? (/* @__PURE__ */ new Date()).toISOString().split(":").join("-").split(".").join("-");
|
|
9280
9284
|
const reg = buildRegistry(ctx);
|
|
9281
9285
|
for (const f2 of ["server.mjs", "hook.mjs"]) {
|
|
9282
|
-
if (!
|
|
9286
|
+
if (!existsSync12(path12.join(ctx.pkgDir, f2))) return { exitCode: 1, agents: [], error: `preflight: ${path12.join(ctx.pkgDir, f2)} is missing` };
|
|
9283
9287
|
}
|
|
9284
9288
|
const ids = opts.agents ?? detectAgents(reg, ctx);
|
|
9285
9289
|
const root = path12.join(ctx.home, STATE_DIR);
|
|
@@ -9370,7 +9374,7 @@ async function runDoctor(opts) {
|
|
|
9370
9374
|
const ctx = { home: opts.home, pkgDir: opts.pkgDir, env: opts.env };
|
|
9371
9375
|
const reg = buildRegistry(ctx);
|
|
9372
9376
|
for (const f2 of ["server.mjs", "hook.mjs"]) {
|
|
9373
|
-
if (!
|
|
9377
|
+
if (!existsSync12(path12.join(ctx.pkgDir, f2))) return { exitCode: 1, agents: [], error: `preflight: ${path12.join(ctx.pkgDir, f2)} is missing` };
|
|
9374
9378
|
}
|
|
9375
9379
|
const ids = opts.agents ?? detectAgents(reg, ctx);
|
|
9376
9380
|
const run = new Run(path12.join(ctx.home, STATE_DIR), "doctor");
|
|
@@ -9432,12 +9436,12 @@ function runRemove(opts) {
|
|
|
9432
9436
|
const env = opts.env ?? process.env;
|
|
9433
9437
|
const root = path12.join(opts.home, STATE_DIR);
|
|
9434
9438
|
const base = path12.join(root, BACKUP_DIR);
|
|
9435
|
-
if (!
|
|
9439
|
+
if (!existsSync12(base)) return { exitCode: 0, restored: 0 };
|
|
9436
9440
|
const held = takeLock(root, "remove");
|
|
9437
9441
|
if (held) return { exitCode: 1, restored: 0, error: held };
|
|
9438
9442
|
let restored = 0;
|
|
9439
9443
|
try {
|
|
9440
|
-
const runs =
|
|
9444
|
+
const runs = readdirSync5(base).map((r2) => path12.join(base, r2)).filter((d) => existsSync12(path12.join(d, MANIFEST))).sort().reverse();
|
|
9441
9445
|
for (const dir of runs) {
|
|
9442
9446
|
const m3 = JSON.parse(readFileSync9(path12.join(dir, MANIFEST), "utf8"));
|
|
9443
9447
|
undo(dir, m3.entries, env);
|
|
@@ -9902,7 +9906,7 @@ async function upgrade(ui) {
|
|
|
9902
9906
|
}
|
|
9903
9907
|
const root = `${spawnSync3(npm, ["root", "-g"], { env: ui.ctx.env, encoding: "utf8", shell, windowsHide: true }).stdout ?? ""}`.trim();
|
|
9904
9908
|
const cli = path13.join(root, "context-mode", "cli.mjs");
|
|
9905
|
-
if (!root || !
|
|
9909
|
+
if (!root || !existsSync13(cli)) {
|
|
9906
9910
|
err(`FAIL upgrade: ${cli} not found after ${install}. Fix: ${install}`);
|
|
9907
9911
|
return EXIT_FAIL;
|
|
9908
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