@xopcai/xopc 0.0.353 → 0.0.355

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 (268) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/activity-YogQEteU.js +1 -0
  4. package/dist/gateway/static/root/assets/activity-store-X7CG9pzB.js +1 -0
  5. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BVIuZcCP.js → agent-avatar-dicebear-DiEBNuSv.js} +1 -1
  6. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-DpBmB3QX.js +1 -0
  7. package/dist/gateway/static/root/assets/agent-plugin-dialog-DlojWUY_.js +1 -0
  8. package/dist/gateway/static/root/assets/agents-CeSCdUHP.js +66 -0
  9. package/dist/gateway/static/root/assets/app-chrome-BeB4KgOf.js +1 -0
  10. package/dist/gateway/static/root/assets/app-management-settings-panel-MkSa6isi.js +1 -0
  11. package/dist/gateway/static/root/assets/appearance-settings-B7hCkaT_.js +1 -0
  12. package/dist/gateway/static/root/assets/apps-page-D_CduJuC.js +1 -0
  13. package/dist/gateway/static/root/assets/{archive-plugin-BZXXJvpX.js → archive-plugin-QfOaQPL_.js} +1 -1
  14. package/dist/gateway/static/root/assets/{automations-page-C7VKkDb5.js → automations-page-uEnQawd7.js} +1 -1
  15. package/dist/gateway/static/root/assets/automations-workspace-pdiSK3Qk.js +7 -0
  16. package/dist/gateway/static/root/assets/{binary-plugins-DoT3g5SP.js → binary-plugins-BF2lVwR9.js} +1 -1
  17. package/dist/gateway/static/root/assets/{block-editor-sqqrCafh.js → block-editor-r4mKGacz.js} +39 -39
  18. package/dist/gateway/static/root/assets/bot-DjLkhyZL.js +1 -0
  19. package/dist/gateway/static/root/assets/{browser-automation-inputs-CZOKsAaa.js → browser-automation-inputs-FW3bYZ-z.js} +1 -1
  20. package/dist/gateway/static/root/assets/{browser-automations-page-TEeTmkGP.js → browser-automations-page-Blrxyy_h.js} +2 -2
  21. package/dist/gateway/static/root/assets/browser-settings-page-DGuwrO7j.js +3 -0
  22. package/dist/gateway/static/root/assets/{capabilities-BOrLei_L.js → capabilities-BCF_160Z.js} +1 -1
  23. package/dist/gateway/static/root/assets/capabilities-CF4-mrIa.js +1 -0
  24. package/dist/gateway/static/root/assets/capabilities-page-DUIA2K--.js +2 -0
  25. package/dist/gateway/static/root/assets/capabilities-settings-panel-CwPNQsJS.js +8 -0
  26. package/dist/gateway/static/root/assets/capability-header-actions-CyvI2F5x.js +1 -0
  27. package/dist/gateway/static/root/assets/channels-DBxDJV8I.js +1 -0
  28. package/dist/gateway/static/root/assets/{chat-terminal-dock-Q99iKyiO.js → chat-terminal-dock-YdxhecE7.js} +2 -2
  29. package/dist/gateway/static/root/assets/chevron-right-BweFrslA.js +1 -0
  30. package/dist/gateway/static/root/assets/circle-alert-BEjgurr2.js +1 -0
  31. package/dist/gateway/static/root/assets/circle-dashed-8qMD7gHf.js +1 -0
  32. package/dist/gateway/static/root/assets/circle-dot-BAseJTrF.js +1 -0
  33. package/dist/gateway/static/root/assets/circle-pause-CN9jYH2s.js +1 -0
  34. package/dist/gateway/static/root/assets/clock-3-DnrAnuyZ.js +1 -0
  35. package/dist/gateway/static/root/assets/cloud-C4-yfnnk.js +1 -0
  36. package/dist/gateway/static/root/assets/computer-settings-page-BuCrA8yD.js +1 -0
  37. package/dist/gateway/static/root/assets/connector-service-page-BiB2GYkp.js +1 -0
  38. package/dist/gateway/static/root/assets/connectors-page-nQAgZk-5.js +2 -0
  39. package/dist/gateway/static/root/assets/copy-text-row-BHDs3cBa.js +1 -0
  40. package/dist/gateway/static/root/assets/date-picker-BJtADyRQ.js +1 -0
  41. package/dist/gateway/static/root/assets/{dependency-picker-BjH8XrKb.js → dependency-picker-D-Ko0G40.js} +1 -1
  42. package/dist/gateway/static/root/assets/{desktop-pet-DyGxNAVW.js → desktop-pet-CVPWcWwC.js} +1 -1
  43. package/dist/gateway/static/root/assets/desktop-pet-settings-BcN_I-7y.js +1 -0
  44. package/dist/gateway/static/root/assets/device-pairing-wizard-CoKKoUlt.js +1 -0
  45. package/dist/gateway/static/root/assets/directory-picker-path-field-m0CubGEP.js +1 -0
  46. package/dist/gateway/static/root/assets/dist-3h6cXXhT.js +1 -0
  47. package/dist/gateway/static/root/assets/dist-Che_jiQF.js +1 -0
  48. package/dist/gateway/static/root/assets/extension-debug-page-BrGWLJg9.js +1 -0
  49. package/dist/gateway/static/root/assets/extension-page-Dd88ynHj.js +1 -0
  50. package/dist/gateway/static/root/assets/extension-provider-CUpbXB2k.js +1 -0
  51. package/dist/gateway/static/root/assets/extension-settings-page-Dq1MXh6D.js +1 -0
  52. package/dist/gateway/static/root/assets/form-field-width-DJw_jULe.js +1 -0
  53. package/dist/gateway/static/root/assets/gateway-settings-C_bTRQeE.js +1 -0
  54. package/dist/gateway/static/root/assets/git-branch-Dh9uxTot.js +1 -0
  55. package/dist/gateway/static/root/assets/home-page-xbqSikkK.js +1 -0
  56. package/dist/gateway/static/root/assets/imports-page-Cd4tcbLU.js +1 -0
  57. package/dist/gateway/static/root/assets/index-BuzC93X-.css +1 -0
  58. package/dist/gateway/static/root/assets/index-CYeGnj-L.js +106 -0
  59. package/dist/gateway/static/root/assets/index.module-Cd9ENXfk.js +1 -0
  60. package/dist/gateway/static/root/assets/interaction-BdhHBbYa.js +1 -0
  61. package/dist/gateway/static/root/assets/is-masked-secret-DOkL5b_X.js +1 -0
  62. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CoYdyBRh.js → keyboard-shortcuts-settings-CmalfzgQ.js} +1 -1
  63. package/dist/gateway/static/root/assets/local-app-workbench-page-BquHHLj6.js +1 -0
  64. package/dist/gateway/static/root/assets/{local-apps-page-CeBhXeoX.js → local-apps-page-RPLHMvYs.js} +1 -1
  65. package/dist/gateway/static/root/assets/logs-page-7NMGltSw.js +2 -0
  66. package/dist/gateway/static/root/assets/management-settings-zwFewbhp.js +1 -0
  67. package/dist/gateway/static/root/assets/markdown-view-7tzqIp_G.js +201 -0
  68. package/dist/gateway/static/root/assets/{media-plugins-C9ya5rUH.js → media-plugins-cjgrKnne.js} +1 -1
  69. package/dist/gateway/static/root/assets/message-square-fVE7Ghj1.js +1 -0
  70. package/dist/gateway/static/root/assets/mic-CuUb7zc-.js +1 -0
  71. package/dist/gateway/static/root/assets/model-display-name-DXhO9rcM.js +1 -0
  72. package/dist/gateway/static/root/assets/models-hub-cache-HGrORbzR.js +1 -0
  73. package/dist/gateway/static/root/assets/note-detail-panel-CwMg9cvF.js +5 -0
  74. package/dist/gateway/static/root/assets/notes-api-J0yhflxC.js +1 -0
  75. package/dist/gateway/static/root/assets/notes-page-CWJwrvo7.js +8 -0
  76. package/dist/gateway/static/root/assets/oauth-api-CYe61zfD.js +1 -0
  77. package/dist/gateway/static/root/assets/page-context-capture-button-DqmAq4Ov.js +1 -0
  78. package/dist/gateway/static/root/assets/page-tabs-D2xpUV26.js +1 -0
  79. package/dist/gateway/static/root/assets/pause-DuPxgSxk.js +1 -0
  80. package/dist/gateway/static/root/assets/personal-page-Bbgx_dgV.js +1 -0
  81. package/dist/gateway/static/root/assets/play-kxZvpBg8.js +1 -0
  82. package/dist/gateway/static/root/assets/popover-select-DcsFzD_i.js +1 -0
  83. package/dist/gateway/static/root/assets/preview-open-alternatives-Dvey7GwU.js +1 -0
  84. package/dist/gateway/static/root/assets/{product-open-page-DUPsiVP9.js → product-open-page-SsG2sljT.js} +1 -1
  85. package/dist/gateway/static/root/assets/project-detail-page-wp5cFhM7.js +1 -0
  86. package/dist/gateway/static/root/assets/projects-page-Brfi519S.js +1 -0
  87. package/dist/gateway/static/root/assets/remote-access-hub-BdtF8Cvk.js +1 -0
  88. package/dist/gateway/static/root/assets/rotate-ccw-JM1TBLpp.js +1 -0
  89. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-C25xEYTK.js → runtime-tools-settings-panel-CT6HKczq.js} +2 -2
  90. package/dist/gateway/static/root/assets/scenes-page-BmlI42OR.js +2 -0
  91. package/dist/gateway/static/root/assets/schema-form-DEcsbgne.js +1 -0
  92. package/dist/gateway/static/root/assets/secret-input-DPl3VYM8.js +1 -0
  93. package/dist/gateway/static/root/assets/send-session-input-C7Nqy0sK.js +1 -0
  94. package/dist/gateway/static/root/assets/sessions-page-C_G8fZwV.js +1 -0
  95. package/dist/gateway/static/root/assets/settings-2-D-csvaET.js +1 -0
  96. package/dist/gateway/static/root/assets/settings-advanced-gate-CDxdzwDs.js +1 -0
  97. package/dist/gateway/static/root/assets/settings-form-draft-Dy10ldo8.js +1 -0
  98. package/dist/gateway/static/root/assets/settings-form-section-exRhP9xn.js +1 -0
  99. package/dist/gateway/static/root/assets/{settings-page-DqCJHcdG.js → settings-page-P50kLPUz.js} +1 -1
  100. package/dist/gateway/static/root/assets/setup-status-panel-DtnwH0wN.js +1 -0
  101. package/dist/gateway/static/root/assets/share-link-dialog-COlX10Dc.js +1 -0
  102. package/dist/gateway/static/root/assets/share-preview-page-NtRLUieq.js +2 -0
  103. package/dist/gateway/static/root/assets/shares-api-DICV5EKH.js +1 -0
  104. package/dist/gateway/static/root/assets/shares-settings-7Ak_MsJg.js +1 -0
  105. package/dist/gateway/static/root/assets/skill-api-CcdHQhxd.js +1 -0
  106. package/dist/gateway/static/root/assets/skill-api-utils-C7V4JVXM.js +1 -0
  107. package/dist/gateway/static/root/assets/skill-reload-api-CWH3Fmx4.js +1 -0
  108. package/dist/gateway/static/root/assets/skill-wire-pattern-BPpeIcCi.js +1 -0
  109. package/dist/gateway/static/root/assets/skills-page-ChjXDxdX.js +2 -0
  110. package/dist/gateway/static/root/assets/sparkles-DHlfQFAF.js +1 -0
  111. package/dist/gateway/static/root/assets/system-settings-panel-DAR0w3Xi.js +1 -0
  112. package/dist/gateway/static/root/assets/task-detail-page-DEx0kXDV.js +1 -0
  113. package/dist/gateway/static/root/assets/tasks-Buv1mgPF.js +1 -0
  114. package/dist/gateway/static/root/assets/theme-store-BKgBPLH4.js +1 -0
  115. package/dist/gateway/static/root/assets/tunnel-api-CBy97LfF.js +1 -0
  116. package/dist/gateway/static/root/assets/usage-page-BdX6VPQC.js +1 -0
  117. package/dist/gateway/static/root/assets/use-async-resource-GrnWNwMZ.js +1 -0
  118. package/dist/gateway/static/root/assets/use-autosave-Cn6hqqyM.js +1 -0
  119. package/dist/gateway/static/root/assets/use-composer-attachments-DL61XeSu.js +2 -0
  120. package/dist/gateway/static/root/assets/use-file-preview-expanded-Cl9mU32w.js +2 -0
  121. package/dist/gateway/static/root/assets/user-model-page-CRxiQnWG.js +2 -0
  122. package/dist/gateway/static/root/assets/voice-api-key-field-Bw05QB_V.js +1 -0
  123. package/dist/gateway/static/root/assets/{work-discovery-overlay-BnfD6w0k.js → work-discovery-overlay-DvwmD9Ma.js} +1 -1
  124. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DSy57rBr.js → workflow-run-setup-panel-BQ3fmhM-.js} +2 -2
  125. package/dist/gateway/static/root/assets/workflows-page-Bl8rd4fM.js +6 -0
  126. package/dist/gateway/static/root/assets/workspace-api-BbBT75Kg.js +2 -0
  127. package/dist/gateway/static/root/index.html +61 -19
  128. package/dist/package.js +1 -1
  129. package/dist/packages/gateway-contract/src/tasks.js +19 -2
  130. package/dist/src/agent/agent-manager.js +4 -4
  131. package/dist/src/agent/embedded/run-for-session.d.ts +1 -0
  132. package/dist/src/agent/embedded/run-for-session.js +2 -1
  133. package/dist/src/agent/embedded/run-turn.js +30 -2
  134. package/dist/src/agent/embedded/types.d.ts +1 -0
  135. package/dist/src/agent/prompt/sections/messaging-runtime.js +2 -1
  136. package/dist/src/agent/service/direct-turn-helpers.d.ts +1 -0
  137. package/dist/src/agent/service/direct-turn-helpers.js +1 -0
  138. package/dist/src/agent/service/process-direct-streaming.js +1 -0
  139. package/dist/src/agent/service.js +4 -1
  140. package/dist/src/agent/session/session-config-service.js +27 -1
  141. package/dist/src/agent/session/session-hydrator.js +1 -1
  142. package/dist/src/agent/tools/factory.js +21 -14
  143. package/dist/src/agent/tools/personal-preference-tool.d.ts +10 -0
  144. package/dist/src/agent/tools/personal-preference-tool.js +44 -0
  145. package/dist/src/agent/tools/personal-task-tool.d.ts +29 -0
  146. package/dist/src/agent/tools/personal-task-tool.js +184 -0
  147. package/dist/src/agent/tools/xopc-use-tool.js +3 -2
  148. package/dist/src/agent-catalog/service.d.ts +1 -1
  149. package/dist/src/agent-catalog/service.js +2 -1
  150. package/dist/src/agent-config/index.js +2 -2
  151. package/dist/src/agent-config/schema.d.ts +153 -1
  152. package/dist/src/agent-config/schema.js +42 -3
  153. package/dist/src/chat-commands/builtins/thinking.js +12 -2
  154. package/dist/src/chat-commands/context.js +7 -1
  155. package/dist/src/cli/commands/auth.js +1 -1
  156. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  157. package/dist/src/cli/commands/models.js +2 -2
  158. package/dist/src/cli/commands/onboard/model.js +1 -1
  159. package/dist/src/cli/commands/providers.js +1 -1
  160. package/dist/src/gateway/hono/lib/config-payload.d.ts +1 -0
  161. package/dist/src/gateway/hono/routes/lazy-bundles.js +8 -0
  162. package/dist/src/gateway/hono/routes/models.js +1 -1
  163. package/dist/src/gateway/hono/routes/personal-agent.d.ts +3 -0
  164. package/dist/src/gateway/hono/routes/personal-agent.js +122 -0
  165. package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
  166. package/dist/src/gateway/hono/routes/sessions.js +5 -0
  167. package/dist/src/gateway/hono/routes/side-chats.js +1 -1
  168. package/dist/src/gateway/hono/routes/tasks.js +64 -1
  169. package/dist/src/gateway/hono/routes/voice.js +8 -0
  170. package/dist/src/gateway/service/agent-runner.js +41 -0
  171. package/dist/src/gateway/service/run-gateway-agent.js +2 -1
  172. package/dist/src/gateway/service/session-command-service.js +7 -1
  173. package/dist/src/gateway/service/sessions-api.js +11 -1
  174. package/dist/src/gateway/service.js +10 -10
  175. package/dist/src/gateway/session-reset-service.js +5 -0
  176. package/dist/src/gateway/xopc-cloud-capability-setup.d.ts +9 -0
  177. package/dist/src/gateway/xopc-cloud-capability-setup.js +42 -2
  178. package/dist/src/home-intelligence/host.js +2 -2
  179. package/dist/src/personal-agent/policy.d.ts +1 -0
  180. package/dist/src/personal-agent/policy.js +13 -0
  181. package/dist/src/personal-agent/repository.d.ts +25 -0
  182. package/dist/src/personal-agent/repository.js +68 -0
  183. package/dist/src/personal-agent/service.d.ts +49 -0
  184. package/dist/src/personal-agent/service.js +234 -0
  185. package/dist/src/session/resolve-session.js +4 -2
  186. package/dist/src/storage/sqlite/migrations/229_task_criterion_reviews.sql +12 -0
  187. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  188. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  189. package/dist/src/storage/sqlite/schema.js +1 -1
  190. package/dist/src/storage/sqlite/schema.sql +13 -0
  191. package/dist/src/storage/sqlite/session-repository.js +6 -2
  192. package/dist/src/storage/sqlite/transcript-repository.js +2 -1
  193. package/dist/src/tasks/capabilities/read.js +3 -0
  194. package/dist/src/tasks/task-application-service.js +6 -1
  195. package/dist/src/tasks/task-criterion-review-repository.d.ts +22 -0
  196. package/dist/src/tasks/task-criterion-review-repository.js +74 -0
  197. package/dist/src/tasks/task-main-update-decision-service.js +6 -0
  198. package/dist/src/tasks/task-main-update-delivery.js +5 -2
  199. package/dist/src/tasks/task-origin-repository.d.ts +4 -1
  200. package/dist/src/tasks/task-origin-repository.js +3 -3
  201. package/dist/src/tasks/task-run-coordinator.d.ts +1 -0
  202. package/dist/src/tasks/task-run-coordinator.js +13 -7
  203. package/dist/src/tasks/task-run-dispatcher.d.ts +1 -1
  204. package/dist/src/tasks/task-run-dispatcher.js +6 -4
  205. package/package.json +4 -4
  206. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CcTnphqy.js +0 -1
  207. package/dist/gateway/static/root/assets/agent-plugin-dialog-CdCzMPhC.js +0 -1
  208. package/dist/gateway/static/root/assets/agents-BiNKpndr.js +0 -66
  209. package/dist/gateway/static/root/assets/app-management-settings-panel-BvGDN5J6.js +0 -1
  210. package/dist/gateway/static/root/assets/appearance-settings-BhQYkuQj.js +0 -1
  211. package/dist/gateway/static/root/assets/apps-page-BQZJuM-C.js +0 -1
  212. package/dist/gateway/static/root/assets/automations-workspace-y4qcvlg8.js +0 -7
  213. package/dist/gateway/static/root/assets/browser-settings-page--N4P7V0l.js +0 -3
  214. package/dist/gateway/static/root/assets/capabilities-page-F7OAv-iz.js +0 -2
  215. package/dist/gateway/static/root/assets/capabilities-settings-panel-CaiIo1S1.js +0 -8
  216. package/dist/gateway/static/root/assets/capability-header-actions-CR_O9_Vr.js +0 -1
  217. package/dist/gateway/static/root/assets/channels-Bb-8c4wl.js +0 -1
  218. package/dist/gateway/static/root/assets/computer-settings-page-QuXZBfky.js +0 -1
  219. package/dist/gateway/static/root/assets/connector-service-page-BIqzVqCO.js +0 -1
  220. package/dist/gateway/static/root/assets/connectors-page-CZ24DSBJ.js +0 -2
  221. package/dist/gateway/static/root/assets/date-picker-Ck-FmYEL.js +0 -1
  222. package/dist/gateway/static/root/assets/desktop-pet-settings-C1rKgB-S.js +0 -1
  223. package/dist/gateway/static/root/assets/device-pairing-wizard-UrPcOU6Q.js +0 -1
  224. package/dist/gateway/static/root/assets/directory-picker-path-field-BYxUgMZb.js +0 -1
  225. package/dist/gateway/static/root/assets/dist-CKkafhaS.js +0 -1
  226. package/dist/gateway/static/root/assets/dist-io9jFpN72.js +0 -1
  227. package/dist/gateway/static/root/assets/extension-debug-page-CGL0jpQA.js +0 -1
  228. package/dist/gateway/static/root/assets/extension-page-DPWf-tYg.js +0 -1
  229. package/dist/gateway/static/root/assets/extension-settings-page-DZWBY39d.js +0 -1
  230. package/dist/gateway/static/root/assets/gateway-settings-D5w5aYXK.js +0 -1
  231. package/dist/gateway/static/root/assets/home-page-DPQwxBGy.js +0 -1
  232. package/dist/gateway/static/root/assets/imports-page-CnRWDtGz.js +0 -1
  233. package/dist/gateway/static/root/assets/index-B-w6Rk9Z.css +0 -1
  234. package/dist/gateway/static/root/assets/index-DU5Eb1V8.js +0 -106
  235. package/dist/gateway/static/root/assets/local-app-workbench-page-hjFeYlIq.js +0 -1
  236. package/dist/gateway/static/root/assets/logs-page-CzpZDjkA.js +0 -2
  237. package/dist/gateway/static/root/assets/management-settings-Beu_R_Rc.js +0 -1
  238. package/dist/gateway/static/root/assets/markdown-view-BlzX7Ze5.js +0 -201
  239. package/dist/gateway/static/root/assets/note-detail-panel-D8bpTGwP.js +0 -5
  240. package/dist/gateway/static/root/assets/notes-page-OmgXowUG.js +0 -8
  241. package/dist/gateway/static/root/assets/page-context-capture-button-BjjjuLkz.js +0 -1
  242. package/dist/gateway/static/root/assets/page-tabs-_DiuzxyD.js +0 -1
  243. package/dist/gateway/static/root/assets/popover-select-0p9PIHRy.js +0 -1
  244. package/dist/gateway/static/root/assets/preview-open-alternatives-BKvUadws.js +0 -1
  245. package/dist/gateway/static/root/assets/project-detail-page-CWlCg2x5.js +0 -1
  246. package/dist/gateway/static/root/assets/projects-page-NbVNo0tP.js +0 -1
  247. package/dist/gateway/static/root/assets/remote-access-hub-CD8HrqGC.js +0 -1
  248. package/dist/gateway/static/root/assets/scenes-page-DbWaemwR.js +0 -2
  249. package/dist/gateway/static/root/assets/schema-form-_3LQ4hyB.js +0 -1
  250. package/dist/gateway/static/root/assets/sessions-page-B7ZUdXlb.js +0 -1
  251. package/dist/gateway/static/root/assets/settings-advanced-gate-CpKzZMft.js +0 -1
  252. package/dist/gateway/static/root/assets/settings-form-section-DS80hVSY.js +0 -1
  253. package/dist/gateway/static/root/assets/setup-status-panel-De-kC3yJ.js +0 -1
  254. package/dist/gateway/static/root/assets/share-preview-page-T-0g_rwr.js +0 -2
  255. package/dist/gateway/static/root/assets/shares-settings-Dz33T3du.js +0 -1
  256. package/dist/gateway/static/root/assets/skill-api-Cx6GGpSY.js +0 -1
  257. package/dist/gateway/static/root/assets/skill-reload-api-DyJ-Duem.js +0 -1
  258. package/dist/gateway/static/root/assets/skills-page-B2iyN-kP.js +0 -2
  259. package/dist/gateway/static/root/assets/system-settings-panel-By3SZQR_.js +0 -1
  260. package/dist/gateway/static/root/assets/task-detail-page-4yHUTs4_.js +0 -1
  261. package/dist/gateway/static/root/assets/tasks-BH8_WMUF.js +0 -1
  262. package/dist/gateway/static/root/assets/tunnel-api-BoH0LBkw.js +0 -1
  263. package/dist/gateway/static/root/assets/usage-page-dKU5X9zT.js +0 -1
  264. package/dist/gateway/static/root/assets/use-autosave-YKCwQvqT.js +0 -1
  265. package/dist/gateway/static/root/assets/user-model-page-Uht32LPP.js +0 -2
  266. package/dist/gateway/static/root/assets/voice-api-key-field-DiqHIA8l.js +0 -1
  267. package/dist/gateway/static/root/assets/workflows-page-Cq3vRUbc.js +0 -6
  268. /package/dist/gateway/static/root/assets/{dist-CI_fqRk-2.js → dist-CI_fqRk-.js} +0 -0
@@ -0,0 +1 @@
1
+ export declare const PERSONAL_MAIN_TOOL_IDS: readonly ["personal_task", "personal_preference", "session_recall", "user_context_search", "user_context_get", "knowledge_search", "knowledge_get", "clarify"];
@@ -0,0 +1,13 @@
1
+ //#region src/personal-agent/policy.ts
2
+ const PERSONAL_MAIN_TOOL_IDS = [
3
+ "personal_task",
4
+ "personal_preference",
5
+ "session_recall",
6
+ "user_context_search",
7
+ "user_context_get",
8
+ "knowledge_search",
9
+ "knowledge_get",
10
+ "clarify"
11
+ ];
12
+ //#endregion
13
+ export { PERSONAL_MAIN_TOOL_IDS };
@@ -0,0 +1,25 @@
1
+ export type PersonalAgentState = 'provisioning' | 'ready' | 'error';
2
+ export type PersonalAppearance = 'spark' | 'cloud' | 'bean';
3
+ export interface PersonalAgentRecord {
4
+ ownerId: string;
5
+ agentId: string;
6
+ conversationId: string;
7
+ state: PersonalAgentState;
8
+ displayName: string;
9
+ appearance: PersonalAppearance;
10
+ preferences: Record<string, unknown>;
11
+ revision: number;
12
+ errorMessage: string | null;
13
+ }
14
+ export declare const DEFAULT_PERSONAL_PREFERENCES: {
15
+ readonly warmth: "balanced";
16
+ readonly humor: "none";
17
+ readonly supportMode: "untangle";
18
+ readonly detailLevel: "balanced";
19
+ readonly proactivity: "decisions";
20
+ };
21
+ export declare function personalAgentId(ownerId: string): string;
22
+ export declare function personalConversationId(ownerId: string): string;
23
+ export declare function getPersonalAgent(ownerId: string): PersonalAgentRecord | null;
24
+ export declare function getPersonalAgentByConversation(conversationId: string): PersonalAgentRecord | null;
25
+ export declare function isPersonalConversation(conversationId: string): boolean;
@@ -0,0 +1,68 @@
1
+ import { init_connection, isXopcDatabaseOpen } from "../storage/sqlite/connection.js";
2
+ import { getSqliteDatabase, init_transaction } from "../storage/sqlite/transaction.js";
3
+ import { getSessionConfig, init_config_repository } from "../storage/sqlite/config-repository.js";
4
+ import { AgentCatalogRepository, init_repository } from "../agent-catalog/repository.js";
5
+ import { createHash } from "node:crypto";
6
+ //#region src/personal-agent/repository.ts
7
+ init_repository();
8
+ init_connection();
9
+ init_config_repository();
10
+ init_transaction();
11
+ const DEFAULT_PERSONAL_PREFERENCES = {
12
+ warmth: "balanced",
13
+ humor: "none",
14
+ supportMode: "untangle",
15
+ detailLevel: "balanced",
16
+ proactivity: "decisions"
17
+ };
18
+ function personalAgentId(ownerId) {
19
+ return `personal-${createHash("sha256").update(ownerId).digest("hex").slice(0, 12)}`;
20
+ }
21
+ function personalConversationId(ownerId) {
22
+ const hash = createHash("sha256").update(`personal-conversation:${ownerId}`).digest("hex");
23
+ return `${hash.slice(0, 8)}-${hash.slice(8, 12)}-5${hash.slice(13, 16)}-8${hash.slice(17, 20)}-${hash.slice(20, 32)}`;
24
+ }
25
+ function personalSession(column, value) {
26
+ if (!isXopcDatabaseOpen()) return null;
27
+ return getSqliteDatabase().prepare(`SELECT conversation_id, agent_id
28
+ FROM sessions WHERE ${column} = ? AND json_extract(custom_data_json, '$.personalAgent') = 1
29
+ ORDER BY created_at LIMIT 1`).get(value) ?? null;
30
+ }
31
+ function appearanceFrom(agent) {
32
+ return agent.profile?.emoji === "☁" ? "cloud" : agent.profile?.emoji === "◕" ? "bean" : "spark";
33
+ }
34
+ function toRecord(ownerId, agent, session) {
35
+ const config = session ? getSessionConfig(session.conversation_id) : null;
36
+ const ready = agent.provisioningState === "ready" && agent.runtime?.thinkingLevel === "off" && session && config?.thinkingLevel === "off" && config.fixedModel;
37
+ return {
38
+ ownerId,
39
+ agentId: agent.id,
40
+ conversationId: session?.conversation_id ?? personalConversationId(ownerId),
41
+ state: agent.provisioningState === "error" ? "error" : ready ? "ready" : "provisioning",
42
+ displayName: agent.profile?.name ?? "Personal AI",
43
+ appearance: appearanceFrom(agent),
44
+ preferences: agent.profile?.responsePreferences ?? DEFAULT_PERSONAL_PREFERENCES,
45
+ revision: agent.revision,
46
+ errorMessage: agent.provisioningError ?? null
47
+ };
48
+ }
49
+ function getPersonalAgent(ownerId) {
50
+ if (!isXopcDatabaseOpen()) return null;
51
+ const agent = new AgentCatalogRepository().get(personalAgentId(ownerId));
52
+ return agent ? toRecord(ownerId, agent, personalSession("agent_id", agent.id)) : null;
53
+ }
54
+ function getPersonalAgentByConversation(conversationId) {
55
+ const session = personalSession("conversation_id", conversationId);
56
+ if (!session) return null;
57
+ const agent = new AgentCatalogRepository().get(session.agent_id);
58
+ if (!agent) return null;
59
+ const ownerId = "local-owner";
60
+ return agent.id === personalAgentId(ownerId) ? toRecord(ownerId, agent, session) : null;
61
+ }
62
+ function isPersonalConversation(conversationId) {
63
+ if (!isXopcDatabaseOpen()) return false;
64
+ return Boolean(getSqliteDatabase().prepare(`SELECT 1 FROM sessions WHERE conversation_id = ?
65
+ AND agent_id = ? AND json_extract(custom_data_json, '$.personalAgent') = 1`).get(conversationId, personalAgentId("local-owner")));
66
+ }
67
+ //#endregion
68
+ export { DEFAULT_PERSONAL_PREFERENCES, getPersonalAgent, getPersonalAgentByConversation, isPersonalConversation, personalAgentId, personalConversationId };
@@ -0,0 +1,49 @@
1
+ import { z } from 'zod';
2
+ import type { GatewayService } from '../gateway/service.js';
3
+ import { type PersonalAgentRecord } from './repository.js';
4
+ export declare const PersonalPreferencesSchema: z.ZodObject<{
5
+ addressAs: z.ZodOptional<z.ZodString>;
6
+ guidance: z.ZodOptional<z.ZodString>;
7
+ warmth: z.ZodOptional<z.ZodEnum<{
8
+ balanced: "balanced";
9
+ reserved: "reserved";
10
+ gentle: "gentle";
11
+ }>>;
12
+ humor: z.ZodOptional<z.ZodEnum<{
13
+ none: "none";
14
+ occasional: "occasional";
15
+ playful: "playful";
16
+ }>>;
17
+ supportMode: z.ZodOptional<z.ZodEnum<{
18
+ listen: "listen";
19
+ untangle: "untangle";
20
+ solutions: "solutions";
21
+ }>>;
22
+ detailLevel: z.ZodOptional<z.ZodEnum<{
23
+ brief: "brief";
24
+ balanced: "balanced";
25
+ detailed: "detailed";
26
+ }>>;
27
+ proactivity: z.ZodOptional<z.ZodEnum<{
28
+ open: "open";
29
+ decisions: "decisions";
30
+ important: "important";
31
+ }>>;
32
+ }, z.core.$strict>;
33
+ export type PersonalPreferences = z.infer<typeof PersonalPreferencesSchema>;
34
+ export declare const PersonalAppearanceSchema: z.ZodEnum<{
35
+ cloud: "cloud";
36
+ spark: "spark";
37
+ bean: "bean";
38
+ }>;
39
+ export type PersonalAppearance = z.infer<typeof PersonalAppearanceSchema>;
40
+ export declare function personalInstructions(preferences: PersonalPreferences): string;
41
+ export declare function refreshPersonalDelegationGuidance(service: GatewayService, ownerId: string): Promise<void>;
42
+ export declare function listPersonalModels(): Promise<Array<{
43
+ id: string;
44
+ name: string;
45
+ }>>;
46
+ export declare function ensurePersonalConversationVisibility(ownerId: string): void;
47
+ export declare function createOrResumePersonalAgent(service: GatewayService, ownerId: string, requestedModel?: string, availableModels?: typeof listPersonalModels): Promise<PersonalAgentRecord>;
48
+ export declare function patchPersonalProfile(service: GatewayService, ownerId: string, revision: number, displayName: string, preferences: PersonalPreferences, appearance: PersonalAppearance): Promise<PersonalAgentRecord | null>;
49
+ export declare function updatePersonalProfileRecord(ownerId: string, revision: number, displayName: string, preferences: PersonalPreferences, appearance: PersonalAppearance): Promise<PersonalAgentRecord | null>;
@@ -0,0 +1,234 @@
1
+ import { getSessionMetadata } from "../storage/sqlite/session-read-repository.js";
2
+ import { init_session_repository, patchSessionMetadata } from "../storage/sqlite/session-repository.js";
3
+ import { init_config_repository, setSessionConfig } from "../storage/sqlite/config-repository.js";
4
+ import { ResponsePreferencesSchema } from "../agent-config/schema.js";
5
+ import { init_agent_config } from "../agent-config/index.js";
6
+ import { AgentCatalogRepository, init_repository } from "../agent-catalog/repository.js";
7
+ import { AgentCatalogService } from "../agent-catalog/service.js";
8
+ import { createConversation, init_conversation_repository } from "../storage/sqlite/conversation-repository.js";
9
+ import { getAvailableModels, init_providers } from "../providers/index.js";
10
+ import { getModelThinking } from "../providers/model-thinking.js";
11
+ import { DEFAULT_PERSONAL_PREFERENCES, getPersonalAgent, personalAgentId } from "./repository.js";
12
+ import { PERSONAL_MAIN_TOOL_IDS } from "./policy.js";
13
+ import { z } from "zod";
14
+ //#region src/personal-agent/service.ts
15
+ init_agent_config();
16
+ init_repository();
17
+ init_providers();
18
+ init_conversation_repository();
19
+ init_session_repository();
20
+ init_config_repository();
21
+ const PersonalPreferencesSchema = ResponsePreferencesSchema;
22
+ const PersonalAppearanceSchema = z.enum([
23
+ "spark",
24
+ "cloud",
25
+ "bean"
26
+ ]);
27
+ function appearanceEmoji(appearance) {
28
+ return appearance === "cloud" ? "☁" : appearance === "bean" ? "◕" : "✦";
29
+ }
30
+ const LEGACY_DELEGATION_RULE = "Answer simple requests directly. For complex work, use personal_task agents to find a suitable specialist, then create a Task and remain available to talk. Never claim a task was created before the tool confirms it.";
31
+ const PREVIOUS_DELEGATION_RULES = [
32
+ "Route by required capability, not task length. Answer directly only when your own tools and knowledge are sufficient. For current facts, web pages, or any tool you lack, call personal_task(command=\"agents\"), choose an Agent with the needed availableTools, then create a Task. Your own lack of browsing does not mean xopc cannot browse. Never claim the system cannot help, ask the user to switch models, or ask them to paste sources before checking Agents.",
33
+ "For current news, delegate to an Agent with web_search. Include the requested date or time window and topic in the brief; require source links, publication dates, and a distinction between confirmed news and uncertain reports. Tell the user briefly that you are checking. Stay available while the Task runs, then summarize verified results in their preferred style.",
34
+ "If no suitable Agent is available, explain the specific missing capability and offer the next useful option. Never claim a Task was created before the tool confirms it."
35
+ ].join("\n");
36
+ const PRIOR_DELEGATION_RULES = [
37
+ "Own the user’s request through completion. If you cannot reliably do it yourself because of missing tools, access, knowledge, time, or specialist judgment, first call personal_task(command=\"agents\"). Match the request to another Agent’s description and availableTools, then create a Task for a plausible candidate. This applies to short requests too. Your own limitation is not a system limitation. Do not stop at “I cannot” or ask the user to switch models or do your work before checking Agents.",
38
+ "If the chosen Agent or tool cannot complete the Task, inspect the actual blocker and try another suitable Agent or a reasonable alternative within the user’s authorization. Do not repeat the same failed approach indefinitely. Ask the user only for a decision, access, or information that no available Agent can supply. Explain a concrete blocker only after checking the available paths; never imply that an untried path was attempted.",
39
+ "For current news or other live facts, find an Agent with web_search and require dated sources. For coding, analysis, writing, media, or connected-app work, choose by the Agent’s role and tools rather than a fixed name. Give the Task a short title and a complete Markdown brief. After Task creation succeeds, tell the user briefly what is happening, stay available, and summarize verified outcomes in their preferred style.",
40
+ "Never claim a Task was created or completed before its tool result confirms that state. Respect the user’s authorization and the selected Agent’s permissions."
41
+ ].join("\n");
42
+ const DELEGATION_RULES = [
43
+ "Own the user’s request through completion. If you cannot reliably do it yourself because of missing tools, access, knowledge, time, or specialist judgment, first call personal_task(command=\"agents\"). Match the request to another Agent’s description and availableTools, then create a Task for a plausible candidate. This applies to short requests too. Your own limitation is not a system limitation. Do not stop at “I cannot” or ask the user to switch models or do your work before checking Agents.",
44
+ "If the chosen Agent or tool cannot complete the Task, inspect the actual blocker and try another suitable Agent or a reasonable alternative within the user’s authorization. Do not repeat the same failed approach indefinitely. Ask the user only for a decision, access, or information that no available Agent can supply. Explain a concrete blocker only after checking the available paths; never imply that an untried path was attempted.",
45
+ "A worker question is yours to resolve first. Read the Task brief and earlier conversation; when the answer is already there, call personal_task(command=\"answer\", taskId=..., questionId=..., instruction=...) so the worker resumes. Ask the user only when the missing fact cannot be found. Once the user asks you to complete a task, retrying a suitable alternative Agent is already authorized; do not ask permission to try again.",
46
+ "For current news or other live facts, find an Agent with web_search and require dated sources. For coding, analysis, writing, media, or connected-app work, choose by the Agent’s role and tools rather than a fixed name. Give the Task a short title and a complete Markdown brief. After Task creation succeeds, tell the user briefly what is happening, stay available, and summarize verified outcomes in their preferred style.",
47
+ "Never claim a Task was created or completed before its tool result confirms that state. Respect the user’s authorization and the selected Agent’s permissions."
48
+ ];
49
+ function personalInstructions(preferences) {
50
+ const rules = [
51
+ "You are the user’s personal AI: capable, clear, attentive, and responsive. Match the user’s language. Let the user’s stated preferences and current situation shape how you speak; do not impose a cute or affectionate persona.",
52
+ ...DELEGATION_RULES,
53
+ "When creating a Task, provide a short title that names the work, a one-sentence objective, and a Markdown description with all detailed instructions. Keep the title free of checklists and long background. Preserve user requirements in the description.",
54
+ "Adapt to the user’s current words first, then their saved preferences. If the user explicitly changes how they want you to respond in future, save it with personal_preference. Do not infer a lasting emotional trait from one conversation or claim human feelings or experiences.",
55
+ "Give the accurate answer or next step in the order this user prefers. Acknowledge feelings only when relevant, without guessing how the user feels. Avoid formulaic reassurance, praise, pet names, emojis, or jokes unless the user welcomes them and the moment fits. Be accurate about task state, evidence, and uncertainty."
56
+ ];
57
+ if (preferences.addressAs) rules.push(`Address the user as ${JSON.stringify(preferences.addressAs)} when a name fits naturally.`);
58
+ if (preferences.guidance) rules.push(`User's explicit response preference: ${JSON.stringify(preferences.guidance)}. Follow it when relevant, subject to accuracy and the current request.`);
59
+ if (preferences.warmth) rules.push({
60
+ reserved: "Tone: calm and direct; skip emotional preambles.",
61
+ balanced: "Tone: friendly and natural.",
62
+ gentle: "Tone: softly supportive without being sentimental."
63
+ }[preferences.warmth]);
64
+ if (preferences.humor) rules.push({
65
+ none: "Do not add jokes.",
66
+ occasional: "Use an occasional light touch when the moment fits.",
67
+ playful: "Be lightly playful in easy moments."
68
+ }[preferences.humor]);
69
+ if (preferences.supportMode) rules.push({
70
+ listen: "When the user is struggling, listen and reflect briefly before proposing fixes.",
71
+ untangle: "When the user is struggling, help name the core problem and make it manageable.",
72
+ solutions: "When the user is struggling, offer a concrete next step promptly."
73
+ }[preferences.supportMode]);
74
+ if (preferences.detailLevel) rules.push({
75
+ brief: "Keep replies short and lead with the answer.",
76
+ balanced: "Give the answer and only the context needed to act.",
77
+ detailed: "Explain reasoning and tradeoffs when useful."
78
+ }[preferences.detailLevel]);
79
+ if (preferences.proactivity) rules.push({
80
+ decisions: "Only proactively surface decisions and outcomes.",
81
+ important: "Proactively surface important milestones as well as outcomes.",
82
+ open: "You may offer useful suggestions without flooding the user."
83
+ }[preferences.proactivity]);
84
+ return rules.join("\n");
85
+ }
86
+ async function refreshPersonalDelegationGuidance(service, ownerId) {
87
+ const agent = new AgentCatalogRepository().get(personalAgentId(ownerId));
88
+ const instructions = agent?.profile?.instructions;
89
+ if (!agent || !instructions) return;
90
+ const oldRule = [
91
+ PRIOR_DELEGATION_RULES,
92
+ PREVIOUS_DELEGATION_RULES,
93
+ LEGACY_DELEGATION_RULE
94
+ ].find((rule) => instructions.includes(rule));
95
+ if (!oldRule) return;
96
+ try {
97
+ await new AgentCatalogService().update(agent.id, { profile: {
98
+ ...agent.profile,
99
+ instructions: instructions.replace(oldRule, DELEGATION_RULES.join("\n"))
100
+ } }, agent.revision);
101
+ service.refreshAgentCatalog?.();
102
+ const conversationId = getPersonalAgent(ownerId)?.conversationId;
103
+ if (conversationId) service.agentService?.evictSessionAgent(conversationId);
104
+ } catch (error) {
105
+ if (!(error instanceof Error && error.message === "Agent revision conflict")) throw error;
106
+ }
107
+ }
108
+ async function listPersonalModels() {
109
+ return (await getAvailableModels()).filter((model) => getModelThinking(model).options.includes("off")).map((model) => ({
110
+ id: `${model.provider}/${model.id}`,
111
+ name: model.name ?? model.id
112
+ }));
113
+ }
114
+ const inFlightProvisioning = /* @__PURE__ */ new Map();
115
+ function ensurePersonalConversationVisibility(ownerId) {
116
+ const conversationId = getPersonalAgent(ownerId)?.conversationId;
117
+ if (!conversationId) return;
118
+ const session = getSessionMetadata(conversationId);
119
+ if (!session || session.hiddenFromSessionList && session.customData?.keepHiddenFromSessionList === true) return;
120
+ patchSessionMetadata(conversationId, {
121
+ hiddenFromSessionList: true,
122
+ customData: {
123
+ ...session.customData,
124
+ keepHiddenFromSessionList: true
125
+ }
126
+ });
127
+ }
128
+ function createOrResumePersonalAgent(service, ownerId, requestedModel, availableModels = listPersonalModels) {
129
+ const current = inFlightProvisioning.get(ownerId);
130
+ if (current) return current;
131
+ const pending = provisionPersonalAgent(service, ownerId, requestedModel, availableModels);
132
+ inFlightProvisioning.set(ownerId, pending);
133
+ pending.finally(() => {
134
+ if (inFlightProvisioning.get(ownerId) === pending) inFlightProvisioning.delete(ownerId);
135
+ }).catch(() => {});
136
+ return pending;
137
+ }
138
+ async function provisionPersonalAgent(service, ownerId, requestedModel, availableModels = listPersonalModels) {
139
+ const existingIdentity = getPersonalAgent(ownerId);
140
+ if (existingIdentity?.state === "ready") {
141
+ await refreshPersonalDelegationGuidance(service, ownerId);
142
+ ensurePersonalConversationVisibility(ownerId);
143
+ return getPersonalAgent(ownerId) ?? existingIdentity;
144
+ }
145
+ const agentId = personalAgentId(ownerId);
146
+ const existing = new AgentCatalogRepository().get(agentId);
147
+ const available = await availableModels();
148
+ const preferredModel = requestedModel ?? existing?.models?.chat?.primary;
149
+ const fastModel = preferredModel ? void 0 : new AgentCatalogRepository().getSettings().defaults.models.intents.fast?.primary;
150
+ const chosen = preferredModel ? available.find((model) => model.id === preferredModel) : available.find((model) => model.id === fastModel) ?? available[0];
151
+ if (!chosen) throw new Error("Choose a configured model that supports thinking off");
152
+ const catalog = new AgentCatalogService();
153
+ if (!existing) await catalog.create({
154
+ id: agentId,
155
+ enabled: true,
156
+ profile: {
157
+ name: "Personal AI",
158
+ description: "A personal AI that adapts its responses to the user and coordinates work.",
159
+ creature: "assistant",
160
+ language: "zh",
161
+ emoji: appearanceEmoji("spark"),
162
+ responsePreferences: DEFAULT_PERSONAL_PREFERENCES,
163
+ instructions: personalInstructions(DEFAULT_PERSONAL_PREFERENCES)
164
+ },
165
+ toolAllowlist: [...PERSONAL_MAIN_TOOL_IDS],
166
+ skills: {
167
+ mode: "replace",
168
+ include: []
169
+ },
170
+ runtime: { thinkingLevel: "off" },
171
+ models: { chat: {
172
+ primary: chosen.id,
173
+ fallbacks: []
174
+ } }
175
+ });
176
+ else if (existing.provisioningState !== "ready" || existing.models?.chat?.primary !== chosen.id || existing.runtime?.thinkingLevel !== "off") await catalog.update(agentId, {
177
+ models: { chat: {
178
+ primary: chosen.id,
179
+ fallbacks: []
180
+ } },
181
+ runtime: {
182
+ ...existing.runtime,
183
+ thinkingLevel: "off"
184
+ }
185
+ });
186
+ const record = getPersonalAgent(ownerId);
187
+ if (!record) throw new Error("Personal Agent provisioning did not complete");
188
+ const conversationId = record.conversationId;
189
+ service.refreshAgentCatalog();
190
+ if (!getSessionMetadata(conversationId)) createConversation({
191
+ agentId,
192
+ sourceChannel: "webchat",
193
+ name: record.displayName,
194
+ hiddenFromSessionList: true,
195
+ customData: {
196
+ personalAgent: true,
197
+ keepHiddenFromSessionList: true
198
+ }
199
+ }, "", conversationId);
200
+ ensurePersonalConversationVisibility(ownerId);
201
+ setSessionConfig(conversationId, {
202
+ modelOverride: chosen.id,
203
+ fixedModel: true,
204
+ thinkingLevel: "off"
205
+ }, process.cwd());
206
+ return getPersonalAgent(ownerId) ?? record;
207
+ }
208
+ async function patchPersonalProfile(service, ownerId, revision, displayName, preferences, appearance) {
209
+ const updated = await updatePersonalProfileRecord(ownerId, revision, displayName, preferences, appearance);
210
+ if (!updated) return null;
211
+ service.refreshAgentCatalog();
212
+ service.agentService.evictSessionAgent(updated.conversationId);
213
+ return updated;
214
+ }
215
+ async function updatePersonalProfileRecord(ownerId, revision, displayName, preferences, appearance) {
216
+ const current = new AgentCatalogRepository().get(personalAgentId(ownerId));
217
+ if (!current || current.provisioningState !== "ready" || current.revision !== revision || getPersonalAgent(ownerId)?.state !== "ready") return null;
218
+ const profile = {
219
+ ...current.profile,
220
+ name: displayName,
221
+ emoji: appearanceEmoji(appearance),
222
+ responsePreferences: preferences,
223
+ instructions: personalInstructions(preferences)
224
+ };
225
+ try {
226
+ await new AgentCatalogService().update(current.id, { profile }, revision);
227
+ } catch (error) {
228
+ if (error instanceof Error && error.message === "Agent revision conflict") return null;
229
+ throw error;
230
+ }
231
+ return getPersonalAgent(ownerId);
232
+ }
233
+ //#endregion
234
+ export { PersonalAppearanceSchema, PersonalPreferencesSchema, createOrResumePersonalAgent, ensurePersonalConversationVisibility, listPersonalModels, patchPersonalProfile, personalInstructions, refreshPersonalDelegationGuidance, updatePersonalProfileRecord };
@@ -6,6 +6,7 @@ import { findConversationIdByTranscriptId } from "../storage/sqlite/session-repo
6
6
  import { getSessionConfig } from "../storage/sqlite/config-repository.js";
7
7
  import { init_sqlite } from "../storage/sqlite/index.js";
8
8
  import { SessionConfigSchema, init_schema } from "../config/schema.js";
9
+ import { isPersonalConversation } from "../personal-agent/repository.js";
9
10
  import { normalizeThinkLevel, normalizeVerboseLevel } from "../agent/transcript/thinking-types.js";
10
11
  import { evaluateSessionFreshness, resolveSessionResetPolicy } from "./reset-policy.js";
11
12
  import { resolveChannelResetConfig, resolveSessionResetType } from "./reset-type.js";
@@ -51,12 +52,13 @@ async function resolveSession(opts) {
51
52
  sessionStartedAt: sessionMetadata.sessionStartedAt ? Date.parse(sessionMetadata.sessionStartedAt) : void 0,
52
53
  lastInteractionAt: sessionMetadata.lastInteractionAt ? Date.parse(sessionMetadata.lastInteractionAt) : void 0
53
54
  } : void 0 });
54
- const fresh = (sessionMetadata ? evaluateSessionFreshness({
55
+ const freshness = sessionMetadata ? evaluateSessionFreshness({
55
56
  updatedAt: Date.parse(sessionMetadata.updatedAt),
56
57
  ...lifecycle,
57
58
  now,
58
59
  policy: resetPolicy
59
- }) : { fresh: false }).fresh;
60
+ }) : { fresh: false };
61
+ const fresh = Boolean(sessionMetadata && conversationId && isPersonalConversation(conversationId)) || freshness.fresh;
60
62
  const transcriptId = opts.transcriptId?.trim() || (fresh ? sessionMetadata?.transcriptId : void 0) || randomUUID();
61
63
  const isNewSession = !fresh && !opts.transcriptId?.trim();
62
64
  if (isNewSession && conversationId) log.debug({
@@ -0,0 +1,12 @@
1
+ CREATE TABLE IF NOT EXISTS task_criterion_reviews (
2
+ task_id TEXT NOT NULL,
3
+ contract_version INTEGER NOT NULL,
4
+ criterion_index INTEGER NOT NULL,
5
+ criterion_text TEXT NOT NULL,
6
+ status TEXT NOT NULL CHECK (status IN ('passed', 'failed')),
7
+ note TEXT,
8
+ reviewed_by_json TEXT NOT NULL,
9
+ reviewed_at INTEGER NOT NULL,
10
+ PRIMARY KEY (task_id, contract_version, criterion_index),
11
+ FOREIGN KEY (task_id, contract_version) REFERENCES task_contracts(task_id, version) ON DELETE CASCADE
12
+ );
@@ -3,7 +3,7 @@ import type { ApplyMigrationsOptions } from './types.js';
3
3
  /** Baseline schema version applied from schema.sql on first open. */
4
4
  export declare const XOPC_DB_BASELINE_SCHEMA_VERSION = 165;
5
5
  /** Latest schema version this release supports (increment when adding migrations). */
6
- export declare const XOPC_DB_SCHEMA_VERSION = 228;
6
+ export declare const XOPC_DB_SCHEMA_VERSION = 229;
7
7
  export declare function resolveMigrationsDir(override?: string): string;
8
8
  /**
9
9
  * Apply sequential SQL migrations from (currentVersion + 1) through targetVersion.
@@ -57,7 +57,7 @@ function applySingleMigration(db, migration, discardOldScenes = false) {
57
57
  */
58
58
  function applyPendingMigrations(db, options = {}) {
59
59
  db.function("xopc_operation_id", () => currentOperationId() ?? null);
60
- const targetVersion = options.targetVersion ?? 228;
60
+ const targetVersion = options.targetVersion ?? 229;
61
61
  let currentVersion = readSchemaVersion(db);
62
62
  if (currentVersion > targetVersion) throw new DatabaseSchemaTooNewError(currentVersion, targetVersion);
63
63
  if (!options.migrationsDir && currentVersion < 165) throw new DatabaseSchemaTooOldError(currentVersion, 165);
@@ -95,7 +95,7 @@ function applyPendingMigrations(db, options = {}) {
95
95
  }
96
96
  /** Inspect schema version without mutating the database. */
97
97
  function inspectSchemaMigrationStatus(db, options = {}) {
98
- const appVersion = options.targetVersion ?? 228;
98
+ const appVersion = options.targetVersion ?? 229;
99
99
  const dbVersion = readSchemaVersion(db);
100
100
  if (dbVersion > appVersion) return {
101
101
  dbVersion,
@@ -137,7 +137,7 @@ var init_runner = __esmMin((() => {
137
137
  init_errors();
138
138
  log = createLogger("Sqlite:Migrations");
139
139
  XOPC_DB_BASELINE_SCHEMA_VERSION = 165;
140
- XOPC_DB_SCHEMA_VERSION = 228;
140
+ XOPC_DB_SCHEMA_VERSION = 229;
141
141
  }));
142
142
  //#endregion
143
143
  init_runner();
@@ -28,7 +28,7 @@ function ensureXopcDatabaseSchema(db, options = {}) {
28
28
  currentVersion = 165;
29
29
  }
30
30
  applyPendingMigrations(db, {
31
- targetVersion: 228,
31
+ targetVersion: 229,
32
32
  databasePath: fresh ? void 0 : options.databasePath
33
33
  });
34
34
  }
@@ -1277,6 +1277,19 @@ CREATE TABLE task_contracts (
1277
1277
  FOREIGN KEY (task_id) REFERENCES tasks(task_id) ON DELETE CASCADE
1278
1278
  );
1279
1279
 
1280
+ CREATE TABLE task_criterion_reviews (
1281
+ task_id TEXT NOT NULL,
1282
+ contract_version INTEGER NOT NULL,
1283
+ criterion_index INTEGER NOT NULL,
1284
+ criterion_text TEXT NOT NULL,
1285
+ status TEXT NOT NULL CHECK (status IN ('passed', 'failed')),
1286
+ note TEXT,
1287
+ reviewed_by_json TEXT NOT NULL,
1288
+ reviewed_at INTEGER NOT NULL,
1289
+ PRIMARY KEY (task_id, contract_version, criterion_index),
1290
+ FOREIGN KEY (task_id, contract_version) REFERENCES task_contracts(task_id, version) ON DELETE CASCADE
1291
+ );
1292
+
1280
1293
  CREATE TABLE task_dependencies (
1281
1294
  task_id TEXT NOT NULL,
1282
1295
  depends_on_task_id TEXT NOT NULL,
@@ -90,8 +90,12 @@ function listSessionMetadata(query = {}) {
90
90
  JOIN task_origin_links origin ON origin.task_id = worker.task_id
91
91
  JOIN sessions parent ON parent.conversation_id = origin.conversation_id
92
92
  WHERE worker.conversation_id = s.conversation_id AND worker.role = 'execution'
93
- AND parent.hidden_from_session_list = 0
94
- AND (parent.updated_at >= ? OR parent.status = 'pinned' OR parent.conversation_id = ?)
93
+ AND (
94
+ COALESCE(CASE WHEN json_valid(parent.custom_data_json)
95
+ THEN json_extract(parent.custom_data_json, '$.keepHiddenFromSessionList') END, 0) = 1
96
+ OR (parent.hidden_from_session_list = 0
97
+ AND (parent.updated_at >= ? OR parent.status = 'pinned' OR parent.conversation_id = ?))
98
+ )
95
99
  )`);
96
100
  params.push(query.updatedAfter ?? 0, query.includeConversationId ?? "");
97
101
  }
@@ -14,7 +14,8 @@ function shouldRevealSessionForUserMessage(db, conversationId) {
14
14
  const row = db.prepare(`SELECT custom_data_json FROM sessions WHERE conversation_id = ?`).get(conversationId);
15
15
  if (!row?.custom_data_json) return true;
16
16
  try {
17
- return JSON.parse(row.custom_data_json).deferVisibilityUntilOutput !== true;
17
+ const customData = JSON.parse(row.custom_data_json);
18
+ return customData.deferVisibilityUntilOutput !== true && customData.keepHiddenFromSessionList !== true;
18
19
  } catch {
19
20
  return true;
20
21
  }
@@ -8,6 +8,7 @@ import { TaskConversationRepository } from "../task-conversation-repository.js";
8
8
  import { TaskReadModelProjector } from "../task-read-model-projector.js";
9
9
  import { TaskContextRepository } from "../task-context-repository.js";
10
10
  import { TaskDependencyService } from "../task-dependency-service.js";
11
+ import { TaskCriterionReviewRepository } from "../task-criterion-review-repository.js";
11
12
  import { TaskValueMetricsService } from "../task-value-metrics-service.js";
12
13
  //#region src/tasks/capabilities/read.ts
13
14
  init_src();
@@ -37,6 +38,7 @@ function registerTaskReadCapabilities(dispatcher) {
37
38
  const context = new TaskContextRepository();
38
39
  const conversations = new TaskConversationRepository();
39
40
  const dependencies = new TaskDependencyService();
41
+ const criterionReviews = new TaskCriterionReviewRepository();
40
42
  dispatcher.register(defineReadCapability({
41
43
  id: "xopc.task_runs.get",
42
44
  majorVersion: 1,
@@ -106,6 +108,7 @@ function registerTaskReadCapabilities(dispatcher) {
106
108
  waits: runs.listActiveWaits(id),
107
109
  runs: runs.listByTask(id),
108
110
  receipts: runs.listReceipts(id),
111
+ criterionReviews: criterionReviews.list(id, task.latestContractVersion),
109
112
  context: context.list(id),
110
113
  conversation: conversations.requireState(id),
111
114
  sessions: conversations.listSessions(id),
@@ -8,6 +8,7 @@ import { TaskConversationRepository } from "./task-conversation-repository.js";
8
8
  import { TaskReadModelProjector } from "./task-read-model-projector.js";
9
9
  import { TaskContextRepository } from "./task-context-repository.js";
10
10
  import { TaskDependencyService } from "./task-dependency-service.js";
11
+ import { TaskCriterionReviewRepository } from "./task-criterion-review-repository.js";
11
12
  import { TaskCollaborationRepository } from "./task-collaboration-repository.js";
12
13
  import { createHash, randomUUID } from "node:crypto";
13
14
  //#region src/tasks/task-application-service.ts
@@ -231,7 +232,11 @@ var TaskApplicationService = class {
231
232
  };
232
233
  break;
233
234
  case "close":
234
- result = this.lifecycle(task.id, task.version, "closed", input.command.resolution);
235
+ result = input.command.resolution === "done" && (!new TaskCriterionReviewRepository().allPassed(task) || this.#runs.getActiveRoot(task.id) !== void 0 || this.#runs.listActiveWaits(task.id).length > 0) ? {
236
+ ok: false,
237
+ reason: "blocked",
238
+ model
239
+ } : this.lifecycle(task.id, task.version, "closed", input.command.resolution);
235
240
  break;
236
241
  case "reopen":
237
242
  result = task.phase === "closed" ? this.lifecycle(task.id, task.version, input.command.phase) : {
@@ -0,0 +1,22 @@
1
+ import type { ActorRef, Task } from '@xopcai/gateway-contract';
2
+ export interface TaskCriterionReview {
3
+ contractVersion: number;
4
+ criterionIndex: number;
5
+ criterionText: string;
6
+ status: 'passed' | 'failed';
7
+ note?: string;
8
+ reviewedBy: ActorRef;
9
+ reviewedAt: number;
10
+ }
11
+ export declare class TaskCriterionReviewRepository {
12
+ list(taskId: string, contractVersion: number): TaskCriterionReview[];
13
+ set(input: {
14
+ task: Task;
15
+ expectedVersion: number;
16
+ criterionIndex: number;
17
+ status: 'passed' | 'failed';
18
+ note?: string;
19
+ actor: ActorRef;
20
+ }): TaskCriterionReview | undefined;
21
+ allPassed(task: Task): boolean;
22
+ }