@open-artifacts/bus 0.150.0 → 0.151.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/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.150.0";
14
+ const CLIENT_VERSION = "0.151.0";
15
15
 
16
16
  type Frame = Json & { type: string; id: string };
17
17
  type Ctx = {
@@ -27704,7 +27704,7 @@ var base2 = { v: external_exports.literal(V), id: external_exports.string().min(
27704
27704
  var late = { late: external_exports.array(external_exports.string().min(1)).optional() };
27705
27705
  var isWellFormed2 = (s) => s.isWellFormed();
27706
27706
  var WELL_FORMED = { message: "text is not well-formed unicode" };
27707
- var CLIENT_VERSION = true ? "0.150.0" : "0.0.0";
27707
+ var CLIENT_VERSION = true ? "0.151.0" : "0.0.0";
27708
27708
  var clientVersion = {
27709
27709
  client_version: external_exports.string().min(1).max(64).optional()
27710
27710
  };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oa-bus",
3
- "version": "0.150.0",
3
+ "version": "0.151.0",
4
4
  "type": "module",
5
5
  "openclaw": {
6
6
  "extensions": [
package/dist/index.js CHANGED
@@ -20535,7 +20535,16 @@ var init_caps = __esm({
20535
20535
  * daemon tells a harness adapter its proof was taken (`link_proofed.bound`)
20536
20536
  * only when the hub listed both `link` and this.
20537
20537
  */
20538
- linkArg: "link_arg"
20538
+ linkArg: "link_arg",
20539
+ /**
20540
+ * Notice acks (#1752): a daemon listing it sends the existing `ack` frame
20541
+ * with a notice deliver frame's `msg_id` only once the harness took the
20542
+ * notice (nothing while it waits), and `refuse` (reason `closed`) if it is
20543
+ * dropped or the session is gone. The hub then reads the notice as held,
20544
+ * not delivered, until that ack. A socket without it keeps today's rule:
20545
+ * accepted by the socket is delivered.
20546
+ */
20547
+ noticeAck: "notice_ack"
20539
20548
  };
20540
20549
  MAX_CAPS = 16;
20541
20550
  CapTokenSchema = external_exports.string().regex(/^[a-z][a-z0-9_-]{0,31}$/);
@@ -21743,7 +21752,7 @@ var init_frames = __esm({
21743
21752
  late = { late: external_exports.array(external_exports.string().min(1)).optional() };
21744
21753
  isWellFormed2 = (s) => s.isWellFormed();
21745
21754
  WELL_FORMED = { message: "text is not well-formed unicode" };
21746
- CLIENT_VERSION = true ? "0.150.0" : "0.0.0";
21755
+ CLIENT_VERSION = true ? "0.151.0" : "0.0.0";
21747
21756
  clientVersion = {
21748
21757
  client_version: external_exports.string().min(1).max(64).optional()
21749
21758
  };
@@ -47990,9 +47999,9 @@ function systemService(d) {
47990
47999
  const launcherNode = () => d.platform === "win32" ? void 0 : d.execPath;
47991
48000
  const nodeOf = (h) => d.platform === "win32" ? d.execPath : launcherOf(h);
47992
48001
  const entryOf = () => join18(home2(), "bin", entryName(d.source()));
47993
- const installFile = () => join18(home2(), "install.json");
48002
+ const installFile2 = () => join18(home2(), "install.json");
47994
48003
  const record7 = () => {
47995
- const r = readInstallFile(installFile()).service;
48004
+ const r = readInstallFile(installFile2()).service;
47996
48005
  return typeof r === "object" && r !== null ? r : {};
47997
48006
  };
47998
48007
  const xdg = d.env.XDG_CONFIG_HOME;
@@ -48095,7 +48104,7 @@ function systemService(d) {
48095
48104
  }
48096
48105
  const started = manager === "launchd" ? await startLaunchd(f, unit) : manager === "systemd" ? await startSystemd(f, unit) : "failed";
48097
48106
  if (started === "started") {
48098
- updateInstallFile(installFile(), {
48107
+ updateInstallFile(installFile2(), {
48099
48108
  service: {
48100
48109
  kind: manager,
48101
48110
  node: u.node,
@@ -48113,7 +48122,7 @@ function systemService(d) {
48113
48122
  out: u.out,
48114
48123
  err: u.err
48115
48124
  });
48116
- updateInstallFile(installFile(), {
48125
+ updateInstallFile(installFile2(), {
48117
48126
  service: { fallback: true, pid }
48118
48127
  });
48119
48128
  return {};
@@ -48123,7 +48132,7 @@ function systemService(d) {
48123
48132
  if (await d.daemonPid() === void 0) return {};
48124
48133
  const left2 = await stopDaemon();
48125
48134
  if (left2 !== void 0) return { running: left2 };
48126
- updateInstallFile(installFile(), { service: {} });
48135
+ updateInstallFile(installFile2(), { service: {} });
48127
48136
  return { stopped: true };
48128
48137
  }
48129
48138
  const f = file2();
@@ -48135,7 +48144,7 @@ function systemService(d) {
48135
48144
  if (manager === "systemd") await systemctl("daemon-reload");
48136
48145
  const left = await quiet();
48137
48146
  if (left !== void 0) return { unit: manager, running: left };
48138
- updateInstallFile(installFile(), { service: {} });
48147
+ updateInstallFile(installFile2(), { service: {} });
48139
48148
  return { unit: manager };
48140
48149
  },
48141
48150
  async checkNode() {
@@ -48163,11 +48172,11 @@ function systemService(d) {
48163
48172
  nodeOf(home2()),
48164
48173
  installCli(home2(), d.source(), launcherNode())
48165
48174
  ];
48166
- updateInstallFile(installFile(), { cli: argv });
48175
+ updateInstallFile(installFile2(), { cli: argv });
48167
48176
  return argv;
48168
48177
  },
48169
48178
  argv() {
48170
- const r = readInstallFile(installFile()).cli;
48179
+ const r = readInstallFile(installFile2()).cli;
48171
48180
  return Array.isArray(r) && r.length === 2 && r.every((x) => typeof x === "string") ? r : [nodeOf(home2()), entryOf()];
48172
48181
  },
48173
48182
  env() {
@@ -48193,7 +48202,7 @@ var noService = {
48193
48202
  remove: async () => ({}),
48194
48203
  cli: () => ["oa-bus"]
48195
48204
  };
48196
- var VERSION = true ? "0.150.0" : JSON.parse(
48205
+ var VERSION = true ? "0.151.0" : JSON.parse(
48197
48206
  readFileSync14(new URL("../package.json", import.meta.url), "utf8")
48198
48207
  ).version;
48199
48208
  var which = (cmd) => {
@@ -50951,6 +50960,7 @@ var OPENCLAW_MARKER = ".oa-bus-managed";
50951
50960
  var OPENCLAW_HABITS_MARKER = "habits.on";
50952
50961
  var OPENCLAW_NIX = "OpenClaw is in Nix mode (OPENCLAW_NIX_MODE=1), which turns off plugin commands; left it alone";
50953
50962
  var OPENCLAW_NO_CLI = "no openclaw binary found; its config may still list oa-bus";
50963
+ var OPENCLAW_STRAY_NOTE = (reason2) => `Couldn't remove oa-bus from OpenClaw's config: its plugin folder is gone, and \`openclaw plugins uninstall oa-bus\` failed (${reason2}). Run that command yourself to finish.`;
50954
50964
  var INSTALL_TIMEOUT_MS = 18e4;
50955
50965
  var ENABLE_TIMEOUT_MS = 6e4;
50956
50966
  var INSPECT_TIMEOUT_MS = 3e4;
@@ -51037,6 +51047,20 @@ function openclawPluginState(dir, shipped) {
51037
51047
  return "stale";
51038
51048
  }
51039
51049
  }
51050
+ var installFile = (deps2) => join24(deps2.busHome ?? join24(deps2.home, ".oa-bus"), "install.json");
51051
+ var recordedStateDir = (deps2) => {
51052
+ const r = readInstallFile(installFile(deps2)).openclaw;
51053
+ const d = r?.stateDir;
51054
+ return typeof d === "string" ? d : void 0;
51055
+ };
51056
+ var thisStateDir = (deps2) => openclawStateDir(deps2.home, deps2.env ?? {});
51057
+ var forgetInstall = (deps2) => {
51058
+ if (recordedStateDir(deps2) === thisStateDir(deps2))
51059
+ updateInstallFile(installFile(deps2), { openclaw: {} });
51060
+ };
51061
+ var rememberInstall = (deps2) => updateInstallFile(installFile(deps2), {
51062
+ openclaw: { stateDir: thisStateDir(deps2) }
51063
+ });
51040
51064
  var exec2 = async (deps2, args, timeoutMs = ENABLE_TIMEOUT_MS) => {
51041
51065
  try {
51042
51066
  return await deps2.exec("openclaw", args, {
@@ -51114,6 +51138,7 @@ async function installOpenclaw(deps2, notes, optedOut) {
51114
51138
  if (optedOut && kind2(dest) === "dir") rmSync9(habitsFile, { force: true });
51115
51139
  };
51116
51140
  if (state === "current") {
51141
+ rememberInstall(deps2);
51117
51142
  dropHabitsIfOptedOut();
51118
51143
  if (await openclawVerify(deps2) === void 0) return "done";
51119
51144
  } else {
@@ -51145,6 +51170,7 @@ async function installOpenclaw(deps2, notes, optedOut) {
51145
51170
  `managed by the Open Artifacts bus installer: edits are replaced on reinstall. ${pluginHash(shipped)}
51146
51171
  `
51147
51172
  );
51173
+ rememberInstall(deps2);
51148
51174
  rmSync9(habitsFile, { force: true });
51149
51175
  restore();
51150
51176
  }
@@ -51163,9 +51189,22 @@ async function installOpenclaw(deps2, notes, optedOut) {
51163
51189
  async function uninstallOpenclaw(deps2, notes) {
51164
51190
  const dest = openclawPluginDir(deps2.home, deps2.env ?? {});
51165
51191
  const state = openclawPluginState(dest, deps2.assets.openclaw);
51166
- if (state === "absent") return "none";
51167
51192
  if (state === "foreign")
51168
51193
  throw new Error(`${dest} is not Open Artifacts bus's; left it untouched`);
51194
+ if (state === "absent") {
51195
+ if (recordedStateDir(deps2) !== thisStateDir(deps2) || openclawNix(deps2.env) || !deps2.which("openclaw"))
51196
+ return "none";
51197
+ const r = await exec2(deps2, [
51198
+ "plugins",
51199
+ "uninstall",
51200
+ "--force",
51201
+ OPENCLAW_PLUGIN_ID
51202
+ ]);
51203
+ forgetInstall(deps2);
51204
+ if (r.code === 0) return "done";
51205
+ notes.push(OPENCLAW_STRAY_NOTE(why(r)));
51206
+ return "none";
51207
+ }
51169
51208
  if (openclawNix(deps2.env)) {
51170
51209
  notes.push(OPENCLAW_NIX);
51171
51210
  return "none";
@@ -51183,6 +51222,7 @@ async function uninstallOpenclaw(deps2, notes) {
51183
51222
  );
51184
51223
  } else notes.push(OPENCLAW_NO_CLI);
51185
51224
  rmSync9(dest, { recursive: true, force: true });
51225
+ forgetInstall(deps2);
51186
51226
  return "done";
51187
51227
  }
51188
51228
  var OPENCLAW_PLUGIN = (() => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@open-artifacts/bus",
3
3
  "type": "module",
4
- "version": "0.150.0",
4
+ "version": "0.151.0",
5
5
  "description": "The Open Artifacts bus: your AI agents reach each other across machines.",
6
6
  "license": "MIT",
7
7
  "repository": {