@open-artifacts/bus 0.131.0 → 0.132.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/dist/index.js +22 -7
- 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.132.0";
|
|
15
15
|
|
|
16
16
|
type Frame = Json & { type: string; id: string };
|
|
17
17
|
type Ctx = {
|
package/dist/index.js
CHANGED
|
@@ -32426,7 +32426,7 @@ var init_frames = __esm({
|
|
|
32426
32426
|
late = { late: external_exports.array(external_exports.string().min(1)).optional() };
|
|
32427
32427
|
isWellFormed2 = (s) => s.isWellFormed();
|
|
32428
32428
|
WELL_FORMED = { message: "text is not well-formed unicode" };
|
|
32429
|
-
CLIENT_VERSION = true ? "0.
|
|
32429
|
+
CLIENT_VERSION = true ? "0.132.0" : "0.0.0";
|
|
32430
32430
|
clientVersion = {
|
|
32431
32431
|
client_version: external_exports.string().min(1).max(64).optional()
|
|
32432
32432
|
};
|
|
@@ -42311,8 +42311,13 @@ async function runDaemon(deps = {}) {
|
|
|
42311
42311
|
);
|
|
42312
42312
|
const conns = /* @__PURE__ */ new Map();
|
|
42313
42313
|
const piLinks = /* @__PURE__ */ new Map();
|
|
42314
|
+
const held = (ref) => {
|
|
42315
|
+
const rec = agents.byRef(ref);
|
|
42316
|
+
return rec?.replaces !== void 0 && !hubHelloed;
|
|
42317
|
+
};
|
|
42318
|
+
const handoverOf = (old) => old.replaces !== void 0 && !hubHelloed ? old.replaces : old.ref;
|
|
42314
42319
|
const sessions = () => ({
|
|
42315
|
-
open: agents.openRefs(),
|
|
42320
|
+
open: agents.openRefs().filter((r) => !held(r)),
|
|
42316
42321
|
closed: agents.closedRefs()
|
|
42317
42322
|
});
|
|
42318
42323
|
const announceSessions = () => {
|
|
@@ -42324,6 +42329,7 @@ async function runDaemon(deps = {}) {
|
|
|
42324
42329
|
const limited = /* @__PURE__ */ new Map();
|
|
42325
42330
|
const caps = /* @__PURE__ */ new Map();
|
|
42326
42331
|
const announceUp = (rec) => {
|
|
42332
|
+
if (rec.replaces !== void 0 && !hubHelloed) return false;
|
|
42327
42333
|
const id = frameId();
|
|
42328
42334
|
const kind2 = rec.kind;
|
|
42329
42335
|
upIds.set(id, { ref: rec.ref, kind: kind2 });
|
|
@@ -42473,6 +42479,10 @@ async function runDaemon(deps = {}) {
|
|
|
42473
42479
|
});
|
|
42474
42480
|
const sendToHub = (f, native = false, onUnsent) => {
|
|
42475
42481
|
if (f.type !== "send") return hub.send(f, onUnsent);
|
|
42482
|
+
if (held(f.from_ref)) {
|
|
42483
|
+
outbox.push({ frame: f, native });
|
|
42484
|
+
return true;
|
|
42485
|
+
}
|
|
42476
42486
|
const from = agents.byRef(f.from_ref);
|
|
42477
42487
|
if (f.to_namespace === void 0 && from && !from.global)
|
|
42478
42488
|
f = { ...f, to_namespace: from.namespace };
|
|
@@ -42527,7 +42537,7 @@ async function runDaemon(deps = {}) {
|
|
|
42527
42537
|
};
|
|
42528
42538
|
const withTo = (r) => hubIds && r.peerId ? { ...r.frame, to_id: r.peerId } : r.frame;
|
|
42529
42539
|
const outbox = new Outbox({
|
|
42530
|
-
send: (r, unsent) => hub.open && hubVersion !== void 0 ? sendToHub(withTo(r), true, unsent) : false,
|
|
42540
|
+
send: (r, unsent) => hub.open && hubVersion !== void 0 && !held(r.frame.from_ref) ? sendToHub(withTo(r), r.native ?? true, unsent) : false,
|
|
42531
42541
|
stale: (r) => !agents.byRef(r.frame.from_ref)?.live,
|
|
42532
42542
|
log
|
|
42533
42543
|
});
|
|
@@ -42609,7 +42619,7 @@ async function runDaemon(deps = {}) {
|
|
|
42609
42619
|
if (old) takenOver.add(old.ref);
|
|
42610
42620
|
announceUp(
|
|
42611
42621
|
agents.up({
|
|
42612
|
-
...old ? { replaces: old
|
|
42622
|
+
...old ? { replaces: handoverOf(old) } : {},
|
|
42613
42623
|
ref: s.ref,
|
|
42614
42624
|
kind: "claude-code",
|
|
42615
42625
|
proposedName: old?.busName ?? s.name,
|
|
@@ -42670,6 +42680,7 @@ async function runDaemon(deps = {}) {
|
|
|
42670
42680
|
let hubDroppedAt;
|
|
42671
42681
|
let hubIds = false;
|
|
42672
42682
|
let hubMailbox = false;
|
|
42683
|
+
let hubHelloed = false;
|
|
42673
42684
|
let hubVersion;
|
|
42674
42685
|
const hub = new HubConnection({
|
|
42675
42686
|
url: `${cfg.hub.replace(/^http/, "ws").replace(/\/+$/, "")}${BUS_ROUTES.connect}`,
|
|
@@ -42759,6 +42770,9 @@ async function runDaemon(deps = {}) {
|
|
|
42759
42770
|
hubVersion = frame.server_version;
|
|
42760
42771
|
hubIds = frame.caps?.includes(BUS_CAPS.ids) ?? false;
|
|
42761
42772
|
hubMailbox = frame.caps?.includes(BUS_CAPS.mailbox) ?? false;
|
|
42773
|
+
hubHelloed = true;
|
|
42774
|
+
for (const rec of agents.all())
|
|
42775
|
+
if (rec.live && rec.replaces !== void 0) announceUp(rec);
|
|
42762
42776
|
outbox.flush();
|
|
42763
42777
|
return;
|
|
42764
42778
|
}
|
|
@@ -42805,6 +42819,7 @@ async function runDaemon(deps = {}) {
|
|
|
42805
42819
|
hubVersion = void 0;
|
|
42806
42820
|
hubIds = false;
|
|
42807
42821
|
hubMailbox = false;
|
|
42822
|
+
hubHelloed = false;
|
|
42808
42823
|
statusRelay.dropped();
|
|
42809
42824
|
receipts.release();
|
|
42810
42825
|
resends.dropped();
|
|
@@ -43006,7 +43021,7 @@ async function runDaemon(deps = {}) {
|
|
|
43006
43021
|
seenAt.set(hello.agent_ref, ++seenSeq);
|
|
43007
43022
|
if (old) takenOver.add(old.ref);
|
|
43008
43023
|
const rec = agents.up({
|
|
43009
|
-
...old ? { replaces: old
|
|
43024
|
+
...old ? { replaces: handoverOf(old) } : {},
|
|
43010
43025
|
ref: hello.agent_ref,
|
|
43011
43026
|
kind: hello.kind,
|
|
43012
43027
|
proposedName: old?.busName ?? proposedName,
|
|
@@ -45467,7 +45482,7 @@ var noService = {
|
|
|
45467
45482
|
remove: async () => ({}),
|
|
45468
45483
|
cli: () => ["oa-bus"]
|
|
45469
45484
|
};
|
|
45470
|
-
var VERSION = true ? "0.
|
|
45485
|
+
var VERSION = true ? "0.132.0" : JSON.parse(
|
|
45471
45486
|
readFileSync13(new URL("../package.json", import.meta.url), "utf8")
|
|
45472
45487
|
).version;
|
|
45473
45488
|
var which = (cmd) => {
|
|
@@ -48776,7 +48791,7 @@ async function link(opts, ctx) {
|
|
|
48776
48791
|
const j = await res.json();
|
|
48777
48792
|
if (typeof j.confirmUrl === "string") {
|
|
48778
48793
|
const u = new URL(j.confirmUrl);
|
|
48779
|
-
if (u.origin === new URL(m.hub).origin &&
|
|
48794
|
+
if (u.origin === new URL(m.hub).origin && u.pathname === "/bus/links/confirm" && !u.search && /^#[A-Za-z0-9_-]{43}$/.test(u.hash))
|
|
48780
48795
|
url2 = u.href;
|
|
48781
48796
|
}
|
|
48782
48797
|
} catch {
|