@zeph-to/mcp-server 1.8.0 → 1.9.1
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/config.d.ts.map +1 -1
- package/dist/config.js +17 -1
- package/package.json +1 -1
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAuCD,eAAO,MAAM,UAAU,QAAO,eA0B7B,CAAC"}
|
package/dist/config.js
CHANGED
|
@@ -19,13 +19,29 @@ const loadFileConfig = () => {
|
|
|
19
19
|
return {};
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
|
+
/** Detect Claude Code session ID from ~/.claude/projects/{projectHash}/{sessionId}/ */
|
|
23
|
+
const detectClaudeSessionId = () => {
|
|
24
|
+
try {
|
|
25
|
+
const projectDir = process.env.CLAUDE_PROJECT_DIR ?? process.cwd();
|
|
26
|
+
const projectHash = projectDir.replace(/\//g, '-');
|
|
27
|
+
const sessionsDir = (0, path_1.join)(process.env.HOME ?? '~', '.claude', 'projects', projectHash);
|
|
28
|
+
const entries = (0, fs_1.readdirSync)(sessionsDir)
|
|
29
|
+
.filter((name) => /^[0-9a-f]{8}-/.test(name))
|
|
30
|
+
.map((name) => ({ name, mtime: (0, fs_1.statSync)((0, path_1.join)(sessionsDir, name)).mtimeMs }))
|
|
31
|
+
.sort((a, b) => b.mtime - a.mtime);
|
|
32
|
+
return entries[0]?.name;
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
22
38
|
const loadConfig = () => {
|
|
23
39
|
const fileConfig = loadFileConfig();
|
|
24
40
|
const apiKey = resolvedEnv('ZEPH_API_KEY') ?? fileConfig.apiKey;
|
|
25
41
|
if (!apiKey) {
|
|
26
42
|
throw new Error('ZEPH_API_KEY not found. Run "npx @zeph-to/hook-sdk install" or set ZEPH_API_KEY env var.');
|
|
27
43
|
}
|
|
28
|
-
const sessionId = resolvedEnv('ZEPH_SESSION_ID') ?? `sess_${(0, crypto_1.randomBytes)(12).toString('base64url')}`;
|
|
44
|
+
const sessionId = resolvedEnv('ZEPH_SESSION_ID') ?? detectClaudeSessionId() ?? `sess_${(0, crypto_1.randomBytes)(12).toString('base64url')}`;
|
|
29
45
|
// Write sessionId to tmp file so shell hooks (zeph-stop.sh) can read it
|
|
30
46
|
try {
|
|
31
47
|
const projectDir = process.env.CLAUDE_PROJECT_DIR ?? process.cwd();
|