@songsid/agend 2.4.0-beta.25 → 2.4.0-beta.26

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.
Files changed (157) hide show
  1. package/dist/agent-file-read.js +1 -1
  2. package/dist/agent-file-read.js.map +1 -1
  3. package/dist/auth-api.js +3 -1
  4. package/dist/auth-api.js.map +1 -1
  5. package/dist/build-provenance.json +1 -1
  6. package/dist/channel/mcp-tools.js +1 -1
  7. package/dist/channel/mcp-tools.js.map +1 -1
  8. package/dist/delivery-outbox.js +4 -1
  9. package/dist/delivery-outbox.js.map +1 -1
  10. package/dist/fleet-lock.d.ts +16 -0
  11. package/dist/fleet-lock.js +40 -0
  12. package/dist/fleet-lock.js.map +1 -1
  13. package/dist/fleet-manager.d.ts +20 -1
  14. package/dist/fleet-manager.js +154 -14
  15. package/dist/fleet-manager.js.map +1 -1
  16. package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +6 -1
  17. package/dist/general-knowledge/skills/hub/SKILL.md +12 -1
  18. package/dist/general-knowledge/skills/web-appearance/SKILL.md +3 -1
  19. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +7 -0
  20. package/dist/hub/client.js +7 -0
  21. package/dist/hub/client.js.map +1 -1
  22. package/dist/hub/compose/member.js +6 -1
  23. package/dist/hub/compose/member.js.map +1 -1
  24. package/dist/hub/compose/server.d.ts +1 -0
  25. package/dist/hub/compose/server.js +3 -2
  26. package/dist/hub/compose/server.js.map +1 -1
  27. package/dist/hub/http/compose.js +3 -2
  28. package/dist/hub/http/compose.js.map +1 -1
  29. package/dist/hub/http/deps.d.ts +1 -0
  30. package/dist/hub/member/room-ask.d.ts +7 -8
  31. package/dist/hub/member/room-ask.js +52 -13
  32. package/dist/hub/member/room-ask.js.map +1 -1
  33. package/dist/hub/member/room-reaction-acks.d.ts +12 -0
  34. package/dist/hub/member/room-reaction-acks.js +44 -0
  35. package/dist/hub/member/room-reaction-acks.js.map +1 -0
  36. package/dist/hub/protocol.d.ts +4 -0
  37. package/dist/hub/protocol.js +2 -2
  38. package/dist/hub/protocol.js.map +1 -1
  39. package/dist/hub/roles/audit-details.d.ts +2 -0
  40. package/dist/hub/roles/audit-details.js +1 -1
  41. package/dist/hub/roles/audit-details.js.map +1 -1
  42. package/dist/hub/roles/authority.d.ts +8 -3
  43. package/dist/hub/roles/authority.js +144 -102
  44. package/dist/hub/roles/authority.js.map +1 -1
  45. package/dist/hub/roles/delegation.js +2 -2
  46. package/dist/hub/roles/delegation.js.map +1 -1
  47. package/dist/hub/roles/model.d.ts +5 -2
  48. package/dist/hub/roles/model.js +5 -4
  49. package/dist/hub/roles/model.js.map +1 -1
  50. package/dist/hub/roles/review.js +2 -2
  51. package/dist/hub/roles/review.js.map +1 -1
  52. package/dist/hub/room-react-ack-model.d.ts +2 -0
  53. package/dist/hub/room-react-ack-model.js +3 -0
  54. package/dist/hub/room-react-ack-model.js.map +1 -0
  55. package/dist/hub/rooms/admin.d.ts +6 -0
  56. package/dist/hub/rooms/admin.js +33 -0
  57. package/dist/hub/rooms/admin.js.map +1 -1
  58. package/dist/hub/rooms/agents.d.ts +2 -0
  59. package/dist/hub/rooms/agents.js +44 -3
  60. package/dist/hub/rooms/agents.js.map +1 -1
  61. package/dist/hub/rooms/service.d.ts +5 -1
  62. package/dist/hub/rooms/service.js +76 -24
  63. package/dist/hub/rooms/service.js.map +1 -1
  64. package/dist/hub/rooms/types.d.ts +2 -0
  65. package/dist/hub/server.js +6 -1
  66. package/dist/hub/server.js.map +1 -1
  67. package/dist/hub/types.d.ts +2 -0
  68. package/dist/locale.js +2 -2
  69. package/dist/locale.js.map +1 -1
  70. package/dist/public-web-gateway.js +2 -0
  71. package/dist/public-web-gateway.js.map +1 -1
  72. package/dist/recover.cjs +212 -26
  73. package/dist/request-contact-native.js +4 -0
  74. package/dist/request-contact-native.js.map +1 -1
  75. package/dist/scheduler/scheduler.d.ts +9 -0
  76. package/dist/scheduler/scheduler.js +26 -0
  77. package/dist/scheduler/scheduler.js.map +1 -1
  78. package/dist/scheduler/scheduler.test.js +17 -0
  79. package/dist/scheduler/scheduler.test.js.map +1 -1
  80. package/dist/settings-api.js +72 -0
  81. package/dist/settings-api.js.map +1 -1
  82. package/dist/settings-change.js +13 -0
  83. package/dist/settings-change.js.map +1 -1
  84. package/dist/settings-effect.js +11 -1
  85. package/dist/settings-effect.js.map +1 -1
  86. package/dist/ui/contact-auth-strings.js +7 -2
  87. package/dist/ui/contact-permissions.js +10 -2
  88. package/dist/ui/fleet-office-pack.d.ts +2 -2
  89. package/dist/ui/fleet-office-pack.js +25 -8
  90. package/dist/ui/fleet-office-vehicles.js +28 -11
  91. package/dist/ui/fleet-office-zones.js +2 -2
  92. package/dist/ui/fleet-office.js +25 -5
  93. package/dist/ui/hub-admin-rooms-strings.js +6 -2
  94. package/dist/ui/hub-admin-rooms.js +3 -1
  95. package/dist/ui/hub-group-search.js +2 -2
  96. package/dist/ui/hub-notify-keep.js +49 -0
  97. package/dist/ui/hub-role-view.js +1 -1
  98. package/dist/ui/hub-roles-strings.js +14 -10
  99. package/dist/ui/hub-roles.js +1 -1
  100. package/dist/ui/hub-room-notify.js +2 -1
  101. package/dist/ui/hub-room-strings.js +3 -3
  102. package/dist/ui/hub-room-thread.js +9 -4
  103. package/dist/ui/panel-hub.js +3 -2
  104. package/dist/ui/panel-needs.js +13 -5
  105. package/dist/ui/settings-update.js +13 -0
  106. package/dist/ui/shared/app-install.js +123 -0
  107. package/dist/ui/shared/app-shell.js +4 -2
  108. package/dist/ui/shared/app-update.js +16 -2
  109. package/dist/ui/shared/app.css +43 -0
  110. package/dist/ui/shared/app.js +3 -0
  111. package/dist/ui/shared/hub-chat.css +6 -0
  112. package/dist/ui/shared/ui-confirm.js +4 -3
  113. package/dist/ui/shared/ui-icons.js +2 -0
  114. package/dist/ui/shared/update-card-ui.js +419 -0
  115. package/dist/update-abandon.d.ts +26 -0
  116. package/dist/update-abandon.js +111 -0
  117. package/dist/update-abandon.js.map +1 -0
  118. package/dist/update-forward.d.ts +5 -19
  119. package/dist/update-forward.js +19 -75
  120. package/dist/update-forward.js.map +1 -1
  121. package/dist/update-goback.d.ts +90 -0
  122. package/dist/update-goback.js +260 -0
  123. package/dist/update-goback.js.map +1 -0
  124. package/dist/update-journal.d.ts +8 -0
  125. package/dist/update-journal.js +8 -2
  126. package/dist/update-journal.js.map +1 -1
  127. package/dist/update-package-restore.d.ts +11 -2
  128. package/dist/update-package-restore.js +16 -5
  129. package/dist/update-package-restore.js.map +1 -1
  130. package/dist/update-quiescence.d.ts +38 -9
  131. package/dist/update-quiescence.js +50 -10
  132. package/dist/update-quiescence.js.map +1 -1
  133. package/dist/update-recovery/recover.js +10 -0
  134. package/dist/update-recovery/recover.js.map +1 -1
  135. package/dist/update-recovery/runner.d.ts +4 -0
  136. package/dist/update-recovery/runner.js +38 -5
  137. package/dist/update-recovery/runner.js.map +1 -1
  138. package/dist/update-restore.d.ts +7 -1
  139. package/dist/update-restore.js +10 -5
  140. package/dist/update-restore.js.map +1 -1
  141. package/dist/update-retained.d.ts +28 -1
  142. package/dist/update-retained.js +28 -3
  143. package/dist/update-retained.js.map +1 -1
  144. package/dist/update-settings.d.ts +27 -0
  145. package/dist/update-settings.js +40 -0
  146. package/dist/update-settings.js.map +1 -1
  147. package/dist/update-snapshot-scope.js +1 -0
  148. package/dist/update-snapshot-scope.js.map +1 -1
  149. package/dist/web-icons.d.ts +11 -0
  150. package/dist/web-icons.js +14 -2
  151. package/dist/web-icons.js.map +1 -1
  152. package/dist/web-mentions.d.ts +27 -8
  153. package/dist/web-mentions.js +108 -1
  154. package/dist/web-mentions.js.map +1 -1
  155. package/dist/web-office-acts.js +3 -0
  156. package/dist/web-office-acts.js.map +1 -1
  157. package/package.json +2 -2
@@ -280,7 +280,7 @@ import { WebChatHistory, WEB_CHAT_TEXT_MAX, isWebMessageId, newWebMessageId, web
280
280
  import { WEB_ECHO_COPIES_MAX, WEB_MIRROR_TIMEOUT_MS, webReactionEmoji, webReactionProblem } from "./web-reactions.js";
281
281
  import { WebChatDiskStore, isSafeInstanceDirName } from "./web-chat-store.js";
282
282
  import { WebChatArchive } from "./web-chat-archive.js";
283
- import { SeenUsers, resolveMentions } from "./web-mentions.js";
283
+ import { SEEN_USERS_FILE, SeenUsers, resolveMentions } from "./web-mentions.js";
284
284
  import { OPERATOR, WebPrefsStore } from "./web-prefs.js";
285
285
  import { agendVersion } from "./agent-whats-new.js";
286
286
  import { OwnerCssStore } from "./web-owner-css-store.js";
@@ -328,7 +328,8 @@ import { WebSettingsTools } from "./web-settings-tools.js";
328
328
  import { GUEST_COMMAND_RUNS, GUEST_PREF_WRITES, GUEST_SEARCHES, bindGuestRequest, guestRouteDecision } from "./web-guest-access.js";
329
329
  import { GUEST_ROOM_TICK_MS, GuestRoomMembership, guestGroupRooms } from "./web-guest-rooms.js";
330
330
  import { Delegations, TrafficLog, trafficItem } from "./fleet-traffic.js";
331
- import { turnSource } from "./update-quiescence.js";
331
+ import { QuiescenceBarrier, stripHumanReceipt, UPDATE_HANDBACK_COPY_KIND, UPDATE_HANDBACK_SOURCE, handbackDue, turnSource } from "./update-quiescence.js";
332
+ import { readCurrent as readUpdateJournal } from "./update-journal.js";
332
333
  import { installedChannel, updateNoticeKey } from "./update-check.js";
333
334
  import { idleClaimOutcome, idleUpdateMessageId, UpdateOfferCard, updateAnswerLabel, updateOfferReply } from "./update-card.js";
334
335
  import { preflightAllows } from "./update-readiness.js";
@@ -848,6 +849,98 @@ export class FleetManager {
848
849
  /** S-244: the quiescence barrier. Unset, every pane write and admission proceeds as today. */
849
850
  quiescence = null;
850
851
  attachQuiescence(gate) { this.quiescence = gate; }
852
+ updateHandbackTimer = null;
853
+ /**
854
+ * M-3770 §2.3/§2.6 (rev 15): this fleet was restarted by an abandon as the attempt's `old` generation (its handoff
855
+ * nonce): it takes the held inbox and deferred jobs back. The first walk runs during the start, before the web chat,
856
+ * the adapters and the agents open any ingress, so a held copy keeps its place ahead of anything newer (Fable #4536
857
+ * design 3b): it waits, bounded, for the abandon driver to journal `restart-old`. Later walks every 10 s pick up
858
+ * stragglers until `hand-back` is journaled or the attempt closes.
859
+ */
860
+ async startUpdateHandback(nonce = process.env.AGEND_UPDATE_HANDOFF ?? "", waitMs = 15_000, sleep = (ms) => new Promise(r => setTimeout(r, ms))) {
861
+ if (!/^[0-9a-f]{32}$/.test(nonce))
862
+ return;
863
+ const own = { nonce, pid: process.pid };
864
+ const mine = (a) => a.stage === "abandoning"
865
+ && a.fleets?.some(g => g.gen === "old" && g.nonce === nonce) === true;
866
+ const until = performance.now() + waitMs;
867
+ for (;;) {
868
+ const read = readUpdateJournal(this.dataDir);
869
+ if (read.state !== "open" || !mine(read.attempt))
870
+ return;
871
+ if (handbackDue(read.attempt, own)) {
872
+ this.walkUpdateHandback(read.attempt, own);
873
+ break;
874
+ }
875
+ if (performance.now() >= until || this.shuttingDown) {
876
+ this.logger.warn({ attemptId: read.attempt.id }, "Update hand-back: restart-old isn't journaled yet; the held work is taken back by the next walk");
877
+ break;
878
+ }
879
+ await sleep(250);
880
+ }
881
+ const again = () => {
882
+ this.updateHandbackTimer = null;
883
+ if (this.shuttingDown)
884
+ return;
885
+ const read = readUpdateJournal(this.dataDir);
886
+ if (read.state !== "open" || !mine(read.attempt))
887
+ return;
888
+ if (handbackDue(read.attempt, own))
889
+ this.walkUpdateHandback(read.attempt, own);
890
+ this.updateHandbackTimer = setTimeout(again, 10_000);
891
+ this.updateHandbackTimer.unref?.();
892
+ };
893
+ this.updateHandbackTimer = setTimeout(again, 10_000);
894
+ this.updateHandbackTimer.unref?.();
895
+ }
896
+ walkUpdateHandback(attempt, own) {
897
+ try {
898
+ const r = new QuiescenceBarrier(this.dataDir).runHandback(attempt, this.updateHandbackPorts(), own);
899
+ if (r.walked)
900
+ this.logger.info({ attemptId: attempt.id, acked: r.acked }, "Update hand-back walked");
901
+ }
902
+ catch (err) {
903
+ this.logger.warn({ err, attemptId: attempt.id }, "Update hand-back walk failed; the next walk retries");
904
+ }
905
+ }
906
+ /** §2.6 ports, rev 15 (Fable #4536 design): the pump owns a handed-back row again; copies go in as their own kind. */
907
+ updateHandbackPorts() {
908
+ const outbox = this.deliveryOutbox;
909
+ if (!outbox)
910
+ throw new Error("the delivery outbox isn't open");
911
+ return {
912
+ log: (fields, message) => this.logger.warn(fields, `Update hand-back: ${message}`),
913
+ lookup: id => { const row = outbox.get(id); return row ? { state: row.state, target: row.targetInstance } : null; },
914
+ // Queued and retry_wait rows (inside a backoff too) are the restarted pump's again: it delivers them per target in
915
+ // order. Nothing is claimed here, so the pump's lane bookkeeping stays whole.
916
+ claim: id => {
917
+ const row = outbox.get(id);
918
+ if (!row)
919
+ return "missing";
920
+ if (row.state !== "queued" && row.state !== "retry_wait")
921
+ return "settled";
922
+ this.scheduleDeliveryOutboxPump();
923
+ return "claimed";
924
+ },
925
+ admitCopy: (sourceKey, body, target) => {
926
+ if (!this.fleetConfig?.instances[target])
927
+ return null;
928
+ const payload = { ...body };
929
+ const meta = payload.meta && typeof payload.meta === "object" ? payload.meta : undefined;
930
+ if (meta) {
931
+ const stripped = stripHumanReceipt(meta);
932
+ payload.meta = stripped.meta;
933
+ if (stripped.receiptId)
934
+ outbox.markHumanReceiptUncertain(stripped.receiptId, target);
935
+ }
936
+ const admitted = outbox.admit({ operationId: sourceKey, sourceKey, sourceInstance: UPDATE_HANDBACK_SOURCE, sourceDaemonBootId: this.managerBootId,
937
+ targetInstance: target, kind: UPDATE_HANDBACK_COPY_KIND, payload });
938
+ return { deliveryId: admitted.delivery.deliveryId };
939
+ },
940
+ runDeferred: job => { this.scheduler?.runDeferredOccurrence(job.scheduleId, job.runId, name => !!this.fleetConfig?.instances[name]); },
941
+ recordInterrupted: job => { this.scheduler?.recordInterruptedOccurrence(job.scheduleId, job.runId); },
942
+ };
943
+ }
851
944
  children = new Map();
852
945
  lifecycle;
853
946
  stormWindow;
@@ -4490,7 +4583,7 @@ export class FleetManager {
4490
4583
  }
4491
4584
  /** #1770: an instance's web-files byte cap (a field, so a test can make it small). */
4492
4585
  webReplyMaxBytes = REPLY_FILES_MAX_BYTES;
4493
- /** #1682: the people seen on inbound messages (id → name), for the web chat's mention pills; bounded, in memory. */
4586
+ /** #1682: the people seen on inbound messages (id → name), for the web chat's mention pills; bounded; on disk since M-3827. */
4494
4587
  seenUsers = new SeenUsers();
4495
4588
  webPrefsStore;
4496
4589
  /** #1665: the web preferences kept on the host (<home>/web-prefs.json), read on first use. */
@@ -7119,7 +7212,7 @@ export class FleetManager {
7119
7212
  clearTimeout(entry.timer);
7120
7213
  // #4438 review: a card still being posted has no message yet; postHeldTicketCard retires it once it has one.
7121
7214
  if (entry.messageId)
7122
- void this.retireNonceButtons(entry, entry.messageId, heldCardOutcome(ticket.state, !!ticket.requestContext));
7215
+ void this.removeDecidedContactCard(entry, entry.messageId, heldCardOutcome(ticket.state, !!ticket.requestContext));
7123
7216
  }
7124
7217
  return;
7125
7218
  }
@@ -7219,7 +7312,10 @@ export class FleetManager {
7219
7312
  if (!entry.messageId)
7220
7313
  return; // never an edit without a message
7221
7314
  closed = true;
7222
- void this.retireNonceButtons(entry, entry.messageId, fresh && fresh.state !== "pending" ? heldCardOutcome(fresh.state, !!fresh.requestContext) : t("contactProposal.expired"));
7315
+ if (fresh && fresh.state !== "pending")
7316
+ void this.removeDecidedContactCard(entry, entry.messageId, heldCardOutcome(fresh.state, !!fresh.requestContext));
7317
+ else
7318
+ void this.retireNonceButtons(entry, entry.messageId, t("contactProposal.expired"));
7223
7319
  };
7224
7320
  void posted.then(retire, () => { });
7225
7321
  try {
@@ -7235,6 +7331,25 @@ export class FleetManager {
7235
7331
  throw error;
7236
7332
  }
7237
7333
  }
7334
+ /**
7335
+ * M-3820 (the user, 11-26: General filled with cards edited to "approved elsewhere"): a contact card whose request was
7336
+ * decided or expired somewhere else — the web, another card, a General proposal — is deleted; the card a person pressed
7337
+ * keeps its outcome, and the decision stays in the agent's Permissions history. One try: a delete the platform refuses
7338
+ * (no permission, a Telegram message over 48 h old, a gateway not ready) falls back to the edit it had before.
7339
+ */
7340
+ async removeDecidedContactCard(entry, messageId, text) {
7341
+ if (!entry.retire && entry.adapter.deleteMessage) {
7342
+ try {
7343
+ await entry.adapter.deleteMessage(entry.chatId, messageId, entry.threadId);
7344
+ this.webPromptGone(entry, text);
7345
+ return;
7346
+ }
7347
+ catch (err) {
7348
+ this.logger.info({ err: err?.message, instanceName: entry.instanceName }, "Could not delete a contact card decided elsewhere; editing it instead");
7349
+ }
7350
+ }
7351
+ await this.retireNonceButtons(entry, messageId, text);
7352
+ }
7238
7353
  async postHeldTicketCard(ticket) {
7239
7354
  const found = this.contactCardRoute(ticket.target);
7240
7355
  if (typeof found === "string")
@@ -7268,7 +7383,10 @@ export class FleetManager {
7268
7383
  if (entry.timer)
7269
7384
  clearTimeout(entry.timer);
7270
7385
  }
7271
- await this.retireNonceButtons(entry, entry.messageId, !fresh || fresh.state === "pending" ? t("contactHeld.expired") : heldCardOutcome(fresh.state, !!fresh.requestContext));
7386
+ if (!fresh || fresh.state === "pending")
7387
+ await this.retireNonceButtons(entry, entry.messageId, t("contactHeld.expired"));
7388
+ else
7389
+ await this.removeDecidedContactCard(entry, entry.messageId, heldCardOutcome(fresh.state, !!fresh.requestContext));
7272
7390
  }
7273
7391
  async handleContactTicketCallback(data, adapterId, adapter) {
7274
7392
  if (!data.callbackData.startsWith(CONTACT_TICKET_PREFIX))
@@ -8073,6 +8191,19 @@ export class FleetManager {
8073
8191
  }
8074
8192
  sent = true;
8075
8193
  }
8194
+ else if (claimed.kind === UPDATE_HANDBACK_COPY_KIND) {
8195
+ // M-3770 §2.6 (rev 15, Fable #4536 design 3a): a turn the update barrier held, delivered as journaled. A person's
8196
+ // turn stays a person's — no from_instance is stamped — and only the fence's delivery id and attempt are added.
8197
+ if (payload.type === "raw_paste") {
8198
+ if (typeof payload.content !== "string")
8199
+ throw new Error("Durable hand-back copy has an invalid payload");
8200
+ sent = await this.deliverToInstance(target, { ...payload, delivery_id: claimed.deliveryId, delivery_attempt: String(claimed.attemptNo) }, { waitForIdle: false, noInlineWake: this.deliveryWorkerMode(target) !== "off" });
8201
+ }
8202
+ else {
8203
+ payload.meta = { ...rawMeta, delivery_id: claimed.deliveryId, delivery_attempt: String(claimed.attemptNo) };
8204
+ sent = await this.deliverToInstance(target, payload, { waitForIdle: true, noInlineWake: this.deliveryWorkerMode(target) !== "off" });
8205
+ }
8206
+ }
8076
8207
  else if (claimed.kind === "raw_paste") {
8077
8208
  if (payload.type !== "raw_paste" || typeof payload.content !== "string") {
8078
8209
  throw new Error("Durable raw_paste row has an invalid payload");
@@ -9878,8 +10009,8 @@ export class FleetManager {
9878
10009
  * not sent. There is no await between this and `ipc.send`. Unarmed, or not an agent turn: false, and the send proceeds.
9879
10010
  * A Hub or room payload is not a copy: `refuseHubPane` refuses it before this, and the producer leaves the row queued.
9880
10011
  */
9881
- holdPaneSend(payload) {
9882
- return this.quiescence?.commitTurn(payload) === true;
10012
+ holdPaneSend(instanceName, payload) {
10013
+ return this.quiescence?.commitTurn(payload, instanceName) === true;
9883
10014
  }
9884
10015
  /** The fence is up and this payload belongs to a durable Hub or room row. Do not send it and do not copy it. */
9885
10016
  refuseHubPane(payload) {
@@ -9916,7 +10047,7 @@ export class FleetManager {
9916
10047
  const wire = this.bindHumanReceiptPayload(instanceName, payload);
9917
10048
  if (this.refuseHubPane(wire))
9918
10049
  return false;
9919
- if (this.holdPaneSend(wire))
10050
+ if (this.holdPaneSend(instanceName, wire))
9920
10051
  return true;
9921
10052
  if (ipc.send(wire))
9922
10053
  return true;
@@ -9956,7 +10087,7 @@ export class FleetManager {
9956
10087
  return false;
9957
10088
  if (this.quiescence?.armed()) {
9958
10089
  const early = this.bindHumanReceiptPayload(instanceName, payload);
9959
- if (this.holdPaneSend(early))
10090
+ if (this.holdPaneSend(instanceName, early))
9960
10091
  return true;
9961
10092
  }
9962
10093
  if (!(await beforeInput()))
@@ -9972,7 +10103,7 @@ export class FleetManager {
9972
10103
  const wire = this.bindHumanReceiptPayload(instanceName, payload);
9973
10104
  if (this.refuseHubPane(wire))
9974
10105
  return false;
9975
- if (this.holdPaneSend(wire))
10106
+ if (this.holdPaneSend(instanceName, wire))
9976
10107
  return true;
9977
10108
  const sent = ipc.send(wire);
9978
10109
  if (sent && privateToken) {
@@ -10006,7 +10137,7 @@ export class FleetManager {
10006
10137
  const wire = this.bindHumanReceiptPayload(instanceName, payload);
10007
10138
  if (this.refuseHubPane(wire))
10008
10139
  return false;
10009
- if (this.holdPaneSend(wire))
10140
+ if (this.holdPaneSend(instanceName, wire))
10010
10141
  return true;
10011
10142
  if (ipc.send(wire))
10012
10143
  return true;
@@ -10364,7 +10495,11 @@ export class FleetManager {
10364
10495
  const contactStore = this.deliveryOutbox.contactAuthorizations;
10365
10496
  if (this.contactRoom(instanceName)?.restrictedMode === true && !contactStore)
10366
10497
  throw Error("Contact origin storage unavailable");
10367
- if (contactStore && (this.contactRoom(instanceName)?.restrictedMode === true || contactStore.origin(instanceName))) {
10498
+ // M-3830 (user 11-26, Fable): a person's message becomes contact origin only in a restricted ClassicBot room. Who may
10499
+ // talk to a fleet agent in its own topic is the admin's channel access (#754); recording it only once some earlier
10500
+ // inheritance had created a row made a cleared agent re-arm on its next topic message (a project lead, 11-26). What an
10501
+ // agent inherits from peers, rooms, new instances and board notes still carries its origin.
10502
+ if (contactStore && this.contactRoom(instanceName)?.restrictedMode === true) {
10368
10503
  const authority = origin.authority;
10369
10504
  const identity = origin.platform === "web" && isWebSessionIdentity(origin.web_identity) ? origin.web_identity : undefined;
10370
10505
  const actor = origin.platform === "web" ? identity ?? (authority?.kind === "web-verified" ? authority.actor : null)
@@ -10477,7 +10612,7 @@ export class FleetManager {
10477
10612
  const wire = this.bindHumanReceiptPayload(instanceName, admitted);
10478
10613
  if (this.refuseHubPane(wire))
10479
10614
  return false;
10480
- if (this.holdPaneSend(wire)) {
10615
+ if (this.holdPaneSend(instanceName, wire)) {
10481
10616
  sent = true;
10482
10617
  return true;
10483
10618
  }
@@ -14271,6 +14406,8 @@ export class FleetManager {
14271
14406
  setUpdateProgressStage(this.dataDir, "starting", { version: pendingUpdateProgress.progress.version });
14272
14407
  }
14273
14408
  this.initializeWebAuthTokens();
14409
+ // M-3827: the people seen before this start keep their names in the web chat's mentions (before any adapter connects).
14410
+ this.seenUsers?.persistTo({ path: join(this.dataDir, SEEN_USERS_FILE), onWarn: message => this.logger.warn(message) });
14274
14411
  // Must run before the first General/CLI spawn: pressure can hold startup.
14275
14412
  // Logs remain available even before the adapters and health listener exist.
14276
14413
  this.memoryPressure.start();
@@ -14581,6 +14718,8 @@ export class FleetManager {
14581
14718
  // rows can never crowd an instance's own out (#3421 review). Nothing unbounded goes into process.env.
14582
14719
  this.snapshotActiveDecisions();
14583
14720
  }
14721
+ // M-3770 §2.6: a fleet an abandon restarted takes the held work back before any ingress opens (rev 15).
14722
+ await this.startUpdateHandback();
14584
14723
  // Phase 1: Start general instances first and wait for them
14585
14724
  // M-2457: a held fleet starts no agent (the hold's Needs-you line says why and what to do).
14586
14725
  const allEntries = this.tmuxHold ? [] : Object.entries(fleet.instances).filter(([, config]) => !isNativeExecInstance(config));
@@ -32039,6 +32178,7 @@ export class FleetManager {
32039
32178
  // write that failed and is still owed — is paid now, so a restart neither shortens the idle window
32040
32179
  // nor revives a session that was revoked while the disk was refusing writes.
32041
32180
  this.webSessions?.flush();
32181
+ this.seenUsers?.flush(); // M-3827: the names seen since the last write
32042
32182
  this.eventLog?.close();
32043
32183
  this.replyButtonsCtl?.stop();
32044
32184
  this.replyButtonsStore?.close();