@open-bus/cli 0.44.0 → 0.45.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.
package/assets/openbus.ts CHANGED
@@ -9,6 +9,11 @@ import { basename, dirname, join, resolve } from "node:path";
9
9
  import { StringDecoder } from "node:string_decoder";
10
10
 
11
11
  type Json = Record<string, unknown>;
12
+
13
+ /** Kinds this build knows; any other is shown as `other` (CONTRACT.md). */
14
+ const KINDS = ["claude-code", "opencode", "pi", "omp"];
15
+ const displayKind = (kind: unknown): string =>
16
+ typeof kind === "string" && KINDS.includes(kind) ? kind : "other";
12
17
  type Frame = Json & { type: string; id: string };
13
18
  type Ctx = {
14
19
  cwd: string;
@@ -776,7 +781,7 @@ export default function openbus(pi: Pi): void {
776
781
  .map((a) => {
777
782
  const queued =
778
783
  (a.state ?? (a.live ? "live" : "queued")) === "queued";
779
- return `- ${a.name} (${a.kind}, ${a.namespace}${typeof a.machine_label === "string" ? `, ${a.machine_label}` : ""})${queued ? " (queued)" : ""}`;
784
+ return `- ${a.name} (${displayKind(a.kind)}, ${a.namespace}${typeof a.machine_label === "string" ? `, ${a.machine_label}` : ""})${queued ? " (queued)" : ""}`;
780
785
  })
781
786
  .join("\n")
782
787
  : "No agents in your namespace.";
package/dist/index.js CHANGED
@@ -20802,13 +20802,15 @@ var init_ids = __esm({
20802
20802
  });
20803
20803
 
20804
20804
  // ../shared/dist/kinds.js
20805
- var AGENT_KINDS, AgentKindSchema;
20805
+ var AGENT_KINDS, AgentKindSchema, KindTokenSchema, displayKind;
20806
20806
  var init_kinds = __esm({
20807
20807
  "../shared/dist/kinds.js"() {
20808
20808
  "use strict";
20809
20809
  init_zod();
20810
- AGENT_KINDS = ["claude-code", "opencode", "pi"];
20810
+ AGENT_KINDS = ["claude-code", "opencode", "pi", "omp"];
20811
20811
  AgentKindSchema = external_exports.enum(AGENT_KINDS);
20812
+ KindTokenSchema = external_exports.string().regex(/^[a-z][a-z0-9-]{0,31}$/);
20813
+ displayKind = (kind2) => AGENT_KINDS.includes(kind2) ? kind2 : "other";
20812
20814
  }
20813
20815
  });
20814
20816
 
@@ -21093,7 +21095,11 @@ var init_protocol = __esm({
21093
21095
  ReceiptFrame = external_exports.strictObject({ ...base, type: external_exports.literal("receipt"), ...receiptShape }).refine(receiptReasonMatchesState, "reason does not match state").refine((f) => f.state === "pending" || f.state === "refused", "send receipt is pending or refused");
21094
21096
  RosterAgent = external_exports.strictObject({
21095
21097
  bus_name: BusNameSchema,
21096
- kind: AgentKindSchema,
21098
+ /**
21099
+ * Any kind token, so a future kind never fails the whole roster (from
21100
+ * 0.45.0; older daemons are gated by the hub). Display it via displayKind.
21101
+ */
21102
+ kind: KindTokenSchema,
21097
21103
  namespace: WireNamespaceSchema,
21098
21104
  global: external_exports.boolean(),
21099
21105
  /**
@@ -21283,7 +21289,11 @@ var init_rest = __esm({
21283
21289
  id: IdSchema,
21284
21290
  namespace: WireNamespaceSchema,
21285
21291
  name: BusNameSchema,
21286
- kind: AgentKindSchema,
21292
+ /**
21293
+ * Any kind token, so a dashboard tab built before a new kind keeps the
21294
+ * roster; it shows an unknown kind as Other.
21295
+ */
21296
+ kind: KindTokenSchema,
21287
21297
  machineId: IdSchema,
21288
21298
  machineLabel: MachineLabelSchema,
21289
21299
  global: external_exports.boolean(),
@@ -21399,17 +21409,19 @@ var init_dist = __esm({
21399
21409
  });
21400
21410
 
21401
21411
  // ../ipc/src/frames.ts
21402
- var V, MAX_BODY_BYTES, MAX_LINE_BYTES, INLINE_CAP_BYTES, KIND, AGENT_REF, base2, late, isWellFormed2, WELL_FORMED, Hello2, optIn, Send2, List2, Self, Fetch2, Ack2, StatusRequest, AdapterFrame, AgentInfo, Welcome, Receipt, Roster2, Agent, Body, Deliver2, Notice2, ErrorFrame2, StatusReply, DaemonFrame;
21412
+ var V, MAX_BODY_BYTES, MAX_LINE_BYTES, INLINE_CAP_BYTES, KIND, KIND_TOKEN, AGENT_REF, base2, late, isWellFormed2, WELL_FORMED, Hello2, optIn, Send2, List2, Self, Fetch2, Ack2, StatusRequest, AdapterFrame, AgentInfo, Welcome, Receipt, Roster2, Agent, Body, Deliver2, Notice2, ErrorFrame2, StatusReply, DaemonFrame;
21403
21413
  var init_frames = __esm({
21404
21414
  "../ipc/src/frames.ts"() {
21405
21415
  "use strict";
21406
21416
  init_dist();
21407
21417
  init_zod();
21418
+ init_dist();
21408
21419
  V = 1;
21409
21420
  MAX_BODY_BYTES = 1024 * 1024;
21410
21421
  MAX_LINE_BYTES = 4 * 1024 * 1024;
21411
21422
  INLINE_CAP_BYTES = 32 * 1024;
21412
21423
  KIND = AgentKindSchema;
21424
+ KIND_TOKEN = KindTokenSchema;
21413
21425
  AGENT_REF = AgentRefSchema;
21414
21426
  base2 = { v: external_exports.literal(V), id: external_exports.string().min(1).max(64) };
21415
21427
  late = { late: external_exports.array(external_exports.string().min(1)).optional() };
@@ -21473,7 +21485,7 @@ var init_frames = __esm({
21473
21485
  AgentInfo = external_exports.object({
21474
21486
  name: external_exports.string(),
21475
21487
  namespace: external_exports.string(),
21476
- kind: KIND,
21488
+ kind: KIND_TOKEN,
21477
21489
  /** `state === "live"`; kept for older adapters. */
21478
21490
  live: external_exports.boolean(),
21479
21491
  /** Roster entries only: `queued` means the agent's machine is disconnected. */
@@ -21571,7 +21583,7 @@ var init_frames = __esm({
21571
21583
  agents: external_exports.array(
21572
21584
  external_exports.object({
21573
21585
  name: external_exports.string(),
21574
- kind: KIND,
21586
+ kind: KIND_TOKEN,
21575
21587
  /** Empty when the hub does not say which machine. */
21576
21588
  machine: external_exports.string(),
21577
21589
  state: external_exports.enum(["live", "queued"])
@@ -22276,6 +22288,22 @@ function ancestorChain(pid) {
22276
22288
  }
22277
22289
  return out;
22278
22290
  }
22291
+ function statStartTicks(stat) {
22292
+ const close = stat.lastIndexOf(")");
22293
+ if (close < 0) return null;
22294
+ const start = stat.slice(close + 1).trim().split(/\s+/)[19];
22295
+ return start && /^\d+$/.test(start) ? start : null;
22296
+ }
22297
+ function claudeProcStartOf(pid, deps = {}) {
22298
+ if ((deps.platform ?? process.platform) !== "linux") return procStartOf(pid);
22299
+ try {
22300
+ return statStartTicks(
22301
+ (deps.readStat ?? ((p) => readFileSync(`/proc/${p}/stat`, "utf8")))(pid)
22302
+ );
22303
+ } catch {
22304
+ return null;
22305
+ }
22306
+ }
22279
22307
  function sessionHello(session, pid, cwd) {
22280
22308
  return Hello2.parse({
22281
22309
  v: 1,
@@ -22432,7 +22460,7 @@ async function run(name, args, request) {
22432
22460
  if (r.type !== "roster") return failed(r);
22433
22461
  return text(
22434
22462
  r.agents.length ? r.agents.map(
22435
- (a) => `- ${a.name} (${a.kind}, ${a.namespace}${a.machine_label ? `, ${a.machine_label}` : ""})${queued(a) ? " (queued)" : ""}`
22463
+ (a) => `- ${a.name} (${displayKind(a.kind)}, ${a.namespace}${a.machine_label ? `, ${a.machine_label}` : ""})${queued(a) ? " (queued)" : ""}`
22436
22464
  ).join("\n") : "No agents in your namespace."
22437
22465
  );
22438
22466
  }
@@ -37442,7 +37470,7 @@ async function connect4() {
37442
37470
  const session = findSession(process.pid, {
37443
37471
  sessionsDir: SESSIONS,
37444
37472
  ancestors: ancestorChain,
37445
- procStart: procStartOf
37473
+ procStart: claudeProcStartOf
37446
37474
  });
37447
37475
  if (!session || socketDirProblem(HOME)) return null;
37448
37476
  return await connectDaemon({
@@ -37937,6 +37965,8 @@ function attest(hello, deps = {}) {
37937
37965
  }
37938
37966
  return { ok: true };
37939
37967
  }
37968
+ case "omp":
37969
+ return { ok: false, reason: "omp is not supported yet" };
37940
37970
  }
37941
37971
  }
37942
37972
  function attestClaude(hello, deps) {
@@ -37956,7 +37986,7 @@ function attestClaude(hello, deps) {
37956
37986
  if (typeof raw.procStart !== "string") {
37957
37987
  return { ok: false, reason: "Claude session has no procStart" };
37958
37988
  }
37959
- const start = (deps.procStart ?? procStartOf)(pid);
37989
+ const start = (deps.procStart ?? claudeProcStartOf)(pid);
37960
37990
  if (!start) return { ok: false, reason: "session process is not running" };
37961
37991
  if (raw.procStart !== start) {
37962
37992
  return { ok: false, reason: "session process start time moved" };
@@ -40171,7 +40201,7 @@ async function runDaemon(deps = {}) {
40171
40201
  const running = cl.isRunning ?? isRunning;
40172
40202
  const claudeSessions = {
40173
40203
  dir: cl.sessionsDir ?? claudeSessionsDir(),
40174
- procStart: cachedProcStart(cl.procStart ?? procStartOf, running, {
40204
+ procStart: cachedProcStart(cl.procStart ?? claudeProcStartOf, running, {
40175
40205
  ttlMs: cl.syncMs ?? 2e3
40176
40206
  }),
40177
40207
  isRunning: running
@@ -40834,6 +40864,9 @@ import { execFileSync as execFileSync4, spawn as spawn2 } from "node:child_proce
40834
40864
  import { closeSync as closeSync3, openSync as openSync3, readFileSync as readFileSync9 } from "node:fs";
40835
40865
  import { homedir as homedir2, userInfo } from "node:os";
40836
40866
 
40867
+ // src/copy.ts
40868
+ init_dist();
40869
+
40837
40870
  // ../ui/src/tokens/terminal.ts
40838
40871
  var terminal = {
40839
40872
  bg: { light: "#FFFFFF", dark: "#131518" },
@@ -40918,7 +40951,9 @@ var HARNESS_LABEL = {
40918
40951
  var KIND_LABEL = {
40919
40952
  "claude-code": "Claude Code",
40920
40953
  opencode: "OpenCode",
40921
- pi: "Pi"
40954
+ pi: "Pi",
40955
+ omp: "oh-my-pi",
40956
+ other: "Other"
40922
40957
  };
40923
40958
  var len = (s) => [...s].length;
40924
40959
  function cutMiddle(value, max, more = "\u2026") {
@@ -41063,7 +41098,7 @@ function copy(style) {
41063
41098
  const lead = `${n} agent${n === 1 ? "" : "s"} in namespace `;
41064
41099
  return `${lead}${p("accent", clip(namespace, len(lead) + 2 + len(meta3)))} ${p("muted", meta3)}`;
41065
41100
  },
41066
- rosterRow: (a) => ` ${cell(a.name, 20, more)}${cell(KIND_LABEL[a.kind] ?? a.kind, 13, more)}${cell(a.machine, 22, more)}${a.state === "live" ? p("success", `${g("live")} live`) : p("warning", `${g("queued")} queued`)}`,
41101
+ rosterRow: (a) => ` ${cell(a.name, 20, more)}${cell(KIND_LABEL[displayKind(a.kind)], 13, more)}${cell(a.machine, 22, more)}${a.state === "live" ? p("success", `${g("live")} live`) : p("warning", `${g("queued")} queued`)}`,
41067
41102
  rosterMore: (n) => ` ${p("muted", `and ${n} more ${g("sep")} npx @open-bus/cli status`)}`,
41068
41103
  queuedFootnote: () => [
41069
41104
  p(
@@ -41814,7 +41849,7 @@ var noService = {
41814
41849
  remove: async () => ({}),
41815
41850
  cli: () => ["open-bus"]
41816
41851
  };
41817
- var VERSION = true ? "0.44.0" : JSON.parse(
41852
+ var VERSION = true ? "0.45.0" : JSON.parse(
41818
41853
  readFileSync9(new URL("../package.json", import.meta.url), "utf8")
41819
41854
  ).version;
41820
41855
  var which = (cmd) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@open-bus/cli",
3
3
  "type": "module",
4
- "version": "0.44.0",
4
+ "version": "0.45.0",
5
5
  "description": "One bus for all your AI coding agents, across machines.",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -29,11 +29,11 @@
29
29
  "typescript": "^5.9.3",
30
30
  "vitest": "^4.1.12",
31
31
  "zod": "^4.1.0",
32
- "@ob/adapter-mcp-json": "0.0.0",
33
- "@ob/daemon": "0.0.0",
34
32
  "@ob/adapter-claude-code": "0.0.0",
35
- "@ob/adapter-pi": "0.0.0",
36
33
  "@ob/adapter-opencode": "0.0.0",
34
+ "@ob/adapter-mcp-json": "0.0.0",
35
+ "@ob/adapter-pi": "0.0.0",
36
+ "@ob/daemon": "0.0.0",
37
37
  "@ob/ipc": "0.0.0",
38
38
  "@ob/shared": "0.0.0",
39
39
  "@ob/ui": "0.0.0"