context-mode 1.0.21 → 1.0.23
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 +4 -2
- package/.openclaw-plugin/index.ts +11 -0
- package/.openclaw-plugin/openclaw.plugin.json +23 -0
- package/.openclaw-plugin/package.json +28 -0
- package/README.md +165 -26
- package/build/adapters/antigravity/index.d.ts +49 -0
- package/build/adapters/antigravity/index.js +217 -0
- package/build/adapters/client-map.d.ts +10 -0
- package/build/adapters/client-map.js +18 -0
- package/build/adapters/detect.d.ts +8 -1
- package/build/adapters/detect.js +58 -1
- package/build/adapters/kiro/hooks.d.ts +32 -0
- package/build/adapters/kiro/hooks.js +47 -0
- package/build/adapters/kiro/index.d.ts +50 -0
- package/build/adapters/kiro/index.js +325 -0
- package/build/adapters/openclaw/config.d.ts +8 -0
- package/build/adapters/openclaw/config.js +8 -0
- package/build/adapters/openclaw/hooks.d.ts +50 -0
- package/build/adapters/openclaw/hooks.js +61 -0
- package/build/adapters/openclaw/index.d.ts +51 -0
- package/build/adapters/openclaw/index.js +459 -0
- package/build/adapters/openclaw/session-db.d.ts +55 -0
- package/build/adapters/openclaw/session-db.js +88 -0
- package/build/adapters/types.d.ts +1 -1
- package/build/cli.js +5 -3
- package/build/executor.js +99 -112
- package/build/openclaw/workspace-router.d.ts +29 -0
- package/build/openclaw/workspace-router.js +64 -0
- package/build/openclaw-plugin.d.ts +121 -0
- package/build/openclaw-plugin.js +525 -0
- package/build/server.js +45 -10
- package/build/session/db.d.ts +9 -0
- package/build/session/db.js +38 -0
- package/cli.bundle.mjs +136 -124
- package/configs/antigravity/GEMINI.md +58 -0
- package/configs/antigravity/mcp_config.json +7 -0
- package/configs/kiro/mcp_config.json +7 -0
- package/configs/openclaw/AGENTS.md +58 -0
- package/configs/openclaw/openclaw.json +13 -0
- package/hooks/core/routing.mjs +16 -8
- package/hooks/kiro/posttooluse.mjs +58 -0
- package/hooks/kiro/pretooluse.mjs +63 -0
- package/hooks/posttooluse.mjs +6 -5
- package/hooks/precompact.mjs +5 -4
- package/hooks/session-db.bundle.mjs +57 -0
- package/hooks/session-extract.bundle.mjs +1 -0
- package/hooks/session-helpers.mjs +41 -3
- package/hooks/session-loaders.mjs +28 -0
- package/hooks/session-snapshot.bundle.mjs +14 -0
- package/hooks/sessionstart.mjs +6 -5
- package/hooks/userpromptsubmit.mjs +6 -5
- package/hooks/vscode-copilot/posttooluse.mjs +5 -4
- package/hooks/vscode-copilot/precompact.mjs +5 -4
- package/hooks/vscode-copilot/sessionstart.mjs +5 -4
- package/openclaw.plugin.json +23 -0
- package/package.json +13 -2
- package/server.bundle.mjs +94 -82
- package/start.mjs +1 -0
package/build/session/db.js
CHANGED
|
@@ -7,6 +7,44 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { SQLiteBase, defaultDBPath } from "../db-base.js";
|
|
9
9
|
import { createHash } from "node:crypto";
|
|
10
|
+
import { execFileSync } from "node:child_process";
|
|
11
|
+
// ─────────────────────────────────────────────────────────
|
|
12
|
+
// Worktree isolation
|
|
13
|
+
// ─────────────────────────────────────────────────────────
|
|
14
|
+
/**
|
|
15
|
+
* Returns the worktree suffix to append to session identifiers.
|
|
16
|
+
* Returns empty string when running in the main working tree.
|
|
17
|
+
*
|
|
18
|
+
* Set CONTEXT_MODE_SESSION_SUFFIX to an explicit value to override
|
|
19
|
+
* (useful in CI environments or when git is unavailable).
|
|
20
|
+
* Set to empty string to disable isolation entirely.
|
|
21
|
+
*/
|
|
22
|
+
export function getWorktreeSuffix() {
|
|
23
|
+
const envSuffix = process.env.CONTEXT_MODE_SESSION_SUFFIX;
|
|
24
|
+
if (envSuffix !== undefined) {
|
|
25
|
+
return envSuffix ? `__${envSuffix}` : "";
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
const cwd = process.cwd();
|
|
29
|
+
const mainWorktree = execFileSync("git", ["worktree", "list", "--porcelain"], {
|
|
30
|
+
encoding: "utf-8",
|
|
31
|
+
timeout: 2000,
|
|
32
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
33
|
+
})
|
|
34
|
+
.split(/\r?\n/)
|
|
35
|
+
.find((l) => l.startsWith("worktree "))
|
|
36
|
+
?.replace("worktree ", "")
|
|
37
|
+
?.trim();
|
|
38
|
+
if (mainWorktree && cwd !== mainWorktree) {
|
|
39
|
+
const suffix = createHash("sha256").update(cwd).digest("hex").slice(0, 8);
|
|
40
|
+
return `__${suffix}`;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
// git not available or not a git repo — no suffix
|
|
45
|
+
}
|
|
46
|
+
return "";
|
|
47
|
+
}
|
|
10
48
|
// ─────────────────────────────────────────────────────────
|
|
11
49
|
// Constants
|
|
12
50
|
// ─────────────────────────────────────────────────────────
|