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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (256) hide show
  1. package/dist/agent-cli-instructions.md +1 -1
  2. package/dist/backend/claude-carry.d.ts +11 -0
  3. package/dist/backend/claude-carry.js +88 -6
  4. package/dist/backend/claude-carry.js.map +1 -1
  5. package/dist/backend/claude-code.js +3 -0
  6. package/dist/backend/claude-code.js.map +1 -1
  7. package/dist/build-provenance.json +1 -1
  8. package/dist/cache-ledger.d.ts +23 -21
  9. package/dist/cache-ledger.js +70 -6
  10. package/dist/cache-ledger.js.map +1 -1
  11. package/dist/cache-prices.d.ts +8 -6
  12. package/dist/cache-prices.js +12 -5
  13. package/dist/cache-prices.js.map +1 -1
  14. package/dist/cache-service.d.ts +9 -5
  15. package/dist/cache-service.js +202 -50
  16. package/dist/cache-service.js.map +1 -1
  17. package/dist/channel/mcp-tools.js +6 -4
  18. package/dist/channel/mcp-tools.js.map +1 -1
  19. package/dist/cli-audited.js +2 -1
  20. package/dist/cli-audited.js.map +1 -1
  21. package/dist/cli.js +4 -1
  22. package/dist/cli.js.map +1 -1
  23. package/dist/contact-auth-policy.js +1 -1
  24. package/dist/contact-auth-policy.js.map +1 -1
  25. package/dist/contact-auth-service.js +8 -2
  26. package/dist/contact-auth-service.js.map +1 -1
  27. package/dist/contact-auth-store.d.ts +3 -0
  28. package/dist/contact-auth-store.js +34 -8
  29. package/dist/contact-auth-store.js.map +1 -1
  30. package/dist/contact-auth-types.d.ts +3 -2
  31. package/dist/contact-auth-types.js.map +1 -1
  32. package/dist/contact-change-proposals.d.ts +47 -0
  33. package/dist/contact-change-proposals.js +132 -0
  34. package/dist/contact-change-proposals.js.map +1 -0
  35. package/dist/daemon.d.ts +31 -0
  36. package/dist/daemon.js +149 -2
  37. package/dist/daemon.js.map +1 -1
  38. package/dist/delivery-outbox.d.ts +10 -0
  39. package/dist/delivery-outbox.js +21 -0
  40. package/dist/delivery-outbox.js.map +1 -1
  41. package/dist/fleet-manager.d.ts +65 -1
  42. package/dist/fleet-manager.js +338 -20
  43. package/dist/fleet-manager.js.map +1 -1
  44. package/dist/general-knowledge/skills/concepts/SKILL.md +2 -1
  45. package/dist/general-knowledge/skills/hub/SKILL.md +45 -5
  46. package/dist/general-knowledge/skills/task-board/SKILL.md +4 -0
  47. package/dist/general-knowledge/skills/web-appearance/SKILL.md +1 -1
  48. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +16 -6
  49. package/dist/hub/agent-pictures-model.d.ts +275 -0
  50. package/dist/hub/agent-pictures-model.js +103 -0
  51. package/dist/hub/agent-pictures-model.js.map +1 -0
  52. package/dist/hub/agent-pictures.d.ts +64 -0
  53. package/dist/hub/agent-pictures.js +255 -0
  54. package/dist/hub/agent-pictures.js.map +1 -0
  55. package/dist/hub/client.d.ts +4 -0
  56. package/dist/hub/client.js +23 -2
  57. package/dist/hub/client.js.map +1 -1
  58. package/dist/hub/compose/member.d.ts +14 -3
  59. package/dist/hub/compose/member.js +46 -10
  60. package/dist/hub/compose/member.js.map +1 -1
  61. package/dist/hub/compose/server.d.ts +6 -5
  62. package/dist/hub/compose/server.js +7 -3
  63. package/dist/hub/compose/server.js.map +1 -1
  64. package/dist/hub/direct-posts-model.d.ts +1 -0
  65. package/dist/hub/direct-posts-model.js +2 -0
  66. package/dist/hub/direct-posts-model.js.map +1 -0
  67. package/dist/hub/direct-posts.d.ts +36 -0
  68. package/dist/hub/direct-posts.js +145 -0
  69. package/dist/hub/direct-posts.js.map +1 -0
  70. package/dist/hub/http/compose.d.ts +5 -0
  71. package/dist/hub/http/compose.js +158 -20
  72. package/dist/hub/http/compose.js.map +1 -1
  73. package/dist/hub/http/core.d.ts +9 -1
  74. package/dist/hub/http/core.js +21 -1
  75. package/dist/hub/http/core.js.map +1 -1
  76. package/dist/hub/http/deps.d.ts +1 -0
  77. package/dist/hub/http/schema.js +7 -0
  78. package/dist/hub/http/schema.js.map +1 -1
  79. package/dist/hub/init/text.js +1 -1
  80. package/dist/hub/join/service.d.ts +2 -0
  81. package/dist/hub/join/service.js +7 -3
  82. package/dist/hub/join/service.js.map +1 -1
  83. package/dist/hub/member/agent-pictures.d.ts +76 -0
  84. package/dist/hub/member/agent-pictures.js +196 -0
  85. package/dist/hub/member/agent-pictures.js.map +1 -0
  86. package/dist/hub/member/direct-rooms.d.ts +9 -0
  87. package/dist/hub/member/direct-rooms.js +14 -0
  88. package/dist/hub/member/direct-rooms.js.map +1 -0
  89. package/dist/hub/member/room-ask.d.ts +22 -1
  90. package/dist/hub/member/room-ask.js +99 -5
  91. package/dist/hub/member/room-ask.js.map +1 -1
  92. package/dist/hub/member/room-asker-store.d.ts +48 -0
  93. package/dist/hub/member/room-asker-store.js +181 -0
  94. package/dist/hub/member/room-asker-store.js.map +1 -0
  95. package/dist/hub/member/room-post.d.ts +11 -10
  96. package/dist/hub/member/room-post.js +51 -7
  97. package/dist/hub/member/room-post.js.map +1 -1
  98. package/dist/hub/policy.d.ts +11 -2
  99. package/dist/hub/policy.js +60 -7
  100. package/dist/hub/policy.js.map +1 -1
  101. package/dist/hub/protocol.d.ts +254 -1
  102. package/dist/hub/protocol.js +20 -8
  103. package/dist/hub/protocol.js.map +1 -1
  104. package/dist/hub/representative.d.ts +38 -0
  105. package/dist/hub/representative.js +140 -12
  106. package/dist/hub/representative.js.map +1 -1
  107. package/dist/hub/room-asker-identity-model.d.ts +53 -0
  108. package/dist/hub/room-asker-identity-model.js +14 -0
  109. package/dist/hub/room-asker-identity-model.js.map +1 -0
  110. package/dist/hub/room-asker-identity.d.ts +22 -0
  111. package/dist/hub/room-asker-identity.js +43 -0
  112. package/dist/hub/room-asker-identity.js.map +1 -0
  113. package/dist/hub/rooms/agents.d.ts +2 -0
  114. package/dist/hub/rooms/agents.js +30 -3
  115. package/dist/hub/rooms/agents.js.map +1 -1
  116. package/dist/hub/rooms/asker-identity.d.ts +21 -0
  117. package/dist/hub/rooms/asker-identity.js +86 -0
  118. package/dist/hub/rooms/asker-identity.js.map +1 -0
  119. package/dist/hub/rooms/direct-view.d.ts +3 -2
  120. package/dist/hub/rooms/direct-view.js +23 -8
  121. package/dist/hub/rooms/direct-view.js.map +1 -1
  122. package/dist/hub/rooms/office.d.ts +27 -0
  123. package/dist/hub/rooms/office.js +12 -2
  124. package/dist/hub/rooms/office.js.map +1 -1
  125. package/dist/hub/rooms/service.d.ts +38 -1
  126. package/dist/hub/rooms/service.js +56 -3
  127. package/dist/hub/rooms/service.js.map +1 -1
  128. package/dist/hub/rooms/types.d.ts +5 -2
  129. package/dist/hub/rooms.d.ts +9 -0
  130. package/dist/hub/rooms.js +97 -26
  131. package/dist/hub/rooms.js.map +1 -1
  132. package/dist/hub/runtime.d.ts +1 -1
  133. package/dist/hub/server.js +24 -2
  134. package/dist/hub/server.js.map +1 -1
  135. package/dist/hub/session-directory-transition.d.ts +1 -0
  136. package/dist/hub/session-directory-transition.js +15 -9
  137. package/dist/hub/session-directory-transition.js.map +1 -1
  138. package/dist/hub/session-limits.d.ts +58 -0
  139. package/dist/hub/session-limits.js +121 -0
  140. package/dist/hub/session-limits.js.map +1 -0
  141. package/dist/hub/sessions.d.ts +1 -1
  142. package/dist/hub/sessions.js +13 -7
  143. package/dist/hub/sessions.js.map +1 -1
  144. package/dist/hub/settings-directory-decision.js +1 -1
  145. package/dist/hub/settings-directory-decision.js.map +1 -1
  146. package/dist/hub/types.d.ts +9 -2
  147. package/dist/hub-character-plan.d.ts +47 -0
  148. package/dist/hub-character-plan.js +70 -0
  149. package/dist/hub-character-plan.js.map +1 -0
  150. package/dist/hub-contact-windows.d.ts +13 -1
  151. package/dist/hub-contact-windows.js +35 -2
  152. package/dist/hub-contact-windows.js.map +1 -1
  153. package/dist/hub-picture-reduce.d.ts +34 -0
  154. package/dist/hub-picture-reduce.js +101 -0
  155. package/dist/hub-picture-reduce.js.map +1 -0
  156. package/dist/hub-picture-worker.d.ts +1 -0
  157. package/dist/hub-picture-worker.js +19 -0
  158. package/dist/hub-picture-worker.js.map +1 -0
  159. package/dist/hub-report-target.d.ts +6 -0
  160. package/dist/hub-report-target.js +6 -0
  161. package/dist/hub-report-target.js.map +1 -1
  162. package/dist/locale.js +357 -265
  163. package/dist/locale.js.map +1 -1
  164. package/dist/ls-rows.d.ts +2 -0
  165. package/dist/ls-rows.js.map +1 -1
  166. package/dist/needs-you.d.ts +6 -0
  167. package/dist/needs-you.js +3 -1
  168. package/dist/needs-you.js.map +1 -1
  169. package/dist/outbound-handlers.d.ts +8 -0
  170. package/dist/outbound-handlers.js +53 -6
  171. package/dist/outbound-handlers.js.map +1 -1
  172. package/dist/outbound-schemas.d.ts +2 -0
  173. package/dist/outbound-schemas.js +6 -4
  174. package/dist/outbound-schemas.js.map +1 -1
  175. package/dist/runtime-cli-install.js +4 -4
  176. package/dist/runtime-cli-install.js.map +1 -1
  177. package/dist/task-board-tool.d.ts +17 -0
  178. package/dist/task-board-tool.js +58 -6
  179. package/dist/task-board-tool.js.map +1 -1
  180. package/dist/tips.js +3 -3
  181. package/dist/tool-permissions.js +2 -2
  182. package/dist/tool-permissions.js.map +1 -1
  183. package/dist/ui/agent-export-strings.js +1 -1
  184. package/dist/ui/agent-page-strings.js +5 -5
  185. package/dist/ui/contact-auth-client.js +2 -2
  186. package/dist/ui/contact-tool-groups.js +1 -1
  187. package/dist/ui/fleet-cache.js +5 -5
  188. package/dist/ui/fleet-canvas.js +3 -2
  189. package/dist/ui/fleet-office-card.js +46 -7
  190. package/dist/ui/fleet-office-dialogue.d.ts +6 -3
  191. package/dist/ui/fleet-office-dialogue.js +13 -3
  192. package/dist/ui/fleet-office-layout.js +15 -15
  193. package/dist/ui/fleet-office-model.js +3 -2
  194. package/dist/ui/fleet-office-overview.js +1 -1
  195. package/dist/ui/fleet-office-pack.d.ts +17 -7
  196. package/dist/ui/fleet-office-pack.js +106 -38
  197. package/dist/ui/fleet-office-play.js +11 -4
  198. package/dist/ui/fleet-office-skin.js +41 -11
  199. package/dist/ui/fleet-office-store.js +10 -1
  200. package/dist/ui/fleet-office-talk.js +423 -0
  201. package/dist/ui/fleet-office-view.js +58 -17
  202. package/dist/ui/fleet-office-zones.js +20 -12
  203. package/dist/ui/fleet-office.js +250 -65
  204. package/dist/ui/fleet-org.js +3 -3
  205. package/dist/ui/fleet-task-common.js +3 -3
  206. package/dist/ui/fleet-task-sort.js +88 -0
  207. package/dist/ui/fleet-task-view.js +38 -9
  208. package/dist/ui/fleet-tasks.js +47 -15
  209. package/dist/ui/fleet-usage.js +6 -6
  210. package/dist/ui/hub-admin-overview.js +1 -1
  211. package/dist/ui/hub-chat-store.js +4 -3
  212. package/dist/ui/hub-chat-strings.js +3 -1
  213. package/dist/ui/hub-client.js +3 -0
  214. package/dist/ui/hub-my-agents-strings.js +2 -2
  215. package/dist/ui/hub-my-agents.js +3 -0
  216. package/dist/ui/hub-room-composer.js +24 -4
  217. package/dist/ui/hub-room-members.js +7 -3
  218. package/dist/ui/hub-room-office.js +71 -2
  219. package/dist/ui/hub-room-presence.js +14 -0
  220. package/dist/ui/hub-room-strings.js +18 -2
  221. package/dist/ui/hub-room-thread.js +82 -13
  222. package/dist/ui/hub-room-working.js +37 -0
  223. package/dist/ui/hub-session-limits.js +79 -0
  224. package/dist/ui/panel-fleet.js +5 -5
  225. package/dist/ui/panel-hub.js +41 -6
  226. package/dist/ui/panel-log.js +3 -3
  227. package/dist/ui/panel-needs.js +28 -2
  228. package/dist/ui/panel-runtimes.js +2 -2
  229. package/dist/ui/runtime-cli-install.js +1 -1
  230. package/dist/ui/runtime-update-status.js +1 -1
  231. package/dist/ui/settings-access-strings.js +1 -1
  232. package/dist/ui/settings-hub-setup-strings.js +1 -1
  233. package/dist/ui/settings-layout.js +2 -2
  234. package/dist/ui/settings-named-test.js +16 -16
  235. package/dist/ui/settings-public-session-strings.js +2 -2
  236. package/dist/ui/settings-revoke-strings.js +1 -1
  237. package/dist/ui/settings-shared-strings.js +2 -2
  238. package/dist/ui/settings-strings.js +40 -40
  239. package/dist/ui/shared/app-shell.js +1 -1
  240. package/dist/ui/shared/app.css +106 -6
  241. package/dist/ui/shared/chat-strings.js +9 -9
  242. package/dist/ui/shared/hub-owner.css +5 -0
  243. package/dist/ui/shared/hub-rooms-u2.css +3 -0
  244. package/dist/ui/shared/instance-nav.js +36 -2
  245. package/dist/ui/shared/office-dialogue.css +110 -0
  246. package/dist/ui/shared/task-board.css +103 -7
  247. package/dist/ui/shared/view-strings.js +27 -9
  248. package/dist/web-api.d.ts +5 -0
  249. package/dist/web-api.js +29 -0
  250. package/dist/web-api.js.map +1 -1
  251. package/dist/web-office-skins.d.ts +8 -2
  252. package/dist/web-office-skins.js +33 -14
  253. package/dist/web-office-skins.js.map +1 -1
  254. package/dist/web-office-store.js +5 -3
  255. package/dist/web-office-store.js.map +1 -1
  256. package/package.json +1 -1
@@ -0,0 +1,196 @@
1
+ /**
2
+ * M-3533 R2b: this Fleet's shared agents' pictures for the Hub's room offices (agent-pictures-model.ts). Each published share
3
+ * reports its disc (what the owner's sidebar shows for it) and its identity-card portrait. A PNG is reduced to the square the
4
+ * Fleet shows; another type goes as it is when it fits. Over its cap a picture is left out and reported as too large. The
5
+ * sources are read every few seconds by a cheap key (a file's version); bytes are read and reduced only when a key changes.
6
+ */
7
+ import { createHash, randomUUID } from "node:crypto";
8
+ import { HUB_LIMITS } from "../protocol.js";
9
+ import { agentPictureResultSchema, agentPicturesResultSchema, characterSetBytes, HUB_AGENT_CHARACTERS_CAPABILITY, HUB_AGENT_PICTURES_CAPABILITY, HUB_PICTURE_AGENT_MAX, HUB_PICTURE_CHUNK, HUB_PICTURE_DISC_MAX, sniffPicture, } from "../agent-pictures-model.js";
10
+ export const MEMBER_PICTURES_POLL_MS = 5_000;
11
+ /**
12
+ * M-3533 R2c (Prism #4421): what one `agent.pictures` frame may take, serialized — the link refuses a frame over
13
+ * HUB_LIMITS.frame (256 KiB), and a refused report would be sent unchanged on every tick. Room for its envelope.
14
+ */
15
+ export const MEMBER_PICTURES_REPORT_MAX = HUB_LIMITS.frame - 4 * 1024;
16
+ /**
17
+ * The report fitted into one frame: every row keeps its disc and portrait (a report replaces the Fleet's rows, so none may
18
+ * be left out); characters, whole, are left out from the last row back until the frame fits. Such a set is not "too large"
19
+ * (the agent's own cap is not why): it is sent when the report has room again.
20
+ */
21
+ export function fitReport(rows, size, max = MEMBER_PICTURES_REPORT_MAX) {
22
+ const out = rows.slice();
23
+ for (let i = out.length - 1; i >= 0 && size(out) > max; i--)
24
+ if (out[i].character) {
25
+ const { character: _c, ...rest } = out[i];
26
+ out[i] = rest;
27
+ }
28
+ return out;
29
+ }
30
+ export class HubMemberAgentPictures {
31
+ options;
32
+ link = null;
33
+ timer = null;
34
+ running = null;
35
+ sent = null;
36
+ stopped = false;
37
+ /** Prepared pictures by source key and slot; only the keys in use are kept. */
38
+ made = new Map();
39
+ characters = new Map();
40
+ constructor(options) {
41
+ this.options = options;
42
+ }
43
+ connected(link) {
44
+ if (!link) {
45
+ this.disconnected();
46
+ return;
47
+ }
48
+ if (this.stopped || !this.options.current() || !link.current() || !link.features.has(HUB_AGENT_PICTURES_CAPABILITY))
49
+ return;
50
+ this.link = link;
51
+ this.sent = null;
52
+ if (!this.timer) {
53
+ this.timer = setInterval(() => { void this.refresh(); }, MEMBER_PICTURES_POLL_MS);
54
+ this.timer.unref?.();
55
+ }
56
+ void this.refresh();
57
+ }
58
+ disconnected() { this.link = null; this.sent = null; if (this.timer)
59
+ clearInterval(this.timer); this.timer = null; }
60
+ close() { this.stopped = true; this.disconnected(); this.made.clear(); this.characters.clear(); }
61
+ refresh() {
62
+ if (this.running)
63
+ return this.running;
64
+ this.running = this.flush().catch(() => { try {
65
+ this.options.failed?.();
66
+ }
67
+ catch { /* diagnostic only */ } }).finally(() => { this.running = null; });
68
+ return this.running;
69
+ }
70
+ /** A picture's cache entry is its agent's, its slot's and its source's (Prism #4393: two agents' sources may share a key). */
71
+ static cacheKey(agent, slot, key) { return JSON.stringify([agent, slot, key]); }
72
+ async prepare(agent, key, slot, source) {
73
+ const cacheKey = HubMemberAgentPictures.cacheKey(agent, slot, key);
74
+ if (this.made.has(cacheKey))
75
+ return this.made.get(cacheKey);
76
+ let made = null;
77
+ const raw = source.load()?.bytes ?? null;
78
+ const mime = raw ? sniffPicture(raw) : null;
79
+ if (raw && mime) {
80
+ const small = mime === "image/png" ? await this.options.reduce(raw, slot) : null;
81
+ const bytes = small && small.length <= raw.length ? small : raw;
82
+ const type = bytes === small ? "image/png" : mime;
83
+ made = bytes.length > (slot === "disc" ? HUB_PICTURE_DISC_MAX : HUB_PICTURE_AGENT_MAX) ? "too-large"
84
+ : { bytes, ref: { sha256: createHash("sha256").update(bytes).digest("hex"), mime: type, size: bytes.length } };
85
+ }
86
+ this.made.set(cacheKey, made);
87
+ return made;
88
+ }
89
+ /**
90
+ * M-3533 R2c: the character cut (each pose its PNG), hashed. A picture the pack cannot give or that does not cut (not a
91
+ * PNG, unreadable): null — never an uncut sheet. Over the agent's whole cap on its own: "too-large".
92
+ */
93
+ async prepareCharacter(agent, source) {
94
+ const cacheKey = JSON.stringify([agent, "character", source.key]);
95
+ if (this.characters.has(cacheKey))
96
+ return this.characters.get(cacheKey);
97
+ let made = null;
98
+ const loaded = this.options.crop ? source.load() : null;
99
+ const cut = loaded && loaded.plan.sources.every(src => { const b = loaded.pictures.get(src); return !!b && sniffPicture(b) === "image/png"; })
100
+ ? await this.options.crop(loaded.pictures, Object.values(loaded.plan.poses).map(p => p.cut)) : null;
101
+ if (loaded && cut) {
102
+ const set = {}, bytes = new Map();
103
+ for (const [pose, p] of Object.entries(loaded.plan.poses)) {
104
+ const png = cut.get(pose);
105
+ if (!png || !p) {
106
+ set[pose] = undefined;
107
+ continue;
108
+ }
109
+ const ref = { sha256: createHash("sha256").update(png).digest("hex"), mime: "image/png", size: png.length };
110
+ bytes.set(ref.sha256, { bytes: png, ref });
111
+ set[pose] = { ...ref, mime: "image/png", ...p.meta };
112
+ }
113
+ const whole = Object.keys(loaded.plan.poses).every(pose => !!set[pose]);
114
+ made = !whole ? null : characterSetBytes(set) > HUB_PICTURE_AGENT_MAX ? "too-large" : { set, bytes };
115
+ }
116
+ this.characters.set(cacheKey, made);
117
+ return made;
118
+ }
119
+ async flush() {
120
+ const link = this.link;
121
+ const live = () => !this.stopped && this.link === link && !!link?.current() && this.options.current();
122
+ if (!link || !live())
123
+ return;
124
+ const shares = this.options.exposures().slice().sort((a, b) => a.id.localeCompare(b.id));
125
+ // M-3533 R2c: characters only to a Hub that offered them (an older Hub's strict row refuses the field).
126
+ const characters = !!this.options.crop && link.features.has(HUB_AGENT_CHARACTERS_CAPABILITY);
127
+ const keyed = shares.map(s => {
128
+ const src = this.options.sources(s.agent);
129
+ return { ...s, src, key: [src.disc?.key ?? null, src.portrait?.key ?? null], character: characters ? src.character ?? null : null };
130
+ });
131
+ const signature = JSON.stringify(keyed.map(k => [k.id, k.agent, ...k.key, k.character?.key ?? null]));
132
+ if (signature === this.sent)
133
+ return;
134
+ // Forget pictures no share uses now.
135
+ const inUse = new Set(keyed.flatMap(k => [k.key[0] !== null ? HubMemberAgentPictures.cacheKey(k.agent, "disc", k.key[0]) : "", k.key[1] !== null ? HubMemberAgentPictures.cacheKey(k.agent, "portrait", k.key[1]) : ""]));
136
+ for (const k of [...this.made.keys()])
137
+ if (!inUse.has(k))
138
+ this.made.delete(k);
139
+ const charactersInUse = new Set(keyed.filter(k => k.character).map(k => JSON.stringify([k.agent, "character", k.character.key])));
140
+ for (const k of [...this.characters.keys()])
141
+ if (!charactersInUse.has(k))
142
+ this.characters.delete(k);
143
+ const rows = [], bytes = new Map();
144
+ for (const k of keyed) {
145
+ const disc = k.src.disc ? await this.prepare(k.agent, k.key[0], "disc", k.src.disc) : null;
146
+ const discRef = disc && disc !== "too-large" ? disc : null;
147
+ const portrait = k.src.portrait ? await this.prepare(k.agent, k.key[1], "portrait", k.src.portrait) : null;
148
+ // The portrait has what the disc leaves of the agent's 512 KB: the disc is never the one dropped (the design's order).
149
+ const portraitRef = portrait && portrait !== "too-large" && portrait.ref.size <= HUB_PICTURE_AGENT_MAX - (discRef?.ref.size ?? 0) ? portrait : null;
150
+ // M-3533 R2c: the character has what the avatar and portrait leave, whole or not at all (dropped first, Lumen R2c 3).
151
+ const character = k.character ? await this.prepareCharacter(k.agent, k.character) : null;
152
+ const left = HUB_PICTURE_AGENT_MAX - (discRef?.ref.size ?? 0) - (portraitRef?.ref.size ?? 0);
153
+ const characterRef = character && character !== "too-large" && characterSetBytes(character.set) <= left ? character : null;
154
+ const tooLarge = [...(disc === "too-large" ? ["disc"] : []), ...(portrait && !portraitRef ? ["portrait"] : []),
155
+ ...(character && !characterRef ? ["character"] : [])];
156
+ for (const p of [discRef, portraitRef])
157
+ if (p)
158
+ bytes.set(p.ref.sha256, p);
159
+ if (characterRef)
160
+ for (const [h, p] of characterRef.bytes)
161
+ bytes.set(h, p);
162
+ rows.push({ exposureId: k.id, disc: discRef?.ref ?? null, portrait: portraitRef?.ref ?? null, ...(characterRef ? { character: characterRef.set } : {}),
163
+ ...(tooLarge.length ? { tooLarge } : {}) });
164
+ }
165
+ if (!live())
166
+ return;
167
+ const frameOf = (agents) => ({ v: 1, type: "agent.pictures", requestId: randomUUID(), linkEpoch: link.linkEpoch,
168
+ // The rows' own JSON (built in a fixed key order): canonicalArguments caps its input at 64 KiB, which characters exceed.
169
+ payload: { revision: createHash("sha256").update(JSON.stringify(agents)).digest("hex"), agents } });
170
+ const fitted = fitReport(rows, agents => Buffer.byteLength(JSON.stringify(frameOf(agents))));
171
+ const reply = await link.exchange(frameOf(fitted), "agent.pictures-result");
172
+ const result = agentPicturesResultSchema.parse(reply.payload);
173
+ if (!result.ok || !live())
174
+ return;
175
+ for (const hash of result.need) {
176
+ const p = bytes.get(hash);
177
+ if (!p)
178
+ continue;
179
+ const count = Math.ceil(p.bytes.length / HUB_PICTURE_CHUNK);
180
+ for (let index = 0; index < count; index++) {
181
+ if (!live())
182
+ return;
183
+ const data = p.bytes.subarray(index * HUB_PICTURE_CHUNK, (index + 1) * HUB_PICTURE_CHUNK).toString("base64");
184
+ const answer = await link.exchange({ v: 1, type: "agent.picture", requestId: randomUUID(), linkEpoch: link.linkEpoch,
185
+ payload: { sha256: hash, mime: p.ref.mime, size: p.bytes.length, index, count, data } }, "agent.picture-result");
186
+ const got = agentPictureResultSchema.parse(answer.payload);
187
+ // Refused: the report is sent again on the next tick (nothing is marked sent).
188
+ if (!got.ok)
189
+ return;
190
+ }
191
+ }
192
+ if (live())
193
+ this.sent = signature;
194
+ }
195
+ }
196
+ //# sourceMappingURL=agent-pictures.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-pictures.js","sourceRoot":"","sources":["../../../src/hub/member/agent-pictures.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EACL,wBAAwB,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,+BAA+B,EAAE,6BAA6B,EAAE,qBAAqB,EAAE,iBAAiB,EAChL,oBAAoB,EAAE,YAAY,GACnC,MAAM,4BAA4B,CAAC;AAkBpC,MAAM,CAAC,MAAM,uBAAuB,GAAG,KAAK,CAAC;AAC7C;;;GAGG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,UAAU,CAAC,KAAK,GAAG,CAAC,GAAG,IAAI,CAAC;AACtE;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,IAA2B,EAAE,IAA6C,EAAE,GAAG,GAAG,0BAA0B;IACpI,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;IACzB,KAAK,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE;QAAE,IAAI,G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adata). */
2
+ import type Database from "better-sqlite3";
3
+ export declare class HubDirectRooms {
4
+ private db;
5
+ constructor(db: Database.Database);
6
+ remember(message: string, room: string, exposure: string, token: string): void;
7
+ room(message: string): string | undefined;
8
+ has(room: string, exposure: string, token: string): boolean;
9
+ }
@@ -0,0 +1,14 @@
1
+ export class HubDirectRooms {
2
+ db;
3
+ constructor(db) {
4
+ this.db = db;
5
+ db.exec(`CREATE TABLE IF NOT EXISTS hub_member_direct_rooms(message_id TEXT PRIMARY KEY,room_id TEXT NOT NULL,exposure_id TEXT NOT NULL,token TEXT NOT NULL)`);
6
+ }
7
+ remember(message, room, exposure, token) {
8
+ this.db.prepare("DELETE FROM hub_member_direct_rooms WHERE message_id NOT LIKE 'listed:%' AND message_id NOT IN(SELECT message_id FROM hub_representative_questions)").run();
9
+ this.db.prepare("INSERT INTO hub_member_direct_rooms VALUES(?,?,?,?) ON CONFLICT(message_id) DO UPDATE SET room_id=excluded.room_id,exposure_id=excluded.exposure_id,token=excluded.token").run(message, room, exposure, token);
10
+ }
11
+ room(message) { return this.db.prepare("SELECT room_id FROM hub_member_direct_rooms WHERE message_id=?").get(message)?.room_id; }
12
+ has(room, exposure, token) { return !!this.db.prepare("SELECT 1 FROM hub_member_direct_rooms WHERE room_id=? AND exposure_id=? AND token=? LIMIT 1").get(room, exposure, token); }
13
+ }
14
+ //# sourceMappingURL=direct-rooms.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"direct-rooms.js","sourceRoot":"","sources":["../../../src/hub/member/direct-rooms.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,cAAc;IACL,EAAE;IAAtB,YAAoB,EAAoB;kBAApB,EAAE;QAAoB,EAAE,CAAC,IAAI,CAAC,qJAAqJ,CAAC,CAAC;IAAA,CAAC;IAC1M,QAAQ,CAAC,OAAc,EAAC,IAAW,EAAC,QAAe,EAAC,KAAY;QAC9D,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,qJAAqJ,CAAC,CAAC,GAAG,EAAE,CAAC;QAC7K,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,0KAA0K,CAAC,CAAC,GAAG,CAAC,OAAO,EAAC,IAAI,EAAC,QAAQ,EAAC,KAAK,CAAC,CAAC;IAC/N,CAAC;IACD,IAAI,CAAC,OAAc,IAAmB,OAAQ,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,gEAAgE,CAAC,CAAC,GAAG,CAAC,OAAO,CAAgC,EAAE,OAAO,CAAC,CAAA,CAAC;IACtL,GAAG,CAAC,IAAW,EAAC,QAAe,EAAC,KAAY,IAAU,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,6FAA6F,CAAC,CAAC,GAAG,CAAC,IAAI,EAAC,QAAQ,EAAC,KAAK,CAAC,CAAC,CAAA,CAAC;CACzM"}
@@ -1,3 +1,5 @@
1
+ import { type RoomAskerDestination, type VerifiedHubAsker, type HubRoomAskerIdentity } from "../room-asker-identity-model.js";
2
+ import type { HubRoomAskerStore } from "./room-asker-store.js";
1
3
  import { type RoomBrief } from "../room-brief-model.js";
2
4
  /** Track C / seam2: injectable Fleet adapter. Track R owns the negotiated wire schemas and socket routing. */
3
5
  import type Database from "better-sqlite3";
@@ -65,6 +67,7 @@ export interface RoomExposure {
65
67
  export interface RoomAskLink {
66
68
  current(): boolean;
67
69
  readonly features?: ReadonlySet<string>;
70
+ readonly linkEpoch?: number;
68
71
  sendAnswer(answer: RoomAnswer): Promise<void>;
69
72
  /** M-3127 (agent reactions, on room-answer-buttons-v1): the agent's reaction to the room question it was asked (absent: an older link). */
70
73
  sendReact?(react: {
@@ -81,6 +84,10 @@ export interface RoomAskLink {
81
84
  }
82
85
  export interface RoomAskOptions {
83
86
  db: Database.Database;
87
+ /** Optional separately encrypted provenance; never changes the strict legacy row. */
88
+ askerStore?: HubRoomAskerStore;
89
+ now?(): number;
90
+ attentionChanged?(): void;
84
91
  /** Stable immutable Hub issuer / Fleet / owner binding, from the selected member state set. */
85
92
  bindingKey: string;
86
93
  encryptionKey: Buffer;
@@ -115,6 +122,7 @@ export declare function verifyRoomAskJournal(db: Database.Database, options: Pic
115
122
  export declare class HubRoomAskAdapter {
116
123
  private readonly options;
117
124
  private closed;
125
+ private readonly clockHolds;
118
126
  private link;
119
127
  private readonly binding;
120
128
  private readonly key;
@@ -126,17 +134,30 @@ export declare class HubRoomAskAdapter {
126
134
  private contextFlush;
127
135
  private contextCursor;
128
136
  constructor(options: RoomAskOptions);
137
+ /**
138
+ * M-3660: whether this agent's room question on `correlationId` is no longer being answered (answered, acked). A held
139
+ * room ask still takes the agent's late answer, so it is not settled: its window runs to its deadline. null: not one here.
140
+ */
141
+ questionSettled(correlationId: string, agent: string): boolean | null;
129
142
  hasOpenQuestion(agent: string): boolean;
130
143
  private rows;
131
144
  private row;
132
145
  private aad;
133
146
  private read;
134
147
  private save;
148
+ private accepted;
149
+ /** Historical author of this exact accepted payload; never current consent, lease or active turn. */
150
+ verifiedAsker(messageId: string, expected: RoomAskerDestination): VerifiedHubAsker | null;
151
+ attentionItems(): import("../../needs-you.js").HubExecutionAttentionInput[];
152
+ private prepareAsker;
153
+ private provenanceReady;
135
154
  private usable;
136
155
  private current;
137
156
  connected(link: RoomAskLink | null): void;
138
157
  /** Synchronous admission only: callers must not await agent work on the socket's control/ACK queue. */
139
- accept(input: RoomAsk, source: RoomAskLink): "accepted" | "duplicate";
158
+ accept(input: RoomAsk & {
159
+ askerIdentity?: HubRoomAskerIdentity;
160
+ }, source: RoomAskLink): "accepted" | "duplicate";
140
161
  private kick;
141
162
  private dispatch;
142
163
  settled(): Promise<void>;
@@ -1,3 +1,6 @@
1
+ import { tForLocale } from "../../locale.js";
2
+ import { HubRoomAskerClockError } from "../room-asker-identity.js";
3
+ import { HUB_ROOM_ASKER_IDENTITY_CAPABILITY } from "../room-asker-identity-model.js";
1
4
  import { HUB_ROOM_ANSWER_STATUS_CAPABILITY } from "../room-answer-status-model.js";
2
5
  import { HUB_ROOM_BRIEF_CAPABILITY, roomBriefSchema, formatRoomBrief } from "../room-brief-model.js";
3
6
  import { budgetRoomContext } from "./room-context-budget.js";
@@ -83,6 +86,7 @@ export function verifyRoomAskJournal(db, options) {
83
86
  export class HubRoomAskAdapter {
84
87
  options;
85
88
  closed = false;
89
+ clockHolds = new Map();
86
90
  link = null;
87
91
  binding;
88
92
  key;
@@ -101,6 +105,7 @@ export class HubRoomAskAdapter {
101
105
  this.binding = createHash("sha256").update(options.bindingKey).digest("hex");
102
106
  // Authenticate the whole retained set before changing any recovery state. Never replace corrupt history.
103
107
  const retained = this.rows().map(row => ({ row, saved: this.read(row) }));
108
+ options.askerStore?.recover(id => { const row = this.row(id); return row ? this.accepted(this.read(row)) : null; });
104
109
  options.db.transaction(() => {
105
110
  for (const { row, saved } of retained) {
106
111
  if (row.state === "input")
@@ -110,6 +115,25 @@ export class HubRoomAskAdapter {
110
115
  }
111
116
  }).immediate();
112
117
  }
118
+ /**
119
+ * M-3660: whether this agent's room question on `correlationId` is no longer being answered (answered, acked). A held
120
+ * room ask still takes the agent's late answer, so it is not settled: its window runs to its deadline. null: not one here.
121
+ */
122
+ questionSettled(correlationId, agent) {
123
+ if (this.closed)
124
+ return null;
125
+ const row = this.options.db.prepare("SELECT * FROM hub_room_asks WHERE cid=?").get(correlationId);
126
+ if (!row)
127
+ return null;
128
+ try {
129
+ if (this.read(row).local.agent !== agent)
130
+ return null;
131
+ }
132
+ catch {
133
+ return null;
134
+ }
135
+ return row.state === "answered" || row.state === "acked";
136
+ }
113
137
  hasOpenQuestion(agent) {
114
138
  return !this.closed && this.rows().some(row => ["input", "delivered"].includes(row.state) && this.read(row).local.agent === agent);
115
139
  }
@@ -128,6 +152,59 @@ export class HubRoomAskAdapter {
128
152
  this.options.db.prepare("INSERT INTO hub_room_asks VALUES(?,?,?,?,?) ON CONFLICT(message_id) DO UPDATE SET state=excluded.state,value=excluded.value")
129
153
  .run(id, this.binding, state, saved.cid, value);
130
154
  }
155
+ accepted(saved) {
156
+ const destination = { agent: saved.local.agent, exposureId: saved.ask.exposureId, incarnation: createHash("sha256").update(JSON.stringify([saved.local.token, saved.generation ?? null])).digest("hex") };
157
+ return { ask: saved.ask, destination, journalDigest: createHash("sha256").update(JSON.stringify([saved.ask, saved.local, saved.cid, saved.generation ?? null])).digest("hex") };
158
+ }
159
+ /** Historical author of this exact accepted payload; never current consent, lease or active turn. */
160
+ verifiedAsker(messageId, expected) {
161
+ if (this.closed)
162
+ return null;
163
+ try {
164
+ const row = this.row(messageId);
165
+ if (!row)
166
+ return null;
167
+ const accepted = this.accepted(this.read(row)), d = accepted.destination;
168
+ if (d.agent !== expected.agent || d.exposureId !== expected.exposureId || d.incarnation !== expected.incarnation)
169
+ return null;
170
+ return this.options.askerStore?.get(messageId, accepted) ?? null;
171
+ }
172
+ catch {
173
+ return null;
174
+ }
175
+ }
176
+ attentionItems() {
177
+ if (this.closed)
178
+ return [];
179
+ const now = this.options.now?.() ?? Date.now(), items = [];
180
+ for (const [key, hold] of this.clockHolds) {
181
+ if (now >= hold.expiresAt || this.options.localExposure(hold.item.exposureId)?.agent !== hold.item.agent) {
182
+ this.clockHolds.delete(key);
183
+ continue;
184
+ }
185
+ items.push(hold.item);
186
+ }
187
+ return items;
188
+ }
189
+ prepareAsker(proof, saved, source, replay) {
190
+ try {
191
+ this.options.askerStore.prepare(proof, this.accepted(saved), { linkEpoch: source.linkEpoch, exposureRevision: saved.local.revision }, { replay, legacyAbsent: !replay, canCollect: id => { const row = this.row(id); if (!row)
192
+ return true; this.read(row); return ["answered", "acked", "held"].includes(row.state); } });
193
+ if (this.clockHolds.delete(saved.ask.exposureId))
194
+ this.options.attentionChanged?.();
195
+ }
196
+ catch (error) {
197
+ if (error instanceof HubRoomAskerClockError && (!replay || ["queued", "dispatching"].includes(this.row(saved.ask.messageId)?.state ?? ""))) {
198
+ if (this.clockHolds.size >= 4096 && !this.clockHolds.has(saved.ask.exposureId))
199
+ this.clockHolds.delete(this.clockHolds.keys().next().value);
200
+ this.clockHolds.set(saved.ask.exposureId, { expiresAt: proof.retainedUntil, item: { id: `room-clock:${saved.ask.exposureId}`, kind: "hold", agent: saved.local.agent, messageId: saved.ask.messageId, exposureId: saved.ask.exposureId, since: this.options.now?.() ?? Date.now(),
201
+ detail: tForLocale(this.options.locale ?? "en", "hub.room.clockSkew") } });
202
+ this.options.attentionChanged?.();
203
+ }
204
+ throw error;
205
+ }
206
+ }
207
+ provenanceReady(saved) { return this.options.askerStore?.permitsInput(saved.ask.messageId, this.accepted(saved)) ?? true; }
131
208
  usable(source) {
132
209
  return !this.closed && this.options.current() && source !== null && source === this.link && source.current()
133
210
  && !!source.features?.has("welcome-caps-v1") && source.features.has(ROOM_ASK_CAPABILITY);
@@ -148,7 +225,10 @@ export class HubRoomAskAdapter {
148
225
  accept(input, source) {
149
226
  if (!this.usable(source))
150
227
  throw new HubProtocolError("stale");
151
- const ask = validated(askSchema, input);
228
+ const { askerIdentity, ...legacy } = input;
229
+ if (askerIdentity !== undefined && (!this.options.askerStore || !source.features?.has(HUB_ROOM_ASKER_IDENTITY_CAPABILITY) || source.linkEpoch === undefined))
230
+ throw new HubProtocolError("incompatible");
231
+ const ask = validated(askSchema, legacy);
152
232
  if (!ask.text.trim() || Buffer.byteLength(JSON.stringify(ask)) > HUB_LIMITS.frame - 1024)
153
233
  throw new HubProtocolError("invalid");
154
234
  const old = this.row(ask.messageId);
@@ -158,6 +238,13 @@ export class HubRoomAskAdapter {
158
238
  throw new HubProtocolError("conflict");
159
239
  if (!this.current(saved))
160
240
  throw new HubProtocolError("stale");
241
+ if (askerIdentity !== undefined)
242
+ this.prepareAsker(askerIdentity, saved, source, true);
243
+ // Finish only an exact previously prepared binding; a proofless retry cannot invent one.
244
+ if (askerIdentity !== undefined)
245
+ this.options.askerStore.commit(ask.messageId, this.accepted(saved));
246
+ if (!this.provenanceReady(saved))
247
+ throw new HubProtocolError("uncertain");
161
248
  this.admitted.set(ask.messageId, source);
162
249
  if (old.state === "queued")
163
250
  this.kick(ask.messageId);
@@ -174,7 +261,12 @@ export class HubRoomAskAdapter {
174
261
  const pending = this.options.db.prepare("SELECT count(*) AS n FROM hub_room_asks WHERE state NOT IN ('acked','held')").get();
175
262
  if (pending.n >= 4096)
176
263
  throw new HubProtocolError("backpressure");
177
- this.save(ask.messageId, "queued", { ask, local: { agent: local.agent, consentId: local.consentId, revision: local.revision, token: local.token }, cid: `hub-room-${randomUUID()}`, ...(generation ? { generation } : {}) });
264
+ const saved = { ask, local: { agent: local.agent, consentId: local.consentId, revision: local.revision, token: local.token }, cid: `hub-room-${randomUUID()}`, ...(generation ? { generation } : {}) };
265
+ if (askerIdentity !== undefined)
266
+ this.prepareAsker(askerIdentity, saved, source, false);
267
+ this.save(ask.messageId, "queued", saved);
268
+ if (askerIdentity !== undefined)
269
+ this.options.askerStore.commit(ask.messageId, this.accepted(this.read(this.row(ask.messageId))));
178
270
  this.admitted.set(ask.messageId, source);
179
271
  this.kick(ask.messageId);
180
272
  return "accepted";
@@ -192,10 +284,10 @@ export class HubRoomAskAdapter {
192
284
  if (!row || row.state !== "queued" || !source || !this.usable(source))
193
285
  return;
194
286
  const saved = this.read(row);
195
- if (!this.current(saved))
287
+ if (!this.current(saved) || !this.provenanceReady(saved))
196
288
  return;
197
289
  this.save(id, "dispatching", saved);
198
- const current = () => this.usable(source) && this.admitted.get(id) === source && this.current(saved);
290
+ const current = () => this.usable(source) && this.admitted.get(id) === source && this.current(saved) && this.provenanceReady(saved);
199
291
  try {
200
292
  if (saved.generation && source.features?.has(HUB_ROOM_CONTEXT_CAPABILITY) && !await this.ensureContext(source, saved.ask.exposureId, saved.local.agent, saved.generation))
201
293
  throw new HubProtocolError("stale");
@@ -209,8 +301,10 @@ export class HubRoomAskAdapter {
209
301
  ? await store.receive(saved.local.agent, saved.ask.messageId, files, (fid, offset) => fetch(fid, offset)).catch(() => files.map(f => `(${f.name}: could not be fetched)`))
210
302
  : files.map(f => `(${f.name}: not available on this Fleet)`);
211
303
  }
304
+ const verifiedHubAsker = this.options.askerStore?.get(id, this.accepted(saved));
212
305
  const delivered = await this.options.deliver({ agent: saved.local.agent, correlationId: saved.cid, contactLimit: this.options.localExposure(saved.ask.exposureId)?.contactLimit !== false,
213
306
  ...(saved.generation ? { roomContextGeneration: saved.generation } : {}),
307
+ ...(verifiedHubAsker ? { verifiedHubAsker, roomAskerMessageId: id, roomAskerDestination: Object.freeze(this.accepted(saved).destination) } : {}),
214
308
  text: formatRoomAskPrompt(saved.ask, saved.cid, this.options.locale, { maxContextBytes: this.options.maxCrossInstanceMessageBytes?.(), react: !!source.features?.has(HUB_ROOM_REACT_CAPABILITY) && typeof source.sendReact === "function", fileLines }), stillCurrent: current,
215
309
  beforeInput: async () => {
216
310
  if (!current() || this.row(id)?.state !== "dispatching")
@@ -573,7 +667,7 @@ export class HubRoomAskAdapter {
573
667
  if (saved.local.agent === agent)
574
668
  this.save(row.message_id, "held", saved);
575
669
  }
576
- close() { this.closed = true; this.link = null; this.admitted.clear(); }
670
+ close() { this.closed = true; this.link = null; this.admitted.clear(); this.clockHolds.clear(); }
577
671
  }
578
672
  export function formatRoomAskPrompt(ask, correlationId, locale = "en", { react = false, fileLines = [], maxContextBytes } = {}) {
579
673
  const zh = locale === "zh-TW";