clay-server 5.2.0-beta.1 → 5.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 (552) hide show
  1. package/lib/account-auth-socket.js +1 -0
  2. package/lib/builtin-mates.js +19 -16
  3. package/lib/bundled-skills/clay-agent-browser/SKILL.md +6 -2
  4. package/lib/canonical-clay-record-authority.js +15 -0
  5. package/lib/canonical-clay-scheduling-authority.js +19 -0
  6. package/lib/claude-hook-installer.js +1 -239
  7. package/lib/claude-jsonl-watcher.js +1 -204
  8. package/lib/clay-control-presentation-binding.js +96 -0
  9. package/lib/clay-control-presentation.js +128 -0
  10. package/lib/clay-control-target-projection.js +26 -0
  11. package/lib/clay-mate-chat-receipts.js +26 -0
  12. package/lib/clay-mate-chat.js +88 -0
  13. package/lib/clay-mate-knowledge-input.js +26 -0
  14. package/lib/clay-mate-knowledge.js +95 -0
  15. package/lib/clay-mate-lifecycle.js +95 -0
  16. package/lib/clay-product-control-input.js +33 -0
  17. package/lib/clay-product-control-tools.js +51 -0
  18. package/lib/clay-product-control.js +247 -0
  19. package/lib/clay-project-lifecycle.js +154 -0
  20. package/lib/clay-project-record-input.js +44 -0
  21. package/lib/clay-project-records.js +84 -0
  22. package/lib/clay-scheduling-input.js +21 -0
  23. package/lib/clay-scheduling-receipts.js +26 -0
  24. package/lib/clay-scheduling.js +119 -0
  25. package/lib/clay-screen-controls.js +104 -0
  26. package/lib/clay-skill-install.js +1 -33
  27. package/lib/clay-workspace-controls.js +84 -0
  28. package/lib/clay-workspace-input.js +17 -0
  29. package/lib/clay-workspace-receipts.js +26 -0
  30. package/lib/cli-sessions.js +1 -300
  31. package/lib/codex-defaults.js +1 -28
  32. package/lib/context-usage.js +3 -2
  33. package/lib/contextual-screen-snapshot.js +38 -0
  34. package/lib/daemon-project-access.js +11 -0
  35. package/lib/daemon-project-lifecycle-callbacks.js +15 -0
  36. package/lib/daemon-project-lifecycle.js +262 -0
  37. package/lib/daemon-projects.js +1 -1
  38. package/lib/daemon.js +78 -276
  39. package/lib/default-ai-runtime.js +4 -8
  40. package/lib/dm-digest-cursor.js +120 -0
  41. package/lib/email-mcp-server.js +1 -1
  42. package/lib/issues-service.js +29 -15
  43. package/lib/kiro-defaults.js +1 -22
  44. package/lib/knowledge-db-import-validation.js +46 -0
  45. package/lib/knowledge-db-import.js +99 -0
  46. package/lib/knowledge-db-service.js +24 -33
  47. package/lib/knowledge-db-storage-nedb-maintenance.js +99 -0
  48. package/lib/knowledge-db-storage-nedb.js +66 -0
  49. package/lib/knowledge-db-storage.js +72 -0
  50. package/lib/knowledge-db-validation.js +0 -0
  51. package/lib/knowledge-document-index.js +2 -1
  52. package/lib/knowledge-file-store.js +7 -1
  53. package/lib/knowledge-product-operations.js +46 -0
  54. package/lib/mate-avatar-catalog.js +12 -0
  55. package/lib/mate-avatar-migration.js +41 -0
  56. package/lib/mate-context-service.js +138 -0
  57. package/lib/mate-context-tools.js +21 -0
  58. package/lib/mate-creation-mcp-server.js +2 -0
  59. package/lib/mate-knowledge-canonical-access.js +10 -0
  60. package/lib/mate-knowledge-mate-bound.js +53 -0
  61. package/lib/mate-knowledge-mcp-server.js +55 -8
  62. package/lib/mate-knowledge-service.js +16 -34
  63. package/lib/mate-knowledge-text-tools.js +106 -0
  64. package/lib/mate-lifecycle-service.js +94 -0
  65. package/lib/mate-message-delivery.js +43 -0
  66. package/lib/mate-ready-creation.js +9 -1
  67. package/lib/mate-schedule-input.js +29 -0
  68. package/lib/mate-schedule-lifecycle.js +151 -0
  69. package/lib/mate-scheduling.js +103 -0
  70. package/lib/mates.js +18 -6
  71. package/lib/mcp-agent-tools.js +117 -0
  72. package/lib/mcp-connection-store.js +119 -15
  73. package/lib/mcp-import-credentials.js +31 -0
  74. package/lib/mcp-local-transport.js +13 -0
  75. package/lib/mcp-oauth.js +8 -6
  76. package/lib/mcp-proxy.js +2 -32
  77. package/lib/mcp-query-bridge.js +30 -0
  78. package/lib/mcp-remote-connections.js +74 -20
  79. package/lib/mcp-source-adapters.js +1 -0
  80. package/lib/mcp-source-context.js +1 -0
  81. package/lib/mcp-source-discovery.js +1 -0
  82. package/lib/mcp-source-plugins.js +1 -0
  83. package/lib/mcp-source-restrictions.js +1 -0
  84. package/lib/mcp-tool-policy.js +9 -0
  85. package/lib/notes-checklist.js +50 -0
  86. package/lib/notes.js +49 -3
  87. package/lib/os-user-diagnostics.js +2 -4
  88. package/lib/os-users.js +24 -70
  89. package/lib/pane-pending-interactions.js +20 -0
  90. package/lib/pane-session-activation.js +114 -0
  91. package/lib/pane-session-transport.js +26 -0
  92. package/lib/project-admin-overview.js +51 -0
  93. package/lib/project-ask-user.js +8 -4
  94. package/lib/project-connection.js +14 -10
  95. package/lib/project-control-git-view.js +12 -0
  96. package/lib/project-debate.js +1 -0
  97. package/lib/project-delegated-follow-up.js +2 -1
  98. package/lib/project-directory-claim.js +65 -0
  99. package/lib/project-file-operations.js +61 -0
  100. package/lib/project-filesystem.js +15 -85
  101. package/lib/project-full-access.js +23 -2
  102. package/lib/project-http.js +7 -4
  103. package/lib/project-knowledge.js +32 -18
  104. package/lib/project-lifecycle-operations.js +98 -0
  105. package/lib/project-lifecycle-process-witness.js +32 -0
  106. package/lib/project-lifecycle-runtime.js +50 -0
  107. package/lib/project-linux-access.js +22 -0
  108. package/lib/project-logs-canonical-clay.js +27 -0
  109. package/lib/project-logs-clay-query.js +16 -0
  110. package/lib/project-logs-schema.js +4 -2
  111. package/lib/project-logs-service.js +8 -7
  112. package/lib/project-logs.js +1 -0
  113. package/lib/project-loop.js +1 -0
  114. package/lib/project-mate-chat-control.js +55 -0
  115. package/lib/project-mate-creation-proposal.js +18 -3
  116. package/lib/project-mate-interaction.js +40 -62
  117. package/lib/project-mcp.js +54 -16
  118. package/lib/project-models.js +14 -31
  119. package/lib/project-notifications.js +76 -17
  120. package/lib/project-ownership.js +77 -0
  121. package/lib/project-pair-result-delivery.js +14 -3
  122. package/lib/project-pair-usage.js +12 -13
  123. package/lib/project-pending-message-queue.js +4 -1
  124. package/lib/project-product-control.js +89 -0
  125. package/lib/project-product-session-queue.js +46 -0
  126. package/lib/project-push-access.js +28 -0
  127. package/lib/project-scheduled-message-queue.js +30 -0
  128. package/lib/project-scheduled-messages.js +67 -68
  129. package/lib/project-scheduled-task-control.js +83 -0
  130. package/lib/project-scheduled-tasks.js +13 -2
  131. package/lib/project-scheduling-access.js +10 -0
  132. package/lib/project-session-actions.js +65 -0
  133. package/lib/project-session-delete.js +8 -1
  134. package/lib/project-session-document.js +27 -7
  135. package/lib/project-session-github.js +63 -19
  136. package/lib/project-session-history-actions.js +167 -0
  137. package/lib/project-session-linear.js +14 -6
  138. package/lib/project-session-notes.js +7 -3
  139. package/lib/project-session-pair.js +1 -1
  140. package/lib/project-session-runtime-actions.js +64 -0
  141. package/lib/project-session-spawn.js +2 -3
  142. package/lib/project-session-vendor.js +55 -0
  143. package/lib/project-sessions.js +103 -272
  144. package/lib/project-shared-browser.js +78 -17
  145. package/lib/project-studio-presentation.js +58 -0
  146. package/lib/project-user-message.js +67 -1
  147. package/lib/project-vendor-login.js +6 -36
  148. package/lib/project-workspace-operations.js +126 -0
  149. package/lib/project-workspace-query.js +19 -2
  150. package/lib/project.js +178 -45
  151. package/lib/public/app.js +46 -0
  152. package/lib/public/appearance-bootstrap.js +16 -0
  153. package/lib/public/css/clay-tool-activity.css +51 -0
  154. package/lib/public/css/clay-workspace.css +29 -0
  155. package/lib/public/css/command-palette.css +12 -33
  156. package/lib/public/css/contextual-clay.css +240 -0
  157. package/lib/public/css/home-debate-planning.css +2 -0
  158. package/lib/public/css/home-mate-creation.css +5 -0
  159. package/lib/public/css/input.css +6 -0
  160. package/lib/public/css/mate-avatar-gallery.css +12 -0
  161. package/lib/public/css/mate-conversation.css +10 -5
  162. package/lib/public/css/messages.css +6 -2
  163. package/lib/public/css/overlays.css +4 -2
  164. package/lib/public/css/project-admin-overview.css +13 -0
  165. package/lib/public/css/session-folders.css +11 -0
  166. package/lib/public/css/session-github.css +46 -1
  167. package/lib/public/css/shared-browser.css +35 -1
  168. package/lib/public/css/sticky-notes.css +87 -1
  169. package/lib/public/index.html +11 -5
  170. package/lib/public/mate-avatars/B01.png +0 -0
  171. package/lib/public/mate-avatars/B02.png +0 -0
  172. package/lib/public/mate-avatars/B03.png +0 -0
  173. package/lib/public/mate-avatars/B04.png +0 -0
  174. package/lib/public/mate-avatars/B05.png +0 -0
  175. package/lib/public/mate-avatars/B06.png +0 -0
  176. package/lib/public/mate-avatars/B07.png +0 -0
  177. package/lib/public/mate-avatars/B08.png +0 -0
  178. package/lib/public/mate-avatars/B09.png +0 -0
  179. package/lib/public/mate-avatars/B10.png +0 -0
  180. package/lib/public/mate-avatars/B11.png +0 -0
  181. package/lib/public/mate-avatars/B12.png +0 -0
  182. package/lib/public/mate-avatars/B13.png +0 -0
  183. package/lib/public/mate-avatars/B14.png +0 -0
  184. package/lib/public/mate-avatars/B15.png +0 -0
  185. package/lib/public/mate-avatars/B16.png +0 -0
  186. package/lib/public/mate-avatars/B17.png +0 -0
  187. package/lib/public/mate-avatars/B18.png +0 -0
  188. package/lib/public/mate-avatars/B19.png +0 -0
  189. package/lib/public/mate-avatars/B20.png +0 -0
  190. package/lib/public/mate-avatars/B21.png +0 -0
  191. package/lib/public/mate-avatars/B22.png +0 -0
  192. package/lib/public/mate-avatars/B23.png +0 -0
  193. package/lib/public/mate-avatars/B24.png +0 -0
  194. package/lib/public/mate-avatars/B25.png +0 -0
  195. package/lib/public/mate-avatars/B26.png +0 -0
  196. package/lib/public/mate-avatars/B27.png +0 -0
  197. package/lib/public/mate-avatars/B28.png +0 -0
  198. package/lib/public/mate-avatars/B29.png +0 -0
  199. package/lib/public/mate-avatars/B30.png +0 -0
  200. package/lib/public/mate-avatars/B31.png +0 -0
  201. package/lib/public/mate-avatars/B32.png +0 -0
  202. package/lib/public/mate-avatars/B33.png +0 -0
  203. package/lib/public/mate-avatars/B34.png +0 -0
  204. package/lib/public/mate-avatars/B35.png +0 -0
  205. package/lib/public/mate-avatars/B36.png +0 -0
  206. package/lib/public/mate-avatars/B37.png +0 -0
  207. package/lib/public/mate-avatars/B38.png +0 -0
  208. package/lib/public/mate-avatars/B39.png +0 -0
  209. package/lib/public/mate-avatars/B40.png +0 -0
  210. package/lib/public/mate-avatars/B41.png +0 -0
  211. package/lib/public/mate-avatars/B42.png +0 -0
  212. package/lib/public/mate-avatars/B43.png +0 -0
  213. package/lib/public/mate-avatars/B44.png +0 -0
  214. package/lib/public/mate-avatars/B45.png +0 -0
  215. package/lib/public/mate-avatars/B46.png +0 -0
  216. package/lib/public/mate-avatars/B47.png +0 -0
  217. package/lib/public/mate-avatars/B48.png +0 -0
  218. package/lib/public/mate-avatars/C01.png +0 -0
  219. package/lib/public/mate-avatars/C02.png +0 -0
  220. package/lib/public/mate-avatars/C03.png +0 -0
  221. package/lib/public/mate-avatars/C04.png +0 -0
  222. package/lib/public/mate-avatars/C05.png +0 -0
  223. package/lib/public/mate-avatars/C06.png +0 -0
  224. package/lib/public/mate-avatars/C07.png +0 -0
  225. package/lib/public/mate-avatars/C08.png +0 -0
  226. package/lib/public/mate-avatars/C09.png +0 -0
  227. package/lib/public/mate-avatars/C10.png +0 -0
  228. package/lib/public/mate-avatars/C11.png +0 -0
  229. package/lib/public/mate-avatars/C12.png +0 -0
  230. package/lib/public/mate-avatars/C13.png +0 -0
  231. package/lib/public/mate-avatars/C14.png +0 -0
  232. package/lib/public/mate-avatars/C15.png +0 -0
  233. package/lib/public/mate-avatars/C16.png +0 -0
  234. package/lib/public/mate-avatars/C17.png +0 -0
  235. package/lib/public/mate-avatars/C18.png +0 -0
  236. package/lib/public/mate-avatars/C19.png +0 -0
  237. package/lib/public/mate-avatars/C20.png +0 -0
  238. package/lib/public/mate-avatars/C21.png +0 -0
  239. package/lib/public/mate-avatars/C22.png +0 -0
  240. package/lib/public/mate-avatars/C23.png +0 -0
  241. package/lib/public/mate-avatars/C24.png +0 -0
  242. package/lib/public/mate-avatars/C25.png +0 -0
  243. package/lib/public/mate-avatars/C26.png +0 -0
  244. package/lib/public/mate-avatars/C27.png +0 -0
  245. package/lib/public/mate-avatars/C28.png +0 -0
  246. package/lib/public/mate-avatars/C29.png +0 -0
  247. package/lib/public/mate-avatars/C30.png +0 -0
  248. package/lib/public/mate-avatars/C31.png +0 -0
  249. package/lib/public/mate-avatars/C32.png +0 -0
  250. package/lib/public/mate-avatars/C33.png +0 -0
  251. package/lib/public/mate-avatars/C34.png +0 -0
  252. package/lib/public/mate-avatars/C35.png +0 -0
  253. package/lib/public/mate-avatars/C36.png +0 -0
  254. package/lib/public/mate-avatars/C37.png +0 -0
  255. package/lib/public/mate-avatars/C38.png +0 -0
  256. package/lib/public/mate-avatars/C39.png +0 -0
  257. package/lib/public/mate-avatars/C40.png +0 -0
  258. package/lib/public/mate-avatars/C41.png +0 -0
  259. package/lib/public/mate-avatars/C42.png +0 -0
  260. package/lib/public/mate-avatars/C43.png +0 -0
  261. package/lib/public/mate-avatars/C44.png +0 -0
  262. package/lib/public/mate-avatars/C45.png +0 -0
  263. package/lib/public/mate-avatars/C46.png +0 -0
  264. package/lib/public/mate-avatars/C47.png +0 -0
  265. package/lib/public/mate-avatars/C48.png +0 -0
  266. package/lib/public/mate-avatars/catalog.json +482 -0
  267. package/lib/public/mate-avatars/lead-clay.png +0 -0
  268. package/lib/public/modules/admin-settings-projects.js +6 -2
  269. package/lib/public/modules/app-connection.js +11 -1
  270. package/lib/public/modules/app-favicon.js +18 -9
  271. package/lib/public/modules/app-header.js +7 -4
  272. package/lib/public/modules/app-loop-ui.js +2 -0
  273. package/lib/public/modules/app-message-router.js +22 -1
  274. package/lib/public/modules/app-messages.js +115 -17
  275. package/lib/public/modules/app-misc.js +3 -1
  276. package/lib/public/modules/app-notifications.js +11 -5
  277. package/lib/public/modules/app-panels.js +61 -123
  278. package/lib/public/modules/app-projects.js +13 -0
  279. package/lib/public/modules/app-rate-limit.js +7 -27
  280. package/lib/public/modules/app-rendering.js +4 -3
  281. package/lib/public/modules/avatar.js +15 -41
  282. package/lib/public/modules/chat-render-runtime.js +20 -0
  283. package/lib/public/modules/clay-browser-links.js +47 -0
  284. package/lib/public/modules/clay-control-activity.js +214 -0
  285. package/lib/public/modules/clay-control-copy.js +36 -0
  286. package/lib/public/modules/clay-control-detail-targets.js +44 -0
  287. package/lib/public/modules/clay-control-object-targets.js +52 -0
  288. package/lib/public/modules/clay-control-target-visibility.js +12 -0
  289. package/lib/public/modules/clay-control-targets.js +44 -0
  290. package/lib/public/modules/clay-log-links.js +23 -0
  291. package/lib/public/modules/clay-navigation-render.js +52 -0
  292. package/lib/public/modules/clay-owner-navigation.js +33 -0
  293. package/lib/public/modules/clay-session-links.js +31 -0
  294. package/lib/public/modules/clay-studio-bridge.js +20 -0
  295. package/lib/public/modules/clay-studio-document.js +67 -0
  296. package/lib/public/modules/clay-studio-render.js +146 -0
  297. package/lib/public/modules/clay-tool-activity.js +140 -0
  298. package/lib/public/modules/clay-tool-presentation.js +342 -0
  299. package/lib/public/modules/command-palette.js +162 -40
  300. package/lib/public/modules/contextual-ask-session.js +26 -0
  301. package/lib/public/modules/contextual-clay-geometry.js +155 -0
  302. package/lib/public/modules/contextual-clay-session.js +130 -0
  303. package/lib/public/modules/contextual-clay-workspace.js +169 -0
  304. package/lib/public/modules/contextual-clay.js +250 -0
  305. package/lib/public/modules/contextual-composer.js +91 -0
  306. package/lib/public/modules/contextual-mate-context.js +117 -0
  307. package/lib/public/modules/contextual-mate-hint.js +40 -0
  308. package/lib/public/modules/contextual-mate-identity.js +23 -0
  309. package/lib/public/modules/contextual-mate-sessions.js +134 -0
  310. package/lib/public/modules/contextual-search.js +137 -0
  311. package/lib/public/modules/contextual-session-citations.js +58 -0
  312. package/lib/public/modules/debate.js +1 -0
  313. package/lib/public/modules/default-ai.js +11 -3
  314. package/lib/public/modules/elicitation-form.js +5 -0
  315. package/lib/public/modules/filebrowser.js +20 -1
  316. package/lib/public/modules/generation-stop.js +8 -5
  317. package/lib/public/modules/git-panel.js +3 -1
  318. package/lib/public/modules/history-replay-batch.js +13 -1
  319. package/lib/public/modules/home-debate-live.js +2 -0
  320. package/lib/public/modules/home-debate-planning.js +7 -7
  321. package/lib/public/modules/home-mate-avatar-editor.js +127 -208
  322. package/lib/public/modules/home-mate-chat.js +8 -6
  323. package/lib/public/modules/home-mate-creation.js +73 -1
  324. package/lib/public/modules/home-mate-settings.js +19 -12
  325. package/lib/public/modules/icon-strip-tooltip.js +2 -1
  326. package/lib/public/modules/input.js +88 -10
  327. package/lib/public/modules/issues-render.js +3 -2
  328. package/lib/public/modules/knowledge-db-workbench.js +4 -4
  329. package/lib/public/modules/markdown.js +6 -34
  330. package/lib/public/modules/mate-avatar-catalog.js +97 -0
  331. package/lib/public/modules/mate-knowledge-workbench.js +1 -1
  332. package/lib/public/modules/mate-management.js +40 -7
  333. package/lib/public/modules/mcp-connection-view.js +31 -13
  334. package/lib/public/modules/mcp-discovery-view.js +31 -0
  335. package/lib/public/modules/mcp-ui.js +23 -4
  336. package/lib/public/modules/mention.js +3 -0
  337. package/lib/public/modules/message-delivery.js +20 -2
  338. package/lib/public/modules/model-picker.js +2 -0
  339. package/lib/public/modules/pane-activation.js +214 -0
  340. package/lib/public/modules/pane-binding.js +82 -0
  341. package/lib/public/modules/pane-bridge.js +7 -4
  342. package/lib/public/modules/pane-browser-bridge.js +22 -0
  343. package/lib/public/modules/pane-file-bridge.js +4 -0
  344. package/lib/public/modules/pane-issue-bridge.js +4 -1
  345. package/lib/public/modules/pending-message-queue.js +1 -0
  346. package/lib/public/modules/permission-control.js +5 -4
  347. package/lib/public/modules/personal-settings-dialog.js +7 -1
  348. package/lib/public/modules/product-review.js +26 -0
  349. package/lib/public/modules/profile.js +1 -238
  350. package/lib/public/modules/project-access-recovery.js +17 -0
  351. package/lib/public/modules/project-admin-overview.js +21 -0
  352. package/lib/public/modules/project-chat-identity.js +13 -4
  353. package/lib/public/modules/project-logs-render.js +3 -0
  354. package/lib/public/modules/project-mate-navigation.js +144 -22
  355. package/lib/public/modules/rewind.js +5 -0
  356. package/lib/public/modules/scheduled-tasks.js +2 -0
  357. package/lib/public/modules/scheduler.js +2 -0
  358. package/lib/public/modules/search-clay-chat.js +5 -440
  359. package/lib/public/modules/session-actions.js +5 -2
  360. package/lib/public/modules/session-context-menu.js +5 -0
  361. package/lib/public/modules/session-create-form.js +10 -10
  362. package/lib/public/modules/session-folder-layout.js +1 -1
  363. package/lib/public/modules/session-folder-view-menu.js +9 -0
  364. package/lib/public/modules/session-github.js +85 -14
  365. package/lib/public/modules/session-rich-drafts.js +21 -0
  366. package/lib/public/modules/session-switch-defer.js +67 -0
  367. package/lib/public/modules/session-work-primary.js +51 -0
  368. package/lib/public/modules/settings-defaults.js +27 -28
  369. package/lib/public/modules/shared-browser-settings.js +112 -0
  370. package/lib/public/modules/shared-browser-tabs.js +13 -3
  371. package/lib/public/modules/shared-browser.js +29 -6
  372. package/lib/public/modules/sidebar-mobile.js +4 -3
  373. package/lib/public/modules/sidebar-projects.js +1 -0
  374. package/lib/public/modules/sidebar-session-folders-ui.js +1 -1
  375. package/lib/public/modules/sidebar-sessions.js +1 -0
  376. package/lib/public/modules/split-group-restore.js +68 -0
  377. package/lib/public/modules/split-pair-ui.js +1 -0
  378. package/lib/public/modules/split-pane-reconciler.js +15 -0
  379. package/lib/public/modules/split-pane-renderer.js +87 -6
  380. package/lib/public/modules/split-session-boundary.js +1 -1
  381. package/lib/public/modules/split-view.js +60 -68
  382. package/lib/public/modules/sticky-note-markdown.js +72 -6
  383. package/lib/public/modules/sticky-notes-actions.js +30 -0
  384. package/lib/public/modules/sticky-notes-browser.js +9 -2
  385. package/lib/public/modules/sticky-notes-card.js +23 -7
  386. package/lib/public/modules/sticky-notes-checklist.js +116 -0
  387. package/lib/public/modules/sticky-notes-editor.js +108 -44
  388. package/lib/public/modules/sticky-notes-shared.js +50 -2
  389. package/lib/public/modules/sticky-notes-state.js +66 -0
  390. package/lib/public/modules/sticky-notes.js +34 -51
  391. package/lib/public/modules/stt-controller.js +4 -1
  392. package/lib/public/modules/stt-recording.js +1 -1
  393. package/lib/public/modules/stt.js +7 -2
  394. package/lib/public/modules/terminal.js +9 -0
  395. package/lib/public/modules/theme.js +8 -1
  396. package/lib/public/modules/thinking-lifecycle.js +33 -3
  397. package/lib/public/modules/thinking-view.js +23 -1
  398. package/lib/public/modules/tools.js +60 -11
  399. package/lib/public/modules/tui-grab.js +1 -2
  400. package/lib/public/modules/user-settings-appearance.js +10 -3
  401. package/lib/public/modules/user-settings-editors.js +1 -1
  402. package/lib/public/modules/user-settings-layout.js +11 -2
  403. package/lib/public/modules/user-settings-preferences.js +6 -2
  404. package/lib/public/modules/user-settings-profile.js +12 -2
  405. package/lib/public/modules/user-settings.js +3 -2
  406. package/lib/public/modules/vendor-login-browser.js +5 -3
  407. package/lib/public/modules/vendor-login.js +2 -2
  408. package/lib/public/modules/vendor-priority.js +15 -1
  409. package/lib/public/modules/wireframe-workbench.js +5 -2
  410. package/lib/public/muse-avatar.svg +4 -0
  411. package/lib/public/style.css +5 -0
  412. package/lib/public/sw.js +3 -1
  413. package/lib/safe-bash-commands.js +3 -45
  414. package/lib/scheduled-task-records.js +3 -1
  415. package/lib/scheduler.js +2 -0
  416. package/lib/sdk-bridge.js +342 -401
  417. package/lib/sdk-foreground-admission.js +16 -0
  418. package/lib/sdk-mcp-descriptors.js +2 -37
  419. package/lib/sdk-message-processor.js +52 -17
  420. package/lib/sdk-quota-snapshot.js +1 -1
  421. package/lib/sdk-response-recovery.js +1 -0
  422. package/lib/sdk-worker.js +2 -677
  423. package/lib/server-admin.js +63 -16
  424. package/lib/server-appearance-settings.js +13 -1
  425. package/lib/server-contextual-clay-settings.js +40 -0
  426. package/lib/server-contextual-mate-sessions.js +70 -0
  427. package/lib/server-dm.js +2 -1
  428. package/lib/server-global-ws.js +10 -20
  429. package/lib/server-home-chat-events.js +18 -4
  430. package/lib/server-home-chat.js +22 -20
  431. package/lib/server-home-clay-entry.js +23 -4
  432. package/lib/server-home-clay-session-links.js +29 -9
  433. package/lib/server-home-mate-creation.js +1 -0
  434. package/lib/server-home-mcp-consent.js +14 -0
  435. package/lib/server-mates.js +25 -62
  436. package/lib/server-owner-ui.js +118 -0
  437. package/lib/server-path-access.js +38 -0
  438. package/lib/server-project-removal.js +22 -0
  439. package/lib/server-settings.js +6 -1
  440. package/lib/server.js +163 -43
  441. package/lib/session-config-transition.js +45 -0
  442. package/lib/session-folders.js +7 -2
  443. package/lib/session-fork-history.js +21 -0
  444. package/lib/session-github.js +9 -2
  445. package/lib/session-hygiene.js +3 -35
  446. package/lib/session-permission-mode.js +4 -3
  447. package/lib/session-skill-scope.js +11 -0
  448. package/lib/session-visibility.js +5 -2
  449. package/lib/session-work-primary.js +50 -0
  450. package/lib/sessions.js +64 -99
  451. package/lib/shared-browser-cookie-sync.js +32 -0
  452. package/lib/shared-browser-cookies.js +79 -0
  453. package/lib/shared-browser-runtime.js +25 -9
  454. package/lib/shared-browser-storage-sync.js +43 -0
  455. package/lib/shared-browser-storage.js +101 -0
  456. package/lib/shared-browser-tools.js +2 -1
  457. package/lib/shared-browser-worker.js +46 -10
  458. package/lib/terminal-manager.js +65 -6
  459. package/lib/tool-llm.js +1 -1
  460. package/lib/tui-transcript-index.js +1 -132
  461. package/lib/users-contextual-clay-preferences.js +31 -0
  462. package/lib/users-permissions.js +2 -8
  463. package/lib/users.js +7 -0
  464. package/lib/vendor-login-browser.js +1 -11
  465. package/lib/workspace-assignment-service.js +25 -0
  466. package/lib/workspace-query-access.js +4 -1
  467. package/lib/workspace-query-mcp-server.js +1 -1
  468. package/lib/workspace-query-service.js +13 -2
  469. package/lib/ws-request.js +1 -0
  470. package/lib/ws-schema.js +18 -2
  471. package/lib/yoke/acp-agent-profiles.js +7 -5
  472. package/lib/yoke/adapters/antigravity.js +3 -14
  473. package/lib/yoke/adapters/claude-query-contract.js +9 -0
  474. package/lib/yoke/adapters/claude.js +54 -50
  475. package/lib/yoke/adapters/codex-query-contract.js +24 -0
  476. package/lib/yoke/adapters/codex.js +53 -111
  477. package/lib/yoke/adapters/kiro.js +3 -1
  478. package/lib/yoke/adapters/muse-query-contract.js +7 -0
  479. package/lib/yoke/adapters/muse.js +122 -0
  480. package/lib/yoke/auth-events.js +17 -0
  481. package/lib/yoke/claude-hook-installer.js +271 -0
  482. package/lib/yoke/claude-jsonl-watcher.js +204 -0
  483. package/lib/yoke/claude-maintenance.js +55 -0
  484. package/lib/yoke/claude-permission-patterns.js +53 -0
  485. package/lib/yoke/claude-response-recovery.js +155 -0
  486. package/lib/yoke/claude-transcript-hygiene.js +34 -0
  487. package/lib/yoke/claude-worker-startup.js +28 -0
  488. package/lib/yoke/clay-skill-install.js +33 -0
  489. package/lib/yoke/cli-sessions.js +300 -0
  490. package/lib/yoke/codex-app-server.js +7 -12
  491. package/lib/yoke/codex-idle-recovery.js +81 -1
  492. package/lib/yoke/codex-recovery-admission.js +164 -0
  493. package/lib/yoke/configuration.js +13 -0
  494. package/lib/yoke/discovery.js +70 -0
  495. package/lib/yoke/errors.js +8 -0
  496. package/lib/yoke/host-environment.js +7 -0
  497. package/lib/yoke/index.js +9 -51
  498. package/lib/yoke/interface.js +116 -0
  499. package/lib/yoke/kiro-acp-server.js +5 -5
  500. package/lib/yoke/legacy-sessions.js +89 -0
  501. package/lib/yoke/login-protocol.js +25 -0
  502. package/lib/yoke/maintenance.js +12 -0
  503. package/lib/yoke/mcp-proxy.js +32 -0
  504. package/lib/yoke/mcp-source-adapters.js +91 -0
  505. package/lib/yoke/mcp-source-context.js +42 -0
  506. package/lib/yoke/mcp-source-discovery.js +169 -0
  507. package/lib/yoke/mcp-source-plugins.js +68 -0
  508. package/lib/yoke/mcp-source-restrictions.js +47 -0
  509. package/lib/yoke/mcp-tool-policy-normalize.js +28 -0
  510. package/lib/yoke/model-preferences.js +6 -0
  511. package/lib/yoke/muse-artifacts.js +36 -0
  512. package/lib/yoke/muse-controls.js +50 -0
  513. package/lib/yoke/muse-input.js +64 -0
  514. package/lib/yoke/muse-items.js +157 -0
  515. package/lib/yoke/muse-policy.js +52 -0
  516. package/lib/yoke/muse-query.js +428 -0
  517. package/lib/yoke/muse-runtime.js +211 -0
  518. package/lib/yoke/muse-services.js +79 -0
  519. package/lib/yoke/muse-skills.js +79 -0
  520. package/lib/yoke/muse-turns.js +71 -0
  521. package/lib/yoke/options/acp.js +2 -0
  522. package/lib/yoke/options/antigravity.js +2 -0
  523. package/lib/yoke/options/claude.js +21 -0
  524. package/lib/yoke/options/codex-defaults.js +29 -0
  525. package/lib/yoke/options/codex-settings.js +21 -0
  526. package/lib/yoke/options/codex.js +6 -0
  527. package/lib/yoke/options/kiro-defaults.js +22 -0
  528. package/lib/yoke/options/kiro.js +5 -0
  529. package/lib/yoke/options/muse.js +5 -0
  530. package/lib/yoke/provider-contract.js +5 -0
  531. package/lib/yoke/providers/antigravity-executable.js +8 -0
  532. package/lib/yoke/providers/claude-executable.js +40 -0
  533. package/lib/yoke/providers/claude-model-descriptions.js +14 -0
  534. package/lib/yoke/providers/claude-process.js +97 -0
  535. package/lib/yoke/providers/claude-provision.js +75 -0
  536. package/lib/yoke/providers/codex-errors.js +8 -0
  537. package/lib/yoke/providers/muse-executable.js +17 -0
  538. package/lib/yoke/provisioning.js +6 -0
  539. package/lib/yoke/query-options.js +10 -0
  540. package/lib/yoke/response-recovery.js +41 -0
  541. package/lib/yoke/sdk-mcp-descriptors.js +37 -0
  542. package/lib/yoke/sdk-server-factory.js +7 -0
  543. package/lib/yoke/session-history.js +8 -0
  544. package/lib/yoke/session-tool-transport.js +34 -13
  545. package/lib/yoke/settings.js +23 -0
  546. package/lib/yoke/source-locations.js +4 -0
  547. package/lib/yoke/title-query.js +18 -7
  548. package/lib/yoke/tui-transcript-index.js +132 -0
  549. package/lib/yoke/usage.js +48 -0
  550. package/lib/yoke/user-input.js +13 -0
  551. package/lib/yoke/vendor-registry.js +81 -1
  552. package/package.json +10 -4
@@ -103,7 +103,8 @@ function renderFileRow(file, staged) {
103
103
  var actionTitle = staged ? "Unstage file — keep its changes" : "Stage file for commit";
104
104
  var actionIcon = staged ? "minus" : "plus";
105
105
  var actionsOpen = expandedFileActionsPath === file.path;
106
- return '<div class="git-file-row' + (actionsOpen ? ' active' : '') + '">' +
106
+ var control = currentStatus && currentStatus.controlView, view = control && control.files.find(function (item) { return item.path === file.path; });
107
+ return '<div data-control-git-path="' + escapeHtml(file.path) + '" data-control-revision="' + escapeHtml(view && view.revision || '') + '" data-control-runtime="' + escapeHtml(control && control.runtimeId || '') + '" class="git-file-row' + (actionsOpen ? ' active' : '') + '">' +
107
108
  '<span class="git-file-status' + statusClass + '">' + escapeHtml(fileStatusLabel(file, staged)) + '</span>' +
108
109
  '<div class="git-file-main" data-git-file-item="' + pathKey + '" tabindex="0" aria-label="File actions for ' + escapeHtml(parts.name) + '" aria-expanded="' + (actionsOpen ? 'true' : 'false') + '">' +
109
110
  '<div class="git-file-name">' + escapeHtml(parts.name) + '</div>' +
@@ -282,6 +283,7 @@ export function refreshGitStatus() {
282
283
  return requestJson(basePath + "api/git/status", { cache: "no-store" }).then(function (status) {
283
284
  if (statusBasePath !== basePath) return status;
284
285
  currentStatus = status;
286
+ store.set({ clayControlGitView: status.controlView ? Object.assign({ projectSlug: store.get('currentSlug') }, status.controlView) : null });
285
287
  if (expandedFileActionsPath && !status.files.some(function (file) { return file.path === expandedFileActionsPath; })) {
286
288
  expandedFileActionsPath = null;
287
289
  }
@@ -27,7 +27,15 @@ function canCombine(previous, message) {
27
27
  // can differ; the first token still supplies the message's display time.
28
28
  var keys = Object.keys(previous).concat(Object.keys(message));
29
29
  return keys.every(function (key) {
30
- return key === 'text' || key === '_ts' || previous[key] === message[key];
30
+ // Socket JSON gives each event its own activation object. Compare every
31
+ // field, including future metadata, without weakening replay boundaries.
32
+ if (key === 'paneActivation' && previous[key] && message[key]) {
33
+ var before = previous[key], after = message[key];
34
+ return Object.keys(before).concat(Object.keys(after)).every(function (field) {
35
+ return before[field] === after[field];
36
+ });
37
+ }
38
+ return key === 'text' || key === '_ts' || key === '_historyIndex' || key === '_historyIndexes' || previous[key] === message[key];
31
39
  });
32
40
  }
33
41
 
@@ -105,6 +113,10 @@ export function receiveHistoryReplay(msg, dispatch) {
105
113
  if (canCombine(previous, msg)) {
106
114
  if (!batch.textParts) batch.textParts = [previous.text];
107
115
  batch.textParts.push(msg.text);
116
+ if (Number.isSafeInteger(msg._historyIndex) && msg._historyIndex >= 0) {
117
+ if (!previous._historyIndexes) previous._historyIndexes = Number.isSafeInteger(previous._historyIndex) ? [previous._historyIndex] : [];
118
+ previous._historyIndexes.push(msg._historyIndex);
119
+ }
108
120
  } else {
109
121
  finishText(batch);
110
122
  batch.items.push(Object.assign({}, msg));
@@ -23,6 +23,7 @@ function debateIdentity(message, prior) {
23
23
  return {
24
24
  mateId: message.speakerMateId || message.mateId || previous.mateId || null,
25
25
  mateName: name,
26
+ avatarCatalogId: message.avatarCatalogId || previous.avatarCatalogId || cachedProfile.avatarCatalogId || "",
26
27
  avatarStyle: message.avatarStyle || previous.avatarStyle || cachedProfile.avatarStyle || "imprint",
27
28
  avatarSeed: message.avatarSeed || previous.avatarSeed || cachedProfile.avatarSeed || message.speakerMateId || message.mateId || name,
28
29
  avatarColor: message.avatarColor || previous.avatarColor || cachedProfile.avatarColor || "",
@@ -37,6 +38,7 @@ function mateForTurn(message) {
37
38
  name: identity.mateName,
38
39
  profile: {
39
40
  displayName: identity.mateName,
41
+ avatarCatalogId: identity.avatarCatalogId,
40
42
  avatarStyle: identity.avatarStyle,
41
43
  avatarSeed: identity.avatarSeed,
42
44
  avatarColor: identity.avatarColor,
@@ -123,11 +123,11 @@ export function createHomeDebateProposalCard(message, respond) {
123
123
  export function createHomeDebateQuestionCard(message, respond) {
124
124
  var question = Array.isArray(message.questions) && message.questions.length ? message.questions[0] : {};
125
125
  var card = document.createElement("section");
126
- card.className = "home-debate-question";
126
+ card.className = "home-debate-question" + (message.flow === "mcp_import" ? " mcp-import-consent" : "");
127
127
  card.dataset.toolId = message.toolId || "";
128
128
  card.setAttribute("aria-busy", message.status === "submitting" ? "true" : "false");
129
- var isMateCreation = message.flow === "mate_creation";
130
- card.setAttribute("aria-label", (isMateCreation ? "Mate creation interview question: " : "Debate planning question: ") + (question.question || "Question"));
129
+ var isMateQuestion = message.flow === "mate_question", isMateCreation = message.flow === "mate_creation", isMcpImport = message.flow === "mcp_import";
130
+ card.setAttribute("aria-label", (isMateQuestion ? "Mate question: " : isMcpImport ? "MCP import consent: " : isMateCreation ? "Mate creation interview question: " : "Debate planning question: ") + (question.question || "Question"));
131
131
  if (question.header) card.appendChild(textElement("div", "home-debate-question-header", question.header));
132
132
  card.appendChild(textElement("h3", "home-debate-question-text", question.question || "Clay has a question."));
133
133
  var form = document.createElement("div");
@@ -162,8 +162,8 @@ export function createHomeDebateQuestionCard(message, respond) {
162
162
  answerControl.className = freeform ? "home-debate-question-freeform" : "home-debate-question-other";
163
163
  answerControl.placeholder = freeform ? (isMateCreation ? "Describe what you want in your own words" : "Describe the topic in your own words") : "Type another answer";
164
164
  answerLabel.appendChild(answerControl);
165
- form.appendChild(answerLabel);
166
- var submit = textElement("button", "home-debate-question-submit", message.status === "submitting" ? "Submitting…" : "Submit answer");
165
+ if (freeform || question.allowOther !== false) form.appendChild(answerLabel);
166
+ var submit = textElement("button", "home-debate-question-submit", message.status === "submitting" ? "Submitting…" : (isMcpImport || isMateQuestion) ? "Confirm choice" : "Submit answer");
167
167
  submit.type = "button";
168
168
  submit.disabled = message.status !== "pending" || !selected;
169
169
  function submitAnswer() {
@@ -253,7 +253,7 @@ export function normalizeHomeTranscript(raw) {
253
253
  export function applyHomeDebateQuestion(messages, msg) {
254
254
  if (!msg || !msg.toolId) return messages;
255
255
  for (var i = 0; i < messages.length; i++) if (messages[i].role === "question" && messages[i].toolId === msg.toolId) return messages;
256
- return messages.concat([{ role: "question", flow: msg.type === "home_mate_creation_question" ? "mate_creation" : "debate", toolId: msg.toolId, questions: msg.questions || [], status: "pending", error: "" }]);
256
+ return messages.concat([{ role: "question", flow: msg.type === "home_mate_question" ? "mate_question" : msg.type === "home_mcp_import_question" ? "mcp_import" : msg.type === "home_mate_creation_question" ? "mate_creation" : "debate", toolId: msg.toolId, questions: msg.questions || [], status: "pending", error: "" }]);
257
257
  }
258
258
 
259
259
  export function resolveHomeDebateQuestion(messages, msg) {
@@ -296,7 +296,7 @@ export function markHomeDebateQuestionSubmitting(message, opener) {
296
296
  export function createHomeDebateResponder(sendMessage, getContext, onChange) {
297
297
  return function respond(message, action, opener, answers, modelOverrides) {
298
298
  if (!message || message.status === "submitting") return;
299
- var payload = message.role === "question" ? { type: message.flow === "mate_creation" ? "home_mate_creation_question_response" : "home_debate_question_response", toolId: message.toolId, answers: answers || {} } : { type: "home_debate_proposal_response", proposalId: message.proposal.proposalId, action: action, modelOverrides: Array.isArray(modelOverrides) ? modelOverrides : [] };
299
+ var payload = message.role === "question" ? { type: message.flow === "mate_question" ? "home_mate_question_response" : message.flow === "mcp_import" ? "home_mcp_import_response" : message.flow === "mate_creation" ? "home_mate_creation_question_response" : "home_debate_question_response", toolId: message.toolId, answers: answers || {} } : { type: "home_debate_proposal_response", proposalId: message.proposal.proposalId, action: action, modelOverrides: Array.isArray(modelOverrides) ? modelOverrides : [] };
300
300
  Object.assign(payload, getContext());
301
301
  if (!sendMessage(payload)) return;
302
302
  if (message.role === "question") markHomeDebateQuestionSubmitting(message, opener);
@@ -1,228 +1,147 @@
1
- // Mate avatar choices hosted inside the current settings dialog.
2
-
3
- import { mateStyleAvatarUrl, mateAvatarUrl, MATE_AVATAR_STYLES } from './avatar.js';
1
+ // Explicit avatar drafts in the existing owner-scoped Mate settings surface.
2
+ import { mateAvatarUrl, mateCatalogAvatarUrl } from './avatar.js';
4
3
  import { showAvatarPositioner } from './profile.js';
5
4
  import { getWs } from './ws-ref.js';
6
5
  import { store } from './store.js';
6
+ import { MATE_AVATAR_COLLECTIONS } from './mate-avatar-catalog.js';
7
7
 
8
- var activeToken = 0;
9
- var activeMateId = null;
10
- var pending = null;
11
- var statusByMate = Object.create(null);
12
- var draftByMate = Object.create(null);
13
-
14
- function mateName(mate) {
15
- var profile = mate && mate.profile ? mate.profile : {};
16
- return profile.displayName || (mate && (mate.displayName || mate.name)) || 'Mate';
17
- }
18
-
19
- function mateProfile(mate) {
20
- return Object.assign({}, mate && mate.profile ? mate.profile : {});
8
+ var timer = null;
9
+ function state() { return store.get('mateAvatarDraft'); }
10
+ function put(value) { store.set({ mateAvatarDraft: value }); }
11
+ function profile(mate) { return Object.assign({}, mate.profile || {}); }
12
+ function currentMate(mate) {
13
+ return (store.get('cachedMatesList') || []).find(function (item) { return item.id === mate.id; }) || mate;
21
14
  }
22
-
23
- function sendProfile(mate, profile, rerender, message) {
24
- draftByMate[mate.id] = profile;
25
- var ws = getWs();
26
- if (!ws || ws.readyState !== 1) {
27
- statusByMate[mate.id] = { kind: 'error', text: 'Clay is offline. Your choice was not saved.' };
28
- rerender();
29
- return false;
15
+ function ensure(mate) {
16
+ var s = state();
17
+ if (!s || s.mateId !== mate.id) {
18
+ s = { mateId: mate.id, selected: (mate.profile || {}).avatarCatalogId || '', dirty: false, requestId: null, error: '', saved: false, uploading: false };
19
+ put(s);
20
+ } else if (!s.dirty && !s.requestId && !s.uploading && s.selected !== ((mate.profile || {}).avatarCatalogId || '')) {
21
+ s = Object.assign({}, s, { selected: (mate.profile || {}).avatarCatalogId || '' }); put(s);
30
22
  }
31
- pending = { mateId: mate.id, style: profile.avatarStyle || 'imprint', seed: profile.avatarSeed || '', custom: profile.avatarCustom || '' };
32
- statusByMate[mate.id] = { kind: 'pending', text: message || 'Saving avatar…' };
33
- ws.send(JSON.stringify({ type: 'mate_update', mateId: mate.id, updates: { profile: profile } }));
34
- rerender();
35
- return true;
36
- }
37
-
38
- function appendStatus(body, mate) {
39
- var state = statusByMate[mate.id];
40
- var status = document.createElement('div');
41
- status.className = 'home-mate-avatar-status' + (state ? ' is-' + state.kind : '');
42
- status.setAttribute('aria-live', 'polite');
43
- status.textContent = state ? state.text : '';
44
- body.appendChild(status);
23
+ return s;
45
24
  }
46
-
47
- function createChoice(label, src, selected) {
48
- var button = document.createElement('button');
49
- button.type = 'button';
50
- button.className = 'home-mate-avatar-choice';
51
- button.setAttribute('aria-label', label + ' avatar');
52
- button.setAttribute('aria-pressed', selected ? 'true' : 'false');
53
- button.title = label;
54
- var image = document.createElement('img');
55
- image.src = src;
56
- image.alt = '';
57
- image.draggable = false;
58
- var text = document.createElement('span');
59
- text.textContent = label;
60
- button.appendChild(image);
61
- button.appendChild(text);
62
- return button;
25
+ function button(label, id, action) {
26
+ var b = document.createElement('button');
27
+ b.type = 'button'; b.textContent = label; b.id = id;
28
+ b.addEventListener('click', action);
29
+ return b;
63
30
  }
64
-
65
- function selectStyle(mate, style, seed, rerender) {
66
- var profile = mateProfile(mate);
67
- profile.avatarStyle = style;
68
- profile.avatarSeed = seed;
69
- profile.avatarCustom = '';
70
- sendProfile(mate, profile, rerender);
31
+ function closePicker(render) {
32
+ clearHomeMateAvatarEditor();
33
+ store.set({ mateSettingsAvatarOpen: false }); render();
34
+ var opener = document.getElementById('mate-profile-avatar');
35
+ if (opener) opener.focus();
71
36
  }
72
-
73
- function uploadBlob(mate, blob, token, rerender) {
74
- pending = null;
75
- statusByMate[mate.id] = { kind: 'pending', text: 'Uploading image…' };
76
- rerender();
77
- blob.arrayBuffer().then(function (buffer) {
78
- return fetch('/api/mate-avatar/' + encodeURIComponent(mate.id), {
79
- method: 'POST',
80
- headers: { 'Content-Type': 'application/octet-stream' },
81
- body: new Uint8Array(buffer),
82
- });
83
- }).then(function (response) {
84
- return response.json().then(function (data) {
85
- if (!response.ok || !data.ok || !data.avatar) throw new Error(data.error || 'Upload failed');
86
- return data.avatar;
87
- });
88
- }).then(function (avatar) {
89
- if (token !== activeToken) return;
90
- var profile = mateProfile(mate);
91
- profile.avatarCustom = avatar;
92
- draftByMate[mate.id] = profile;
93
- statusByMate[mate.id] = { kind: 'saved', text: 'Image saved.' };
94
- var mates = store.get('cachedMatesList') || [];
95
- store.set({ cachedMatesList: mates.map(function (item) {
96
- return item && item.id === mate.id ? Object.assign({}, item, { profile: profile }) : item;
97
- }) });
98
- var ws = getWs();
99
- if (ws && ws.readyState === 1) {
100
- ws.send(JSON.stringify({ type: 'mate_update', mateId: mate.id, updates: { profile: profile } }));
101
- }
102
- rerender();
103
- }).catch(function (error) {
104
- if (token !== activeToken) return;
105
- statusByMate[mate.id] = { kind: 'error', text: error && error.message ? error.message : 'Could not upload this image.' };
106
- rerender();
107
- });
37
+ function save(mate, render) {
38
+ var s = state(); var ws = getWs();
39
+ if (!s || s.requestId || !s.dirty) return;
40
+ if (!ws || ws.readyState !== 1) { put(Object.assign({}, s, { error: 'Clay is offline. Your choice was not saved.' })); render(); return; }
41
+ var requestId = 'mate-avatar-' + Date.now() + '-' + Math.random().toString(36).slice(2);
42
+ var p = profile(currentMate(mate)); p.avatarCatalogId = s.selected; p.avatarCustom = '';
43
+ put(Object.assign({}, s, { requestId: requestId, error: '', saved: false })); render();
44
+ try { ws.send(JSON.stringify({ type: 'mate_update', mateId: mate.id, requestId: requestId, updates: { profile: p } })); }
45
+ catch (error) { failHomeMateAvatar(mate.id, 'Could not send your choice. Try again.', requestId); render(); return; }
46
+ clearTimeout(timer);
47
+ timer = setTimeout(function () { if (failHomeMateAvatar(mate.id, 'No response received. Your choice is retained; try again.', requestId)) render(); }, 15000);
108
48
  }
109
-
110
- function openUpload(mate, input, rerender) {
111
- var file = input.files && input.files[0];
112
- if (!file) return;
113
- var token = ++activeToken;
114
- var image = new Image();
115
- var objectUrl = URL.createObjectURL(file);
49
+ function upload(mate, input, render) {
50
+ var file = input.files && input.files[0]; if (!file) return;
51
+ var image = new Image(); var url = URL.createObjectURL(file); var originalState = state();
52
+ image.onerror = function () {
53
+ URL.revokeObjectURL(url);
54
+ if (state() === originalState) { put(Object.assign({}, originalState, { error: 'Could not read this image.' })); render(); }
55
+ };
116
56
  image.onload = function () {
117
- if (token !== activeToken) {
118
- URL.revokeObjectURL(objectUrl);
119
- return;
120
- }
121
- showAvatarPositioner(image, objectUrl, function (blob) {
122
- URL.revokeObjectURL(objectUrl);
123
- if (token === activeToken) uploadBlob(mate, blob, token, rerender);
57
+ if (state() !== originalState) { URL.revokeObjectURL(url); return; }
58
+ showAvatarPositioner(image, url, function (blob) {
59
+ URL.revokeObjectURL(url);
60
+ if (state() !== originalState) return;
61
+ var uploadingState = Object.assign({}, originalState, { uploading: true, error: '' }); put(uploadingState); render();
62
+ blob.arrayBuffer().then(function (buffer) {
63
+ return fetch('/api/mate-avatar/' + encodeURIComponent(mate.id), { method: 'POST', headers: { 'Content-Type': 'application/octet-stream' }, body: new Uint8Array(buffer) });
64
+ }).then(function (response) {
65
+ return response.json().then(function (data) { if (!response.ok || !data.ok || !data.avatar) throw new Error(data.error || 'Upload failed.'); return data.avatar; });
66
+ }).then(function (avatar) {
67
+ if (state() !== uploadingState) return;
68
+ var p = profile(currentMate(mate)); p.avatarCustom = avatar;
69
+ store.set({ cachedMatesList: (store.get('cachedMatesList') || []).map(function (item) { return item.id === mate.id ? Object.assign({}, item, { profile: p }) : item; }) });
70
+ put(Object.assign({}, uploadingState, { uploading: false, dirty: false, saved: true }));
71
+ // The HTTP upload is persisted; the update also refreshes other owner tabs.
72
+ var ws = getWs();
73
+ if (ws && ws.readyState === 1) {
74
+ try { ws.send(JSON.stringify({ type: 'mate_update', mateId: mate.id, updates: { profile: p } })); }
75
+ catch (error) { /* The acknowledged upload remains saved. */ }
76
+ }
77
+ render();
78
+ }).catch(function (error) {
79
+ if (state() !== uploadingState) return;
80
+ put(Object.assign({}, uploadingState, { uploading: false, error: error.message || 'Could not upload this image.' })); render();
81
+ });
124
82
  });
125
83
  };
126
- image.onerror = function () {
127
- URL.revokeObjectURL(objectUrl);
128
- if (token !== activeToken) return;
129
- statusByMate[mate.id] = { kind: 'error', text: 'Could not read this image.' };
130
- rerender();
131
- };
132
- image.src = objectUrl;
84
+ image.src = url;
133
85
  }
134
-
135
- export function renderHomeMateAvatarEditor(body, mate, rerender) {
86
+ export function renderHomeMateAvatarEditor(body, mate, render, onCancel) {
136
87
  if (!mate) return;
137
- if (activeMateId !== mate.id) {
138
- activeMateId = mate.id;
139
- activeToken++;
140
- }
141
- var profile = draftByMate[mate.id] || mateProfile(mate);
142
- var name = mateName(mate);
143
- var style = profile.avatarStyle || 'imprint';
144
- var seed = profile.avatarSeed || mate.id || name;
145
- var locked = profile.avatarLocked === true;
146
- var section = document.createElement('section');
147
- section.className = 'home-mate-avatar-editor';
148
- var heading = document.createElement('div');
149
- heading.className = 'home-mate-avatar-heading';
150
- var preview = document.createElement('img');
151
- preview.className = 'home-mate-avatar-preview';
152
- preview.src = mateAvatarUrl(Object.assign({}, mate, { profile: profile }), 72);
153
- preview.alt = name + ' avatar';
154
- var copy = document.createElement('div');
155
- var title = document.createElement('h3');
156
- title.textContent = 'Avatar';
157
- var note = document.createElement('p');
158
- note.textContent = locked ? 'This built-in avatar is managed by Clay.' : 'Choose a locally generated style or upload your own image.';
159
- copy.appendChild(title);
160
- copy.appendChild(note);
161
- heading.appendChild(preview);
162
- heading.appendChild(copy);
163
- section.appendChild(heading);
164
- if (!locked) {
165
- var choices = document.createElement('div');
166
- choices.className = 'home-mate-avatar-choices';
167
- choices.setAttribute('role', 'group');
168
- choices.setAttribute('aria-label', 'Avatar for ' + name);
169
- for (var i = 0; i < MATE_AVATAR_STYLES.length; i++) {
170
- (function (entry) {
171
- var choice = createChoice(entry.name, mateStyleAvatarUrl(entry.id, seed, 48), !profile.avatarCustom && style === entry.id);
172
- choice.addEventListener('click', function () { selectStyle(mate, entry.id, seed, rerender); });
173
- choices.appendChild(choice);
174
- })(MATE_AVATAR_STYLES[i]);
175
- }
176
- section.appendChild(choices);
177
- var actions = document.createElement('div');
178
- actions.className = 'home-mate-avatar-actions';
179
- var shuffle = document.createElement('button');
180
- shuffle.type = 'button';
181
- shuffle.textContent = 'Shuffle selected style';
182
- shuffle.disabled = style === 'imprint' || style === 'initial' || !!profile.avatarCustom;
183
- shuffle.addEventListener('click', function () {
184
- selectStyle(mate, style, Math.random().toString(36).substring(2, 10), rerender);
88
+ var s = ensure(mate); var p = profile(mate); var busy = !!s.requestId || s.uploading;
89
+ var section = document.createElement('section'); section.className = 'home-mate-avatar-editor';
90
+ var preview = document.createElement('div'); preview.className = 'home-mate-avatar-selection';
91
+ var image = document.createElement('img'); image.className = 'home-mate-avatar-preview';
92
+ image.src = s.dirty ? mateCatalogAvatarUrl(s.selected) : mateAvatarUrl(mate, 52); image.alt = 'Avatar preview';
93
+ var caption = document.createElement('p'); caption.textContent = s.dirty ? 'Preview' : 'Current avatar';
94
+ preview.appendChild(image); preview.appendChild(caption); section.appendChild(preview);
95
+ if (!p.avatarLocked) {
96
+ MATE_AVATAR_COLLECTIONS.forEach(function (collection) {
97
+ var family = collection.id;
98
+ var heading = document.createElement('h4'); heading.textContent = collection.name;
99
+ heading.id = 'mate-avatar-family-' + family; section.appendChild(heading);
100
+ var grid = document.createElement('div'); grid.className = 'home-mate-avatar-choices';
101
+ grid.setAttribute('role', 'group'); grid.setAttribute('aria-labelledby', heading.id);
102
+ collection.avatars.forEach(function (entry) {
103
+ var id = entry.id;
104
+ var choice = button(id, 'mate-avatar-' + id, function () {
105
+ put(Object.assign({}, state(), { selected: id, dirty: id !== (currentMate(mate).profile || {}).avatarCatalogId || !!(currentMate(mate).profile || {}).avatarCustom, error: '', saved: false }));
106
+ render(); var target = document.getElementById('mate-avatar-' + id); if (target) target.focus({ preventScroll: true });
107
+ });
108
+ choice.textContent = ''; choice.className = 'home-mate-avatar-choice'; choice.disabled = busy;
109
+ choice.setAttribute('aria-label', entry.name + ' avatar'); choice.title = entry.name; choice.setAttribute('aria-pressed', String(s.selected === id && (s.dirty || !p.avatarCustom)));
110
+ var img = document.createElement('img'); img.src = mateCatalogAvatarUrl(id); img.alt = ''; img.draggable = false;
111
+ choice.appendChild(img);
112
+ choice.addEventListener('keydown', function (event) {
113
+ var buttons = Array.from(grid.querySelectorAll('button')); var index = buttons.indexOf(choice);
114
+ var columns = getComputedStyle(grid).gridTemplateColumns.split(' ').length;
115
+ var offset = { ArrowRight: 1, ArrowLeft: -1, ArrowDown: columns, ArrowUp: -columns }[event.key];
116
+ if (offset !== undefined || event.key === 'Home' || event.key === 'End') {
117
+ event.preventDefault(); var next = event.key === 'Home' ? 0 : event.key === 'End' ? 47 : Math.max(0, Math.min(47, index + offset)); buttons[next].focus();
118
+ }
119
+ });
120
+ grid.appendChild(choice);
121
+ });
122
+ section.appendChild(grid);
185
123
  });
186
- var upload = document.createElement('button');
187
- upload.type = 'button';
188
- upload.textContent = profile.avatarCustom ? 'Replace image' : 'Upload image';
189
- var input = document.createElement('input');
190
- input.type = 'file';
191
- input.accept = 'image/png,image/jpeg,image/gif,image/webp';
192
- input.className = 'home-mate-avatar-file-input';
193
- input.hidden = true;
194
- input.tabIndex = -1;
195
- input.setAttribute('aria-hidden', 'true');
196
- input.addEventListener('change', function () { openUpload(mate, input, rerender); });
197
- upload.addEventListener('click', function () { input.click(); });
198
- actions.appendChild(shuffle);
199
- actions.appendChild(upload);
200
- actions.appendChild(input);
201
- section.appendChild(actions);
124
+ var actions = document.createElement('div'); actions.className = 'home-mate-avatar-actions';
125
+ var cancel = button('Cancel', 'mate-avatar-cancel', function () { if (onCancel) onCancel(); else closePicker(render); }); cancel.disabled = busy;
126
+ var saveButton = button('Save avatar', 'mate-avatar-save', function () { save(mate, render); }); saveButton.disabled = busy || !s.dirty;
127
+ saveButton.className = 'primary';
128
+ var input = document.createElement('input'); input.type = 'file'; input.accept = 'image/png,image/jpeg,image/gif,image/webp'; input.hidden = true; input.tabIndex = -1;
129
+ input.className = 'home-mate-avatar-file-input'; input.addEventListener('change', function () { upload(mate, input, render); });
130
+ var uploadButton = button('Upload image', 'mate-avatar-upload', function () { input.click(); }); uploadButton.disabled = busy;
131
+ actions.appendChild(cancel); actions.appendChild(saveButton); actions.appendChild(uploadButton); actions.appendChild(input); section.appendChild(actions);
202
132
  }
203
- appendStatus(section, mate);
204
- body.appendChild(section);
133
+ var status = document.createElement('p'); status.className = 'home-mate-avatar-status' + (s.error ? ' is-error' : '');
134
+ status.setAttribute('aria-live', 'polite'); status.setAttribute('role', s.error ? 'alert' : 'status'); status.textContent = s.error || (s.requestId ? 'Saving avatar…' : s.uploading ? 'Uploading image…' : s.saved ? 'Avatar saved.' : 'Choose a face, then save.');
135
+ (actions || section).appendChild(status); body.appendChild(section);
205
136
  }
206
-
207
- export function confirmHomeMateAvatar(mate) {
208
- if (!mate || !pending || pending.mateId !== mate.id) return false;
209
- var profile = mateProfile(mate);
210
- if ((profile.avatarStyle || 'imprint') !== pending.style || (profile.avatarSeed || '') !== pending.seed || (profile.avatarCustom || '') !== pending.custom) return false;
211
- pending = null;
212
- delete draftByMate[mate.id];
213
- statusByMate[mate.id] = { kind: 'saved', text: 'Avatar saved.' };
214
- return true;
137
+ export function hasHomeMateAvatarDraft() { var s = state(); return !!s && s.dirty; }
138
+ export function homeMateAvatarSaving() { var s = state(); return !!s && (!!s.requestId || s.uploading); }
139
+ export function confirmHomeMateAvatar(mate, requestId) {
140
+ var s = state(); if (!mate || !s || s.mateId !== mate.id || !s.requestId || s.requestId !== requestId || (mate.profile || {}).avatarCatalogId !== s.selected) return false;
141
+ clearTimeout(timer); put(Object.assign({}, s, { requestId: null, dirty: false, saved: true, error: '' })); return true;
215
142
  }
216
-
217
- export function failHomeMateAvatar(mateId, message) {
218
- if (!pending || !mateId || pending.mateId !== mateId) return false;
219
- statusByMate[pending.mateId] = { kind: 'error', text: message || 'Could not save this avatar.' };
220
- pending = null;
221
- return true;
222
- }
223
-
224
- export function clearHomeMateAvatarEditor() {
225
- activeToken++;
226
- activeMateId = null;
227
- pending = null;
143
+ export function failHomeMateAvatar(mateId, message, requestId) {
144
+ var s = state(); if (!s || !s.requestId || s.mateId !== mateId || s.requestId !== requestId) return false;
145
+ clearTimeout(timer); put(Object.assign({}, s, { requestId: null, error: message || 'Could not save this avatar.' })); return true;
228
146
  }
147
+ export function clearHomeMateAvatarEditor() { clearTimeout(timer); put(null); }
@@ -340,24 +340,26 @@ export function handleHomeDebateTranscript(msg) {
340
340
  if (!isCurrentSessionMessage(msg)) return;
341
341
  markHomeChatActivity();
342
342
  settleHomeDebateLaunch(msg);
343
- if (msg.type === "home_debate_proposal" || msg.type === "home_debate_question" || msg.type === "home_debate_event" || msg.type === "home_mate_creation_proposal" || msg.type === "home_mate_creation_question") messages = finalizeHomeAssistant(messages, streamingText, "", Date.now());
343
+ var questionMessage = ["home_debate_question", "home_mcp_import_question", "home_mate_question"].indexOf(msg.type) >= 0;
344
+ var questionResolved = ["home_debate_question_resolved", "home_mcp_import_question_resolved", "home_mate_question_resolved"].indexOf(msg.type) >= 0;
345
+ if (msg.type === "home_debate_proposal" || questionMessage || msg.type === "home_debate_event" || msg.type === "home_mate_creation_proposal" || msg.type === "home_mate_creation_question") messages = finalizeHomeAssistant(messages, streamingText, "", Date.now());
344
346
  if (msg.type === "home_debate_event") messages = applyHomeDebateEvent(messages, msg);
345
347
  if (msg.type === "home_debate_proposal") messages = applyHomeDebateProposal(messages, msg);
346
348
  if (msg.type === "home_debate_proposal_resolved") messages = resolveHomeDebateProposal(messages, msg);
347
- if (msg.type === "home_debate_question") messages = applyHomeDebateQuestion(messages, msg);
348
- if (msg.type === "home_debate_question_resolved") messages = resolveHomeDebateQuestion(messages, msg);
349
+ if (questionMessage) messages = applyHomeDebateQuestion(messages, msg);
350
+ if (questionResolved) messages = resolveHomeDebateQuestion(messages, msg);
349
351
  if (msg.type === "home_mate_creation_question") messages = applyHomeDebateQuestion(messages, msg);
350
352
  if (msg.type === "home_mate_creation_question_resolved") messages = resolveHomeDebateQuestion(messages, msg);
351
353
  if (msg.type === "home_mate_creation_proposal") messages = applyHomeMateProposal(messages, msg);
352
354
  if (msg.type === "home_mate_creation_proposal_resolved") messages = resolveHomeMateProposal(messages, msg);
353
355
  if (msg.type === "home_mate_error" && /^question_/.test(msg.code || "")) messages = failHomeDebateQuestion(messages, msg);
354
- if (msg.type === "home_debate_proposal" || msg.type === "home_debate_question" || msg.type === "home_debate_event" || msg.type === "home_mate_creation_proposal" || msg.type === "home_mate_creation_question") { clearHomeDebatePlanningPending(); streaming = false; streamingText = ""; }
355
- if ((msg.type === "home_debate_question_resolved" || msg.type === "home_mate_creation_question_resolved") && msg.status === "expired") clearHomeDebatePlanningPending();
356
+ if (msg.type === "home_debate_proposal" || questionMessage || msg.type === "home_debate_event" || msg.type === "home_mate_creation_proposal" || msg.type === "home_mate_creation_question") { clearHomeDebatePlanningPending(); streaming = false; streamingText = ""; }
357
+ if ((questionResolved || msg.type === "home_mate_creation_question_resolved") && msg.status === "expired") clearHomeDebatePlanningPending();
356
358
  renderHomeChat();
357
359
  if (msg.proposalId) restoreHomeDebateProposalFocus(msg.proposalId);
358
360
  if (msg.proposalId && msg.type === "home_mate_creation_proposal_resolved") restoreHomeMateProposalFocus(msg.proposalId);
359
361
  if (msg.toolId && msg.type === "home_mate_creation_question") restoreHomeDebateQuestionFocus(msg.toolId);
360
- if (msg.toolId && msg.type === "home_debate_question_resolved") restoreHomeDebateQuestionFocus(msg.toolId);
362
+ if (msg.toolId && questionResolved) restoreHomeDebateQuestionFocus(msg.toolId);
361
363
  if (msg.toolId && msg.type === "home_mate_error") restoreHomeDebateQuestionFocus(msg.toolId);
362
364
  }
363
365
  export function handleHomeMateDelta(msg) {
@@ -7,6 +7,67 @@ function textElement(tag, className, text) {
7
7
  return element;
8
8
  }
9
9
 
10
+ function scheduleDate(value) {
11
+ var parts = String(value || "").split("-").map(Number);
12
+ var date = new Date(Date.UTC(parts[0], parts[1] - 1, parts[2]));
13
+ return Number.isFinite(date.getTime()) ? date.toLocaleDateString("en-US", { month: "long", day: "numeric", year: "numeric", timeZone: "UTC" }) : value;
14
+ }
15
+
16
+ function exactScheduleFact(proposal) {
17
+ var intent = proposal.scheduleIntent;
18
+ var schedule = intent.scheduleRule;
19
+ var recurrence = schedule.recurrence;
20
+ var timing = "On " + scheduleDate(schedule.anchorDate);
21
+ if (recurrence) {
22
+ var days = (recurrence.weekdays || []).map(function (day) { return ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"][day]; });
23
+ if (recurrence.unit === "week" && recurrence.every === 1 && (recurrence.weekdays || []).join(",") === "1,2,3,4,5") timing = "Every weekday";
24
+ else if (recurrence.unit === "week" && recurrence.every === 1 && days.length) timing = "Every " + days.join(", ");
25
+ else timing = "Every " + (recurrence.every === 1 ? recurrence.unit : recurrence.every + " " + recurrence.unit + "s") + (days.length ? " on " + days.join(", ") : "");
26
+ }
27
+ timing += " at " + schedule.time + " (" + (proposal.scheduleTimezone || "server local") + ")";
28
+ if (recurrence) timing += ", starting " + scheduleDate(schedule.anchorDate);
29
+ if (schedule.recurrenceEnd) timing += schedule.recurrenceEnd.type === "after" ? "; for " + schedule.recurrenceEnd.count + " deliveries" : "; through " + scheduleDate(schedule.recurrenceEnd.date);
30
+ if (schedule.interval) {
31
+ var interval = schedule.interval;
32
+ timing += "; every " + interval.every + " " + interval.unit + (interval.every === 1 ? "" : "s");
33
+ timing += !interval.end ? " until end of day" : interval.end.type === "after" ? ", " + interval.end.count + " deliveries per day" : " until " + interval.end.time;
34
+ }
35
+ return timing + ": " + intent.message;
36
+ }
37
+
38
+ function friendlyTime(value) {
39
+ var parts = value.split(":");
40
+ var hour = Number(parts[0]);
41
+ if (parts[1] === "00" && (hour === 0 || hour === 12)) return hour === 0 ? "midnight" : "noon";
42
+ return (hour % 12 || 12) + (parts[1] === "00" ? "" : ":" + parts[1]) + (hour < 12 ? " AM" : " PM");
43
+ }
44
+
45
+ function scheduleSummary(proposal) {
46
+ var intent = proposal.scheduleIntent;
47
+ var schedule = intent.scheduleRule;
48
+ var recurrence = schedule.recurrence;
49
+ var timing = scheduleDate(schedule.anchorDate);
50
+ if (recurrence) {
51
+ var days = (recurrence.weekdays || []).map(function (day) { return ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"][day]; });
52
+ if (recurrence.unit === "week" && recurrence.every === 1 && (recurrence.weekdays || []).join(",") === "1,2,3,4,5") timing = "Every weekday";
53
+ else if (recurrence.unit === "week" && recurrence.every === 1 && days.length) timing = "Every " + days.join(", ");
54
+ else timing = "Every " + (recurrence.every === 1 ? recurrence.unit : recurrence.every + " " + recurrence.unit + "s") + (days.length ? " on " + days.join(", ") : "");
55
+ }
56
+ var hour = Number(schedule.time.split(":")[0]);
57
+ var time = friendlyTime(schedule.time);
58
+ var period = hour >= 5 && hour < 12 ? "morning" : hour >= 13 && hour < 17 ? "afternoon" : hour >= 17 && hour < 21 ? "evening" : "";
59
+ if (recurrence && period && recurrence.unit === "day" && recurrence.every === 1) timing = "Every " + period + " at " + time.replace(/ (AM|PM)$/, "");
60
+ else if (recurrence && period && timing === "Every weekday") timing += " " + period + " at " + time.replace(/ (AM|PM)$/, "");
61
+ else timing += " at " + time;
62
+ if (schedule.recurrenceEnd) timing += schedule.recurrenceEnd.type === "after" ? ", for " + schedule.recurrenceEnd.count + (schedule.recurrenceEnd.count === 1 ? " delivery" : " deliveries") : ", through " + scheduleDate(schedule.recurrenceEnd.date);
63
+ if (schedule.interval) {
64
+ var interval = schedule.interval;
65
+ timing += ", then every " + interval.every + " " + interval.unit + (interval.every === 1 ? "" : "s");
66
+ timing += !interval.end ? " until the end of the day" : interval.end.type === "after" ? ", " + interval.end.count + " deliveries a day" : " until " + friendlyTime(interval.end.time);
67
+ }
68
+ return timing + ": " + intent.message;
69
+ }
70
+
10
71
  export function createHomeMateProposalCard(message, respond, openMate) {
11
72
  var proposal = message.proposal || {};
12
73
  var card = document.createElement("section");
@@ -21,12 +82,23 @@ export function createHomeMateProposalCard(message, respond, openMate) {
21
82
  function fact(label, value) {
22
83
  if (!value) return;
23
84
  facts.appendChild(textElement("dt", "", label));
24
- facts.appendChild(textElement("dd", "", value));
85
+ var description = textElement("dd", "", typeof value === "string" ? value : "");
86
+ if (typeof value !== "string") description.appendChild(value);
87
+ facts.appendChild(description);
88
+ return description;
25
89
  }
26
90
  fact("Relationship", proposal.relationship);
27
91
  fact("Activities", Array.isArray(proposal.activities) ? proposal.activities.join(", ") : "");
28
92
  fact("Communication", Array.isArray(proposal.communicationStyle) ? proposal.communicationStyle.join(", ") : "");
29
93
  fact("Autonomy", proposal.autonomy);
94
+ if (proposal.scheduleIntent && proposal.scheduleIntent.message && proposal.scheduleIntent.scheduleRule) {
95
+ var scheduleItem = fact("Schedule", textElement("span", "home-mate-proposal-schedule-summary", scheduleSummary(proposal)));
96
+ var exactTiming = document.createElement("details");
97
+ exactTiming.className = "home-mate-proposal-schedule-details";
98
+ exactTiming.appendChild(textElement("summary", "", "Exact timing"));
99
+ exactTiming.appendChild(textElement("div", "", exactScheduleFact(proposal)));
100
+ scheduleItem.appendChild(exactTiming);
101
+ }
30
102
  card.appendChild(facts);
31
103
  if (proposal.identityMarkdown) {
32
104
  var details = document.createElement("details");