@open-artifacts/bus 0.132.1 → 0.133.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/dist/index.js CHANGED
@@ -4586,7 +4586,7 @@ function isRef(value) {
4586
4586
  function cloneIssues(issues) {
4587
4587
  return issues.map((iss) => iss.path ? { ...iss, path: iss.path.slice() } : { ...iss });
4588
4588
  }
4589
- function isRecursive(inst, stack, resolve10) {
4589
+ function isRecursive(inst, stack, resolve11) {
4590
4590
  const cached2 = recursive.get(inst);
4591
4591
  if (cached2 !== void 0)
4592
4592
  return cached2 ? PROVEN : NONE;
@@ -4596,7 +4596,7 @@ function isRecursive(inst, stack, resolve10) {
4596
4596
  let result = NONE;
4597
4597
  const check2 = (child) => {
4598
4598
  if (result !== PROVEN && child?._zod) {
4599
- const answer = isRecursive(child, stack, resolve10);
4599
+ const answer = isRecursive(child, stack, resolve11);
4600
4600
  if (answer > result)
4601
4601
  result = answer;
4602
4602
  }
@@ -4607,7 +4607,7 @@ function isRecursive(inst, stack, resolve10) {
4607
4607
  const desc = Object.getOwnPropertyDescriptor(sh, key2);
4608
4608
  if (spread && !desc.enumerable)
4609
4609
  continue;
4610
- const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve10) : NONE;
4610
+ const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve11) : NONE;
4611
4611
  if (child > answer)
4612
4612
  answer = child;
4613
4613
  }
@@ -4618,8 +4618,8 @@ function isRecursive(inst, stack, resolve10) {
4618
4618
  result = answer;
4619
4619
  };
4620
4620
  const def = inst._zod.def;
4621
- const kind2 = def.type;
4622
- switch (kind2) {
4621
+ const kind3 = def.type;
4622
+ switch (kind3) {
4623
4623
  case "object": {
4624
4624
  const raw = rawShape(def);
4625
4625
  merge2(raw ? shape(raw, true) : ASSUMED);
@@ -4671,7 +4671,7 @@ function isRecursive(inst, stack, resolve10) {
4671
4671
  break;
4672
4672
  // `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
4673
4673
  case "lazy": {
4674
- const inner = def._cachedInner ?? (resolve10 ? inst._zod.innerType : void 0);
4674
+ const inner = def._cachedInner ?? (resolve11 ? inst._zod.innerType : void 0);
4675
4675
  merge2(inner ? isRecursive(inner, stack, false) : ASSUMED);
4676
4676
  break;
4677
4677
  }
@@ -4699,7 +4699,7 @@ function isRecursive(inst, stack, resolve10) {
4699
4699
  case "custom":
4700
4700
  break;
4701
4701
  default: {
4702
- kind2;
4702
+ kind3;
4703
4703
  for (const key2 in def) {
4704
4704
  const desc = Object.getOwnPropertyDescriptor(def, key2);
4705
4705
  if (!desc || desc.get)
@@ -17384,8 +17384,8 @@ function visit(schema, fnOrHandlers) {
17384
17384
  }
17385
17385
  function mapInner(s) {
17386
17386
  const def = s._zod.def;
17387
- const kind2 = def.type;
17388
- switch (kind2) {
17387
+ const kind3 = def.type;
17388
+ switch (kind3) {
17389
17389
  case "object": {
17390
17390
  const oldShape = def.shape;
17391
17391
  const keys = Object.keys(oldShape);
@@ -17505,7 +17505,7 @@ function visit(schema, fnOrHandlers) {
17505
17505
  case "custom":
17506
17506
  return s;
17507
17507
  default: {
17508
- kind2;
17508
+ kind3;
17509
17509
  return s;
17510
17510
  }
17511
17511
  }
@@ -23038,7 +23038,7 @@ var init_protocol = __esm({
23038
23038
  return;
23039
23039
  }
23040
23040
  const pollInterval = task2.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1e3;
23041
- await new Promise((resolve10) => setTimeout(resolve10, pollInterval));
23041
+ await new Promise((resolve11) => setTimeout(resolve11, pollInterval));
23042
23042
  options?.signal?.throwIfAborted();
23043
23043
  }
23044
23044
  } catch (error62) {
@@ -23055,7 +23055,7 @@ var init_protocol = __esm({
23055
23055
  */
23056
23056
  request(request, resultSchema, options) {
23057
23057
  const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {};
23058
- return new Promise((resolve10, reject) => {
23058
+ return new Promise((resolve11, reject) => {
23059
23059
  const earlyReject = (error62) => {
23060
23060
  reject(error62);
23061
23061
  };
@@ -23133,7 +23133,7 @@ var init_protocol = __esm({
23133
23133
  if (!parseResult.success) {
23134
23134
  reject(parseResult.error);
23135
23135
  } else {
23136
- resolve10(parseResult.data);
23136
+ resolve11(parseResult.data);
23137
23137
  }
23138
23138
  } catch (error62) {
23139
23139
  reject(error62);
@@ -23395,12 +23395,12 @@ var init_protocol = __esm({
23395
23395
  }
23396
23396
  } catch {
23397
23397
  }
23398
- return new Promise((resolve10, reject) => {
23398
+ return new Promise((resolve11, reject) => {
23399
23399
  if (signal.aborted) {
23400
23400
  reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
23401
23401
  return;
23402
23402
  }
23403
- const timeoutId = setTimeout(resolve10, interval);
23403
+ const timeoutId = setTimeout(resolve11, interval);
23404
23404
  signal.addEventListener("abort", () => {
23405
23405
  clearTimeout(timeoutId);
23406
23406
  reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
@@ -26427,7 +26427,7 @@ var require_compile = __commonJS({
26427
26427
  const schOrFunc = root.refs[ref];
26428
26428
  if (schOrFunc)
26429
26429
  return schOrFunc;
26430
- let _sch = resolve10.call(this, root, ref);
26430
+ let _sch = resolve11.call(this, root, ref);
26431
26431
  if (_sch === void 0) {
26432
26432
  const schema = (_a3 = root.localRefs) === null || _a3 === void 0 ? void 0 : _a3[ref];
26433
26433
  const { schemaId } = this.opts;
@@ -26454,7 +26454,7 @@ var require_compile = __commonJS({
26454
26454
  function sameSchemaEnv(s1, s2) {
26455
26455
  return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
26456
26456
  }
26457
- function resolve10(root, ref) {
26457
+ function resolve11(root, ref) {
26458
26458
  let sch;
26459
26459
  while (typeof (sch = this.refs[ref]) == "string")
26460
26460
  ref = sch;
@@ -27284,7 +27284,7 @@ var require_fast_uri = __commonJS({
27284
27284
  }
27285
27285
  return uri;
27286
27286
  }
27287
- function resolve10(baseURI, relativeURI, options) {
27287
+ function resolve11(baseURI, relativeURI, options) {
27288
27288
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
27289
27289
  const {
27290
27290
  parsed: baseParsed,
@@ -27317,49 +27317,49 @@ var require_fast_uri = __commonJS({
27317
27317
  schemelessOptions.skipEscape = true;
27318
27318
  return serialize(resolved, schemelessOptions);
27319
27319
  }
27320
- function resolveComponent(base3, relative, options, skipNormalization) {
27320
+ function resolveComponent(base3, relative2, options, skipNormalization) {
27321
27321
  const target2 = {};
27322
27322
  if (!skipNormalization) {
27323
27323
  base3 = parse8(serialize(base3, options), options);
27324
- relative = parse8(serialize(relative, options), options);
27324
+ relative2 = parse8(serialize(relative2, options), options);
27325
27325
  }
27326
27326
  options = options || {};
27327
- if (!options.tolerant && relative.scheme) {
27328
- target2.scheme = relative.scheme;
27329
- target2.userinfo = relative.userinfo;
27330
- target2.host = relative.host;
27331
- target2.port = relative.port;
27332
- target2.path = removeDotSegments(relative.path || "");
27333
- target2.query = relative.query;
27327
+ if (!options.tolerant && relative2.scheme) {
27328
+ target2.scheme = relative2.scheme;
27329
+ target2.userinfo = relative2.userinfo;
27330
+ target2.host = relative2.host;
27331
+ target2.port = relative2.port;
27332
+ target2.path = removeDotSegments(relative2.path || "");
27333
+ target2.query = relative2.query;
27334
27334
  } else {
27335
- if (relative.userinfo !== void 0 || relative.host !== void 0 || relative.port !== void 0) {
27336
- target2.userinfo = relative.userinfo;
27337
- target2.host = relative.host;
27338
- target2.port = relative.port;
27339
- target2.path = removeDotSegments(relative.path || "");
27340
- target2.query = relative.query;
27335
+ if (relative2.userinfo !== void 0 || relative2.host !== void 0 || relative2.port !== void 0) {
27336
+ target2.userinfo = relative2.userinfo;
27337
+ target2.host = relative2.host;
27338
+ target2.port = relative2.port;
27339
+ target2.path = removeDotSegments(relative2.path || "");
27340
+ target2.query = relative2.query;
27341
27341
  } else {
27342
- if (!relative.path) {
27342
+ if (!relative2.path) {
27343
27343
  target2.path = base3.path;
27344
- if (relative.query !== void 0) {
27345
- target2.query = relative.query;
27344
+ if (relative2.query !== void 0) {
27345
+ target2.query = relative2.query;
27346
27346
  } else {
27347
27347
  target2.query = base3.query;
27348
27348
  }
27349
27349
  } else {
27350
- if (relative.path[0] === "/") {
27351
- target2.path = removeDotSegments(relative.path);
27350
+ if (relative2.path[0] === "/") {
27351
+ target2.path = removeDotSegments(relative2.path);
27352
27352
  } else {
27353
27353
  if ((base3.userinfo !== void 0 || base3.host !== void 0 || base3.port !== void 0) && !base3.path) {
27354
- target2.path = "/" + relative.path;
27354
+ target2.path = "/" + relative2.path;
27355
27355
  } else if (!base3.path) {
27356
- target2.path = relative.path;
27356
+ target2.path = relative2.path;
27357
27357
  } else {
27358
- target2.path = base3.path.slice(0, base3.path.lastIndexOf("/") + 1) + relative.path;
27358
+ target2.path = base3.path.slice(0, base3.path.lastIndexOf("/") + 1) + relative2.path;
27359
27359
  }
27360
27360
  target2.path = removeDotSegments(target2.path);
27361
27361
  }
27362
- target2.query = relative.query;
27362
+ target2.query = relative2.query;
27363
27363
  }
27364
27364
  target2.userinfo = base3.userinfo;
27365
27365
  target2.host = base3.host;
@@ -27367,7 +27367,7 @@ var require_fast_uri = __commonJS({
27367
27367
  }
27368
27368
  target2.scheme = base3.scheme;
27369
27369
  }
27370
- target2.fragment = relative.fragment;
27370
+ target2.fragment = relative2.fragment;
27371
27371
  return target2;
27372
27372
  }
27373
27373
  function equal(uriA, uriB, options) {
@@ -27653,7 +27653,7 @@ var require_fast_uri = __commonJS({
27653
27653
  var fastUri = {
27654
27654
  SCHEMES,
27655
27655
  normalize,
27656
- resolve: resolve10,
27656
+ resolve: resolve11,
27657
27657
  resolveComponent,
27658
27658
  equal,
27659
27659
  serialize,
@@ -31798,6 +31798,7 @@ var init_kinds = __esm({
31798
31798
  "opencode",
31799
31799
  "pi",
31800
31800
  "omp",
31801
+ "hermes",
31801
31802
  "codex"
31802
31803
  ];
31803
31804
  AgentKindSchema = external_exports.enum(AGENT_KINDS);
@@ -32426,7 +32427,7 @@ var init_frames = __esm({
32426
32427
  late = { late: external_exports.array(external_exports.string().min(1)).optional() };
32427
32428
  isWellFormed2 = (s) => s.isWellFormed();
32428
32429
  WELL_FORMED = { message: "text is not well-formed unicode" };
32429
- CLIENT_VERSION = true ? "0.132.1" : "0.0.0";
32430
+ CLIENT_VERSION = true ? "0.133.0" : "0.0.0";
32430
32431
  clientVersion = {
32431
32432
  client_version: external_exports.string().min(1).max(64).optional()
32432
32433
  };
@@ -32760,8 +32761,8 @@ var init_lines = __esm({
32760
32761
  import { connect } from "node:net";
32761
32762
  async function connectDaemon(opts) {
32762
32763
  const sock = connect(opts.path);
32763
- await new Promise((resolve10, reject) => {
32764
- sock.once("connect", resolve10);
32764
+ await new Promise((resolve11, reject) => {
32765
+ sock.once("connect", resolve11);
32765
32766
  sock.once("error", reject);
32766
32767
  });
32767
32768
  const decoder = new LineDecoder();
@@ -32821,8 +32822,8 @@ async function connectDaemon(opts) {
32821
32822
  sock.on("error", (e) => failAll(e));
32822
32823
  sock.on("close", () => failAll(new Error("daemon connection closed")));
32823
32824
  let timer;
32824
- const welcomeRaw = await new Promise((resolve10, reject) => {
32825
- waiters.push({ resolve: resolve10, reject });
32825
+ const welcomeRaw = await new Promise((resolve11, reject) => {
32826
+ waiters.push({ resolve: resolve11, reject });
32826
32827
  timer = setTimeout(() => {
32827
32828
  reject(new Error("daemon did not answer hello"));
32828
32829
  sock.destroy();
@@ -32844,7 +32845,7 @@ async function connectDaemon(opts) {
32844
32845
  if (state === "closed")
32845
32846
  return Promise.reject(new Error("daemon connection closed"));
32846
32847
  const id = partial2.id ?? String(++seq2);
32847
- return new Promise((resolve10, reject) => {
32848
+ return new Promise((resolve11, reject) => {
32848
32849
  const ms = opts.requestTimeoutMs ?? 2e4;
32849
32850
  const timer2 = setTimeout(() => {
32850
32851
  if (pending.delete(id))
@@ -32859,7 +32860,7 @@ async function connectDaemon(opts) {
32859
32860
  clearTimeout(timer2);
32860
32861
  f(...a);
32861
32862
  };
32862
- pending.set(id, { resolve: done(resolve10), reject: done(reject) });
32863
+ pending.set(id, { resolve: done(resolve11), reject: done(reject) });
32863
32864
  sock.write(`${JSON.stringify({ v: 1, ...partial2, id })}
32864
32865
  `);
32865
32866
  });
@@ -32883,7 +32884,7 @@ async function connectDaemon(opts) {
32883
32884
  };
32884
32885
  }
32885
32886
  function daemonStatus(opts) {
32886
- return new Promise((resolve10, reject) => {
32887
+ return new Promise((resolve11, reject) => {
32887
32888
  const sock = connect(opts.path);
32888
32889
  const decoder = new LineDecoder();
32889
32890
  const done = (f) => {
@@ -32920,7 +32921,7 @@ function daemonStatus(opts) {
32920
32921
  try {
32921
32922
  for (const raw of decoder.push(chunk)) {
32922
32923
  const f = DaemonFrame.parse(raw);
32923
- if (f.type === "status") return done(() => resolve10(f));
32924
+ if (f.type === "status") return done(() => resolve11(f));
32924
32925
  if (f.type === "error")
32925
32926
  return done(
32926
32927
  () => reject(
@@ -33184,8 +33185,8 @@ ${own2}` : `${head},
33184
33185
  CUT_OFF = " [control sequence removed]";
33185
33186
  stripTerminalControls = (text3) => text3.replace(TERMINAL_CONTROLS, (seq2) => cutOff(seq2) ? CUT_OFF : "");
33186
33187
  KIND_CHARS = 32;
33187
- displayKind = (kind2) => [
33188
- ...stripTerminalControls(kind2).replace(INVISIBLES, "").replace(/\s+/g, " ").trim()
33188
+ displayKind = (kind3) => [
33189
+ ...stripTerminalControls(kind3).replace(INVISIBLES, "").replace(/\s+/g, " ").trim()
33189
33190
  ].slice(0, KIND_CHARS).join("") || "unknown";
33190
33191
  neutralizeBody = (body) => body.replace(
33191
33192
  new RegExp("^((?:[^\\S\\n\\r\\u2028\\u2029]|\\p{Cf}|[\\u115f\\u1160\\u2800\\u3164\\uffa0])*)(?=\\[oa-bus\\])", "gimu"),
@@ -33249,13 +33250,13 @@ async function clearStale(path) {
33249
33250
  code: "ENOTSOCK"
33250
33251
  });
33251
33252
  }
33252
- const live = await new Promise((resolve10) => {
33253
+ const live = await new Promise((resolve11) => {
33253
33254
  const probe = connect2(path);
33254
33255
  probe.once("connect", () => {
33255
33256
  probe.destroy();
33256
- resolve10(true);
33257
+ resolve11(true);
33257
33258
  });
33258
- probe.once("error", () => resolve10(false));
33259
+ probe.once("error", () => resolve11(false));
33259
33260
  });
33260
33261
  if (live) {
33261
33262
  throw Object.assign(new Error(`daemon already listening on ${path}`), {
@@ -33275,16 +33276,16 @@ async function serveDaemon(opts) {
33275
33276
  sock.once("close", () => sockets.delete(sock));
33276
33277
  handle(sock, opts);
33277
33278
  });
33278
- await new Promise((resolve10, reject) => {
33279
+ await new Promise((resolve11, reject) => {
33279
33280
  server4.once("error", reject);
33280
- server4.listen(opts.path, () => resolve10());
33281
+ server4.listen(opts.path, () => resolve11());
33281
33282
  });
33282
33283
  chmodSync(opts.path, 384);
33283
33284
  const st = statSync(opts.path);
33284
33285
  const mode = st.mode & 511;
33285
33286
  return {
33286
33287
  mode,
33287
- close: () => new Promise((resolve10) => {
33288
+ close: () => new Promise((resolve11) => {
33288
33289
  for (const s of sockets) s.destroy();
33289
33290
  let parked;
33290
33291
  try {
@@ -33302,7 +33303,7 @@ async function serveDaemon(opts) {
33302
33303
  } catch {
33303
33304
  }
33304
33305
  }
33305
- resolve10();
33306
+ resolve11();
33306
33307
  });
33307
33308
  })
33308
33309
  };
@@ -33909,7 +33910,7 @@ ${neutralize(a.text)}
33909
33910
  };
33910
33911
  }
33911
33912
  function inject(a) {
33912
- return new Promise((resolve10, reject) => {
33913
+ return new Promise((resolve11, reject) => {
33913
33914
  const sock = connect3(a.socketPath);
33914
33915
  let connected = false;
33915
33916
  const fail = (e) => {
@@ -33933,7 +33934,7 @@ function inject(a) {
33933
33934
  sock.once("finish", () => {
33934
33935
  clearTimeout(timer);
33935
33936
  sock.destroy();
33936
- resolve10();
33937
+ resolve11();
33937
33938
  });
33938
33939
  sock.end(`${JSON.stringify(frameOf(a))}
33939
33940
  `);
@@ -36430,7 +36431,7 @@ var require_websocket = __commonJS({
36430
36431
  var http = __require("http");
36431
36432
  var net = __require("net");
36432
36433
  var tls = __require("tls");
36433
- var { randomBytes: randomBytes5, createHash: createHash6 } = __require("crypto");
36434
+ var { randomBytes: randomBytes6, createHash: createHash7 } = __require("crypto");
36434
36435
  var { Duplex, Readable } = __require("stream");
36435
36436
  var { URL: URL2 } = __require("url");
36436
36437
  var PerMessageDeflate2 = require_permessage_deflate();
@@ -36968,7 +36969,7 @@ var require_websocket = __commonJS({
36968
36969
  }
36969
36970
  }
36970
36971
  const defaultPort = isSecure ? 443 : 80;
36971
- const key2 = randomBytes5(16).toString("base64");
36972
+ const key2 = randomBytes6(16).toString("base64");
36972
36973
  const request = isSecure ? https.request : http.request;
36973
36974
  const protocolSet = /* @__PURE__ */ new Set();
36974
36975
  let perMessageDeflate;
@@ -37098,7 +37099,7 @@ var require_websocket = __commonJS({
37098
37099
  abortHandshake(websocket, socket, "Invalid Upgrade header");
37099
37100
  return;
37100
37101
  }
37101
- const digest = createHash6("sha1").update(key2 + GUID).digest("base64");
37102
+ const digest = createHash7("sha1").update(key2 + GUID).digest("base64");
37102
37103
  if (res.headers["sec-websocket-accept"] !== digest) {
37103
37104
  abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
37104
37105
  return;
@@ -37467,7 +37468,7 @@ var require_websocket_server = __commonJS({
37467
37468
  var EventEmitter = __require("events");
37468
37469
  var http = __require("http");
37469
37470
  var { Duplex } = __require("stream");
37470
- var { createHash: createHash6 } = __require("crypto");
37471
+ var { createHash: createHash7 } = __require("crypto");
37471
37472
  var extension2 = require_extension();
37472
37473
  var PerMessageDeflate2 = require_permessage_deflate();
37473
37474
  var subprotocol2 = require_subprotocol();
@@ -37774,7 +37775,7 @@ var require_websocket_server = __commonJS({
37774
37775
  );
37775
37776
  }
37776
37777
  if (this._state > RUNNING) return abortHandshake(socket, 503);
37777
- const digest = createHash6("sha1").update(key2 + GUID).digest("base64");
37778
+ const digest = createHash7("sha1").update(key2 + GUID).digest("base64");
37778
37779
  const headers = [
37779
37780
  "HTTP/1.1 101 Switching Protocols",
37780
37781
  "Upgrade: websocket",
@@ -38086,12 +38087,12 @@ var init_stdio2 = __esm({
38086
38087
  this.onclose?.();
38087
38088
  }
38088
38089
  send(message) {
38089
- return new Promise((resolve10) => {
38090
+ return new Promise((resolve11) => {
38090
38091
  const json3 = serializeMessage(message);
38091
38092
  if (this._stdout.write(json3)) {
38092
- resolve10();
38093
+ resolve11();
38093
38094
  } else {
38094
- this._stdout.once("drain", resolve10);
38095
+ this._stdout.once("drain", resolve11);
38095
38096
  }
38096
38097
  });
38097
38098
  }
@@ -38253,6 +38254,12 @@ var harnessSkills = {
38253
38254
  },
38254
38255
  omp: {
38255
38256
  skillPath: "~/.agents/skills/open-artifacts/SKILL.md"
38257
+ },
38258
+ // The plugin's tools carry an `oabus_` prefix (packages/bus-adapter-hermes/assets/oa_bus/tools.py).
38259
+ // The path is under HERMES_HOME when that is set; the installer resolves it.
38260
+ hermes: {
38261
+ skillPath: "~/.hermes/skills/open-artifacts/SKILL.md",
38262
+ busToolName: (tool) => `oabus_${tool}`
38256
38263
  }
38257
38264
  };
38258
38265
 
@@ -38260,7 +38267,7 @@ var harnessSkills = {
38260
38267
  var harnessNames = Object.keys(harnessSkills);
38261
38268
 
38262
38269
  // src/main.ts
38263
- import { resolve as resolve9 } from "node:path";
38270
+ import { resolve as resolve10 } from "node:path";
38264
38271
 
38265
38272
  // src/commands/daemon.ts
38266
38273
  import { existsSync as existsSync4 } from "node:fs";
@@ -38280,9 +38287,9 @@ function parseOpencodeVersion(out) {
38280
38287
  const first = out.replace(ANSI, "").split(/\r?\n/).map((l) => l.trim()).find((l) => l !== "");
38281
38288
  return OWN.exec(first ?? "")?.[1];
38282
38289
  }
38283
- async function opencodeVersion(exec) {
38290
+ async function opencodeVersion(exec2) {
38284
38291
  try {
38285
- const r = await exec("opencode", ["--version"]);
38292
+ const r = await exec2("opencode", ["--version"]);
38286
38293
  if (r.code !== 0) return void 0;
38287
38294
  return parseOpencodeVersion(r.stdout) ?? parseOpencodeVersion(r.stderr);
38288
38295
  } catch {
@@ -39003,10 +39010,10 @@ function holdingFiles(pairs) {
39003
39010
  return void 0;
39004
39011
  }
39005
39012
  };
39006
- const files = [...new Set(pairs.map((p) => p.file))];
39013
+ const files2 = [...new Set(pairs.map((p) => p.file))];
39007
39014
  let out;
39008
39015
  try {
39009
- out = execFileSync2(systemTool("lsof"), ["-F", "pn", ...files], {
39016
+ out = execFileSync2(systemTool("lsof"), ["-F", "pn", ...files2], {
39010
39017
  encoding: "utf8",
39011
39018
  stdio: ["ignore", "pipe", "ignore"],
39012
39019
  // It blocks the daemon, and the adapter waits 5 s for its hello.
@@ -39172,18 +39179,19 @@ function attest(hello, deps = {}) {
39172
39179
  return attestClaude(hello, deps);
39173
39180
  case "opencode":
39174
39181
  return attestOpenCode(hello, deps);
39175
- // omp runs under bun, so comm is never read: the start time is the check.
39182
+ // omp runs under bun and Hermes under python, so comm is never read: the start time is the check.
39176
39183
  case "pi":
39177
- case "omp": {
39178
- const kind2 = hello.kind;
39184
+ case "omp":
39185
+ case "hermes": {
39186
+ const kind3 = hello.kind;
39179
39187
  if (!hello.attest.proc_start) {
39180
- return { ok: false, reason: `${kind2} hello has no proc_start` };
39188
+ return { ok: false, reason: `${kind3} hello has no proc_start` };
39181
39189
  }
39182
39190
  const start = (deps.procStart ?? procStartOf)(hello.pid);
39183
39191
  if (!start)
39184
- return { ok: false, reason: `${kind2} process is not running` };
39192
+ return { ok: false, reason: `${kind3} process is not running` };
39185
39193
  if (hello.attest.proc_start !== start) {
39186
- return { ok: false, reason: `${kind2} process start time moved` };
39194
+ return { ok: false, reason: `${kind3} process start time moved` };
39187
39195
  }
39188
39196
  return { ok: true };
39189
39197
  }
@@ -40805,7 +40813,7 @@ function routeLocal(frame, hello, reply, ctx) {
40805
40813
  const ref = agent.ref;
40806
40814
  switch (frame.type) {
40807
40815
  case "self": {
40808
- const files = frame.row ? ctx.configFiles?.(
40816
+ const files2 = frame.row ? ctx.configFiles?.(
40809
40817
  agent.cwd,
40810
40818
  hello.caps?.includes(ADAPTER_CAPS.pending)
40811
40819
  ) ?? [] : [];
@@ -40817,7 +40825,7 @@ function routeLocal(frame, hello, reply, ctx) {
40817
40825
  kind: agent.kind,
40818
40826
  live: agent.live,
40819
40827
  global: agent.global,
40820
- ...files.length > 0 ? { config_files: files } : {}
40828
+ ...files2.length > 0 ? { config_files: files2 } : {}
40821
40829
  }
40822
40830
  };
40823
40831
  const own2 = frame.row ? ctx.ownRow?.(ref) : void 0;
@@ -41242,12 +41250,12 @@ var Receipts = class {
41242
41250
  this.#waiting.delete(msgId);
41243
41251
  return Promise.resolve(w.final);
41244
41252
  }
41245
- return new Promise((resolve10) => {
41253
+ return new Promise((resolve11) => {
41246
41254
  const cancel = this.#after(ms, () => w.done?.(void 0));
41247
41255
  w.done = (f) => {
41248
41256
  cancel();
41249
41257
  this.#waiting.delete(msgId);
41250
- resolve10(f);
41258
+ resolve11(f);
41251
41259
  };
41252
41260
  });
41253
41261
  }
@@ -41556,22 +41564,22 @@ var ClaudeTransport = class {
41556
41564
  return { ok: false, reason: "closed", cause: st };
41557
41565
  }
41558
41566
  #waitFor(msgId, ms) {
41559
- return new Promise((resolve10) => {
41567
+ return new Promise((resolve11) => {
41560
41568
  const buffered = this.#buffered.get(msgId);
41561
41569
  if (buffered !== void 0) {
41562
41570
  this.#buffered.delete(msgId);
41563
- resolve10(buffered);
41571
+ resolve11(buffered);
41564
41572
  return;
41565
41573
  }
41566
41574
  const timer = setTimeout(() => {
41567
41575
  this.#waiting.delete(msgId);
41568
- resolve10(void 0);
41576
+ resolve11(void 0);
41569
41577
  }, ms);
41570
41578
  timer.unref();
41571
41579
  this.#waiting.set(msgId, (s) => {
41572
41580
  clearTimeout(timer);
41573
41581
  this.#waiting.delete(msgId);
41574
- resolve10(s);
41582
+ resolve11(s);
41575
41583
  });
41576
41584
  });
41577
41585
  }
@@ -41711,9 +41719,9 @@ var ClaudeTransport = class {
41711
41719
  );
41712
41720
  })
41713
41721
  };
41714
- await new Promise((resolve10, reject) => {
41722
+ await new Promise((resolve11, reject) => {
41715
41723
  sink.server.once("error", reject);
41716
- sink.server.listen(path, () => resolve10());
41724
+ sink.server.listen(path, () => resolve11());
41717
41725
  });
41718
41726
  chmodSync7(path, 384);
41719
41727
  return sink;
@@ -41932,7 +41940,7 @@ function splitArgv0(args) {
41932
41940
  });
41933
41941
  return words(args.slice(real2 ?? ends[0]));
41934
41942
  }
41935
- var execText = (cmd, args) => new Promise((resolve10) => {
41943
+ var execText = (cmd, args) => new Promise((resolve11) => {
41936
41944
  execFile(
41937
41945
  cmd,
41938
41946
  args,
@@ -41941,7 +41949,7 @@ var execText = (cmd, args) => new Promise((resolve10) => {
41941
41949
  timeout: 2e3,
41942
41950
  env: { ...process.env, LC_ALL: "C" }
41943
41951
  },
41944
- (err, stdout) => resolve10(err ? void 0 : stdout)
41952
+ (err, stdout) => resolve11(err ? void 0 : stdout)
41945
41953
  );
41946
41954
  });
41947
41955
  async function processArgs(pid) {
@@ -41964,17 +41972,17 @@ async function processArgs(pid) {
41964
41972
  return args ? splitArgv0(args) : void 0;
41965
41973
  }
41966
41974
  var START_ERRORS = /* @__PURE__ */ new Set(["ENOENT", "EACCES", "ENOEXEC"]);
41967
- var execCodex = (timeoutMs = CODEX_QUEUE_TIMEOUT_MS) => (bin, args, env2) => new Promise((resolve10, reject) => {
41975
+ var execCodex = (timeoutMs = CODEX_QUEUE_TIMEOUT_MS) => (bin, args, env2) => new Promise((resolve11, reject) => {
41968
41976
  execFile(
41969
41977
  bin,
41970
41978
  args,
41971
41979
  { timeout: timeoutMs, maxBuffer: 64 * 1024, env: env2 },
41972
41980
  (err, _stdout, stderr) => {
41973
- if (!err) return resolve10({ code: 0, stderr });
41981
+ if (!err) return resolve11({ code: 0, stderr });
41974
41982
  const e = err;
41975
41983
  if (typeof e.code === "string" && START_ERRORS.has(e.code))
41976
41984
  return reject(err);
41977
- resolve10({
41985
+ resolve11({
41978
41986
  // A maxBuffer kill is SIGTERM too, but carries its own string code.
41979
41987
  code: e.killed && e.signal === "SIGTERM" && typeof e.code !== "string" ? null : typeof e.code === "number" ? e.code : -1,
41980
41988
  stderr: String(stderr ?? "")
@@ -42099,17 +42107,17 @@ var codexHostWakes = async (pid) => {
42099
42107
  init_src2();
42100
42108
  import { execFile as execFile2 } from "node:child_process";
42101
42109
  var START_ERRORS2 = /* @__PURE__ */ new Set(["ENOENT", "EACCES"]);
42102
- var execSpawn = (timeoutMs, maxBuffer = 1024 * 1024) => (cmd, args) => new Promise((resolve10, reject) => {
42110
+ var execSpawn = (timeoutMs, maxBuffer = 1024 * 1024) => (cmd, args) => new Promise((resolve11, reject) => {
42103
42111
  execFile2(
42104
42112
  cmd,
42105
42113
  args,
42106
42114
  { timeout: timeoutMs, maxBuffer },
42107
42115
  (err, stdout, stderr) => {
42108
- if (!err) return resolve10({ code: 0, stdout, stderr });
42116
+ if (!err) return resolve11({ code: 0, stdout, stderr });
42109
42117
  const e = err;
42110
42118
  if (typeof e.code === "string" && START_ERRORS2.has(e.code))
42111
42119
  return reject(err);
42112
- resolve10({
42120
+ resolve11({
42113
42121
  code: e.killed || typeof e.code !== "number" ? null : e.code,
42114
42122
  stdout,
42115
42123
  stderr
@@ -42224,18 +42232,18 @@ var PiTransport = class {
42224
42232
  });
42225
42233
  if (!pushed) return { ok: false, reason: "closed" };
42226
42234
  this.#forget(mail.msg_id);
42227
- return new Promise((resolve10) => {
42235
+ return new Promise((resolve11) => {
42228
42236
  const timer = setTimeout(() => {
42229
42237
  this.#waiting.delete(mail.msg_id);
42230
42238
  this.#remember(mail.msg_id, agent.ref);
42231
- resolve10({ ok: false, reason: "timeout" });
42239
+ resolve11({ ok: false, reason: "timeout" });
42232
42240
  }, this.opts.ackTimeoutMs ?? 1e4);
42233
42241
  timer.unref();
42234
42242
  this.#waiting.set(mail.msg_id, {
42235
42243
  ref: agent.ref,
42236
42244
  done: (o) => {
42237
42245
  clearTimeout(timer);
42238
- resolve10(o);
42246
+ resolve11(o);
42239
42247
  }
42240
42248
  });
42241
42249
  });
@@ -42291,7 +42299,7 @@ var PiTransport = class {
42291
42299
  var NOTICE_RETRY_MS = 3e4;
42292
42300
  var LIMITED_RETRY_MS = 5 * 6e4;
42293
42301
  var LATE_WINDOW_MS = 60 * 6e4;
42294
- var piLike = (kind2) => kind2 === "pi" || kind2 === "omp";
42302
+ var piLike = (kind3) => kind3 === "pi" || kind3 === "omp" || kind3 === "hermes";
42295
42303
  async function runDaemon(deps = {}) {
42296
42304
  const cfg = deps.config ?? readConfig();
42297
42305
  const log = deps.log ?? ((msg) => console.error(`oa-bus: ${msg}`));
@@ -42331,14 +42339,14 @@ async function runDaemon(deps = {}) {
42331
42339
  const announceUp = (rec) => {
42332
42340
  if (rec.replaces !== void 0 && !hubHelloed) return false;
42333
42341
  const id = frameId();
42334
- const kind2 = rec.kind;
42335
- upIds.set(id, { ref: rec.ref, kind: kind2 });
42342
+ const kind3 = rec.kind;
42343
+ upIds.set(id, { ref: rec.ref, kind: kind3 });
42336
42344
  return hub.send({
42337
42345
  v: 1,
42338
42346
  id,
42339
42347
  type: "agent_up",
42340
42348
  agent_ref: rec.ref,
42341
- kind: kind2,
42349
+ kind: kind3,
42342
42350
  proposed_name: fitName(rec.proposedName, 64),
42343
42351
  namespace: rec.namespace,
42344
42352
  global: rec.global,
@@ -42508,6 +42516,7 @@ async function runDaemon(deps = {}) {
42508
42516
  opencode: (agent, text3, msgId) => opencode.notify(agent, text3, msgId),
42509
42517
  pi: (agent, text3, msgId) => pi.notify(agent, text3, msgId),
42510
42518
  omp: (agent, text3, msgId) => pi.notify(agent, text3, msgId),
42519
+ hermes: (agent, text3, msgId) => pi.notify(agent, text3, msgId),
42511
42520
  codex: (agent, text3, msgId) => codex.notify(agent, text3, msgId),
42512
42521
  ...deps.notifiers
42513
42522
  };
@@ -42670,6 +42679,7 @@ async function runDaemon(deps = {}) {
42670
42679
  opencode: (agent, mail) => opencode.deliver(agent, mail),
42671
42680
  pi: (agent, mail) => pi.deliver(agent, mail),
42672
42681
  omp: (agent, mail) => pi.deliver(agent, mail),
42682
+ hermes: (agent, mail) => pi.deliver(agent, mail),
42673
42683
  codex: (agent, mail) => codex.deliver(agent, mail),
42674
42684
  ...deps.transports
42675
42685
  },
@@ -42845,21 +42855,21 @@ async function runDaemon(deps = {}) {
42845
42855
  statusEveryMs: deps.status?.statusEveryMs
42846
42856
  });
42847
42857
  const hubRoster = (ref) => new Promise(
42848
- (resolve10) => {
42858
+ (resolve11) => {
42849
42859
  const id = pending.open(
42850
42860
  "status",
42851
- (f) => resolve10(f.type === "roster" ? f.agents : void 0)
42861
+ (f) => resolve11(f.type === "roster" ? f.agents : void 0)
42852
42862
  );
42853
42863
  const timer = setTimeout(() => {
42854
42864
  pending.cancel(id);
42855
42865
  hub.cancel(id);
42856
- resolve10(void 0);
42866
+ resolve11(void 0);
42857
42867
  }, deps.statusRosterMs ?? 1500);
42858
42868
  timer.unref();
42859
42869
  if (!hub.send({ v: 1, id, type: "list", from_ref: ref })) {
42860
42870
  clearTimeout(timer);
42861
42871
  pending.cancel(id);
42862
- resolve10(void 0);
42872
+ resolve11(void 0);
42863
42873
  }
42864
42874
  }
42865
42875
  );
@@ -43008,15 +43018,15 @@ async function runDaemon(deps = {}) {
43008
43018
  };
43009
43019
  attested(pid);
43010
43020
  const proposedName = hello.proposed_name ?? hello.agent_ref;
43011
- const files = hello.kind === "claude-code" ? liveClaudeSessions(claudeSessions) : [];
43012
- const mine = files.find(
43021
+ const files2 = hello.kind === "claude-code" ? liveClaudeSessions(claudeSessions) : [];
43022
+ const mine = files2.find(
43013
43023
  (x) => x.ref === hello.agent_ref && x.pid === pid
43014
43024
  );
43015
43025
  const old = mine && !prev ? clearedFrom(
43016
43026
  hello.agent_ref,
43017
43027
  pid,
43018
43028
  mine.procStart,
43019
- new Set(files.map((x) => x.ref))
43029
+ new Set(files2.map((x) => x.ref))
43020
43030
  ) : void 0;
43021
43031
  seenAt.set(hello.agent_ref, ++seenSeq);
43022
43032
  if (old) takenOver.add(old.ref);
@@ -43299,16 +43309,18 @@ var HARNESS_LABEL = {
43299
43309
  opencode: "OpenCode",
43300
43310
  pi: "Pi",
43301
43311
  omp: "oh-my-pi",
43302
- codex: "Codex"
43312
+ codex: "Codex",
43313
+ hermes: "Hermes"
43303
43314
  };
43304
43315
  var KIND_LABEL = {
43305
43316
  "claude-code": "Claude Code",
43306
43317
  opencode: "OpenCode",
43307
43318
  pi: "Pi",
43308
43319
  omp: "oh-my-pi",
43320
+ hermes: "Hermes",
43309
43321
  codex: "Codex"
43310
43322
  };
43311
- var kindLabel = (kind2) => Object.hasOwn(KIND_LABEL, kind2) ? KIND_LABEL[kind2] : displayKind(kind2);
43323
+ var kindLabel = (kind3) => Object.hasOwn(KIND_LABEL, kind3) ? KIND_LABEL[kind3] : displayKind(kind3);
43312
43324
  var len = (s) => [...s].length;
43313
43325
  function cutMiddle(value, max, more = "\u2026") {
43314
43326
  const chars = [...value];
@@ -43425,7 +43437,7 @@ function copy(style) {
43425
43437
  )}`
43426
43438
  ),
43427
43439
  noHarness: () => [
43428
- warn("No Claude Code, OpenCode, Pi, oh-my-pi or Codex found"),
43440
+ warn("No Claude Code, OpenCode, Pi, oh-my-pi, Codex or Hermes found"),
43429
43441
  next(`Install one, then run ${BUS_CMD} again.`)
43430
43442
  ],
43431
43443
  restarted: () => done("Restarted the OpenCode service to load the plugin"),
@@ -43443,6 +43455,15 @@ function copy(style) {
43443
43455
  ),
43444
43456
  next(`Install the Codex CLI, then run ${BUS_CMD} again.`)
43445
43457
  ],
43458
+ // After the configured line, when the Hermes plugin was copied and enabled.
43459
+ hermesRestart: () => next("Restart running Hermes sessions and gateways to load the plugin."),
43460
+ // After uninstall removed the Hermes plugin folder with no hermes binary to disable it.
43461
+ hermesNoCli: (config2) => [
43462
+ warn("Hermes isn't on PATH, so oa-bus may still be enabled in Hermes."),
43463
+ next(
43464
+ `Run hermes plugins disable oa-bus, or remove oa-bus from plugins.enabled in ${config2}.`
43465
+ )
43466
+ ],
43446
43467
  opencodeNotRunning: () => done("OpenCode service not running; it loads the plugin when it starts"),
43447
43468
  daemonRunning: (pid, service, fallback) => fallback && !service ? (
43448
43469
  // The service manager cannot run it: install again won't help.
@@ -43541,7 +43562,8 @@ function copy(style) {
43541
43562
  const lead = "No agents in namespace ";
43542
43563
  return [
43543
43564
  `${lead}${p("accent", clip(namespace2, len(lead) + 5))} yet.`,
43544
- "Start Claude Code, OpenCode, Pi, oh-my-pi or Codex in this folder and it joins."
43565
+ "Start Claude Code, OpenCode, Pi, oh-my-pi, Codex or Hermes in this folder.",
43566
+ "It joins."
43545
43567
  ];
43546
43568
  },
43547
43569
  // 7. status: messages delivered after send_message stopped waiting.
@@ -43806,8 +43828,8 @@ function copy(style) {
43806
43828
  ].filter(Boolean).join(", ")}.`
43807
43829
  ),
43808
43830
  // 9, 10. uninstall
43809
- serviceRemoved: (kind2) => done(
43810
- kind2 === "launchd" ? "Stopped and removed the launchd service" : "Stopped and removed the systemd user service"
43831
+ serviceRemoved: (kind3) => done(
43832
+ kind3 === "launchd" ? "Stopped and removed the launchd service" : "Stopped and removed the systemd user service"
43811
43833
  ),
43812
43834
  noService: () => done("No service to remove"),
43813
43835
  daemonStopped: () => done("Stopped the daemon"),
@@ -43977,19 +43999,19 @@ init_src2();
43977
43999
  import { execFile as execFile3, spawn } from "node:child_process";
43978
44000
  import { promisify } from "node:util";
43979
44001
  var browserCommand = (platform, url2) => platform === "darwin" ? { cmd: "open", args: [url2] } : platform === "win32" ? { cmd: "rundll32", args: ["url.dll,FileProtocolHandler", url2] } : { cmd: "xdg-open", args: [url2] };
43980
- var openBrowser = (url2, launcher = browserCommand(process.platform, url2)) => new Promise((resolve10) => {
44002
+ var openBrowser = (url2, launcher = browserCommand(process.platform, url2)) => new Promise((resolve11) => {
43981
44003
  try {
43982
44004
  const child = spawn(launcher.cmd, launcher.args, {
43983
44005
  stdio: "ignore",
43984
44006
  detached: true
43985
44007
  });
43986
- child.once("error", () => resolve10(false));
44008
+ child.once("error", () => resolve11(false));
43987
44009
  child.once("spawn", () => {
43988
44010
  child.unref();
43989
- resolve10(true);
44011
+ resolve11(true);
43990
44012
  });
43991
44013
  } catch {
43992
- resolve10(false);
44014
+ resolve11(false);
43993
44015
  }
43994
44016
  });
43995
44017
  var EXEC_TIMEOUT_MS = 1e4;
@@ -44000,10 +44022,11 @@ function guardServiceManager(cmd, args = [], env2 = process.env) {
44000
44022
  }
44001
44023
  var SYSTEM_TOOLS = /* @__PURE__ */ new Set(["launchctl", "systemctl"]);
44002
44024
  var resolveCmd = (cmd) => SYSTEM_TOOLS.has(cmd) ? systemTool(cmd) : cmd;
44003
- var makeExec = (timeoutMs) => async (cmd, args) => {
44025
+ var makeExec = (timeoutMs) => async (cmd, args, opts) => {
44004
44026
  guardServiceManager(cmd, args);
44005
44027
  try {
44006
44028
  const r = await promisify(execFile3)(resolveCmd(cmd), args, {
44029
+ ...opts?.env ? { env: { ...process.env, ...opts.env } } : {},
44007
44030
  maxBuffer: 8 * 1024 * 1024,
44008
44031
  timeout: timeoutMs,
44009
44032
  killSignal: "SIGKILL"
@@ -45482,7 +45505,7 @@ var noService = {
45482
45505
  remove: async () => ({}),
45483
45506
  cli: () => ["oa-bus"]
45484
45507
  };
45485
- var VERSION = true ? "0.132.1" : JSON.parse(
45508
+ var VERSION = true ? "0.133.0" : JSON.parse(
45486
45509
  readFileSync13(new URL("../package.json", import.meta.url), "utf8")
45487
45510
  ).version;
45488
45511
  var which = (cmd) => {
@@ -45564,7 +45587,7 @@ function realCtx(noColor) {
45564
45587
  });
45565
45588
  try {
45566
45589
  return await new Promise(
45567
- (resolve10) => rl.question(question, resolve10)
45590
+ (resolve11) => rl.question(question, resolve11)
45568
45591
  );
45569
45592
  } finally {
45570
45593
  rl.close();
@@ -45638,7 +45661,7 @@ var sayErr = (ctx, ...lines) => {
45638
45661
  var tildeReason = (ctx, harness, reason) => harness === "codex" && reason.startsWith(`${ctx.userHome}/`) ? `~${reason.slice(ctx.userHome.length)}` : reason;
45639
45662
  var tilde = (ctx, path) => path === ctx.userHome ? "~" : path.startsWith(`${ctx.userHome}/`) ? `~${path.slice(ctx.userHome.length)}` : path;
45640
45663
  var plain2 = (text3) => stripTerminalControls(text3).replace(/[\r\n\t]/g, " ");
45641
- var configFileLines = (ctx, files) => files.flatMap(
45664
+ var configFileLines = (ctx, files2) => files2.flatMap(
45642
45665
  (f) => ctx.copy.configFile({
45643
45666
  state: f.state,
45644
45667
  reason: plain2(f.reason),
@@ -45689,7 +45712,7 @@ async function daemon(ctx, run4 = runDaemon, signals = process) {
45689
45712
  sayErr(ctx, ctx.copy.revoked());
45690
45713
  return 0;
45691
45714
  }
45692
- return new Promise((resolve10) => {
45715
+ return new Promise((resolve11) => {
45693
45716
  let running;
45694
45717
  let ended = false;
45695
45718
  const end = (code2) => {
@@ -45697,7 +45720,7 @@ async function daemon(ctx, run4 = runDaemon, signals = process) {
45697
45720
  ended = true;
45698
45721
  signals.off("SIGINT", onSignal);
45699
45722
  signals.off("SIGTERM", onSignal);
45700
- void (running?.stop() ?? Promise.resolve()).finally(() => resolve10(code2));
45723
+ void (running?.stop() ?? Promise.resolve()).finally(() => resolve11(code2));
45701
45724
  };
45702
45725
  const onSignal = () => end(0);
45703
45726
  signals.once("SIGINT", onSignal);
@@ -45726,8 +45749,8 @@ async function daemon(ctx, run4 = runDaemon, signals = process) {
45726
45749
  }
45727
45750
 
45728
45751
  // src/commands/doctor.ts
45729
- import { readFileSync as readFileSync17 } from "node:fs";
45730
- import { join as join21 } from "node:path";
45752
+ import { readFileSync as readFileSync18 } from "node:fs";
45753
+ import { join as join22 } from "node:path";
45731
45754
 
45732
45755
  // ../bus-adapter-opencode/src/index.ts
45733
45756
  init_session2();
@@ -45738,22 +45761,28 @@ var OPENCODE_TUI_PLUGIN = fileURLToPath2(
45738
45761
  );
45739
45762
 
45740
45763
  // src/steps/adapters.ts
45741
- import { randomBytes as randomBytes3 } from "node:crypto";
45764
+ import { randomBytes as randomBytes4 } from "node:crypto";
45742
45765
  import {
45743
45766
  chmodSync as chmodSync10,
45744
45767
  existsSync as existsSync5,
45745
- lstatSync as lstatSync9,
45746
- mkdirSync as mkdirSync9,
45747
- readFileSync as readFileSync15,
45768
+ lstatSync as lstatSync10,
45769
+ mkdirSync as mkdirSync10,
45770
+ readFileSync as readFileSync16,
45748
45771
  readlinkSync,
45749
- renameSync as renameSync9,
45750
- rmSync as rmSync5,
45772
+ renameSync as renameSync10,
45773
+ rmSync as rmSync6,
45751
45774
  statSync as statSync9,
45752
- writeFileSync as writeFileSync7
45775
+ writeFileSync as writeFileSync8
45753
45776
  } from "node:fs";
45754
- import { dirname as dirname9, join as join17, resolve as resolve5 } from "node:path";
45777
+ import { dirname as dirname10, join as join18, resolve as resolve6 } from "node:path";
45755
45778
  import { isDeepStrictEqual } from "node:util";
45756
45779
 
45780
+ // ../bus-adapter-hermes/src/index.ts
45781
+ import { fileURLToPath as fileURLToPath3 } from "node:url";
45782
+ var HERMES_PLUGIN = fileURLToPath3(
45783
+ new URL("../assets/oa_bus", import.meta.url)
45784
+ );
45785
+
45757
45786
  // ../../node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/scanner.js
45758
45787
  function createScanner(text3, ignoreTrivia = false) {
45759
45788
  const len2 = text3.length;
@@ -46967,47 +46996,251 @@ function removeMcpServer(doc, name) {
46967
46996
  }
46968
46997
 
46969
46998
  // ../bus-adapter-pi/src/index.ts
46970
- import { fileURLToPath as fileURLToPath3 } from "node:url";
46971
- var PI_EXTENSION = fileURLToPath3(
46999
+ import { fileURLToPath as fileURLToPath4 } from "node:url";
47000
+ var PI_EXTENSION = fileURLToPath4(
46972
47001
  new URL("../assets/oa-bus.ts", import.meta.url)
46973
47002
  );
46974
47003
 
47004
+ // src/steps/hermes.ts
47005
+ import { createHash as createHash6, randomBytes as randomBytes3 } from "node:crypto";
47006
+ import {
47007
+ cpSync as cpSync2,
47008
+ lstatSync as lstatSync9,
47009
+ mkdirSync as mkdirSync9,
47010
+ readdirSync as readdirSync4,
47011
+ readFileSync as readFileSync15,
47012
+ renameSync as renameSync9,
47013
+ rmSync as rmSync5,
47014
+ writeFileSync as writeFileSync7
47015
+ } from "node:fs";
47016
+ import {
47017
+ basename as basename7,
47018
+ dirname as dirname9,
47019
+ isAbsolute as isAbsolute9,
47020
+ join as join17,
47021
+ relative,
47022
+ resolve as resolve5
47023
+ } from "node:path";
47024
+ var HERMES_PLUGIN_NAME = "oa-bus";
47025
+ var HERMES_MARKER = ".oa-bus-managed";
47026
+ var HERMES_NO_CLI = "no hermes binary found; its config may still list oa-bus";
47027
+ var HERMES_STAGING = ".oa-bus-staging";
47028
+ var tilded = (home2, v) => v === "~" ? home2 : resolve5(v.startsWith("~/") ? join17(home2, v.slice(2)) : v);
47029
+ function hermesHome(home2, env2) {
47030
+ const native = join17(home2, ".hermes");
47031
+ const v = env2.HERMES_HOME?.trim();
47032
+ const given = v ? tilded(home2, v) : void 0;
47033
+ if (given !== void 0 && basename7(dirname9(given)) === "profiles")
47034
+ return given;
47035
+ const base3 = given ?? native;
47036
+ const root = (() => {
47037
+ if (given === void 0) return native;
47038
+ const rel = relative(native, given);
47039
+ if (rel === "" || !rel.startsWith("..") && !isAbsolute9(rel))
47040
+ return native;
47041
+ return given;
47042
+ })();
47043
+ if (env2.HERMES_S6_SUPERVISED_CHILD) return base3;
47044
+ try {
47045
+ const name = readFileSync15(join17(root, "active_profile"), "utf8").trim().toLowerCase();
47046
+ if (name && name !== "default" && /^[a-z0-9][a-z0-9_-]{0,63}$/.test(name)) {
47047
+ const dir = join17(root, "profiles", name);
47048
+ if (lstatSync9(dir).isDirectory()) return dir;
47049
+ }
47050
+ } catch {
47051
+ }
47052
+ return base3;
47053
+ }
47054
+ var hermesEnv = (home2, env2) => ({
47055
+ HERMES_HOME: hermesHome(home2, env2)
47056
+ });
47057
+ var hermesPluginDir = (home2, env2) => join17(hermesHome(home2, env2), "plugins", HERMES_PLUGIN_NAME);
47058
+ var kind = (path) => {
47059
+ try {
47060
+ const st = lstatSync9(path);
47061
+ return st.isSymbolicLink() ? "link" : st.isDirectory() ? "dir" : "file";
47062
+ } catch {
47063
+ return void 0;
47064
+ }
47065
+ };
47066
+ function files(dir, rel = "") {
47067
+ const out = [];
47068
+ for (const name of readdirSync4(join17(dir, rel)).sort()) {
47069
+ if (name === "__pycache__" || name.startsWith(".") || name.endsWith(".pyc"))
47070
+ continue;
47071
+ const r = rel ? `${rel}/${name}` : name;
47072
+ if (kind(join17(dir, r)) === "dir") out.push(...files(dir, r));
47073
+ else out.push(r);
47074
+ }
47075
+ return out;
47076
+ }
47077
+ function pluginHash(dir) {
47078
+ const h = createHash6("sha256");
47079
+ for (const f of files(dir)) {
47080
+ h.update(`${f}\0`);
47081
+ h.update(readFileSync15(join17(dir, f)));
47082
+ h.update("\0");
47083
+ }
47084
+ return h.digest("hex").slice(0, 16);
47085
+ }
47086
+ function pluginState(dir, shipped) {
47087
+ const k = kind(dir);
47088
+ if (k === void 0) return "absent";
47089
+ if (k !== "dir") return "foreign";
47090
+ let marker;
47091
+ try {
47092
+ marker = readFileSync15(join17(dir, HERMES_MARKER), "utf8").trim();
47093
+ } catch {
47094
+ return "foreign";
47095
+ }
47096
+ if (!marker.startsWith("managed by the Open Artifacts bus installer"))
47097
+ return "foreign";
47098
+ if (shipped === void 0) return "stale";
47099
+ try {
47100
+ return marker.endsWith(` ${pluginHash(shipped)}`) && pluginHash(dir) === pluginHash(shipped) ? "current" : "stale";
47101
+ } catch {
47102
+ return "stale";
47103
+ }
47104
+ }
47105
+ var exec = async (deps, args) => {
47106
+ try {
47107
+ return await deps.exec("hermes", args, {
47108
+ env: hermesEnv(deps.home, deps.env ?? {})
47109
+ });
47110
+ } catch (e) {
47111
+ return {
47112
+ code: -1,
47113
+ stdout: "",
47114
+ stderr: e instanceof Error ? e.message : String(e)
47115
+ };
47116
+ }
47117
+ };
47118
+ var firstLine = (s) => s.trim().split("\n")[0] ?? "";
47119
+ async function installHermes(deps) {
47120
+ if (!deps.which("hermes")) return "absent";
47121
+ const shipped = deps.assets.hermes;
47122
+ if (shipped === void 0)
47123
+ throw new Error("the Hermes plugin is missing from this install");
47124
+ const dest = hermesPluginDir(deps.home, deps.env ?? {});
47125
+ const state = pluginState(dest, shipped);
47126
+ if (state === "foreign")
47127
+ throw new Error(
47128
+ `${dest} exists and is not Open Artifacts bus's; left it untouched`
47129
+ );
47130
+ if (state !== "current") {
47131
+ const plugins2 = join17(dest, "..");
47132
+ mkdirSync9(plugins2, { recursive: true });
47133
+ const staging = join17(plugins2, "..", HERMES_STAGING);
47134
+ rmSync5(staging, { recursive: true, force: true });
47135
+ mkdirSync9(staging, { recursive: true });
47136
+ const tmp = join17(staging, randomBytes3(4).toString("hex"));
47137
+ try {
47138
+ mkdirSync9(tmp);
47139
+ for (const f of files(shipped)) {
47140
+ mkdirSync9(join17(tmp, f, ".."), { recursive: true });
47141
+ cpSync2(join17(shipped, f), join17(tmp, f));
47142
+ }
47143
+ writeFileSync7(
47144
+ join17(tmp, HERMES_MARKER),
47145
+ `managed by the Open Artifacts bus installer: edits are replaced on reinstall. ${pluginHash(shipped)}
47146
+ `
47147
+ );
47148
+ if (state === "stale") rmSync5(dest, { recursive: true, force: true });
47149
+ renameSync9(tmp, dest);
47150
+ } catch (e) {
47151
+ rmSync5(tmp, { recursive: true, force: true });
47152
+ throw e;
47153
+ } finally {
47154
+ rmSync5(staging, { recursive: true, force: true });
47155
+ }
47156
+ }
47157
+ if (await hermesEnabled(deps)) return "done";
47158
+ const r = await exec(deps, [
47159
+ "plugins",
47160
+ "enable",
47161
+ "--no-allow-tool-override",
47162
+ HERMES_PLUGIN_NAME
47163
+ ]);
47164
+ if (r.code !== 0)
47165
+ throw new Error(
47166
+ `copied the plugin to ${dest}, but \`hermes plugins enable ${HERMES_PLUGIN_NAME}\` failed (${firstLine(r.stderr) || firstLine(r.stdout) || `exit ${r.code}`})`
47167
+ );
47168
+ return "done";
47169
+ }
47170
+ async function uninstallHermes(deps, notes) {
47171
+ const dest = hermesPluginDir(deps.home, deps.env ?? {});
47172
+ const state = pluginState(dest, void 0);
47173
+ if (state === "absent") return "none";
47174
+ if (state === "foreign")
47175
+ throw new Error(`${dest} is not Open Artifacts bus's; left it untouched`);
47176
+ if (deps.which("hermes")) {
47177
+ const r = await exec(deps, ["plugins", "disable", HERMES_PLUGIN_NAME]);
47178
+ if (r.code !== 0)
47179
+ throw new Error(
47180
+ `\`hermes plugins disable ${HERMES_PLUGIN_NAME}\` failed (${firstLine(r.stderr) || firstLine(r.stdout) || `exit ${r.code}`}); left the plugin folder, rerun once Hermes works`
47181
+ );
47182
+ } else notes.push(HERMES_NO_CLI);
47183
+ rmSync5(dest, { recursive: true, force: true });
47184
+ return "done";
47185
+ }
47186
+ async function hermesEnabled(deps) {
47187
+ const r = await exec(deps, ["plugins", "list", "--json", "--user"]);
47188
+ if (r.code !== 0) return false;
47189
+ try {
47190
+ const list = JSON.parse(r.stdout);
47191
+ return Array.isArray(list) && list.some(
47192
+ (e) => typeof e === "object" && e !== null && e.name === HERMES_PLUGIN_NAME && e.status === "enabled"
47193
+ );
47194
+ } catch {
47195
+ return false;
47196
+ }
47197
+ }
47198
+
46975
47199
  // src/steps/adapters.ts
46976
47200
  var HARNESS_ENTRY = "oa_bus";
46977
47201
  var NAME = HARNESS_ENTRY;
46978
- var HARNESSES = ["claude", "opencode", "pi", "omp", "codex"];
47202
+ var HARNESSES = [
47203
+ "claude",
47204
+ "opencode",
47205
+ "pi",
47206
+ "omp",
47207
+ "codex",
47208
+ "hermes"
47209
+ ];
46979
47210
  var readAssets = () => ({
46980
- pi: readFileSync15(PI_EXTENSION, "utf8"),
46981
- opencodePlugin: readFileSync15(OPENCODE_TUI_PLUGIN, "utf8")
47211
+ pi: readFileSync16(PI_EXTENSION, "utf8"),
47212
+ opencodePlugin: readFileSync16(OPENCODE_TUI_PLUGIN, "utf8"),
47213
+ // A folder, not text: the plugin is several Python files.
47214
+ hermes: HERMES_PLUGIN
46982
47215
  });
46983
47216
  var movedHome = (deps) => {
46984
47217
  if (deps.busHome === void 0) return void 0;
46985
- const ob = resolve5(deps.busHome);
46986
- return ob === join17(deps.home, ".oa-bus") ? void 0 : ob;
47218
+ const ob = resolve6(deps.busHome);
47219
+ return ob === join18(deps.home, ".oa-bus") ? void 0 : ob;
46987
47220
  };
46988
47221
  var homeLine = (ob) => `process.env.OA_BUS_HOME ||= ${JSON.stringify(ob)};`;
46989
47222
  var withHome = (text3, ob) => ob === void 0 ? text3 : `${homeLine(ob)}
46990
47223
  ${text3}`;
46991
47224
  var paths = (deps) => {
46992
47225
  const env2 = deps.env ?? {};
46993
- const opencode = env2.OPENCODE_CONFIG_DIR ?? join17(env2.XDG_CONFIG_HOME ?? join17(deps.home, ".config"), "opencode");
46994
- const busDir = deps.busHome ?? join17(deps.home, ".oa-bus");
47226
+ const opencode = env2.OPENCODE_CONFIG_DIR ?? join18(env2.XDG_CONFIG_HOME ?? join18(deps.home, ".config"), "opencode");
47227
+ const busDir = deps.busHome ?? join18(deps.home, ".oa-bus");
46995
47228
  return {
46996
- claude: join17(env2.CLAUDE_CONFIG_DIR ?? deps.home, ".claude.json"),
47229
+ claude: join18(env2.CLAUDE_CONFIG_DIR ?? deps.home, ".claude.json"),
46997
47230
  // OpenCode reads both; edit the one the user has, else create .json.
46998
47231
  opencodeConfigs: [
46999
- join17(opencode, "opencode.json"),
47000
- join17(opencode, "opencode.jsonc")
47232
+ join18(opencode, "opencode.json"),
47233
+ join18(opencode, "opencode.jsonc")
47001
47234
  ],
47002
- opencodeCli: join17(opencode, "cli.json"),
47003
- record: join17(busDir, "install.json"),
47235
+ opencodeCli: join18(opencode, "cli.json"),
47236
+ record: join18(busDir, "install.json"),
47004
47237
  // OpenCode registers the folder that holds tui.js.
47005
- opencodePlugin: join17(busDir, "integrations/opencode", NAME),
47006
- pi: join17(
47007
- agentDirEnv(deps.home, env2) ?? join17(deps.home, ".pi/agent"),
47238
+ opencodePlugin: join18(busDir, "integrations/opencode", NAME),
47239
+ pi: join18(
47240
+ agentDirEnv(deps.home, env2) ?? join18(deps.home, ".pi/agent"),
47008
47241
  "extensions/oa-bus.ts"
47009
47242
  ),
47010
- omp: join17(ompAgentDir(deps.home, env2), "extensions/oa-bus.ts"),
47243
+ omp: join18(ompAgentDir(deps.home, env2), "extensions/oa-bus.ts"),
47011
47244
  codex: codexConfig(deps.home, env2),
47012
47245
  codexBin: codexBinFile(busDir),
47013
47246
  busDir
@@ -47017,9 +47250,9 @@ function agentDirEnv(home2, env2) {
47017
47250
  const dir = env2.PI_CODING_AGENT_DIR;
47018
47251
  if (!dir) return void 0;
47019
47252
  if (dir === "~") return home2;
47020
- return resolve5(dir.startsWith("~/") ? join17(home2, dir.slice(2)) : dir);
47253
+ return resolve6(dir.startsWith("~/") ? join18(home2, dir.slice(2)) : dir);
47021
47254
  }
47022
- var ompRoot = (home2, env2) => join17(home2, env2.PI_CONFIG_DIR || ".omp");
47255
+ var ompRoot = (home2, env2) => join18(home2, env2.PI_CONFIG_DIR || ".omp");
47023
47256
  function ompProfile(env2) {
47024
47257
  const name = (env2.OMP_PROFILE !== void 0 ? env2.OMP_PROFILE : env2.PI_PROFILE)?.trim();
47025
47258
  if (!name || name === "default" || name.endsWith(".")) return void 0;
@@ -47028,19 +47261,19 @@ function ompProfile(env2) {
47028
47261
  function ompAgentDir(home2, env2) {
47029
47262
  const root = ompRoot(home2, env2);
47030
47263
  const profile = ompProfile(env2);
47031
- if (profile) return join17(root, "profiles", profile, "agent");
47264
+ if (profile) return join18(root, "profiles", profile, "agent");
47032
47265
  const piProfile = ompProfile({ PI_PROFILE: env2.PI_PROFILE });
47033
47266
  const dir = agentDirEnv(home2, env2);
47034
- if (dir && !(piProfile && dir === join17(root, "profiles", piProfile, "agent")))
47267
+ if (dir && !(piProfile && dir === join18(root, "profiles", piProfile, "agent")))
47035
47268
  return dir;
47036
- return join17(root, "agent");
47269
+ return join18(root, "agent");
47037
47270
  }
47038
- var hasOmp = (deps) => deps.which("omp") || present2(ompRoot(deps.home, deps.env ?? {})) || present2(join17(deps.home, ".bun/bin/omp"));
47271
+ var hasOmp = (deps) => deps.which("omp") || present2(ompRoot(deps.home, deps.env ?? {})) || present2(join18(deps.home, ".bun/bin/omp"));
47039
47272
  var sharedFile = (deps) => paths(deps).omp === paths(deps).pi;
47040
47273
  function readDoc(path) {
47041
47274
  let text3;
47042
47275
  try {
47043
- text3 = readFileSync15(path, "utf8");
47276
+ text3 = readFileSync16(path, "utf8");
47044
47277
  } catch (e) {
47045
47278
  if (e.code === "ENOENT") return {};
47046
47279
  throw e;
@@ -47055,7 +47288,7 @@ function readDoc(path) {
47055
47288
  }
47056
47289
  function present2(path) {
47057
47290
  try {
47058
- lstatSync9(path);
47291
+ lstatSync10(path);
47059
47292
  return true;
47060
47293
  } catch {
47061
47294
  return false;
@@ -47064,40 +47297,40 @@ function present2(path) {
47064
47297
  function target(path) {
47065
47298
  let p = path;
47066
47299
  for (let hops = 0; hops < 40; hops++) {
47067
- if (!present2(p) || !lstatSync9(p).isSymbolicLink()) {
47068
- if (p !== path && !existsSync5(dirname9(p)))
47300
+ if (!present2(p) || !lstatSync10(p).isSymbolicLink()) {
47301
+ if (p !== path && !existsSync5(dirname10(p)))
47069
47302
  throw new Error(
47070
47303
  `${path} is a dangling symlink to ${p}; left it untouched`
47071
47304
  );
47072
47305
  return p;
47073
47306
  }
47074
- p = resolve5(dirname9(p), readlinkSync(p));
47307
+ p = resolve6(dirname10(p), readlinkSync(p));
47075
47308
  }
47076
47309
  throw new Error(`${path}: too many symlinks; left it untouched`);
47077
47310
  }
47078
47311
  function writeAtomic(path, data, mode) {
47079
47312
  const dest = target(path);
47080
- mkdirSync9(dirname9(dest), { recursive: true });
47313
+ mkdirSync10(dirname10(dest), { recursive: true });
47081
47314
  let m = mode ?? 420;
47082
47315
  if (mode === void 0)
47083
47316
  try {
47084
47317
  m = statSync9(dest).mode & 511;
47085
47318
  } catch {
47086
47319
  }
47087
- const tmp = `${dest}.${process.pid}.${randomBytes3(4).toString("hex")}.tmp`;
47320
+ const tmp = `${dest}.${process.pid}.${randomBytes4(4).toString("hex")}.tmp`;
47088
47321
  try {
47089
- writeFileSync7(tmp, data, { mode: m, flag: "wx" });
47322
+ writeFileSync8(tmp, data, { mode: m, flag: "wx" });
47090
47323
  chmodSync10(tmp, m);
47091
- renameSync9(tmp, dest);
47324
+ renameSync10(tmp, dest);
47092
47325
  } catch (e) {
47093
- rmSync5(tmp, { force: true });
47326
+ rmSync6(tmp, { force: true });
47094
47327
  throw e;
47095
47328
  }
47096
47329
  }
47097
47330
  function readJsonc(path) {
47098
47331
  let text3;
47099
47332
  try {
47100
- text3 = readFileSync15(path, "utf8");
47333
+ text3 = readFileSync16(path, "utf8");
47101
47334
  } catch (e) {
47102
47335
  if (e.code === "ENOENT") return "";
47103
47336
  throw e;
@@ -47114,7 +47347,7 @@ function saveText(path, before, next, ok) {
47114
47347
  }
47115
47348
  function readRecord(path) {
47116
47349
  try {
47117
- const v = JSON.parse(readFileSync15(path, "utf8"));
47350
+ const v = JSON.parse(readFileSync16(path, "utf8"));
47118
47351
  const c = v?.created;
47119
47352
  if (typeof c === "object" && c !== null) return c;
47120
47353
  } catch {
@@ -47125,7 +47358,7 @@ function writeRecord(path, before, created) {
47125
47358
  if (isDeepStrictEqual(before, created)) return;
47126
47359
  let rest = {};
47127
47360
  try {
47128
- const v = JSON.parse(readFileSync15(path, "utf8"));
47361
+ const v = JSON.parse(readFileSync16(path, "utf8"));
47129
47362
  if (typeof v === "object" && v !== null && !Array.isArray(v))
47130
47363
  rest = v;
47131
47364
  } catch {
@@ -47155,7 +47388,7 @@ async function run3(deps, cmd, args) {
47155
47388
  };
47156
47389
  }
47157
47390
  }
47158
- var firstLine = (s) => s.trim().split("\n")[0] ?? "";
47391
+ var firstLine2 = (s) => s.trim().split("\n")[0] ?? "";
47159
47392
  var RESTART_FAILED = "opencode service restart failed";
47160
47393
  var CODEX_NO_BIN = "no codex binary found; Codex threads are not woken";
47161
47394
  var codexHere = (deps) => hasCodex({
@@ -47166,7 +47399,7 @@ var codexHere = (deps) => hasCodex({
47166
47399
  });
47167
47400
  async function restartOpencode(deps, notes) {
47168
47401
  const r = await run3(deps, "opencode", ["service", "restart"]);
47169
- if (r.code !== 0) notes.push(`${RESTART_FAILED}: ${firstLine(r.stderr)}`);
47402
+ if (r.code !== 0) notes.push(`${RESTART_FAILED}: ${firstLine2(r.stderr)}`);
47170
47403
  }
47171
47404
  var install = {
47172
47405
  // Claude rewrites ~/.claude.json while it runs, so its own CLI does the edit.
@@ -47201,7 +47434,7 @@ var install = {
47201
47434
  })
47202
47435
  );
47203
47436
  notes.push(
47204
- `claude mcp add failed (${firstLine(add.stderr)}); wrote ${path} directly`
47437
+ `claude mcp add failed (${firstLine2(add.stderr)}); wrote ${path} directly`
47205
47438
  );
47206
47439
  return "done";
47207
47440
  },
@@ -47243,7 +47476,7 @@ var install = {
47243
47476
  created[p.opencodeCli] = add(p.opencodeCli, madeCli);
47244
47477
  writeRecord(p.record, record6, created);
47245
47478
  writeAtomic(
47246
- join17(p.opencodePlugin, "tui.js"),
47479
+ join18(p.opencodePlugin, "tui.js"),
47247
47480
  withHome(deps.assets.opencodePlugin, movedHome(deps)),
47248
47481
  420
47249
47482
  );
@@ -47295,15 +47528,19 @@ var install = {
47295
47528
  const pin = codexBinPin(bin);
47296
47529
  let had = "";
47297
47530
  try {
47298
- had = readFileSync15(p.codexBin, "utf8");
47531
+ had = readFileSync16(p.codexBin, "utf8");
47299
47532
  } catch {
47300
47533
  }
47301
47534
  if (had !== pin) writeAtomic(p.codexBin, pin, 384);
47302
47535
  } else {
47303
- rmSync5(p.codexBin, { force: true });
47536
+ rmSync6(p.codexBin, { force: true });
47304
47537
  notes.push(CODEX_NO_BIN);
47305
47538
  }
47306
47539
  return "done";
47540
+ },
47541
+ // Hermes loads a Python plugin folder; its own CLI enables it.
47542
+ async hermes(deps) {
47543
+ return installHermes(deps);
47307
47544
  }
47308
47545
  };
47309
47546
  var uninstall = {
@@ -47350,7 +47587,7 @@ var uninstall = {
47350
47587
  for (const { file: file2 } of edits) delete left[file2];
47351
47588
  writeRecord(p.record, record6, left);
47352
47589
  const hadPlugin = existsSync5(p.opencodePlugin);
47353
- rmSync5(p.opencodePlugin, { recursive: true, force: true });
47590
+ rmSync6(p.opencodePlugin, { recursive: true, force: true });
47354
47591
  if (!saved.some(Boolean) && !hadPlugin) return "none";
47355
47592
  if (deps.which("opencode")) await restartOpencode(deps, notes);
47356
47593
  return saved.some(Boolean) ? "done" : "folder";
@@ -47358,14 +47595,14 @@ var uninstall = {
47358
47595
  async pi(deps) {
47359
47596
  const path = paths(deps).pi;
47360
47597
  if (!existsSync5(path)) return "none";
47361
- rmSync5(path, { force: true });
47598
+ rmSync6(path, { force: true });
47362
47599
  return "done";
47363
47600
  },
47364
47601
  async omp(deps, _notes, done) {
47365
47602
  if (sharedFile(deps) && done.includes("pi")) return "done";
47366
47603
  const path = paths(deps).omp;
47367
47604
  if (!existsSync5(path)) return "none";
47368
- rmSync5(path, { force: true });
47605
+ rmSync6(path, { force: true });
47369
47606
  return "done";
47370
47607
  },
47371
47608
  async codex(deps) {
@@ -47380,8 +47617,11 @@ var uninstall = {
47380
47617
  }
47381
47618
  }
47382
47619
  const pinned = present2(p.codexBin);
47383
- rmSync5(p.codexBin, { force: true });
47620
+ rmSync6(p.codexBin, { force: true });
47384
47621
  return saved || pinned ? "done" : "none";
47622
+ },
47623
+ async hermes(deps, notes) {
47624
+ return uninstallHermes(deps, notes);
47385
47625
  }
47386
47626
  };
47387
47627
  async function each(steps, deps, notes) {
@@ -47414,7 +47654,8 @@ async function installAdapters(deps) {
47414
47654
  notes,
47415
47655
  opencodeRestarted: done.includes("opencode") && !notes.some((n) => n.startsWith(RESTART_FAILED)),
47416
47656
  ...done.includes("pi") && done.includes("omp") && sharedFile(deps) ? { sharedPiFile: paths(deps).pi } : {},
47417
- codexNoWake: done.includes("codex") && notes.includes(CODEX_NO_BIN)
47657
+ codexNoWake: done.includes("codex") && notes.includes(CODEX_NO_BIN),
47658
+ hermesRestart: done.includes("hermes")
47418
47659
  };
47419
47660
  }
47420
47661
  async function uninstallAdapters(deps) {
@@ -47425,7 +47666,8 @@ async function uninstallAdapters(deps) {
47425
47666
  folderOnly: folder,
47426
47667
  skipped,
47427
47668
  notes,
47428
- opencodeRestarted: [...done, ...folder].includes("opencode") && deps.which("opencode") && !notes.some((n) => n.startsWith(RESTART_FAILED))
47669
+ opencodeRestarted: [...done, ...folder].includes("opencode") && deps.which("opencode") && !notes.some((n) => n.startsWith(RESTART_FAILED)),
47670
+ hermesNoCli: notes.includes(HERMES_NO_CLI)
47429
47671
  };
47430
47672
  }
47431
47673
  function checkAdapters(deps) {
@@ -47440,7 +47682,7 @@ function checkAdapters(deps) {
47440
47682
  const homeOf = (env2) => typeof env2 === "object" && env2 !== null ? env2.OA_BUS_HOME : void 0;
47441
47683
  const homed = (file2) => {
47442
47684
  if (!existsSync5(file2)) return false;
47443
- const first = readFileSync15(file2, "utf8").split("\n", 1)[0] ?? "";
47685
+ const first = readFileSync16(file2, "utf8").split("\n", 1)[0] ?? "";
47444
47686
  const ob = movedHome(deps);
47445
47687
  return ob === void 0 ? !first.startsWith("process.env.OA_BUS_HOME ||=") : first === homeLine(ob);
47446
47688
  };
@@ -47453,13 +47695,13 @@ function checkAdapters(deps) {
47453
47695
  opencode: state(
47454
47696
  "opencode",
47455
47697
  () => p.opencodeConfigs.filter(present2).some((f) => {
47456
- const d = parseJsonc(readFileSync15(f, "utf8"), f);
47698
+ const d = parseJsonc(readFileSync16(f, "utf8"), f);
47457
47699
  const e = servers2(d)?.[NAME] ?? d.mcp?.[NAME];
47458
47700
  return e !== void 0 && homeOf(e.environment) === movedHome(deps);
47459
47701
  }) && listed(
47460
- parseJsonc(readFileSync15(p.opencodeCli, "utf8"), p.opencodeCli),
47702
+ parseJsonc(readFileSync16(p.opencodeCli, "utf8"), p.opencodeCli),
47461
47703
  p.opencodePlugin
47462
- ) && homed(join17(p.opencodePlugin, "tui.js"))
47704
+ ) && homed(join18(p.opencodePlugin, "tui.js"))
47463
47705
  ),
47464
47706
  pi: state("pi", () => homed(p.pi)),
47465
47707
  omp: state("omp", () => homed(p.omp)),
@@ -47475,24 +47717,32 @@ function checkAdapters(deps) {
47475
47717
  ),
47476
47718
  deps.busBin !== void 0
47477
47719
  )
47720
+ ),
47721
+ // Files only (this never execs): whether Hermes enabled it is hermesEnabled's.
47722
+ hermes: state(
47723
+ "hermes",
47724
+ () => pluginState(
47725
+ hermesPluginDir(deps.home, deps.env ?? {}),
47726
+ deps.hermesPlugin ?? HERMES_PLUGIN
47727
+ ) === "current"
47478
47728
  )
47479
47729
  };
47480
47730
  }
47481
47731
 
47482
47732
  // src/commands/login.ts
47483
47733
  init_src();
47484
- import { randomBytes as randomBytes4 } from "node:crypto";
47734
+ import { randomBytes as randomBytes5 } from "node:crypto";
47485
47735
  import {
47486
47736
  chmodSync as chmodSync11,
47487
47737
  closeSync as closeSync6,
47488
- mkdirSync as mkdirSync10,
47738
+ mkdirSync as mkdirSync11,
47489
47739
  openSync as openSync6,
47490
- renameSync as renameSync10,
47491
- rmSync as rmSync6,
47740
+ renameSync as renameSync11,
47741
+ rmSync as rmSync7,
47492
47742
  unlinkSync as unlinkSync3,
47493
47743
  writeSync as writeSync3
47494
47744
  } from "node:fs";
47495
- import { join as join18 } from "node:path";
47745
+ import { join as join19 } from "node:path";
47496
47746
 
47497
47747
  // src/machine-label.ts
47498
47748
  import { hostname as osHostname } from "node:os";
@@ -47513,9 +47763,9 @@ async function defaultMachineLabel(d) {
47513
47763
 
47514
47764
  // src/commands/login.ts
47515
47765
  var LoginFailed = class extends Error {
47516
- constructor(kind2, message, detail = {}) {
47766
+ constructor(kind3, message, detail = {}) {
47517
47767
  super(message);
47518
- this.kind = kind2;
47768
+ this.kind = kind3;
47519
47769
  this.detail = detail;
47520
47770
  }
47521
47771
  kind;
@@ -47538,9 +47788,9 @@ function checkVerificationUri(uri, hub) {
47538
47788
  return uri;
47539
47789
  }
47540
47790
  function writeMachineFile(home2, body) {
47541
- mkdirSync10(home2, { recursive: true, mode: 448 });
47791
+ mkdirSync11(home2, { recursive: true, mode: 448 });
47542
47792
  chmodSync11(home2, 448);
47543
- const tmp = join18(home2, `.machine.json.${randomBytes4(8).toString("hex")}.tmp`);
47793
+ const tmp = join19(home2, `.machine.json.${randomBytes5(8).toString("hex")}.tmp`);
47544
47794
  const fd = openSync6(tmp, "wx", 384);
47545
47795
  try {
47546
47796
  writeSync3(fd, body);
@@ -47552,7 +47802,7 @@ function writeMachineFile(home2, body) {
47552
47802
  closeSync6(fd);
47553
47803
  try {
47554
47804
  chmodSync11(tmp, 384);
47555
- renameSync10(tmp, join18(home2, "machine.json"));
47805
+ renameSync11(tmp, join19(home2, "machine.json"));
47556
47806
  } catch (e) {
47557
47807
  unlinkSync3(tmp);
47558
47808
  throw e;
@@ -47679,7 +47929,7 @@ async function login(args) {
47679
47929
  `${JSON.stringify({ hub, label, machine_token: poll.machine_token }, null, 2)}
47680
47930
  `
47681
47931
  );
47682
- rmSync6(join18(args.home, "revoked"), { force: true });
47932
+ rmSync7(join19(args.home, "revoked"), { force: true });
47683
47933
  if (!events?.code) print(`Approved this machine as ${label}.`);
47684
47934
  return {
47685
47935
  machineToken: poll.machine_token,
@@ -47703,7 +47953,7 @@ init_src();
47703
47953
 
47704
47954
  // src/commands/install.ts
47705
47955
  init_src3();
47706
- import { join as join20 } from "node:path";
47956
+ import { join as join21 } from "node:path";
47707
47957
  init_src2();
47708
47958
 
47709
47959
  // src/live.ts
@@ -47755,17 +48005,17 @@ function spinner(ctx) {
47755
48005
  // src/steps/skill.ts
47756
48006
  import {
47757
48007
  existsSync as existsSync6,
47758
- lstatSync as lstatSync10,
47759
- mkdirSync as mkdirSync11,
47760
- readdirSync as readdirSync4,
47761
- readFileSync as readFileSync16,
48008
+ lstatSync as lstatSync11,
48009
+ mkdirSync as mkdirSync12,
48010
+ readdirSync as readdirSync5,
48011
+ readFileSync as readFileSync17,
47762
48012
  realpathSync as realpathSync8,
47763
- renameSync as renameSync11,
48013
+ renameSync as renameSync12,
47764
48014
  rmdirSync,
47765
- rmSync as rmSync7,
47766
- writeFileSync as writeFileSync8
48015
+ rmSync as rmSync8,
48016
+ writeFileSync as writeFileSync9
47767
48017
  } from "node:fs";
47768
- import { dirname as dirname10, join as join19 } from "node:path";
48018
+ import { dirname as dirname11, join as join20 } from "node:path";
47769
48019
  var SKILL_MARKER = "<!-- managed by the Open Artifacts bus installer: edits are replaced on reinstall. -->";
47770
48020
  var CODEX_BEGIN = "<!-- BEGIN Open Artifacts skill (managed): edits inside are replaced on reinstall. -->";
47771
48021
  var CODEX_END = "<!-- END Open Artifacts skill -->";
@@ -47773,14 +48023,15 @@ var MAX_SKILL_BYTES = 256 * 1024;
47773
48023
  var env = (deps) => deps.env ?? {};
47774
48024
  var skillDir = (deps, h) => {
47775
48025
  const e = env(deps);
47776
- const opencode = e.OPENCODE_CONFIG_DIR ?? join19(e.XDG_CONFIG_HOME ?? join19(deps.home, ".config"), "opencode");
47777
- const agents = join19(deps.home, ".agents", "skills");
48026
+ const opencode = e.OPENCODE_CONFIG_DIR ?? join20(e.XDG_CONFIG_HOME ?? join20(deps.home, ".config"), "opencode");
48027
+ const agents = join20(deps.home, ".agents", "skills");
47778
48028
  return {
47779
- claude: join19(e.CLAUDE_CONFIG_DIR ?? join19(deps.home, ".claude"), "skills"),
47780
- opencode: join19(opencode, "skills"),
48029
+ claude: join20(e.CLAUDE_CONFIG_DIR ?? join20(deps.home, ".claude"), "skills"),
48030
+ opencode: join20(opencode, "skills"),
47781
48031
  pi: agents,
47782
48032
  omp: agents,
47783
- codex: join19(codexHome2(deps.home, e), "AGENTS.md")
48033
+ codex: join20(codexHome2(deps.home, e), "AGENTS.md"),
48034
+ hermes: join20(hermesHome(deps.home, e), "skills")
47784
48035
  }[h];
47785
48036
  };
47786
48037
  var skillFolder = (text3) => {
@@ -47818,7 +48069,7 @@ var quotesMarker = (text3) => {
47818
48069
  };
47819
48070
  var lstatOk = (path) => {
47820
48071
  try {
47821
- lstatSync10(path);
48072
+ lstatSync11(path);
47822
48073
  return true;
47823
48074
  } catch {
47824
48075
  return false;
@@ -47826,7 +48077,7 @@ var lstatOk = (path) => {
47826
48077
  };
47827
48078
  var brokenLink = (path) => {
47828
48079
  try {
47829
- return lstatSync10(path).isSymbolicLink() && !existsSync6(path);
48080
+ return lstatSync11(path).isSymbolicLink() && !existsSync6(path);
47830
48081
  } catch {
47831
48082
  return false;
47832
48083
  }
@@ -47869,21 +48120,21 @@ async function fetchSkillText(doFetch, url2) {
47869
48120
  }
47870
48121
  var targetOf = (path) => {
47871
48122
  try {
47872
- return lstatSync10(path).isSymbolicLink() ? realpathSync8(path) : path;
48123
+ return lstatSync11(path).isSymbolicLink() ? realpathSync8(path) : path;
47873
48124
  } catch {
47874
48125
  return path;
47875
48126
  }
47876
48127
  };
47877
48128
  var seq = 0;
47878
48129
  var writeAtomic2 = (path, text3) => {
47879
- mkdirSync11(dirname10(path), { recursive: true });
48130
+ mkdirSync12(dirname11(path), { recursive: true });
47880
48131
  const tmp = `${path}.oa-${process.pid}-${seq++}.tmp`;
47881
48132
  try {
47882
- writeFileSync8(tmp, text3);
47883
- renameSync11(tmp, path);
48133
+ writeFileSync9(tmp, text3);
48134
+ renameSync12(tmp, path);
47884
48135
  } catch (e) {
47885
48136
  try {
47886
- rmSync7(tmp, { force: true });
48137
+ rmSync8(tmp, { force: true });
47887
48138
  } catch {
47888
48139
  }
47889
48140
  throw e;
@@ -47935,7 +48186,7 @@ async function installSkill(deps, origin, harnesses) {
47935
48186
  failedUrl: url2
47936
48187
  };
47937
48188
  const base3 = skillDir(deps, h);
47938
- const path = harnessSkills[h].agentsMd ? base3 : join19(base3, folder, "SKILL.md");
48189
+ const path = harnessSkills[h].agentsMd ? base3 : join20(base3, folder, "SKILL.md");
47939
48190
  if (brokenLink(path)) {
47940
48191
  notes.push(`Left ${path} alone: it is a broken symlink.`);
47941
48192
  continue;
@@ -47943,7 +48194,7 @@ async function installSkill(deps, origin, harnesses) {
47943
48194
  const writing = targetOf(path);
47944
48195
  try {
47945
48196
  if (harnessSkills[h].agentsMd) {
47946
- const before = existsSync6(writing) ? readFileSync16(writing, "utf8") : "";
48197
+ const before = existsSync6(writing) ? readFileSync17(writing, "utf8") : "";
47947
48198
  if (codexBroken(before)) {
47948
48199
  notes.push(
47949
48200
  `Left ${writing} alone: its Open Artifacts block has no END marker. Fix or remove the block, then rerun the install.`
@@ -47952,7 +48203,7 @@ async function installSkill(deps, origin, harnesses) {
47952
48203
  }
47953
48204
  writeAtomic2(writing, withCodexBlock(before, text3));
47954
48205
  } else {
47955
- if (existsSync6(writing) && !isOurs(readFileSync16(writing, "utf8"), folder)) {
48206
+ if (existsSync6(writing) && !isOurs(readFileSync17(writing, "utf8"), folder)) {
47956
48207
  notes.push(
47957
48208
  `Left ${writing} alone: it has no Open Artifacts marker, so it is not ours to replace.`
47958
48209
  );
@@ -47969,7 +48220,7 @@ async function installSkill(deps, origin, harnesses) {
47969
48220
  }
47970
48221
  return { written, notes };
47971
48222
  }
47972
- var uninstallSkill = (deps, harnesses = ["claude", "opencode", "pi", "omp", "codex"]) => {
48223
+ var uninstallSkill = (deps, harnesses = ["claude", "opencode", "pi", "omp", "codex", "hermes"]) => {
47973
48224
  const written = [];
47974
48225
  const notes = [];
47975
48226
  const seen2 = /* @__PURE__ */ new Set();
@@ -47983,7 +48234,7 @@ var uninstallSkill = (deps, harnesses = ["claude", "opencode", "pi", "omp", "cod
47983
48234
  if (harnessSkills[h].agentsMd) {
47984
48235
  try {
47985
48236
  if (brokenLink(base3) || !existsSync6(base3)) continue;
47986
- const text3 = readFileSync16(base3, "utf8");
48237
+ const text3 = readFileSync17(base3, "utf8");
47987
48238
  if (codexBroken(text3)) {
47988
48239
  notes.push(
47989
48240
  `Left ${base3} alone: its Open Artifacts block has no END marker. Fix or remove the block, then rerun the install.`
@@ -47997,7 +48248,7 @@ var uninstallSkill = (deps, harnesses = ["claude", "opencode", "pi", "omp", "cod
47997
48248
  }).join("\n").trimEnd();
47998
48249
  if (clean) writeAtomic2(targetOf(base3), `${clean}
47999
48250
  `);
48000
- else rmSync7(targetOf(base3), { force: true });
48251
+ else rmSync8(targetOf(base3), { force: true });
48001
48252
  written.push(base3);
48002
48253
  } catch (e) {
48003
48254
  fail(base3, e);
@@ -48007,29 +48258,29 @@ var uninstallSkill = (deps, harnesses = ["claude", "opencode", "pi", "omp", "cod
48007
48258
  let entries;
48008
48259
  try {
48009
48260
  if (!existsSync6(base3)) continue;
48010
- entries = readdirSync4(base3);
48261
+ entries = readdirSync5(base3);
48011
48262
  } catch (e) {
48012
48263
  fail(base3, e);
48013
48264
  continue;
48014
48265
  }
48015
48266
  for (const entry of entries) {
48016
- const dir = join19(base3, entry);
48017
- const file2 = join19(dir, "SKILL.md");
48267
+ const dir = join20(base3, entry);
48268
+ const file2 = join20(dir, "SKILL.md");
48018
48269
  try {
48019
- const st = lstatSync10(dir);
48270
+ const st = lstatSync11(dir);
48020
48271
  if (st.isSymbolicLink()) {
48021
48272
  if (existsSync6(file2))
48022
48273
  notes.push(`Left ${dir} alone: it is a symlinked folder.`);
48023
48274
  continue;
48024
48275
  }
48025
48276
  if (!st.isDirectory() || !lstatOk(file2)) continue;
48026
- if (!isOurs(readFileSync16(targetOf(file2), "utf8"), entry)) {
48277
+ if (!isOurs(readFileSync17(targetOf(file2), "utf8"), entry)) {
48027
48278
  notes.push(
48028
48279
  `Left ${file2} alone: it is not an Open Artifacts skill file.`
48029
48280
  );
48030
48281
  continue;
48031
48282
  }
48032
- rmSync7(targetOf(file2), { force: true });
48283
+ rmSync8(targetOf(file2), { force: true });
48033
48284
  try {
48034
48285
  rmdirSync(dir);
48035
48286
  } catch {
@@ -48123,7 +48374,7 @@ async function loginStep(ctx, opts) {
48123
48374
  ctx,
48124
48375
  c.approved(result.label),
48125
48376
  c.tokenSaved(
48126
- tilde(ctx, join20(ctx.home, "machine.json")),
48377
+ tilde(ctx, join21(ctx.home, "machine.json")),
48127
48378
  result.machineToken
48128
48379
  ),
48129
48380
  c.connected(originOf2(result.hub)),
@@ -48168,6 +48419,7 @@ async function harnessesStep(ctx, hub) {
48168
48419
  else if (out.skipped.length === 0) say(ctx, c.noHarness());
48169
48420
  if (out.sharedPiFile) say(ctx, c.sharedPiFile());
48170
48421
  if (out.codexNoWake) say(ctx, c.codexNoWake());
48422
+ if (out.hermesRestart) say(ctx, c.hermesRestart());
48171
48423
  for (const s of out.skipped)
48172
48424
  say(ctx, await skippedLines(ctx, s.harness, s.reason));
48173
48425
  if (out.installed.includes("opencode"))
@@ -48212,7 +48464,7 @@ function shownSocket(ctx) {
48212
48464
  const real2 = `${canonicalHome(ctx.home)}/`;
48213
48465
  return tilde(
48214
48466
  ctx,
48215
- path.startsWith(real2) ? join20(ctx.home, path.slice(real2.length)) : path
48467
+ path.startsWith(real2) ? join21(ctx.home, path.slice(real2.length)) : path
48216
48468
  );
48217
48469
  }
48218
48470
  async function waitForDaemon(ctx) {
@@ -48307,16 +48559,24 @@ var installSteps = (opts) => [
48307
48559
  label: "Harnesses configured",
48308
48560
  failed: "Harnesses not configured",
48309
48561
  action: `Run ${BUS_CMD} to configure them.`,
48310
- check: async (ctx) => Object.values(
48311
- checkAdapters({
48562
+ check: async (ctx) => {
48563
+ const wiring = checkAdapters({
48312
48564
  home: ctx.userHome,
48313
48565
  busHome: ctx.home,
48314
48566
  env: ctx.env,
48315
48567
  which: ctx.which,
48316
48568
  codexApp: ctx.codexApp,
48317
48569
  busBin: ctx.service.argv?.()
48318
- })
48319
- ).includes("missing") ? "todo" : "done",
48570
+ });
48571
+ if (Object.values(wiring).includes("missing")) return "todo";
48572
+ if (wiring.hermes === "configured" && !await hermesEnabled({
48573
+ home: ctx.userHome,
48574
+ env: ctx.env,
48575
+ exec: ctx.exec
48576
+ }))
48577
+ return "todo";
48578
+ return "done";
48579
+ },
48320
48580
  apply: (ctx) => harnessesStep(ctx, opts.hub)
48321
48581
  },
48322
48582
  {
@@ -48348,7 +48608,7 @@ async function install2(opts, ctx) {
48348
48608
  return results.every((r) => r.state === "done") ? 0 : 1;
48349
48609
  }
48350
48610
  const ok = await runSteps(steps, ctx, {
48351
- path: join20(ctx.home, "install.json"),
48611
+ path: join21(ctx.home, "install.json"),
48352
48612
  now: ctx.now
48353
48613
  });
48354
48614
  const skillFailed = reportSkillFailure(ctx);
@@ -48497,7 +48757,7 @@ async function healthz(ctx, hub) {
48497
48757
  function claudeIsolates(path) {
48498
48758
  let text3;
48499
48759
  try {
48500
- text3 = readFileSync17(path, "utf8");
48760
+ text3 = readFileSync18(path, "utf8");
48501
48761
  } catch {
48502
48762
  return void 0;
48503
48763
  }
@@ -48564,7 +48824,7 @@ async function doctor(ctx) {
48564
48824
  const node2 = ctx.nodeVersion.replace(/^v/, "");
48565
48825
  if (Number(node2.split(".")[0]) >= MIN_NODE) pass(c.nodeOk(node2));
48566
48826
  else fail(c.nodeOld(node2));
48567
- const machineFile = tilde(ctx, join21(ctx.home, "machine.json"));
48827
+ const machineFile = tilde(ctx, join22(ctx.home, "machine.json"));
48568
48828
  const m = readMachine(ctx.home);
48569
48829
  if (m.state !== "ok") fail(c.noCredentials(machineFile));
48570
48830
  else if (m.revoked) fail(c.revokedCheck());
@@ -48617,7 +48877,14 @@ async function doctor(ctx) {
48617
48877
  codexApp: ctx.codexApp,
48618
48878
  busBin: ctx.service.argv?.()
48619
48879
  });
48620
- for (const h of ["claude", "opencode", "pi", "omp", "codex"]) {
48880
+ for (const h of [
48881
+ "claude",
48882
+ "opencode",
48883
+ "pi",
48884
+ "omp",
48885
+ "codex",
48886
+ "hermes"
48887
+ ]) {
48621
48888
  if (wiring[h] === "absent") continue;
48622
48889
  let version2;
48623
48890
  if (h === "opencode") {
@@ -48631,11 +48898,16 @@ async function doctor(ctx) {
48631
48898
  continue;
48632
48899
  }
48633
48900
  }
48634
- if (wiring[h] === "configured") pass(c.wired(h, version2));
48901
+ if (wiring[h] === "configured" && (h !== "hermes" || await hermesEnabled({
48902
+ home: ctx.userHome,
48903
+ env: ctx.env,
48904
+ exec: ctx.exec
48905
+ })))
48906
+ pass(c.wired(h, version2));
48635
48907
  else fail(c.notWired(h));
48636
48908
  if (h === "claude") {
48637
- const settings = join21(
48638
- ctx.env.CLAUDE_CONFIG_DIR ?? join21(ctx.userHome, ".claude"),
48909
+ const settings = join22(
48910
+ ctx.env.CLAUDE_CONFIG_DIR ?? join22(ctx.userHome, ".claude"),
48639
48911
  "settings.json"
48640
48912
  );
48641
48913
  const isolates = claudeIsolates(settings);
@@ -48647,13 +48919,13 @@ async function doctor(ctx) {
48647
48919
  const allow = globalFile(ctx.home);
48648
48920
  const list = readGlobalDirs(allow);
48649
48921
  if (list.error) warn(c.globalUnusable(tilde(ctx, allow), list.error));
48650
- const files = scanConfigFiles(ctx.cwd, {
48922
+ const files2 = scanConfigFiles(ctx.cwd, {
48651
48923
  globalFile: allow,
48652
48924
  namespacesFile: namespacesFile(ctx.home)
48653
48925
  }).filter((f) => f.file !== allow);
48654
- if (files.length > 0) {
48655
- n.warnings += files.length;
48656
- say(ctx, configFileLines(ctx, files));
48926
+ if (files2.length > 0) {
48927
+ n.warnings += files2.length;
48928
+ say(ctx, configFileLines(ctx, files2));
48657
48929
  }
48658
48930
  if (asksForGlobal(ctx, list.dirs)) warn(c.globalAsked());
48659
48931
  say(ctx, "", c.summary(n.failed, n.warnings, n.passed));
@@ -48662,7 +48934,7 @@ async function doctor(ctx) {
48662
48934
 
48663
48935
  // src/commands/global.ts
48664
48936
  import { realpathSync as realpathSync9, statSync as statSync10 } from "node:fs";
48665
- import { resolve as resolve6 } from "node:path";
48937
+ import { resolve as resolve7 } from "node:path";
48666
48938
  function shown(ctx, path) {
48667
48939
  const t = tilde(ctx, path);
48668
48940
  if (t !== path) return t;
@@ -48688,7 +48960,7 @@ async function global(opts, ctx) {
48688
48960
  );
48689
48961
  return 0;
48690
48962
  }
48691
- const given = resolve6(ctx.cwd, opts.dir);
48963
+ const given = resolve7(ctx.cwd, opts.dir);
48692
48964
  let real2;
48693
48965
  try {
48694
48966
  real2 = canonicalPath(given);
@@ -48721,10 +48993,10 @@ async function global(opts, ctx) {
48721
48993
 
48722
48994
  // src/commands/link.ts
48723
48995
  import { statSync as statSync11 } from "node:fs";
48724
- import { resolve as resolve7 } from "node:path";
48996
+ import { resolve as resolve8 } from "node:path";
48725
48997
  init_src();
48726
48998
  function side(ctx, dir) {
48727
- const given = resolve7(ctx.cwd, dir);
48999
+ const given = resolve8(ctx.cwd, dir);
48728
49000
  try {
48729
49001
  const real2 = canonicalPath(given);
48730
49002
  if (!statSync11(real2).isDirectory()) return void 0;
@@ -48753,7 +49025,7 @@ async function link(opts, ctx) {
48753
49025
  for (const d of opts.dirs) {
48754
49026
  const s = side(ctx, d);
48755
49027
  if (!s) {
48756
- sayErr(ctx, c.linkNotDir(shq(resolve7(ctx.cwd, d))));
49028
+ sayErr(ctx, c.linkNotDir(shq(resolve8(ctx.cwd, d))));
48757
49029
  return 1;
48758
49030
  }
48759
49031
  sides.push(s);
@@ -48813,14 +49085,14 @@ async function link(opts, ctx) {
48813
49085
  }
48814
49086
 
48815
49087
  // src/commands/logs.ts
48816
- import { readFileSync as readFileSync18 } from "node:fs";
48817
- import { join as join22 } from "node:path";
49088
+ import { readFileSync as readFileSync19 } from "node:fs";
49089
+ import { join as join23 } from "node:path";
48818
49090
  var TAIL = 50;
48819
49091
  async function logs(ctx) {
48820
- const path = join22(ctx.home, "logs", "daemon.log");
49092
+ const path = join23(ctx.home, "logs", "daemon.log");
48821
49093
  let text3;
48822
49094
  try {
48823
- text3 = readFileSync18(path, "utf8");
49095
+ text3 = readFileSync19(path, "utf8");
48824
49096
  } catch {
48825
49097
  say(ctx, ctx.copy.noLog(tilde(ctx, path)));
48826
49098
  return 1;
@@ -48847,7 +49119,7 @@ async function mcp(harness, ctx, load = (h) => MCP_SERVER[h]()) {
48847
49119
 
48848
49120
  // src/commands/namespace.ts
48849
49121
  import { realpathSync as realpathSync10, statSync as statSync12 } from "node:fs";
48850
- import { join as join23, resolve as resolve8 } from "node:path";
49122
+ import { join as join24, resolve as resolve9 } from "node:path";
48851
49123
  init_src();
48852
49124
  function shown2(ctx, path) {
48853
49125
  const t = tilde(ctx, path);
@@ -48874,7 +49146,7 @@ async function namespace(opts, ctx) {
48874
49146
  );
48875
49147
  return 0;
48876
49148
  }
48877
- const given = resolve8(ctx.cwd, opts.dir);
49149
+ const given = resolve9(ctx.cwd, opts.dir);
48878
49150
  let real2;
48879
49151
  try {
48880
49152
  real2 = canonicalPath(given);
@@ -48901,7 +49173,7 @@ async function namespace(opts, ctx) {
48901
49173
  sayErr(ctx, c.nsNotDir(shown2(ctx, real2 ?? given)));
48902
49174
  return 1;
48903
49175
  }
48904
- const cfgFile = join23(real2, CONFIG_FILE);
49176
+ const cfgFile = join24(real2, CONFIG_FILE);
48905
49177
  const own2 = readOwnFile(cfgFile, process.getuid?.(), {
48906
49178
  allowGroupWrite: true
48907
49179
  });
@@ -48958,12 +49230,12 @@ async function namespace(opts, ctx) {
48958
49230
  }
48959
49231
 
48960
49232
  // src/commands/uninstall.ts
48961
- import { join as join25 } from "node:path";
49233
+ import { join as join26 } from "node:path";
48962
49234
 
48963
49235
  // src/steps/purge.ts
48964
49236
  init_src3();
48965
- import { lstatSync as lstatSync11, readdirSync as readdirSync5, rmdirSync as rmdirSync2, rmSync as rmSync8 } from "node:fs";
48966
- import { join as join24 } from "node:path";
49237
+ import { lstatSync as lstatSync12, readdirSync as readdirSync6, rmdirSync as rmdirSync2, rmSync as rmSync9 } from "node:fs";
49238
+ import { join as join25 } from "node:path";
48967
49239
  var FILES = [
48968
49240
  "machine.json",
48969
49241
  "install.json",
@@ -48990,18 +49262,18 @@ var FOLDERS = [
48990
49262
  { path: "opencode-tui", ours: (n) => /^\d+\.json(\.\d+\.tmp)?$/.test(n) },
48991
49263
  {
48992
49264
  path: "claude-return",
48993
- ours: (_n, p) => kind(p) === "socket"
49265
+ ours: (_n, p) => kind2(p) === "socket"
48994
49266
  }
48995
49267
  ];
48996
- function kind(path) {
49268
+ function kind2(path) {
48997
49269
  try {
48998
- const st = lstatSync11(path);
49270
+ const st = lstatSync12(path);
48999
49271
  return st.isDirectory() ? "dir" : st.isSocket() ? "socket" : "other";
49000
49272
  } catch {
49001
49273
  return void 0;
49002
49274
  }
49003
49275
  }
49004
- var remove2 = (path, k) => rmSync8(path, { recursive: k === "dir", force: true });
49276
+ var remove2 = (path, k) => rmSync9(path, { recursive: k === "dir", force: true });
49005
49277
  var rmdirIfEmpty = (path) => {
49006
49278
  try {
49007
49279
  rmdirSync2(path);
@@ -49011,16 +49283,16 @@ var rmdirIfEmpty = (path) => {
49011
49283
  }
49012
49284
  };
49013
49285
  function purgeShort(dir, removed) {
49014
- if (kind(dir) !== "dir" || unsafeSocketDir(dir)) return;
49015
- const ret = join24(dir, "claude-return");
49286
+ if (kind2(dir) !== "dir" || unsafeSocketDir(dir)) return;
49287
+ const ret = join25(dir, "claude-return");
49016
49288
  for (const [d, ours2] of [
49017
- [ret, (_n, p) => kind(p) === "socket"],
49289
+ [ret, (_n, p) => kind2(p) === "socket"],
49018
49290
  [dir, (n) => /^daemon\.sock(\.keep-\d+)?$/.test(n)]
49019
49291
  ]) {
49020
- if (kind(d) !== "dir") continue;
49021
- for (const name of readdirSync5(d)) {
49022
- const path = join24(d, name);
49023
- const k = kind(path);
49292
+ if (kind2(d) !== "dir") continue;
49293
+ for (const name of readdirSync6(d)) {
49294
+ const path = join25(d, name);
49295
+ const k = kind2(path);
49024
49296
  if (k === void 0 || k === "dir" || !ours2(name, path)) continue;
49025
49297
  remove2(path, k);
49026
49298
  removed.push(path);
@@ -49032,7 +49304,7 @@ function purgeShort(dir, removed) {
49032
49304
  function purge(home2, opts) {
49033
49305
  let entries;
49034
49306
  try {
49035
- entries = readdirSync5(home2);
49307
+ entries = readdirSync6(home2);
49036
49308
  } catch {
49037
49309
  return { removed: [], leftDir: false };
49038
49310
  }
@@ -49044,21 +49316,21 @@ function purge(home2, opts) {
49044
49316
  ...FILES,
49045
49317
  ...entries.filter((n) => TEMP.some((re) => re.test(n)))
49046
49318
  ]) {
49047
- const path = join24(home2, name);
49048
- const k = kind(path);
49319
+ const path = join25(home2, name);
49320
+ const k = kind2(path);
49049
49321
  if (k === void 0 || k === "dir") continue;
49050
49322
  remove2(path, k);
49051
49323
  removed.push(name);
49052
49324
  }
49053
49325
  for (const folder of FOLDERS) {
49054
- const dir = join24(home2, folder.path);
49055
- if (kind(dir) !== "dir") continue;
49056
- for (const name of readdirSync5(dir)) {
49057
- const path = join24(dir, name);
49058
- const k = kind(path);
49326
+ const dir = join25(home2, folder.path);
49327
+ if (kind2(dir) !== "dir") continue;
49328
+ for (const name of readdirSync6(dir)) {
49329
+ const path = join25(dir, name);
49330
+ const k = kind2(path);
49059
49331
  if (k === void 0 || !folder.ours(name, path)) continue;
49060
49332
  remove2(path, k);
49061
- removed.push(join24(folder.path, name));
49333
+ removed.push(join25(folder.path, name));
49062
49334
  }
49063
49335
  if (rmdirIfEmpty(dir)) removed.push(folder.path);
49064
49336
  }
@@ -49097,6 +49369,13 @@ async function uninstall2(opts, ctx) {
49097
49369
  `Could not remove the skill files: ${e instanceof Error ? e.message : String(e)}`
49098
49370
  ]);
49099
49371
  }
49372
+ if (r.hermesNoCli)
49373
+ say(
49374
+ ctx,
49375
+ c.hermesNoCli(
49376
+ tilde(ctx, join26(hermesHome(ctx.userHome, ctx.env), "config.yaml"))
49377
+ )
49378
+ );
49100
49379
  if (r.folderOnly.includes("opencode")) say(ctx, c.removedPluginFolder());
49101
49380
  if (r.removed.length + r.folderOnly.length === 0) say(ctx, c.noneWired());
49102
49381
  for (const s of r.skipped)
@@ -49110,7 +49389,7 @@ async function uninstall2(opts, ctx) {
49110
49389
  r.opencodeRestarted ? c.restartedUnload() : c.opencodeNotRunningUnload()
49111
49390
  );
49112
49391
  if (!opts.purge) {
49113
- say(ctx, "", c.kept(tilde(ctx, join25(ctx.home, "machine.json"))));
49392
+ say(ctx, "", c.kept(tilde(ctx, join26(ctx.home, "machine.json"))));
49114
49393
  return 0;
49115
49394
  }
49116
49395
  const home2 = tilde(ctx, ctx.home);
@@ -49121,7 +49400,7 @@ async function uninstall2(opts, ctx) {
49121
49400
  } catch {
49122
49401
  }
49123
49402
  const out = purge(ctx.home, {
49124
- isDefault: ctx.home === join25(ctx.userHome, ".oa-bus")
49403
+ isDefault: ctx.home === join26(ctx.userHome, ".oa-bus")
49125
49404
  });
49126
49405
  if ("refused" in out) {
49127
49406
  sayErr(ctx, c.purgeRefused(home2));
@@ -49288,7 +49567,7 @@ async function main(argv, makeCtx = realCtx) {
49288
49567
  return 2;
49289
49568
  }
49290
49569
  const ctx = makeCtx(cmd.noColor);
49291
- if (cmd.home) ctx.home = resolve9(cmd.home);
49570
+ if (cmd.home) ctx.home = resolve10(cmd.home);
49292
49571
  try {
49293
49572
  return await dispatch(cmd, ctx);
49294
49573
  } catch (e) {