Add 5 pi extensions: pi-subagents, pi-crew, rpiv-pi, pi-interactive-shell, pi-intercom
This commit is contained in:
20
extensions/pi-intercom/broker/paths.ts
Normal file
20
extensions/pi-intercom/broker/paths.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { join } from "path";
|
||||
import { homedir } from "os";
|
||||
|
||||
function sanitizePipeSegment(value: string): string {
|
||||
return value
|
||||
.replace(/[^a-zA-Z0-9]+/g, "-")
|
||||
.replace(/^-+|-+$/g, "")
|
||||
.toLowerCase() || "default";
|
||||
}
|
||||
|
||||
export function getBrokerSocketPath(
|
||||
platform: NodeJS.Platform = process.platform,
|
||||
homeDir: string = homedir(),
|
||||
): string {
|
||||
if (platform === "win32") {
|
||||
return `\\\\.\\pipe\\pi-intercom-${sanitizePipeSegment(homeDir)}`;
|
||||
}
|
||||
|
||||
return join(homeDir, ".pi/agent/intercom/broker.sock");
|
||||
}
|
||||
Reference in New Issue
Block a user