@open-artifacts/bus 0.252.0 → 0.253.1
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 +37 -4
- package/assets/openclaw/package.json +1 -1
- package/dist/index.js +480 -47
- package/package.json +2 -2
package/assets/oa-bus.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { StringDecoder } from "node:string_decoder";
|
|
|
11
11
|
type Json = Record<string, unknown>;
|
|
12
12
|
|
|
13
13
|
/** The IPC marker (CONTRACT.md): the package version, stamped by the CLI's bundler. */
|
|
14
|
-
const CLIENT_VERSION = "0.
|
|
14
|
+
const CLIENT_VERSION = "0.253.1";
|
|
15
15
|
|
|
16
16
|
type Frame = Json & { type: string; id: string };
|
|
17
17
|
type Ctx = {
|
package/assets/openclaw/index.js
CHANGED
|
@@ -27513,6 +27513,35 @@ var ProofSeen = external_exports.strictObject({
|
|
|
27513
27513
|
type: external_exports.literal("proof_seen"),
|
|
27514
27514
|
hash: LinkProofHashSchema
|
|
27515
27515
|
});
|
|
27516
|
+
var CodexThreadIdSchema = external_exports.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/);
|
|
27517
|
+
var CodexExecCallIdSchema = external_exports.string().regex(/^exec-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/);
|
|
27518
|
+
var CodexDirectCallIdSchema = external_exports.string().regex(/^call_[A-Za-z0-9]{8,64}$/);
|
|
27519
|
+
var CodexItemIdSchema = external_exports.string().regex(/^ctc_[0-9a-f]{16,96}$/);
|
|
27520
|
+
var CodexToolNameSchema = external_exports.string().regex(/^[a-z][a-z0-9_]{0,63}$/);
|
|
27521
|
+
var CodexCallCheck = external_exports.strictObject({
|
|
27522
|
+
...base,
|
|
27523
|
+
type: external_exports.literal("codex_call_check"),
|
|
27524
|
+
thread_id: CodexThreadIdSchema,
|
|
27525
|
+
tool: CodexToolNameSchema,
|
|
27526
|
+
mode: external_exports.discriminatedUnion("kind", [
|
|
27527
|
+
external_exports.strictObject({
|
|
27528
|
+
kind: external_exports.literal("direct"),
|
|
27529
|
+
call_id: CodexDirectCallIdSchema,
|
|
27530
|
+
args_sha256: LinkProofHashSchema
|
|
27531
|
+
}),
|
|
27532
|
+
external_exports.strictObject({
|
|
27533
|
+
kind: external_exports.literal("code"),
|
|
27534
|
+
call_id: CodexExecCallIdSchema,
|
|
27535
|
+
item_id: CodexItemIdSchema
|
|
27536
|
+
})
|
|
27537
|
+
])
|
|
27538
|
+
});
|
|
27539
|
+
var CodexCallChecked = external_exports.strictObject({
|
|
27540
|
+
...base,
|
|
27541
|
+
type: external_exports.literal("codex_call_checked"),
|
|
27542
|
+
re: FrameIdSchema,
|
|
27543
|
+
ok: external_exports.boolean()
|
|
27544
|
+
});
|
|
27516
27545
|
var MAX_WAITING_QUERY = 64;
|
|
27517
27546
|
var WaitingQuery = external_exports.strictObject({
|
|
27518
27547
|
...base,
|
|
@@ -27793,7 +27822,8 @@ var ClientFrameSchema = external_exports.discriminatedUnion("type", [
|
|
|
27793
27822
|
WaitingQuery,
|
|
27794
27823
|
UpdateReport,
|
|
27795
27824
|
GuestUp,
|
|
27796
|
-
GuestDown
|
|
27825
|
+
GuestDown,
|
|
27826
|
+
CodexCallChecked
|
|
27797
27827
|
]);
|
|
27798
27828
|
var ServerFrameSchema = external_exports.discriminatedUnion("type", [
|
|
27799
27829
|
HelloOk,
|
|
@@ -27816,7 +27846,8 @@ var ServerFrameSchema = external_exports.discriminatedUnion("type", [
|
|
|
27816
27846
|
InstallNow,
|
|
27817
27847
|
UpdateAck,
|
|
27818
27848
|
OwnerAwayPush,
|
|
27819
|
-
ProofSeen
|
|
27849
|
+
ProofSeen,
|
|
27850
|
+
CodexCallCheck
|
|
27820
27851
|
]);
|
|
27821
27852
|
var FrameSchema = external_exports.discriminatedUnion("type", [
|
|
27822
27853
|
Hello,
|
|
@@ -27838,6 +27869,7 @@ var FrameSchema = external_exports.discriminatedUnion("type", [
|
|
|
27838
27869
|
UpdateReport,
|
|
27839
27870
|
GuestUp,
|
|
27840
27871
|
GuestDown,
|
|
27872
|
+
CodexCallChecked,
|
|
27841
27873
|
HelloOk,
|
|
27842
27874
|
AgentOk,
|
|
27843
27875
|
ReceiptFrame,
|
|
@@ -27858,7 +27890,8 @@ var FrameSchema = external_exports.discriminatedUnion("type", [
|
|
|
27858
27890
|
InstallNow,
|
|
27859
27891
|
UpdateAck,
|
|
27860
27892
|
OwnerAwayPush,
|
|
27861
|
-
ProofSeen
|
|
27893
|
+
ProofSeen,
|
|
27894
|
+
CodexCallCheck
|
|
27862
27895
|
]);
|
|
27863
27896
|
var MAX_RAW_FRAME_CHARS = 2 * LIMITS.maxMessageBytes + 4096;
|
|
27864
27897
|
|
|
@@ -27877,7 +27910,7 @@ var base2 = { v: external_exports.literal(V), id: external_exports.string().min(
|
|
|
27877
27910
|
var late = { late: external_exports.array(external_exports.string().min(1)).optional() };
|
|
27878
27911
|
var isWellFormed2 = (s) => s.isWellFormed();
|
|
27879
27912
|
var WELL_FORMED = { message: "text is not well-formed unicode" };
|
|
27880
|
-
var CLIENT_VERSION = true ? "0.
|
|
27913
|
+
var CLIENT_VERSION = true ? "0.253.1" : "0.0.0";
|
|
27881
27914
|
var clientVersion = {
|
|
27882
27915
|
client_version: external_exports.string().min(1).max(64).optional()
|
|
27883
27916
|
};
|
package/dist/index.js
CHANGED
|
@@ -31513,7 +31513,14 @@ var init_caps = __esm({
|
|
|
31513
31513
|
* client sends them only when it did (an older hub's strict decoder would
|
|
31514
31514
|
* refuse them).
|
|
31515
31515
|
*/
|
|
31516
|
-
guest: "guest"
|
|
31516
|
+
guest: "guest",
|
|
31517
|
+
/**
|
|
31518
|
+
* #3108: the hub may send `codex_call_check` (a /mcp tools/call signed in
|
|
31519
|
+
* as this member, with no proof, named a Codex thread and call) and the
|
|
31520
|
+
* daemon answers `codex_call_checked`. Sent only to a socket whose hello
|
|
31521
|
+
* listed it, and listed in `hello_ok.caps`.
|
|
31522
|
+
*/
|
|
31523
|
+
codexCheck: "codex_check"
|
|
31517
31524
|
};
|
|
31518
31525
|
MAX_CAPS = 32;
|
|
31519
31526
|
CapTokenSchema = external_exports.string().regex(/^[a-z][a-z0-9_-]{0,31}$/);
|
|
@@ -31521,6 +31528,62 @@ var init_caps = __esm({
|
|
|
31521
31528
|
}
|
|
31522
31529
|
});
|
|
31523
31530
|
|
|
31531
|
+
// ../bus-protocol/src/codex-call.ts
|
|
31532
|
+
function canonicalArgs(value) {
|
|
31533
|
+
const seen2 = /* @__PURE__ */ new Set();
|
|
31534
|
+
const walk = (v, depth) => {
|
|
31535
|
+
if (depth > 64) return void 0;
|
|
31536
|
+
if (v === null || typeof v === "boolean" || typeof v === "string")
|
|
31537
|
+
return JSON.stringify(v);
|
|
31538
|
+
if (typeof v === "number")
|
|
31539
|
+
return Number.isFinite(v) ? JSON.stringify(v) : void 0;
|
|
31540
|
+
if (typeof v !== "object") return void 0;
|
|
31541
|
+
if (seen2.has(v)) return void 0;
|
|
31542
|
+
seen2.add(v);
|
|
31543
|
+
try {
|
|
31544
|
+
if (Array.isArray(v)) {
|
|
31545
|
+
const parts2 = [];
|
|
31546
|
+
for (const x of v) {
|
|
31547
|
+
const p = walk(x, depth + 1);
|
|
31548
|
+
if (p === void 0) return void 0;
|
|
31549
|
+
parts2.push(p);
|
|
31550
|
+
}
|
|
31551
|
+
return `[${parts2.join(",")}]`;
|
|
31552
|
+
}
|
|
31553
|
+
const parts = [];
|
|
31554
|
+
for (const k of Object.keys(v).sort()) {
|
|
31555
|
+
const p = walk(v[k], depth + 1);
|
|
31556
|
+
if (p === void 0) return void 0;
|
|
31557
|
+
parts.push(`${JSON.stringify(k)}:${p}`);
|
|
31558
|
+
}
|
|
31559
|
+
return `{${parts.join(",")}}`;
|
|
31560
|
+
} finally {
|
|
31561
|
+
seen2.delete(v);
|
|
31562
|
+
}
|
|
31563
|
+
};
|
|
31564
|
+
return walk(value, 0);
|
|
31565
|
+
}
|
|
31566
|
+
async function canonicalArgsSha256(value) {
|
|
31567
|
+
const text3 = canonicalArgs(value);
|
|
31568
|
+
if (text3 === void 0) return void 0;
|
|
31569
|
+
const d = await crypto.subtle.digest(
|
|
31570
|
+
"SHA-256",
|
|
31571
|
+
new TextEncoder().encode(text3)
|
|
31572
|
+
);
|
|
31573
|
+
return [...new Uint8Array(d)].map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
31574
|
+
}
|
|
31575
|
+
var CODEX_SPAWNED_SOURCES;
|
|
31576
|
+
var init_codex_call = __esm({
|
|
31577
|
+
"../bus-protocol/src/codex-call.ts"() {
|
|
31578
|
+
"use strict";
|
|
31579
|
+
CODEX_SPAWNED_SOURCES = /* @__PURE__ */ new Set([
|
|
31580
|
+
"subagent",
|
|
31581
|
+
"guardian_review",
|
|
31582
|
+
"memory_consolidation"
|
|
31583
|
+
]);
|
|
31584
|
+
}
|
|
31585
|
+
});
|
|
31586
|
+
|
|
31524
31587
|
// ../bus-protocol/src/limits.ts
|
|
31525
31588
|
var KB, LIMITS, MAILBOX_RETAIN_MS, MAILBOX_PENDING_CAP, MAILBOX_BYTES_CAP, HUB_MAILBOX_BYTES_CAP, enc, utf8Bytes, utf8Exceeds;
|
|
31526
31589
|
var init_limits = __esm({
|
|
@@ -31796,9 +31859,9 @@ var init_refs = __esm({
|
|
|
31796
31859
|
});
|
|
31797
31860
|
|
|
31798
31861
|
// ../bus-protocol/src/device.ts
|
|
31799
|
-
function verificationUriMatches(uri,
|
|
31862
|
+
function verificationUriMatches(uri, instanceOrigin2) {
|
|
31800
31863
|
try {
|
|
31801
|
-
const want = `${new URL(
|
|
31864
|
+
const want = `${new URL(instanceOrigin2).origin}${BUS_ROUTES.approve}`;
|
|
31802
31865
|
return isSafeVerificationUri(uri) && uri === want;
|
|
31803
31866
|
} catch {
|
|
31804
31867
|
return false;
|
|
@@ -32304,7 +32367,7 @@ function decode3(raw, schema, caps) {
|
|
|
32304
32367
|
function decodeServerFrame(raw) {
|
|
32305
32368
|
return decode3(raw, ServerFrameSchema, SERVER_CAPS);
|
|
32306
32369
|
}
|
|
32307
|
-
var PING, PONG, isWellFormed, WellFormedText, FrameIdSchema, base, BodySchema, InlineBodySchema, distinct, Hello, AgentUp, AgentDown, Sessions, Send, Ack, Refuse, List, Fetch, Status, Rename, FollowRefSchema, Follow, Unfollow, Following, LINK_PROOF_HEADER, LinkProofSchema, LinkProofHashSchema, LinkBind, LinkBound, GuestUp, GuestDown, ProofSeen, MAX_WAITING_QUERY, WaitingQuery, WaitingCounts, Acked, MAX_FOLLOWS, FollowEntry, Followed, Unfollowed, Follows, RunVersionSchema, OwnerAwayUntilSchema, UPDATE_REASONS, UPDATE_EVENTS, ReportVersion, UpdateReport, RunVersionPush, OwnerAwayPush, InstallNow, UpdateAck, HelloOk, AgentOk, Renamed, ReceiptFrame, RosterAgent, Roster, BodyFrame, AGENT_CAP_MESSAGES, ErrorFrame, GUEST_DELIVERY_KINDS, NOTICE_META_ID_RE, Notice, NoticeMetaSchema, Deliver, ReceiptUpdate, RosterChanged, ClientFrameSchema, ServerFrameSchema, FrameSchema, MAX_RAW_FRAME_CHARS, SERVER_CAPS, MAX_OBJECT_TOKENS, ID_PREFIX_RE;
|
|
32370
|
+
var PING, PONG, isWellFormed, WellFormedText, FrameIdSchema, base, BodySchema, InlineBodySchema, distinct, Hello, AgentUp, AgentDown, Sessions, Send, Ack, Refuse, List, Fetch, Status, Rename, FollowRefSchema, Follow, Unfollow, Following, LINK_PROOF_HEADER, LinkProofSchema, LinkProofHashSchema, LinkBind, LinkBound, GuestUp, GuestDown, ProofSeen, CodexThreadIdSchema, CodexExecCallIdSchema, CodexDirectCallIdSchema, CodexItemIdSchema, CodexToolNameSchema, CodexCallCheck, CodexCallChecked, MAX_WAITING_QUERY, WaitingQuery, WaitingCounts, Acked, MAX_FOLLOWS, FollowEntry, Followed, Unfollowed, Follows, RunVersionSchema, OwnerAwayUntilSchema, UPDATE_REASONS, UPDATE_EVENTS, ReportVersion, UpdateReport, RunVersionPush, OwnerAwayPush, InstallNow, UpdateAck, HelloOk, AgentOk, Renamed, ReceiptFrame, RosterAgent, Roster, BodyFrame, AGENT_CAP_MESSAGES, ErrorFrame, GUEST_DELIVERY_KINDS, NOTICE_META_ID_RE, Notice, NoticeMetaSchema, Deliver, ReceiptUpdate, RosterChanged, ClientFrameSchema, ServerFrameSchema, FrameSchema, MAX_RAW_FRAME_CHARS, SERVER_CAPS, MAX_OBJECT_TOKENS, ID_PREFIX_RE;
|
|
32308
32371
|
var init_protocol2 = __esm({
|
|
32309
32372
|
"../bus-protocol/src/protocol.ts"() {
|
|
32310
32373
|
"use strict";
|
|
@@ -32501,6 +32564,35 @@ var init_protocol2 = __esm({
|
|
|
32501
32564
|
type: external_exports.literal("proof_seen"),
|
|
32502
32565
|
hash: LinkProofHashSchema
|
|
32503
32566
|
});
|
|
32567
|
+
CodexThreadIdSchema = external_exports.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/);
|
|
32568
|
+
CodexExecCallIdSchema = external_exports.string().regex(/^exec-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/);
|
|
32569
|
+
CodexDirectCallIdSchema = external_exports.string().regex(/^call_[A-Za-z0-9]{8,64}$/);
|
|
32570
|
+
CodexItemIdSchema = external_exports.string().regex(/^ctc_[0-9a-f]{16,96}$/);
|
|
32571
|
+
CodexToolNameSchema = external_exports.string().regex(/^[a-z][a-z0-9_]{0,63}$/);
|
|
32572
|
+
CodexCallCheck = external_exports.strictObject({
|
|
32573
|
+
...base,
|
|
32574
|
+
type: external_exports.literal("codex_call_check"),
|
|
32575
|
+
thread_id: CodexThreadIdSchema,
|
|
32576
|
+
tool: CodexToolNameSchema,
|
|
32577
|
+
mode: external_exports.discriminatedUnion("kind", [
|
|
32578
|
+
external_exports.strictObject({
|
|
32579
|
+
kind: external_exports.literal("direct"),
|
|
32580
|
+
call_id: CodexDirectCallIdSchema,
|
|
32581
|
+
args_sha256: LinkProofHashSchema
|
|
32582
|
+
}),
|
|
32583
|
+
external_exports.strictObject({
|
|
32584
|
+
kind: external_exports.literal("code"),
|
|
32585
|
+
call_id: CodexExecCallIdSchema,
|
|
32586
|
+
item_id: CodexItemIdSchema
|
|
32587
|
+
})
|
|
32588
|
+
])
|
|
32589
|
+
});
|
|
32590
|
+
CodexCallChecked = external_exports.strictObject({
|
|
32591
|
+
...base,
|
|
32592
|
+
type: external_exports.literal("codex_call_checked"),
|
|
32593
|
+
re: FrameIdSchema,
|
|
32594
|
+
ok: external_exports.boolean()
|
|
32595
|
+
});
|
|
32504
32596
|
MAX_WAITING_QUERY = 64;
|
|
32505
32597
|
WaitingQuery = external_exports.strictObject({
|
|
32506
32598
|
...base,
|
|
@@ -32785,7 +32877,8 @@ var init_protocol2 = __esm({
|
|
|
32785
32877
|
WaitingQuery,
|
|
32786
32878
|
UpdateReport,
|
|
32787
32879
|
GuestUp,
|
|
32788
|
-
GuestDown
|
|
32880
|
+
GuestDown,
|
|
32881
|
+
CodexCallChecked
|
|
32789
32882
|
]);
|
|
32790
32883
|
ServerFrameSchema = external_exports.discriminatedUnion("type", [
|
|
32791
32884
|
HelloOk,
|
|
@@ -32808,7 +32901,8 @@ var init_protocol2 = __esm({
|
|
|
32808
32901
|
InstallNow,
|
|
32809
32902
|
UpdateAck,
|
|
32810
32903
|
OwnerAwayPush,
|
|
32811
|
-
ProofSeen
|
|
32904
|
+
ProofSeen,
|
|
32905
|
+
CodexCallCheck
|
|
32812
32906
|
]);
|
|
32813
32907
|
FrameSchema = external_exports.discriminatedUnion("type", [
|
|
32814
32908
|
Hello,
|
|
@@ -32830,6 +32924,7 @@ var init_protocol2 = __esm({
|
|
|
32830
32924
|
UpdateReport,
|
|
32831
32925
|
GuestUp,
|
|
32832
32926
|
GuestDown,
|
|
32927
|
+
CodexCallChecked,
|
|
32833
32928
|
HelloOk,
|
|
32834
32929
|
AgentOk,
|
|
32835
32930
|
ReceiptFrame,
|
|
@@ -32850,7 +32945,8 @@ var init_protocol2 = __esm({
|
|
|
32850
32945
|
InstallNow,
|
|
32851
32946
|
UpdateAck,
|
|
32852
32947
|
OwnerAwayPush,
|
|
32853
|
-
ProofSeen
|
|
32948
|
+
ProofSeen,
|
|
32949
|
+
CodexCallCheck
|
|
32854
32950
|
]);
|
|
32855
32951
|
MAX_RAW_FRAME_CHARS = 2 * LIMITS.maxMessageBytes + 4096;
|
|
32856
32952
|
SERVER_CAPS = { depth: 5, tokens: 65536, structural: 131072 };
|
|
@@ -32888,6 +32984,7 @@ var init_src = __esm({
|
|
|
32888
32984
|
"../bus-protocol/src/index.ts"() {
|
|
32889
32985
|
"use strict";
|
|
32890
32986
|
init_caps();
|
|
32987
|
+
init_codex_call();
|
|
32891
32988
|
init_config();
|
|
32892
32989
|
init_device();
|
|
32893
32990
|
init_habits();
|
|
@@ -32925,7 +33022,7 @@ var init_frames = __esm({
|
|
|
32925
33022
|
late = { late: external_exports.array(external_exports.string().min(1)).optional() };
|
|
32926
33023
|
isWellFormed2 = (s) => s.isWellFormed();
|
|
32927
33024
|
WELL_FORMED = { message: "text is not well-formed unicode" };
|
|
32928
|
-
CLIENT_VERSION = true ? "0.
|
|
33025
|
+
CLIENT_VERSION = true ? "0.253.1" : "0.0.0";
|
|
32929
33026
|
clientVersion = {
|
|
32930
33027
|
client_version: external_exports.string().min(1).max(64).optional()
|
|
32931
33028
|
};
|
|
@@ -33025,11 +33122,7 @@ var init_frames = __esm({
|
|
|
33025
33122
|
turn_id: external_exports.string().min(1).max(256).optional()
|
|
33026
33123
|
}).optional()
|
|
33027
33124
|
});
|
|
33028
|
-
SPAWNED_SOURCES =
|
|
33029
|
-
"subagent",
|
|
33030
|
-
"guardian_review",
|
|
33031
|
-
"memory_consolidation"
|
|
33032
|
-
]);
|
|
33125
|
+
SPAWNED_SOURCES = CODEX_SPAWNED_SOURCES;
|
|
33033
33126
|
optIn = { late: external_exports.literal(true).optional() };
|
|
33034
33127
|
Send2 = external_exports.object({
|
|
33035
33128
|
...base2,
|
|
@@ -33717,11 +33810,11 @@ function fitLine(text3, value) {
|
|
|
33717
33810
|
const widest = (s) => Math.max(...s.split("\n").map((l) => l.length));
|
|
33718
33811
|
const over = widest(text3(value)) - MAX_COLS;
|
|
33719
33812
|
if (over <= 0) return text3(value);
|
|
33720
|
-
const
|
|
33721
|
-
if (
|
|
33722
|
-
const head = Math.ceil(
|
|
33813
|
+
const keep2 = value.length - over - 1;
|
|
33814
|
+
if (keep2 < 2) return text3(value);
|
|
33815
|
+
const head = Math.ceil(keep2 / 2);
|
|
33723
33816
|
return text3(
|
|
33724
|
-
`${value.slice(0, head)}\u2026${value.slice(value.length - (
|
|
33817
|
+
`${value.slice(0, head)}\u2026${value.slice(value.length - (keep2 - head))}`
|
|
33725
33818
|
);
|
|
33726
33819
|
}
|
|
33727
33820
|
function receiptText(r, sentTo, namespaces, excerpt, movedTo2, linkedNs) {
|
|
@@ -45362,6 +45455,7 @@ import { basename as basename4, isAbsolute as isAbsolute4 } from "node:path";
|
|
|
45362
45455
|
|
|
45363
45456
|
// ../bus-daemon/src/codex-attest.ts
|
|
45364
45457
|
init_src2();
|
|
45458
|
+
init_src();
|
|
45365
45459
|
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
45366
45460
|
import {
|
|
45367
45461
|
closeSync as closeSync4,
|
|
@@ -45668,18 +45762,58 @@ function codexProxyNamespaces(busHome2) {
|
|
|
45668
45762
|
return [];
|
|
45669
45763
|
}
|
|
45670
45764
|
}
|
|
45765
|
+
var CODEX_OA_ENTRIES_FILE = "codex-oa-entries.json";
|
|
45766
|
+
var codexEntryNamespace = (name) => `mcp__${name.replace(/[^A-Za-z0-9_]/g, "_")}`;
|
|
45767
|
+
var instanceOrigin = (hub) => {
|
|
45768
|
+
try {
|
|
45769
|
+
return new URL(hub.replace(/^ws(s?):/, "http$1:")).origin;
|
|
45770
|
+
} catch {
|
|
45771
|
+
return hub;
|
|
45772
|
+
}
|
|
45773
|
+
};
|
|
45774
|
+
var OA_ENTRIES_MAX = 16;
|
|
45775
|
+
function codexOaEntries(busHome2, origin) {
|
|
45776
|
+
try {
|
|
45777
|
+
const v = JSON.parse(
|
|
45778
|
+
readFileSync7(`${busHome2}/${CODEX_OA_ENTRIES_FILE}`, "utf8")
|
|
45779
|
+
);
|
|
45780
|
+
const list = v?.instances;
|
|
45781
|
+
if (!Array.isArray(list)) return [];
|
|
45782
|
+
const out = [];
|
|
45783
|
+
for (const i of list) {
|
|
45784
|
+
if (!record3(i) || i.origin !== origin || !Array.isArray(i.names))
|
|
45785
|
+
continue;
|
|
45786
|
+
for (const n of i.names)
|
|
45787
|
+
if (typeof n === "string" && n !== "" && n.length <= 128 && out.length < OA_ENTRIES_MAX)
|
|
45788
|
+
out.push(n);
|
|
45789
|
+
}
|
|
45790
|
+
return out;
|
|
45791
|
+
} catch {
|
|
45792
|
+
return [];
|
|
45793
|
+
}
|
|
45794
|
+
}
|
|
45671
45795
|
var TAIL_CAP = 8 * 1024 * 1024;
|
|
45672
45796
|
var LINE_CAP = 1024 * 1024;
|
|
45673
45797
|
var META_CAP = 8 * 1024 * 1024;
|
|
45674
45798
|
var CHUNK = 64 * 1024;
|
|
45675
45799
|
var EXEC_CALL = /^exec-[0-9a-f-]{36}$/;
|
|
45676
|
-
var
|
|
45800
|
+
var REMOTE_KEEP = 256;
|
|
45801
|
+
var REMOTE_TEXT_CAP = 256 * 1024;
|
|
45802
|
+
var seen = (remote = false) => ({
|
|
45677
45803
|
open: /* @__PURE__ */ new Map(),
|
|
45678
45804
|
execs: /* @__PURE__ */ new Map(),
|
|
45679
45805
|
lookups: /* @__PURE__ */ new Map(),
|
|
45680
45806
|
latest: void 0,
|
|
45681
|
-
done: /* @__PURE__ */ new Set()
|
|
45807
|
+
done: /* @__PURE__ */ new Set(),
|
|
45808
|
+
remote,
|
|
45809
|
+
calls: /* @__PURE__ */ new Map(),
|
|
45810
|
+
scripts: /* @__PURE__ */ new Map()
|
|
45682
45811
|
});
|
|
45812
|
+
var keep = (m, k, v) => {
|
|
45813
|
+
m.delete(k);
|
|
45814
|
+
m.set(k, v);
|
|
45815
|
+
while (m.size > REMOTE_KEEP) m.delete(m.keys().next().value);
|
|
45816
|
+
};
|
|
45683
45817
|
var USED_CAP = 4096;
|
|
45684
45818
|
var codexHome = () => process.env.CODEX_HOME || join7(homedir3(), ".codex");
|
|
45685
45819
|
var lockOf = (home2, thread) => join7(home2, "thread-writer-locks", `${thread}.lock`);
|
|
@@ -45925,7 +46059,83 @@ function codexAttestor(deps2 = {}) {
|
|
|
45925
46059
|
}
|
|
45926
46060
|
return out;
|
|
45927
46061
|
};
|
|
46062
|
+
const remoteScans = /* @__PURE__ */ new Map();
|
|
46063
|
+
const linked = /* @__PURE__ */ new Map();
|
|
46064
|
+
const perItem = /* @__PURE__ */ new Map();
|
|
46065
|
+
const remote = async (frame, o) => {
|
|
46066
|
+
const f = parseRemote(frame);
|
|
46067
|
+
if (!f || o.namespaces.length === 0) return false;
|
|
46068
|
+
const home2 = deps2.home ?? codexHome();
|
|
46069
|
+
const rows = procs([o.pid]);
|
|
46070
|
+
const proc = rows?.get(o.pid);
|
|
46071
|
+
if (!proc || basename3(proc.comm) !== "codex") return false;
|
|
46072
|
+
const was = pinned.get(o.pid);
|
|
46073
|
+
if (was !== void 0 && was !== proc.start) return false;
|
|
46074
|
+
const lock = lockOf(home2, f.thread);
|
|
46075
|
+
if (!plainFile(lock) || !holding([{ pid: o.pid, file: lock }])?.[0])
|
|
46076
|
+
return false;
|
|
46077
|
+
if (!isUserThread(home2, f.thread)) return false;
|
|
46078
|
+
const row = threadRow(home2, f.thread);
|
|
46079
|
+
const rollout = row?.rollout_path ?? globRollout(home2, f.thread);
|
|
46080
|
+
if (!rollout || !plainFile(rollout)) return false;
|
|
46081
|
+
let scan2 = remoteScans.get(f.thread);
|
|
46082
|
+
if (scan2?.rollout !== rollout) {
|
|
46083
|
+
scan2 = { rollout, offset: -1, pid: o.pid, ...seen(true) };
|
|
46084
|
+
remoteScans.set(f.thread, scan2);
|
|
46085
|
+
while (remoteScans.size > 64)
|
|
46086
|
+
remoteScans.delete(remoteScans.keys().next().value);
|
|
46087
|
+
}
|
|
46088
|
+
const sc = scan2;
|
|
46089
|
+
const since = ((lstartEpoch(proc.start) ?? Number.POSITIVE_INFINITY) + 1) * 1e3;
|
|
46090
|
+
const find = async () => {
|
|
46091
|
+
advance(sc, o.namespaces);
|
|
46092
|
+
if (linked.get(f.thread)?.has(f.call)) return false;
|
|
46093
|
+
if (f.mode === "direct") {
|
|
46094
|
+
const c = sc.calls.get(f.call);
|
|
46095
|
+
if (!c || !(c.at >= since) || c.tool !== f.tool) return void 0;
|
|
46096
|
+
let args;
|
|
46097
|
+
try {
|
|
46098
|
+
args = JSON.parse(c.args);
|
|
46099
|
+
} catch {
|
|
46100
|
+
return false;
|
|
46101
|
+
}
|
|
46102
|
+
if (await canonicalArgsSha256(args) !== f.argsSha) return false;
|
|
46103
|
+
return { ns: c.ns };
|
|
46104
|
+
}
|
|
46105
|
+
const e = sc.scripts.get(f.item);
|
|
46106
|
+
if (!e || !(e.at >= since) || e.turn === void 0 || sc.latest !== e.turn || sc.done.has(f.call))
|
|
46107
|
+
return void 0;
|
|
46108
|
+
const ns = o.namespaces.find(
|
|
46109
|
+
(n) => namesTool(e.input, `${n}__${f.tool}`)
|
|
46110
|
+
);
|
|
46111
|
+
if (ns === void 0) return false;
|
|
46112
|
+
if ((perItem.get(`${f.thread}\0${f.item}`) ?? 0) >= REMOTE_PER_ITEM)
|
|
46113
|
+
return false;
|
|
46114
|
+
return { ns };
|
|
46115
|
+
};
|
|
46116
|
+
const admit = (hit) => {
|
|
46117
|
+
const set2 = linked.get(f.thread) ?? /* @__PURE__ */ new Set();
|
|
46118
|
+
if (set2.has(f.call)) return false;
|
|
46119
|
+
set2.add(f.call);
|
|
46120
|
+
if (set2.size > USED_CAP) set2.delete(set2.values().next().value);
|
|
46121
|
+
linked.set(f.thread, set2);
|
|
46122
|
+
if (f.mode === "code") {
|
|
46123
|
+
const k = `${f.thread}\0${f.item}`;
|
|
46124
|
+
perItem.set(k, (perItem.get(k) ?? 0) + 1);
|
|
46125
|
+
while (perItem.size > USED_CAP)
|
|
46126
|
+
perItem.delete(perItem.keys().next().value);
|
|
46127
|
+
}
|
|
46128
|
+
return hit;
|
|
46129
|
+
};
|
|
46130
|
+
let r = await find();
|
|
46131
|
+
if (r === void 0 && retryMs > 0) {
|
|
46132
|
+
await sleep(retryMs);
|
|
46133
|
+
r = await find();
|
|
46134
|
+
}
|
|
46135
|
+
return r ? admit(r) : false;
|
|
46136
|
+
};
|
|
45928
46137
|
return {
|
|
46138
|
+
remote,
|
|
45929
46139
|
holders,
|
|
45930
46140
|
attest: (hello) => check2(hello, true),
|
|
45931
46141
|
attestNow: (hello) => check2(hello, false),
|
|
@@ -45934,6 +46144,40 @@ function codexAttestor(deps2 = {}) {
|
|
|
45934
46144
|
restore: restore2
|
|
45935
46145
|
};
|
|
45936
46146
|
}
|
|
46147
|
+
var REMOTE_PER_ITEM = 50;
|
|
46148
|
+
function parseRemote(frame) {
|
|
46149
|
+
const f = record3(frame);
|
|
46150
|
+
const m = record3(f?.mode);
|
|
46151
|
+
if (!f || !m) return void 0;
|
|
46152
|
+
const thread = CodexThreadIdSchema.safeParse(f.thread_id);
|
|
46153
|
+
const tool = CodexToolNameSchema.safeParse(f.tool);
|
|
46154
|
+
if (!thread.success || !tool.success) return void 0;
|
|
46155
|
+
if (m.kind === "direct") {
|
|
46156
|
+
const call = CodexDirectCallIdSchema.safeParse(m.call_id);
|
|
46157
|
+
const sha = LinkProofHashSchema.safeParse(m.args_sha256);
|
|
46158
|
+
if (!call.success || !sha.success) return void 0;
|
|
46159
|
+
return {
|
|
46160
|
+
thread: thread.data,
|
|
46161
|
+
tool: tool.data,
|
|
46162
|
+
call: call.data,
|
|
46163
|
+
mode: "direct",
|
|
46164
|
+
argsSha: sha.data
|
|
46165
|
+
};
|
|
46166
|
+
}
|
|
46167
|
+
if (m.kind === "code") {
|
|
46168
|
+
const call = CodexExecCallIdSchema.safeParse(m.call_id);
|
|
46169
|
+
const item = CodexItemIdSchema.safeParse(m.item_id);
|
|
46170
|
+
if (!call.success || !item.success) return void 0;
|
|
46171
|
+
return {
|
|
46172
|
+
thread: thread.data,
|
|
46173
|
+
tool: tool.data,
|
|
46174
|
+
call: call.data,
|
|
46175
|
+
mode: "code",
|
|
46176
|
+
item: item.data
|
|
46177
|
+
};
|
|
46178
|
+
}
|
|
46179
|
+
return void 0;
|
|
46180
|
+
}
|
|
45937
46181
|
function advance(scan2, namespaces = [CODEX_TOOL_NAMESPACE]) {
|
|
45938
46182
|
let fd;
|
|
45939
46183
|
try {
|
|
@@ -45945,7 +46189,7 @@ function advance(scan2, namespaces = [CODEX_TOOL_NAMESPACE]) {
|
|
|
45945
46189
|
const size = fstatSync4(fd).size;
|
|
45946
46190
|
if (scan2.offset > size) {
|
|
45947
46191
|
scan2.offset = -1;
|
|
45948
|
-
Object.assign(scan2, seen());
|
|
46192
|
+
Object.assign(scan2, seen(scan2.remote));
|
|
45949
46193
|
}
|
|
45950
46194
|
let skipFirst = false;
|
|
45951
46195
|
if (scan2.offset < 0) {
|
|
@@ -46023,7 +46267,7 @@ function visitLine(st, text3, namespaces = [CODEX_TOOL_NAMESPACE]) {
|
|
|
46023
46267
|
for (const [id, c] of open3)
|
|
46024
46268
|
if (turn === void 0 || c.turn === void 0 || c.turn === turn)
|
|
46025
46269
|
open3.delete(id);
|
|
46026
|
-
for (const m of [execs, lookups])
|
|
46270
|
+
for (const m of [execs, lookups, st.scripts, st.calls])
|
|
46027
46271
|
for (const [id, c] of m)
|
|
46028
46272
|
if (turn === void 0 || c.turn === void 0 || c.turn === turn)
|
|
46029
46273
|
m.delete(id);
|
|
@@ -46033,6 +46277,7 @@ function visitLine(st, text3, namespaces = [CODEX_TOOL_NAMESPACE]) {
|
|
|
46033
46277
|
const id = record3(p.item)?.id;
|
|
46034
46278
|
if (typeof id === "string") {
|
|
46035
46279
|
open3.delete(id);
|
|
46280
|
+
st.calls.delete(id);
|
|
46036
46281
|
if (EXEC_CALL.test(id)) {
|
|
46037
46282
|
st.done.add(id);
|
|
46038
46283
|
if (st.done.size > USED_CAP)
|
|
@@ -46053,6 +46298,8 @@ function visitLine(st, text3, namespaces = [CODEX_TOOL_NAMESPACE]) {
|
|
|
46053
46298
|
if (p.input.includes(`${CODEX_TOOL_NAMESPACE}__`))
|
|
46054
46299
|
execs.set(p.id, entry);
|
|
46055
46300
|
else lookups.set(p.id, entry);
|
|
46301
|
+
if (st.remote && p.input.length <= REMOTE_TEXT_CAP)
|
|
46302
|
+
keep(st.scripts, p.id, { ...entry, input: p.input });
|
|
46056
46303
|
}
|
|
46057
46304
|
return;
|
|
46058
46305
|
}
|
|
@@ -46061,6 +46308,17 @@ function visitLine(st, text3, namespaces = [CODEX_TOOL_NAMESPACE]) {
|
|
|
46061
46308
|
const proxied = !bus && typeof p.namespace === "string" && namespaces.includes(p.namespace);
|
|
46062
46309
|
const ours2 = bus || proxied;
|
|
46063
46310
|
const turn = record3(p.internal_chat_message_metadata_passthrough)?.turn_id;
|
|
46311
|
+
if (st.remote && typeof p.name === "string") {
|
|
46312
|
+
const hit = remoteName(p, namespaces);
|
|
46313
|
+
if (hit && typeof p.arguments === "string" && p.arguments.length <= REMOTE_TEXT_CAP)
|
|
46314
|
+
keep(st.calls, p.call_id, {
|
|
46315
|
+
at: Date.parse(String(line.timestamp)),
|
|
46316
|
+
turn: typeof turn === "string" ? turn : void 0,
|
|
46317
|
+
ns: hit.ns,
|
|
46318
|
+
tool: hit.tool,
|
|
46319
|
+
args: p.arguments
|
|
46320
|
+
});
|
|
46321
|
+
}
|
|
46064
46322
|
if (ours2)
|
|
46065
46323
|
open3.set(p.call_id, {
|
|
46066
46324
|
at: Date.parse(String(line.timestamp)),
|
|
@@ -46071,10 +46329,30 @@ function visitLine(st, text3, namespaces = [CODEX_TOOL_NAMESPACE]) {
|
|
|
46071
46329
|
}
|
|
46072
46330
|
if (p.type.endsWith("_output") || p.type.endsWith("_end")) {
|
|
46073
46331
|
open3.delete(p.call_id);
|
|
46074
|
-
|
|
46332
|
+
st.calls.delete(p.call_id);
|
|
46333
|
+
for (const m of [execs, lookups, st.scripts])
|
|
46075
46334
|
for (const [id, e] of m) if (e.call === p.call_id) m.delete(id);
|
|
46076
46335
|
}
|
|
46077
46336
|
}
|
|
46337
|
+
function remoteName(p, namespaces) {
|
|
46338
|
+
const name = p.name;
|
|
46339
|
+
if (typeof p.namespace === "string")
|
|
46340
|
+
return namespaces.includes(p.namespace) ? { ns: p.namespace, tool: name } : void 0;
|
|
46341
|
+
if (p.namespace !== void 0) return void 0;
|
|
46342
|
+
for (const ns of namespaces)
|
|
46343
|
+
if (name.startsWith(`${ns}__`))
|
|
46344
|
+
return { ns, tool: name.slice(ns.length + 2) };
|
|
46345
|
+
return void 0;
|
|
46346
|
+
}
|
|
46347
|
+
var IDENT = /[A-Za-z0-9_$]/;
|
|
46348
|
+
function namesTool(script, needle) {
|
|
46349
|
+
for (let at = script.indexOf(needle); at >= 0; at = script.indexOf(needle, at + 1)) {
|
|
46350
|
+
const before = at === 0 ? "" : script[at - 1];
|
|
46351
|
+
const after = script[at + needle.length] ?? "";
|
|
46352
|
+
if (!IDENT.test(before) && !IDENT.test(after)) return true;
|
|
46353
|
+
}
|
|
46354
|
+
return false;
|
|
46355
|
+
}
|
|
46078
46356
|
var record3 = (v) => v && typeof v === "object" && !Array.isArray(v) ? v : void 0;
|
|
46079
46357
|
function isSubagent(source) {
|
|
46080
46358
|
let s = source;
|
|
@@ -47377,9 +47655,9 @@ var TakenWatch = class {
|
|
|
47377
47655
|
const raw = JSON.parse(
|
|
47378
47656
|
readFileSync11(join11(dirname3(opts.file), "codex-queued.json"), "utf8")
|
|
47379
47657
|
);
|
|
47380
|
-
const
|
|
47658
|
+
const keep2 = this.#now() - (opts.ttlMs ?? MAILBOX_RETAIN_MS);
|
|
47381
47659
|
for (const [k, at] of Object.entries(raw))
|
|
47382
|
-
if (typeof at === "number" && at >=
|
|
47660
|
+
if (typeof at === "number" && at >= keep2) this.#legacy.add(k);
|
|
47383
47661
|
} catch {
|
|
47384
47662
|
}
|
|
47385
47663
|
}
|
|
@@ -49211,7 +49489,8 @@ var HUB_HELLO_CAPS = [
|
|
|
49211
49489
|
BUS_CAPS.runVersion,
|
|
49212
49490
|
BUS_CAPS.noticeMeta,
|
|
49213
49491
|
BUS_CAPS.ownerAway,
|
|
49214
|
-
BUS_CAPS.guest
|
|
49492
|
+
BUS_CAPS.guest,
|
|
49493
|
+
BUS_CAPS.codexCheck
|
|
49215
49494
|
];
|
|
49216
49495
|
var HubConnection = class {
|
|
49217
49496
|
constructor(opts) {
|
|
@@ -49580,6 +49859,8 @@ var Lane = class {
|
|
|
49580
49859
|
runCap = false;
|
|
49581
49860
|
/** #2793 S3b: this hub listed the guest cap: proof_seen and guest deliveries come, guest_up goes. */
|
|
49582
49861
|
guest = false;
|
|
49862
|
+
/** #3108: this hub listed the codex check cap: codex_call_check frames come. */
|
|
49863
|
+
codexCheck = false;
|
|
49583
49864
|
ever = false;
|
|
49584
49865
|
droppedAt;
|
|
49585
49866
|
/** The hub refused this instance's token; its link stays closed. */
|
|
@@ -49606,6 +49887,7 @@ var Lane = class {
|
|
|
49606
49887
|
this.ackConfirm = has(BUS_CAPS.ackConfirm);
|
|
49607
49888
|
this.runCap = has(BUS_CAPS.runVersion);
|
|
49608
49889
|
this.guest = has(BUS_CAPS.guest);
|
|
49890
|
+
this.codexCheck = has(BUS_CAPS.codexCheck);
|
|
49609
49891
|
this.helloed = true;
|
|
49610
49892
|
}
|
|
49611
49893
|
/** The link dropped: the next hello_ok says again which hub this is. */
|
|
@@ -49624,6 +49906,7 @@ var Lane = class {
|
|
|
49624
49906
|
this.helloed = false;
|
|
49625
49907
|
this.runCap = false;
|
|
49626
49908
|
this.guest = false;
|
|
49909
|
+
this.codexCheck = false;
|
|
49627
49910
|
}
|
|
49628
49911
|
};
|
|
49629
49912
|
var Lanes = class {
|
|
@@ -50069,9 +50352,9 @@ var Pending = class {
|
|
|
50069
50352
|
return true;
|
|
50070
50353
|
}
|
|
50071
50354
|
/** `keep`: requests that still wait (a send that will be resent). */
|
|
50072
|
-
failAll(code2, message,
|
|
50355
|
+
failAll(code2, message, keep2 = () => false) {
|
|
50073
50356
|
for (const hubId of [...this.#byHubId.keys()])
|
|
50074
|
-
if (!
|
|
50357
|
+
if (!keep2(hubId)) this.#fail(hubId, code2, message);
|
|
50075
50358
|
}
|
|
50076
50359
|
#fail(hubId, code2, message) {
|
|
50077
50360
|
const w = this.#take(hubId);
|
|
@@ -51293,9 +51576,9 @@ var ClaudeTransport = class {
|
|
|
51293
51576
|
if (op === "read") return all;
|
|
51294
51577
|
if (!key2 || !entry) return all;
|
|
51295
51578
|
all[key2] = { ...entry, at: this.#now() };
|
|
51296
|
-
const
|
|
51579
|
+
const keep2 = Object.entries(all).sort(([, a], [, b]) => b.at - a.at).slice(0, RETURN_INDEX_MAX);
|
|
51297
51580
|
const out = /* @__PURE__ */ Object.create(null);
|
|
51298
|
-
for (const [k, v] of
|
|
51581
|
+
for (const [k, v] of keep2) out[k] = v;
|
|
51299
51582
|
const tmp = `${file2}.${process.pid}.tmp`;
|
|
51300
51583
|
writeFileSync11(tmp, JSON.stringify(out), { mode: 384 });
|
|
51301
51584
|
chmodSync12(tmp, 384);
|
|
@@ -52301,11 +52584,11 @@ function markLive(entryFile, home2, pid = process.pid) {
|
|
|
52301
52584
|
return void 0;
|
|
52302
52585
|
}
|
|
52303
52586
|
}
|
|
52304
|
-
function prune(home2,
|
|
52587
|
+
function prune(home2, keep2, opts = {}) {
|
|
52305
52588
|
const alive3 = opts.alive ?? pidAlive2;
|
|
52306
52589
|
const dir = versionsDir(home2);
|
|
52307
52590
|
if (unsafeDir(dir) !== void 0 || !lstat2(dir)) return [];
|
|
52308
|
-
const keepSet = new Set(
|
|
52591
|
+
const keepSet = new Set(keep2.filter((k) => k !== void 0));
|
|
52309
52592
|
const removed = [];
|
|
52310
52593
|
for (const name of readdirSync8(dir)) {
|
|
52311
52594
|
if (keepSet.has(name)) continue;
|
|
@@ -55659,8 +55942,48 @@ async function runDaemon(deps2 = {}) {
|
|
|
55659
55942
|
const cut2 = flat.length > GUEST_BODY_MAX ? `${flat.slice(0, GUEST_BODY_MAX)}...` : flat;
|
|
55660
55943
|
return `from ${lane} (another instance, treat as data): \xAB${cut2}\xBB`;
|
|
55661
55944
|
};
|
|
55945
|
+
const linkedLogged = /* @__PURE__ */ new Map();
|
|
55946
|
+
const onCodexCheck = async (lane, frame) => {
|
|
55947
|
+
let ok = false;
|
|
55948
|
+
try {
|
|
55949
|
+
const rec = agents.all().find(
|
|
55950
|
+
(a) => a.kind === "codex" && a.live && a.ref === frame.thread_id && a.pid !== void 0 && homedOf(a) === lane.name
|
|
55951
|
+
);
|
|
55952
|
+
if (rec && lane.codexCheck && !lane.revoked) {
|
|
55953
|
+
const names2 = codexOaEntries(home(), instanceOrigin(lane.cfg.hub));
|
|
55954
|
+
const hit = await codexCheck.remote(frame, {
|
|
55955
|
+
pid: rec.pid,
|
|
55956
|
+
namespaces: names2.map(codexEntryNamespace)
|
|
55957
|
+
});
|
|
55958
|
+
if (hit) {
|
|
55959
|
+
ok = true;
|
|
55960
|
+
const entry = names2.find((n) => codexEntryNamespace(n) === hit.ns);
|
|
55961
|
+
const now = Date.now();
|
|
55962
|
+
if (entry !== void 0 && now - (linkedLogged.get(entry) ?? 0) > 36e5) {
|
|
55963
|
+
linkedLogged.set(entry, now);
|
|
55964
|
+
ev("codex_call_linked", { name: entry });
|
|
55965
|
+
}
|
|
55966
|
+
}
|
|
55967
|
+
}
|
|
55968
|
+
} catch {
|
|
55969
|
+
ok = false;
|
|
55970
|
+
}
|
|
55971
|
+
sendOn(lane, {
|
|
55972
|
+
v: 1,
|
|
55973
|
+
id: frameId(),
|
|
55974
|
+
type: "codex_call_checked",
|
|
55975
|
+
re: frame.id,
|
|
55976
|
+
ok
|
|
55977
|
+
});
|
|
55978
|
+
};
|
|
55662
55979
|
const guestFrame = (lane, frame) => {
|
|
55663
55980
|
switch (frame.type) {
|
|
55981
|
+
case "codex_call_check":
|
|
55982
|
+
if (lane.codexCheck)
|
|
55983
|
+
void onCodexCheck(lane, frame).catch(
|
|
55984
|
+
(e) => log(`codex_call_check from ${lane.name}: ${errText(e)}`)
|
|
55985
|
+
);
|
|
55986
|
+
return true;
|
|
55664
55987
|
case "proof_seen":
|
|
55665
55988
|
void onProofSeen(lane, frame.hash).catch(
|
|
55666
55989
|
(e) => log(`proof_seen from ${lane.name}: ${errText(e)}`)
|
|
@@ -57581,12 +57904,12 @@ var len = (s) => [...s].length;
|
|
|
57581
57904
|
function cutMiddle(value, max, more = "\u2026") {
|
|
57582
57905
|
const chars = [...value];
|
|
57583
57906
|
if (chars.length <= max) return value;
|
|
57584
|
-
const
|
|
57907
|
+
const keep2 = Math.max(0, max - len(more));
|
|
57585
57908
|
const slash = value.lastIndexOf("/");
|
|
57586
57909
|
const dot = value.lastIndexOf(".", value.lastIndexOf(".") - 1);
|
|
57587
57910
|
const end = slash >= 0 ? value.slice(slash) : dot >= 0 ? value.slice(dot) : "";
|
|
57588
|
-
const tail2 = len(end) > 0 && len(end) <=
|
|
57589
|
-
return chars.slice(0,
|
|
57911
|
+
const tail2 = len(end) > 0 && len(end) <= keep2 / 2 ? len(end) : Math.ceil(keep2 / 2);
|
|
57912
|
+
return chars.slice(0, keep2 - tail2).join("") + more + chars.slice(chars.length - tail2).join("");
|
|
57590
57913
|
}
|
|
57591
57914
|
var graphemes = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
57592
57915
|
var WIDE = /[\u1100-\u115f\u2e80-\u303e\u3041-\u33ff\u3400-\u4dbf\u4e00-\u9fff\ua000-\ua4cf\uac00-\ud7a3\uf900-\ufaff\ufe30-\ufe4f\uff00-\uff60\uffe0-\uffe6\u{20000}-\u{3fffd}]/u;
|
|
@@ -58193,6 +58516,12 @@ function copy(style, bus = BUS_CMD, approve) {
|
|
|
58193
58516
|
],
|
|
58194
58517
|
// Codex's checks, after its wiring line (C26e).
|
|
58195
58518
|
codexWakes: (bin) => done(`Codex wakes with ${clip(bin, 20)}`),
|
|
58519
|
+
// #3108: a Codex entry that signs in by itself, linked through the server check.
|
|
58520
|
+
codexLinked: (name, ago3) => done(`Codex's ${clip(name, 50)} entry is linked (last call ${ago3}).`),
|
|
58521
|
+
codexLinksOnFirstCall: (name) => p(
|
|
58522
|
+
"muted",
|
|
58523
|
+
`Codex's ${clip(name, 50)} entry links on its first Open Artifacts call.`
|
|
58524
|
+
),
|
|
58196
58525
|
// The Claude Code plugins (#2095). Drafts for OA Product: wording is theirs.
|
|
58197
58526
|
outputStyleOn: () => [
|
|
58198
58527
|
done("Turned on the Artifacts Teammate output style"),
|
|
@@ -60525,7 +60854,7 @@ var noService = {
|
|
|
60525
60854
|
remove: async () => ({}),
|
|
60526
60855
|
cli: () => ["oa-bus"]
|
|
60527
60856
|
};
|
|
60528
|
-
var VERSION = true ? "0.
|
|
60857
|
+
var VERSION = true ? "0.253.1" : JSON.parse(
|
|
60529
60858
|
readFileSync25(new URL("../package.json", import.meta.url), "utf8")
|
|
60530
60859
|
).version;
|
|
60531
60860
|
var which = (cmd) => {
|
|
@@ -62669,9 +62998,7 @@ function plan(doc, origin, patFile) {
|
|
|
62669
62998
|
}
|
|
62670
62999
|
if (blocker === void 0 && patFile !== void 0 && existsSync12(patFile))
|
|
62671
63000
|
return { kind: "swap", name, entry: e, cred: { tokenFile: patFile } };
|
|
62672
|
-
return
|
|
62673
|
-
patFile === void 0 ? "it signs in with `codex mcp login` or another kind of token that oa-bus can't pass on." : `it signs in with \`codex mcp login\` or another kind of token that oa-bus can't pass on, and there is no PAT at ${patFile} for the proxy to use. Save one there (see the connect guide) and run oa-bus install again.`
|
|
62674
|
-
);
|
|
63001
|
+
return { kind: "link" };
|
|
62675
63002
|
}
|
|
62676
63003
|
return { kind: "none" };
|
|
62677
63004
|
}
|
|
@@ -62717,10 +63044,50 @@ function checked2(file2, before, next, name, entry) {
|
|
|
62717
63044
|
}
|
|
62718
63045
|
var readTomlText = (text3) => parse4(text3);
|
|
62719
63046
|
function installEntry(io, origin) {
|
|
63047
|
+
const out = swapEntry(io, origin);
|
|
63048
|
+
recordEntries(io, origin);
|
|
63049
|
+
return out;
|
|
63050
|
+
}
|
|
63051
|
+
function remoteEntries(io, origin) {
|
|
63052
|
+
const { doc } = readToml(io.file);
|
|
63053
|
+
return Object.entries(servers2(doc)).filter(
|
|
63054
|
+
([name, e]) => name !== CODEX_ENTRY && isRecord5(e) && e.enabled !== false && isInstance(e, origin) && ourEntry(e, origin) === void 0
|
|
63055
|
+
).map(([name]) => name);
|
|
63056
|
+
}
|
|
63057
|
+
function recordEntries(io, origin) {
|
|
63058
|
+
try {
|
|
63059
|
+
const names2 = remoteEntries(io, origin);
|
|
63060
|
+
let had = [];
|
|
63061
|
+
let before;
|
|
63062
|
+
try {
|
|
63063
|
+
before = readFileSync28(io.entries, "utf8");
|
|
63064
|
+
const v = JSON.parse(before);
|
|
63065
|
+
const list = isRecord5(v) ? v.instances : void 0;
|
|
63066
|
+
if (Array.isArray(list))
|
|
63067
|
+
had = list.filter(
|
|
63068
|
+
(i) => isRecord5(i) && typeof i.origin === "string" && Array.isArray(i.names) && i.names.every((n) => typeof n === "string")
|
|
63069
|
+
);
|
|
63070
|
+
} catch {
|
|
63071
|
+
}
|
|
63072
|
+
const next = [
|
|
63073
|
+
...had.filter((i) => i.origin !== origin),
|
|
63074
|
+
...names2.length > 0 ? [{ origin, names: names2 }] : []
|
|
63075
|
+
];
|
|
63076
|
+
if (next.length === 0) {
|
|
63077
|
+
if (before !== void 0) rmSync17(io.entries, { force: true });
|
|
63078
|
+
return;
|
|
63079
|
+
}
|
|
63080
|
+
const text3 = `${JSON.stringify({ instances: next }, null, 2)}
|
|
63081
|
+
`;
|
|
63082
|
+
if (text3 !== before) io.writeEntries(text3);
|
|
63083
|
+
} catch {
|
|
63084
|
+
}
|
|
63085
|
+
}
|
|
63086
|
+
function swapEntry(io, origin) {
|
|
62720
63087
|
const { text: text3, doc } = readToml(io.file);
|
|
62721
63088
|
const p = plan(doc, origin, io.patFile);
|
|
62722
63089
|
if (p.kind === "note") return { notes: [p.note] };
|
|
62723
|
-
if (p.kind === "none") return { notes: [] };
|
|
63090
|
+
if (p.kind === "none" || p.kind === "link") return { notes: [] };
|
|
62724
63091
|
if (p.kind === "swap") {
|
|
62725
63092
|
const other = otherSwapped(io, doc, p.name);
|
|
62726
63093
|
if (other !== void 0)
|
|
@@ -62787,7 +63154,10 @@ ${wantEntry(io, origin, p.cred).join("\n")}
|
|
|
62787
63154
|
}
|
|
62788
63155
|
function restoreEntry(io) {
|
|
62789
63156
|
const m = readMoved(io.moved);
|
|
62790
|
-
if (!m)
|
|
63157
|
+
if (!m) {
|
|
63158
|
+
rmSync17(io.entries, { force: true });
|
|
63159
|
+
return false;
|
|
63160
|
+
}
|
|
62791
63161
|
let put3 = false;
|
|
62792
63162
|
if (existsSync12(io.file)) {
|
|
62793
63163
|
const { text: text3, doc } = readToml(io.file);
|
|
@@ -62815,6 +63185,7 @@ ${m.lines.join("\n")}
|
|
|
62815
63185
|
}
|
|
62816
63186
|
}
|
|
62817
63187
|
rmSync17(io.moved, { force: true });
|
|
63188
|
+
rmSync17(io.entries, { force: true });
|
|
62818
63189
|
return put3;
|
|
62819
63190
|
}
|
|
62820
63191
|
function linesOf(text3) {
|
|
@@ -64351,6 +64722,8 @@ var paths = (deps2) => {
|
|
|
64351
64722
|
codexBin: codexBinFile(busDir),
|
|
64352
64723
|
// #1856: where install keeps the Codex entry it swapped for the proxy.
|
|
64353
64724
|
codexEntry: join40(busDir, CODEX_PROXY_ENTRY_FILE),
|
|
64725
|
+
// #3108: the Codex entries oa-bus leaves as they are, linked by the daemon's server check.
|
|
64726
|
+
codexOaEntries: join40(busDir, CODEX_OA_ENTRIES_FILE),
|
|
64354
64727
|
// agy 1.5's user-level MCP config (`agy mcp add` writes it; the older
|
|
64355
64728
|
// ~/.gemini/antigravity/mcp_config.json is the legacy path it migrated from).
|
|
64356
64729
|
agyMcp: join40(deps2.home, ".gemini", "config", "mcp_config.json"),
|
|
@@ -64586,6 +64959,8 @@ var cxEntryIo = (deps2) => ({
|
|
|
64586
64959
|
moved: paths(deps2).codexEntry,
|
|
64587
64960
|
write: (text3) => writeAtomic2(paths(deps2).codex, text3),
|
|
64588
64961
|
writeMoved: (data) => writeAtomic2(paths(deps2).codexEntry, data, 384),
|
|
64962
|
+
entries: paths(deps2).codexOaEntries,
|
|
64963
|
+
writeEntries: (data) => writeAtomic2(paths(deps2).codexOaEntries, data, 384),
|
|
64589
64964
|
busBin: deps2.busBin,
|
|
64590
64965
|
...movedHome(deps2) ? { busHome: movedHome(deps2) } : {},
|
|
64591
64966
|
// #2954: the PAT the connect guide tells people to save, so an entry that
|
|
@@ -65253,6 +65628,14 @@ function skippedProxyEntries(deps2) {
|
|
|
65253
65628
|
}
|
|
65254
65629
|
return out;
|
|
65255
65630
|
}
|
|
65631
|
+
function reapplyCodexEntries(deps2) {
|
|
65632
|
+
try {
|
|
65633
|
+
const d = { ...deps2, busBin: [] };
|
|
65634
|
+
if (!present3(paths(d).codex)) return;
|
|
65635
|
+
recordEntries(cxEntryIo(d), deps2.hub);
|
|
65636
|
+
} catch {
|
|
65637
|
+
}
|
|
65638
|
+
}
|
|
65256
65639
|
function reapplyClaudeProof(deps2, onWrite) {
|
|
65257
65640
|
try {
|
|
65258
65641
|
if (deps2.busBin.length === 0) return;
|
|
@@ -66640,6 +67023,13 @@ async function daemon(ctx, run5 = runDaemon, signals = process) {
|
|
|
66640
67023
|
},
|
|
66641
67024
|
(c) => events(PROOF_EVENT, { name: c.entry, kind: c.scope })
|
|
66642
67025
|
);
|
|
67026
|
+
if (m.state === "ok")
|
|
67027
|
+
reapplyCodexEntries({
|
|
67028
|
+
home: ctx.userHome,
|
|
67029
|
+
busHome: ctx.home,
|
|
67030
|
+
env: ctx.env,
|
|
67031
|
+
hub: originOf2(m.hub)
|
|
67032
|
+
});
|
|
66643
67033
|
if (wiredTo(ctx)) {
|
|
66644
67034
|
try {
|
|
66645
67035
|
const removed = removeHabitsBlocks({
|
|
@@ -67626,15 +68016,15 @@ async function namespace(opts, ctx) {
|
|
|
67626
68016
|
} catch {
|
|
67627
68017
|
}
|
|
67628
68018
|
if (opts.sub === "revoke") {
|
|
67629
|
-
const
|
|
68019
|
+
const keep2 = entries.filter(
|
|
67630
68020
|
(e) => e.dir !== given && e.dir !== real3 && !(real3 && sameDir(e.dir, real3))
|
|
67631
68021
|
);
|
|
67632
|
-
if (
|
|
68022
|
+
if (keep2.length === entries.length) {
|
|
67633
68023
|
say(ctx, c.nsNotListed(shown2(ctx, real3 ?? given)));
|
|
67634
68024
|
return 0;
|
|
67635
68025
|
}
|
|
67636
|
-
writeApprovals(
|
|
67637
|
-
for (const e of entries.filter((x) => !
|
|
68026
|
+
writeApprovals(keep2, ctx.home, instance);
|
|
68027
|
+
for (const e of entries.filter((x) => !keep2.includes(x)))
|
|
67638
68028
|
logApproval(
|
|
67639
68029
|
{ action: "revoke", ...e, tty: Boolean(ctx.stdinIsTTY) },
|
|
67640
68030
|
ctx.home
|
|
@@ -68583,6 +68973,47 @@ function asksForGlobal(ctx, dirs) {
|
|
|
68583
68973
|
if (nearestConfig(ctx.cwd).global !== true) return false;
|
|
68584
68974
|
return !isGlobalDir(ctx.cwd, dirs);
|
|
68585
68975
|
}
|
|
68976
|
+
var EVENTS_TAIL = 512 * 1024;
|
|
68977
|
+
var LINK_RECENT_MS = 7 * 24 * 36e5;
|
|
68978
|
+
function ago2(ms) {
|
|
68979
|
+
const m = Math.max(0, Math.floor(ms / 6e4));
|
|
68980
|
+
if (m < 1) return "just now";
|
|
68981
|
+
if (m < 60) return `${m} minute${m === 1 ? "" : "s"} ago`;
|
|
68982
|
+
const h = Math.floor(m / 60);
|
|
68983
|
+
if (h < 48) return `${h} hour${h === 1 ? "" : "s"} ago`;
|
|
68984
|
+
return `${Math.floor(h / 24)} days ago`;
|
|
68985
|
+
}
|
|
68986
|
+
function codexLinkLines(ctx, hub) {
|
|
68987
|
+
let origin;
|
|
68988
|
+
try {
|
|
68989
|
+
origin = new URL(hub).origin;
|
|
68990
|
+
} catch {
|
|
68991
|
+
return;
|
|
68992
|
+
}
|
|
68993
|
+
const names2 = codexOaEntries(ctx.home, origin);
|
|
68994
|
+
if (names2.length === 0) return;
|
|
68995
|
+
let tail2 = "";
|
|
68996
|
+
try {
|
|
68997
|
+
const file2 = join55(ctx.home, "logs", "events.log");
|
|
68998
|
+
const text3 = readFileSync43(file2, "utf8");
|
|
68999
|
+
tail2 = text3.length > EVENTS_TAIL ? text3.slice(-EVENTS_TAIL) : text3;
|
|
69000
|
+
} catch {
|
|
69001
|
+
}
|
|
69002
|
+
const lines = tail2.split("\n");
|
|
69003
|
+
for (const name of names2) {
|
|
69004
|
+
const token = formatEvent(/* @__PURE__ */ new Date(0), "codex_call_linked", { name }).split(" ").slice(1).join(" ");
|
|
69005
|
+
let last;
|
|
69006
|
+
for (const l of lines) {
|
|
69007
|
+
if (!l.endsWith(` ${token}`)) continue;
|
|
69008
|
+
const at = Date.parse(l.slice(0, l.indexOf(" ")));
|
|
69009
|
+
if (Number.isFinite(at) && (last === void 0 || at > last)) last = at;
|
|
69010
|
+
}
|
|
69011
|
+
const age = last === void 0 ? void 0 : ctx.now() - last;
|
|
69012
|
+
if (age !== void 0 && age <= LINK_RECENT_MS)
|
|
69013
|
+
say(ctx, ctx.copy.codexLinked(safeText(name, 80), ago2(age)));
|
|
69014
|
+
else say(ctx, ctx.copy.codexLinksOnFirstCall(safeText(name, 80)));
|
|
69015
|
+
}
|
|
69016
|
+
}
|
|
68586
69017
|
function codexChecks(ctx, out) {
|
|
68587
69018
|
const c = ctx.copy;
|
|
68588
69019
|
const bin = findCodexBin({
|
|
@@ -68834,6 +69265,7 @@ async function doctor(ctx) {
|
|
|
68834
69265
|
if (hub !== void 0) {
|
|
68835
69266
|
for (const k of skippedProxyEntries({ ...skipDeps(ctx), hub }))
|
|
68836
69267
|
if (k.harness === "Codex") warn([`Codex: ${safeText(k.note, 400)}`]);
|
|
69268
|
+
codexLinkLines(ctx, hub);
|
|
68837
69269
|
}
|
|
68838
69270
|
}
|
|
68839
69271
|
if (h === "openclaw") say(ctx, c.openclawDmNote());
|
|
@@ -68935,14 +69367,14 @@ async function global(opts, ctx) {
|
|
|
68935
69367
|
say(ctx, c.globalAdded(shown3(ctx, real3)));
|
|
68936
69368
|
return 0;
|
|
68937
69369
|
}
|
|
68938
|
-
const
|
|
69370
|
+
const keep2 = dirs.filter(
|
|
68939
69371
|
(d) => d !== given && d !== real3 && !(real3 && sameDir(d, real3))
|
|
68940
69372
|
);
|
|
68941
|
-
if (
|
|
69373
|
+
if (keep2.length === dirs.length) {
|
|
68942
69374
|
say(ctx, c.globalNotListed(shown3(ctx, real3 ?? given)));
|
|
68943
69375
|
return 0;
|
|
68944
69376
|
}
|
|
68945
|
-
writeGlobalDirs(
|
|
69377
|
+
writeGlobalDirs(keep2, ctx.home);
|
|
68946
69378
|
say(ctx, c.globalRemoved(shown3(ctx, real3 ?? given)));
|
|
68947
69379
|
return 0;
|
|
68948
69380
|
}
|
|
@@ -69488,6 +69920,7 @@ var FILES = [
|
|
|
69488
69920
|
"claude-held.injected.json",
|
|
69489
69921
|
"opencode-uncertain.json",
|
|
69490
69922
|
"codex-mcp-entry.json",
|
|
69923
|
+
"codex-oa-entries.json",
|
|
69491
69924
|
"revoked",
|
|
69492
69925
|
"update.json",
|
|
69493
69926
|
// The rescue shim the service runs (#2552): written only by an install.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-artifacts/bus",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.253.1",
|
|
5
5
|
"description": "The Open Artifacts bus: your AI agents reach each other across machines.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -29,6 +29,6 @@
|
|
|
29
29
|
"typecheck": "tsc --noEmit"
|
|
30
30
|
},
|
|
31
31
|
"oaBus": {
|
|
32
|
-
"commit": "
|
|
32
|
+
"commit": "372387016b9929a9a37b72bce9d3ac94362afac3"
|
|
33
33
|
}
|
|
34
34
|
}
|