context-mode 1.0.6 → 1.0.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 +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/build/adapters/claude-code/hooks.d.ts +3 -3
- package/build/adapters/claude-code/hooks.js +7 -3
- package/build/adapters/claude-code/index.js +1 -1
- package/build/adapters/detect.d.ts +6 -7
- package/build/adapters/detect.js +23 -24
- package/build/adapters/gemini-cli/hooks.d.ts +3 -3
- package/build/adapters/gemini-cli/hooks.js +7 -3
- package/build/adapters/gemini-cli/index.d.ts +2 -2
- package/build/adapters/gemini-cli/index.js +8 -8
- package/build/adapters/types.d.ts +1 -1
- package/build/adapters/vscode-copilot/hooks.d.ts +3 -3
- package/build/adapters/vscode-copilot/hooks.js +6 -3
- package/build/adapters/vscode-copilot/index.d.ts +2 -2
- package/build/adapters/vscode-copilot/index.js +8 -8
- package/build/cli.js +2 -2
- package/build/exit-classify.d.ts +19 -0
- package/build/exit-classify.js +12 -0
- package/build/server.js +29 -10
- package/hooks/gemini-cli/aftertool.mjs +3 -3
- package/hooks/gemini-cli/precompress.mjs +3 -3
- package/hooks/gemini-cli/sessionstart.mjs +4 -4
- package/hooks/posttooluse.mjs +3 -3
- package/hooks/precompact.mjs +3 -3
- package/hooks/sessionstart.mjs +4 -4
- package/hooks/userpromptsubmit.mjs +3 -3
- package/hooks/vscode-copilot/posttooluse.mjs +3 -3
- package/hooks/vscode-copilot/precompact.mjs +3 -3
- package/hooks/vscode-copilot/sessionstart.mjs +5 -4
- package/package.json +5 -4
- package/server.bundle.mjs +389 -0
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
import { join, dirname } from "node:path";
|
|
20
20
|
import { readFileSync, writeFileSync, unlinkSync } from "node:fs";
|
|
21
21
|
import { homedir } from "node:os";
|
|
22
|
-
import { fileURLToPath } from "node:url";
|
|
22
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
23
23
|
|
|
24
24
|
const HOOK_DIR = dirname(fileURLToPath(import.meta.url));
|
|
25
25
|
const PKG_SESSION = join(HOOK_DIR, "..", "..", "build", "session");
|
|
@@ -33,7 +33,7 @@ try {
|
|
|
33
33
|
const source = input.source ?? "startup";
|
|
34
34
|
|
|
35
35
|
if (source === "compact") {
|
|
36
|
-
const { SessionDB } = await import(join(PKG_SESSION, "db.js"));
|
|
36
|
+
const { SessionDB } = await import(pathToFileURL(join(PKG_SESSION, "db.js")).href);
|
|
37
37
|
const dbPath = getSessionDBPath(OPTS);
|
|
38
38
|
const db = new SessionDB({ dbPath });
|
|
39
39
|
const sessionId = getSessionId(input, OPTS);
|
|
@@ -53,7 +53,7 @@ try {
|
|
|
53
53
|
} else if (source === "resume") {
|
|
54
54
|
try { unlinkSync(getCleanupFlagPath(OPTS)); } catch { /* no flag */ }
|
|
55
55
|
|
|
56
|
-
const { SessionDB } = await import(join(PKG_SESSION, "db.js"));
|
|
56
|
+
const { SessionDB } = await import(pathToFileURL(join(PKG_SESSION, "db.js")).href);
|
|
57
57
|
const dbPath = getSessionDBPath(OPTS);
|
|
58
58
|
const db = new SessionDB({ dbPath });
|
|
59
59
|
|
|
@@ -65,7 +65,7 @@ try {
|
|
|
65
65
|
|
|
66
66
|
db.close();
|
|
67
67
|
} else if (source === "startup") {
|
|
68
|
-
const { SessionDB } = await import(join(PKG_SESSION, "db.js"));
|
|
68
|
+
const { SessionDB } = await import(pathToFileURL(join(PKG_SESSION, "db.js")).href);
|
|
69
69
|
const dbPath = getSessionDBPath(OPTS);
|
|
70
70
|
const db = new SessionDB({ dbPath });
|
|
71
71
|
try { unlinkSync(getSessionEventsPath(OPTS)); } catch { /* no stale file */ }
|
package/hooks/posttooluse.mjs
CHANGED
|
@@ -11,7 +11,7 @@ import "./suppress-stderr.mjs";
|
|
|
11
11
|
|
|
12
12
|
import { readStdin, getSessionId, getSessionDBPath } from "./session-helpers.mjs";
|
|
13
13
|
import { join, dirname } from "node:path";
|
|
14
|
-
import { fileURLToPath } from "node:url";
|
|
14
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
15
15
|
|
|
16
16
|
// Resolve absolute path for imports — relative dynamic imports can fail
|
|
17
17
|
// when Claude Code invokes hooks from a different working directory.
|
|
@@ -22,8 +22,8 @@ try {
|
|
|
22
22
|
const raw = await readStdin();
|
|
23
23
|
const input = JSON.parse(raw);
|
|
24
24
|
|
|
25
|
-
const { extractEvents } = await import(join(PKG_SESSION, "extract.js"));
|
|
26
|
-
const { SessionDB } = await import(join(PKG_SESSION, "db.js"));
|
|
25
|
+
const { extractEvents } = await import(pathToFileURL(join(PKG_SESSION, "extract.js")).href);
|
|
26
|
+
const { SessionDB } = await import(pathToFileURL(join(PKG_SESSION, "db.js")).href);
|
|
27
27
|
|
|
28
28
|
const dbPath = getSessionDBPath();
|
|
29
29
|
const db = new SessionDB({ dbPath });
|
package/hooks/precompact.mjs
CHANGED
|
@@ -12,7 +12,7 @@ import { readStdin, getSessionId, getSessionDBPath } from "./session-helpers.mjs
|
|
|
12
12
|
import { appendFileSync } from "node:fs";
|
|
13
13
|
import { join, dirname } from "node:path";
|
|
14
14
|
import { homedir } from "node:os";
|
|
15
|
-
import { fileURLToPath } from "node:url";
|
|
15
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
16
16
|
|
|
17
17
|
// Resolve absolute path for imports
|
|
18
18
|
const HOOK_DIR = dirname(fileURLToPath(import.meta.url));
|
|
@@ -23,8 +23,8 @@ try {
|
|
|
23
23
|
const raw = await readStdin();
|
|
24
24
|
const input = JSON.parse(raw);
|
|
25
25
|
|
|
26
|
-
const { buildResumeSnapshot } = await import(join(PKG_SESSION, "snapshot.js"));
|
|
27
|
-
const { SessionDB } = await import(join(PKG_SESSION, "db.js"));
|
|
26
|
+
const { buildResumeSnapshot } = await import(pathToFileURL(join(PKG_SESSION, "snapshot.js")).href);
|
|
27
|
+
const { SessionDB } = await import(pathToFileURL(join(PKG_SESSION, "db.js")).href);
|
|
28
28
|
|
|
29
29
|
const dbPath = getSessionDBPath();
|
|
30
30
|
const db = new SessionDB({ dbPath });
|
package/hooks/sessionstart.mjs
CHANGED
|
@@ -18,7 +18,7 @@ import { ROUTING_BLOCK } from "./routing-block.mjs";
|
|
|
18
18
|
import { readStdin, getSessionId, getSessionDBPath, getSessionEventsPath, getCleanupFlagPath } from "./session-helpers.mjs";
|
|
19
19
|
import { writeSessionEventsFile, buildSessionDirective, getAllProjectEvents } from "./session-directive.mjs";
|
|
20
20
|
import { join, dirname } from "node:path";
|
|
21
|
-
import { fileURLToPath } from "node:url";
|
|
21
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
22
22
|
import { readFileSync, writeFileSync, unlinkSync } from "node:fs";
|
|
23
23
|
import { homedir } from "node:os";
|
|
24
24
|
|
|
@@ -35,7 +35,7 @@ try {
|
|
|
35
35
|
|
|
36
36
|
if (source === "compact") {
|
|
37
37
|
// Session was compacted — write events to file for auto-indexing, inject directive only
|
|
38
|
-
const { SessionDB } = await import(join(PKG_SESSION, "db.js"));
|
|
38
|
+
const { SessionDB } = await import(pathToFileURL(join(PKG_SESSION, "db.js")).href);
|
|
39
39
|
const dbPath = getSessionDBPath();
|
|
40
40
|
const db = new SessionDB({ dbPath });
|
|
41
41
|
const sessionId = getSessionId(input);
|
|
@@ -56,7 +56,7 @@ try {
|
|
|
56
56
|
// User used --continue — clear cleanup flag so startup doesn't wipe data
|
|
57
57
|
try { unlinkSync(getCleanupFlagPath()); } catch { /* no flag */ }
|
|
58
58
|
|
|
59
|
-
const { SessionDB } = await import(join(PKG_SESSION, "db.js"));
|
|
59
|
+
const { SessionDB } = await import(pathToFileURL(join(PKG_SESSION, "db.js")).href);
|
|
60
60
|
const dbPath = getSessionDBPath();
|
|
61
61
|
const db = new SessionDB({ dbPath });
|
|
62
62
|
|
|
@@ -69,7 +69,7 @@ try {
|
|
|
69
69
|
db.close();
|
|
70
70
|
} else if (source === "startup") {
|
|
71
71
|
// Fresh session (no --continue) — clean slate, capture CLAUDE.md rules.
|
|
72
|
-
const { SessionDB } = await import(join(PKG_SESSION, "db.js"));
|
|
72
|
+
const { SessionDB } = await import(pathToFileURL(join(PKG_SESSION, "db.js")).href);
|
|
73
73
|
const dbPath = getSessionDBPath();
|
|
74
74
|
const db = new SessionDB({ dbPath });
|
|
75
75
|
try { unlinkSync(getSessionEventsPath()); } catch { /* no stale file */ }
|
|
@@ -11,7 +11,7 @@ import "./suppress-stderr.mjs";
|
|
|
11
11
|
|
|
12
12
|
import { readStdin, getSessionId, getSessionDBPath } from "./session-helpers.mjs";
|
|
13
13
|
import { join, dirname } from "node:path";
|
|
14
|
-
import { fileURLToPath } from "node:url";
|
|
14
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
15
15
|
|
|
16
16
|
const HOOK_DIR = dirname(fileURLToPath(import.meta.url));
|
|
17
17
|
const PKG_SESSION = join(HOOK_DIR, "..", "build", "session");
|
|
@@ -30,8 +30,8 @@ try {
|
|
|
30
30
|
|| trimmed.startsWith("<tool-result>");
|
|
31
31
|
|
|
32
32
|
if (trimmed.length > 0 && !isSystemMessage) {
|
|
33
|
-
const { SessionDB } = await import(join(PKG_SESSION, "db.js"));
|
|
34
|
-
const { extractUserEvents } = await import(join(PKG_SESSION, "extract.js"));
|
|
33
|
+
const { SessionDB } = await import(pathToFileURL(join(PKG_SESSION, "db.js")).href);
|
|
34
|
+
const { extractUserEvents } = await import(pathToFileURL(join(PKG_SESSION, "extract.js")).href);
|
|
35
35
|
const dbPath = getSessionDBPath();
|
|
36
36
|
const db = new SessionDB({ dbPath });
|
|
37
37
|
const sessionId = getSessionId(input);
|
|
@@ -12,8 +12,8 @@ import "../suppress-stderr.mjs";
|
|
|
12
12
|
import { readStdin, getSessionId, getSessionDBPath, getProjectDir, VSCODE_OPTS } from "../session-helpers.mjs";
|
|
13
13
|
import { appendFileSync } from "node:fs";
|
|
14
14
|
import { join, dirname } from "node:path";
|
|
15
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
15
16
|
import { homedir } from "node:os";
|
|
16
|
-
import { fileURLToPath } from "node:url";
|
|
17
17
|
|
|
18
18
|
const HOOK_DIR = dirname(fileURLToPath(import.meta.url));
|
|
19
19
|
const PKG_SESSION = join(HOOK_DIR, "..", "..", "build", "session");
|
|
@@ -26,8 +26,8 @@ try {
|
|
|
26
26
|
|
|
27
27
|
appendFileSync(DEBUG_LOG, `[${new Date().toISOString()}] CALL: ${input.tool_name}\n`);
|
|
28
28
|
|
|
29
|
-
const { extractEvents } = await import(join(PKG_SESSION, "extract.js"));
|
|
30
|
-
const { SessionDB } = await import(join(PKG_SESSION, "db.js"));
|
|
29
|
+
const { extractEvents } = await import(pathToFileURL(join(PKG_SESSION, "extract.js")).href);
|
|
30
|
+
const { SessionDB } = await import(pathToFileURL(join(PKG_SESSION, "db.js")).href);
|
|
31
31
|
|
|
32
32
|
const dbPath = getSessionDBPath(OPTS);
|
|
33
33
|
const db = new SessionDB({ dbPath });
|
|
@@ -11,8 +11,8 @@ import "../suppress-stderr.mjs";
|
|
|
11
11
|
import { readStdin, getSessionId, getSessionDBPath, VSCODE_OPTS } from "../session-helpers.mjs";
|
|
12
12
|
import { appendFileSync } from "node:fs";
|
|
13
13
|
import { join, dirname } from "node:path";
|
|
14
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
14
15
|
import { homedir } from "node:os";
|
|
15
|
-
import { fileURLToPath } from "node:url";
|
|
16
16
|
|
|
17
17
|
const HOOK_DIR = dirname(fileURLToPath(import.meta.url));
|
|
18
18
|
const PKG_SESSION = join(HOOK_DIR, "..", "..", "build", "session");
|
|
@@ -23,8 +23,8 @@ try {
|
|
|
23
23
|
const raw = await readStdin();
|
|
24
24
|
const input = JSON.parse(raw);
|
|
25
25
|
|
|
26
|
-
const { buildResumeSnapshot } = await import(join(PKG_SESSION, "snapshot.js"));
|
|
27
|
-
const { SessionDB } = await import(join(PKG_SESSION, "db.js"));
|
|
26
|
+
const { buildResumeSnapshot } = await import(pathToFileURL(join(PKG_SESSION, "snapshot.js")).href);
|
|
27
|
+
const { SessionDB } = await import(pathToFileURL(join(PKG_SESSION, "db.js")).href);
|
|
28
28
|
|
|
29
29
|
const dbPath = getSessionDBPath(OPTS);
|
|
30
30
|
const db = new SessionDB({ dbPath });
|
|
@@ -18,9 +18,10 @@ import {
|
|
|
18
18
|
} from "../session-helpers.mjs";
|
|
19
19
|
import { join } from "node:path";
|
|
20
20
|
import { readFileSync, writeFileSync, unlinkSync } from "node:fs";
|
|
21
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
21
22
|
import { homedir } from "node:os";
|
|
22
23
|
|
|
23
|
-
const HOOK_DIR = new URL(".", import.meta.url)
|
|
24
|
+
const HOOK_DIR = fileURLToPath(new URL(".", import.meta.url));
|
|
24
25
|
const PKG_SESSION = join(HOOK_DIR, "..", "..", "build", "session");
|
|
25
26
|
const OPTS = VSCODE_OPTS;
|
|
26
27
|
|
|
@@ -32,7 +33,7 @@ try {
|
|
|
32
33
|
const source = input.source ?? "startup";
|
|
33
34
|
|
|
34
35
|
if (source === "compact") {
|
|
35
|
-
const { SessionDB } = await import(join(PKG_SESSION, "db.js"));
|
|
36
|
+
const { SessionDB } = await import(pathToFileURL(join(PKG_SESSION, "db.js")).href);
|
|
36
37
|
const dbPath = getSessionDBPath(OPTS);
|
|
37
38
|
const db = new SessionDB({ dbPath });
|
|
38
39
|
const sessionId = getSessionId(input, OPTS);
|
|
@@ -52,7 +53,7 @@ try {
|
|
|
52
53
|
} else if (source === "resume") {
|
|
53
54
|
try { unlinkSync(getCleanupFlagPath(OPTS)); } catch { /* no flag */ }
|
|
54
55
|
|
|
55
|
-
const { SessionDB } = await import(join(PKG_SESSION, "db.js"));
|
|
56
|
+
const { SessionDB } = await import(pathToFileURL(join(PKG_SESSION, "db.js")).href);
|
|
56
57
|
const dbPath = getSessionDBPath(OPTS);
|
|
57
58
|
const db = new SessionDB({ dbPath });
|
|
58
59
|
|
|
@@ -64,7 +65,7 @@ try {
|
|
|
64
65
|
|
|
65
66
|
db.close();
|
|
66
67
|
} else if (source === "startup") {
|
|
67
|
-
const { SessionDB } = await import(join(PKG_SESSION, "db.js"));
|
|
68
|
+
const { SessionDB } = await import(pathToFileURL(join(PKG_SESSION, "db.js")).href);
|
|
68
69
|
const dbPath = getSessionDBPath(OPTS);
|
|
69
70
|
const db = new SessionDB({ dbPath });
|
|
70
71
|
try { unlinkSync(getSessionEventsPath(OPTS)); } catch { /* no stale file */ }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "context-mode",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "MCP plugin that saves 98% of your context window. Works with Claude Code, Gemini CLI, VS Code Copilot, OpenCode, and Codex CLI. Sandboxed code execution, FTS5 knowledge base, and intent-driven search.",
|
|
6
6
|
"author": "Mert Koseoğlu",
|
|
@@ -26,10 +26,11 @@
|
|
|
26
26
|
},
|
|
27
27
|
"homepage": "https://github.com/mksglu/context-mode#readme",
|
|
28
28
|
"bugs": "https://github.com/mksglu/context-mode/issues",
|
|
29
|
-
"main": "./build/
|
|
29
|
+
"main": "./build/opencode-plugin.js",
|
|
30
30
|
"exports": {
|
|
31
|
-
".": "./build/
|
|
32
|
-
"./plugin": "./build/opencode-plugin.js"
|
|
31
|
+
".": "./build/opencode-plugin.js",
|
|
32
|
+
"./plugin": "./build/opencode-plugin.js",
|
|
33
|
+
"./cli": "./build/cli.js"
|
|
33
34
|
},
|
|
34
35
|
"bin": {
|
|
35
36
|
"context-mode": "./build/cli.js"
|