@open-artifacts/bus 0.244.0 → 0.245.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/oa-bus.ts +1 -1
- package/assets/openclaw/index.js +1 -1
- package/assets/openclaw/package.json +1 -1
- package/dist/index.js +120 -72
- package/package.json +2 -2
package/assets/oa-bus.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { StringDecoder } from "node:string_decoder";
|
|
|
11
11
|
type Json = Record<string, unknown>;
|
|
12
12
|
|
|
13
13
|
/** The IPC marker (CONTRACT.md): the package version, stamped by the CLI's bundler. */
|
|
14
|
-
const CLIENT_VERSION = "0.
|
|
14
|
+
const CLIENT_VERSION = "0.245.0";
|
|
15
15
|
|
|
16
16
|
type Frame = Json & { type: string; id: string };
|
|
17
17
|
type Ctx = {
|
package/assets/openclaw/index.js
CHANGED
|
@@ -27876,7 +27876,7 @@ var base2 = { v: external_exports.literal(V), id: external_exports.string().min(
|
|
|
27876
27876
|
var late = { late: external_exports.array(external_exports.string().min(1)).optional() };
|
|
27877
27877
|
var isWellFormed2 = (s) => s.isWellFormed();
|
|
27878
27878
|
var WELL_FORMED = { message: "text is not well-formed unicode" };
|
|
27879
|
-
var CLIENT_VERSION = true ? "0.
|
|
27879
|
+
var CLIENT_VERSION = true ? "0.245.0" : "0.0.0";
|
|
27880
27880
|
var clientVersion = {
|
|
27881
27881
|
client_version: external_exports.string().min(1).max(64).optional()
|
|
27882
27882
|
};
|
package/dist/index.js
CHANGED
|
@@ -32923,7 +32923,7 @@ var init_frames = __esm({
|
|
|
32923
32923
|
late = { late: external_exports.array(external_exports.string().min(1)).optional() };
|
|
32924
32924
|
isWellFormed2 = (s) => s.isWellFormed();
|
|
32925
32925
|
WELL_FORMED = { message: "text is not well-formed unicode" };
|
|
32926
|
-
CLIENT_VERSION = true ? "0.
|
|
32926
|
+
CLIENT_VERSION = true ? "0.245.0" : "0.0.0";
|
|
32927
32927
|
clientVersion = {
|
|
32928
32928
|
client_version: external_exports.string().min(1).max(64).optional()
|
|
32929
32929
|
};
|
|
@@ -44359,7 +44359,7 @@ var init_stdio2 = __esm({
|
|
|
44359
44359
|
|
|
44360
44360
|
// ../bus-adapter-claude-code/src/main.ts
|
|
44361
44361
|
var main_exports = {};
|
|
44362
|
-
import { existsSync as
|
|
44362
|
+
import { existsSync as existsSync20 } from "node:fs";
|
|
44363
44363
|
var SESSIONS, connect5, rules, server, underClaude;
|
|
44364
44364
|
var init_main = __esm({
|
|
44365
44365
|
async "../bus-adapter-claude-code/src/main.ts"() {
|
|
@@ -44384,7 +44384,7 @@ var init_main = __esm({
|
|
|
44384
44384
|
}),
|
|
44385
44385
|
// A short socket folder another user could reach is never dialed.
|
|
44386
44386
|
socketDirProblem: () => socketDirProblem(HOME3),
|
|
44387
|
-
socketExists: () =>
|
|
44387
|
+
socketExists: () => existsSync20(SOCKET3),
|
|
44388
44388
|
connect: (session) => connectDaemon({
|
|
44389
44389
|
path: SOCKET3,
|
|
44390
44390
|
hello: sessionHello(session, process.pid, process.cwd())
|
|
@@ -54199,6 +54199,11 @@ async function runDaemon(deps2 = {}) {
|
|
|
54199
54199
|
return any2;
|
|
54200
54200
|
};
|
|
54201
54201
|
const lookup = deps2.homeLookup ?? (instHome === void 0 ? () => ({ instance: MAIN_INSTANCE }) : folderHomeLookup(instHome));
|
|
54202
|
+
const connectedHome = (cwd) => {
|
|
54203
|
+
const r = lookup(cwd);
|
|
54204
|
+
const name = "instance" in r ? r.instance : void 0;
|
|
54205
|
+
return name !== void 0 && lanes.get(name) ? name : void 0;
|
|
54206
|
+
};
|
|
54202
54207
|
const unmappedNoted = /* @__PURE__ */ new Set();
|
|
54203
54208
|
const homeInstance = (cwd) => {
|
|
54204
54209
|
const r = lookup(cwd);
|
|
@@ -55214,7 +55219,8 @@ async function runDaemon(deps2 = {}) {
|
|
|
55214
55219
|
sendLink(prev);
|
|
55215
55220
|
}
|
|
55216
55221
|
}
|
|
55217
|
-
|
|
55222
|
+
const rehome = prev?.live === true && prev.instance === void 0 && prev.pid === s.pid && prev.procStart === s.procStart && isAbsolute8(s.cwd) && connectedHome(s.cwd) !== void 0;
|
|
55223
|
+
if (prev?.live && !rehome) {
|
|
55218
55224
|
if (!livePid(s.ref, prev.pid)) {
|
|
55219
55225
|
prev.pid = s.pid;
|
|
55220
55226
|
prev.procStart = s.procStart;
|
|
@@ -55226,7 +55232,7 @@ async function runDaemon(deps2 = {}) {
|
|
|
55226
55232
|
renameIfChanged(prev, s.name, s.pid, s.nameChosen === true);
|
|
55227
55233
|
continue;
|
|
55228
55234
|
}
|
|
55229
|
-
if (prev && prev.pid === s.pid && prev.procStart === s.procStart) {
|
|
55235
|
+
if (!rehome && prev && prev.pid === s.pid && prev.procStart === s.procStart) {
|
|
55230
55236
|
if (prev.closedBy !== "liveness") continue;
|
|
55231
55237
|
const last = reopenedAt.get(s.ref);
|
|
55232
55238
|
if (last !== void 0 && Date.now() - last < REOPEN_SAME_PROC_MS)
|
|
@@ -56791,7 +56797,7 @@ async function runDaemon(deps2 = {}) {
|
|
|
56791
56797
|
|
|
56792
56798
|
// src/bus-cmd.ts
|
|
56793
56799
|
init_src();
|
|
56794
|
-
import { existsSync as
|
|
56800
|
+
import { existsSync as existsSync18 } from "node:fs";
|
|
56795
56801
|
import { join as join40 } from "node:path";
|
|
56796
56802
|
|
|
56797
56803
|
// src/context.ts
|
|
@@ -59808,7 +59814,7 @@ var noService = {
|
|
|
59808
59814
|
remove: async () => ({}),
|
|
59809
59815
|
cli: () => ["oa-bus"]
|
|
59810
59816
|
};
|
|
59811
|
-
var VERSION = true ? "0.
|
|
59817
|
+
var VERSION = true ? "0.245.0" : JSON.parse(
|
|
59812
59818
|
readFileSync24(new URL("../package.json", import.meta.url), "utf8")
|
|
59813
59819
|
).version;
|
|
59814
59820
|
var which = (cmd) => {
|
|
@@ -59989,7 +59995,7 @@ var isolated = (ctx) => Boolean(ctx.service.isolated);
|
|
|
59989
59995
|
import { randomBytes as randomBytes8 } from "node:crypto";
|
|
59990
59996
|
import {
|
|
59991
59997
|
chmodSync as chmodSync20,
|
|
59992
|
-
existsSync as
|
|
59998
|
+
existsSync as existsSync17,
|
|
59993
59999
|
lstatSync as lstatSync18,
|
|
59994
60000
|
mkdirSync as mkdirSync15,
|
|
59995
60001
|
readFileSync as readFileSync33,
|
|
@@ -61245,7 +61251,8 @@ var PI_EXTENSION = fileURLToPath4(
|
|
|
61245
61251
|
var hostSlug = (host) => host.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "instance";
|
|
61246
61252
|
|
|
61247
61253
|
// src/steps/claude-proof.ts
|
|
61248
|
-
|
|
61254
|
+
init_src3();
|
|
61255
|
+
import { existsSync as existsSync10, lstatSync as lstatSync13, readFileSync as readFileSync25 } from "node:fs";
|
|
61249
61256
|
import { join as join32, resolve as resolve7 } from "node:path";
|
|
61250
61257
|
var claudeConfigFile2 = (home2, env2) => join32(env2.CLAUDE_CONFIG_DIR ?? home2, ".claude.json");
|
|
61251
61258
|
var PROOF_COMMAND = "mcp-proof";
|
|
@@ -61276,6 +61283,16 @@ function helperHome(helper) {
|
|
|
61276
61283
|
);
|
|
61277
61284
|
}
|
|
61278
61285
|
var ownedBy = (helper, busHome2) => helperHome(helper) === (busHome2 === void 0 ? void 0 : resolve7(busHome2));
|
|
61286
|
+
function busStopped(owner, userHome, opts = {}) {
|
|
61287
|
+
const home2 = owner ?? join32(userHome, ".oa-bus");
|
|
61288
|
+
try {
|
|
61289
|
+
if (!existsSync10(home2)) return true;
|
|
61290
|
+
if (existsSync10(daemonSocketPath(home2))) return false;
|
|
61291
|
+
return !opts.retired || !existsSync10(join32(home2, "install.json"));
|
|
61292
|
+
} catch {
|
|
61293
|
+
return false;
|
|
61294
|
+
}
|
|
61295
|
+
}
|
|
61279
61296
|
var isRecord4 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
61280
61297
|
function isInstanceEntry(entry, origin) {
|
|
61281
61298
|
if (!isRecord4(entry) || typeof entry.url !== "string") return false;
|
|
@@ -61401,13 +61418,18 @@ function installProof(io, origin, busBin, busHome2, opts = {}) {
|
|
|
61401
61418
|
const rec = records[at];
|
|
61402
61419
|
const cur = f.entry.headersHelper;
|
|
61403
61420
|
let original;
|
|
61404
|
-
|
|
61421
|
+
const foreign = typeof cur === "string" && isProofHelper(cur) && !ownedBy(cur, busHome2);
|
|
61422
|
+
if (foreign && opts.stopped?.(helperHome(cur))) {
|
|
61423
|
+
original = adoptedOriginal(cur);
|
|
61424
|
+
out.notes.push(
|
|
61425
|
+
`took over the headersHelper of ${f.name} (${f.scope} scope) in ${io.file}: the bus at ${helperHome(cur) ?? "the default home"} no longer runs`
|
|
61426
|
+
);
|
|
61427
|
+
} else if (foreign) {
|
|
61405
61428
|
out.notes.push(
|
|
61406
61429
|
`left the headersHelper of ${f.name} (${f.scope} scope) in ${io.file} as it is: it belongs to the bus at ${helperHome(cur) ?? "the default home"}`
|
|
61407
61430
|
);
|
|
61408
61431
|
continue;
|
|
61409
|
-
}
|
|
61410
|
-
if (isProofHelper(cur) && rec) original = rec.original;
|
|
61432
|
+
} else if (isProofHelper(cur) && rec) original = rec.original;
|
|
61411
61433
|
else if (isProofHelper(cur) && !opts.guard && typeof cur === "string")
|
|
61412
61434
|
original = adoptedOriginal(cur);
|
|
61413
61435
|
else if (isProofHelper(cur)) continue;
|
|
@@ -61561,7 +61583,7 @@ function proofReport(file2, origin, opts = {}) {
|
|
|
61561
61583
|
}
|
|
61562
61584
|
return report;
|
|
61563
61585
|
}
|
|
61564
|
-
function addInstanceProof(io, target2, busBin, busHome2) {
|
|
61586
|
+
function addInstanceProof(io, target2, busBin, busHome2, stopped) {
|
|
61565
61587
|
let matched = 0;
|
|
61566
61588
|
try {
|
|
61567
61589
|
const text3 = (io.read ?? readText)(io.file);
|
|
@@ -61571,7 +61593,10 @@ function addInstanceProof(io, target2, busBin, busHome2) {
|
|
|
61571
61593
|
}
|
|
61572
61594
|
if (matched === 0) return { notes: [], changed: [], matched };
|
|
61573
61595
|
return {
|
|
61574
|
-
...installProof(io, "", busBin, busHome2, {
|
|
61596
|
+
...installProof(io, "", busBin, busHome2, {
|
|
61597
|
+
instance: target2,
|
|
61598
|
+
...stopped ? { stopped } : {}
|
|
61599
|
+
}),
|
|
61575
61600
|
matched
|
|
61576
61601
|
};
|
|
61577
61602
|
}
|
|
@@ -61579,7 +61604,7 @@ function addInstanceProof(io, target2, busBin, busHome2) {
|
|
|
61579
61604
|
// src/steps/codex-proof.ts
|
|
61580
61605
|
init_src3();
|
|
61581
61606
|
init_src();
|
|
61582
|
-
import { existsSync as
|
|
61607
|
+
import { existsSync as existsSync11, readFileSync as readFileSync26, rmSync as rmSync14 } from "node:fs";
|
|
61583
61608
|
import { isAbsolute as isAbsolute11 } from "node:path";
|
|
61584
61609
|
var CODEX_MIN_VERSION = "0.123.0";
|
|
61585
61610
|
var PROXY_CMD = "mcp-proxy";
|
|
@@ -61702,7 +61727,7 @@ function plan(doc, origin, patFile) {
|
|
|
61702
61727
|
if (name === CODEX_ENTRY || !isRecord5(e)) continue;
|
|
61703
61728
|
const ours2 = ourEntry(e, origin);
|
|
61704
61729
|
if (ours2) {
|
|
61705
|
-
if (ours2.tokenFile !== void 0 && !
|
|
61730
|
+
if (ours2.tokenFile !== void 0 && !existsSync11(ours2.tokenFile))
|
|
61706
61731
|
return {
|
|
61707
61732
|
kind: "note",
|
|
61708
61733
|
note: `the ${name} entry in the Codex config reaches Open Artifacts through oa-bus, but its PAT file ${ours2.tokenFile} is gone, so Codex has no token and its tools fail. Save a PAT there again, or run ${BUS_CMD} uninstall to put your own entry back.`
|
|
@@ -61732,7 +61757,7 @@ function plan(doc, origin, patFile) {
|
|
|
61732
61757
|
);
|
|
61733
61758
|
return { kind: "swap", name, entry: e, cred: { tokenEnv } };
|
|
61734
61759
|
}
|
|
61735
|
-
if (blocker === void 0 && patFile !== void 0 &&
|
|
61760
|
+
if (blocker === void 0 && patFile !== void 0 && existsSync11(patFile))
|
|
61736
61761
|
return { kind: "swap", name, entry: e, cred: { tokenFile: patFile } };
|
|
61737
61762
|
return left(
|
|
61738
61763
|
patFile === void 0 ? "it signs in with `codex mcp login` or another kind of token that oa-bus can't pass on." : `it signs in with \`codex mcp login\` or another kind of token that oa-bus can't pass on, and there is no PAT at ${patFile} for the proxy to use. Save one there (see the connect guide) and run oa-bus install again.`
|
|
@@ -61854,7 +61879,7 @@ function restoreEntry(io) {
|
|
|
61854
61879
|
const m = readMoved(io.moved);
|
|
61855
61880
|
if (!m) return false;
|
|
61856
61881
|
let put2 = false;
|
|
61857
|
-
if (
|
|
61882
|
+
if (existsSync11(io.file)) {
|
|
61858
61883
|
const { text: text3, doc } = readToml(io.file);
|
|
61859
61884
|
const cur = servers2(doc)[m.name];
|
|
61860
61885
|
const lines = splitLines(text3);
|
|
@@ -61896,7 +61921,7 @@ function proxyProgramMissing(doc, which2) {
|
|
|
61896
61921
|
if (i < 0 || a[i + 3] !== "--for" || a[i + 4] !== "codex") continue;
|
|
61897
61922
|
for (const part of [e.command, ...a.slice(0, i)]) {
|
|
61898
61923
|
if (typeof part !== "string") continue;
|
|
61899
|
-
if (isAbsolute11(part) ? !
|
|
61924
|
+
if (isAbsolute11(part) ? !existsSync11(part) : !which2(part))
|
|
61900
61925
|
return { name, missing: part };
|
|
61901
61926
|
}
|
|
61902
61927
|
}
|
|
@@ -61906,7 +61931,7 @@ function proxyProgramMissing(doc, which2) {
|
|
|
61906
61931
|
// src/steps/habits.ts
|
|
61907
61932
|
init_src();
|
|
61908
61933
|
import {
|
|
61909
|
-
existsSync as
|
|
61934
|
+
existsSync as existsSync14,
|
|
61910
61935
|
lstatSync as lstatSync17,
|
|
61911
61936
|
readFileSync as readFileSync30,
|
|
61912
61937
|
realpathSync as realpathSync15,
|
|
@@ -62247,7 +62272,7 @@ async function hermesEnabled(deps2) {
|
|
|
62247
62272
|
|
|
62248
62273
|
// src/steps/openclaw.ts
|
|
62249
62274
|
import {
|
|
62250
|
-
existsSync as
|
|
62275
|
+
existsSync as existsSync13,
|
|
62251
62276
|
lstatSync as lstatSync16,
|
|
62252
62277
|
readdirSync as readdirSync12,
|
|
62253
62278
|
readFileSync as readFileSync29,
|
|
@@ -62260,7 +62285,7 @@ import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
|
62260
62285
|
// src/steps/skill.ts
|
|
62261
62286
|
import {
|
|
62262
62287
|
chmodSync as chmodSync19,
|
|
62263
|
-
existsSync as
|
|
62288
|
+
existsSync as existsSync12,
|
|
62264
62289
|
lstatSync as lstatSync15,
|
|
62265
62290
|
mkdirSync as mkdirSync14,
|
|
62266
62291
|
readdirSync as readdirSync11,
|
|
@@ -62301,7 +62326,7 @@ var withoutCodexBlock = (text3) => {
|
|
|
62301
62326
|
return removed ? lines.join("\n") : void 0;
|
|
62302
62327
|
};
|
|
62303
62328
|
var dropCodexBlock = (agentsPath, notes) => {
|
|
62304
|
-
if (brokenLink(agentsPath) || !
|
|
62329
|
+
if (brokenLink(agentsPath) || !existsSync12(agentsPath)) return false;
|
|
62305
62330
|
const text3 = readFileSync28(agentsPath, "utf8");
|
|
62306
62331
|
if (codexBroken(text3)) {
|
|
62307
62332
|
notes.push(
|
|
@@ -62373,7 +62398,7 @@ var lstatOk = (path) => {
|
|
|
62373
62398
|
};
|
|
62374
62399
|
var brokenLink = (path) => {
|
|
62375
62400
|
try {
|
|
62376
|
-
return lstatSync15(path).isSymbolicLink() && !
|
|
62401
|
+
return lstatSync15(path).isSymbolicLink() && !existsSync12(path);
|
|
62377
62402
|
} catch {
|
|
62378
62403
|
return false;
|
|
62379
62404
|
}
|
|
@@ -62506,7 +62531,7 @@ var installCodex = (deps2, folder, text3, written, notes) => {
|
|
|
62506
62531
|
const filePath = codexSkillFile(deps2, folder);
|
|
62507
62532
|
let before;
|
|
62508
62533
|
try {
|
|
62509
|
-
before =
|
|
62534
|
+
before = existsSync12(targetOf(agentsPath)) ? readFileSync28(targetOf(agentsPath), "utf8") : "";
|
|
62510
62535
|
} catch (e) {
|
|
62511
62536
|
notes.push(
|
|
62512
62537
|
`Left ${agentsPath} alone: could not read it (${e instanceof Error ? e.message : String(e)}).`
|
|
@@ -62535,7 +62560,7 @@ var installCodex = (deps2, folder, text3, written, notes) => {
|
|
|
62535
62560
|
}
|
|
62536
62561
|
const writing2 = targetOf(filePath);
|
|
62537
62562
|
try {
|
|
62538
|
-
if (
|
|
62563
|
+
if (existsSync12(writing2) && !ourSkillFile(writing2, folder)) {
|
|
62539
62564
|
notes.push(
|
|
62540
62565
|
`Left ${writing2} alone: it has no Open Artifacts marker, so it is not ours to replace.`
|
|
62541
62566
|
);
|
|
@@ -62623,7 +62648,7 @@ async function installSkill(deps2, origin, harnesses) {
|
|
|
62623
62648
|
}
|
|
62624
62649
|
const writing = targetOf(path);
|
|
62625
62650
|
try {
|
|
62626
|
-
if (
|
|
62651
|
+
if (existsSync12(writing) && !ourSkillFile(writing, folder)) {
|
|
62627
62652
|
notes.push(
|
|
62628
62653
|
`Left ${writing} alone: it has no Open Artifacts marker, so it is not ours to replace.`
|
|
62629
62654
|
);
|
|
@@ -62657,7 +62682,7 @@ var uninstallSkill = (deps2, harnesses = [
|
|
|
62657
62682
|
const scan2 = (base3) => {
|
|
62658
62683
|
let entries;
|
|
62659
62684
|
try {
|
|
62660
|
-
if (!
|
|
62685
|
+
if (!existsSync12(base3)) return;
|
|
62661
62686
|
entries = readdirSync11(base3);
|
|
62662
62687
|
} catch (e) {
|
|
62663
62688
|
fail3(base3, e);
|
|
@@ -62669,7 +62694,7 @@ var uninstallSkill = (deps2, harnesses = [
|
|
|
62669
62694
|
try {
|
|
62670
62695
|
const st = lstatSync15(dir);
|
|
62671
62696
|
if (st.isSymbolicLink()) {
|
|
62672
|
-
if (
|
|
62697
|
+
if (existsSync12(file2))
|
|
62673
62698
|
notes.push(`Left ${dir} alone: it is a symlinked folder.`);
|
|
62674
62699
|
continue;
|
|
62675
62700
|
}
|
|
@@ -62776,9 +62801,9 @@ function openclawStateDir(home2, env2) {
|
|
|
62776
62801
|
override.startsWith("~") ? override.replace(/^~(?=$|[\\/])/, h) : override
|
|
62777
62802
|
);
|
|
62778
62803
|
const next = join35(h, ".openclaw");
|
|
62779
|
-
if (env2.OPENCLAW_TEST_FAST === "1" ||
|
|
62804
|
+
if (env2.OPENCLAW_TEST_FAST === "1" || existsSync13(next)) return next;
|
|
62780
62805
|
const legacy = join35(h, ".clawdbot");
|
|
62781
|
-
return
|
|
62806
|
+
return existsSync13(legacy) ? legacy : next;
|
|
62782
62807
|
}
|
|
62783
62808
|
var openclawPluginDir = (home2, env2) => join35(openclawStateDir(home2, env2), "extensions", OPENCLAW_PLUGIN_ID);
|
|
62784
62809
|
function openclawPluginDirs(home2, env2) {
|
|
@@ -62921,7 +62946,7 @@ async function installOpenclaw(deps2, notes, optedOut) {
|
|
|
62921
62946
|
return "absent";
|
|
62922
62947
|
}
|
|
62923
62948
|
const shipped = deps2.assets.openclaw;
|
|
62924
|
-
if (shipped === void 0 || !
|
|
62949
|
+
if (shipped === void 0 || !existsSync13(join35(shipped, "openclaw.plugin.json")))
|
|
62925
62950
|
throw new Error("the OpenClaw plugin is missing from this install");
|
|
62926
62951
|
const dest = openclawPluginDir(deps2.home, deps2.env ?? {});
|
|
62927
62952
|
const state = openclawPluginState(dest, shipped);
|
|
@@ -63025,7 +63050,7 @@ var OPENCLAW_PLUGIN = (() => {
|
|
|
63025
63050
|
const packaged = fileURLToPath5(
|
|
63026
63051
|
new URL("../assets/openclaw", import.meta.url)
|
|
63027
63052
|
);
|
|
63028
|
-
if (
|
|
63053
|
+
if (existsSync13(packaged)) return packaged;
|
|
63029
63054
|
return fileURLToPath5(
|
|
63030
63055
|
new URL("../../../bus-adapter-openclaw/dist", import.meta.url)
|
|
63031
63056
|
);
|
|
@@ -63068,7 +63093,7 @@ function habitsFiles(deps2, h) {
|
|
|
63068
63093
|
const pair = (dir) => {
|
|
63069
63094
|
const override = join36(dir, "AGENTS.override.md");
|
|
63070
63095
|
const plain3 = join36(dir, "AGENTS.md");
|
|
63071
|
-
return
|
|
63096
|
+
return existsSync14(override) ? [override, plain3] : [plain3, override];
|
|
63072
63097
|
};
|
|
63073
63098
|
switch (h) {
|
|
63074
63099
|
case "claude":
|
|
@@ -63219,7 +63244,7 @@ function projectHabitsFileState(cwd, h) {
|
|
|
63219
63244
|
const path = projectHabitsTarget(cwd, h);
|
|
63220
63245
|
try {
|
|
63221
63246
|
if (brokenLink(path)) return { state: "broken", path };
|
|
63222
|
-
if (!
|
|
63247
|
+
if (!existsSync14(path)) return { state: "absent", path };
|
|
63223
63248
|
return { ...blockState(readFileSync30(path, "utf8")), path };
|
|
63224
63249
|
} catch {
|
|
63225
63250
|
return { state: "broken", path };
|
|
@@ -63255,7 +63280,7 @@ function writeProjectHabits(deps2, harnesses, io = {}) {
|
|
|
63255
63280
|
);
|
|
63256
63281
|
continue;
|
|
63257
63282
|
}
|
|
63258
|
-
const exists3 =
|
|
63283
|
+
const exists3 = existsSync14(path);
|
|
63259
63284
|
const before = exists3 ? readFileSync30(path, "utf8") : "";
|
|
63260
63285
|
const state = blockState(before).state;
|
|
63261
63286
|
if (exists3 && state === "absent") {
|
|
@@ -63293,7 +63318,7 @@ function removeProjectHabits(deps2, only) {
|
|
|
63293
63318
|
for (const [path, rec] of Object.entries(cur.files)) {
|
|
63294
63319
|
if (only !== void 0 && !only(path)) continue;
|
|
63295
63320
|
try {
|
|
63296
|
-
if (brokenLink(path) || !
|
|
63321
|
+
if (brokenLink(path) || !existsSync14(path) || isLink(path)) {
|
|
63297
63322
|
delete kept[path];
|
|
63298
63323
|
cleaned.add(path);
|
|
63299
63324
|
continue;
|
|
@@ -63332,7 +63357,7 @@ function removeProjectHabits(deps2, only) {
|
|
|
63332
63357
|
exclude.splice(exclude.indexOf(e), 1);
|
|
63333
63358
|
}
|
|
63334
63359
|
}
|
|
63335
|
-
if (deps2.busHome &&
|
|
63360
|
+
if (deps2.busHome && existsSync14(join36(deps2.busHome, "install.json")))
|
|
63336
63361
|
saveRecord(deps2.busHome, { project: { files: kept, exclude } });
|
|
63337
63362
|
return { files: files2, notes };
|
|
63338
63363
|
}
|
|
@@ -63340,7 +63365,7 @@ function habitsFileState(deps2, h) {
|
|
|
63340
63365
|
const path = habitsTarget(deps2, h);
|
|
63341
63366
|
try {
|
|
63342
63367
|
if (brokenLink(path)) return { state: "broken", path };
|
|
63343
|
-
if (!
|
|
63368
|
+
if (!existsSync14(path)) return { state: "absent", path };
|
|
63344
63369
|
return { ...blockState(readFileSync30(targetOf(path), "utf8")), path };
|
|
63345
63370
|
} catch {
|
|
63346
63371
|
return { state: "broken", path };
|
|
@@ -63368,7 +63393,7 @@ function writeHabits(deps2, harnesses, opts = {}) {
|
|
|
63368
63393
|
}
|
|
63369
63394
|
const real3 = targetOf(path);
|
|
63370
63395
|
try {
|
|
63371
|
-
const exists3 =
|
|
63396
|
+
const exists3 = existsSync14(real3);
|
|
63372
63397
|
const before = exists3 ? readFileSync30(real3, "utf8") : "";
|
|
63373
63398
|
const fresh = blockState(before).state === "absent";
|
|
63374
63399
|
const after = withHabits(before, habitsBlock());
|
|
@@ -63398,7 +63423,7 @@ function removeHabits(deps2, harnesses = HABITS_HARNESSES) {
|
|
|
63398
63423
|
if (seen2.has(path)) continue;
|
|
63399
63424
|
seen2.add(path);
|
|
63400
63425
|
try {
|
|
63401
|
-
if (brokenLink(path) || !
|
|
63426
|
+
if (brokenLink(path) || !existsSync14(path)) continue;
|
|
63402
63427
|
const real3 = targetOf(path);
|
|
63403
63428
|
const before = readFileSync30(real3, "utf8");
|
|
63404
63429
|
if (blockState(before).state === "absent") continue;
|
|
@@ -63419,7 +63444,7 @@ function removeHabits(deps2, harnesses = HABITS_HARNESSES) {
|
|
|
63419
63444
|
const p = setPluginHabits(deps2, PLUGIN_HARNESSES, false);
|
|
63420
63445
|
files2.push(...p.markers);
|
|
63421
63446
|
notes.push(...p.notes);
|
|
63422
|
-
if (deps2.busHome &&
|
|
63447
|
+
if (deps2.busHome && existsSync14(join36(deps2.busHome, "install.json")))
|
|
63423
63448
|
saveRecord(deps2.busHome, { files: kept });
|
|
63424
63449
|
return {
|
|
63425
63450
|
files: files2,
|
|
@@ -63437,7 +63462,7 @@ function habitsOn(deps2) {
|
|
|
63437
63462
|
if (seen2.has(path)) continue;
|
|
63438
63463
|
seen2.add(path);
|
|
63439
63464
|
try {
|
|
63440
|
-
if (brokenLink(path) || !
|
|
63465
|
+
if (brokenLink(path) || !existsSync14(path)) continue;
|
|
63441
63466
|
const s = blockState(readFileSync30(targetOf(path), "utf8")).state;
|
|
63442
63467
|
if (s === "current" || s === "changed") out.push(path);
|
|
63443
63468
|
} catch {
|
|
@@ -63507,7 +63532,7 @@ function setPluginHabits(deps2, plugins2, on) {
|
|
|
63507
63532
|
try {
|
|
63508
63533
|
if (isLink(dir) || !pluginOurs(dir, p)) {
|
|
63509
63534
|
notes.push(
|
|
63510
|
-
`Left the ${p.label} plugin alone: ${isLink(dir) ? `${dir} is a symlink.` :
|
|
63535
|
+
`Left the ${p.label} plugin alone: ${isLink(dir) ? `${dir} is a symlink.` : existsSync14(dir) ? `${dir} wasn't installed by ${BUS_CMD}` : `nothing installed at ${dir}.`}`
|
|
63511
63536
|
);
|
|
63512
63537
|
continue;
|
|
63513
63538
|
}
|
|
@@ -63600,7 +63625,7 @@ function setPluginHabits(deps2, plugins2, on) {
|
|
|
63600
63625
|
done.add(dir);
|
|
63601
63626
|
if (!changed.includes(p)) changed.push(p);
|
|
63602
63627
|
}
|
|
63603
|
-
if (deps2.busHome &&
|
|
63628
|
+
if (deps2.busHome && existsSync14(join36(deps2.busHome, "install.json"))) {
|
|
63604
63629
|
const { pluginDirs } = record6(deps2.busHome);
|
|
63605
63630
|
const had = pluginDirs[p.name];
|
|
63606
63631
|
if (had !== void 0) {
|
|
@@ -63662,7 +63687,7 @@ var habitsQuestionLines = (q) => [
|
|
|
63662
63687
|
];
|
|
63663
63688
|
|
|
63664
63689
|
// src/steps/opencode-proof.ts
|
|
63665
|
-
import { existsSync as
|
|
63690
|
+
import { existsSync as existsSync15, readFileSync as readFileSync31, rmSync as rmSync19 } from "node:fs";
|
|
63666
63691
|
import { dirname as dirname17, isAbsolute as isAbsolute13, join as join37, resolve as resolve12 } from "node:path";
|
|
63667
63692
|
init_src();
|
|
63668
63693
|
var OPENCODE_ENTRY_FILE = "opencode-mcp-entry.json";
|
|
@@ -63818,7 +63843,7 @@ function restoreEntry2(io) {
|
|
|
63818
63843
|
const m = readMoved2(io.moved);
|
|
63819
63844
|
if (!m) return false;
|
|
63820
63845
|
let put2 = false;
|
|
63821
|
-
if (
|
|
63846
|
+
if (existsSync15(m.file)) {
|
|
63822
63847
|
const text3 = io.read(m.file);
|
|
63823
63848
|
const now = jsoncValue(text3, m.path);
|
|
63824
63849
|
if (isRecord6(now) && ourEntry2(now, m.origin)) {
|
|
@@ -63843,7 +63868,7 @@ function proxyProgramMissing2(entry, origin, which2) {
|
|
|
63843
63868
|
if (origin !== void 0 && c[i + 2] !== origin) return void 0;
|
|
63844
63869
|
for (const part of c.slice(0, i)) {
|
|
63845
63870
|
if (typeof part !== "string") continue;
|
|
63846
|
-
if (isAbsolute13(part) ? !
|
|
63871
|
+
if (isAbsolute13(part) ? !existsSync15(part) : !which2(part)) return part;
|
|
63847
63872
|
}
|
|
63848
63873
|
return void 0;
|
|
63849
63874
|
}
|
|
@@ -63876,14 +63901,14 @@ function skippedNotes(files2, read2, origin) {
|
|
|
63876
63901
|
}
|
|
63877
63902
|
|
|
63878
63903
|
// src/steps/pi-proof.ts
|
|
63879
|
-
import { existsSync as
|
|
63904
|
+
import { existsSync as existsSync16, readFileSync as readFileSync32, rmSync as rmSync20 } from "node:fs";
|
|
63880
63905
|
var PI_ENTRY_FILE = "pi-mcp-entry.json";
|
|
63881
63906
|
var OMP_ORIGIN_FILE = "omp-mcp-origin.json";
|
|
63882
63907
|
var PI_MIN_VERSION = "1.5.0";
|
|
63883
63908
|
var isRecord7 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
63884
63909
|
var BOM2 = "\uFEFF";
|
|
63885
63910
|
function readConfig2(file2) {
|
|
63886
|
-
if (!
|
|
63911
|
+
if (!existsSync16(file2)) return null;
|
|
63887
63912
|
const raw = readFileSync32(file2, "utf8");
|
|
63888
63913
|
const bom = raw.startsWith(BOM2);
|
|
63889
63914
|
const text3 = bom ? raw.slice(1) : raw;
|
|
@@ -64091,7 +64116,7 @@ function target(path) {
|
|
|
64091
64116
|
let p = path;
|
|
64092
64117
|
for (let hops = 0; hops < 40; hops++) {
|
|
64093
64118
|
if (!present2(p) || !lstatSync18(p).isSymbolicLink()) {
|
|
64094
|
-
if (p !== path && !
|
|
64119
|
+
if (p !== path && !existsSync17(dirname18(p)))
|
|
64095
64120
|
throw new Error(
|
|
64096
64121
|
`${path} is a dangling symlink to ${p}; left it untouched`
|
|
64097
64122
|
);
|
|
@@ -64181,18 +64206,30 @@ async function run4(deps2, cmd, args) {
|
|
|
64181
64206
|
};
|
|
64182
64207
|
}
|
|
64183
64208
|
}
|
|
64184
|
-
|
|
64185
|
-
|
|
64209
|
+
var stoppedBus = (deps2, retired) => (owner) => busStopped(owner, deps2.home, { retired });
|
|
64210
|
+
function instanceProofs(deps2, opts = {}) {
|
|
64211
|
+
const out = [];
|
|
64186
64212
|
const bus = deps2.busHome ?? join38(deps2.home, ".oa-bus");
|
|
64213
|
+
const io = proofIo(deps2);
|
|
64187
64214
|
for (const i of listInstances(bus)) {
|
|
64188
64215
|
if (i.main || i.hub === "") continue;
|
|
64189
|
-
|
|
64190
|
-
|
|
64191
|
-
|
|
64192
|
-
|
|
64216
|
+
out.push(
|
|
64217
|
+
installProof(
|
|
64218
|
+
opts.file ? { ...io, file: opts.file } : io,
|
|
64219
|
+
i.hub,
|
|
64220
|
+
deps2.busBin,
|
|
64221
|
+
movedHome(deps2),
|
|
64222
|
+
{
|
|
64223
|
+
instance: { name: i.name, hub: i.hub },
|
|
64224
|
+
// The daemon takes only a retired bus's entry; a person running
|
|
64225
|
+
// install also takes one whose daemon is not running.
|
|
64226
|
+
stopped: stoppedBus(deps2, opts.guard === true),
|
|
64227
|
+
...opts.guard ? { guard: true } : {}
|
|
64228
|
+
}
|
|
64229
|
+
)
|
|
64193
64230
|
);
|
|
64194
64231
|
}
|
|
64195
|
-
return
|
|
64232
|
+
return out;
|
|
64196
64233
|
}
|
|
64197
64234
|
function claudeProof(deps2, notes) {
|
|
64198
64235
|
if (deps2.hub === void 0) return;
|
|
@@ -64200,7 +64237,7 @@ function claudeProof(deps2, notes) {
|
|
|
64200
64237
|
notes.push(
|
|
64201
64238
|
...installProof(proofIo(deps2), deps2.hub, deps2.busBin, movedHome(deps2)).notes
|
|
64202
64239
|
);
|
|
64203
|
-
notes.push(...
|
|
64240
|
+
for (const r of instanceProofs(deps2)) notes.push(...r.notes);
|
|
64204
64241
|
} catch (e) {
|
|
64205
64242
|
notes.push(
|
|
64206
64243
|
`could not add the proof helper to the Claude entry: ${e instanceof Error ? e.message : String(e)}`
|
|
@@ -64594,7 +64631,7 @@ var uninstall = {
|
|
|
64594
64631
|
const left = { ...record7 };
|
|
64595
64632
|
for (const { file: file2 } of edits) delete left[file2];
|
|
64596
64633
|
writeRecord2(p.record, record7, left);
|
|
64597
|
-
const hadPlugin =
|
|
64634
|
+
const hadPlugin = existsSync17(p.opencodePlugin);
|
|
64598
64635
|
rmSync21(p.opencodePlugin, { recursive: true, force: true });
|
|
64599
64636
|
if (!saved.some(Boolean) && !hadPlugin && !restored) return "none";
|
|
64600
64637
|
if (deps2.which("opencode")) await restartOpencode(deps2, notes, true);
|
|
@@ -64612,16 +64649,16 @@ var uninstall = {
|
|
|
64612
64649
|
throw new Error("kept the extension, the entry is still moved");
|
|
64613
64650
|
}
|
|
64614
64651
|
const path = paths(deps2).pi;
|
|
64615
|
-
if (!
|
|
64652
|
+
if (!existsSync17(path)) return restored ? "done" : "none";
|
|
64616
64653
|
rmSync21(path, { force: true });
|
|
64617
64654
|
return "done";
|
|
64618
64655
|
},
|
|
64619
64656
|
async omp(deps2, _notes, done) {
|
|
64620
64657
|
rmSync21(paths(deps2).ompOrigin, { force: true });
|
|
64621
64658
|
if (sharedFile(deps2) && done.includes("pi")) return "done";
|
|
64622
|
-
if (sharedFile(deps2) &&
|
|
64659
|
+
if (sharedFile(deps2) && existsSync17(paths(deps2).piEntry)) return "none";
|
|
64623
64660
|
const path = paths(deps2).omp;
|
|
64624
|
-
if (!
|
|
64661
|
+
if (!existsSync17(path)) return "none";
|
|
64625
64662
|
rmSync21(path, { force: true });
|
|
64626
64663
|
return "done";
|
|
64627
64664
|
},
|
|
@@ -64736,7 +64773,7 @@ function checkAdapters(deps2) {
|
|
|
64736
64773
|
};
|
|
64737
64774
|
const homeOf = (env2) => typeof env2 === "object" && env2 !== null ? env2.OA_BUS_HOME : void 0;
|
|
64738
64775
|
const homed = (file2) => {
|
|
64739
|
-
if (!
|
|
64776
|
+
if (!existsSync17(file2)) return false;
|
|
64740
64777
|
const first = readFileSync33(file2, "utf8").split("\n", 1)[0] ?? "";
|
|
64741
64778
|
const ob = movedHome(deps2);
|
|
64742
64779
|
return ob === void 0 ? !first.startsWith("process.env.OA_BUS_HOME ||=") : first === homeLine(ob);
|
|
@@ -64837,6 +64874,8 @@ function reapplyClaudeProof(deps2, onWrite) {
|
|
|
64837
64874
|
{ guard: true }
|
|
64838
64875
|
);
|
|
64839
64876
|
for (const c of r.changed) onWrite(c);
|
|
64877
|
+
for (const ri of instanceProofs(deps2, { guard: true, file: deps2.config }))
|
|
64878
|
+
for (const c of ri.changed) onWrite(c);
|
|
64840
64879
|
} catch {
|
|
64841
64880
|
}
|
|
64842
64881
|
}
|
|
@@ -65000,7 +65039,7 @@ function busCmd(o) {
|
|
|
65000
65039
|
function installedForm(home2) {
|
|
65001
65040
|
const node2 = join40(home2, "bin", "node");
|
|
65002
65041
|
const entry = join40(home2, "bin", "dist", "index.js");
|
|
65003
|
-
if (!
|
|
65042
|
+
if (!existsSync18(node2) || !existsSync18(entry)) return void 0;
|
|
65004
65043
|
const q = (p) => /[\s"'$`\\]/.test(p) ? JSON.stringify(p) : p;
|
|
65005
65044
|
return `${q(node2)} ${q(entry)}`;
|
|
65006
65045
|
}
|
|
@@ -65397,7 +65436,8 @@ function claudeEntries(name, hub, ctx) {
|
|
|
65397
65436
|
},
|
|
65398
65437
|
{ name, hub },
|
|
65399
65438
|
ctx.service.argv?.() ?? ctx.service.cli(),
|
|
65400
|
-
isDefaultHome2(ctx.home, ctx.userHome) ? void 0 : ctx.home
|
|
65439
|
+
isDefaultHome2(ctx.home, ctx.userHome) ? void 0 : ctx.home,
|
|
65440
|
+
(owner) => busStopped(owner, ctx.userHome)
|
|
65401
65441
|
);
|
|
65402
65442
|
for (const n of r.notes) say(ctx, n);
|
|
65403
65443
|
if (r.changed.length > 0)
|
|
@@ -65444,7 +65484,7 @@ async function autoUpdate(opts, ctx) {
|
|
|
65444
65484
|
}
|
|
65445
65485
|
|
|
65446
65486
|
// src/commands/daemon.ts
|
|
65447
|
-
import { existsSync as
|
|
65487
|
+
import { existsSync as existsSync19 } from "node:fs";
|
|
65448
65488
|
import { join as join44 } from "node:path";
|
|
65449
65489
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
65450
65490
|
|
|
@@ -65553,6 +65593,14 @@ function claudeProofChecks(ctx, hub, instance) {
|
|
|
65553
65593
|
lines: [`${cc} ${at} shows as this session on pages.`]
|
|
65554
65594
|
}
|
|
65555
65595
|
);
|
|
65596
|
+
else if (e.state === "other-bus" && instance !== void 0 && busStopped(e.owner, ctx.userHome))
|
|
65597
|
+
out.push({
|
|
65598
|
+
level: "fail",
|
|
65599
|
+
lines: [
|
|
65600
|
+
`${cc} ${at} has the helper of a bus that no longer runs (${e.owner === void 0 ? "the default home" : safeText(tilde(ctx, e.owner), 120)}), so sessions using it are not linked.`,
|
|
65601
|
+
` Fix: ${install3}, then restart those sessions`
|
|
65602
|
+
]
|
|
65603
|
+
});
|
|
65556
65604
|
else if (e.state === "other-bus")
|
|
65557
65605
|
out.push({
|
|
65558
65606
|
level: "warn",
|
|
@@ -65661,7 +65709,7 @@ var lasting = (e) => [...START_ERROR_CODES, "EACCES", "EPERM"].includes(
|
|
|
65661
65709
|
);
|
|
65662
65710
|
async function daemon(ctx, run5 = runDaemon, signals = process) {
|
|
65663
65711
|
const m = readMachine(ctx.home);
|
|
65664
|
-
if (
|
|
65712
|
+
if (existsSync19(join44(ctx.home, "revoked")) && (m.state !== "ok" || m.revoked)) {
|
|
65665
65713
|
sayErr(ctx, ctx.copy.revoked());
|
|
65666
65714
|
return 0;
|
|
65667
65715
|
}
|
|
@@ -69350,7 +69398,7 @@ import { spawnSync as spawnSync2 } from "node:child_process";
|
|
|
69350
69398
|
import {
|
|
69351
69399
|
chmodSync as chmodSync23,
|
|
69352
69400
|
copyFileSync as copyFileSync2,
|
|
69353
|
-
existsSync as
|
|
69401
|
+
existsSync as existsSync21,
|
|
69354
69402
|
mkdirSync as mkdirSync19,
|
|
69355
69403
|
rmSync as rmSync27,
|
|
69356
69404
|
writeFileSync as writeFileSync23
|
|
@@ -69471,9 +69519,9 @@ async function upgrade(ctx, opts, deps2 = realUpgradeDeps(ctx)) {
|
|
|
69471
69519
|
try {
|
|
69472
69520
|
dest = stage(ctx.home, target2, (dir) => {
|
|
69473
69521
|
unpackTo(verified2.entries, dir);
|
|
69474
|
-
if (!
|
|
69522
|
+
if (!existsSync21(join58(dir, "dist", "index.js")))
|
|
69475
69523
|
throw new Error("the release has no dist/index.js");
|
|
69476
|
-
if (
|
|
69524
|
+
if (existsSync21(launcher)) {
|
|
69477
69525
|
copyFileSync2(launcher, join58(dir, "node"));
|
|
69478
69526
|
chmodSync23(join58(dir, "node"), 448);
|
|
69479
69527
|
}
|
|
@@ -69490,7 +69538,7 @@ async function upgrade(ctx, opts, deps2 = realUpgradeDeps(ctx)) {
|
|
|
69490
69538
|
}
|
|
69491
69539
|
deps2.beforeInstall?.(dest);
|
|
69492
69540
|
const entry = join58(dest, "dist", "index.js");
|
|
69493
|
-
if (!
|
|
69541
|
+
if (!existsSync21(entry)) {
|
|
69494
69542
|
sayErr(ctx, c.upgradeStaleStage(target2));
|
|
69495
69543
|
return 1;
|
|
69496
69544
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-artifacts/bus",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.245.0",
|
|
5
5
|
"description": "The Open Artifacts bus: your AI agents reach each other across machines.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -29,6 +29,6 @@
|
|
|
29
29
|
"typecheck": "tsc --noEmit"
|
|
30
30
|
},
|
|
31
31
|
"oaBus": {
|
|
32
|
-
"commit": "
|
|
32
|
+
"commit": "cf2dcd3e697ea07478928ef55419f35966613873"
|
|
33
33
|
}
|
|
34
34
|
}
|