@cello-protocol/cli 0.0.315 → 0.0.316
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 +7 -0
- package/dist/cli.js +14 -4
- package/dist/daemon/main.js +15 -4
- package/dist/daemon/paths.d.ts +5 -1
- package/dist/daemon/paths.js +28 -2
- package/dist/hermes-bridge.js +5 -5
- package/dist/install-mcp.d.ts +7 -0
- package/dist/install-mcp.js +41 -5
- package/dist/ipc/client.d.ts +5 -1
- package/dist/ipc/client.js +45 -3
- package/dist/ipc/handshake.d.ts +6 -0
- package/dist/ipc/handshake.js +20 -0
- package/dist/issuer-list-sign.js +2 -1
- package/dist/screener/screener-state.d.ts +2 -0
- package/dist/screener/screener-state.js +18 -0
- package/dist/setup.js +3 -3
- package/hermes/plugin/__init__.py +86 -8
- package/hermes/plugin/__pycache__/__init__.cpython-314.pyc +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -37,6 +37,13 @@ When you call an address on another server, the conversation lives on that serve
|
|
|
37
37
|
|
|
38
38
|
To connect Claude Code, Claude Desktop and ChatGPT Desktop on this machine: `cello setup --install-mcp`. It says what it changed.
|
|
39
39
|
|
|
40
|
+
### On Windows
|
|
41
|
+
|
|
42
|
+
- Your data is in `%USERPROFILE%\.cello`. The daemon listens on a named pipe, `\\.\pipe\cello-<12 hex>-daemon`, not on a socket file. The 12 characters come from the data folder, so each `CELLO_HOME` gets its own daemon. Other accounts on the machine can't send the daemon anything. Before anything is sent, `cello`, the MCP server and the Hermes bridge each check that whatever holds the pipe knows a key only your account can read, so another account can't pose as the daemon. If one ever fails that check, you see `daemon_unverified` and nothing is sent.
|
|
43
|
+
- The daemon runs hidden, with no console window. It doesn't start again by itself after a reboot or a sign-out, so run `cello login` again then.
|
|
44
|
+
- `cello screener install` runs `npm` itself. It adds `allow-scripts=onnxruntime-node,protobufjs` to the `.npmrc` in its runtime folder, so npm 11 fetches the model's native runtime. Anything else in that file is kept.
|
|
45
|
+
- A sandbox that blocks named pipes stops everything from reaching the daemon (`EPERM`). Run `cello` outside it.
|
|
46
|
+
|
|
40
47
|
## Trust signals
|
|
41
48
|
|
|
42
49
|
A trust signal is a signed statement about your agent from an issuer. Setup collects your verified email signal, and your agent presents it to the server when it registers. The CELLO server requires one.
|
package/dist/cli.js
CHANGED
|
@@ -17,7 +17,7 @@ import { commandSigner, parseRootName, signIssuerListFile } from "./issuer-list-
|
|
|
17
17
|
import { RootKeysNotConfigured } from "./protocol/issuer-list.js";
|
|
18
18
|
import { productionRootKeys } from "./protocol/issuer-roots.js";
|
|
19
19
|
import { installModel } from "./screener/model-installer.js";
|
|
20
|
-
import { SCREENER_RUNTIME_MODULE, describeScreenerState, runtimeAvailable, screenerModelDir, screenerRuntimeDir, screenerState } from "./screener/screener-state.js";
|
|
20
|
+
import { SCREENER_RUNTIME_MODULE, describeScreenerState, mergeNpmrc, npmShell, runtimeAvailable, screenerModelDir, screenerRuntimeDir, screenerState } from "./screener/screener-state.js";
|
|
21
21
|
const DOWNLOAD_MB = 241;
|
|
22
22
|
const DISK_MB = 618;
|
|
23
23
|
// Each shell session that sets CELLO_CALLER is its own caller, so one can't read another's messages by accident.
|
|
@@ -239,7 +239,9 @@ async function startDaemon(server) {
|
|
|
239
239
|
const entry = daemonEntry();
|
|
240
240
|
mkdirSync(celloHome(), { recursive: true, mode: 0o700 });
|
|
241
241
|
const logFile = openSync(logPath(), "a", 0o600);
|
|
242
|
-
|
|
242
|
+
// On Windows a detached child gets its own console window, which would sit open for as long as the daemon runs,
|
|
243
|
+
// and closing it would kill the daemon. windowsHide keeps it out of sight; elsewhere it does nothing.
|
|
244
|
+
const child = spawn(process.execPath, server ? [entry, server] : [entry], { detached: true, windowsHide: true, stdio: ["ignore", logFile, logFile] });
|
|
243
245
|
closeSync(logFile);
|
|
244
246
|
const client = await waitForDaemon(child);
|
|
245
247
|
child.unref();
|
|
@@ -439,8 +441,16 @@ async function screenerCommand(args) {
|
|
|
439
441
|
process.stdout.write(`Installing the runtime into ${screenerRuntimeDir()}\n`);
|
|
440
442
|
mkdirSync(screenerRuntimeDir(), { recursive: true });
|
|
441
443
|
// Its own folder, because Node's ESM resolver doesn't look in npm's global root. The native model runtime needs its install script.
|
|
442
|
-
|
|
443
|
-
const
|
|
444
|
+
const npmrc = join(screenerRuntimeDir(), ".npmrc");
|
|
445
|
+
const existing = existsSync(npmrc) ? readFileSync(npmrc, "utf8") : "";
|
|
446
|
+
const merged = mergeNpmrc(existing);
|
|
447
|
+
if (merged !== existing)
|
|
448
|
+
writeFileSync(npmrc, merged);
|
|
449
|
+
const npmArgs = ["install", "--no-audit", "--no-fund", SCREENER_RUNTIME_MODULE];
|
|
450
|
+
// Through a shell it's one finished line: an args array with shell: true is deprecated in Node 24. The words are fixed, with no spaces.
|
|
451
|
+
const npm = npmShell()
|
|
452
|
+
? spawnSync(["npm", ...npmArgs].join(" "), { stdio: "inherit", cwd: screenerRuntimeDir(), shell: true })
|
|
453
|
+
: spawnSync("npm", npmArgs, { stdio: "inherit", cwd: screenerRuntimeDir() });
|
|
444
454
|
if (npm.status !== 0)
|
|
445
455
|
fail(`${JSON.stringify({ error: "runtime_install_failed", message: `npm install failed with status ${npm.status ?? "none"}, so the model can't run. Try again.` })}\n`, EXIT_REFUSED);
|
|
446
456
|
}
|
package/dist/daemon/main.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// The daemon: the local socket opens first, so a client never sees "failed" while it's coming up.
|
|
2
2
|
import { randomBytes, randomUUID } from "node:crypto";
|
|
3
|
-
import { existsSync, mkdirSync, unlinkSync } from "node:fs";
|
|
3
|
+
import { existsSync, mkdirSync, unlinkSync, writeFileSync } from "node:fs";
|
|
4
|
+
import { HELLO_METHOD, daemonProof, ipcHandshakeRequired, newIpcKey } from "../ipc/handshake.js";
|
|
4
5
|
import { createServer, createConnection } from "node:net";
|
|
5
6
|
import { monitorEventLoopDelay } from "node:perf_hooks";
|
|
6
7
|
import { createInterface } from "node:readline";
|
|
@@ -10,7 +11,7 @@ import { serveAccountPage } from "./account-page.js";
|
|
|
10
11
|
import { Channels } from "./channels.js";
|
|
11
12
|
import { logEvent } from "./log.js";
|
|
12
13
|
import { currentSetting } from "./settings.js";
|
|
13
|
-
import { celloHome, databasePath, holdsOldVersion, oldVersionMessage, socketPath } from "./paths.js";
|
|
14
|
+
import { celloHome, databasePath, endpointIsFile, holdsOldVersion, ipcKeyPath, oldVersionMessage, socketPath } from "./paths.js";
|
|
14
15
|
import { Store } from "./store.js";
|
|
15
16
|
const home = celloHome();
|
|
16
17
|
if (holdsOldVersion(home)) {
|
|
@@ -19,9 +20,10 @@ if (holdsOldVersion(home)) {
|
|
|
19
20
|
}
|
|
20
21
|
mkdirSync(home, { recursive: true, mode: 0o700 });
|
|
21
22
|
const path = socketPath(home);
|
|
23
|
+
const ipcKey = ipcHandshakeRequired() ? newIpcKey() : undefined;
|
|
22
24
|
// One daemon per home. A socket file nobody answers on is left over from a crash.
|
|
23
25
|
async function clearStaleSocket() {
|
|
24
|
-
if (!existsSync(path))
|
|
26
|
+
if (endpointIsFile() && !existsSync(path))
|
|
25
27
|
return;
|
|
26
28
|
const answered = await new Promise((resolve) => {
|
|
27
29
|
const probe = createConnection(path);
|
|
@@ -30,7 +32,8 @@ async function clearStaleSocket() {
|
|
|
30
32
|
});
|
|
31
33
|
if (answered)
|
|
32
34
|
throw new Error(`a daemon is already running on ${path}`);
|
|
33
|
-
|
|
35
|
+
if (endpointIsFile())
|
|
36
|
+
unlinkSync(path);
|
|
34
37
|
}
|
|
35
38
|
await clearStaleSocket();
|
|
36
39
|
const store = new Store(databasePath(home));
|
|
@@ -263,6 +266,11 @@ async function handle(socket, method, params) {
|
|
|
263
266
|
if (method.startsWith("channel_") && typeof params["agent"] === "string")
|
|
264
267
|
engine.assertCanAct(engine.resolveAgent(params["agent"]));
|
|
265
268
|
switch (method) {
|
|
269
|
+
case HELLO_METHOD: {
|
|
270
|
+
if (!ipcKey)
|
|
271
|
+
throw new LocalError("not_supported", "this daemon doesn't prove itself on this platform");
|
|
272
|
+
return { proof: daemonProof(ipcKey, text(params, "nonce")) };
|
|
273
|
+
}
|
|
266
274
|
case "status": {
|
|
267
275
|
// A fact about this thread, measured here. It's the longest it has been held up since the last time anyone asked.
|
|
268
276
|
const longestStallMs = Math.max(0, Math.round(mainThreadDelay.max / 1e6 - STALL_RESOLUTION_MS));
|
|
@@ -553,6 +561,9 @@ const ipc = createServer((socket) => {
|
|
|
553
561
|
});
|
|
554
562
|
socket.on("error", () => undefined);
|
|
555
563
|
});
|
|
564
|
+
// Written before the pipe opens, so a client that reaches this daemon can always read the key it proves itself with.
|
|
565
|
+
if (ipcKey)
|
|
566
|
+
writeFileSync(ipcKeyPath(home), `${ipcKey}\n`, { mode: 0o600 });
|
|
556
567
|
await new Promise((resolve) => ipc.listen({ path, readableAll: false, writableAll: false }, resolve));
|
|
557
568
|
logEvent("daemon.listening", { pid: process.pid, server: serverUrl });
|
|
558
569
|
await engine.start();
|
package/dist/daemon/paths.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
export declare function celloHome(): string;
|
|
2
|
-
export declare function socketPath(home?: string): string;
|
|
2
|
+
export declare function socketPath(home?: string, platform?: NodeJS.Platform): string;
|
|
3
|
+
export declare function windowsPipe(home: string, name: "daemon" | "gateway"): string;
|
|
4
|
+
export declare function oldVersionEndpoints(home?: string, platform?: NodeJS.Platform): string[];
|
|
5
|
+
export declare const endpointIsFile: (platform?: NodeJS.Platform) => boolean;
|
|
6
|
+
export declare function ipcKeyPath(home?: string): string;
|
|
3
7
|
export declare function databasePath(home?: string): string;
|
|
4
8
|
export declare function logPath(home?: string): string;
|
|
5
9
|
export declare function holdsOldVersion(home?: string): boolean;
|
package/dist/daemon/paths.js
CHANGED
|
@@ -1,12 +1,38 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
1
2
|
import { existsSync } from "node:fs";
|
|
2
3
|
import { homedir } from "node:os";
|
|
3
|
-
import { join } from "node:path";
|
|
4
|
+
import { join, win32 } from "node:path";
|
|
4
5
|
export function celloHome() {
|
|
5
6
|
return process.env["CELLO_HOME"] ?? join(homedir(), ".cello");
|
|
6
7
|
}
|
|
7
|
-
|
|
8
|
+
// Windows refuses a Unix socket in the home folder (listen EACCES at any path length, admin or not), so there the
|
|
9
|
+
// daemon listens on a named pipe. The pipe's name comes from the home folder, so two homes get two daemons.
|
|
10
|
+
// A pipe made by Node takes the default DACL: full control for its user, SYSTEM and Administrators, and READ for
|
|
11
|
+
// Everyone and Anonymous. A reader can't send a request, so other accounts can't act, but the name is predictable and
|
|
12
|
+
// another account could create it first. The client checks the daemon's proof before trusting it (src/ipc/handshake.ts).
|
|
13
|
+
export function socketPath(home = celloHome(), platform = process.platform) {
|
|
14
|
+
if (platform === "win32")
|
|
15
|
+
return windowsPipe(home, "daemon");
|
|
8
16
|
return join(home, "daemon.sock");
|
|
9
17
|
}
|
|
18
|
+
// The old version used the same naming, with a second pipe for its gateway. Setup probes both to see if it's running.
|
|
19
|
+
export function windowsPipe(home, name) {
|
|
20
|
+
const canonical = win32.resolve(home).toLowerCase().replace(/\//g, "\\");
|
|
21
|
+
const hash = createHash("sha256").update(canonical).digest("hex").slice(0, 12);
|
|
22
|
+
return `\\\\.\\pipe\\cello-${hash}-${name}`;
|
|
23
|
+
}
|
|
24
|
+
// Where the old version listened: a socket file on macOS and Linux, a named pipe on Windows.
|
|
25
|
+
export function oldVersionEndpoints(home = celloHome(), platform = process.platform) {
|
|
26
|
+
if (platform === "win32")
|
|
27
|
+
return [windowsPipe(home, "daemon"), windowsPipe(home, "gateway")];
|
|
28
|
+
return [join(home, "daemon.sock"), join(home, "gateway.sock")];
|
|
29
|
+
}
|
|
30
|
+
// A named pipe vanishes with the process that made it. Only a socket file can be left behind by a crash.
|
|
31
|
+
export const endpointIsFile = (platform = process.platform) => platform !== "win32";
|
|
32
|
+
// The key the daemon proves itself with on Windows (src/ipc/handshake.ts). A fresh one at every start.
|
|
33
|
+
export function ipcKeyPath(home = celloHome()) {
|
|
34
|
+
return join(home, "daemon.ipc-key");
|
|
35
|
+
}
|
|
10
36
|
export function databasePath(home = celloHome()) {
|
|
11
37
|
return join(home, "cello.db");
|
|
12
38
|
}
|
package/dist/hermes-bridge.js
CHANGED
|
@@ -33,7 +33,7 @@ const mcpEntry = () => fileURLToPath(new URL(`./mcp${extname(fileURLToPath(impor
|
|
|
33
33
|
const daemonEntry = () => fileURLToPath(new URL(`./daemon/main${extname(fileURLToPath(import.meta.url))}`, import.meta.url));
|
|
34
34
|
function withEnv(existing, set, drop) {
|
|
35
35
|
const keyOf = (line) => line.split("=", 1)[0];
|
|
36
|
-
const lines = existing.split(
|
|
36
|
+
const lines = existing.split(/\r?\n/).filter((line) => !drop.includes(keyOf(line)));
|
|
37
37
|
while (lines.at(-1) === "")
|
|
38
38
|
lines.pop();
|
|
39
39
|
for (const [key, value] of Object.entries(set)) {
|
|
@@ -70,11 +70,11 @@ export function setLanding(options) {
|
|
|
70
70
|
const envPath = join(hermesHome, ".env");
|
|
71
71
|
if (!existsSync(envPath))
|
|
72
72
|
return { ok: false, output: `There's no bridge in ${hermesHome} yet. A person sets it up first with cello bridge hermes.` };
|
|
73
|
-
const bridged = readFileSync(envPath, "utf8").split(
|
|
73
|
+
const bridged = readFileSync(envPath, "utf8").split(/\r?\n/).find((line) => line.startsWith("CELLO_AGENT_NAME="))?.slice("CELLO_AGENT_NAME=".length);
|
|
74
74
|
// An agent moves its own notifications, never another profile's.
|
|
75
75
|
if (bridged !== options.agent.trim())
|
|
76
76
|
return { ok: false, output: `${hermesHome} is bridged to ${bridged ?? "no agent"}, not ${options.agent}. Nothing changed.` };
|
|
77
|
-
if (readFileSync(envPath, "utf8").split(
|
|
77
|
+
if (readFileSync(envPath, "utf8").split(/\r?\n/).includes("CELLO_SESSION_SCOPE=peer"))
|
|
78
78
|
return { ok: false, output: "This agent gives each caller their own session, so there's no one landing session to move. Nothing changed." };
|
|
79
79
|
const { landing, error } = resolveLanding(options.landingSession);
|
|
80
80
|
if (error)
|
|
@@ -96,11 +96,11 @@ export async function installBridge(options) {
|
|
|
96
96
|
const envPath = join(hermesHome, ".env");
|
|
97
97
|
const hermesEnv = existsSync(envPath) ? readFileSync(envPath, "utf8") : "";
|
|
98
98
|
// This has to be re-run after every upgrade, and forgetting a flag then mustn't open a public agent to strangers. Only --not-public ends it.
|
|
99
|
-
const wasPublic = hermesEnv.split(
|
|
99
|
+
const wasPublic = hermesEnv.split(/\r?\n/).includes("CELLO_PUBLIC=1");
|
|
100
100
|
if (options.public && options.notPublic)
|
|
101
101
|
return refuse("--public and --not-public can't go together.");
|
|
102
102
|
const isPublic = options.public || (wasPublic && !options.notPublic);
|
|
103
|
-
const allowInitiate = options.allowInitiate || (isPublic && !options.notPublic && hermesEnv.split(
|
|
103
|
+
const allowInitiate = options.allowInitiate || (isPublic && !options.notPublic && hermesEnv.split(/\r?\n/).includes("CELLO_ALLOW_INITIATE=1"));
|
|
104
104
|
const scope = options.sessionScope ?? (isPublic ? "peer" : "agent");
|
|
105
105
|
if (!SESSION_SCOPES.includes(scope))
|
|
106
106
|
return refuse(`--session-scope must be one of ${SESSION_SCOPES.join(", ")}, not '${scope}'.`);
|
package/dist/install-mcp.d.ts
CHANGED
|
@@ -3,4 +3,11 @@ export interface McpInstallLine {
|
|
|
3
3
|
outcome: "installed" | "unchanged" | "not_found" | "failed";
|
|
4
4
|
detail: string;
|
|
5
5
|
}
|
|
6
|
+
export declare function claudeDesktopFolder(home: string, platform?: NodeJS.Platform, env?: NodeJS.ProcessEnv): string;
|
|
7
|
+
export declare function windowsCommandLine(command: string, args: string[]): {
|
|
8
|
+
file: string;
|
|
9
|
+
args: string[];
|
|
10
|
+
shell: boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare function pickWindowsClaude(whereOutput: string): string;
|
|
6
13
|
export declare function installMcp(home?: string): McpInstallLine[];
|
package/dist/install-mcp.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// cello setup --install-mcp: connects the apps on this machine, and says exactly what it changed. Nothing here leaves the machine.
|
|
2
2
|
import { spawnSync } from "node:child_process";
|
|
3
|
-
import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { existsSync, mkdirSync, readFileSync, readdirSync, renameSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { homedir } from "node:os";
|
|
5
|
-
import { dirname, extname, join } from "node:path";
|
|
5
|
+
import { dirname, extname, join, win32 } from "node:path";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
7
|
const CLAUDE_WAIT_MS = 120_000;
|
|
8
8
|
function writeAtomically(path, text) {
|
|
@@ -10,13 +10,49 @@ function writeAtomically(path, text) {
|
|
|
10
10
|
writeFileSync(`${path}.cello-tmp`, text, { mode: 0o600 });
|
|
11
11
|
renameSync(`${path}.cello-tmp`, path);
|
|
12
12
|
}
|
|
13
|
+
// Claude Desktop keeps its config in Application Support on a Mac, under %APPDATA% on Windows, and in ~/.config on Linux.
|
|
14
|
+
// The Microsoft Store (MSIX) install on Windows redirects %APPDATA% into its package folder, so that one wins if present.
|
|
15
|
+
export function claudeDesktopFolder(home, platform = process.platform, env = process.env) {
|
|
16
|
+
if (platform === "darwin")
|
|
17
|
+
return join(home, "Library", "Application Support", "Claude");
|
|
18
|
+
if (platform === "win32") {
|
|
19
|
+
const localAppData = env["LOCALAPPDATA"] ?? win32.join(home, "AppData", "Local");
|
|
20
|
+
const packages = win32.join(localAppData, "Packages");
|
|
21
|
+
const store = existsSync(packages) ? readdirSync(packages).find((name) => /^Claude_/i.test(name)) : undefined;
|
|
22
|
+
const storeConfig = store ? win32.join(packages, store, "LocalCache", "Roaming", "Claude") : undefined;
|
|
23
|
+
if (storeConfig && existsSync(storeConfig))
|
|
24
|
+
return storeConfig;
|
|
25
|
+
return win32.join(env["APPDATA"] ?? win32.join(home, "AppData", "Roaming"), "Claude");
|
|
26
|
+
}
|
|
27
|
+
return join(home, ".config", "Claude");
|
|
28
|
+
}
|
|
29
|
+
// Windows has no sh, so the claude command is found with where. An npm install there is claude.cmd, which Node
|
|
30
|
+
// runs only through a shell. The shell gets one finished line (an args array with shell: true is deprecated in
|
|
31
|
+
// Node 24), with each part quoted, because it splits on spaces and a user folder often has one.
|
|
32
|
+
export function windowsCommandLine(command, args) {
|
|
33
|
+
if (/\.exe$/i.test(command))
|
|
34
|
+
return { file: command, args, shell: false };
|
|
35
|
+
const quote = (s) => `"${s.replace(/"/g, '""')}"`;
|
|
36
|
+
return { file: [command, ...args].map(quote).join(" "), args: [], shell: true };
|
|
37
|
+
}
|
|
38
|
+
// where lists every match on PATH. An npm install puts an extensionless sh script first, which cmd can't run itself.
|
|
39
|
+
export function pickWindowsClaude(whereOutput) {
|
|
40
|
+
const found = whereOutput.split(/\r?\n/).map((line) => line.trim()).filter(Boolean);
|
|
41
|
+
return found.find((p) => /\.exe$/i.test(p)) ?? found.find((p) => /\.(cmd|bat)$/i.test(p)) ?? "";
|
|
42
|
+
}
|
|
43
|
+
function findClaude() {
|
|
44
|
+
if (process.platform === "win32")
|
|
45
|
+
return pickWindowsClaude(spawnSync("where", ["claude"], { encoding: "utf8" }).stdout ?? "");
|
|
46
|
+
return (spawnSync("sh", ["-c", "command -v claude"], { encoding: "utf8" }).stdout ?? "").trim();
|
|
47
|
+
}
|
|
13
48
|
function claudeCode(packageRoot) {
|
|
14
49
|
const app = "Claude Code";
|
|
15
|
-
const onPath =
|
|
50
|
+
const onPath = findClaude();
|
|
16
51
|
if (!onPath)
|
|
17
52
|
return { app, outcome: "not_found", detail: "no claude command on this PATH" };
|
|
18
53
|
const claude = (args) => {
|
|
19
|
-
const
|
|
54
|
+
const line = process.platform === "win32" ? windowsCommandLine(onPath, args) : { file: onPath, args, shell: false };
|
|
55
|
+
const run = spawnSync(line.file, line.args, { encoding: "utf8", timeout: CLAUDE_WAIT_MS, shell: line.shell });
|
|
20
56
|
return { ok: run.status === 0, said: `${run.stdout ?? ""}${run.stderr ?? ""}`.trim() };
|
|
21
57
|
};
|
|
22
58
|
const listed = claude(["plugin", "list"]);
|
|
@@ -32,7 +68,7 @@ function claudeCode(packageRoot) {
|
|
|
32
68
|
}
|
|
33
69
|
function claudeDesktop(home, command, args) {
|
|
34
70
|
const app = "Claude Desktop";
|
|
35
|
-
const folder =
|
|
71
|
+
const folder = claudeDesktopFolder(home);
|
|
36
72
|
if (!existsSync(folder))
|
|
37
73
|
return { app, outcome: "not_found", detail: `no ${folder}` };
|
|
38
74
|
const path = join(folder, "claude_desktop_config.json");
|
package/dist/ipc/client.d.ts
CHANGED
|
@@ -7,12 +7,16 @@ export declare class DaemonGone extends Error {
|
|
|
7
7
|
readonly code = "daemon_not_running";
|
|
8
8
|
constructor();
|
|
9
9
|
}
|
|
10
|
+
export declare function connectFailure(path: string, err: NodeJS.ErrnoException): Error;
|
|
10
11
|
export declare class IpcClient {
|
|
11
12
|
#private;
|
|
12
13
|
onNotification: (frame: IpcNotification) => void;
|
|
13
14
|
onClose: () => void;
|
|
14
15
|
private constructor();
|
|
15
|
-
static connect(path: string
|
|
16
|
+
static connect(path: string, options?: {
|
|
17
|
+
verify?: boolean;
|
|
18
|
+
keyFile?: string;
|
|
19
|
+
}): Promise<IpcClient>;
|
|
16
20
|
call(method: string, params?: Record<string, unknown>, timeoutMs?: number): Promise<unknown>;
|
|
17
21
|
close(): void;
|
|
18
22
|
}
|
package/dist/ipc/client.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
1
2
|
import { createConnection } from "node:net";
|
|
3
|
+
import { ipcKeyPath } from "../daemon/paths.js";
|
|
4
|
+
import { HELLO_METHOD, ipcHandshakeRequired, newNonce, proofHolds } from "./handshake.js";
|
|
2
5
|
import { createInterface } from "node:readline";
|
|
3
6
|
export class DaemonRefused extends Error {
|
|
4
7
|
code;
|
|
@@ -15,8 +18,20 @@ export class DaemonGone extends Error {
|
|
|
15
18
|
this.name = "DaemonGone";
|
|
16
19
|
}
|
|
17
20
|
}
|
|
21
|
+
// Only nothing listening means the daemon isn't running. Anything else (a sandbox blocking the pipe or socket, a busy
|
|
22
|
+
// pipe, a permission problem) is said as itself, or the person is sent to log in again, which hits the same wall.
|
|
23
|
+
const NOT_RUNNING = new Set(["ENOENT", "ECONNREFUSED"]);
|
|
24
|
+
export function connectFailure(path, err) {
|
|
25
|
+
if (!err.code || NOT_RUNNING.has(err.code))
|
|
26
|
+
return new DaemonGone();
|
|
27
|
+
const hint = err.code === "EPERM" || err.code === "EACCES"
|
|
28
|
+
? " This process isn't allowed to open it, which a sandbox can cause. Run cello outside the sandbox."
|
|
29
|
+
: " Try again in a moment.";
|
|
30
|
+
return new DaemonRefused("daemon_unreachable", `the daemon at ${path} couldn't be reached (${err.code}).${hint}`);
|
|
31
|
+
}
|
|
18
32
|
// A wedged daemon mustn't hang a tool forever. It outlasts every wait the daemon has of its own.
|
|
19
33
|
const CALL_TIMEOUT_MS = 90_000;
|
|
34
|
+
const HELLO_TIMEOUT_MS = 10_000;
|
|
20
35
|
// The daemon may have saved a call before it stopped, so what a caller should do next depends on the call.
|
|
21
36
|
function afterCutOff(method) {
|
|
22
37
|
switch (method) {
|
|
@@ -71,15 +86,42 @@ export class IpcClient {
|
|
|
71
86
|
});
|
|
72
87
|
socket.on("error", () => undefined);
|
|
73
88
|
}
|
|
74
|
-
static connect(path) {
|
|
75
|
-
|
|
89
|
+
static async connect(path, options = {}) {
|
|
90
|
+
const client = await new Promise((resolve, reject) => {
|
|
76
91
|
const socket = createConnection(path);
|
|
77
92
|
socket.once("connect", () => {
|
|
78
93
|
socket.removeAllListeners("error");
|
|
79
94
|
resolve(new IpcClient(socket));
|
|
80
95
|
});
|
|
81
|
-
socket.once("error", () => reject(
|
|
96
|
+
socket.once("error", (err) => reject(connectFailure(path, err)));
|
|
82
97
|
});
|
|
98
|
+
if (options.verify ?? ipcHandshakeRequired())
|
|
99
|
+
await client.#verifyDaemon(path, options.keyFile ?? ipcKeyPath());
|
|
100
|
+
return client;
|
|
101
|
+
}
|
|
102
|
+
// Nothing is sent until whoever answers proves it holds this user's key. See handshake.ts for why.
|
|
103
|
+
async #verifyDaemon(path, keyFile) {
|
|
104
|
+
const impostor = (why) => {
|
|
105
|
+
this.close();
|
|
106
|
+
return new DaemonRefused("daemon_unverified", `Something is listening at ${path}, but it ${why}, so nothing was sent to it. If the daemon was just upgraded, run cello logout and cello login. If that doesn't fix it, another account on this machine may be posing as the daemon: restart the machine, then run cello login.`);
|
|
107
|
+
};
|
|
108
|
+
let key;
|
|
109
|
+
try {
|
|
110
|
+
key = readFileSync(keyFile, "utf8").trim();
|
|
111
|
+
}
|
|
112
|
+
catch {
|
|
113
|
+
throw impostor(`left no key at ${keyFile}`);
|
|
114
|
+
}
|
|
115
|
+
const nonce = newNonce();
|
|
116
|
+
let answer;
|
|
117
|
+
try {
|
|
118
|
+
answer = await this.call(HELLO_METHOD, { nonce }, HELLO_TIMEOUT_MS);
|
|
119
|
+
}
|
|
120
|
+
catch {
|
|
121
|
+
throw impostor("didn't answer the check");
|
|
122
|
+
}
|
|
123
|
+
if (!proofHolds(key, nonce, answer?.proof))
|
|
124
|
+
throw impostor("failed the check");
|
|
83
125
|
}
|
|
84
126
|
call(method, params = {}, timeoutMs = CALL_TIMEOUT_MS) {
|
|
85
127
|
const id = this.#nextId++;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const HELLO_METHOD = "hello";
|
|
2
|
+
export declare const ipcHandshakeRequired: (platform?: NodeJS.Platform) => boolean;
|
|
3
|
+
export declare const newIpcKey: () => string;
|
|
4
|
+
export declare const newNonce: () => string;
|
|
5
|
+
export declare function daemonProof(keyHex: string, nonceHex: string): string;
|
|
6
|
+
export declare function proofHolds(keyHex: string, nonceHex: string, proof: unknown): boolean;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// On Windows the daemon's pipe has a predictable name and lives in a namespace every local user shares, so another
|
|
2
|
+
// account can create it first and pose as the daemon: the real one then can't start, and every request goes to the
|
|
3
|
+
// impostor. A socket file can't be taken that way, because it sits in a folder only its owner can open.
|
|
4
|
+
//
|
|
5
|
+
// So on Windows a client makes the daemon prove itself before it sends anything. At each start the daemon writes a
|
|
6
|
+
// fresh random key to a file in the CELLO home, which only this user can read. The client sends a nonce, and the daemon
|
|
7
|
+
// answers with an HMAC of it under that key. The nonce is fresh each time, so an answer seen once can't be replayed.
|
|
8
|
+
import { createHmac, randomBytes, timingSafeEqual } from "node:crypto";
|
|
9
|
+
export const HELLO_METHOD = "hello";
|
|
10
|
+
export const ipcHandshakeRequired = (platform = process.platform) => platform === "win32";
|
|
11
|
+
export const newIpcKey = () => randomBytes(32).toString("hex");
|
|
12
|
+
export const newNonce = () => randomBytes(32).toString("hex");
|
|
13
|
+
export function daemonProof(keyHex, nonceHex) {
|
|
14
|
+
return createHmac("sha256", Buffer.from(keyHex, "hex")).update("cello-daemon-ipc-v1\0").update(Buffer.from(nonceHex, "hex")).digest("hex");
|
|
15
|
+
}
|
|
16
|
+
export function proofHolds(keyHex, nonceHex, proof) {
|
|
17
|
+
if (typeof proof !== "string" || !/^[0-9a-f]{64}$/.test(proof))
|
|
18
|
+
return false;
|
|
19
|
+
return timingSafeEqual(Buffer.from(daemonProof(keyHex, nonceHex), "hex"), Buffer.from(proof, "hex"));
|
|
20
|
+
}
|
package/dist/issuer-list-sign.js
CHANGED
|
@@ -24,7 +24,8 @@ export function commandSigner(root, command) {
|
|
|
24
24
|
return {
|
|
25
25
|
root,
|
|
26
26
|
sign: async (message) => {
|
|
27
|
-
|
|
27
|
+
// shell: true is /bin/sh -c elsewhere and cmd.exe on Windows, which has no /bin/sh.
|
|
28
|
+
const run = spawnSync(command, { shell: true, input: message, timeout: SIGNER_WAIT_MS, encoding: "buffer", stdio: ["pipe", "pipe", "inherit"] });
|
|
28
29
|
if (run.status !== 0)
|
|
29
30
|
throw new Error(`the signer command failed with status ${run.status ?? "none"}${run.error ? `: ${run.error.message}` : ""}`);
|
|
30
31
|
return hexBytes("the signer command's output", run.stdout.toString("utf8").trim());
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export declare function screenerModelDir(): string;
|
|
2
2
|
export declare const SCREENER_RUNTIME_MODULE = "@huggingface/transformers";
|
|
3
3
|
export declare function screenerRuntimeDir(): string;
|
|
4
|
+
export declare function mergeNpmrc(existing: string): string;
|
|
5
|
+
export declare const npmShell: (platform?: NodeJS.Platform) => boolean;
|
|
4
6
|
export declare function resolveScreenerRuntime(): string | null;
|
|
5
7
|
export declare function runtimeAvailable(importImpl?: (s: string) => Promise<unknown>): Promise<boolean>;
|
|
6
8
|
export type ScreenerStateName = "not_installed" | "half_installed" | "broken" | "ready";
|
|
@@ -20,6 +20,24 @@ export const SCREENER_RUNTIME_MODULE = "@huggingface/transformers";
|
|
|
20
20
|
export function screenerRuntimeDir() {
|
|
21
21
|
return join(celloHome(), "screener-runtime");
|
|
22
22
|
}
|
|
23
|
+
// npm 11 skips install scripts it hasn't been told to allow, and without onnxruntime-node's the native runtime
|
|
24
|
+
// is never fetched. The setting is added to whatever .npmrc is there, never written over it.
|
|
25
|
+
const NEEDS_SCRIPTS = ["onnxruntime-node", "protobufjs"];
|
|
26
|
+
export function mergeNpmrc(existing) {
|
|
27
|
+
const lines = existing.split(/\r?\n/);
|
|
28
|
+
const at = lines.findIndex((line) => /^\s*allow-scripts\s*=/.test(line));
|
|
29
|
+
if (at === -1)
|
|
30
|
+
return `${existing}${existing === "" || existing.endsWith("\n") ? "" : "\n"}allow-scripts=${NEEDS_SCRIPTS.join(",")}\n`;
|
|
31
|
+
const have = lines[at].split("=").slice(1).join("=").split(",").map((s) => s.trim()).filter(Boolean);
|
|
32
|
+
const missing = NEEDS_SCRIPTS.filter((name) => !have.includes(name));
|
|
33
|
+
if (missing.length === 0)
|
|
34
|
+
return existing;
|
|
35
|
+
lines[at] = `allow-scripts=${[...have, ...missing].join(",")}`;
|
|
36
|
+
return lines.join(existing.includes("\r\n") ? "\r\n" : "\n");
|
|
37
|
+
}
|
|
38
|
+
// On Windows npm is npm.cmd, which Node can't spawn by name (ENOENT) or directly (EINVAL). Only a shell runs it.
|
|
39
|
+
// The arguments are fixed words with no spaces, so the shell has nothing to misread.
|
|
40
|
+
export const npmShell = (platform = process.platform) => platform === "win32";
|
|
23
41
|
export function resolveScreenerRuntime() {
|
|
24
42
|
try {
|
|
25
43
|
const require = createRequire(join(screenerRuntimeDir(), "resolver.cjs"));
|
package/dist/setup.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
// `cello setup`: from nothing to an agent with its verified email, on a server, with a reply on screen.
|
|
2
2
|
// Each step says what it did, and each failure says what to do next, with JSON behind a flag.
|
|
3
3
|
import { existsSync, renameSync } from "node:fs";
|
|
4
|
-
import { join } from "node:path";
|
|
5
4
|
import { createConnection } from "node:net";
|
|
6
|
-
import { celloHome, databasePath, holdsOldVersion, oldVersionMessage, socketPath } from "./daemon/paths.js";
|
|
5
|
+
import { celloHome, databasePath, holdsOldVersion, oldVersionEndpoints, oldVersionMessage, socketPath } from "./daemon/paths.js";
|
|
7
6
|
import { DEFAULT_SERVER_URL } from "./daemon/settings.js";
|
|
8
7
|
import { HOW_TO_GET_A_CODE } from "./daemon/wallet.js";
|
|
9
8
|
import { installMcp } from "./install-mcp.js";
|
|
@@ -86,7 +85,8 @@ async function moveOldVersion(host, say) {
|
|
|
86
85
|
const target = `${home}-old`;
|
|
87
86
|
if (!process.stdin.isTTY || !process.stdout.isTTY)
|
|
88
87
|
throw new SetupFailed("old_version_data", oldVersionMessage(home));
|
|
89
|
-
|
|
88
|
+
const [oldDaemon, oldGateway] = oldVersionEndpoints(home);
|
|
89
|
+
if (await answers(oldDaemon) || await answers(oldGateway))
|
|
90
90
|
throw new SetupFailed("old_version_running", `The old version of CELLO is still running from ${home}. Stop it, or restart this machine, then run the same command again. Nothing changed.`);
|
|
91
91
|
if (existsSync(target))
|
|
92
92
|
throw new SetupFailed("old_version_data", `${home} holds data from the old version, and ${target} already exists, so it can't be moved there. Move one of them yourself, then run the same command again. Nothing changed.`);
|
|
@@ -15,8 +15,11 @@ from __future__ import annotations
|
|
|
15
15
|
|
|
16
16
|
import asyncio
|
|
17
17
|
import atexit
|
|
18
|
+
import hashlib
|
|
19
|
+
import hmac
|
|
18
20
|
import json
|
|
19
21
|
import logging
|
|
22
|
+
import ntpath
|
|
20
23
|
import os
|
|
21
24
|
import re
|
|
22
25
|
import socketserver
|
|
@@ -29,8 +32,12 @@ from typing import Any, Callable, Dict, List, Optional
|
|
|
29
32
|
|
|
30
33
|
try:
|
|
31
34
|
import fcntl
|
|
32
|
-
except ImportError: # Windows,
|
|
35
|
+
except ImportError: # Windows, which locks with msvcrt instead.
|
|
33
36
|
fcntl = None
|
|
37
|
+
try:
|
|
38
|
+
import msvcrt
|
|
39
|
+
except ImportError:
|
|
40
|
+
msvcrt = None
|
|
34
41
|
|
|
35
42
|
from gateway.config import Platform, PlatformConfig
|
|
36
43
|
from gateway.platforms.base import (
|
|
@@ -139,10 +146,37 @@ def _hermes_home() -> Path:
|
|
|
139
146
|
return Path.home() / ".hermes"
|
|
140
147
|
|
|
141
148
|
|
|
142
|
-
def
|
|
149
|
+
def _cello_home(explicit_home: Optional[Any] = None) -> str:
|
|
143
150
|
raw = str(explicit_home).strip() if explicit_home is not None else ""
|
|
144
|
-
|
|
145
|
-
|
|
151
|
+
return raw or _get_cello_env("CELLO_HOME") or str(Path.home() / ".cello")
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
def _ipc_key_path(explicit_home: Optional[Any] = None) -> str:
|
|
155
|
+
"""The key the daemon proves itself with on Windows (src/daemon/paths.ts ipcKeyPath)."""
|
|
156
|
+
return str(Path(_cello_home(explicit_home)) / "daemon.ipc-key")
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
def _socket_path(explicit_home: Optional[Any] = None, platform: Optional[str] = None) -> str:
|
|
160
|
+
"""Where the daemon listens. Named exactly as the daemon names it (src/daemon/paths.ts socketPath)."""
|
|
161
|
+
home = _cello_home(explicit_home)
|
|
162
|
+
if (platform or sys.platform) == "win32":
|
|
163
|
+
# Windows refuses a Unix socket in the home folder, so the daemon listens on a named pipe named from it.
|
|
164
|
+
canonical = ntpath.abspath(home).lower().replace("/", "\\")
|
|
165
|
+
return "\\\\.\\pipe\\cello-" + hashlib.sha256(canonical.encode("utf-8")).hexdigest()[:12] + "-daemon"
|
|
166
|
+
return str(Path(home) / "daemon.sock")
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
async def _open_daemon(endpoint: str):
|
|
170
|
+
"""A line stream to the daemon: a Unix socket, or on Windows a named pipe through the proactor loop."""
|
|
171
|
+
if sys.platform != "win32":
|
|
172
|
+
return await asyncio.open_unix_connection(endpoint, limit=MAX_LINE_BYTES)
|
|
173
|
+
loop = asyncio.get_running_loop()
|
|
174
|
+
if not hasattr(loop, "create_pipe_connection"):
|
|
175
|
+
raise RuntimeError("CELLO reaches its daemon on Windows through a named pipe, which needs asyncio's Proactor event loop, and this process runs " + type(loop).__name__)
|
|
176
|
+
reader = asyncio.StreamReader(limit=MAX_LINE_BYTES, loop=loop)
|
|
177
|
+
protocol = asyncio.StreamReaderProtocol(reader, loop=loop)
|
|
178
|
+
transport, _ = await loop.create_pipe_connection(lambda: protocol, endpoint)
|
|
179
|
+
return reader, asyncio.StreamWriter(transport, protocol, reader, loop)
|
|
146
180
|
|
|
147
181
|
|
|
148
182
|
def _bindings_file(home: Path) -> Path:
|
|
@@ -178,17 +212,42 @@ def _update_bindings(path: Path, change: Callable[[Dict[str, str]], None]) -> Di
|
|
|
178
212
|
with open(str(path) + ".lock", "a", encoding="utf-8") as lock:
|
|
179
213
|
if fcntl is not None:
|
|
180
214
|
fcntl.flock(lock, fcntl.LOCK_EX)
|
|
215
|
+
elif msvcrt is not None:
|
|
216
|
+
# Released when the file closes. The lock file stays empty, so byte 0 is always the one locked.
|
|
217
|
+
# LK_LOCK gives up after about ten seconds, where flock waits. Keep asking, as flock would.
|
|
218
|
+
lock.seek(0)
|
|
219
|
+
while True:
|
|
220
|
+
try:
|
|
221
|
+
msvcrt.locking(lock.fileno(), msvcrt.LK_LOCK, 1)
|
|
222
|
+
break
|
|
223
|
+
except OSError:
|
|
224
|
+
continue
|
|
181
225
|
# Strict: writing over a file that couldn't be read would erase every other binding.
|
|
182
226
|
bindings = _read_bindings_strict(path)
|
|
183
227
|
change(bindings)
|
|
184
228
|
tmp = Path(str(path) + "." + str(os.getpid()) + ".tmp")
|
|
185
229
|
tmp.write_text(json.dumps(bindings), encoding="utf-8")
|
|
186
|
-
|
|
230
|
+
_replace_file(tmp, path)
|
|
187
231
|
return bindings
|
|
188
232
|
|
|
189
233
|
|
|
234
|
+
def _replace_file(tmp: Path, path: Path) -> None:
|
|
235
|
+
"""os.replace, except that on Windows a reader holding the file open makes it fail for a moment. That reader is the
|
|
236
|
+
unlocked _read_bindings, which finishes in milliseconds, so a few short retries are enough."""
|
|
237
|
+
for attempt in range(50):
|
|
238
|
+
try:
|
|
239
|
+
os.replace(str(tmp), str(path))
|
|
240
|
+
return
|
|
241
|
+
except PermissionError:
|
|
242
|
+
if sys.platform != "win32" or attempt == 49:
|
|
243
|
+
raise
|
|
244
|
+
time.sleep(0.02)
|
|
245
|
+
|
|
246
|
+
|
|
190
247
|
def check_cello_requirements() -> bool:
|
|
191
|
-
|
|
248
|
+
# On Windows this opens the pipe as a client for a moment, and reads False if every instance happens to be busy.
|
|
249
|
+
# The gateway asks again later, so a miss only delays the start.
|
|
250
|
+
return os.path.exists(_socket_path())
|
|
192
251
|
|
|
193
252
|
|
|
194
253
|
def _has_content_field(value: Any) -> bool:
|
|
@@ -249,7 +308,8 @@ class CelloAdapter(BasePlatformAdapter):
|
|
|
249
308
|
# Kept from v1's installs. This bridge only does explicit, so any other value must stop it rather than be ignored.
|
|
250
309
|
self._legacy_delivery_mode: str = _get_cello_env("CELLO_DELIVERY_MODE").lower()
|
|
251
310
|
# Pinned now, because a background reconnect runs outside the profile's scope.
|
|
252
|
-
self._socket:
|
|
311
|
+
self._socket: str = _socket_path(extra.get("cello_home"))
|
|
312
|
+
self._ipc_key_file: str = _ipc_key_path(extra.get("cello_home"))
|
|
253
313
|
self._writer: Optional[asyncio.StreamWriter] = None
|
|
254
314
|
self._read_task: Optional[asyncio.Task] = None
|
|
255
315
|
self._reconnect_task: Optional[asyncio.Task] = None
|
|
@@ -474,10 +534,12 @@ class CelloAdapter(BasePlatformAdapter):
|
|
|
474
534
|
logger.info("[cello] Disconnected")
|
|
475
535
|
|
|
476
536
|
async def _establish(self) -> None:
|
|
477
|
-
reader, writer = await
|
|
537
|
+
reader, writer = await _open_daemon(self._socket)
|
|
478
538
|
self._writer = writer
|
|
479
539
|
self._start_wake_worker()
|
|
480
540
|
self._read_task = asyncio.create_task(self._read_loop(reader))
|
|
541
|
+
if sys.platform == "win32":
|
|
542
|
+
await self._verify_daemon()
|
|
481
543
|
held = await self._call("subscribe", {"agent": self._agent_name, "caller": self._caller})
|
|
482
544
|
self._agent_id = held.get("agent_id")
|
|
483
545
|
if self._agent_id:
|
|
@@ -486,6 +548,20 @@ class CelloAdapter(BasePlatformAdapter):
|
|
|
486
548
|
# Nothing rings again for what arrived while this side was away.
|
|
487
549
|
await self._announce_waiting()
|
|
488
550
|
|
|
551
|
+
async def _verify_daemon(self) -> None:
|
|
552
|
+
"""On Windows another account could create the daemon's pipe first. Nothing is sent until it proves it holds
|
|
553
|
+
this user's key (the same check as src/ipc/handshake.ts)."""
|
|
554
|
+
try:
|
|
555
|
+
key = bytes.fromhex(Path(self._ipc_key_file).read_text(encoding="utf-8").strip())
|
|
556
|
+
except Exception:
|
|
557
|
+
raise ConnectionError("something is listening at " + self._socket + " but left no key at " + self._ipc_key_file + ", so nothing was sent to it")
|
|
558
|
+
nonce = os.urandom(32)
|
|
559
|
+
answer = await self._call("hello", {"nonce": nonce.hex()}, timeout=10.0)
|
|
560
|
+
expected = hmac.new(key, b"cello-daemon-ipc-v1\0" + nonce, hashlib.sha256).hexdigest()
|
|
561
|
+
proof = answer.get("proof") if isinstance(answer, dict) else None
|
|
562
|
+
if not isinstance(proof, str) or not hmac.compare_digest(proof, expected):
|
|
563
|
+
raise ConnectionError("whatever is listening at " + self._socket + " failed the daemon's check, so nothing was sent to it. Another account may be posing as the daemon")
|
|
564
|
+
|
|
489
565
|
async def _announce_waiting(self) -> None:
|
|
490
566
|
try:
|
|
491
567
|
inbox = await self._call("inbox", {"agent": self._agent_name})
|
|
@@ -1316,3 +1392,5 @@ def register(ctx) -> None:
|
|
|
1316
1392
|
ctx.register_hook("post_llm_call", _on_post_llm_call)
|
|
1317
1393
|
if sys.platform != "win32":
|
|
1318
1394
|
_start_handoff_host(ctx)
|
|
1395
|
+
else:
|
|
1396
|
+
logger.warning("[cello] On Windows, CELLO notifications for a Hermes Desktop chat go to the agent's own CELLO chat instead, because handing them between Hermes processes isn't built for Windows yet.")
|
|
Binary file
|