claudemesh-cli 1.34.12 → 1.34.15
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/entrypoints/cli.js +131 -95
- package/dist/entrypoints/cli.js.map +7 -7
- package/dist/entrypoints/mcp.js +43 -13
- package/dist/entrypoints/mcp.js.map +4 -4
- package/package.json +1 -1
package/dist/entrypoints/mcp.js
CHANGED
|
@@ -81,7 +81,7 @@ __export(exports_urls, {
|
|
|
81
81
|
VERSION: () => VERSION,
|
|
82
82
|
URLS: () => URLS
|
|
83
83
|
});
|
|
84
|
-
var URLS, VERSION = "1.34.
|
|
84
|
+
var URLS, VERSION = "1.34.15", env;
|
|
85
85
|
var init_urls = __esm(() => {
|
|
86
86
|
URLS = {
|
|
87
87
|
BROKER: process.env.CLAUDEMESH_BROKER_URL ?? "wss://ic.claudemesh.com/ws",
|
|
@@ -97,13 +97,40 @@ var init_urls = __esm(() => {
|
|
|
97
97
|
});
|
|
98
98
|
|
|
99
99
|
// src/constants/paths.ts
|
|
100
|
+
import { existsSync } from "node:fs";
|
|
100
101
|
import { homedir as homedir2 } from "node:os";
|
|
101
102
|
import { join as join2 } from "node:path";
|
|
102
|
-
|
|
103
|
+
function resolveConfigDir() {
|
|
104
|
+
if (_resolvedConfigDir !== null)
|
|
105
|
+
return _resolvedConfigDir;
|
|
106
|
+
const envDir = process.env.CLAUDEMESH_CONFIG_DIR;
|
|
107
|
+
if (!envDir) {
|
|
108
|
+
_resolvedConfigDir = DEFAULT_CONFIG_DIR;
|
|
109
|
+
return DEFAULT_CONFIG_DIR;
|
|
110
|
+
}
|
|
111
|
+
if (existsSync(envDir)) {
|
|
112
|
+
_resolvedConfigDir = envDir;
|
|
113
|
+
return envDir;
|
|
114
|
+
}
|
|
115
|
+
if (!_warnedStaleEnv && process.stderr.isTTY) {
|
|
116
|
+
_warnedStaleEnv = true;
|
|
117
|
+
const unsetHint = process.env.SHELL?.endsWith("fish") ? "set -e CLAUDEMESH_CONFIG_DIR CLAUDEMESH_IPC_TOKEN_FILE" : "unset CLAUDEMESH_CONFIG_DIR CLAUDEMESH_IPC_TOKEN_FILE";
|
|
118
|
+
process.stderr.write(`claudemesh: ignoring stale CLAUDEMESH_CONFIG_DIR=${envDir} (no config.json there); using ${DEFAULT_CONFIG_DIR}.
|
|
119
|
+
` + ` Hint: this is usually a leftover env from a previous \`claudemesh launch\`. Clean it with:
|
|
120
|
+
` + ` ${unsetHint}
|
|
121
|
+
`);
|
|
122
|
+
}
|
|
123
|
+
_resolvedConfigDir = DEFAULT_CONFIG_DIR;
|
|
124
|
+
return DEFAULT_CONFIG_DIR;
|
|
125
|
+
}
|
|
126
|
+
var home, DEFAULT_CONFIG_DIR, _resolvedConfigDir = null, _warnedStaleEnv = false, PATHS;
|
|
103
127
|
var init_paths2 = __esm(() => {
|
|
104
128
|
home = homedir2();
|
|
129
|
+
DEFAULT_CONFIG_DIR = join2(home, ".claudemesh");
|
|
105
130
|
PATHS = {
|
|
106
|
-
CONFIG_DIR
|
|
131
|
+
get CONFIG_DIR() {
|
|
132
|
+
return resolveConfigDir();
|
|
133
|
+
},
|
|
107
134
|
get CONFIG_FILE() {
|
|
108
135
|
return join2(this.CONFIG_DIR, "config.json");
|
|
109
136
|
},
|
|
@@ -127,9 +154,9 @@ function emptyConfig() {
|
|
|
127
154
|
}
|
|
128
155
|
|
|
129
156
|
// src/services/config/read.ts
|
|
130
|
-
import { readFileSync, existsSync } from "node:fs";
|
|
157
|
+
import { readFileSync, existsSync as existsSync2 } from "node:fs";
|
|
131
158
|
function readConfig() {
|
|
132
|
-
if (!
|
|
159
|
+
if (!existsSync2(PATHS.CONFIG_FILE))
|
|
133
160
|
return emptyConfig();
|
|
134
161
|
try {
|
|
135
162
|
const raw = readFileSync(PATHS.CONFIG_FILE, "utf-8");
|
|
@@ -2640,7 +2667,7 @@ __export(exports_token, {
|
|
|
2640
2667
|
TOKEN_FILE_ENV: () => TOKEN_FILE_ENV
|
|
2641
2668
|
});
|
|
2642
2669
|
import { randomBytes as randomBytes3 } from "node:crypto";
|
|
2643
|
-
import { existsSync as
|
|
2670
|
+
import { existsSync as existsSync3, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
2644
2671
|
function mintSessionToken(dir, fileName = "session-token") {
|
|
2645
2672
|
const token = randomBytes3(32).toString("hex");
|
|
2646
2673
|
const filePath = `${dir}/${fileName}`;
|
|
@@ -2655,7 +2682,7 @@ function readSessionTokenFromEnv(env2 = process.env) {
|
|
|
2655
2682
|
if (!path)
|
|
2656
2683
|
return null;
|
|
2657
2684
|
try {
|
|
2658
|
-
if (!
|
|
2685
|
+
if (!existsSync3(path))
|
|
2659
2686
|
return null;
|
|
2660
2687
|
const raw = readFileSync2(path, "utf8").trim();
|
|
2661
2688
|
if (/^[0-9a-f]{64}$/i.test(raw))
|
|
@@ -2681,12 +2708,12 @@ import {
|
|
|
2681
2708
|
ListResourcesRequestSchema,
|
|
2682
2709
|
ReadResourceRequestSchema
|
|
2683
2710
|
} from "@modelcontextprotocol/sdk/types.js";
|
|
2684
|
-
import { existsSync as
|
|
2711
|
+
import { existsSync as existsSync4, appendFileSync } from "node:fs";
|
|
2685
2712
|
import { request as httpRequest } from "node:http";
|
|
2686
2713
|
import { join as join3 } from "node:path";
|
|
2687
2714
|
async function daemonReady() {
|
|
2688
2715
|
for (let i = 0;i < DAEMON_BOOT_RETRIES; i++) {
|
|
2689
|
-
if (
|
|
2716
|
+
if (existsSync4(DAEMON_PATHS.SOCK_FILE))
|
|
2690
2717
|
return true;
|
|
2691
2718
|
await new Promise((r) => setTimeout(r, DAEMON_BOOT_RETRY_MS));
|
|
2692
2719
|
}
|
|
@@ -2754,17 +2781,20 @@ function daemonMarkSeen(ids, sessionToken) {
|
|
|
2754
2781
|
req.end();
|
|
2755
2782
|
});
|
|
2756
2783
|
}
|
|
2757
|
-
function subscribeEvents(onEvent) {
|
|
2784
|
+
function subscribeEvents(onEvent, opts = {}) {
|
|
2758
2785
|
let active = true;
|
|
2759
2786
|
let req = null;
|
|
2760
2787
|
const connect = () => {
|
|
2761
2788
|
if (!active)
|
|
2762
2789
|
return;
|
|
2790
|
+
const headers = { Accept: "text/event-stream" };
|
|
2791
|
+
if (opts.sessionToken)
|
|
2792
|
+
headers.Authorization = `ClaudeMesh-Session ${opts.sessionToken}`;
|
|
2763
2793
|
req = httpRequest({
|
|
2764
2794
|
socketPath: DAEMON_PATHS.SOCK_FILE,
|
|
2765
2795
|
path: "/v1/events",
|
|
2766
2796
|
method: "GET",
|
|
2767
|
-
headers
|
|
2797
|
+
headers
|
|
2768
2798
|
});
|
|
2769
2799
|
let buffer = "";
|
|
2770
2800
|
req.on("response", (res) => {
|
|
@@ -3051,7 +3081,7 @@ ${mf.allowed_tools.map((t) => ` - ${t}`).join(`
|
|
|
3051
3081
|
});
|
|
3052
3082
|
} catch {}
|
|
3053
3083
|
}
|
|
3054
|
-
});
|
|
3084
|
+
}, { sessionToken: sessionTokenForSeen });
|
|
3055
3085
|
const WELCOME_GRACE_MS = 3000;
|
|
3056
3086
|
let welcomeSent = false;
|
|
3057
3087
|
server.oninitialized = () => {
|
|
@@ -3307,4 +3337,4 @@ startMcpServer().catch((err) => {
|
|
|
3307
3337
|
process.exit(1);
|
|
3308
3338
|
});
|
|
3309
3339
|
|
|
3310
|
-
//# debugId=
|
|
3340
|
+
//# debugId=B2D6A5ABF776DBD164756E2164756E21
|