@feynmanzhang/open-party 0.1.2 → 0.1.3-beta.0

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.
@@ -152,7 +152,7 @@ function joinTailnet(authKey, timeout = 3e4) {
152
152
  const binary = getTailscaleBinary();
153
153
  try {
154
154
  const output = execWithSudoFallback(
155
- [binary, "up", "--authkey", authKey, "--accept-routes"],
155
+ [binary, "up", "--authkey", authKey],
156
156
  timeout
157
157
  );
158
158
  return { success: true, output: output.trim() };
@@ -3502,6 +3502,9 @@ var serve = (options, listeningListener) => {
3502
3502
  // src/server/index.ts
3503
3503
  init_config();
3504
3504
  init_state();
3505
+ import { mkdirSync, writeFileSync, unlinkSync } from "fs";
3506
+ import { join as join2, dirname } from "path";
3507
+ import { homedir } from "os";
3505
3508
 
3506
3509
  // src/server/models.ts
3507
3510
  function sanitizeAgentInfo(info) {
@@ -4623,7 +4626,15 @@ app.use("*", cors());
4623
4626
  app.route("/agent", agentRoutes);
4624
4627
  app.route("/proxy", proxyRoutes);
4625
4628
  app.route("/dashboard", dashboardRoutes);
4629
+ function pidFilePath() {
4630
+ const pluginData = process.env.CLAUDE_PLUGIN_DATA || "";
4631
+ if (pluginData) return join2(pluginData, "server.pid");
4632
+ return join2(homedir(), ".open-party", "server.pid");
4633
+ }
4626
4634
  async function main() {
4635
+ const pidPath = pidFilePath();
4636
+ mkdirSync(dirname(pidPath), { recursive: true });
4637
+ writeFileSync(pidPath, String(process.pid));
4627
4638
  console.log(`Starting Party Server on port ${PARTY_PORT} (Tailscale IP: ${getSelfIp()})`);
4628
4639
  process.on("SIGHUP", () => {
4629
4640
  });
@@ -4632,6 +4643,10 @@ async function main() {
4632
4643
  const cleanupPromise = periodicCleanup();
4633
4644
  const shutdown = () => {
4634
4645
  console.log("\nShutting down Party Server...");
4646
+ try {
4647
+ unlinkSync(pidPath);
4648
+ } catch {
4649
+ }
4635
4650
  server.close();
4636
4651
  process.exit(0);
4637
4652
  };