@open-artifacts/bus 0.254.0 → 0.256.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 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.254.0";
14
+ const CLIENT_VERSION = "0.256.0";
15
15
 
16
16
  type Frame = Json & { type: string; id: string };
17
17
  type Ctx = {
@@ -27803,7 +27803,9 @@ var Deliver = external_exports.strictObject({
27803
27803
  body: InlineBodySchema.optional(),
27804
27804
  notice: Notice.optional(),
27805
27805
  /** Only from the reserved sender, only with BUS_CAPS.noticeMeta (#2768). */
27806
- meta: NoticeMetaSchema.optional()
27806
+ meta: NoticeMetaSchema.optional(),
27807
+ /** When the hub drops this message if it is still unacked; set only with BUS_CAPS.mailExpiry. */
27808
+ expires_at: IsoTimeSchema.optional()
27807
27809
  }).refine(
27808
27810
  (f) => f.meta === void 0 || f.from_name === INSTANCE_SENDER_NAME,
27809
27811
  "meta only from the instance"
@@ -27927,7 +27929,7 @@ var base2 = { v: external_exports.literal(V), id: external_exports.string().min(
27927
27929
  var late = { late: external_exports.array(external_exports.string().min(1)).optional() };
27928
27930
  var isWellFormed2 = (s) => s.isWellFormed();
27929
27931
  var WELL_FORMED = { message: "text is not well-formed unicode" };
27930
- var CLIENT_VERSION = true ? "0.254.0" : "0.0.0";
27932
+ var CLIENT_VERSION = true ? "0.256.0" : "0.0.0";
27931
27933
  var clientVersion = {
27932
27934
  client_version: external_exports.string().min(1).max(64).optional()
27933
27935
  };
@@ -27969,7 +27971,15 @@ var ADAPTER_CAPS = {
27969
27971
  * `welcome.caps` only for an adapter that listed it, and an adapter sends
27970
27972
  * the frame only to a daemon whose welcome listed it.
27971
27973
  */
27972
- link: "link"
27974
+ link: "link",
27975
+ /**
27976
+ * `agy_watch` (agy S3): this antigravity connection is the watcher of one
27977
+ * agy process, not a conversation. Its hello names the watcher's own pid
27978
+ * and the agy process's start time; the daemon walks the watcher's parents
27979
+ * to that agy process and pushes it `agy_deliver` frames, which it answers
27980
+ * with `ack` or `agy_failed`. Any other request on it is refused.
27981
+ */
27982
+ agyWatch: "agy_watch"
27973
27983
  };
27974
27984
  var Hello2 = external_exports.object({
27975
27985
  ...base2,
@@ -28127,6 +28137,12 @@ var AdapterLinkProof = external_exports.object({
28127
28137
  type: external_exports.literal("link_proof"),
28128
28138
  hash: LinkProofHashSchema
28129
28139
  }).strict();
28140
+ var AgyFailed = external_exports.object({
28141
+ ...base2,
28142
+ type: external_exports.literal("agy_failed"),
28143
+ msg_id: MsgIdSchema,
28144
+ outcome: external_exports.literal("unknown").optional()
28145
+ });
28130
28146
  var AdapterFrame = external_exports.discriminatedUnion("type", [
28131
28147
  Hello2,
28132
28148
  Send2,
@@ -28141,7 +28157,8 @@ var AdapterFrame = external_exports.discriminatedUnion("type", [
28141
28157
  Following2,
28142
28158
  ProposeReach,
28143
28159
  Habits,
28144
- AdapterLinkProof
28160
+ AdapterLinkProof,
28161
+ AgyFailed
28145
28162
  ]);
28146
28163
  var ConfigFile = external_exports.object({
28147
28164
  file: external_exports.string(),
@@ -28278,6 +28295,13 @@ var Deliver2 = external_exports.object({
28278
28295
  }).refine((d) => d.body === void 0 !== (d.notice === void 0), {
28279
28296
  message: "deliver needs exactly one of body or notice"
28280
28297
  });
28298
+ var AgyDeliver = external_exports.object({
28299
+ ...base2,
28300
+ type: external_exports.literal("agy_deliver"),
28301
+ msg_id: MsgIdSchema,
28302
+ conversation_id: AGENT_REF,
28303
+ text: external_exports.string().min(1)
28304
+ });
28281
28305
  var Notice2 = external_exports.object({
28282
28306
  ...base2,
28283
28307
  type: external_exports.literal("notice"),
@@ -28401,6 +28425,7 @@ var DaemonFrame = external_exports.discriminatedUnion("type", [
28401
28425
  Agent,
28402
28426
  Body,
28403
28427
  Deliver2,
28428
+ AgyDeliver,
28404
28429
  Notice2,
28405
28430
  ErrorFrame2,
28406
28431
  StatusReply,
@@ -28466,6 +28491,10 @@ async function connectDaemon(opts) {
28466
28491
  const early = [];
28467
28492
  let notice;
28468
28493
  const earlyNotices = [];
28494
+ let agyDeliver;
28495
+ const earlyAgy = [];
28496
+ const closers = [];
28497
+ let closedOnce = false;
28469
28498
  const report = opts.onError ?? ((e) => console.error("onDeliver threw", e));
28470
28499
  const dispatch = (f) => {
28471
28500
  try {
@@ -28494,6 +28523,16 @@ async function connectDaemon(opts) {
28494
28523
  else early.push(frame);
28495
28524
  continue;
28496
28525
  }
28526
+ if (frame.type === "agy_deliver") {
28527
+ if (!agyDeliver) earlyAgy.push(frame);
28528
+ else
28529
+ try {
28530
+ agyDeliver(frame);
28531
+ } catch (e) {
28532
+ report(e);
28533
+ }
28534
+ continue;
28535
+ }
28497
28536
  if (frame.type === "notice") {
28498
28537
  if (notice) {
28499
28538
  try {
@@ -28519,7 +28558,12 @@ async function connectDaemon(opts) {
28519
28558
  }
28520
28559
  });
28521
28560
  sock.on("error", (e) => failAll(e));
28522
- sock.on("close", () => failAll(new Error("daemon connection closed")));
28561
+ sock.on("close", () => {
28562
+ failAll(new Error("daemon connection closed"));
28563
+ if (closedOnce) return;
28564
+ closedOnce = true;
28565
+ for (const cb of closers.splice(0)) cb();
28566
+ });
28523
28567
  let timer;
28524
28568
  const welcomeRaw = await new Promise((resolve3, reject) => {
28525
28569
  waiters.push({ resolve: resolve3, reject });
@@ -28582,6 +28626,28 @@ async function connectDaemon(opts) {
28582
28626
  notice = cb;
28583
28627
  for (const t of earlyNotices.splice(0)) cb(t);
28584
28628
  },
28629
+ onAgyDeliver: (cb) => {
28630
+ agyDeliver = cb;
28631
+ for (const f of earlyAgy.splice(0)) cb(f);
28632
+ },
28633
+ agyFailed: (msg_id) => {
28634
+ if (state === "closed") return;
28635
+ sock.write(
28636
+ `${JSON.stringify({ v: 1, type: "agy_failed", id: `agyf-${++seq}`, msg_id })}
28637
+ `
28638
+ );
28639
+ },
28640
+ agyUnknown: (msg_id) => {
28641
+ if (state === "closed") return;
28642
+ sock.write(
28643
+ `${JSON.stringify({ v: 1, type: "agy_failed", id: `agyf-${++seq}`, msg_id, outcome: "unknown" })}
28644
+ `
28645
+ );
28646
+ },
28647
+ onClose: (cb) => {
28648
+ if (closedOnce) cb();
28649
+ else closers.push(cb);
28650
+ },
28585
28651
  close: () => sock.destroy()
28586
28652
  };
28587
28653
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oa-bus",
3
- "version": "0.254.0",
3
+ "version": "0.256.0",
4
4
  "type": "module",
5
5
  "openclaw": {
6
6
  "extensions": [