@open-artifacts/bus 0.199.3 → 0.199.5
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 +790 -355
- package/package.json +2 -2
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,
|
|
4589
|
+
function isRecursive(inst, stack, resolve18) {
|
|
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, resolve17) {
|
|
|
4596
4596
|
let result = NONE;
|
|
4597
4597
|
const check2 = (child) => {
|
|
4598
4598
|
if (result !== PROVEN && child?._zod) {
|
|
4599
|
-
const answer = isRecursive(child, stack,
|
|
4599
|
+
const answer = isRecursive(child, stack, resolve18);
|
|
4600
4600
|
if (answer > result)
|
|
4601
4601
|
result = answer;
|
|
4602
4602
|
}
|
|
@@ -4607,7 +4607,7 @@ function isRecursive(inst, stack, resolve17) {
|
|
|
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,
|
|
4610
|
+
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve18) : NONE;
|
|
4611
4611
|
if (child > answer)
|
|
4612
4612
|
answer = child;
|
|
4613
4613
|
}
|
|
@@ -4671,7 +4671,7 @@ function isRecursive(inst, stack, resolve17) {
|
|
|
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 ?? (
|
|
4674
|
+
const inner = def._cachedInner ?? (resolve18 ? inst._zod.innerType : void 0);
|
|
4675
4675
|
merge2(inner ? isRecursive(inner, stack, false) : ASSUMED);
|
|
4676
4676
|
break;
|
|
4677
4677
|
}
|
|
@@ -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((
|
|
23041
|
+
await new Promise((resolve18) => setTimeout(resolve18, 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((
|
|
23058
|
+
return new Promise((resolve18, 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
|
-
|
|
23136
|
+
resolve18(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((
|
|
23398
|
+
return new Promise((resolve18, reject) => {
|
|
23399
23399
|
if (signal.aborted) {
|
|
23400
23400
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
23401
23401
|
return;
|
|
23402
23402
|
}
|
|
23403
|
-
const timeoutId = setTimeout(
|
|
23403
|
+
const timeoutId = setTimeout(resolve18, 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 =
|
|
26430
|
+
let _sch = resolve18.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
|
|
26457
|
+
function resolve18(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
|
|
27287
|
+
function resolve18(baseURI, relativeURI, options) {
|
|
27288
27288
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
27289
27289
|
const {
|
|
27290
27290
|
parsed: baseParsed,
|
|
@@ -27653,7 +27653,7 @@ var require_fast_uri = __commonJS({
|
|
|
27653
27653
|
var fastUri = {
|
|
27654
27654
|
SCHEMES,
|
|
27655
27655
|
normalize,
|
|
27656
|
-
resolve:
|
|
27656
|
+
resolve: resolve18,
|
|
27657
27657
|
resolveComponent,
|
|
27658
27658
|
equal,
|
|
27659
27659
|
serialize,
|
|
@@ -32729,7 +32729,7 @@ var init_frames = __esm({
|
|
|
32729
32729
|
late = { late: external_exports.array(external_exports.string().min(1)).optional() };
|
|
32730
32730
|
isWellFormed2 = (s) => s.isWellFormed();
|
|
32731
32731
|
WELL_FORMED = { message: "text is not well-formed unicode" };
|
|
32732
|
-
CLIENT_VERSION = true ? "0.199.
|
|
32732
|
+
CLIENT_VERSION = true ? "0.199.5" : "0.0.0";
|
|
32733
32733
|
clientVersion = {
|
|
32734
32734
|
client_version: external_exports.string().min(1).max(64).optional()
|
|
32735
32735
|
};
|
|
@@ -33199,8 +33199,8 @@ import { connect } from "node:net";
|
|
|
33199
33199
|
async function connectDaemon(opts) {
|
|
33200
33200
|
const sock = connect(opts.path);
|
|
33201
33201
|
if (opts.unref) sock.unref();
|
|
33202
|
-
await new Promise((
|
|
33203
|
-
sock.once("connect",
|
|
33202
|
+
await new Promise((resolve18, reject) => {
|
|
33203
|
+
sock.once("connect", resolve18);
|
|
33204
33204
|
sock.once("error", reject);
|
|
33205
33205
|
});
|
|
33206
33206
|
const decoder = new LineDecoder();
|
|
@@ -33267,8 +33267,8 @@ async function connectDaemon(opts) {
|
|
|
33267
33267
|
sock.on("error", (e) => failAll(e));
|
|
33268
33268
|
sock.on("close", () => failAll(new Error("daemon connection closed")));
|
|
33269
33269
|
let timer;
|
|
33270
|
-
const welcomeRaw = await new Promise((
|
|
33271
|
-
waiters.push({ resolve:
|
|
33270
|
+
const welcomeRaw = await new Promise((resolve18, reject) => {
|
|
33271
|
+
waiters.push({ resolve: resolve18, reject });
|
|
33272
33272
|
timer = setTimeout(() => {
|
|
33273
33273
|
reject(new Error("daemon did not answer hello"));
|
|
33274
33274
|
sock.destroy();
|
|
@@ -33290,7 +33290,7 @@ async function connectDaemon(opts) {
|
|
|
33290
33290
|
if (state === "closed")
|
|
33291
33291
|
return Promise.reject(new Error("daemon connection closed"));
|
|
33292
33292
|
const id = partial2.id ?? String(++seq2);
|
|
33293
|
-
return new Promise((
|
|
33293
|
+
return new Promise((resolve18, reject) => {
|
|
33294
33294
|
const ms = opts.requestTimeoutMs ?? 2e4;
|
|
33295
33295
|
const timer2 = setTimeout(() => {
|
|
33296
33296
|
if (pending.delete(id)) {
|
|
@@ -33307,7 +33307,7 @@ async function connectDaemon(opts) {
|
|
|
33307
33307
|
clearTimeout(timer2);
|
|
33308
33308
|
f(...a);
|
|
33309
33309
|
};
|
|
33310
|
-
pending.set(id, { resolve: done(
|
|
33310
|
+
pending.set(id, { resolve: done(resolve18), reject: done(reject) });
|
|
33311
33311
|
holdWhilePending();
|
|
33312
33312
|
sock.write(`${JSON.stringify({ v: 1, ...partial2, id })}
|
|
33313
33313
|
`);
|
|
@@ -33332,7 +33332,7 @@ async function connectDaemon(opts) {
|
|
|
33332
33332
|
};
|
|
33333
33333
|
}
|
|
33334
33334
|
function daemonStatus(opts) {
|
|
33335
|
-
return new Promise((
|
|
33335
|
+
return new Promise((resolve18, reject) => {
|
|
33336
33336
|
const sock = connect(opts.path);
|
|
33337
33337
|
const decoder = new LineDecoder();
|
|
33338
33338
|
const done = (f) => {
|
|
@@ -33369,7 +33369,7 @@ function daemonStatus(opts) {
|
|
|
33369
33369
|
try {
|
|
33370
33370
|
for (const raw of decoder.push(chunk)) {
|
|
33371
33371
|
const f = DaemonFrame.parse(raw);
|
|
33372
|
-
if (f.type === "status") return done(() =>
|
|
33372
|
+
if (f.type === "status") return done(() => resolve18(f));
|
|
33373
33373
|
if (f.type === "error")
|
|
33374
33374
|
return done(
|
|
33375
33375
|
() => reject(
|
|
@@ -33388,7 +33388,7 @@ function daemonStatus(opts) {
|
|
|
33388
33388
|
});
|
|
33389
33389
|
}
|
|
33390
33390
|
function daemonLinkProof(opts) {
|
|
33391
|
-
return new Promise((
|
|
33391
|
+
return new Promise((resolve18, reject) => {
|
|
33392
33392
|
const sock = connect(opts.path);
|
|
33393
33393
|
const decoder = new LineDecoder();
|
|
33394
33394
|
const done = (f) => {
|
|
@@ -33416,7 +33416,7 @@ function daemonLinkProof(opts) {
|
|
|
33416
33416
|
try {
|
|
33417
33417
|
for (const raw of decoder.push(chunk)) {
|
|
33418
33418
|
const f = DaemonFrame.parse(raw);
|
|
33419
|
-
if (f.type === "link_proofed") return done(() =>
|
|
33419
|
+
if (f.type === "link_proofed") return done(() => resolve18(f.bound));
|
|
33420
33420
|
if (f.type === "error")
|
|
33421
33421
|
return done(() => reject(new Error(f.message)));
|
|
33422
33422
|
}
|
|
@@ -33798,13 +33798,13 @@ async function clearStale(path) {
|
|
|
33798
33798
|
code: "ENOTSOCK"
|
|
33799
33799
|
});
|
|
33800
33800
|
}
|
|
33801
|
-
const live = await new Promise((
|
|
33801
|
+
const live = await new Promise((resolve18) => {
|
|
33802
33802
|
const probe2 = connect2(path);
|
|
33803
33803
|
probe2.once("connect", () => {
|
|
33804
33804
|
probe2.destroy();
|
|
33805
|
-
|
|
33805
|
+
resolve18(true);
|
|
33806
33806
|
});
|
|
33807
|
-
probe2.once("error", () =>
|
|
33807
|
+
probe2.once("error", () => resolve18(false));
|
|
33808
33808
|
});
|
|
33809
33809
|
if (live) {
|
|
33810
33810
|
throw Object.assign(new Error(`daemon already listening on ${path}`), {
|
|
@@ -33824,16 +33824,16 @@ async function serveDaemon(opts) {
|
|
|
33824
33824
|
sock.once("close", () => sockets.delete(sock));
|
|
33825
33825
|
handle(sock, opts);
|
|
33826
33826
|
});
|
|
33827
|
-
await new Promise((
|
|
33827
|
+
await new Promise((resolve18, reject) => {
|
|
33828
33828
|
server4.once("error", reject);
|
|
33829
|
-
server4.listen(opts.path, () =>
|
|
33829
|
+
server4.listen(opts.path, () => resolve18());
|
|
33830
33830
|
});
|
|
33831
33831
|
chmodSync(opts.path, 384);
|
|
33832
33832
|
const st = statSync(opts.path);
|
|
33833
33833
|
const mode = st.mode & 511;
|
|
33834
33834
|
return {
|
|
33835
33835
|
mode,
|
|
33836
|
-
close: () => new Promise((
|
|
33836
|
+
close: () => new Promise((resolve18) => {
|
|
33837
33837
|
for (const s of sockets) s.destroy();
|
|
33838
33838
|
let parked;
|
|
33839
33839
|
try {
|
|
@@ -33851,7 +33851,7 @@ async function serveDaemon(opts) {
|
|
|
33851
33851
|
} catch {
|
|
33852
33852
|
}
|
|
33853
33853
|
}
|
|
33854
|
-
|
|
33854
|
+
resolve18();
|
|
33855
33855
|
});
|
|
33856
33856
|
})
|
|
33857
33857
|
};
|
|
@@ -34897,7 +34897,7 @@ ${neutralize(a.text)}
|
|
|
34897
34897
|
};
|
|
34898
34898
|
}
|
|
34899
34899
|
function inject(a) {
|
|
34900
|
-
return new Promise((
|
|
34900
|
+
return new Promise((resolve18, reject) => {
|
|
34901
34901
|
const sock = connect3(a.socketPath);
|
|
34902
34902
|
let connected = false;
|
|
34903
34903
|
const fail3 = (e) => {
|
|
@@ -34921,7 +34921,7 @@ function inject(a) {
|
|
|
34921
34921
|
sock.once("finish", () => {
|
|
34922
34922
|
clearTimeout(timer);
|
|
34923
34923
|
sock.destroy();
|
|
34924
|
-
|
|
34924
|
+
resolve18();
|
|
34925
34925
|
});
|
|
34926
34926
|
sock.end(`${JSON.stringify(frameOf(a))}
|
|
34927
34927
|
`);
|
|
@@ -44026,12 +44026,12 @@ var init_stdio2 = __esm({
|
|
|
44026
44026
|
this.onclose?.();
|
|
44027
44027
|
}
|
|
44028
44028
|
send(message) {
|
|
44029
|
-
return new Promise((
|
|
44029
|
+
return new Promise((resolve18) => {
|
|
44030
44030
|
const json4 = serializeMessage(message);
|
|
44031
44031
|
if (this._stdout.write(json4)) {
|
|
44032
|
-
|
|
44032
|
+
resolve18();
|
|
44033
44033
|
} else {
|
|
44034
|
-
this._stdout.once("drain",
|
|
44034
|
+
this._stdout.once("drain", resolve18);
|
|
44035
44035
|
}
|
|
44036
44036
|
});
|
|
44037
44037
|
}
|
|
@@ -44290,13 +44290,13 @@ __export(codex_proxy_main_exports, {
|
|
|
44290
44290
|
readTokenFile: () => readTokenFile,
|
|
44291
44291
|
startCodexProxy: () => startCodexProxy
|
|
44292
44292
|
});
|
|
44293
|
-
import { readFileSync as
|
|
44293
|
+
import { readFileSync as readFileSync41 } from "node:fs";
|
|
44294
44294
|
import { homedir as homedir4 } from "node:os";
|
|
44295
44295
|
function readTokenFile(path) {
|
|
44296
44296
|
if (!path) return void 0;
|
|
44297
44297
|
try {
|
|
44298
44298
|
const p = path.startsWith("~/") ? `${homedir4()}${path.slice(1)}` : path;
|
|
44299
|
-
return
|
|
44299
|
+
return readFileSync41(p, "utf8").trim() || void 0;
|
|
44300
44300
|
} catch {
|
|
44301
44301
|
return void 0;
|
|
44302
44302
|
}
|
|
@@ -44346,13 +44346,13 @@ __export(proxy_main_exports, {
|
|
|
44346
44346
|
readTokenFile: () => readTokenFile2,
|
|
44347
44347
|
startProxy: () => startProxy
|
|
44348
44348
|
});
|
|
44349
|
-
import { readFileSync as
|
|
44349
|
+
import { readFileSync as readFileSync42 } from "node:fs";
|
|
44350
44350
|
import { homedir as homedir5 } from "node:os";
|
|
44351
44351
|
function readTokenFile2(path) {
|
|
44352
44352
|
if (!path) return void 0;
|
|
44353
44353
|
try {
|
|
44354
44354
|
const p = path.startsWith("~/") ? `${homedir5()}${path.slice(1)}` : path;
|
|
44355
|
-
return
|
|
44355
|
+
return readFileSync42(p, "utf8").trim() || void 0;
|
|
44356
44356
|
} catch {
|
|
44357
44357
|
return void 0;
|
|
44358
44358
|
}
|
|
@@ -44440,7 +44440,7 @@ var harnessSkills = {
|
|
|
44440
44440
|
var harnessNames = Object.keys(harnessSkills);
|
|
44441
44441
|
|
|
44442
44442
|
// src/main.ts
|
|
44443
|
-
import { resolve as
|
|
44443
|
+
import { resolve as resolve17 } from "node:path";
|
|
44444
44444
|
import { fileURLToPath as fileURLToPath7 } from "node:url";
|
|
44445
44445
|
|
|
44446
44446
|
// ../bus-daemon/src/index.ts
|
|
@@ -49161,12 +49161,12 @@ var Receipts = class {
|
|
|
49161
49161
|
this.#waiting.delete(msgId);
|
|
49162
49162
|
return Promise.resolve(w.final);
|
|
49163
49163
|
}
|
|
49164
|
-
return new Promise((
|
|
49164
|
+
return new Promise((resolve18) => {
|
|
49165
49165
|
const cancel = this.#after(ms, () => w.done?.(void 0));
|
|
49166
49166
|
w.done = (f) => {
|
|
49167
49167
|
cancel();
|
|
49168
49168
|
this.#waiting.delete(msgId);
|
|
49169
|
-
|
|
49169
|
+
resolve18(f);
|
|
49170
49170
|
};
|
|
49171
49171
|
});
|
|
49172
49172
|
}
|
|
@@ -49503,22 +49503,22 @@ var ClaudeTransport = class {
|
|
|
49503
49503
|
return { ok: false, reason: "closed", cause: st };
|
|
49504
49504
|
}
|
|
49505
49505
|
#waitFor(msgId, ms) {
|
|
49506
|
-
return new Promise((
|
|
49506
|
+
return new Promise((resolve18) => {
|
|
49507
49507
|
const buffered = this.#buffered.get(msgId);
|
|
49508
49508
|
if (buffered !== void 0) {
|
|
49509
49509
|
this.#buffered.delete(msgId);
|
|
49510
|
-
|
|
49510
|
+
resolve18(buffered);
|
|
49511
49511
|
return;
|
|
49512
49512
|
}
|
|
49513
49513
|
const timer = setTimeout(() => {
|
|
49514
49514
|
this.#waiting.delete(msgId);
|
|
49515
|
-
|
|
49515
|
+
resolve18(void 0);
|
|
49516
49516
|
}, ms);
|
|
49517
49517
|
timer.unref();
|
|
49518
49518
|
this.#waiting.set(msgId, (s) => {
|
|
49519
49519
|
clearTimeout(timer);
|
|
49520
49520
|
this.#waiting.delete(msgId);
|
|
49521
|
-
|
|
49521
|
+
resolve18(s);
|
|
49522
49522
|
});
|
|
49523
49523
|
});
|
|
49524
49524
|
}
|
|
@@ -49668,9 +49668,9 @@ var ClaudeTransport = class {
|
|
|
49668
49668
|
);
|
|
49669
49669
|
})
|
|
49670
49670
|
};
|
|
49671
|
-
await new Promise((
|
|
49671
|
+
await new Promise((resolve18, reject) => {
|
|
49672
49672
|
sink.server.once("error", reject);
|
|
49673
|
-
sink.server.listen(path, () =>
|
|
49673
|
+
sink.server.listen(path, () => resolve18());
|
|
49674
49674
|
});
|
|
49675
49675
|
chmodSync10(path, 384);
|
|
49676
49676
|
return sink;
|
|
@@ -49933,7 +49933,7 @@ function splitArgv0(args) {
|
|
|
49933
49933
|
});
|
|
49934
49934
|
return words(args.slice(real3 ?? ends[0]));
|
|
49935
49935
|
}
|
|
49936
|
-
var execText = (cmd, args) => new Promise((
|
|
49936
|
+
var execText = (cmd, args) => new Promise((resolve18) => {
|
|
49937
49937
|
execFile(
|
|
49938
49938
|
cmd,
|
|
49939
49939
|
args,
|
|
@@ -49942,7 +49942,7 @@ var execText = (cmd, args) => new Promise((resolve17) => {
|
|
|
49942
49942
|
timeout: 2e3,
|
|
49943
49943
|
env: { ...process.env, LC_ALL: "C" }
|
|
49944
49944
|
},
|
|
49945
|
-
(err, stdout) =>
|
|
49945
|
+
(err, stdout) => resolve18(err ? void 0 : stdout)
|
|
49946
49946
|
);
|
|
49947
49947
|
});
|
|
49948
49948
|
async function processArgs(pid) {
|
|
@@ -49965,17 +49965,17 @@ async function processArgs(pid) {
|
|
|
49965
49965
|
return args ? splitArgv0(args) : void 0;
|
|
49966
49966
|
}
|
|
49967
49967
|
var START_ERRORS = /* @__PURE__ */ new Set(["ENOENT", "EACCES", "ENOEXEC"]);
|
|
49968
|
-
var execCodex = (timeoutMs = CODEX_QUEUE_TIMEOUT_MS) => (bin, args, env2) => new Promise((
|
|
49968
|
+
var execCodex = (timeoutMs = CODEX_QUEUE_TIMEOUT_MS) => (bin, args, env2) => new Promise((resolve18, reject) => {
|
|
49969
49969
|
execFile(
|
|
49970
49970
|
bin,
|
|
49971
49971
|
args,
|
|
49972
49972
|
{ timeout: timeoutMs, maxBuffer: 64 * 1024, env: env2 },
|
|
49973
49973
|
(err, _stdout, stderr) => {
|
|
49974
|
-
if (!err) return
|
|
49974
|
+
if (!err) return resolve18({ code: 0, stderr });
|
|
49975
49975
|
const e = err;
|
|
49976
49976
|
if (typeof e.code === "string" && START_ERRORS.has(e.code))
|
|
49977
49977
|
return reject(err);
|
|
49978
|
-
|
|
49978
|
+
resolve18({
|
|
49979
49979
|
// A maxBuffer kill is SIGTERM too, but carries its own string code.
|
|
49980
49980
|
code: e.killed && e.signal === "SIGTERM" && typeof e.code !== "string" ? null : typeof e.code === "number" ? e.code : -1,
|
|
49981
49981
|
stderr: String(stderr ?? "")
|
|
@@ -50180,17 +50180,17 @@ var CODEX_WAKE_TEXT = `Open Artifacts bus: messages are waiting for this thread.
|
|
|
50180
50180
|
init_src2();
|
|
50181
50181
|
import { execFile as execFile2 } from "node:child_process";
|
|
50182
50182
|
var START_ERRORS2 = /* @__PURE__ */ new Set(["ENOENT", "EACCES"]);
|
|
50183
|
-
var execSpawn = (timeoutMs, maxBuffer = 1024 * 1024) => (cmd, args) => new Promise((
|
|
50183
|
+
var execSpawn = (timeoutMs, maxBuffer = 1024 * 1024) => (cmd, args) => new Promise((resolve18, reject) => {
|
|
50184
50184
|
execFile2(
|
|
50185
50185
|
cmd,
|
|
50186
50186
|
args,
|
|
50187
50187
|
{ timeout: timeoutMs, maxBuffer },
|
|
50188
50188
|
(err, stdout, stderr) => {
|
|
50189
|
-
if (!err) return
|
|
50189
|
+
if (!err) return resolve18({ code: 0, stdout, stderr });
|
|
50190
50190
|
const e = err;
|
|
50191
50191
|
if (typeof e.code === "string" && START_ERRORS2.has(e.code))
|
|
50192
50192
|
return reject(err);
|
|
50193
|
-
|
|
50193
|
+
resolve18({
|
|
50194
50194
|
code: e.killed || typeof e.code !== "number" ? null : e.code,
|
|
50195
50195
|
stdout,
|
|
50196
50196
|
stderr
|
|
@@ -50307,18 +50307,18 @@ var PiTransport = class {
|
|
|
50307
50307
|
});
|
|
50308
50308
|
if (!pushed) return { ok: false, reason: "closed" };
|
|
50309
50309
|
this.#forget(mail.msg_id);
|
|
50310
|
-
return new Promise((
|
|
50310
|
+
return new Promise((resolve18) => {
|
|
50311
50311
|
const timer = setTimeout(() => {
|
|
50312
50312
|
this.#waiting.delete(mail.msg_id);
|
|
50313
50313
|
this.#remember(mail.msg_id, agent.ref);
|
|
50314
|
-
|
|
50314
|
+
resolve18({ ok: false, reason: "timeout" });
|
|
50315
50315
|
}, this.opts.ackTimeoutMs ?? 1e4);
|
|
50316
50316
|
timer.unref();
|
|
50317
50317
|
this.#waiting.set(mail.msg_id, {
|
|
50318
50318
|
ref: agent.ref,
|
|
50319
50319
|
done: (o) => {
|
|
50320
50320
|
clearTimeout(timer);
|
|
50321
|
-
|
|
50321
|
+
resolve18(o);
|
|
50322
50322
|
}
|
|
50323
50323
|
});
|
|
50324
50324
|
});
|
|
@@ -53551,30 +53551,30 @@ async function runDaemon(deps2 = {}) {
|
|
|
53551
53551
|
statusEveryMs: deps2.status?.statusEveryMs
|
|
53552
53552
|
});
|
|
53553
53553
|
const hubRoster = (ref) => new Promise(
|
|
53554
|
-
(
|
|
53554
|
+
(resolve18) => {
|
|
53555
53555
|
const id = pending.open(
|
|
53556
53556
|
"status",
|
|
53557
|
-
(f) =>
|
|
53557
|
+
(f) => resolve18(f.type === "roster" ? f.agents : void 0)
|
|
53558
53558
|
);
|
|
53559
53559
|
const timer = setTimeout(() => {
|
|
53560
53560
|
pending.cancel(id);
|
|
53561
53561
|
hub.cancel(id);
|
|
53562
|
-
|
|
53562
|
+
resolve18(void 0);
|
|
53563
53563
|
}, deps2.statusRosterMs ?? 1500);
|
|
53564
53564
|
timer.unref();
|
|
53565
53565
|
if (!hub.send({ v: 1, id, type: "list", from_ref: ref })) {
|
|
53566
53566
|
clearTimeout(timer);
|
|
53567
53567
|
pending.cancel(id);
|
|
53568
|
-
|
|
53568
|
+
resolve18(void 0);
|
|
53569
53569
|
}
|
|
53570
53570
|
}
|
|
53571
53571
|
);
|
|
53572
|
-
const hubWaitingCounts = (refs) => new Promise((
|
|
53572
|
+
const hubWaitingCounts = (refs) => new Promise((resolve18) => {
|
|
53573
53573
|
const id = frameId();
|
|
53574
53574
|
const done = (c) => {
|
|
53575
53575
|
clearTimeout(timer);
|
|
53576
53576
|
waitingAsks.delete(id);
|
|
53577
|
-
|
|
53577
|
+
resolve18(c);
|
|
53578
53578
|
};
|
|
53579
53579
|
const timer = setTimeout(() => {
|
|
53580
53580
|
hub.cancel(id);
|
|
@@ -55251,15 +55251,15 @@ function copy(style, bus = BUS_CMD, approve) {
|
|
|
55251
55251
|
`Check that \`claude plugin list\` runs, then run ${bus} doctor again.`
|
|
55252
55252
|
)
|
|
55253
55253
|
],
|
|
55254
|
-
styleFileOld: (
|
|
55254
|
+
styleFileOld: (where2) => [
|
|
55255
55255
|
warn(
|
|
55256
|
-
`An older output style file (${clip(
|
|
55256
|
+
`An older output style file (${clip(where2, 20)}) also lists Artifacts Teammate, so it shows twice.`
|
|
55257
55257
|
),
|
|
55258
55258
|
next(`Run ${bus} to remove the old file.`)
|
|
55259
55259
|
],
|
|
55260
|
-
styleFileOldNoClaude: (
|
|
55260
|
+
styleFileOldNoClaude: (where2, min) => [
|
|
55261
55261
|
warn(
|
|
55262
|
-
`An older output style file (${clip(
|
|
55262
|
+
`An older output style file (${clip(where2, 20)}) is still in use. ${bus} can't replace it until Claude Code ${min} or later is on PATH.`
|
|
55263
55263
|
),
|
|
55264
55264
|
next(`Install or update Claude Code, then run ${bus}.`)
|
|
55265
55265
|
],
|
|
@@ -55273,35 +55273,35 @@ function copy(style, bus = BUS_CMD, approve) {
|
|
|
55273
55273
|
],
|
|
55274
55274
|
pluginsStatus: () => done("Claude Code plugins: session shortcuts, output style"),
|
|
55275
55275
|
// #1626: the `oa-bus` shim on PATH.
|
|
55276
|
-
shimInstalled: (
|
|
55276
|
+
shimInstalled: (where2) => done(`Installed the oa-bus command: ${clip(where2, 30)}`),
|
|
55277
55277
|
shimNotOnPath: (dir, hint) => [
|
|
55278
55278
|
warn(
|
|
55279
55279
|
`${clip(dir, 30)} is not on your PATH, so \`oa-bus\` won't run yet.`
|
|
55280
55280
|
),
|
|
55281
55281
|
next(`To fix it, add this line to your shell profile: ${hint}`)
|
|
55282
55282
|
],
|
|
55283
|
-
shimForeign: (
|
|
55284
|
-
warn(`Left ${clip(
|
|
55283
|
+
shimForeign: (where2) => [
|
|
55284
|
+
warn(`Left ${clip(where2, 30)} alone: it isn't from Open Artifacts.`),
|
|
55285
55285
|
next(
|
|
55286
55286
|
`Typing \`oa-bus\` runs that file, not this install. Remove it, or use \`${BUS_CMD}\`.`
|
|
55287
55287
|
)
|
|
55288
55288
|
],
|
|
55289
|
-
shimOtherHome: (
|
|
55289
|
+
shimOtherHome: (where2, home2) => [
|
|
55290
55290
|
warn(
|
|
55291
|
-
`Left ${clip(
|
|
55291
|
+
`Left ${clip(where2, 30)} alone: it belongs to the install in ${clip(home2, 30)}.`
|
|
55292
55292
|
),
|
|
55293
55293
|
next(
|
|
55294
55294
|
`Typing \`oa-bus\` runs that install, not this one. Use \`${BUS_CMD}\` for this one.`
|
|
55295
55295
|
)
|
|
55296
55296
|
],
|
|
55297
|
-
shimRemoved: (
|
|
55298
|
-
shimDoctorOk: (
|
|
55299
|
-
shimDoctorOffPath: (
|
|
55300
|
-
warn(`oa-bus is not on your PATH (the command is in ${clip(
|
|
55297
|
+
shimRemoved: (where2) => done(`Removed the oa-bus command: ${clip(where2, 30)}`),
|
|
55298
|
+
shimDoctorOk: (where2) => done(`oa-bus on your PATH runs this install (${clip(where2, 30)})`),
|
|
55299
|
+
shimDoctorOffPath: (where2, hint) => [
|
|
55300
|
+
warn(`oa-bus is not on your PATH (the command is in ${clip(where2, 30)})`),
|
|
55301
55301
|
next(`To fix it, add this line to your shell profile: ${hint}`)
|
|
55302
55302
|
],
|
|
55303
|
-
shimDoctorOther: (
|
|
55304
|
-
warn(`oa-bus on your PATH is not this install's (${clip(
|
|
55303
|
+
shimDoctorOther: (where2) => [
|
|
55304
|
+
warn(`oa-bus on your PATH is not this install's (${clip(where2, 30)})`),
|
|
55305
55305
|
next(
|
|
55306
55306
|
`Remove it, or put this install's first. Re-run ${BUS_CMD} install to refresh ours.`
|
|
55307
55307
|
)
|
|
@@ -55310,7 +55310,7 @@ function copy(style, bus = BUS_CMD, approve) {
|
|
|
55310
55310
|
warn("oa-bus is not on your PATH"),
|
|
55311
55311
|
next(`Run ${BUS_CMD} install to add it.`)
|
|
55312
55312
|
],
|
|
55313
|
-
codexSkill: (
|
|
55313
|
+
codexSkill: (where2) => done(`Codex skill installed in ${clip(where2, 20)}`),
|
|
55314
55314
|
codexSkillTwice: (file2, block) => [
|
|
55315
55315
|
warn("The Codex skill is installed twice, so it loads twice"),
|
|
55316
55316
|
next(
|
|
@@ -55600,19 +55600,19 @@ init_src2();
|
|
|
55600
55600
|
import { execFile as execFile3, spawn } from "node:child_process";
|
|
55601
55601
|
import { promisify } from "node:util";
|
|
55602
55602
|
var browserCommand = (platform, url2) => platform === "darwin" ? { cmd: "open", args: [url2] } : platform === "win32" ? { cmd: "rundll32", args: ["url.dll,FileProtocolHandler", url2] } : { cmd: "xdg-open", args: [url2] };
|
|
55603
|
-
var openBrowser = (url2, launcher = browserCommand(process.platform, url2)) => new Promise((
|
|
55603
|
+
var openBrowser = (url2, launcher = browserCommand(process.platform, url2)) => new Promise((resolve18) => {
|
|
55604
55604
|
try {
|
|
55605
55605
|
const child = spawn(launcher.cmd, launcher.args, {
|
|
55606
55606
|
stdio: "ignore",
|
|
55607
55607
|
detached: true
|
|
55608
55608
|
});
|
|
55609
|
-
child.once("error", () =>
|
|
55609
|
+
child.once("error", () => resolve18(false));
|
|
55610
55610
|
child.once("spawn", () => {
|
|
55611
55611
|
child.unref();
|
|
55612
|
-
|
|
55612
|
+
resolve18(true);
|
|
55613
55613
|
});
|
|
55614
55614
|
} catch {
|
|
55615
|
-
|
|
55615
|
+
resolve18(false);
|
|
55616
55616
|
}
|
|
55617
55617
|
});
|
|
55618
55618
|
var EXEC_TIMEOUT_MS = 1e4;
|
|
@@ -57446,7 +57446,7 @@ var noService = {
|
|
|
57446
57446
|
remove: async () => ({}),
|
|
57447
57447
|
cli: () => ["oa-bus"]
|
|
57448
57448
|
};
|
|
57449
|
-
var VERSION = true ? "0.199.
|
|
57449
|
+
var VERSION = true ? "0.199.5" : JSON.parse(
|
|
57450
57450
|
readFileSync21(new URL("../package.json", import.meta.url), "utf8")
|
|
57451
57451
|
).version;
|
|
57452
57452
|
var which = (cmd) => {
|
|
@@ -57536,7 +57536,7 @@ function realCtx(noColor) {
|
|
|
57536
57536
|
});
|
|
57537
57537
|
try {
|
|
57538
57538
|
return await new Promise(
|
|
57539
|
-
(
|
|
57539
|
+
(resolve18) => rl.question(question, resolve18)
|
|
57540
57540
|
);
|
|
57541
57541
|
} finally {
|
|
57542
57542
|
rl.close();
|
|
@@ -57628,7 +57628,7 @@ import { randomBytes as randomBytes6 } from "node:crypto";
|
|
|
57628
57628
|
import {
|
|
57629
57629
|
chmodSync as chmodSync19,
|
|
57630
57630
|
existsSync as existsSync14,
|
|
57631
|
-
lstatSync as
|
|
57631
|
+
lstatSync as lstatSync17,
|
|
57632
57632
|
mkdirSync as mkdirSync14,
|
|
57633
57633
|
readFileSync as readFileSync30,
|
|
57634
57634
|
readlinkSync as readlinkSync5,
|
|
@@ -57637,7 +57637,7 @@ import {
|
|
|
57637
57637
|
statSync as statSync9,
|
|
57638
57638
|
writeFileSync as writeFileSync18
|
|
57639
57639
|
} from "node:fs";
|
|
57640
|
-
import { dirname as dirname15, isAbsolute as isAbsolute13, join as join33, relative as relative6, resolve as
|
|
57640
|
+
import { dirname as dirname15, isAbsolute as isAbsolute13, join as join33, relative as relative6, resolve as resolve12 } from "node:path";
|
|
57641
57641
|
import { isDeepStrictEqual } from "node:util";
|
|
57642
57642
|
|
|
57643
57643
|
// ../bus-adapter-hermes/src/index.ts
|
|
@@ -58619,12 +58619,12 @@ var ParseErrorCode;
|
|
|
58619
58619
|
|
|
58620
58620
|
// ../bus-adapter-mcp-json/src/jsonc.ts
|
|
58621
58621
|
var isRecord = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
58622
|
-
function parseJsonc(text3,
|
|
58622
|
+
function parseJsonc(text3, where2) {
|
|
58623
58623
|
if (text3.trim() === "") return {};
|
|
58624
58624
|
const errors = [];
|
|
58625
58625
|
const doc = parse6(text3, errors, { allowTrailingComma: true });
|
|
58626
58626
|
if (errors.length > 0 || !isRecord(doc))
|
|
58627
|
-
throw new Error(`${
|
|
58627
|
+
throw new Error(`${where2} is not a JSON object; left it untouched`);
|
|
58628
58628
|
return doc;
|
|
58629
58629
|
}
|
|
58630
58630
|
var eol = (text3) => text3.includes("\r\n") ? "\r\n" : "\n";
|
|
@@ -58788,9 +58788,9 @@ function verified(text3, path, want) {
|
|
|
58788
58788
|
throw new Error(`editing ${path.join(".")} failed; left it untouched`);
|
|
58789
58789
|
return text3;
|
|
58790
58790
|
}
|
|
58791
|
-
function record4(v,
|
|
58791
|
+
function record4(v, where2) {
|
|
58792
58792
|
if (v === void 0) return void 0;
|
|
58793
|
-
if (!isRecord(v)) throw new Error(`${
|
|
58793
|
+
if (!isRecord(v)) throw new Error(`${where2} is not an object`);
|
|
58794
58794
|
return v;
|
|
58795
58795
|
}
|
|
58796
58796
|
var same2 = (a, b) => JSON.stringify(a) === JSON.stringify(b);
|
|
@@ -58845,10 +58845,10 @@ function removePlugin(text3, pluginPath) {
|
|
|
58845
58845
|
|
|
58846
58846
|
// ../bus-adapter-mcp-json/src/index.ts
|
|
58847
58847
|
var isRecord2 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
58848
|
-
function record5(doc, key2,
|
|
58848
|
+
function record5(doc, key2, where2 = key2) {
|
|
58849
58849
|
const v = doc[key2];
|
|
58850
58850
|
if (v === void 0) return void 0;
|
|
58851
|
-
if (!isRecord2(v)) throw new Error(`${
|
|
58851
|
+
if (!isRecord2(v)) throw new Error(`${where2} is not an object`);
|
|
58852
58852
|
return v;
|
|
58853
58853
|
}
|
|
58854
58854
|
function upsertMcpServer(doc, name, server4) {
|
|
@@ -58880,8 +58880,8 @@ var PI_EXTENSION = fileURLToPath4(
|
|
|
58880
58880
|
);
|
|
58881
58881
|
|
|
58882
58882
|
// src/steps/claude-proof.ts
|
|
58883
|
-
import { readFileSync as readFileSync22 } from "node:fs";
|
|
58884
|
-
import { join as join27 } from "node:path";
|
|
58883
|
+
import { lstatSync as lstatSync12, readFileSync as readFileSync22 } from "node:fs";
|
|
58884
|
+
import { join as join27, resolve as resolve6 } from "node:path";
|
|
58885
58885
|
var claudeConfigFile = (home2, env2) => join27(env2.CLAUDE_CONFIG_DIR ?? home2, ".claude.json");
|
|
58886
58886
|
var PROOF_COMMAND = "mcp-proof";
|
|
58887
58887
|
var TOKEN_HELPER = /^T=\$\(cat (.+)\) && printf '\{"Authorization":"Bearer %s"\}' "\$T"$/;
|
|
@@ -58896,21 +58896,63 @@ function proofHelper(busBin, opts) {
|
|
|
58896
58896
|
return opts.tokenFile ? `T=$(cat ${opts.tokenFile}) && { ${run5} 2>/dev/null || printf '{"Authorization":"Bearer %s"}' "$T"; }` : run5;
|
|
58897
58897
|
}
|
|
58898
58898
|
var isProofHelper = (helper) => typeof helper === "string" && / mcp-proof( |$)/.test(helper);
|
|
58899
|
+
function helperHome(helper) {
|
|
58900
|
+
const m = /(?:^|[ {])OA_BUS_HOME=('(?:[^']|'\\'')*'|\S+)/.exec(helper)?.[1];
|
|
58901
|
+
if (m === void 0) return void 0;
|
|
58902
|
+
return resolve6(
|
|
58903
|
+
m.startsWith("'") ? m.slice(1, -1).replaceAll("'\\''", "'") : m
|
|
58904
|
+
);
|
|
58905
|
+
}
|
|
58906
|
+
var ownedBy = (helper, busHome2) => helperHome(helper) === (busHome2 === void 0 ? void 0 : resolve6(busHome2));
|
|
58899
58907
|
var isRecord3 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
58900
|
-
function
|
|
58901
|
-
|
|
58902
|
-
if (
|
|
58903
|
-
|
|
58904
|
-
|
|
58905
|
-
|
|
58908
|
+
function isInstanceEntry(entry, origin) {
|
|
58909
|
+
if (!isRecord3(entry) || typeof entry.url !== "string") return false;
|
|
58910
|
+
if (entry.type !== void 0 && entry.type !== "http") return false;
|
|
58911
|
+
try {
|
|
58912
|
+
const u = new URL(entry.url);
|
|
58913
|
+
return u.origin === origin && u.pathname.replace(/\/+$/, "") === "/mcp";
|
|
58914
|
+
} catch {
|
|
58915
|
+
return false;
|
|
58916
|
+
}
|
|
58917
|
+
}
|
|
58918
|
+
function allEntries(doc) {
|
|
58919
|
+
const out = [];
|
|
58920
|
+
const add = (servers4, scope, project) => {
|
|
58921
|
+
if (!isRecord3(servers4)) return;
|
|
58922
|
+
for (const [name, entry] of Object.entries(servers4))
|
|
58923
|
+
if (isRecord3(entry))
|
|
58924
|
+
out.push({
|
|
58925
|
+
name,
|
|
58926
|
+
entry,
|
|
58927
|
+
scope,
|
|
58928
|
+
...project === void 0 ? {} : { project },
|
|
58929
|
+
path: project === void 0 ? ["mcpServers", name] : ["projects", project, "mcpServers", name]
|
|
58930
|
+
});
|
|
58931
|
+
};
|
|
58932
|
+
add(doc.mcpServers, "user");
|
|
58933
|
+
if (isRecord3(doc.projects)) {
|
|
58934
|
+
for (const [dir, p] of Object.entries(doc.projects))
|
|
58935
|
+
if (isRecord3(p)) add(p.mcpServers, "local", dir);
|
|
58936
|
+
}
|
|
58937
|
+
return out;
|
|
58938
|
+
}
|
|
58939
|
+
var findEntries = (doc, origin) => allEntries(doc).filter((f) => isInstanceEntry(f.entry, origin));
|
|
58940
|
+
function findElsewhere(doc, origin) {
|
|
58941
|
+
let host;
|
|
58942
|
+
try {
|
|
58943
|
+
host = new URL(origin).hostname;
|
|
58944
|
+
} catch {
|
|
58945
|
+
return [];
|
|
58946
|
+
}
|
|
58947
|
+
return allEntries(doc).filter((f) => {
|
|
58948
|
+
if (typeof f.entry.url !== "string" || isInstanceEntry(f.entry, origin))
|
|
58949
|
+
return false;
|
|
58906
58950
|
try {
|
|
58907
|
-
|
|
58908
|
-
if (u.origin === origin && u.pathname.replace(/\/+$/, "") === "/mcp")
|
|
58909
|
-
return { name, entry };
|
|
58951
|
+
return new URL(f.entry.url).hostname === host;
|
|
58910
58952
|
} catch {
|
|
58953
|
+
return false;
|
|
58911
58954
|
}
|
|
58912
|
-
}
|
|
58913
|
-
return void 0;
|
|
58955
|
+
});
|
|
58914
58956
|
}
|
|
58915
58957
|
var readText = (path) => {
|
|
58916
58958
|
try {
|
|
@@ -58920,79 +58962,216 @@ var readText = (path) => {
|
|
|
58920
58962
|
throw e;
|
|
58921
58963
|
}
|
|
58922
58964
|
};
|
|
58965
|
+
var asRecord = (p) => isRecord3(p) && typeof p.entry === "string" && (p.project === void 0 || typeof p.project === "string") && (p.file === void 0 || typeof p.file === "string") && (typeof p.original === "string" || p.original === null) ? {
|
|
58966
|
+
...typeof p.file === "string" ? { file: p.file } : {},
|
|
58967
|
+
entry: p.entry,
|
|
58968
|
+
...typeof p.project === "string" ? { project: p.project } : {},
|
|
58969
|
+
original: p.original
|
|
58970
|
+
} : void 0;
|
|
58923
58971
|
function readRecord(path) {
|
|
58924
58972
|
try {
|
|
58925
58973
|
const v = JSON.parse(readFileSync22(path, "utf8"));
|
|
58926
58974
|
if (isRecord3(v)) {
|
|
58927
|
-
const { claudeProof: claudeProof2, ...rest } = v;
|
|
58928
|
-
const
|
|
58929
|
-
|
|
58930
|
-
|
|
58931
|
-
|
|
58975
|
+
const { claudeProof: claudeProof2, claudeConfig, ...rest } = v;
|
|
58976
|
+
const list = Array.isArray(claudeProof2) ? claudeProof2 : [claudeProof2];
|
|
58977
|
+
return {
|
|
58978
|
+
rest,
|
|
58979
|
+
proofs: list.map(asRecord).filter((r) => !!r),
|
|
58980
|
+
...typeof claudeConfig === "string" ? { config: claudeConfig } : {}
|
|
58981
|
+
};
|
|
58932
58982
|
}
|
|
58933
58983
|
} catch {
|
|
58934
58984
|
}
|
|
58935
|
-
return { rest: {} };
|
|
58985
|
+
return { rest: {}, proofs: [] };
|
|
58936
58986
|
}
|
|
58937
|
-
function writeRecord(io, rest,
|
|
58938
|
-
const out =
|
|
58987
|
+
function writeRecord(io, rest, proofs, config2) {
|
|
58988
|
+
const out = {
|
|
58989
|
+
...rest,
|
|
58990
|
+
...config2 ? { claudeConfig: config2 } : {},
|
|
58991
|
+
...proofs.length ? { claudeProof: proofs } : {}
|
|
58992
|
+
};
|
|
58939
58993
|
io.write(io.record, `${JSON.stringify(out, null, 2)}
|
|
58940
58994
|
`, 384);
|
|
58941
58995
|
}
|
|
58942
|
-
|
|
58943
|
-
|
|
58944
|
-
|
|
58945
|
-
|
|
58946
|
-
|
|
58947
|
-
|
|
58948
|
-
|
|
58949
|
-
|
|
58950
|
-
|
|
58951
|
-
|
|
58952
|
-
|
|
58953
|
-
|
|
58954
|
-
|
|
58955
|
-
|
|
58956
|
-
|
|
58957
|
-
|
|
58958
|
-
...tokenFile ? { tokenFile } : {},
|
|
58959
|
-
...busHome2 ? { busHome: busHome2 } : {}
|
|
58960
|
-
});
|
|
58961
|
-
if (cur === helper && proof?.entry === found2.name) return void 0;
|
|
58962
|
-
writeRecord(io, rest, { entry: found2.name, original });
|
|
58963
|
-
io.write(
|
|
58964
|
-
io.file,
|
|
58965
|
-
setJsoncValue(text3, ["mcpServers", found2.name, "headersHelper"], helper)
|
|
58966
|
-
);
|
|
58967
|
-
return void 0;
|
|
58968
|
-
}
|
|
58969
|
-
function uninstallProof(io) {
|
|
58970
|
-
const { rest, proof } = readRecord(io.record);
|
|
58971
|
-
if (!proof) return false;
|
|
58972
|
-
const text3 = readText(io.file);
|
|
58973
|
-
const path = ["mcpServers", proof.entry, "headersHelper"];
|
|
58974
|
-
let cur;
|
|
58975
|
-
try {
|
|
58976
|
-
cur = text3 === "" ? void 0 : jsoncValue(text3, path);
|
|
58977
|
-
} catch {
|
|
58978
|
-
cur = void 0;
|
|
58996
|
+
var recordOf = (proofs, file2, name, project) => proofs.findIndex(
|
|
58997
|
+
(r) => (r.file ?? file2) === file2 && r.entry === name && r.project === project
|
|
58998
|
+
);
|
|
58999
|
+
var adoptedOriginal = (helper) => {
|
|
59000
|
+
const f = /^T=\$\(cat (.+?)\) && \{ /.exec(helper)?.[1];
|
|
59001
|
+
return f ? `T=$(cat ${f}) && printf '{"Authorization":"Bearer %s"}' "$T"` : null;
|
|
59002
|
+
};
|
|
59003
|
+
function installProof(io, origin, busBin, busHome2, opts = {}) {
|
|
59004
|
+
const out = { notes: [], changed: [] };
|
|
59005
|
+
const read = io.read ?? readText;
|
|
59006
|
+
const text3 = read(io.file);
|
|
59007
|
+
const { rest, proofs, config: config2 } = readRecord(io.record);
|
|
59008
|
+
if (text3 === "") {
|
|
59009
|
+
if (!opts.guard && config2 !== io.file)
|
|
59010
|
+
writeRecord(io, rest, proofs, io.file);
|
|
59011
|
+
return out;
|
|
58979
59012
|
}
|
|
58980
|
-
|
|
58981
|
-
|
|
58982
|
-
|
|
58983
|
-
|
|
58984
|
-
|
|
58985
|
-
|
|
58986
|
-
|
|
59013
|
+
const records = [...proofs];
|
|
59014
|
+
let next = text3;
|
|
59015
|
+
for (const f of findEntries(parseJsonc(text3, io.file), origin)) {
|
|
59016
|
+
const at = recordOf(records, io.file, f.name, f.project);
|
|
59017
|
+
const rec = records[at];
|
|
59018
|
+
const cur = f.entry.headersHelper;
|
|
59019
|
+
let original;
|
|
59020
|
+
if (typeof cur === "string" && isProofHelper(cur) && !ownedBy(cur, busHome2)) {
|
|
59021
|
+
out.notes.push(
|
|
59022
|
+
`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"}`
|
|
59023
|
+
);
|
|
59024
|
+
continue;
|
|
59025
|
+
}
|
|
59026
|
+
if (isProofHelper(cur) && rec) original = rec.original;
|
|
59027
|
+
else if (isProofHelper(cur) && !opts.guard && typeof cur === "string")
|
|
59028
|
+
original = adoptedOriginal(cur);
|
|
59029
|
+
else if (isProofHelper(cur)) continue;
|
|
59030
|
+
else if (cur === void 0) original = null;
|
|
59031
|
+
else if (typeof cur === "string" && TOKEN_HELPER.test(cur)) original = cur;
|
|
59032
|
+
else {
|
|
59033
|
+
out.notes.push(
|
|
59034
|
+
`left the headersHelper of ${f.name} (${f.scope} scope) in ${io.file} as it is: it is not one oa-bus knows`
|
|
59035
|
+
);
|
|
59036
|
+
continue;
|
|
59037
|
+
}
|
|
59038
|
+
const tokenFile = original?.match(TOKEN_HELPER)?.[1];
|
|
59039
|
+
const helper = proofHelper(busBin, {
|
|
59040
|
+
...tokenFile ? { tokenFile } : {},
|
|
59041
|
+
...busHome2 ? { busHome: busHome2 } : {}
|
|
59042
|
+
});
|
|
59043
|
+
if (cur === helper && rec) continue;
|
|
59044
|
+
const made = {
|
|
59045
|
+
file: io.file,
|
|
59046
|
+
entry: f.name,
|
|
59047
|
+
...f.project === void 0 ? {} : { project: f.project },
|
|
59048
|
+
original
|
|
59049
|
+
};
|
|
59050
|
+
if (at < 0) records.push(made);
|
|
59051
|
+
else records[at] = made;
|
|
59052
|
+
next = setJsoncValue(next, [...f.path, "headersHelper"], helper);
|
|
59053
|
+
out.changed.push({ entry: f.name, scope: f.scope });
|
|
59054
|
+
}
|
|
59055
|
+
const recorded = config2 === io.file;
|
|
59056
|
+
if (out.changed.length === 0 && (recorded || opts.guard)) return out;
|
|
59057
|
+
if (opts.guard) {
|
|
59058
|
+
let link2 = false;
|
|
59059
|
+
try {
|
|
59060
|
+
link2 = lstatSync12(io.file).isSymbolicLink();
|
|
59061
|
+
} catch {
|
|
59062
|
+
}
|
|
59063
|
+
if (link2 || read(io.file) !== text3)
|
|
59064
|
+
return { notes: out.notes, changed: [], skipped: true };
|
|
59065
|
+
}
|
|
59066
|
+
writeRecord(io, rest, records, io.file);
|
|
59067
|
+
if (out.changed.length > 0) io.write(io.file, next);
|
|
59068
|
+
return out;
|
|
58987
59069
|
}
|
|
58988
|
-
function
|
|
59070
|
+
function uninstallProof(io, busHome2) {
|
|
59071
|
+
const { rest, proofs, config: config2 } = readRecord(io.record);
|
|
59072
|
+
if (proofs.length === 0) {
|
|
59073
|
+
if (config2) writeRecord(io, rest, [], void 0);
|
|
59074
|
+
return false;
|
|
59075
|
+
}
|
|
59076
|
+
const texts = /* @__PURE__ */ new Map();
|
|
59077
|
+
let undone = false;
|
|
59078
|
+
for (const proof of proofs) {
|
|
59079
|
+
const file2 = proof.file ?? io.file;
|
|
59080
|
+
let t = texts.get(file2);
|
|
59081
|
+
if (!t) {
|
|
59082
|
+
const before = (io.read ?? readText)(file2);
|
|
59083
|
+
t = { before, text: before };
|
|
59084
|
+
texts.set(file2, t);
|
|
59085
|
+
}
|
|
59086
|
+
const path = [
|
|
59087
|
+
...proof.project === void 0 ? ["mcpServers"] : ["projects", proof.project, "mcpServers"],
|
|
59088
|
+
proof.entry,
|
|
59089
|
+
"headersHelper"
|
|
59090
|
+
];
|
|
59091
|
+
let cur;
|
|
59092
|
+
try {
|
|
59093
|
+
cur = t.text === "" ? void 0 : jsoncValue(t.text, path);
|
|
59094
|
+
} catch {
|
|
59095
|
+
cur = void 0;
|
|
59096
|
+
}
|
|
59097
|
+
if (typeof cur !== "string" || !isProofHelper(cur) || !ownedBy(cur, busHome2))
|
|
59098
|
+
continue;
|
|
59099
|
+
t.text = proof.original === null ? removeJsoncValue(t.text, path) : setJsoncValue(t.text, path, proof.original);
|
|
59100
|
+
undone = true;
|
|
59101
|
+
}
|
|
59102
|
+
for (const [file2, t] of texts)
|
|
59103
|
+
if (t.text !== t.before) io.write(file2, t.text);
|
|
59104
|
+
writeRecord(io, rest, [], void 0);
|
|
59105
|
+
return undone;
|
|
59106
|
+
}
|
|
59107
|
+
var stateOf = (helper) => helper === void 0 ? "missing" : isProofHelper(helper) ? "helper" : "foreign";
|
|
59108
|
+
function trustOf(doc, dir) {
|
|
59109
|
+
const p = isRecord3(doc.projects) ? doc.projects[dir] : void 0;
|
|
59110
|
+
const t = isRecord3(p) ? p.hasTrustDialogAccepted : void 0;
|
|
59111
|
+
return typeof t === "boolean" ? t : void 0;
|
|
59112
|
+
}
|
|
59113
|
+
function proofReport(file2, origin, opts = {}) {
|
|
59114
|
+
const report = { entries: [], elsewhere: [], symlink: false };
|
|
59115
|
+
const read = (path) => {
|
|
59116
|
+
try {
|
|
59117
|
+
const text3 = readText(path);
|
|
59118
|
+
return text3 === "" ? void 0 : parseJsonc(text3, path);
|
|
59119
|
+
} catch {
|
|
59120
|
+
return void 0;
|
|
59121
|
+
}
|
|
59122
|
+
};
|
|
59123
|
+
const doc = read(file2);
|
|
58989
59124
|
try {
|
|
58990
|
-
|
|
58991
|
-
if (!found2) return "none";
|
|
58992
|
-
return isProofHelper(found2.entry.headersHelper) ? "helper" : "missing";
|
|
59125
|
+
report.symlink = lstatSync12(file2).isSymbolicLink();
|
|
58993
59126
|
} catch {
|
|
58994
|
-
return "none";
|
|
58995
59127
|
}
|
|
59128
|
+
const localNames = /* @__PURE__ */ new Set();
|
|
59129
|
+
if (doc) {
|
|
59130
|
+
for (const f of findEntries(doc, origin)) {
|
|
59131
|
+
const base3 = stateOf(f.entry.headersHelper);
|
|
59132
|
+
const known = opts.recorded === void 0 || recordOf(opts.recorded, file2, f.name, f.project) >= 0;
|
|
59133
|
+
const trusted = trustOf(doc, f.project ?? "");
|
|
59134
|
+
const mine = typeof f.entry.headersHelper !== "string" || !isProofHelper(f.entry.headersHelper) || ownedBy(f.entry.headersHelper, opts.busHome);
|
|
59135
|
+
const owner = typeof f.entry.headersHelper === "string" ? helperHome(f.entry.headersHelper) : void 0;
|
|
59136
|
+
report.entries.push({
|
|
59137
|
+
name: f.name,
|
|
59138
|
+
scope: f.scope,
|
|
59139
|
+
...f.project === void 0 ? {} : { project: f.project },
|
|
59140
|
+
state: !mine ? "other-bus" : base3 === "helper" && !known ? "unrecorded" : base3,
|
|
59141
|
+
...!mine && owner !== void 0 ? { owner } : {},
|
|
59142
|
+
...f.scope === "local" && trusted !== void 0 ? { trusted } : {}
|
|
59143
|
+
});
|
|
59144
|
+
if (f.scope === "local" && f.project === opts.cwd) localNames.add(f.name);
|
|
59145
|
+
}
|
|
59146
|
+
for (const f of findElsewhere(doc, origin))
|
|
59147
|
+
report.elsewhere.push({
|
|
59148
|
+
name: f.name,
|
|
59149
|
+
scope: f.scope,
|
|
59150
|
+
url: String(f.entry.url)
|
|
59151
|
+
});
|
|
59152
|
+
}
|
|
59153
|
+
const proj = opts.projectFile === void 0 ? void 0 : read(opts.projectFile);
|
|
59154
|
+
if (proj && isRecord3(proj.mcpServers))
|
|
59155
|
+
for (const [name, entry] of Object.entries(proj.mcpServers)) {
|
|
59156
|
+
if (!isRecord3(entry)) continue;
|
|
59157
|
+
if (isInstanceEntry(entry, origin)) {
|
|
59158
|
+
if (localNames.has(name)) continue;
|
|
59159
|
+
const trusted = doc && opts.cwd !== void 0 ? trustOf(doc, opts.cwd) : void 0;
|
|
59160
|
+
report.entries.push({
|
|
59161
|
+
name,
|
|
59162
|
+
scope: "project",
|
|
59163
|
+
state: stateOf(entry.headersHelper),
|
|
59164
|
+
...trusted === void 0 ? {} : { trusted }
|
|
59165
|
+
});
|
|
59166
|
+
} else if (typeof entry.url === "string") {
|
|
59167
|
+
try {
|
|
59168
|
+
if (new URL(entry.url).hostname === new URL(origin).hostname)
|
|
59169
|
+
report.elsewhere.push({ name, scope: "project", url: entry.url });
|
|
59170
|
+
} catch {
|
|
59171
|
+
}
|
|
59172
|
+
}
|
|
59173
|
+
}
|
|
59174
|
+
return report;
|
|
58996
59175
|
}
|
|
58997
59176
|
|
|
58998
59177
|
// src/steps/codex-proof.ts
|
|
@@ -59306,18 +59485,18 @@ function proxyProgramMissing(doc, which2) {
|
|
|
59306
59485
|
init_src();
|
|
59307
59486
|
import {
|
|
59308
59487
|
existsSync as existsSync11,
|
|
59309
|
-
lstatSync as
|
|
59488
|
+
lstatSync as lstatSync16,
|
|
59310
59489
|
readFileSync as readFileSync27,
|
|
59311
59490
|
realpathSync as realpathSync14,
|
|
59312
59491
|
rmSync as rmSync16
|
|
59313
59492
|
} from "node:fs";
|
|
59314
|
-
import { join as join31, resolve as
|
|
59493
|
+
import { join as join31, resolve as resolve10, sep as sep4 } from "node:path";
|
|
59315
59494
|
|
|
59316
59495
|
// src/steps/hermes.ts
|
|
59317
59496
|
import { createHash as createHash11, randomBytes as randomBytes5 } from "node:crypto";
|
|
59318
59497
|
import {
|
|
59319
59498
|
cpSync as cpSync2,
|
|
59320
|
-
lstatSync as
|
|
59499
|
+
lstatSync as lstatSync13,
|
|
59321
59500
|
mkdirSync as mkdirSync12,
|
|
59322
59501
|
readdirSync as readdirSync8,
|
|
59323
59502
|
readFileSync as readFileSync24,
|
|
@@ -59334,7 +59513,7 @@ import {
|
|
|
59334
59513
|
isAbsolute as isAbsolute11,
|
|
59335
59514
|
join as join28,
|
|
59336
59515
|
relative as relative5,
|
|
59337
|
-
resolve as
|
|
59516
|
+
resolve as resolve7
|
|
59338
59517
|
} from "node:path";
|
|
59339
59518
|
var HERMES_PLUGIN_NAME = "oa-bus";
|
|
59340
59519
|
var HERMES_MARKER = ".oa-bus-managed";
|
|
@@ -59381,7 +59560,7 @@ function sweepStaging(staging, own2, o = {}) {
|
|
|
59381
59560
|
const path = join28(staging, name);
|
|
59382
59561
|
let old;
|
|
59383
59562
|
try {
|
|
59384
|
-
old = now -
|
|
59563
|
+
old = now - lstatSync13(path).mtimeMs > STAGING_STALE_MS;
|
|
59385
59564
|
} catch {
|
|
59386
59565
|
continue;
|
|
59387
59566
|
}
|
|
@@ -59399,7 +59578,7 @@ var nativeHome = (home2, env2, platform) => {
|
|
|
59399
59578
|
const local = env2.LOCALAPPDATA?.trim();
|
|
59400
59579
|
return join28(local || join28(home2, "AppData", "Local"), "hermes");
|
|
59401
59580
|
};
|
|
59402
|
-
var tilded = (home2, v) => v === "~" ? home2 :
|
|
59581
|
+
var tilded = (home2, v) => v === "~" ? home2 : resolve7(v.startsWith("~/") ? join28(home2, v.slice(2)) : v);
|
|
59403
59582
|
function hermesHome(home2, env2, platform = process.platform) {
|
|
59404
59583
|
const native = nativeHome(home2, env2, platform);
|
|
59405
59584
|
const v = env2.HERMES_HOME?.trim();
|
|
@@ -59413,7 +59592,7 @@ function hermesHome(home2, env2, platform = process.platform) {
|
|
|
59413
59592
|
const name = readFileSync24(join28(root, "active_profile"), "utf8").trim().toLowerCase();
|
|
59414
59593
|
if (name && name !== "default" && /^[a-z0-9][a-z0-9_-]{0,63}$/.test(name)) {
|
|
59415
59594
|
const dir = join28(root, "profiles", name);
|
|
59416
|
-
if (
|
|
59595
|
+
if (lstatSync13(dir).isDirectory()) return dir;
|
|
59417
59596
|
}
|
|
59418
59597
|
} catch {
|
|
59419
59598
|
}
|
|
@@ -59433,7 +59612,7 @@ function hermesProfilesScan(home2, env2, platform = process.platform) {
|
|
|
59433
59612
|
const path = join28(hermesRoot(home2, env2, platform), "profiles");
|
|
59434
59613
|
let isLink3 = false;
|
|
59435
59614
|
try {
|
|
59436
|
-
isLink3 =
|
|
59615
|
+
isLink3 = lstatSync13(path).isSymbolicLink();
|
|
59437
59616
|
} catch {
|
|
59438
59617
|
}
|
|
59439
59618
|
const target2 = () => {
|
|
@@ -59441,7 +59620,7 @@ function hermesProfilesScan(home2, env2, platform = process.platform) {
|
|
|
59441
59620
|
return realpathSync11(path);
|
|
59442
59621
|
} catch {
|
|
59443
59622
|
try {
|
|
59444
|
-
return
|
|
59623
|
+
return resolve7(dirname12(path), readlinkSync3(path));
|
|
59445
59624
|
} catch {
|
|
59446
59625
|
return "somewhere else";
|
|
59447
59626
|
}
|
|
@@ -59490,7 +59669,7 @@ var hermesEnv = (home2, env2, platform = process.platform) => ({
|
|
|
59490
59669
|
var hermesPluginDir = (home2, env2, platform = process.platform) => join28(hermesHome(home2, env2, platform), "plugins", HERMES_PLUGIN_NAME);
|
|
59491
59670
|
var kind = (path) => {
|
|
59492
59671
|
try {
|
|
59493
|
-
const st =
|
|
59672
|
+
const st = lstatSync13(path);
|
|
59494
59673
|
return st.isSymbolicLink() ? "link" : st.isDirectory() ? "dir" : "file";
|
|
59495
59674
|
} catch {
|
|
59496
59675
|
return void 0;
|
|
@@ -59567,7 +59746,7 @@ async function installHermes(deps2) {
|
|
|
59567
59746
|
mkdirSync12(plugins2, { recursive: true });
|
|
59568
59747
|
const staging = join28(plugins2, "..", HERMES_STAGING);
|
|
59569
59748
|
const own2 = `${process.pid}-${randomBytes5(4).toString("hex")}`;
|
|
59570
|
-
const st =
|
|
59749
|
+
const st = lstatSync13(staging, { throwIfNoEntry: false });
|
|
59571
59750
|
if (st !== void 0 && !st.isDirectory())
|
|
59572
59751
|
throw new Error(
|
|
59573
59752
|
`${staging} is not a plain folder; remove it and run the install again`
|
|
@@ -59647,20 +59826,20 @@ async function hermesEnabled(deps2) {
|
|
|
59647
59826
|
// src/steps/openclaw.ts
|
|
59648
59827
|
import {
|
|
59649
59828
|
existsSync as existsSync10,
|
|
59650
|
-
lstatSync as
|
|
59829
|
+
lstatSync as lstatSync15,
|
|
59651
59830
|
readdirSync as readdirSync10,
|
|
59652
59831
|
readFileSync as readFileSync26,
|
|
59653
59832
|
realpathSync as realpathSync13,
|
|
59654
59833
|
rmSync as rmSync15
|
|
59655
59834
|
} from "node:fs";
|
|
59656
|
-
import { join as join30, resolve as
|
|
59835
|
+
import { join as join30, resolve as resolve9 } from "node:path";
|
|
59657
59836
|
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
59658
59837
|
|
|
59659
59838
|
// src/steps/skill.ts
|
|
59660
59839
|
import {
|
|
59661
59840
|
chmodSync as chmodSync18,
|
|
59662
59841
|
existsSync as existsSync9,
|
|
59663
|
-
lstatSync as
|
|
59842
|
+
lstatSync as lstatSync14,
|
|
59664
59843
|
mkdirSync as mkdirSync13,
|
|
59665
59844
|
readdirSync as readdirSync9,
|
|
59666
59845
|
readFileSync as readFileSync25,
|
|
@@ -59672,7 +59851,7 @@ import {
|
|
|
59672
59851
|
statSync as statSync8,
|
|
59673
59852
|
writeFileSync as writeFileSync17
|
|
59674
59853
|
} from "node:fs";
|
|
59675
|
-
import { dirname as dirname13, join as join29, resolve as
|
|
59854
|
+
import { dirname as dirname13, join as join29, resolve as resolve8 } from "node:path";
|
|
59676
59855
|
var SKILL_MARKER = "<!-- managed by the Open Artifacts bus installer: edits are replaced on reinstall. -->";
|
|
59677
59856
|
var CODEX_BEGIN = "<!-- BEGIN Open Artifacts skill (managed): edits inside are replaced on reinstall. -->";
|
|
59678
59857
|
var CODEX_END = "<!-- END Open Artifacts skill -->";
|
|
@@ -59764,7 +59943,7 @@ var quotesMarker = (text3) => {
|
|
|
59764
59943
|
};
|
|
59765
59944
|
var lstatOk = (path) => {
|
|
59766
59945
|
try {
|
|
59767
|
-
|
|
59946
|
+
lstatSync14(path);
|
|
59768
59947
|
return true;
|
|
59769
59948
|
} catch {
|
|
59770
59949
|
return false;
|
|
@@ -59772,7 +59951,7 @@ var lstatOk = (path) => {
|
|
|
59772
59951
|
};
|
|
59773
59952
|
var brokenLink = (path) => {
|
|
59774
59953
|
try {
|
|
59775
|
-
return
|
|
59954
|
+
return lstatSync14(path).isSymbolicLink() && !existsSync9(path);
|
|
59776
59955
|
} catch {
|
|
59777
59956
|
return false;
|
|
59778
59957
|
}
|
|
@@ -59815,7 +59994,7 @@ async function fetchSkillText(doFetch, url2) {
|
|
|
59815
59994
|
}
|
|
59816
59995
|
var targetOf = (path) => {
|
|
59817
59996
|
try {
|
|
59818
|
-
return
|
|
59997
|
+
return lstatSync14(path).isSymbolicLink() ? realpathSync12(path) : path;
|
|
59819
59998
|
} catch {
|
|
59820
59999
|
return path;
|
|
59821
60000
|
}
|
|
@@ -59876,14 +60055,14 @@ var realOrResolved = (p) => {
|
|
|
59876
60055
|
try {
|
|
59877
60056
|
return realpathSync12(p);
|
|
59878
60057
|
} catch {
|
|
59879
|
-
return
|
|
60058
|
+
return resolve8(p);
|
|
59880
60059
|
}
|
|
59881
60060
|
};
|
|
59882
60061
|
var placesOf = (p) => {
|
|
59883
60062
|
const out = [realOrResolved(p)];
|
|
59884
60063
|
try {
|
|
59885
|
-
if (
|
|
59886
|
-
out.push(realOrResolved(
|
|
60064
|
+
if (lstatSync14(p).isSymbolicLink())
|
|
60065
|
+
out.push(realOrResolved(resolve8(dirname13(p), readlinkSync4(p))));
|
|
59887
60066
|
} catch {
|
|
59888
60067
|
}
|
|
59889
60068
|
return out;
|
|
@@ -60066,7 +60245,7 @@ var uninstallSkill = (deps2, harnesses = [
|
|
|
60066
60245
|
const dir = join29(base3, entry);
|
|
60067
60246
|
const file2 = join29(dir, "SKILL.md");
|
|
60068
60247
|
try {
|
|
60069
|
-
const st =
|
|
60248
|
+
const st = lstatSync14(dir);
|
|
60070
60249
|
if (st.isSymbolicLink()) {
|
|
60071
60250
|
if (existsSync9(file2))
|
|
60072
60251
|
notes.push(`Left ${dir} alone: it is a symlinked folder.`);
|
|
@@ -60147,13 +60326,13 @@ var placeholder = (v) => {
|
|
|
60147
60326
|
};
|
|
60148
60327
|
function openclawHome(home2, env2) {
|
|
60149
60328
|
const explicit = placeholder(env2.OPENCLAW_HOME);
|
|
60150
|
-
return
|
|
60329
|
+
return resolve9(explicit ? explicit.replace(/^~(?=$|[\\/])/, home2) : home2);
|
|
60151
60330
|
}
|
|
60152
60331
|
function openclawStateDir(home2, env2) {
|
|
60153
60332
|
const h = openclawHome(home2, env2);
|
|
60154
60333
|
const override = env2.OPENCLAW_STATE_DIR?.trim();
|
|
60155
60334
|
if (override)
|
|
60156
|
-
return
|
|
60335
|
+
return resolve9(
|
|
60157
60336
|
override.startsWith("~") ? override.replace(/^~(?=$|[\\/])/, h) : override
|
|
60158
60337
|
);
|
|
60159
60338
|
const next = join30(h, ".openclaw");
|
|
@@ -60181,7 +60360,7 @@ var openclawEnv = (home2, env2) => ({
|
|
|
60181
60360
|
var openclawNix = (env2) => env2?.OPENCLAW_NIX_MODE === "1";
|
|
60182
60361
|
var kind2 = (path) => {
|
|
60183
60362
|
try {
|
|
60184
|
-
const st =
|
|
60363
|
+
const st = lstatSync15(path);
|
|
60185
60364
|
return st.isSymbolicLink() ? "link" : st.isDirectory() ? "dir" : "file";
|
|
60186
60365
|
} catch {
|
|
60187
60366
|
return void 0;
|
|
@@ -60258,7 +60437,7 @@ var realOrSelf = (p) => {
|
|
|
60258
60437
|
try {
|
|
60259
60438
|
return realpathSync13(p);
|
|
60260
60439
|
} catch {
|
|
60261
|
-
return
|
|
60440
|
+
return resolve9(p);
|
|
60262
60441
|
}
|
|
60263
60442
|
};
|
|
60264
60443
|
var NEED_TOOLS = ["oabus_self", "oabus_send_message", "oabus_fetch"];
|
|
@@ -60442,7 +60621,7 @@ var piAgentDir = (home2, env2) => {
|
|
|
60442
60621
|
const d = env2.PI_CODING_AGENT_DIR;
|
|
60443
60622
|
if (!d) return join31(home2, ".pi", "agent");
|
|
60444
60623
|
if (d === "~") return home2;
|
|
60445
|
-
return
|
|
60624
|
+
return resolve10(d.startsWith("~/") ? join31(home2, d.slice(2)) : d);
|
|
60446
60625
|
};
|
|
60447
60626
|
function habitsFiles(deps2, h) {
|
|
60448
60627
|
const env2 = deps2.env ?? {};
|
|
@@ -60525,7 +60704,7 @@ function withHabits(existing, block, added) {
|
|
|
60525
60704
|
var reason = (e) => e instanceof Error ? e.message : String(e);
|
|
60526
60705
|
var isLink = (path) => {
|
|
60527
60706
|
try {
|
|
60528
|
-
return
|
|
60707
|
+
return lstatSync16(path).isSymbolicLink();
|
|
60529
60708
|
} catch {
|
|
60530
60709
|
return false;
|
|
60531
60710
|
}
|
|
@@ -60704,7 +60883,7 @@ var pluginPaths = (deps2, p) => {
|
|
|
60704
60883
|
};
|
|
60705
60884
|
var pluginOurs = (dir, p) => {
|
|
60706
60885
|
try {
|
|
60707
|
-
return
|
|
60886
|
+
return lstatSync16(dir).isDirectory() && p.ours(dir);
|
|
60708
60887
|
} catch {
|
|
60709
60888
|
return false;
|
|
60710
60889
|
}
|
|
@@ -60713,7 +60892,7 @@ function pluginHabitsState(deps2, p) {
|
|
|
60713
60892
|
const { dir, marker } = pluginPaths(deps2, p);
|
|
60714
60893
|
if (!pluginOurs(dir, p)) return "not installed";
|
|
60715
60894
|
try {
|
|
60716
|
-
return
|
|
60895
|
+
return lstatSync16(marker).isFile() ? "on" : "off";
|
|
60717
60896
|
} catch {
|
|
60718
60897
|
return "off";
|
|
60719
60898
|
}
|
|
@@ -60849,7 +61028,7 @@ function setPluginHabits(deps2, plugins2, on) {
|
|
|
60849
61028
|
}
|
|
60850
61029
|
var probe = (path) => {
|
|
60851
61030
|
try {
|
|
60852
|
-
const st =
|
|
61031
|
+
const st = lstatSync16(path);
|
|
60853
61032
|
return {
|
|
60854
61033
|
k: st.isSymbolicLink() ? "link" : st.isDirectory() ? "dir" : "file"
|
|
60855
61034
|
};
|
|
@@ -60880,7 +61059,7 @@ var habitsQuestionLines = (q) => [
|
|
|
60880
61059
|
|
|
60881
61060
|
// src/steps/opencode-proof.ts
|
|
60882
61061
|
import { existsSync as existsSync12, readFileSync as readFileSync28, rmSync as rmSync17 } from "node:fs";
|
|
60883
|
-
import { dirname as dirname14, isAbsolute as isAbsolute12, join as join32, resolve as
|
|
61062
|
+
import { dirname as dirname14, isAbsolute as isAbsolute12, join as join32, resolve as resolve11 } from "node:path";
|
|
60884
61063
|
init_src();
|
|
60885
61064
|
var OPENCODE_ENTRY_FILE = "opencode-mcp-entry.json";
|
|
60886
61065
|
var isRecord5 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
@@ -60923,7 +61102,7 @@ var REMOTE_ONLY = /* @__PURE__ */ new Set(["type", "url", "headers", "oauth"]);
|
|
|
60923
61102
|
function resolveTokenFile(x, configFile, home2) {
|
|
60924
61103
|
if (x === "~") return home2;
|
|
60925
61104
|
if (x.startsWith("~/")) return join32(home2, x.slice(2));
|
|
60926
|
-
return isAbsolute12(x) ? x :
|
|
61105
|
+
return isAbsolute12(x) ? x : resolve11(dirname14(configFile), x);
|
|
60927
61106
|
}
|
|
60928
61107
|
var proxyEntry = (io, origin, tokenFile, entry) => {
|
|
60929
61108
|
const kept = Object.fromEntries(
|
|
@@ -61069,6 +61248,28 @@ function proxyEntries(text3) {
|
|
|
61069
61248
|
({ entry }) => Array.isArray(entry.command) && entry.command.includes(PROXY_CMD2)
|
|
61070
61249
|
).map(({ name, entry }) => ({ name, entry }));
|
|
61071
61250
|
}
|
|
61251
|
+
function skippedNotes(files2, read, origin) {
|
|
61252
|
+
const notes = [];
|
|
61253
|
+
for (const file2 of files2)
|
|
61254
|
+
for (const { name, entry } of candidates(read(file2))) {
|
|
61255
|
+
if (ourEntry2(entry, origin)) return notes;
|
|
61256
|
+
if (!isInstance2(entry, origin) || entry.enabled === false) continue;
|
|
61257
|
+
try {
|
|
61258
|
+
mcpUrl(origin);
|
|
61259
|
+
} catch {
|
|
61260
|
+
notes.push(
|
|
61261
|
+
`left the ${name} entry in ${file2} as it is: oa-bus only passes on https addresses, or http to localhost.`
|
|
61262
|
+
);
|
|
61263
|
+
continue;
|
|
61264
|
+
}
|
|
61265
|
+
if (tokenFileOf(entry) === void 0)
|
|
61266
|
+
notes.push(
|
|
61267
|
+
`left the ${name} entry in ${file2} as it is: it signs in with \`opencode mcp auth\` or another kind of token that oa-bus can't pass on.`
|
|
61268
|
+
);
|
|
61269
|
+
else return notes;
|
|
61270
|
+
}
|
|
61271
|
+
return notes;
|
|
61272
|
+
}
|
|
61072
61273
|
|
|
61073
61274
|
// src/steps/pi-proof.ts
|
|
61074
61275
|
import { existsSync as existsSync13, readFileSync as readFileSync29, rmSync as rmSync18 } from "node:fs";
|
|
@@ -61097,7 +61298,7 @@ var writeConfig = (io, c, servers4) => io.write(
|
|
|
61097
61298
|
`${c.bom ? BOM2 : ""}${JSON.stringify({ ...c.parsed, mcpServers: servers4 }, null, c.indent)}
|
|
61098
61299
|
`
|
|
61099
61300
|
);
|
|
61100
|
-
function
|
|
61301
|
+
function findEntry(servers4, origin) {
|
|
61101
61302
|
for (const [name, e] of Object.entries(servers4)) {
|
|
61102
61303
|
if (!isRecord6(e) || typeof e.url !== "string") continue;
|
|
61103
61304
|
if (e.type !== void 0 && e.type !== "http" && e.type !== "streamable-http")
|
|
@@ -61128,12 +61329,12 @@ function readMoved3(path) {
|
|
|
61128
61329
|
function pendingEntry2(io, origin) {
|
|
61129
61330
|
const c = readConfig2(io.file);
|
|
61130
61331
|
if (!c) return void 0;
|
|
61131
|
-
return
|
|
61332
|
+
return findEntry(c.servers, origin);
|
|
61132
61333
|
}
|
|
61133
61334
|
function moveEntry(io, origin) {
|
|
61134
61335
|
const c = readConfig2(io.file);
|
|
61135
61336
|
if (!c) return false;
|
|
61136
|
-
const name =
|
|
61337
|
+
const name = findEntry(c.servers, origin);
|
|
61137
61338
|
if (name === void 0) return false;
|
|
61138
61339
|
const keys = Object.keys(c.servers);
|
|
61139
61340
|
const moved = {
|
|
@@ -61192,7 +61393,7 @@ var readAssets = () => ({
|
|
|
61192
61393
|
});
|
|
61193
61394
|
var movedHome = (deps2) => {
|
|
61194
61395
|
if (deps2.busHome === void 0) return void 0;
|
|
61195
|
-
const ob =
|
|
61396
|
+
const ob = resolve12(deps2.busHome);
|
|
61196
61397
|
return ob === join33(deps2.home, ".oa-bus") ? void 0 : ob;
|
|
61197
61398
|
};
|
|
61198
61399
|
var homeLine = (ob) => `process.env.OA_BUS_HOME ||= ${JSON.stringify(ob)};`;
|
|
@@ -61238,7 +61439,7 @@ function agentDirEnv(home2, env2) {
|
|
|
61238
61439
|
const dir = env2.PI_CODING_AGENT_DIR;
|
|
61239
61440
|
if (!dir) return void 0;
|
|
61240
61441
|
if (dir === "~") return home2;
|
|
61241
|
-
return
|
|
61442
|
+
return resolve12(dir.startsWith("~/") ? join33(home2, dir.slice(2)) : dir);
|
|
61242
61443
|
}
|
|
61243
61444
|
var ompRoot = (home2, env2) => join33(home2, env2.PI_CONFIG_DIR || ".omp");
|
|
61244
61445
|
function ompProfile(env2) {
|
|
@@ -61276,7 +61477,7 @@ function readDoc(path) {
|
|
|
61276
61477
|
}
|
|
61277
61478
|
function present2(path) {
|
|
61278
61479
|
try {
|
|
61279
|
-
|
|
61480
|
+
lstatSync17(path);
|
|
61280
61481
|
return true;
|
|
61281
61482
|
} catch {
|
|
61282
61483
|
return false;
|
|
@@ -61285,14 +61486,14 @@ function present2(path) {
|
|
|
61285
61486
|
function target(path) {
|
|
61286
61487
|
let p = path;
|
|
61287
61488
|
for (let hops = 0; hops < 40; hops++) {
|
|
61288
|
-
if (!present2(p) || !
|
|
61489
|
+
if (!present2(p) || !lstatSync17(p).isSymbolicLink()) {
|
|
61289
61490
|
if (p !== path && !existsSync14(dirname15(p)))
|
|
61290
61491
|
throw new Error(
|
|
61291
61492
|
`${path} is a dangling symlink to ${p}; left it untouched`
|
|
61292
61493
|
);
|
|
61293
61494
|
return p;
|
|
61294
61495
|
}
|
|
61295
|
-
p =
|
|
61496
|
+
p = resolve12(dirname15(p), readlinkSync5(p));
|
|
61296
61497
|
}
|
|
61297
61498
|
throw new Error(`${path}: too many symlinks; left it untouched`);
|
|
61298
61499
|
}
|
|
@@ -61379,13 +61580,9 @@ async function run4(deps2, cmd, args) {
|
|
|
61379
61580
|
function claudeProof(deps2, notes) {
|
|
61380
61581
|
if (deps2.hub === void 0) return;
|
|
61381
61582
|
try {
|
|
61382
|
-
|
|
61383
|
-
proofIo(deps2),
|
|
61384
|
-
deps2.hub,
|
|
61385
|
-
deps2.busBin,
|
|
61386
|
-
movedHome(deps2)
|
|
61583
|
+
notes.push(
|
|
61584
|
+
...installProof(proofIo(deps2), deps2.hub, deps2.busBin, movedHome(deps2)).notes
|
|
61387
61585
|
);
|
|
61388
|
-
if (note) notes.push(note);
|
|
61389
61586
|
} catch (e) {
|
|
61390
61587
|
notes.push(
|
|
61391
61588
|
`could not add the proof helper to the Claude entry: ${e instanceof Error ? e.message : String(e)}`
|
|
@@ -61524,7 +61721,7 @@ var isolatedInstall = (deps2) => {
|
|
|
61524
61721
|
if (deps2.isolated) return true;
|
|
61525
61722
|
const dir = deps2.env?.OPENCODE_CONFIG_DIR;
|
|
61526
61723
|
if (!dir) return false;
|
|
61527
|
-
const rel = relative6(
|
|
61724
|
+
const rel = relative6(resolve12(deps2.home), resolve12(dir));
|
|
61528
61725
|
return rel.startsWith("..") || isAbsolute13(rel);
|
|
61529
61726
|
};
|
|
61530
61727
|
async function restartOpencode(deps2, notes, changed) {
|
|
@@ -61711,7 +61908,7 @@ var install = {
|
|
|
61711
61908
|
var uninstall = {
|
|
61712
61909
|
async claude(deps2, notes) {
|
|
61713
61910
|
try {
|
|
61714
|
-
uninstallProof(proofIo(deps2));
|
|
61911
|
+
uninstallProof(proofIo(deps2), movedHome(deps2));
|
|
61715
61912
|
} catch (e) {
|
|
61716
61913
|
notes.push(
|
|
61717
61914
|
`could not take the proof helper off the Claude entry: ${e instanceof Error ? e.message : String(e)}`
|
|
@@ -61981,13 +62178,59 @@ function codexProxyProblem(deps2) {
|
|
|
61981
62178
|
return void 0;
|
|
61982
62179
|
}
|
|
61983
62180
|
}
|
|
62181
|
+
function skippedProxyEntries(deps2) {
|
|
62182
|
+
const out = [];
|
|
62183
|
+
const d = { ...deps2, busBin: [] };
|
|
62184
|
+
const p = paths(d);
|
|
62185
|
+
try {
|
|
62186
|
+
if (present2(p.codex)) {
|
|
62187
|
+
const pending = pendingEntry(cxEntryIo(d), deps2.hub);
|
|
62188
|
+
if (pending && "note" in pending)
|
|
62189
|
+
out.push({ harness: "Codex", note: pending.note });
|
|
62190
|
+
}
|
|
62191
|
+
} catch {
|
|
62192
|
+
}
|
|
62193
|
+
try {
|
|
62194
|
+
for (const note of skippedNotes(
|
|
62195
|
+
p.opencodeConfigs.filter(present2),
|
|
62196
|
+
readJsonc,
|
|
62197
|
+
deps2.hub
|
|
62198
|
+
))
|
|
62199
|
+
out.push({ harness: "OpenCode", note });
|
|
62200
|
+
} catch {
|
|
62201
|
+
}
|
|
62202
|
+
return out;
|
|
62203
|
+
}
|
|
62204
|
+
function reapplyClaudeProof(deps2, onWrite) {
|
|
62205
|
+
try {
|
|
62206
|
+
if (deps2.busBin.length === 0) return;
|
|
62207
|
+
const r = installProof(
|
|
62208
|
+
{ ...proofIo(deps2), file: deps2.config },
|
|
62209
|
+
deps2.hub,
|
|
62210
|
+
deps2.busBin,
|
|
62211
|
+
movedHome(deps2),
|
|
62212
|
+
{ guard: true }
|
|
62213
|
+
);
|
|
62214
|
+
for (const c of r.changed) onWrite(c);
|
|
62215
|
+
} catch {
|
|
62216
|
+
}
|
|
62217
|
+
}
|
|
62218
|
+
function recordClaudeProof(deps2) {
|
|
62219
|
+
try {
|
|
62220
|
+
if (deps2.busBin.length === 0) return;
|
|
62221
|
+
const io = proofIo(deps2);
|
|
62222
|
+
if (readRecord(io.record).config !== void 0) return;
|
|
62223
|
+
installProof(io, deps2.hub, deps2.busBin, movedHome(deps2));
|
|
62224
|
+
} catch {
|
|
62225
|
+
}
|
|
62226
|
+
}
|
|
61984
62227
|
|
|
61985
62228
|
// src/steps/path-shim.ts
|
|
61986
62229
|
import {
|
|
61987
62230
|
accessSync as accessSync2,
|
|
61988
62231
|
chmodSync as chmodSync20,
|
|
61989
62232
|
constants as constants6,
|
|
61990
|
-
lstatSync as
|
|
62233
|
+
lstatSync as lstatSync18,
|
|
61991
62234
|
mkdirSync as mkdirSync15,
|
|
61992
62235
|
readFileSync as readFileSync31,
|
|
61993
62236
|
readlinkSync as readlinkSync6,
|
|
@@ -61995,22 +62238,22 @@ import {
|
|
|
61995
62238
|
rmSync as rmSync20,
|
|
61996
62239
|
writeFileSync as writeFileSync19
|
|
61997
62240
|
} from "node:fs";
|
|
61998
|
-
import { delimiter as delimiter3, dirname as dirname16, join as join34, resolve as
|
|
62241
|
+
import { delimiter as delimiter3, dirname as dirname16, join as join34, resolve as resolve13, sep as sep5 } from "node:path";
|
|
61999
62242
|
var SHIM_MARKER = "# oa-bus shim: written by oa-bus install";
|
|
62000
62243
|
var HOME_PREFIX = "# oa-bus home: ";
|
|
62001
62244
|
var NAME2 = "oa-bus";
|
|
62002
62245
|
var LOCAL_HINT = 'export PATH="$HOME/.local/bin:$PATH"';
|
|
62003
62246
|
var isWindows = (platform) => platform.startsWith("win32");
|
|
62004
|
-
var pathDirs = (p) => (p ?? "").split(delimiter3).filter((d) => d !== "").map((d) =>
|
|
62247
|
+
var pathDirs = (p) => (p ?? "").split(delimiter3).filter((d) => d !== "").map((d) => resolve13(d));
|
|
62005
62248
|
var candidates2 = (o) => o.platform.startsWith("darwin") ? [join34(o.userHome, ".local", "bin"), join34(o.userHome, "bin")] : [join34(o.userHome, ".local", "bin")];
|
|
62006
62249
|
var shQuote2 = (v) => `'${v.replaceAll("'", `'\\''`)}'`;
|
|
62007
62250
|
function shimText(o) {
|
|
62008
|
-
const moved =
|
|
62251
|
+
const moved = resolve13(o.busHome) !== resolve13(o.userHome, ".oa-bus");
|
|
62009
62252
|
return [
|
|
62010
62253
|
"#!/bin/sh",
|
|
62011
62254
|
SHIM_MARKER,
|
|
62012
|
-
`${HOME_PREFIX}${
|
|
62013
|
-
...moved ? [`OA_BUS_HOME=${shQuote2(
|
|
62255
|
+
`${HOME_PREFIX}${resolve13(o.busHome)}`,
|
|
62256
|
+
...moved ? [`OA_BUS_HOME=${shQuote2(resolve13(o.busHome))}`, "export OA_BUS_HOME"] : [],
|
|
62014
62257
|
`exec ${o.argv.map(shQuote2).join(" ")} "$@"`,
|
|
62015
62258
|
""
|
|
62016
62259
|
].join("\n");
|
|
@@ -62018,14 +62261,14 @@ function shimText(o) {
|
|
|
62018
62261
|
function ownerOf(file2, busHome2) {
|
|
62019
62262
|
let st;
|
|
62020
62263
|
try {
|
|
62021
|
-
st =
|
|
62264
|
+
st = lstatSync18(file2);
|
|
62022
62265
|
} catch {
|
|
62023
62266
|
return void 0;
|
|
62024
62267
|
}
|
|
62025
62268
|
if (st.isSymbolicLink()) {
|
|
62026
62269
|
try {
|
|
62027
|
-
const to =
|
|
62028
|
-
const home2 =
|
|
62270
|
+
const to = resolve13(dirname16(file2), readlinkSync6(file2));
|
|
62271
|
+
const home2 = resolve13(busHome2);
|
|
62029
62272
|
return to === home2 || to.startsWith(`${home2}/`) ? { ours: true, home: home2 } : { ours: false };
|
|
62030
62273
|
} catch {
|
|
62031
62274
|
return { ours: false };
|
|
@@ -62041,7 +62284,7 @@ function ownerOf(file2, busHome2) {
|
|
|
62041
62284
|
return { ours: false };
|
|
62042
62285
|
}
|
|
62043
62286
|
}
|
|
62044
|
-
var sameHome = (owner, busHome2) => owner?.ours === true && (owner.home === void 0 || owner.home ===
|
|
62287
|
+
var sameHome = (owner, busHome2) => owner?.ours === true && (owner.home === void 0 || owner.home === resolve13(busHome2));
|
|
62045
62288
|
function writeShim(path, text3) {
|
|
62046
62289
|
const tmp = `${path}.${process.pid}.tmp`;
|
|
62047
62290
|
rmSync20(tmp, { force: true });
|
|
@@ -62087,7 +62330,7 @@ function removeShim(o) {
|
|
|
62087
62330
|
const file2 = join34(dir, NAME2);
|
|
62088
62331
|
const owner = ownerOf(file2, o.busHome);
|
|
62089
62332
|
if (!owner?.ours) continue;
|
|
62090
|
-
if (owner.home !== void 0 && owner.home !==
|
|
62333
|
+
if (owner.home !== void 0 && owner.home !== resolve13(o.busHome)) continue;
|
|
62091
62334
|
rmSync20(file2, { force: true });
|
|
62092
62335
|
removed = file2;
|
|
62093
62336
|
}
|
|
@@ -62096,7 +62339,7 @@ function removeShim(o) {
|
|
|
62096
62339
|
var executable2 = (f) => {
|
|
62097
62340
|
try {
|
|
62098
62341
|
accessSync2(f, constants6.X_OK);
|
|
62099
|
-
return
|
|
62342
|
+
return lstatSync18(f).isFile() || lstatSync18(f).isSymbolicLink();
|
|
62100
62343
|
} catch {
|
|
62101
62344
|
return false;
|
|
62102
62345
|
}
|
|
@@ -62110,12 +62353,12 @@ function shimState(o) {
|
|
|
62110
62353
|
const file2 = join34(dir, NAME2);
|
|
62111
62354
|
if (!executable2(file2)) continue;
|
|
62112
62355
|
const owner = ownerOf(file2, o.busHome);
|
|
62113
|
-
return owner?.ours && (owner.home === void 0 || owner.home ===
|
|
62356
|
+
return owner?.ours && (owner.home === void 0 || owner.home === resolve13(o.busHome)) ? { kind: "ours", path: file2 } : { kind: "other", path: file2 };
|
|
62114
62357
|
}
|
|
62115
62358
|
for (const dir of candidates2(o)) {
|
|
62116
62359
|
const file2 = join34(dir, NAME2);
|
|
62117
62360
|
const owner = ownerOf(file2, o.busHome);
|
|
62118
|
-
if (owner?.ours && (owner.home === void 0 || owner.home ===
|
|
62361
|
+
if (owner?.ours && (owner.home === void 0 || owner.home === resolve13(o.busHome)))
|
|
62119
62362
|
return { kind: "off-path", path: file2, hint: LOCAL_HINT };
|
|
62120
62363
|
}
|
|
62121
62364
|
return { kind: "missing" };
|
|
@@ -62192,7 +62435,7 @@ async function autoUpdate(opts, ctx) {
|
|
|
62192
62435
|
|
|
62193
62436
|
// src/commands/daemon.ts
|
|
62194
62437
|
import { existsSync as existsSync15 } from "node:fs";
|
|
62195
|
-
import { join as
|
|
62438
|
+
import { join as join37 } from "node:path";
|
|
62196
62439
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
62197
62440
|
|
|
62198
62441
|
// src/machine.ts
|
|
@@ -62224,6 +62467,168 @@ function readMachine(home2) {
|
|
|
62224
62467
|
}
|
|
62225
62468
|
return { state: "bad" };
|
|
62226
62469
|
}
|
|
62470
|
+
var originOf2 = (hub) => {
|
|
62471
|
+
try {
|
|
62472
|
+
return new URL(hub.replace(/^ws(s?):/, "http$1:")).origin;
|
|
62473
|
+
} catch {
|
|
62474
|
+
return hub;
|
|
62475
|
+
}
|
|
62476
|
+
};
|
|
62477
|
+
|
|
62478
|
+
// src/steps/claude-proof-check.ts
|
|
62479
|
+
import { readFileSync as readFileSync33 } from "node:fs";
|
|
62480
|
+
import { join as join36 } from "node:path";
|
|
62481
|
+
var PROOF_EVENT = "claude_proof_applied";
|
|
62482
|
+
var DAY_MS = 864e5;
|
|
62483
|
+
var safeText = (s, max = 80) => {
|
|
62484
|
+
const t = s.replace(/[\p{Cc}\p{Cf}\u2028\u2029]/gu, "?");
|
|
62485
|
+
return t.length > max ? `${t.slice(0, max - 1)}\u2026` : t;
|
|
62486
|
+
};
|
|
62487
|
+
var safeUrl = (u) => {
|
|
62488
|
+
try {
|
|
62489
|
+
const x = new URL(u);
|
|
62490
|
+
return safeText(`${x.origin}${x.pathname}`, 120);
|
|
62491
|
+
} catch {
|
|
62492
|
+
return "an address that can't be read";
|
|
62493
|
+
}
|
|
62494
|
+
};
|
|
62495
|
+
var where = (ctx, e) => e.scope === "project" ? "project scope, .mcp.json in this folder" : e.scope === "local" ? `local scope, project ${safeText(tilde(ctx, e.project ?? ""), 120)}` : "user scope";
|
|
62496
|
+
function claudeProofChecks(ctx, hub) {
|
|
62497
|
+
const origin = originOf2(hub);
|
|
62498
|
+
let host;
|
|
62499
|
+
try {
|
|
62500
|
+
host = new URL(origin).host;
|
|
62501
|
+
} catch {
|
|
62502
|
+
return [];
|
|
62503
|
+
}
|
|
62504
|
+
const rec = readRecord(join36(ctx.home, "install.json"));
|
|
62505
|
+
const file2 = rec.config ?? claudeConfigFile(ctx.userHome, ctx.env);
|
|
62506
|
+
const r = proofReport(file2, origin, {
|
|
62507
|
+
projectFile: join36(ctx.cwd, ".mcp.json"),
|
|
62508
|
+
cwd: ctx.cwd,
|
|
62509
|
+
recorded: rec.proofs,
|
|
62510
|
+
...isDefaultHome(ctx.home, ctx.userHome) ? {} : { busHome: ctx.home }
|
|
62511
|
+
});
|
|
62512
|
+
const out = [];
|
|
62513
|
+
const install3 = `run ${ctx.busCmd} install`;
|
|
62514
|
+
for (const e of r.entries) {
|
|
62515
|
+
const at = `the ${safeText(e.name)} entry (${where(ctx, e)})`;
|
|
62516
|
+
if (e.scope === "project") {
|
|
62517
|
+
out.push(
|
|
62518
|
+
e.state === "helper" && e.trusted !== false ? {
|
|
62519
|
+
level: "pass",
|
|
62520
|
+
lines: [`Claude Code: ${at} has the helper.`]
|
|
62521
|
+
} : {
|
|
62522
|
+
level: "warn",
|
|
62523
|
+
lines: [
|
|
62524
|
+
e.state === "helper" ? `Claude Code: ${at} has the helper, but Claude doesn't trust this folder yet, so it won't run it.` : `Claude Code: ${at} is not set up by the bus; it links only if it has our helper and the folder is trusted.`,
|
|
62525
|
+
e.state === "helper" ? " Open Claude Code in this folder and accept the trust prompt." : ` Re-add it at user scope with Claude Code, then ${install3}.`
|
|
62526
|
+
]
|
|
62527
|
+
}
|
|
62528
|
+
);
|
|
62529
|
+
continue;
|
|
62530
|
+
}
|
|
62531
|
+
if (e.state === "helper")
|
|
62532
|
+
out.push(
|
|
62533
|
+
e.trusted === false ? {
|
|
62534
|
+
level: "warn",
|
|
62535
|
+
lines: [
|
|
62536
|
+
`Claude Code: ${at} has the helper, but Claude doesn't trust that folder yet, so it won't run it.`,
|
|
62537
|
+
" Open Claude Code in that folder and accept the trust prompt."
|
|
62538
|
+
]
|
|
62539
|
+
} : {
|
|
62540
|
+
level: "pass",
|
|
62541
|
+
lines: [`Claude Code: ${at} shows as this session on pages.`]
|
|
62542
|
+
}
|
|
62543
|
+
);
|
|
62544
|
+
else if (e.state === "other-bus")
|
|
62545
|
+
out.push({
|
|
62546
|
+
level: "warn",
|
|
62547
|
+
lines: [
|
|
62548
|
+
`Claude Code: ${at} has the helper of another bus (${e.owner === void 0 ? "the default home" : safeText(tilde(ctx, e.owner), 120)}), so this bus left it alone.`,
|
|
62549
|
+
" An entry links one bus; use another entry for this one."
|
|
62550
|
+
]
|
|
62551
|
+
});
|
|
62552
|
+
else if (e.state === "unrecorded")
|
|
62553
|
+
out.push({
|
|
62554
|
+
level: "warn",
|
|
62555
|
+
lines: [
|
|
62556
|
+
`Claude Code: ${at} has the helper, but was set up by another bus or an older install.`,
|
|
62557
|
+
` Fix: ${install3} to adopt it`
|
|
62558
|
+
]
|
|
62559
|
+
});
|
|
62560
|
+
else if (e.state === "missing")
|
|
62561
|
+
out.push({
|
|
62562
|
+
level: "fail",
|
|
62563
|
+
lines: [
|
|
62564
|
+
`Claude Code: ${at} has no session helper, so what it posts can't be tied to this session.`,
|
|
62565
|
+
` Fix: ${install3}`
|
|
62566
|
+
]
|
|
62567
|
+
});
|
|
62568
|
+
else
|
|
62569
|
+
out.push({
|
|
62570
|
+
level: "fail",
|
|
62571
|
+
lines: [
|
|
62572
|
+
`Claude Code: ${at} has a headersHelper that is not oa-bus's, so oa-bus left it alone.`,
|
|
62573
|
+
` Fix: remove that headersHelper from the entry in ${tilde(ctx, file2)}, then ${install3}`
|
|
62574
|
+
]
|
|
62575
|
+
});
|
|
62576
|
+
}
|
|
62577
|
+
if (rec.config === void 0 && wiredTo(ctx) && r.entries.some((e) => e.scope !== "project"))
|
|
62578
|
+
out.push({
|
|
62579
|
+
level: "warn",
|
|
62580
|
+
lines: [
|
|
62581
|
+
"Claude Code: automatic linking is off for this bus.",
|
|
62582
|
+
` Fix: ${install3} once to turn it on`
|
|
62583
|
+
]
|
|
62584
|
+
});
|
|
62585
|
+
if (r.symlink)
|
|
62586
|
+
out.push({
|
|
62587
|
+
level: "warn",
|
|
62588
|
+
lines: [
|
|
62589
|
+
`Claude Code: ${tilde(ctx, file2)} is a symlink, so the daemon doesn't edit it on its own.`,
|
|
62590
|
+
` Fix: ${install3} to link its entries`
|
|
62591
|
+
]
|
|
62592
|
+
});
|
|
62593
|
+
if (r.entries.length === 0)
|
|
62594
|
+
out.push({
|
|
62595
|
+
level: "info",
|
|
62596
|
+
lines: [
|
|
62597
|
+
`No Claude Code entry for ${host}.`,
|
|
62598
|
+
" Agents using a connector or another client aren't checked."
|
|
62599
|
+
]
|
|
62600
|
+
});
|
|
62601
|
+
for (const e of r.elsewhere)
|
|
62602
|
+
out.push({
|
|
62603
|
+
level: "warn",
|
|
62604
|
+
lines: [
|
|
62605
|
+
`Claude Code: the ${safeText(e.name)} entry (${e.scope} scope) points at ${safeUrl(e.url)}, not ${origin}/mcp, so it can't be linked.`
|
|
62606
|
+
]
|
|
62607
|
+
});
|
|
62608
|
+
return out;
|
|
62609
|
+
}
|
|
62610
|
+
function lastAutoFix(ctx) {
|
|
62611
|
+
let text3;
|
|
62612
|
+
try {
|
|
62613
|
+
text3 = readFileSync33(join36(ctx.home, "logs", "events.log"), "utf8");
|
|
62614
|
+
} catch {
|
|
62615
|
+
return void 0;
|
|
62616
|
+
}
|
|
62617
|
+
const hits = text3.split("\n").filter((l) => l.includes(` ${PROOF_EVENT} `)).map((l) => {
|
|
62618
|
+
const [at = ""] = l.split(" ");
|
|
62619
|
+
return {
|
|
62620
|
+
at,
|
|
62621
|
+
name: / name=("[^"]*"|\S+)/.exec(l)?.[1]?.replaceAll('"', "") ?? "",
|
|
62622
|
+
scope: / kind=(\S+)/.exec(l)?.[1] ?? ""
|
|
62623
|
+
};
|
|
62624
|
+
});
|
|
62625
|
+
const last = hits.at(-1);
|
|
62626
|
+
if (!last) return void 0;
|
|
62627
|
+
const t = Date.parse(last.at);
|
|
62628
|
+
if (!(ctx.now() - t < 7 * DAY_MS)) return void 0;
|
|
62629
|
+
const run5 = hits.filter((h) => Math.abs(Date.parse(h.at) - t) < 6e4);
|
|
62630
|
+
return `Claude Code: the last automatic fix (${last.at.slice(0, 16).replace("T", " ")} UTC) added the helper to ${run5.map((h) => `${safeText(h.name)} (${safeText(h.scope, 20)} scope)`).join(", ")}.`;
|
|
62631
|
+
}
|
|
62227
62632
|
|
|
62228
62633
|
// src/commands/daemon.ts
|
|
62229
62634
|
var lasting = (e) => [...START_ERROR_CODES, "EACCES", "EPERM"].includes(
|
|
@@ -62231,11 +62636,25 @@ var lasting = (e) => [...START_ERROR_CODES, "EACCES", "EPERM"].includes(
|
|
|
62231
62636
|
);
|
|
62232
62637
|
async function daemon(ctx, run5 = runDaemon, signals = process) {
|
|
62233
62638
|
const m = readMachine(ctx.home);
|
|
62234
|
-
if (existsSync15(
|
|
62639
|
+
if (existsSync15(join37(ctx.home, "revoked")) && (m.state !== "ok" || m.revoked)) {
|
|
62235
62640
|
sayErr(ctx, ctx.copy.revoked());
|
|
62236
62641
|
return 0;
|
|
62237
62642
|
}
|
|
62238
|
-
|
|
62643
|
+
const events = createEventLog(join37(ctx.home, "logs", "events.log"));
|
|
62644
|
+
const config2 = readRecord(join37(ctx.home, "install.json")).config;
|
|
62645
|
+
if (m.state === "ok" && config2 !== void 0 && wiredTo(ctx))
|
|
62646
|
+
reapplyClaudeProof(
|
|
62647
|
+
{
|
|
62648
|
+
home: ctx.userHome,
|
|
62649
|
+
busHome: ctx.home,
|
|
62650
|
+
env: ctx.env,
|
|
62651
|
+
busBin: ctx.service.argv?.() ?? [],
|
|
62652
|
+
hub: originOf2(m.hub),
|
|
62653
|
+
config: config2
|
|
62654
|
+
},
|
|
62655
|
+
(c) => events(PROOF_EVENT, { name: c.entry, kind: c.scope })
|
|
62656
|
+
);
|
|
62657
|
+
return new Promise((resolve18) => {
|
|
62239
62658
|
let running;
|
|
62240
62659
|
let ended = false;
|
|
62241
62660
|
const end = (code2) => {
|
|
@@ -62243,15 +62662,14 @@ async function daemon(ctx, run5 = runDaemon, signals = process) {
|
|
|
62243
62662
|
ended = true;
|
|
62244
62663
|
signals.off("SIGINT", onSignal);
|
|
62245
62664
|
signals.off("SIGTERM", onSignal);
|
|
62246
|
-
void (running?.stop() ?? Promise.resolve()).finally(() =>
|
|
62665
|
+
void (running?.stop() ?? Promise.resolve()).finally(() => resolve18(code2));
|
|
62247
62666
|
};
|
|
62248
62667
|
const onSignal = () => end(0);
|
|
62249
62668
|
signals.once("SIGINT", onSignal);
|
|
62250
62669
|
signals.once("SIGTERM", onSignal);
|
|
62251
62670
|
run5({
|
|
62252
62671
|
version: ctx.version,
|
|
62253
|
-
|
|
62254
|
-
events: createEventLog(join36(ctx.home, "logs", "events.log")),
|
|
62672
|
+
events,
|
|
62255
62673
|
// Only an older token was revoked: a restart picks up the new one.
|
|
62256
62674
|
onRevoked: (replaced) => end(replaced ? 1 : REVOKED_EXIT),
|
|
62257
62675
|
// Exit non-zero: the service restarts the daemon, which binds again.
|
|
@@ -62276,50 +62694,50 @@ async function daemon(ctx, run5 = runDaemon, signals = process) {
|
|
|
62276
62694
|
}
|
|
62277
62695
|
|
|
62278
62696
|
// src/commands/doctor.ts
|
|
62279
|
-
import { readFileSync as
|
|
62280
|
-
import { join as
|
|
62697
|
+
import { readFileSync as readFileSync37 } from "node:fs";
|
|
62698
|
+
import { join as join44 } from "node:path";
|
|
62281
62699
|
|
|
62282
62700
|
// src/steps/claude-plugins.ts
|
|
62283
|
-
import { readFileSync as
|
|
62284
|
-
import { join as
|
|
62701
|
+
import { readFileSync as readFileSync35 } from "node:fs";
|
|
62702
|
+
import { join as join39 } from "node:path";
|
|
62285
62703
|
|
|
62286
62704
|
// src/steps/output-style.ts
|
|
62287
62705
|
import {
|
|
62288
|
-
lstatSync as
|
|
62706
|
+
lstatSync as lstatSync19,
|
|
62289
62707
|
readdirSync as readdirSync11,
|
|
62290
|
-
readFileSync as
|
|
62708
|
+
readFileSync as readFileSync34,
|
|
62291
62709
|
rmdirSync as rmdirSync3,
|
|
62292
62710
|
rmSync as rmSync21
|
|
62293
62711
|
} from "node:fs";
|
|
62294
|
-
import { dirname as dirname17, join as
|
|
62712
|
+
import { dirname as dirname17, join as join38 } from "node:path";
|
|
62295
62713
|
var OUTPUT_STYLE_FILE = "artifacts-teammate.md";
|
|
62296
62714
|
var OUTPUT_STYLE_MARKER = "<!-- managed by the Open Artifacts bus installer: edits are replaced on reinstall. -->";
|
|
62297
62715
|
var OUTPUT_STYLE_NAME = "Artifacts Teammate";
|
|
62298
62716
|
var OUTPUT_STYLE_PLUGIN_NAME = "open-artifacts:Artifacts Teammate";
|
|
62299
62717
|
var isOurName = (v) => v === OUTPUT_STYLE_NAME || v === OUTPUT_STYLE_PLUGIN_NAME;
|
|
62300
|
-
var claudeSettingsFile = (w) =>
|
|
62718
|
+
var claudeSettingsFile = (w) => join38(w.env?.CLAUDE_CONFIG_DIR ?? join38(w.home, ".claude"), "settings.json");
|
|
62301
62719
|
var readRecord3 = (busHome2) => {
|
|
62302
62720
|
if (!busHome2) return void 0;
|
|
62303
|
-
const r = readInstallFile(
|
|
62721
|
+
const r = readInstallFile(join38(busHome2, "install.json")).outputStyle;
|
|
62304
62722
|
return typeof r === "object" && r !== null ? r : void 0;
|
|
62305
62723
|
};
|
|
62306
|
-
var writeRecord3 = (busHome2, r) => updateInstallFile(
|
|
62307
|
-
var styleDir = (w) =>
|
|
62308
|
-
var outputStyleFile = (w) =>
|
|
62724
|
+
var writeRecord3 = (busHome2, r) => updateInstallFile(join38(busHome2, "install.json"), { outputStyle: r });
|
|
62725
|
+
var styleDir = (w) => join38(w.env?.CLAUDE_CONFIG_DIR ?? join38(w.home, ".claude"), "output-styles");
|
|
62726
|
+
var outputStyleFile = (w) => join38(styleDir(w), OUTPUT_STYLE_FILE);
|
|
62309
62727
|
var isOurs2 = (text3) => {
|
|
62310
62728
|
const m = /^---\n[\s\S]*?\n---\n/.exec(text3.replace(/\r\n/g, "\n"));
|
|
62311
62729
|
return m !== null && text3.replace(/\r\n/g, "\n").slice(m[0].length).split("\n", 1)[0] === OUTPUT_STYLE_MARKER;
|
|
62312
62730
|
};
|
|
62313
62731
|
var isLink2 = (path) => {
|
|
62314
62732
|
try {
|
|
62315
|
-
return
|
|
62733
|
+
return lstatSync19(path).isSymbolicLink();
|
|
62316
62734
|
} catch {
|
|
62317
62735
|
return false;
|
|
62318
62736
|
}
|
|
62319
62737
|
};
|
|
62320
62738
|
var exists = (path) => {
|
|
62321
62739
|
try {
|
|
62322
|
-
|
|
62740
|
+
lstatSync19(path);
|
|
62323
62741
|
return true;
|
|
62324
62742
|
} catch {
|
|
62325
62743
|
return false;
|
|
@@ -62329,7 +62747,7 @@ var readSettings = (path) => {
|
|
|
62329
62747
|
if (isLink2(path)) return { ok: false, why: "it is a symlink" };
|
|
62330
62748
|
if (!exists(path)) return { ok: true, text: void 0, style: void 0 };
|
|
62331
62749
|
try {
|
|
62332
|
-
const text3 =
|
|
62750
|
+
const text3 = readFileSync34(path, "utf8");
|
|
62333
62751
|
parseJsonc(text3, path);
|
|
62334
62752
|
return { ok: true, text: text3, style: jsoncValue(text3, ["outputStyle"]) };
|
|
62335
62753
|
} catch {
|
|
@@ -62390,7 +62808,7 @@ function selectOutputStyle(deps2) {
|
|
|
62390
62808
|
);
|
|
62391
62809
|
} else {
|
|
62392
62810
|
try {
|
|
62393
|
-
if (exists(path) && isOurs2(
|
|
62811
|
+
if (exists(path) && isOurs2(readFileSync34(path, "utf8"))) {
|
|
62394
62812
|
rmSync21(path);
|
|
62395
62813
|
removed = true;
|
|
62396
62814
|
if (readdirSync11(dir).length === 0) rmdirSync3(dir);
|
|
@@ -62462,7 +62880,7 @@ function uninstallOutputStyle(deps2) {
|
|
|
62462
62880
|
);
|
|
62463
62881
|
} else if (!exists(path)) {
|
|
62464
62882
|
gone = true;
|
|
62465
|
-
} else if (!isOurs2(
|
|
62883
|
+
} else if (!isOurs2(readFileSync34(path, "utf8"))) {
|
|
62466
62884
|
out.notes.push(
|
|
62467
62885
|
`Left ${path} alone: it has no Open Artifacts marker, so it is not ours to replace.`
|
|
62468
62886
|
);
|
|
@@ -62503,7 +62921,7 @@ var outputStyleState = (deps2) => {
|
|
|
62503
62921
|
const path = outputStyleFile(deps2);
|
|
62504
62922
|
try {
|
|
62505
62923
|
if (isLink2(dirname17(path)) || isLink2(path)) return void 0;
|
|
62506
|
-
if (!isOurs2(
|
|
62924
|
+
if (!isOurs2(readFileSync34(path, "utf8"))) return void 0;
|
|
62507
62925
|
const s = readSettings(claudeSettingsFile(deps2));
|
|
62508
62926
|
return { path, on: s.ok && s.style === OUTPUT_STYLE_NAME };
|
|
62509
62927
|
} catch {
|
|
@@ -62523,10 +62941,10 @@ var SPARSE = [".claude-plugin", "plugins", "packages/claude-code-shortcuts"];
|
|
|
62523
62941
|
var CALL_MS = 12e4;
|
|
62524
62942
|
var MCP_LIST_MS = 2e4;
|
|
62525
62943
|
var readRecord4 = (busHome2) => {
|
|
62526
|
-
const r = readInstallFile(
|
|
62944
|
+
const r = readInstallFile(join39(busHome2, "install.json")).claudePlugins;
|
|
62527
62945
|
return typeof r === "object" && r !== null ? r : void 0;
|
|
62528
62946
|
};
|
|
62529
|
-
var writeRecord4 = (busHome2, r) => updateInstallFile(
|
|
62947
|
+
var writeRecord4 = (busHome2, r) => updateInstallFile(join39(busHome2, "install.json"), { claudePlugins: r });
|
|
62530
62948
|
var cmpVersion = (a, b) => {
|
|
62531
62949
|
const pa = a.split(".").map(Number);
|
|
62532
62950
|
const pb = b.split(".").map(Number);
|
|
@@ -62593,11 +63011,11 @@ ${r.stderr}`;
|
|
|
62593
63011
|
return { why: /timed out/i.test(text3) ? "timeout" : "error" };
|
|
62594
63012
|
}
|
|
62595
63013
|
const m = /^\s*URL:\s*(\S+)/m.exec(r.stdout);
|
|
62596
|
-
if (m &&
|
|
63014
|
+
if (m && originOf3(m[1]) === origin)
|
|
62597
63015
|
return { name: DEFAULT_MCP_SERVER };
|
|
62598
63016
|
return { why: "none" };
|
|
62599
63017
|
}
|
|
62600
|
-
var
|
|
63018
|
+
var originOf3 = (url2) => {
|
|
62601
63019
|
try {
|
|
62602
63020
|
return new URL(url2).origin;
|
|
62603
63021
|
} catch {
|
|
@@ -62809,7 +63227,7 @@ async function installClaudePlugins(deps2, harnesses) {
|
|
|
62809
63227
|
const ownShortcuts = fresh || mine.has(SHORTCUTS_PLUGIN);
|
|
62810
63228
|
const origin = deps2.origin;
|
|
62811
63229
|
if (!ownShortcuts) {
|
|
62812
|
-
} else if (origin !== void 0 &&
|
|
63230
|
+
} else if (origin !== void 0 && originOf3(origin) !== origin) {
|
|
62813
63231
|
out.notes.push(...copy2.pluginsBadInstance());
|
|
62814
63232
|
} else if (origin) {
|
|
62815
63233
|
config2.push("--config", `instanceUrl=${origin}/mcp`);
|
|
@@ -62966,13 +63384,13 @@ async function claudePluginsState(deps2) {
|
|
|
62966
63384
|
let unconfigured = false;
|
|
62967
63385
|
if (rec.plugins.includes(SHORTCUTS_PLUGIN) && !missing2.includes(SHORTCUTS_PLUGIN)) {
|
|
62968
63386
|
const url2 = readInstanceUrl(deps2);
|
|
62969
|
-
unconfigured = url2 !== void 0 &&
|
|
63387
|
+
unconfigured = url2 !== void 0 && originOf3(url2) === void 0;
|
|
62970
63388
|
}
|
|
62971
63389
|
return { missing: missing2, unconfigured };
|
|
62972
63390
|
}
|
|
62973
63391
|
function readShortcutOptions(deps2) {
|
|
62974
63392
|
try {
|
|
62975
|
-
const text3 =
|
|
63393
|
+
const text3 = readFileSync35(claudeSettingsFile(deps2), "utf8");
|
|
62976
63394
|
const o = JSON.parse(text3);
|
|
62977
63395
|
const opts = o.pluginConfigs?.[SHORTCUTS_PLUGIN]?.options;
|
|
62978
63396
|
const str3 = (v) => typeof v === "string" && v ? v : void 0;
|
|
@@ -62991,7 +63409,7 @@ function readInstanceUrl(deps2) {
|
|
|
62991
63409
|
|
|
62992
63410
|
// src/commands/habits.ts
|
|
62993
63411
|
init_src();
|
|
62994
|
-
import { join as
|
|
63412
|
+
import { join as join40 } from "node:path";
|
|
62995
63413
|
var pluginOn = (p) => `Habits on in the ${p.label} plugin.`;
|
|
62996
63414
|
var pluginOff = (p) => `Habits off in the ${p.label} plugin.`;
|
|
62997
63415
|
var deps = (ctx) => ({
|
|
@@ -63110,7 +63528,7 @@ async function habitsAfterInstall(ctx, json4) {
|
|
|
63110
63528
|
})),
|
|
63111
63529
|
// A plugin has no block to compare: its marker is there ("current") or not.
|
|
63112
63530
|
...plugins2.map((p) => ({
|
|
63113
|
-
path:
|
|
63531
|
+
path: join40(p.dir(ctx.userHome, ctx.env), p.marker),
|
|
63114
63532
|
label: `the ${p.label} plugin`,
|
|
63115
63533
|
s: {
|
|
63116
63534
|
state: pluginHabitsState(deps(ctx), p) === "on" ? "current" : "absent"
|
|
@@ -63155,7 +63573,7 @@ async function habitsAfterInstall(ctx, json4) {
|
|
|
63155
63573
|
const pl = setPluginHabits(
|
|
63156
63574
|
deps(ctx),
|
|
63157
63575
|
plugins2.filter(
|
|
63158
|
-
(p) => asked.includes(
|
|
63576
|
+
(p) => asked.includes(join40(p.dir(ctx.userHome, ctx.env), p.marker))
|
|
63159
63577
|
),
|
|
63160
63578
|
true
|
|
63161
63579
|
);
|
|
@@ -63228,7 +63646,7 @@ import {
|
|
|
63228
63646
|
unlinkSync as unlinkSync3,
|
|
63229
63647
|
writeSync as writeSync4
|
|
63230
63648
|
} from "node:fs";
|
|
63231
|
-
import { join as
|
|
63649
|
+
import { join as join41 } from "node:path";
|
|
63232
63650
|
init_src();
|
|
63233
63651
|
|
|
63234
63652
|
// src/machine-label.ts
|
|
@@ -63277,7 +63695,7 @@ function checkVerificationUri(uri, hub) {
|
|
|
63277
63695
|
function writeMachineFile(home2, body) {
|
|
63278
63696
|
mkdirSync16(home2, { recursive: true, mode: 448 });
|
|
63279
63697
|
chmodSync21(home2, 448);
|
|
63280
|
-
const tmp =
|
|
63698
|
+
const tmp = join41(home2, `.machine.json.${randomBytes7(8).toString("hex")}.tmp`);
|
|
63281
63699
|
const fd = openSync9(tmp, "wx", 384);
|
|
63282
63700
|
try {
|
|
63283
63701
|
writeSync4(fd, body);
|
|
@@ -63289,7 +63707,7 @@ function writeMachineFile(home2, body) {
|
|
|
63289
63707
|
closeSync9(fd);
|
|
63290
63708
|
try {
|
|
63291
63709
|
chmodSync21(tmp, 384);
|
|
63292
|
-
renameSync21(tmp,
|
|
63710
|
+
renameSync21(tmp, join41(home2, "machine.json"));
|
|
63293
63711
|
} catch (e) {
|
|
63294
63712
|
unlinkSync3(tmp);
|
|
63295
63713
|
throw e;
|
|
@@ -63424,7 +63842,7 @@ async function loginInner(args) {
|
|
|
63424
63842
|
`${JSON.stringify({ hub, label: label2, machine_token: poll.machine_token }, null, 2)}
|
|
63425
63843
|
`
|
|
63426
63844
|
);
|
|
63427
|
-
rmSync22(
|
|
63845
|
+
rmSync22(join41(args.home, "revoked"), { force: true });
|
|
63428
63846
|
if (!events?.code) print(`Approved this machine as ${label2}.`);
|
|
63429
63847
|
return {
|
|
63430
63848
|
machineToken: poll.machine_token,
|
|
@@ -63448,7 +63866,7 @@ init_src();
|
|
|
63448
63866
|
|
|
63449
63867
|
// src/commands/install.ts
|
|
63450
63868
|
init_src3();
|
|
63451
|
-
import { dirname as dirname18, join as
|
|
63869
|
+
import { dirname as dirname18, join as join43 } from "node:path";
|
|
63452
63870
|
init_src2();
|
|
63453
63871
|
|
|
63454
63872
|
// src/live.ts
|
|
@@ -63499,21 +63917,21 @@ function spinner(ctx) {
|
|
|
63499
63917
|
|
|
63500
63918
|
// src/steps/leftovers.ts
|
|
63501
63919
|
import {
|
|
63502
|
-
lstatSync as
|
|
63920
|
+
lstatSync as lstatSync20,
|
|
63503
63921
|
readdirSync as readdirSync12,
|
|
63504
|
-
readFileSync as
|
|
63922
|
+
readFileSync as readFileSync36,
|
|
63505
63923
|
rmdirSync as rmdirSync4,
|
|
63506
63924
|
rmSync as rmSync23
|
|
63507
63925
|
} from "node:fs";
|
|
63508
|
-
import { join as
|
|
63926
|
+
import { join as join42 } from "node:path";
|
|
63509
63927
|
function leftoverTargets(deps2) {
|
|
63510
63928
|
const env2 = deps2.env ?? {};
|
|
63511
63929
|
const p = paths(deps2);
|
|
63512
|
-
const piDir = agentDirEnv(deps2.home, env2) ??
|
|
63930
|
+
const piDir = agentDirEnv(deps2.home, env2) ?? join42(deps2.home, ".pi/agent");
|
|
63513
63931
|
const skill = (h) => skillDir({ home: deps2.home, env: env2 }, h);
|
|
63514
63932
|
return {
|
|
63515
63933
|
files: [
|
|
63516
|
-
|
|
63934
|
+
join42(codexHome2(deps2.home, env2), "AGENTS.md"),
|
|
63517
63935
|
p.codex,
|
|
63518
63936
|
...p.opencodeConfigs,
|
|
63519
63937
|
p.opencodeCli
|
|
@@ -63522,10 +63940,10 @@ function leftoverTargets(deps2) {
|
|
|
63522
63940
|
skill("claude"),
|
|
63523
63941
|
skill("pi"),
|
|
63524
63942
|
skill("hermes"),
|
|
63525
|
-
|
|
63526
|
-
|
|
63527
|
-
|
|
63528
|
-
|
|
63943
|
+
join42(hermesHome(deps2.home, env2), "plugins"),
|
|
63944
|
+
join42(deps2.home, ".local", "bin"),
|
|
63945
|
+
join42(ompAgentDir(deps2.home, env2), "extensions"),
|
|
63946
|
+
join42(piDir, "extensions"),
|
|
63529
63947
|
skill("opencode"),
|
|
63530
63948
|
skill("openclaw")
|
|
63531
63949
|
]
|
|
@@ -63533,7 +63951,7 @@ function leftoverTargets(deps2) {
|
|
|
63533
63951
|
}
|
|
63534
63952
|
var exists2 = (path) => {
|
|
63535
63953
|
try {
|
|
63536
|
-
|
|
63954
|
+
lstatSync20(path);
|
|
63537
63955
|
return true;
|
|
63538
63956
|
} catch {
|
|
63539
63957
|
return false;
|
|
@@ -63566,10 +63984,10 @@ function pruneMade(deps2) {
|
|
|
63566
63984
|
}
|
|
63567
63985
|
function emptyFile(path) {
|
|
63568
63986
|
try {
|
|
63569
|
-
const st =
|
|
63987
|
+
const st = lstatSync20(path);
|
|
63570
63988
|
if (!st.isFile()) return false;
|
|
63571
63989
|
if (st.size === 0) return true;
|
|
63572
|
-
const doc = JSON.parse(
|
|
63990
|
+
const doc = JSON.parse(readFileSync36(path, "utf8"));
|
|
63573
63991
|
return typeof doc === "object" && doc !== null && !Array.isArray(doc) && Object.keys(doc).length === 0;
|
|
63574
63992
|
} catch {
|
|
63575
63993
|
return false;
|
|
@@ -63585,7 +64003,7 @@ function removeMade(made) {
|
|
|
63585
64003
|
}
|
|
63586
64004
|
for (const path of made.filter((x) => !gone.includes(x)).sort((a, b) => b.length - a.length)) {
|
|
63587
64005
|
try {
|
|
63588
|
-
if (!
|
|
64006
|
+
if (!lstatSync20(path).isDirectory()) continue;
|
|
63589
64007
|
if (readdirSync12(path).length > 0) continue;
|
|
63590
64008
|
rmdirSync4(path);
|
|
63591
64009
|
gone.push(path);
|
|
@@ -63602,13 +64020,6 @@ var DAEMON_POLL_MS = 250;
|
|
|
63602
64020
|
var DAEMON_POLL_MAX_MS = 2e3;
|
|
63603
64021
|
var DAEMON_GONE_AFTER_MS = 1e4;
|
|
63604
64022
|
var ROSTER_ROWS = 20;
|
|
63605
|
-
var originOf3 = (hub) => {
|
|
63606
|
-
try {
|
|
63607
|
-
return new URL(hub.replace(/^ws(s?):/, "http$1:")).origin;
|
|
63608
|
-
} catch {
|
|
63609
|
-
return hub;
|
|
63610
|
-
}
|
|
63611
|
-
};
|
|
63612
64023
|
var hostOf = (hub) => {
|
|
63613
64024
|
try {
|
|
63614
64025
|
return new URL(hub).host;
|
|
@@ -63621,7 +64032,7 @@ async function loginStep(ctx, opts) {
|
|
|
63621
64032
|
const machine = readMachine(ctx.home);
|
|
63622
64033
|
const asked = opts.hub ?? ctx.env.OA_BUS_INSTANCE;
|
|
63623
64034
|
if (machine.state === "ok" && !machine.revoked && !opts.force) {
|
|
63624
|
-
if (asked &&
|
|
64035
|
+
if (asked && originOf2(asked) !== originOf2(machine.hub)) {
|
|
63625
64036
|
sayErr(ctx, c.hubMismatch(hostOf(machine.hub), hostOf(asked), asked));
|
|
63626
64037
|
return false;
|
|
63627
64038
|
}
|
|
@@ -63677,10 +64088,10 @@ async function loginStep(ctx, opts) {
|
|
|
63677
64088
|
ctx,
|
|
63678
64089
|
c.approved(result.label),
|
|
63679
64090
|
c.tokenSaved(
|
|
63680
|
-
tilde(ctx,
|
|
64091
|
+
tilde(ctx, join43(ctx.home, "machine.json")),
|
|
63681
64092
|
result.machineToken
|
|
63682
64093
|
),
|
|
63683
|
-
c.connected(
|
|
64094
|
+
c.connected(originOf2(result.hub)),
|
|
63684
64095
|
""
|
|
63685
64096
|
);
|
|
63686
64097
|
return true;
|
|
@@ -63707,7 +64118,7 @@ async function loginStep(ctx, opts) {
|
|
|
63707
64118
|
}
|
|
63708
64119
|
async function harnessesStep(ctx, hub) {
|
|
63709
64120
|
const c = ctx.copy;
|
|
63710
|
-
const hubOrigin2 = hub ?
|
|
64121
|
+
const hubOrigin2 = hub ? originOf2(hub) : machineOrigin(ctx);
|
|
63711
64122
|
const out = await installAdapters({
|
|
63712
64123
|
home: ctx.userHome,
|
|
63713
64124
|
busHome: ctx.home,
|
|
@@ -63751,7 +64162,7 @@ async function harnessesStep(ctx, hub) {
|
|
|
63751
64162
|
codexVersion,
|
|
63752
64163
|
fetchSkill: (url2) => fetchSkillText(ctx.fetch, url2)
|
|
63753
64164
|
},
|
|
63754
|
-
hub ?
|
|
64165
|
+
hub ? originOf2(hub) : machineOrigin(ctx),
|
|
63755
64166
|
out.installed
|
|
63756
64167
|
);
|
|
63757
64168
|
for (const n of skill.notes) say(ctx, [n]);
|
|
@@ -63764,7 +64175,7 @@ async function harnessesStep(ctx, hub) {
|
|
|
63764
64175
|
env: ctx.env,
|
|
63765
64176
|
exec: ctx.exec,
|
|
63766
64177
|
version: ctx.version,
|
|
63767
|
-
origin: hub ?
|
|
64178
|
+
origin: hub ? originOf2(hub) : machineOrigin(ctx),
|
|
63768
64179
|
copy: c
|
|
63769
64180
|
},
|
|
63770
64181
|
out.installed
|
|
@@ -63791,7 +64202,7 @@ function reportSkillFailure(ctx) {
|
|
|
63791
64202
|
}
|
|
63792
64203
|
function machineOrigin(ctx) {
|
|
63793
64204
|
const m = readMachine(ctx.home);
|
|
63794
|
-
return m.state === "ok" ?
|
|
64205
|
+
return m.state === "ok" ? originOf2(m.hub) : void 0;
|
|
63795
64206
|
}
|
|
63796
64207
|
async function skippedLines(ctx, h, reason2) {
|
|
63797
64208
|
if (h !== "opencode") return ctx.copy.skipped(h, tildeReason(ctx, h, reason2));
|
|
@@ -63806,7 +64217,7 @@ function shownSocket(ctx) {
|
|
|
63806
64217
|
const real3 = `${canonicalHome(ctx.home)}/`;
|
|
63807
64218
|
return tilde(
|
|
63808
64219
|
ctx,
|
|
63809
|
-
path.startsWith(real3) ?
|
|
64220
|
+
path.startsWith(real3) ? join43(ctx.home, path.slice(real3.length)) : path
|
|
63810
64221
|
);
|
|
63811
64222
|
}
|
|
63812
64223
|
async function waitForDaemon(ctx) {
|
|
@@ -64058,7 +64469,7 @@ async function installRun(opts, realCtx2) {
|
|
|
64058
64469
|
return results.every((r) => r.state === "done") ? 0 : 1;
|
|
64059
64470
|
}
|
|
64060
64471
|
const ok = await runSteps(steps, ctx, {
|
|
64061
|
-
path:
|
|
64472
|
+
path: join43(ctx.home, "install.json"),
|
|
64062
64473
|
now: ctx.now
|
|
64063
64474
|
});
|
|
64064
64475
|
if (ok && second) say(ctx, "", c.secondBus(ctx.home));
|
|
@@ -64150,19 +64561,11 @@ var updateTarget = async (ctx, st, probe2) => {
|
|
|
64150
64561
|
);
|
|
64151
64562
|
return newest !== void 0 && !semverGte(mine, newest) ? newest : void 0;
|
|
64152
64563
|
};
|
|
64153
|
-
var
|
|
64154
|
-
|
|
64155
|
-
|
|
64156
|
-
|
|
64157
|
-
|
|
64158
|
-
return void 0;
|
|
64159
|
-
}
|
|
64160
|
-
const state = proofState(claudeConfigFile(ctx.userHome, ctx.env), origin);
|
|
64161
|
-
if (state === "none") return void 0;
|
|
64162
|
-
if (state === "missing")
|
|
64163
|
-
return `Claude Code: run ${ctx.busCmd} install to set this entry up to show as this session on pages.`;
|
|
64164
|
-
return daemonKnows ? "Claude Code: this entry is set up to show as this session on pages." : "Claude Code: update the daemon so this entry can show as this session on pages.";
|
|
64165
|
-
};
|
|
64564
|
+
var proofLines = (ctx, hub, daemonKnows) => claudeProofChecks(ctx, hub).filter((c) => c.level !== "info").flatMap(
|
|
64565
|
+
(c) => c.level === "pass" && !daemonKnows ? [
|
|
64566
|
+
"Claude Code: update the daemon so these entries can show as this session on pages."
|
|
64567
|
+
] : c.lines
|
|
64568
|
+
);
|
|
64166
64569
|
async function status(ctx) {
|
|
64167
64570
|
const c = ctx.copy;
|
|
64168
64571
|
say(ctx, c.header(ctx.version), "");
|
|
@@ -64202,8 +64605,8 @@ async function status(ctx) {
|
|
|
64202
64605
|
if (habits) say(ctx, habits);
|
|
64203
64606
|
if (readRecord4(ctx.home)?.plugins?.length)
|
|
64204
64607
|
say(ctx, c.pluginsStatus());
|
|
64205
|
-
const proof =
|
|
64206
|
-
if (proof) say(ctx, proof);
|
|
64608
|
+
const proof = [...new Set(proofLines(ctx, m.hub, st.link === true))];
|
|
64609
|
+
if (proof.length) say(ctx, proof);
|
|
64207
64610
|
const ocState = openclawPluginState(
|
|
64208
64611
|
openclawPluginDir(ctx.userHome, ctx.env),
|
|
64209
64612
|
void 0
|
|
@@ -64237,6 +64640,11 @@ var sameOrigin = (url2, hub) => {
|
|
|
64237
64640
|
return false;
|
|
64238
64641
|
}
|
|
64239
64642
|
};
|
|
64643
|
+
var skipDeps = (ctx) => ({
|
|
64644
|
+
home: ctx.userHome,
|
|
64645
|
+
busHome: ctx.home,
|
|
64646
|
+
env: ctx.env
|
|
64647
|
+
});
|
|
64240
64648
|
async function healthz(ctx, hub) {
|
|
64241
64649
|
try {
|
|
64242
64650
|
const res = await ctx.fetch(`${hub.replace(/\/+$/, "")}/healthz`, {
|
|
@@ -64251,7 +64659,7 @@ async function healthz(ctx, hub) {
|
|
|
64251
64659
|
function claudeIsolates(path) {
|
|
64252
64660
|
let text3;
|
|
64253
64661
|
try {
|
|
64254
|
-
text3 =
|
|
64662
|
+
text3 = readFileSync37(path, "utf8");
|
|
64255
64663
|
} catch {
|
|
64256
64664
|
return void 0;
|
|
64257
64665
|
}
|
|
@@ -64327,7 +64735,7 @@ async function doctor(ctx) {
|
|
|
64327
64735
|
const node2 = ctx.nodeVersion.replace(/^v/, "");
|
|
64328
64736
|
if (Number(node2.split(".")[0]) >= MIN_NODE) pass(c.nodeOk(node2));
|
|
64329
64737
|
else fail3(c.nodeOld(node2));
|
|
64330
|
-
const machineFile = tilde(ctx,
|
|
64738
|
+
const machineFile = tilde(ctx, join44(ctx.home, "machine.json"));
|
|
64331
64739
|
const m = readMachine(ctx.home);
|
|
64332
64740
|
if (m.state !== "ok") fail3(c.noCredentials(machineFile));
|
|
64333
64741
|
else if (m.revoked) fail3(c.revokedCheck());
|
|
@@ -64416,8 +64824,8 @@ async function doctor(ctx) {
|
|
|
64416
64824
|
pass(c.wired(h, version2));
|
|
64417
64825
|
else fail3(c.notWired(h));
|
|
64418
64826
|
if (h === "claude") {
|
|
64419
|
-
const settings =
|
|
64420
|
-
ctx.env.CLAUDE_CONFIG_DIR ??
|
|
64827
|
+
const settings = join44(
|
|
64828
|
+
ctx.env.CLAUDE_CONFIG_DIR ?? join44(ctx.userHome, ".claude"),
|
|
64421
64829
|
"settings.json"
|
|
64422
64830
|
);
|
|
64423
64831
|
const isolates = claudeIsolates(settings);
|
|
@@ -64441,6 +64849,15 @@ async function doctor(ctx) {
|
|
|
64441
64849
|
fail3(c.pluginsDoctorMissing(plugins2.missing));
|
|
64442
64850
|
else if (plugins2?.unconfigured) warn(c.pluginsDoctorUnconfigured());
|
|
64443
64851
|
else if (plugins2) pass(c.pluginsDoctor());
|
|
64852
|
+
if (hub !== void 0) {
|
|
64853
|
+
for (const chk of claudeProofChecks(ctx, hub))
|
|
64854
|
+
if (chk.level === "pass") pass(chk.lines[0]);
|
|
64855
|
+
else if (chk.level === "warn") warn(chk.lines);
|
|
64856
|
+
else if (chk.level === "info") say(ctx, chk.lines);
|
|
64857
|
+
else fail3(chk.lines);
|
|
64858
|
+
const fixed = lastAutoFix(ctx);
|
|
64859
|
+
if (fixed) say(ctx, fixed);
|
|
64860
|
+
}
|
|
64444
64861
|
}
|
|
64445
64862
|
if (h === "opencode") {
|
|
64446
64863
|
const gone = opencodeProxyProblem({
|
|
@@ -64450,6 +64867,11 @@ async function doctor(ctx) {
|
|
|
64450
64867
|
which: ctx.which
|
|
64451
64868
|
});
|
|
64452
64869
|
if (gone) fail3(c.opencodeProxyMissing(gone.name, gone.missing));
|
|
64870
|
+
if (hub !== void 0) {
|
|
64871
|
+
for (const k of skippedProxyEntries({ ...skipDeps(ctx), hub }))
|
|
64872
|
+
if (k.harness === "OpenCode")
|
|
64873
|
+
warn([`OpenCode: ${safeText(k.note, 400)}`]);
|
|
64874
|
+
}
|
|
64453
64875
|
}
|
|
64454
64876
|
if (h === "codex") {
|
|
64455
64877
|
codexChecks(ctx, { pass, warn });
|
|
@@ -64460,6 +64882,10 @@ async function doctor(ctx) {
|
|
|
64460
64882
|
which: ctx.which
|
|
64461
64883
|
});
|
|
64462
64884
|
if (gone) fail3(c.codexProxyMissing(gone.name, gone.missing));
|
|
64885
|
+
if (hub !== void 0) {
|
|
64886
|
+
for (const k of skippedProxyEntries({ ...skipDeps(ctx), hub }))
|
|
64887
|
+
if (k.harness === "Codex") warn([`Codex: ${safeText(k.note, 400)}`]);
|
|
64888
|
+
}
|
|
64463
64889
|
}
|
|
64464
64890
|
if (h === "openclaw") say(ctx, c.openclawDmNote());
|
|
64465
64891
|
}
|
|
@@ -64511,7 +64937,7 @@ async function doctor(ctx) {
|
|
|
64511
64937
|
|
|
64512
64938
|
// src/commands/global.ts
|
|
64513
64939
|
import { realpathSync as realpathSync15, statSync as statSync11 } from "node:fs";
|
|
64514
|
-
import { resolve as
|
|
64940
|
+
import { resolve as resolve14 } from "node:path";
|
|
64515
64941
|
function shown3(ctx, path) {
|
|
64516
64942
|
const t = tilde(ctx, path);
|
|
64517
64943
|
if (t !== path) return t;
|
|
@@ -64537,7 +64963,7 @@ async function global(opts, ctx) {
|
|
|
64537
64963
|
);
|
|
64538
64964
|
return 0;
|
|
64539
64965
|
}
|
|
64540
|
-
const given =
|
|
64966
|
+
const given = resolve14(ctx.cwd, opts.dir);
|
|
64541
64967
|
let real3;
|
|
64542
64968
|
try {
|
|
64543
64969
|
real3 = canonicalPath(given);
|
|
@@ -64569,12 +64995,12 @@ async function global(opts, ctx) {
|
|
|
64569
64995
|
}
|
|
64570
64996
|
|
|
64571
64997
|
// src/commands/leads.ts
|
|
64572
|
-
import { readFileSync as
|
|
64573
|
-
import { join as
|
|
64998
|
+
import { readFileSync as readFileSync38 } from "node:fs";
|
|
64999
|
+
import { join as join45 } from "node:path";
|
|
64574
65000
|
function hubOrigin(ctx) {
|
|
64575
65001
|
try {
|
|
64576
65002
|
const raw = JSON.parse(
|
|
64577
|
-
|
|
65003
|
+
readFileSync38(join45(ctx.home, "machine.json"), "utf8")
|
|
64578
65004
|
);
|
|
64579
65005
|
return typeof raw?.hub === "string" ? new URL(raw.hub).origin : void 0;
|
|
64580
65006
|
} catch {
|
|
@@ -64633,10 +65059,10 @@ async function leads(opts, ctx) {
|
|
|
64633
65059
|
|
|
64634
65060
|
// src/commands/link.ts
|
|
64635
65061
|
import { statSync as statSync12 } from "node:fs";
|
|
64636
|
-
import { resolve as
|
|
65062
|
+
import { resolve as resolve15 } from "node:path";
|
|
64637
65063
|
init_src();
|
|
64638
65064
|
function side(ctx, dir) {
|
|
64639
|
-
const given =
|
|
65065
|
+
const given = resolve15(ctx.cwd, dir);
|
|
64640
65066
|
try {
|
|
64641
65067
|
const real3 = canonicalPath(given);
|
|
64642
65068
|
if (!statSync12(real3).isDirectory()) return void 0;
|
|
@@ -64667,7 +65093,7 @@ async function link(opts, ctx) {
|
|
|
64667
65093
|
for (const d of opts.dirs) {
|
|
64668
65094
|
const s = side(ctx, d);
|
|
64669
65095
|
if (!s) {
|
|
64670
|
-
sayErr(ctx, c.linkNotDir(shq(
|
|
65096
|
+
sayErr(ctx, c.linkNotDir(shq(resolve15(ctx.cwd, d))));
|
|
64671
65097
|
return 1;
|
|
64672
65098
|
}
|
|
64673
65099
|
sides.push(s);
|
|
@@ -64731,16 +65157,16 @@ import {
|
|
|
64731
65157
|
closeSync as closeSync10,
|
|
64732
65158
|
constants as constants7,
|
|
64733
65159
|
fstatSync as fstatSync5,
|
|
64734
|
-
lstatSync as
|
|
65160
|
+
lstatSync as lstatSync21,
|
|
64735
65161
|
openSync as openSync10,
|
|
64736
|
-
readFileSync as
|
|
65162
|
+
readFileSync as readFileSync39
|
|
64737
65163
|
} from "node:fs";
|
|
64738
|
-
import { dirname as dirname19, join as
|
|
65164
|
+
import { dirname as dirname19, join as join46 } from "node:path";
|
|
64739
65165
|
var TAIL = 50;
|
|
64740
65166
|
var checkDir = (dir) => {
|
|
64741
65167
|
let fd;
|
|
64742
65168
|
try {
|
|
64743
|
-
const ls =
|
|
65169
|
+
const ls = lstatSync21(dir);
|
|
64744
65170
|
if (ls.isSymbolicLink()) return { ok: false, why: "it is a symlink" };
|
|
64745
65171
|
if (!ls.isDirectory()) return { ok: false, why: "it is not a folder" };
|
|
64746
65172
|
if (typeof process.getuid === "function" && ls.uid !== process.getuid())
|
|
@@ -64769,10 +65195,10 @@ var tail = (path, dir) => {
|
|
|
64769
65195
|
constants7.O_RDONLY | constants7.O_NOFOLLOW | constants7.O_NONBLOCK
|
|
64770
65196
|
);
|
|
64771
65197
|
if (!fstatSync5(fd).isFile()) return "skipped";
|
|
64772
|
-
const after =
|
|
65198
|
+
const after = lstatSync21(dirname19(path));
|
|
64773
65199
|
if (after.isSymbolicLink() || after.dev !== dir.dev || after.ino !== dir.ino)
|
|
64774
65200
|
return "skipped";
|
|
64775
|
-
return
|
|
65201
|
+
return readFileSync39(fd, "utf8").replace(/\n$/, "").split("\n").slice(-TAIL);
|
|
64776
65202
|
} catch (e) {
|
|
64777
65203
|
return e.code === "ELOOP" ? "skipped" : void 0;
|
|
64778
65204
|
} finally {
|
|
@@ -64780,9 +65206,9 @@ var tail = (path, dir) => {
|
|
|
64780
65206
|
}
|
|
64781
65207
|
};
|
|
64782
65208
|
async function logs(ctx) {
|
|
64783
|
-
const logDir =
|
|
64784
|
-
const path =
|
|
64785
|
-
const eventsPath =
|
|
65209
|
+
const logDir = join46(ctx.home, "logs");
|
|
65210
|
+
const path = join46(logDir, "daemon.log");
|
|
65211
|
+
const eventsPath = join46(logDir, "events.log");
|
|
64786
65212
|
const dir = checkDir(logDir);
|
|
64787
65213
|
if (!dir.ok && dir.why !== "missing") {
|
|
64788
65214
|
say(ctx, `Not reading ${tilde(ctx, logDir)}: ${dir.why}.`);
|
|
@@ -64826,7 +65252,7 @@ init_src2();
|
|
|
64826
65252
|
init_src();
|
|
64827
65253
|
import { execFileSync as execFileSync7 } from "node:child_process";
|
|
64828
65254
|
import { createHash as createHash12, randomBytes as randomBytes8 } from "node:crypto";
|
|
64829
|
-
import { readFileSync as
|
|
65255
|
+
import { readFileSync as readFileSync40, readlinkSync as readlinkSync7 } from "node:fs";
|
|
64830
65256
|
import { basename as basename9 } from "node:path";
|
|
64831
65257
|
var isClaude = (name) => name === "claude" || /\/claude\/versions\/[^/]+$/.test(name);
|
|
64832
65258
|
function parsePs(out) {
|
|
@@ -64837,14 +65263,14 @@ function parsePs(out) {
|
|
|
64837
65263
|
}
|
|
64838
65264
|
function readProc(pid) {
|
|
64839
65265
|
try {
|
|
64840
|
-
const stat =
|
|
65266
|
+
const stat = readFileSync40(`/proc/${pid}/stat`, "utf8");
|
|
64841
65267
|
const ppid = Number(stat.slice(stat.lastIndexOf(")") + 1).split(/\s+/)[2]);
|
|
64842
65268
|
let exe = "";
|
|
64843
65269
|
try {
|
|
64844
65270
|
exe = readlinkSync7(`/proc/${pid}/exe`);
|
|
64845
65271
|
} catch {
|
|
64846
65272
|
}
|
|
64847
|
-
const comm =
|
|
65273
|
+
const comm = readFileSync40(`/proc/${pid}/comm`, "utf8").trim();
|
|
64848
65274
|
return { ppid, name: isClaude(exe) ? exe : comm };
|
|
64849
65275
|
} catch {
|
|
64850
65276
|
}
|
|
@@ -64872,7 +65298,7 @@ function findClaude(from, proc) {
|
|
|
64872
65298
|
function tokenOf(file2) {
|
|
64873
65299
|
if (!file2) return void 0;
|
|
64874
65300
|
try {
|
|
64875
|
-
return
|
|
65301
|
+
return readFileSync40(file2, "utf8").trim() || void 0;
|
|
64876
65302
|
} catch {
|
|
64877
65303
|
return void 0;
|
|
64878
65304
|
}
|
|
@@ -64901,7 +65327,7 @@ async function mcpProof(opts, ctx, deps2 = {
|
|
|
64901
65327
|
|
|
64902
65328
|
// src/commands/namespace.ts
|
|
64903
65329
|
import { realpathSync as realpathSync16, statSync as statSync13 } from "node:fs";
|
|
64904
|
-
import { join as
|
|
65330
|
+
import { join as join47, resolve as resolve16 } from "node:path";
|
|
64905
65331
|
init_src();
|
|
64906
65332
|
function shown4(ctx, path) {
|
|
64907
65333
|
const t = tilde(ctx, path);
|
|
@@ -64928,7 +65354,7 @@ async function namespace(opts, ctx) {
|
|
|
64928
65354
|
);
|
|
64929
65355
|
return 0;
|
|
64930
65356
|
}
|
|
64931
|
-
const given =
|
|
65357
|
+
const given = resolve16(ctx.cwd, opts.dir);
|
|
64932
65358
|
let real3;
|
|
64933
65359
|
try {
|
|
64934
65360
|
real3 = canonicalPath(given);
|
|
@@ -64955,7 +65381,7 @@ async function namespace(opts, ctx) {
|
|
|
64955
65381
|
sayErr(ctx, c.nsNotDir(shown4(ctx, real3 ?? given)));
|
|
64956
65382
|
return 1;
|
|
64957
65383
|
}
|
|
64958
|
-
const cfgFile =
|
|
65384
|
+
const cfgFile = join47(real3, CONFIG_FILE);
|
|
64959
65385
|
const own2 = readOwnFile(cfgFile, process.getuid?.(), {
|
|
64960
65386
|
allowGroupWrite: true
|
|
64961
65387
|
});
|
|
@@ -65029,12 +65455,12 @@ async function namespace(opts, ctx) {
|
|
|
65029
65455
|
}
|
|
65030
65456
|
|
|
65031
65457
|
// src/commands/uninstall.ts
|
|
65032
|
-
import { join as
|
|
65458
|
+
import { join as join49 } from "node:path";
|
|
65033
65459
|
|
|
65034
65460
|
// src/steps/purge.ts
|
|
65035
65461
|
init_src3();
|
|
65036
|
-
import { lstatSync as
|
|
65037
|
-
import { join as
|
|
65462
|
+
import { lstatSync as lstatSync22, readdirSync as readdirSync13, rmdirSync as rmdirSync5, rmSync as rmSync24 } from "node:fs";
|
|
65463
|
+
import { join as join48 } from "node:path";
|
|
65038
65464
|
var FILES = [
|
|
65039
65465
|
"machine.json",
|
|
65040
65466
|
"install.json",
|
|
@@ -65087,7 +65513,7 @@ var FOLDERS = [
|
|
|
65087
65513
|
];
|
|
65088
65514
|
function kind3(path) {
|
|
65089
65515
|
try {
|
|
65090
|
-
const st =
|
|
65516
|
+
const st = lstatSync22(path);
|
|
65091
65517
|
return st.isDirectory() ? "dir" : st.isSocket() ? "socket" : "other";
|
|
65092
65518
|
} catch {
|
|
65093
65519
|
return void 0;
|
|
@@ -65104,14 +65530,14 @@ var rmdirIfEmpty = (path) => {
|
|
|
65104
65530
|
};
|
|
65105
65531
|
function purgeShort(dir, removed) {
|
|
65106
65532
|
if (kind3(dir) !== "dir" || unsafeSocketDir(dir)) return;
|
|
65107
|
-
const ret =
|
|
65533
|
+
const ret = join48(dir, "claude-return");
|
|
65108
65534
|
for (const [d, ours2] of [
|
|
65109
65535
|
[ret, (_n, p) => kind3(p) === "socket"],
|
|
65110
65536
|
[dir, (n) => /^daemon\.sock(\.keep-\d+)?$/.test(n)]
|
|
65111
65537
|
]) {
|
|
65112
65538
|
if (kind3(d) !== "dir") continue;
|
|
65113
65539
|
for (const name of readdirSync13(d)) {
|
|
65114
|
-
const path =
|
|
65540
|
+
const path = join48(d, name);
|
|
65115
65541
|
const k = kind3(path);
|
|
65116
65542
|
if (k === void 0 || k === "dir" || !ours2(name, path)) continue;
|
|
65117
65543
|
remove2(path, k);
|
|
@@ -65136,21 +65562,21 @@ function purge(home2, opts) {
|
|
|
65136
65562
|
...FILES,
|
|
65137
65563
|
...entries.filter((n) => TEMP.some((re) => re.test(n)))
|
|
65138
65564
|
]) {
|
|
65139
|
-
const path =
|
|
65565
|
+
const path = join48(home2, name);
|
|
65140
65566
|
const k = kind3(path);
|
|
65141
65567
|
if (k === void 0 || k === "dir") continue;
|
|
65142
65568
|
remove2(path, k);
|
|
65143
65569
|
removed.push(name);
|
|
65144
65570
|
}
|
|
65145
65571
|
for (const folder of FOLDERS) {
|
|
65146
|
-
const dir =
|
|
65572
|
+
const dir = join48(home2, folder.path);
|
|
65147
65573
|
if (kind3(dir) !== "dir") continue;
|
|
65148
65574
|
for (const name of readdirSync13(dir)) {
|
|
65149
|
-
const path =
|
|
65575
|
+
const path = join48(dir, name);
|
|
65150
65576
|
const k = kind3(path);
|
|
65151
65577
|
if (k === void 0 || !folder.ours(name, path)) continue;
|
|
65152
65578
|
remove2(path, k);
|
|
65153
|
-
removed.push(
|
|
65579
|
+
removed.push(join48(folder.path, name));
|
|
65154
65580
|
}
|
|
65155
65581
|
if (rmdirIfEmpty(dir)) removed.push(folder.path);
|
|
65156
65582
|
}
|
|
@@ -65241,7 +65667,7 @@ async function unwire(ctx) {
|
|
|
65241
65667
|
say(
|
|
65242
65668
|
ctx,
|
|
65243
65669
|
c.hermesNoCli(
|
|
65244
|
-
tilde(ctx,
|
|
65670
|
+
tilde(ctx, join49(hermesHome(ctx.userHome, ctx.env), "config.yaml"))
|
|
65245
65671
|
)
|
|
65246
65672
|
);
|
|
65247
65673
|
if (r.openclawNoCli) say(ctx, c.openclawNoCli());
|
|
@@ -65275,7 +65701,7 @@ async function uninstall2(opts, ctx) {
|
|
|
65275
65701
|
say(ctx, c.daemonStillRunning(removed.running));
|
|
65276
65702
|
if (wiredTo(ctx)) await unwire(ctx);
|
|
65277
65703
|
if (!opts.purge) {
|
|
65278
|
-
say(ctx, "", c.kept(tilde(ctx,
|
|
65704
|
+
say(ctx, "", c.kept(tilde(ctx, join49(ctx.home, "machine.json"))));
|
|
65279
65705
|
return 0;
|
|
65280
65706
|
}
|
|
65281
65707
|
const home2 = tilde(ctx, ctx.home);
|
|
@@ -65285,9 +65711,9 @@ async function uninstall2(opts, ctx) {
|
|
|
65285
65711
|
return 1;
|
|
65286
65712
|
} catch {
|
|
65287
65713
|
}
|
|
65288
|
-
const made = readMade(
|
|
65714
|
+
const made = readMade(join49(ctx.home, "install.json"));
|
|
65289
65715
|
const out = purge(ctx.home, {
|
|
65290
|
-
isDefault: ctx.home ===
|
|
65716
|
+
isDefault: ctx.home === join49(ctx.userHome, ".oa-bus")
|
|
65291
65717
|
});
|
|
65292
65718
|
if ("refused" in out) {
|
|
65293
65719
|
sayErr(ctx, c.purgeRefused(home2));
|
|
@@ -65337,6 +65763,15 @@ async function update(ctx, installStaged) {
|
|
|
65337
65763
|
return 1;
|
|
65338
65764
|
}
|
|
65339
65765
|
if (!await installStaged(version2)) return 1;
|
|
65766
|
+
const m = readMachine(ctx.home);
|
|
65767
|
+
if (m.state === "ok" && ctx.which("claude") && wiredTo(ctx))
|
|
65768
|
+
recordClaudeProof({
|
|
65769
|
+
home: ctx.userHome,
|
|
65770
|
+
busHome: ctx.home,
|
|
65771
|
+
env: ctx.env,
|
|
65772
|
+
busBin: ctx.service.argv?.() ?? [],
|
|
65773
|
+
hub: originOf2(m.hub)
|
|
65774
|
+
});
|
|
65340
65775
|
say(ctx, c.updateDone(version2));
|
|
65341
65776
|
return 0;
|
|
65342
65777
|
}
|
|
@@ -65615,7 +66050,7 @@ async function main(argv, makeCtx = realCtx) {
|
|
|
65615
66050
|
return 2;
|
|
65616
66051
|
}
|
|
65617
66052
|
const ctx = makeCtx(cmd.noColor);
|
|
65618
|
-
if (cmd.home) ctx.home =
|
|
66053
|
+
if (cmd.home) ctx.home = resolve17(cmd.home);
|
|
65619
66054
|
if (!TERMINAL.has(cmd.cmd) && cmd.cmd !== "install" && cmd.cmd !== "uninstall")
|
|
65620
66055
|
markLive(fileURLToPath7(import.meta.url), ctx.home);
|
|
65621
66056
|
ctx.copy = copyFor(ctx);
|