@songsid/agend 2.4.0-alpha.3 → 2.4.0-beta.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.
Files changed (426) hide show
  1. package/dist/agent-cli-instructions.md +8 -4
  2. package/dist/agent-whats-new.js +8 -8
  3. package/dist/agent-whats-new.js.map +1 -1
  4. package/dist/auth-api.js +8 -1
  5. package/dist/auth-api.js.map +1 -1
  6. package/dist/backend/claude-code.d.ts +8 -0
  7. package/dist/backend/claude-code.js +11 -4
  8. package/dist/backend/claude-code.js.map +1 -1
  9. package/dist/backend/codex.js +7 -3
  10. package/dist/backend/codex.js.map +1 -1
  11. package/dist/backend/grok.d.ts +19 -0
  12. package/dist/backend/grok.js +112 -1
  13. package/dist/backend/grok.js.map +1 -1
  14. package/dist/backend/types.d.ts +10 -0
  15. package/dist/backend/types.js.map +1 -1
  16. package/dist/build-provenance.json +1 -1
  17. package/dist/channel/mcp-tools.js +2 -2
  18. package/dist/channel/mcp-tools.js.map +1 -1
  19. package/dist/child-process.d.ts +1 -0
  20. package/dist/child-process.js.map +1 -1
  21. package/dist/claude-model-observation.d.ts +71 -0
  22. package/dist/claude-model-observation.js +169 -0
  23. package/dist/claude-model-observation.js.map +1 -0
  24. package/dist/cross-instance-envelope.d.ts +4 -1
  25. package/dist/cross-instance-envelope.js +12 -7
  26. package/dist/cross-instance-envelope.js.map +1 -1
  27. package/dist/daemon.d.ts +24 -2
  28. package/dist/daemon.js +263 -35
  29. package/dist/daemon.js.map +1 -1
  30. package/dist/delivery-consumed-watch.d.ts +24 -0
  31. package/dist/delivery-consumed-watch.js +21 -10
  32. package/dist/delivery-consumed-watch.js.map +1 -1
  33. package/dist/delivery-outbox.d.ts +5 -1
  34. package/dist/delivery-outbox.js +5 -0
  35. package/dist/delivery-outbox.js.map +1 -1
  36. package/dist/fleet-manager.d.ts +11 -1
  37. package/dist/fleet-manager.js +80 -2
  38. package/dist/fleet-manager.js.map +1 -1
  39. package/dist/general-knowledge/skills/concepts/SKILL.md +16 -3
  40. package/dist/general-knowledge/skills/credential-profiles/SKILL.md +8 -2
  41. package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +5 -3
  42. package/dist/general-knowledge/skills/hub/SKILL.md +203 -10
  43. package/dist/general-knowledge/skills/multi-channel/SKILL.md +1 -1
  44. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +18 -7
  45. package/dist/general-knowledge/skills/worker-collaboration/SKILL.md +1 -1
  46. package/dist/grok-delivery-proof.d.ts +24 -0
  47. package/dist/grok-delivery-proof.js +124 -0
  48. package/dist/grok-delivery-proof.js.map +1 -0
  49. package/dist/hub/assistant/admin-types.d.ts +43 -0
  50. package/dist/hub/assistant/admin-types.js +2 -0
  51. package/dist/hub/assistant/admin-types.js.map +1 -0
  52. package/dist/hub/assistant/claude-host.d.ts +17 -0
  53. package/dist/hub/assistant/claude-host.js +300 -0
  54. package/dist/hub/assistant/claude-host.js.map +1 -0
  55. package/dist/hub/assistant/context.d.ts +3 -0
  56. package/dist/hub/assistant/context.js +7 -0
  57. package/dist/hub/assistant/context.js.map +1 -0
  58. package/dist/hub/assistant/fleet-host.d.ts +19 -0
  59. package/dist/hub/assistant/fleet-host.js +28 -0
  60. package/dist/hub/assistant/fleet-host.js.map +1 -0
  61. package/dist/hub/assistant/runner.d.ts +64 -0
  62. package/dist/hub/assistant/runner.js +239 -0
  63. package/dist/hub/assistant/runner.js.map +1 -0
  64. package/dist/hub/assistant/service.d.ts +51 -0
  65. package/dist/hub/assistant/service.js +143 -0
  66. package/dist/hub/assistant/service.js.map +1 -0
  67. package/dist/hub/assistant/store.d.ts +3 -0
  68. package/dist/hub/assistant/store.js +65 -0
  69. package/dist/hub/assistant/store.js.map +1 -0
  70. package/dist/hub/assistant/types.d.ts +60 -0
  71. package/dist/hub/assistant/types.js +2 -0
  72. package/dist/hub/assistant/types.js.map +1 -0
  73. package/dist/hub/catalog.d.ts +1 -1
  74. package/dist/hub/catalog.js +55 -12
  75. package/dist/hub/catalog.js.map +1 -1
  76. package/dist/hub/client.d.ts +10 -0
  77. package/dist/hub/client.js +48 -8
  78. package/dist/hub/client.js.map +1 -1
  79. package/dist/hub/compose/member.d.ts +8 -1
  80. package/dist/hub/compose/member.js +224 -58
  81. package/dist/hub/compose/member.js.map +1 -1
  82. package/dist/hub/compose/server.d.ts +12 -1
  83. package/dist/hub/compose/server.js +74 -11
  84. package/dist/hub/compose/server.js.map +1 -1
  85. package/dist/hub/directory/admission.d.ts +15 -0
  86. package/dist/hub/directory/admission.js +56 -0
  87. package/dist/hub/directory/admission.js.map +1 -0
  88. package/dist/hub/directory/directory.d.ts +1 -1
  89. package/dist/hub/directory/directory.js +63 -0
  90. package/dist/hub/directory/directory.js.map +1 -1
  91. package/dist/hub/directory/types.d.ts +13 -0
  92. package/dist/hub/directory/types.js.map +1 -1
  93. package/dist/hub/grant-access.js +23 -3
  94. package/dist/hub/grant-access.js.map +1 -1
  95. package/dist/hub/grant-search.js +13 -1
  96. package/dist/hub/grant-search.js.map +1 -1
  97. package/dist/hub/group-policy/admin-control.d.ts +1 -0
  98. package/dist/hub/group-policy/admin-control.js +4 -2
  99. package/dist/hub/group-policy/admin-control.js.map +1 -1
  100. package/dist/hub/group-policy/admin-facts.d.ts +1 -0
  101. package/dist/hub/group-policy/admin-facts.js +2 -1
  102. package/dist/hub/group-policy/admin-facts.js.map +1 -1
  103. package/dist/hub/group-policy/admin-read.d.ts +1 -0
  104. package/dist/hub/group-policy/admin-read.js +3 -2
  105. package/dist/hub/group-policy/admin-read.js.map +1 -1
  106. package/dist/hub/group-policy/errors.d.ts +9 -0
  107. package/dist/hub/group-policy/errors.js +13 -0
  108. package/dist/hub/group-policy/errors.js.map +1 -0
  109. package/dist/hub/group-policy/impact-inventory.js +18 -2
  110. package/dist/hub/group-policy/impact-inventory.js.map +1 -1
  111. package/dist/hub/group-policy/store.d.ts +3 -9
  112. package/dist/hub/group-policy/store.js +5 -29
  113. package/dist/hub/group-policy/store.js.map +1 -1
  114. package/dist/hub/http/compose.d.ts +1 -0
  115. package/dist/hub/http/compose.js +482 -15
  116. package/dist/hub/http/compose.js.map +1 -1
  117. package/dist/hub/http/core.d.ts +6 -5
  118. package/dist/hub/http/core.js +74 -48
  119. package/dist/hub/http/core.js.map +1 -1
  120. package/dist/hub/http/deps.d.ts +20 -0
  121. package/dist/hub/http/schema.js +8 -0
  122. package/dist/hub/http/schema.js.map +1 -1
  123. package/dist/hub/init/member-certificate.d.ts +1 -0
  124. package/dist/hub/init/member-certificate.js +39 -0
  125. package/dist/hub/init/member-certificate.js.map +1 -0
  126. package/dist/hub/init/plan-digest.js +1 -0
  127. package/dist/hub/init/plan-digest.js.map +1 -1
  128. package/dist/hub/invitations.d.ts +96 -0
  129. package/dist/hub/invitations.js +292 -0
  130. package/dist/hub/invitations.js.map +1 -0
  131. package/dist/hub/join/certificate-trust.d.ts +13 -0
  132. package/dist/hub/join/certificate-trust.js +41 -0
  133. package/dist/hub/join/certificate-trust.js.map +1 -0
  134. package/dist/hub/join/certificate.d.ts +11 -0
  135. package/dist/hub/join/certificate.js +67 -0
  136. package/dist/hub/join/certificate.js.map +1 -0
  137. package/dist/hub/join/client.d.ts +5 -0
  138. package/dist/hub/join/client.js +30 -3
  139. package/dist/hub/join/client.js.map +1 -1
  140. package/dist/hub/join/http.js +5 -3
  141. package/dist/hub/join/http.js.map +1 -1
  142. package/dist/hub/join/local.d.ts +32 -1
  143. package/dist/hub/join/local.js +116 -11
  144. package/dist/hub/join/local.js.map +1 -1
  145. package/dist/hub/join/service.d.ts +17 -0
  146. package/dist/hub/join/service.js +12 -0
  147. package/dist/hub/join/service.js.map +1 -1
  148. package/dist/hub/join/store.d.ts +5 -0
  149. package/dist/hub/join/store.js +12 -2
  150. package/dist/hub/join/store.js.map +1 -1
  151. package/dist/hub/join/trust.d.ts +9 -0
  152. package/dist/hub/join/trust.js +35 -0
  153. package/dist/hub/join/trust.js.map +1 -1
  154. package/dist/hub/member/pairing-api.js +9 -1
  155. package/dist/hub/member/pairing-api.js.map +1 -1
  156. package/dist/hub/member/room-ask.d.ts +137 -0
  157. package/dist/hub/member/room-ask.js +358 -0
  158. package/dist/hub/member/room-ask.js.map +1 -0
  159. package/dist/hub/member-journal.d.ts +18 -1
  160. package/dist/hub/member-journal.js +76 -3
  161. package/dist/hub/member-journal.js.map +1 -1
  162. package/dist/hub/member-origin.d.ts +177 -0
  163. package/dist/hub/member-origin.js +314 -0
  164. package/dist/hub/member-origin.js.map +1 -0
  165. package/dist/hub/pairing-notices.d.ts +1 -0
  166. package/dist/hub/pairing-notices.js +2 -1
  167. package/dist/hub/pairing-notices.js.map +1 -1
  168. package/dist/hub/pairing.d.ts +8 -0
  169. package/dist/hub/pairing.js +32 -5
  170. package/dist/hub/pairing.js.map +1 -1
  171. package/dist/hub/protocol.d.ts +159 -0
  172. package/dist/hub/protocol.js +19 -1
  173. package/dist/hub/protocol.js.map +1 -1
  174. package/dist/hub/roles/clock.d.ts +18 -0
  175. package/dist/hub/roles/clock.js +58 -0
  176. package/dist/hub/roles/clock.js.map +1 -0
  177. package/dist/hub/roles/cutover-marker.d.ts +57 -0
  178. package/dist/hub/roles/cutover-marker.js +26 -0
  179. package/dist/hub/roles/cutover-marker.js.map +1 -0
  180. package/dist/hub/roles/cutover.js +3 -17
  181. package/dist/hub/roles/cutover.js.map +1 -1
  182. package/dist/hub/roles/read.d.ts +7 -3
  183. package/dist/hub/roles/read.js +9 -1
  184. package/dist/hub/roles/read.js.map +1 -1
  185. package/dist/hub/rooms/admin.d.ts +45 -0
  186. package/dist/hub/rooms/admin.js +105 -0
  187. package/dist/hub/rooms/admin.js.map +1 -0
  188. package/dist/hub/rooms/agents.d.ts +74 -0
  189. package/dist/hub/rooms/agents.js +333 -0
  190. package/dist/hub/rooms/agents.js.map +1 -0
  191. package/dist/hub/rooms/assistant.d.ts +44 -0
  192. package/dist/hub/rooms/assistant.js +179 -0
  193. package/dist/hub/rooms/assistant.js.map +1 -0
  194. package/dist/hub/rooms/context.d.ts +10 -0
  195. package/dist/hub/rooms/context.js +24 -0
  196. package/dist/hub/rooms/context.js.map +1 -0
  197. package/dist/hub/rooms/direct-view.d.ts +39 -0
  198. package/dist/hub/rooms/direct-view.js +38 -0
  199. package/dist/hub/rooms/direct-view.js.map +1 -0
  200. package/dist/hub/rooms/directory.d.ts +35 -0
  201. package/dist/hub/rooms/directory.js +98 -0
  202. package/dist/hub/rooms/directory.js.map +1 -0
  203. package/dist/hub/rooms/schema.d.ts +11 -0
  204. package/dist/hub/rooms/schema.js +73 -0
  205. package/dist/hub/rooms/schema.js.map +1 -0
  206. package/dist/hub/rooms/service.d.ts +449 -0
  207. package/dist/hub/rooms/service.js +581 -0
  208. package/dist/hub/rooms/service.js.map +1 -0
  209. package/dist/hub/rooms/types.d.ts +79 -0
  210. package/dist/hub/rooms/types.js +2 -0
  211. package/dist/hub/rooms/types.js.map +1 -0
  212. package/dist/hub/rooms.d.ts +7 -1
  213. package/dist/hub/rooms.js +30 -5
  214. package/dist/hub/rooms.js.map +1 -1
  215. package/dist/hub/runtime.d.ts +8 -0
  216. package/dist/hub/runtime.js +57 -3
  217. package/dist/hub/runtime.js.map +1 -1
  218. package/dist/hub/server.d.ts +25 -0
  219. package/dist/hub/server.js +63 -5
  220. package/dist/hub/server.js.map +1 -1
  221. package/dist/hub/sessions.js +1 -1
  222. package/dist/hub/sessions.js.map +1 -1
  223. package/dist/hub/settings-commit.d.ts +6 -1
  224. package/dist/hub/settings-commit.js +15 -0
  225. package/dist/hub/settings-commit.js.map +1 -1
  226. package/dist/hub/settings-directory-recovery.d.ts +5 -0
  227. package/dist/hub/settings-directory-recovery.js +11 -1
  228. package/dist/hub/settings-directory-recovery.js.map +1 -1
  229. package/dist/hub/settings-member-address-control.d.ts +84 -0
  230. package/dist/hub/settings-member-address-control.js +150 -0
  231. package/dist/hub/settings-member-address-control.js.map +1 -0
  232. package/dist/hub/settings-member-address-decision.d.ts +229 -0
  233. package/dist/hub/settings-member-address-decision.js +320 -0
  234. package/dist/hub/settings-member-address-decision.js.map +1 -0
  235. package/dist/hub/settings-member-address-http.d.ts +9 -0
  236. package/dist/hub/settings-member-address-http.js +79 -0
  237. package/dist/hub/settings-member-address-http.js.map +1 -0
  238. package/dist/hub/settings-member-address-network.d.ts +2 -0
  239. package/dist/hub/settings-member-address-network.js +22 -0
  240. package/dist/hub/settings-member-address-network.js.map +1 -0
  241. package/dist/hub/settings-member-address-notices.d.ts +22 -0
  242. package/dist/hub/settings-member-address-notices.js +21 -0
  243. package/dist/hub/settings-member-address-notices.js.map +1 -0
  244. package/dist/hub/settings-member-address-policy.d.ts +22 -0
  245. package/dist/hub/settings-member-address-policy.js +36 -0
  246. package/dist/hub/settings-member-address-policy.js.map +1 -0
  247. package/dist/hub/settings-member-address.d.ts +64 -0
  248. package/dist/hub/settings-member-address.js +239 -0
  249. package/dist/hub/settings-member-address.js.map +1 -0
  250. package/dist/hub/settings-web-address-decision.js +3 -1
  251. package/dist/hub/settings-web-address-decision.js.map +1 -1
  252. package/dist/hub/settings-web-address-http.js +3 -2
  253. package/dist/hub/settings-web-address-http.js.map +1 -1
  254. package/dist/hub/settings-web-address-policy.d.ts +3 -2
  255. package/dist/hub/settings-web-address-policy.js +3 -1
  256. package/dist/hub/settings-web-address-policy.js.map +1 -1
  257. package/dist/hub/socket.d.ts +2 -0
  258. package/dist/hub/socket.js +2 -0
  259. package/dist/hub/socket.js.map +1 -1
  260. package/dist/hub/teams/grant-schema.d.ts +2 -0
  261. package/dist/hub/teams/grant-schema.js +13 -0
  262. package/dist/hub/teams/grant-schema.js.map +1 -0
  263. package/dist/hub/teams/index.d.ts +7 -0
  264. package/dist/hub/teams/index.js +273 -0
  265. package/dist/hub/teams/index.js.map +1 -0
  266. package/dist/hub/teams/store.d.ts +34 -0
  267. package/dist/hub/teams/store.js +57 -0
  268. package/dist/hub/teams/store.js.map +1 -0
  269. package/dist/hub/teams/types.d.ts +98 -0
  270. package/dist/hub/teams/types.js +2 -0
  271. package/dist/hub/teams/types.js.map +1 -0
  272. package/dist/hub/tls.d.ts +47 -0
  273. package/dist/hub/tls.js +23 -6
  274. package/dist/hub/tls.js.map +1 -1
  275. package/dist/hub/types.d.ts +54 -3
  276. package/dist/hub/validation.d.ts +1 -1
  277. package/dist/hub/validation.js +2 -2
  278. package/dist/hub/validation.js.map +1 -1
  279. package/dist/hub/web-origin.d.ts +20 -7
  280. package/dist/hub/web-origin.js +26 -15
  281. package/dist/hub/web-origin.js.map +1 -1
  282. package/dist/hub-pilot-trust-settings.d.ts +4 -0
  283. package/dist/hub-pilot-trust-settings.js +13 -0
  284. package/dist/hub-pilot-trust-settings.js.map +1 -0
  285. package/dist/human-delivery-receipts.d.ts +4 -2
  286. package/dist/human-delivery-receipts.js +20 -13
  287. package/dist/human-delivery-receipts.js.map +1 -1
  288. package/dist/inbound-presentation.d.ts +28 -0
  289. package/dist/inbound-presentation.js +48 -0
  290. package/dist/inbound-presentation.js.map +1 -0
  291. package/dist/instance-lifecycle.js +1 -0
  292. package/dist/instance-lifecycle.js.map +1 -1
  293. package/dist/instructions.d.ts +4 -2
  294. package/dist/instructions.js +7 -4
  295. package/dist/instructions.js.map +1 -1
  296. package/dist/locale.js +16 -0
  297. package/dist/locale.js.map +1 -1
  298. package/dist/log-service.d.ts +3 -0
  299. package/dist/log-service.js +39 -22
  300. package/dist/log-service.js.map +1 -1
  301. package/dist/log-steps.d.ts +56 -1
  302. package/dist/log-steps.js +318 -56
  303. package/dist/log-steps.js.map +1 -1
  304. package/dist/needs-you-hub.js +6 -2
  305. package/dist/needs-you-hub.js.map +1 -1
  306. package/dist/needs-you.d.ts +5 -1
  307. package/dist/needs-you.js +4 -8
  308. package/dist/needs-you.js.map +1 -1
  309. package/dist/office-share-page.js +1 -1
  310. package/dist/office-share-page.js.map +1 -1
  311. package/dist/outbound-handlers.d.ts +1 -0
  312. package/dist/outbound-handlers.js +6 -0
  313. package/dist/outbound-handlers.js.map +1 -1
  314. package/dist/outbound-schemas.d.ts +1 -0
  315. package/dist/outbound-schemas.js +1 -0
  316. package/dist/outbound-schemas.js.map +1 -1
  317. package/dist/queued-handoffs.d.ts +3 -1
  318. package/dist/queued-handoffs.js +1 -1
  319. package/dist/queued-handoffs.js.map +1 -1
  320. package/dist/runtime-transcript-source.d.ts +2 -0
  321. package/dist/runtime-transcript-source.js +23 -1
  322. package/dist/runtime-transcript-source.js.map +1 -1
  323. package/dist/settings-api.d.ts +1 -0
  324. package/dist/settings-api.js +15 -8
  325. package/dist/settings-api.js.map +1 -1
  326. package/dist/settings-baseline.d.ts +3 -0
  327. package/dist/settings-baseline.js +2 -2
  328. package/dist/settings-baseline.js.map +1 -1
  329. package/dist/settings-effect.d.ts +3 -0
  330. package/dist/settings-effect.js +12 -2
  331. package/dist/settings-effect.js.map +1 -1
  332. package/dist/topic-commands.js +2 -1
  333. package/dist/topic-commands.js.map +1 -1
  334. package/dist/transcript-jsonl.d.ts +24 -0
  335. package/dist/transcript-jsonl.js +72 -22
  336. package/dist/transcript-jsonl.js.map +1 -1
  337. package/dist/transcript-monitor.d.ts +5 -1
  338. package/dist/transcript-monitor.js +65 -3
  339. package/dist/transcript-monitor.js.map +1 -1
  340. package/dist/transcript-needles.d.ts +1 -1
  341. package/dist/transcript-needles.js +1 -1
  342. package/dist/transcript-records.d.ts +2 -1
  343. package/dist/transcript-records.js.map +1 -1
  344. package/dist/transcript-sources.d.ts +4 -0
  345. package/dist/transcript-sources.js +2 -0
  346. package/dist/transcript-sources.js.map +1 -1
  347. package/dist/ui/agent-details-settings.js +10 -1
  348. package/dist/ui/chat-activity.js +2 -2
  349. package/dist/ui/fleet-canvas.js +5 -2
  350. package/dist/ui/fleet-office-card.js +4 -2
  351. package/dist/ui/fleet-org.js +2 -0
  352. package/dist/ui/hub-admin-rooms-strings.js +28 -0
  353. package/dist/ui/hub-admin-rooms.js +77 -0
  354. package/dist/ui/hub-assistant-admin-strings.js +26 -0
  355. package/dist/ui/hub-assistant-admin.js +85 -0
  356. package/dist/ui/hub-client.js +178 -14
  357. package/dist/ui/hub-grant-picker.js +14 -5
  358. package/dist/ui/hub-group-strings.js +3 -3
  359. package/dist/ui/hub-invitations-strings.js +30 -0
  360. package/dist/ui/hub-invitations.js +108 -0
  361. package/dist/ui/hub-join-one-strings.js +2 -0
  362. package/dist/ui/hub-pairing-form-strings.js +48 -0
  363. package/dist/ui/hub-pilot-trust-strings.js +27 -0
  364. package/dist/ui/hub-pilot-trust.js +41 -0
  365. package/dist/ui/hub-room-composer.js +123 -0
  366. package/dist/ui/hub-room-favorites.js +90 -0
  367. package/dist/ui/hub-room-list.js +152 -0
  368. package/dist/ui/hub-room-members-strings.js +12 -0
  369. package/dist/ui/hub-room-members.js +104 -0
  370. package/dist/ui/hub-room-new-strings.js +46 -0
  371. package/dist/ui/hub-room-new.js +135 -0
  372. package/dist/ui/hub-room-presence.js +123 -0
  373. package/dist/ui/hub-room-settings-strings.js +26 -0
  374. package/dist/ui/hub-room-settings.js +134 -0
  375. package/dist/ui/hub-room-strings.js +224 -0
  376. package/dist/ui/hub-room-thread.js +288 -0
  377. package/dist/ui/hub-room-unread.js +51 -0
  378. package/dist/ui/hub-room-working.js +29 -0
  379. package/dist/ui/hub-strings.js +2 -0
  380. package/dist/ui/hub-teams-strings.js +34 -0
  381. package/dist/ui/hub-teams.js +169 -0
  382. package/dist/ui/log-row.js +14 -5
  383. package/dist/ui/panel-details.js +6 -1
  384. package/dist/ui/panel-hub.js +115 -57
  385. package/dist/ui/panel-needs.js +2 -0
  386. package/dist/ui/settings-hub-company-join.js +31 -11
  387. package/dist/ui/settings-hub-connection.js +9 -3
  388. package/dist/ui/settings-hub-member-address.js +220 -0
  389. package/dist/ui/settings-hub-section.js +4 -2
  390. package/dist/ui/settings-hub-web-address.js +21 -5
  391. package/dist/ui/settings-hub.js +10 -4
  392. package/dist/ui/settings-layout.js +5 -1
  393. package/dist/ui/shared/app-i18n.js +2 -2
  394. package/dist/ui/shared/app-needs.js +3 -0
  395. package/dist/ui/shared/app-shell.js +7 -4
  396. package/dist/ui/shared/app.css +8 -0
  397. package/dist/ui/shared/chat-render.js +10 -0
  398. package/dist/ui/shared/chat-thread.js +15 -5
  399. package/dist/ui/shared/hub-chat.css +22 -0
  400. package/dist/ui/shared/hub-rooms-u2.css +42 -0
  401. package/dist/ui/shared/hub-signin.css +2 -0
  402. package/dist/ui/shared/hub-teams.css +31 -0
  403. package/dist/ui/shared/model-observation.js +16 -0
  404. package/dist/ui/shared/page-head.js +3 -2
  405. package/dist/ui/shared/stale-tab.css +6 -0
  406. package/dist/ui/shared/stale-tab.js +50 -0
  407. package/dist/ui/shared/usage-dialog.js +2 -1
  408. package/dist/ui/shared/view-strings.js +2 -0
  409. package/dist/usage/agent-output.js +1 -0
  410. package/dist/usage/agent-output.js.map +1 -1
  411. package/dist/usage/i18n-keys.d.ts +1 -1
  412. package/dist/usage/i18n-keys.js +1 -1
  413. package/dist/usage/i18n-keys.js.map +1 -1
  414. package/dist/usage/i18n.d.ts +1 -1
  415. package/dist/usage/i18n.js +2 -1
  416. package/dist/usage/i18n.js.map +1 -1
  417. package/dist/usage/providers.d.ts +4 -1
  418. package/dist/usage/providers.js +25 -10
  419. package/dist/usage/providers.js.map +1 -1
  420. package/dist/usage/usage-api.d.ts +1 -1
  421. package/dist/usage/usage-api.js +4 -4
  422. package/dist/usage/usage-api.js.map +1 -1
  423. package/dist/web-api.d.ts +2 -0
  424. package/dist/web-api.js +6 -2
  425. package/dist/web-api.js.map +1 -1
  426. package/package.json +1 -1
package/dist/daemon.d.ts CHANGED
@@ -1,7 +1,9 @@
1
+ import { type ModelObservation } from "./claude-model-observation.js";
1
2
  import type { SubagentSource } from "./subagent-service.js";
2
3
  import type { RecoveryLive } from "./working-recovery.js";
3
4
  import type { PaneContextSource } from "./pane-context-cache.js";
4
5
  import type { WorkingStateObservation } from "./working-state-journal.js";
6
+ import { type HumanPresentation } from "./inbound-presentation.js";
5
7
  import { EventEmitter } from "node:events";
6
8
  import type { InstanceConfig, RotationSnapshot } from "./types.js";
7
9
  import { type Logger } from "./logger.js";
@@ -823,6 +825,9 @@ export declare class Daemon extends EventEmitter {
823
825
  /** Includes a pause's pane admission, before it publishes pausing. */
824
826
  private pauseAdmissions;
825
827
  private modelOverride;
828
+ private claudeModelObserver;
829
+ private modelObservationBound;
830
+ modelObservation(): ModelObservation | null;
826
831
  private recentUserMessages;
827
832
  private recentEvents;
828
833
  private recentToolActivity;
@@ -1147,7 +1152,8 @@ export declare class Daemon extends EventEmitter {
1147
1152
  /**
1148
1153
  * #1201: a steer or a native-queue hand-off was accepted into the CLI's input (or may have been) — not read. Watch
1149
1154
  * the transcript from this attempt's checkpoint for the moment the CLI takes it, and record that on the delivery;
1150
- * an `uncertain` row becomes `delivered` then. Only claude-code and codex write a transcript AgEnD can read. The
1155
+ * an `uncertain` row becomes `delivered` then. An uncertain idle submission is watched the same way (M-3098). Grok
1156
+ * idle submissions use only their exact launch-UUID lease (#3810). The
1151
1157
  * watch belongs to this CLI: a stop, pause or respawn ends it (restart reconciliation owns the row after that).
1152
1158
  */
1153
1159
  private startConsumedWatch;
@@ -1781,11 +1787,25 @@ export declare class Daemon extends EventEmitter {
1781
1787
  */
1782
1788
  /** #1650: how this instance talks to the fleet — MCP tools, or agend-agent commands (agent_mode: cli). */
1783
1789
  private agentMode;
1790
+ private humanReminders;
1791
+ private compactInboundInstructions;
1792
+ private inboundCompatibilityPending;
1793
+ private humanPreparations;
1794
+ private humanReminderAttempts;
1795
+ /** Manager-owned admission capability. Never derived from a body marker. */
1796
+ registerHumanReceiptPreparation(receiptId: string, prepare: (presentation: HumanPresentation) => {
1797
+ wire: string;
1798
+ meta: Record<string, string>;
1799
+ }, abandon?: () => void): string;
1800
+ /** Called only when this launch has installed instructions teaching both dialects. */
1801
+ private installCompactInboundInstructions;
1802
+ resetInboundPresentation(): void;
1803
+ private prepareHumanReceiptWrite;
1784
1804
  private formatInboundMessage;
1785
1805
  /** Pure cached owner: no pane/process query on ingress. */
1786
1806
  captureHumanReceiptOwner(): string | null;
1787
1807
  /** The same formatter/sanitizer used by the actual write; snapshot only. */
1788
- humanReceiptWire(content: string, meta: Record<string, string>, kind: string): string;
1808
+ humanReceiptWire(content: string, meta: Record<string, string>, kind: string, presentation?: HumanPresentation): string;
1789
1809
  private humanReceiptAttempt;
1790
1810
  /**
1791
1811
  * #2770: a person's message a cancel dropped before it reached the CLI is told, not left as a silent "uncertain":
@@ -1795,6 +1815,8 @@ export declare class Daemon extends EventEmitter {
1795
1815
  */
1796
1816
  private noteCancelledHuman;
1797
1817
  private finishHumanReceipt;
1818
+ /** Synchronous acknowledgement from the manager after the existing receipt owner/authority checks. */
1819
+ noteHumanReceiptSettlement(id: string, positive: boolean): void;
1798
1820
  /**
1799
1821
  * Whether ONE delivery reached a verdict, carried by that delivery.
1800
1822
  *
package/dist/daemon.js CHANGED
@@ -1,5 +1,7 @@
1
+ import { checkpointGrokDelivery } from "./grok-delivery-proof.js";
1
2
  import { nativePaneToolRefusal } from "./native-pane-tools.js";
2
3
  import { generalByName } from "./general-instance.js";
4
+ import { ClaudeModelObserver, normalizeClaudeModel } from "./claude-model-observation.js";
3
5
  import { codexMetadataHomes } from "./backend/codex-metadata.js";
4
6
  import { claudeMinimumError, cliVersionBelow } from "./claude-model-minimum.js";
5
7
  import { quotaNoticeProblem } from "./quota-notice-config.js";
@@ -18,6 +20,7 @@ import { clearKiroSessionProof, proveKiroSessionId, recordKiroSessionProof } fro
18
20
  import { fileURLToPath } from "node:url";
19
21
  import { ensureInstanceDir } from "./private-dir.js";
20
22
  import { createHash, randomBytes, randomUUID } from "node:crypto";
23
+ import { HumanReminderState, humanReceiptMarker, escapeInboundField } from "./inbound-presentation.js";
21
24
  import { EventEmitter } from "node:events";
22
25
  import { rotateLogIfNeededAsync } from "./logger.js";
23
26
  import { coredumpFilterLaunchPrefix } from "./coredump-filter.js";
@@ -58,7 +61,7 @@ import { writeSecretFile } from "./secret-file.js";
58
61
  import { PaneWriteLock } from "./pane-write-lock.js";
59
62
  import { answerRemoteCard } from "./remote-card-answer.js";
60
63
  import { tmuxPaneHost } from "./tmux-pane-host.js";
61
- import { buildFleetInstructions } from "./instructions.js";
64
+ import { buildFleetInstructions, INBOUND_HEADER_RULE } from "./instructions.js";
62
65
  import { formatHumanInboundMessage, prepareDeliveryWire, steerInboundEnvelope, BTW_INBOUND_PREFIX, humanBodyHash, humanOwnerObjectId } from "./human-delivery-receipts.js";
63
66
  import { formatCrossInstanceInboundMessage, renderCrossInstanceHandoffMetadata, } from "./cross-instance-envelope.js";
64
67
  import { agendMessageInInput, bottomRowIsReady, inputAreaText, inputShowsPastedText, pastedTextSignature, pasteLeftInInput, strandedAgendMessageInInput } from "./pane-input-residue.js";
@@ -1596,6 +1599,9 @@ export class Daemon extends EventEmitter {
1596
1599
  pauseAdmissions = new Set();
1597
1600
  // Model failover: override model on next spawn when rate-limited
1598
1601
  modelOverride;
1602
+ claudeModelObserver = null;
1603
+ modelObservationBound = false;
1604
+ modelObservation() { return this.modelObservationBound ? this.claudeModelObserver?.snapshot() ?? null : null; }
1599
1605
  // Context rotation v3: ring buffers for daemon-side snapshot
1600
1606
  recentUserMessages = [];
1601
1607
  recentEvents = [];
@@ -2367,25 +2373,36 @@ export class Daemon extends EventEmitter {
2367
2373
  this.noteWorkActivity();
2368
2374
  this.deliveryOutbox?.complete(delivery.deliveryId, this.bootId, delivery.attemptNo, outcome, evidence);
2369
2375
  if (verdict && outcome !== "failed")
2370
- this.startConsumedWatch(delivery, verdict);
2376
+ this.startConsumedWatch(delivery, verdict, outcome);
2371
2377
  }
2372
2378
  /**
2373
2379
  * #1201: a steer or a native-queue hand-off was accepted into the CLI's input (or may have been) — not read. Watch
2374
2380
  * the transcript from this attempt's checkpoint for the moment the CLI takes it, and record that on the delivery;
2375
- * an `uncertain` row becomes `delivered` then. Only claude-code and codex write a transcript AgEnD can read. The
2381
+ * an `uncertain` row becomes `delivered` then. An uncertain idle submission is watched the same way (M-3098). Grok
2382
+ * idle submissions use only their exact launch-UUID lease (#3810). The
2376
2383
  * watch belongs to this CLI: a stop, pause or respawn ends it (restart reconciliation owns the row after that).
2377
2384
  */
2378
- startConsumedWatch(delivery, verdict) {
2385
+ startConsumedWatch(delivery, verdict, outcome = "delivered") {
2379
2386
  const checkpoint = verdict.transcriptCheckpoint;
2380
2387
  const outbox = this.deliveryOutbox;
2381
2388
  if (!checkpoint || !outbox?.markConsumed)
2382
2389
  return;
2383
2390
  if (this.nativePaneLifecycle && !checkpoint.runtime)
2384
2391
  return;
2385
- if (verdict.submissionMode !== "steer" && verdict.submissionMode !== "native_queue_handoff")
2386
- return;
2387
- if (!["claude-code", "codex"].includes(checkpoint.backend))
2388
- return;
2392
+ const grok = !checkpoint.runtime && checkpoint.backend === "grok" ? checkpoint.ownedGrok : undefined;
2393
+ if (grok) {
2394
+ if (verdict.submissionMode !== "idle_submit")
2395
+ return;
2396
+ }
2397
+ else {
2398
+ // M-3098: an UNCERTAIN idle submission is watched too — the CLI's later marker is the same positive proof, and it
2399
+ // clears the row from Needs you. A delivered one is not: it needs no upgrade, and the fleet cap stays for real doubt.
2400
+ const lateIdle = verdict.submissionMode === "idle_submit" && outcome === "uncertain";
2401
+ if (verdict.submissionMode !== "steer" && verdict.submissionMode !== "native_queue_handoff" && !lateIdle)
2402
+ return;
2403
+ if (!["claude-code", "codex"].includes(checkpoint.backend))
2404
+ return;
2405
+ }
2389
2406
  const spawn = this.spawnGeneration, fence = this.launchFenceEpoch, boot = this.bootId;
2390
2407
  let location;
2391
2408
  try {
@@ -2399,7 +2416,8 @@ export class Daemon extends EventEmitter {
2399
2416
  attemptNo: delivery.attemptNo,
2400
2417
  backend: checkpoint.backend,
2401
2418
  ...location,
2402
- current: () => !this.deliveryWritesStopping && spawn === this.spawnGeneration && fence === this.launchFenceEpoch,
2419
+ ...(grok ? { grokSessionId: grok.sessionId, readChunk: grok.readChunk } : {}),
2420
+ current: () => !this.deliveryWritesStopping && spawn === this.spawnGeneration && fence === this.launchFenceEpoch && (grok?.current() ?? true),
2403
2421
  consumed: (via, evidence) => {
2404
2422
  try {
2405
2423
  const result = outbox.markConsumed(delivery.deliveryId, boot, delivery.attemptNo, via, evidence);
@@ -2437,7 +2455,7 @@ export class Daemon extends EventEmitter {
2437
2455
  if (!["claude-code", "codex"].includes(backend))
2438
2456
  return;
2439
2457
  const marker = durableAttempt ? `[agend-delivery-id:${durableAttempt.deliveryId}]`
2440
- : humanVerificationId ? `[agend-human-id:${humanVerificationId}]` : null;
2458
+ : humanVerificationId ? verdict.humanReceipt?.marker ?? `[agend-human-id:${humanVerificationId}]` : null;
2441
2459
  if (!marker || !formatted.startsWith(marker))
2442
2460
  return;
2443
2461
  let found = verdict.transcriptCheckpoint ?? null;
@@ -2456,7 +2474,7 @@ export class Daemon extends EventEmitter {
2456
2474
  return; // nothing could judge it later: it runs as before (✅ at the hand-off)
2457
2475
  const entry = {
2458
2476
  id: track.id ?? randomUUID(), marker, backend, path: checkpoint.path, offset: checkpoint.offset,
2459
- content: track.content, meta: track.meta, holder: this.handoffHolder(), createdAt: Date.now(),
2477
+ content: track.content, meta: track.meta, wire: formatted, holder: this.handoffHolder(), createdAt: Date.now(),
2460
2478
  redeliveries: track.redeliveries ?? 0,
2461
2479
  };
2462
2480
  try {
@@ -3051,6 +3069,18 @@ export class Daemon extends EventEmitter {
3051
3069
  if (this.startupAborted || this.deliveryWritesStopping || !this.nativePaneLifecycle.current())
3052
3070
  throw Error("Native launch was superseded");
3053
3071
  }
3072
+ // Only a fresh owned launch has received this manager's current instruction grammar.
3073
+ // A resumed/reattached context learns it through the same proven legacy notice as local panes.
3074
+ this.startupAdmission?.();
3075
+ if (this.startupAborted || this.deliveryWritesStopping || !this.nativePaneLifecycle.current())
3076
+ throw Error("Native launch was superseded");
3077
+ if (acquired.disposition === "fresh")
3078
+ this.installCompactInboundInstructions();
3079
+ else {
3080
+ this.compactInboundInstructions = false;
3081
+ this.inboundCompatibilityPending = true;
3082
+ this.resetInboundPresentation();
3083
+ }
3054
3084
  }
3055
3085
  finally {
3056
3086
  this.endSpawn();
@@ -4926,6 +4956,8 @@ export class Daemon extends EventEmitter {
4926
4956
  return;
4927
4957
  const outcome = follower.look(pane);
4928
4958
  if (outcome) {
4959
+ if (outcome === "done")
4960
+ this.resetInboundPresentation();
4929
4961
  this.broadcastFleetMessage({ type: "compact_pane_result", id, owner, outcome });
4930
4962
  return;
4931
4963
  }
@@ -4942,10 +4974,17 @@ export class Daemon extends EventEmitter {
4942
4974
  isDeliveryEpochCurrent(epoch) {
4943
4975
  return epoch === this.deliveryEpoch;
4944
4976
  }
4945
- queueRawPaste(rawText, deliveryEpoch = this.deliveryEpoch, confirmClear = false, durableAttempt, ownSwitch, notifyWritten) {
4977
+ queueRawPaste(rawText, deliveryEpoch = this.deliveryEpoch, confirmClear = false, durableAttempt, ownSwitch, notifyWritten, contextReset) {
4978
+ const modelObserver = this.claudeModelObserver;
4979
+ const modelOwner = launchIdentity(this.interactionOwner());
4980
+ const currentModelOwner = () => modelObserver === this.claudeModelObserver && modelOwner === launchIdentity(this.interactionOwner());
4946
4981
  const reportSwitch = (result) => {
4947
4982
  if (!ownSwitch)
4948
4983
  return;
4984
+ if (currentModelOwner())
4985
+ modelObserver?.ownResult(result.outcome === "switched", ownSwitch.requested);
4986
+ if (result.outcome === "switched")
4987
+ this.resetInboundPresentation();
4949
4988
  this.broadcastFleetMessage({ type: "runtime_switch_result", id: ownSwitch.id, ...result });
4950
4989
  };
4951
4990
  // Board 003648ac: the fleet follows a web /compact from just before its paste is written: the transcript's end then
@@ -5020,8 +5059,12 @@ export class Daemon extends EventEmitter {
5020
5059
  preserveExactBytes: true,
5021
5060
  // #1690: our own /model holds every other delivery from its write on — before the lock is released, so a steer
5022
5061
  // or /btw waiting on it cannot type into the gap before claude paints "Switch model?" (default cursor: Yes).
5023
- ...(ownSwitch || notifyWritten ? { onPaneWritten: () => { if (ownSwitch)
5024
- this.ownSwitch = ownSwitch; tellWritten(true); } } : {}),
5062
+ ...(ownSwitch || notifyWritten || contextReset ? { onPaneWritten: () => { if (contextReset)
5063
+ this.resetInboundPresentation(); if (ownSwitch) {
5064
+ this.ownSwitch = ownSwitch;
5065
+ if (currentModelOwner())
5066
+ modelObserver?.ownIntent(ownSwitch.requested);
5067
+ } tellWritten(true); } } : {}),
5025
5068
  ...(notifyWritten ? { beforePaneWrite: takeCheckpoint, ...(this.backend?.compactPaneUi?.() ? { lookBeforePaneWrite: lookBefore } : {}) } : {}),
5026
5069
  });
5027
5070
  tellWritten(false); // never written (once told, this says nothing)
@@ -5104,7 +5147,7 @@ export class Daemon extends EventEmitter {
5104
5147
  const ownSwitch = sw && typeof sw.id === "string" && sw.kind === "model" && typeof sw.requested === "string"
5105
5148
  ? { id: sw.id, kind: "model", requested: sw.requested } : undefined;
5106
5149
  const notifyWritten = typeof msg.notify_written === "string" && /^[0-9a-f]{16}$/.test(msg.notify_written) ? msg.notify_written : undefined;
5107
- this.queueRawPaste(msg.content, this.captureDeliveryEpoch(msg.delivery_epoch), msg.confirm_clear === true, durableAttempt ? { ...durableAttempt, submissionMode: "raw_paste", silentSchedule: msg.silent_schedule === true } : undefined, ownSwitch, notifyWritten);
5150
+ this.queueRawPaste(msg.content, this.captureDeliveryEpoch(msg.delivery_epoch), msg.confirm_clear === true, durableAttempt ? { ...durableAttempt, submissionMode: "raw_paste", silentSchedule: msg.silent_schedule === true } : undefined, ownSwitch, notifyWritten, msg.context_reset === "clear" || msg.context_reset === "compact" ? msg.context_reset : undefined);
5108
5151
  }
5109
5152
  /**
5110
5153
  * #1690 (the user's choice A): after AgEnD's own `/model <name>`, claude may ask "Switch model?" (a warm cache for
@@ -6845,7 +6888,57 @@ export class Daemon extends EventEmitter {
6845
6888
  */
6846
6889
  buildTranscriptMonitor(source) {
6847
6890
  this.followLog.reset();
6848
- const monitor = new TranscriptMonitor(this.instanceDir, this.logger, source);
6891
+ const modelLaunch = this.backend?.modelObservationLaunch?.();
6892
+ const monitor = new TranscriptMonitor(this.instanceDir, this.logger, source, () => modelLaunch);
6893
+ let savedModel;
6894
+ try {
6895
+ const path = join(this.instanceDir, "claude-model-observation.json");
6896
+ if (statSync(path).size < 1_000_000)
6897
+ savedModel = JSON.parse(readFileSync(path, "utf-8"));
6898
+ }
6899
+ catch { /* No checkpoint. */ }
6900
+ const nativeModel = !!source && source === this.nativeTranscriptSource && !!source.modelObservationSession;
6901
+ const modelCurrent = () => !nativeModel || this.nativePaneLifecycle?.current() === true;
6902
+ const modelObserver = (!source || nativeModel) && this.isClaudeCodeBackend()
6903
+ ? new ClaudeModelObserver(this.config.model, this.backend?.modelObservationLaunch?.()?.model ?? this.runtimeIdentity?.model ?? this.config.model, savedModel) : null;
6904
+ this.claudeModelObserver = modelObserver;
6905
+ this.modelObservationBound = false;
6906
+ const owner = launchIdentity(this.interactionOwner());
6907
+ let reminderSession = modelObserver?.checkpoint().sessionId ?? null;
6908
+ const observeReminderBoundary = (sessionId, before, after) => {
6909
+ const selected = (s) => normalizeClaudeModel(s.session ?? s.launch);
6910
+ const served = (s) => normalizeClaudeModel(s.active?.served ?? s.lastServed ?? s.session ?? s.launch);
6911
+ const moved = (a, b) => a !== null && b !== null && a !== b;
6912
+ const changed = reminderSession !== null && reminderSession !== sessionId
6913
+ || moved(selected(before), selected(after)) || moved(served(before), served(after));
6914
+ reminderSession = sessionId;
6915
+ if (changed)
6916
+ this.resetInboundPresentation();
6917
+ };
6918
+ monitor.on("model_context", (sessionId, sessionModel) => {
6919
+ if (!modelObserver || this.transcriptMonitor !== monitor || owner !== launchIdentity(this.interactionOwner()) || !modelCurrent())
6920
+ return;
6921
+ const before = modelObserver.snapshot();
6922
+ modelObserver.bindSession(sessionId, sessionModel);
6923
+ this.modelObservationBound = true;
6924
+ observeReminderBoundary(sessionId, before, modelObserver.snapshot());
6925
+ });
6926
+ monitor.on("model_observation", (record, sessionModel, allowInference = true) => {
6927
+ if (!modelObserver || this.transcriptMonitor !== monitor || owner !== launchIdentity(this.interactionOwner()) || !modelCurrent())
6928
+ return;
6929
+ const before = modelObserver.snapshot();
6930
+ const changed = modelObserver.observe(record, sessionModel, allowInference);
6931
+ this.modelObservationBound = true;
6932
+ observeReminderBoundary(record.sessionId, before, modelObserver.snapshot());
6933
+ try {
6934
+ const path = join(this.instanceDir, "claude-model-observation.json"), temp = `${path}.tmp`;
6935
+ writeFileSync(temp, JSON.stringify(modelObserver.checkpoint()), { mode: 0o600 });
6936
+ renameSync(temp, path);
6937
+ }
6938
+ catch { /* Observation remains visible in memory. */ }
6939
+ if (changed)
6940
+ this.emit("model_observation");
6941
+ });
6849
6942
  this.transcriptTurns.reset();
6850
6943
  this.transcriptActivityAt = 0;
6851
6944
  // Monotonic: a wall-clock correction must neither end nor extend the open-turn hold (#1641 R1).
@@ -6867,7 +6960,12 @@ export class Daemon extends EventEmitter {
6867
6960
  this.transcriptTurns.reset();
6868
6961
  this.transcriptActivityAt = 0;
6869
6962
  this.followLog.reset();
6963
+ this.resetInboundPresentation();
6870
6964
  } });
6965
+ monitor.on("context_reset", () => {
6966
+ if (this.transcriptMonitor === monitor && owner === launchIdentity(this.interactionOwner()))
6967
+ this.resetInboundPresentation();
6968
+ });
6871
6969
  for (const event of ["tool_use", "tool_result", "assistant_text"])
6872
6970
  monitor.on(event, touch);
6873
6971
  return monitor;
@@ -7956,12 +8054,59 @@ export class Daemon extends EventEmitter {
7956
8054
  */
7957
8055
  /** #1650: how this instance talks to the fleet — MCP tools, or agend-agent commands (agent_mode: cli). */
7958
8056
  agentMode() { return this.config.agent_mode === "cli" ? "cli" : "mcp"; }
8057
+ humanReminders = new HumanReminderState();
8058
+ compactInboundInstructions = false;
8059
+ inboundCompatibilityPending = false;
8060
+ humanPreparations = new Map();
8061
+ humanReminderAttempts = new Map();
8062
+ /** Manager-owned admission capability. Never derived from a body marker. */
8063
+ registerHumanReceiptPreparation(receiptId, prepare, abandon) {
8064
+ this.humanPreparations ??= new Map();
8065
+ this.humanReminderAttempts ??= new Map();
8066
+ this.humanReminders ??= new HumanReminderState();
8067
+ const token = randomUUID();
8068
+ this.humanPreparations.set(token, { receiptId, prepare, abandon });
8069
+ return token;
8070
+ }
8071
+ /** Called only when this launch has installed instructions teaching both dialects. */
8072
+ installCompactInboundInstructions() {
8073
+ this.compactInboundInstructions = true;
8074
+ this.inboundCompatibilityPending = false;
8075
+ this.humanReminders.reset();
8076
+ }
8077
+ resetInboundPresentation() { (this.humanReminders ??= new HumanReminderState()).reset(); }
8078
+ prepareHumanReceiptWrite(meta, fallback) {
8079
+ if (!meta.human_prepare_token)
8080
+ return fallback;
8081
+ const preparation = this.humanPreparations.get(meta.human_prepare_token);
8082
+ if (!preparation || preparation.receiptId !== meta.human_receipt_id)
8083
+ throw new Error("Human delivery preparation is unavailable");
8084
+ const stamp = preparation.prepared?.stamp ?? this.humanReminders.prepare(preparation.receiptId);
8085
+ if (!this.humanReminders.current(stamp))
8086
+ throw new Error("Human delivery context changed");
8087
+ const dialect = this.compactInboundInstructions ? "compact" : "legacy";
8088
+ const prepared = preparation.prepared ?? { ...preparation.prepare({ dialect, replyHint: stamp.replyHint, escape: true,
8089
+ ...(this.inboundCompatibilityPending ? { compatibilityNotice: "[system:headers] " + INBOUND_HEADER_RULE } : {}) }), stamp };
8090
+ preparation.prepared = prepared;
8091
+ Object.assign(meta, prepared.meta);
8092
+ this.humanReminderAttempts.set(preparation.receiptId, stamp);
8093
+ return prepared.wire;
8094
+ }
7959
8095
  formatInboundMessage(content, meta) {
8096
+ let historicalHandoff = false;
8097
+ if (meta.handoff_redelivery) {
8098
+ const owned = this.handoffStore().list().find(row => row.id === meta.handoff_redelivery && row.holder === this.handoffHolder());
8099
+ if (owned?.wire)
8100
+ return owned.wire;
8101
+ // Pre-wire records retain their historical rendering only after proving the owned handoff.
8102
+ historicalHandoff = !!owned;
8103
+ }
8104
+ // Receiptless bot/system traffic has no final receipt preparation to replace this fallback.
7960
8105
  if (!meta.from_instance)
7961
- return formatHumanInboundMessage(content, meta, this.agentMode());
8106
+ return formatHumanInboundMessage(content, meta, this.agentMode(), { dialect: "legacy", escape: !historicalHandoff });
7962
8107
  let formatted = formatCrossInstanceInboundMessage(content, meta, this.agentMode());
7963
8108
  if (meta.reply_to_text)
7964
- formatted += '\n(reply_to: "' + meta.reply_to_text + '")';
8109
+ formatted += '\n(reply_to: "' + escapeInboundField(meta.reply_to_text) + '")';
7965
8110
  if (meta.delivery_id)
7966
8111
  formatted = "[agend-delivery-id:" + meta.delivery_id + "]\n" + formatted;
7967
8112
  return formatted;
@@ -7984,10 +8129,13 @@ export class Daemon extends EventEmitter {
7984
8129
  }
7985
8130
  }
7986
8131
  /** The same formatter/sanitizer used by the actual write; snapshot only. */
7987
- humanReceiptWire(content, meta, kind) {
8132
+ humanReceiptWire(content, meta, kind, presentation) {
7988
8133
  let wire = kind === "raw_paste" ? content
7989
8134
  : !meta.from_instance && content.startsWith("/raw ") && kind === "fleet_inbound"
7990
- ? content.slice(5) : this.formatInboundMessage(content, meta);
8135
+ ? content.slice(5) : presentation && !meta.from_instance
8136
+ ? formatHumanInboundMessage(content, meta, this.agentMode(), presentation) : this.formatInboundMessage(content, meta);
8137
+ if (presentation?.compatibilityNotice)
8138
+ wire = withWhatsNew(wire, presentation.compatibilityNotice);
7991
8139
  if (kind === "steer")
7992
8140
  wire = Daemon.steerEnvelope(wire);
7993
8141
  else if (kind === "btw")
@@ -8001,8 +8149,10 @@ export class Daemon extends EventEmitter {
8001
8149
  || !daemonOwner || !meta.human_owner_key || !/^[a-f0-9]{64}$/.test(meta.human_wire_sha256 ?? "")
8002
8150
  || humanBodyHash(prepareDeliveryWire(wire)) !== meta.human_wire_sha256)
8003
8151
  return undefined;
8152
+ const stamp = this.humanReminderAttempts?.get(id);
8004
8153
  return { receiptId: id, verificationId: meta.verification_id, expectedWireHash: meta.human_wire_sha256,
8005
- ownerKey: meta.human_owner_key, current: () => this.captureHumanReceiptOwner() === daemonOwner };
8154
+ ownerKey: meta.human_owner_key, marker: humanReceiptMarker(meta.verification_id, meta.human_wire_dialect === "compact" ? "compact" : "legacy"), current: () => this.captureHumanReceiptOwner() === daemonOwner
8155
+ && (!stamp || this.humanReminders.current(stamp)) };
8006
8156
  }
8007
8157
  /**
8008
8158
  * #2770: a person's message a cancel dropped before it reached the CLI is told, not left as a silent "uncertain":
@@ -8025,8 +8175,15 @@ export class Daemon extends EventEmitter {
8025
8175
  this.cancelledHumansTimer.unref?.();
8026
8176
  }
8027
8177
  finishHumanReceipt(meta, verdict) {
8028
- if (!meta.human_receipt_id || !meta.human_owner_key)
8178
+ if (!meta.human_receipt_id)
8029
8179
  return;
8180
+ if (!meta.human_owner_key) {
8181
+ const preparation = meta.human_prepare_token ? this.humanPreparations?.get(meta.human_prepare_token) : undefined;
8182
+ preparation?.abandon?.();
8183
+ if (meta.human_prepare_token)
8184
+ this.humanPreparations?.delete(meta.human_prepare_token);
8185
+ return;
8186
+ }
8030
8187
  const attempt = verdict.humanReceipt;
8031
8188
  const proof = attempt?.current() && !["unverified", "output-edge", "unverifiable"].includes(verdict.proof ?? "")
8032
8189
  ? attempt.proof ?? null : null;
@@ -8036,6 +8193,22 @@ export class Daemon extends EventEmitter {
8036
8193
  catch (err) {
8037
8194
  this.logger.error({ err }, "Could not publish human delivery evidence");
8038
8195
  }
8196
+ finally {
8197
+ if (meta.human_prepare_token)
8198
+ this.humanPreparations.delete(meta.human_prepare_token);
8199
+ this.humanReminderAttempts.delete(meta.human_receipt_id);
8200
+ }
8201
+ }
8202
+ /** Synchronous acknowledgement from the manager after the existing receipt owner/authority checks. */
8203
+ noteHumanReceiptSettlement(id, positive) {
8204
+ const stamp = this.humanReminderAttempts?.get(id);
8205
+ if (!stamp || !positive || !this.humanReminders.current(stamp))
8206
+ return;
8207
+ this.humanReminders.settle(stamp, true);
8208
+ if (this.inboundCompatibilityPending) {
8209
+ this.compactInboundInstructions = true;
8210
+ this.inboundCompatibilityPending = false;
8211
+ }
8039
8212
  }
8040
8213
  /**
8041
8214
  * Whether ONE delivery reached a verdict, carried by that delivery.
@@ -8138,7 +8311,7 @@ export class Daemon extends EventEmitter {
8138
8311
  steer: true,
8139
8312
  deliveryEpoch,
8140
8313
  submissionId: meta.message_id,
8141
- ...(meta.verification_id ? { humanVerificationId: meta.verification_id } : {}),
8314
+ ...(meta.verification_id ? { humanVerificationId: meta.verification_id, humanMeta: meta } : {}),
8142
8315
  verdict,
8143
8316
  durableAttempt: durableAttempt || undefined,
8144
8317
  })) {
@@ -8216,7 +8389,7 @@ export class Daemon extends EventEmitter {
8216
8389
  let delivered = false;
8217
8390
  try {
8218
8391
  if (await this.deliverMessage(formatted, status, { steer: true, deliveryEpoch, submissionId: meta.message_id,
8219
- ...(meta.verification_id ? { humanVerificationId: meta.verification_id } : {}), verdict })) {
8392
+ ...(meta.verification_id ? { humanVerificationId: meta.verification_id, humanMeta: meta } : {}), verdict })) {
8220
8393
  delivered = true;
8221
8394
  this.markTurnStarted(meta, formatted, deliveryEpoch);
8222
8395
  }
@@ -8353,7 +8526,7 @@ export class Daemon extends EventEmitter {
8353
8526
  sent = await this.deliverMessage(pasted, status, {
8354
8527
  deliveryEpoch,
8355
8528
  submissionId: meta.message_id,
8356
- ...(meta.verification_id ? { humanVerificationId: meta.verification_id } : {}),
8529
+ ...(meta.verification_id ? { humanVerificationId: meta.verification_id, humanMeta: meta } : {}),
8357
8530
  verdict,
8358
8531
  durableAttempt: durableAttempt || undefined,
8359
8532
  });
@@ -8644,7 +8817,7 @@ export class Daemon extends EventEmitter {
8644
8817
  return stale();
8645
8818
  if (residue !== "clear")
8646
8819
  return this.failDelivery(verdict, status, "input-residue", residue);
8647
- const written = await this.writeMessageToPane(formatted, windowId, handingOffToNativeQueue, status, opts?.submissionId, verdict, opts?.durableAttempt, opts?.steer === true, writeCurrent, opts?.humanVerificationId, opts?.beforePaneWrite, opts?.lookBeforePaneWrite);
8820
+ const written = await this.writeMessageToPane(formatted, windowId, handingOffToNativeQueue, status, opts?.submissionId, verdict, opts?.durableAttempt, opts?.steer === true, writeCurrent, opts?.humanVerificationId, opts?.beforePaneWrite, opts?.lookBeforePaneWrite, opts?.humanMeta);
8648
8821
  // #1690: still under the lock — whatever waits on it next must already see what this write started.
8649
8822
  if (verdict.paneWriteStarted)
8650
8823
  opts?.onPaneWritten?.();
@@ -10785,13 +10958,34 @@ export class Daemon extends EventEmitter {
10785
10958
  // Board 003648ac: called synchronously right before each paste — after the last await and fence of that attempt.
10786
10959
  beforePaste,
10787
10960
  // Board 907c7899: awaited each attempt after its last capture, begin and fence; the fence is asked again after it.
10788
- lookBeforePaste) {
10789
- const signature = this.submissionSignature(formatted, humanVerificationId ?? submissionId, humanVerificationId !== undefined);
10961
+ lookBeforePaste, humanMeta) {
10962
+ if (humanMeta?.human_prepare_token) {
10963
+ if (stillCurrent && !stillCurrent())
10964
+ return false;
10965
+ formatted = this.prepareHumanReceiptWrite(humanMeta, formatted);
10966
+ if (verdict.trackHandoff) {
10967
+ const { human_prepare_token: _token, ...kept } = humanMeta;
10968
+ Object.assign(verdict.trackHandoff.meta, kept);
10969
+ delete verdict.trackHandoff.meta.human_prepare_token;
10970
+ }
10971
+ verdict.humanReceipt = this.humanReceiptAttempt(humanMeta, formatted);
10972
+ if (!verdict.humanReceipt?.current())
10973
+ return false;
10974
+ const writeOwner = stillCurrent;
10975
+ stillCurrent = () => (!writeOwner || writeOwner()) && verdict.humanReceipt.current();
10976
+ }
10977
+ const humanDialect = humanMeta?.human_wire_dialect === "compact" ? "compact" : "legacy";
10978
+ const signature = this.submissionSignature(formatted, humanVerificationId ?? submissionId, humanVerificationId !== undefined, humanDialect);
10979
+ // M-3098: the lead marker AgEnD put on this delivery, for a CLI that shows it as taken (Grok cuts its echo before
10980
+ // the trailing message_id). Only AgEnD's own value for this attempt, and only when the text really leads with it.
10981
+ const leadMarker = durableAttempt && humanVerificationId === undefined ? `[agend-delivery-id:${durableAttempt.deliveryId}]` : null;
10982
+ if (leadMarker && formatted.startsWith(leadMarker + "\n"))
10983
+ signature.takenMarker = leadMarker;
10790
10984
  const rawPaste = durableAttempt?.submissionMode === "raw_paste";
10791
10985
  const humanAttempt = verdict.humanReceipt;
10792
10986
  const humanMode = rawPaste ? "raw_paste" : steer ? "steer"
10793
10987
  : handingOffToNativeQueue ? "native_queue_handoff" : "idle_submit";
10794
- if (humanAttempt && signature.unique && signature.value === "agend-human-id:" + humanAttempt.verificationId
10988
+ if (humanAttempt && signature.unique && signature.value === humanReceiptMarker(humanAttempt.verificationId, humanDialect).slice(1, -1)
10795
10989
  && humanBodyHash(formatted) === humanAttempt.expectedWireHash) {
10796
10990
  signature.humanPositive = tag => {
10797
10991
  if (!humanAttempt.current() || (stillCurrent && !stillCurrent()))
@@ -10872,12 +11066,21 @@ export class Daemon extends EventEmitter {
10872
11066
  };
10873
11067
  const codexCheckpoint = !this.nativePaneLifecycle && rawPaste && attemptEvidence.backend === "codex" && windowId
10874
11068
  ? await this.bindCodexRawPaste(windowId, steerCurrent) : null;
11069
+ const grokCheckpoint = !this.nativePaneLifecycle && !rawPaste && attemptEvidence.backend === "grok" && attemptEvidence.submissionMode === "idle_submit"
11070
+ ? await checkpointGrokDelivery({ cwd: this.config.working_directory,
11071
+ sessionId: this.backend?.getDeliverySessionId?.() ?? null,
11072
+ current: () => steerCurrent() && sameInteractionOwner(proofOwner, this.interactionOwner()) }) : null;
11073
+ if (grokCheckpoint) {
11074
+ attemptEvidence.transcriptPath = grokCheckpoint.path;
11075
+ attemptEvidence.transcriptOffset = grokCheckpoint.offset;
11076
+ attemptEvidence.transcriptSessionId = grokCheckpoint.sessionId;
11077
+ }
10875
11078
  if (codexCheckpoint) {
10876
11079
  attemptEvidence.transcriptPath = codexCheckpoint.path;
10877
11080
  attemptEvidence.transcriptOffset = codexCheckpoint.offset;
10878
11081
  attemptEvidence.transcriptSessionId = codexCheckpoint.sessionId;
10879
11082
  }
10880
- if ((stillCurrent && !stillCurrent()) || (!this.nativePaneLifecycle && rawPaste && attemptEvidence.backend === "codex"
11083
+ if ((stillCurrent && !stillCurrent()) || ((grokCheckpoint || (!this.nativePaneLifecycle && rawPaste && attemptEvidence.backend === "codex"))
10881
11084
  && (!sameInteractionOwner(proofOwner, this.interactionOwner()) || !steerCurrent()))) {
10882
11085
  verdict.fenced = true;
10883
11086
  return false;
@@ -10896,6 +11099,7 @@ export class Daemon extends EventEmitter {
10896
11099
  path: attemptEvidence.transcriptPath,
10897
11100
  offset: attemptEvidence.transcriptOffset,
10898
11101
  ...(codexCheckpoint ? { ownedCodex: codexCheckpoint.ownedCodex } : {}),
11102
+ ...(grokCheckpoint ? { ownedGrok: grokCheckpoint.ownedGrok } : {}),
10899
11103
  };
10900
11104
  // From here every proof of this write may also ask the CLI's transcript (the pane can lose the echo to the
10901
11105
  // reply, or still be painting the paste) — this delivery's exact marker only, or a raw paste's exact text (#1647).
@@ -11055,7 +11259,7 @@ export class Daemon extends EventEmitter {
11055
11259
  if (!this.steerPasteIsOurs(before.pane, formatted))
11056
11260
  return this.failDelivery(verdict, status, "steer-paste", "box-not-this-paste");
11057
11261
  const shown = this.backend?.readSteerComposerText?.(before.pane)?.replace(/\s+/g, " ").trim();
11058
- humanComposerOwned = !!humanAttempt && shown === "[agend-human-id:" + humanAttempt.verificationId + "]";
11262
+ humanComposerOwned = !!humanAttempt && shown === (humanAttempt.marker ?? "[agend-human-id:" + humanAttempt.verificationId + "]");
11059
11263
  // …and so is the Enter: the key is sent only while the reading is still within it.
11060
11264
  steerEnterDeadline = deadline;
11061
11265
  }
@@ -11821,6 +12025,12 @@ export class Daemon extends EventEmitter {
11821
12025
  // Something sits in the box that cannot be attributed either way. Only a unique signature seen outside the box
11822
12026
  // (below) can still prove this delivery; nothing else on screen may.
11823
12027
  const unattributedResidue = !attributable && (after.strandedInput || after.collapsedPastes > 0);
12028
+ // M-3098: this delivery's own lead marker shown as TAKEN above the box — a Grok echo's first row, or its queue.
12029
+ // Grok cuts an echo to three rows, so the trailing message_id never shows after Enter; the marker always does.
12030
+ // Placed after the strand checks: text of ours still in the box (or its collapsed paste) outranks it.
12031
+ if (signature.takenMarker && after.inputReadable && this.backend?.readTakenMarkers?.(pane).includes(signature.takenMarker)) {
12032
+ return this.submittedProof();
12033
+ }
11824
12034
  // 2. Positive evidence. A unique signature needs no baseline: no earlier
11825
12035
  // message can carry this delivery's message_id, so finding it outside
11826
12036
  // the input row is proof in itself — which also means a momentary
@@ -11974,7 +12184,7 @@ export class Daemon extends EventEmitter {
11974
12184
  * paste that never landed. System pastes carry no envelope and fall back to
11975
12185
  * the body signature, which the baseline comparison still ties to this paste.
11976
12186
  */
11977
- submissionSignature(formatted, trustedId, verification = false) {
12187
+ submissionSignature(formatted, trustedId, verification = false, dialect = "legacy") {
11978
12188
  // The id must come from the message's own metadata, never from scanning the
11979
12189
  // rendered text: agents and users discuss message ids in the body all the
11980
12190
  // time ("check message_id: abc"), and a body-scanned value would match an
@@ -11983,7 +12193,7 @@ export class Daemon extends EventEmitter {
11983
12193
  // the handoff metadata identifies THIS delivery.
11984
12194
  const id = trustedId?.trim();
11985
12195
  if (id)
11986
- return { value: (verification ? "agend-human-id:" : "message_id:") + id, unique: true };
12196
+ return { value: verification ? humanReceiptMarker(id, dialect).slice(1, -1) : "message_id:" + id, unique: true };
11987
12197
  return { value: pastedTextSignature(formatted), unique: false };
11988
12198
  }
11989
12199
  /**
@@ -12948,6 +13158,13 @@ export class Daemon extends EventEmitter {
12948
13158
  this.clearReplyGuardConfirm();
12949
13159
  this.sawBlockedInput = false;
12950
13160
  if (this.spawnDepth === 0) {
13161
+ this.resetInboundPresentation();
13162
+ this.compactInboundInstructions = false;
13163
+ this.inboundCompatibilityPending = false;
13164
+ for (const p of this.humanPreparations?.values() ?? [])
13165
+ p.abandon?.();
13166
+ this.humanPreparations?.clear();
13167
+ this.humanReminderAttempts?.clear();
12951
13168
  this.cliOomObservation = null;
12952
13169
  this.spawnGeneration++;
12953
13170
  this.interactionObservation.reset(this.interactionOwner());
@@ -14226,7 +14443,8 @@ export class Daemon extends EventEmitter {
14226
14443
  this.emit("kiro_compatibility_hold", null);
14227
14444
  }
14228
14445
  // #1633: decided before prev-instructions is first written — its absence is what says "never launched before".
14229
- this.prepareWhatsNew(!existsSync(join(this.instanceDir, "prev-instructions")));
14446
+ const freshInboundInstructions = !existsSync(join(this.instanceDir, "prev-instructions"));
14447
+ this.prepareWhatsNew(freshInboundInstructions);
14230
14448
  // Record what this launch writes. #2787: a change is never announced in the pane; the CLI takes the new
14231
14449
  // instructions whenever it next reads its own file.
14232
14450
  if (backendConfig.instructions) {
@@ -14248,6 +14466,13 @@ export class Daemon extends EventEmitter {
14248
14466
  if (launchFence !== this.launchFenceEpoch)
14249
14467
  throw new Error("Launch cancelled: the instance was stopped or paused while the launch was being prepared");
14250
14468
  this.backend.writeConfig(backendConfig);
14469
+ if (freshInboundInstructions)
14470
+ this.installCompactInboundInstructions();
14471
+ else {
14472
+ this.compactInboundInstructions = false;
14473
+ this.inboundCompatibilityPending = true;
14474
+ this.resetInboundPresentation();
14475
+ }
14251
14476
  this.backend.preTrust?.(this.config.working_directory, backendConfig);
14252
14477
  // Resolve working directory (e.g. symlink for hidden paths)
14253
14478
  const resolvedCwd = this.backend.resolveWorkingDirectory?.(this.config.working_directory, this.name) ?? this.config.working_directory;
@@ -14845,8 +15070,11 @@ export class Daemon extends EventEmitter {
14845
15070
  // Idle observations happen after turns. Avoid needless writes (and mtime
14846
15071
  // churn) while still updating the marker when /new changes the session.
14847
15072
  try {
14848
- if (readFileSync(path, "utf-8").trim() === sid)
15073
+ const previous = readFileSync(path, "utf-8").trim();
15074
+ if (previous === sid)
14849
15075
  return;
15076
+ if (previous)
15077
+ this.resetInboundPresentation();
14850
15078
  }
14851
15079
  catch { /* first checkpoint */ }
14852
15080
  writeFileSync(path, sid);