@dhf-claude/grix 0.1.8 → 0.1.9
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/README.md +133 -86
- package/cli/prod-runner.js +163 -0
- package/cli/prod-runner.test.js +195 -0
- package/cli/runtime-targets.js +66 -0
- package/dist/daemon.js +2010 -904
- package/dist/index.js +1364 -2033
- package/hooks/hooks.json +34 -1
- package/package.json +5 -3
- package/scripts/dev-start.js +14 -0
- package/scripts/elicitation-hook.js +34 -27
- package/scripts/lifecycle-hook.js +3 -0
- package/scripts/notification-hook.js +0 -8
- package/scripts/prod-start.js +7 -0
- package/scripts/user-prompt-submit-hook.js +2 -1
- package/skills/grix/SKILL.md +121 -0
- package/skills/access/SKILL.md +0 -129
- package/skills/status/SKILL.md +0 -11
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import os from "node:os";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
|
|
4
|
+
const MANAGED_ENV_KEYS = Object.freeze([
|
|
5
|
+
"GRIX_CLAUDE_WS_URL",
|
|
6
|
+
"GRIX_CLAUDE_ENDPOINT",
|
|
7
|
+
"GRIX_CLAUDE_AGENT_ID",
|
|
8
|
+
"GRIX_CLAUDE_API_KEY",
|
|
9
|
+
"GRIX_CLAUDE_OUTBOUND_TEXT_CHUNK_LIMIT",
|
|
10
|
+
"GRIX_CLAUDE_TEXT_CHUNK_LIMIT",
|
|
11
|
+
]);
|
|
12
|
+
|
|
13
|
+
const RUNTIME_PROFILES = Object.freeze({
|
|
14
|
+
dev: Object.freeze({
|
|
15
|
+
dataDirName: "grix-claude-daemon-dev",
|
|
16
|
+
wsUrl: "ws://127.0.0.1:27189/v1/agent-api/ws?agent_id=2035251418226495488",
|
|
17
|
+
agentId: "2035251418226495488",
|
|
18
|
+
apiKey: "ak_2035251418226495488__Y-1s6Sy1dBsEJhuv_GLTI-n4PitFlYg",
|
|
19
|
+
}),
|
|
20
|
+
prod: Object.freeze({
|
|
21
|
+
dataDirName: "grix-claude-daemon",
|
|
22
|
+
wsUrl: "wss://clawpool.dhf.pub/v1/agent-api/ws?agent_id=2035513096339984384",
|
|
23
|
+
agentId: "2035513096339984384",
|
|
24
|
+
apiKey: "ak_2035513096339984384_wyIkUkt9FyEZFJGHyvWHPu7ZOXkpj0KM",
|
|
25
|
+
}),
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
function normalizeRuntimeName(name) {
|
|
29
|
+
return String(name ?? "").trim().toLowerCase();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function createManagedCommandEnv(env = process.env) {
|
|
33
|
+
const nextEnv = { ...env };
|
|
34
|
+
for (const key of MANAGED_ENV_KEYS) {
|
|
35
|
+
delete nextEnv[key];
|
|
36
|
+
}
|
|
37
|
+
return nextEnv;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function resolveRuntimeTarget(name, { homeDir = os.homedir() } = {}) {
|
|
41
|
+
const normalizedName = normalizeRuntimeName(name);
|
|
42
|
+
const profile = RUNTIME_PROFILES[normalizedName];
|
|
43
|
+
if (!profile) {
|
|
44
|
+
throw new Error(`unknown runtime target: ${name}`);
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
name: normalizedName,
|
|
48
|
+
dataDir: path.join(homeDir, ".claude", profile.dataDirName),
|
|
49
|
+
wsUrl: profile.wsUrl,
|
|
50
|
+
agentId: profile.agentId,
|
|
51
|
+
apiKey: profile.apiKey,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function buildRuntimeArgs(target) {
|
|
56
|
+
return [
|
|
57
|
+
"--data-dir",
|
|
58
|
+
target.dataDir,
|
|
59
|
+
"--ws-url",
|
|
60
|
+
target.wsUrl,
|
|
61
|
+
"--agent-id",
|
|
62
|
+
target.agentId,
|
|
63
|
+
"--api-key",
|
|
64
|
+
target.apiKey,
|
|
65
|
+
];
|
|
66
|
+
}
|