@open-artifacts/bus 0.142.0 → 0.144.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 +219 -78
- package/package.json +1 -1
package/assets/oa-bus.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { StringDecoder } from "node:string_decoder";
|
|
|
11
11
|
type Json = Record<string, unknown>;
|
|
12
12
|
|
|
13
13
|
/** The IPC marker (CONTRACT.md): the package version, stamped by the CLI's bundler. */
|
|
14
|
-
const CLIENT_VERSION = "0.
|
|
14
|
+
const CLIENT_VERSION = "0.144.0";
|
|
15
15
|
|
|
16
16
|
type Frame = Json & { type: string; id: string };
|
|
17
17
|
type Ctx = {
|
package/assets/openclaw/index.js
CHANGED
|
@@ -28817,7 +28817,7 @@ var base = { v: external_exports.literal(V), id: external_exports.string().min(1
|
|
|
28817
28817
|
var late = { late: external_exports.array(external_exports.string().min(1)).optional() };
|
|
28818
28818
|
var isWellFormed = (s) => s.isWellFormed();
|
|
28819
28819
|
var WELL_FORMED = { message: "text is not well-formed unicode" };
|
|
28820
|
-
var CLIENT_VERSION = true ? "0.
|
|
28820
|
+
var CLIENT_VERSION = true ? "0.144.0" : "0.0.0";
|
|
28821
28821
|
var clientVersion = {
|
|
28822
28822
|
client_version: external_exports.string().min(1).max(64).optional()
|
|
28823
28823
|
};
|
package/dist/index.js
CHANGED
|
@@ -32639,7 +32639,7 @@ var init_frames = __esm({
|
|
|
32639
32639
|
late = { late: external_exports.array(external_exports.string().min(1)).optional() };
|
|
32640
32640
|
isWellFormed2 = (s) => s.isWellFormed();
|
|
32641
32641
|
WELL_FORMED = { message: "text is not well-formed unicode" };
|
|
32642
|
-
CLIENT_VERSION = true ? "0.
|
|
32642
|
+
CLIENT_VERSION = true ? "0.144.0" : "0.0.0";
|
|
32643
32643
|
clientVersion = {
|
|
32644
32644
|
client_version: external_exports.string().min(1).max(64).optional()
|
|
32645
32645
|
};
|
|
@@ -38724,7 +38724,7 @@ import { join as join18 } from "node:path";
|
|
|
38724
38724
|
|
|
38725
38725
|
// ../bus-daemon/src/index.ts
|
|
38726
38726
|
init_src3();
|
|
38727
|
-
import { lstatSync as lstatSync7, realpathSync as realpathSync7, writeFileSync as
|
|
38727
|
+
import { lstatSync as lstatSync7, realpathSync as realpathSync7, writeFileSync as writeFileSync5 } from "node:fs";
|
|
38728
38728
|
import { basename as basename5, isAbsolute as isAbsolute6, join as join14 } from "node:path";
|
|
38729
38729
|
|
|
38730
38730
|
// ../bus-adapter-opencode/src/version.ts
|
|
@@ -39194,10 +39194,36 @@ function codexAttestor(deps2 = {}) {
|
|
|
39194
39194
|
});
|
|
39195
39195
|
return still;
|
|
39196
39196
|
};
|
|
39197
|
+
const restore = ({ thread, pid, start }) => {
|
|
39198
|
+
const home2 = deps2.home ?? codexHome();
|
|
39199
|
+
const proc = procs([pid]).get(pid);
|
|
39200
|
+
if (!proc || basename2(proc.comm) !== "codex" || proc.start !== start)
|
|
39201
|
+
return void 0;
|
|
39202
|
+
const was = pinned.get(pid);
|
|
39203
|
+
if (was !== void 0 && was !== start) return void 0;
|
|
39204
|
+
const row = threadRow(home2, thread);
|
|
39205
|
+
const rollout = row?.rollout_path ?? globRollout(home2, thread);
|
|
39206
|
+
if (!rollout || !plainFile(rollout)) return void 0;
|
|
39207
|
+
const meta3 = metaOf2(rollout, thread);
|
|
39208
|
+
if (!meta3 || typeof meta3.cwd !== "string" || !isAbsolute(meta3.cwd))
|
|
39209
|
+
return void 0;
|
|
39210
|
+
if (isSubagent(row ? row.source : meta3.source) || isSubagent(meta3.source) || SPAWNED_SOURCES.has(String(meta3.thread_source)))
|
|
39211
|
+
return void 0;
|
|
39212
|
+
const had = was !== void 0;
|
|
39213
|
+
pinned.set(pid, start);
|
|
39214
|
+
proofs.set(`${pid}\0${start}\0${thread}`, { cwd: meta3.cwd, rollout });
|
|
39215
|
+
if (sweep([{ thread, pid }], true).has(thread)) return { cwd: meta3.cwd };
|
|
39216
|
+
proofs.delete(`${pid}\0${start}\0${thread}`);
|
|
39217
|
+
if (!had && ![...proofs.keys()].some((k) => k.startsWith(`${pid}\0`)))
|
|
39218
|
+
pinned.delete(pid);
|
|
39219
|
+
return void 0;
|
|
39220
|
+
};
|
|
39197
39221
|
return {
|
|
39198
39222
|
attest: (hello) => check2(hello, true),
|
|
39199
39223
|
attestNow: (hello) => check2(hello, false),
|
|
39200
|
-
sweep
|
|
39224
|
+
sweep,
|
|
39225
|
+
startOf: (pid) => pinned.get(pid),
|
|
39226
|
+
restore
|
|
39201
39227
|
};
|
|
39202
39228
|
}
|
|
39203
39229
|
function advance(scan2) {
|
|
@@ -39720,9 +39746,10 @@ function defaultOpenSessions() {
|
|
|
39720
39746
|
});
|
|
39721
39747
|
}
|
|
39722
39748
|
|
|
39723
|
-
// ../bus-daemon/src/codex-
|
|
39724
|
-
|
|
39725
|
-
|
|
39749
|
+
// ../bus-daemon/src/codex-agents.ts
|
|
39750
|
+
init_src();
|
|
39751
|
+
init_zod();
|
|
39752
|
+
import { chmodSync as chmodSync3, renameSync as renameSync2, writeFileSync } from "node:fs";
|
|
39726
39753
|
|
|
39727
39754
|
// ../bus-daemon/src/own-file.ts
|
|
39728
39755
|
import {
|
|
@@ -39818,7 +39845,51 @@ function readOwnFile(file2, uid = process.getuid?.(), opts = {}) {
|
|
|
39818
39845
|
}
|
|
39819
39846
|
}
|
|
39820
39847
|
|
|
39848
|
+
// ../bus-daemon/src/codex-agents.ts
|
|
39849
|
+
var CodexAgentSchema = external_exports.strictObject({
|
|
39850
|
+
/** Joined into the thread's lock path: a real ref, never `../`. */
|
|
39851
|
+
ref: AgentRefSchema,
|
|
39852
|
+
pid: external_exports.number().int().positive(),
|
|
39853
|
+
/** The process start as `ps` printed it when pinned. */
|
|
39854
|
+
procStart: external_exports.string().min(1).max(100),
|
|
39855
|
+
proposedName: external_exports.string().min(1).max(200),
|
|
39856
|
+
sentName: external_exports.string().max(200).optional(),
|
|
39857
|
+
busName: external_exports.string().min(1).max(200)
|
|
39858
|
+
});
|
|
39859
|
+
var FileSchema = external_exports.strictObject({
|
|
39860
|
+
v: external_exports.literal(1),
|
|
39861
|
+
agents: external_exports.array(external_exports.unknown())
|
|
39862
|
+
});
|
|
39863
|
+
function readCodexAgents(file2, uid = process.getuid?.()) {
|
|
39864
|
+
try {
|
|
39865
|
+
const f = readOwnFile(file2, uid);
|
|
39866
|
+
if (f.state !== "ok") return [];
|
|
39867
|
+
const top = FileSchema.safeParse(JSON.parse(f.text));
|
|
39868
|
+
if (!top.success) return [];
|
|
39869
|
+
const seen2 = /* @__PURE__ */ new Set();
|
|
39870
|
+
const out = [];
|
|
39871
|
+
for (const raw of top.data.agents) {
|
|
39872
|
+
if (out.length >= LIMITS.maxAgentsPerMachine) break;
|
|
39873
|
+
const one2 = CodexAgentSchema.safeParse(raw);
|
|
39874
|
+
if (!one2.success || seen2.has(one2.data.ref)) continue;
|
|
39875
|
+
seen2.add(one2.data.ref);
|
|
39876
|
+
out.push(one2.data);
|
|
39877
|
+
}
|
|
39878
|
+
return out;
|
|
39879
|
+
} catch {
|
|
39880
|
+
return [];
|
|
39881
|
+
}
|
|
39882
|
+
}
|
|
39883
|
+
function writeCodexAgents(file2, agents) {
|
|
39884
|
+
const tmp = `${file2}.${process.pid}.tmp`;
|
|
39885
|
+
writeFileSync(tmp, JSON.stringify({ v: 1, agents }), { mode: 384 });
|
|
39886
|
+
chmodSync3(tmp, 384);
|
|
39887
|
+
renameSync2(tmp, file2);
|
|
39888
|
+
}
|
|
39889
|
+
|
|
39821
39890
|
// ../bus-daemon/src/codex-names.ts
|
|
39891
|
+
import { closeSync as closeSync3, constants as constants2, fstatSync as fstatSync3, openSync as openSync3, readSync as readSync2 } from "node:fs";
|
|
39892
|
+
import { join as join7 } from "node:path";
|
|
39822
39893
|
var CODEX_INDEX_MAX_BYTES = 1024 * 1024;
|
|
39823
39894
|
var codexThreadNames = (home2, opts = {}) => {
|
|
39824
39895
|
const uid = "uid" in opts ? opts.uid : process.getuid?.();
|
|
@@ -39886,13 +39957,13 @@ import { dirname as dirname5, join as join10 } from "node:path";
|
|
|
39886
39957
|
// ../bus-daemon/src/global.ts
|
|
39887
39958
|
import { randomBytes } from "node:crypto";
|
|
39888
39959
|
import {
|
|
39889
|
-
chmodSync as
|
|
39960
|
+
chmodSync as chmodSync4,
|
|
39890
39961
|
closeSync as closeSync4,
|
|
39891
39962
|
lstatSync as lstatSync4,
|
|
39892
39963
|
mkdirSync as mkdirSync4,
|
|
39893
39964
|
openSync as openSync4,
|
|
39894
39965
|
realpathSync as realpathSync3,
|
|
39895
|
-
renameSync as
|
|
39966
|
+
renameSync as renameSync3,
|
|
39896
39967
|
statSync as statSync6,
|
|
39897
39968
|
unlinkSync,
|
|
39898
39969
|
writeSync
|
|
@@ -39965,7 +40036,7 @@ function sameDir(entry, dir) {
|
|
|
39965
40036
|
}
|
|
39966
40037
|
function writeGlobalDirs(dirs, h = home()) {
|
|
39967
40038
|
mkdirSync4(h, { recursive: true, mode: 448 });
|
|
39968
|
-
|
|
40039
|
+
chmodSync4(h, 448);
|
|
39969
40040
|
const tmp = join8(h, `.global.json.${randomBytes(8).toString("hex")}.tmp`);
|
|
39970
40041
|
const fd = openSync4(tmp, "wx", 384);
|
|
39971
40042
|
try {
|
|
@@ -39978,8 +40049,8 @@ function writeGlobalDirs(dirs, h = home()) {
|
|
|
39978
40049
|
}
|
|
39979
40050
|
closeSync4(fd);
|
|
39980
40051
|
try {
|
|
39981
|
-
|
|
39982
|
-
|
|
40052
|
+
chmodSync4(tmp, 384);
|
|
40053
|
+
renameSync3(tmp, globalFile(h));
|
|
39983
40054
|
} catch (e) {
|
|
39984
40055
|
unlinkSync(tmp);
|
|
39985
40056
|
throw e;
|
|
@@ -39996,11 +40067,11 @@ import { basename as basename4, dirname as dirname4, resolve as resolve2 } from
|
|
|
39996
40067
|
import { randomBytes as randomBytes2 } from "node:crypto";
|
|
39997
40068
|
import {
|
|
39998
40069
|
appendFileSync,
|
|
39999
|
-
chmodSync as
|
|
40070
|
+
chmodSync as chmodSync5,
|
|
40000
40071
|
closeSync as closeSync5,
|
|
40001
40072
|
mkdirSync as mkdirSync5,
|
|
40002
40073
|
openSync as openSync5,
|
|
40003
|
-
renameSync as
|
|
40074
|
+
renameSync as renameSync4,
|
|
40004
40075
|
unlinkSync as unlinkSync2,
|
|
40005
40076
|
writeSync as writeSync2
|
|
40006
40077
|
} from "node:fs";
|
|
@@ -40028,7 +40099,7 @@ function isApproved(dir, namespace2, entries) {
|
|
|
40028
40099
|
}
|
|
40029
40100
|
function writeApprovals(entries, h = home()) {
|
|
40030
40101
|
mkdirSync5(h, { recursive: true, mode: 448 });
|
|
40031
|
-
|
|
40102
|
+
chmodSync5(h, 448);
|
|
40032
40103
|
const tmp = join9(h, `.namespaces.json.${randomBytes2(8).toString("hex")}.tmp`);
|
|
40033
40104
|
const fd = openSync5(tmp, "wx", 384);
|
|
40034
40105
|
try {
|
|
@@ -40041,8 +40112,8 @@ function writeApprovals(entries, h = home()) {
|
|
|
40041
40112
|
}
|
|
40042
40113
|
closeSync5(fd);
|
|
40043
40114
|
try {
|
|
40044
|
-
|
|
40045
|
-
|
|
40115
|
+
chmodSync5(tmp, 384);
|
|
40116
|
+
renameSync4(tmp, namespacesFile(h));
|
|
40046
40117
|
} catch (e) {
|
|
40047
40118
|
unlinkSync2(tmp);
|
|
40048
40119
|
throw e;
|
|
@@ -40055,7 +40126,7 @@ function logApproval(entry, h = home(), now = /* @__PURE__ */ new Date()) {
|
|
|
40055
40126
|
const line = `${now.toISOString()} ${entry.action} dir=${JSON.stringify(entry.dir)} namespace=${JSON.stringify(entry.namespace)} tty=${entry.tty ? "yes" : "no"}
|
|
40056
40127
|
`;
|
|
40057
40128
|
appendFileSync(file2, line, { mode: 384 });
|
|
40058
|
-
|
|
40129
|
+
chmodSync5(file2, 384);
|
|
40059
40130
|
}
|
|
40060
40131
|
|
|
40061
40132
|
// ../bus-daemon/src/namespace.ts
|
|
@@ -41612,11 +41683,11 @@ function routeLocal(frame, hello, reply, ctx) {
|
|
|
41612
41683
|
init_src2();
|
|
41613
41684
|
init_src();
|
|
41614
41685
|
import {
|
|
41615
|
-
chmodSync as
|
|
41686
|
+
chmodSync as chmodSync6,
|
|
41616
41687
|
readFileSync as readFileSync7,
|
|
41617
|
-
renameSync as
|
|
41688
|
+
renameSync as renameSync5,
|
|
41618
41689
|
rmSync as rmSync2,
|
|
41619
|
-
writeFileSync
|
|
41690
|
+
writeFileSync as writeFileSync2
|
|
41620
41691
|
} from "node:fs";
|
|
41621
41692
|
var metaOf = ({
|
|
41622
41693
|
at: _,
|
|
@@ -41838,12 +41909,12 @@ var SentStore = class {
|
|
|
41838
41909
|
const tmp = `${this.file}.${process.pid}.tmp`;
|
|
41839
41910
|
try {
|
|
41840
41911
|
rmSync2(tmp, { force: true });
|
|
41841
|
-
|
|
41912
|
+
writeFileSync2(tmp, JSON.stringify(Object.fromEntries(this.#all)), {
|
|
41842
41913
|
mode: 384,
|
|
41843
41914
|
flag: "wx"
|
|
41844
41915
|
});
|
|
41845
|
-
|
|
41846
|
-
|
|
41916
|
+
chmodSync6(tmp, 384);
|
|
41917
|
+
renameSync5(tmp, this.file);
|
|
41847
41918
|
} catch (e) {
|
|
41848
41919
|
this.#log?.(
|
|
41849
41920
|
`sent file write failed: ${e instanceof Error ? e.message : String(e)}`
|
|
@@ -42019,20 +42090,20 @@ init_src3();
|
|
|
42019
42090
|
init_src();
|
|
42020
42091
|
import { createHash as createHash4, randomUUID } from "node:crypto";
|
|
42021
42092
|
import {
|
|
42022
|
-
chmodSync as
|
|
42093
|
+
chmodSync as chmodSync8,
|
|
42023
42094
|
lstatSync as lstatSync5,
|
|
42024
42095
|
mkdirSync as mkdirSync6,
|
|
42025
42096
|
readFileSync as readFileSync9,
|
|
42026
|
-
renameSync as
|
|
42097
|
+
renameSync as renameSync7,
|
|
42027
42098
|
rmSync as rmSync3,
|
|
42028
|
-
writeFileSync as
|
|
42099
|
+
writeFileSync as writeFileSync4
|
|
42029
42100
|
} from "node:fs";
|
|
42030
42101
|
import { createServer as createServer2 } from "node:net";
|
|
42031
42102
|
import { dirname as dirname6, join as join11 } from "node:path";
|
|
42032
42103
|
import { createInterface } from "node:readline";
|
|
42033
42104
|
|
|
42034
42105
|
// ../bus-daemon/src/transports/held.ts
|
|
42035
|
-
import { chmodSync as
|
|
42106
|
+
import { chmodSync as chmodSync7, readFileSync as readFileSync8, renameSync as renameSync6, writeFileSync as writeFileSync3 } from "node:fs";
|
|
42036
42107
|
var HeldStore = class {
|
|
42037
42108
|
constructor(file2, opts = {}) {
|
|
42038
42109
|
this.file = file2;
|
|
@@ -42070,9 +42141,9 @@ var HeldStore = class {
|
|
|
42070
42141
|
}
|
|
42071
42142
|
#write(all) {
|
|
42072
42143
|
const tmp = `${this.file}.${process.pid}.tmp`;
|
|
42073
|
-
|
|
42074
|
-
|
|
42075
|
-
|
|
42144
|
+
writeFileSync3(tmp, JSON.stringify(all), { mode: 384 });
|
|
42145
|
+
chmodSync7(tmp, 384);
|
|
42146
|
+
renameSync6(tmp, this.file);
|
|
42076
42147
|
}
|
|
42077
42148
|
};
|
|
42078
42149
|
|
|
@@ -42409,7 +42480,7 @@ var ClaudeTransport = class {
|
|
|
42409
42480
|
if (unsafe) throw new UnsafeDir(unsafe);
|
|
42410
42481
|
} else {
|
|
42411
42482
|
mkdirSync6(this.opts.socketsDir, { recursive: true, mode: 448 });
|
|
42412
|
-
|
|
42483
|
+
chmodSync8(this.opts.socketsDir, 448);
|
|
42413
42484
|
}
|
|
42414
42485
|
rmSync3(path, { force: true });
|
|
42415
42486
|
this.#paths.set(key2, path);
|
|
@@ -42441,7 +42512,7 @@ var ClaudeTransport = class {
|
|
|
42441
42512
|
sink.server.once("error", reject);
|
|
42442
42513
|
sink.server.listen(path, () => resolve13());
|
|
42443
42514
|
});
|
|
42444
|
-
|
|
42515
|
+
chmodSync8(path, 384);
|
|
42445
42516
|
return sink;
|
|
42446
42517
|
}
|
|
42447
42518
|
/** Paths of the sinks bound or binding now, by key. */
|
|
@@ -42481,9 +42552,9 @@ var ClaudeTransport = class {
|
|
|
42481
42552
|
const out = /* @__PURE__ */ Object.create(null);
|
|
42482
42553
|
for (const [k, v] of keep) out[k] = v;
|
|
42483
42554
|
const tmp = `${file2}.${process.pid}.tmp`;
|
|
42484
|
-
|
|
42485
|
-
|
|
42486
|
-
|
|
42555
|
+
writeFileSync4(tmp, JSON.stringify(out), { mode: 384 });
|
|
42556
|
+
chmodSync8(tmp, 384);
|
|
42557
|
+
renameSync7(tmp, file2);
|
|
42487
42558
|
return out;
|
|
42488
42559
|
} catch (e) {
|
|
42489
42560
|
this.opts.log?.(
|
|
@@ -43773,7 +43844,7 @@ async function runDaemon(deps2 = {}) {
|
|
|
43773
43844
|
log(`this machine was revoked; run \`${BUS_CMD} install\``);
|
|
43774
43845
|
process.exitCode = 1;
|
|
43775
43846
|
try {
|
|
43776
|
-
|
|
43847
|
+
writeFileSync5(
|
|
43777
43848
|
deps2.revokedFile ?? join14(home(), "revoked"),
|
|
43778
43849
|
revokedMarker(cfg.machine_token),
|
|
43779
43850
|
{ mode: 384 }
|
|
@@ -44033,6 +44104,7 @@ async function runDaemon(deps2 = {}) {
|
|
|
44033
44104
|
live: true
|
|
44034
44105
|
});
|
|
44035
44106
|
if (rec.kind === "opencode") ocServiceStart.set(rec.ref, ocStart(pid));
|
|
44107
|
+
if (rec.kind === "codex") persistCodex();
|
|
44036
44108
|
if (rec.kind === "claude-code") void claude.revive(rec.ref);
|
|
44037
44109
|
conns.set(rec.ref, (conns.get(rec.ref) ?? 0) + 1);
|
|
44038
44110
|
announceUp(rec);
|
|
@@ -44157,11 +44229,78 @@ async function runDaemon(deps2 = {}) {
|
|
|
44157
44229
|
deps2.onSocketLost?.();
|
|
44158
44230
|
}, deps2.socketCheckMs ?? 6e4);
|
|
44159
44231
|
socketWatch.unref();
|
|
44232
|
+
const codexAgentsFile = cx.agentsFile ?? join14(home(), "codex-agents.json");
|
|
44233
|
+
let codexSaved;
|
|
44234
|
+
const persistCodex = () => {
|
|
44235
|
+
const rows = [];
|
|
44236
|
+
for (const a of agents.all()) {
|
|
44237
|
+
if (a.kind !== "codex" || !a.live) continue;
|
|
44238
|
+
const procStart = codexCheck.startOf(a.pid);
|
|
44239
|
+
if (procStart === void 0) continue;
|
|
44240
|
+
rows.push({
|
|
44241
|
+
ref: a.ref,
|
|
44242
|
+
pid: a.pid,
|
|
44243
|
+
procStart,
|
|
44244
|
+
proposedName: a.proposedName,
|
|
44245
|
+
...a.sentName !== void 0 ? { sentName: a.sentName } : {},
|
|
44246
|
+
busName: a.busName
|
|
44247
|
+
});
|
|
44248
|
+
}
|
|
44249
|
+
const text3 = JSON.stringify(rows);
|
|
44250
|
+
if (codexSaved === void 0 ? rows.length === 0 : text3 === codexSaved)
|
|
44251
|
+
return;
|
|
44252
|
+
try {
|
|
44253
|
+
writeCodexAgents(codexAgentsFile, rows);
|
|
44254
|
+
codexSaved = text3;
|
|
44255
|
+
} catch (e) {
|
|
44256
|
+
log(
|
|
44257
|
+
`could not save the live Codex threads: ${e instanceof Error ? e.message : String(e)}`
|
|
44258
|
+
);
|
|
44259
|
+
}
|
|
44260
|
+
};
|
|
44261
|
+
const restoreCodex = () => {
|
|
44262
|
+
if (deps2.attest) return;
|
|
44263
|
+
for (const r of readCodexAgents(codexAgentsFile)) {
|
|
44264
|
+
if (agents.byRef(r.ref)) continue;
|
|
44265
|
+
let proven;
|
|
44266
|
+
try {
|
|
44267
|
+
proven = codexCheck.restore({
|
|
44268
|
+
thread: r.ref,
|
|
44269
|
+
pid: r.pid,
|
|
44270
|
+
start: r.procStart
|
|
44271
|
+
});
|
|
44272
|
+
} catch {
|
|
44273
|
+
}
|
|
44274
|
+
if (!proven) continue;
|
|
44275
|
+
let ns;
|
|
44276
|
+
try {
|
|
44277
|
+
ns = resolveNs(proven.cwd, true);
|
|
44278
|
+
} catch {
|
|
44279
|
+
continue;
|
|
44280
|
+
}
|
|
44281
|
+
if (!WireNamespaceSchema.safeParse(ns.namespace).success) continue;
|
|
44282
|
+
agents.up({
|
|
44283
|
+
ref: r.ref,
|
|
44284
|
+
kind: "codex",
|
|
44285
|
+
proposedName: r.proposedName,
|
|
44286
|
+
busName: r.busName,
|
|
44287
|
+
namespace: ns.namespace,
|
|
44288
|
+
global: ns.global,
|
|
44289
|
+
pid: r.pid,
|
|
44290
|
+
procStart: r.procStart,
|
|
44291
|
+
cwd: proven.cwd,
|
|
44292
|
+
live: true,
|
|
44293
|
+
...r.sentName !== void 0 ? { sentName: r.sentName } : {}
|
|
44294
|
+
});
|
|
44295
|
+
seenAt.set(r.ref, ++seenSeq);
|
|
44296
|
+
if (debug) log(`restored codex thread ${r.ref.slice(0, 8)} pid ${r.pid}`);
|
|
44297
|
+
}
|
|
44298
|
+
};
|
|
44160
44299
|
const syncCodex = () => {
|
|
44161
44300
|
renameCodexThreads();
|
|
44162
44301
|
const live = agents.all().filter((a) => a.kind === "codex" && a.live).map((a) => ({ thread: a.ref, pid: a.pid }));
|
|
44163
44302
|
codexTicks = (codexTicks + 1) % relockEvery;
|
|
44164
|
-
if (!live.length || deps2.attest) return;
|
|
44303
|
+
if (!live.length || deps2.attest) return persistCodex();
|
|
44165
44304
|
const still = codexCheck.sweep(live, codexTicks === 0);
|
|
44166
44305
|
let closed = false;
|
|
44167
44306
|
for (const { thread } of live) {
|
|
@@ -44171,6 +44310,7 @@ async function runDaemon(deps2 = {}) {
|
|
|
44171
44310
|
closed = true;
|
|
44172
44311
|
}
|
|
44173
44312
|
if (closed) announceSessions();
|
|
44313
|
+
persistCodex();
|
|
44174
44314
|
};
|
|
44175
44315
|
const sync = () => {
|
|
44176
44316
|
for (const rec of agents.all()) if (rec.live) flushRename(rec);
|
|
@@ -44188,6 +44328,7 @@ async function runDaemon(deps2 = {}) {
|
|
|
44188
44328
|
}
|
|
44189
44329
|
}
|
|
44190
44330
|
};
|
|
44331
|
+
restoreCodex();
|
|
44191
44332
|
sync();
|
|
44192
44333
|
const watcher = setInterval(sync, cl.syncMs ?? 2e3);
|
|
44193
44334
|
watcher.unref();
|
|
@@ -45110,15 +45251,15 @@ var realDeps = {
|
|
|
45110
45251
|
init_src();
|
|
45111
45252
|
import { createHash as createHash5 } from "node:crypto";
|
|
45112
45253
|
import {
|
|
45113
|
-
chmodSync as
|
|
45254
|
+
chmodSync as chmodSync10,
|
|
45114
45255
|
cpSync,
|
|
45115
45256
|
existsSync as existsSync3,
|
|
45116
45257
|
lstatSync as lstatSync9,
|
|
45117
45258
|
mkdirSync as mkdirSync8,
|
|
45118
45259
|
realpathSync as realpathSync8,
|
|
45119
|
-
renameSync as
|
|
45260
|
+
renameSync as renameSync9,
|
|
45120
45261
|
rmSync as rmSync4,
|
|
45121
|
-
writeFileSync as
|
|
45262
|
+
writeFileSync as writeFileSync7
|
|
45122
45263
|
} from "node:fs";
|
|
45123
45264
|
import { basename as basename6, dirname as dirname8, isAbsolute as isAbsolute7, join as join16, resolve as resolve4 } from "node:path";
|
|
45124
45265
|
import { fileURLToPath } from "node:url";
|
|
@@ -46159,11 +46300,11 @@ function remove(path, text3, doc) {
|
|
|
46159
46300
|
|
|
46160
46301
|
// src/steps/step.ts
|
|
46161
46302
|
import {
|
|
46162
|
-
chmodSync as
|
|
46303
|
+
chmodSync as chmodSync9,
|
|
46163
46304
|
mkdirSync as mkdirSync7,
|
|
46164
46305
|
readFileSync as readFileSync12,
|
|
46165
|
-
renameSync as
|
|
46166
|
-
writeFileSync as
|
|
46306
|
+
renameSync as renameSync8,
|
|
46307
|
+
writeFileSync as writeFileSync6
|
|
46167
46308
|
} from "node:fs";
|
|
46168
46309
|
import { dirname as dirname7 } from "node:path";
|
|
46169
46310
|
function readInstallFile(path) {
|
|
@@ -46179,10 +46320,10 @@ function updateInstallFile(path, patch) {
|
|
|
46179
46320
|
const next = { ...readInstallFile(path), ...patch };
|
|
46180
46321
|
mkdirSync7(dirname7(path), { recursive: true, mode: 448 });
|
|
46181
46322
|
const tmp = `${path}.${process.pid}.tmp`;
|
|
46182
|
-
|
|
46323
|
+
writeFileSync6(tmp, `${JSON.stringify(next, null, 2)}
|
|
46183
46324
|
`, { mode: 384 });
|
|
46184
|
-
|
|
46185
|
-
|
|
46325
|
+
chmodSync9(tmp, 384);
|
|
46326
|
+
renameSync8(tmp, path);
|
|
46186
46327
|
}
|
|
46187
46328
|
async function runSteps(steps, ctx, record7) {
|
|
46188
46329
|
for (const step2 of steps) {
|
|
@@ -46338,7 +46479,7 @@ function installCli(home2, src, node2) {
|
|
|
46338
46479
|
const bin = join16(home2, "bin");
|
|
46339
46480
|
const tmp = `${bin}.${process.pid}.tmp`;
|
|
46340
46481
|
mkdirSync8(home2, { recursive: true, mode: 448 });
|
|
46341
|
-
|
|
46482
|
+
chmodSync10(home2, 448);
|
|
46342
46483
|
rmSync4(tmp, { recursive: true, force: true });
|
|
46343
46484
|
mkdirSync8(tmp);
|
|
46344
46485
|
if (src.kind === "bundle") {
|
|
@@ -46346,16 +46487,16 @@ function installCli(home2, src, node2) {
|
|
|
46346
46487
|
for (const name of ["dist", "assets", "package.json"])
|
|
46347
46488
|
if (existsSync3(join16(pkg, name)))
|
|
46348
46489
|
cpSync(join16(pkg, name), join16(tmp, name), { recursive: true });
|
|
46349
|
-
} else
|
|
46350
|
-
|
|
46490
|
+
} else writeFileSync7(join16(tmp, entryName(src)), shim(src));
|
|
46491
|
+
chmodSync10(tmp, 448);
|
|
46351
46492
|
if (node2 !== void 0) {
|
|
46352
|
-
|
|
46353
|
-
|
|
46493
|
+
writeFileSync7(join16(tmp, "node"), launcherText(node2), { mode: 448 });
|
|
46494
|
+
chmodSync10(join16(tmp, "node"), 448);
|
|
46354
46495
|
}
|
|
46355
46496
|
if (!existsSync3(join16(tmp, "package.json")))
|
|
46356
|
-
|
|
46497
|
+
writeFileSync7(join16(tmp, "package.json"), '{ "type": "module" }\n');
|
|
46357
46498
|
rmSync4(bin, { recursive: true, force: true });
|
|
46358
|
-
|
|
46499
|
+
renameSync9(tmp, bin);
|
|
46359
46500
|
return join16(bin, entryName(src));
|
|
46360
46501
|
}
|
|
46361
46502
|
var present = (path) => {
|
|
@@ -46370,8 +46511,8 @@ function writeReplacing(path, text3) {
|
|
|
46370
46511
|
mkdirSync8(dirname8(path), { recursive: true });
|
|
46371
46512
|
const tmp = `${path}.${process.pid}.tmp`;
|
|
46372
46513
|
try {
|
|
46373
|
-
|
|
46374
|
-
|
|
46514
|
+
writeFileSync7(tmp, text3, { mode: 420 });
|
|
46515
|
+
renameSync9(tmp, path);
|
|
46375
46516
|
} catch (e) {
|
|
46376
46517
|
rmSync4(tmp, { force: true });
|
|
46377
46518
|
throw e;
|
|
@@ -46619,7 +46760,7 @@ var noService = {
|
|
|
46619
46760
|
remove: async () => ({}),
|
|
46620
46761
|
cli: () => ["oa-bus"]
|
|
46621
46762
|
};
|
|
46622
|
-
var VERSION = true ? "0.
|
|
46763
|
+
var VERSION = true ? "0.144.0" : JSON.parse(
|
|
46623
46764
|
readFileSync13(new URL("../package.json", import.meta.url), "utf8")
|
|
46624
46765
|
).version;
|
|
46625
46766
|
var which = (cmd) => {
|
|
@@ -46877,16 +47018,16 @@ var OPENCODE_TUI_PLUGIN = fileURLToPath2(
|
|
|
46877
47018
|
// src/steps/adapters.ts
|
|
46878
47019
|
import { randomBytes as randomBytes4 } from "node:crypto";
|
|
46879
47020
|
import {
|
|
46880
|
-
chmodSync as
|
|
47021
|
+
chmodSync as chmodSync12,
|
|
46881
47022
|
existsSync as existsSync8,
|
|
46882
47023
|
lstatSync as lstatSync14,
|
|
46883
47024
|
mkdirSync as mkdirSync11,
|
|
46884
47025
|
readFileSync as readFileSync19,
|
|
46885
47026
|
readlinkSync,
|
|
46886
|
-
renameSync as
|
|
47027
|
+
renameSync as renameSync12,
|
|
46887
47028
|
rmSync as rmSync9,
|
|
46888
47029
|
statSync as statSync11,
|
|
46889
|
-
writeFileSync as
|
|
47030
|
+
writeFileSync as writeFileSync10
|
|
46890
47031
|
} from "node:fs";
|
|
46891
47032
|
import { dirname as dirname11, join as join23, resolve as resolve8 } from "node:path";
|
|
46892
47033
|
import { isDeepStrictEqual } from "node:util";
|
|
@@ -48135,10 +48276,10 @@ import {
|
|
|
48135
48276
|
readdirSync as readdirSync5,
|
|
48136
48277
|
readFileSync as readFileSync15,
|
|
48137
48278
|
realpathSync as realpathSync9,
|
|
48138
|
-
renameSync as
|
|
48279
|
+
renameSync as renameSync10,
|
|
48139
48280
|
rmdirSync,
|
|
48140
48281
|
rmSync as rmSync5,
|
|
48141
|
-
writeFileSync as
|
|
48282
|
+
writeFileSync as writeFileSync8
|
|
48142
48283
|
} from "node:fs";
|
|
48143
48284
|
import {
|
|
48144
48285
|
basename as basename7,
|
|
@@ -48348,15 +48489,15 @@ async function installHermes(deps2) {
|
|
|
48348
48489
|
mkdirSync9(join19(tmp, f, ".."), { recursive: true });
|
|
48349
48490
|
cpSync2(join19(shipped, f), join19(tmp, f));
|
|
48350
48491
|
}
|
|
48351
|
-
|
|
48492
|
+
writeFileSync8(
|
|
48352
48493
|
join19(tmp, HERMES_MARKER),
|
|
48353
48494
|
`managed by the Open Artifacts bus installer: edits are replaced on reinstall. ${pluginHash(shipped)}
|
|
48354
48495
|
`
|
|
48355
48496
|
);
|
|
48356
48497
|
if (keepHabits)
|
|
48357
|
-
|
|
48498
|
+
writeFileSync8(join19(tmp, HERMES_HABITS_MARKER), HABITS_MARKER_TEXT);
|
|
48358
48499
|
if (state === "stale") rmSync5(dest, { recursive: true, force: true });
|
|
48359
|
-
|
|
48500
|
+
renameSync10(tmp, dest);
|
|
48360
48501
|
} catch (e) {
|
|
48361
48502
|
rmSync5(tmp, { recursive: true, force: true });
|
|
48362
48503
|
throw e;
|
|
@@ -48423,18 +48564,18 @@ import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
|
48423
48564
|
|
|
48424
48565
|
// src/steps/skill.ts
|
|
48425
48566
|
import {
|
|
48426
|
-
chmodSync as
|
|
48567
|
+
chmodSync as chmodSync11,
|
|
48427
48568
|
existsSync as existsSync5,
|
|
48428
48569
|
lstatSync as lstatSync11,
|
|
48429
48570
|
mkdirSync as mkdirSync10,
|
|
48430
48571
|
readdirSync as readdirSync6,
|
|
48431
48572
|
readFileSync as readFileSync16,
|
|
48432
48573
|
realpathSync as realpathSync10,
|
|
48433
|
-
renameSync as
|
|
48574
|
+
renameSync as renameSync11,
|
|
48434
48575
|
rmdirSync as rmdirSync2,
|
|
48435
48576
|
rmSync as rmSync6,
|
|
48436
48577
|
statSync as statSync10,
|
|
48437
|
-
writeFileSync as
|
|
48578
|
+
writeFileSync as writeFileSync9
|
|
48438
48579
|
} from "node:fs";
|
|
48439
48580
|
import { dirname as dirname10, join as join20 } from "node:path";
|
|
48440
48581
|
var SKILL_MARKER = "<!-- managed by the Open Artifacts bus installer: edits are replaced on reinstall. -->";
|
|
@@ -48558,9 +48699,9 @@ var writeAtomic = (path, text3) => {
|
|
|
48558
48699
|
mode = statSync10(path).mode & 4095;
|
|
48559
48700
|
} catch {
|
|
48560
48701
|
}
|
|
48561
|
-
|
|
48562
|
-
if (mode !== void 0)
|
|
48563
|
-
|
|
48702
|
+
writeFileSync9(tmp, text3);
|
|
48703
|
+
if (mode !== void 0) chmodSync11(tmp, mode);
|
|
48704
|
+
renameSync11(tmp, path);
|
|
48564
48705
|
} catch (e) {
|
|
48565
48706
|
try {
|
|
48566
48707
|
rmSync6(tmp, { force: true });
|
|
@@ -49561,9 +49702,9 @@ function writeAtomic2(path, data, mode) {
|
|
|
49561
49702
|
}
|
|
49562
49703
|
const tmp = `${dest}.${process.pid}.${randomBytes4(4).toString("hex")}.tmp`;
|
|
49563
49704
|
try {
|
|
49564
|
-
|
|
49565
|
-
|
|
49566
|
-
|
|
49705
|
+
writeFileSync10(tmp, data, { mode: m, flag: "wx" });
|
|
49706
|
+
chmodSync12(tmp, m);
|
|
49707
|
+
renameSync12(tmp, dest);
|
|
49567
49708
|
} catch (e) {
|
|
49568
49709
|
rmSync9(tmp, { force: true });
|
|
49569
49710
|
throw e;
|
|
@@ -50221,11 +50362,11 @@ function habitsLine(ctx) {
|
|
|
50221
50362
|
init_src();
|
|
50222
50363
|
import { randomBytes as randomBytes5 } from "node:crypto";
|
|
50223
50364
|
import {
|
|
50224
|
-
chmodSync as
|
|
50365
|
+
chmodSync as chmodSync13,
|
|
50225
50366
|
closeSync as closeSync7,
|
|
50226
50367
|
mkdirSync as mkdirSync12,
|
|
50227
50368
|
openSync as openSync7,
|
|
50228
|
-
renameSync as
|
|
50369
|
+
renameSync as renameSync13,
|
|
50229
50370
|
rmSync as rmSync10,
|
|
50230
50371
|
unlinkSync as unlinkSync3,
|
|
50231
50372
|
writeSync as writeSync3
|
|
@@ -50277,7 +50418,7 @@ function checkVerificationUri(uri, hub) {
|
|
|
50277
50418
|
}
|
|
50278
50419
|
function writeMachineFile(home2, body) {
|
|
50279
50420
|
mkdirSync12(home2, { recursive: true, mode: 448 });
|
|
50280
|
-
|
|
50421
|
+
chmodSync13(home2, 448);
|
|
50281
50422
|
const tmp = join25(home2, `.machine.json.${randomBytes5(8).toString("hex")}.tmp`);
|
|
50282
50423
|
const fd = openSync7(tmp, "wx", 384);
|
|
50283
50424
|
try {
|
|
@@ -50289,8 +50430,8 @@ function writeMachineFile(home2, body) {
|
|
|
50289
50430
|
}
|
|
50290
50431
|
closeSync7(fd);
|
|
50291
50432
|
try {
|
|
50292
|
-
|
|
50293
|
-
|
|
50433
|
+
chmodSync13(tmp, 384);
|
|
50434
|
+
renameSync13(tmp, join25(home2, "machine.json"));
|
|
50294
50435
|
} catch (e) {
|
|
50295
50436
|
unlinkSync3(tmp);
|
|
50296
50437
|
throw e;
|