@open-artifacts/bus 0.168.0 → 0.169.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/assets/oa-bus.ts CHANGED
@@ -11,7 +11,7 @@ import { StringDecoder } from "node:string_decoder";
11
11
  type Json = Record<string, unknown>;
12
12
 
13
13
  /** The IPC marker (CONTRACT.md): the package version, stamped by the CLI's bundler. */
14
- const CLIENT_VERSION = "0.168.0";
14
+ const CLIENT_VERSION = "0.169.1";
15
15
 
16
16
  type Frame = Json & { type: string; id: string };
17
17
  type Ctx = {
@@ -27374,6 +27374,12 @@ var AgentUp = external_exports.strictObject({
27374
27374
  * it only to hubs that accept it.
27375
27375
  */
27376
27376
  name_kind: NameKindSchema.optional(),
27377
+ /**
27378
+ * #2311: the harness says a user or a peer named this session, so the name
27379
+ * is never treated as a harness default (not expired, not hidden as
27380
+ * unnamed). Sent only to a hub that listed `BUS_CAPS.nameChosen`.
27381
+ */
27382
+ name_chosen: external_exports.literal(true).optional(),
27377
27383
  /**
27378
27384
  * #1295: the agent_ref this one takes over from, after a /clear: the same
27379
27385
  * live process now reports a new session. The hub honours it only for a
@@ -27450,7 +27456,14 @@ var Rename = external_exports.strictObject({
27450
27456
  agent_ref: AgentRefSchema,
27451
27457
  proposed_name: WellFormedText.pipe(external_exports.string().min(1).max(256)),
27452
27458
  /** A tool rename is `chosen`; a harness reverting to its fallback is `default`. Absent means `chosen`. */
27453
- name_kind: NameKindSchema.optional()
27459
+ name_kind: NameKindSchema.optional(),
27460
+ /**
27461
+ * #2311: false when the harness re-derived the title (not a user's or a
27462
+ * peer's choice): the hub then leaves `name_chosen` as it is. Absent or
27463
+ * true marks the name chosen. Sent only to a hub that listed
27464
+ * `BUS_CAPS.nameChosen`.
27465
+ */
27466
+ name_chosen: external_exports.boolean().optional()
27454
27467
  });
27455
27468
  var FollowRefSchema = WellFormedText.pipe(external_exports.string().min(1).max(2048));
27456
27469
  var Follow = external_exports.strictObject({
@@ -27731,7 +27744,7 @@ var base2 = { v: external_exports.literal(V), id: external_exports.string().min(
27731
27744
  var late = { late: external_exports.array(external_exports.string().min(1)).optional() };
27732
27745
  var isWellFormed2 = (s) => s.isWellFormed();
27733
27746
  var WELL_FORMED = { message: "text is not well-formed unicode" };
27734
- var CLIENT_VERSION = true ? "0.168.0" : "0.0.0";
27747
+ var CLIENT_VERSION = true ? "0.169.1" : "0.0.0";
27735
27748
  var clientVersion = {
27736
27749
  client_version: external_exports.string().min(1).max(64).optional()
27737
27750
  };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oa-bus",
3
- "version": "0.168.0",
3
+ "version": "0.169.1",
4
4
  "type": "module",
5
5
  "openclaw": {
6
6
  "extensions": [
package/dist/index.js CHANGED
@@ -20560,6 +20560,13 @@ var init_caps = __esm({
20560
20560
  * accepted by the socket is delivered.
20561
20561
  */
20562
20562
  noticeAck: "notice_ack",
20563
+ /**
20564
+ * Chosen names (#2311): the client may send `agent_up.name_chosen: true`
20565
+ * for a session whose harness says the user (or a peer) named it. The hub
20566
+ * lists it in `hello_ok.caps`; a client sends the key only when it did (an
20567
+ * older hub's strict decoder refuses it).
20568
+ */
20569
+ nameChosen: "name_chosen",
20563
20570
  /**
20564
20571
  * Confirmed acks (#2198): a mail `ack` from a socket listing it is answered
20565
20572
  * by `acked {msg_id}` once the hub has durably settled the receipt, or, for
@@ -21386,6 +21393,12 @@ var init_protocol = __esm({
21386
21393
  * it only to hubs that accept it.
21387
21394
  */
21388
21395
  name_kind: NameKindSchema.optional(),
21396
+ /**
21397
+ * #2311: the harness says a user or a peer named this session, so the name
21398
+ * is never treated as a harness default (not expired, not hidden as
21399
+ * unnamed). Sent only to a hub that listed `BUS_CAPS.nameChosen`.
21400
+ */
21401
+ name_chosen: external_exports.literal(true).optional(),
21389
21402
  /**
21390
21403
  * #1295: the agent_ref this one takes over from, after a /clear: the same
21391
21404
  * live process now reports a new session. The hub honours it only for a
@@ -21462,7 +21475,14 @@ var init_protocol = __esm({
21462
21475
  agent_ref: AgentRefSchema,
21463
21476
  proposed_name: WellFormedText.pipe(external_exports.string().min(1).max(256)),
21464
21477
  /** A tool rename is `chosen`; a harness reverting to its fallback is `default`. Absent means `chosen`. */
21465
- name_kind: NameKindSchema.optional()
21478
+ name_kind: NameKindSchema.optional(),
21479
+ /**
21480
+ * #2311: false when the harness re-derived the title (not a user's or a
21481
+ * peer's choice): the hub then leaves `name_chosen` as it is. Absent or
21482
+ * true marks the name chosen. Sent only to a hub that listed
21483
+ * `BUS_CAPS.nameChosen`.
21484
+ */
21485
+ name_chosen: external_exports.boolean().optional()
21466
21486
  });
21467
21487
  FollowRefSchema = WellFormedText.pipe(external_exports.string().min(1).max(2048));
21468
21488
  Follow = external_exports.strictObject({
@@ -21803,7 +21823,7 @@ var init_frames = __esm({
21803
21823
  late = { late: external_exports.array(external_exports.string().min(1)).optional() };
21804
21824
  isWellFormed2 = (s) => s.isWellFormed();
21805
21825
  WELL_FORMED = { message: "text is not well-formed unicode" };
21806
- CLIENT_VERSION = true ? "0.168.0" : "0.0.0";
21826
+ CLIENT_VERSION = true ? "0.169.1" : "0.0.0";
21807
21827
  clientVersion = {
21808
21828
  client_version: external_exports.string().min(1).max(64).optional()
21809
21829
  };
@@ -34610,14 +34630,16 @@ function sessionHello(session, pid, cwd) {
34610
34630
  }
34611
34631
  });
34612
34632
  }
34613
- var claudeSessionsDir, busHome, notASession, sha256, NOT_UNDER_CLAUDE, ProcStartUnknownError, PS_TIMEOUT_MS, ps, procStartOf;
34633
+ var claudeSessionsDir, busHome, notASession, isHeadlessEntrypoint, nameWasChosen, sha256, NOT_UNDER_CLAUDE, ProcStartUnknownError, PS_TIMEOUT_MS, ps, procStartOf;
34614
34634
  var init_session = __esm({
34615
34635
  "../bus-adapter-claude-code/src/session.ts"() {
34616
34636
  "use strict";
34617
34637
  init_src2();
34618
34638
  claudeSessionsDir = (env2 = process.env) => env2.OA_BUS_CLAUDE_SESSIONS_DIR || join2(env2.CLAUDE_CONFIG_DIR || join2(homedir(), ".claude"), "sessions");
34619
34639
  busHome = (env2 = process.env) => resolve2(env2.OA_BUS_HOME || join2(homedir(), ".oa-bus"));
34620
- notASession = (rec) => rec.parkedJobId !== void 0 || Boolean(rec.agentBus);
34640
+ notASession = (rec) => rec.parkedJobId !== void 0 || Boolean(rec.agentBus) || isHeadlessEntrypoint(rec) && !nameWasChosen(rec);
34641
+ isHeadlessEntrypoint = (rec) => typeof rec.entrypoint === "string" && rec.entrypoint !== "cli";
34642
+ nameWasChosen = (rec) => rec.nameSource === "user" || rec.nameSource === "peer";
34621
34643
  sha256 = (s) => createHash("sha256").update(s).digest("hex");
34622
34644
  NOT_UNDER_CLAUDE = "This MCP server is for Claude Code; use this harness's own bus tools.";
34623
34645
  ProcStartUnknownError = class extends Error {
@@ -41756,6 +41778,7 @@ function scanSessions(dir) {
41756
41778
  socketPath: typeof rec.messagingSocketPath === "string" ? rec.messagingSocketPath : "",
41757
41779
  cwd: typeof rec.cwd === "string" ? rec.cwd : "",
41758
41780
  procStart: rec.procStart,
41781
+ ...nameWasChosen(rec) ? { nameChosen: true } : {},
41759
41782
  // Not the mtime: live sessions rewrite their file every 15-60 s. A reused pid writes a new procStart.
41760
41783
  stamp: rec.procStart
41761
41784
  });
@@ -46952,6 +46975,7 @@ async function runDaemon(deps2 = {}) {
46952
46975
  proposed_name: fitName(rec.proposedName, 64),
46953
46976
  namespace: rec.namespace,
46954
46977
  global: rec.global,
46978
+ ...rec.nameChosen && hubNameChosen ? { name_chosen: true } : {},
46955
46979
  // A /clear: the new ref takes over the old address and its mail (#1295).
46956
46980
  ...rec.replaces !== void 0 && hubMailbox ? { replaces: rec.replaces } : {}
46957
46981
  });
@@ -47321,7 +47345,8 @@ async function runDaemon(deps2 = {}) {
47321
47345
  const renameIds = /* @__PURE__ */ new Map();
47322
47346
  const renameFrames = /* @__PURE__ */ new Map();
47323
47347
  const renameHeldUntil = /* @__PURE__ */ new Map();
47324
- const renameIfChanged = (rec, name, filePid) => {
47348
+ const renameIfChanged = (rec, name, filePid, chosen) => {
47349
+ if (chosen !== void 0) rec.nameChosen = chosen;
47325
47350
  const was = rec.sessionName ?? rec.proposedName;
47326
47351
  if (name === "" || name === `claude-${filePid}`) return;
47327
47352
  rec.sessionName = name;
@@ -47357,7 +47382,9 @@ async function runDaemon(deps2 = {}) {
47357
47382
  type: "rename",
47358
47383
  agent_ref: rec.ref,
47359
47384
  proposed_name: fitName(rec.proposedName, 64),
47360
- name_kind: "chosen"
47385
+ name_kind: "chosen",
47386
+ // #2311: a re-derived Claude title is a rename, not a user's choice.
47387
+ ...hubNameChosen && rec.kind === "claude-code" ? { name_chosen: rec.nameChosen === true } : {}
47361
47388
  })) {
47362
47389
  rec.sentName = rec.proposedName;
47363
47390
  recent.push(now);
@@ -47415,7 +47442,7 @@ async function runDaemon(deps2 = {}) {
47415
47442
  prev.pid = s.pid;
47416
47443
  prev.procStart = s.procStart;
47417
47444
  }
47418
- renameIfChanged(prev, s.name, s.pid);
47445
+ renameIfChanged(prev, s.name, s.pid, s.nameChosen === true);
47419
47446
  continue;
47420
47447
  }
47421
47448
  if (prev && prev.pid === s.pid && prev.procStart === s.procStart) {
@@ -47450,6 +47477,7 @@ async function runDaemon(deps2 = {}) {
47450
47477
  // The same process keeps its proof across /clear and a reopen; agent_ok rebinds it.
47451
47478
  ...(prev?.linkHashes ?? old?.linkHashes) !== void 0 ? { linkHashes: prev?.linkHashes ?? old?.linkHashes } : {},
47452
47479
  sessionName: s.name,
47480
+ ...s.nameChosen ? { nameChosen: true } : {},
47453
47481
  cwd: s.cwd,
47454
47482
  live: true
47455
47483
  });
@@ -47527,6 +47555,7 @@ async function runDaemon(deps2 = {}) {
47527
47555
  let hubDroppedAt;
47528
47556
  let hubIds = false;
47529
47557
  let hubMailbox = false;
47558
+ let hubNameChosen = false;
47530
47559
  let hubFollow = false;
47531
47560
  let hubLink = false;
47532
47561
  let hubLinkArg = false;
@@ -47666,6 +47695,7 @@ async function runDaemon(deps2 = {}) {
47666
47695
  hubVersion = frame.server_version;
47667
47696
  hubIds = frame.caps?.includes(BUS_CAPS.ids) ?? false;
47668
47697
  hubMailbox = frame.caps?.includes(BUS_CAPS.mailbox) ?? false;
47698
+ hubNameChosen = frame.caps?.includes(BUS_CAPS.nameChosen) ?? false;
47669
47699
  hubFollow = frame.caps?.includes(BUS_CAPS.follow) ?? false;
47670
47700
  hubWaiting = frame.caps?.includes(BUS_CAPS.waiting) ?? false;
47671
47701
  hubWaitingQuery = frame.caps?.includes(BUS_CAPS.waitingQuery) ?? false;
@@ -47675,6 +47705,11 @@ async function runDaemon(deps2 = {}) {
47675
47705
  hubHelloed = true;
47676
47706
  for (const rec of agents.all())
47677
47707
  if (rec.live && rec.replaces !== void 0) announceUp(rec);
47708
+ if (hubNameChosen) {
47709
+ for (const rec of agents.all())
47710
+ if (rec.live && rec.nameChosen && rec.replaces === void 0)
47711
+ announceUp(rec);
47712
+ }
47678
47713
  for (const rec of agents.all()) flushRename(rec);
47679
47714
  outbox.flush();
47680
47715
  if (hubAckConfirm) {
@@ -47734,6 +47769,7 @@ async function runDaemon(deps2 = {}) {
47734
47769
  hubVersion = void 0;
47735
47770
  hubIds = false;
47736
47771
  hubMailbox = false;
47772
+ hubNameChosen = false;
47737
47773
  hubFollow = false;
47738
47774
  hubLink = false;
47739
47775
  hubLinkArg = false;
@@ -48056,6 +48092,7 @@ async function runDaemon(deps2 = {}) {
48056
48092
  pid,
48057
48093
  ...mine ? { procStart: mine.procStart } : {},
48058
48094
  ...mine ? { sessionName: mine.name } : {},
48095
+ ...mine?.nameChosen ? { nameChosen: true } : {},
48059
48096
  // Claude's MCP server reconnects per tool call: the proof stays.
48060
48097
  ...(prev?.linkHashes ?? old?.linkHashes) !== void 0 ? { linkHashes: prev?.linkHashes ?? old?.linkHashes } : {},
48061
48098
  ...codexName !== void 0 ? { sessionName: codexName } : {},
@@ -48388,6 +48425,7 @@ async function runDaemon(deps2 = {}) {
48388
48425
  );
48389
48426
  const wakeLogged = /* @__PURE__ */ new Set();
48390
48427
  const wakeAsked = /* @__PURE__ */ new Map();
48428
+ const wakeUnloadedLogged = /* @__PURE__ */ new Map();
48391
48429
  let waking = false;
48392
48430
  let wakeCheckedAt;
48393
48431
  const wakeSent = /* @__PURE__ */ new Map();
@@ -48410,6 +48448,8 @@ async function runDaemon(deps2 = {}) {
48410
48448
  );
48411
48449
  const away = new Set(rows.map((r) => r.ref));
48412
48450
  for (const [k, w] of wakeSent) if (!away.has(w.ref)) wakeSent.delete(k);
48451
+ for (const k of wakeUnloadedLogged.keys())
48452
+ if (!away.has(k)) wakeUnloadedLogged.delete(k);
48413
48453
  for (const m of [wakeAsked, wakeWaiting])
48414
48454
  for (const k of m.keys())
48415
48455
  if (!away.has(k.split(":")[1] ?? "")) m.delete(k);
@@ -48427,7 +48467,10 @@ async function runDaemon(deps2 = {}) {
48427
48467
  };
48428
48468
  let counts;
48429
48469
  if (hubWaitingQuery && hub.open && hubVersion !== void 0) {
48430
- const refs = rows.filter((r) => held2.has(r.ref)).map((r) => r.ref).slice(0, MAX_WAITING_QUERY);
48470
+ const refs = [
48471
+ ...rows.filter((r) => held2.has(r.ref)),
48472
+ ...rows.filter((r) => !held2.has(r.ref))
48473
+ ].map((r) => r.ref).slice(0, MAX_WAITING_QUERY);
48431
48474
  if (refs.length) {
48432
48475
  counts = await hubWaitingCounts(refs);
48433
48476
  if (!counts) log("codex wake skipped: the hub did not answer");
@@ -48435,7 +48478,14 @@ async function runDaemon(deps2 = {}) {
48435
48478
  }
48436
48479
  for (const r of rows) {
48437
48480
  const h = held2.get(r.ref);
48438
- if (!h) continue;
48481
+ if (!h) {
48482
+ const last = wakeUnloadedLogged.get(r.ref);
48483
+ if (counts?.[r.ref] && (last === void 0 || now - last >= 36e5)) {
48484
+ wakeUnloadedLogged.set(r.ref, now);
48485
+ ev("codex_wake_skipped", { thread: r.ref, reason: "not_loaded" });
48486
+ }
48487
+ continue;
48488
+ }
48439
48489
  const key2 = `wake:${r.ref}:${h.pid}:${h.start.replace(/\s+/g, "_")}`;
48440
48490
  const who = `codex wake ${r.ref.slice(0, 8)} pid ${h.pid}`;
48441
48491
  let n = 1;
@@ -50277,7 +50327,7 @@ var noService = {
50277
50327
  remove: async () => ({}),
50278
50328
  cli: () => ["oa-bus"]
50279
50329
  };
50280
- var VERSION = true ? "0.168.0" : JSON.parse(
50330
+ var VERSION = true ? "0.169.1" : JSON.parse(
50281
50331
  readFileSync16(new URL("../package.json", import.meta.url), "utf8")
50282
50332
  ).version;
50283
50333
  var which = (cmd) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@open-artifacts/bus",
3
3
  "type": "module",
4
- "version": "0.168.0",
4
+ "version": "0.169.1",
5
5
  "description": "The Open Artifacts bus: your AI agents reach each other across machines.",
6
6
  "license": "MIT",
7
7
  "repository": {