@feynmanzhang/open-party 0.1.7 → 0.1.9

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.
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "open-party",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "Decentralized Agent communication network for Claude Code"
5
5
  }
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": "0.1.9",
3
+ "git_commit": "c853081",
4
+ "build_timestamp": "2026-06-06T14:57:17.114Z",
5
+ "source_path": "src/client/claude-code/"
6
+ }
@@ -12,10 +12,7 @@ var PartyHttpClient = class {
12
12
  this.baseUrl = baseUrl.replace(/\/$/, "");
13
13
  this.timeout = timeout;
14
14
  }
15
- // -- Dashboard --
16
- async getOverview() {
17
- return this.request("/dashboard/api/overview");
18
- }
15
+ // -- Agent lifecycle --
19
16
  async request(path, options = {}) {
20
17
  const controller = new AbortController();
21
18
  const timer = setTimeout(() => controller.abort(), this.timeout);
@@ -34,7 +31,6 @@ var PartyHttpClient = class {
34
31
  clearTimeout(timer);
35
32
  }
36
33
  }
37
- // -- Agent lifecycle --
38
34
  async register(agentId, displayName, metadata, callbackUrl) {
39
35
  return this.request("/agent/register", {
40
36
  method: "POST",
@@ -55,8 +51,7 @@ var PartyHttpClient = class {
55
51
  });
56
52
  }
57
53
  async listAgents() {
58
- const result = await this.request("/agent/list");
59
- return result.agents ?? [];
54
+ return this.request("/agent/list");
60
55
  }
61
56
  // -- Messaging --
62
57
  async sendMessage(senderId, recipientId, content, summary) {
@@ -78,6 +73,9 @@ var PartyHttpClient = class {
78
73
  async health() {
79
74
  return this.request("/proxy/health");
80
75
  }
76
+ async listPeers() {
77
+ return this.request("/proxy/peers");
78
+ }
81
79
  };
82
80
 
83
81
  // src/client/shared/session-store.ts
@@ -20947,10 +20947,7 @@ var PartyHttpClient = class {
20947
20947
  this.baseUrl = baseUrl.replace(/\/$/, "");
20948
20948
  this.timeout = timeout;
20949
20949
  }
20950
- // -- Dashboard --
20951
- async getOverview() {
20952
- return this.request("/dashboard/api/overview");
20953
- }
20950
+ // -- Agent lifecycle --
20954
20951
  async request(path, options = {}) {
20955
20952
  const controller = new AbortController();
20956
20953
  const timer = setTimeout(() => controller.abort(), this.timeout);
@@ -20969,7 +20966,6 @@ var PartyHttpClient = class {
20969
20966
  clearTimeout(timer);
20970
20967
  }
20971
20968
  }
20972
- // -- Agent lifecycle --
20973
20969
  async register(agentId, displayName, metadata, callbackUrl) {
20974
20970
  return this.request("/agent/register", {
20975
20971
  method: "POST",
@@ -20990,8 +20986,7 @@ var PartyHttpClient = class {
20990
20986
  });
20991
20987
  }
20992
20988
  async listAgents() {
20993
- const result = await this.request("/agent/list");
20994
- return result.agents ?? [];
20989
+ return this.request("/agent/list");
20995
20990
  }
20996
20991
  // -- Messaging --
20997
20992
  async sendMessage(senderId, recipientId, content, summary) {
@@ -21013,6 +21008,9 @@ var PartyHttpClient = class {
21013
21008
  async health() {
21014
21009
  return this.request("/proxy/health");
21015
21010
  }
21011
+ async listPeers() {
21012
+ return this.request("/proxy/peers");
21013
+ }
21016
21014
  };
21017
21015
 
21018
21016
  // src/client/shared/server-manager.ts
@@ -21635,7 +21633,7 @@ function startHeartbeat() {
21635
21633
  }, HEARTBEAT_INTERVAL_MS);
21636
21634
  }
21637
21635
  var mcpServerInstance = new McpServer(
21638
- { name: "open-party", version: "0.1.7" },
21636
+ { name: "open-party", version: "0.1.9" },
21639
21637
  {
21640
21638
  capabilities: {
21641
21639
  experimental: { "claude/channel": {} }
@@ -3994,9 +3994,15 @@ agentRoutes.post("/heartbeat", async (c) => {
3994
3994
  agentRoutes.get("/list", async (c) => {
3995
3995
  const { registry: registry2, discovery: discovery2 } = await Promise.resolve().then(() => (init_state(), state_exports));
3996
3996
  const localAgents = registry2.listAll();
3997
- const remoteAgents = discovery2.getReachableRemoteAgents();
3998
- const allAgents = localAgents.concat(remoteAgents);
3999
- return c.json({ agents: sanitizeAgentList(allAgents), count: allAgents.length });
3997
+ const remoteEntries = discovery2.getRemoteAgentEntries();
3998
+ const remoteAgents = remoteEntries.filter((e) => e.reachable).map((e) => ({ ...sanitizeAgentInfo(e.agentInfo), source_peer_ip: e.sourcePeerIp }));
3999
+ const allAgents = sanitizeAgentList(localAgents).concat(remoteAgents);
4000
+ return c.json({
4001
+ agents: allAgents,
4002
+ count: allAgents.length,
4003
+ local_count: localAgents.length,
4004
+ remote_count: remoteAgents.length
4005
+ });
4000
4006
  });
4001
4007
  agentRoutes.post("/send", async (c) => {
4002
4008
  const { registry: registry2, messageQueue: messageQueue2, discovery: discovery2 } = await Promise.resolve().then(() => (init_state(), state_exports));
@@ -4082,6 +4088,11 @@ proxyRoutes.get("/list_agents", async (c) => {
4082
4088
  const agents = registry.listAll();
4083
4089
  return c.json({ agents, count: agents.length });
4084
4090
  });
4091
+ proxyRoutes.get("/peers", async (c) => {
4092
+ const { discovery: discovery2 } = await Promise.resolve().then(() => (init_state(), state_exports));
4093
+ const peerStates = discovery2.getPeerStates();
4094
+ return c.json({ peers: peerStates, total: peerStates.length });
4095
+ });
4085
4096
  proxyRoutes.post("/receive", async (c) => {
4086
4097
  const envelope = await c.req.json();
4087
4098
  const stamped = { ...envelope, timestamp: envelope.timestamp ?? Date.now() / 1e3 };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-party",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "type": "module",
5
5
  "private": true
6
6
  }
package/dist/cli/index.js CHANGED
@@ -4282,9 +4282,15 @@ var init_agent = __esm({
4282
4282
  agentRoutes.get("/list", async (c) => {
4283
4283
  const { registry: registry2, discovery: discovery2 } = await Promise.resolve().then(() => (init_state(), state_exports));
4284
4284
  const localAgents = registry2.listAll();
4285
- const remoteAgents = discovery2.getReachableRemoteAgents();
4286
- const allAgents = localAgents.concat(remoteAgents);
4287
- return c.json({ agents: sanitizeAgentList(allAgents), count: allAgents.length });
4285
+ const remoteEntries = discovery2.getRemoteAgentEntries();
4286
+ const remoteAgents = remoteEntries.filter((e) => e.reachable).map((e) => ({ ...sanitizeAgentInfo(e.agentInfo), source_peer_ip: e.sourcePeerIp }));
4287
+ const allAgents = sanitizeAgentList(localAgents).concat(remoteAgents);
4288
+ return c.json({
4289
+ agents: allAgents,
4290
+ count: allAgents.length,
4291
+ local_count: localAgents.length,
4292
+ remote_count: remoteAgents.length
4293
+ });
4288
4294
  });
4289
4295
  agentRoutes.post("/send", async (c) => {
4290
4296
  const { registry: registry2, messageQueue: messageQueue2, discovery: discovery2 } = await Promise.resolve().then(() => (init_state(), state_exports));
@@ -4378,6 +4384,11 @@ var init_proxy = __esm({
4378
4384
  const agents = registry.listAll();
4379
4385
  return c.json({ agents, count: agents.length });
4380
4386
  });
4387
+ proxyRoutes.get("/peers", async (c) => {
4388
+ const { discovery: discovery2 } = await Promise.resolve().then(() => (init_state(), state_exports));
4389
+ const peerStates = discovery2.getPeerStates();
4390
+ return c.json({ peers: peerStates, total: peerStates.length });
4391
+ });
4381
4392
  proxyRoutes.post("/receive", async (c) => {
4382
4393
  const envelope = await c.req.json();
4383
4394
  const stamped = { ...envelope, timestamp: envelope.timestamp ?? Date.now() / 1e3 };
@@ -4593,7 +4604,7 @@ import { homedir as homedir2, platform } from "os";
4593
4604
  import { execSync as execSync2 } from "child_process";
4594
4605
 
4595
4606
  // src/cli/tty-utils.ts
4596
- import { createInterface } from "readline";
4607
+ import { createInterface, emitKeypressEvents } from "readline";
4597
4608
  function cyan(text) {
4598
4609
  return `\x1B[36m${text}\x1B[0m`;
4599
4610
  }
@@ -4630,7 +4641,10 @@ async function select(options, opts) {
4630
4641
  if (options.length === 1) return options[0].value;
4631
4642
  const message = opts?.message ?? "";
4632
4643
  const wasRaw = process.stdin.isRaw;
4633
- if (process.stdin.isTTY) process.stdin.setRawMode(true);
4644
+ if (process.stdin.isTTY) {
4645
+ process.stdin.setRawMode(true);
4646
+ emitKeypressEvents(process.stdin);
4647
+ }
4634
4648
  try {
4635
4649
  let cursor = 0;
4636
4650
  const render = () => {
@@ -5018,8 +5032,14 @@ async function setupCommand() {
5018
5032
  console.log(`
5019
5033
  ${bold(cyan("Open Party Setup"))}
5020
5034
  `);
5021
- if (!buildPlugin()) {
5022
- process.exit(1);
5035
+ const existingPlugin = findPluginDistDir();
5036
+ if (!existingPlugin) {
5037
+ if (!buildPlugin()) {
5038
+ process.exit(1);
5039
+ }
5040
+ } else {
5041
+ console.log(`${green("Pre-built plugin found, skipping build.")}
5042
+ `);
5023
5043
  }
5024
5044
  if (!installToClaudeCode()) {
5025
5045
  process.exit(1);
@@ -5346,10 +5366,7 @@ var PartyHttpClient = class {
5346
5366
  this.baseUrl = baseUrl.replace(/\/$/, "");
5347
5367
  this.timeout = timeout;
5348
5368
  }
5349
- // -- Dashboard --
5350
- async getOverview() {
5351
- return this.request("/dashboard/api/overview");
5352
- }
5369
+ // -- Agent lifecycle --
5353
5370
  async request(path, options = {}) {
5354
5371
  const controller = new AbortController();
5355
5372
  const timer = setTimeout(() => controller.abort(), this.timeout);
@@ -5368,7 +5385,6 @@ var PartyHttpClient = class {
5368
5385
  clearTimeout(timer);
5369
5386
  }
5370
5387
  }
5371
- // -- Agent lifecycle --
5372
5388
  async register(agentId, displayName, metadata, callbackUrl) {
5373
5389
  return this.request("/agent/register", {
5374
5390
  method: "POST",
@@ -5389,8 +5405,7 @@ var PartyHttpClient = class {
5389
5405
  });
5390
5406
  }
5391
5407
  async listAgents() {
5392
- const result = await this.request("/agent/list");
5393
- return result.agents ?? [];
5408
+ return this.request("/agent/list");
5394
5409
  }
5395
5410
  // -- Messaging --
5396
5411
  async sendMessage(senderId, recipientId, content, summary) {
@@ -5412,6 +5427,9 @@ var PartyHttpClient = class {
5412
5427
  async health() {
5413
5428
  return this.request("/proxy/health");
5414
5429
  }
5430
+ async listPeers() {
5431
+ return this.request("/proxy/peers");
5432
+ }
5415
5433
  };
5416
5434
 
5417
5435
  // src/cli/list-agents.ts
@@ -5426,17 +5444,12 @@ async function listAgentsCommand(args2) {
5426
5444
  return;
5427
5445
  }
5428
5446
  try {
5429
- const overview = await client.getOverview();
5430
- const agentsData = overview.agents;
5431
- if (!agentsData) {
5432
- console.log("No agent data available.");
5433
- return;
5434
- }
5435
- const localAgents = agentsData.local_agents ?? [];
5436
- const remoteAgents = agentsData.remote_agents ?? [];
5437
- const localCount = agentsData.local_count ?? localAgents.length;
5438
- const remoteCount = agentsData.remote_count ?? remoteAgents.length;
5439
- const allAgents = [...localAgents, ...remoteAgents];
5447
+ const data = await client.listAgents();
5448
+ const allAgents = data.agents ?? [];
5449
+ const localCount = data.local_count ?? 0;
5450
+ const remoteCount = data.remote_count ?? 0;
5451
+ const localAgents = allAgents.slice(0, localCount);
5452
+ const remoteAgents = allAgents.slice(localCount);
5440
5453
  const totalCount = localCount + remoteCount;
5441
5454
  if (jsonMode) {
5442
5455
  console.log(JSON.stringify({ agents: allAgents, count: totalCount, local_count: localCount, remote_count: remoteCount }, null, 2));
@@ -5478,7 +5491,7 @@ Remote agents (${remoteCount}):`);
5478
5491
  }
5479
5492
  function formatTimeAgo(timestamp) {
5480
5493
  if (!timestamp) return "\u2014";
5481
- const diff = Date.now() / 1e3 - timestamp / 1e3;
5494
+ const diff = Date.now() / 1e3 - timestamp;
5482
5495
  if (diff < 60) return "just now";
5483
5496
  if (diff < 3600) return `${Math.floor(diff / 60)} min ago`;
5484
5497
  if (diff < 86400) return `${Math.floor(diff / 3600)} hr ago`;
@@ -5497,23 +5510,21 @@ async function peersCommand(args2 = []) {
5497
5510
  return;
5498
5511
  }
5499
5512
  try {
5500
- const overview = await client.getOverview();
5501
- const peers = overview.peers;
5502
- if (!peers) {
5503
- console.log("No peer data available.");
5504
- return;
5505
- }
5506
- const details = peers.details ?? [];
5507
- const remoteAgents = overview.agents?.remote_agents ?? [];
5513
+ const [peerData, agentData] = await Promise.all([
5514
+ client.listPeers(),
5515
+ client.listAgents()
5516
+ ]);
5517
+ const peers = peerData.peers ?? [];
5518
+ const remoteAgents = (agentData.agents ?? []).filter((a) => a.source_peer_ip);
5508
5519
  const peerAgentCounts = /* @__PURE__ */ new Map();
5509
5520
  for (const agent of remoteAgents) {
5510
5521
  const ip = agent.source_peer_ip;
5511
5522
  peerAgentCounts.set(ip, (peerAgentCounts.get(ip) ?? 0) + 1);
5512
5523
  }
5513
- const total = peers.total ?? details.length;
5524
+ const total = peerData.total ?? peers.length;
5514
5525
  if (jsonMode) {
5515
5526
  console.log(JSON.stringify({
5516
- peers: details.map((p) => ({
5527
+ peers: peers.map((p) => ({
5517
5528
  ...p,
5518
5529
  agent_count: peerAgentCounts.get(p.ip) ?? 0
5519
5530
  })),
@@ -5521,13 +5532,13 @@ async function peersCommand(args2 = []) {
5521
5532
  }, null, 2));
5522
5533
  return;
5523
5534
  }
5524
- if (details.length === 0) {
5535
+ if (peers.length === 0) {
5525
5536
  console.log("No peers discovered yet.");
5526
5537
  return;
5527
5538
  }
5528
5539
  console.log(`Peers (${total}):
5529
5540
  `);
5530
- for (const peer of details) {
5541
+ for (const peer of peers) {
5531
5542
  const agentCount = peerAgentCounts.get(peer.ip);
5532
5543
  const agentStr = agentCount != null ? String(agentCount) : "\u2014";
5533
5544
  const statusStr = formatStatus(peer.status);
@@ -5788,11 +5799,13 @@ async function offlineCommand() {
5788
5799
  var COMMANDS = [
5789
5800
  {
5790
5801
  name: "setup",
5802
+ scope: "user",
5791
5803
  description: "Build & install plugin into Claude Code, then start server",
5792
5804
  usage: "open-party setup"
5793
5805
  },
5794
5806
  {
5795
5807
  name: "start",
5808
+ scope: "user",
5796
5809
  description: "Start the Party Server (default when no command given)",
5797
5810
  usage: "open-party start [-d] [-p <port>]",
5798
5811
  options: [
@@ -5807,27 +5820,32 @@ var COMMANDS = [
5807
5820
  },
5808
5821
  {
5809
5822
  name: "stop",
5823
+ scope: "user",
5810
5824
  description: "Stop the Party Server",
5811
5825
  usage: "open-party stop"
5812
5826
  },
5813
5827
  {
5814
5828
  name: "status",
5829
+ scope: "user",
5815
5830
  description: "Show server status",
5816
5831
  usage: "open-party status"
5817
5832
  },
5818
5833
  {
5819
5834
  name: "login",
5835
+ scope: "user",
5820
5836
  description: "Login to Tailscale network",
5821
5837
  usage: "open-party login"
5822
5838
  },
5823
5839
  {
5824
5840
  name: "logout",
5841
+ scope: "user",
5825
5842
  description: "Log out of Tailscale network",
5826
5843
  usage: "open-party logout"
5827
5844
  },
5828
5845
  {
5829
5846
  name: "agents",
5830
5847
  alias: "list-agents",
5848
+ scope: "agent",
5831
5849
  description: "List online agents (local + remote, with status)",
5832
5850
  usage: "open-party agents [--json]",
5833
5851
  options: [
@@ -5840,6 +5858,7 @@ var COMMANDS = [
5840
5858
  },
5841
5859
  {
5842
5860
  name: "peers",
5861
+ scope: "agent",
5843
5862
  description: "List discovered peer nodes",
5844
5863
  usage: "open-party peers [--json]",
5845
5864
  options: [
@@ -5848,6 +5867,7 @@ var COMMANDS = [
5848
5867
  },
5849
5868
  {
5850
5869
  name: "send-message",
5870
+ scope: "agent",
5851
5871
  description: "Send a message to an agent",
5852
5872
  usage: "open-party send-message --recipient <id> --content <text> [options]",
5853
5873
  options: [
@@ -5864,6 +5884,7 @@ var COMMANDS = [
5864
5884
  },
5865
5885
  {
5866
5886
  name: "online",
5887
+ scope: "agent",
5867
5888
  description: "Go online \u2014 register this agent with the Party Server",
5868
5889
  usage: "open-party online [--name <name>]",
5869
5890
  options: [
@@ -5876,11 +5897,13 @@ var COMMANDS = [
5876
5897
  },
5877
5898
  {
5878
5899
  name: "offline",
5900
+ scope: "agent",
5879
5901
  description: "Go offline \u2014 unregister from the Party Server",
5880
5902
  usage: "open-party offline"
5881
5903
  },
5882
5904
  {
5883
5905
  name: "check-messages",
5906
+ scope: "agent",
5884
5907
  description: "Check for new messages (add --history to include history)",
5885
5908
  usage: "open-party check-messages [--agent-id <id>] [--history] [--limit N] [--json]",
5886
5909
  options: [
@@ -5934,8 +5957,15 @@ function showHelp(commandName) {
5934
5957
  }
5935
5958
  return;
5936
5959
  }
5937
- const lines = ["Usage: open-party <command> [options]", "", "Commands:"];
5938
- for (const cmd of COMMANDS) {
5960
+ const userCmds = COMMANDS.filter((c) => c.scope === "user");
5961
+ const agentCmds = COMMANDS.filter((c) => c.scope === "agent");
5962
+ const lines = ["Usage: open-party <command> [options]", "", "Server & Network (user):"];
5963
+ for (const cmd of userCmds) {
5964
+ const label = cmd.alias ? `${cmd.name}, ${cmd.alias}` : cmd.name;
5965
+ lines.push(` ${label.padEnd(22)} ${cmd.description}`);
5966
+ }
5967
+ lines.push("", "Agent Communication:");
5968
+ for (const cmd of agentCmds) {
5939
5969
  const label = cmd.alias ? `${cmd.name}, ${cmd.alias}` : cmd.name;
5940
5970
  lines.push(` ${label.padEnd(22)} ${cmd.description}`);
5941
5971
  }