@open-artifacts/bus 0.147.0 → 0.149.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/assets/output-styles/artifacts-teammate.md +47 -0
- package/dist/index.js +688 -202
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1533,8 +1533,8 @@ var init_regexes = __esm({
|
|
|
1533
1533
|
_emoji = `^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;
|
|
1534
1534
|
ipv4 = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
|
|
1535
1535
|
ipv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;
|
|
1536
|
-
mac = (
|
|
1537
|
-
const escapedDelim = escapeRegex(
|
|
1536
|
+
mac = (delimiter3) => {
|
|
1537
|
+
const escapedDelim = escapeRegex(delimiter3 ?? ":");
|
|
1538
1538
|
return new RegExp(`^(?:[0-9A-F]{2}${escapedDelim}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${escapedDelim}){5}[0-9a-f]{2}$`);
|
|
1539
1539
|
};
|
|
1540
1540
|
cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/;
|
|
@@ -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, resolve16) {
|
|
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, resolve15) {
|
|
|
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, resolve16);
|
|
4600
4600
|
if (answer > result)
|
|
4601
4601
|
result = answer;
|
|
4602
4602
|
}
|
|
@@ -4607,7 +4607,7 @@ function isRecursive(inst, stack, resolve15) {
|
|
|
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, resolve16) : NONE;
|
|
4611
4611
|
if (child > answer)
|
|
4612
4612
|
answer = child;
|
|
4613
4613
|
}
|
|
@@ -4671,7 +4671,7 @@ function isRecursive(inst, stack, resolve15) {
|
|
|
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 ?? (resolve16 ? 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((resolve16) => setTimeout(resolve16, 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((resolve16, 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
|
+
resolve16(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((resolve16, 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(resolve16, interval);
|
|
23404
23404
|
signal.addEventListener("abort", () => {
|
|
23405
23405
|
clearTimeout(timeoutId);
|
|
23406
23406
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
@@ -23853,11 +23853,11 @@ var require_codegen = __commonJS({
|
|
|
23853
23853
|
const rhs = this.rhs === void 0 ? "" : ` = ${this.rhs}`;
|
|
23854
23854
|
return `${varKind} ${this.name}${rhs};` + _n;
|
|
23855
23855
|
}
|
|
23856
|
-
optimizeNames(names2,
|
|
23856
|
+
optimizeNames(names2, constants5) {
|
|
23857
23857
|
if (!names2[this.name.str])
|
|
23858
23858
|
return;
|
|
23859
23859
|
if (this.rhs)
|
|
23860
|
-
this.rhs = optimizeExpr(this.rhs, names2,
|
|
23860
|
+
this.rhs = optimizeExpr(this.rhs, names2, constants5);
|
|
23861
23861
|
return this;
|
|
23862
23862
|
}
|
|
23863
23863
|
get names() {
|
|
@@ -23874,10 +23874,10 @@ var require_codegen = __commonJS({
|
|
|
23874
23874
|
render({ _n }) {
|
|
23875
23875
|
return `${this.lhs} = ${this.rhs};` + _n;
|
|
23876
23876
|
}
|
|
23877
|
-
optimizeNames(names2,
|
|
23877
|
+
optimizeNames(names2, constants5) {
|
|
23878
23878
|
if (this.lhs instanceof code_1.Name && !names2[this.lhs.str] && !this.sideEffects)
|
|
23879
23879
|
return;
|
|
23880
|
-
this.rhs = optimizeExpr(this.rhs, names2,
|
|
23880
|
+
this.rhs = optimizeExpr(this.rhs, names2, constants5);
|
|
23881
23881
|
return this;
|
|
23882
23882
|
}
|
|
23883
23883
|
get names() {
|
|
@@ -23938,8 +23938,8 @@ var require_codegen = __commonJS({
|
|
|
23938
23938
|
optimizeNodes() {
|
|
23939
23939
|
return `${this.code}` ? this : void 0;
|
|
23940
23940
|
}
|
|
23941
|
-
optimizeNames(names2,
|
|
23942
|
-
this.code = optimizeExpr(this.code, names2,
|
|
23941
|
+
optimizeNames(names2, constants5) {
|
|
23942
|
+
this.code = optimizeExpr(this.code, names2, constants5);
|
|
23943
23943
|
return this;
|
|
23944
23944
|
}
|
|
23945
23945
|
get names() {
|
|
@@ -23968,12 +23968,12 @@ var require_codegen = __commonJS({
|
|
|
23968
23968
|
}
|
|
23969
23969
|
return nodes.length > 0 ? this : void 0;
|
|
23970
23970
|
}
|
|
23971
|
-
optimizeNames(names2,
|
|
23971
|
+
optimizeNames(names2, constants5) {
|
|
23972
23972
|
const { nodes } = this;
|
|
23973
23973
|
let i = nodes.length;
|
|
23974
23974
|
while (i--) {
|
|
23975
23975
|
const n = nodes[i];
|
|
23976
|
-
if (n.optimizeNames(names2,
|
|
23976
|
+
if (n.optimizeNames(names2, constants5))
|
|
23977
23977
|
continue;
|
|
23978
23978
|
subtractNames(names2, n.names);
|
|
23979
23979
|
nodes.splice(i, 1);
|
|
@@ -24026,12 +24026,12 @@ var require_codegen = __commonJS({
|
|
|
24026
24026
|
return void 0;
|
|
24027
24027
|
return this;
|
|
24028
24028
|
}
|
|
24029
|
-
optimizeNames(names2,
|
|
24029
|
+
optimizeNames(names2, constants5) {
|
|
24030
24030
|
var _a3;
|
|
24031
|
-
this.else = (_a3 = this.else) === null || _a3 === void 0 ? void 0 : _a3.optimizeNames(names2,
|
|
24032
|
-
if (!(super.optimizeNames(names2,
|
|
24031
|
+
this.else = (_a3 = this.else) === null || _a3 === void 0 ? void 0 : _a3.optimizeNames(names2, constants5);
|
|
24032
|
+
if (!(super.optimizeNames(names2, constants5) || this.else))
|
|
24033
24033
|
return;
|
|
24034
|
-
this.condition = optimizeExpr(this.condition, names2,
|
|
24034
|
+
this.condition = optimizeExpr(this.condition, names2, constants5);
|
|
24035
24035
|
return this;
|
|
24036
24036
|
}
|
|
24037
24037
|
get names() {
|
|
@@ -24054,10 +24054,10 @@ var require_codegen = __commonJS({
|
|
|
24054
24054
|
render(opts) {
|
|
24055
24055
|
return `for(${this.iteration})` + super.render(opts);
|
|
24056
24056
|
}
|
|
24057
|
-
optimizeNames(names2,
|
|
24058
|
-
if (!super.optimizeNames(names2,
|
|
24057
|
+
optimizeNames(names2, constants5) {
|
|
24058
|
+
if (!super.optimizeNames(names2, constants5))
|
|
24059
24059
|
return;
|
|
24060
|
-
this.iteration = optimizeExpr(this.iteration, names2,
|
|
24060
|
+
this.iteration = optimizeExpr(this.iteration, names2, constants5);
|
|
24061
24061
|
return this;
|
|
24062
24062
|
}
|
|
24063
24063
|
get names() {
|
|
@@ -24093,10 +24093,10 @@ var require_codegen = __commonJS({
|
|
|
24093
24093
|
render(opts) {
|
|
24094
24094
|
return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(opts);
|
|
24095
24095
|
}
|
|
24096
|
-
optimizeNames(names2,
|
|
24097
|
-
if (!super.optimizeNames(names2,
|
|
24096
|
+
optimizeNames(names2, constants5) {
|
|
24097
|
+
if (!super.optimizeNames(names2, constants5))
|
|
24098
24098
|
return;
|
|
24099
|
-
this.iterable = optimizeExpr(this.iterable, names2,
|
|
24099
|
+
this.iterable = optimizeExpr(this.iterable, names2, constants5);
|
|
24100
24100
|
return this;
|
|
24101
24101
|
}
|
|
24102
24102
|
get names() {
|
|
@@ -24138,11 +24138,11 @@ var require_codegen = __commonJS({
|
|
|
24138
24138
|
(_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNodes();
|
|
24139
24139
|
return this;
|
|
24140
24140
|
}
|
|
24141
|
-
optimizeNames(names2,
|
|
24141
|
+
optimizeNames(names2, constants5) {
|
|
24142
24142
|
var _a3, _b;
|
|
24143
|
-
super.optimizeNames(names2,
|
|
24144
|
-
(_a3 = this.catch) === null || _a3 === void 0 ? void 0 : _a3.optimizeNames(names2,
|
|
24145
|
-
(_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names2,
|
|
24143
|
+
super.optimizeNames(names2, constants5);
|
|
24144
|
+
(_a3 = this.catch) === null || _a3 === void 0 ? void 0 : _a3.optimizeNames(names2, constants5);
|
|
24145
|
+
(_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names2, constants5);
|
|
24146
24146
|
return this;
|
|
24147
24147
|
}
|
|
24148
24148
|
get names() {
|
|
@@ -24443,7 +24443,7 @@ var require_codegen = __commonJS({
|
|
|
24443
24443
|
function addExprNames(names2, from) {
|
|
24444
24444
|
return from instanceof code_1._CodeOrName ? addNames(names2, from.names) : names2;
|
|
24445
24445
|
}
|
|
24446
|
-
function optimizeExpr(expr, names2,
|
|
24446
|
+
function optimizeExpr(expr, names2, constants5) {
|
|
24447
24447
|
if (expr instanceof code_1.Name)
|
|
24448
24448
|
return replaceName(expr);
|
|
24449
24449
|
if (!canOptimize(expr))
|
|
@@ -24458,14 +24458,14 @@ var require_codegen = __commonJS({
|
|
|
24458
24458
|
return items;
|
|
24459
24459
|
}, []));
|
|
24460
24460
|
function replaceName(n) {
|
|
24461
|
-
const c =
|
|
24461
|
+
const c = constants5[n.str];
|
|
24462
24462
|
if (c === void 0 || names2[n.str] !== 1)
|
|
24463
24463
|
return n;
|
|
24464
24464
|
delete names2[n.str];
|
|
24465
24465
|
return c;
|
|
24466
24466
|
}
|
|
24467
24467
|
function canOptimize(e) {
|
|
24468
|
-
return e instanceof code_1._Code && e._items.some((c) => c instanceof code_1.Name && names2[c.str] === 1 &&
|
|
24468
|
+
return e instanceof code_1._Code && e._items.some((c) => c instanceof code_1.Name && names2[c.str] === 1 && constants5[c.str] !== void 0);
|
|
24469
24469
|
}
|
|
24470
24470
|
}
|
|
24471
24471
|
function subtractNames(names2, from) {
|
|
@@ -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 = resolve16.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 resolve16(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 resolve16(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: resolve16,
|
|
27657
27657
|
resolveComponent,
|
|
27658
27658
|
equal,
|
|
27659
27659
|
serialize,
|
|
@@ -32649,7 +32649,7 @@ var init_frames = __esm({
|
|
|
32649
32649
|
late = { late: external_exports.array(external_exports.string().min(1)).optional() };
|
|
32650
32650
|
isWellFormed2 = (s) => s.isWellFormed();
|
|
32651
32651
|
WELL_FORMED = { message: "text is not well-formed unicode" };
|
|
32652
|
-
CLIENT_VERSION = true ? "0.
|
|
32652
|
+
CLIENT_VERSION = true ? "0.149.0" : "0.0.0";
|
|
32653
32653
|
clientVersion = {
|
|
32654
32654
|
client_version: external_exports.string().min(1).max(64).optional()
|
|
32655
32655
|
};
|
|
@@ -33117,8 +33117,8 @@ import { connect } from "node:net";
|
|
|
33117
33117
|
async function connectDaemon(opts) {
|
|
33118
33118
|
const sock = connect(opts.path);
|
|
33119
33119
|
if (opts.unref) sock.unref();
|
|
33120
|
-
await new Promise((
|
|
33121
|
-
sock.once("connect",
|
|
33120
|
+
await new Promise((resolve16, reject) => {
|
|
33121
|
+
sock.once("connect", resolve16);
|
|
33122
33122
|
sock.once("error", reject);
|
|
33123
33123
|
});
|
|
33124
33124
|
const decoder = new LineDecoder();
|
|
@@ -33185,8 +33185,8 @@ async function connectDaemon(opts) {
|
|
|
33185
33185
|
sock.on("error", (e) => failAll(e));
|
|
33186
33186
|
sock.on("close", () => failAll(new Error("daemon connection closed")));
|
|
33187
33187
|
let timer;
|
|
33188
|
-
const welcomeRaw = await new Promise((
|
|
33189
|
-
waiters.push({ resolve:
|
|
33188
|
+
const welcomeRaw = await new Promise((resolve16, reject) => {
|
|
33189
|
+
waiters.push({ resolve: resolve16, reject });
|
|
33190
33190
|
timer = setTimeout(() => {
|
|
33191
33191
|
reject(new Error("daemon did not answer hello"));
|
|
33192
33192
|
sock.destroy();
|
|
@@ -33208,7 +33208,7 @@ async function connectDaemon(opts) {
|
|
|
33208
33208
|
if (state === "closed")
|
|
33209
33209
|
return Promise.reject(new Error("daemon connection closed"));
|
|
33210
33210
|
const id = partial2.id ?? String(++seq2);
|
|
33211
|
-
return new Promise((
|
|
33211
|
+
return new Promise((resolve16, reject) => {
|
|
33212
33212
|
const ms = opts.requestTimeoutMs ?? 2e4;
|
|
33213
33213
|
const timer2 = setTimeout(() => {
|
|
33214
33214
|
if (pending.delete(id)) {
|
|
@@ -33225,7 +33225,7 @@ async function connectDaemon(opts) {
|
|
|
33225
33225
|
clearTimeout(timer2);
|
|
33226
33226
|
f(...a);
|
|
33227
33227
|
};
|
|
33228
|
-
pending.set(id, { resolve: done(
|
|
33228
|
+
pending.set(id, { resolve: done(resolve16), reject: done(reject) });
|
|
33229
33229
|
holdWhilePending();
|
|
33230
33230
|
sock.write(`${JSON.stringify({ v: 1, ...partial2, id })}
|
|
33231
33231
|
`);
|
|
@@ -33250,7 +33250,7 @@ async function connectDaemon(opts) {
|
|
|
33250
33250
|
};
|
|
33251
33251
|
}
|
|
33252
33252
|
function daemonStatus(opts) {
|
|
33253
|
-
return new Promise((
|
|
33253
|
+
return new Promise((resolve16, reject) => {
|
|
33254
33254
|
const sock = connect(opts.path);
|
|
33255
33255
|
const decoder = new LineDecoder();
|
|
33256
33256
|
const done = (f) => {
|
|
@@ -33287,7 +33287,7 @@ function daemonStatus(opts) {
|
|
|
33287
33287
|
try {
|
|
33288
33288
|
for (const raw of decoder.push(chunk)) {
|
|
33289
33289
|
const f = DaemonFrame.parse(raw);
|
|
33290
|
-
if (f.type === "status") return done(() =>
|
|
33290
|
+
if (f.type === "status") return done(() => resolve16(f));
|
|
33291
33291
|
if (f.type === "error")
|
|
33292
33292
|
return done(
|
|
33293
33293
|
() => reject(
|
|
@@ -33306,7 +33306,7 @@ function daemonStatus(opts) {
|
|
|
33306
33306
|
});
|
|
33307
33307
|
}
|
|
33308
33308
|
function daemonLinkProof(opts) {
|
|
33309
|
-
return new Promise((
|
|
33309
|
+
return new Promise((resolve16, reject) => {
|
|
33310
33310
|
const sock = connect(opts.path);
|
|
33311
33311
|
const decoder = new LineDecoder();
|
|
33312
33312
|
const done = (f) => {
|
|
@@ -33334,7 +33334,7 @@ function daemonLinkProof(opts) {
|
|
|
33334
33334
|
try {
|
|
33335
33335
|
for (const raw of decoder.push(chunk)) {
|
|
33336
33336
|
const f = DaemonFrame.parse(raw);
|
|
33337
|
-
if (f.type === "link_proofed") return done(() =>
|
|
33337
|
+
if (f.type === "link_proofed") return done(() => resolve16(f.bound));
|
|
33338
33338
|
if (f.type === "error")
|
|
33339
33339
|
return done(() => reject(new Error(f.message)));
|
|
33340
33340
|
}
|
|
@@ -33716,13 +33716,13 @@ async function clearStale(path) {
|
|
|
33716
33716
|
code: "ENOTSOCK"
|
|
33717
33717
|
});
|
|
33718
33718
|
}
|
|
33719
|
-
const live = await new Promise((
|
|
33719
|
+
const live = await new Promise((resolve16) => {
|
|
33720
33720
|
const probe2 = connect2(path);
|
|
33721
33721
|
probe2.once("connect", () => {
|
|
33722
33722
|
probe2.destroy();
|
|
33723
|
-
|
|
33723
|
+
resolve16(true);
|
|
33724
33724
|
});
|
|
33725
|
-
probe2.once("error", () =>
|
|
33725
|
+
probe2.once("error", () => resolve16(false));
|
|
33726
33726
|
});
|
|
33727
33727
|
if (live) {
|
|
33728
33728
|
throw Object.assign(new Error(`daemon already listening on ${path}`), {
|
|
@@ -33742,16 +33742,16 @@ async function serveDaemon(opts) {
|
|
|
33742
33742
|
sock.once("close", () => sockets.delete(sock));
|
|
33743
33743
|
handle(sock, opts);
|
|
33744
33744
|
});
|
|
33745
|
-
await new Promise((
|
|
33745
|
+
await new Promise((resolve16, reject) => {
|
|
33746
33746
|
server4.once("error", reject);
|
|
33747
|
-
server4.listen(opts.path, () =>
|
|
33747
|
+
server4.listen(opts.path, () => resolve16());
|
|
33748
33748
|
});
|
|
33749
33749
|
chmodSync(opts.path, 384);
|
|
33750
33750
|
const st = statSync(opts.path);
|
|
33751
33751
|
const mode = st.mode & 511;
|
|
33752
33752
|
return {
|
|
33753
33753
|
mode,
|
|
33754
|
-
close: () => new Promise((
|
|
33754
|
+
close: () => new Promise((resolve16) => {
|
|
33755
33755
|
for (const s of sockets) s.destroy();
|
|
33756
33756
|
let parked;
|
|
33757
33757
|
try {
|
|
@@ -33769,7 +33769,7 @@ async function serveDaemon(opts) {
|
|
|
33769
33769
|
} catch {
|
|
33770
33770
|
}
|
|
33771
33771
|
}
|
|
33772
|
-
|
|
33772
|
+
resolve16();
|
|
33773
33773
|
});
|
|
33774
33774
|
})
|
|
33775
33775
|
};
|
|
@@ -33981,10 +33981,10 @@ var init_server3 = __esm({
|
|
|
33981
33981
|
|
|
33982
33982
|
// ../bus-ipc/src/sysbin.ts
|
|
33983
33983
|
import { existsSync } from "node:fs";
|
|
33984
|
-
function systemTool(name,
|
|
33984
|
+
function systemTool(name, exists2 = existsSync) {
|
|
33985
33985
|
const hit = found.get(name);
|
|
33986
33986
|
if (hit) return hit;
|
|
33987
|
-
const path = SYSTEM_DIRS.map((d) => `${d}/${name}`).find(
|
|
33987
|
+
const path = SYSTEM_DIRS.map((d) => `${d}/${name}`).find(exists2);
|
|
33988
33988
|
if (path) found.set(name, path);
|
|
33989
33989
|
return path ?? name;
|
|
33990
33990
|
}
|
|
@@ -34766,7 +34766,7 @@ ${neutralize(a.text)}
|
|
|
34766
34766
|
};
|
|
34767
34767
|
}
|
|
34768
34768
|
function inject(a) {
|
|
34769
|
-
return new Promise((
|
|
34769
|
+
return new Promise((resolve16, reject) => {
|
|
34770
34770
|
const sock = connect3(a.socketPath);
|
|
34771
34771
|
let connected = false;
|
|
34772
34772
|
const fail2 = (e) => {
|
|
@@ -34790,7 +34790,7 @@ function inject(a) {
|
|
|
34790
34790
|
sock.once("finish", () => {
|
|
34791
34791
|
clearTimeout(timer);
|
|
34792
34792
|
sock.destroy();
|
|
34793
|
-
|
|
34793
|
+
resolve16();
|
|
34794
34794
|
});
|
|
34795
34795
|
sock.end(`${JSON.stringify(frameOf(a))}
|
|
34796
34796
|
`);
|
|
@@ -38930,12 +38930,12 @@ var init_stdio2 = __esm({
|
|
|
38930
38930
|
this.onclose?.();
|
|
38931
38931
|
}
|
|
38932
38932
|
send(message) {
|
|
38933
|
-
return new Promise((
|
|
38933
|
+
return new Promise((resolve16) => {
|
|
38934
38934
|
const json3 = serializeMessage(message);
|
|
38935
38935
|
if (this._stdout.write(json3)) {
|
|
38936
|
-
|
|
38936
|
+
resolve16();
|
|
38937
38937
|
} else {
|
|
38938
|
-
this._stdout.once("drain",
|
|
38938
|
+
this._stdout.once("drain", resolve16);
|
|
38939
38939
|
}
|
|
38940
38940
|
});
|
|
38941
38941
|
}
|
|
@@ -38945,7 +38945,7 @@ var init_stdio2 = __esm({
|
|
|
38945
38945
|
|
|
38946
38946
|
// ../bus-adapter-claude-code/src/main.ts
|
|
38947
38947
|
var main_exports = {};
|
|
38948
|
-
import { existsSync as
|
|
38948
|
+
import { existsSync as existsSync14 } from "node:fs";
|
|
38949
38949
|
var SESSIONS, HOME, SOCKET, connect4, server, underClaude;
|
|
38950
38950
|
var init_main = __esm({
|
|
38951
38951
|
async "../bus-adapter-claude-code/src/main.ts"() {
|
|
@@ -38969,7 +38969,7 @@ var init_main = __esm({
|
|
|
38969
38969
|
}),
|
|
38970
38970
|
// A short socket folder another user could reach is never dialed.
|
|
38971
38971
|
socketDirProblem: () => socketDirProblem(HOME),
|
|
38972
|
-
socketExists: () =>
|
|
38972
|
+
socketExists: () => existsSync14(SOCKET),
|
|
38973
38973
|
connect: (session) => connectDaemon({
|
|
38974
38974
|
path: SOCKET,
|
|
38975
38975
|
hello: sessionHello(session, process.pid, process.cwd())
|
|
@@ -39192,13 +39192,13 @@ __export(codex_proxy_main_exports, {
|
|
|
39192
39192
|
readTokenFile: () => readTokenFile,
|
|
39193
39193
|
startCodexProxy: () => startCodexProxy
|
|
39194
39194
|
});
|
|
39195
|
-
import { readFileSync as
|
|
39195
|
+
import { readFileSync as readFileSync30 } from "node:fs";
|
|
39196
39196
|
import { homedir as homedir4 } from "node:os";
|
|
39197
39197
|
function readTokenFile(path) {
|
|
39198
39198
|
if (!path) return void 0;
|
|
39199
39199
|
try {
|
|
39200
39200
|
const p = path.startsWith("~/") ? `${homedir4()}${path.slice(1)}` : path;
|
|
39201
|
-
return
|
|
39201
|
+
return readFileSync30(p, "utf8").trim() || void 0;
|
|
39202
39202
|
} catch {
|
|
39203
39203
|
return void 0;
|
|
39204
39204
|
}
|
|
@@ -39248,13 +39248,13 @@ __export(proxy_main_exports, {
|
|
|
39248
39248
|
readTokenFile: () => readTokenFile2,
|
|
39249
39249
|
startProxy: () => startProxy
|
|
39250
39250
|
});
|
|
39251
|
-
import { readFileSync as
|
|
39251
|
+
import { readFileSync as readFileSync31 } from "node:fs";
|
|
39252
39252
|
import { homedir as homedir5 } from "node:os";
|
|
39253
39253
|
function readTokenFile2(path) {
|
|
39254
39254
|
if (!path) return void 0;
|
|
39255
39255
|
try {
|
|
39256
39256
|
const p = path.startsWith("~/") ? `${homedir5()}${path.slice(1)}` : path;
|
|
39257
|
-
return
|
|
39257
|
+
return readFileSync31(p, "utf8").trim() || void 0;
|
|
39258
39258
|
} catch {
|
|
39259
39259
|
return void 0;
|
|
39260
39260
|
}
|
|
@@ -39342,7 +39342,7 @@ var harnessSkills = {
|
|
|
39342
39342
|
var harnessNames = Object.keys(harnessSkills);
|
|
39343
39343
|
|
|
39344
39344
|
// src/main.ts
|
|
39345
|
-
import { resolve as
|
|
39345
|
+
import { resolve as resolve15 } from "node:path";
|
|
39346
39346
|
|
|
39347
39347
|
// src/commands/daemon.ts
|
|
39348
39348
|
import { existsSync as existsSync5 } from "node:fs";
|
|
@@ -39393,6 +39393,8 @@ init_src2();
|
|
|
39393
39393
|
init_src();
|
|
39394
39394
|
|
|
39395
39395
|
// ../bus-daemon/src/agents.ts
|
|
39396
|
+
var LINK_HASHES_MAX = 4;
|
|
39397
|
+
var withLinkHash = (list, hash2) => [...(list ?? []).filter((h) => h !== hash2), hash2].slice(-LINK_HASHES_MAX);
|
|
39396
39398
|
var AgentTable = class {
|
|
39397
39399
|
#byRef = /* @__PURE__ */ new Map();
|
|
39398
39400
|
up(rec) {
|
|
@@ -43006,12 +43008,12 @@ var Receipts = class {
|
|
|
43006
43008
|
this.#waiting.delete(msgId);
|
|
43007
43009
|
return Promise.resolve(w.final);
|
|
43008
43010
|
}
|
|
43009
|
-
return new Promise((
|
|
43011
|
+
return new Promise((resolve16) => {
|
|
43010
43012
|
const cancel = this.#after(ms, () => w.done?.(void 0));
|
|
43011
43013
|
w.done = (f) => {
|
|
43012
43014
|
cancel();
|
|
43013
43015
|
this.#waiting.delete(msgId);
|
|
43014
|
-
|
|
43016
|
+
resolve16(f);
|
|
43015
43017
|
};
|
|
43016
43018
|
});
|
|
43017
43019
|
}
|
|
@@ -43328,22 +43330,22 @@ var ClaudeTransport = class {
|
|
|
43328
43330
|
return { ok: false, reason: "closed", cause: st };
|
|
43329
43331
|
}
|
|
43330
43332
|
#waitFor(msgId, ms) {
|
|
43331
|
-
return new Promise((
|
|
43333
|
+
return new Promise((resolve16) => {
|
|
43332
43334
|
const buffered = this.#buffered.get(msgId);
|
|
43333
43335
|
if (buffered !== void 0) {
|
|
43334
43336
|
this.#buffered.delete(msgId);
|
|
43335
|
-
|
|
43337
|
+
resolve16(buffered);
|
|
43336
43338
|
return;
|
|
43337
43339
|
}
|
|
43338
43340
|
const timer = setTimeout(() => {
|
|
43339
43341
|
this.#waiting.delete(msgId);
|
|
43340
|
-
|
|
43342
|
+
resolve16(void 0);
|
|
43341
43343
|
}, ms);
|
|
43342
43344
|
timer.unref();
|
|
43343
43345
|
this.#waiting.set(msgId, (s) => {
|
|
43344
43346
|
clearTimeout(timer);
|
|
43345
43347
|
this.#waiting.delete(msgId);
|
|
43346
|
-
|
|
43348
|
+
resolve16(s);
|
|
43347
43349
|
});
|
|
43348
43350
|
});
|
|
43349
43351
|
}
|
|
@@ -43493,9 +43495,9 @@ var ClaudeTransport = class {
|
|
|
43493
43495
|
);
|
|
43494
43496
|
})
|
|
43495
43497
|
};
|
|
43496
|
-
await new Promise((
|
|
43498
|
+
await new Promise((resolve16, reject) => {
|
|
43497
43499
|
sink.server.once("error", reject);
|
|
43498
|
-
sink.server.listen(path, () =>
|
|
43500
|
+
sink.server.listen(path, () => resolve16());
|
|
43499
43501
|
});
|
|
43500
43502
|
chmodSync8(path, 384);
|
|
43501
43503
|
return sink;
|
|
@@ -43714,7 +43716,7 @@ function splitArgv0(args) {
|
|
|
43714
43716
|
});
|
|
43715
43717
|
return words(args.slice(real3 ?? ends[0]));
|
|
43716
43718
|
}
|
|
43717
|
-
var execText = (cmd, args) => new Promise((
|
|
43719
|
+
var execText = (cmd, args) => new Promise((resolve16) => {
|
|
43718
43720
|
execFile(
|
|
43719
43721
|
cmd,
|
|
43720
43722
|
args,
|
|
@@ -43723,7 +43725,7 @@ var execText = (cmd, args) => new Promise((resolve15) => {
|
|
|
43723
43725
|
timeout: 2e3,
|
|
43724
43726
|
env: { ...process.env, LC_ALL: "C" }
|
|
43725
43727
|
},
|
|
43726
|
-
(err, stdout) =>
|
|
43728
|
+
(err, stdout) => resolve16(err ? void 0 : stdout)
|
|
43727
43729
|
);
|
|
43728
43730
|
});
|
|
43729
43731
|
async function processArgs(pid) {
|
|
@@ -43746,17 +43748,17 @@ async function processArgs(pid) {
|
|
|
43746
43748
|
return args ? splitArgv0(args) : void 0;
|
|
43747
43749
|
}
|
|
43748
43750
|
var START_ERRORS = /* @__PURE__ */ new Set(["ENOENT", "EACCES", "ENOEXEC"]);
|
|
43749
|
-
var execCodex = (timeoutMs = CODEX_QUEUE_TIMEOUT_MS) => (bin, args, env2) => new Promise((
|
|
43751
|
+
var execCodex = (timeoutMs = CODEX_QUEUE_TIMEOUT_MS) => (bin, args, env2) => new Promise((resolve16, reject) => {
|
|
43750
43752
|
execFile(
|
|
43751
43753
|
bin,
|
|
43752
43754
|
args,
|
|
43753
43755
|
{ timeout: timeoutMs, maxBuffer: 64 * 1024, env: env2 },
|
|
43754
43756
|
(err, _stdout, stderr) => {
|
|
43755
|
-
if (!err) return
|
|
43757
|
+
if (!err) return resolve16({ code: 0, stderr });
|
|
43756
43758
|
const e = err;
|
|
43757
43759
|
if (typeof e.code === "string" && START_ERRORS.has(e.code))
|
|
43758
43760
|
return reject(err);
|
|
43759
|
-
|
|
43761
|
+
resolve16({
|
|
43760
43762
|
// A maxBuffer kill is SIGTERM too, but carries its own string code.
|
|
43761
43763
|
code: e.killed && e.signal === "SIGTERM" && typeof e.code !== "string" ? null : typeof e.code === "number" ? e.code : -1,
|
|
43762
43764
|
stderr: String(stderr ?? "")
|
|
@@ -43881,17 +43883,17 @@ var codexHostWakes = async (pid) => {
|
|
|
43881
43883
|
init_src2();
|
|
43882
43884
|
import { execFile as execFile2 } from "node:child_process";
|
|
43883
43885
|
var START_ERRORS2 = /* @__PURE__ */ new Set(["ENOENT", "EACCES"]);
|
|
43884
|
-
var execSpawn = (timeoutMs, maxBuffer = 1024 * 1024) => (cmd, args) => new Promise((
|
|
43886
|
+
var execSpawn = (timeoutMs, maxBuffer = 1024 * 1024) => (cmd, args) => new Promise((resolve16, reject) => {
|
|
43885
43887
|
execFile2(
|
|
43886
43888
|
cmd,
|
|
43887
43889
|
args,
|
|
43888
43890
|
{ timeout: timeoutMs, maxBuffer },
|
|
43889
43891
|
(err, stdout, stderr) => {
|
|
43890
|
-
if (!err) return
|
|
43892
|
+
if (!err) return resolve16({ code: 0, stdout, stderr });
|
|
43891
43893
|
const e = err;
|
|
43892
43894
|
if (typeof e.code === "string" && START_ERRORS2.has(e.code))
|
|
43893
43895
|
return reject(err);
|
|
43894
|
-
|
|
43896
|
+
resolve16({
|
|
43895
43897
|
code: e.killed || typeof e.code !== "number" ? null : e.code,
|
|
43896
43898
|
stdout,
|
|
43897
43899
|
stderr
|
|
@@ -44008,18 +44010,18 @@ var PiTransport = class {
|
|
|
44008
44010
|
});
|
|
44009
44011
|
if (!pushed) return { ok: false, reason: "closed" };
|
|
44010
44012
|
this.#forget(mail.msg_id);
|
|
44011
|
-
return new Promise((
|
|
44013
|
+
return new Promise((resolve16) => {
|
|
44012
44014
|
const timer = setTimeout(() => {
|
|
44013
44015
|
this.#waiting.delete(mail.msg_id);
|
|
44014
44016
|
this.#remember(mail.msg_id, agent.ref);
|
|
44015
|
-
|
|
44017
|
+
resolve16({ ok: false, reason: "timeout" });
|
|
44016
44018
|
}, this.opts.ackTimeoutMs ?? 1e4);
|
|
44017
44019
|
timer.unref();
|
|
44018
44020
|
this.#waiting.set(mail.msg_id, {
|
|
44019
44021
|
ref: agent.ref,
|
|
44020
44022
|
done: (o) => {
|
|
44021
44023
|
clearTimeout(timer);
|
|
44022
|
-
|
|
44024
|
+
resolve16(o);
|
|
44023
44025
|
}
|
|
44024
44026
|
});
|
|
44025
44027
|
});
|
|
@@ -44301,15 +44303,16 @@ async function runDaemon(deps2 = {}) {
|
|
|
44301
44303
|
if (sent2) rec.sentName = rec.proposedName;
|
|
44302
44304
|
return sent2;
|
|
44303
44305
|
};
|
|
44304
|
-
const sendLink = (rec) => {
|
|
44305
|
-
if (!hubLink || !rec.live
|
|
44306
|
-
|
|
44307
|
-
|
|
44308
|
-
|
|
44309
|
-
|
|
44310
|
-
|
|
44311
|
-
|
|
44312
|
-
|
|
44306
|
+
const sendLink = (rec, only) => {
|
|
44307
|
+
if (!hubLink || !rec.live) return;
|
|
44308
|
+
for (const hash2 of only === void 0 ? rec.linkHashes ?? [] : [only])
|
|
44309
|
+
hub.send({
|
|
44310
|
+
v: 1,
|
|
44311
|
+
id: frameId(),
|
|
44312
|
+
type: "link_bind",
|
|
44313
|
+
agent_ref: rec.ref,
|
|
44314
|
+
hash: hash2
|
|
44315
|
+
});
|
|
44313
44316
|
};
|
|
44314
44317
|
const markLimited = (ref, message) => {
|
|
44315
44318
|
if (!limited.has(ref))
|
|
@@ -44652,8 +44655,8 @@ async function runDaemon(deps2 = {}) {
|
|
|
44652
44655
|
const p = pendingProofs.get(rec.pid);
|
|
44653
44656
|
if (!p || p.procStart !== rec.procStart) continue;
|
|
44654
44657
|
pendingProofs.delete(rec.pid);
|
|
44655
|
-
rec.
|
|
44656
|
-
sendLink(rec);
|
|
44658
|
+
rec.linkHashes = withLinkHash(rec.linkHashes, p.hash);
|
|
44659
|
+
sendLink(rec, p.hash);
|
|
44657
44660
|
}
|
|
44658
44661
|
};
|
|
44659
44662
|
const renameCodexThreads = () => {
|
|
@@ -44710,7 +44713,7 @@ async function runDaemon(deps2 = {}) {
|
|
|
44710
44713
|
pid: s.pid,
|
|
44711
44714
|
procStart: s.procStart,
|
|
44712
44715
|
// The same process keeps its proof across /clear; agent_ok rebinds it.
|
|
44713
|
-
...old?.
|
|
44716
|
+
...old?.linkHashes !== void 0 ? { linkHashes: old.linkHashes } : {},
|
|
44714
44717
|
sessionName: s.name,
|
|
44715
44718
|
cwd: s.cwd,
|
|
44716
44719
|
live: true
|
|
@@ -44970,21 +44973,21 @@ async function runDaemon(deps2 = {}) {
|
|
|
44970
44973
|
statusEveryMs: deps2.status?.statusEveryMs
|
|
44971
44974
|
});
|
|
44972
44975
|
const hubRoster = (ref) => new Promise(
|
|
44973
|
-
(
|
|
44976
|
+
(resolve16) => {
|
|
44974
44977
|
const id = pending.open(
|
|
44975
44978
|
"status",
|
|
44976
|
-
(f) =>
|
|
44979
|
+
(f) => resolve16(f.type === "roster" ? f.agents : void 0)
|
|
44977
44980
|
);
|
|
44978
44981
|
const timer = setTimeout(() => {
|
|
44979
44982
|
pending.cancel(id);
|
|
44980
44983
|
hub.cancel(id);
|
|
44981
|
-
|
|
44984
|
+
resolve16(void 0);
|
|
44982
44985
|
}, deps2.statusRosterMs ?? 1500);
|
|
44983
44986
|
timer.unref();
|
|
44984
44987
|
if (!hub.send({ v: 1, id, type: "list", from_ref: ref })) {
|
|
44985
44988
|
clearTimeout(timer);
|
|
44986
44989
|
pending.cancel(id);
|
|
44987
|
-
|
|
44990
|
+
resolve16(void 0);
|
|
44988
44991
|
}
|
|
44989
44992
|
}
|
|
44990
44993
|
);
|
|
@@ -45020,8 +45023,8 @@ async function runDaemon(deps2 = {}) {
|
|
|
45020
45023
|
}
|
|
45021
45024
|
if (rec && rec.procStart !== void 0) {
|
|
45022
45025
|
if (rec.procStart !== start) return { bound: false };
|
|
45023
|
-
rec.
|
|
45024
|
-
sendLink(rec);
|
|
45026
|
+
rec.linkHashes = withLinkHash(rec.linkHashes, req.hash);
|
|
45027
|
+
sendLink(rec, req.hash);
|
|
45025
45028
|
return { bound: true };
|
|
45026
45029
|
}
|
|
45027
45030
|
pendingProofs.delete(req.pid);
|
|
@@ -45237,7 +45240,7 @@ async function runDaemon(deps2 = {}) {
|
|
|
45237
45240
|
...mine ? { procStart: mine.procStart } : {},
|
|
45238
45241
|
...mine ? { sessionName: mine.name } : {},
|
|
45239
45242
|
// Claude's MCP server reconnects per tool call: the proof stays.
|
|
45240
|
-
...(prev?.
|
|
45243
|
+
...(prev?.linkHashes ?? old?.linkHashes) !== void 0 ? { linkHashes: prev?.linkHashes ?? old?.linkHashes } : {},
|
|
45241
45244
|
...codexName !== void 0 ? { sessionName: codexName } : {},
|
|
45242
45245
|
cwd,
|
|
45243
45246
|
live: true
|
|
@@ -45301,8 +45304,8 @@ async function runDaemon(deps2 = {}) {
|
|
|
45301
45304
|
if (!hubLink || !hubLinkArg) return false;
|
|
45302
45305
|
const rec = agents.byRef(ref);
|
|
45303
45306
|
if (!rec?.live) return false;
|
|
45304
|
-
rec.
|
|
45305
|
-
sendLink(rec);
|
|
45307
|
+
rec.linkHashes = withLinkHash(rec.linkHashes, hash2);
|
|
45308
|
+
sendLink(rec, hash2);
|
|
45306
45309
|
return true;
|
|
45307
45310
|
},
|
|
45308
45311
|
renamed: (ref, name) => {
|
|
@@ -46127,6 +46130,58 @@ function copy(style) {
|
|
|
46127
46130
|
],
|
|
46128
46131
|
// Codex's checks, after its wiring line (C26e).
|
|
46129
46132
|
codexWakes: (bin) => done(`Codex wakes with ${clip(bin, 20)}`),
|
|
46133
|
+
// The Claude Code output style (#1970): turned on, or added beside the person's own choice.
|
|
46134
|
+
// Product's sentence, wrapped to the 80 columns every transcript line keeps.
|
|
46135
|
+
outputStyleOn: (where) => [
|
|
46136
|
+
done("Turned on the Artifacts Teammate output style"),
|
|
46137
|
+
next(`(${clip(where, 5)}).`),
|
|
46138
|
+
next("Restart Claude Code sessions to use it.")
|
|
46139
|
+
],
|
|
46140
|
+
// `style` is undefined when the choice is not a style name (null, a number, "default").
|
|
46141
|
+
outputStyleKept: (style2) => done(
|
|
46142
|
+
`Added the Artifacts Teammate output style. You're on ${style2 ?? "the default style"}; switch with /output-style.`
|
|
46143
|
+
),
|
|
46144
|
+
outputStyleDoctor: (where, on) => done(
|
|
46145
|
+
`Artifacts Teammate output style installed in ${where} (${on ? "on" : "installed, not selected"})`
|
|
46146
|
+
),
|
|
46147
|
+
// #1626: the `oa-bus` shim on PATH.
|
|
46148
|
+
shimInstalled: (where) => done(`Installed the oa-bus command: ${clip(where, 30)}`),
|
|
46149
|
+
shimNotOnPath: (dir, hint) => [
|
|
46150
|
+
warn(
|
|
46151
|
+
`${clip(dir, 30)} is not on your PATH, so \`oa-bus\` won't run yet.`
|
|
46152
|
+
),
|
|
46153
|
+
next(`To fix it, add this line to your shell profile: ${hint}`)
|
|
46154
|
+
],
|
|
46155
|
+
shimForeign: (where) => [
|
|
46156
|
+
warn(`Left ${clip(where, 30)} alone: it isn't from Open Artifacts.`),
|
|
46157
|
+
next(
|
|
46158
|
+
`Typing \`oa-bus\` runs that file, not this install. Remove it, or use \`${BUS_CMD}\`.`
|
|
46159
|
+
)
|
|
46160
|
+
],
|
|
46161
|
+
shimOtherHome: (where, home2) => [
|
|
46162
|
+
warn(
|
|
46163
|
+
`Left ${clip(where, 30)} alone: it belongs to the install in ${clip(home2, 30)}.`
|
|
46164
|
+
),
|
|
46165
|
+
next(
|
|
46166
|
+
`Typing \`oa-bus\` runs that install, not this one. Use \`${BUS_CMD}\` for this one.`
|
|
46167
|
+
)
|
|
46168
|
+
],
|
|
46169
|
+
shimRemoved: (where) => done(`Removed the oa-bus command: ${clip(where, 30)}`),
|
|
46170
|
+
shimDoctorOk: (where) => done(`oa-bus on your PATH runs this install (${clip(where, 30)})`),
|
|
46171
|
+
shimDoctorOffPath: (where, hint) => [
|
|
46172
|
+
warn(`oa-bus is not on your PATH (the command is in ${clip(where, 30)})`),
|
|
46173
|
+
next(`To fix it, add this line to your shell profile: ${hint}`)
|
|
46174
|
+
],
|
|
46175
|
+
shimDoctorOther: (where) => [
|
|
46176
|
+
warn(`oa-bus on your PATH is not this install's (${clip(where, 30)})`),
|
|
46177
|
+
next(
|
|
46178
|
+
`Remove it, or put this install's first. Re-run ${BUS_CMD} install to refresh ours.`
|
|
46179
|
+
)
|
|
46180
|
+
],
|
|
46181
|
+
shimDoctorMissing: () => [
|
|
46182
|
+
warn("oa-bus is not on your PATH"),
|
|
46183
|
+
next(`Run ${BUS_CMD} install to add it.`)
|
|
46184
|
+
],
|
|
46130
46185
|
codexSkill: (where) => done(`Codex skill installed in ${clip(where, 20)}`),
|
|
46131
46186
|
codexSkillTwice: (file2, block) => [
|
|
46132
46187
|
warn("The Codex skill is installed twice, so it loads twice"),
|
|
@@ -46404,19 +46459,19 @@ init_src2();
|
|
|
46404
46459
|
import { execFile as execFile3, spawn } from "node:child_process";
|
|
46405
46460
|
import { promisify } from "node:util";
|
|
46406
46461
|
var browserCommand = (platform, url2) => platform === "darwin" ? { cmd: "open", args: [url2] } : platform === "win32" ? { cmd: "rundll32", args: ["url.dll,FileProtocolHandler", url2] } : { cmd: "xdg-open", args: [url2] };
|
|
46407
|
-
var openBrowser = (url2, launcher = browserCommand(process.platform, url2)) => new Promise((
|
|
46462
|
+
var openBrowser = (url2, launcher = browserCommand(process.platform, url2)) => new Promise((resolve16) => {
|
|
46408
46463
|
try {
|
|
46409
46464
|
const child = spawn(launcher.cmd, launcher.args, {
|
|
46410
46465
|
stdio: "ignore",
|
|
46411
46466
|
detached: true
|
|
46412
46467
|
});
|
|
46413
|
-
child.once("error", () =>
|
|
46468
|
+
child.once("error", () => resolve16(false));
|
|
46414
46469
|
child.once("spawn", () => {
|
|
46415
46470
|
child.unref();
|
|
46416
|
-
|
|
46471
|
+
resolve16(true);
|
|
46417
46472
|
});
|
|
46418
46473
|
} catch {
|
|
46419
|
-
|
|
46474
|
+
resolve16(false);
|
|
46420
46475
|
}
|
|
46421
46476
|
});
|
|
46422
46477
|
var EXEC_TIMEOUT_MS = 1e4;
|
|
@@ -47486,8 +47541,8 @@ function upsert(path, text3, doc, entry) {
|
|
|
47486
47541
|
);
|
|
47487
47542
|
const eol2 = eolOf(lines);
|
|
47488
47543
|
const ended = lines.at(-1)?.text === "" && lines.length > 1;
|
|
47489
|
-
const
|
|
47490
|
-
next = `${text3}${
|
|
47544
|
+
const sep4 = text3 === "" ? "" : ended ? blank(lines.at(-2)) ? "" : eol2 : eol2 + eol2;
|
|
47545
|
+
next = `${text3}${sep4}${block.join(eol2)}${eol2}`;
|
|
47491
47546
|
}
|
|
47492
47547
|
return checked(path, doc, next, entry);
|
|
47493
47548
|
}
|
|
@@ -47981,7 +48036,7 @@ var noService = {
|
|
|
47981
48036
|
remove: async () => ({}),
|
|
47982
48037
|
cli: () => ["oa-bus"]
|
|
47983
48038
|
};
|
|
47984
|
-
var VERSION = true ? "0.
|
|
48039
|
+
var VERSION = true ? "0.149.0" : JSON.parse(
|
|
47985
48040
|
readFileSync13(new URL("../package.json", import.meta.url), "utf8")
|
|
47986
48041
|
).version;
|
|
47987
48042
|
var which = (cmd) => {
|
|
@@ -48063,7 +48118,7 @@ function realCtx(noColor) {
|
|
|
48063
48118
|
});
|
|
48064
48119
|
try {
|
|
48065
48120
|
return await new Promise(
|
|
48066
|
-
(
|
|
48121
|
+
(resolve16) => rl.question(question, resolve16)
|
|
48067
48122
|
);
|
|
48068
48123
|
} finally {
|
|
48069
48124
|
rl.close();
|
|
@@ -48188,7 +48243,7 @@ async function daemon(ctx, run4 = runDaemon, signals = process) {
|
|
|
48188
48243
|
sayErr(ctx, ctx.copy.revoked());
|
|
48189
48244
|
return 0;
|
|
48190
48245
|
}
|
|
48191
|
-
return new Promise((
|
|
48246
|
+
return new Promise((resolve16) => {
|
|
48192
48247
|
let running;
|
|
48193
48248
|
let ended = false;
|
|
48194
48249
|
const end = (code2) => {
|
|
@@ -48196,7 +48251,7 @@ async function daemon(ctx, run4 = runDaemon, signals = process) {
|
|
|
48196
48251
|
ended = true;
|
|
48197
48252
|
signals.off("SIGINT", onSignal);
|
|
48198
48253
|
signals.off("SIGTERM", onSignal);
|
|
48199
|
-
void (running?.stop() ?? Promise.resolve()).finally(() =>
|
|
48254
|
+
void (running?.stop() ?? Promise.resolve()).finally(() => resolve16(code2));
|
|
48200
48255
|
};
|
|
48201
48256
|
const onSignal = () => end(0);
|
|
48202
48257
|
signals.once("SIGINT", onSignal);
|
|
@@ -48225,8 +48280,8 @@ async function daemon(ctx, run4 = runDaemon, signals = process) {
|
|
|
48225
48280
|
}
|
|
48226
48281
|
|
|
48227
48282
|
// src/commands/doctor.ts
|
|
48228
|
-
import { readFileSync as
|
|
48229
|
-
import { join as
|
|
48283
|
+
import { readFileSync as readFileSync26 } from "node:fs";
|
|
48284
|
+
import { join as join32 } from "node:path";
|
|
48230
48285
|
|
|
48231
48286
|
// ../bus-adapter-opencode/src/index.ts
|
|
48232
48287
|
init_proxy();
|
|
@@ -48799,11 +48854,11 @@ function parseTree(text3, errors = [], options = ParseOptions.DEFAULT) {
|
|
|
48799
48854
|
onValue({ type: getNodeType(value), offset, length, parent: currentParent, value });
|
|
48800
48855
|
ensurePropertyComplete(offset + length);
|
|
48801
48856
|
},
|
|
48802
|
-
onSeparator: (
|
|
48857
|
+
onSeparator: (sep4, offset, length) => {
|
|
48803
48858
|
if (currentParent.type === "property") {
|
|
48804
|
-
if (
|
|
48859
|
+
if (sep4 === ":") {
|
|
48805
48860
|
currentParent.colonOffset = offset;
|
|
48806
|
-
} else if (
|
|
48861
|
+
} else if (sep4 === ",") {
|
|
48807
48862
|
ensurePropertyComplete(offset);
|
|
48808
48863
|
}
|
|
48809
48864
|
}
|
|
@@ -50035,9 +50090,9 @@ function hermesRoot(home2, env2, platform = process.platform) {
|
|
|
50035
50090
|
}
|
|
50036
50091
|
function hermesProfilesScan(home2, env2, platform = process.platform) {
|
|
50037
50092
|
const path = join21(hermesRoot(home2, env2, platform), "profiles");
|
|
50038
|
-
let
|
|
50093
|
+
let isLink3 = false;
|
|
50039
50094
|
try {
|
|
50040
|
-
|
|
50095
|
+
isLink3 = lstatSync10(path).isSymbolicLink();
|
|
50041
50096
|
} catch {
|
|
50042
50097
|
}
|
|
50043
50098
|
const target2 = () => {
|
|
@@ -50056,7 +50111,7 @@ function hermesProfilesScan(home2, env2, platform = process.platform) {
|
|
|
50056
50111
|
return {
|
|
50057
50112
|
names: names2,
|
|
50058
50113
|
incomplete: false,
|
|
50059
|
-
note:
|
|
50114
|
+
note: isLink3 ? `The Hermes profiles folder ${path} is a symlink to ${target2()}. Its profiles were checked too.` : void 0
|
|
50060
50115
|
};
|
|
50061
50116
|
} catch (e) {
|
|
50062
50117
|
const code2 = e.code ?? "error";
|
|
@@ -50064,7 +50119,7 @@ function hermesProfilesScan(home2, env2, platform = process.platform) {
|
|
|
50064
50119
|
return {
|
|
50065
50120
|
names: [],
|
|
50066
50121
|
incomplete: false,
|
|
50067
|
-
note:
|
|
50122
|
+
note: isLink3 ? `The Hermes profiles folder ${path} is a symlink to ${target2()}, which doesn't exist, so there were no profiles to check.` : void 0
|
|
50068
50123
|
};
|
|
50069
50124
|
if (code2 === "ENOTDIR")
|
|
50070
50125
|
return {
|
|
@@ -51059,10 +51114,10 @@ function blockState(existing) {
|
|
|
51059
51114
|
var separatorFor = (existing) => {
|
|
51060
51115
|
if (existing === "") return "";
|
|
51061
51116
|
const eol2 = existing.includes("\r\n") ? "\r\n" : "\n";
|
|
51062
|
-
let
|
|
51063
|
-
if (!existing.endsWith("\n"))
|
|
51064
|
-
if (!/\n\r?\n$/.test(existing +
|
|
51065
|
-
return
|
|
51117
|
+
let sep4 = "";
|
|
51118
|
+
if (!existing.endsWith("\n")) sep4 += eol2;
|
|
51119
|
+
if (!/\n\r?\n$/.test(existing + sep4)) sep4 += eol2;
|
|
51120
|
+
return sep4;
|
|
51066
51121
|
};
|
|
51067
51122
|
function withHabits(existing, block, added) {
|
|
51068
51123
|
const lines = existing.split("\n");
|
|
@@ -51170,15 +51225,15 @@ function writeHabits(deps2, harnesses, opts = {}) {
|
|
|
51170
51225
|
}
|
|
51171
51226
|
const real3 = targetOf(path);
|
|
51172
51227
|
try {
|
|
51173
|
-
const
|
|
51174
|
-
const before =
|
|
51228
|
+
const exists2 = existsSync9(real3);
|
|
51229
|
+
const before = exists2 ? readFileSync20(real3, "utf8") : "";
|
|
51175
51230
|
const fresh = blockState(before).state === "absent";
|
|
51176
51231
|
const after = withHabits(before, habitsBlock());
|
|
51177
51232
|
if (after !== before) writeAtomic(real3, after);
|
|
51178
51233
|
if (fresh)
|
|
51179
51234
|
files_[path] = {
|
|
51180
51235
|
added: separatorFor(before),
|
|
51181
|
-
created: !
|
|
51236
|
+
created: !exists2 && !link2
|
|
51182
51237
|
};
|
|
51183
51238
|
files2.push(path);
|
|
51184
51239
|
} catch (e) {
|
|
@@ -52509,9 +52564,355 @@ function codexProxyProblem(deps2) {
|
|
|
52509
52564
|
}
|
|
52510
52565
|
}
|
|
52511
52566
|
|
|
52567
|
+
// src/steps/output-style.ts
|
|
52568
|
+
import {
|
|
52569
|
+
existsSync as existsSync13,
|
|
52570
|
+
lstatSync as lstatSync15,
|
|
52571
|
+
readdirSync as readdirSync8,
|
|
52572
|
+
readFileSync as readFileSync24,
|
|
52573
|
+
rmdirSync as rmdirSync3,
|
|
52574
|
+
rmSync as rmSync13
|
|
52575
|
+
} from "node:fs";
|
|
52576
|
+
import { dirname as dirname13, join as join27 } from "node:path";
|
|
52577
|
+
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
52578
|
+
var OUTPUT_STYLE_FILE = "artifacts-teammate.md";
|
|
52579
|
+
var OUTPUT_STYLE_MARKER = "<!-- managed by the Open Artifacts bus installer: edits are replaced on reinstall. -->";
|
|
52580
|
+
var OUTPUT_STYLE_NAME = "Artifacts Teammate";
|
|
52581
|
+
var claudeSettingsFile = (w) => join27(w.env?.CLAUDE_CONFIG_DIR ?? join27(w.home, ".claude"), "settings.json");
|
|
52582
|
+
var readRecord3 = (busHome2) => {
|
|
52583
|
+
if (!busHome2) return void 0;
|
|
52584
|
+
const r = readInstallFile(join27(busHome2, "install.json")).outputStyle;
|
|
52585
|
+
return typeof r === "object" && r !== null ? r : void 0;
|
|
52586
|
+
};
|
|
52587
|
+
var writeRecord3 = (busHome2, r) => updateInstallFile(join27(busHome2, "install.json"), { outputStyle: r });
|
|
52588
|
+
var styleDir = (w) => join27(w.env?.CLAUDE_CONFIG_DIR ?? join27(w.home, ".claude"), "output-styles");
|
|
52589
|
+
var outputStyleFile = (w) => join27(styleDir(w), OUTPUT_STYLE_FILE);
|
|
52590
|
+
var outputStyleSource = () => {
|
|
52591
|
+
for (const rel of [
|
|
52592
|
+
"../assets/output-styles/artifacts-teammate.md",
|
|
52593
|
+
"../../output-style/artifacts-teammate.md"
|
|
52594
|
+
]) {
|
|
52595
|
+
const path = fileURLToPath6(new URL(rel, import.meta.url));
|
|
52596
|
+
if (existsSync13(path)) return readFileSync24(path, "utf8");
|
|
52597
|
+
}
|
|
52598
|
+
throw new Error("the Artifacts Teammate output style is missing");
|
|
52599
|
+
};
|
|
52600
|
+
var withMarker2 = (text3) => {
|
|
52601
|
+
const end = text3.startsWith("---\n") ? text3.indexOf("\n---\n", 3) : -1;
|
|
52602
|
+
if (end === -1) throw new Error("the output style has no frontmatter");
|
|
52603
|
+
const at = end + "\n---\n".length;
|
|
52604
|
+
return `${text3.slice(0, at)}${OUTPUT_STYLE_MARKER}
|
|
52605
|
+
${text3.slice(at)}`;
|
|
52606
|
+
};
|
|
52607
|
+
var isOurs2 = (text3) => {
|
|
52608
|
+
const m = /^---\n[\s\S]*?\n---\n/.exec(text3.replace(/\r\n/g, "\n"));
|
|
52609
|
+
return m !== null && text3.replace(/\r\n/g, "\n").slice(m[0].length).split("\n", 1)[0] === OUTPUT_STYLE_MARKER;
|
|
52610
|
+
};
|
|
52611
|
+
var isLink2 = (path) => {
|
|
52612
|
+
try {
|
|
52613
|
+
return lstatSync15(path).isSymbolicLink();
|
|
52614
|
+
} catch {
|
|
52615
|
+
return false;
|
|
52616
|
+
}
|
|
52617
|
+
};
|
|
52618
|
+
var exists = (path) => {
|
|
52619
|
+
try {
|
|
52620
|
+
lstatSync15(path);
|
|
52621
|
+
return true;
|
|
52622
|
+
} catch {
|
|
52623
|
+
return false;
|
|
52624
|
+
}
|
|
52625
|
+
};
|
|
52626
|
+
var readSettings = (path) => {
|
|
52627
|
+
if (isLink2(path)) return { ok: false, why: "it is a symlink" };
|
|
52628
|
+
if (!exists(path)) return { ok: true, text: void 0, style: void 0 };
|
|
52629
|
+
try {
|
|
52630
|
+
const text3 = readFileSync24(path, "utf8");
|
|
52631
|
+
parseJsonc(text3, path);
|
|
52632
|
+
return { ok: true, text: text3, style: jsoncValue(text3, ["outputStyle"]) };
|
|
52633
|
+
} catch {
|
|
52634
|
+
return { ok: false, why: "it is not valid JSON" };
|
|
52635
|
+
}
|
|
52636
|
+
};
|
|
52637
|
+
function turnOn(deps2, out) {
|
|
52638
|
+
const path = claudeSettingsFile(deps2);
|
|
52639
|
+
const busHome2 = deps2.busHome;
|
|
52640
|
+
if (!busHome2) return;
|
|
52641
|
+
const cur = readSettings(path);
|
|
52642
|
+
if (!cur.ok) {
|
|
52643
|
+
out.notes.push(
|
|
52644
|
+
`Left ${path} alone: ${cur.why}, so the output style was not turned on. Pick it with /output-style.`
|
|
52645
|
+
);
|
|
52646
|
+
return;
|
|
52647
|
+
}
|
|
52648
|
+
const unset = cur.style === void 0 || cur.style === null || typeof cur.style === "string" && cur.style.trim() === "";
|
|
52649
|
+
if (!unset) {
|
|
52650
|
+
if (cur.style !== OUTPUT_STYLE_NAME) {
|
|
52651
|
+
out.settings = "kept";
|
|
52652
|
+
if (typeof cur.style === "string" && cur.style.toLowerCase() !== "default")
|
|
52653
|
+
out.kept = cur.style;
|
|
52654
|
+
}
|
|
52655
|
+
return;
|
|
52656
|
+
}
|
|
52657
|
+
if (readRecord3(busHome2)?.set) return;
|
|
52658
|
+
try {
|
|
52659
|
+
writeRecord3(busHome2, {
|
|
52660
|
+
set: true,
|
|
52661
|
+
value: OUTPUT_STYLE_NAME,
|
|
52662
|
+
before: cur.style === void 0 ? { state: "absent" } : cur.style === null ? { state: "null" } : { state: "empty", value: String(cur.style) },
|
|
52663
|
+
createdFile: cur.text === void 0,
|
|
52664
|
+
file: path
|
|
52665
|
+
});
|
|
52666
|
+
const next = cur.text === void 0 || cur.text.trim() === "" ? createdText() : setJsoncValue(cur.text, ["outputStyle"], OUTPUT_STYLE_NAME);
|
|
52667
|
+
writeAtomic(path, next);
|
|
52668
|
+
out.settings = "set";
|
|
52669
|
+
} catch (e) {
|
|
52670
|
+
try {
|
|
52671
|
+
writeRecord3(busHome2, void 0);
|
|
52672
|
+
} catch {
|
|
52673
|
+
}
|
|
52674
|
+
out.notes.push(
|
|
52675
|
+
`Left ${path} alone: could not edit it (${e instanceof Error ? e.message : String(e)}). Pick the style with /output-style.`
|
|
52676
|
+
);
|
|
52677
|
+
}
|
|
52678
|
+
}
|
|
52679
|
+
function installOutputStyle(deps2, harnesses) {
|
|
52680
|
+
const out = { written: [], notes: [], first: false };
|
|
52681
|
+
if (!harnesses.includes("claude")) return out;
|
|
52682
|
+
const dir = styleDir(deps2);
|
|
52683
|
+
const path = outputStyleFile(deps2);
|
|
52684
|
+
if (isLink2(dir) || isLink2(path)) {
|
|
52685
|
+
out.notes.push(
|
|
52686
|
+
`Left ${isLink2(dir) ? dir : path} alone: it is a symlink, so the output style was not written there.`
|
|
52687
|
+
);
|
|
52688
|
+
return out;
|
|
52689
|
+
}
|
|
52690
|
+
try {
|
|
52691
|
+
const there = exists(path);
|
|
52692
|
+
if (there && !isOurs2(readFileSync24(path, "utf8"))) {
|
|
52693
|
+
out.notes.push(
|
|
52694
|
+
`Left ${path} alone: it has no Open Artifacts marker, so it is not ours to replace.`
|
|
52695
|
+
);
|
|
52696
|
+
return out;
|
|
52697
|
+
}
|
|
52698
|
+
writeAtomic(path, withMarker2(deps2.text));
|
|
52699
|
+
out.written.push(path);
|
|
52700
|
+
out.first = !there;
|
|
52701
|
+
} catch (e) {
|
|
52702
|
+
out.notes.push(
|
|
52703
|
+
`Could not write ${path}: ${e instanceof Error ? e.message : String(e)}`
|
|
52704
|
+
);
|
|
52705
|
+
return out;
|
|
52706
|
+
}
|
|
52707
|
+
turnOn(deps2, out);
|
|
52708
|
+
return out;
|
|
52709
|
+
}
|
|
52710
|
+
var createdText = () => `${JSON.stringify({ outputStyle: OUTPUT_STYLE_NAME }, null, 2)}
|
|
52711
|
+
`;
|
|
52712
|
+
function turnOff(deps2, out) {
|
|
52713
|
+
const busHome2 = deps2.busHome;
|
|
52714
|
+
const rec = readRecord3(busHome2);
|
|
52715
|
+
const path = claudeSettingsFile(deps2);
|
|
52716
|
+
try {
|
|
52717
|
+
const cur = readSettings(path);
|
|
52718
|
+
if (cur.ok && cur.text !== void 0 && cur.style === OUTPUT_STYLE_NAME) {
|
|
52719
|
+
const was = rec?.set ? rec.before : void 0;
|
|
52720
|
+
const next = was?.state === "null" ? setJsoncValue(cur.text, ["outputStyle"], null) : was?.state === "empty" ? setJsoncValue(cur.text, ["outputStyle"], was.value) : removeJsoncValue(cur.text, ["outputStyle"]);
|
|
52721
|
+
if (rec?.set && rec.createdFile && cur.text === createdText())
|
|
52722
|
+
rmSync13(path);
|
|
52723
|
+
else writeAtomic(path, next);
|
|
52724
|
+
}
|
|
52725
|
+
if (busHome2 && rec) writeRecord3(busHome2, void 0);
|
|
52726
|
+
} catch (e) {
|
|
52727
|
+
out.notes.push(
|
|
52728
|
+
`Left ${path} alone: ${e instanceof Error ? e.message : String(e)}`
|
|
52729
|
+
);
|
|
52730
|
+
}
|
|
52731
|
+
}
|
|
52732
|
+
function uninstallOutputStyle(deps2) {
|
|
52733
|
+
const out = { written: [], notes: [] };
|
|
52734
|
+
const dir = styleDir(deps2);
|
|
52735
|
+
const path = outputStyleFile(deps2);
|
|
52736
|
+
let gone = false;
|
|
52737
|
+
try {
|
|
52738
|
+
if (isLink2(dir) || isLink2(path)) {
|
|
52739
|
+
out.notes.push(
|
|
52740
|
+
`Left ${isLink2(dir) ? dir : path} alone: it is a symlink, so the output style was not removed there.`
|
|
52741
|
+
);
|
|
52742
|
+
} else if (!exists(path)) {
|
|
52743
|
+
gone = true;
|
|
52744
|
+
} else if (!isOurs2(readFileSync24(path, "utf8"))) {
|
|
52745
|
+
out.notes.push(
|
|
52746
|
+
`Left ${path} alone: it has no Open Artifacts marker, so it is not ours to replace.`
|
|
52747
|
+
);
|
|
52748
|
+
} else {
|
|
52749
|
+
rmSync13(path);
|
|
52750
|
+
out.written.push(path);
|
|
52751
|
+
gone = true;
|
|
52752
|
+
if (readdirSync8(dir).length === 0) rmdirSync3(dir);
|
|
52753
|
+
}
|
|
52754
|
+
} catch (e) {
|
|
52755
|
+
out.notes.push(
|
|
52756
|
+
`Left ${path} alone: ${e instanceof Error ? e.message : String(e)}`
|
|
52757
|
+
);
|
|
52758
|
+
}
|
|
52759
|
+
if (gone) turnOff(deps2, out);
|
|
52760
|
+
return out;
|
|
52761
|
+
}
|
|
52762
|
+
var outputStyleState = (deps2) => {
|
|
52763
|
+
const path = outputStyleFile(deps2);
|
|
52764
|
+
try {
|
|
52765
|
+
if (isLink2(dirname13(path)) || isLink2(path)) return void 0;
|
|
52766
|
+
if (!isOurs2(readFileSync24(path, "utf8"))) return void 0;
|
|
52767
|
+
const s = readSettings(claudeSettingsFile(deps2));
|
|
52768
|
+
return { path, on: s.ok && s.style === OUTPUT_STYLE_NAME };
|
|
52769
|
+
} catch {
|
|
52770
|
+
return void 0;
|
|
52771
|
+
}
|
|
52772
|
+
};
|
|
52773
|
+
|
|
52774
|
+
// src/steps/path-shim.ts
|
|
52775
|
+
import {
|
|
52776
|
+
accessSync as accessSync2,
|
|
52777
|
+
chmodSync as chmodSync13,
|
|
52778
|
+
constants as constants4,
|
|
52779
|
+
lstatSync as lstatSync16,
|
|
52780
|
+
mkdirSync as mkdirSync12,
|
|
52781
|
+
readFileSync as readFileSync25,
|
|
52782
|
+
readlinkSync as readlinkSync4,
|
|
52783
|
+
renameSync as renameSync13,
|
|
52784
|
+
rmSync as rmSync14,
|
|
52785
|
+
writeFileSync as writeFileSync11
|
|
52786
|
+
} from "node:fs";
|
|
52787
|
+
import { delimiter as delimiter2, dirname as dirname14, join as join28, resolve as resolve11, sep as sep3 } from "node:path";
|
|
52788
|
+
var SHIM_MARKER = "# oa-bus shim: written by oa-bus install";
|
|
52789
|
+
var HOME_PREFIX = "# oa-bus home: ";
|
|
52790
|
+
var NAME2 = "oa-bus";
|
|
52791
|
+
var LOCAL_HINT = 'export PATH="$HOME/.local/bin:$PATH"';
|
|
52792
|
+
var isWindows = (platform) => platform.startsWith("win32");
|
|
52793
|
+
var pathDirs = (p) => (p ?? "").split(delimiter2).filter((d) => d !== "").map((d) => resolve11(d));
|
|
52794
|
+
var candidates2 = (o) => o.platform.startsWith("darwin") ? [join28(o.userHome, ".local", "bin"), join28(o.userHome, "bin")] : [join28(o.userHome, ".local", "bin")];
|
|
52795
|
+
var shQuote2 = (v) => `'${v.replaceAll("'", `'\\''`)}'`;
|
|
52796
|
+
function shimText(o) {
|
|
52797
|
+
const moved = resolve11(o.busHome) !== resolve11(o.userHome, ".oa-bus");
|
|
52798
|
+
return [
|
|
52799
|
+
"#!/bin/sh",
|
|
52800
|
+
SHIM_MARKER,
|
|
52801
|
+
`${HOME_PREFIX}${resolve11(o.busHome)}`,
|
|
52802
|
+
...moved ? [`OA_BUS_HOME=${shQuote2(resolve11(o.busHome))}`, "export OA_BUS_HOME"] : [],
|
|
52803
|
+
`exec ${o.argv.map(shQuote2).join(" ")} "$@"`,
|
|
52804
|
+
""
|
|
52805
|
+
].join("\n");
|
|
52806
|
+
}
|
|
52807
|
+
function ownerOf(file2, busHome2) {
|
|
52808
|
+
let st;
|
|
52809
|
+
try {
|
|
52810
|
+
st = lstatSync16(file2);
|
|
52811
|
+
} catch {
|
|
52812
|
+
return void 0;
|
|
52813
|
+
}
|
|
52814
|
+
if (st.isSymbolicLink()) {
|
|
52815
|
+
try {
|
|
52816
|
+
const to = resolve11(dirname14(file2), readlinkSync4(file2));
|
|
52817
|
+
const home2 = resolve11(busHome2);
|
|
52818
|
+
return to === home2 || to.startsWith(`${home2}/`) ? { ours: true, home: home2 } : { ours: false };
|
|
52819
|
+
} catch {
|
|
52820
|
+
return { ours: false };
|
|
52821
|
+
}
|
|
52822
|
+
}
|
|
52823
|
+
if (!st.isFile() || st.size > 4096) return { ours: false };
|
|
52824
|
+
try {
|
|
52825
|
+
const lines = readFileSync25(file2, "utf8").split("\n");
|
|
52826
|
+
if (lines[1] !== SHIM_MARKER) return { ours: false };
|
|
52827
|
+
const h = lines[2]?.startsWith(HOME_PREFIX) ? lines[2].slice(HOME_PREFIX.length) : void 0;
|
|
52828
|
+
return { ours: true, home: h };
|
|
52829
|
+
} catch {
|
|
52830
|
+
return { ours: false };
|
|
52831
|
+
}
|
|
52832
|
+
}
|
|
52833
|
+
var sameHome = (owner, busHome2) => owner?.ours === true && (owner.home === void 0 || owner.home === resolve11(busHome2));
|
|
52834
|
+
function writeShim(path, text3) {
|
|
52835
|
+
const tmp = `${path}.${process.pid}.tmp`;
|
|
52836
|
+
rmSync14(tmp, { force: true });
|
|
52837
|
+
try {
|
|
52838
|
+
writeFileSync11(tmp, text3, { mode: 493, flag: "wx" });
|
|
52839
|
+
chmodSync13(tmp, 493);
|
|
52840
|
+
renameSync13(tmp, path);
|
|
52841
|
+
} catch (e) {
|
|
52842
|
+
rmSync14(tmp, { force: true });
|
|
52843
|
+
throw e;
|
|
52844
|
+
}
|
|
52845
|
+
}
|
|
52846
|
+
function installShim(o) {
|
|
52847
|
+
if (isWindows(o.platform)) return { kind: "skipped" };
|
|
52848
|
+
const onPath = new Set(pathDirs(o.env.PATH));
|
|
52849
|
+
const list = candidates2(o);
|
|
52850
|
+
const dir = list.find((d) => onPath.has(d)) ?? list[0];
|
|
52851
|
+
const path = join28(dir, NAME2);
|
|
52852
|
+
const owner = ownerOf(path, o.busHome);
|
|
52853
|
+
if (owner && !owner.ours) return { kind: "foreign", path };
|
|
52854
|
+
if (owner?.ours && !sameHome(owner, o.busHome))
|
|
52855
|
+
return { kind: "other-home", path, home: owner.home };
|
|
52856
|
+
mkdirSync12(dir, { recursive: true });
|
|
52857
|
+
const text3 = shimText(o);
|
|
52858
|
+
writeShim(path, text3);
|
|
52859
|
+
for (const d of list) {
|
|
52860
|
+
const other = join28(d, NAME2);
|
|
52861
|
+
if (d !== dir && sameHome(ownerOf(other, o.busHome), o.busHome))
|
|
52862
|
+
writeShim(other, text3);
|
|
52863
|
+
}
|
|
52864
|
+
const on = onPath.has(dir);
|
|
52865
|
+
return {
|
|
52866
|
+
kind: "installed",
|
|
52867
|
+
path,
|
|
52868
|
+
onPath: on,
|
|
52869
|
+
...on ? {} : { hint: LOCAL_HINT }
|
|
52870
|
+
};
|
|
52871
|
+
}
|
|
52872
|
+
function removeShim(o) {
|
|
52873
|
+
if (isWindows(o.platform)) return void 0;
|
|
52874
|
+
let removed;
|
|
52875
|
+
for (const dir of candidates2({ ...o, env: {} })) {
|
|
52876
|
+
const file2 = join28(dir, NAME2);
|
|
52877
|
+
const owner = ownerOf(file2, o.busHome);
|
|
52878
|
+
if (!owner?.ours) continue;
|
|
52879
|
+
if (owner.home !== void 0 && owner.home !== resolve11(o.busHome)) continue;
|
|
52880
|
+
rmSync14(file2, { force: true });
|
|
52881
|
+
removed = file2;
|
|
52882
|
+
}
|
|
52883
|
+
return removed;
|
|
52884
|
+
}
|
|
52885
|
+
var executable2 = (f) => {
|
|
52886
|
+
try {
|
|
52887
|
+
accessSync2(f, constants4.X_OK);
|
|
52888
|
+
return lstatSync16(f).isFile() || lstatSync16(f).isSymbolicLink();
|
|
52889
|
+
} catch {
|
|
52890
|
+
return false;
|
|
52891
|
+
}
|
|
52892
|
+
};
|
|
52893
|
+
function shimState(o) {
|
|
52894
|
+
if (isWindows(o.platform)) return void 0;
|
|
52895
|
+
const dirs = pathDirs(o.env.PATH).filter(
|
|
52896
|
+
(d) => !(d.endsWith(`${sep3}node_modules${sep3}.bin`) && d.split(sep3).includes("_npx"))
|
|
52897
|
+
);
|
|
52898
|
+
for (const dir of dirs) {
|
|
52899
|
+
const file2 = join28(dir, NAME2);
|
|
52900
|
+
if (!executable2(file2)) continue;
|
|
52901
|
+
const owner = ownerOf(file2, o.busHome);
|
|
52902
|
+
return owner?.ours && (owner.home === void 0 || owner.home === resolve11(o.busHome)) ? { kind: "ours", path: file2 } : { kind: "other", path: file2 };
|
|
52903
|
+
}
|
|
52904
|
+
for (const dir of candidates2(o)) {
|
|
52905
|
+
const file2 = join28(dir, NAME2);
|
|
52906
|
+
const owner = ownerOf(file2, o.busHome);
|
|
52907
|
+
if (owner?.ours && (owner.home === void 0 || owner.home === resolve11(o.busHome)))
|
|
52908
|
+
return { kind: "off-path", path: file2, hint: LOCAL_HINT };
|
|
52909
|
+
}
|
|
52910
|
+
return { kind: "missing" };
|
|
52911
|
+
}
|
|
52912
|
+
|
|
52512
52913
|
// src/commands/habits.ts
|
|
52513
52914
|
init_src();
|
|
52514
|
-
import { join as
|
|
52915
|
+
import { join as join29 } from "node:path";
|
|
52515
52916
|
var pluginOn = (p) => `Habits on in the ${p.label} plugin.`;
|
|
52516
52917
|
var pluginOff = (p) => `Habits off in the ${p.label} plugin.`;
|
|
52517
52918
|
var deps = (ctx) => ({
|
|
@@ -52549,7 +52950,7 @@ var show = (ctx) => {
|
|
|
52549
52950
|
);
|
|
52550
52951
|
return 0;
|
|
52551
52952
|
};
|
|
52552
|
-
function
|
|
52953
|
+
function turnOn2(ctx) {
|
|
52553
52954
|
const { targets, plugins: plugins2 } = wired(ctx);
|
|
52554
52955
|
if (targets.length === 0 && plugins2.length === 0) {
|
|
52555
52956
|
sayErr(ctx, [
|
|
@@ -52566,7 +52967,7 @@ function turnOn(ctx) {
|
|
|
52566
52967
|
for (const n of notes) say(ctx, n);
|
|
52567
52968
|
return notes.length > 0 && r.files.length + pl.changed.length === 0 ? 1 : 0;
|
|
52568
52969
|
}
|
|
52569
|
-
function
|
|
52970
|
+
function turnOff2(ctx) {
|
|
52570
52971
|
const r = removeHabits(deps(ctx));
|
|
52571
52972
|
setHabitsOptOut(ctx.home, true, stamp(ctx));
|
|
52572
52973
|
const pluginFiles = r.pluginFiles ?? [];
|
|
@@ -52629,7 +53030,7 @@ async function habitsAfterInstall(ctx, json3) {
|
|
|
52629
53030
|
})),
|
|
52630
53031
|
// A plugin has no block to compare: its marker is there ("current") or not.
|
|
52631
53032
|
...plugins2.map((p) => ({
|
|
52632
|
-
path:
|
|
53033
|
+
path: join29(p.dir(ctx.userHome, ctx.env), p.marker),
|
|
52633
53034
|
label: `the ${p.label} plugin`,
|
|
52634
53035
|
s: {
|
|
52635
53036
|
state: pluginHabitsState(deps(ctx), p) === "on" ? "current" : "absent"
|
|
@@ -52672,7 +53073,7 @@ async function habitsAfterInstall(ctx, json3) {
|
|
|
52672
53073
|
const pl = setPluginHabits(
|
|
52673
53074
|
deps(ctx),
|
|
52674
53075
|
plugins2.filter(
|
|
52675
|
-
(p) => asked.includes(
|
|
53076
|
+
(p) => asked.includes(join29(p.dir(ctx.userHome, ctx.env), p.marker))
|
|
52676
53077
|
),
|
|
52677
53078
|
true
|
|
52678
53079
|
);
|
|
@@ -52714,7 +53115,7 @@ async function habitsAfterInstall(ctx, json3) {
|
|
|
52714
53115
|
}
|
|
52715
53116
|
function habitsCommand(mode, ctx) {
|
|
52716
53117
|
say(ctx, ctx.copy.header(ctx.version), "");
|
|
52717
|
-
return mode === "show" ? show(ctx) : mode === "yes" ?
|
|
53118
|
+
return mode === "show" ? show(ctx) : mode === "yes" ? turnOn2(ctx) : turnOff2(ctx);
|
|
52718
53119
|
}
|
|
52719
53120
|
function habitsLine(ctx) {
|
|
52720
53121
|
const { targets, plugins: plugins2 } = wired(ctx);
|
|
@@ -52737,16 +53138,16 @@ function habitsLine(ctx) {
|
|
|
52737
53138
|
init_src();
|
|
52738
53139
|
import { randomBytes as randomBytes7 } from "node:crypto";
|
|
52739
53140
|
import {
|
|
52740
|
-
chmodSync as
|
|
53141
|
+
chmodSync as chmodSync14,
|
|
52741
53142
|
closeSync as closeSync7,
|
|
52742
|
-
mkdirSync as
|
|
53143
|
+
mkdirSync as mkdirSync13,
|
|
52743
53144
|
openSync as openSync7,
|
|
52744
|
-
renameSync as
|
|
52745
|
-
rmSync as
|
|
53145
|
+
renameSync as renameSync14,
|
|
53146
|
+
rmSync as rmSync15,
|
|
52746
53147
|
unlinkSync as unlinkSync3,
|
|
52747
53148
|
writeSync as writeSync3
|
|
52748
53149
|
} from "node:fs";
|
|
52749
|
-
import { join as
|
|
53150
|
+
import { join as join30 } from "node:path";
|
|
52750
53151
|
|
|
52751
53152
|
// src/machine-label.ts
|
|
52752
53153
|
import { hostname as osHostname } from "node:os";
|
|
@@ -52792,9 +53193,9 @@ function checkVerificationUri(uri, hub) {
|
|
|
52792
53193
|
return uri;
|
|
52793
53194
|
}
|
|
52794
53195
|
function writeMachineFile(home2, body) {
|
|
52795
|
-
|
|
52796
|
-
|
|
52797
|
-
const tmp =
|
|
53196
|
+
mkdirSync13(home2, { recursive: true, mode: 448 });
|
|
53197
|
+
chmodSync14(home2, 448);
|
|
53198
|
+
const tmp = join30(home2, `.machine.json.${randomBytes7(8).toString("hex")}.tmp`);
|
|
52798
53199
|
const fd = openSync7(tmp, "wx", 384);
|
|
52799
53200
|
try {
|
|
52800
53201
|
writeSync3(fd, body);
|
|
@@ -52805,8 +53206,8 @@ function writeMachineFile(home2, body) {
|
|
|
52805
53206
|
}
|
|
52806
53207
|
closeSync7(fd);
|
|
52807
53208
|
try {
|
|
52808
|
-
|
|
52809
|
-
|
|
53209
|
+
chmodSync14(tmp, 384);
|
|
53210
|
+
renameSync14(tmp, join30(home2, "machine.json"));
|
|
52810
53211
|
} catch (e) {
|
|
52811
53212
|
unlinkSync3(tmp);
|
|
52812
53213
|
throw e;
|
|
@@ -52933,7 +53334,7 @@ async function login(args) {
|
|
|
52933
53334
|
`${JSON.stringify({ hub, label, machine_token: poll.machine_token }, null, 2)}
|
|
52934
53335
|
`
|
|
52935
53336
|
);
|
|
52936
|
-
|
|
53337
|
+
rmSync15(join30(args.home, "revoked"), { force: true });
|
|
52937
53338
|
if (!events?.code) print(`Approved this machine as ${label}.`);
|
|
52938
53339
|
return {
|
|
52939
53340
|
machineToken: poll.machine_token,
|
|
@@ -52957,7 +53358,7 @@ init_src();
|
|
|
52957
53358
|
|
|
52958
53359
|
// src/commands/install.ts
|
|
52959
53360
|
init_src3();
|
|
52960
|
-
import { join as
|
|
53361
|
+
import { dirname as dirname15, join as join31 } from "node:path";
|
|
52961
53362
|
init_src2();
|
|
52962
53363
|
|
|
52963
53364
|
// src/live.ts
|
|
@@ -53086,7 +53487,7 @@ async function loginStep(ctx, opts) {
|
|
|
53086
53487
|
ctx,
|
|
53087
53488
|
c.approved(result.label),
|
|
53088
53489
|
c.tokenSaved(
|
|
53089
|
-
tilde(ctx,
|
|
53490
|
+
tilde(ctx, join31(ctx.home, "machine.json")),
|
|
53090
53491
|
result.machineToken
|
|
53091
53492
|
),
|
|
53092
53493
|
c.connected(originOf2(result.hub)),
|
|
@@ -53159,6 +53560,26 @@ async function harnessesStep(ctx, hub) {
|
|
|
53159
53560
|
);
|
|
53160
53561
|
for (const n of skill.notes) say(ctx, [n]);
|
|
53161
53562
|
if (skill.failedUrl) skillFailure.set(ctx, skill.failedUrl);
|
|
53563
|
+
try {
|
|
53564
|
+
const style = installOutputStyle(
|
|
53565
|
+
{
|
|
53566
|
+
home: ctx.userHome,
|
|
53567
|
+
busHome: ctx.home,
|
|
53568
|
+
env: ctx.env,
|
|
53569
|
+
text: outputStyleSource()
|
|
53570
|
+
},
|
|
53571
|
+
out.installed
|
|
53572
|
+
);
|
|
53573
|
+
for (const n of style.notes) say(ctx, [n]);
|
|
53574
|
+
if (style.settings === "set" && style.written[0])
|
|
53575
|
+
say(ctx, c.outputStyleOn(tilde(ctx, style.written[0])));
|
|
53576
|
+
else if (style.settings === "kept" && style.first)
|
|
53577
|
+
say(ctx, c.outputStyleKept(style.kept));
|
|
53578
|
+
} catch (e) {
|
|
53579
|
+
say(ctx, [
|
|
53580
|
+
`Could not write the output style: ${e instanceof Error ? e.message : String(e)}`
|
|
53581
|
+
]);
|
|
53582
|
+
}
|
|
53162
53583
|
return true;
|
|
53163
53584
|
}
|
|
53164
53585
|
var skillFailure = /* @__PURE__ */ new WeakMap();
|
|
@@ -53188,7 +53609,7 @@ function shownSocket(ctx) {
|
|
|
53188
53609
|
const real3 = `${canonicalHome(ctx.home)}/`;
|
|
53189
53610
|
return tilde(
|
|
53190
53611
|
ctx,
|
|
53191
|
-
path.startsWith(real3) ?
|
|
53612
|
+
path.startsWith(real3) ? join31(ctx.home, path.slice(real3.length)) : path
|
|
53192
53613
|
);
|
|
53193
53614
|
}
|
|
53194
53615
|
async function waitForDaemon(ctx) {
|
|
@@ -53326,6 +53747,31 @@ var installSteps = (opts) => [
|
|
|
53326
53747
|
apply: (ctx) => daemonStep(ctx, opts.noService)
|
|
53327
53748
|
}
|
|
53328
53749
|
];
|
|
53750
|
+
function reportShim(ctx) {
|
|
53751
|
+
const argv = ctx.service.argv?.();
|
|
53752
|
+
if (!argv || argv.length !== 2) return;
|
|
53753
|
+
try {
|
|
53754
|
+
const r = installShim({
|
|
53755
|
+
userHome: ctx.userHome,
|
|
53756
|
+
busHome: ctx.home,
|
|
53757
|
+
platform: ctx.platform,
|
|
53758
|
+
env: ctx.env,
|
|
53759
|
+
argv
|
|
53760
|
+
});
|
|
53761
|
+
if (r.kind === "installed") {
|
|
53762
|
+
say(ctx, ctx.copy.shimInstalled(tilde(ctx, r.path)));
|
|
53763
|
+
if (!r.onPath && r.hint)
|
|
53764
|
+
say(ctx, ctx.copy.shimNotOnPath(tilde(ctx, dirname15(r.path)), r.hint));
|
|
53765
|
+
} else if (r.kind === "other-home")
|
|
53766
|
+
say(ctx, ctx.copy.shimOtherHome(tilde(ctx, r.path), tilde(ctx, r.home)));
|
|
53767
|
+
else if (r.kind === "foreign")
|
|
53768
|
+
say(ctx, ctx.copy.shimForeign(tilde(ctx, r.path)));
|
|
53769
|
+
} catch (e) {
|
|
53770
|
+
say(ctx, [
|
|
53771
|
+
`Could not add the oa-bus command: ${e instanceof Error ? e.message : String(e)}`
|
|
53772
|
+
]);
|
|
53773
|
+
}
|
|
53774
|
+
}
|
|
53329
53775
|
async function install2(opts, realCtx2) {
|
|
53330
53776
|
if (opts.habits) return habitsCommand(opts.habits, realCtx2);
|
|
53331
53777
|
const json3 = Boolean(opts.json && !opts.check);
|
|
@@ -53342,9 +53788,10 @@ async function install2(opts, realCtx2) {
|
|
|
53342
53788
|
return results.every((r) => r.state === "done") ? 0 : 1;
|
|
53343
53789
|
}
|
|
53344
53790
|
const ok = await runSteps(steps, ctx, {
|
|
53345
|
-
path:
|
|
53791
|
+
path: join31(ctx.home, "install.json"),
|
|
53346
53792
|
now: ctx.now
|
|
53347
53793
|
});
|
|
53794
|
+
if (ok) reportShim(ctx);
|
|
53348
53795
|
const skillFailed = reportSkillFailure(ctx);
|
|
53349
53796
|
const habits = ok ? await habitsAfterInstall(ctx, json3) : void 0;
|
|
53350
53797
|
const code2 = ok && !skillFailed ? 0 : 1;
|
|
@@ -53528,7 +53975,7 @@ async function healthz(ctx, hub) {
|
|
|
53528
53975
|
function claudeIsolates(path) {
|
|
53529
53976
|
let text3;
|
|
53530
53977
|
try {
|
|
53531
|
-
text3 =
|
|
53978
|
+
text3 = readFileSync26(path, "utf8");
|
|
53532
53979
|
} catch {
|
|
53533
53980
|
return void 0;
|
|
53534
53981
|
}
|
|
@@ -53604,7 +54051,7 @@ async function doctor(ctx) {
|
|
|
53604
54051
|
const node2 = ctx.nodeVersion.replace(/^v/, "");
|
|
53605
54052
|
if (Number(node2.split(".")[0]) >= MIN_NODE) pass(c.nodeOk(node2));
|
|
53606
54053
|
else fail2(c.nodeOld(node2));
|
|
53607
|
-
const machineFile = tilde(ctx,
|
|
54054
|
+
const machineFile = tilde(ctx, join32(ctx.home, "machine.json"));
|
|
53608
54055
|
const m = readMachine(ctx.home);
|
|
53609
54056
|
if (m.state !== "ok") fail2(c.noCredentials(machineFile));
|
|
53610
54057
|
else if (m.revoked) fail2(c.revokedCheck());
|
|
@@ -53691,13 +54138,15 @@ async function doctor(ctx) {
|
|
|
53691
54138
|
pass(c.wired(h, version2));
|
|
53692
54139
|
else fail2(c.notWired(h));
|
|
53693
54140
|
if (h === "claude") {
|
|
53694
|
-
const settings =
|
|
53695
|
-
ctx.env.CLAUDE_CONFIG_DIR ??
|
|
54141
|
+
const settings = join32(
|
|
54142
|
+
ctx.env.CLAUDE_CONFIG_DIR ?? join32(ctx.userHome, ".claude"),
|
|
53696
54143
|
"settings.json"
|
|
53697
54144
|
);
|
|
53698
54145
|
const isolates = claudeIsolates(settings);
|
|
53699
54146
|
if (isolates === false) pass(c.claudeAccepts());
|
|
53700
54147
|
if (isolates === true) warn(c.claudeIsolates(tilde(ctx, settings)));
|
|
54148
|
+
const style = outputStyleState({ home: ctx.userHome, env: ctx.env });
|
|
54149
|
+
if (style) pass(c.outputStyleDoctor(tilde(ctx, style.path), style.on));
|
|
53701
54150
|
}
|
|
53702
54151
|
if (h === "opencode") {
|
|
53703
54152
|
const gone = opencodeProxyProblem({
|
|
@@ -53720,6 +54169,19 @@ async function doctor(ctx) {
|
|
|
53720
54169
|
}
|
|
53721
54170
|
if (h === "openclaw") say(ctx, c.openclawDmNote());
|
|
53722
54171
|
}
|
|
54172
|
+
if (ctx.service.argv?.().length === 2) {
|
|
54173
|
+
const sh = shimState({
|
|
54174
|
+
userHome: ctx.userHome,
|
|
54175
|
+
busHome: ctx.home,
|
|
54176
|
+
platform: ctx.platform,
|
|
54177
|
+
env: ctx.env
|
|
54178
|
+
});
|
|
54179
|
+
if (sh?.kind === "ours") pass(c.shimDoctorOk(tilde(ctx, sh.path)));
|
|
54180
|
+
else if (sh?.kind === "off-path")
|
|
54181
|
+
warn(c.shimDoctorOffPath(tilde(ctx, sh.path), sh.hint));
|
|
54182
|
+
else if (sh?.kind === "other") warn(c.shimDoctorOther(tilde(ctx, sh.path)));
|
|
54183
|
+
else if (sh?.kind === "missing") warn(c.shimDoctorMissing());
|
|
54184
|
+
}
|
|
53723
54185
|
const habits = habitsLine(ctx);
|
|
53724
54186
|
if (habits) say(ctx, habits);
|
|
53725
54187
|
const allow = globalFile(ctx.home);
|
|
@@ -53753,7 +54215,7 @@ async function doctor(ctx) {
|
|
|
53753
54215
|
|
|
53754
54216
|
// src/commands/global.ts
|
|
53755
54217
|
import { realpathSync as realpathSync13, statSync as statSync11 } from "node:fs";
|
|
53756
|
-
import { resolve as
|
|
54218
|
+
import { resolve as resolve12 } from "node:path";
|
|
53757
54219
|
function shown3(ctx, path) {
|
|
53758
54220
|
const t = tilde(ctx, path);
|
|
53759
54221
|
if (t !== path) return t;
|
|
@@ -53779,7 +54241,7 @@ async function global(opts, ctx) {
|
|
|
53779
54241
|
);
|
|
53780
54242
|
return 0;
|
|
53781
54243
|
}
|
|
53782
|
-
const given =
|
|
54244
|
+
const given = resolve12(ctx.cwd, opts.dir);
|
|
53783
54245
|
let real3;
|
|
53784
54246
|
try {
|
|
53785
54247
|
real3 = canonicalPath(given);
|
|
@@ -53811,12 +54273,12 @@ async function global(opts, ctx) {
|
|
|
53811
54273
|
}
|
|
53812
54274
|
|
|
53813
54275
|
// src/commands/leads.ts
|
|
53814
|
-
import { readFileSync as
|
|
53815
|
-
import { join as
|
|
54276
|
+
import { readFileSync as readFileSync27 } from "node:fs";
|
|
54277
|
+
import { join as join33 } from "node:path";
|
|
53816
54278
|
function hubOrigin(ctx) {
|
|
53817
54279
|
try {
|
|
53818
54280
|
const raw = JSON.parse(
|
|
53819
|
-
|
|
54281
|
+
readFileSync27(join33(ctx.home, "machine.json"), "utf8")
|
|
53820
54282
|
);
|
|
53821
54283
|
return typeof raw?.hub === "string" ? new URL(raw.hub).origin : void 0;
|
|
53822
54284
|
} catch {
|
|
@@ -53875,10 +54337,10 @@ async function leads(opts, ctx) {
|
|
|
53875
54337
|
|
|
53876
54338
|
// src/commands/link.ts
|
|
53877
54339
|
import { statSync as statSync12 } from "node:fs";
|
|
53878
|
-
import { resolve as
|
|
54340
|
+
import { resolve as resolve13 } from "node:path";
|
|
53879
54341
|
init_src();
|
|
53880
54342
|
function side(ctx, dir) {
|
|
53881
|
-
const given =
|
|
54343
|
+
const given = resolve13(ctx.cwd, dir);
|
|
53882
54344
|
try {
|
|
53883
54345
|
const real3 = canonicalPath(given);
|
|
53884
54346
|
if (!statSync12(real3).isDirectory()) return void 0;
|
|
@@ -53909,7 +54371,7 @@ async function link(opts, ctx) {
|
|
|
53909
54371
|
for (const d of opts.dirs) {
|
|
53910
54372
|
const s = side(ctx, d);
|
|
53911
54373
|
if (!s) {
|
|
53912
|
-
sayErr(ctx, c.linkNotDir(shq(
|
|
54374
|
+
sayErr(ctx, c.linkNotDir(shq(resolve13(ctx.cwd, d))));
|
|
53913
54375
|
return 1;
|
|
53914
54376
|
}
|
|
53915
54377
|
sides.push(s);
|
|
@@ -53969,14 +54431,14 @@ async function link(opts, ctx) {
|
|
|
53969
54431
|
}
|
|
53970
54432
|
|
|
53971
54433
|
// src/commands/logs.ts
|
|
53972
|
-
import { readFileSync as
|
|
53973
|
-
import { join as
|
|
54434
|
+
import { readFileSync as readFileSync28 } from "node:fs";
|
|
54435
|
+
import { join as join34 } from "node:path";
|
|
53974
54436
|
var TAIL = 50;
|
|
53975
54437
|
async function logs(ctx) {
|
|
53976
|
-
const path =
|
|
54438
|
+
const path = join34(ctx.home, "logs", "daemon.log");
|
|
53977
54439
|
let text3;
|
|
53978
54440
|
try {
|
|
53979
|
-
text3 =
|
|
54441
|
+
text3 = readFileSync28(path, "utf8");
|
|
53980
54442
|
} catch {
|
|
53981
54443
|
say(ctx, ctx.copy.noLog(tilde(ctx, path)));
|
|
53982
54444
|
return 1;
|
|
@@ -54007,7 +54469,7 @@ init_src2();
|
|
|
54007
54469
|
init_src();
|
|
54008
54470
|
import { execFileSync as execFileSync6 } from "node:child_process";
|
|
54009
54471
|
import { createHash as createHash8, randomBytes as randomBytes8 } from "node:crypto";
|
|
54010
|
-
import { readFileSync as
|
|
54472
|
+
import { readFileSync as readFileSync29, readlinkSync as readlinkSync5 } from "node:fs";
|
|
54011
54473
|
import { basename as basename8 } from "node:path";
|
|
54012
54474
|
var isClaude = (name) => name === "claude" || /\/claude\/versions\/[^/]+$/.test(name);
|
|
54013
54475
|
function parsePs(out) {
|
|
@@ -54018,14 +54480,14 @@ function parsePs(out) {
|
|
|
54018
54480
|
}
|
|
54019
54481
|
function readProc(pid) {
|
|
54020
54482
|
try {
|
|
54021
|
-
const stat =
|
|
54483
|
+
const stat = readFileSync29(`/proc/${pid}/stat`, "utf8");
|
|
54022
54484
|
const ppid = Number(stat.slice(stat.lastIndexOf(")") + 1).split(/\s+/)[2]);
|
|
54023
54485
|
let exe = "";
|
|
54024
54486
|
try {
|
|
54025
|
-
exe =
|
|
54487
|
+
exe = readlinkSync5(`/proc/${pid}/exe`);
|
|
54026
54488
|
} catch {
|
|
54027
54489
|
}
|
|
54028
|
-
const comm =
|
|
54490
|
+
const comm = readFileSync29(`/proc/${pid}/comm`, "utf8").trim();
|
|
54029
54491
|
return { ppid, name: isClaude(exe) ? exe : comm };
|
|
54030
54492
|
} catch {
|
|
54031
54493
|
}
|
|
@@ -54053,7 +54515,7 @@ function findClaude(from, proc) {
|
|
|
54053
54515
|
function tokenOf(file2) {
|
|
54054
54516
|
if (!file2) return void 0;
|
|
54055
54517
|
try {
|
|
54056
|
-
return
|
|
54518
|
+
return readFileSync29(file2, "utf8").trim() || void 0;
|
|
54057
54519
|
} catch {
|
|
54058
54520
|
return void 0;
|
|
54059
54521
|
}
|
|
@@ -54082,7 +54544,7 @@ async function mcpProof(opts, ctx, deps2 = {
|
|
|
54082
54544
|
|
|
54083
54545
|
// src/commands/namespace.ts
|
|
54084
54546
|
import { realpathSync as realpathSync14, statSync as statSync13 } from "node:fs";
|
|
54085
|
-
import { join as
|
|
54547
|
+
import { join as join35, resolve as resolve14 } from "node:path";
|
|
54086
54548
|
init_src();
|
|
54087
54549
|
function shown4(ctx, path) {
|
|
54088
54550
|
const t = tilde(ctx, path);
|
|
@@ -54109,7 +54571,7 @@ async function namespace(opts, ctx) {
|
|
|
54109
54571
|
);
|
|
54110
54572
|
return 0;
|
|
54111
54573
|
}
|
|
54112
|
-
const given =
|
|
54574
|
+
const given = resolve14(ctx.cwd, opts.dir);
|
|
54113
54575
|
let real3;
|
|
54114
54576
|
try {
|
|
54115
54577
|
real3 = canonicalPath(given);
|
|
@@ -54136,7 +54598,7 @@ async function namespace(opts, ctx) {
|
|
|
54136
54598
|
sayErr(ctx, c.nsNotDir(shown4(ctx, real3 ?? given)));
|
|
54137
54599
|
return 1;
|
|
54138
54600
|
}
|
|
54139
|
-
const cfgFile =
|
|
54601
|
+
const cfgFile = join35(real3, CONFIG_FILE);
|
|
54140
54602
|
const own2 = readOwnFile(cfgFile, process.getuid?.(), {
|
|
54141
54603
|
allowGroupWrite: true
|
|
54142
54604
|
});
|
|
@@ -54210,12 +54672,12 @@ async function namespace(opts, ctx) {
|
|
|
54210
54672
|
}
|
|
54211
54673
|
|
|
54212
54674
|
// src/commands/uninstall.ts
|
|
54213
|
-
import { join as
|
|
54675
|
+
import { join as join37 } from "node:path";
|
|
54214
54676
|
|
|
54215
54677
|
// src/steps/purge.ts
|
|
54216
54678
|
init_src3();
|
|
54217
|
-
import { lstatSync as
|
|
54218
|
-
import { join as
|
|
54679
|
+
import { lstatSync as lstatSync17, readdirSync as readdirSync9, rmdirSync as rmdirSync4, rmSync as rmSync16 } from "node:fs";
|
|
54680
|
+
import { join as join36 } from "node:path";
|
|
54219
54681
|
var FILES = [
|
|
54220
54682
|
"machine.json",
|
|
54221
54683
|
"install.json",
|
|
@@ -54248,16 +54710,16 @@ var FOLDERS = [
|
|
|
54248
54710
|
];
|
|
54249
54711
|
function kind3(path) {
|
|
54250
54712
|
try {
|
|
54251
|
-
const st =
|
|
54713
|
+
const st = lstatSync17(path);
|
|
54252
54714
|
return st.isDirectory() ? "dir" : st.isSocket() ? "socket" : "other";
|
|
54253
54715
|
} catch {
|
|
54254
54716
|
return void 0;
|
|
54255
54717
|
}
|
|
54256
54718
|
}
|
|
54257
|
-
var remove2 = (path, k) =>
|
|
54719
|
+
var remove2 = (path, k) => rmSync16(path, { recursive: k === "dir", force: true });
|
|
54258
54720
|
var rmdirIfEmpty = (path) => {
|
|
54259
54721
|
try {
|
|
54260
|
-
|
|
54722
|
+
rmdirSync4(path);
|
|
54261
54723
|
return true;
|
|
54262
54724
|
} catch {
|
|
54263
54725
|
return false;
|
|
@@ -54265,14 +54727,14 @@ var rmdirIfEmpty = (path) => {
|
|
|
54265
54727
|
};
|
|
54266
54728
|
function purgeShort(dir, removed) {
|
|
54267
54729
|
if (kind3(dir) !== "dir" || unsafeSocketDir(dir)) return;
|
|
54268
|
-
const ret =
|
|
54730
|
+
const ret = join36(dir, "claude-return");
|
|
54269
54731
|
for (const [d, ours2] of [
|
|
54270
54732
|
[ret, (_n, p) => kind3(p) === "socket"],
|
|
54271
54733
|
[dir, (n) => /^daemon\.sock(\.keep-\d+)?$/.test(n)]
|
|
54272
54734
|
]) {
|
|
54273
54735
|
if (kind3(d) !== "dir") continue;
|
|
54274
|
-
for (const name of
|
|
54275
|
-
const path =
|
|
54736
|
+
for (const name of readdirSync9(d)) {
|
|
54737
|
+
const path = join36(d, name);
|
|
54276
54738
|
const k = kind3(path);
|
|
54277
54739
|
if (k === void 0 || k === "dir" || !ours2(name, path)) continue;
|
|
54278
54740
|
remove2(path, k);
|
|
@@ -54285,7 +54747,7 @@ function purgeShort(dir, removed) {
|
|
|
54285
54747
|
function purge(home2, opts) {
|
|
54286
54748
|
let entries;
|
|
54287
54749
|
try {
|
|
54288
|
-
entries =
|
|
54750
|
+
entries = readdirSync9(home2);
|
|
54289
54751
|
} catch {
|
|
54290
54752
|
return { removed: [], leftDir: false };
|
|
54291
54753
|
}
|
|
@@ -54297,21 +54759,21 @@ function purge(home2, opts) {
|
|
|
54297
54759
|
...FILES,
|
|
54298
54760
|
...entries.filter((n) => TEMP.some((re) => re.test(n)))
|
|
54299
54761
|
]) {
|
|
54300
|
-
const path =
|
|
54762
|
+
const path = join36(home2, name);
|
|
54301
54763
|
const k = kind3(path);
|
|
54302
54764
|
if (k === void 0 || k === "dir") continue;
|
|
54303
54765
|
remove2(path, k);
|
|
54304
54766
|
removed.push(name);
|
|
54305
54767
|
}
|
|
54306
54768
|
for (const folder of FOLDERS) {
|
|
54307
|
-
const dir =
|
|
54769
|
+
const dir = join36(home2, folder.path);
|
|
54308
54770
|
if (kind3(dir) !== "dir") continue;
|
|
54309
|
-
for (const name of
|
|
54310
|
-
const path =
|
|
54771
|
+
for (const name of readdirSync9(dir)) {
|
|
54772
|
+
const path = join36(dir, name);
|
|
54311
54773
|
const k = kind3(path);
|
|
54312
54774
|
if (k === void 0 || !folder.ours(name, path)) continue;
|
|
54313
54775
|
remove2(path, k);
|
|
54314
|
-
removed.push(
|
|
54776
|
+
removed.push(join36(folder.path, name));
|
|
54315
54777
|
}
|
|
54316
54778
|
if (rmdirIfEmpty(dir)) removed.push(folder.path);
|
|
54317
54779
|
}
|
|
@@ -54350,6 +54812,18 @@ async function uninstall2(opts, ctx) {
|
|
|
54350
54812
|
`Could not remove the skill files: ${e instanceof Error ? e.message : String(e)}`
|
|
54351
54813
|
]);
|
|
54352
54814
|
}
|
|
54815
|
+
try {
|
|
54816
|
+
const style = uninstallOutputStyle({
|
|
54817
|
+
home: ctx.userHome,
|
|
54818
|
+
busHome: ctx.home,
|
|
54819
|
+
env: ctx.env
|
|
54820
|
+
});
|
|
54821
|
+
for (const n of style.notes) say(ctx, [n]);
|
|
54822
|
+
} catch (e) {
|
|
54823
|
+
say(ctx, [
|
|
54824
|
+
`Could not remove the output style: ${e instanceof Error ? e.message : String(e)}`
|
|
54825
|
+
]);
|
|
54826
|
+
}
|
|
54353
54827
|
try {
|
|
54354
54828
|
const habits = removeHabits({
|
|
54355
54829
|
home: ctx.userHome,
|
|
@@ -54362,11 +54836,23 @@ async function uninstall2(opts, ctx) {
|
|
|
54362
54836
|
`Could not remove the habits block: ${e instanceof Error ? e.message : String(e)}`
|
|
54363
54837
|
]);
|
|
54364
54838
|
}
|
|
54839
|
+
try {
|
|
54840
|
+
const gone = removeShim({
|
|
54841
|
+
userHome: ctx.userHome,
|
|
54842
|
+
busHome: ctx.home,
|
|
54843
|
+
platform: ctx.platform
|
|
54844
|
+
});
|
|
54845
|
+
if (gone) say(ctx, c.shimRemoved(tilde(ctx, gone)));
|
|
54846
|
+
} catch (e) {
|
|
54847
|
+
say(ctx, [
|
|
54848
|
+
`Could not remove the oa-bus command: ${e instanceof Error ? e.message : String(e)}`
|
|
54849
|
+
]);
|
|
54850
|
+
}
|
|
54365
54851
|
if (r.hermesNoCli)
|
|
54366
54852
|
say(
|
|
54367
54853
|
ctx,
|
|
54368
54854
|
c.hermesNoCli(
|
|
54369
|
-
tilde(ctx,
|
|
54855
|
+
tilde(ctx, join37(hermesHome(ctx.userHome, ctx.env), "config.yaml"))
|
|
54370
54856
|
)
|
|
54371
54857
|
);
|
|
54372
54858
|
if (r.openclawNoCli) say(ctx, c.openclawNoCli());
|
|
@@ -54385,7 +54871,7 @@ async function uninstall2(opts, ctx) {
|
|
|
54385
54871
|
r.opencodeRestarted ? c.restartedUnload() : c.opencodeNotRunningUnload()
|
|
54386
54872
|
);
|
|
54387
54873
|
if (!opts.purge) {
|
|
54388
|
-
say(ctx, "", c.kept(tilde(ctx,
|
|
54874
|
+
say(ctx, "", c.kept(tilde(ctx, join37(ctx.home, "machine.json"))));
|
|
54389
54875
|
return 0;
|
|
54390
54876
|
}
|
|
54391
54877
|
const home2 = tilde(ctx, ctx.home);
|
|
@@ -54396,7 +54882,7 @@ async function uninstall2(opts, ctx) {
|
|
|
54396
54882
|
} catch {
|
|
54397
54883
|
}
|
|
54398
54884
|
const out = purge(ctx.home, {
|
|
54399
|
-
isDefault: ctx.home ===
|
|
54885
|
+
isDefault: ctx.home === join37(ctx.userHome, ".oa-bus")
|
|
54400
54886
|
});
|
|
54401
54887
|
if ("refused" in out) {
|
|
54402
54888
|
sayErr(ctx, c.purgeRefused(home2));
|
|
@@ -54627,7 +55113,7 @@ async function main(argv, makeCtx = realCtx) {
|
|
|
54627
55113
|
return 2;
|
|
54628
55114
|
}
|
|
54629
55115
|
const ctx = makeCtx(cmd.noColor);
|
|
54630
|
-
if (cmd.home) ctx.home =
|
|
55116
|
+
if (cmd.home) ctx.home = resolve15(cmd.home);
|
|
54631
55117
|
try {
|
|
54632
55118
|
return await dispatch(cmd, ctx);
|
|
54633
55119
|
} catch (e) {
|