@cryptiklemur/lattice 5.10.0 → 5.11.0
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/dist/client/assets/{angular-html-BDIcxkJq.js → angular-html-BoFzmWT8.js} +1 -1
- package/dist/client/assets/{angular-ts-Bt22ouNH.js → angular-ts-DZnI8rKE.js} +1 -1
- package/dist/client/assets/{apl-p8qkxzEK.js → apl-DstVmncE.js} +1 -1
- package/dist/client/assets/{astro-CIaMc49M.js → astro-DTPCjzEx.js} +1 -1
- package/dist/client/assets/{blade-BR56EAMD.js → blade-6q42Ss3F.js} +1 -1
- package/dist/client/assets/{c-Dli0HzAh.js → c-BQDGJ-nQ.js} +1 -1
- package/dist/client/assets/{cobol-Cad15ECy.js → cobol-Dlh0WvsZ.js} +1 -1
- package/dist/client/assets/{coffee-DpyATEbF.js → coffee-DdQv129j.js} +1 -1
- package/dist/client/assets/{cpp-KN8_NFsf.js → cpp-DhbQJIv4.js} +1 -1
- package/dist/client/assets/{crystal-CuyGv0kh.js → crystal-C22kERUB.js} +1 -1
- package/dist/client/assets/{css-Cm3q4bxn.js → css-n31O5kHj.js} +1 -1
- package/dist/client/assets/{dist-BjxsMc4u.js → dist-D8okl7lw.js} +2 -2
- package/dist/client/assets/{edge-B6S7CSbx.js → edge-Cgwx-o_7.js} +1 -1
- package/dist/client/assets/{elixir-CNUy9H8T.js → elixir-DAGM2WKD.js} +1 -1
- package/dist/client/assets/{elm-CNfcWmb9.js → elm-BLw_7oO9.js} +1 -1
- package/dist/client/assets/{erb-DWebzDaI.js → erb-DCaNhYa7.js} +1 -1
- package/dist/client/assets/{git-rebase-B_Pt2ZBK.js → git-rebase-CNNhb8-g.js} +1 -1
- package/dist/client/assets/{glimmer-js-CVwoOd72.js → glimmer-js-BnZd88Wi.js} +1 -1
- package/dist/client/assets/{glimmer-ts-CjtFSxjz.js → glimmer-ts-DvFNbZu-.js} +1 -1
- package/dist/client/assets/{glsl-CP4rggAA.js → glsl-Dnrk_Jnx.js} +1 -1
- package/dist/client/assets/{graphql-Dbm6sAtp.js → graphql-DlWTPvCG.js} +1 -1
- package/dist/client/assets/{hack-Bj9y3SGf.js → hack-DQg1Ek33.js} +1 -1
- package/dist/client/assets/{haml-DRGrdf3f.js → haml-DSk45qIE.js} +1 -1
- package/dist/client/assets/{handlebars-CFKjcBMg.js → handlebars-DuLvATB2.js} +1 -1
- package/dist/client/assets/{html-Vcd4eHHg.js → html-D4DiUnLg.js} +1 -1
- package/dist/client/assets/{html-derivative-BF0YbD4L.js → html-derivative-CS5MZ6d9.js} +1 -1
- package/dist/client/assets/{http-CGVTa2NT.js → http-CkDncfer.js} +1 -1
- package/dist/client/assets/{hurl-B0GrsGqd.js → hurl-DU39oO3U.js} +1 -1
- package/dist/client/assets/{index-CX1tudsF.js → index-CHPfE1Zl.js} +129 -129
- package/dist/client/assets/index-DHUKmLLC.css +2 -0
- package/dist/client/assets/{java-BJHQqHsm.js → java-lntACKEu.js} +1 -1
- package/dist/client/assets/{javascript-CmuMsKrc.js → javascript-CxkFc6nV.js} +1 -1
- package/dist/client/assets/{jinja-JxCLeq1j.js → jinja-DolO2zO7.js} +1 -1
- package/dist/client/assets/{jison-BdgAUhei.js → jison-Cok5FPev.js} +1 -1
- package/dist/client/assets/{json-DtPissHL.js → json-BebuQPrq.js} +1 -1
- package/dist/client/assets/{jsx-DUAxxDkP.js → jsx-iLBaUyXr.js} +1 -1
- package/dist/client/assets/{julia-DxDlbL6e.js → julia-C5Dsc7cH.js} +1 -1
- package/dist/client/assets/{just-CVmAAx2R.js → just-DJYqq_9R.js} +1 -1
- package/dist/client/assets/{latex-uwxggTWA.js → latex-BTTYiKj1.js} +1 -1
- package/dist/client/assets/{liquid-xsETAJJy.js → liquid-DpAKCrOB.js} +1 -1
- package/dist/client/assets/{lua-B2Hh8PgD.js → lua-BZ6b1hko.js} +1 -1
- package/dist/client/assets/{marko-yDeGxD87.js → marko-D8VK6iGt.js} +1 -1
- package/dist/client/assets/{mdc-QMp4ieYR.js → mdc-Paa3XzwY.js} +1 -1
- package/dist/client/assets/{nginx-7gmRmcqz.js → nginx-C5k9mWtJ.js} +1 -1
- package/dist/client/assets/{nim-CA8SNY_7.js → nim-Dst6YSnE.js} +1 -1
- package/dist/client/assets/{perl-lx5nW4VC.js → perl-XhiCjgBp.js} +1 -1
- package/dist/client/assets/{php-DgHiW953.js → php-BcsPLnLU.js} +1 -1
- package/dist/client/assets/{pug-CbbB1vwb.js → pug-GLH9-eAJ.js} +1 -1
- package/dist/client/assets/{qml-COrzwCIh.js → qml-Cj_lJioE.js} +1 -1
- package/dist/client/assets/{r-Dv7pZJDH.js → r-B70aGYK5.js} +1 -1
- package/dist/client/assets/{razor-D2m8EDP5.js → razor-R3gub_zy.js} +1 -1
- package/dist/client/assets/{regexp-BXLT-jPc.js → regexp-itC0dIUJ.js} +1 -1
- package/dist/client/assets/{rst-_S6rrUYh.js → rst-DdyoV8E2.js} +1 -1
- package/dist/client/assets/{ruby-C3XO7tYY.js → ruby-BYBZsv66.js} +1 -1
- package/dist/client/assets/{sas-DP2k4iuN.js → sas-fqfqXqj1.js} +1 -1
- package/dist/client/assets/{scss-lhLFMXGn.js → scss-B-ELv6mu.js} +1 -1
- package/dist/client/assets/{shellscript-BYlBPHen.js → shellscript-BgB8TNw6.js} +1 -1
- package/dist/client/assets/{shellsession-CbVyQKWZ.js → shellsession-BLK2Dgkm.js} +1 -1
- package/dist/client/assets/{soy-Be8a0lHq.js → soy-C7_RmNrp.js} +1 -1
- package/dist/client/assets/{sql-2KxvU9YS.js → sql-AUgbUJq4.js} +1 -1
- package/dist/client/assets/{stata-BxlWftTS.js → stata-CIVqSIOr.js} +1 -1
- package/dist/client/assets/{surrealql-CJ-q86nR.js → surrealql-BzRQzc5S.js} +1 -1
- package/dist/client/assets/{svelte-Q1ml0OiY.js → svelte-BCIwEwtb.js} +1 -1
- package/dist/client/assets/{templ-BbfPZhtu.js → templ-C1hbwe4u.js} +1 -1
- package/dist/client/assets/{tex-Dcth4Gi6.js → tex-CI4tIsaP.js} +1 -1
- package/dist/client/assets/{ts-tags-BKhSOXI3.js → ts-tags-SUeikhEp.js} +1 -1
- package/dist/client/assets/{tsx-CS6iQ0XH.js → tsx-xkp7aIZs.js} +1 -1
- package/dist/client/assets/{twig-BHp31ZxS.js → twig-CGgBSAyc.js} +1 -1
- package/dist/client/assets/{typescript-16YJBTaO.js → typescript-O2YMTl_s.js} +1 -1
- package/dist/client/assets/{vue-CMKwTi4r.js → vue-DsNRxos1.js} +1 -1
- package/dist/client/assets/{vue-html-Dr8VUA2G.js → vue-html-CuY3t7bs.js} +1 -1
- package/dist/client/assets/{vue-vine-DZUqDerl.js → vue-vine-C6kSCKwY.js} +1 -1
- package/dist/client/assets/{xml-CBbBKKDC.js → xml-DafwzOLY.js} +1 -1
- package/dist/client/assets/{xsl-DWEX6PKX.js → xsl-1SGGZibr.js} +1 -1
- package/dist/client/assets/{yaml-DvKvvh3X.js → yaml-DSVhzmhr.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/client/sw.js +1 -1
- package/dist/server/analytics/engine.js +241 -241
- package/dist/server/assets.js +4 -4
- package/dist/server/auth/passphrase.js +13 -13
- package/dist/server/config.js +7 -7
- package/dist/server/daemon.js +93 -93
- package/dist/server/features/brainstorm.js +42 -42
- package/dist/server/features/ralph-loop.js +33 -33
- package/dist/server/features/scheduler.js +53 -53
- package/dist/server/features/specs.js +54 -54
- package/dist/server/features/sticky-notes.js +17 -17
- package/dist/server/features/superpowers.js +24 -24
- package/dist/server/handlers/analytics.js +1 -1
- package/dist/server/handlers/attachment.js +32 -32
- package/dist/server/handlers/bookmarks.js +4 -4
- package/dist/server/handlers/brainstorm.js +4 -4
- package/dist/server/handlers/chat.js +54 -54
- package/dist/server/handlers/editor.js +13 -13
- package/dist/server/handlers/fs.js +51 -51
- package/dist/server/handlers/hooks.js +20 -20
- package/dist/server/handlers/loop.js +6 -6
- package/dist/server/handlers/memory.js +44 -44
- package/dist/server/handlers/mesh.js +60 -60
- package/dist/server/handlers/notes.js +7 -7
- package/dist/server/handlers/plugins.js +174 -174
- package/dist/server/handlers/project-settings.js +26 -26
- package/dist/server/handlers/scheduler.js +6 -6
- package/dist/server/handlers/session.js +24 -24
- package/dist/server/handlers/settings.js +21 -21
- package/dist/server/handlers/skills.js +91 -91
- package/dist/server/handlers/specs.js +51 -28
- package/dist/server/handlers/terminal.js +13 -13
- package/dist/server/handlers/themes.js +21 -21
- package/dist/server/handlers/update.js +17 -17
- package/dist/server/hooks/event_forward.sh +34 -0
- package/dist/server/hooks/post_tool_use.sh +26 -0
- package/dist/server/hooks/statusline.sh +26 -0
- package/dist/server/identity.js +6 -6
- package/dist/server/index.js +111 -111
- package/dist/server/logger.js +1 -1
- package/dist/server/mesh/connector.js +78 -78
- package/dist/server/mesh/crypto.js +20 -20
- package/dist/server/mesh/discovery.js +14 -14
- package/dist/server/mesh/pairing.js +30 -30
- package/dist/server/mesh/peers.js +10 -10
- package/dist/server/mesh/proxy.js +14 -14
- package/dist/server/mesh/session-sync.js +23 -23
- package/dist/server/project/bookmarks.js +11 -11
- package/dist/server/project/context-breakdown.js +70 -70
- package/dist/server/project/file-browser.js +17 -17
- package/dist/server/project/project-files.js +68 -68
- package/dist/server/project/registry.js +10 -10
- package/dist/server/project/sdk-bridge.js +157 -157
- package/dist/server/project/session.js +201 -199
- package/dist/server/project/terminal.js +15 -15
- package/dist/server/project/warmup.js +37 -37
- package/dist/server/push.js +11 -11
- package/dist/server/runtime.js +1 -1
- package/dist/server/tls.js +15 -15
- package/dist/server/tui.js +15 -15
- package/dist/server/update-checker.js +21 -21
- package/dist/server/ws/broadcast.js +18 -18
- package/dist/server/ws/router.js +17 -17
- package/dist/shared/constants.js +8 -8
- package/package.json +2 -2
- package/dist/client/assets/index-DlfI20Gn.css +0 -2
|
@@ -17,16 +17,16 @@ async function ensureThemesDir() {
|
|
|
17
17
|
}
|
|
18
18
|
export async function loadAllThemes() {
|
|
19
19
|
await ensureThemesDir();
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
for (
|
|
20
|
+
const dir = themesDir();
|
|
21
|
+
const files = await readdir(dir);
|
|
22
|
+
const jsonFiles = files.filter((f) => f.endsWith(".json"));
|
|
23
|
+
const themes = [];
|
|
24
|
+
for (const file of jsonFiles) {
|
|
25
25
|
try {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
for (
|
|
26
|
+
const raw = await readFile(join(dir, file), "utf-8");
|
|
27
|
+
const data = JSON.parse(raw);
|
|
28
|
+
const colors = {};
|
|
29
|
+
for (const key of Object.keys(data)) {
|
|
30
30
|
if (key.startsWith("base0")) {
|
|
31
31
|
colors[key] = data[key];
|
|
32
32
|
}
|
|
@@ -47,15 +47,15 @@ export async function loadAllThemes() {
|
|
|
47
47
|
}
|
|
48
48
|
registerHandler("theme", async function (clientId, message) {
|
|
49
49
|
if (message.type === "theme:list_custom") {
|
|
50
|
-
|
|
50
|
+
const themes = await loadAllThemes();
|
|
51
51
|
sendTo(clientId, { type: "theme:custom_list", themes });
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
54
|
if (message.type === "theme:save") {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
const saveMsg = message;
|
|
56
|
+
const slug = slugify(saveMsg.name);
|
|
57
|
+
const filename = slug + ".json";
|
|
58
|
+
const themeData = {
|
|
59
59
|
name: saveMsg.name,
|
|
60
60
|
author: saveMsg.author,
|
|
61
61
|
variant: saveMsg.variant,
|
|
@@ -63,8 +63,8 @@ registerHandler("theme", async function (clientId, message) {
|
|
|
63
63
|
};
|
|
64
64
|
await ensureThemesDir();
|
|
65
65
|
await writeFile(join(themesDir(), filename), JSON.stringify(themeData, null, 2));
|
|
66
|
-
|
|
67
|
-
for (
|
|
66
|
+
const savedColors = {};
|
|
67
|
+
for (const key of Object.keys(saveMsg.colors)) {
|
|
68
68
|
if (key.startsWith("base0")) {
|
|
69
69
|
savedColors[key] = saveMsg.colors[key];
|
|
70
70
|
}
|
|
@@ -79,14 +79,14 @@ registerHandler("theme", async function (clientId, message) {
|
|
|
79
79
|
colors: savedColors,
|
|
80
80
|
},
|
|
81
81
|
});
|
|
82
|
-
|
|
82
|
+
const allThemes = await loadAllThemes();
|
|
83
83
|
broadcast({ type: "theme:custom_list", themes: allThemes });
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
86
|
if (message.type === "theme:delete") {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
const deleteMsg = message;
|
|
88
|
+
const deleteSlug = slugify(deleteMsg.name);
|
|
89
|
+
const deleteFilename = deleteSlug + ".json";
|
|
90
90
|
try {
|
|
91
91
|
await unlink(join(themesDir(), deleteFilename));
|
|
92
92
|
}
|
|
@@ -95,7 +95,7 @@ registerHandler("theme", async function (clientId, message) {
|
|
|
95
95
|
return;
|
|
96
96
|
}
|
|
97
97
|
sendTo(clientId, { type: "theme:deleted", filename: deleteFilename });
|
|
98
|
-
|
|
98
|
+
const updatedThemes = await loadAllThemes();
|
|
99
99
|
broadcast({ type: "theme:custom_list", themes: updatedThemes });
|
|
100
100
|
return;
|
|
101
101
|
}
|
|
@@ -6,39 +6,39 @@ import { registerHandler } from "../ws/router.js";
|
|
|
6
6
|
import { sendTo, broadcast } from "../ws/broadcast.js";
|
|
7
7
|
import { checkForUpdate, getPackageName, getGitHubRepo } from "../update-checker.js";
|
|
8
8
|
function getAssetName() {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
const platform = process.platform === "darwin" ? "darwin" : "linux";
|
|
10
|
+
const arch = process.arch === "arm64" ? "arm64" : "x64";
|
|
11
11
|
return "lattice-" + platform + "-" + arch;
|
|
12
12
|
}
|
|
13
13
|
async function downloadBinaryUpdate() {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
const repo = getGitHubRepo();
|
|
15
|
+
const assetName = getAssetName();
|
|
16
16
|
try {
|
|
17
|
-
|
|
17
|
+
const releaseRes = await fetch("https://api.github.com/repos/" + repo + "/releases/latest", {
|
|
18
18
|
headers: { "Accept": "application/vnd.github.v3+json" },
|
|
19
19
|
signal: AbortSignal.timeout(30000),
|
|
20
20
|
});
|
|
21
21
|
if (!releaseRes.ok) {
|
|
22
22
|
return { success: false, message: "Failed to fetch release info (HTTP " + releaseRes.status + ")" };
|
|
23
23
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
const release = await releaseRes.json();
|
|
25
|
+
const assets = release.assets ?? [];
|
|
26
|
+
const asset = assets.find(function (a) { return a.name === assetName; });
|
|
27
27
|
if (!asset) {
|
|
28
28
|
return { success: false, message: "No binary found for " + assetName + " in latest release" };
|
|
29
29
|
}
|
|
30
|
-
|
|
30
|
+
const downloadRes = await fetch(asset.browser_download_url, {
|
|
31
31
|
signal: AbortSignal.timeout(120000),
|
|
32
32
|
});
|
|
33
33
|
if (!downloadRes.ok) {
|
|
34
34
|
return { success: false, message: "Failed to download binary (HTTP " + downloadRes.status + ")" };
|
|
35
35
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
const binary = new Uint8Array(await downloadRes.arrayBuffer());
|
|
37
|
+
const execPath = process.execPath;
|
|
38
|
+
const tmpPath = join(tmpdir(), "lattice-update-" + Date.now());
|
|
39
39
|
writeFileSync(tmpPath, binary);
|
|
40
40
|
chmodSync(tmpPath, 0o755);
|
|
41
|
-
|
|
41
|
+
let needsSudo = false;
|
|
42
42
|
try {
|
|
43
43
|
accessSync(execPath, fsConstants.W_OK);
|
|
44
44
|
}
|
|
@@ -72,7 +72,7 @@ async function downloadBinaryUpdate() {
|
|
|
72
72
|
}
|
|
73
73
|
registerHandler("update", function (clientId, message) {
|
|
74
74
|
if (message.type === "update:check") {
|
|
75
|
-
|
|
75
|
+
const checkMsg = message;
|
|
76
76
|
void checkForUpdate(checkMsg.force ?? false).then(function (info) {
|
|
77
77
|
sendTo(clientId, {
|
|
78
78
|
type: "update:status",
|
|
@@ -87,12 +87,12 @@ registerHandler("update", function (clientId, message) {
|
|
|
87
87
|
}
|
|
88
88
|
if (message.type === "update:apply") {
|
|
89
89
|
{
|
|
90
|
-
|
|
90
|
+
const pkgName = getPackageName();
|
|
91
91
|
try {
|
|
92
|
-
|
|
92
|
+
const proc = spawn("npm", ["install", "-g", pkgName + "@latest"], {
|
|
93
93
|
stdio: ["ignore", "pipe", "pipe"],
|
|
94
94
|
});
|
|
95
|
-
|
|
95
|
+
const timeout = setTimeout(function () {
|
|
96
96
|
proc.kill();
|
|
97
97
|
}, 120000);
|
|
98
98
|
proc.on("close", function (code) {
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
# Lattice Context Analyzer - Generic event hook for Claude Code
|
|
3
|
+
# Used for: SessionStart, Stop, PreCompact, PostCompact, UserPromptSubmit
|
|
4
|
+
# Reads JSON from stdin, forwards to Lattice server
|
|
5
|
+
set -e
|
|
6
|
+
|
|
7
|
+
EVENT_TYPE="$1"
|
|
8
|
+
if [ -z "$EVENT_TYPE" ]; then
|
|
9
|
+
exit 0
|
|
10
|
+
fi
|
|
11
|
+
|
|
12
|
+
# Derive LATTICE_HOME from this script's install location (hooks/ is inside LATTICE_HOME)
|
|
13
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
14
|
+
LATTICE_HOME="${SCRIPT_DIR%/hooks}"
|
|
15
|
+
CONFIG="$LATTICE_HOME/config.json"
|
|
16
|
+
|
|
17
|
+
PORT=7654
|
|
18
|
+
if [ -f "$LATTICE_HOME/port" ]; then
|
|
19
|
+
PORT=$(cat "$LATTICE_HOME/port" 2>/dev/null || echo 7654)
|
|
20
|
+
elif [ -f "$CONFIG" ]; then
|
|
21
|
+
P=$(grep -o '"port"[[:space:]]*:[[:space:]]*[0-9]*' "$CONFIG" 2>/dev/null | grep -o '[0-9]*$' || true)
|
|
22
|
+
[ -n "$P" ] && PORT="$P"
|
|
23
|
+
fi
|
|
24
|
+
|
|
25
|
+
INPUT=$(cat)
|
|
26
|
+
SESSION_ID=$(printf '%s' "$INPUT" | grep -o '"session_id"[[:space:]]*:[[:space:]]*"[^"]*"' | head -1 | sed 's/.*:.*"\(.*\)"/\1/')
|
|
27
|
+
TIMESTAMP=$(date +%s000)
|
|
28
|
+
|
|
29
|
+
curl -s -X POST "http://127.0.0.1:$PORT/api/hook/event" \
|
|
30
|
+
-H "Content-Type: application/json" \
|
|
31
|
+
-d "{\"event_type\":\"$EVENT_TYPE\",\"session_id\":\"$SESSION_ID\",\"timestamp_ms\":$TIMESTAMP}" \
|
|
32
|
+
>/dev/null 2>&1 || true
|
|
33
|
+
|
|
34
|
+
exit 0
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
# Lattice Context Analyzer - PostToolUse hook for Claude Code
|
|
3
|
+
# Reads tool use JSON from stdin, forwards raw JSON to Lattice server
|
|
4
|
+
set -e
|
|
5
|
+
|
|
6
|
+
# Derive LATTICE_HOME from this script's install location (hooks/ is inside LATTICE_HOME)
|
|
7
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
8
|
+
LATTICE_HOME="${SCRIPT_DIR%/hooks}"
|
|
9
|
+
CONFIG="$LATTICE_HOME/config.json"
|
|
10
|
+
|
|
11
|
+
PORT=7654
|
|
12
|
+
if [ -f "$LATTICE_HOME/port" ]; then
|
|
13
|
+
PORT=$(cat "$LATTICE_HOME/port" 2>/dev/null || echo 7654)
|
|
14
|
+
elif [ -f "$CONFIG" ]; then
|
|
15
|
+
P=$(grep -o '"port"[[:space:]]*:[[:space:]]*[0-9]*' "$CONFIG" 2>/dev/null | grep -o '[0-9]*$' || true)
|
|
16
|
+
[ -n "$P" ] && PORT="$P"
|
|
17
|
+
fi
|
|
18
|
+
|
|
19
|
+
INPUT=$(cat)
|
|
20
|
+
|
|
21
|
+
# Post raw JSON -- server handles parsing
|
|
22
|
+
curl -s -X POST "http://127.0.0.1:$PORT/api/hook/tool_use" \
|
|
23
|
+
-H "Content-Type: application/json" \
|
|
24
|
+
-d "$INPUT" >/dev/null 2>&1 || true
|
|
25
|
+
|
|
26
|
+
exit 0
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
# Lattice Context Analyzer - Statusline hook for Claude Code
|
|
3
|
+
# Reads context window JSON from stdin, posts raw JSON to Lattice for server-side parsing
|
|
4
|
+
set -e
|
|
5
|
+
|
|
6
|
+
# Derive LATTICE_HOME from this script's install location (hooks/ is inside LATTICE_HOME)
|
|
7
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
8
|
+
LATTICE_HOME="${SCRIPT_DIR%/hooks}"
|
|
9
|
+
CONFIG="$LATTICE_HOME/config.json"
|
|
10
|
+
|
|
11
|
+
PORT=7654
|
|
12
|
+
if [ -f "$LATTICE_HOME/port" ]; then
|
|
13
|
+
PORT=$(cat "$LATTICE_HOME/port" 2>/dev/null || echo 7654)
|
|
14
|
+
elif [ -f "$CONFIG" ]; then
|
|
15
|
+
P=$(grep -o '"port"[[:space:]]*:[[:space:]]*[0-9]*' "$CONFIG" 2>/dev/null | grep -o '[0-9]*$' || true)
|
|
16
|
+
[ -n "$P" ] && PORT="$P"
|
|
17
|
+
fi
|
|
18
|
+
|
|
19
|
+
INPUT=$(cat)
|
|
20
|
+
|
|
21
|
+
# Post raw JSON to Lattice -- server handles parsing
|
|
22
|
+
curl -s -X POST "http://127.0.0.1:$PORT/api/hook/statusline" \
|
|
23
|
+
-H "Content-Type: application/json" \
|
|
24
|
+
-d "$INPUT" >/dev/null 2>&1 || true
|
|
25
|
+
|
|
26
|
+
exit 0
|
package/dist/server/identity.js
CHANGED
|
@@ -6,21 +6,21 @@ export function getIdentityPath() {
|
|
|
6
6
|
return join(getLatticeHome(), "identity.json");
|
|
7
7
|
}
|
|
8
8
|
export function loadOrCreateIdentity() {
|
|
9
|
-
|
|
9
|
+
const path = getIdentityPath();
|
|
10
10
|
if (existsSync(path)) {
|
|
11
|
-
|
|
11
|
+
const stored = JSON.parse(readFileSync(path, "utf-8"));
|
|
12
12
|
if (stored.publicKey && stored.privateKey) {
|
|
13
13
|
return stored;
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
const keys = generateEd25519Keypair();
|
|
16
16
|
stored.publicKey = keys.publicKey;
|
|
17
17
|
stored.privateKey = keys.privateKey;
|
|
18
18
|
writeFileSync(path, JSON.stringify(stored, null, 2), "utf-8");
|
|
19
19
|
chmodSync(path, 0o600);
|
|
20
20
|
return stored;
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
const keys = generateEd25519Keypair();
|
|
23
|
+
const identity = {
|
|
24
24
|
id: randomUUID(),
|
|
25
25
|
publicKey: keys.publicKey,
|
|
26
26
|
privateKey: keys.privateKey,
|
|
@@ -31,7 +31,7 @@ export function loadOrCreateIdentity() {
|
|
|
31
31
|
return identity;
|
|
32
32
|
}
|
|
33
33
|
function generateEd25519Keypair() {
|
|
34
|
-
|
|
34
|
+
const pair = generateKeyPairSync("ed25519", {
|
|
35
35
|
publicKeyEncoding: { type: "spki", format: "der" },
|
|
36
36
|
privateKeyEncoding: { type: "pkcs8", format: "der" },
|
|
37
37
|
});
|