@xopcai/xopc 0.0.146 → 0.0.147

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 (376) hide show
  1. package/README.md +2 -2
  2. package/dist/browser-ext/manifest.json +1 -1
  3. package/dist/extensions/demo-memory/src/index.js +6 -4
  4. package/dist/extensions/demo-memory/src/index.js.map +1 -1
  5. package/dist/extensions/telegram/xopc.extension.json +1 -1
  6. package/dist/gateway/static/root/assets/Combination-14nmIgxH.js +41 -0
  7. package/dist/gateway/static/root/assets/activity-store-DXeSSlw1.js +1 -0
  8. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-gBVDdd-Q.js → agent-avatar-dicebear-CFdJKSjY.js} +1 -1
  9. package/dist/gateway/static/root/assets/agents-DKjbRpbA.js +2 -0
  10. package/dist/gateway/static/root/assets/api-Bs69B5zA.js +1 -0
  11. package/dist/gateway/static/root/assets/{app-management-settings-panel-Dd5dmRWY.js → app-management-settings-panel-ag1ViXT_.js} +1 -1
  12. package/dist/gateway/static/root/assets/{appearance-settings-D89pY61C.js → appearance-settings-C6iMpwOM.js} +1 -1
  13. package/dist/gateway/static/root/assets/apps-page-CpX3lBFF.js +1 -0
  14. package/dist/gateway/static/root/assets/{archive-plugin-BZj1tk3p.js → archive-plugin-Dwi3mIBy.js} +1 -1
  15. package/dist/gateway/static/root/assets/{attachment-load-18eo6l3m.js → attachment-load-BaCDoq40.js} +1 -1
  16. package/dist/gateway/static/root/assets/{automation-suggestion-card-F1g3MckR.js → automation-suggestion-card-CwqtFgnw.js} +1 -1
  17. package/dist/gateway/static/root/assets/automations-page-DlupOxFQ.js +6 -0
  18. package/dist/gateway/static/root/assets/{binary-plugins-jOYMquLP.js → binary-plugins-DoAYhsxa.js} +1 -1
  19. package/dist/gateway/static/root/assets/{block-editor-CD77nXJU.js → block-editor-Bw72pO7S.js} +31 -31
  20. package/dist/gateway/static/root/assets/browser-settings-page-BwLoUBcZ.js +8 -0
  21. package/dist/gateway/static/root/assets/capability-presets-api-vdbAR65Q.js +1 -0
  22. package/dist/gateway/static/root/assets/capability-presets-settings-panel-BAsKbJgm.js +2 -0
  23. package/dist/gateway/static/root/assets/{channel-recipient-api-fTlTnWB4.js → channel-recipient-api-rTG26jpV.js} +1 -1
  24. package/dist/gateway/static/root/assets/channels-settings-CxFWy0cE.js +1 -0
  25. package/dist/gateway/static/root/assets/channels-status-swr-OKlqTtKJ.js +1 -0
  26. package/dist/gateway/static/root/assets/{connector-logo-g9f07qO6.js → connector-logo-DIMP4NWY.js} +1 -1
  27. package/dist/gateway/static/root/assets/connectors-page-BjQQwX62.js +2 -0
  28. package/dist/gateway/static/root/assets/{desktop-pet-DwPVWi3D.js → desktop-pet-kQq2e0BN.js} +1 -1
  29. package/dist/gateway/static/root/assets/{desktop-pet-settings-Dm1N7RRX.js → desktop-pet-settings-B6vtozMY.js} +1 -1
  30. package/dist/gateway/static/root/assets/{directory-picker-path-field-hZghTKie.js → directory-picker-path-field-Dn5-e3v4.js} +1 -1
  31. package/dist/gateway/static/root/assets/dist-C230izr8.js +1 -0
  32. package/dist/gateway/static/root/assets/dist-CxGUk8J-.js +1 -0
  33. package/dist/gateway/static/root/assets/dreaming-settings-BzwIujPG.js +3 -0
  34. package/dist/gateway/static/root/assets/extension-debug-page-D_e_hsEy.js +1 -0
  35. package/dist/gateway/static/root/assets/{extension-page-otKJCjKP.js → extension-page-D15CWHBd.js} +1 -1
  36. package/dist/gateway/static/root/assets/{extension-settings-page-ifHzMfT-.js → extension-settings-page-D4P0n1om.js} +1 -1
  37. package/dist/gateway/static/root/assets/{gateway-config-api-BQX5GGl2.js → gateway-config-api-B4qZctjG.js} +1 -1
  38. package/dist/gateway/static/root/assets/{gateway-settings-BfXo0j0O.js → gateway-settings-BvndV7TP.js} +1 -1
  39. package/dist/gateway/static/root/assets/{gateway-startup-retry-DtoLihQE.js → gateway-startup-retry-BpgMunEb.js} +1 -1
  40. package/dist/gateway/static/root/assets/{goal-create-dialog-C_Qw_QgW.js → goal-create-dialog-DrVHKXHq.js} +1 -1
  41. package/dist/gateway/static/root/assets/goal-detail-page-PHlCwv68.js +4 -0
  42. package/dist/gateway/static/root/assets/{goals-config-api-DQJ5mBXB.js → goals-config-api-B6YJB_ct.js} +1 -1
  43. package/dist/gateway/static/root/assets/goals-page-Hg9uyO6e.js +2 -0
  44. package/dist/gateway/static/root/assets/{goals-settings-CQX8zWKe.js → goals-settings-BROWCIcL.js} +1 -1
  45. package/dist/gateway/static/root/assets/{heartbeat-settings-yy_Pt_24.js → heartbeat-settings-CoCwIOIg.js} +1 -1
  46. package/dist/gateway/static/root/assets/index-CxkNzw3e.js +259 -0
  47. package/dist/gateway/static/root/assets/index-DjCSOyaN.css +1 -0
  48. package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-Bm_AIYQ7.js +1 -0
  49. package/dist/gateway/static/root/assets/local-app-workbench-page-BJWFcxwG.js +2 -0
  50. package/dist/gateway/static/root/assets/local-apps-page-BsiZMrEf.js +1 -0
  51. package/dist/gateway/static/root/assets/{locale-store-CiM-D9jA.js → locale-store-Bp8joZck.js} +1 -1
  52. package/dist/gateway/static/root/assets/logs-page-DOmK61ey.js +7 -0
  53. package/dist/gateway/static/root/assets/{markdown-split-BYasrWPk.js → markdown-split-Dy7QpaAz.js} +1 -1
  54. package/dist/gateway/static/root/assets/{media-plugins--cJpmHc2.js → media-plugins-3Lxliy9D.js} +1 -1
  55. package/dist/gateway/static/root/assets/messages-CQGpD-dC.js +5 -0
  56. package/dist/gateway/static/root/assets/models-hub-panel-DGCZom4o.js +2 -0
  57. package/dist/gateway/static/root/assets/{notes-page-Digm3EgB.js → notes-page-BJtT4vSf.js} +1 -1
  58. package/dist/gateway/static/root/assets/notes-workbench-B_bN7cOR.js +4 -0
  59. package/dist/gateway/static/root/assets/{page-tabs-CGVMJEW0.js → page-tabs-DKB6RDre.js} +1 -1
  60. package/dist/gateway/static/root/assets/{preview-open-alternatives-BBAkU4xW.js → preview-open-alternatives-Br_YhYHp.js} +1 -1
  61. package/dist/gateway/static/root/assets/project-detail-page-Dq8JouJj.js +1 -0
  62. package/dist/gateway/static/root/assets/projects-page-DvfL7fSe.js +1 -0
  63. package/dist/gateway/static/root/assets/remote-access-hub-DqwMXSXP.js +1 -0
  64. package/dist/gateway/static/root/assets/{save-bar-controls-D4B469dh.js → save-bar-controls-BgIE9BBh.js} +1 -1
  65. package/dist/gateway/static/root/assets/{schedule-field-Vy4OjH0i.js → schedule-field-BXDP-oMz.js} +1 -1
  66. package/dist/gateway/static/root/assets/{schema-form-CPYzgmby.js → schema-form-Dhv-SmjG.js} +1 -1
  67. package/dist/gateway/static/root/assets/sessions-page-B_mOZkQk.js +1 -0
  68. package/dist/gateway/static/root/assets/settings-advanced-gate-BHGmH6YS.js +1 -0
  69. package/dist/gateway/static/root/assets/{settings-collapsible-section-BB5y9vwh.js → settings-collapsible-section-CUTExnlK.js} +1 -1
  70. package/dist/gateway/static/root/assets/{settings-form-section-BfzJkVHd.js → settings-form-section-CmnDhsf0.js} +1 -1
  71. package/dist/gateway/static/root/assets/{settings-loading-skeleton-DM8iH25s.js → settings-loading-skeleton-B79dq-XY.js} +1 -1
  72. package/dist/gateway/static/root/assets/{settings-page-h5Alz_fA.js → settings-page-Db8uAv3X.js} +1 -1
  73. package/dist/gateway/static/root/assets/{settings-page-layout-DjbdpK2j.js → settings-page-layout-DaFwstQw.js} +1 -1
  74. package/dist/gateway/static/root/assets/setup-status-panel-BUSEj0KK.js +1 -0
  75. package/dist/gateway/static/root/assets/{share-preview-page-DxozU_zz.js → share-preview-page-Bi00uXzV.js} +1 -1
  76. package/dist/gateway/static/root/assets/shares-settings-DzsTYfuX.js +1 -0
  77. package/dist/gateway/static/root/assets/skill-reload-api-DSsdU081.js +1 -0
  78. package/dist/gateway/static/root/assets/skills-page-DeB1tQZL.js +2 -0
  79. package/dist/gateway/static/root/assets/{system-settings-panel-DNi9Ofuj.js → system-settings-panel-Cxaph7hW.js} +1 -1
  80. package/dist/gateway/static/root/assets/{theme-store-C9Dxcppm.js → theme-store-eCTN1RpG.js} +1 -1
  81. package/dist/gateway/static/root/assets/{typed-models-lib-B6Nw3iFM.js → typed-models-lib-CcZ_tyFY.js} +1 -1
  82. package/dist/gateway/static/root/assets/{use-channel-catalog-DE9cpn4G.js → use-channel-catalog-C4PWbNoi.js} +1 -1
  83. package/dist/gateway/static/root/assets/user-context-page-QTVMx_hG.js +1 -0
  84. package/dist/gateway/static/root/assets/{user-profile-fields-editor-DVBShNYF.js → user-profile-fields-editor-CPOO9Jz5.js} +1 -1
  85. package/dist/gateway/static/root/assets/{user-profile-settings-panel-CC0sf3vS.js → user-profile-settings-panel-C8cgtSF7.js} +1 -1
  86. package/dist/gateway/static/root/assets/{utils-DnsuE4YP.js → utils-CiZK2KwH.js} +1 -1
  87. package/dist/gateway/static/root/assets/voice-api-key-field-b-YZtvUu.js +1 -0
  88. package/dist/gateway/static/root/assets/work-discovery-page-4zVDOl2G.js +1 -0
  89. package/dist/gateway/static/root/assets/work-item-detail-page-CHe2tfkc.js +1 -0
  90. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DXc_pbVG.js → workflow-run-setup-panel-8SLCYeXE.js} +2 -2
  91. package/dist/gateway/static/root/assets/workflows-page-DEOFqiWn.js +11 -0
  92. package/dist/gateway/static/root/index.html +10 -9
  93. package/dist/package.js +1 -1
  94. package/dist/src/activity/types.d.ts +1 -1
  95. package/dist/src/agent/agent-instance-gateway.d.ts +1 -1
  96. package/dist/src/agent/agent-manager.d.ts +1 -1
  97. package/dist/src/agent/agent-manager.js +5 -4
  98. package/dist/src/agent/agent-manager.js.map +1 -1
  99. package/dist/src/agent/background-review/coordinator.js +0 -1
  100. package/dist/src/agent/background-review/coordinator.js.map +1 -1
  101. package/dist/src/agent/background-review/settings.d.ts +1 -1
  102. package/dist/src/agent/background-review/settings.js +10 -17
  103. package/dist/src/agent/background-review/settings.js.map +1 -1
  104. package/dist/src/agent/bootstrap/filter-bootstrap-files.d.ts +1 -1
  105. package/dist/src/agent/bootstrap/filter-bootstrap-files.js +1 -1
  106. package/dist/src/agent/bootstrap/filter-bootstrap-files.js.map +1 -1
  107. package/dist/src/agent/bootstrap/load-bootstrap-files.js +2 -3
  108. package/dist/src/agent/bootstrap/load-bootstrap-files.js.map +1 -1
  109. package/dist/src/agent/code-intelligence/binary.js +1 -1
  110. package/dist/src/agent/context/project-context.d.ts +14 -0
  111. package/dist/src/agent/context/project-context.js +23 -1
  112. package/dist/src/agent/context/project-context.js.map +1 -1
  113. package/dist/src/agent/context/workspace-templates/AGENTS.md +1 -1
  114. package/dist/src/agent/context/workspace.d.ts +1 -2
  115. package/dist/src/agent/context/workspace.js +2 -4
  116. package/dist/src/agent/context/workspace.js.map +1 -1
  117. package/dist/src/agent/embedded/run-for-session.js +1 -2
  118. package/dist/src/agent/embedded/run-for-session.js.map +1 -1
  119. package/dist/src/agent/embedded/run-turn.js +6 -1
  120. package/dist/src/agent/embedded/run-turn.js.map +1 -1
  121. package/dist/src/agent/embedded/types.d.ts +17 -0
  122. package/dist/src/agent/memory/builtin-memory-store.d.ts +2 -2
  123. package/dist/src/agent/memory/builtin-memory-store.js +2 -2
  124. package/dist/src/agent/memory/builtin-memory-store.js.map +1 -1
  125. package/dist/src/agent/memory/builtin-provider.d.ts +1 -3
  126. package/dist/src/agent/memory/builtin-provider.js +21 -48
  127. package/dist/src/agent/memory/builtin-provider.js.map +1 -1
  128. package/dist/src/agent/memory/context/planner.js +48 -9
  129. package/dist/src/agent/memory/context/planner.js.map +1 -1
  130. package/dist/src/agent/memory/context/types.d.ts +7 -1
  131. package/dist/src/agent/memory/context-fence.js +1 -1
  132. package/dist/src/agent/memory/context-fence.js.map +1 -1
  133. package/dist/src/agent/memory/create-memory-manager.js +2 -9
  134. package/dist/src/agent/memory/create-memory-manager.js.map +1 -1
  135. package/dist/src/agent/memory/dreaming/config.js +4 -9
  136. package/dist/src/agent/memory/dreaming/config.js.map +1 -1
  137. package/dist/src/agent/memory/dreaming/promotion-lifecycle.js +2 -2
  138. package/dist/src/agent/memory/dreaming/promotion-lifecycle.js.map +1 -1
  139. package/dist/src/agent/memory/dreaming/scope.d.ts +2 -3
  140. package/dist/src/agent/memory/dreaming/scope.js +8 -8
  141. package/dist/src/agent/memory/dreaming/scope.js.map +1 -1
  142. package/dist/src/agent/memory/manager.d.ts +1 -5
  143. package/dist/src/agent/memory/manager.js +2 -23
  144. package/dist/src/agent/memory/manager.js.map +1 -1
  145. package/dist/src/agent/memory/memory-config.d.ts +3 -3
  146. package/dist/src/agent/memory/memory-config.js +9 -14
  147. package/dist/src/agent/memory/memory-config.js.map +1 -1
  148. package/dist/src/agent/memory/types.d.ts +9 -5
  149. package/dist/src/agent/memory/understanding/service.js +21 -8
  150. package/dist/src/agent/memory/understanding/service.js.map +1 -1
  151. package/dist/src/agent/memory/understanding/types.d.ts +5 -0
  152. package/dist/src/agent/memory/user-context-coordinator.d.ts +1 -1
  153. package/dist/src/agent/memory/user-context-coordinator.js +6 -2
  154. package/dist/src/agent/memory/user-context-coordinator.js.map +1 -1
  155. package/dist/src/agent/orchestration/agent-orchestrator.js +2 -2
  156. package/dist/src/agent/orchestration/agent-orchestrator.js.map +1 -1
  157. package/dist/src/agent/prompt/memory/index.d.ts +1 -2
  158. package/dist/src/agent/prompt/memory/index.js +6 -7
  159. package/dist/src/agent/prompt/memory/index.js.map +1 -1
  160. package/dist/src/agent/prompt/sections/tooling.js +1 -1
  161. package/dist/src/agent/prompt/sections/tooling.js.map +1 -1
  162. package/dist/src/agent/service/direct-turn-helpers.js +13 -2
  163. package/dist/src/agent/service/direct-turn-helpers.js.map +1 -1
  164. package/dist/src/agent/tools/curated-memory-tool.js +4 -4
  165. package/dist/src/agent/tools/curated-memory-tool.js.map +1 -1
  166. package/dist/src/agent/tools/factory.d.ts +1 -1
  167. package/dist/src/agent/tools/factory.js +2 -2
  168. package/dist/src/agent/tools/factory.js.map +1 -1
  169. package/dist/src/agent/tools/memory-tool.js +1 -1
  170. package/dist/src/agent/tools/memory-tool.js.map +1 -1
  171. package/dist/src/agent/workflow/workflow-child-tools.js +2 -3
  172. package/dist/src/agent/workflow/workflow-child-tools.js.map +1 -1
  173. package/dist/src/agent/workspace-runtime/registry.d.ts +5 -5
  174. package/dist/src/agent/workspace-runtime/registry.js +6 -11
  175. package/dist/src/agent/workspace-runtime/registry.js.map +1 -1
  176. package/dist/src/agent-manifest/index.js +2 -2
  177. package/dist/src/agent-manifest/prompt.js +1 -7
  178. package/dist/src/agent-manifest/prompt.js.map +1 -1
  179. package/dist/src/agent-manifest/schema.d.ts +0 -598
  180. package/dist/src/agent-manifest/schema.js +2 -143
  181. package/dist/src/agent-manifest/schema.js.map +1 -1
  182. package/dist/src/agent-manifest/validator.js +0 -12
  183. package/dist/src/agent-manifest/validator.js.map +1 -1
  184. package/dist/src/agent-runtime/memory-runtime.d.ts +2 -2
  185. package/dist/src/agent-runtime/memory-runtime.js +8 -7
  186. package/dist/src/agent-runtime/memory-runtime.js.map +1 -1
  187. package/dist/src/agent-runtime/runtime-profile.d.ts +2 -0
  188. package/dist/src/agent-runtime/runtime-profile.js +1 -1
  189. package/dist/src/agent-runtime/runtime-profile.js.map +1 -1
  190. package/dist/src/chat-commands/agent-edit.js +1 -2
  191. package/dist/src/chat-commands/agent-edit.js.map +1 -1
  192. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  193. package/dist/src/cli/commands/init.js +0 -22
  194. package/dist/src/cli/commands/init.js.map +1 -1
  195. package/dist/src/cli/templates.d.ts +1 -1
  196. package/dist/src/cli/templates.js +1 -16
  197. package/dist/src/cli/templates.js.map +1 -1
  198. package/dist/src/commands/agents.config.js +0 -10
  199. package/dist/src/commands/agents.config.js.map +1 -1
  200. package/dist/src/config/index.js +2 -2
  201. package/dist/src/config/paths.d.ts +0 -1
  202. package/dist/src/config/paths.js +1 -2
  203. package/dist/src/config/paths.js.map +1 -1
  204. package/dist/src/config/schema.d.ts +118 -532
  205. package/dist/src/config/schema.js +32 -26
  206. package/dist/src/config/schema.js.map +1 -1
  207. package/dist/src/extensions/loader.js +2 -1
  208. package/dist/src/extensions/loader.js.map +1 -1
  209. package/dist/src/gateway/agents-admin.d.ts +0 -2
  210. package/dist/src/gateway/agents-admin.js +0 -6
  211. package/dist/src/gateway/agents-admin.js.map +1 -1
  212. package/dist/src/gateway/capability-presets-admin.d.ts +0 -2
  213. package/dist/src/gateway/capability-presets-admin.js.map +1 -1
  214. package/dist/src/gateway/chat-stream/mapper.js +26 -0
  215. package/dist/src/gateway/chat-stream/mapper.js.map +1 -1
  216. package/dist/src/gateway/chat-stream/protocol.d.ts +16 -1
  217. package/dist/src/gateway/dreaming-automation-reconciler.d.ts +0 -1
  218. package/dist/src/gateway/dreaming-automation-reconciler.js +41 -63
  219. package/dist/src/gateway/dreaming-automation-reconciler.js.map +1 -1
  220. package/dist/src/gateway/hono/app.js +3 -1
  221. package/dist/src/gateway/hono/app.js.map +1 -1
  222. package/dist/src/gateway/hono/lib/config-payload.d.ts +0 -130
  223. package/dist/src/gateway/hono/lib/config-payload.js +0 -1
  224. package/dist/src/gateway/hono/lib/config-payload.js.map +1 -1
  225. package/dist/src/gateway/hono/routes/agents.js +6 -12
  226. package/dist/src/gateway/hono/routes/agents.js.map +1 -1
  227. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +6 -0
  228. package/dist/src/gateway/hono/routes/auth-registry-extensions.js.map +1 -1
  229. package/dist/src/gateway/hono/routes/capability-presets.js +2 -2
  230. package/dist/src/gateway/hono/routes/capability-presets.js.map +1 -1
  231. package/dist/src/gateway/hono/routes/dreaming.js +9 -20
  232. package/dist/src/gateway/hono/routes/dreaming.js.map +1 -1
  233. package/dist/src/gateway/hono/routes/index.js +4 -0
  234. package/dist/src/gateway/hono/routes/index.js.map +1 -1
  235. package/dist/src/gateway/hono/routes/local-apps.d.ts +5 -0
  236. package/dist/src/gateway/hono/routes/local-apps.js +99 -0
  237. package/dist/src/gateway/hono/routes/local-apps.js.map +1 -0
  238. package/dist/src/gateway/hono/routes/memory.js +48 -65
  239. package/dist/src/gateway/hono/routes/memory.js.map +1 -1
  240. package/dist/src/gateway/hono/routes/projects.js +2 -2
  241. package/dist/src/gateway/hono/routes/projects.js.map +1 -1
  242. package/dist/src/gateway/hono/routes/work-discovery.d.ts +3 -0
  243. package/dist/src/gateway/hono/routes/work-discovery.js +150 -0
  244. package/dist/src/gateway/hono/routes/work-discovery.js.map +1 -0
  245. package/dist/src/gateway/hono/routes/you.d.ts +3 -0
  246. package/dist/src/gateway/hono/routes/you.js +358 -91
  247. package/dist/src/gateway/hono/routes/you.js.map +1 -1
  248. package/dist/src/gateway/service.d.ts +3 -0
  249. package/dist/src/gateway/service.js +12 -0
  250. package/dist/src/gateway/service.js.map +1 -1
  251. package/dist/src/knowledge/connected-knowledge-pipeline.js +9 -5
  252. package/dist/src/knowledge/connected-knowledge-pipeline.js.map +1 -1
  253. package/dist/src/local-apps/acceptance.d.ts +30 -0
  254. package/dist/src/local-apps/acceptance.js +93 -0
  255. package/dist/src/local-apps/acceptance.js.map +1 -0
  256. package/dist/src/local-apps/index.d.ts +5 -0
  257. package/dist/src/local-apps/index.js +4 -0
  258. package/dist/src/local-apps/preview-runtime-bridge.d.ts +4 -0
  259. package/dist/src/local-apps/preview-runtime-bridge.js +171 -0
  260. package/dist/src/local-apps/preview-runtime-bridge.js.map +1 -0
  261. package/dist/src/local-apps/runtime-entry.d.ts +8 -0
  262. package/dist/src/local-apps/runtime-entry.js +25 -0
  263. package/dist/src/local-apps/runtime-entry.js.map +1 -0
  264. package/dist/src/local-apps/scaffold.d.ts +8 -0
  265. package/dist/src/local-apps/scaffold.js +122 -0
  266. package/dist/src/local-apps/scaffold.js.map +1 -0
  267. package/dist/src/local-apps/service.d.ts +37 -0
  268. package/dist/src/local-apps/service.js +553 -0
  269. package/dist/src/local-apps/service.js.map +1 -0
  270. package/dist/src/local-apps/store.d.ts +44 -0
  271. package/dist/src/local-apps/store.js +195 -0
  272. package/dist/src/local-apps/store.js.map +1 -0
  273. package/dist/src/local-apps/types.d.ts +105 -0
  274. package/dist/src/local-apps/types.js +1 -0
  275. package/dist/src/storage/sqlite/index.d.ts +3 -2
  276. package/dist/src/storage/sqlite/index.js +4 -3
  277. package/dist/src/storage/sqlite/memory-index-repository.d.ts +2 -3
  278. package/dist/src/storage/sqlite/memory-index-repository.js +16 -20
  279. package/dist/src/storage/sqlite/memory-index-repository.js.map +1 -1
  280. package/dist/src/storage/sqlite/memory-records-repository.d.ts +18 -10
  281. package/dist/src/storage/sqlite/memory-records-repository.js +79 -34
  282. package/dist/src/storage/sqlite/memory-records-repository.js.map +1 -1
  283. package/dist/src/storage/sqlite/memory-reference-consent-repository.d.ts +27 -0
  284. package/dist/src/storage/sqlite/memory-reference-consent-repository.js +109 -0
  285. package/dist/src/storage/sqlite/memory-reference-consent-repository.js.map +1 -0
  286. package/dist/src/storage/sqlite/migrations/038_user_owned_memory.sql +68 -0
  287. package/dist/src/storage/sqlite/migrations/039_memory_reference_consents.sql +19 -0
  288. package/dist/src/storage/sqlite/migrations/040_local_apps.sql +32 -0
  289. package/dist/src/storage/sqlite/migrations/041_local_app_release_lifecycle.sql +17 -0
  290. package/dist/src/storage/sqlite/migrations/042_work_discovery.sql +41 -0
  291. package/dist/src/storage/sqlite/migrations/043_local_app_acceptance_runs.sql +16 -0
  292. package/dist/src/storage/sqlite/migrations/044_repair_work_discovery_foreign_keys.sql +75 -0
  293. package/dist/src/storage/sqlite/migrations/045_extension_ui_grants.sql +13 -0
  294. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  295. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  296. package/dist/src/storage/sqlite/migrations/runner.js.map +1 -1
  297. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  298. package/dist/src/storage/sqlite/schema.js +1 -1
  299. package/dist/src/storage/sqlite/schema.sql +20 -0
  300. package/dist/src/user-context/config.d.ts +227 -0
  301. package/dist/src/user-context/config.js +158 -0
  302. package/dist/src/user-context/config.js.map +1 -0
  303. package/dist/src/user-context/import.d.ts +1 -1
  304. package/dist/src/user-context/import.js +6 -1
  305. package/dist/src/user-context/import.js.map +1 -1
  306. package/dist/src/user-context/owner.d.ts +5 -0
  307. package/dist/src/user-context/owner.js +9 -0
  308. package/dist/src/user-context/owner.js.map +1 -0
  309. package/dist/src/user-context/projection.d.ts +11 -9
  310. package/dist/src/user-context/projection.js +74 -47
  311. package/dist/src/user-context/projection.js.map +1 -1
  312. package/dist/src/user-context/runtime.d.ts +13 -0
  313. package/dist/src/user-context/runtime.js +36 -0
  314. package/dist/src/user-context/runtime.js.map +1 -0
  315. package/dist/src/work-discovery/analyzer.d.ts +11 -0
  316. package/dist/src/work-discovery/analyzer.js +171 -0
  317. package/dist/src/work-discovery/analyzer.js.map +1 -0
  318. package/dist/src/work-discovery/index.d.ts +5 -0
  319. package/dist/src/work-discovery/index.js +5 -0
  320. package/dist/src/work-discovery/probe.d.ts +12 -0
  321. package/dist/src/work-discovery/probe.js +335 -0
  322. package/dist/src/work-discovery/probe.js.map +1 -0
  323. package/dist/src/work-discovery/repository.d.ts +11 -0
  324. package/dist/src/work-discovery/repository.js +100 -0
  325. package/dist/src/work-discovery/repository.js.map +1 -0
  326. package/dist/src/work-discovery/service.d.ts +30 -0
  327. package/dist/src/work-discovery/service.js +387 -0
  328. package/dist/src/work-discovery/service.js.map +1 -0
  329. package/dist/src/work-discovery/types.d.ts +114 -0
  330. package/dist/src/work-discovery/types.js +1 -0
  331. package/dist/src/workflows/service/workflow-session-bridge.js +1 -1
  332. package/dist/src/workflows/service/workflow-session-bridge.js.map +1 -1
  333. package/package.json +4 -3
  334. package/skills/engineering/build-xopc-local-app/SKILL.md +45 -0
  335. package/skills/engineering/build-xopc-local-app/references/app-contract.md +33 -0
  336. package/skills/engineering/build-xopc-local-app/scripts/validate-local-app.mjs +72 -0
  337. package/dist/gateway/static/root/assets/Combination-DolwnuKi.js +0 -41
  338. package/dist/gateway/static/root/assets/activity-center-store-3l9ahUqb.js +0 -1
  339. package/dist/gateway/static/root/assets/agents-BLp5ItD3.js +0 -2
  340. package/dist/gateway/static/root/assets/apps-page-CgOy905b.js +0 -1
  341. package/dist/gateway/static/root/assets/automations-page-Bdj0A_IC.js +0 -6
  342. package/dist/gateway/static/root/assets/browser-settings-page-D73ClpC2.js +0 -8
  343. package/dist/gateway/static/root/assets/capability-presets-api-DZwIrY_P.js +0 -1
  344. package/dist/gateway/static/root/assets/capability-presets-settings-panel-Dw2uinRX.js +0 -2
  345. package/dist/gateway/static/root/assets/channels-settings-g9TZdnQh.js +0 -1
  346. package/dist/gateway/static/root/assets/channels-status-swr-CJauF1CW.js +0 -1
  347. package/dist/gateway/static/root/assets/connectors-page-CJLsXBB0.js +0 -2
  348. package/dist/gateway/static/root/assets/dist-C99RGfAH.js +0 -1
  349. package/dist/gateway/static/root/assets/dreaming-settings-B_LcHWcv.js +0 -3
  350. package/dist/gateway/static/root/assets/extension-debug-page-BqguEetG.js +0 -1
  351. package/dist/gateway/static/root/assets/goal-detail-page-BnUrr9_O.js +0 -4
  352. package/dist/gateway/static/root/assets/goals-page-BgDCoiG0.js +0 -2
  353. package/dist/gateway/static/root/assets/index-BJGusbyV.js +0 -259
  354. package/dist/gateway/static/root/assets/index-CSLF84-Q.css +0 -1
  355. package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-D1rVyDdf.js +0 -1
  356. package/dist/gateway/static/root/assets/logs-page-C35Xa_mx.js +0 -7
  357. package/dist/gateway/static/root/assets/messages-Cb1VMeqP.js +0 -5
  358. package/dist/gateway/static/root/assets/models-hub-panel-CqehWxbT.js +0 -2
  359. package/dist/gateway/static/root/assets/notes-workbench-CCuL7qlg.js +0 -4
  360. package/dist/gateway/static/root/assets/project-detail-page-DTWPEtSE.js +0 -1
  361. package/dist/gateway/static/root/assets/projects-page-NnJpsIAD.js +0 -1
  362. package/dist/gateway/static/root/assets/remote-access-hub-wbk1GCvg.js +0 -1
  363. package/dist/gateway/static/root/assets/sessions-page-Do0ZNuqM.js +0 -1
  364. package/dist/gateway/static/root/assets/settings-advanced-gate-HeYP_JCr.js +0 -1
  365. package/dist/gateway/static/root/assets/setup-status-panel-bjbH7U6x.js +0 -1
  366. package/dist/gateway/static/root/assets/shares-settings-Cl_bE9gQ.js +0 -1
  367. package/dist/gateway/static/root/assets/skill-reload-api-DcqbKYgB.js +0 -1
  368. package/dist/gateway/static/root/assets/skills-page-D_Xkjxtr.js +0 -2
  369. package/dist/gateway/static/root/assets/user-context-page-BtU2sQoK.js +0 -1
  370. package/dist/gateway/static/root/assets/voice-api-key-field-BIcSMf0O.js +0 -1
  371. package/dist/gateway/static/root/assets/work-item-detail-page-ChCKymS7.js +0 -1
  372. package/dist/gateway/static/root/assets/workflows-page-CheHRVox.js +0 -11
  373. package/dist/src/agent/context/workspace-templates/MEMORY.md +0 -33
  374. package/dist/src/agent/memory/access-policy.d.ts +0 -12
  375. package/dist/src/agent/memory/access-policy.js +0 -44
  376. package/dist/src/agent/memory/access-policy.js.map +0 -1
@@ -1,28 +1,30 @@
1
1
  import { runSqliteWriteTransaction } from "../../../storage/sqlite/transaction.js";
2
2
  import { deleteMemoryRecord, getMemoryRecord, listMemoryRecords, upsertMemoryRecord } from "../../../storage/sqlite/memory-records-repository.js";
3
3
  import { listKnowledgeSourceItems, listKnowledgeSyncRuns } from "../../../storage/sqlite/knowledge-repository.js";
4
+ import { getConnectorConnection, listConnectorConnections } from "../../../storage/sqlite/connector-repository.js";
4
5
  import { USER_TRUST_LEVELS, isUserTrustLevel } from "../../../user-context/trust-policy.js";
5
6
  import { getUserTrustPolicy, setUserTrustPolicy } from "../../../storage/sqlite/user-trust-repository.js";
7
+ import { decideMemoryReferenceConsent, listMemoryReferenceConsents, revokeMemoryReferenceConsent } from "../../../storage/sqlite/memory-reference-consent-repository.js";
6
8
  import { getUserProfilePromptState, setUserProfilePromptState } from "../../../storage/sqlite/user-profile-setup-repository.js";
7
9
  import "../../../storage/sqlite/index.js";
8
- import { MemoryPolicySchema, init_schema } from "../../../agent-manifest/schema.js";
10
+ import { UserContextConfigSchema, init_config } from "../../../user-context/config.js";
9
11
  import { init_agent_scope, resolveDefaultAgentId } from "../../../agent/agent-scope.js";
10
- import { resolveEffectiveAgentManifestForAgent } from "../../../config/agent-profile.js";
11
12
  import { GoalService } from "../../../goals/goal-service.js";
12
13
  import { draftGoalContract } from "../../../goals/goal-contract-draft.js";
13
14
  import "../../../goals/index.js";
15
+ import { revokeComposioConnection } from "../../../connectors/composio.js";
14
16
  import { listConnectorCatalog } from "../../../connectors/catalog.js";
15
17
  import { nextMemoryReviewAt, resolveMemoryStability } from "../../../agent/memory/lifecycle.js";
16
18
  import { listConnectorInstances } from "../../../connectors/instances.js";
17
19
  import { uninstallConnector } from "../../../connectors/install.js";
18
- import { prepareUpdateAgent, readUserProfileFile, writeUserProfileFile } from "../../agents-admin.js";
19
- import { isUserContextRecord, projectPersonalContextSources, projectUserContextRecord, recordsDerivedFromPersonalContextSource } from "../../../user-context/projection.js";
20
+ import { readUserProfileFile, writeUserProfileFile } from "../../agents-admin.js";
21
+ import { isUserContextMemoryKind, isUserContextRecord, projectPersonalContextSources, projectUserContextRecord, recordsDerivedFromPersonalContextSource } from "../../../user-context/projection.js";
20
22
  import { prepareUserContextImport } from "../../../user-context/import.js";
21
23
  import { buildUserProfileSetup, parseUserProfileMarkdown, patchUserProfileMarkdown } from "../../../user-context/profile.js";
22
24
  import { buildGoalSourceRecommendations } from "../../../user-context/source-recommendations.js";
23
25
  //#region src/gateway/hono/routes/you.ts
24
26
  init_agent_scope();
25
- init_schema();
27
+ init_config();
26
28
  const VISIBLE_STATUSES = new Set([
27
29
  "active",
28
30
  "candidate",
@@ -42,6 +44,8 @@ const PLAYBOOK_IDS = [
42
44
  "execution",
43
45
  "routines"
44
46
  ];
47
+ const PLAYBOOK_DISABLED_TAG = "playbook:disabled";
48
+ const PLAYBOOK_ORDER_PREFIX = "playbook:order:";
45
49
  const PROFILE_FIELD_LIMITS = {
46
50
  callName: 80,
47
51
  pronouns: 80,
@@ -57,13 +61,28 @@ const ALL_MEMORY_STATUSES = [
57
61
  "archived",
58
62
  "rejected"
59
63
  ];
60
- function listAllAgentMemoryRecords(agentId, statuses) {
64
+ const MEMORY_SENSITIVITIES = new Set([
65
+ "normal",
66
+ "personal",
67
+ "secret",
68
+ "regulated"
69
+ ]);
70
+ const MEMORY_DURABILITIES = new Set([
71
+ "ephemeral",
72
+ "durable",
73
+ "recurring"
74
+ ]);
75
+ const MEMORY_DISCLOSURE_POLICIES = new Set([
76
+ "silent",
77
+ "referenceable",
78
+ "ask_before_reference"
79
+ ]);
80
+ function listAllUserContextRecords(statuses) {
61
81
  return statuses.flatMap((status) => {
62
82
  const records = [];
63
83
  let offset = 0;
64
84
  while (true) {
65
85
  const page = listMemoryRecords({
66
- agentId,
67
86
  status,
68
87
  limit: 500,
69
88
  offset
@@ -75,6 +94,38 @@ function listAllAgentMemoryRecords(agentId, statuses) {
75
94
  return records;
76
95
  });
77
96
  }
97
+ function projectReferenceConsent(consent, record) {
98
+ return {
99
+ id: consent.id,
100
+ recordId: consent.recordId,
101
+ sessionKey: consent.sessionKey,
102
+ purpose: consent.purpose,
103
+ statement: record.content,
104
+ sourceName: record.source.provider ?? "local",
105
+ status: consent.status,
106
+ grantScope: consent.grantScope,
107
+ expiresAt: consent.expiresAt,
108
+ createdAt: consent.createdAt,
109
+ updatedAt: consent.updatedAt
110
+ };
111
+ }
112
+ function buildConflictGroups(records) {
113
+ const groups = /* @__PURE__ */ new Map();
114
+ for (const record of records) {
115
+ if (!record.conflictGroupId) continue;
116
+ const group = groups.get(record.conflictGroupId) ?? [];
117
+ group.push(record);
118
+ groups.set(record.conflictGroupId, group);
119
+ }
120
+ return [...groups.entries()].filter(([, group]) => group.length > 1 && group.some((record) => VISIBLE_STATUSES.has(record.status))).map(([id, group]) => ({
121
+ id,
122
+ records: group.sort((left, right) => Date.parse(right.updatedAt) - Date.parse(left.updatedAt)).map((record) => ({
123
+ ...projectUserContextRecord(record),
124
+ storedStatus: record.status
125
+ })),
126
+ unresolved: group.filter((record) => VISIBLE_STATUSES.has(record.status)).length > 1
127
+ }));
128
+ }
78
129
  async function readProfileBundle(config) {
79
130
  const result = await readUserProfileFile();
80
131
  const profileContent = result.ok ? result.data.content : "";
@@ -107,20 +158,33 @@ function playbookForRecord(record) {
107
158
  if (record.kind === "task_lesson" || record.kind === "derived_insight") return "execution";
108
159
  if (record.kind === "routine") return "routines";
109
160
  }
161
+ function playbookRuleOrder(record) {
162
+ const tag = record.tags?.find((value) => value.startsWith(PLAYBOOK_ORDER_PREFIX));
163
+ const parsed = tag ? Number.parseInt(tag.slice(15), 10) : NaN;
164
+ return Number.isFinite(parsed) ? parsed : 1e3;
165
+ }
166
+ function patchPlaybookRuleTags(record, patch) {
167
+ let tags = (record.tags ?? []).filter((tag) => !tag.startsWith(PLAYBOOK_ORDER_PREFIX));
168
+ if (patch.enabled === true) tags = tags.filter((tag) => tag !== PLAYBOOK_DISABLED_TAG);
169
+ if (patch.enabled === false) tags.push(PLAYBOOK_DISABLED_TAG);
170
+ if (patch.order !== void 0) tags.push(`${PLAYBOOK_ORDER_PREFIX}${patch.order}`);
171
+ return [...new Set(tags)];
172
+ }
110
173
  function buildPersonalPlaybooks(records) {
111
- return PLAYBOOK_IDS.flatMap((id) => {
112
- const rules = records.filter((record) => playbookForRecord(record) === id);
113
- if (rules.length === 0) return [];
114
- return [{
174
+ return PLAYBOOK_IDS.map((id) => {
175
+ const rules = records.filter((record) => playbookForRecord(record) === id).sort((left, right) => playbookRuleOrder(left) - playbookRuleOrder(right) || left.updatedAt.localeCompare(right.updatedAt));
176
+ return {
115
177
  id,
116
- enabled: rules.some((record) => record.status === "active"),
178
+ enabled: rules.some((record) => !record.tags?.includes(PLAYBOOK_DISABLED_TAG)),
117
179
  rules: rules.map((record) => ({
118
180
  id: record.id,
119
181
  statement: record.content,
120
- origin: record.explicitness
182
+ origin: record.explicitness,
183
+ enabled: !record.tags?.includes(PLAYBOOK_DISABLED_TAG),
184
+ order: playbookRuleOrder(record)
121
185
  })),
122
186
  updatedAt: rules.map((record) => record.updatedAt).sort().at(-1)
123
- }];
187
+ };
124
188
  });
125
189
  }
126
190
  function buildInsightSuggestions(records) {
@@ -137,12 +201,19 @@ function buildInsightSuggestions(records) {
137
201
  sourceName: record.source.provider ?? "local"
138
202
  }));
139
203
  }
204
+ function buildRoutineAutomationDraftHref(record) {
205
+ return `/automations?${new URLSearchParams({
206
+ draft: record.content,
207
+ autogenerate: "1",
208
+ insight: record.id
209
+ }).toString()}`;
210
+ }
140
211
  function selectedAgentId(config) {
141
212
  return resolveDefaultAgentId(config);
142
213
  }
143
- function editableRecord(recordId, config) {
214
+ function editableRecord(recordId) {
144
215
  const record = getMemoryRecord(recordId);
145
- if (!record || record.scope.agentId !== selectedAgentId(config) || !VISIBLE_STATUSES.has(record.status) || !isUserContextRecord(record)) return null;
216
+ if (!record || !VISIBLE_STATUSES.has(record.status) || !isUserContextRecord(record)) return null;
146
217
  return record;
147
218
  }
148
219
  function preserveRecord(record, patch) {
@@ -150,7 +221,7 @@ function preserveRecord(record, patch) {
150
221
  id: record.id,
151
222
  providerId: record.source.provider ?? "local",
152
223
  kind: record.kind,
153
- agentId: record.scope.agentId,
224
+ sourceAgentId: record.provenance.sourceAgentId,
154
225
  workspaceId: record.scope.workspaceId,
155
226
  sessionKey: record.scope.sessionKey,
156
227
  projectId: record.scope.projectId,
@@ -180,20 +251,17 @@ function registerYouRoutes(authenticated, deps) {
180
251
  const config = deps.service.currentConfig;
181
252
  const agentId = selectedAgentId(config);
182
253
  const profileBundle = await readProfileBundle(config);
183
- const allUserContextRecords = listAllAgentMemoryRecords(agentId, ALL_MEMORY_STATUSES).filter(isUserContextRecord);
254
+ const allUserContextRecords = listAllUserContextRecords(ALL_MEMORY_STATUSES).filter(isUserContextRecord);
184
255
  const records = allUserContextRecords.filter((record) => VISIBLE_STATUSES.has(record.status));
185
- const pausedPlaybookRecords = listMemoryRecords({
186
- agentId,
187
- status: "archived",
188
- limit: 200
189
- }).filter(isUserContextRecord).filter((record) => record.tags?.some((tag) => tag.startsWith("playbook:paused:")));
190
- const manifest = resolveEffectiveAgentManifestForAgent(config, agentId);
256
+ const recordById = new Map(allUserContextRecords.map((record) => [record.id, record]));
257
+ const consents = listMemoryReferenceConsents();
191
258
  const trustPolicy = getUserTrustPolicy();
192
259
  const sourceDefinitions = listConnectorCatalog();
193
260
  const sourceInstances = listConnectorInstances(config);
194
261
  const sources = projectPersonalContextSources(sourceDefinitions, sourceInstances, allUserContextRecords, {
195
262
  sourceItems: listKnowledgeSourceItems({ limit: 500 }),
196
- syncRuns: listKnowledgeSyncRuns({ limit: 500 })
263
+ syncRuns: listKnowledgeSyncRuns({ limit: 500 }),
264
+ connections: listConnectorConnections({ principalId: "local-owner" })
197
265
  });
198
266
  const activeGoals = new GoalService().list({
199
267
  agentId,
@@ -206,23 +274,29 @@ function registerYouRoutes(authenticated, deps) {
206
274
  limit: 20
207
275
  });
208
276
  return c.json({
209
- agentId,
210
277
  scope: {
211
278
  profile: "global",
212
- memory: "agent",
213
- trust: "global",
214
- agentId
279
+ memory: "global",
280
+ trust: "global"
215
281
  },
216
282
  ...profileBundle,
217
283
  understanding: records.map(projectUserContextRecord),
284
+ consentRequests: consents.filter((consent) => consent.status === "pending").flatMap((consent) => {
285
+ const record = recordById.get(consent.recordId);
286
+ return record ? [projectReferenceConsent(consent, record)] : [];
287
+ }),
288
+ referenceGrants: consents.filter((consent) => consent.status === "granted" && (!consent.expiresAt || Date.parse(consent.expiresAt) > Date.now())).flatMap((consent) => {
289
+ const record = recordById.get(consent.recordId);
290
+ return record ? [projectReferenceConsent(consent, record)] : [];
291
+ }),
292
+ conflictGroups: buildConflictGroups(allUserContextRecords),
218
293
  insights: buildInsightSuggestions(records),
219
- playbooks: buildPersonalPlaybooks([...records.filter((record) => record.status === "active"), ...pausedPlaybookRecords]),
294
+ playbooks: buildPersonalPlaybooks(records.filter((record) => record.status === "active")),
220
295
  sources,
221
296
  sourceRecommendations: buildGoalSourceRecommendations(sourceDefinitions.filter((definition) => definition.capabilities.includes("context") || definition.capabilities.includes("memory_source")), new Set(sourceInstances.map((instance) => instance.connectorId)), activeGoals),
222
297
  controls: {
223
- mode: manifest.memory.mode,
224
- sensitiveWritePolicy: manifest.memory.privacy?.sensitiveWritePolicy ?? "confirm",
225
- crossAgentSharing: manifest.memory.privacy?.crossAgentSharing ?? "deny"
298
+ mode: config.userContext.memory.mode,
299
+ sensitiveWritePolicy: config.userContext.privacy.sensitiveWritePolicy
226
300
  },
227
301
  trust: {
228
302
  defaultActionLevel: trustPolicy.defaultActionLevel,
@@ -236,39 +310,37 @@ function registerYouRoutes(authenticated, deps) {
236
310
  });
237
311
  authenticated.get("/api/you/export", async (c) => {
238
312
  const config = deps.service.currentConfig;
239
- const agentId = selectedAgentId(config);
240
313
  const profileBundle = await readProfileBundle(config);
241
- const understanding = listAllAgentMemoryRecords(agentId, ALL_MEMORY_STATUSES).filter(isUserContextRecord).map((record) => ({
314
+ const understanding = listAllUserContextRecords(ALL_MEMORY_STATUSES).filter(isUserContextRecord).map((record) => ({
242
315
  statement: record.content,
243
316
  kind: record.kind,
244
317
  status: record.status,
245
318
  sensitivity: record.sensitivity ?? "normal",
246
319
  durability: record.durability,
247
- canReference: record.disclosurePolicy !== "silent",
320
+ disclosurePolicy: record.disclosurePolicy,
248
321
  sourceName: record.source.provider ?? "local",
249
322
  updatedAt: record.updatedAt
250
323
  }));
251
324
  return c.json({
252
- version: 1,
325
+ version: 2,
253
326
  exportedAt: (/* @__PURE__ */ new Date()).toISOString(),
254
- agentId,
255
327
  profile: profileBundle.profile,
256
328
  understanding
257
329
  });
258
330
  });
259
331
  authenticated.post("/api/you/import", deps.strictRateLimitMiddleware, async (c) => {
260
332
  const body = await c.req.json().catch(() => null);
261
- if (!body || typeof body !== "object" || Array.isArray(body) || body.version !== 1 || !Array.isArray(body.understanding)) return c.json({ error: "Invalid About You export" }, 400);
333
+ if (!body || typeof body !== "object" || Array.isArray(body) || body.version !== 2 || !Array.isArray(body.understanding)) return c.json({ error: "Invalid About You export" }, 400);
262
334
  if (body.understanding.length > 500) return c.json({ error: "Import is limited to 500 understandings" }, 400);
263
335
  const config = deps.service.currentConfig;
264
336
  const agentId = selectedAgentId(config);
265
- const existingStatements = listAllAgentMemoryRecords(agentId, ALL_MEMORY_STATUSES).filter(isUserContextRecord).map((record) => record.content);
337
+ const existingStatements = listAllUserContextRecords(ALL_MEMORY_STATUSES).filter(isUserContextRecord).map((record) => record.content);
266
338
  const { imports, skippedCount } = prepareUserContextImport(body.understanding, existingStatements);
267
339
  runSqliteWriteTransaction(() => {
268
340
  for (const item of imports) upsertMemoryRecord({
269
341
  providerId: "local",
270
342
  kind: item.kind,
271
- agentId,
343
+ sourceAgentId: agentId,
272
344
  content: item.statement,
273
345
  source: {
274
346
  provider: "local",
@@ -281,7 +353,7 @@ function registerYouRoutes(authenticated, deps) {
281
353
  explicitness: "explicit",
282
354
  durability: item.durability,
283
355
  importance: .7,
284
- disclosurePolicy: item.canReference ? "referenceable" : "silent"
356
+ disclosurePolicy: item.disclosurePolicy
285
357
  });
286
358
  });
287
359
  return c.json({
@@ -290,6 +362,114 @@ function registerYouRoutes(authenticated, deps) {
290
362
  skippedCount
291
363
  });
292
364
  });
365
+ authenticated.post("/api/you/understanding", deps.strictRateLimitMiddleware, async (c) => {
366
+ const body = await c.req.json().catch(() => ({}));
367
+ const content = typeof body.content === "string" ? body.content.trim() : "";
368
+ const kind = isUserContextMemoryKind(body.kind) ? body.kind : void 0;
369
+ if (!content || content.length > 5e3) return c.json({ error: "Understanding content must be 1-5000 characters" }, 400);
370
+ if (!kind) return c.json({ error: "A valid user understanding kind is required" }, 400);
371
+ const duplicate = listAllUserContextRecords(ALL_MEMORY_STATUSES).filter(isUserContextRecord).find((record) => record.content.trim().toLocaleLowerCase() === content.toLocaleLowerCase());
372
+ if (duplicate) return c.json({
373
+ error: "This understanding already exists",
374
+ understanding: projectUserContextRecord(duplicate)
375
+ }, 409);
376
+ const sensitivity = MEMORY_SENSITIVITIES.has(body.sensitivity) ? body.sensitivity : "normal";
377
+ const durability = MEMORY_DURABILITIES.has(body.durability) ? body.durability : "durable";
378
+ const disclosurePolicy = MEMORY_DISCLOSURE_POLICIES.has(body.disclosurePolicy) ? body.disclosurePolicy : "referenceable";
379
+ const config = deps.service.currentConfig;
380
+ const created = upsertMemoryRecord({
381
+ providerId: "local",
382
+ kind,
383
+ sourceAgentId: selectedAgentId(config),
384
+ content,
385
+ source: {
386
+ provider: "local",
387
+ path: "you://manual"
388
+ },
389
+ confidence: 1,
390
+ tags: ["user-understanding", "explicit-user-memory"],
391
+ status: "active",
392
+ sensitivity,
393
+ explicitness: "explicit",
394
+ durability,
395
+ importance: .8,
396
+ disclosurePolicy,
397
+ reviewAfter: nextMemoryReviewAt({
398
+ durability,
399
+ explicitness: "explicit"
400
+ })
401
+ });
402
+ return c.json({ understanding: projectUserContextRecord(created) }, 201);
403
+ });
404
+ authenticated.get("/api/you/understanding/:id/history", (c) => {
405
+ const all = listAllUserContextRecords(ALL_MEMORY_STATUSES).filter(isUserContextRecord);
406
+ const target = all.find((record) => record.id === c.req.param("id"));
407
+ if (!target) return c.json({ error: "Understanding not found" }, 404);
408
+ const relatedIds = new Set([target.id]);
409
+ let changed = true;
410
+ while (changed) {
411
+ changed = false;
412
+ for (const record of all) if (record.supersedesRecordId && relatedIds.has(record.supersedesRecordId) || record.supersedesRecordId && relatedIds.has(record.id)) {
413
+ if (!relatedIds.has(record.id)) {
414
+ relatedIds.add(record.id);
415
+ changed = true;
416
+ }
417
+ if (record.supersedesRecordId && !relatedIds.has(record.supersedesRecordId)) {
418
+ relatedIds.add(record.supersedesRecordId);
419
+ changed = true;
420
+ }
421
+ }
422
+ }
423
+ const history = all.filter((record) => relatedIds.has(record.id)).sort((left, right) => Date.parse(right.updatedAt) - Date.parse(left.updatedAt)).map((record) => ({
424
+ ...projectUserContextRecord(record),
425
+ storedStatus: record.status
426
+ }));
427
+ return c.json({ history });
428
+ });
429
+ authenticated.post("/api/you/understanding/batch", deps.strictRateLimitMiddleware, async (c) => {
430
+ const body = await c.req.json().catch(() => ({}));
431
+ const ids = Array.isArray(body.ids) ? [...new Set(body.ids.filter((id) => typeof id === "string" && id.trim().length > 0).slice(0, 100))] : [];
432
+ const action = body.action === "confirm" || body.action === "reject" || body.action === "forget" ? body.action : void 0;
433
+ if (!ids.length || !action) return c.json({ error: "ids and a valid action are required" }, 400);
434
+ let updatedCount = 0;
435
+ runSqliteWriteTransaction(() => {
436
+ for (const id of ids) {
437
+ const record = editableRecord(id);
438
+ if (!record) continue;
439
+ if (action === "forget") deleteMemoryRecord(id);
440
+ else preserveRecord(record, {
441
+ status: action === "confirm" ? "active" : "rejected",
442
+ ...action === "confirm" ? { reviewAfter: nextMemoryReviewAt(record) } : {}
443
+ });
444
+ updatedCount += 1;
445
+ }
446
+ });
447
+ return c.json({
448
+ ok: true,
449
+ updatedCount
450
+ });
451
+ });
452
+ authenticated.post("/api/you/conflicts/:id/resolve", deps.strictRateLimitMiddleware, async (c) => {
453
+ const body = await c.req.json().catch(() => ({}));
454
+ const winnerId = typeof body.winnerId === "string" ? body.winnerId : "";
455
+ const group = listAllUserContextRecords(ALL_MEMORY_STATUSES).filter(isUserContextRecord).filter((record) => record.conflictGroupId === c.req.param("id"));
456
+ const winner = group.find((record) => record.id === winnerId && VISIBLE_STATUSES.has(record.status));
457
+ if (group.length < 2 || !winner) return c.json({ error: "Conflict group or winner not found" }, 404);
458
+ const now = (/* @__PURE__ */ new Date()).toISOString();
459
+ runSqliteWriteTransaction(() => {
460
+ for (const record of group) preserveRecord(record, record.id === winnerId ? {
461
+ status: "active",
462
+ reviewAfter: nextMemoryReviewAt(record)
463
+ } : {
464
+ status: "archived",
465
+ validTo: record.validTo ?? now
466
+ });
467
+ });
468
+ return c.json({
469
+ ok: true,
470
+ understanding: projectUserContextRecord(getMemoryRecord(winnerId))
471
+ });
472
+ });
293
473
  authenticated.patch("/api/you/profile", deps.strictRateLimitMiddleware, async (c) => {
294
474
  const config = deps.service.currentConfig;
295
475
  const parsed = parseProfilePatch(await c.req.json().catch(() => null));
@@ -338,38 +518,87 @@ function registerYouRoutes(authenticated, deps) {
338
518
  if (!PLAYBOOK_IDS.includes(id)) return c.json({ error: "Playbook not found" }, 404);
339
519
  const enabled = (await c.req.json().catch(() => ({}))).enabled;
340
520
  if (typeof enabled !== "boolean") return c.json({ error: "enabled must be a boolean" }, 400);
341
- const config = deps.service.currentConfig;
342
- const agentId = selectedAgentId(config);
343
- const pauseTag = `playbook:paused:${id}`;
344
521
  const active = listMemoryRecords({
345
- agentId,
346
522
  status: "active",
347
523
  limit: 500
348
524
  }).filter(isUserContextRecord).filter((record) => playbookForRecord(record) === id);
349
- const paused = listMemoryRecords({
350
- agentId,
351
- status: "archived",
352
- limit: 500
353
- }).filter(isUserContextRecord).filter((record) => record.tags?.includes(pauseTag));
354
- const targets = enabled ? paused : active;
355
525
  runSqliteWriteTransaction(() => {
356
- for (const record of targets) preserveRecord(record, {
357
- status: enabled ? "active" : "archived",
358
- tags: enabled ? (record.tags ?? []).filter((tag) => tag !== pauseTag) : [...new Set([...record.tags ?? [], pauseTag])]
359
- });
526
+ for (const record of active) preserveRecord(record, { tags: patchPlaybookRuleTags(record, { enabled }) });
360
527
  });
361
- const current = active.concat(paused);
528
+ const current = active.map((record) => ({
529
+ ...record,
530
+ tags: patchPlaybookRuleTags(record, { enabled })
531
+ }));
362
532
  return c.json({
363
533
  ok: true,
364
- playbook: buildPersonalPlaybooks(current.map((record) => ({
365
- ...record,
366
- status: enabled ? "active" : "archived"
367
- })))[0]
534
+ playbook: buildPersonalPlaybooks(current).find((playbook) => playbook.id === id)
535
+ });
536
+ });
537
+ authenticated.post("/api/you/playbooks/:id/rules", deps.strictRateLimitMiddleware, async (c) => {
538
+ const id = c.req.param("id");
539
+ if (!PLAYBOOK_IDS.includes(id)) return c.json({ error: "Playbook not found" }, 404);
540
+ const body = await c.req.json().catch(() => ({}));
541
+ const statement = typeof body.statement === "string" ? body.statement.trim() : "";
542
+ if (!statement || statement.length > 5e3) return c.json({ error: "Rule statement is required" }, 400);
543
+ const record = upsertMemoryRecord({
544
+ providerId: "local",
545
+ kind: id === "communication" ? "preference" : id === "execution" ? "task_lesson" : "routine",
546
+ sourceAgentId: selectedAgentId(deps.service.currentConfig),
547
+ content: statement,
548
+ source: {
549
+ provider: "local",
550
+ path: "you://playbook"
551
+ },
552
+ confidence: 1,
553
+ tags: [
554
+ "user-understanding",
555
+ "playbook:explicit",
556
+ `${PLAYBOOK_ORDER_PREFIX}${Number.isInteger(body.order) ? body.order : 1e3}`
557
+ ],
558
+ status: "active",
559
+ sensitivity: "normal",
560
+ explicitness: "explicit",
561
+ durability: id === "routines" ? "recurring" : "durable",
562
+ importance: .85,
563
+ disclosurePolicy: "referenceable"
368
564
  });
565
+ return c.json({
566
+ ok: true,
567
+ rule: buildPersonalPlaybooks([record]).find((playbook) => playbook.id === id)?.rules[0]
568
+ }, 201);
569
+ });
570
+ authenticated.patch("/api/you/playbooks/:id/rules/:recordId", deps.strictRateLimitMiddleware, async (c) => {
571
+ const id = c.req.param("id");
572
+ const record = editableRecord(c.req.param("recordId"));
573
+ if (!PLAYBOOK_IDS.includes(id) || !record || playbookForRecord(record) !== id) return c.json({ error: "Playbook rule not found" }, 404);
574
+ const body = await c.req.json().catch(() => ({}));
575
+ const content = body.statement === void 0 ? record.content : typeof body.statement === "string" ? body.statement.trim() : "";
576
+ if (!content || content.length > 5e3) return c.json({ error: "Rule statement is required" }, 400);
577
+ if (body.enabled !== void 0 && typeof body.enabled !== "boolean") return c.json({ error: "enabled must be boolean" }, 400);
578
+ if (body.order !== void 0 && (!Number.isInteger(body.order) || body.order < 0 || body.order > 1e4)) return c.json({ error: "order must be an integer between 0 and 10000" }, 400);
579
+ const updated = preserveRecord(record, {
580
+ content,
581
+ tags: patchPlaybookRuleTags(record, {
582
+ enabled: body.enabled,
583
+ order: body.order
584
+ }),
585
+ explicitness: body.statement === void 0 ? record.explicitness : "explicit"
586
+ });
587
+ return c.json({
588
+ ok: true,
589
+ rule: buildPersonalPlaybooks([updated]).find((playbook) => playbook.id === id)?.rules[0]
590
+ });
591
+ });
592
+ authenticated.delete("/api/you/playbooks/:id/rules/:recordId", deps.strictRateLimitMiddleware, (c) => {
593
+ const id = c.req.param("id");
594
+ const record = editableRecord(c.req.param("recordId"));
595
+ if (!PLAYBOOK_IDS.includes(id) || !record || playbookForRecord(record) !== id) return c.json({ error: "Playbook rule not found" }, 404);
596
+ deleteMemoryRecord(record.id);
597
+ return c.json({ ok: true });
369
598
  });
370
599
  authenticated.patch("/api/you/insights/:id", deps.strictRateLimitMiddleware, async (c) => {
371
600
  const config = deps.service.currentConfig;
372
- const existing = editableRecord(c.req.param("id"), config);
601
+ const existing = editableRecord(c.req.param("id"));
373
602
  if (!existing || existing.status !== "active" || !ACTIONABLE_INSIGHT_KINDS.has(existing.kind)) return c.json({ error: "Insight not found" }, 404);
374
603
  const body = await c.req.json().catch(() => ({}));
375
604
  const action = typeof body.action === "string" ? body.action : "";
@@ -380,7 +609,19 @@ function registerYouRoutes(authenticated, deps) {
380
609
  status: "dismissed"
381
610
  });
382
611
  }
383
- if (action !== "apply") return c.json({ error: "Action must be apply or dismiss" }, 400);
612
+ if (action === "complete" && existing.kind === "routine") {
613
+ preserveRecord(existing, { tags: [...new Set([...existing.tags ?? [], INSIGHT_ACCEPTED_TAG])] });
614
+ return c.json({
615
+ ok: true,
616
+ status: "saved"
617
+ });
618
+ }
619
+ if (action !== "apply") return c.json({ error: "Action must be apply, complete, or dismiss" }, 400);
620
+ if (existing.kind === "routine") return c.json({
621
+ ok: true,
622
+ status: "drafting",
623
+ href: buildRoutineAutomationDraftHref(existing)
624
+ });
384
625
  const title = existing.content.trim().split(/\r?\n/)[0].slice(0, 72);
385
626
  const uiLocale = body.uiLocale === "zh" ? "zh" : "en";
386
627
  const contractDraft = await draftGoalContract({
@@ -422,51 +663,79 @@ function registerYouRoutes(authenticated, deps) {
422
663
  });
423
664
  authenticated.patch("/api/you/controls", deps.strictRateLimitMiddleware, async (c) => {
424
665
  const config = deps.service.currentConfig;
425
- const agentId = selectedAgentId(config);
426
- const manifest = resolveEffectiveAgentManifestForAgent(config, agentId);
427
666
  const body = await c.req.json().catch(() => ({}));
428
- const parsed = MemoryPolicySchema.safeParse({
429
- ...manifest.memory,
430
- mode: body.mode,
667
+ const parsed = UserContextConfigSchema.safeParse({
668
+ ...config.userContext,
669
+ memory: {
670
+ ...config.userContext.memory,
671
+ mode: body.mode
672
+ },
431
673
  privacy: {
432
- ...manifest.memory.privacy,
433
- sensitiveWritePolicy: body.sensitiveWritePolicy,
434
- crossAgentSharing: body.crossAgentSharing
674
+ ...config.userContext.privacy,
675
+ sensitiveWritePolicy: body.sensitiveWritePolicy
435
676
  }
436
677
  });
437
678
  if (!parsed.success) return c.json({ error: parsed.error.issues[0]?.message ?? "Invalid personal context controls" }, 400);
438
- const prep = prepareUpdateAgent(config, agentId, { memory: parsed.data });
439
- if (prep.ok === false) return c.json({ error: prep.error }, prep.status ?? 400);
440
- const saved = await deps.service.saveConfig(prep.data.nextConfig);
679
+ const saved = await deps.service.saveConfig({
680
+ ...config,
681
+ userContext: parsed.data
682
+ });
441
683
  if (!saved.saved) return c.json({ error: saved.error ?? "save failed" }, 500);
442
- const updated = resolveEffectiveAgentManifestForAgent(deps.service.currentConfig, agentId);
684
+ const updated = deps.service.currentConfig.userContext;
443
685
  return c.json({ controls: {
444
686
  mode: updated.memory.mode,
445
- sensitiveWritePolicy: updated.memory.privacy?.sensitiveWritePolicy ?? "confirm",
446
- crossAgentSharing: updated.memory.privacy?.crossAgentSharing ?? "deny"
687
+ sensitiveWritePolicy: updated.privacy.sensitiveWritePolicy
447
688
  } });
448
689
  });
690
+ authenticated.patch("/api/you/consents/:id", deps.strictRateLimitMiddleware, async (c) => {
691
+ const body = await c.req.json().catch(() => ({}));
692
+ const decision = typeof body.decision === "string" ? body.decision : "";
693
+ if (![
694
+ "once",
695
+ "session",
696
+ "always",
697
+ "deny"
698
+ ].includes(decision)) return c.json({ error: "Decision must be once, session, always, or deny" }, 400);
699
+ const consent = decideMemoryReferenceConsent(c.req.param("id"), decision);
700
+ if (!consent) return c.json({ error: "Pending consent not found" }, 404);
701
+ return c.json({
702
+ ok: true,
703
+ consent
704
+ });
705
+ });
706
+ authenticated.delete("/api/you/consents/:id", deps.strictRateLimitMiddleware, (c) => {
707
+ const consent = revokeMemoryReferenceConsent(c.req.param("id"));
708
+ if (!consent) return c.json({ error: "Active reference grant not found" }, 404);
709
+ return c.json({
710
+ ok: true,
711
+ consent
712
+ });
713
+ });
449
714
  authenticated.delete("/api/you/sources/:instanceId", deps.strictRateLimitMiddleware, async (c) => {
450
715
  const config = deps.service.currentConfig;
451
716
  const instanceId = c.req.param("instanceId");
452
717
  const installedInstances = listConnectorInstances(config);
718
+ const connection = getConnectorConnection(instanceId);
453
719
  const instance = installedInstances.find((item) => item.instanceId === instanceId);
454
- const definition = instance ? listConnectorCatalog().find((item) => item.id === instance.connectorId) : void 0;
455
- if (!instance || !definition || !definition.capabilities.some((capability) => capability === "context" || capability === "memory_source")) return c.json({ error: "Personal context source not found" }, 404);
720
+ const connectorId = connection?.connectorId ?? instance?.connectorId;
721
+ const definition = connectorId ? listConnectorCatalog().find((item) => item.id === connectorId) : void 0;
722
+ if (!instance && !connection || !definition || !definition.capabilities.some((capability) => capability === "context" || capability === "memory_source")) return c.json({ error: "Personal context source not found" }, 404);
456
723
  const body = await c.req.json().catch(() => ({}));
457
724
  if (typeof body.deleteDerivedUnderstanding !== "boolean") return c.json({ error: "deleteDerivedUnderstanding must be a boolean" }, 400);
458
725
  try {
459
- const sourceInstances = installedInstances.filter((item) => item.connectorId === instance.connectorId);
460
- for (const sourceInstance of sourceInstances) uninstallConnector(config, sourceInstance.instanceId);
461
- const saved = await deps.service.saveConfig(config);
462
- if (!saved.saved) return c.json({ error: saved.error ?? "save failed" }, 500);
726
+ if (connection) await revokeComposioConnection(connection.id);
727
+ else if (instance) {
728
+ uninstallConnector(config, instance.instanceId);
729
+ const saved = await deps.service.saveConfig(config);
730
+ if (!saved.saved) return c.json({ error: saved.error ?? "save failed" }, 500);
731
+ }
463
732
  } catch (error) {
464
733
  return c.json({ error: error instanceof Error ? error.message : String(error) }, 400);
465
734
  }
466
735
  let deletedUnderstandingCount = 0;
467
736
  if (body.deleteDerivedUnderstanding) {
468
- const agentId = selectedAgentId(config);
469
- const targets = recordsDerivedFromPersonalContextSource(listAllAgentMemoryRecords(agentId, ALL_MEMORY_STATUSES), agentId, instance.connectorId);
737
+ const sourceInstanceId = connection ? `composio:${connection.connectorId}:${connection.id}` : instanceId;
738
+ const targets = recordsDerivedFromPersonalContextSource(listAllUserContextRecords(ALL_MEMORY_STATUSES), sourceInstanceId);
470
739
  runSqliteWriteTransaction(() => {
471
740
  for (const record of targets) deleteMemoryRecord(record.id);
472
741
  });
@@ -478,8 +747,7 @@ function registerYouRoutes(authenticated, deps) {
478
747
  });
479
748
  });
480
749
  authenticated.patch("/api/you/understanding/:id", deps.strictRateLimitMiddleware, async (c) => {
481
- const config = deps.service.currentConfig;
482
- const existing = editableRecord(c.req.param("id"), config);
750
+ const existing = editableRecord(c.req.param("id"));
483
751
  if (!existing) return c.json({ error: "Understanding not found" }, 404);
484
752
  const body = await c.req.json().catch(() => ({}));
485
753
  const action = typeof body.action === "string" ? body.action : "";
@@ -494,7 +762,7 @@ function registerYouRoutes(authenticated, deps) {
494
762
  const replacement = upsertMemoryRecord({
495
763
  providerId: "local",
496
764
  kind: existing.kind,
497
- agentId: existing.scope.agentId,
765
+ sourceAgentId: existing.provenance.sourceAgentId,
498
766
  workspaceId: existing.scope.workspaceId,
499
767
  sessionKey: existing.scope.sessionKey,
500
768
  projectId: existing.scope.projectId,
@@ -529,14 +797,13 @@ function registerYouRoutes(authenticated, deps) {
529
797
  return c.json({ error: "Action must be confirm, reject, or update" }, 400);
530
798
  });
531
799
  authenticated.delete("/api/you/understanding/:id", deps.strictRateLimitMiddleware, (c) => {
532
- const config = deps.service.currentConfig;
533
- const existing = editableRecord(c.req.param("id"), config);
800
+ const existing = editableRecord(c.req.param("id"));
534
801
  if (!existing) return c.json({ error: "Understanding not found" }, 404);
535
802
  deleteMemoryRecord(existing.id);
536
803
  return c.json({ ok: true });
537
804
  });
538
805
  }
539
806
  //#endregion
540
- export { buildInsightSuggestions, buildPersonalPlaybooks, registerYouRoutes };
807
+ export { buildInsightSuggestions, buildPersonalPlaybooks, buildRoutineAutomationDraftHref, registerYouRoutes };
541
808
 
542
809
  //# sourceMappingURL=you.js.map