ea437745a3
These four paths bypassed DirResolver's XDG-aware rootSubdir/agentSubdir hooks, resolving directly against getConfigRootDir()/getAgentDir() and ignoring XDG state/data layout. Add XDG-aware path helpers in dirs.ts and route all four through them: - secret-placeholder.key → $XDG_STATE_HOME/omp/ (state, agent flattened) - marketplaces.json → $XDG_DATA_HOME/omp/ (data) - run/daemons/<hash>/ → $XDG_STATE_HOME/omp/run/ (state) - run/provider-inflight/ → $XDG_STATE_HOME/omp/run/ (state) omp config init-xdg migrates secret-placeholder.key and marketplaces.json from their legacy locations; run/ is ephemeral and rebuilds on restart.
15 lines
629 B
TypeScript
15 lines
629 B
TypeScript
import * as path from "node:path";
|
|
import { getDaemonRuntimeDir } from "@oh-my-pi/pi-utils";
|
|
|
|
/** Resolve the private runtime directory shared by omp processes in one project directory. */
|
|
export { getDaemonRuntimeDir as daemonRuntimeDir };
|
|
|
|
/** Resolve the Unix socket or Windows named pipe used by one project broker. */
|
|
export function daemonBrokerEndpoint(projectDir: string, runtimeDir: string): string {
|
|
if (process.platform === "win32") {
|
|
const key = Bun.hash.wyhash(path.resolve(projectDir)).toString(16).padStart(16, "0");
|
|
return `\\\\.\\pipe\\omp-daemon-${key}`;
|
|
}
|
|
return path.join(runtimeDir, "broker.sock");
|
|
}
|