@feynmanzhang/open-party 0.1.8 → 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.8",
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.8" },
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.8",
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 = () => {
@@ -5352,10 +5366,7 @@ var PartyHttpClient = class {
5352
5366
  this.baseUrl = baseUrl.replace(/\/$/, "");
5353
5367
  this.timeout = timeout;
5354
5368
  }
5355
- // -- Dashboard --
5356
- async getOverview() {
5357
- return this.request("/dashboard/api/overview");
5358
- }
5369
+ // -- Agent lifecycle --
5359
5370
  async request(path, options = {}) {
5360
5371
  const controller = new AbortController();
5361
5372
  const timer = setTimeout(() => controller.abort(), this.timeout);
@@ -5374,7 +5385,6 @@ var PartyHttpClient = class {
5374
5385
  clearTimeout(timer);
5375
5386
  }
5376
5387
  }
5377
- // -- Agent lifecycle --
5378
5388
  async register(agentId, displayName, metadata, callbackUrl) {
5379
5389
  return this.request("/agent/register", {
5380
5390
  method: "POST",
@@ -5395,8 +5405,7 @@ var PartyHttpClient = class {
5395
5405
  });
5396
5406
  }
5397
5407
  async listAgents() {
5398
- const result = await this.request("/agent/list");
5399
- return result.agents ?? [];
5408
+ return this.request("/agent/list");
5400
5409
  }
5401
5410
  // -- Messaging --
5402
5411
  async sendMessage(senderId, recipientId, content, summary) {
@@ -5418,6 +5427,9 @@ var PartyHttpClient = class {
5418
5427
  async health() {
5419
5428
  return this.request("/proxy/health");
5420
5429
  }
5430
+ async listPeers() {
5431
+ return this.request("/proxy/peers");
5432
+ }
5421
5433
  };
5422
5434
 
5423
5435
  // src/cli/list-agents.ts
@@ -5432,17 +5444,12 @@ async function listAgentsCommand(args2) {
5432
5444
  return;
5433
5445
  }
5434
5446
  try {
5435
- const overview = await client.getOverview();
5436
- const agentsData = overview.agents;
5437
- if (!agentsData) {
5438
- console.log("No agent data available.");
5439
- return;
5440
- }
5441
- const localAgents = agentsData.local_agents ?? [];
5442
- const remoteAgents = agentsData.remote_agents ?? [];
5443
- const localCount = agentsData.local_count ?? localAgents.length;
5444
- const remoteCount = agentsData.remote_count ?? remoteAgents.length;
5445
- 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);
5446
5453
  const totalCount = localCount + remoteCount;
5447
5454
  if (jsonMode) {
5448
5455
  console.log(JSON.stringify({ agents: allAgents, count: totalCount, local_count: localCount, remote_count: remoteCount }, null, 2));
@@ -5484,7 +5491,7 @@ Remote agents (${remoteCount}):`);
5484
5491
  }
5485
5492
  function formatTimeAgo(timestamp) {
5486
5493
  if (!timestamp) return "\u2014";
5487
- const diff = Date.now() / 1e3 - timestamp / 1e3;
5494
+ const diff = Date.now() / 1e3 - timestamp;
5488
5495
  if (diff < 60) return "just now";
5489
5496
  if (diff < 3600) return `${Math.floor(diff / 60)} min ago`;
5490
5497
  if (diff < 86400) return `${Math.floor(diff / 3600)} hr ago`;
@@ -5503,23 +5510,21 @@ async function peersCommand(args2 = []) {
5503
5510
  return;
5504
5511
  }
5505
5512
  try {
5506
- const overview = await client.getOverview();
5507
- const peers = overview.peers;
5508
- if (!peers) {
5509
- console.log("No peer data available.");
5510
- return;
5511
- }
5512
- const details = peers.details ?? [];
5513
- 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);
5514
5519
  const peerAgentCounts = /* @__PURE__ */ new Map();
5515
5520
  for (const agent of remoteAgents) {
5516
5521
  const ip = agent.source_peer_ip;
5517
5522
  peerAgentCounts.set(ip, (peerAgentCounts.get(ip) ?? 0) + 1);
5518
5523
  }
5519
- const total = peers.total ?? details.length;
5524
+ const total = peerData.total ?? peers.length;
5520
5525
  if (jsonMode) {
5521
5526
  console.log(JSON.stringify({
5522
- peers: details.map((p) => ({
5527
+ peers: peers.map((p) => ({
5523
5528
  ...p,
5524
5529
  agent_count: peerAgentCounts.get(p.ip) ?? 0
5525
5530
  })),
@@ -5527,13 +5532,13 @@ async function peersCommand(args2 = []) {
5527
5532
  }, null, 2));
5528
5533
  return;
5529
5534
  }
5530
- if (details.length === 0) {
5535
+ if (peers.length === 0) {
5531
5536
  console.log("No peers discovered yet.");
5532
5537
  return;
5533
5538
  }
5534
5539
  console.log(`Peers (${total}):
5535
5540
  `);
5536
- for (const peer of details) {
5541
+ for (const peer of peers) {
5537
5542
  const agentCount = peerAgentCounts.get(peer.ip);
5538
5543
  const agentStr = agentCount != null ? String(agentCount) : "\u2014";
5539
5544
  const statusStr = formatStatus(peer.status);
@@ -5794,11 +5799,13 @@ async function offlineCommand() {
5794
5799
  var COMMANDS = [
5795
5800
  {
5796
5801
  name: "setup",
5802
+ scope: "user",
5797
5803
  description: "Build & install plugin into Claude Code, then start server",
5798
5804
  usage: "open-party setup"
5799
5805
  },
5800
5806
  {
5801
5807
  name: "start",
5808
+ scope: "user",
5802
5809
  description: "Start the Party Server (default when no command given)",
5803
5810
  usage: "open-party start [-d] [-p <port>]",
5804
5811
  options: [
@@ -5813,27 +5820,32 @@ var COMMANDS = [
5813
5820
  },
5814
5821
  {
5815
5822
  name: "stop",
5823
+ scope: "user",
5816
5824
  description: "Stop the Party Server",
5817
5825
  usage: "open-party stop"
5818
5826
  },
5819
5827
  {
5820
5828
  name: "status",
5829
+ scope: "user",
5821
5830
  description: "Show server status",
5822
5831
  usage: "open-party status"
5823
5832
  },
5824
5833
  {
5825
5834
  name: "login",
5835
+ scope: "user",
5826
5836
  description: "Login to Tailscale network",
5827
5837
  usage: "open-party login"
5828
5838
  },
5829
5839
  {
5830
5840
  name: "logout",
5841
+ scope: "user",
5831
5842
  description: "Log out of Tailscale network",
5832
5843
  usage: "open-party logout"
5833
5844
  },
5834
5845
  {
5835
5846
  name: "agents",
5836
5847
  alias: "list-agents",
5848
+ scope: "agent",
5837
5849
  description: "List online agents (local + remote, with status)",
5838
5850
  usage: "open-party agents [--json]",
5839
5851
  options: [
@@ -5846,6 +5858,7 @@ var COMMANDS = [
5846
5858
  },
5847
5859
  {
5848
5860
  name: "peers",
5861
+ scope: "agent",
5849
5862
  description: "List discovered peer nodes",
5850
5863
  usage: "open-party peers [--json]",
5851
5864
  options: [
@@ -5854,6 +5867,7 @@ var COMMANDS = [
5854
5867
  },
5855
5868
  {
5856
5869
  name: "send-message",
5870
+ scope: "agent",
5857
5871
  description: "Send a message to an agent",
5858
5872
  usage: "open-party send-message --recipient <id> --content <text> [options]",
5859
5873
  options: [
@@ -5870,6 +5884,7 @@ var COMMANDS = [
5870
5884
  },
5871
5885
  {
5872
5886
  name: "online",
5887
+ scope: "agent",
5873
5888
  description: "Go online \u2014 register this agent with the Party Server",
5874
5889
  usage: "open-party online [--name <name>]",
5875
5890
  options: [
@@ -5882,11 +5897,13 @@ var COMMANDS = [
5882
5897
  },
5883
5898
  {
5884
5899
  name: "offline",
5900
+ scope: "agent",
5885
5901
  description: "Go offline \u2014 unregister from the Party Server",
5886
5902
  usage: "open-party offline"
5887
5903
  },
5888
5904
  {
5889
5905
  name: "check-messages",
5906
+ scope: "agent",
5890
5907
  description: "Check for new messages (add --history to include history)",
5891
5908
  usage: "open-party check-messages [--agent-id <id>] [--history] [--limit N] [--json]",
5892
5909
  options: [
@@ -5940,8 +5957,15 @@ function showHelp(commandName) {
5940
5957
  }
5941
5958
  return;
5942
5959
  }
5943
- const lines = ["Usage: open-party <command> [options]", "", "Commands:"];
5944
- 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) {
5945
5969
  const label = cmd.alias ? `${cmd.name}, ${cmd.alias}` : cmd.name;
5946
5970
  lines.push(` ${label.padEnd(22)} ${cmd.description}`);
5947
5971
  }