@songsid/agend 2.4.0-beta.20 → 2.4.0-beta.22

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 (256) hide show
  1. package/dist/agent-cli-instructions.md +1 -1
  2. package/dist/backend/claude-carry.d.ts +11 -0
  3. package/dist/backend/claude-carry.js +88 -6
  4. package/dist/backend/claude-carry.js.map +1 -1
  5. package/dist/backend/claude-code.js +3 -0
  6. package/dist/backend/claude-code.js.map +1 -1
  7. package/dist/build-provenance.json +1 -1
  8. package/dist/cache-ledger.d.ts +23 -21
  9. package/dist/cache-ledger.js +70 -6
  10. package/dist/cache-ledger.js.map +1 -1
  11. package/dist/cache-prices.d.ts +8 -6
  12. package/dist/cache-prices.js +12 -5
  13. package/dist/cache-prices.js.map +1 -1
  14. package/dist/cache-service.d.ts +9 -5
  15. package/dist/cache-service.js +202 -50
  16. package/dist/cache-service.js.map +1 -1
  17. package/dist/channel/mcp-tools.js +6 -4
  18. package/dist/channel/mcp-tools.js.map +1 -1
  19. package/dist/cli-audited.js +2 -1
  20. package/dist/cli-audited.js.map +1 -1
  21. package/dist/cli.js +4 -1
  22. package/dist/cli.js.map +1 -1
  23. package/dist/contact-auth-policy.js +1 -1
  24. package/dist/contact-auth-policy.js.map +1 -1
  25. package/dist/contact-auth-service.js +8 -2
  26. package/dist/contact-auth-service.js.map +1 -1
  27. package/dist/contact-auth-store.d.ts +3 -0
  28. package/dist/contact-auth-store.js +34 -8
  29. package/dist/contact-auth-store.js.map +1 -1
  30. package/dist/contact-auth-types.d.ts +3 -2
  31. package/dist/contact-auth-types.js.map +1 -1
  32. package/dist/contact-change-proposals.d.ts +47 -0
  33. package/dist/contact-change-proposals.js +132 -0
  34. package/dist/contact-change-proposals.js.map +1 -0
  35. package/dist/daemon.d.ts +31 -0
  36. package/dist/daemon.js +149 -2
  37. package/dist/daemon.js.map +1 -1
  38. package/dist/delivery-outbox.d.ts +10 -0
  39. package/dist/delivery-outbox.js +21 -0
  40. package/dist/delivery-outbox.js.map +1 -1
  41. package/dist/fleet-manager.d.ts +65 -1
  42. package/dist/fleet-manager.js +338 -20
  43. package/dist/fleet-manager.js.map +1 -1
  44. package/dist/general-knowledge/skills/concepts/SKILL.md +2 -1
  45. package/dist/general-knowledge/skills/hub/SKILL.md +45 -5
  46. package/dist/general-knowledge/skills/task-board/SKILL.md +4 -0
  47. package/dist/general-knowledge/skills/web-appearance/SKILL.md +1 -1
  48. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +16 -6
  49. package/dist/hub/agent-pictures-model.d.ts +275 -0
  50. package/dist/hub/agent-pictures-model.js +103 -0
  51. package/dist/hub/agent-pictures-model.js.map +1 -0
  52. package/dist/hub/agent-pictures.d.ts +64 -0
  53. package/dist/hub/agent-pictures.js +255 -0
  54. package/dist/hub/agent-pictures.js.map +1 -0
  55. package/dist/hub/client.d.ts +4 -0
  56. package/dist/hub/client.js +23 -2
  57. package/dist/hub/client.js.map +1 -1
  58. package/dist/hub/compose/member.d.ts +14 -3
  59. package/dist/hub/compose/member.js +46 -10
  60. package/dist/hub/compose/member.js.map +1 -1
  61. package/dist/hub/compose/server.d.ts +6 -5
  62. package/dist/hub/compose/server.js +7 -3
  63. package/dist/hub/compose/server.js.map +1 -1
  64. package/dist/hub/direct-posts-model.d.ts +1 -0
  65. package/dist/hub/direct-posts-model.js +2 -0
  66. package/dist/hub/direct-posts-model.js.map +1 -0
  67. package/dist/hub/direct-posts.d.ts +36 -0
  68. package/dist/hub/direct-posts.js +145 -0
  69. package/dist/hub/direct-posts.js.map +1 -0
  70. package/dist/hub/http/compose.d.ts +5 -0
  71. package/dist/hub/http/compose.js +158 -20
  72. package/dist/hub/http/compose.js.map +1 -1
  73. package/dist/hub/http/core.d.ts +9 -1
  74. package/dist/hub/http/core.js +21 -1
  75. package/dist/hub/http/core.js.map +1 -1
  76. package/dist/hub/http/deps.d.ts +1 -0
  77. package/dist/hub/http/schema.js +7 -0
  78. package/dist/hub/http/schema.js.map +1 -1
  79. package/dist/hub/init/text.js +1 -1
  80. package/dist/hub/join/service.d.ts +2 -0
  81. package/dist/hub/join/service.js +7 -3
  82. package/dist/hub/join/service.js.map +1 -1
  83. package/dist/hub/member/agent-pictures.d.ts +76 -0
  84. package/dist/hub/member/agent-pictures.js +196 -0
  85. package/dist/hub/member/agent-pictures.js.map +1 -0
  86. package/dist/hub/member/direct-rooms.d.ts +9 -0
  87. package/dist/hub/member/direct-rooms.js +14 -0
  88. package/dist/hub/member/direct-rooms.js.map +1 -0
  89. package/dist/hub/member/room-ask.d.ts +22 -1
  90. package/dist/hub/member/room-ask.js +99 -5
  91. package/dist/hub/member/room-ask.js.map +1 -1
  92. package/dist/hub/member/room-asker-store.d.ts +48 -0
  93. package/dist/hub/member/room-asker-store.js +181 -0
  94. package/dist/hub/member/room-asker-store.js.map +1 -0
  95. package/dist/hub/member/room-post.d.ts +11 -10
  96. package/dist/hub/member/room-post.js +51 -7
  97. package/dist/hub/member/room-post.js.map +1 -1
  98. package/dist/hub/policy.d.ts +11 -2
  99. package/dist/hub/policy.js +60 -7
  100. package/dist/hub/policy.js.map +1 -1
  101. package/dist/hub/protocol.d.ts +254 -1
  102. package/dist/hub/protocol.js +20 -8
  103. package/dist/hub/protocol.js.map +1 -1
  104. package/dist/hub/representative.d.ts +38 -0
  105. package/dist/hub/representative.js +140 -12
  106. package/dist/hub/representative.js.map +1 -1
  107. package/dist/hub/room-asker-identity-model.d.ts +53 -0
  108. package/dist/hub/room-asker-identity-model.js +14 -0
  109. package/dist/hub/room-asker-identity-model.js.map +1 -0
  110. package/dist/hub/room-asker-identity.d.ts +22 -0
  111. package/dist/hub/room-asker-identity.js +43 -0
  112. package/dist/hub/room-asker-identity.js.map +1 -0
  113. package/dist/hub/rooms/agents.d.ts +2 -0
  114. package/dist/hub/rooms/agents.js +30 -3
  115. package/dist/hub/rooms/agents.js.map +1 -1
  116. package/dist/hub/rooms/asker-identity.d.ts +21 -0
  117. package/dist/hub/rooms/asker-identity.js +86 -0
  118. package/dist/hub/rooms/asker-identity.js.map +1 -0
  119. package/dist/hub/rooms/direct-view.d.ts +3 -2
  120. package/dist/hub/rooms/direct-view.js +23 -8
  121. package/dist/hub/rooms/direct-view.js.map +1 -1
  122. package/dist/hub/rooms/office.d.ts +27 -0
  123. package/dist/hub/rooms/office.js +12 -2
  124. package/dist/hub/rooms/office.js.map +1 -1
  125. package/dist/hub/rooms/service.d.ts +38 -1
  126. package/dist/hub/rooms/service.js +56 -3
  127. package/dist/hub/rooms/service.js.map +1 -1
  128. package/dist/hub/rooms/types.d.ts +5 -2
  129. package/dist/hub/rooms.d.ts +9 -0
  130. package/dist/hub/rooms.js +97 -26
  131. package/dist/hub/rooms.js.map +1 -1
  132. package/dist/hub/runtime.d.ts +1 -1
  133. package/dist/hub/server.js +24 -2
  134. package/dist/hub/server.js.map +1 -1
  135. package/dist/hub/session-directory-transition.d.ts +1 -0
  136. package/dist/hub/session-directory-transition.js +15 -9
  137. package/dist/hub/session-directory-transition.js.map +1 -1
  138. package/dist/hub/session-limits.d.ts +58 -0
  139. package/dist/hub/session-limits.js +121 -0
  140. package/dist/hub/session-limits.js.map +1 -0
  141. package/dist/hub/sessions.d.ts +1 -1
  142. package/dist/hub/sessions.js +13 -7
  143. package/dist/hub/sessions.js.map +1 -1
  144. package/dist/hub/settings-directory-decision.js +1 -1
  145. package/dist/hub/settings-directory-decision.js.map +1 -1
  146. package/dist/hub/types.d.ts +9 -2
  147. package/dist/hub-character-plan.d.ts +47 -0
  148. package/dist/hub-character-plan.js +70 -0
  149. package/dist/hub-character-plan.js.map +1 -0
  150. package/dist/hub-contact-windows.d.ts +13 -1
  151. package/dist/hub-contact-windows.js +35 -2
  152. package/dist/hub-contact-windows.js.map +1 -1
  153. package/dist/hub-picture-reduce.d.ts +34 -0
  154. package/dist/hub-picture-reduce.js +101 -0
  155. package/dist/hub-picture-reduce.js.map +1 -0
  156. package/dist/hub-picture-worker.d.ts +1 -0
  157. package/dist/hub-picture-worker.js +19 -0
  158. package/dist/hub-picture-worker.js.map +1 -0
  159. package/dist/hub-report-target.d.ts +6 -0
  160. package/dist/hub-report-target.js +6 -0
  161. package/dist/hub-report-target.js.map +1 -1
  162. package/dist/locale.js +357 -265
  163. package/dist/locale.js.map +1 -1
  164. package/dist/ls-rows.d.ts +2 -0
  165. package/dist/ls-rows.js.map +1 -1
  166. package/dist/needs-you.d.ts +6 -0
  167. package/dist/needs-you.js +3 -1
  168. package/dist/needs-you.js.map +1 -1
  169. package/dist/outbound-handlers.d.ts +8 -0
  170. package/dist/outbound-handlers.js +53 -6
  171. package/dist/outbound-handlers.js.map +1 -1
  172. package/dist/outbound-schemas.d.ts +2 -0
  173. package/dist/outbound-schemas.js +6 -4
  174. package/dist/outbound-schemas.js.map +1 -1
  175. package/dist/runtime-cli-install.js +4 -4
  176. package/dist/runtime-cli-install.js.map +1 -1
  177. package/dist/task-board-tool.d.ts +17 -0
  178. package/dist/task-board-tool.js +58 -6
  179. package/dist/task-board-tool.js.map +1 -1
  180. package/dist/tips.js +3 -3
  181. package/dist/tool-permissions.js +2 -2
  182. package/dist/tool-permissions.js.map +1 -1
  183. package/dist/ui/agent-export-strings.js +1 -1
  184. package/dist/ui/agent-page-strings.js +5 -5
  185. package/dist/ui/contact-auth-client.js +2 -2
  186. package/dist/ui/contact-tool-groups.js +1 -1
  187. package/dist/ui/fleet-cache.js +5 -5
  188. package/dist/ui/fleet-canvas.js +3 -2
  189. package/dist/ui/fleet-office-card.js +46 -7
  190. package/dist/ui/fleet-office-dialogue.d.ts +6 -3
  191. package/dist/ui/fleet-office-dialogue.js +13 -3
  192. package/dist/ui/fleet-office-layout.js +15 -15
  193. package/dist/ui/fleet-office-model.js +3 -2
  194. package/dist/ui/fleet-office-overview.js +1 -1
  195. package/dist/ui/fleet-office-pack.d.ts +17 -7
  196. package/dist/ui/fleet-office-pack.js +106 -38
  197. package/dist/ui/fleet-office-play.js +11 -4
  198. package/dist/ui/fleet-office-skin.js +41 -11
  199. package/dist/ui/fleet-office-store.js +10 -1
  200. package/dist/ui/fleet-office-talk.js +423 -0
  201. package/dist/ui/fleet-office-view.js +58 -17
  202. package/dist/ui/fleet-office-zones.js +20 -12
  203. package/dist/ui/fleet-office.js +250 -65
  204. package/dist/ui/fleet-org.js +3 -3
  205. package/dist/ui/fleet-task-common.js +3 -3
  206. package/dist/ui/fleet-task-sort.js +88 -0
  207. package/dist/ui/fleet-task-view.js +38 -9
  208. package/dist/ui/fleet-tasks.js +47 -15
  209. package/dist/ui/fleet-usage.js +6 -6
  210. package/dist/ui/hub-admin-overview.js +1 -1
  211. package/dist/ui/hub-chat-store.js +4 -3
  212. package/dist/ui/hub-chat-strings.js +3 -1
  213. package/dist/ui/hub-client.js +3 -0
  214. package/dist/ui/hub-my-agents-strings.js +2 -2
  215. package/dist/ui/hub-my-agents.js +3 -0
  216. package/dist/ui/hub-room-composer.js +24 -4
  217. package/dist/ui/hub-room-members.js +7 -3
  218. package/dist/ui/hub-room-office.js +71 -2
  219. package/dist/ui/hub-room-presence.js +14 -0
  220. package/dist/ui/hub-room-strings.js +18 -2
  221. package/dist/ui/hub-room-thread.js +82 -13
  222. package/dist/ui/hub-room-working.js +37 -0
  223. package/dist/ui/hub-session-limits.js +79 -0
  224. package/dist/ui/panel-fleet.js +5 -5
  225. package/dist/ui/panel-hub.js +41 -6
  226. package/dist/ui/panel-log.js +3 -3
  227. package/dist/ui/panel-needs.js +28 -2
  228. package/dist/ui/panel-runtimes.js +2 -2
  229. package/dist/ui/runtime-cli-install.js +1 -1
  230. package/dist/ui/runtime-update-status.js +1 -1
  231. package/dist/ui/settings-access-strings.js +1 -1
  232. package/dist/ui/settings-hub-setup-strings.js +1 -1
  233. package/dist/ui/settings-layout.js +2 -2
  234. package/dist/ui/settings-named-test.js +16 -16
  235. package/dist/ui/settings-public-session-strings.js +2 -2
  236. package/dist/ui/settings-revoke-strings.js +1 -1
  237. package/dist/ui/settings-shared-strings.js +2 -2
  238. package/dist/ui/settings-strings.js +40 -40
  239. package/dist/ui/shared/app-shell.js +1 -1
  240. package/dist/ui/shared/app.css +106 -6
  241. package/dist/ui/shared/chat-strings.js +9 -9
  242. package/dist/ui/shared/hub-owner.css +5 -0
  243. package/dist/ui/shared/hub-rooms-u2.css +3 -0
  244. package/dist/ui/shared/instance-nav.js +36 -2
  245. package/dist/ui/shared/office-dialogue.css +110 -0
  246. package/dist/ui/shared/task-board.css +103 -7
  247. package/dist/ui/shared/view-strings.js +27 -9
  248. package/dist/web-api.d.ts +5 -0
  249. package/dist/web-api.js +29 -0
  250. package/dist/web-api.js.map +1 -1
  251. package/dist/web-office-skins.d.ts +8 -2
  252. package/dist/web-office-skins.js +33 -14
  253. package/dist/web-office-skins.js.map +1 -1
  254. package/dist/web-office-store.js +5 -3
  255. package/dist/web-office-store.js.map +1 -1
  256. package/package.json +1 -1
@@ -1,3 +1,4 @@
1
+ import { prepareContactChange } from "./contact-change-proposals.js";
1
2
  import { detectMonitoringPlatform } from './host-monitoring-defaults.js';
2
3
  import { SharedDefaultAdoption } from "./shared-default-adoption.js";
3
4
  import { scopedDefaultModel } from "./model-defaults.js";
@@ -22,6 +23,7 @@ import { ContactAuthService } from "./contact-auth-service.js";
22
23
  import { stageContactFiles } from "./contact-auth-files.js";
23
24
  import { ContactOriginClearSchema, ContactPermissionsSchema, sameContactPerson } from "./contact-auth-policy.js";
24
25
  import { CLASSIC_RESTRICTED_TOOLS } from "./contact-auth-types.js";
26
+ import { contactPersonKey, normalizeContactPersonKey } from "./contact-auth-store.js";
25
27
  import { hubSharingNoticeText } from "./hub-sharing-notice.js";
26
28
  import { hubPageSharingSettings } from "./hub-page-sharing-settings.js";
27
29
  import { replyPreviews } from "./reply-preview-spec.js";
@@ -279,7 +281,8 @@ import { ThemeStore } from "./web-theme-store.js";
279
281
  import { OfficeStore, OfficeWriteLimiter } from "./web-office-store.js";
280
282
  import { WebPinStore } from "./web-pin-store.js";
281
283
  import { OfficeSkinStore } from "./web-office-skins.js";
282
- import { OfficeActs } from "./web-office-acts.js";
284
+ import { OfficeActs, officeMembers } from "./web-office-acts.js";
285
+ import { characterPlan, ownCharacter } from "./hub-character-plan.js";
283
286
  import { OFFICE_PACK_TOOLS, OfficePackTools } from "./web-office-pack-tools.js";
284
287
  import { WebAppearance } from "./web-appearance.js";
285
288
  import { effectiveAppearanceLimits } from "./web-appearance-limits.js";
@@ -2773,6 +2776,7 @@ export class FleetManager {
2773
2776
  boundHub: () => this.hubMemberBinding?.(this.dataDir)?.hubId ?? null,
2774
2777
  agents: () => this.hubMemberAgents(),
2775
2778
  catalogAgents: () => this.hubCatalogAgents(),
2779
+ pictureSources: agent => this.hubPictureSources(agent),
2776
2780
  sharingNotice: value => this.recordHubSharingNotice(value),
2777
2781
  attachSharing: controller => { this.hubSharingController = controller; },
2778
2782
  maxCrossInstanceMessageBytes: () => this.fleetConfig?.defaults?.max_cross_instance_message_bytes,
@@ -2796,6 +2800,7 @@ export class FleetManager {
2796
2800
  scratchDir: agent => isSafeInstanceDirName(agent) ? join(this.dataDir, "workspaces", agent, "hub-files") : null },
2797
2801
  attachReports: (handler, failed) => { this.hubReports = handler; this.hubDeliveryFailed = failed; },
2798
2802
  attachPrivateQuestions: read => { this.hubPrivateQuestions = read; },
2803
+ attachQuestionSettled: read => { this.hubQuestionSettled = read; },
2799
2804
  attachReacts: handler => { this.hubReacts = handler; },
2800
2805
  },
2801
2806
  attachAgentIntro: port => { this.hubAgentIntro = port; },
@@ -2821,7 +2826,7 @@ export class FleetManager {
2821
2826
  : this.getInstanceAdapterId(agent) === actor.adapter_id && this.isFleetAdmin(actor.user_id, actor.adapter_id),
2822
2827
  }, caller.agent, receiptId),
2823
2828
  attachExposures: api => this.attachHubMemberExposures(api),
2824
- attachAttention: read => this.attachHubExecutionAttention(read),
2829
+ attachAttention: (read, retry) => this.attachHubExecutionAttention(read, retry),
2825
2830
  updates: { idle: () => this.hubUpdateIdle(), busy: () => !!this.webUpdateOwned || isUpdateInProgress(this.dataDir),
2826
2831
  canInstall: () => this.hubUpdateCanInstall(), launch: (row, control) => this.launchHubUpdate(row, control),
2827
2832
  active: id => this.hubUpdateOwned?.id === id, outcome: row => this.hubUpdateOutcome(row), notify: n => this.recordHubUpdateNotice(n) },
@@ -2930,6 +2935,109 @@ export class FleetManager {
2930
2935
  : { ...base, shareable: true };
2931
2936
  });
2932
2937
  }
2938
+ /**
2939
+ * M-3533 R2b: an agent's pictures for the Hub's room offices, as this Fleet shows them (hub-office-visit.md "Decided while
2940
+ * building"). The disc is the sidebar's (webIdentityImage + instance-nav.js avatarOf): a profile picture, else its theme
2941
+ * avatar while the owner shows agents' themes (fx.show), else its bot's avatar, else a Discord custom persona emoji; a
2942
+ * Unicode emoji or an initial is no picture (the catalog's emoji stays). The portrait is the identity card's (a person's,
2943
+ * else the agent's own). Cheap keys only: the bytes are read when a key changes (hub/member/agent-pictures.ts).
2944
+ */
2945
+ hubPictureSources(name) {
2946
+ let disc = null;
2947
+ let portrait = null;
2948
+ try {
2949
+ const profileFile = profileIdentities(this.dataDir).get(name)?.avatar_path;
2950
+ let profileVersion = null;
2951
+ if (profileFile && imageMimeForFile(profileFile)) {
2952
+ try {
2953
+ profileVersion = Math.floor(statSync(join(this.dataDir, "avatars", basename(profileFile))).mtimeMs).toString(36);
2954
+ }
2955
+ catch { /* removed */ }
2956
+ }
2957
+ let theme = { v: 1 };
2958
+ try {
2959
+ theme = this.themeStore.get(name).theme;
2960
+ }
2961
+ catch { /* unreadable themes: none */ }
2962
+ let themesShown = true;
2963
+ try {
2964
+ themesShown = this.webPrefs.read(OPERATOR).values["fx.show"] !== false;
2965
+ }
2966
+ catch { /* the default: shown */ }
2967
+ // The key names the file and its version (Prism #4393: two agents' uploads may share an mtime).
2968
+ if (profileVersion)
2969
+ disc = { key: `profile:${basename(profileFile)}:${profileVersion}`, load: () => this.webImage("avatar", name) };
2970
+ else if (themesShown && theme.avatar) {
2971
+ const id = theme.avatar;
2972
+ disc = { key: `theme:${id}`, load: () => this.themeStore.asset(name, id) };
2973
+ }
2974
+ else {
2975
+ const bots = this.webBots(), connection = bots.own.get(name) ?? bots.speaking.get(name);
2976
+ const owner = connection ? this.botOwner(connection) : null;
2977
+ const source = connection && owner?.adapter.fetchBotAvatar ? this.botAvatarSource(connection, owner) : null;
2978
+ const bot = source ? this.webImageCache("avatars").peek(source.key, source.load) : null;
2979
+ if (source && bot)
2980
+ disc = { key: `${source.key}:${bot.version}`, load: () => this.webImageCache("avatars").read(source.key) };
2981
+ else {
2982
+ const emoji = normalizeEmoji(this.ownInstanceConfig(name)?.status_emojis?.delivered);
2983
+ const cached = emoji?.kind === "custom" ? this.webImageCache("emoji").read(`emoji:${emoji.id}`) : null;
2984
+ if (emoji?.kind === "custom" && cached)
2985
+ disc = { key: `emoji:${emoji.id}:${cached.version}`, load: () => this.webImageCache("emoji").read(`emoji:${emoji.id}`) };
2986
+ }
2987
+ }
2988
+ const person = humanCards(this.dataDir).get(name)?.portrait ?? null, own = theme.card?.portrait ?? null;
2989
+ if (person || own)
2990
+ portrait = { key: person ? `card:${person}` : `agent-card:${own}`, load: () => cardPicture({ dataDir: this.dataDir, themeStore: this.themeStore }, name, "portrait") };
2991
+ }
2992
+ catch { /* unreadable: no pictures */ }
2993
+ let character = null;
2994
+ try {
2995
+ character = this.hubCharacterSource(name);
2996
+ }
2997
+ catch { /* unreadable offices or packs: no character */ }
2998
+ return { disc, portrait, character };
2999
+ }
3000
+ /**
3001
+ * M-3533 R2c: the agent's own character (hub-character-plan.ts ownCharacter): the set its owner gave it by name in
3002
+ * the first of these offices (their own order) holding it, else in the "All" office's pack. The key is that pack's version
3003
+ * and the set's name: a changed pack, set or office changes it; the pictures are read and cut only then.
3004
+ */
3005
+ hubCharacterSource(name) {
3006
+ const list = this.officeStore.list();
3007
+ if (!list.readable)
3008
+ return null;
3009
+ let chart = null;
3010
+ const holds = (office, agent) => {
3011
+ if (!office.members.length)
3012
+ return true;
3013
+ if (office.members.includes(agent))
3014
+ return true;
3015
+ if (!office.members.some(m => m.startsWith("team:")))
3016
+ return false;
3017
+ chart ??= (() => { const c = this.orgChart(); return { names: Object.keys(c.instances), teams: c.teams }; })();
3018
+ return officeMembers({ members: [...office.members] }, chart).includes(agent);
3019
+ };
3020
+ const hit = ownCharacter({ offices: list.offices, autoSkin: list.autoSkin ?? null, holds, pack: id => this.officeSkins.pack(id) }, name);
3021
+ if (!hit)
3022
+ return null;
3023
+ const sha = this.officeSkins.list().packs.find(p => p.id === hit.packId)?.sha;
3024
+ if (!sha)
3025
+ return null;
3026
+ return { key: `${hit.packId}@${sha}:${hit.set}`, load: () => {
3027
+ const pack = this.officeSkins.pack(hit.packId), files = this.officeSkins.get(hit.packId)?.files;
3028
+ const plan = pack && files ? characterPlan(pack.characters[hit.set]) : null;
3029
+ if (!plan)
3030
+ return null;
3031
+ const pictures = new Map();
3032
+ for (const src of plan.sources) {
3033
+ const id = files[src], bytes = id ? this.officeSkins.picture(hit.packId, id) : null;
3034
+ if (!bytes)
3035
+ return null;
3036
+ pictures.set(src, bytes);
3037
+ }
3038
+ return { plan, pictures };
3039
+ } };
3040
+ }
2933
3041
  /** The actual launch target, including Classic's own effective backend/folder; never aliases a room to a Fleet topic. */
2934
3042
  hubAgentConfig(agent) {
2935
3043
  const instances = this.fleetConfig?.instances ?? {};
@@ -3191,7 +3299,80 @@ export class FleetManager {
3191
3299
  contactWindows() {
3192
3300
  return this.hubContactWindows ??= new HubContactWindows(join(this.dataDir, "hub-contact-windows.json"));
3193
3301
  }
3194
- hubContactRestricted(agent) { return this.contactWindows().restricted(agent); }
3302
+ /**
3303
+ * M-3660: each agent's running Hub answer turn as its daemon tells it (re-told on every connect): a correlation id, or
3304
+ * null for "confirmed none". An agent missing here is unknown (this fleet has not heard from its daemon since it
3305
+ * started): nothing settled lifts its windows then — they hold until the daemon says (Prism #4420 P2-1).
3306
+ */
3307
+ hubAnswerTurns = new Map();
3308
+ /**
3309
+ * M-3660: the agent's daemon is about to write a Hub question into its idle pane: the answer turn's window opens (none for
3310
+ * a share that opted out). A window that cannot be saved still holds in memory: fail closed.
3311
+ */
3312
+ hubQuestionInput(agent, correlationId, contactLimit = true) {
3313
+ this.hubAnswerTurns.set(agent, correlationId);
3314
+ if (!contactLimit)
3315
+ return;
3316
+ try {
3317
+ this.contactWindows().begin(agent, correlationId);
3318
+ }
3319
+ catch (err) {
3320
+ this.logger.warn({ err, agent }, "Hub contact window could not be saved; it holds until this fleet restarts or it expires");
3321
+ }
3322
+ }
3323
+ /** M-3660: that answer turn is over (its idle edge, or the next turn's write): the window closes, whatever came of it. */
3324
+ hubQuestionTurnEnded(agent, correlationId) {
3325
+ if (this.hubAnswerTurns.get(agent) === correlationId)
3326
+ this.hubAnswerTurns.set(agent, null);
3327
+ try {
3328
+ this.contactWindows().answered(agent, correlationId);
3329
+ }
3330
+ catch (err) {
3331
+ this.logger.warn({ err, agent }, "Hub contact window could not be closed; it will expire");
3332
+ }
3333
+ }
3334
+ /**
3335
+ * M-3660: what the daemon says on (re)connect — the turn it is answering now, or none. A lost hub_question_input or
3336
+ * hub_question_turn_ended (a stale connection, a fleet or daemon restart) is made good here: with no turn running every
3337
+ * window of the agent ends; with one, that one holds and the rest end.
3338
+ */
3339
+ hubQuestionTurnState(agent, correlationId, contactLimit = true) {
3340
+ try {
3341
+ this.contactWindows().closeAgent(agent, correlationId ?? undefined);
3342
+ }
3343
+ catch (err) {
3344
+ this.logger.warn({ err, agent }, "Hub contact windows could not be reconciled; they will expire");
3345
+ }
3346
+ if (correlationId)
3347
+ this.hubQuestionInput(agent, correlationId, contactLimit);
3348
+ else
3349
+ this.hubAnswerTurns.set(agent, null);
3350
+ }
3351
+ /** M-3660: a daemon's Hub turn signal (from its current connection). "unknown" (an unreadable turn record) changes nothing. */
3352
+ hubTurnSignal(agent, msg) {
3353
+ const cid = typeof msg.correlationId === "string" && /^hub-[A-Za-z0-9-]+$/.test(msg.correlationId) ? msg.correlationId : null;
3354
+ if (msg.type === "hub_question_turn_state") {
3355
+ if (msg.unknown !== true && (cid || msg.correlationId === null))
3356
+ this.hubQuestionTurnState(agent, cid, msg.contactLimit !== false);
3357
+ }
3358
+ else if (cid && msg.type === "hub_question_input")
3359
+ this.hubQuestionInput(agent, cid, msg.contactLimit !== false);
3360
+ else if (cid && msg.type === "hub_question_turn_ended")
3361
+ this.hubQuestionTurnEnded(agent, cid);
3362
+ }
3363
+ /** M-3660: the agent's daemon has told this fleet its current turn, and it is not this question (unknown is never "none"). */
3364
+ hubAnswerTurnKnownNone(agent, correlationId) {
3365
+ return this.hubAnswerTurns.has(agent) && this.hubAnswerTurns.get(agent) !== correlationId;
3366
+ }
3367
+ /** M-3660: a settled question lifts its window only outside its own running answer turn; inside it, the turn's end does. */
3368
+ hubSettledOutsideTurn() {
3369
+ const settled = this.hubQuestionSettled;
3370
+ return settled ? (agent, correlationId) => this.hubAnswerTurnKnownNone(agent, correlationId) && settled(agent, correlationId) : undefined;
3371
+ }
3372
+ /** M-3660: the member side's "this question is no longer being answered" reader (null: no member service attached). */
3373
+ hubQuestionSettled = null;
3374
+ hubContactRestricted(agent) { return this.contactWindows().restricted(agent, this.hubSettledOutsideTurn()); }
3375
+ hubContactQuestion(agent) { return this.contactWindows().restrictingQuestion(agent, this.hubSettledOutsideTurn()); }
3195
3376
  /**
3196
3377
  * M-3313 (#4145 for the Hub): what a Hub question or room notification hands the agent, with this fleet's sign-in
3197
3378
  * access token hidden (exact match, as a chat's). The live one is taken back and replaced, and the sign-in's chat told.
@@ -3246,6 +3427,9 @@ export class FleetManager {
3246
3427
  };
3247
3428
  if (input.roomContextGeneration)
3248
3429
  ipcMeta.hub_room_context_generation = input.roomContextGeneration;
3430
+ // M-3660: the share's opt-out travels with the question; its daemon's hub_question_input then opens no window.
3431
+ if (input.contactLimit === false)
3432
+ ipcMeta.hub_contact_limit = "off";
3249
3433
  const result = await this.deliverToInstance(input.agent, { type: "fleet_inbound", targetSession: input.agent, content: this.screenHubText(input.text), meta: ipcMeta }, { isCrossInstance: true, stillCurrent: input.stillCurrent, beforeInput: async () => {
3250
3434
  const classic = this.isClassicInstance(input.agent);
3251
3435
  // A busy Classic room must finish its public turn first; never force a private question into that turn's queue.
@@ -3264,9 +3448,9 @@ export class FleetManager {
3264
3448
  return false;
3265
3449
  this.classicPrivacy().begin(input.agent, input.correlationId);
3266
3450
  }
3267
- // Before any possible IPC exposure. An uncertain write retains the window, never replays the question.
3268
- if (input.contactLimit !== false)
3269
- this.contactWindows().begin(input.agent, input.correlationId);
3451
+ // M-3660: the window covers only the turn that answers the question. The agent's daemon (Classic rooms' too)
3452
+ // writes it only into an idle pane, as a turn of its own, and says so just before the write (hub_question_input),
3453
+ // so a question waiting behind another turn — or never written — opens nothing.
3270
3454
  return input.stillCurrent();
3271
3455
  } });
3272
3456
  return result !== false;
@@ -3394,7 +3578,8 @@ export class FleetManager {
3394
3578
  if (!result)
3395
3579
  return null;
3396
3580
  return result.then(outcome => {
3397
- if (outcome.ok) {
3581
+ // M-3660: an accepted answer inside its own running answer turn does not lift it: the turn's end does.
3582
+ if (outcome.ok && this.hubAnswerTurnKnownNone(input.caller, input.correlationId)) {
3398
3583
  try {
3399
3584
  this.contactWindows().answered(input.caller, input.correlationId);
3400
3585
  }
@@ -3682,6 +3867,8 @@ export class FleetManager {
3682
3867
  /** #3292: "Keep sign-in alive" (signin-keepalive.ts); built at startup, stopped at shutdown. */
3683
3868
  signInKeepAlive = null;
3684
3869
  hubExecutionAttention = null;
3870
+ /** M-3632: the member's "Try again" for a held Hub question (null while no member runs). */
3871
+ hubHeldRetry = null;
3685
3872
  missedOfflineStore = null;
3686
3873
  configHistory = null;
3687
3874
  configHistoryTimer = null;
@@ -6103,14 +6290,30 @@ export class FleetManager {
6103
6290
  throw Error("unavailable");
6104
6291
  return incarnation;
6105
6292
  }
6293
+ /** Eligible connections share a platform; the current Fleet-admin gate still decides each user's role. */
6294
+ contactAdminAdapterIds(adapter) {
6295
+ const channels = this.fleetConfig?.channels ?? (this.fleetConfig?.channel ? [this.fleetConfig.channel] : []);
6296
+ return [...new Set([adapter.id, ...channels.filter(ch => ch.type === adapter.type).map(ch => ch.id ?? ch.type)])];
6297
+ }
6298
+ /** Contact permissions identify a person by platform/user; sibling bot connections do not create new people. */
6299
+ contactDefaultApprovers(name) {
6300
+ const adapter = this.contactAdapter(name);
6301
+ if (!adapter || (adapter.type !== "discord" && adapter.type !== "telegram"))
6302
+ return [];
6303
+ const people = this.contactAdminAdapterIds(adapter).flatMap(id => (this.adminListOf(id) ?? []).map(userId => ({
6304
+ platform: adapter.type, adapterId: id, userId, label: userId
6305
+ })));
6306
+ return [...new Map(people.map(person => [contactPersonKey(person), person])).values()];
6307
+ }
6106
6308
  contactAdminOf(name, actor) {
6107
6309
  if (actor.platform === "host" && actor.adapterId === "host" && actor.userId === "operator")
6108
6310
  return true;
6109
6311
  const adapter = this.contactAdapter(name);
6110
- if (!adapter || actor.adapterId !== adapter.id || actor.platform !== adapter.type)
6312
+ if (!adapter || actor.platform !== adapter.type)
6111
6313
  return false;
6112
- return this.isFleetAdmin(actor.userId, adapter.id)
6113
- || (!!this.contactRoom(name) && this.classicChannels?.isAdmin(actor.userId) === true);
6314
+ if (this.contactAdminAdapterIds(adapter).some(id => this.isFleetAdmin(actor.userId, id)))
6315
+ return true;
6316
+ return !!this.contactRoom(name) && this.classicChannels?.isAdmin(actor.userId) === true;
6114
6317
  }
6115
6318
  contactService() {
6116
6319
  this.ensureDeliveryOutbox();
@@ -6118,12 +6321,7 @@ export class FleetManager {
6118
6321
  restricted: name => this.contactRoom(name)?.restrictedMode === true,
6119
6322
  legacyClassic: name => !!this.contactRoom(name) && this.contactRoom(name)?.restrictedMode !== true,
6120
6323
  adminOf: (name, actor) => this.contactAdminOf(name, actor),
6121
- defaultApprovers: name => {
6122
- const adapter = this.contactAdapter(name);
6123
- if (!adapter || (adapter.type !== "discord" && adapter.type !== "telegram"))
6124
- return [];
6125
- return (this.adminListOf(adapter.id) ?? []).map(userId => ({ platform: adapter.type, adapterId: adapter.id, userId, label: userId }));
6126
- },
6324
+ defaultApprovers: name => this.contactDefaultApprovers(name),
6127
6325
  generation: name => this.contactGeneration(name),
6128
6326
  hubRestricted: name => this.hubContactRestricted(name),
6129
6327
  delivered: ticket => !!ticket.deliveryId && this.deliveryOutbox.get(ticket.deliveryId)?.state === "delivered",
@@ -6278,6 +6476,93 @@ export class FleetManager {
6278
6476
  originRevision: service.host.store.originRevision(name) });
6279
6477
  return this.contactPermissions(name, actor);
6280
6478
  }
6479
+ /** General can propose only. The platform callback supplies the human actor. */
6480
+ async requestContactChange(requester, raw, callerCurrent) {
6481
+ if (!callerCurrent() || this.fleetConfig?.instances[requester]?.general_topic !== true)
6482
+ throw Error("general-only");
6483
+ if (this.hubContactRestricted(requester))
6484
+ throw Error("hub-contact-restricted");
6485
+ const pending = [...this.pendingNonceButtons.values()].filter(e => e.prefix === "contact-change:");
6486
+ if (pending.length >= 64 || pending.filter(e => e.generalName === requester).length >= 8)
6487
+ throw Error("contact-proposal-limit");
6488
+ const service = this.contactService();
6489
+ const plan = prepareContactChange(raw, { service, label: n => this.fleetConfig?.instances[n]?.display_name || this.contactRoom(n)?.displayName || n, timeZone: () => this.usageZone(), mode: n => { const room = this.contactRoom(n); return room ? room.restrictedMode ? "restricted" : "legacy" : undefined; },
6490
+ generation: n => this.contactGeneration(n), modeAdmin: (n, p) => this.contactAdminOf(n, p),
6491
+ write: (n, value, p) => this.writeContactPermissions(n, value, p), decide: (id, value, p) => this.decideContactAuthorization(id, value, p) });
6492
+ const targetAdapter = this.contactAdapter(plan.target);
6493
+ if (!targetAdapter || !["discord", "telegram"].includes(targetAdapter.type))
6494
+ throw Error("contact-proposal-use-web");
6495
+ const routes = Object.keys(this.fleetConfig?.instances ?? {}).flatMap(n => {
6496
+ const route = this.settingsGeneralRoute(n, targetAdapter.type, new Set());
6497
+ return route && route.adapterId === targetAdapter.id && route.adapter === targetAdapter ? [{ name: n, ...route }] : [];
6498
+ });
6499
+ if (routes.length !== 1)
6500
+ throw Error("contact-proposal-route-unavailable");
6501
+ const route = routes[0], requesterPin = this.lifecyclePin(requester), deadline = performance.now() + 5 * 60_000;
6502
+ let retired = false;
6503
+ const current = () => !retired && !this.shuttingDown && performance.now() < deadline && callerCurrent() && requesterPin()
6504
+ && this.fleetConfig?.instances[requester]?.general_topic === true && !this.hubContactRestricted(requester)
6505
+ && route.current() && this.contactAdapter(plan.target) === targetAdapter && this.adapters.get(targetAdapter.id) === targetAdapter && plan.current();
6506
+ if (!current())
6507
+ throw Error("conflict");
6508
+ const posted = this.postNonceButtonPromptOrThrow({ prefix: "contact-change:", alertType: "clear_confirm", instanceName: route.name,
6509
+ adapter: route.adapter, adapterId: route.adapterId, chatId: route.chatId, threadId: route.topic,
6510
+ message: [t("contactProposal.title"), ...plan.summary].join("\n"),
6511
+ choices: [{ action: "confirm", label: t("contactProposal.confirm") }, { action: "cancel", label: t("contactProposal.cancel") }],
6512
+ expiredText: t("contactProposal.expired"), timeoutMs: 5 * 60_000,
6513
+ extra: { generalName: requester, contactChange: { plan, current } } });
6514
+ const retire = (nonce) => {
6515
+ const entry = this.pendingNonceButtons.get(nonce);
6516
+ if (!entry)
6517
+ return;
6518
+ this.pendingNonceButtons.delete(nonce);
6519
+ if (entry.timer)
6520
+ clearTimeout(entry.timer);
6521
+ void this.retireNonceButtons(entry, entry.messageId ?? "", t("contactProposal.expired"));
6522
+ };
6523
+ void posted.then(nonce => { if (retired || !current())
6524
+ retire(nonce); }, () => { });
6525
+ try {
6526
+ const nonce = await withinBudget(posted, performance.now() + 5000);
6527
+ if (!current()) {
6528
+ retire(nonce);
6529
+ throw Error("conflict");
6530
+ }
6531
+ return { status: "awaiting_platform_admin_confirmation" };
6532
+ }
6533
+ catch (error) {
6534
+ retired = true;
6535
+ throw error;
6536
+ }
6537
+ }
6538
+ async handleContactChangeCallback(data, adapterId, adapter) {
6539
+ if (!data.callbackData.startsWith("contact-change:"))
6540
+ return false;
6541
+ const person = data.userId && adapter && this.adapters.get(adapterId) === adapter && adapter.id === adapterId
6542
+ && (adapter.type === "discord" || adapter.type === "telegram") && data.userId !== adapter.getBotUserId?.()
6543
+ ? { platform: adapter.type, adapterId, userId: data.userId, label: data.username || data.userId } : null;
6544
+ const claimed = this.consumeNonceCallback("contact-change:", /^contact-change:([0-9a-f]{32}):(confirm|cancel)$/, data, adapterId, adapter, undefined, (_user, entry) => !!person && !!entry.messageId && !this.webPromptClicks.has(data) && entry.contactChange?.plan.authorized(person) === true);
6545
+ if (claimed === null)
6546
+ return false;
6547
+ if (claimed === "consumed")
6548
+ return true;
6549
+ const { entry, action } = claimed;
6550
+ const stillCurrent = entry.lifecycleCurrent?.() === true && entry.contactChange?.current() === true;
6551
+ let text = t(stillCurrent ? "contactProposal.cancelled" : "contactProposal.expired");
6552
+ if (action === "confirm" && stillCurrent) {
6553
+ try {
6554
+ if (!person)
6555
+ throw Error("forbidden");
6556
+ entry.contactChange.plan.apply(person);
6557
+ text = entry.contactChange.plan.success;
6558
+ }
6559
+ catch {
6560
+ text = t("contactProposal.failed");
6561
+ }
6562
+ }
6563
+ await this.retireNonceButtons(entry, entry.messageId ?? data.messageId, text);
6564
+ return true;
6565
+ }
6281
6566
  contactAuthorization(id, actor) {
6282
6567
  const service = this.contactService(), ticket = service.host.store.get(id);
6283
6568
  if (!ticket)
@@ -6291,7 +6576,7 @@ export class FleetManager {
6291
6576
  const view = service.view(ticket, actor);
6292
6577
  if (filter.status && view.state !== filter.status)
6293
6578
  return [];
6294
- if (filter.person && !view.origin.people.some(person => JSON.stringify([person.platform, person.adapterId, person.userId]) === filter.person))
6579
+ if (filter.person && !view.origin.people.some(person => contactPersonKey(person) === normalizeContactPersonKey(filter.person ?? "")))
6295
6580
  return [];
6296
6581
  return [view];
6297
6582
  }
@@ -7397,6 +7682,15 @@ export class FleetManager {
7397
7682
  clearUpdateMarker(this.dataDir);
7398
7683
  }
7399
7684
  // ── ArchiverContext bridge ────────────────────────────────────────────
7685
+ /** M-3674: the last turn another agent started for `name` (the delivery outbox), ISO or null; never throws. */
7686
+ lastAgentTurnOf(name) {
7687
+ try {
7688
+ return this.deliveryOutbox?.lastAgentTurn(name) ?? null;
7689
+ }
7690
+ catch {
7691
+ return null;
7692
+ }
7693
+ }
7400
7694
  lastActivityMs(name) {
7401
7695
  return this.lastActivity.get(name) ?? 0;
7402
7696
  }
@@ -11261,7 +11555,7 @@ export class FleetManager {
11261
11555
  result = { carried: false, reason: `copy failed: ${err.message}` };
11262
11556
  }
11263
11557
  if (result.carried) {
11264
- const fields = { name, from: sw.from ?? "default", to: sw.to ?? "default", bytes: result.bytes, ms: result.ms, replacedOlderCopy: result.replacedOlderCopy };
11558
+ const fields = { name, from: sw.from ?? "default", to: sw.to ?? "default", bytes: result.bytes, ms: result.ms, replacedOlderCopy: result.replacedOlderCopy, ...(result.backedUp ? { backedUp: result.backedUp } : {}) };
11265
11559
  if (result.bytes > CARRY_LARGE_BYTES)
11266
11560
  this.logger.warn(fields, "Conversation carried to the new credential profile (a large transcript)");
11267
11561
  else
@@ -14632,6 +14926,11 @@ export class FleetManager {
14632
14926
  if (this.instanceIpcClients.get(name) === ipc && typeof msg.generation === "string" && typeof msg.turn === "string")
14633
14927
  void this.hubRoomOwed?.turnEnded(name, msg.generation, msg.turn).catch(err => this.logger.warn({ err }, "Hub room completion notice held"));
14634
14928
  }
14929
+ else if (msg.type === "hub_question_input" || msg.type === "hub_question_turn_ended" || msg.type === "hub_question_turn_state") {
14930
+ // M-3660: only the instance's current daemon speaks for its pane's turns.
14931
+ if (this.instanceIpcClients.get(name) === ipc)
14932
+ this.hubTurnSignal(name, msg);
14933
+ }
14635
14934
  else if (msg.type === "hub_room_input") {
14636
14935
  if (this.instanceIpcClients.get(name) === ipc && typeof msg.correlationId === "string" && typeof msg.generation === "string")
14637
14936
  this.hubRoomInput?.(msg.correlationId, name, msg.generation);
@@ -20644,6 +20943,8 @@ export class FleetManager {
20644
20943
  return true;
20645
20944
  if (await this.handleLoginBackendSelect(data, adapterId, adapter))
20646
20945
  return true;
20946
+ if (await this.handleContactChangeCallback(data, adapterId, adapter))
20947
+ return true;
20647
20948
  if (await this.handleSettingsChangeCallback(data, adapterId, adapter))
20648
20949
  return true;
20649
20950
  if (await this.handleKiroMigrateCallback(data, adapterId, adapter))
@@ -20720,9 +21021,22 @@ export class FleetManager {
20720
21021
  return this.needsYou?.webItems() ?? [];
20721
21022
  }
20722
21023
  /** Enabled member composition supplies only a local attention reader, never an approval/execution callback. */
20723
- attachHubExecutionAttention(read) {
21024
+ attachHubExecutionAttention(read, retry = null) {
20724
21025
  this.hubExecutionAttention = read;
21026
+ this.hubHeldRetry = read ? retry : null;
21027
+ this.needsYou?.poke();
21028
+ }
21029
+ /**
21030
+ * M-3632: Needs you → "Try again" on held Hub work (`hub:hold:<row>`). The question goes back through the member's whole
21031
+ * hand-off, including the Hub's begin lease; nothing is delivered without it.
21032
+ */
21033
+ retryHubHeld(itemId) {
21034
+ const id = itemId.startsWith("hub:") ? itemId.slice(4) : itemId;
21035
+ if (!this.hubHeldRetry || !id.startsWith("hold:"))
21036
+ return { status: 404, code: "not-found" };
21037
+ const code = this.hubHeldRetry(id);
20725
21038
  this.needsYou?.poke();
21039
+ return { status: code === "queued" ? 200 : code === "not-found" ? 404 : 409, code };
20726
21040
  }
20727
21041
  /**
20728
21042
  * #1389: the org chart's structure for the web — the instances the dashboard lists (getUiStatus's names), General,
@@ -33283,6 +33597,8 @@ export class FleetManager {
33283
33597
  // User activity is persisted by the daemon, so both the board and
33284
33598
  // auto-pause retain an accurate age across fleet restarts.
33285
33599
  lastActivity,
33600
+ // M-3674: the last turn another agent started (lastActivity is a person's side).
33601
+ lastAgentTurn: inst.classic ? null : this.lastAgentTurnOf(inst.name),
33286
33602
  currentTask,
33287
33603
  idle: this.getInstanceIdle(inst.name),
33288
33604
  ...this.instancePresentation(inst.name),
@@ -33738,7 +34054,7 @@ export class FleetManager {
33738
34054
  model: nativeConfig.model || "default", model_source: nativeConfig.model ? "instance" : "cli-default",
33739
34055
  status: agent && runtime ? runtime.status(name) : "crashed", state: agent && runtime ? runtime.execution(name) : null, execution_state: agent && runtime ? runtime.execution(name) : null,
33740
34056
  interaction: null, interaction_summary: null, context_pct: null, cost: null,
33741
- last_reply: this.webChatHistory.lastAgentReply(name) ?? undefined,
34057
+ last_reply: this.webChatHistory.lastAgentReply(name) ?? undefined, last_agent_turn: this.lastAgentTurnOf(name) ?? undefined,
33742
34058
  avatar: avatarFor({ name, displayName: display_name }),
33743
34059
  capabilities: { chat: true, settings: true, pause: true, cancel: true, teams: true, schedules: true, delegation: true, mcp: nativeProviderMcpSupported(backend), channels: false, terminal: false, attachments: false, usage: false, send_while_busy: false },
33744
34060
  ...(!agent ? { runtime_error: "Windows profile is missing or invalid; restore its saved conversation before using this instance" }
@@ -33824,6 +34140,8 @@ export class FleetManager {
33824
34140
  // #3008 G2: a web-only fleet's General (the agent its owner ticked) — the sidebar pins it first.
33825
34141
  ...(this.isWebOnlyFleet() && this.fleetConfig?.instances[name]?.general_topic === true ? { general: true } : {}),
33826
34142
  last_reply: this.webChatHistory.lastAgentReply(name) ?? undefined, // #2179: its last reply to a person (ISO)
34143
+ // M-3674: its last turn another agent started (a message from another instance it took up), beside last_reply.
34144
+ last_agent_turn: this.lastAgentTurnOf(name) ?? undefined,
33827
34145
  // #2855: its last reply that reached the channel — the only reply time a guest's sidebar gets (guestStatus).
33828
34146
  last_reply_channel: this.webChatHistory.lastAgentReply(name, { channel: true }) ?? undefined,
33829
34147
  // #2855: the web commands a guest may run here — the table's "anyone" cells for this channel (guestWebCommands);