@pitboss/cli 0.2.0 → 0.2.1

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.
package/dist/cli.js CHANGED
@@ -19282,7 +19282,8 @@ Already logged in as ${source_default.bold(existing.agentName)} (${existing.agen
19282
19282
  `));
19283
19283
  return;
19284
19284
  }
19285
- const apiUrl = opts.api ?? await dist_default6({ message: "API URL", default: "http://localhost:3010" });
19285
+ const ni = nonInteractive();
19286
+ const apiUrl = opts.api || (ni ? requireFlag("api url", "--api <url>") : await dist_default6({ message: "API URL", default: "http://localhost:3010" }));
19286
19287
  let agentId;
19287
19288
  let agentName;
19288
19289
  let repoId;
@@ -19306,14 +19307,14 @@ Already logged in as ${source_default.bold(existing.agentName)} (${existing.agen
19306
19307
  }
19307
19308
  } else {
19308
19309
  const client = new CliApiClient({ apiUrl });
19309
- const name = await dist_default6({
19310
+ const name = opts.name || (ni ? void 0 : await dist_default6({
19310
19311
  message: "Agent name",
19311
19312
  default: `${process.env.USER ?? "agent"}-claude-code`
19312
- });
19313
- const specialization = await dist_default7({
19313
+ }));
19314
+ const specialization = opts.specialization || (ni ? void 0 : await dist_default7({
19314
19315
  message: "Specialization",
19315
19316
  choices: SPECIALIZATION_CHOICES
19316
- });
19317
+ }));
19317
19318
  const specForApi = specialization === "custom" ? void 0 : specialization;
19318
19319
  const s = ora("Accepting invite\u2026").start();
19319
19320
  try {
@@ -19326,7 +19327,7 @@ Already logged in as ${source_default.bold(existing.agentName)} (${existing.agen
19326
19327
  agentId = result.agent.id;
19327
19328
  agentName = result.agent.name;
19328
19329
  repoId = result.agent.repoId;
19329
- agentSpecialization = specialization === "custom" ? void 0 : specialization;
19330
+ agentSpecialization = result.agent.specialization ?? void 0;
19330
19331
  token2 = result.token;
19331
19332
  s.succeed(source_default.green("Logged in"));
19332
19333
  } catch (err) {
@@ -19865,7 +19866,7 @@ program2.command("send <threadId>").description("Send a message to a thread").op
19865
19866
  program2.command("inbox").description("Show unread messages").option("-r, --read", "Mark all displayed messages as read").action(inboxCommand);
19866
19867
  program2.command("repos").description("List all repos on this server").action(reposListCommand);
19867
19868
  program2.command("agents").description("List agents in the current repo").action(agentsListCommand);
19868
- program2.command("login").description("Log in to a repo on this machine using an invite code or an agent token").option("--invite <code>", "Invite code from `pitboss repo invite`").option("--token <token>", "Per-agent token (from the cloud dashboard)").option("--api <url>", "API URL (skips prompt)").option("--working-dir <path>", "Override the working directory (defaults to CWD)").option("--worker-type <type>", "Agent runtime: claude, copilot, cursor, windsurf, gemini, gpt, mcp, human (default: human)").action(loginCommand);
19869
+ program2.command("login").description("Log in to a repo on this machine using an invite code or an agent token").option("--invite <code>", "Invite code from `pitboss repo invite`").option("--token <token>", "Per-agent token (from the cloud dashboard)").option("--api <url>", "API URL (skips prompt)").option("--working-dir <path>", "Override the working directory (defaults to CWD)").option("--worker-type <type>", "Agent runtime: claude, copilot, cursor, windsurf, gemini, gpt, mcp, human (default: human)").option("--name <name>", "Agent name (defaults to the invite's suggestion when not interactive)").option("--specialization <spec>", "Agent specialization: writer, reviewer, tester, architect, devops, orchestrator (defaults to the invite's suggestion)").action(loginCommand);
19869
19870
  var repo = program2.command("repo").description("Repo operations");
19870
19871
  repo.command("show [id]").description("Show a repo's details (defaults to the current repo)").action(repoShowCommand);
19871
19872
  var repoContext = repo.command("context").description("View or edit the repo's pinned context (read by every agent on session start)");
package/dist/mcp.js CHANGED
@@ -13411,17 +13411,39 @@ function diffAttention(prev, tasks) {
13411
13411
  for (const s of next.values()) counts.set(s, (counts.get(s) ?? 0) + 1);
13412
13412
  const parts = [...counts.entries()].map(([s, n]) => `${n} ${s}`).sort();
13413
13413
  return {
13414
- notices: [`relai: ${next.size} item(s) need you (${parts.join(", ")}). Call list_attention.`],
13414
+ notices: [{ text: `relai: ${next.size} item(s) need you (${parts.join(", ")}). Call list_attention.`, ids: [...next.keys()] }],
13415
13415
  next
13416
13416
  };
13417
13417
  }
13418
13418
  const byId = new Map(tasks.map((t) => [t.id, t]));
13419
13419
  const notices = [];
13420
13420
  for (const [id, state] of next) {
13421
- if (prev.get(id) !== state) notices.push(describe(byId.get(id), state));
13421
+ if (prev.get(id) !== state) notices.push({ text: describe(byId.get(id), state), ids: [id] });
13422
13422
  }
13423
13423
  return { notices, next };
13424
13424
  }
13425
+ async function deliverAttention(prev, tasks, send) {
13426
+ const { notices, next } = diffAttention(prev, tasks);
13427
+ const undelivered = /* @__PURE__ */ new Set();
13428
+ for (const [i, n] of notices.entries()) {
13429
+ try {
13430
+ await send(n.text);
13431
+ } catch (err) {
13432
+ const held = notices.slice(i);
13433
+ console.error(`[relai-mcp] ${held.length} attention notice(s) held for the next poll:`, err instanceof Error ? err.message : err);
13434
+ held.forEach((h) => h.ids.forEach((id) => undelivered.add(id)));
13435
+ break;
13436
+ }
13437
+ }
13438
+ if (undelivered.size === 0) return next;
13439
+ if (prev === null) return null;
13440
+ for (const id of undelivered) {
13441
+ const before = prev.get(id);
13442
+ if (before) next.set(id, before);
13443
+ else next.delete(id);
13444
+ }
13445
+ return next;
13446
+ }
13425
13447
 
13426
13448
  // ../../shared/git/src/index.ts
13427
13449
  import { execFileSync } from "node:child_process";
@@ -13602,19 +13624,24 @@ var toolConfig = OWNER_MODE ? { ownerMode: true, ownerId: OWNER_ID } : { ownerMo
13602
13624
  if (OWNER_MODE) {
13603
13625
  const OWNER_POLL_INTERVAL_MS = Number(process.env.OWNER_POLL_INTERVAL_MS ?? 6e4);
13604
13626
  let seen = null;
13627
+ let polling = false;
13605
13628
  async function pollAttention() {
13629
+ if (polling) return;
13630
+ polling = true;
13606
13631
  try {
13607
13632
  const [attention, active] = await Promise.all([
13608
13633
  apiClient.getTasks({ status: "blocked,pending_verification,proposed" }),
13609
13634
  apiClient.getTasks({ status: "in_progress" })
13610
13635
  ]);
13611
- const { notices, next } = diffAttention(seen, [...attention, ...active]);
13612
- seen = next;
13613
- for (const data of notices) {
13614
- await server.server.sendLoggingMessage({ level: "warning", data });
13615
- }
13636
+ seen = await deliverAttention(
13637
+ seen,
13638
+ [...attention, ...active],
13639
+ (data) => server.server.sendLoggingMessage({ level: "warning", data })
13640
+ );
13616
13641
  } catch (err) {
13617
13642
  console.error("[relai-mcp] attention poll failed:", err instanceof Error ? err.message : err);
13643
+ } finally {
13644
+ polling = false;
13618
13645
  }
13619
13646
  }
13620
13647
  void pollAttention();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pitboss/cli",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "private": false,
5
5
  "description": "Connect your coding agents to a pitboss instance",
6
6
  "keywords": [