@open-artifacts/bus 0.187.0 → 0.189.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/oa-bus.ts +1 -1
- package/assets/openclaw/index.js +1 -1
- package/assets/openclaw/package.json +1 -1
- package/dist/index.js +432 -249
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -13181,9 +13181,9 @@ function codePointLengthVar(doc, ctx, accessor, inDoubt) {
|
|
|
13181
13181
|
doc.write(`const ${v} = typeof ${accessor} === "string" && ${inDoubt} ? ${cpLen}(${accessor}) : ${accessor}.length;`);
|
|
13182
13182
|
return v;
|
|
13183
13183
|
}
|
|
13184
|
-
function numericOperand(value,
|
|
13184
|
+
function numericOperand(value, label2) {
|
|
13185
13185
|
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
13186
|
-
throw new ZodCompileUnsupportedError(`${
|
|
13186
|
+
throw new ZodCompileUnsupportedError(`${label2} bound of type ${typeof value}`);
|
|
13187
13187
|
}
|
|
13188
13188
|
return `${value}`;
|
|
13189
13189
|
}
|
|
@@ -23895,9 +23895,9 @@ var require_codegen = __commonJS({
|
|
|
23895
23895
|
}
|
|
23896
23896
|
};
|
|
23897
23897
|
var Label = class extends Node {
|
|
23898
|
-
constructor(
|
|
23898
|
+
constructor(label2) {
|
|
23899
23899
|
super();
|
|
23900
|
-
this.label =
|
|
23900
|
+
this.label = label2;
|
|
23901
23901
|
this.names = {};
|
|
23902
23902
|
}
|
|
23903
23903
|
render({ _n }) {
|
|
@@ -23905,14 +23905,14 @@ var require_codegen = __commonJS({
|
|
|
23905
23905
|
}
|
|
23906
23906
|
};
|
|
23907
23907
|
var Break = class extends Node {
|
|
23908
|
-
constructor(
|
|
23908
|
+
constructor(label2) {
|
|
23909
23909
|
super();
|
|
23910
|
-
this.label =
|
|
23910
|
+
this.label = label2;
|
|
23911
23911
|
this.names = {};
|
|
23912
23912
|
}
|
|
23913
23913
|
render({ _n }) {
|
|
23914
|
-
const
|
|
23915
|
-
return `break${
|
|
23914
|
+
const label2 = this.label ? ` ${this.label}` : "";
|
|
23915
|
+
return `break${label2};` + _n;
|
|
23916
23916
|
}
|
|
23917
23917
|
};
|
|
23918
23918
|
var Throw = class extends Node {
|
|
@@ -24324,12 +24324,12 @@ var require_codegen = __commonJS({
|
|
|
24324
24324
|
return this._endBlockNode(For);
|
|
24325
24325
|
}
|
|
24326
24326
|
// `label` statement
|
|
24327
|
-
label(
|
|
24328
|
-
return this._leafNode(new Label(
|
|
24327
|
+
label(label2) {
|
|
24328
|
+
return this._leafNode(new Label(label2));
|
|
24329
24329
|
}
|
|
24330
24330
|
// `break` statement
|
|
24331
|
-
break(
|
|
24332
|
-
return this._leafNode(new Break(
|
|
24331
|
+
break(label2) {
|
|
24332
|
+
return this._leafNode(new Break(label2));
|
|
24333
24333
|
}
|
|
24334
24334
|
// `return` statement
|
|
24335
24335
|
return(value) {
|
|
@@ -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.
|
|
32732
|
+
CLIENT_VERSION = true ? "0.189.0" : "0.0.0";
|
|
32733
32733
|
clientVersion = {
|
|
32734
32734
|
client_version: external_exports.string().min(1).max(64).optional()
|
|
32735
32735
|
};
|
|
@@ -33485,16 +33485,16 @@ function receiptText(r, sentTo, namespaces, excerpt, movedTo2, linkedNs) {
|
|
|
33485
33485
|
}
|
|
33486
33486
|
case "refused": {
|
|
33487
33487
|
const copy2 = r.reason ? refusals[r.reason] : void 0;
|
|
33488
|
-
const
|
|
33488
|
+
const label2 = r.reason ? `Refused (${r.reason})` : "Refused";
|
|
33489
33489
|
const moved = r.reason === "revoked" ? movedTo2 : void 0;
|
|
33490
33490
|
const [detail, hint] = moved ? [null, null] : copy2 ?? [null, "Message another agent."];
|
|
33491
33491
|
const said = (v) => moved ? `${v} moved; try ${moved}.` : typeof detail === "function" ? detail(namespaces, v) : detail;
|
|
33492
33492
|
const lines = (v) => [
|
|
33493
33493
|
quote2 ? quoted(
|
|
33494
|
-
`\xD7 ${
|
|
33494
|
+
`\xD7 ${label2}: your message to ${v}`,
|
|
33495
33495
|
quote2,
|
|
33496
33496
|
"was not delivered."
|
|
33497
|
-
) : `\xD7 ${
|
|
33497
|
+
) : `\xD7 ${label2}: your message to ${v} was not delivered.`,
|
|
33498
33498
|
...said(v) ? [` ${said(v)}`] : [],
|
|
33499
33499
|
...hint ? [` ${hint}`] : [],
|
|
33500
33500
|
...linkedNs !== void 0 && (r.reason === "closed" || r.reason === "revoked") ? [
|
|
@@ -33578,12 +33578,12 @@ function excerptOf(body) {
|
|
|
33578
33578
|
function statusSaysText(row, now = Date.now()) {
|
|
33579
33579
|
if (typeof row.status !== "string") return void 0;
|
|
33580
33580
|
const state = displayKind(row.status);
|
|
33581
|
-
const
|
|
33581
|
+
const label2 = typeof row.status_label === "string" ? displayLabel(row.status_label) : "";
|
|
33582
33582
|
const at = typeof row.status_at === "string" ? Date.parse(row.status_at) : NaN;
|
|
33583
33583
|
const age = Number.isNaN(at) ? 0 : now - at;
|
|
33584
33584
|
return [
|
|
33585
33585
|
`agent says: ${state}`,
|
|
33586
|
-
...
|
|
33586
|
+
...label2 ? [`"${label2}"`] : [],
|
|
33587
33587
|
...age >= STATUS_STALE_MS ? [agoText(age)] : []
|
|
33588
33588
|
].join(" \xB7 ");
|
|
33589
33589
|
}
|
|
@@ -33621,11 +33621,11 @@ function rosterText(agents, now = Date.now()) {
|
|
|
33621
33621
|
function selfText(agent) {
|
|
33622
33622
|
if (!agent) return JSON.stringify(agent, null, 2);
|
|
33623
33623
|
const { status: _s, status_label: _l, status_at: _a3, ...rest } = agent;
|
|
33624
|
-
const
|
|
33624
|
+
const label2 = typeof agent.status_label === "string" ? displayLabel(agent.status_label) : "";
|
|
33625
33625
|
const shown5 = {
|
|
33626
33626
|
...rest,
|
|
33627
33627
|
...typeof agent.status === "string" ? { status: displayKind(agent.status) } : {},
|
|
33628
|
-
...
|
|
33628
|
+
...label2 ? { status_label: label2 } : {},
|
|
33629
33629
|
...typeof agent.status_at === "string" && !Number.isNaN(Date.parse(agent.status_at)) ? { status_at: agent.status_at } : {}
|
|
33630
33630
|
};
|
|
33631
33631
|
return JSON.stringify(shown5, null, 2);
|
|
@@ -33730,7 +33730,7 @@ ${neutralizeBody(m.body)}`;
|
|
|
33730
33730
|
BAD_LABEL_CHARS2 = new RegExp(BAD_NS_CHARS.source, "gu");
|
|
33731
33731
|
cleanStatusLabel = (raw) => raw.normalize("NFC").replace(/\s+/gu, " ").replace(BAD_LABEL_CHARS2, "").normalize("NFC").trim();
|
|
33732
33732
|
statusLabelTooLong = (n) => `oa-bus: that label is ${n} characters, and the limit is ${LIMITS.maxLabelChars}. Your status did not change. Send a shorter one.`;
|
|
33733
|
-
statusSetText = (state,
|
|
33733
|
+
statusSetText = (state, label2) => `Your status is now ${state}${label2 ? `: "${label2}"` : ""}. The user sees it as your own report.`;
|
|
33734
33734
|
earlierStatusText = (message) => `Your previous status did not reach the user. ${message}`;
|
|
33735
33735
|
followText = (url2) => `Following ${url2}. You get a notice here when it changes.`;
|
|
33736
33736
|
unfollowText = (removed, artifact) => removed ? `Stopped following ${artifact}.` : `You were not following ${artifact}.`;
|
|
@@ -33765,7 +33765,7 @@ ${neutralizeBody(m.body)}`;
|
|
|
33765
33765
|
if (hours < 24) return `${hours} h ago`;
|
|
33766
33766
|
return `${Math.round(ms / 864e5)} d ago`;
|
|
33767
33767
|
};
|
|
33768
|
-
displayLabel = (
|
|
33768
|
+
displayLabel = (label2) => [...cleanStatusLabel(stripTerminalControls(label2).replace(INVISIBLES, ""))].slice(0, LIMITS.maxLabelChars).join("").replaceAll('"', "'");
|
|
33769
33769
|
awayTime = (iso) => {
|
|
33770
33770
|
const t = Date.parse(iso);
|
|
33771
33771
|
return Number.isNaN(t) ? iso : `${new Date(t).toISOString().slice(0, 16).replace("T", " ")} UTC`;
|
|
@@ -34168,15 +34168,15 @@ async function run(name, args, request) {
|
|
|
34168
34168
|
}
|
|
34169
34169
|
}
|
|
34170
34170
|
async function statusTool(args, request) {
|
|
34171
|
-
const
|
|
34172
|
-
const chars = typeof
|
|
34171
|
+
const label2 = typeof args.label === "string" ? cleanStatusLabel(args.label) : args.label;
|
|
34172
|
+
const chars = typeof label2 === "string" ? [...label2].length : 0;
|
|
34173
34173
|
if (chars > MAX_LABEL_CHARS) return text(statusLabelTooLong(chars), true);
|
|
34174
34174
|
const frame = SetStatus.safeParse({
|
|
34175
34175
|
v: 1,
|
|
34176
34176
|
id: "0",
|
|
34177
34177
|
type: "set_status",
|
|
34178
34178
|
state: args.state,
|
|
34179
|
-
...
|
|
34179
|
+
...label2 === void 0 || label2 === "" ? {} : { label: label2 }
|
|
34180
34180
|
});
|
|
34181
34181
|
if (!frame.success) {
|
|
34182
34182
|
const issue2 = frame.error.issues[0];
|
|
@@ -35386,26 +35386,26 @@ var require_permessage_deflate = __commonJS({
|
|
|
35386
35386
|
value = value[0];
|
|
35387
35387
|
if (key2 === "client_max_window_bits") {
|
|
35388
35388
|
if (value !== true) {
|
|
35389
|
-
const
|
|
35390
|
-
if (!Number.isInteger(
|
|
35389
|
+
const num2 = +value;
|
|
35390
|
+
if (!Number.isInteger(num2) || num2 < 8 || num2 > 15) {
|
|
35391
35391
|
throw new TypeError(
|
|
35392
35392
|
`Invalid value for parameter "${key2}": ${value}`
|
|
35393
35393
|
);
|
|
35394
35394
|
}
|
|
35395
|
-
value =
|
|
35395
|
+
value = num2;
|
|
35396
35396
|
} else if (!this._isServer) {
|
|
35397
35397
|
throw new TypeError(
|
|
35398
35398
|
`Invalid value for parameter "${key2}": ${value}`
|
|
35399
35399
|
);
|
|
35400
35400
|
}
|
|
35401
35401
|
} else if (key2 === "server_max_window_bits") {
|
|
35402
|
-
const
|
|
35403
|
-
if (!Number.isInteger(
|
|
35402
|
+
const num2 = +value;
|
|
35403
|
+
if (!Number.isInteger(num2) || num2 < 8 || num2 > 15) {
|
|
35404
35404
|
throw new TypeError(
|
|
35405
35405
|
`Invalid value for parameter "${key2}": ${value}`
|
|
35406
35406
|
);
|
|
35407
35407
|
}
|
|
35408
|
-
value =
|
|
35408
|
+
value = num2;
|
|
35409
35409
|
} else if (key2 === "client_no_context_takeover" || key2 === "server_no_context_takeover") {
|
|
35410
35410
|
if (value !== true) {
|
|
35411
35411
|
throw new TypeError(
|
|
@@ -36118,8 +36118,8 @@ var require_receiver = __commonJS({
|
|
|
36118
36118
|
return;
|
|
36119
36119
|
}
|
|
36120
36120
|
const buf = this.consume(8);
|
|
36121
|
-
const
|
|
36122
|
-
if (
|
|
36121
|
+
const num2 = buf.readUInt32BE(0);
|
|
36122
|
+
if (num2 > Math.pow(2, 53 - 32) - 1) {
|
|
36123
36123
|
const error62 = this.createError(
|
|
36124
36124
|
RangeError,
|
|
36125
36125
|
"Unsupported WebSocket frame: payload length > 2^53 - 1",
|
|
@@ -36130,7 +36130,7 @@ var require_receiver = __commonJS({
|
|
|
36130
36130
|
cb(error62);
|
|
36131
36131
|
return;
|
|
36132
36132
|
}
|
|
36133
|
-
this._payloadLength =
|
|
36133
|
+
this._payloadLength = num2 * Math.pow(2, 32) + buf.readUInt32BE(4);
|
|
36134
36134
|
this.haveLength(cb);
|
|
36135
36135
|
}
|
|
36136
36136
|
/**
|
|
@@ -39325,13 +39325,13 @@ __export(codex_proxy_main_exports, {
|
|
|
39325
39325
|
readTokenFile: () => readTokenFile,
|
|
39326
39326
|
startCodexProxy: () => startCodexProxy
|
|
39327
39327
|
});
|
|
39328
|
-
import { readFileSync as
|
|
39328
|
+
import { readFileSync as readFileSync37 } from "node:fs";
|
|
39329
39329
|
import { homedir as homedir4 } from "node:os";
|
|
39330
39330
|
function readTokenFile(path) {
|
|
39331
39331
|
if (!path) return void 0;
|
|
39332
39332
|
try {
|
|
39333
39333
|
const p = path.startsWith("~/") ? `${homedir4()}${path.slice(1)}` : path;
|
|
39334
|
-
return
|
|
39334
|
+
return readFileSync37(p, "utf8").trim() || void 0;
|
|
39335
39335
|
} catch {
|
|
39336
39336
|
return void 0;
|
|
39337
39337
|
}
|
|
@@ -39381,13 +39381,13 @@ __export(proxy_main_exports, {
|
|
|
39381
39381
|
readTokenFile: () => readTokenFile2,
|
|
39382
39382
|
startProxy: () => startProxy
|
|
39383
39383
|
});
|
|
39384
|
-
import { readFileSync as
|
|
39384
|
+
import { readFileSync as readFileSync38 } from "node:fs";
|
|
39385
39385
|
import { homedir as homedir5 } from "node:os";
|
|
39386
39386
|
function readTokenFile2(path) {
|
|
39387
39387
|
if (!path) return void 0;
|
|
39388
39388
|
try {
|
|
39389
39389
|
const p = path.startsWith("~/") ? `${homedir5()}${path.slice(1)}` : path;
|
|
39390
|
-
return
|
|
39390
|
+
return readFileSync38(p, "utf8").trim() || void 0;
|
|
39391
39391
|
} catch {
|
|
39392
39392
|
return void 0;
|
|
39393
39393
|
}
|
|
@@ -39481,7 +39481,7 @@ import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
|
39481
39481
|
// ../bus-daemon/src/index.ts
|
|
39482
39482
|
init_src3();
|
|
39483
39483
|
import { randomBytes as randomBytes3 } from "node:crypto";
|
|
39484
|
-
import { lstatSync as lstatSync8, realpathSync as realpathSync8, writeFileSync as
|
|
39484
|
+
import { lstatSync as lstatSync8, realpathSync as realpathSync8, writeFileSync as writeFileSync10 } from "node:fs";
|
|
39485
39485
|
import { basename as basename5, isAbsolute as isAbsolute7, join as join18 } from "node:path";
|
|
39486
39486
|
|
|
39487
39487
|
// ../bus-adapter-opencode/src/version.ts
|
|
@@ -43371,8 +43371,8 @@ var AgentStatusRelay = class {
|
|
|
43371
43371
|
* Answered at once: the hub replies nothing on success. A refusal of an
|
|
43372
43372
|
* earlier status, or one that never went, rides on this answer.
|
|
43373
43373
|
*/
|
|
43374
|
-
status(ref, state,
|
|
43375
|
-
const update = { state, ...
|
|
43374
|
+
status(ref, state, label2, reply) {
|
|
43375
|
+
const update = { state, ...label2 === void 0 ? {} : { label: label2 } };
|
|
43376
43376
|
const earlier = this.#earlier.get(ref);
|
|
43377
43377
|
this.#earlier.delete(ref);
|
|
43378
43378
|
const g = this.#guards.get(ref);
|
|
@@ -45595,27 +45595,27 @@ function checkLeadsDir(dir, uid) {
|
|
|
45595
45595
|
return `the leads folder is writable by others: run chmod 700 ${dir}`;
|
|
45596
45596
|
return void 0;
|
|
45597
45597
|
}
|
|
45598
|
-
function checkRealDir(path,
|
|
45599
|
-
if (path === "/") return `${
|
|
45598
|
+
function checkRealDir(path, label2, uid, group) {
|
|
45599
|
+
if (path === "/") return `${label2} is the root folder`;
|
|
45600
45600
|
let real3;
|
|
45601
45601
|
try {
|
|
45602
45602
|
real3 = realpathSync6.native(path);
|
|
45603
45603
|
} catch {
|
|
45604
|
-
return `${
|
|
45604
|
+
return `${label2} does not exist`;
|
|
45605
45605
|
}
|
|
45606
45606
|
if (real3 !== path)
|
|
45607
|
-
return `${
|
|
45607
|
+
return `${label2} is not its own real path (a symlink or alias)`;
|
|
45608
45608
|
try {
|
|
45609
45609
|
const st = statSync7(real3);
|
|
45610
|
-
if (!st.isDirectory()) return `${
|
|
45610
|
+
if (!st.isDirectory()) return `${label2} is not a folder`;
|
|
45611
45611
|
if (uid !== void 0 && st.uid !== uid)
|
|
45612
|
-
return `${
|
|
45612
|
+
return `${label2} belongs to another user`;
|
|
45613
45613
|
if (st.mode & 2)
|
|
45614
|
-
return `${
|
|
45614
|
+
return `${label2} is writable by everyone: run chmod 700 ${path}`;
|
|
45615
45615
|
if (st.mode & 16 && (st.gid !== group.gid || !group.isPrivate(st.gid)))
|
|
45616
|
-
return `${
|
|
45616
|
+
return `${label2} is writable by a group others share: run chmod 700 ${path}`;
|
|
45617
45617
|
} catch {
|
|
45618
|
-
return `${
|
|
45618
|
+
return `${label2} cannot be read`;
|
|
45619
45619
|
}
|
|
45620
45620
|
return void 0;
|
|
45621
45621
|
}
|
|
@@ -45937,6 +45937,137 @@ function installVersion(home2, version2, fill, opts = {}) {
|
|
|
45937
45937
|
prune(home2, [version2, previous], opts);
|
|
45938
45938
|
}
|
|
45939
45939
|
|
|
45940
|
+
// ../bus-daemon/src/update/policy.ts
|
|
45941
|
+
var SIX_HOURS_MS = 6 * 60 * 60 * 1e3;
|
|
45942
|
+
var READY_AFTER_MS = 24 * 60 * 60 * 1e3;
|
|
45943
|
+
var MAX_LIST = 20;
|
|
45944
|
+
var REFUSED_BACKOFF_MS = 24 * 60 * 60 * 1e3;
|
|
45945
|
+
var REFUSED_BACKOFF_MAX_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
45946
|
+
var emptyPolicy = () => ({
|
|
45947
|
+
armed: false,
|
|
45948
|
+
unreadable: false,
|
|
45949
|
+
off: false,
|
|
45950
|
+
failed: [],
|
|
45951
|
+
refused: {},
|
|
45952
|
+
notified: {},
|
|
45953
|
+
introShown: false,
|
|
45954
|
+
needsYou: false
|
|
45955
|
+
});
|
|
45956
|
+
var XYZ = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/;
|
|
45957
|
+
function parseVersion(v) {
|
|
45958
|
+
if (typeof v !== "string" || v.length > 32) return void 0;
|
|
45959
|
+
const m = XYZ.exec(v);
|
|
45960
|
+
if (!m) return void 0;
|
|
45961
|
+
const n = [Number(m[1]), Number(m[2]), Number(m[3])];
|
|
45962
|
+
return n.every(Number.isSafeInteger) ? n : void 0;
|
|
45963
|
+
}
|
|
45964
|
+
function readyDue(s, now) {
|
|
45965
|
+
const st = s.staged;
|
|
45966
|
+
if (!st || s.off) return false;
|
|
45967
|
+
if (s.notified[st.version]?.includes("ready")) return false;
|
|
45968
|
+
return Math.max(now, st.readySince) - st.readySince >= READY_AFTER_MS;
|
|
45969
|
+
}
|
|
45970
|
+
function label(s, now) {
|
|
45971
|
+
if (s.needsYou || s.unreadable) return "Update needs you";
|
|
45972
|
+
const st = s.staged;
|
|
45973
|
+
if (!st) return "Up to date";
|
|
45974
|
+
return s.notified[st.version]?.includes("ready") || readyDue(s, now) ? "Update ready" : "Updating soon";
|
|
45975
|
+
}
|
|
45976
|
+
|
|
45977
|
+
// ../bus-daemon/src/update/state.ts
|
|
45978
|
+
import {
|
|
45979
|
+
chmodSync as chmodSync12,
|
|
45980
|
+
readFileSync as readFileSync14,
|
|
45981
|
+
renameSync as renameSync12,
|
|
45982
|
+
rmSync as rmSync6,
|
|
45983
|
+
writeFileSync as writeFileSync9
|
|
45984
|
+
} from "node:fs";
|
|
45985
|
+
function load(home2) {
|
|
45986
|
+
let text3;
|
|
45987
|
+
try {
|
|
45988
|
+
text3 = readFileSync14(stateFile(home2), "utf8");
|
|
45989
|
+
} catch (e) {
|
|
45990
|
+
return e.code === "ENOENT" ? { kind: "missing" } : { kind: "bad" };
|
|
45991
|
+
}
|
|
45992
|
+
try {
|
|
45993
|
+
const j = JSON.parse(text3);
|
|
45994
|
+
if (j !== null && typeof j === "object" && !Array.isArray(j))
|
|
45995
|
+
return { kind: "ok", j };
|
|
45996
|
+
} catch {
|
|
45997
|
+
}
|
|
45998
|
+
return { kind: "bad" };
|
|
45999
|
+
}
|
|
46000
|
+
var ver = (v) => parseVersion(v) ? v : void 0;
|
|
46001
|
+
var num = (v) => typeof v === "number" && Number.isFinite(v) ? v : void 0;
|
|
46002
|
+
function readPolicy(home2) {
|
|
46003
|
+
const r = load(home2);
|
|
46004
|
+
const s = emptyPolicy();
|
|
46005
|
+
if (r.kind === "bad") {
|
|
46006
|
+
s.unreadable = true;
|
|
46007
|
+
return s;
|
|
46008
|
+
}
|
|
46009
|
+
if (r.kind === "missing") return s;
|
|
46010
|
+
const j = r.j;
|
|
46011
|
+
s.armed = j.armed === true;
|
|
46012
|
+
s.off = j.off === true;
|
|
46013
|
+
const newest = ver(j.newestRun);
|
|
46014
|
+
const prev = ver(j.previous);
|
|
46015
|
+
const cur = ver(j.current);
|
|
46016
|
+
if (newest) s.newestRun = newest;
|
|
46017
|
+
if (prev) s.previous = prev;
|
|
46018
|
+
if (cur) s.current = cur;
|
|
46019
|
+
if (Array.isArray(j.failed))
|
|
46020
|
+
s.failed = j.failed.filter((v) => ver(v) !== void 0).slice(-MAX_LIST);
|
|
46021
|
+
const ref = j.refused;
|
|
46022
|
+
if (ref && typeof ref === "object" && !Array.isArray(ref))
|
|
46023
|
+
for (const [k, v] of Object.entries(ref).slice(-MAX_LIST)) {
|
|
46024
|
+
const e = v;
|
|
46025
|
+
const at = num(e?.at);
|
|
46026
|
+
const count = num(e?.count);
|
|
46027
|
+
if (ver(k) && at !== void 0 && count !== void 0 && count >= 1)
|
|
46028
|
+
s.refused[k] = { at, count };
|
|
46029
|
+
}
|
|
46030
|
+
const lastAt = num(j.lastAt);
|
|
46031
|
+
if (lastAt !== void 0) s.lastAt = lastAt;
|
|
46032
|
+
const st = j.staged;
|
|
46033
|
+
const rs = num(st?.readySince);
|
|
46034
|
+
if (st && typeof st === "object" && ver(st.version) && rs !== void 0)
|
|
46035
|
+
s.staged = { version: st.version, readySince: rs };
|
|
46036
|
+
if (j.notified && typeof j.notified === "object" && !Array.isArray(j.notified)) {
|
|
46037
|
+
for (const [k, v] of Object.entries(j.notified).slice(-MAX_LIST))
|
|
46038
|
+
if (ver(k) && Array.isArray(v))
|
|
46039
|
+
s.notified[k] = v.filter((x) => typeof x === "string");
|
|
46040
|
+
}
|
|
46041
|
+
s.introShown = j.introShown === true;
|
|
46042
|
+
s.needsYou = j.needsYou === true;
|
|
46043
|
+
return s;
|
|
46044
|
+
}
|
|
46045
|
+
function put(home2, next) {
|
|
46046
|
+
const tmp = `${stateFile(home2)}.${process.pid}.policy.tmp`;
|
|
46047
|
+
try {
|
|
46048
|
+
writeFileSync9(tmp, `${JSON.stringify(next, null, 2)}
|
|
46049
|
+
`, { mode: 384 });
|
|
46050
|
+
chmodSync12(tmp, 384);
|
|
46051
|
+
renameSync12(tmp, stateFile(home2));
|
|
46052
|
+
} catch (e) {
|
|
46053
|
+
rmSync6(tmp, { force: true });
|
|
46054
|
+
throw e;
|
|
46055
|
+
}
|
|
46056
|
+
}
|
|
46057
|
+
function setCliKey(home2, key2, v) {
|
|
46058
|
+
const r = load(home2);
|
|
46059
|
+
const base3 = r.kind === "ok" ? { ...r.j } : {};
|
|
46060
|
+
base3[key2] = v;
|
|
46061
|
+
put(home2, base3);
|
|
46062
|
+
}
|
|
46063
|
+
function setOff(home2, off) {
|
|
46064
|
+
setCliKey(home2, "off", off);
|
|
46065
|
+
return readPolicy(home2);
|
|
46066
|
+
}
|
|
46067
|
+
function setIntroShown(home2) {
|
|
46068
|
+
setCliKey(home2, "introShown", true);
|
|
46069
|
+
}
|
|
46070
|
+
|
|
45940
46071
|
// ../bus-daemon/src/index.ts
|
|
45941
46072
|
var NOTICE_RETRY_MS = 3e4;
|
|
45942
46073
|
var BINDING_IDLE_MS = 24 * 60 * 6e4;
|
|
@@ -46803,7 +46934,7 @@ async function runDaemon(deps2 = {}) {
|
|
|
46803
46934
|
log(`this machine was revoked; run \`${BUS_CMD} install\``);
|
|
46804
46935
|
process.exitCode = 1;
|
|
46805
46936
|
try {
|
|
46806
|
-
|
|
46937
|
+
writeFileSync10(
|
|
46807
46938
|
deps2.revokedFile ?? join18(home(), "revoked"),
|
|
46808
46939
|
revokedMarker(cfg.machine_token),
|
|
46809
46940
|
{ mode: 384 }
|
|
@@ -47744,7 +47875,7 @@ init_src();
|
|
|
47744
47875
|
// src/context.ts
|
|
47745
47876
|
init_src3();
|
|
47746
47877
|
import { execFileSync as execFileSync6, spawn as spawn2 } from "node:child_process";
|
|
47747
|
-
import { closeSync as closeSync7, openSync as openSync7, readFileSync as
|
|
47878
|
+
import { closeSync as closeSync7, openSync as openSync7, readFileSync as readFileSync18 } from "node:fs";
|
|
47748
47879
|
import { homedir as homedir3, userInfo as userInfo2 } from "node:os";
|
|
47749
47880
|
import { createInterface as createInterface2 } from "node:readline";
|
|
47750
47881
|
init_src2();
|
|
@@ -47938,7 +48069,7 @@ function copy(style, bus = BUS_CMD, approve) {
|
|
|
47938
48069
|
return `${p("warning", frame)} Waiting for approval ${p("muted", left)}${failing ? ` ${p("warning", "hub unreachable, retrying")}` : ""}`;
|
|
47939
48070
|
},
|
|
47940
48071
|
waitingPlain: () => `Waiting for approval (up to 10 minutes)${more}`,
|
|
47941
|
-
approved: (
|
|
48072
|
+
approved: (label2) => done(`Approved as ${clip(label2, 15)}`),
|
|
47942
48073
|
tokenSaved: (path, token) => done(`Token saved to ${path}`, tokenTail(token, more)),
|
|
47943
48074
|
/**
|
|
47944
48075
|
* After approval: the instance, and its /bus page, where this machine is
|
|
@@ -47958,7 +48089,7 @@ function copy(style, bus = BUS_CMD, approve) {
|
|
|
47958
48089
|
warn(`The daemon (pid ${pid}) still uses the old token.`),
|
|
47959
48090
|
next(`Run ${bus} install to restart it with the new one.`)
|
|
47960
48091
|
],
|
|
47961
|
-
alreadyConnected: (
|
|
48092
|
+
alreadyConnected: (label2) => done(`Already connected as ${clip(label2, 24)}`),
|
|
47962
48093
|
configured: (names2) => done(
|
|
47963
48094
|
`Configured ${listing(
|
|
47964
48095
|
names2.map((h) => HARNESS_LABEL[h]),
|
|
@@ -48234,6 +48365,7 @@ function copy(style, bus = BUS_CMD, approve) {
|
|
|
48234
48365
|
" namespace approve [dir], revoke <dir> or list",
|
|
48235
48366
|
" link <dir> <dir> or list; unlink <dir> <dir>",
|
|
48236
48367
|
" leads check [name]",
|
|
48368
|
+
" auto-update off, on or status: whether the bus keeps itself up to date",
|
|
48237
48369
|
" mcp <claude|opencode|codex|pi>: the MCP server a harness runs",
|
|
48238
48370
|
" version Print the version",
|
|
48239
48371
|
" help This text",
|
|
@@ -48275,12 +48407,12 @@ function copy(style, bus = BUS_CMD, approve) {
|
|
|
48275
48407
|
next(`${bus} --instance ${clip(askedUrl, 39)}.`)
|
|
48276
48408
|
];
|
|
48277
48409
|
},
|
|
48278
|
-
checkOk: (
|
|
48279
|
-
done(
|
|
48410
|
+
checkOk: (label2, details = []) => [
|
|
48411
|
+
done(label2),
|
|
48280
48412
|
...details.map((d) => next(d))
|
|
48281
48413
|
],
|
|
48282
|
-
checkFailed: (
|
|
48283
|
-
fail2(
|
|
48414
|
+
checkFailed: (label2, action, details = []) => [
|
|
48415
|
+
fail2(label2),
|
|
48284
48416
|
...details.map((d) => next(d)),
|
|
48285
48417
|
next(action)
|
|
48286
48418
|
],
|
|
@@ -48322,7 +48454,7 @@ function copy(style, bus = BUS_CMD, approve) {
|
|
|
48322
48454
|
const dur = link2.for ? ` ${p("muted", link2.for)}` : "";
|
|
48323
48455
|
return `Hub ${clip(host, 9 + 2 + len(word) + (link2.for ? 2 + len(link2.for) : 0))} ${p(tone, word)}${dur}`;
|
|
48324
48456
|
},
|
|
48325
|
-
machineRow: (
|
|
48457
|
+
machineRow: (label2) => `Machine ${clip(label2, 9)}`,
|
|
48326
48458
|
statusDaemonDown: () => [
|
|
48327
48459
|
fail2("Daemon not running"),
|
|
48328
48460
|
next(`Run ${bus} to restart it,`),
|
|
@@ -48672,8 +48804,8 @@ function copy(style, bus = BUS_CMD, approve) {
|
|
|
48672
48804
|
p("muted", `To remove everything, run ${bus} uninstall --purge.`)
|
|
48673
48805
|
],
|
|
48674
48806
|
deleted: (home2) => done(`Deleted ${clip(home2, 35)}, including machine.json`),
|
|
48675
|
-
stillListed: (
|
|
48676
|
-
warn(`${clip(
|
|
48807
|
+
stillListed: (label2, origin) => [
|
|
48808
|
+
warn(`${clip(label2, 30)} is still listed on the bus`),
|
|
48677
48809
|
next("Revoke it on the machines page to remove it for good:"),
|
|
48678
48810
|
next(clip(`${origin}/settings/machines`, 3)),
|
|
48679
48811
|
next(`To use this computer again, run ${bus}.`)
|
|
@@ -48703,6 +48835,19 @@ function copy(style, bus = BUS_CMD, approve) {
|
|
|
48703
48835
|
`${dirs.length} global ${dirs.length === 1 ? "directory" : "directories"}`,
|
|
48704
48836
|
...dirs.map((d) => ` ${clip(d, 2)}`)
|
|
48705
48837
|
],
|
|
48838
|
+
// 14. auto-update (#2552). Only the first four lines are the issue's copy.
|
|
48839
|
+
autoUpdateIntro: () => `The bus now keeps itself up to date. To turn this off: ${bus} auto-update off`,
|
|
48840
|
+
autoUpdateLabel: (l) => l,
|
|
48841
|
+
autoUpdateOff: () => "Auto-update is off.",
|
|
48842
|
+
autoUpdateOn: () => "Auto-update is on.",
|
|
48843
|
+
autoUpdateStatusOff: () => "Auto-update: off",
|
|
48844
|
+
updateNotATerminal: () => "Run this yourself in a terminal. It's not for an agent to run.",
|
|
48845
|
+
updateNothingStaged: (l) => `${l}. Nothing is waiting to install.`,
|
|
48846
|
+
updateOff: () => `Auto-update is off. Turn it on with ${bus} auto-update on.`,
|
|
48847
|
+
updateFailedVersion: (v) => `${v} failed on this machine before, so it won't be installed. The next version will be.`,
|
|
48848
|
+
updatePrompt: (v) => `Install ${v} now? The bus restarts for a few seconds. Type yes to continue: `,
|
|
48849
|
+
updateDeclined: () => "Nothing was installed.",
|
|
48850
|
+
updateDone: (v) => `Installed ${v}.`,
|
|
48706
48851
|
// 13. lead templates (#1328). DRAFT: not in the transcript yet.
|
|
48707
48852
|
leadsNoHub: () => [
|
|
48708
48853
|
fail2("This machine has no instance to check briefs against."),
|
|
@@ -48905,17 +49050,17 @@ var realDeps = {
|
|
|
48905
49050
|
// src/steps/service.ts
|
|
48906
49051
|
import { createHash as createHash6 } from "node:crypto";
|
|
48907
49052
|
import {
|
|
48908
|
-
chmodSync as
|
|
49053
|
+
chmodSync as chmodSync14,
|
|
48909
49054
|
cpSync,
|
|
48910
49055
|
existsSync as existsSync4,
|
|
48911
49056
|
lstatSync as lstatSync10,
|
|
48912
49057
|
mkdirSync as mkdirSync9,
|
|
48913
49058
|
readdirSync as readdirSync7,
|
|
48914
|
-
readFileSync as
|
|
49059
|
+
readFileSync as readFileSync17,
|
|
48915
49060
|
realpathSync as realpathSync9,
|
|
48916
|
-
renameSync as
|
|
48917
|
-
rmSync as
|
|
48918
|
-
writeFileSync as
|
|
49061
|
+
renameSync as renameSync14,
|
|
49062
|
+
rmSync as rmSync7,
|
|
49063
|
+
writeFileSync as writeFileSync12
|
|
48919
49064
|
} from "node:fs";
|
|
48920
49065
|
import { tmpdir } from "node:os";
|
|
48921
49066
|
import {
|
|
@@ -48931,7 +49076,7 @@ import { fileURLToPath } from "node:url";
|
|
|
48931
49076
|
init_src();
|
|
48932
49077
|
|
|
48933
49078
|
// src/steps/codex.ts
|
|
48934
|
-
import { lstatSync as lstatSync9, readFileSync as
|
|
49079
|
+
import { lstatSync as lstatSync9, readFileSync as readFileSync15 } from "node:fs";
|
|
48935
49080
|
import { join as join19, resolve as resolve3 } from "node:path";
|
|
48936
49081
|
|
|
48937
49082
|
// ../../node_modules/.pnpm/smol-toml@1.9.1/node_modules/smol-toml/dist/error.js
|
|
@@ -49713,7 +49858,7 @@ var findCodexBin = (o) => resolveCodexBin({ ...o, app: o.app ?? null })?.path;
|
|
|
49713
49858
|
function readToml(path) {
|
|
49714
49859
|
let text3;
|
|
49715
49860
|
try {
|
|
49716
|
-
text3 =
|
|
49861
|
+
text3 = readFileSync15(path, "utf8");
|
|
49717
49862
|
} catch (e) {
|
|
49718
49863
|
if (e.code === "ENOENT")
|
|
49719
49864
|
return { text: "", doc: {} };
|
|
@@ -49979,16 +50124,16 @@ async function readCodexVersion(o) {
|
|
|
49979
50124
|
|
|
49980
50125
|
// src/steps/step.ts
|
|
49981
50126
|
import {
|
|
49982
|
-
chmodSync as
|
|
50127
|
+
chmodSync as chmodSync13,
|
|
49983
50128
|
mkdirSync as mkdirSync8,
|
|
49984
|
-
readFileSync as
|
|
49985
|
-
renameSync as
|
|
49986
|
-
writeFileSync as
|
|
50129
|
+
readFileSync as readFileSync16,
|
|
50130
|
+
renameSync as renameSync13,
|
|
50131
|
+
writeFileSync as writeFileSync11
|
|
49987
50132
|
} from "node:fs";
|
|
49988
50133
|
import { dirname as dirname9 } from "node:path";
|
|
49989
50134
|
function readInstallFile(path) {
|
|
49990
50135
|
try {
|
|
49991
|
-
const v = JSON.parse(
|
|
50136
|
+
const v = JSON.parse(readFileSync16(path, "utf8"));
|
|
49992
50137
|
if (typeof v === "object" && v !== null && !Array.isArray(v))
|
|
49993
50138
|
return v;
|
|
49994
50139
|
} catch {
|
|
@@ -49999,10 +50144,10 @@ function updateInstallFile(path, patch) {
|
|
|
49999
50144
|
const next = { ...readInstallFile(path), ...patch };
|
|
50000
50145
|
mkdirSync8(dirname9(path), { recursive: true, mode: 448 });
|
|
50001
50146
|
const tmp = `${path}.${process.pid}.tmp`;
|
|
50002
|
-
|
|
50147
|
+
writeFileSync11(tmp, `${JSON.stringify(next, null, 2)}
|
|
50003
50148
|
`, { mode: 384 });
|
|
50004
|
-
|
|
50005
|
-
|
|
50149
|
+
chmodSync13(tmp, 384);
|
|
50150
|
+
renameSync13(tmp, path);
|
|
50006
50151
|
}
|
|
50007
50152
|
async function runSteps(steps, ctx, record7) {
|
|
50008
50153
|
for (const step2 of steps) {
|
|
@@ -50063,14 +50208,14 @@ var oneLine = (v) => {
|
|
|
50063
50208
|
return v;
|
|
50064
50209
|
};
|
|
50065
50210
|
var xml = (v) => oneLine(v).replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
50066
|
-
function renderPlist(u,
|
|
50211
|
+
function renderPlist(u, label2 = LAUNCHD_LABEL) {
|
|
50067
50212
|
const str3 = (v) => `<string>${xml(v)}</string>`;
|
|
50068
50213
|
const env2 = Object.entries(u.env).map(([k, v]) => `<key>${xml(k)}</key>${str3(v)}`).join("");
|
|
50069
50214
|
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
50070
50215
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
50071
50216
|
<plist version="1.0">
|
|
50072
50217
|
<dict>
|
|
50073
|
-
<key>Label</key><string>${xml(
|
|
50218
|
+
<key>Label</key><string>${xml(label2)}</string>
|
|
50074
50219
|
<key>ProgramArguments</key>
|
|
50075
50220
|
<array>${str3(u.node)}${str3(u.entry)}${str3("daemon")}</array>
|
|
50076
50221
|
<key>RunAtLoad</key><true/>
|
|
@@ -50175,7 +50320,7 @@ function versionOf(src) {
|
|
|
50175
50320
|
if (src.kind === "dev") return "dev";
|
|
50176
50321
|
try {
|
|
50177
50322
|
const j = JSON.parse(
|
|
50178
|
-
|
|
50323
|
+
readFileSync17(join20(dirname10(dirname10(src.file)), "package.json"), "utf8")
|
|
50179
50324
|
);
|
|
50180
50325
|
if (isSafeVersion(j?.version)) return j.version;
|
|
50181
50326
|
} catch {
|
|
@@ -50184,21 +50329,21 @@ function versionOf(src) {
|
|
|
50184
50329
|
}
|
|
50185
50330
|
function installCli(home2, src, node2) {
|
|
50186
50331
|
mkdirSync9(home2, { recursive: true, mode: 448 });
|
|
50187
|
-
|
|
50332
|
+
chmodSync14(home2, 448);
|
|
50188
50333
|
installVersion(home2, versionOf(src), (tmp) => {
|
|
50189
50334
|
if (src.kind === "bundle") {
|
|
50190
50335
|
const pkg = dirname10(dirname10(src.file));
|
|
50191
50336
|
for (const name of ["dist", "assets", "package.json"])
|
|
50192
50337
|
if (existsSync4(join20(pkg, name)))
|
|
50193
50338
|
cpSync(join20(pkg, name), join20(tmp, name), { recursive: true });
|
|
50194
|
-
} else
|
|
50195
|
-
|
|
50339
|
+
} else writeFileSync12(join20(tmp, entryName(src)), shim(src));
|
|
50340
|
+
chmodSync14(tmp, 448);
|
|
50196
50341
|
if (node2 !== void 0) {
|
|
50197
|
-
|
|
50198
|
-
|
|
50342
|
+
writeFileSync12(join20(tmp, "node"), launcherText(node2), { mode: 448 });
|
|
50343
|
+
chmodSync14(join20(tmp, "node"), 448);
|
|
50199
50344
|
}
|
|
50200
50345
|
if (!existsSync4(join20(tmp, "package.json")))
|
|
50201
|
-
|
|
50346
|
+
writeFileSync12(join20(tmp, "package.json"), '{ "type": "module" }\n');
|
|
50202
50347
|
});
|
|
50203
50348
|
return join20(home2, "bin", entryName(src));
|
|
50204
50349
|
}
|
|
@@ -50214,10 +50359,10 @@ function writeReplacing(path, text3) {
|
|
|
50214
50359
|
mkdirSync9(dirname10(path), { recursive: true });
|
|
50215
50360
|
const tmp = `${path}.${process.pid}.tmp`;
|
|
50216
50361
|
try {
|
|
50217
|
-
|
|
50218
|
-
|
|
50362
|
+
writeFileSync12(tmp, text3, { mode: 420 });
|
|
50363
|
+
renameSync14(tmp, path);
|
|
50219
50364
|
} catch (e) {
|
|
50220
|
-
|
|
50365
|
+
rmSync7(tmp, { force: true });
|
|
50221
50366
|
throw e;
|
|
50222
50367
|
}
|
|
50223
50368
|
}
|
|
@@ -50316,7 +50461,7 @@ function systemService(d) {
|
|
|
50316
50461
|
return "started";
|
|
50317
50462
|
await d.sleep(1e3);
|
|
50318
50463
|
}
|
|
50319
|
-
|
|
50464
|
+
rmSync7(f, { force: true });
|
|
50320
50465
|
return "failed";
|
|
50321
50466
|
}
|
|
50322
50467
|
async function startSystemd(f, u) {
|
|
@@ -50330,7 +50475,7 @@ function systemService(d) {
|
|
|
50330
50475
|
]) {
|
|
50331
50476
|
if ((await systemctl(...args)).code === 0) continue;
|
|
50332
50477
|
if (args[0] !== "daemon-reload") await systemctl("disable", unit);
|
|
50333
|
-
|
|
50478
|
+
rmSync7(f, { force: true });
|
|
50334
50479
|
if (args[0] !== "daemon-reload") await systemctl("daemon-reload");
|
|
50335
50480
|
return "failed";
|
|
50336
50481
|
}
|
|
@@ -50386,7 +50531,7 @@ function systemService(d) {
|
|
|
50386
50531
|
const old = recorded();
|
|
50387
50532
|
if (!skipped && old && old !== f) {
|
|
50388
50533
|
if (manager === "systemd") await systemctl("disable", names2().unit);
|
|
50389
|
-
|
|
50534
|
+
rmSync7(old, { force: true });
|
|
50390
50535
|
}
|
|
50391
50536
|
const started = skipped ? "failed" : manager === "launchd" ? await startLaunchd(f, unit) : manager === "systemd" ? await startSystemd(f, unit) : "failed";
|
|
50392
50537
|
if (started === "started") {
|
|
@@ -50427,11 +50572,11 @@ function systemService(d) {
|
|
|
50427
50572
|
return { stopped: true };
|
|
50428
50573
|
}
|
|
50429
50574
|
const f = file2();
|
|
50430
|
-
const { label, unit } = names2();
|
|
50575
|
+
const { label: label2, unit } = names2();
|
|
50431
50576
|
if (manager === "launchd")
|
|
50432
|
-
await d.exec("launchctl", ["bootout", `${domain2}/${
|
|
50577
|
+
await d.exec("launchctl", ["bootout", `${domain2}/${label2}`]);
|
|
50433
50578
|
else await systemctl("disable", "--now", unit);
|
|
50434
|
-
|
|
50579
|
+
rmSync7(f, { force: true });
|
|
50435
50580
|
if (manager === "systemd") await systemctl("daemon-reload");
|
|
50436
50581
|
const left = await quiet();
|
|
50437
50582
|
if (left !== void 0) return { unit: manager, running: left };
|
|
@@ -50528,8 +50673,8 @@ var noService = {
|
|
|
50528
50673
|
remove: async () => ({}),
|
|
50529
50674
|
cli: () => ["oa-bus"]
|
|
50530
50675
|
};
|
|
50531
|
-
var VERSION = true ? "0.
|
|
50532
|
-
|
|
50676
|
+
var VERSION = true ? "0.189.0" : JSON.parse(
|
|
50677
|
+
readFileSync18(new URL("../package.json", import.meta.url), "utf8")
|
|
50533
50678
|
).version;
|
|
50534
50679
|
var which = (cmd) => {
|
|
50535
50680
|
try {
|
|
@@ -50544,7 +50689,7 @@ function processArgs2(pid, io = {
|
|
|
50544
50689
|
encoding: "utf8",
|
|
50545
50690
|
stdio: ["ignore", "pipe", "ignore"]
|
|
50546
50691
|
}),
|
|
50547
|
-
proc: (path) =>
|
|
50692
|
+
proc: (path) => readFileSync18(path, "utf8")
|
|
50548
50693
|
}) {
|
|
50549
50694
|
try {
|
|
50550
50695
|
return io.ps(pid).trim() || void 0;
|
|
@@ -50708,16 +50853,16 @@ var isolated = (ctx) => Boolean(ctx.service.isolated);
|
|
|
50708
50853
|
// src/steps/adapters.ts
|
|
50709
50854
|
import { randomBytes as randomBytes6 } from "node:crypto";
|
|
50710
50855
|
import {
|
|
50711
|
-
chmodSync as
|
|
50856
|
+
chmodSync as chmodSync16,
|
|
50712
50857
|
existsSync as existsSync11,
|
|
50713
50858
|
lstatSync as lstatSync15,
|
|
50714
50859
|
mkdirSync as mkdirSync12,
|
|
50715
|
-
readFileSync as
|
|
50860
|
+
readFileSync as readFileSync27,
|
|
50716
50861
|
readlinkSync as readlinkSync5,
|
|
50717
|
-
renameSync as
|
|
50718
|
-
rmSync as
|
|
50862
|
+
renameSync as renameSync17,
|
|
50863
|
+
rmSync as rmSync15,
|
|
50719
50864
|
statSync as statSync9,
|
|
50720
|
-
writeFileSync as
|
|
50865
|
+
writeFileSync as writeFileSync15
|
|
50721
50866
|
} from "node:fs";
|
|
50722
50867
|
import { dirname as dirname14, isAbsolute as isAbsolute13, join as join27, relative as relative5, resolve as resolve10 } from "node:path";
|
|
50723
50868
|
import { isDeepStrictEqual } from "node:util";
|
|
@@ -51962,7 +52107,7 @@ var PI_EXTENSION = fileURLToPath4(
|
|
|
51962
52107
|
);
|
|
51963
52108
|
|
|
51964
52109
|
// src/steps/claude-proof.ts
|
|
51965
|
-
import { readFileSync as
|
|
52110
|
+
import { readFileSync as readFileSync19 } from "node:fs";
|
|
51966
52111
|
import { join as join21 } from "node:path";
|
|
51967
52112
|
var claudeConfigFile = (home2, env2) => join21(env2.CLAUDE_CONFIG_DIR ?? home2, ".claude.json");
|
|
51968
52113
|
var PROOF_COMMAND = "mcp-proof";
|
|
@@ -51996,7 +52141,7 @@ function findEntry(doc, origin) {
|
|
|
51996
52141
|
}
|
|
51997
52142
|
var readText = (path) => {
|
|
51998
52143
|
try {
|
|
51999
|
-
return
|
|
52144
|
+
return readFileSync19(path, "utf8");
|
|
52000
52145
|
} catch (e) {
|
|
52001
52146
|
if (e.code === "ENOENT") return "";
|
|
52002
52147
|
throw e;
|
|
@@ -52004,7 +52149,7 @@ var readText = (path) => {
|
|
|
52004
52149
|
};
|
|
52005
52150
|
function readRecord(path) {
|
|
52006
52151
|
try {
|
|
52007
|
-
const v = JSON.parse(
|
|
52152
|
+
const v = JSON.parse(readFileSync19(path, "utf8"));
|
|
52008
52153
|
if (isRecord3(v)) {
|
|
52009
52154
|
const { claudeProof: claudeProof2, ...rest } = v;
|
|
52010
52155
|
const p = claudeProof2;
|
|
@@ -52080,7 +52225,7 @@ function proofState(file2, origin) {
|
|
|
52080
52225
|
// src/steps/codex-proof.ts
|
|
52081
52226
|
init_src3();
|
|
52082
52227
|
init_src();
|
|
52083
|
-
import { existsSync as existsSync5, readFileSync as
|
|
52228
|
+
import { existsSync as existsSync5, readFileSync as readFileSync20, rmSync as rmSync8 } from "node:fs";
|
|
52084
52229
|
import { isAbsolute as isAbsolute10 } from "node:path";
|
|
52085
52230
|
var CODEX_MIN_VERSION = "0.123.0";
|
|
52086
52231
|
var PROXY_CMD = "mcp-proxy";
|
|
@@ -52103,7 +52248,7 @@ var BLOCKING = [
|
|
|
52103
52248
|
var isRecord4 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
52104
52249
|
function readMoved(path) {
|
|
52105
52250
|
try {
|
|
52106
|
-
const v = JSON.parse(
|
|
52251
|
+
const v = JSON.parse(readFileSync20(path, "utf8"));
|
|
52107
52252
|
if (isRecord4(v) && typeof v.name === "string" && typeof v.origin === "string" && Array.isArray(v.lines) && v.lines.every((l) => typeof l === "string") && typeof v.original === "string" && typeof v.swapped === "string")
|
|
52108
52253
|
return v;
|
|
52109
52254
|
} catch {
|
|
@@ -52334,7 +52479,7 @@ ${wantEntry(io, origin, p.tokenEnv).join("\n")}
|
|
|
52334
52479
|
function restoreEntry(io) {
|
|
52335
52480
|
const m = readMoved(io.moved);
|
|
52336
52481
|
if (!m) return false;
|
|
52337
|
-
let
|
|
52482
|
+
let put2 = false;
|
|
52338
52483
|
if (existsSync5(io.file)) {
|
|
52339
52484
|
const { text: text3, doc } = readToml(io.file);
|
|
52340
52485
|
const cur = servers2(doc)[m.name];
|
|
@@ -52357,11 +52502,11 @@ function restoreEntry(io) {
|
|
|
52357
52502
|
${m.lines.join("\n")}
|
|
52358
52503
|
`).x);
|
|
52359
52504
|
io.write(checked2(io.file, doc, out, m.name, { ...want, ...orig }));
|
|
52360
|
-
|
|
52505
|
+
put2 = true;
|
|
52361
52506
|
}
|
|
52362
52507
|
}
|
|
52363
|
-
|
|
52364
|
-
return
|
|
52508
|
+
rmSync8(io.moved, { force: true });
|
|
52509
|
+
return put2;
|
|
52365
52510
|
}
|
|
52366
52511
|
function linesOf(text3) {
|
|
52367
52512
|
const ls = splitLines(text3);
|
|
@@ -52389,9 +52534,9 @@ init_src();
|
|
|
52389
52534
|
import {
|
|
52390
52535
|
existsSync as existsSync8,
|
|
52391
52536
|
lstatSync as lstatSync14,
|
|
52392
|
-
readFileSync as
|
|
52537
|
+
readFileSync as readFileSync24,
|
|
52393
52538
|
realpathSync as realpathSync13,
|
|
52394
|
-
rmSync as
|
|
52539
|
+
rmSync as rmSync12
|
|
52395
52540
|
} from "node:fs";
|
|
52396
52541
|
import { join as join25, resolve as resolve8, sep as sep3 } from "node:path";
|
|
52397
52542
|
|
|
@@ -52402,13 +52547,13 @@ import {
|
|
|
52402
52547
|
lstatSync as lstatSync11,
|
|
52403
52548
|
mkdirSync as mkdirSync10,
|
|
52404
52549
|
readdirSync as readdirSync8,
|
|
52405
|
-
readFileSync as
|
|
52550
|
+
readFileSync as readFileSync21,
|
|
52406
52551
|
readlinkSync as readlinkSync3,
|
|
52407
52552
|
realpathSync as realpathSync10,
|
|
52408
|
-
renameSync as
|
|
52553
|
+
renameSync as renameSync15,
|
|
52409
52554
|
rmdirSync,
|
|
52410
|
-
rmSync as
|
|
52411
|
-
writeFileSync as
|
|
52555
|
+
rmSync as rmSync9,
|
|
52556
|
+
writeFileSync as writeFileSync13
|
|
52412
52557
|
} from "node:fs";
|
|
52413
52558
|
import {
|
|
52414
52559
|
basename as basename7,
|
|
@@ -52469,7 +52614,7 @@ function sweepStaging(staging, own2, o = {}) {
|
|
|
52469
52614
|
const m = STAGE_NAME.exec(name);
|
|
52470
52615
|
if (m ? old || !alive2(Number(m[1])) : old) {
|
|
52471
52616
|
try {
|
|
52472
|
-
|
|
52617
|
+
rmSync9(path, { recursive: true, force: true });
|
|
52473
52618
|
} catch {
|
|
52474
52619
|
}
|
|
52475
52620
|
}
|
|
@@ -52491,7 +52636,7 @@ function hermesHome(home2, env2, platform = process.platform) {
|
|
|
52491
52636
|
const root = hermesRoot(home2, env2, platform);
|
|
52492
52637
|
if (env2.HERMES_S6_SUPERVISED_CHILD) return base3;
|
|
52493
52638
|
try {
|
|
52494
|
-
const name =
|
|
52639
|
+
const name = readFileSync21(join22(root, "active_profile"), "utf8").trim().toLowerCase();
|
|
52495
52640
|
if (name && name !== "default" && /^[a-z0-9][a-z0-9_-]{0,63}$/.test(name)) {
|
|
52496
52641
|
const dir = join22(root, "profiles", name);
|
|
52497
52642
|
if (lstatSync11(dir).isDirectory()) return dir;
|
|
@@ -52592,7 +52737,7 @@ function pluginHash(dir) {
|
|
|
52592
52737
|
const h = createHash8("sha256");
|
|
52593
52738
|
for (const f of files(dir)) {
|
|
52594
52739
|
h.update(`${f}\0`);
|
|
52595
|
-
h.update(
|
|
52740
|
+
h.update(readFileSync21(join22(dir, f)));
|
|
52596
52741
|
h.update("\0");
|
|
52597
52742
|
}
|
|
52598
52743
|
return h.digest("hex").slice(0, 16);
|
|
@@ -52603,7 +52748,7 @@ function pluginState(dir, shipped) {
|
|
|
52603
52748
|
if (k !== "dir") return "foreign";
|
|
52604
52749
|
let marker;
|
|
52605
52750
|
try {
|
|
52606
|
-
marker =
|
|
52751
|
+
marker = readFileSync21(join22(dir, HERMES_MARKER), "utf8").trim();
|
|
52607
52752
|
} catch {
|
|
52608
52753
|
return "foreign";
|
|
52609
52754
|
}
|
|
@@ -52661,17 +52806,17 @@ async function installHermes(deps2) {
|
|
|
52661
52806
|
mkdirSync10(join22(tmp, f, ".."), { recursive: true });
|
|
52662
52807
|
cpSync2(join22(shipped, f), join22(tmp, f));
|
|
52663
52808
|
}
|
|
52664
|
-
|
|
52809
|
+
writeFileSync13(
|
|
52665
52810
|
join22(tmp, HERMES_MARKER),
|
|
52666
52811
|
`managed by the Open Artifacts bus installer: edits are replaced on reinstall. ${pluginHash(shipped)}
|
|
52667
52812
|
`
|
|
52668
52813
|
);
|
|
52669
52814
|
if (keepHabits)
|
|
52670
|
-
|
|
52671
|
-
if (state === "stale")
|
|
52672
|
-
|
|
52815
|
+
writeFileSync13(join22(tmp, HERMES_HABITS_MARKER), HABITS_MARKER_TEXT);
|
|
52816
|
+
if (state === "stale") rmSync9(dest, { recursive: true, force: true });
|
|
52817
|
+
renameSync15(tmp, dest);
|
|
52673
52818
|
} catch (e) {
|
|
52674
|
-
|
|
52819
|
+
rmSync9(tmp, { recursive: true, force: true });
|
|
52675
52820
|
throw e;
|
|
52676
52821
|
} finally {
|
|
52677
52822
|
try {
|
|
@@ -52706,7 +52851,7 @@ async function uninstallHermes(deps2, notes) {
|
|
|
52706
52851
|
`\`hermes plugins disable ${HERMES_PLUGIN_NAME}\` failed (${firstLine(r.stderr) || firstLine(r.stdout) || `exit ${r.code}`}); left the plugin folder, rerun once Hermes works`
|
|
52707
52852
|
);
|
|
52708
52853
|
} else notes.push(HERMES_NO_CLI);
|
|
52709
|
-
|
|
52854
|
+
rmSync9(dest, { recursive: true, force: true });
|
|
52710
52855
|
return "done";
|
|
52711
52856
|
}
|
|
52712
52857
|
async function hermesEnabled(deps2) {
|
|
@@ -52727,28 +52872,28 @@ import {
|
|
|
52727
52872
|
existsSync as existsSync7,
|
|
52728
52873
|
lstatSync as lstatSync13,
|
|
52729
52874
|
readdirSync as readdirSync10,
|
|
52730
|
-
readFileSync as
|
|
52875
|
+
readFileSync as readFileSync23,
|
|
52731
52876
|
realpathSync as realpathSync12,
|
|
52732
|
-
rmSync as
|
|
52877
|
+
rmSync as rmSync11
|
|
52733
52878
|
} from "node:fs";
|
|
52734
52879
|
import { join as join24, resolve as resolve7 } from "node:path";
|
|
52735
52880
|
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
52736
52881
|
|
|
52737
52882
|
// src/steps/skill.ts
|
|
52738
52883
|
import {
|
|
52739
|
-
chmodSync as
|
|
52884
|
+
chmodSync as chmodSync15,
|
|
52740
52885
|
existsSync as existsSync6,
|
|
52741
52886
|
lstatSync as lstatSync12,
|
|
52742
52887
|
mkdirSync as mkdirSync11,
|
|
52743
52888
|
readdirSync as readdirSync9,
|
|
52744
|
-
readFileSync as
|
|
52889
|
+
readFileSync as readFileSync22,
|
|
52745
52890
|
readlinkSync as readlinkSync4,
|
|
52746
52891
|
realpathSync as realpathSync11,
|
|
52747
|
-
renameSync as
|
|
52892
|
+
renameSync as renameSync16,
|
|
52748
52893
|
rmdirSync as rmdirSync2,
|
|
52749
|
-
rmSync as
|
|
52894
|
+
rmSync as rmSync10,
|
|
52750
52895
|
statSync as statSync8,
|
|
52751
|
-
writeFileSync as
|
|
52896
|
+
writeFileSync as writeFileSync14
|
|
52752
52897
|
} from "node:fs";
|
|
52753
52898
|
import { dirname as dirname12, join as join23, resolve as resolve6 } from "node:path";
|
|
52754
52899
|
var SKILL_MARKER = "<!-- managed by the Open Artifacts bus installer: edits are replaced on reinstall. -->";
|
|
@@ -52779,7 +52924,7 @@ var withoutCodexBlock = (text3) => {
|
|
|
52779
52924
|
};
|
|
52780
52925
|
var dropCodexBlock = (agentsPath, notes) => {
|
|
52781
52926
|
if (brokenLink(agentsPath) || !existsSync6(agentsPath)) return false;
|
|
52782
|
-
const text3 =
|
|
52927
|
+
const text3 = readFileSync22(agentsPath, "utf8");
|
|
52783
52928
|
if (codexBroken(text3)) {
|
|
52784
52929
|
notes.push(
|
|
52785
52930
|
`Left ${agentsPath} alone: its Open Artifacts block has no END marker. Fix or remove the block, then rerun the install.`
|
|
@@ -52908,12 +53053,12 @@ var writeAtomic = (path, text3) => {
|
|
|
52908
53053
|
mode = statSync8(path).mode & 4095;
|
|
52909
53054
|
} catch {
|
|
52910
53055
|
}
|
|
52911
|
-
|
|
52912
|
-
if (mode !== void 0)
|
|
52913
|
-
|
|
53056
|
+
writeFileSync14(tmp, text3);
|
|
53057
|
+
if (mode !== void 0) chmodSync15(tmp, mode);
|
|
53058
|
+
renameSync16(tmp, path);
|
|
52914
53059
|
} catch (e) {
|
|
52915
53060
|
try {
|
|
52916
|
-
|
|
53061
|
+
rmSync10(tmp, { force: true });
|
|
52917
53062
|
} catch {
|
|
52918
53063
|
}
|
|
52919
53064
|
throw e;
|
|
@@ -52973,7 +53118,7 @@ var codexSkillsShared = (deps2) => {
|
|
|
52973
53118
|
};
|
|
52974
53119
|
var ourSkillFile = (path, folder) => {
|
|
52975
53120
|
try {
|
|
52976
|
-
return isOurs(
|
|
53121
|
+
return isOurs(readFileSync22(path, "utf8"), folder);
|
|
52977
53122
|
} catch {
|
|
52978
53123
|
return false;
|
|
52979
53124
|
}
|
|
@@ -52983,7 +53128,7 @@ var installCodex = (deps2, folder, text3, written, notes) => {
|
|
|
52983
53128
|
const filePath = codexSkillFile(deps2, folder);
|
|
52984
53129
|
let before;
|
|
52985
53130
|
try {
|
|
52986
|
-
before = existsSync6(targetOf(agentsPath)) ?
|
|
53131
|
+
before = existsSync6(targetOf(agentsPath)) ? readFileSync22(targetOf(agentsPath), "utf8") : "";
|
|
52987
53132
|
} catch (e) {
|
|
52988
53133
|
notes.push(
|
|
52989
53134
|
`Left ${agentsPath} alone: could not read it (${e instanceof Error ? e.message : String(e)}).`
|
|
@@ -53051,7 +53196,7 @@ var installCodex = (deps2, folder, text3, written, notes) => {
|
|
|
53051
53196
|
written.push(agentsPath);
|
|
53052
53197
|
if (ourFile && !shared) {
|
|
53053
53198
|
try {
|
|
53054
|
-
|
|
53199
|
+
rmSync10(targetOf(filePath), { force: true });
|
|
53055
53200
|
try {
|
|
53056
53201
|
rmdirSync2(dirname12(filePath));
|
|
53057
53202
|
} catch {
|
|
@@ -53151,13 +53296,13 @@ var uninstallSkill = (deps2, harnesses = [
|
|
|
53151
53296
|
continue;
|
|
53152
53297
|
}
|
|
53153
53298
|
if (!st.isDirectory() || !lstatOk(file2)) continue;
|
|
53154
|
-
if (!isOurs(
|
|
53299
|
+
if (!isOurs(readFileSync22(targetOf(file2), "utf8"), entry)) {
|
|
53155
53300
|
notes.push(
|
|
53156
53301
|
`Left ${file2} alone: it is not an Open Artifacts skill file.`
|
|
53157
53302
|
);
|
|
53158
53303
|
continue;
|
|
53159
53304
|
}
|
|
53160
|
-
|
|
53305
|
+
rmSync10(targetOf(file2), { force: true });
|
|
53161
53306
|
try {
|
|
53162
53307
|
rmdirSync2(dir);
|
|
53163
53308
|
} catch {
|
|
@@ -53202,7 +53347,7 @@ var codexSkillState = (deps2) => {
|
|
|
53202
53347
|
}
|
|
53203
53348
|
try {
|
|
53204
53349
|
const agents = skillDir(deps2, "codex");
|
|
53205
|
-
if (withoutCodexBlock(
|
|
53350
|
+
if (withoutCodexBlock(readFileSync22(agents, "utf8")) !== void 0)
|
|
53206
53351
|
out.block = agents;
|
|
53207
53352
|
} catch {
|
|
53208
53353
|
}
|
|
@@ -53268,7 +53413,7 @@ var kind2 = (path) => {
|
|
|
53268
53413
|
var openclawManifestIsOurs = (dir) => {
|
|
53269
53414
|
try {
|
|
53270
53415
|
const m = JSON.parse(
|
|
53271
|
-
|
|
53416
|
+
readFileSync23(join24(dir, "openclaw.plugin.json"), "utf8")
|
|
53272
53417
|
);
|
|
53273
53418
|
return m?.id === OPENCLAW_PLUGIN_ID;
|
|
53274
53419
|
} catch {
|
|
@@ -53289,7 +53434,7 @@ function openclawPluginState(dir, shipped) {
|
|
|
53289
53434
|
if (k !== "dir") return "foreign";
|
|
53290
53435
|
let marker;
|
|
53291
53436
|
try {
|
|
53292
|
-
marker =
|
|
53437
|
+
marker = readFileSync23(join24(dir, OPENCLAW_MARKER), "utf8").trim();
|
|
53293
53438
|
} catch {
|
|
53294
53439
|
return sameAsShipped(dir, shipped) ? "stale" : "foreign";
|
|
53295
53440
|
}
|
|
@@ -53390,7 +53535,7 @@ async function installOpenclaw(deps2, notes, optedOut) {
|
|
|
53390
53535
|
);
|
|
53391
53536
|
const habitsFile = join24(dest, OPENCLAW_HABITS_MARKER);
|
|
53392
53537
|
const dropHabitsIfOptedOut = () => {
|
|
53393
|
-
if (optedOut && kind2(dest) === "dir")
|
|
53538
|
+
if (optedOut && kind2(dest) === "dir") rmSync11(habitsFile, { force: true });
|
|
53394
53539
|
};
|
|
53395
53540
|
if (state === "current") {
|
|
53396
53541
|
rememberInstall(deps2);
|
|
@@ -53426,7 +53571,7 @@ async function installOpenclaw(deps2, notes, optedOut) {
|
|
|
53426
53571
|
`
|
|
53427
53572
|
);
|
|
53428
53573
|
rememberInstall(deps2);
|
|
53429
|
-
|
|
53574
|
+
rmSync11(habitsFile, { force: true });
|
|
53430
53575
|
restore2();
|
|
53431
53576
|
}
|
|
53432
53577
|
const en = await exec2(deps2, ["plugins", "enable", OPENCLAW_PLUGIN_ID]);
|
|
@@ -53476,7 +53621,7 @@ async function uninstallOpenclaw(deps2, notes) {
|
|
|
53476
53621
|
`\`openclaw plugins uninstall ${OPENCLAW_PLUGIN_ID}\` failed (${why(r)}); left the plugin folder, rerun once OpenClaw works`
|
|
53477
53622
|
);
|
|
53478
53623
|
} else notes.push(OPENCLAW_NO_CLI);
|
|
53479
|
-
|
|
53624
|
+
rmSync11(dest, { recursive: true, force: true });
|
|
53480
53625
|
forgetInstall(deps2);
|
|
53481
53626
|
return "done";
|
|
53482
53627
|
}
|
|
@@ -53651,7 +53796,7 @@ function habitsFileState(deps2, h) {
|
|
|
53651
53796
|
try {
|
|
53652
53797
|
if (brokenLink(path)) return { state: "broken", path };
|
|
53653
53798
|
if (!existsSync8(path)) return { state: "absent", path };
|
|
53654
|
-
return { ...blockState(
|
|
53799
|
+
return { ...blockState(readFileSync24(targetOf(path), "utf8")), path };
|
|
53655
53800
|
} catch {
|
|
53656
53801
|
return { state: "broken", path };
|
|
53657
53802
|
}
|
|
@@ -53679,7 +53824,7 @@ function writeHabits(deps2, harnesses, opts = {}) {
|
|
|
53679
53824
|
const real3 = targetOf(path);
|
|
53680
53825
|
try {
|
|
53681
53826
|
const exists3 = existsSync8(real3);
|
|
53682
|
-
const before = exists3 ?
|
|
53827
|
+
const before = exists3 ? readFileSync24(real3, "utf8") : "";
|
|
53683
53828
|
const fresh = blockState(before).state === "absent";
|
|
53684
53829
|
const after = withHabits(before, habitsBlock());
|
|
53685
53830
|
if (after !== before) writeAtomic(real3, after);
|
|
@@ -53710,12 +53855,12 @@ function removeHabits(deps2, harnesses = HABITS_HARNESSES) {
|
|
|
53710
53855
|
try {
|
|
53711
53856
|
if (brokenLink(path) || !existsSync8(path)) continue;
|
|
53712
53857
|
const real3 = targetOf(path);
|
|
53713
|
-
const before =
|
|
53858
|
+
const before = readFileSync24(real3, "utf8");
|
|
53714
53859
|
if (blockState(before).state === "absent") continue;
|
|
53715
53860
|
const rec = kept[path];
|
|
53716
53861
|
const after = withHabits(before, null, rec?.added);
|
|
53717
53862
|
if (rec?.created && !isLink(path) && after.trim() === "")
|
|
53718
|
-
|
|
53863
|
+
rmSync12(real3, { force: true });
|
|
53719
53864
|
else writeAtomic(real3, after);
|
|
53720
53865
|
delete kept[path];
|
|
53721
53866
|
files2.push(path);
|
|
@@ -53748,7 +53893,7 @@ function habitsOn(deps2) {
|
|
|
53748
53893
|
seen2.add(path);
|
|
53749
53894
|
try {
|
|
53750
53895
|
if (brokenLink(path) || !existsSync8(path)) continue;
|
|
53751
|
-
const s = blockState(
|
|
53896
|
+
const s = blockState(readFileSync24(targetOf(path), "utf8")).state;
|
|
53752
53897
|
if (s === "current" || s === "changed") out.push(path);
|
|
53753
53898
|
} catch {
|
|
53754
53899
|
}
|
|
@@ -53893,7 +54038,7 @@ function setPluginHabits(deps2, plugins2, on) {
|
|
|
53893
54038
|
continue;
|
|
53894
54039
|
}
|
|
53895
54040
|
try {
|
|
53896
|
-
|
|
54041
|
+
rmSync12(marker, { force: true });
|
|
53897
54042
|
} catch (e) {
|
|
53898
54043
|
left(
|
|
53899
54044
|
`Could not remove ${marker} (${reason(e)}): ${p.label} habits are still on there. Delete it, then rerun.`
|
|
@@ -53957,7 +54102,7 @@ var habitsQuestionLines = (q) => [
|
|
|
53957
54102
|
];
|
|
53958
54103
|
|
|
53959
54104
|
// src/steps/opencode-proof.ts
|
|
53960
|
-
import { existsSync as existsSync9, readFileSync as
|
|
54105
|
+
import { existsSync as existsSync9, readFileSync as readFileSync25, rmSync as rmSync13 } from "node:fs";
|
|
53961
54106
|
import { dirname as dirname13, isAbsolute as isAbsolute12, join as join26, resolve as resolve9 } from "node:path";
|
|
53962
54107
|
init_src();
|
|
53963
54108
|
var OPENCODE_ENTRY_FILE = "opencode-mcp-entry.json";
|
|
@@ -54040,7 +54185,7 @@ function ourEntry2(e, origin) {
|
|
|
54040
54185
|
}
|
|
54041
54186
|
function readMoved2(path) {
|
|
54042
54187
|
try {
|
|
54043
|
-
const v = JSON.parse(
|
|
54188
|
+
const v = JSON.parse(readFileSync25(path, "utf8"));
|
|
54044
54189
|
if (isRecord5(v) && typeof v.file === "string" && Array.isArray(v.path) && typeof v.origin === "string" && isRecord5(v.config))
|
|
54045
54190
|
return v;
|
|
54046
54191
|
} catch {
|
|
@@ -54112,7 +54257,7 @@ var sameAt = (d, path, want) => {
|
|
|
54112
54257
|
function restoreEntry2(io) {
|
|
54113
54258
|
const m = readMoved2(io.moved);
|
|
54114
54259
|
if (!m) return false;
|
|
54115
|
-
let
|
|
54260
|
+
let put2 = false;
|
|
54116
54261
|
if (existsSync9(m.file)) {
|
|
54117
54262
|
const text3 = io.read(m.file);
|
|
54118
54263
|
const now = jsoncValue(text3, m.path);
|
|
@@ -54123,11 +54268,11 @@ function restoreEntry2(io) {
|
|
|
54123
54268
|
setJsoncValue(text3, m.path, m.config),
|
|
54124
54269
|
(d) => sameAt(d, m.path, m.config)
|
|
54125
54270
|
);
|
|
54126
|
-
|
|
54271
|
+
put2 = true;
|
|
54127
54272
|
}
|
|
54128
54273
|
}
|
|
54129
|
-
|
|
54130
|
-
return
|
|
54274
|
+
rmSync13(io.moved, { force: true });
|
|
54275
|
+
return put2;
|
|
54131
54276
|
}
|
|
54132
54277
|
function proxyProgramMissing2(entry, origin, which2) {
|
|
54133
54278
|
if (!Array.isArray(entry.command)) return void 0;
|
|
@@ -54149,7 +54294,7 @@ function proxyEntries(text3) {
|
|
|
54149
54294
|
}
|
|
54150
54295
|
|
|
54151
54296
|
// src/steps/pi-proof.ts
|
|
54152
|
-
import { existsSync as existsSync10, readFileSync as
|
|
54297
|
+
import { existsSync as existsSync10, readFileSync as readFileSync26, rmSync as rmSync14 } from "node:fs";
|
|
54153
54298
|
var PI_ENTRY_FILE = "pi-mcp-entry.json";
|
|
54154
54299
|
var OMP_ORIGIN_FILE = "omp-mcp-origin.json";
|
|
54155
54300
|
var PI_MIN_VERSION = "1.5.0";
|
|
@@ -54157,7 +54302,7 @@ var isRecord6 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
|
54157
54302
|
var BOM2 = "\uFEFF";
|
|
54158
54303
|
function readConfig2(file2) {
|
|
54159
54304
|
if (!existsSync10(file2)) return null;
|
|
54160
|
-
const raw =
|
|
54305
|
+
const raw = readFileSync26(file2, "utf8");
|
|
54161
54306
|
const bom = raw.startsWith(BOM2);
|
|
54162
54307
|
const text3 = bom ? raw.slice(1) : raw;
|
|
54163
54308
|
const parsed = JSON.parse(text3);
|
|
@@ -54191,7 +54336,7 @@ function findEntry2(servers4, origin) {
|
|
|
54191
54336
|
}
|
|
54192
54337
|
function readMoved3(path) {
|
|
54193
54338
|
try {
|
|
54194
|
-
const v = JSON.parse(
|
|
54339
|
+
const v = JSON.parse(readFileSync26(path, "utf8"));
|
|
54195
54340
|
if (isRecord6(v) && typeof v.name === "string" && typeof v.index === "number" && isRecord6(v.config))
|
|
54196
54341
|
return {
|
|
54197
54342
|
name: v.name,
|
|
@@ -54230,7 +54375,7 @@ function restoreEntry3(io) {
|
|
|
54230
54375
|
const m = readMoved3(io.moved);
|
|
54231
54376
|
if (!m) return false;
|
|
54232
54377
|
const c = readConfig2(io.file);
|
|
54233
|
-
let
|
|
54378
|
+
let put2 = false;
|
|
54234
54379
|
if (!c || c.servers[m.name] === void 0) {
|
|
54235
54380
|
const entries = Object.entries(c?.servers ?? {});
|
|
54236
54381
|
entries.splice(Math.min(Math.max(m.index, 0), entries.length), 0, [
|
|
@@ -54242,10 +54387,10 @@ function restoreEntry3(io) {
|
|
|
54242
54387
|
c ?? { parsed: {}, servers: {}, indent: " ", bom: false },
|
|
54243
54388
|
Object.fromEntries(entries)
|
|
54244
54389
|
);
|
|
54245
|
-
|
|
54390
|
+
put2 = true;
|
|
54246
54391
|
}
|
|
54247
|
-
|
|
54248
|
-
return
|
|
54392
|
+
rmSync14(io.moved, { force: true });
|
|
54393
|
+
return put2;
|
|
54249
54394
|
}
|
|
54250
54395
|
|
|
54251
54396
|
// src/steps/adapters.ts
|
|
@@ -54261,8 +54406,8 @@ var HARNESSES = [
|
|
|
54261
54406
|
"openclaw"
|
|
54262
54407
|
];
|
|
54263
54408
|
var readAssets = () => ({
|
|
54264
|
-
pi:
|
|
54265
|
-
opencodePlugin:
|
|
54409
|
+
pi: readFileSync27(PI_EXTENSION, "utf8"),
|
|
54410
|
+
opencodePlugin: readFileSync27(OPENCODE_TUI_PLUGIN, "utf8"),
|
|
54266
54411
|
// A folder, not text: the plugin is several Python files.
|
|
54267
54412
|
hermes: HERMES_PLUGIN,
|
|
54268
54413
|
// Built from packages/bus-adapter-openclaw (the CLI's bundle step does it).
|
|
@@ -54339,7 +54484,7 @@ var sharedFile = (deps2) => paths(deps2).omp === paths(deps2).pi;
|
|
|
54339
54484
|
function readDoc(path) {
|
|
54340
54485
|
let text3;
|
|
54341
54486
|
try {
|
|
54342
|
-
text3 =
|
|
54487
|
+
text3 = readFileSync27(path, "utf8");
|
|
54343
54488
|
} catch (e) {
|
|
54344
54489
|
if (e.code === "ENOENT") return {};
|
|
54345
54490
|
throw e;
|
|
@@ -54385,18 +54530,18 @@ function writeAtomic2(path, data, mode) {
|
|
|
54385
54530
|
}
|
|
54386
54531
|
const tmp = `${dest}.${process.pid}.${randomBytes6(4).toString("hex")}.tmp`;
|
|
54387
54532
|
try {
|
|
54388
|
-
|
|
54389
|
-
|
|
54390
|
-
|
|
54533
|
+
writeFileSync15(tmp, data, { mode: m, flag: "wx" });
|
|
54534
|
+
chmodSync16(tmp, m);
|
|
54535
|
+
renameSync17(tmp, dest);
|
|
54391
54536
|
} catch (e) {
|
|
54392
|
-
|
|
54537
|
+
rmSync15(tmp, { force: true });
|
|
54393
54538
|
throw e;
|
|
54394
54539
|
}
|
|
54395
54540
|
}
|
|
54396
54541
|
function readJsonc(path) {
|
|
54397
54542
|
let text3;
|
|
54398
54543
|
try {
|
|
54399
|
-
text3 =
|
|
54544
|
+
text3 = readFileSync27(path, "utf8");
|
|
54400
54545
|
} catch (e) {
|
|
54401
54546
|
if (e.code === "ENOENT") return "";
|
|
54402
54547
|
throw e;
|
|
@@ -54413,7 +54558,7 @@ function saveText(path, before, next, ok) {
|
|
|
54413
54558
|
}
|
|
54414
54559
|
function readRecord2(path) {
|
|
54415
54560
|
try {
|
|
54416
|
-
const v = JSON.parse(
|
|
54561
|
+
const v = JSON.parse(readFileSync27(path, "utf8"));
|
|
54417
54562
|
const c = v?.created;
|
|
54418
54563
|
if (typeof c === "object" && c !== null) return c;
|
|
54419
54564
|
} catch {
|
|
@@ -54424,7 +54569,7 @@ function writeRecord2(path, before, created) {
|
|
|
54424
54569
|
if (isDeepStrictEqual(before, created)) return;
|
|
54425
54570
|
let rest = {};
|
|
54426
54571
|
try {
|
|
54427
|
-
const v = JSON.parse(
|
|
54572
|
+
const v = JSON.parse(readFileSync27(path, "utf8"));
|
|
54428
54573
|
if (typeof v === "object" && v !== null && !Array.isArray(v))
|
|
54429
54574
|
rest = v;
|
|
54430
54575
|
} catch {
|
|
@@ -54701,7 +54846,7 @@ var install = {
|
|
|
54701
54846
|
const pluginText = withHome(deps2.assets.opencodePlugin, movedHome(deps2));
|
|
54702
54847
|
let pluginBefore;
|
|
54703
54848
|
try {
|
|
54704
|
-
pluginBefore =
|
|
54849
|
+
pluginBefore = readFileSync27(pluginFile, "utf8");
|
|
54705
54850
|
} catch {
|
|
54706
54851
|
}
|
|
54707
54852
|
const touched = { changed: pluginBefore !== pluginText };
|
|
@@ -54766,12 +54911,12 @@ var install = {
|
|
|
54766
54911
|
const pin = codexBinPin(bin);
|
|
54767
54912
|
let had = "";
|
|
54768
54913
|
try {
|
|
54769
|
-
had =
|
|
54914
|
+
had = readFileSync27(p.codexBin, "utf8");
|
|
54770
54915
|
} catch {
|
|
54771
54916
|
}
|
|
54772
54917
|
if (had !== pin) writeAtomic2(p.codexBin, pin, 384);
|
|
54773
54918
|
} else {
|
|
54774
|
-
|
|
54919
|
+
rmSync15(p.codexBin, { force: true });
|
|
54775
54920
|
notes.push(CODEX_NO_BIN);
|
|
54776
54921
|
}
|
|
54777
54922
|
await codexEntryStep(deps2, notes);
|
|
@@ -54851,7 +54996,7 @@ var uninstall = {
|
|
|
54851
54996
|
for (const { file: file2 } of edits) delete left[file2];
|
|
54852
54997
|
writeRecord2(p.record, record7, left);
|
|
54853
54998
|
const hadPlugin = existsSync11(p.opencodePlugin);
|
|
54854
|
-
|
|
54999
|
+
rmSync15(p.opencodePlugin, { recursive: true, force: true });
|
|
54855
55000
|
if (!saved.some(Boolean) && !hadPlugin && !restored) return "none";
|
|
54856
55001
|
if (deps2.which("opencode")) await restartOpencode(deps2, notes, true);
|
|
54857
55002
|
return saved.some(Boolean) || restored ? "done" : "folder";
|
|
@@ -54869,16 +55014,16 @@ var uninstall = {
|
|
|
54869
55014
|
}
|
|
54870
55015
|
const path = paths(deps2).pi;
|
|
54871
55016
|
if (!existsSync11(path)) return restored ? "done" : "none";
|
|
54872
|
-
|
|
55017
|
+
rmSync15(path, { force: true });
|
|
54873
55018
|
return "done";
|
|
54874
55019
|
},
|
|
54875
55020
|
async omp(deps2, _notes, done) {
|
|
54876
|
-
|
|
55021
|
+
rmSync15(paths(deps2).ompOrigin, { force: true });
|
|
54877
55022
|
if (sharedFile(deps2) && done.includes("pi")) return "done";
|
|
54878
55023
|
if (sharedFile(deps2) && existsSync11(paths(deps2).piEntry)) return "none";
|
|
54879
55024
|
const path = paths(deps2).omp;
|
|
54880
55025
|
if (!existsSync11(path)) return "none";
|
|
54881
|
-
|
|
55026
|
+
rmSync15(path, { force: true });
|
|
54882
55027
|
return "done";
|
|
54883
55028
|
},
|
|
54884
55029
|
async codex(deps2, notes) {
|
|
@@ -54901,7 +55046,7 @@ var uninstall = {
|
|
|
54901
55046
|
}
|
|
54902
55047
|
}
|
|
54903
55048
|
const pinned = present2(p.codexBin);
|
|
54904
|
-
|
|
55049
|
+
rmSync15(p.codexBin, { force: true });
|
|
54905
55050
|
return saved || pinned ? "done" : "none";
|
|
54906
55051
|
},
|
|
54907
55052
|
async hermes(deps2, notes) {
|
|
@@ -54973,7 +55118,7 @@ function opencodeProxyProblem(deps2) {
|
|
|
54973
55118
|
const p = paths(deps2);
|
|
54974
55119
|
for (const f of p.opencodeConfigs.filter(present2))
|
|
54975
55120
|
try {
|
|
54976
|
-
for (const { name, entry } of proxyEntries(
|
|
55121
|
+
for (const { name, entry } of proxyEntries(readFileSync27(f, "utf8"))) {
|
|
54977
55122
|
const missing2 = proxyProgramMissing2(entry, void 0, deps2.which);
|
|
54978
55123
|
if (missing2 !== void 0) return { name, missing: missing2 };
|
|
54979
55124
|
}
|
|
@@ -54993,7 +55138,7 @@ function checkAdapters(deps2) {
|
|
|
54993
55138
|
const homeOf = (env2) => typeof env2 === "object" && env2 !== null ? env2.OA_BUS_HOME : void 0;
|
|
54994
55139
|
const homed = (file2) => {
|
|
54995
55140
|
if (!existsSync11(file2)) return false;
|
|
54996
|
-
const first =
|
|
55141
|
+
const first = readFileSync27(file2, "utf8").split("\n", 1)[0] ?? "";
|
|
54997
55142
|
const ob = movedHome(deps2);
|
|
54998
55143
|
return ob === void 0 ? !first.startsWith("process.env.OA_BUS_HOME ||=") : first === homeLine(ob);
|
|
54999
55144
|
};
|
|
@@ -55009,11 +55154,11 @@ function checkAdapters(deps2) {
|
|
|
55009
55154
|
opencode: state(
|
|
55010
55155
|
"opencode",
|
|
55011
55156
|
() => p.opencodeConfigs.filter(present2).some((f) => {
|
|
55012
|
-
const d = parseJsonc(
|
|
55157
|
+
const d = parseJsonc(readFileSync27(f, "utf8"), f);
|
|
55013
55158
|
const e = servers3(d)?.[NAME] ?? d.mcp?.[NAME];
|
|
55014
55159
|
return e !== void 0 && homeOf(e.environment) === movedHome(deps2);
|
|
55015
55160
|
}) && listed(
|
|
55016
|
-
parseJsonc(
|
|
55161
|
+
parseJsonc(readFileSync27(p.opencodeCli, "utf8"), p.opencodeCli),
|
|
55017
55162
|
p.opencodePlugin
|
|
55018
55163
|
) && homed(join27(p.opencodePlugin, "tui.js"))
|
|
55019
55164
|
),
|
|
@@ -55063,15 +55208,15 @@ function codexProxyProblem(deps2) {
|
|
|
55063
55208
|
// src/steps/path-shim.ts
|
|
55064
55209
|
import {
|
|
55065
55210
|
accessSync as accessSync2,
|
|
55066
|
-
chmodSync as
|
|
55211
|
+
chmodSync as chmodSync17,
|
|
55067
55212
|
constants as constants5,
|
|
55068
55213
|
lstatSync as lstatSync16,
|
|
55069
55214
|
mkdirSync as mkdirSync13,
|
|
55070
|
-
readFileSync as
|
|
55215
|
+
readFileSync as readFileSync28,
|
|
55071
55216
|
readlinkSync as readlinkSync6,
|
|
55072
|
-
renameSync as
|
|
55073
|
-
rmSync as
|
|
55074
|
-
writeFileSync as
|
|
55217
|
+
renameSync as renameSync18,
|
|
55218
|
+
rmSync as rmSync16,
|
|
55219
|
+
writeFileSync as writeFileSync16
|
|
55075
55220
|
} from "node:fs";
|
|
55076
55221
|
import { delimiter as delimiter3, dirname as dirname15, join as join28, resolve as resolve11, sep as sep4 } from "node:path";
|
|
55077
55222
|
var SHIM_MARKER = "# oa-bus shim: written by oa-bus install";
|
|
@@ -55111,7 +55256,7 @@ function ownerOf(file2, busHome2) {
|
|
|
55111
55256
|
}
|
|
55112
55257
|
if (!st.isFile() || st.size > 4096) return { ours: false };
|
|
55113
55258
|
try {
|
|
55114
|
-
const lines =
|
|
55259
|
+
const lines = readFileSync28(file2, "utf8").split("\n");
|
|
55115
55260
|
if (lines[1] !== SHIM_MARKER) return { ours: false };
|
|
55116
55261
|
const h = lines[2]?.startsWith(HOME_PREFIX) ? lines[2].slice(HOME_PREFIX.length) : void 0;
|
|
55117
55262
|
return { ours: true, home: h };
|
|
@@ -55122,13 +55267,13 @@ function ownerOf(file2, busHome2) {
|
|
|
55122
55267
|
var sameHome = (owner, busHome2) => owner?.ours === true && (owner.home === void 0 || owner.home === resolve11(busHome2));
|
|
55123
55268
|
function writeShim(path, text3) {
|
|
55124
55269
|
const tmp = `${path}.${process.pid}.tmp`;
|
|
55125
|
-
|
|
55270
|
+
rmSync16(tmp, { force: true });
|
|
55126
55271
|
try {
|
|
55127
|
-
|
|
55128
|
-
|
|
55129
|
-
|
|
55272
|
+
writeFileSync16(tmp, text3, { mode: 493, flag: "wx" });
|
|
55273
|
+
chmodSync17(tmp, 493);
|
|
55274
|
+
renameSync18(tmp, path);
|
|
55130
55275
|
} catch (e) {
|
|
55131
|
-
|
|
55276
|
+
rmSync16(tmp, { force: true });
|
|
55132
55277
|
throw e;
|
|
55133
55278
|
}
|
|
55134
55279
|
}
|
|
@@ -55166,7 +55311,7 @@ function removeShim(o) {
|
|
|
55166
55311
|
const owner = ownerOf(file2, o.busHome);
|
|
55167
55312
|
if (!owner?.ours) continue;
|
|
55168
55313
|
if (owner.home !== void 0 && owner.home !== resolve11(o.busHome)) continue;
|
|
55169
|
-
|
|
55314
|
+
rmSync16(file2, { force: true });
|
|
55170
55315
|
removed = file2;
|
|
55171
55316
|
}
|
|
55172
55317
|
return removed;
|
|
@@ -55243,12 +55388,37 @@ function useBusCmd(ctx) {
|
|
|
55243
55388
|
ctx.copy = copyFor(ctx, cmd);
|
|
55244
55389
|
}
|
|
55245
55390
|
|
|
55391
|
+
// src/commands/auto-update.ts
|
|
55392
|
+
async function autoUpdate(opts, ctx) {
|
|
55393
|
+
const c = ctx.copy;
|
|
55394
|
+
if (opts.sub === "off") {
|
|
55395
|
+
setOff(ctx.home, true);
|
|
55396
|
+
say(ctx, c.autoUpdateOff());
|
|
55397
|
+
return 0;
|
|
55398
|
+
}
|
|
55399
|
+
if (opts.sub === "on") {
|
|
55400
|
+
setOff(ctx.home, false);
|
|
55401
|
+
say(ctx, c.autoUpdateOn());
|
|
55402
|
+
return 0;
|
|
55403
|
+
}
|
|
55404
|
+
const s = readPolicy(ctx.home);
|
|
55405
|
+
if (!s.introShown && !s.unreadable) {
|
|
55406
|
+
say(ctx, c.autoUpdateIntro());
|
|
55407
|
+
setIntroShown(ctx.home);
|
|
55408
|
+
}
|
|
55409
|
+
say(
|
|
55410
|
+
ctx,
|
|
55411
|
+
s.off ? c.autoUpdateStatusOff() : c.autoUpdateLabel(label(s, ctx.now()))
|
|
55412
|
+
);
|
|
55413
|
+
return 0;
|
|
55414
|
+
}
|
|
55415
|
+
|
|
55246
55416
|
// src/commands/daemon.ts
|
|
55247
55417
|
import { existsSync as existsSync12 } from "node:fs";
|
|
55248
55418
|
import { join as join30 } from "node:path";
|
|
55249
55419
|
|
|
55250
55420
|
// src/machine.ts
|
|
55251
|
-
import { readFileSync as
|
|
55421
|
+
import { readFileSync as readFileSync29, statSync as statSync10 } from "node:fs";
|
|
55252
55422
|
import { join as join29 } from "node:path";
|
|
55253
55423
|
init_src();
|
|
55254
55424
|
function readMachine(home2) {
|
|
@@ -55257,7 +55427,7 @@ function readMachine(home2) {
|
|
|
55257
55427
|
let mode;
|
|
55258
55428
|
try {
|
|
55259
55429
|
mode = statSync10(file2).mode;
|
|
55260
|
-
text3 =
|
|
55430
|
+
text3 = readFileSync29(file2, "utf8");
|
|
55261
55431
|
} catch (e) {
|
|
55262
55432
|
return e.code === "ENOENT" ? { state: "missing" } : { state: "bad" };
|
|
55263
55433
|
}
|
|
@@ -55326,20 +55496,20 @@ async function daemon(ctx, run5 = runDaemon, signals = process) {
|
|
|
55326
55496
|
}
|
|
55327
55497
|
|
|
55328
55498
|
// src/commands/doctor.ts
|
|
55329
|
-
import { readFileSync as
|
|
55499
|
+
import { readFileSync as readFileSync33 } from "node:fs";
|
|
55330
55500
|
import { join as join37 } from "node:path";
|
|
55331
55501
|
|
|
55332
55502
|
// src/steps/claude-plugins.ts
|
|
55333
|
-
import { readFileSync as
|
|
55503
|
+
import { readFileSync as readFileSync31 } from "node:fs";
|
|
55334
55504
|
import { join as join32 } from "node:path";
|
|
55335
55505
|
|
|
55336
55506
|
// src/steps/output-style.ts
|
|
55337
55507
|
import {
|
|
55338
55508
|
lstatSync as lstatSync17,
|
|
55339
55509
|
readdirSync as readdirSync11,
|
|
55340
|
-
readFileSync as
|
|
55510
|
+
readFileSync as readFileSync30,
|
|
55341
55511
|
rmdirSync as rmdirSync3,
|
|
55342
|
-
rmSync as
|
|
55512
|
+
rmSync as rmSync17
|
|
55343
55513
|
} from "node:fs";
|
|
55344
55514
|
import { dirname as dirname16, join as join31 } from "node:path";
|
|
55345
55515
|
var OUTPUT_STYLE_FILE = "artifacts-teammate.md";
|
|
@@ -55379,7 +55549,7 @@ var readSettings = (path) => {
|
|
|
55379
55549
|
if (isLink2(path)) return { ok: false, why: "it is a symlink" };
|
|
55380
55550
|
if (!exists(path)) return { ok: true, text: void 0, style: void 0 };
|
|
55381
55551
|
try {
|
|
55382
|
-
const text3 =
|
|
55552
|
+
const text3 = readFileSync30(path, "utf8");
|
|
55383
55553
|
parseJsonc(text3, path);
|
|
55384
55554
|
return { ok: true, text: text3, style: jsoncValue(text3, ["outputStyle"]) };
|
|
55385
55555
|
} catch {
|
|
@@ -55440,8 +55610,8 @@ function selectOutputStyle(deps2) {
|
|
|
55440
55610
|
);
|
|
55441
55611
|
} else {
|
|
55442
55612
|
try {
|
|
55443
|
-
if (exists(path) && isOurs2(
|
|
55444
|
-
|
|
55613
|
+
if (exists(path) && isOurs2(readFileSync30(path, "utf8"))) {
|
|
55614
|
+
rmSync17(path);
|
|
55445
55615
|
removed = true;
|
|
55446
55616
|
if (readdirSync11(dir).length === 0) rmdirSync3(dir);
|
|
55447
55617
|
} else if (exists(path)) {
|
|
@@ -55490,7 +55660,7 @@ function turnOff(deps2, out) {
|
|
|
55490
55660
|
const was = rec?.set ? rec.before : void 0;
|
|
55491
55661
|
const next = was?.state === "null" ? setJsoncValue(cur.text, ["outputStyle"], null) : was?.state === "empty" ? setJsoncValue(cur.text, ["outputStyle"], was.value) : removeJsoncValue(cur.text, ["outputStyle"]);
|
|
55492
55662
|
if (rec?.set && rec.createdFile && (cur.text === createdText() || cur.text === createdText(OUTPUT_STYLE_NAME)))
|
|
55493
|
-
|
|
55663
|
+
rmSync17(path);
|
|
55494
55664
|
else writeAtomic(path, next);
|
|
55495
55665
|
}
|
|
55496
55666
|
if (busHome2 && rec) writeRecord3(busHome2, void 0);
|
|
@@ -55512,12 +55682,12 @@ function uninstallOutputStyle(deps2) {
|
|
|
55512
55682
|
);
|
|
55513
55683
|
} else if (!exists(path)) {
|
|
55514
55684
|
gone = true;
|
|
55515
|
-
} else if (!isOurs2(
|
|
55685
|
+
} else if (!isOurs2(readFileSync30(path, "utf8"))) {
|
|
55516
55686
|
out.notes.push(
|
|
55517
55687
|
`Left ${path} alone: it has no Open Artifacts marker, so it is not ours to replace.`
|
|
55518
55688
|
);
|
|
55519
55689
|
} else {
|
|
55520
|
-
|
|
55690
|
+
rmSync17(path);
|
|
55521
55691
|
out.written.push(path);
|
|
55522
55692
|
gone = true;
|
|
55523
55693
|
if (readdirSync11(dir).length === 0) rmdirSync3(dir);
|
|
@@ -55553,7 +55723,7 @@ var outputStyleState = (deps2) => {
|
|
|
55553
55723
|
const path = outputStyleFile(deps2);
|
|
55554
55724
|
try {
|
|
55555
55725
|
if (isLink2(dirname16(path)) || isLink2(path)) return void 0;
|
|
55556
|
-
if (!isOurs2(
|
|
55726
|
+
if (!isOurs2(readFileSync30(path, "utf8"))) return void 0;
|
|
55557
55727
|
const s = readSettings(claudeSettingsFile(deps2));
|
|
55558
55728
|
return { path, on: s.ok && s.style === OUTPUT_STYLE_NAME };
|
|
55559
55729
|
} catch {
|
|
@@ -56022,7 +56192,7 @@ async function claudePluginsState(deps2) {
|
|
|
56022
56192
|
}
|
|
56023
56193
|
function readShortcutOptions(deps2) {
|
|
56024
56194
|
try {
|
|
56025
|
-
const text3 =
|
|
56195
|
+
const text3 = readFileSync31(claudeSettingsFile(deps2), "utf8");
|
|
56026
56196
|
const o = JSON.parse(text3);
|
|
56027
56197
|
const opts = o.pluginConfigs?.[SHORTCUTS_PLUGIN]?.options;
|
|
56028
56198
|
const str3 = (v) => typeof v === "string" && v ? v : void 0;
|
|
@@ -56270,12 +56440,12 @@ function habitsLine(ctx) {
|
|
|
56270
56440
|
init_src();
|
|
56271
56441
|
import { randomBytes as randomBytes7 } from "node:crypto";
|
|
56272
56442
|
import {
|
|
56273
|
-
chmodSync as
|
|
56443
|
+
chmodSync as chmodSync18,
|
|
56274
56444
|
closeSync as closeSync8,
|
|
56275
56445
|
mkdirSync as mkdirSync14,
|
|
56276
56446
|
openSync as openSync8,
|
|
56277
|
-
renameSync as
|
|
56278
|
-
rmSync as
|
|
56447
|
+
renameSync as renameSync19,
|
|
56448
|
+
rmSync as rmSync18,
|
|
56279
56449
|
unlinkSync as unlinkSync3,
|
|
56280
56450
|
writeSync as writeSync3
|
|
56281
56451
|
} from "node:fs";
|
|
@@ -56326,7 +56496,7 @@ function checkVerificationUri(uri, hub) {
|
|
|
56326
56496
|
}
|
|
56327
56497
|
function writeMachineFile(home2, body) {
|
|
56328
56498
|
mkdirSync14(home2, { recursive: true, mode: 448 });
|
|
56329
|
-
|
|
56499
|
+
chmodSync18(home2, 448);
|
|
56330
56500
|
const tmp = join34(home2, `.machine.json.${randomBytes7(8).toString("hex")}.tmp`);
|
|
56331
56501
|
const fd = openSync8(tmp, "wx", 384);
|
|
56332
56502
|
try {
|
|
@@ -56338,8 +56508,8 @@ function writeMachineFile(home2, body) {
|
|
|
56338
56508
|
}
|
|
56339
56509
|
closeSync8(fd);
|
|
56340
56510
|
try {
|
|
56341
|
-
|
|
56342
|
-
|
|
56511
|
+
chmodSync18(tmp, 384);
|
|
56512
|
+
renameSync19(tmp, join34(home2, "machine.json"));
|
|
56343
56513
|
} catch (e) {
|
|
56344
56514
|
unlinkSync3(tmp);
|
|
56345
56515
|
throw e;
|
|
@@ -56351,10 +56521,10 @@ var post = (hub, fetch2, path, body, signal) => fetch2(`${hub}${path}`, {
|
|
|
56351
56521
|
body: JSON.stringify(body),
|
|
56352
56522
|
...signal ? { signal } : {}
|
|
56353
56523
|
});
|
|
56354
|
-
async function requestCode(args, hub,
|
|
56524
|
+
async function requestCode(args, hub, label2) {
|
|
56355
56525
|
const waits = args.codeRetryMs ?? [];
|
|
56356
56526
|
const total = waits.length + 1;
|
|
56357
|
-
const body = DeviceCodeRequestSchema.parse({ machine_label:
|
|
56527
|
+
const body = DeviceCodeRequestSchema.parse({ machine_label: label2 });
|
|
56358
56528
|
for (let attempt2 = 1; ; attempt2++) {
|
|
56359
56529
|
let error62;
|
|
56360
56530
|
try {
|
|
@@ -56385,13 +56555,13 @@ async function requestCode(args, hub, label) {
|
|
|
56385
56555
|
async function login(args) {
|
|
56386
56556
|
const print = args.print ?? realDeps.print;
|
|
56387
56557
|
const hub = normalizeHub(args.hub);
|
|
56388
|
-
const
|
|
56558
|
+
const label2 = newMachineLabel(
|
|
56389
56559
|
args.label ?? await defaultMachineLabel({
|
|
56390
56560
|
exec: args.exec ?? realDeps.exec,
|
|
56391
56561
|
platform: args.platform
|
|
56392
56562
|
})
|
|
56393
56563
|
);
|
|
56394
|
-
const codeRes = await requestCode(args, hub,
|
|
56564
|
+
const codeRes = await requestCode(args, hub, label2);
|
|
56395
56565
|
if (!codeRes.ok) {
|
|
56396
56566
|
throw new Error(
|
|
56397
56567
|
`bus/device failed: ${codeRes.status} ${(await codeRes.text()).slice(0, 200)}`
|
|
@@ -56463,14 +56633,14 @@ async function login(args) {
|
|
|
56463
56633
|
case "approved": {
|
|
56464
56634
|
writeMachineFile(
|
|
56465
56635
|
args.home,
|
|
56466
|
-
`${JSON.stringify({ hub, label, machine_token: poll.machine_token }, null, 2)}
|
|
56636
|
+
`${JSON.stringify({ hub, label: label2, machine_token: poll.machine_token }, null, 2)}
|
|
56467
56637
|
`
|
|
56468
56638
|
);
|
|
56469
|
-
|
|
56470
|
-
if (!events?.code) print(`Approved this machine as ${
|
|
56639
|
+
rmSync18(join34(args.home, "revoked"), { force: true });
|
|
56640
|
+
if (!events?.code) print(`Approved this machine as ${label2}.`);
|
|
56471
56641
|
return {
|
|
56472
56642
|
machineToken: poll.machine_token,
|
|
56473
|
-
label,
|
|
56643
|
+
label: label2,
|
|
56474
56644
|
hub,
|
|
56475
56645
|
home: args.home
|
|
56476
56646
|
};
|
|
@@ -56543,9 +56713,9 @@ function spinner(ctx) {
|
|
|
56543
56713
|
import {
|
|
56544
56714
|
lstatSync as lstatSync18,
|
|
56545
56715
|
readdirSync as readdirSync12,
|
|
56546
|
-
readFileSync as
|
|
56716
|
+
readFileSync as readFileSync32,
|
|
56547
56717
|
rmdirSync as rmdirSync4,
|
|
56548
|
-
rmSync as
|
|
56718
|
+
rmSync as rmSync19
|
|
56549
56719
|
} from "node:fs";
|
|
56550
56720
|
import { join as join35 } from "node:path";
|
|
56551
56721
|
function leftoverTargets(deps2) {
|
|
@@ -56611,7 +56781,7 @@ function emptyFile(path) {
|
|
|
56611
56781
|
const st = lstatSync18(path);
|
|
56612
56782
|
if (!st.isFile()) return false;
|
|
56613
56783
|
if (st.size === 0) return true;
|
|
56614
|
-
const doc = JSON.parse(
|
|
56784
|
+
const doc = JSON.parse(readFileSync32(path, "utf8"));
|
|
56615
56785
|
return typeof doc === "object" && doc !== null && !Array.isArray(doc) && Object.keys(doc).length === 0;
|
|
56616
56786
|
} catch {
|
|
56617
56787
|
return false;
|
|
@@ -56622,7 +56792,7 @@ function removeMade(made) {
|
|
|
56622
56792
|
const gone = [];
|
|
56623
56793
|
for (const path of made) {
|
|
56624
56794
|
if (!emptyFile(path)) continue;
|
|
56625
|
-
|
|
56795
|
+
rmSync19(path, { force: true });
|
|
56626
56796
|
gone.push(path);
|
|
56627
56797
|
}
|
|
56628
56798
|
for (const path of made.filter((x) => !gone.includes(x)).sort((a, b) => b.length - a.length)) {
|
|
@@ -57293,7 +57463,7 @@ async function healthz(ctx, hub) {
|
|
|
57293
57463
|
function claudeIsolates(path) {
|
|
57294
57464
|
let text3;
|
|
57295
57465
|
try {
|
|
57296
|
-
text3 =
|
|
57466
|
+
text3 = readFileSync33(path, "utf8");
|
|
57297
57467
|
} catch {
|
|
57298
57468
|
return void 0;
|
|
57299
57469
|
}
|
|
@@ -57609,12 +57779,12 @@ async function global(opts, ctx) {
|
|
|
57609
57779
|
}
|
|
57610
57780
|
|
|
57611
57781
|
// src/commands/leads.ts
|
|
57612
|
-
import { readFileSync as
|
|
57782
|
+
import { readFileSync as readFileSync34 } from "node:fs";
|
|
57613
57783
|
import { join as join38 } from "node:path";
|
|
57614
57784
|
function hubOrigin(ctx) {
|
|
57615
57785
|
try {
|
|
57616
57786
|
const raw = JSON.parse(
|
|
57617
|
-
|
|
57787
|
+
readFileSync34(join38(ctx.home, "machine.json"), "utf8")
|
|
57618
57788
|
);
|
|
57619
57789
|
return typeof raw?.hub === "string" ? new URL(raw.hub).origin : void 0;
|
|
57620
57790
|
} catch {
|
|
@@ -57773,7 +57943,7 @@ import {
|
|
|
57773
57943
|
fstatSync as fstatSync5,
|
|
57774
57944
|
lstatSync as lstatSync19,
|
|
57775
57945
|
openSync as openSync9,
|
|
57776
|
-
readFileSync as
|
|
57946
|
+
readFileSync as readFileSync35
|
|
57777
57947
|
} from "node:fs";
|
|
57778
57948
|
import { dirname as dirname18, join as join39 } from "node:path";
|
|
57779
57949
|
var TAIL = 50;
|
|
@@ -57812,7 +57982,7 @@ var tail = (path, dir) => {
|
|
|
57812
57982
|
const after = lstatSync19(dirname18(path));
|
|
57813
57983
|
if (after.isSymbolicLink() || after.dev !== dir.dev || after.ino !== dir.ino)
|
|
57814
57984
|
return "skipped";
|
|
57815
|
-
return
|
|
57985
|
+
return readFileSync35(fd, "utf8").replace(/\n$/, "").split("\n").slice(-TAIL);
|
|
57816
57986
|
} catch (e) {
|
|
57817
57987
|
return e.code === "ELOOP" ? "skipped" : void 0;
|
|
57818
57988
|
} finally {
|
|
@@ -57851,12 +58021,12 @@ var MCP_SERVER = {
|
|
|
57851
58021
|
opencode: () => init_main2().then(() => main_exports2),
|
|
57852
58022
|
codex: () => init_codex_main().then(() => codex_main_exports)
|
|
57853
58023
|
};
|
|
57854
|
-
async function mcp(harness, ctx,
|
|
58024
|
+
async function mcp(harness, ctx, load2 = (h) => MCP_SERVER[h]()) {
|
|
57855
58025
|
if (harness === "pi") {
|
|
57856
58026
|
say(ctx, ctx.copy.mcpPi());
|
|
57857
58027
|
return 1;
|
|
57858
58028
|
}
|
|
57859
|
-
await
|
|
58029
|
+
await load2(harness);
|
|
57860
58030
|
return void 0;
|
|
57861
58031
|
}
|
|
57862
58032
|
|
|
@@ -57866,7 +58036,7 @@ init_src2();
|
|
|
57866
58036
|
init_src();
|
|
57867
58037
|
import { execFileSync as execFileSync7 } from "node:child_process";
|
|
57868
58038
|
import { createHash as createHash9, randomBytes as randomBytes8 } from "node:crypto";
|
|
57869
|
-
import { readFileSync as
|
|
58039
|
+
import { readFileSync as readFileSync36, readlinkSync as readlinkSync7 } from "node:fs";
|
|
57870
58040
|
import { basename as basename8 } from "node:path";
|
|
57871
58041
|
var isClaude = (name) => name === "claude" || /\/claude\/versions\/[^/]+$/.test(name);
|
|
57872
58042
|
function parsePs(out) {
|
|
@@ -57877,14 +58047,14 @@ function parsePs(out) {
|
|
|
57877
58047
|
}
|
|
57878
58048
|
function readProc(pid) {
|
|
57879
58049
|
try {
|
|
57880
|
-
const stat =
|
|
58050
|
+
const stat = readFileSync36(`/proc/${pid}/stat`, "utf8");
|
|
57881
58051
|
const ppid = Number(stat.slice(stat.lastIndexOf(")") + 1).split(/\s+/)[2]);
|
|
57882
58052
|
let exe = "";
|
|
57883
58053
|
try {
|
|
57884
58054
|
exe = readlinkSync7(`/proc/${pid}/exe`);
|
|
57885
58055
|
} catch {
|
|
57886
58056
|
}
|
|
57887
|
-
const comm =
|
|
58057
|
+
const comm = readFileSync36(`/proc/${pid}/comm`, "utf8").trim();
|
|
57888
58058
|
return { ppid, name: isClaude(exe) ? exe : comm };
|
|
57889
58059
|
} catch {
|
|
57890
58060
|
}
|
|
@@ -57912,7 +58082,7 @@ function findClaude(from, proc) {
|
|
|
57912
58082
|
function tokenOf(file2) {
|
|
57913
58083
|
if (!file2) return void 0;
|
|
57914
58084
|
try {
|
|
57915
|
-
return
|
|
58085
|
+
return readFileSync36(file2, "utf8").trim() || void 0;
|
|
57916
58086
|
} catch {
|
|
57917
58087
|
return void 0;
|
|
57918
58088
|
}
|
|
@@ -58073,7 +58243,7 @@ import { join as join42 } from "node:path";
|
|
|
58073
58243
|
|
|
58074
58244
|
// src/steps/purge.ts
|
|
58075
58245
|
init_src3();
|
|
58076
|
-
import { lstatSync as lstatSync20, readdirSync as readdirSync13, rmdirSync as rmdirSync5, rmSync as
|
|
58246
|
+
import { lstatSync as lstatSync20, readdirSync as readdirSync13, rmdirSync as rmdirSync5, rmSync as rmSync20 } from "node:fs";
|
|
58077
58247
|
import { join as join41 } from "node:path";
|
|
58078
58248
|
var FILES = [
|
|
58079
58249
|
"machine.json",
|
|
@@ -58121,7 +58291,7 @@ function kind3(path) {
|
|
|
58121
58291
|
return void 0;
|
|
58122
58292
|
}
|
|
58123
58293
|
}
|
|
58124
|
-
var remove2 = (path, k) =>
|
|
58294
|
+
var remove2 = (path, k) => rmSync20(path, { recursive: k === "dir", force: true });
|
|
58125
58295
|
var rmdirIfEmpty = (path) => {
|
|
58126
58296
|
try {
|
|
58127
58297
|
rmdirSync5(path);
|
|
@@ -58353,12 +58523,14 @@ var COMMANDS = /* @__PURE__ */ new Set([
|
|
|
58353
58523
|
"link",
|
|
58354
58524
|
"unlink",
|
|
58355
58525
|
"leads",
|
|
58526
|
+
"auto-update",
|
|
58356
58527
|
"version"
|
|
58357
58528
|
]);
|
|
58358
58529
|
var HARNESSES2 = ["claude", "opencode", "codex", "pi"];
|
|
58359
58530
|
var GLOBAL_USAGE = `usage: ${BUS_CMD} global <add|rm> <dir>, or global list`;
|
|
58360
58531
|
var LINK_USAGE = `usage: ${BUS_CMD} link <dir> <dir>, ${BUS_CMD} unlink <dir> <dir>, or link list`;
|
|
58361
58532
|
var LEADS_USAGE = `usage: ${BUS_CMD} leads check [name]`;
|
|
58533
|
+
var AUTO_UPDATE_USAGE = `usage: ${BUS_CMD} auto-update <off|on|status>`;
|
|
58362
58534
|
var NAMESPACE_USAGE = `usage: ${BUS_CMD} namespace approve [dir], namespace revoke <dir>, or namespace list`;
|
|
58363
58535
|
var COMMON = /* @__PURE__ */ new Set(["no-color", "version", "home"]);
|
|
58364
58536
|
var FLAGS = {
|
|
@@ -58435,13 +58607,19 @@ function parse7(argv) {
|
|
|
58435
58607
|
if (rest[2] !== void 0)
|
|
58436
58608
|
throw new Error(`unexpected argument: ${rest[2]}`);
|
|
58437
58609
|
}
|
|
58610
|
+
if (cmd === "auto-update") {
|
|
58611
|
+
if (!["off", "on", "status"].includes(rest[0] ?? ""))
|
|
58612
|
+
throw new Error(AUTO_UPDATE_USAGE);
|
|
58613
|
+
if (rest[1] !== void 0)
|
|
58614
|
+
throw new Error(`unexpected argument: ${rest[1]}`);
|
|
58615
|
+
}
|
|
58438
58616
|
if (cmd === "link" || cmd === "unlink") {
|
|
58439
58617
|
const n = cmd === "link" && rest[0] === "list" ? 1 : 2;
|
|
58440
58618
|
if (rest.length < n) throw new Error(LINK_USAGE);
|
|
58441
58619
|
if (rest[n] !== void 0)
|
|
58442
58620
|
throw new Error(`unexpected argument: ${rest[n]}`);
|
|
58443
58621
|
}
|
|
58444
|
-
const extra = cmd === "namespace" || cmd === "link" || cmd === "unlink" || cmd === "leads" ? void 0 : rest[takes];
|
|
58622
|
+
const extra = cmd === "namespace" || cmd === "link" || cmd === "unlink" || cmd === "leads" || cmd === "auto-update" ? void 0 : rest[takes];
|
|
58445
58623
|
if (extra !== void 0) throw new Error(`unexpected argument: ${extra}`);
|
|
58446
58624
|
for (const name of ["home", "instance"])
|
|
58447
58625
|
if (values[name] === "") throw new Error(`--${name} needs a value`);
|
|
@@ -58508,6 +58686,8 @@ function route(cmd, values, positionals) {
|
|
|
58508
58686
|
const name = positionals[1];
|
|
58509
58687
|
return { cmd, sub: "check", ...name ? { name } : {} };
|
|
58510
58688
|
}
|
|
58689
|
+
case "auto-update":
|
|
58690
|
+
return { cmd, sub: positionals[0] };
|
|
58511
58691
|
case "link":
|
|
58512
58692
|
case "unlink": {
|
|
58513
58693
|
if (cmd === "link" && positionals[0] === "list")
|
|
@@ -58562,6 +58742,7 @@ var TERMINAL = /* @__PURE__ */ new Set([
|
|
|
58562
58742
|
"namespace",
|
|
58563
58743
|
"link",
|
|
58564
58744
|
"leads",
|
|
58745
|
+
"auto-update",
|
|
58565
58746
|
"version",
|
|
58566
58747
|
"help"
|
|
58567
58748
|
]);
|
|
@@ -58659,6 +58840,8 @@ async function dispatch(cmd, ctx) {
|
|
|
58659
58840
|
return namespace(cmd, ctx);
|
|
58660
58841
|
case "leads":
|
|
58661
58842
|
return leads(cmd, ctx);
|
|
58843
|
+
case "auto-update":
|
|
58844
|
+
return autoUpdate(cmd, ctx);
|
|
58662
58845
|
case "link":
|
|
58663
58846
|
return link(cmd, ctx);
|
|
58664
58847
|
case "version":
|