@songsid/agend 2.2.0-beta.1 → 2.2.0-beta.10

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 (377) hide show
  1. package/README.md +1 -1
  2. package/README.zh-TW.md +1 -1
  3. package/dist/agent-cli-instructions.md +16 -9
  4. package/dist/agent-cli.js +15 -7
  5. package/dist/agent-cli.js.map +1 -1
  6. package/dist/agent-endpoint.js +21 -9
  7. package/dist/agent-endpoint.js.map +1 -1
  8. package/dist/agent-whats-new.d.ts +47 -0
  9. package/dist/agent-whats-new.js +147 -0
  10. package/dist/agent-whats-new.js.map +1 -0
  11. package/dist/auth-api.d.ts +2 -2
  12. package/dist/auth-api.js +4 -2
  13. package/dist/auth-api.js.map +1 -1
  14. package/dist/backend/antigravity.d.ts +3 -0
  15. package/dist/backend/antigravity.js +9 -0
  16. package/dist/backend/antigravity.js.map +1 -1
  17. package/dist/backend/claude-carry.d.ts +22 -0
  18. package/dist/backend/claude-carry.js +170 -0
  19. package/dist/backend/claude-carry.js.map +1 -0
  20. package/dist/backend/claude-code.d.ts +65 -2
  21. package/dist/backend/claude-code.js +226 -33
  22. package/dist/backend/claude-code.js.map +1 -1
  23. package/dist/backend/codex-metadata.d.ts +33 -0
  24. package/dist/backend/codex-metadata.js +122 -18
  25. package/dist/backend/codex-metadata.js.map +1 -1
  26. package/dist/backend/codex.d.ts +3 -0
  27. package/dist/backend/codex.js +17 -1
  28. package/dist/backend/codex.js.map +1 -1
  29. package/dist/backend/credential-profile.d.ts +40 -3
  30. package/dist/backend/credential-profile.js +113 -5
  31. package/dist/backend/credential-profile.js.map +1 -1
  32. package/dist/backend/effort-metadata.d.ts +1 -1
  33. package/dist/backend/effort-metadata.js +3 -2
  34. package/dist/backend/effort-metadata.js.map +1 -1
  35. package/dist/backend/grok.d.ts +4 -0
  36. package/dist/backend/grok.js +14 -0
  37. package/dist/backend/grok.js.map +1 -1
  38. package/dist/backend/kiro-engine-ledger.d.ts +5 -0
  39. package/dist/backend/kiro-engine-ledger.js +20 -0
  40. package/dist/backend/kiro-engine-ledger.js.map +1 -1
  41. package/dist/backend/kiro-identity.d.ts +6 -0
  42. package/dist/backend/kiro-identity.js +19 -5
  43. package/dist/backend/kiro-identity.js.map +1 -1
  44. package/dist/backend/kiro.d.ts +39 -3
  45. package/dist/backend/kiro.js +143 -19
  46. package/dist/backend/kiro.js.map +1 -1
  47. package/dist/backend/launch-effort.d.ts +33 -0
  48. package/dist/backend/launch-effort.js +123 -0
  49. package/dist/backend/launch-effort.js.map +1 -0
  50. package/dist/backend/muse.d.ts +84 -0
  51. package/dist/backend/muse.js +449 -53
  52. package/dist/backend/muse.js.map +1 -1
  53. package/dist/backend/types.d.ts +33 -4
  54. package/dist/backend/types.js +2 -1
  55. package/dist/backend/types.js.map +1 -1
  56. package/dist/backend-command.d.ts +91 -0
  57. package/dist/backend-command.js +122 -0
  58. package/dist/backend-command.js.map +1 -0
  59. package/dist/background-work-ended.d.ts +18 -0
  60. package/dist/background-work-ended.js +30 -0
  61. package/dist/background-work-ended.js.map +1 -0
  62. package/dist/cache-service.d.ts +2 -0
  63. package/dist/cache-service.js +2 -1
  64. package/dist/cache-service.js.map +1 -1
  65. package/dist/channel/adapters/discord.d.ts +24 -1
  66. package/dist/channel/adapters/discord.js +87 -2
  67. package/dist/channel/adapters/discord.js.map +1 -1
  68. package/dist/channel/adapters/telegram.d.ts +24 -2
  69. package/dist/channel/adapters/telegram.js +118 -20
  70. package/dist/channel/adapters/telegram.js.map +1 -1
  71. package/dist/channel/mcp-server.js +9 -1
  72. package/dist/channel/mcp-server.js.map +1 -1
  73. package/dist/channel/mcp-tools.d.ts +11 -0
  74. package/dist/channel/mcp-tools.js +24 -13
  75. package/dist/channel/mcp-tools.js.map +1 -1
  76. package/dist/channel/message-edit-errors.d.ts +5 -0
  77. package/dist/channel/message-edit-errors.js +24 -0
  78. package/dist/channel/message-edit-errors.js.map +1 -0
  79. package/dist/channel/telegram-markdown.d.ts +6 -0
  80. package/dist/channel/telegram-markdown.js +104 -0
  81. package/dist/channel/telegram-markdown.js.map +1 -0
  82. package/dist/channel/tool-router.js +9 -3
  83. package/dist/channel/tool-router.js.map +1 -1
  84. package/dist/channel/types.d.ts +39 -3
  85. package/dist/cli.js +133 -28
  86. package/dist/cli.js.map +1 -1
  87. package/dist/command-table.d.ts +2 -2
  88. package/dist/command-table.js +6 -3
  89. package/dist/command-table.js.map +1 -1
  90. package/dist/config-validator.js +59 -0
  91. package/dist/config-validator.js.map +1 -1
  92. package/dist/cross-instance-envelope.d.ts +15 -2
  93. package/dist/cross-instance-envelope.js +29 -5
  94. package/dist/cross-instance-envelope.js.map +1 -1
  95. package/dist/daemon.d.ts +156 -1
  96. package/dist/daemon.js +764 -89
  97. package/dist/daemon.js.map +1 -1
  98. package/dist/delivery-outbox.d.ts +62 -7
  99. package/dist/delivery-outbox.js +309 -22
  100. package/dist/delivery-outbox.js.map +1 -1
  101. package/dist/delivery-reconciliation.d.ts +18 -1
  102. package/dist/delivery-reconciliation.js +67 -2
  103. package/dist/delivery-reconciliation.js.map +1 -1
  104. package/dist/fleet-context.d.ts +10 -1
  105. package/dist/fleet-manager.d.ts +345 -10
  106. package/dist/fleet-manager.js +1868 -174
  107. package/dist/fleet-manager.js.map +1 -1
  108. package/dist/general-knowledge/skills/backend-providers/SKILL.md +1 -1
  109. package/dist/general-knowledge/skills/credential-profiles/SKILL.md +92 -21
  110. package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +27 -3
  111. package/dist/general-knowledge/skills/delegation-playbook/SKILL.md +8 -8
  112. package/dist/general-knowledge/skills/fleet-config/SKILL.md +5 -5
  113. package/dist/general-knowledge/skills/fleet-health/SKILL.md +4 -4
  114. package/dist/general-knowledge/skills/fleet-restart/SKILL.md +13 -13
  115. package/dist/general-knowledge/skills/instance-lifecycle/SKILL.md +3 -2
  116. package/dist/general-knowledge/skills/kiro-engine-migration/SKILL.md +6 -0
  117. package/dist/general-knowledge/skills/model-discovery/SKILL.md +9 -9
  118. package/dist/general-knowledge/skills/multi-channel/SKILL.md +8 -2
  119. package/dist/general-knowledge/skills/scheduling/SKILL.md +5 -3
  120. package/dist/general-knowledge/skills/session-management/SKILL.md +6 -5
  121. package/dist/general-knowledge/skills/tui-effort/SKILL.md +2 -2
  122. package/dist/general-knowledge/skills/worker-collaboration/SKILL.md +8 -3
  123. package/dist/general-knowledge/steering/core-rules.md +8 -7
  124. package/dist/host-memory.d.ts +10 -0
  125. package/dist/host-memory.js +33 -1
  126. package/dist/host-memory.js.map +1 -1
  127. package/dist/human-delivery-receipts.d.ts +83 -0
  128. package/dist/human-delivery-receipts.js +194 -0
  129. package/dist/human-delivery-receipts.js.map +1 -0
  130. package/dist/instance-avatar.d.ts +36 -0
  131. package/dist/instance-avatar.js +57 -0
  132. package/dist/instance-avatar.js.map +1 -0
  133. package/dist/instance-config-impact.js +6 -0
  134. package/dist/instance-config-impact.js.map +1 -1
  135. package/dist/instance-lifecycle.d.ts +29 -6
  136. package/dist/instance-lifecycle.js +79 -28
  137. package/dist/instance-lifecycle.js.map +1 -1
  138. package/dist/instructions.d.ts +3 -1
  139. package/dist/instructions.js +11 -8
  140. package/dist/instructions.js.map +1 -1
  141. package/dist/kiro-log-gate.d.ts +42 -0
  142. package/dist/kiro-log-gate.js +39 -0
  143. package/dist/kiro-log-gate.js.map +1 -0
  144. package/dist/locale.js +200 -44
  145. package/dist/locale.js.map +1 -1
  146. package/dist/log-service.d.ts +99 -0
  147. package/dist/log-service.js +243 -0
  148. package/dist/log-service.js.map +1 -0
  149. package/dist/log-steps.d.ts +169 -0
  150. package/dist/log-steps.js +858 -0
  151. package/dist/log-steps.js.map +1 -0
  152. package/dist/login-controller.d.ts +20 -3
  153. package/dist/login-controller.js +71 -19
  154. package/dist/login-controller.js.map +1 -1
  155. package/dist/login-flows.d.ts +5 -2
  156. package/dist/login-flows.js +5 -4
  157. package/dist/login-flows.js.map +1 -1
  158. package/dist/memory-pressure.d.ts +13 -1
  159. package/dist/memory-pressure.js +50 -10
  160. package/dist/memory-pressure.js.map +1 -1
  161. package/dist/needs-you-hub.js +2 -0
  162. package/dist/needs-you-hub.js.map +1 -1
  163. package/dist/needs-you-live.d.ts +6 -0
  164. package/dist/needs-you-live.js +23 -3
  165. package/dist/needs-you-live.js.map +1 -1
  166. package/dist/next-steps.js +1 -1
  167. package/dist/next-steps.js.map +1 -1
  168. package/dist/outbound-handlers.d.ts +100 -0
  169. package/dist/outbound-handlers.js +263 -96
  170. package/dist/outbound-handlers.js.map +1 -1
  171. package/dist/outbound-schemas.d.ts +26 -15
  172. package/dist/outbound-schemas.js +24 -7
  173. package/dist/outbound-schemas.js.map +1 -1
  174. package/dist/public-link-progress.d.ts +1 -1
  175. package/dist/public-link-progress.js +8 -2
  176. package/dist/public-link-progress.js.map +1 -1
  177. package/dist/public-preview.d.ts +101 -0
  178. package/dist/public-preview.js +236 -0
  179. package/dist/public-preview.js.map +1 -0
  180. package/dist/public-web-gateway.js +11 -4
  181. package/dist/public-web-gateway.js.map +1 -1
  182. package/dist/public-web-link.d.ts +24 -1
  183. package/dist/public-web-link.js +63 -9
  184. package/dist/public-web-link.js.map +1 -1
  185. package/dist/reply-buttons-controller.d.ts +3 -0
  186. package/dist/reply-buttons-controller.js +3 -2
  187. package/dist/reply-buttons-controller.js.map +1 -1
  188. package/dist/restart-guard.d.ts +6 -3
  189. package/dist/restart-guard.js +6 -3
  190. package/dist/restart-guard.js.map +1 -1
  191. package/dist/restart-progress.d.ts +33 -0
  192. package/dist/restart-progress.js +30 -0
  193. package/dist/restart-progress.js.map +1 -1
  194. package/dist/service-activation.d.ts +15 -7
  195. package/dist/service-activation.js +46 -29
  196. package/dist/service-activation.js.map +1 -1
  197. package/dist/service-installer.d.ts +31 -0
  198. package/dist/service-installer.js +41 -2
  199. package/dist/service-installer.js.map +1 -1
  200. package/dist/settings-api.js +85 -25
  201. package/dist/settings-api.js.map +1 -1
  202. package/dist/settings-change.js +72 -1
  203. package/dist/settings-change.js.map +1 -1
  204. package/dist/settings-effect.js +28 -4
  205. package/dist/settings-effect.js.map +1 -1
  206. package/dist/settings-http-confirmation.js +7 -0
  207. package/dist/settings-http-confirmation.js.map +1 -1
  208. package/dist/setup-form.d.ts +1 -1
  209. package/dist/setup-form.js +1 -1
  210. package/dist/spawn-gate.js +5 -1
  211. package/dist/spawn-gate.js.map +1 -1
  212. package/dist/spawn-hold-reply.d.ts +12 -0
  213. package/dist/spawn-hold-reply.js +39 -0
  214. package/dist/spawn-hold-reply.js.map +1 -0
  215. package/dist/status-emojis.d.ts +10 -3
  216. package/dist/status-emojis.js +11 -2
  217. package/dist/status-emojis.js.map +1 -1
  218. package/dist/systemd-peer-bus.d.ts +95 -0
  219. package/dist/systemd-peer-bus.js +430 -0
  220. package/dist/systemd-peer-bus.js.map +1 -0
  221. package/dist/systemd-runtime.d.ts +27 -1
  222. package/dist/systemd-runtime.js +69 -7
  223. package/dist/systemd-runtime.js.map +1 -1
  224. package/dist/tips.js +4 -4
  225. package/dist/tips.js.map +1 -1
  226. package/dist/tool-progress.js +3 -2
  227. package/dist/tool-progress.js.map +1 -1
  228. package/dist/topic-commands.d.ts +42 -2
  229. package/dist/topic-commands.js +92 -7
  230. package/dist/topic-commands.js.map +1 -1
  231. package/dist/transcript-delta-reader.d.ts +3 -3
  232. package/dist/transcript-delta-reader.js +8 -8
  233. package/dist/transcript-delta-reader.js.map +1 -1
  234. package/dist/transcript-jsonl.d.ts +80 -3
  235. package/dist/transcript-jsonl.js +147 -10
  236. package/dist/transcript-jsonl.js.map +1 -1
  237. package/dist/transcript-monitor.d.ts +19 -0
  238. package/dist/transcript-monitor.js +87 -15
  239. package/dist/transcript-monitor.js.map +1 -1
  240. package/dist/transcript-sources.d.ts +78 -0
  241. package/dist/transcript-sources.js +375 -64
  242. package/dist/transcript-sources.js.map +1 -1
  243. package/dist/transcript-turns.d.ts +15 -2
  244. package/dist/transcript-turns.js +15 -2
  245. package/dist/transcript-turns.js.map +1 -1
  246. package/dist/tunnel/cloudflared.d.ts +7 -15
  247. package/dist/tunnel/cloudflared.js +36 -1
  248. package/dist/tunnel/cloudflared.js.map +1 -1
  249. package/dist/tunnel/purpose-lane.d.ts +5 -1
  250. package/dist/tunnel/purpose-lane.js +14 -7
  251. package/dist/tunnel/purpose-lane.js.map +1 -1
  252. package/dist/tunnel/types.d.ts +5 -1
  253. package/dist/tunnel/types.js.map +1 -1
  254. package/dist/turn-resume.d.ts +2 -0
  255. package/dist/turn-resume.js +1 -1
  256. package/dist/turn-resume.js.map +1 -1
  257. package/dist/types.d.ts +25 -0
  258. package/dist/ui/chat-commands.js +1 -0
  259. package/dist/ui/chat-emojis.js +33 -0
  260. package/dist/ui/chat-mentions.js +63 -0
  261. package/dist/ui/chat-render.js +42 -2
  262. package/dist/ui/chat-store.js +2 -2
  263. package/dist/ui/chat-strings.js +38 -20
  264. package/dist/ui/chat-thread.js +69 -12
  265. package/dist/ui/chat-time.js +80 -0
  266. package/dist/ui/panel-chat.js +39 -10
  267. package/dist/ui/panel-details.js +2 -0
  268. package/dist/ui/panel-fleet.js +199 -57
  269. package/dist/ui/panel-log.js +428 -0
  270. package/dist/ui/panel-needs.js +6 -2
  271. package/dist/ui/panel-settings.js +137 -32
  272. package/dist/ui/preview-panel.js +55 -15
  273. package/dist/ui/preview-status.js +28 -0
  274. package/dist/ui/preview.js +44 -3
  275. package/dist/ui/settings-dialogs.js +7 -2
  276. package/dist/ui/settings-model.js +2 -1
  277. package/dist/ui/settings-strings.js +46 -4
  278. package/dist/ui/settings-token.js +1 -1
  279. package/dist/ui/shared/app-i18n.js +43 -17
  280. package/dist/ui/shared/app-prefs.js +250 -0
  281. package/dist/ui/shared/app-route.js +7 -2
  282. package/dist/ui/shared/app-shell.js +165 -8
  283. package/dist/ui/shared/app-store.js +5 -1
  284. package/dist/ui/shared/app-stream.js +23 -5
  285. package/dist/ui/shared/app.css +155 -22
  286. package/dist/ui/shared/app.js +11 -1
  287. package/dist/ui/shared/fonts/README.md +1 -1
  288. package/dist/ui/shared/header-tools.js +55 -5
  289. package/dist/ui/shared/instance-nav.js +241 -45
  290. package/dist/ui/shared/instance-switch.js +4 -4
  291. package/dist/ui/shared/panel-view.js +6 -0
  292. package/dist/ui/shared/signin.js +7 -7
  293. package/dist/ui/shared/theme.js +39 -7
  294. package/dist/ui/shared/tokens.css +1 -1
  295. package/dist/ui/shared/ui-icons.js +1 -0
  296. package/dist/ui/shared/usage-dialog.js +23 -5
  297. package/dist/ui/shared/view-strings.js +32 -4
  298. package/dist/ui/signin.html +1 -1
  299. package/dist/unrecognised-prompt.d.ts +23 -0
  300. package/dist/unrecognised-prompt.js +74 -0
  301. package/dist/unrecognised-prompt.js.map +1 -0
  302. package/dist/update-install.d.ts +28 -2
  303. package/dist/update-install.js +22 -4
  304. package/dist/update-install.js.map +1 -1
  305. package/dist/update-marker.d.ts +51 -0
  306. package/dist/update-marker.js +61 -0
  307. package/dist/update-marker.js.map +1 -1
  308. package/dist/update-preflight.d.ts +100 -0
  309. package/dist/update-preflight.js +264 -0
  310. package/dist/update-preflight.js.map +1 -0
  311. package/dist/updater-caller.d.ts +31 -0
  312. package/dist/updater-caller.js +109 -0
  313. package/dist/updater-caller.js.map +1 -0
  314. package/dist/usage/i18n-keys.d.ts +1 -1
  315. package/dist/usage/i18n-keys.js +1 -1
  316. package/dist/usage/i18n-keys.js.map +1 -1
  317. package/dist/usage/providers.d.ts +34 -5
  318. package/dist/usage/providers.js +160 -27
  319. package/dist/usage/providers.js.map +1 -1
  320. package/dist/usage/statusline-usage.d.ts +6 -2
  321. package/dist/usage/statusline-usage.js +10 -4
  322. package/dist/usage/statusline-usage.js.map +1 -1
  323. package/dist/view-api.d.ts +1 -1
  324. package/dist/view-api.js +38 -8
  325. package/dist/view-api.js.map +1 -1
  326. package/dist/wake-coordinator.d.ts +11 -0
  327. package/dist/wake-coordinator.js +38 -4
  328. package/dist/wake-coordinator.js.map +1 -1
  329. package/dist/web-api.d.ts +49 -2
  330. package/dist/web-api.js +421 -31
  331. package/dist/web-api.js.map +1 -1
  332. package/dist/web-auth.d.ts +2 -2
  333. package/dist/web-auth.js +9 -4
  334. package/dist/web-auth.js.map +1 -1
  335. package/dist/web-commands.d.ts +27 -4
  336. package/dist/web-commands.js +19 -4
  337. package/dist/web-commands.js.map +1 -1
  338. package/dist/web-host-guard.d.ts +3 -11
  339. package/dist/web-host-guard.js +3 -12
  340. package/dist/web-host-guard.js.map +1 -1
  341. package/dist/web-images.d.ts +47 -0
  342. package/dist/web-images.js +169 -0
  343. package/dist/web-images.js.map +1 -0
  344. package/dist/web-mentions.d.ts +44 -0
  345. package/dist/web-mentions.js +75 -0
  346. package/dist/web-mentions.js.map +1 -0
  347. package/dist/web-prefs.d.ts +63 -0
  348. package/dist/web-prefs.js +265 -0
  349. package/dist/web-prefs.js.map +1 -0
  350. package/dist/web-preview.d.ts +14 -1
  351. package/dist/web-preview.js +35 -13
  352. package/dist/web-preview.js.map +1 -1
  353. package/dist/web-reply-files.d.ts +45 -0
  354. package/dist/web-reply-files.js +223 -0
  355. package/dist/web-reply-files.js.map +1 -0
  356. package/dist/web-schedules.d.ts +12 -0
  357. package/dist/web-schedules.js +34 -0
  358. package/dist/web-schedules.js.map +1 -0
  359. package/dist/web-server-drain.d.ts +10 -0
  360. package/dist/web-server-drain.js +50 -0
  361. package/dist/web-server-drain.js.map +1 -0
  362. package/dist/web-session.d.ts +36 -1
  363. package/dist/web-session.js +53 -6
  364. package/dist/web-session.js.map +1 -1
  365. package/dist/web-settings-patch.d.ts +23 -0
  366. package/dist/web-settings-patch.js +77 -0
  367. package/dist/web-settings-patch.js.map +1 -0
  368. package/dist/web-shell-routes.d.ts +5 -1
  369. package/dist/web-shell-routes.js +10 -1
  370. package/dist/web-shell-routes.js.map +1 -1
  371. package/dist/web-upload.d.ts +17 -4
  372. package/dist/web-upload.js +64 -13
  373. package/dist/web-upload.js.map +1 -1
  374. package/dist/workflow-templates/default.md +1 -1
  375. package/package.json +1 -1
  376. package/templates/launchd.plist.ejs +3 -1
  377. package/templates/systemd.service.ejs +2 -1
@@ -8,7 +8,7 @@ When creating a new instance with `create_instance`:
8
8
 
9
9
  **Pre-checks (mandatory):**
10
10
  1. **Check for duplicate working directory** — Run `list_instances` and verify no existing instance uses the same `working_directory`. Two instances sharing a directory causes file conflicts and race conditions.
11
- 2. **Verify the directory exists** — If specifying a directory, confirm it exists on disk before calling create.
11
+ 2. **Verify the directory exists** — If specifying a directory, confirm it exists on disk before calling create. When the fleet sets `project_roots`, it must also be inside one of them, or create is refused.
12
12
  3. **Use unique names** — The instance name is derived from `topic_name` or `basename(directory)`. Avoid generic names like "dev" or "test" that may collide.
13
13
 
14
14
  **Post-checks (mandatory):**
@@ -23,12 +23,13 @@ When creating a new instance with `create_instance`:
23
23
  ## What NOT to Do (Dangerous Operations)
24
24
 
25
25
  - **Don't delete `~/.agend/fleet.yaml`** while fleet is running
26
- - **Don't delete `~/.agend/fleet.pid`** manually — use `agend fleet stop`
26
+ - **Don't delete `~/.agend/fleet.pid`** manually — use `agend fleet stop` (from a fleet session it needs `--yes`, and it stops every instance)
27
27
  - **Don't kill tmux server** (`tmux kill-server`) — kills all agent sessions
28
28
  - **Don't edit instance output.log** — it's actively written by the daemon
29
29
  - **Don't run two fleet processes** on the same AGEND_HOME — port/socket conflicts
30
30
  - **Don't change `channel.group_id`** without re-creating all topics — routing breaks
31
31
  - **Don't remove an instance from fleet.yaml** that has active work — stop it first
32
+ - **Don't try to get around a Settings confirmation** — a sensitive change made in the web Settings (access, secrets, connections, …) waits for a fleet admin to confirm it in General, or with `agend settings confirm <id>` on the host
32
33
 
33
34
  ## Access Mode Reference
34
35
 
@@ -37,7 +38,7 @@ fleet.yaml `channel.access.mode` valid values:
37
38
  | Mode | Behavior |
38
39
  |------|----------|
39
40
  | `locked` | Only `allowed_users` can interact (default) |
40
- | `pairing` | Users can request access via `/pair` command |
41
+ | `pairing` | A user sends `/pair` (Telegram), gets a code, and the owner grants access |
41
42
  | `open` | All users can interact, no restrictions |
42
43
 
43
44
  Example:
@@ -46,7 +47,7 @@ channel:
46
47
  access:
47
48
  mode: open # everyone can use
48
49
  # mode: locked # whitelist only (add allowed_users)
49
- # mode: pairing # users self-register via /pair
50
+ # mode: pairing # /pair gives a code the owner approves
50
51
  allowed_users: [123456789] # only needed for locked/pairing
51
52
  ```
52
53
 
@@ -72,14 +73,14 @@ Always use a dedicated subdirectory like `/home/user/projects/my-project` or let
72
73
  Use layered memory to minimize context usage:
73
74
 
74
75
  1. **Fleet Decision** — short, shared rules only (role, workflow rules, TODOs). Keep concise (~20 lines guideline). If it exceeds this, consider whether the details belong in soul.md instead.
75
- 2. **soul.md** (workspace root) — full memory: architecture, decisions, history. Loaded as steering.
76
+ 2. **soul.md** (workspace root) — full memory: architecture, decisions, history. AgEnD does not load it for you: read it when you need it.
76
77
  - If soul.md doesn't exist, do NOT create one unprompted. Only create when the user explicitly asks.
77
- 3. **Skills** (`.kiro/skills/`) — reusable workflows. On-demand loading.
78
+ 3. **Skills** — reusable workflows, loaded on demand, in your backend's skills directory: `.kiro/skills/` (kiro), `.claude/skills/` (claude-code), `.agents/skills/` (codex, opencode, muse, antigravity), `.grok/skills/` (grok).
78
79
 
79
80
  Rules:
80
81
  - Keep Fleet Decisions minimal. Move details to soul.md.
81
82
  - Each instance maintains its own soul.md (not shared).
82
- - Good workflows → **propose** converting to a skill. Create in `.kiro/skills/<name>/SKILL.md` only after user approval.
83
+ - Good workflows → **propose** converting to a skill. Create `<skills directory>/<name>/SKILL.md` (see Skills above) only after user approval.
83
84
  - Global skills (`src/general-knowledge/skills/`) only for knowledge ALL instances need.
84
85
  - Never put architecture details or bug history in Fleet Decisions.
85
86
  - After completing a **multi-step task that introduced new architectural knowledge or a reusable process**, suggest updating soul.md. Do NOT ask after routine tasks (reviews, single-file fixes, Q&A).
@@ -1,3 +1,9 @@
1
+ export interface LinuxMemoryPsi {
2
+ someAvg60: number;
3
+ fullAvg10: number;
4
+ }
5
+ /** Kernel percentage averages; missing/ambiguous output is unavailable, not zero pressure. */
6
+ export declare function parseLinuxMemoryPsi(output: string): LinuxMemoryPsi | null;
1
7
  export interface HostMemory {
2
8
  totalBytes: number;
3
9
  availableBytes: number | null;
@@ -8,12 +14,16 @@ export interface HostMemory {
8
14
  darwinPressureLevel?: 1 | 2 | 4 | null;
9
15
  /** Bounded diagnostic output; null when unavailable or not requested. */
10
16
  darwinPressureRaw?: string | null;
17
+ /** Linux pressure sampling only; null means PSI cannot be used. */
18
+ linuxPsi?: LinuxMemoryPsi | null;
11
19
  }
12
20
  interface HostMemoryDeps {
13
21
  platform: NodeJS.Platform;
14
22
  meminfo: () => string;
15
23
  totalmem: () => number;
16
24
  freemem: () => number;
25
+ includePressure: boolean;
26
+ psi: () => string;
17
27
  }
18
28
  /** Host memory, not the fleet's RSS/cgroup charge. Missing swap data is not zero swap. */
19
29
  export declare function readHostMemory(overrides?: Partial<HostMemoryDeps>): HostMemory;
@@ -1,15 +1,44 @@
1
1
  import { DarwinMemoryProbe } from "./darwin-memory.js";
2
2
  import { readFileSync } from "node:fs";
3
3
  import { freemem, totalmem, platform } from "node:os";
4
+ /** Kernel percentage averages; missing/ambiguous output is unavailable, not zero pressure. */
5
+ export function parseLinuxMemoryPsi(output) {
6
+ if (output.length > 4096)
7
+ return null;
8
+ const rows = new Map();
9
+ const lines = output.trim().split(/\r?\n/);
10
+ if (lines.length !== 2)
11
+ return null;
12
+ for (const line of lines) {
13
+ const match = /^(some|full) avg10=(\d+(?:\.\d+)?) avg60=(\d+(?:\.\d+)?) avg300=(\d+(?:\.\d+)?) total=\d+$/.exec(line);
14
+ if (!match || rows.has(match[1]))
15
+ return null;
16
+ const averages = match.slice(2).map(Number);
17
+ if (averages.some(n => !Number.isFinite(n) || n < 0 || n > 100))
18
+ return null;
19
+ rows.set(match[1], averages);
20
+ }
21
+ if (!rows.has("some") || !rows.has("full"))
22
+ return null;
23
+ return { someAvg60: rows.get("some")[1], fullAvg10: rows.get("full")[0] };
24
+ }
4
25
  /** Host memory, not the fleet's RSS/cgroup charge. Missing swap data is not zero swap. */
5
26
  export function readHostMemory(overrides = {}) {
6
- const deps = { platform: platform(), meminfo: () => readFileSync("/proc/meminfo", "utf8"), totalmem, freemem, ...overrides };
27
+ const deps = { platform: platform(), meminfo: () => readFileSync("/proc/meminfo", "utf8"), totalmem, freemem,
28
+ includePressure: false, psi: () => readFileSync("/proc/pressure/memory", "utf8"), ...overrides };
7
29
  // macOS keeps reclaimable pages in use. Its free count is not availability.
8
30
  // Synchronous readers cannot run the native probe; absence stays unknown.
9
31
  if (deps.platform === "darwin") {
10
32
  return { totalBytes: deps.totalmem(), availableBytes: null, availableKind: "unknown", swapTotalBytes: null, swapFreeBytes: null };
11
33
  }
12
34
  if (deps.platform === "linux") {
35
+ let linuxPsi = null;
36
+ if (deps.includePressure) {
37
+ try {
38
+ linuxPsi = parseLinuxMemoryPsi(deps.psi());
39
+ }
40
+ catch { /* Fall back to RAM, without inventing PSI. */ }
41
+ }
13
42
  try {
14
43
  const fields = new Map();
15
44
  for (const match of deps.meminfo().matchAll(/^(\w+):\s+(\d+)\s+kB\s*$/gm)) {
@@ -28,10 +57,13 @@ export function readHostMemory(overrides = {}) {
28
57
  availableKind: fields.has("MemAvailable") ? "available" : "free",
29
58
  swapTotalBytes: hasSwap ? swapTotal : null,
30
59
  swapFreeBytes: hasSwap ? swapFree : null,
60
+ ...(deps.includePressure ? { linuxPsi } : {}),
31
61
  };
32
62
  }
33
63
  }
34
64
  catch { /* non-procfs Linux, or an unreadable snapshot: portable fallback */ }
65
+ return { totalBytes: deps.totalmem(), availableBytes: deps.freemem(), availableKind: "free", swapTotalBytes: null, swapFreeBytes: null,
66
+ ...(deps.includePressure ? { linuxPsi } : {}) };
35
67
  }
36
68
  return { totalBytes: deps.totalmem(), availableBytes: deps.freemem(), availableKind: "free", swapTotalBytes: null, swapFreeBytes: null };
37
69
  }
@@ -1 +1 @@
1
- {"version":3,"file":"host-memory.js","sourceR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C,eAAe,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;iBAC9C,CAAC;YACJ,CAAC;QACH,CAAC;QAAC,MAAM,CAAC,CAAC,oEAAoE,CAAC,CAAC;QAChF,OAAO,EAAE,UAAU,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,cAAc,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI;YACpI,GAAG,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;IACpD,CAAC;IACD,OAAO,EAAE,UAAU,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,cAAc,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;AAC3I,CAAC;AAED,oFAAoF;AACpF,IAAI,qBAAqB,GAA6B,IAAI,CAAC;AAC3D,MAAM,UAAU,mBAAmB;IACjC,IAAI,QAAQ,EAAE,KAAK,QAAQ;QAAE,OAAO,OAAO,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IACtE,qBAAqB,KAAK,IAAI,iBAAiB,EAAE,CAAC;IAClD,OAAO,qBAAqB,CAAC,IAAI,EAAE,CAAC;AACtC,CAAC"}
@@ -0,0 +1,83 @@
1
+ import type Database from "better-sqlite3";
2
+ import type { DeliveryStatusSelector, DeliveryStatusPage } from "./delivery-outbox.js";
3
+ import { type AgentMode } from "./cross-instance-envelope.js";
4
+ /** Server-owned ingress facts. Labels and Web session identity are not platform authority. */
5
+ export interface HumanOrigin {
6
+ platform: "discord" | "telegram" | "web";
7
+ adapter_id: string | null;
8
+ user_id: string | null;
9
+ username: string | null;
10
+ platform_message_id: string | null;
11
+ ingress: "message" | "action" | "web";
12
+ anchor_message_id?: string;
13
+ event_id?: string;
14
+ }
15
+ /** Called only by trusted SDK event producers, never on text/agent metadata. */
16
+ export declare function nativeHumanOrigin(platform: "telegram" | "discord", adapterId: string, userId: string, username: string | undefined, isBot: boolean | undefined, messageId: string | null, action?: {
17
+ anchor: string;
18
+ event: string;
19
+ }): HumanOrigin | undefined;
20
+ export declare function webHumanOrigin(action?: boolean): HumanOrigin;
21
+ export type HumanWriteMode = "idle_submit" | "native_queue_handoff" | "steer" | "raw_paste";
22
+ export type HumanPositiveTag = "unique-id-pane" | "composer-empty-steer" | "composer-empty-queue" | "composer-empty-idle";
23
+ export interface HumanReceiptProof {
24
+ receipt_id: string;
25
+ verification_id: string;
26
+ wire_sha256: string;
27
+ owner_key: string;
28
+ mode: HumanWriteMode;
29
+ tag: HumanPositiveTag;
30
+ }
31
+ export interface HumanReceiptAttempt {
32
+ receiptId: string;
33
+ verificationId: string;
34
+ expectedWireHash: string;
35
+ ownerKey: string;
36
+ current: () => boolean;
37
+ proof?: HumanReceiptProof;
38
+ }
39
+ export declare function humanBodyHash(body: string): string;
40
+ /** Process-local object identity; a new process cannot settle an old binding. */
41
+ export declare function humanOwnerObjectId(owner: object): string;
42
+ export declare function isHumanPositiveProof(proof: unknown): proof is HumanReceiptProof;
43
+ export interface HumanReceiptRow {
44
+ receipt_id: string;
45
+ message_id: string;
46
+ target_instance: string;
47
+ manager_boot_id: string;
48
+ original_body: string;
49
+ original_sha256: string;
50
+ origin_json: string;
51
+ wire_body: string | null;
52
+ wire_sha256: string | null;
53
+ owner_key: string | null;
54
+ input_kind: string;
55
+ state: "queued" | "delivered" | "uncertain";
56
+ proof_tag: HumanPositiveTag | null;
57
+ proof_mode: HumanWriteMode | null;
58
+ created_at: string;
59
+ updated_at: string;
60
+ delivered_at: string | null;
61
+ }
62
+ export declare function initializeHumanReceipts(db: Database.Database): void;
63
+ /** Server-only admission; no origin is read from an agent payload or tool argument. */
64
+ export declare function createHumanReceipt(db: Database.Database, input: {
65
+ targetInstance: string;
66
+ originalBody: string;
67
+ origin: HumanOrigin;
68
+ inputKind: string;
69
+ managerBootId: string;
70
+ }): HumanReceiptRow;
71
+ export declare function getHumanReceipt(db: Database.Database, id: string): HumanReceiptRow | undefined;
72
+ /** Bind once at the actual IPC handoff, after wake/reconnect waits. */
73
+ export declare function bindHumanReceipt(db: Database.Database, id: string, target: string, ownerKey: string, wire: string, managerBootId: string): HumanReceiptRow;
74
+ /** An owned unknown result may close pending evidence; it never grants or overwrites a positive proof. */
75
+ export declare function settleHumanReceipt(db: Database.Database, id: string, target: string, ownerKey: string, proof: unknown, currentOwnerKey: string | null): boolean;
76
+ /** Read-only operator compatibility: an older database simply has no human receipts. */
77
+ export declare function queryHumanReceipt(db: Database.Database, caller: string | null, selector: DeliveryStatusSelector): DeliveryStatusPage | null;
78
+ /** Preserve the existing sanitizer in one place; receipts hash these actual prepared bytes. */
79
+ export declare function prepareDeliveryWire(body: string, preserveExactBytes?: boolean): string;
80
+ export declare function steerInboundEnvelope(inbound: string): string;
81
+ export declare const BTW_INBOUND_PREFIX = "[BTW \u2014 side question from the user. Answer it separately without changing or interrupting the CURRENT work.]\n";
82
+ /** One formatter for human wire bytes and their immutable evidence snapshot. */
83
+ export declare function formatHumanInboundMessage(content: string, meta: Record<string, string>, mode: AgentMode): string;
@@ -0,0 +1,194 @@
1
+ import { createHash, randomUUID } from "node:crypto";
2
+ import { t } from "./locale.js";
3
+ import { renderCrossInstanceHandoffMetadata } from "./cross-instance-envelope.js";
4
+ /** Called only by trusted SDK event producers, never on text/agent metadata. */
5
+ export function nativeHumanOrigin(platform, adapterId, userId, username, isBot, messageId, action) {
6
+ if (isBot !== false || !adapterId || !userId)
7
+ return undefined;
8
+ return {
9
+ platform, adapter_id: adapterId, user_id: userId, username: username ?? null,
10
+ platform_message_id: action ? null : messageId, ingress: action ? "action" : "message",
11
+ ...(action ? { anchor_message_id: action.anchor, event_id: action.event } : {}),
12
+ };
13
+ }
14
+ export function webHumanOrigin(action = false) {
15
+ return { platform: "web", adapter_id: null, user_id: null, username: null,
16
+ platform_message_id: null, ingress: action ? "action" : "web" };
17
+ }
18
+ export function humanBodyHash(body) {
19
+ return createHash("sha256").update(body, "utf8").digest("hex");
20
+ }
21
+ const objectIds = new WeakMap();
22
+ /** Process-local object identity; a new process cannot settle an old binding. */
23
+ export function humanOwnerObjectId(owner) {
24
+ let id = objectIds.get(owner);
25
+ if (!id) {
26
+ id = randomUUID();
27
+ objectIds.set(owner, id);
28
+ }
29
+ return id;
30
+ }
31
+ export function isHumanPositiveProof(proof) {
32
+ if (!proof || typeof proof !== "object")
33
+ return false;
34
+ const p = proof;
35
+ if (!["receipt_id", "verification_id", "wire_sha256", "owner_key", "mode", "tag"].every(key => Object.hasOwn(p, key)))
36
+ return false;
37
+ if (typeof p.receipt_id !== "string" || !/^[a-f0-9]{8}-(?:[a-f0-9]{4}-){3}[a-f0-9]{12}$/.test(p.receipt_id)
38
+ || p.verification_id !== "hmsg-" + p.receipt_id
39
+ || typeof p.wire_sha256 !== "string" || !/^[a-f0-9]{64}$/.test(p.wire_sha256)
40
+ || typeof p.owner_key !== "string" || !p.owner_key)
41
+ return false;
42
+ if (p.tag === "unique-id-pane")
43
+ return p.mode === "idle_submit" || p.mode === "native_queue_handoff" || p.mode === "steer";
44
+ return p.mode === "steer"
45
+ && (p.tag === "composer-empty-steer" || p.tag === "composer-empty-queue" || p.tag === "composer-empty-idle");
46
+ }
47
+ export function initializeHumanReceipts(db) {
48
+ db.exec([
49
+ "CREATE TABLE IF NOT EXISTS human_delivery_receipts (",
50
+ "receipt_id TEXT PRIMARY KEY,message_id TEXT NOT NULL UNIQUE,target_instance TEXT NOT NULL,manager_boot_id TEXT NOT NULL,",
51
+ "original_body TEXT NOT NULL,original_sha256 TEXT NOT NULL,origin_json TEXT NOT NULL,",
52
+ "wire_body TEXT,wire_sha256 TEXT,owner_key TEXT,input_kind TEXT NOT NULL,",
53
+ "state TEXT NOT NULL CHECK (state IN ('queued','delivered','uncertain')),",
54
+ "proof_tag TEXT,proof_mode TEXT,created_at TEXT NOT NULL,updated_at TEXT NOT NULL,delivered_at TEXT);",
55
+ "CREATE INDEX IF NOT EXISTS idx_human_receipt_retention ON human_delivery_receipts(updated_at);",
56
+ ].join("\n"));
57
+ }
58
+ /** Server-only admission; no origin is read from an agent payload or tool argument. */
59
+ export function createHumanReceipt(db, input) {
60
+ if (!input.targetInstance || Buffer.byteLength(input.originalBody, "utf8") > 64 * 1024
61
+ || !["discord", "telegram", "web"].includes(input.origin.platform)
62
+ || !["fleet_inbound", "steer", "btw", "raw_paste"].includes(input.inputKind)
63
+ || !["message", "action", "web"].includes(input.origin.ingress)
64
+ || (input.origin.platform !== "web" && (!input.origin.adapter_id || !input.origin.user_id || input.origin.ingress === "web"))
65
+ || (input.origin.platform === "web" && (input.origin.adapter_id !== null || input.origin.user_id !== null || input.origin.username !== null || input.origin.platform_message_id !== null))
66
+ || (input.origin.ingress === "action" && input.origin.platform_message_id !== null))
67
+ throw new Error("Human verification evidence is unavailable");
68
+ const origin = JSON.stringify(input.origin);
69
+ if (Buffer.byteLength(origin, "utf8") > 4096)
70
+ throw new Error("Human verification origin exceeds its bound");
71
+ const id = randomUUID(), now = new Date().toISOString();
72
+ db.prepare("INSERT INTO human_delivery_receipts " +
73
+ "(receipt_id,message_id,target_instance,manager_boot_id,original_body,original_sha256,origin_json,input_kind,state,created_at,updated_at) " +
74
+ "VALUES (?,?,?,?,?,?,?,?,'queued',?,?)")
75
+ .run(id, "hmsg-" + id, input.targetInstance, input.managerBootId, input.originalBody, humanBodyHash(input.originalBody), origin, input.inputKind, now, now);
76
+ return getHumanReceipt(db, id);
77
+ }
78
+ export function getHumanReceipt(db, id) {
79
+ return db.prepare("SELECT * FROM human_delivery_receipts WHERE receipt_id=?").get(id);
80
+ }
81
+ /** Bind once at the actual IPC handoff, after wake/reconnect waits. */
82
+ export function bindHumanReceipt(db, id, target, ownerKey, wire, managerBootId) {
83
+ if (!ownerKey || Buffer.byteLength(wire, "utf8") > 256 * 1024)
84
+ throw new Error("Human verification wire evidence is unavailable");
85
+ return db.transaction(() => {
86
+ const row = getHumanReceipt(db, id);
87
+ if (!row || row.target_instance !== target || row.manager_boot_id !== managerBootId)
88
+ throw new Error("Human verification owner is unavailable");
89
+ const hash = humanBodyHash(wire);
90
+ if (row.owner_key !== null) {
91
+ if (row.owner_key !== ownerKey || row.wire_sha256 !== hash)
92
+ throw new Error("Human verification binding changed");
93
+ return row;
94
+ }
95
+ db.prepare("UPDATE human_delivery_receipts SET owner_key=?,wire_body=?,wire_sha256=?,updated_at=? WHERE receipt_id=? AND owner_key IS NULL")
96
+ .run(ownerKey, wire, hash, new Date().toISOString(), id);
97
+ return getHumanReceipt(db, id);
98
+ })();
99
+ }
100
+ /** An owned unknown result may close pending evidence; it never grants or overwrites a positive proof. */
101
+ export function settleHumanReceipt(db, id, target, ownerKey, proof, currentOwnerKey) {
102
+ return db.transaction(() => {
103
+ const row = getHumanReceipt(db, id);
104
+ if (!row || row.target_instance !== target || row.owner_key !== ownerKey || row.state === "delivered")
105
+ return false;
106
+ let positive = null;
107
+ if (isHumanPositiveProof(proof)) {
108
+ const modeMatches = row.input_kind === "steer" || row.input_kind === "btw"
109
+ ? proof.mode === "steer" : row.input_kind === "fleet_inbound" && (proof.mode === "idle_submit" || proof.mode === "native_queue_handoff");
110
+ if (modeMatches && proof.receipt_id === id && proof.verification_id === row.message_id
111
+ && proof.owner_key === ownerKey && currentOwnerKey === ownerKey
112
+ && proof.wire_sha256 === row.wire_sha256 && row.wire_body !== null
113
+ && humanBodyHash(row.wire_body) === row.wire_sha256 && humanBodyHash(row.original_body) === row.original_sha256)
114
+ positive = proof;
115
+ }
116
+ const now = new Date().toISOString();
117
+ db.prepare("UPDATE human_delivery_receipts SET state=?,proof_tag=?,proof_mode=?,updated_at=?,delivered_at=? WHERE receipt_id=? AND state!='delivered'")
118
+ .run(positive ? "delivered" : "uncertain", positive?.tag ?? null, positive?.mode ?? null, now, positive ? now : null, id);
119
+ return positive !== null;
120
+ })();
121
+ }
122
+ /** Read-only operator compatibility: an older database simply has no human receipts. */
123
+ export function queryHumanReceipt(db, caller, selector) {
124
+ const table = db.prepare("SELECT 1 FROM sqlite_master WHERE type='table' AND name='human_delivery_receipts'").get();
125
+ if (!table || selector.correlationId)
126
+ return null;
127
+ const field = selector.messageId ? "message_id" : "receipt_id";
128
+ const id = selector.messageId ?? selector.deliveryId ?? selector.operationId;
129
+ if (!id || (selector.cursor && selector.cursor !== id))
130
+ return null;
131
+ const row = db.prepare("SELECT * FROM human_delivery_receipts WHERE " + field + "=?").get(id);
132
+ if (!row)
133
+ return null;
134
+ if (selector.cursor)
135
+ return { items: [], next_cursor: null };
136
+ if (caller !== null && row.target_instance !== caller
137
+ && !db.prepare("SELECT 1 FROM delivery_forward_edges WHERE reference_kind='human' AND reference_id=? AND receiver_instance=? LIMIT 1")
138
+ .get(row.receipt_id, caller))
139
+ return { items: [], next_cursor: null };
140
+ const origin = JSON.parse(row.origin_json);
141
+ const item = {
142
+ delivery_id: row.receipt_id, operation_id: row.receipt_id, correlation_id: null,
143
+ source_instance: "human:" + origin.platform + ":" + (origin.user_id ?? "unknown"),
144
+ target_instance: row.target_instance, kind: "human_inbound", state: row.state, attempt_no: 0,
145
+ created_at: row.created_at, updated_at: row.updated_at,
146
+ status_summary: t("delivery.status_" + row.state),
147
+ error_summary: null, safe_to_retry: false, message_id: row.message_id, content_sha256: row.original_sha256,
148
+ delivery_mode: row.proof_mode === "steer" ? "steer" : "idle_queue", submission_mode: row.proof_mode, consumed_at: null, consumed_via: null,
149
+ origin, wire_content_sha256: row.wire_sha256, delivered_at: row.delivered_at,
150
+ proof_kind: row.proof_tag,
151
+ ...(caller !== null && selector.messageId ? { content: row.original_body } : {}),
152
+ };
153
+ if (caller !== null && selector.messageId) {
154
+ const edges = db.prepare("SELECT sender_instance AS source_instance,forwarding_message_id AS message_id,created_at AS forwarded_at " +
155
+ "FROM delivery_forward_edges WHERE reference_kind='human' AND reference_id=? AND receiver_instance=? " +
156
+ "ORDER BY created_at DESC,forwarding_delivery_id DESC LIMIT 1").all(row.receipt_id, caller);
157
+ if (edges?.length)
158
+ item.forwarded_by = edges;
159
+ }
160
+ return { items: [item], next_cursor: null };
161
+ }
162
+ /** Preserve the existing sanitizer in one place; receipts hash these actual prepared bytes. */
163
+ export function prepareDeliveryWire(body, preserveExactBytes = false) {
164
+ const fence = String.fromCharCode(96).repeat(3);
165
+ const parts = body.split(fence);
166
+ return !preserveExactBytes && (parts.length - 1) % 2 !== 0 ? parts.join("") : body;
167
+ }
168
+ export function steerInboundEnvelope(inbound) {
169
+ const banner = "[STEERING — mid-task course correction. Fold this into the CURRENT work if one is active.]\n";
170
+ const marker = inbound.match(/^\[agend-(?:delivery|human)-id:[^\]\r\n]+\]\r?\n/);
171
+ return marker ? marker[0] + banner + inbound.slice(marker[0].length) : banner + inbound;
172
+ }
173
+ export const BTW_INBOUND_PREFIX = "[BTW — side question from the user. Answer it separately without changing or interrupting the CURRENT work.]\n";
174
+ /** One formatter for human wire bytes and their immutable evidence snapshot. */
175
+ export function formatHumanInboundMessage(content, meta, mode) {
176
+ const via = meta.source ? " via " + meta.source : "";
177
+ const idTag = meta.user_id ? ", id:" + meta.user_id : "";
178
+ let body = "[user:" + (meta.user || "unknown") + via + idTag + "] " + content;
179
+ if (meta.pending_reactions)
180
+ body = "[Recent reactions: " + meta.pending_reactions + "]\n" + body;
181
+ // Reaction/reply addressing keeps the actual platform ID. Only verification uses hmsg.
182
+ body += renderCrossInstanceHandoffMetadata(meta);
183
+ body += mode === "cli"
184
+ ? '\n(Reply with agend-agent reply "…" — do NOT respond with direct text)'
185
+ : "\n(Reply using the reply tool — do NOT respond with direct text)";
186
+ if (meta.reply_to_text)
187
+ body += '\n(reply_to: "' + meta.reply_to_text + '")';
188
+ if (meta.verification_id)
189
+ body = "[agend-human-id:" + meta.verification_id + "]\n" + body;
190
+ if (meta.delivery_id)
191
+ body = "[agend-delivery-id:" + meta.delivery_id + "]\n" + body;
192
+ return body;
193
+ }
194
+ //# sourceMappingURL=human-delivery-receipts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"human-delivery-receipts.js","sourceRoot":"","sources":["../src/human-delivery-receipts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGrD,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAChC,OAAO,EAAE,kCAAkC,EAAkB,MAAM,8BAA8B,CAAC;AAclG,gFAAgF;AAChF,MAAM,UAAU,iBAAiB,CAAC,QAAgC,EAAE,SAAiB,EAAE,MAAc,EACnG,QAA4B,EAAE,KAA0B,EAAE,SAAwB,EAClF,MAA0C;IAC1C,IAAI,KAAK,KAAK,KAAK,IAAI,CAAC,SAAS,IAAI,CAAC,MAAM;QAAE,OAAO,SAAS,CAAC;IAC/D,OAAO;QACL,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,IAAI,IAAI;QAC5E,mBAAmB,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS;QACtF,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAChF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,MAAM,GAAG,KAAK;IAC3C,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI;QACvE,mBAAmB,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,CA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G,qBAAqB,GAAG,IAAI,CAAC,WAAW,GAAG,KAAK,GAAG,IAAI,CAAC;IACrF,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,36 @@
1
+ export type AvatarDescriptor = {
2
+ kind: "image";
3
+ src: string;
4
+ } | {
5
+ kind: "emoji";
6
+ text: string;
7
+ } | {
8
+ kind: "emoji";
9
+ src: string;
10
+ alt: string;
11
+ } | {
12
+ kind: "initial";
13
+ text: string;
14
+ };
15
+ /** The first user-perceived character, upper-cased where that means anything ("é" → "É", "中" stays). */
16
+ export declare function firstCharacter(text: string): string;
17
+ export declare function avatarFor(input: {
18
+ name: string;
19
+ displayName?: string | null;
20
+ /** The profile picture's version, when one is uploaded (step 0). */
21
+ profileVersion?: string | null;
22
+ /** The bot's avatar: its connection id and cached version, when the instance has its own bot and the avatar is on disk. */
23
+ bot?: {
24
+ connection: string;
25
+ version: string;
26
+ } | null;
27
+ /** The instance's own `status_emojis.delivered`, as configured. */
28
+ personaEmoji?: unknown;
29
+ }): AvatarDescriptor;
30
+ /**
31
+ * The connections that are ONE instance's own bot: not the primary (that is the fleet's shared bot), and answering for
32
+ * exactly one instance or ClassicBot room. `assignments` is every instance and room with the connection it uses.
33
+ */
34
+ export declare function ownBotConnections(primary: string | undefined, assignments: ReadonlyArray<readonly [instance: string, connection: string | undefined]>): Map<string, string>;
35
+ /** A Discord role colour as the page may use it: `#rrggbb`, never black (Discord's "no colour"). */
36
+ export declare function accentColor(raw: unknown): string | null;
@@ -0,0 +1,57 @@
1
+ /**
2
+ * #1630 (design: the comment on #1630): what stands for an instance in the web app — decided here, on the server,
3
+ * once; the page only draws it. In order:
4
+ * 0. the picture uploaded for it in View (its profile avatar);
5
+ * 1. its own bot's avatar — only when it has a bot of its own: an instance on the shared bot skips this, the same
6
+ * face for everyone tells nobody apart; so does a bot with no avatar set (a default avatar says nothing);
7
+ * 2. its persona emoji (`status_emojis.delivered`, what set_persona_emoji sets): unicode as text, a Discord server
8
+ * emoji through the emoji route (a Telegram custom emoji has no picture here and falls through);
9
+ * 3. the first character of its display name, or of its name.
10
+ * Images are same-origin `/ui/img/…` URLs only; the version makes a changed picture a new URL.
11
+ */
12
+ import { normalizeEmoji } from "./status-emojis.js";
13
+ const GRAPHEMES = new Intl.Segmenter(undefined, { granularity: "grapheme" });
14
+ /** The first user-perceived character, upper-cased where that means anything ("é" → "É", "中" stays). */
15
+ export function firstCharacter(text) {
16
+ for (const { segment } of GRAPHEMES.segment(text.trim()))
17
+ return segment.toLocaleUpperCase();
18
+ return "?";
19
+ }
20
+ export function avatarFor(input) {
21
+ if (input.profileVersion)
22
+ return { kind: "image", src: `/ui/img/avatar/${encodeURIComponent(input.name)}?v=${encodeURIComponent(input.profileVersion)}` };
23
+ if (input.bot)
24
+ return { kind: "image", src: `/ui/img/bot/${encodeURIComponent(input.bot.connection)}?v=${encodeURIComponent(input.bot.version)}` };
25
+ const emoji = normalizeEmoji(input.personaEmoji);
26
+ if (emoji?.kind === "unicode")
27
+ return { kind: "emoji", text: emoji.value };
28
+ if (emoji?.kind === "custom")
29
+ return { kind: "emoji", src: `/ui/img/emoji/${emoji.id}`, alt: `:${emoji.name}:` };
30
+ return { kind: "initial", text: firstCharacter(input.displayName || input.name) };
31
+ }
32
+ /**
33
+ * The connections that are ONE instance's own bot: not the primary (that is the fleet's shared bot), and answering for
34
+ * exactly one instance or ClassicBot room. `assignments` is every instance and room with the connection it uses.
35
+ */
36
+ export function ownBotConnections(primary, assignments) {
37
+ const users = new Map();
38
+ for (const [instance, connection] of assignments) {
39
+ if (!connection)
40
+ continue;
41
+ const list = users.get(connection);
42
+ if (list)
43
+ list.push(instance);
44
+ else
45
+ users.set(connection, [instance]);
46
+ }
47
+ const own = new Map(); // instance → its own connection
48
+ for (const [connection, instances] of users)
49
+ if (connection !== primary && instances.length === 1)
50
+ own.set(instances[0], connection);
51
+ return own;
52
+ }
53
+ /** A Discord role colour as the page may use it: `#rrggbb`, never black (Discord's "no colour"). */
54
+ export function accentColor(raw) {
55
+ return typeof raw === "string" && /^#[0-9a-f]{6}$/i.test(raw) && raw.toLowerCase() !== "#000000" ? raw.toLowerCase() : null;
56
+ }
57
+ //# sourceMappingURL=instance-avatar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instance-avatar.js","sourceRoot":"","sources":["../src/instance-avatar.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAQpD,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC,CAAC;AAC7E,wGAAwG;AACxG,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,KAAK,MAAM,EAAE,OAAO,EAAE,IAAI,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QAAE,OAAO,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAC7F,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,KASzB;IACC,IAAI,KAAK,CAAC,cAAc;QAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,kBAAkB,kBAAkB,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,kBAAkB,CAAC,KAAK,CAAC,cAAc,CAAC,EAAE,EAAE,CAAC;IAC1J,IAAI,KAAK,CAAC,GAAG;QAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,eAAe,kBAAkB,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,kBAAkB,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC;IACnJ,MAAM,KAAK,GAAG,cAAc,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IACjD,IAAI,KAAK,EAAE,IAAI,KAAK,SAAS;QAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,I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,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,WAAW,EAAE,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AAC9H,CAAC"}
@@ -79,9 +79,15 @@ const CLASSIC_FIELDS = [
79
79
  */
80
80
  const FLEET_FIELD_IMPACTS = {
81
81
  "web.echo_to_channel": "now",
82
+ "web.log_tab": "now",
82
83
  "web.public_link.allow_public": "now",
83
84
  "web.public_link.ttl_minutes": "now",
84
85
  "web.public_link.protocol": "now",
86
+ // #1620: read at every session check, and by /login when it starts a terminal.
87
+ "web.session.local.absolute_hours": "now",
88
+ "web.session.local.idle_hours": "now",
89
+ "web_terminal.enabled": "now",
90
+ "web_terminal.ttl_minutes": "now",
85
91
  "defaults.locale": "now",
86
92
  "fleet.channels": "fleet",
87
93
  "fleet.channel.access.mode": "fleet",
@@ -1 +1 @@
1
- {"version":3,"file":"instance-config-impact.js","sourceRoot":"","sources":["../src/instance-config-impact.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAM9C,0EAA0E;AAC1E,MAAM,CAAC,MAAM,YAAY,GAA4B,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;AAElF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAsC,IAAI,GAAG,CAAuB;IACvG,eAAe;IACf,wBAAwB;IACxB,iBAAiB;IACjB,kBAAkB;IAClB,UAAU;IACV,cAAc;IACd,aAAa;IACb,MAAM;IACN,WAAW;IACX,sFAAsF;IACtF,2BAA2B;CAC5B,CAAC,CAAC;AAEH;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAwB,IAAI,GAAG,CAChE,CAAC,eAAe,EAAE,wBAAwB,CAAW;KACnD,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,wBAAwB,CAAC,GAAG,CAA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,CAAC"}
1
+ {"version":3,"file":"instance-config-impact.js","sourceRoot":"","sources":["../src/instance-config-impact.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAM9C,0EAA0E;AAC1E,MAAM,CAAC,MAAM,YAAY,GAA4B,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;AAElF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAsC,IAAI,GAAG,CAAuB;IACvG,eAAe;IACf,wBAAwB;IACxB,iBAAiB;IACjB,kBAAkB;IAClB,UAAU;IACV,cAAc;IACd,aAAa;IACb,MAAM;IACN,WAAW;IACX,sFAAsF;IACtF,2BAA2B;CAC5B,CAAC,CAAC;AAEH;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAwB,IAAI,GAAG,CAChE,CAAC,eAAe,EAAE,wBAAwB,CAAW;KACnD,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,wBAAwB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CACpD,CAAC;AAEF;;;GAGG;AACH,MAAM,0BAA0B,GAAwB,IAAI,GAAG,CAAC;IAC9D,UAAU;IACV,YAAY;IACZ,eAAe;CAChB,CAAC,CAAC;AAEH,wDAAwD;AACxD,MAAM,eAAe,GAAG;IACtB,cAAc,EAAE,aAAa,EAAE,SAAS,EAAE,OAAO,EAAE,mBAAmB;IACtE,kBAAkB,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,eAAe;IACzE,eAAe,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,WAAW;IACzE,cAAc,EAAE,MAAM,EAAE,eAAe,EAAE,YAAY,EAAE,UAAU;IACjE,aAAa,EAAE,gBAAgB,EAAE,QAAQ,EAAE,kBAAkB;IAC7D,0EAA0E;IAC1E,kEAAkE;IAClE,eAAe;IACf,2BAA2B;CACnB,CAAC;AAEX,2DAA2D;A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