Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions assistant/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as readline from 'node:readline';
import { readFileSync, appendFileSync, mkdirSync } from 'node:fs';
import { dirname } from 'node:path';
import { getSocketPath, getHistoryPath, readSessionToken } from './util/platform.js';
import { hasSocketOverride } from './daemon/connection-policy.js';
import {
serialize,
createMessageParser,
Expand Down Expand Up @@ -666,6 +667,15 @@ export async function startCli(): Promise<void> {
// accept any other messages.
const token = readSessionToken();
if (!token) {
if (hasSocketOverride()) {
// SSH-forwarded socket: the token file lives on the remote
// host, not locally. Connect without auth and let the server
// decide whether to accept the unauthenticated connection.
authenticated = true;
startHeartbeat();
resolve();
Comment thread
siddseethepalli marked this conversation as resolved.
return;
Comment thread
siddseethepalli marked this conversation as resolved.
}
reject(new Error('Session token not found — is the daemon running?'));
newSocket.destroy();
return;
Expand Down
2 changes: 1 addition & 1 deletion assistant/src/daemon/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ export class DaemonServer {
}

broadcast(msg: ServerMessage, excludeSocket?: net.Socket): void {
for (const socket of this.connectedSockets) {
for (const socket of this.authenticatedSockets) {
if (socket === excludeSocket) continue;
this.send(socket, msg);
}
Expand Down
Loading