@xopcai/xopc 0.0.116 → 0.0.118

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 (677) hide show
  1. package/README.md +44 -28
  2. package/README.zh-CN.md +63 -45
  3. package/dist/browser-ext/manifest.json +1 -1
  4. package/dist/extensions/demo-memory/src/index.d.ts +6 -0
  5. package/dist/extensions/demo-memory/src/index.js +132 -0
  6. package/dist/extensions/demo-memory/src/index.js.map +1 -0
  7. package/dist/extensions/demo-memory/xopc.extension.json +15 -0
  8. package/dist/extensions/feishu/src/outbound/media-load.js +1 -1
  9. package/dist/extensions/feishu/src/schema/config-schema.d.ts +3 -3
  10. package/dist/extensions/feishu/src/workflow-progress.js +1 -1
  11. package/dist/extensions/telegram/src/adapters/streaming-adapter.js +1 -1
  12. package/dist/extensions/telegram/src/command-handler.js +1 -2
  13. package/dist/extensions/telegram/src/command-handler.js.map +1 -1
  14. package/dist/extensions/telegram/src/config-schema.d.ts +8 -8
  15. package/dist/extensions/telegram/src/inbound-processor.js +1 -1
  16. package/dist/extensions/telegram/src/plugin.js +1 -1
  17. package/dist/extensions/telegram/src/routing-integration.js +2 -2
  18. package/dist/extensions/telegram/src/update-offset-store.js +1 -1
  19. package/dist/extensions/telegram/src/workflow-progress.js +1 -1
  20. package/dist/extensions/telegram/xopc.extension.json +1 -1
  21. package/dist/extensions/weixin/src/api/api.js +2 -2
  22. package/dist/extensions/weixin/src/auth/accounts.js +1 -1
  23. package/dist/extensions/weixin/src/cdn/upload.js +1 -1
  24. package/dist/extensions/weixin/src/config-schema.d.ts +3 -3
  25. package/dist/extensions/weixin/src/media/data-url.js +1 -1
  26. package/dist/extensions/weixin/src/messaging/debug-mode.js +1 -1
  27. package/dist/extensions/weixin/src/messaging/inbound.js +1 -1
  28. package/dist/extensions/weixin/src/messaging/process-message.js +1 -1
  29. package/dist/extensions/weixin/src/plugin.js +1 -1
  30. package/dist/extensions/weixin/src/storage/sync-buf.js +1 -1
  31. package/dist/extensions/weixin/src/workflow-progress.js +1 -1
  32. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CWM1UU5P.js → agent-avatar-dicebear-dzUrQoeZ.js} +1 -1
  33. package/dist/gateway/static/root/assets/agents-BCxZbkOw.js +2 -0
  34. package/dist/gateway/static/root/assets/{app-management-settings-panel-yXSXY_bu.js → app-management-settings-panel-bxYJVJpx.js} +1 -1
  35. package/dist/gateway/static/root/assets/{appearance-settings-DjY1P_ug.js → appearance-settings-BCIykXlI.js} +1 -1
  36. package/dist/gateway/static/root/assets/apps-page--wMEL00f.js +1 -0
  37. package/dist/gateway/static/root/assets/{archive-plugin-CytE5j-e.js → archive-plugin-Cki4SfU2.js} +1 -1
  38. package/dist/gateway/static/root/assets/{attachment-load-BvvrN6rF.js → attachment-load-D-KnS2Do.js} +1 -1
  39. package/dist/gateway/static/root/assets/{binary-plugins-IBWSitnj.js → binary-plugins-D2sgvJja.js} +1 -1
  40. package/dist/gateway/static/root/assets/{block-editor-C-wDpsf-.js → block-editor-DIq-4Gvb.js} +27 -27
  41. package/dist/gateway/static/root/assets/browser-settings-page-DRhKdn81.js +8 -0
  42. package/dist/gateway/static/root/assets/capability-presets-api-CorhiHlg.js +1 -0
  43. package/dist/gateway/static/root/assets/capability-presets-settings-panel-qFx9Jtce.js +1 -0
  44. package/dist/gateway/static/root/assets/channels-settings-BAwAkqIA.js +1 -0
  45. package/dist/gateway/static/root/assets/connectors-page-BQLcfitM.js +2 -0
  46. package/dist/gateway/static/root/assets/cron-api-qGwmL-24.js +1 -0
  47. package/dist/gateway/static/root/assets/cron-page-BBWMAj8-.js +3 -0
  48. package/dist/gateway/static/root/assets/dreaming-settings-Dw89Obml.js +1 -0
  49. package/dist/gateway/static/root/assets/{extension-debug-page-BAIyjDlq.js → extension-debug-page-DYu1KaFQ.js} +1 -1
  50. package/dist/gateway/static/root/assets/{extension-page-DEhv2GpC.js → extension-page-B3W6QwlZ.js} +1 -1
  51. package/dist/gateway/static/root/assets/{extension-settings-page-DOuAxTDW.js → extension-settings-page-D7VQ-cxE.js} +1 -1
  52. package/dist/gateway/static/root/assets/{fetch-CTsREQIe.js → fetch-B7xDPu-R.js} +1 -1
  53. package/dist/gateway/static/root/assets/{format-interval-label-D35Bfhtx.js → format-interval-label-BzxafKxR.js} +1 -1
  54. package/dist/gateway/static/root/assets/gateway-config-api-BTBLSeUu.js +1 -0
  55. package/dist/gateway/static/root/assets/gateway-settings-Cmwy58rS.js +1 -0
  56. package/dist/gateway/static/root/assets/{gateway-startup-retry-C1KAHrd2.js → gateway-startup-retry-CYj9FWCp.js} +1 -1
  57. package/dist/gateway/static/root/assets/goal-detail-page-l7mu5GWX.js +1 -0
  58. package/dist/gateway/static/root/assets/{goals-config-api-KnLGpu6h.js → goals-config-api-CQQgzPr3.js} +1 -1
  59. package/dist/gateway/static/root/assets/goals-page-BHitvJAv.js +2 -0
  60. package/dist/gateway/static/root/assets/{goals-settings-DtPtqZi8.js → goals-settings-CYVY4NGp.js} +1 -1
  61. package/dist/gateway/static/root/assets/{heartbeat-config-api-uKw1f0IG.js → heartbeat-config-api-DriO_CN9.js} +1 -1
  62. package/dist/gateway/static/root/assets/heartbeat-settings-CUQTKxg7.js +1 -0
  63. package/dist/gateway/static/root/assets/index-C17Tsd_b.css +1 -0
  64. package/dist/gateway/static/root/assets/index-Cc41r16l.js +191 -0
  65. package/dist/gateway/static/root/assets/{interval-presets-Dq0FXJ65.js → interval-presets-DFPCKW_W.js} +1 -1
  66. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-C9_t4m7t.js → keyboard-shortcuts-settings-CcVcqstx.js} +1 -1
  67. package/dist/gateway/static/root/assets/{logs-page-SNkWzidV.js → logs-page-C2Uqvae9.js} +2 -2
  68. package/dist/gateway/static/root/assets/{markdown-split-Ca87W8-h.js → markdown-split-BwOFrJ2E.js} +1 -1
  69. package/dist/gateway/static/root/assets/{media-plugins-BAcUjPRJ.js → media-plugins-Cnz6Q5G6.js} +1 -1
  70. package/dist/gateway/static/root/assets/messages-B1iSKjiw.js +3 -0
  71. package/dist/gateway/static/root/assets/models-hub-panel-BfLfcta8.js +2 -0
  72. package/dist/gateway/static/root/assets/note-detail-page-BjwOQBfT.js +2 -0
  73. package/dist/gateway/static/root/assets/{note-image-lightbox-hnSX5SSn.js → note-image-lightbox-B-Svpmza.js} +1 -1
  74. package/dist/gateway/static/root/assets/notes-page-DktdBiwB.js +1 -0
  75. package/dist/gateway/static/root/assets/{preview-open-alternatives-CNgM20H5.js → preview-open-alternatives-Bss4TiwP.js} +1 -1
  76. package/dist/gateway/static/root/assets/remote-access-hub-rfVx96fq.js +1 -0
  77. package/dist/gateway/static/root/assets/{save-bar-controls-CcdjGcfT.js → save-bar-controls-BRNjdgKq.js} +1 -1
  78. package/dist/gateway/static/root/assets/{schedule-field-CYr39z76.js → schedule-field-CUCKODde.js} +1 -1
  79. package/dist/gateway/static/root/assets/{schema-form-BRAJgZQ2.js → schema-form-Dub9sy8r.js} +1 -1
  80. package/dist/gateway/static/root/assets/sessions-page-DbtMFuuH.js +1 -0
  81. package/dist/gateway/static/root/assets/settings-advanced-gate-5re5gAnP.js +1 -0
  82. package/dist/gateway/static/root/assets/{settings-collapsible-section-BhzjeGWi.js → settings-collapsible-section-BeFLavGi.js} +1 -1
  83. package/dist/gateway/static/root/assets/{settings-form-section-Cz3Pcr9b.js → settings-form-section-dmyaPOTG.js} +1 -1
  84. package/dist/gateway/static/root/assets/settings-page-D-WMyLlj.js +1 -0
  85. package/dist/gateway/static/root/assets/setup-status-panel-Cl-DEJAU.js +1 -0
  86. package/dist/gateway/static/root/assets/{share-preview-page-DL4y9K5e.js → share-preview-page-C8glrdqe.js} +1 -1
  87. package/dist/gateway/static/root/assets/shares-settings-CyPVvbLt.js +1 -0
  88. package/dist/gateway/static/root/assets/skill-reload-api-CleTH1oz.js +1 -0
  89. package/dist/gateway/static/root/assets/skills-page-Ck8hdXqR.js +2 -0
  90. package/dist/gateway/static/root/assets/{system-settings-panel-FD2jxRZ3.js → system-settings-panel-DI-LN_8G.js} +1 -1
  91. package/dist/gateway/static/root/assets/typed-models-lib-kX9duch4.js +1 -0
  92. package/dist/gateway/static/root/assets/{use-channel-catalog-BInPrfR5.js → use-channel-catalog-DqlWTsDb.js} +1 -1
  93. package/dist/gateway/static/root/assets/user-profile-settings-panel-B-UFPMXy.js +1 -0
  94. package/dist/gateway/static/root/assets/utils-Dm0hKalR.js +1 -0
  95. package/dist/gateway/static/root/assets/voice-api-key-field-C73IVZeC.js +1 -0
  96. package/dist/gateway/static/root/assets/{voice-player-store-1U3vFppm.js → voice-player-store-C_ArLJPM.js} +1 -1
  97. package/dist/gateway/static/root/assets/workflows-page-BtFGp2y_.js +18 -0
  98. package/dist/gateway/static/root/index.html +5 -5
  99. package/dist/package.js +1 -1
  100. package/dist/src/agent/agent-manager.d.ts +1 -1
  101. package/dist/src/agent/agent-manager.js +14 -14
  102. package/dist/src/agent/agent-manager.js.map +1 -1
  103. package/dist/src/agent/agent-scope.js +5 -9
  104. package/dist/src/agent/agent-scope.js.map +1 -1
  105. package/dist/src/agent/background-review/coordinator.js +0 -1
  106. package/dist/src/agent/background-review/coordinator.js.map +1 -1
  107. package/dist/src/agent/background-review/prompts.d.ts +2 -2
  108. package/dist/src/agent/background-review/prompts.js +2 -2
  109. package/dist/src/agent/background-review/prompts.js.map +1 -1
  110. package/dist/src/agent/background-review/run-background-review.d.ts +0 -2
  111. package/dist/src/agent/background-review/run-background-review.js +2 -4
  112. package/dist/src/agent/background-review/run-background-review.js.map +1 -1
  113. package/dist/src/agent/background-review/settings.d.ts +1 -1
  114. package/dist/src/agent/background-review/settings.js +8 -8
  115. package/dist/src/agent/background-review/settings.js.map +1 -1
  116. package/dist/src/agent/bootstrap/bootstrap-cache.d.ts +1 -0
  117. package/dist/src/agent/bootstrap/bootstrap-cache.js +4 -3
  118. package/dist/src/agent/bootstrap/bootstrap-cache.js.map +1 -1
  119. package/dist/src/agent/bootstrap/bootstrap-context.d.ts +2 -2
  120. package/dist/src/agent/bootstrap/bootstrap-context.js +4 -4
  121. package/dist/src/agent/bootstrap/bootstrap-context.js.map +1 -1
  122. package/dist/src/agent/bootstrap/bootstrap-files.d.ts +4 -0
  123. package/dist/src/agent/bootstrap/bootstrap-files.js +4 -3
  124. package/dist/src/agent/bootstrap/bootstrap-files.js.map +1 -1
  125. package/dist/src/agent/bootstrap/filter-bootstrap-files.js +4 -2
  126. package/dist/src/agent/bootstrap/filter-bootstrap-files.js.map +1 -1
  127. package/dist/src/agent/bootstrap/load-bootstrap-files.d.ts +2 -1
  128. package/dist/src/agent/bootstrap/load-bootstrap-files.js +18 -17
  129. package/dist/src/agent/bootstrap/load-bootstrap-files.js.map +1 -1
  130. package/dist/src/agent/bootstrap/project-agents-context.js +1 -1
  131. package/dist/src/agent/bootstrap/types.d.ts +1 -1
  132. package/dist/src/agent/context/workspace-seed.js +3 -3
  133. package/dist/src/agent/context/workspace-state.js +1 -1
  134. package/dist/src/agent/context/workspace-templates/AGENTS.md +1 -1
  135. package/dist/src/agent/context/workspace.d.ts +4 -2
  136. package/dist/src/agent/context/workspace.js +6 -5
  137. package/dist/src/agent/context/workspace.js.map +1 -1
  138. package/dist/src/agent/embedded/run-for-session.js +4 -1
  139. package/dist/src/agent/embedded/run-for-session.js.map +1 -1
  140. package/dist/src/agent/fallback/candidates.js +11 -9
  141. package/dist/src/agent/fallback/candidates.js.map +1 -1
  142. package/dist/src/agent/goals/goal-locale.js +2 -2
  143. package/dist/src/agent/goals/post-turn.js +3 -3
  144. package/dist/src/agent/image/generation/runtime-types.d.ts +2 -0
  145. package/dist/src/agent/image/generation/runtime.js +1 -1
  146. package/dist/src/agent/image/generation/runtime.js.map +1 -1
  147. package/dist/src/agent/image/image-helpers.d.ts +1 -1
  148. package/dist/src/agent/image/image-helpers.js +4 -17
  149. package/dist/src/agent/image/image-helpers.js.map +1 -1
  150. package/dist/src/agent/image/image-model-fallback.js +1 -1
  151. package/dist/src/agent/image/image-model-fallback.js.map +1 -1
  152. package/dist/src/agent/image/inbound-image-handling.js +1 -1
  153. package/dist/src/agent/image/inbound-image-handling.js.map +1 -1
  154. package/dist/src/agent/image/load-image-media.js +2 -2
  155. package/dist/src/agent/image/tool-model-config.d.ts +1 -1
  156. package/dist/src/agent/image/tool-model-config.js +2 -2
  157. package/dist/src/agent/image/tool-model-config.js.map +1 -1
  158. package/dist/src/agent/ipc/inbox.js +3 -3
  159. package/dist/src/agent/ipc/socket.js +1 -1
  160. package/dist/src/agent/mcp/bundle-mcp-materialize.js +1 -1
  161. package/dist/src/agent/mcp/bundle-mcp-runtime.js +1 -1
  162. package/dist/src/agent/mcp/mcp-transport-config.js +1 -1
  163. package/dist/src/agent/mcp/mcp-transport.js +1 -1
  164. package/dist/src/agent/mcp/resolve-embedded-mcp-tools.js +1 -1
  165. package/dist/src/agent/mcp/resolve-embedded-mcp-tools.js.map +1 -1
  166. package/dist/src/agent/media-generation/runtime-shared.d.ts +5 -2
  167. package/dist/src/agent/media-generation/runtime-shared.js +1 -1
  168. package/dist/src/agent/media-generation/runtime-shared.js.map +1 -1
  169. package/dist/src/agent/memory/builtin-memory-store.d.ts +6 -2
  170. package/dist/src/agent/memory/builtin-memory-store.js +15 -6
  171. package/dist/src/agent/memory/builtin-memory-store.js.map +1 -1
  172. package/dist/src/agent/memory/builtin-provider.d.ts +31 -9
  173. package/dist/src/agent/memory/builtin-provider.js +290 -11
  174. package/dist/src/agent/memory/builtin-provider.js.map +1 -1
  175. package/dist/src/agent/memory/candidate-extractor.d.ts +6 -0
  176. package/dist/src/agent/memory/candidate-extractor.js +60 -0
  177. package/dist/src/agent/memory/candidate-extractor.js.map +1 -0
  178. package/dist/src/agent/memory/context-assembler.d.ts +10 -0
  179. package/dist/src/agent/memory/context-assembler.js +26 -0
  180. package/dist/src/agent/memory/context-assembler.js.map +1 -0
  181. package/dist/src/agent/memory/create-memory-manager.js +25 -7
  182. package/dist/src/agent/memory/create-memory-manager.js.map +1 -1
  183. package/dist/src/agent/memory/dreaming/config.d.ts +1 -6
  184. package/dist/src/agent/memory/dreaming/config.js +8 -8
  185. package/dist/src/agent/memory/dreaming/config.js.map +1 -1
  186. package/dist/src/agent/memory/dreaming/deep-promotion.d.ts +2 -0
  187. package/dist/src/agent/memory/dreaming/deep-promotion.js +25 -1
  188. package/dist/src/agent/memory/dreaming/deep-promotion.js.map +1 -1
  189. package/dist/src/agent/memory/dreaming/events.js +1 -1
  190. package/dist/src/agent/memory/dreaming/last-run.js +1 -1
  191. package/dist/src/agent/memory/dreaming/light-sweep.js +1 -1
  192. package/dist/src/agent/memory/dreaming/preview.js +1 -1
  193. package/dist/src/agent/memory/dreaming/rem-patterns.js +1 -1
  194. package/dist/src/agent/memory/dreaming/short-term-store.js +1 -1
  195. package/dist/src/agent/memory/dreaming/utils.js +1 -1
  196. package/dist/src/agent/memory/index.d.ts +1 -0
  197. package/dist/src/agent/memory/index.js +4 -3
  198. package/dist/src/agent/memory/inject-prefetch.js +6 -2
  199. package/dist/src/agent/memory/inject-prefetch.js.map +1 -1
  200. package/dist/src/agent/memory/manager.d.ts +39 -2
  201. package/dist/src/agent/memory/manager.js +355 -39
  202. package/dist/src/agent/memory/manager.js.map +1 -1
  203. package/dist/src/agent/memory/memory-config.js +15 -15
  204. package/dist/src/agent/memory/memory-config.js.map +1 -1
  205. package/dist/src/agent/memory/memory-flush.js +1 -1
  206. package/dist/src/agent/memory/plugin-discovery.d.ts +19 -5
  207. package/dist/src/agent/memory/plugin-discovery.js +97 -31
  208. package/dist/src/agent/memory/plugin-discovery.js.map +1 -1
  209. package/dist/src/agent/memory/prefetch-coordinator.js.map +1 -1
  210. package/dist/src/agent/memory/provider.d.ts +20 -15
  211. package/dist/src/agent/memory/stub-memory-provider.d.ts +17 -2
  212. package/dist/src/agent/memory/stub-memory-provider.js +20 -3
  213. package/dist/src/agent/memory/stub-memory-provider.js.map +1 -1
  214. package/dist/src/agent/memory/types.d.ts +162 -3
  215. package/dist/src/agent/models/manager.d.ts +1 -1
  216. package/dist/src/agent/models/manager.js +2 -2
  217. package/dist/src/agent/models/manager.js.map +1 -1
  218. package/dist/src/agent/orchestration/agent-orchestrator.d.ts +1 -1
  219. package/dist/src/agent/orchestration/agent-orchestrator.js +2 -1
  220. package/dist/src/agent/orchestration/agent-orchestrator.js.map +1 -1
  221. package/dist/src/agent/orchestration/run-agent-turn-with-fallbacks.d.ts +2 -2
  222. package/dist/src/agent/orchestration/run-agent-turn-with-fallbacks.js +1 -1
  223. package/dist/src/agent/orchestration/run-agent-turn-with-fallbacks.js.map +1 -1
  224. package/dist/src/agent/orchestration/run-agent-turn-with-timeout.d.ts +2 -6
  225. package/dist/src/agent/orchestration/run-agent-turn-with-timeout.js +2 -8
  226. package/dist/src/agent/orchestration/run-agent-turn-with-timeout.js.map +1 -1
  227. package/dist/src/agent/prompt/memory/index.d.ts +4 -2
  228. package/dist/src/agent/prompt/memory/index.js +19 -13
  229. package/dist/src/agent/prompt/memory/index.js.map +1 -1
  230. package/dist/src/agent/prompt/sections/memory-skills.js +1 -1
  231. package/dist/src/agent/prompt/sections/memory-skills.js.map +1 -1
  232. package/dist/src/agent/prompt/service-prompt-builder.js +5 -20
  233. package/dist/src/agent/prompt/service-prompt-builder.js.map +1 -1
  234. package/dist/src/agent/reply/post-compaction-context.js +10 -7
  235. package/dist/src/agent/reply/post-compaction-context.js.map +1 -1
  236. package/dist/src/agent/reply/startup-context.js +7 -12
  237. package/dist/src/agent/reply/startup-context.js.map +1 -1
  238. package/dist/src/agent/reply/workspace-boundary-read.js +1 -1
  239. package/dist/src/agent/sandbox/path-policy.js +2 -2
  240. package/dist/src/agent/service/process-direct-streaming.js +1 -4
  241. package/dist/src/agent/service/process-direct-streaming.js.map +1 -1
  242. package/dist/src/agent/service/session-context-report.js +1 -1
  243. package/dist/src/agent/service/session-context-report.js.map +1 -1
  244. package/dist/src/agent/service.d.ts +3 -3
  245. package/dist/src/agent/service.js +30 -35
  246. package/dist/src/agent/service.js.map +1 -1
  247. package/dist/src/agent/service.types.d.ts +1 -2
  248. package/dist/src/agent/session/session-hydrator.js +1 -2
  249. package/dist/src/agent/session/session-hydrator.js.map +1 -1
  250. package/dist/src/agent/session/session-inspector.d.ts +1 -1
  251. package/dist/src/agent/session/session-inspector.js +10 -15
  252. package/dist/src/agent/session/session-inspector.js.map +1 -1
  253. package/dist/src/agent/skills/config.js +2 -2
  254. package/dist/src/agent/skills/filesystem-watcher.js +1 -1
  255. package/dist/src/agent/skills/hub-hash.js +2 -2
  256. package/dist/src/agent/skills/hub-lock.js +1 -1
  257. package/dist/src/agent/skills/hub-pull.js +3 -3
  258. package/dist/src/agent/skills/index.js +2 -2
  259. package/dist/src/agent/skills/installer.js +2 -2
  260. package/dist/src/agent/skills/managed-store.js +1 -1
  261. package/dist/src/agent/skills/skill-manage-ops.js +1 -1
  262. package/dist/src/agent/skills/skill-manager.js +1 -1
  263. package/dist/src/agent/skills/skill-view-path.js +1 -1
  264. package/dist/src/agent/skills/test-framework.js +1 -1
  265. package/dist/src/agent/starter-agents.d.ts +1 -3
  266. package/dist/src/agent/starter-agents.js +14 -22
  267. package/dist/src/agent/starter-agents.js.map +1 -1
  268. package/dist/src/agent/tools/browser/tool/browser-use-tool.js +1 -2
  269. package/dist/src/agent/tools/browser/tool/browser-use-tool.js.map +1 -1
  270. package/dist/src/agent/tools/curated-memory-tool.d.ts +2 -5
  271. package/dist/src/agent/tools/curated-memory-tool.js +77 -18
  272. package/dist/src/agent/tools/curated-memory-tool.js.map +1 -1
  273. package/dist/src/agent/tools/dreaming-tool.js +1 -1
  274. package/dist/src/agent/tools/factory.d.ts +0 -4
  275. package/dist/src/agent/tools/factory.js +19 -58
  276. package/dist/src/agent/tools/factory.js.map +1 -1
  277. package/dist/src/agent/tools/find.js +1 -1
  278. package/dist/src/agent/tools/grep.js +1 -1
  279. package/dist/src/agent/tools/image-generate-tool.d.ts +1 -1
  280. package/dist/src/agent/tools/image-generate-tool.js +20 -15
  281. package/dist/src/agent/tools/image-generate-tool.js.map +1 -1
  282. package/dist/src/agent/tools/image-tool.js +1 -3
  283. package/dist/src/agent/tools/image-tool.js.map +1 -1
  284. package/dist/src/agent/tools/memory-tool.d.ts +2 -2
  285. package/dist/src/agent/tools/memory-tool.js +39 -14
  286. package/dist/src/agent/tools/memory-tool.js.map +1 -1
  287. package/dist/src/agent/tools/session-search-tool.js +1 -3
  288. package/dist/src/agent/tools/session-search-tool.js.map +1 -1
  289. package/dist/src/agent/tools/skill-manage-tool.js +1 -1
  290. package/dist/src/agent/tools/web-extract.js +8 -9
  291. package/dist/src/agent/tools/web-extract.js.map +1 -1
  292. package/dist/src/agent/tools/workflow-tool.js +1 -1
  293. package/dist/src/agent/workflow/catalog.js +1 -1
  294. package/dist/src/agent/workflow/subagent-runner.js +1 -3
  295. package/dist/src/agent/workflow/subagent-runner.js.map +1 -1
  296. package/dist/src/agent-manifest/index.d.ts +4 -0
  297. package/dist/src/agent-manifest/index.js +10 -0
  298. package/dist/src/agent-manifest/index.js.map +1 -0
  299. package/dist/src/agent-manifest/prompt.d.ts +2 -0
  300. package/dist/src/agent-manifest/prompt.js +57 -0
  301. package/dist/src/agent-manifest/prompt.js.map +1 -0
  302. package/dist/src/agent-manifest/resolver.d.ts +12 -0
  303. package/dist/src/agent-manifest/resolver.js +95 -0
  304. package/dist/src/agent-manifest/resolver.js.map +1 -0
  305. package/dist/src/agent-manifest/schema.d.ts +1010 -0
  306. package/dist/src/agent-manifest/schema.js +269 -0
  307. package/dist/src/agent-manifest/schema.js.map +1 -0
  308. package/dist/src/agent-manifest/validator.d.ts +25 -0
  309. package/dist/src/agent-manifest/validator.js +88 -0
  310. package/dist/src/agent-manifest/validator.js.map +1 -0
  311. package/dist/src/agent-runtime/boundary-guard.d.ts +12 -0
  312. package/dist/src/agent-runtime/boundary-guard.js +23 -0
  313. package/dist/src/agent-runtime/boundary-guard.js.map +1 -0
  314. package/dist/src/agent-runtime/index.d.ts +7 -0
  315. package/dist/src/agent-runtime/index.js +8 -0
  316. package/dist/src/agent-runtime/memory-runtime.d.ts +21 -0
  317. package/dist/src/agent-runtime/memory-runtime.js +50 -0
  318. package/dist/src/agent-runtime/memory-runtime.js.map +1 -0
  319. package/dist/src/agent-runtime/model-router.d.ts +11 -0
  320. package/dist/src/agent-runtime/model-router.js +16 -0
  321. package/dist/src/agent-runtime/model-router.js.map +1 -0
  322. package/dist/src/agent-runtime/run-trace.d.ts +27 -0
  323. package/dist/src/agent-runtime/run-trace.js +53 -0
  324. package/dist/src/agent-runtime/run-trace.js.map +1 -0
  325. package/dist/src/agent-runtime/runtime-profile.d.ts +24 -0
  326. package/dist/src/agent-runtime/runtime-profile.js +44 -0
  327. package/dist/src/agent-runtime/runtime-profile.js.map +1 -0
  328. package/dist/src/agent-runtime/tool-registry.d.ts +28 -0
  329. package/dist/src/agent-runtime/tool-registry.js +52 -0
  330. package/dist/src/agent-runtime/tool-registry.js.map +1 -0
  331. package/dist/src/agent-runtime/workflow-runtime.d.ts +31 -0
  332. package/dist/src/agent-runtime/workflow-runtime.js +34 -0
  333. package/dist/src/agent-runtime/workflow-runtime.js.map +1 -0
  334. package/dist/src/ai-assist/text-assist.js +1 -1
  335. package/dist/src/auth/credentials.js +2 -2
  336. package/dist/src/auth/profiles/store.js +2 -2
  337. package/dist/src/auth/sync-provider-auth.js +1 -1
  338. package/dist/src/browser/actions/extension-registry-bridge.js +1 -1
  339. package/dist/src/browser/actions/extension-registry-bridge.js.map +1 -1
  340. package/dist/src/browser/actions/registry.js +5 -8
  341. package/dist/src/browser/actions/registry.js.map +1 -1
  342. package/dist/src/browser/backend-from-config.d.ts +1 -1
  343. package/dist/src/browser/backend-from-config.js +50 -71
  344. package/dist/src/browser/backend-from-config.js.map +1 -1
  345. package/dist/src/browser/browser-command-timeout.d.ts +0 -1
  346. package/dist/src/browser/browser-command-timeout.js +3 -7
  347. package/dist/src/browser/browser-command-timeout.js.map +1 -1
  348. package/dist/src/browser/cache-dir-policy.js +1 -1
  349. package/dist/src/browser/cdp-local-launcher.js +2 -2
  350. package/dist/src/browser/pipeline/source.js +1 -1
  351. package/dist/src/browser/providers/browser-ext-install.d.ts +2 -12
  352. package/dist/src/browser/providers/browser-ext-install.js +7 -12
  353. package/dist/src/browser/providers/browser-ext-install.js.map +1 -1
  354. package/dist/src/browser/providers/cloakbrowser.js +5 -5
  355. package/dist/src/browser/providers/playwright-doctor.js +1 -1
  356. package/dist/src/browser/readiness.js +16 -16
  357. package/dist/src/browser/readiness.js.map +1 -1
  358. package/dist/src/browser/schemas.js +1 -1
  359. package/dist/src/browser/schemas.js.map +1 -1
  360. package/dist/src/browser/stealth.js +1 -1
  361. package/dist/src/channels/catalog/channel-catalog-service.js +1 -1
  362. package/dist/src/channels/outbound/persist-store.js +1 -1
  363. package/dist/src/channels/pairing/allow-from-file.js +1 -1
  364. package/dist/src/channels/pairing/pairing-store.js +2 -2
  365. package/dist/src/channels/pipeline.d.ts +1 -1
  366. package/dist/src/channels/pipeline.js.map +1 -1
  367. package/dist/src/chat-commands/agent-edit.js +2 -3
  368. package/dist/src/chat-commands/agent-edit.js.map +1 -1
  369. package/dist/src/chat-commands/builtins/config.js +6 -6
  370. package/dist/src/chat-commands/builtins/config.js.map +1 -1
  371. package/dist/src/chat-commands/builtins/model.js +2 -2
  372. package/dist/src/chat-commands/builtins/model.js.map +1 -1
  373. package/dist/src/chat-commands/builtins/thinking.js +16 -42
  374. package/dist/src/chat-commands/builtins/thinking.js.map +1 -1
  375. package/dist/src/chat-commands/config-paths.js +1 -1
  376. package/dist/src/chat-commands/config-paths.js.map +1 -1
  377. package/dist/src/chat-commands/context.js +3 -4
  378. package/dist/src/chat-commands/context.js.map +1 -1
  379. package/dist/src/cli/command-manifest.d.ts +1 -1
  380. package/dist/src/cli/command-manifest.js +2 -2
  381. package/dist/src/cli/command-manifest.js.map +1 -1
  382. package/dist/src/cli/commands/agent.js +3 -1
  383. package/dist/src/cli/commands/agent.js.map +1 -1
  384. package/dist/src/cli/commands/agents.js +3 -6
  385. package/dist/src/cli/commands/agents.js.map +1 -1
  386. package/dist/src/cli/commands/browser-cli-helpers.js +9 -11
  387. package/dist/src/cli/commands/browser-cli-helpers.js.map +1 -1
  388. package/dist/src/cli/commands/config.js +6 -6
  389. package/dist/src/cli/commands/config.js.map +1 -1
  390. package/dist/src/cli/commands/doctor/checks/config-health.js +1 -1
  391. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  392. package/dist/src/cli/commands/doctor/checks/provider-auth.js +3 -18
  393. package/dist/src/cli/commands/doctor/checks/provider-auth.js.map +1 -1
  394. package/dist/src/cli/commands/doctor/checks/state-integrity.js +1 -1
  395. package/dist/src/cli/commands/doctor/checks/workspace-status.js +1 -2
  396. package/dist/src/cli/commands/doctor/checks/workspace-status.js.map +1 -1
  397. package/dist/src/cli/commands/extension-create.js +1 -1
  398. package/dist/src/cli/commands/extension-dev.js +2 -2
  399. package/dist/src/cli/commands/extension-marketplace.js +2 -2
  400. package/dist/src/cli/commands/extension-pack.js +2 -2
  401. package/dist/src/cli/commands/extension.js +3 -3
  402. package/dist/src/cli/commands/gateway/logs.js +1 -1
  403. package/dist/src/cli/commands/goal.js +1 -1
  404. package/dist/src/cli/commands/image.js +13 -372
  405. package/dist/src/cli/commands/image.js.map +1 -1
  406. package/dist/src/cli/commands/init.js +7 -6
  407. package/dist/src/cli/commands/init.js.map +1 -1
  408. package/dist/src/cli/commands/models.js +14 -16
  409. package/dist/src/cli/commands/models.js.map +1 -1
  410. package/dist/src/cli/commands/onboard/channels/registry.js.map +1 -1
  411. package/dist/src/cli/commands/onboard/model.js +28 -23
  412. package/dist/src/cli/commands/onboard/model.js.map +1 -1
  413. package/dist/src/cli/commands/onboard.js +3 -3
  414. package/dist/src/cli/commands/onboard.js.map +1 -1
  415. package/dist/src/cli/commands/skills-test.js +1 -1
  416. package/dist/src/cli/commands/tui.js +2 -2
  417. package/dist/src/cli/commands/tui.js.map +1 -1
  418. package/dist/src/cli/index.d.ts +1 -0
  419. package/dist/src/cli/index.js +10 -5
  420. package/dist/src/cli/index.js.map +1 -1
  421. package/dist/src/cli/registry.js +1 -1
  422. package/dist/src/cli/registry.js.map +1 -1
  423. package/dist/src/cli/templates.d.ts +1 -1
  424. package/dist/src/cli/templates.js +2 -12
  425. package/dist/src/cli/templates.js.map +1 -1
  426. package/dist/src/cli/utils/gateway-client.js +1 -1
  427. package/dist/src/cli/utils/init-workspace-core.d.ts +1 -4
  428. package/dist/src/cli/utils/init-workspace-core.js +9 -8
  429. package/dist/src/cli/utils/init-workspace-core.js.map +1 -1
  430. package/dist/src/commands/agents.config.d.ts +0 -1
  431. package/dist/src/commands/agents.config.js +59 -13
  432. package/dist/src/commands/agents.config.js.map +1 -1
  433. package/dist/src/config/agent-profile.d.ts +5 -17
  434. package/dist/src/config/agent-profile.js +32 -64
  435. package/dist/src/config/agent-profile.js.map +1 -1
  436. package/dist/src/config/agent-typed-models.d.ts +1 -1
  437. package/dist/src/config/agent-typed-models.js +3 -6
  438. package/dist/src/config/agent-typed-models.js.map +1 -1
  439. package/dist/src/config/gateway-bind.js +1 -1
  440. package/dist/src/config/index.js +9 -9
  441. package/dist/src/config/integration.d.ts +1 -1
  442. package/dist/src/config/loader.js +4 -4
  443. package/dist/src/config/models-json.js +2 -2
  444. package/dist/src/config/paths-state.js +1 -1
  445. package/dist/src/config/paths.d.ts +8 -1
  446. package/dist/src/config/paths.js +17 -4
  447. package/dist/src/config/paths.js.map +1 -1
  448. package/dist/src/config/profile.js +1 -1
  449. package/dist/src/config/reload.js +2 -2
  450. package/dist/src/config/reload.js.map +1 -1
  451. package/dist/src/config/rules.js +6 -56
  452. package/dist/src/config/rules.js.map +1 -1
  453. package/dist/src/config/schema.d.ts +916 -779
  454. package/dist/src/config/schema.js +174 -423
  455. package/dist/src/config/schema.js.map +1 -1
  456. package/dist/src/config/workspace-path.js +1 -1
  457. package/dist/src/connectors/composio-triggers.js +1 -1
  458. package/dist/src/cron/executor.js +1 -1
  459. package/dist/src/cron/index.js +1 -1
  460. package/dist/src/cron/service.js +2 -2
  461. package/dist/src/cron/validation.d.ts +3 -3
  462. package/dist/src/daemon/constants.js +1 -1
  463. package/dist/src/daemon/install-plan.js +2 -2
  464. package/dist/src/daemon/launchd.js +2 -2
  465. package/dist/src/daemon/schtasks.js +2 -2
  466. package/dist/src/daemon/systemd.js +2 -2
  467. package/dist/src/extensions/activation-context.js +13 -7
  468. package/dist/src/extensions/activation-context.js.map +1 -1
  469. package/dist/src/extensions/bundle-mcp.js +1 -1
  470. package/dist/src/extensions/discover-extensions.js +2 -2
  471. package/dist/src/extensions/health.js +1 -1
  472. package/dist/src/extensions/install.js +2 -2
  473. package/dist/src/extensions/loader.js +2 -2
  474. package/dist/src/extensions/lockfile.js +3 -3
  475. package/dist/src/extensions/security.js +1 -1
  476. package/dist/src/extensions/update.js +2 -2
  477. package/dist/src/gateway/agents-admin.d.ts +24 -18
  478. package/dist/src/gateway/agents-admin.js +158 -92
  479. package/dist/src/gateway/agents-admin.js.map +1 -1
  480. package/dist/src/gateway/capability-presets-admin.d.ts +56 -0
  481. package/dist/src/gateway/capability-presets-admin.js +214 -0
  482. package/dist/src/gateway/capability-presets-admin.js.map +1 -0
  483. package/dist/src/gateway/chat-stream/mapper.js +9 -2
  484. package/dist/src/gateway/chat-stream/mapper.js.map +1 -1
  485. package/dist/src/gateway/file-path-classifier.js +2 -2
  486. package/dist/src/gateway/global-defaults-admin.d.ts +36 -0
  487. package/dist/src/gateway/global-defaults-admin.js +146 -0
  488. package/dist/src/gateway/global-defaults-admin.js.map +1 -0
  489. package/dist/src/gateway/hono/lib/agent-model.d.ts +1 -1
  490. package/dist/src/gateway/hono/lib/agent-model.js +1 -1
  491. package/dist/src/gateway/hono/lib/agent-model.js.map +1 -1
  492. package/dist/src/gateway/hono/lib/config-payload.d.ts +234 -127
  493. package/dist/src/gateway/hono/lib/config-payload.js +14 -38
  494. package/dist/src/gateway/hono/lib/config-payload.js.map +1 -1
  495. package/dist/src/gateway/hono/lib/extension-store.js +2 -2
  496. package/dist/src/gateway/hono/lib/static-ui.js +2 -2
  497. package/dist/src/gateway/hono/routes/agents.js +88 -33
  498. package/dist/src/gateway/hono/routes/agents.js.map +1 -1
  499. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
  500. package/dist/src/gateway/hono/routes/browser.js +8 -15
  501. package/dist/src/gateway/hono/routes/browser.js.map +1 -1
  502. package/dist/src/gateway/hono/routes/capability-presets.d.ts +3 -0
  503. package/dist/src/gateway/hono/routes/capability-presets.js +145 -0
  504. package/dist/src/gateway/hono/routes/capability-presets.js.map +1 -0
  505. package/dist/src/gateway/hono/routes/commands-skills.js +4 -5
  506. package/dist/src/gateway/hono/routes/commands-skills.js.map +1 -1
  507. package/dist/src/gateway/hono/routes/config-patch/agents.d.ts +1 -17
  508. package/dist/src/gateway/hono/routes/config-patch/agents.js +2 -443
  509. package/dist/src/gateway/hono/routes/config-patch/agents.js.map +1 -1
  510. package/dist/src/gateway/hono/routes/config-patch/misc.js +7 -1
  511. package/dist/src/gateway/hono/routes/config-patch/misc.js.map +1 -1
  512. package/dist/src/gateway/hono/routes/config.js +1 -1
  513. package/dist/src/gateway/hono/routes/config.js.map +1 -1
  514. package/dist/src/gateway/hono/routes/dreaming.js +8 -1
  515. package/dist/src/gateway/hono/routes/dreaming.js.map +1 -1
  516. package/dist/src/gateway/hono/routes/global-defaults.d.ts +3 -0
  517. package/dist/src/gateway/hono/routes/global-defaults.js +61 -0
  518. package/dist/src/gateway/hono/routes/global-defaults.js.map +1 -0
  519. package/dist/src/gateway/hono/routes/host-fs.js +2 -2
  520. package/dist/src/gateway/hono/routes/index.js +2 -0
  521. package/dist/src/gateway/hono/routes/index.js.map +1 -1
  522. package/dist/src/gateway/hono/routes/lazy-bundles.js +17 -1
  523. package/dist/src/gateway/hono/routes/lazy-bundles.js.map +1 -1
  524. package/dist/src/gateway/hono/routes/memory.d.ts +3 -0
  525. package/dist/src/gateway/hono/routes/memory.js +361 -0
  526. package/dist/src/gateway/hono/routes/memory.js.map +1 -0
  527. package/dist/src/gateway/hono/routes/models.js +2 -2
  528. package/dist/src/gateway/hono/routes/shares.js +1 -1
  529. package/dist/src/gateway/hono/routes/workflows.js +1 -1
  530. package/dist/src/gateway/hono/routes/workspace.js +2 -2
  531. package/dist/src/gateway/lock.js +3 -3
  532. package/dist/src/gateway/ports.js +1 -1
  533. package/dist/src/gateway/service/config-coordinator.js +1 -1
  534. package/dist/src/gateway/service/marketplace-service.d.ts +4 -4
  535. package/dist/src/gateway/service/marketplace-service.js +13 -9
  536. package/dist/src/gateway/service/marketplace-service.js.map +1 -1
  537. package/dist/src/gateway/service.d.ts +1 -1
  538. package/dist/src/gateway/service.js +15 -16
  539. package/dist/src/gateway/service.js.map +1 -1
  540. package/dist/src/gateway/workspace-fs-file-list.js +1 -1
  541. package/dist/src/goals/goal-workflow-judge.js +2 -2
  542. package/dist/src/i18n/goals-bundle.js +1 -1
  543. package/dist/src/i18n/index.js +1 -1
  544. package/dist/src/i18n/share-tool-bundle.js +2 -2
  545. package/dist/src/infra/brew.js +1 -1
  546. package/dist/src/infra/package-json.js +1 -1
  547. package/dist/src/infra/package-update-steps.js +1 -1
  548. package/dist/src/infra/path-env.js +2 -2
  549. package/dist/src/infra/restart.js +1 -1
  550. package/dist/src/infra/stable-node-path.js +1 -1
  551. package/dist/src/infra/update-check.js +1 -1
  552. package/dist/src/infra/update-global.js +1 -1
  553. package/dist/src/infra/update-lock.js +2 -2
  554. package/dist/src/infra/update-restart.js +1 -1
  555. package/dist/src/infra/update-runner.js +1 -1
  556. package/dist/src/infra/update-startup.js +1 -1
  557. package/dist/src/infra/write-file-atomic.js +2 -2
  558. package/dist/src/media/store.js +1 -1
  559. package/dist/src/notes/agent-context.js +3 -3
  560. package/dist/src/notes/service.js +4 -2
  561. package/dist/src/notes/service.js.map +1 -1
  562. package/dist/src/notes/store.js +2 -2
  563. package/dist/src/project-trust/trust-store.js +2 -2
  564. package/dist/src/providers/auth-runtime/auth-profile-store.js +1 -1
  565. package/dist/src/providers/index.d.ts +5 -6
  566. package/dist/src/providers/index.js +26 -30
  567. package/dist/src/providers/index.js.map +1 -1
  568. package/dist/src/providers/model-registry.js +4 -4
  569. package/dist/src/session/index.js +1 -1
  570. package/dist/src/session/init-session-turn.js +1 -1
  571. package/dist/src/session/resolve-session.js +1 -1
  572. package/dist/src/session/session-title.js +2 -2
  573. package/dist/src/session/store.js +1 -1
  574. package/dist/src/session/thinking-resolve.d.ts +1 -1
  575. package/dist/src/session/thinking-resolve.js +1 -1
  576. package/dist/src/session/thinking-resolve.js.map +1 -1
  577. package/dist/src/share/share-auto.js +2 -2
  578. package/dist/src/share/share-store.js +3 -3
  579. package/dist/src/share/share-thumbnail.js +2 -2
  580. package/dist/src/share/share-zip.js +1 -1
  581. package/dist/src/share/site-share-store.js +3 -3
  582. package/dist/src/share/site-static-serve.js +1 -1
  583. package/dist/src/storage/sqlite/connection.js +2 -2
  584. package/dist/src/storage/sqlite/index.d.ts +1 -0
  585. package/dist/src/storage/sqlite/index.js +2 -1
  586. package/dist/src/storage/sqlite/memory-index-repository.d.ts +1 -0
  587. package/dist/src/storage/sqlite/memory-index-repository.js +17 -16
  588. package/dist/src/storage/sqlite/memory-index-repository.js.map +1 -1
  589. package/dist/src/storage/sqlite/memory-records-repository.d.ts +144 -0
  590. package/dist/src/storage/sqlite/memory-records-repository.js +453 -0
  591. package/dist/src/storage/sqlite/memory-records-repository.js.map +1 -0
  592. package/dist/src/storage/sqlite/migrations/012_memory_records.sql +63 -0
  593. package/dist/src/storage/sqlite/migrations/013_memory_trace_events.sql +21 -0
  594. package/dist/src/storage/sqlite/migrations/014_memory_record_governance.sql +10 -0
  595. package/dist/src/storage/sqlite/migrations/015_memory_trace_feedback.sql +4 -0
  596. package/dist/src/storage/sqlite/migrations/discover.js +1 -1
  597. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  598. package/dist/src/storage/sqlite/migrations/runner.js +4 -4
  599. package/dist/src/storage/sqlite/migrations/runner.js.map +1 -1
  600. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  601. package/dist/src/storage/sqlite/schema.js +2 -2
  602. package/dist/src/storage/sqlite/schema.sql +86 -0
  603. package/dist/src/tui/backends/embedded-backend.d.ts +3 -0
  604. package/dist/src/tui/backends/embedded-backend.js +43 -24
  605. package/dist/src/tui/backends/embedded-backend.js.map +1 -1
  606. package/dist/src/tui/backends/gateway-sse-backend.d.ts +1 -0
  607. package/dist/src/tui/backends/gateway-sse-backend.js +16 -3
  608. package/dist/src/tui/backends/gateway-sse-backend.js.map +1 -1
  609. package/dist/src/tui/clipboard-image.js +3 -3
  610. package/dist/src/tui/components/tui-header.d.ts +0 -1
  611. package/dist/src/tui/components/tui-header.js +3 -8
  612. package/dist/src/tui/components/tui-header.js.map +1 -1
  613. package/dist/src/tui/extension-host/load-extensions.js +1 -1
  614. package/dist/src/tui/extension-host/load-extensions.js.map +1 -1
  615. package/dist/src/tui/theme-manager.js +1 -1
  616. package/dist/src/tui/tui-command-formatters.js +4 -4
  617. package/dist/src/tui/tui-commands.js +2 -2
  618. package/dist/src/tui/tui-keybindings-file.js +1 -1
  619. package/dist/src/tui/tui-scoped-models.js +2 -2
  620. package/dist/src/tui/tui-settings.js +1 -1
  621. package/dist/src/tui/tui-startup-resources.js +2 -1
  622. package/dist/src/tui/tui-startup-resources.js.map +1 -1
  623. package/dist/src/tui/tui-startup-text.js +12 -12
  624. package/dist/src/tui/tui-startup-text.js.map +1 -1
  625. package/dist/src/tui/tui.js +10 -7
  626. package/dist/src/tui/tui.js.map +1 -1
  627. package/dist/src/tunnel/frpc-binary.js +4 -4
  628. package/dist/src/tunnel/frpc-config.js +1 -1
  629. package/dist/src/tunnel/frpc-extract.js +1 -1
  630. package/dist/src/tunnel/tunnel-state.js +1 -1
  631. package/dist/src/utils/logger/audit.js +1 -1
  632. package/dist/src/utils/logger/log-store.js +1 -1
  633. package/dist/src/utils/logger/rotation.js +1 -1
  634. package/dist/src/utils/logger/streams.js +1 -1
  635. package/dist/src/voice/tts/audio.js +1 -1
  636. package/dist/src/voice/tts/providers/edge-speech.js +2 -2
  637. package/dist/src/workflows/draft/workflow-draft-service.js +1 -1
  638. package/dist/src/workflows/service/workflow-run-service.js +4 -5
  639. package/dist/src/workflows/service/workflow-run-service.js.map +1 -1
  640. package/dist/src/workflows/service/workflow-session-bridge.js +1 -1
  641. package/dist/src/workflows/store/event-store.js +1 -1
  642. package/dist/src/workflows/store/run-store.js +1 -1
  643. package/package.json +3 -2
  644. package/dist/gateway/static/root/assets/agent-browser-settings-page-D1SyFYeh.js +0 -6
  645. package/dist/gateway/static/root/assets/agent-defaults-tabbed-page-C9YxgvuI.js +0 -1
  646. package/dist/gateway/static/root/assets/agents-CteVs3UO.js +0 -71
  647. package/dist/gateway/static/root/assets/apps-page-CVQ1M8Ax.js +0 -1
  648. package/dist/gateway/static/root/assets/channels-settings-Cd3JbeQ1.js +0 -1
  649. package/dist/gateway/static/root/assets/config-api-C4RAtTKW.js +0 -3
  650. package/dist/gateway/static/root/assets/connectors-page-MsMa5qBr.js +0 -2
  651. package/dist/gateway/static/root/assets/cron-api-sJNMqB6P.js +0 -1
  652. package/dist/gateway/static/root/assets/cron-page-D30CSwkn.js +0 -3
  653. package/dist/gateway/static/root/assets/dreaming-settings-6fCUWRQf.js +0 -1
  654. package/dist/gateway/static/root/assets/gateway-config-api-C6989a-W.js +0 -1
  655. package/dist/gateway/static/root/assets/gateway-settings-BpF26t91.js +0 -1
  656. package/dist/gateway/static/root/assets/goal-detail-page-DOjhmRyf.js +0 -1
  657. package/dist/gateway/static/root/assets/goals-page-Xl9_wrFc.js +0 -2
  658. package/dist/gateway/static/root/assets/heartbeat-settings-DN9vEj9P.js +0 -1
  659. package/dist/gateway/static/root/assets/index-C8ytlAF2.js +0 -122
  660. package/dist/gateway/static/root/assets/index-CVpJW2NS.css +0 -1
  661. package/dist/gateway/static/root/assets/messages-BqzIDrlr.js +0 -3
  662. package/dist/gateway/static/root/assets/models-hub-panel-BO4o-GmO.js +0 -2
  663. package/dist/gateway/static/root/assets/note-detail-page-DLV_XDmT.js +0 -2
  664. package/dist/gateway/static/root/assets/notes-page-ycsDlkFA.js +0 -1
  665. package/dist/gateway/static/root/assets/remote-access-hub-DQpnE8K9.js +0 -1
  666. package/dist/gateway/static/root/assets/sessions-page-BZui7iAY.js +0 -1
  667. package/dist/gateway/static/root/assets/settings-advanced-gate-DEfzZ1ax.js +0 -1
  668. package/dist/gateway/static/root/assets/settings-page-CLuSsu1-.js +0 -1
  669. package/dist/gateway/static/root/assets/setup-status-panel-Cq4qpXLi.js +0 -1
  670. package/dist/gateway/static/root/assets/shares-settings-B9F3HyYQ.js +0 -1
  671. package/dist/gateway/static/root/assets/skill-reload-api-Bp9UPPwm.js +0 -1
  672. package/dist/gateway/static/root/assets/skills-page-BIoBsfSV.js +0 -2
  673. package/dist/gateway/static/root/assets/use-agent-defaults-form-Cz2_pPzu.js +0 -1
  674. package/dist/gateway/static/root/assets/use-settings-tab-guard-nuHMmZQv.js +0 -1
  675. package/dist/gateway/static/root/assets/voice-api-key-field-BUIrKb8s.js +0 -1
  676. package/dist/gateway/static/root/assets/workflows-page-qE3SexnO.js +0 -18
  677. package/dist/src/agent/context/workspace-templates/USER.md +0 -24
@@ -7,4 +7,4 @@ export interface BackgroundReviewSettings {
7
7
  maxHistoryMessages: number;
8
8
  maxDurationMs: number;
9
9
  }
10
- export declare function resolveBackgroundReviewSettings(config: Config | undefined): BackgroundReviewSettings;
10
+ export declare function resolveBackgroundReviewSettings(_config: Config | undefined): BackgroundReviewSettings;
@@ -1,13 +1,13 @@
1
1
  //#region src/agent/background-review/settings.ts
2
- function resolveBackgroundReviewSettings(config) {
3
- const br = config?.agents?.defaults?.backgroundReview;
2
+ function resolveBackgroundReviewSettings(_config) {
3
+ const numberOrDefault = (value, fallback) => typeof value === "number" && Number.isFinite(value) && value > 0 ? Math.trunc(value) : fallback;
4
4
  return {
5
- enabled: br?.enabled === true,
6
- memoryNudgeInterval: br?.memoryNudgeInterval ?? 10,
7
- skillNudgeInterval: br?.skillNudgeInterval ?? 10,
8
- maxToolRounds: br?.maxToolRounds ?? 8,
9
- maxHistoryMessages: br?.maxHistoryMessages ?? 80,
10
- maxDurationMs: br?.maxDurationMs ?? 12e4
5
+ enabled: false,
6
+ memoryNudgeInterval: numberOrDefault(void 0, 10),
7
+ skillNudgeInterval: numberOrDefault(void 0, 10),
8
+ maxToolRounds: numberOrDefault(void 0, 8),
9
+ maxHistoryMessages: numberOrDefault(void 0, 80),
10
+ maxDurationMs: numberOrDefault(void 0, 12e4)
11
11
  };
12
12
  }
13
13
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"settings.js","names":[],"sources":["../../../../src/agent/background-review/settings.ts"],"sourcesContent":["import type { Config } from '../../config/schema.js';\n\nexport interface BackgroundReviewSettings {\n enabled: boolean;\n memoryNudgeInterval: number;\n skillNudgeInterval: number;\n maxToolRounds: number;\n maxHistoryMessages: number;\n maxDurationMs: number;\n}\n\nexport function resolveBackgroundReviewSettings(config: Config | undefined): BackgroundReviewSettings {\n const br = config?.agents?.defaults?.backgroundReview;\n return {\n enabled: br?.enabled === true,\n memoryNudgeInterval: br?.memoryNudgeInterval ?? 10,\n skillNudgeInterval: br?.skillNudgeInterval ?? 10,\n maxToolRounds: br?.maxToolRounds ?? 8,\n maxHistoryMessages: br?.maxHistoryMessages ?? 80,\n maxDurationMs: br?.maxDurationMs ?? 120_000,\n };\n}\n"],"mappings":";AAWA,SAAgB,gCAAgC,QAAsD;CACpG,MAAM,KAAK,QAAQ,QAAQ,UAAU;AACrC,QAAO;EACL,SAAS,IAAI,YAAY;EACzB,qBAAqB,IAAI,uBAAuB;EAChD,oBAAoB,IAAI,sBAAsB;EAC9C,eAAe,IAAI,iBAAiB;EACpC,oBAAoB,IAAI,sBAAsB;EAC9C,eAAe,IAAI,iBAAiB;EACrC"}
1
+ {"version":3,"file":"settings.js","names":[],"sources":["../../../../src/agent/background-review/settings.ts"],"sourcesContent":["import type { Config } from '../../config/schema.js';\n\nexport interface BackgroundReviewSettings {\n enabled: boolean;\n memoryNudgeInterval: number;\n skillNudgeInterval: number;\n maxToolRounds: number;\n maxHistoryMessages: number;\n maxDurationMs: number;\n}\n\nexport function resolveBackgroundReviewSettings(_config: Config | undefined): BackgroundReviewSettings {\n const numberOrDefault = (value: unknown, fallback: number): number =>\n typeof value === 'number' && Number.isFinite(value) && value > 0 ? Math.trunc(value) : fallback;\n\n return {\n enabled: false,\n memoryNudgeInterval: numberOrDefault(undefined, 10),\n skillNudgeInterval: numberOrDefault(undefined, 10),\n maxToolRounds: numberOrDefault(undefined, 8),\n maxHistoryMessages: numberOrDefault(undefined, 80),\n maxDurationMs: numberOrDefault(undefined, 120_000),\n };\n}\n"],"mappings":";AAWA,SAAgB,gCAAgC,SAAuD;CACrG,MAAM,mBAAmB,OAAgB,aACvC,OAAO,UAAU,YAAY,OAAO,SAAS,MAAM,IAAI,QAAQ,IAAI,KAAK,MAAM,MAAM,GAAG;AAEzF,QAAO;EACL,SAAS;EACT,qBAAqB,gBAAgB,KAAA,GAAW,GAAG;EACnD,oBAAoB,gBAAgB,KAAA,GAAW,GAAG;EAClD,eAAe,gBAAgB,KAAA,GAAW,EAAE;EAC5C,oBAAoB,gBAAgB,KAAA,GAAW,GAAG;EAClD,eAAe,gBAAgB,KAAA,GAAW,KAAQ;EACnD"}
@@ -3,6 +3,7 @@ export declare function wasBootstrapContextInjected(sessionKey: string): boolean
3
3
  export declare function markBootstrapContextInjected(sessionKey: string): void;
4
4
  export declare function getOrLoadBootstrapFiles(params: {
5
5
  profileDir: string;
6
+ userProfilePath?: string;
6
7
  sessionKey: string;
7
8
  }): Promise<WorkspaceBootstrapFile[]>;
8
9
  export declare function clearBootstrapSnapshot(sessionKey: string): void;
@@ -1,4 +1,4 @@
1
- import { loadProfileBootstrapFiles } from "./load-bootstrap-files.js";
1
+ import { loadProfileBootstrapFiles, loadUserProfileBootstrapFile } from "./load-bootstrap-files.js";
2
2
  //#region src/agent/bootstrap/bootstrap-cache.ts
3
3
  const cache = /* @__PURE__ */ new Map();
4
4
  const bootstrapContextInjected = /* @__PURE__ */ new Set();
@@ -17,10 +17,11 @@ function markBootstrapContextInjected(sessionKey) {
17
17
  }
18
18
  async function getOrLoadBootstrapFiles(params) {
19
19
  const existing = cache.get(params.sessionKey);
20
- const files = loadProfileBootstrapFiles(params.profileDir);
21
- if (existing && existing.profileDir === params.profileDir && bootstrapFilesEqual(existing.files, files)) return existing.files;
20
+ const files = [...loadUserProfileBootstrapFile(params.userProfilePath), ...loadProfileBootstrapFiles(params.profileDir)];
21
+ if (existing && existing.profileDir === params.profileDir && existing.userProfilePath === params.userProfilePath && bootstrapFilesEqual(existing.files, files)) return existing.files;
22
22
  cache.set(params.sessionKey, {
23
23
  profileDir: params.profileDir,
24
+ userProfilePath: params.userProfilePath,
24
25
  files
25
26
  });
26
27
  return files;
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap-cache.js","names":[],"sources":["../../../../src/agent/bootstrap/bootstrap-cache.ts"],"sourcesContent":["import { loadProfileBootstrapFiles } from './load-bootstrap-files.js';\nimport type { WorkspaceBootstrapFile } from './types.js';\n\ntype BootstrapSnapshot = {\n profileDir: string;\n files: WorkspaceBootstrapFile[];\n};\n\nconst cache = new Map<string, BootstrapSnapshot>();\nconst bootstrapContextInjected = new Set<string>();\n\nfunction bootstrapFilesEqual(\n previous: WorkspaceBootstrapFile[],\n next: WorkspaceBootstrapFile[],\n): boolean {\n if (previous.length !== next.length) {\n return false;\n }\n return previous.every((file, index) => {\n const updated = next[index];\n return (\n updated !== undefined &&\n file.name === updated.name &&\n file.path === updated.path &&\n file.content === updated.content &&\n file.missing === updated.missing\n );\n });\n}\n\nexport function wasBootstrapContextInjected(sessionKey: string): boolean {\n return bootstrapContextInjected.has(sessionKey);\n}\n\nexport function markBootstrapContextInjected(sessionKey: string): void {\n bootstrapContextInjected.add(sessionKey);\n}\n\nexport async function getOrLoadBootstrapFiles(params: {\n profileDir: string;\n sessionKey: string;\n}): Promise<WorkspaceBootstrapFile[]> {\n const existing = cache.get(params.sessionKey);\n const files = loadProfileBootstrapFiles(params.profileDir);\n if (existing && existing.profileDir === params.profileDir && bootstrapFilesEqual(existing.files, files)) {\n return existing.files;\n }\n cache.set(params.sessionKey, {\n profileDir: params.profileDir,\n files,\n });\n return files;\n}\n\nexport function clearBootstrapSnapshot(sessionKey: string): void {\n cache.delete(sessionKey);\n bootstrapContextInjected.delete(sessionKey);\n}\n\nexport function clearAllBootstrapSnapshots(): void {\n cache.clear();\n bootstrapContextInjected.clear();\n}\n"],"mappings":";;AAQA,MAAM,wBAAQ,IAAI,KAAgC;AAClD,MAAM,2CAA2B,IAAI,KAAa;AAElD,SAAS,oBACP,UACA,MACS;AACT,KAAI,SAAS,WAAW,KAAK,OAC3B,QAAO;AAET,QAAO,SAAS,OAAO,MAAM,UAAU;EACrC,MAAM,UAAU,KAAK;AACrB,SACE,YAAY,KAAA,KACZ,KAAK,SAAS,QAAQ,QACtB,KAAK,SAAS,QAAQ,QACtB,KAAK,YAAY,QAAQ,WACzB,KAAK,YAAY,QAAQ;GAE3B;;AAGJ,SAAgB,4BAA4B,YAA6B;AACvE,QAAO,yBAAyB,IAAI,WAAW;;AAGjD,SAAgB,6BAA6B,YAA0B;AACrE,0BAAyB,IAAI,WAAW;;AAG1C,eAAsB,wBAAwB,QAGR;CACpC,MAAM,WAAW,MAAM,IAAI,OAAO,WAAW;CAC7C,MAAM,QAAQ,0BAA0B,OAAO,WAAW;AAC1D,KAAI,YAAY,SAAS,eAAe,OAAO,cAAc,oBAAoB,SAAS,OAAO,MAAM,CACrG,QAAO,SAAS;AAElB,OAAM,IAAI,OAAO,YAAY;EAC3B,YAAY,OAAO;EACnB;EACD,CAAC;AACF,QAAO;;AAGT,SAAgB,uBAAuB,YAA0B;AAC/D,OAAM,OAAO,WAAW;AACxB,0BAAyB,OAAO,WAAW;;AAG7C,SAAgB,6BAAmC;AACjD,OAAM,OAAO;AACb,0BAAyB,OAAO"}
1
+ {"version":3,"file":"bootstrap-cache.js","names":[],"sources":["../../../../src/agent/bootstrap/bootstrap-cache.ts"],"sourcesContent":["import { loadProfileBootstrapFiles, loadUserProfileBootstrapFile } from './load-bootstrap-files.js';\nimport type { WorkspaceBootstrapFile } from './types.js';\n\ntype BootstrapSnapshot = {\n profileDir: string;\n userProfilePath?: string;\n files: WorkspaceBootstrapFile[];\n};\n\nconst cache = new Map<string, BootstrapSnapshot>();\nconst bootstrapContextInjected = new Set<string>();\n\nfunction bootstrapFilesEqual(\n previous: WorkspaceBootstrapFile[],\n next: WorkspaceBootstrapFile[],\n): boolean {\n if (previous.length !== next.length) {\n return false;\n }\n return previous.every((file, index) => {\n const updated = next[index];\n return (\n updated !== undefined &&\n file.name === updated.name &&\n file.path === updated.path &&\n file.content === updated.content &&\n file.missing === updated.missing\n );\n });\n}\n\nexport function wasBootstrapContextInjected(sessionKey: string): boolean {\n return bootstrapContextInjected.has(sessionKey);\n}\n\nexport function markBootstrapContextInjected(sessionKey: string): void {\n bootstrapContextInjected.add(sessionKey);\n}\n\nexport async function getOrLoadBootstrapFiles(params: {\n profileDir: string;\n userProfilePath?: string;\n sessionKey: string;\n}): Promise<WorkspaceBootstrapFile[]> {\n const existing = cache.get(params.sessionKey);\n const files = [\n ...loadUserProfileBootstrapFile(params.userProfilePath),\n ...loadProfileBootstrapFiles(params.profileDir),\n ];\n if (\n existing &&\n existing.profileDir === params.profileDir &&\n existing.userProfilePath === params.userProfilePath &&\n bootstrapFilesEqual(existing.files, files)\n ) {\n return existing.files;\n }\n cache.set(params.sessionKey, {\n profileDir: params.profileDir,\n userProfilePath: params.userProfilePath,\n files,\n });\n return files;\n}\n\nexport function clearBootstrapSnapshot(sessionKey: string): void {\n cache.delete(sessionKey);\n bootstrapContextInjected.delete(sessionKey);\n}\n\nexport function clearAllBootstrapSnapshots(): void {\n cache.clear();\n bootstrapContextInjected.clear();\n}\n"],"mappings":";;AASA,MAAM,wBAAQ,IAAI,KAAgC;AAClD,MAAM,2CAA2B,IAAI,KAAa;AAElD,SAAS,oBACP,UACA,MACS;AACT,KAAI,SAAS,WAAW,KAAK,OAC3B,QAAO;AAET,QAAO,SAAS,OAAO,MAAM,UAAU;EACrC,MAAM,UAAU,KAAK;AACrB,SACE,YAAY,KAAA,KACZ,KAAK,SAAS,QAAQ,QACtB,KAAK,SAAS,QAAQ,QACtB,KAAK,YAAY,QAAQ,WACzB,KAAK,YAAY,QAAQ;GAE3B;;AAGJ,SAAgB,4BAA4B,YAA6B;AACvE,QAAO,yBAAyB,IAAI,WAAW;;AAGjD,SAAgB,6BAA6B,YAA0B;AACrE,0BAAyB,IAAI,WAAW;;AAG1C,eAAsB,wBAAwB,QAIR;CACpC,MAAM,WAAW,MAAM,IAAI,OAAO,WAAW;CAC7C,MAAM,QAAQ,CACZ,GAAG,6BAA6B,OAAO,gBAAgB,EACvD,GAAG,0BAA0B,OAAO,WAAW,CAChD;AACD,KACE,YACA,SAAS,eAAe,OAAO,cAC/B,SAAS,oBAAoB,OAAO,mBACpC,oBAAoB,SAAS,OAAO,MAAM,CAE1C,QAAO,SAAS;AAElB,OAAM,IAAI,OAAO,YAAY;EAC3B,YAAY,OAAO;EACnB,iBAAiB,OAAO;EACxB;EACD,CAAC;AACF,QAAO;;AAGT,SAAgB,uBAAuB,YAA0B;AAC/D,OAAM,OAAO,WAAW;AACxB,0BAAyB,OAAO,WAAW;;AAG7C,SAAgB,6BAAmC;AACjD,OAAM,OAAO;AACb,0BAAyB,OAAO"}
@@ -2,8 +2,8 @@ import type { Config } from '../../config/schema.js';
2
2
  import type { EmbeddedContextFile, WorkspaceBootstrapFile } from './types.js';
3
3
  export declare const DEFAULT_BOOTSTRAP_MAX_CHARS = 12000;
4
4
  export declare const DEFAULT_BOOTSTRAP_TOTAL_MAX_CHARS = 60000;
5
- export declare function resolveBootstrapMaxChars(config?: Config): number;
6
- export declare function resolveBootstrapTotalMaxChars(config?: Config): number;
5
+ export declare function resolveBootstrapMaxChars(_config?: Config): number;
6
+ export declare function resolveBootstrapTotalMaxChars(_config?: Config): number;
7
7
  export declare function buildBootstrapContextFiles(files: WorkspaceBootstrapFile[], opts?: {
8
8
  warn?: (message: string) => void;
9
9
  maxChars?: number;
@@ -4,11 +4,11 @@ const DEFAULT_BOOTSTRAP_TOTAL_MAX_CHARS = 6e4;
4
4
  const MIN_BOOTSTRAP_FILE_BUDGET_CHARS = 64;
5
5
  const BOOTSTRAP_HEAD_RATIO = .75;
6
6
  const BOOTSTRAP_TAIL_RATIO = .25;
7
- function resolveBootstrapMaxChars(config) {
8
- return config?.agents?.defaults?.bootstrapMaxChars ?? 12e3;
7
+ function resolveBootstrapMaxChars(_config) {
8
+ return DEFAULT_BOOTSTRAP_MAX_CHARS;
9
9
  }
10
- function resolveBootstrapTotalMaxChars(config) {
11
- return config?.agents?.defaults?.bootstrapTotalMaxChars ?? 6e4;
10
+ function resolveBootstrapTotalMaxChars(_config) {
11
+ return DEFAULT_BOOTSTRAP_TOTAL_MAX_CHARS;
12
12
  }
13
13
  function clampToBudget(content, budget) {
14
14
  if (budget <= 0) return "";
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap-context.js","names":[],"sources":["../../../../src/agent/bootstrap/bootstrap-context.ts"],"sourcesContent":["import type { Config } from '../../config/schema.js';\nimport type { EmbeddedContextFile, WorkspaceBootstrapFile } from './types.js';\n\nexport const DEFAULT_BOOTSTRAP_MAX_CHARS = 12_000;\nexport const DEFAULT_BOOTSTRAP_TOTAL_MAX_CHARS = 60_000;\nconst MIN_BOOTSTRAP_FILE_BUDGET_CHARS = 64;\nconst BOOTSTRAP_HEAD_RATIO = 0.75;\nconst BOOTSTRAP_TAIL_RATIO = 0.25;\n\nexport function resolveBootstrapMaxChars(config?: Config): number {\n return config?.agents?.defaults?.bootstrapMaxChars ?? DEFAULT_BOOTSTRAP_MAX_CHARS;\n}\n\nexport function resolveBootstrapTotalMaxChars(config?: Config): number {\n return config?.agents?.defaults?.bootstrapTotalMaxChars ?? DEFAULT_BOOTSTRAP_TOTAL_MAX_CHARS;\n}\n\nfunction clampToBudget(content: string, budget: number): string {\n if (budget <= 0) {\n return '';\n }\n if (content.length <= budget) {\n return content;\n }\n if (budget <= 3) {\n return content.slice(0, budget);\n }\n return `${content.slice(0, budget - 1)}…`;\n}\n\nfunction trimBootstrapContent(\n content: string,\n fileName: string,\n maxChars: number,\n): { content: string; truncated: boolean; originalLength: number; maxChars: number } {\n const trimmed = content.trimEnd();\n if (trimmed.length <= maxChars) {\n return { content: trimmed, truncated: false, originalLength: trimmed.length, maxChars };\n }\n\n const markerTemplate = (head: number, tail: number) =>\n `\\n\\n[...truncated ${fileName}: kept ${head}+${tail} of ${trimmed.length} chars...]\\n\\n`;\n let headChars = Math.floor(maxChars * BOOTSTRAP_HEAD_RATIO);\n let tailChars = Math.floor(maxChars * BOOTSTRAP_TAIL_RATIO);\n let marker = markerTemplate(headChars, tailChars);\n let renderedLength = headChars + tailChars + marker.length;\n\n while (renderedLength > maxChars && (headChars > 0 || tailChars > 0)) {\n if (tailChars >= headChars && tailChars > 0) {\n tailChars -= 1;\n } else if (headChars > 0) {\n headChars -= 1;\n } else {\n break;\n }\n marker = markerTemplate(headChars, tailChars);\n renderedLength = headChars + tailChars + marker.length;\n }\n\n const head = trimmed.slice(0, headChars);\n const tail = tailChars > 0 ? trimmed.slice(-tailChars) : '';\n const bounded = `${head}${marker}${tail}`;\n return {\n content: bounded.length > maxChars ? bounded.slice(0, maxChars) : bounded,\n truncated: true,\n originalLength: trimmed.length,\n maxChars,\n };\n}\n\nexport function buildBootstrapContextFiles(\n files: WorkspaceBootstrapFile[],\n opts?: { warn?: (message: string) => void; maxChars?: number; totalMaxChars?: number },\n): EmbeddedContextFile[] {\n const maxChars = opts?.maxChars ?? DEFAULT_BOOTSTRAP_MAX_CHARS;\n const totalMaxChars = Math.max(\n 1,\n Math.floor(opts?.totalMaxChars ?? Math.max(maxChars, DEFAULT_BOOTSTRAP_TOTAL_MAX_CHARS)),\n );\n let remainingTotalChars = totalMaxChars;\n const result: EmbeddedContextFile[] = [];\n\n for (const file of files) {\n if (remainingTotalChars <= 0) {\n break;\n }\n const pathValue = file.path.trim();\n if (!pathValue) {\n opts?.warn?.(`skipping bootstrap file \"${file.name}\" — missing path`);\n continue;\n }\n\n if (file.missing) {\n const missingText = `[MISSING] Expected at: ${pathValue}`;\n const capped = clampToBudget(missingText, remainingTotalChars);\n if (!capped) {\n break;\n }\n remainingTotalChars = Math.max(0, remainingTotalChars - capped.length);\n result.push({ path: pathValue, content: capped });\n continue;\n }\n\n if (remainingTotalChars < MIN_BOOTSTRAP_FILE_BUDGET_CHARS) {\n opts?.warn?.(\n `remaining bootstrap budget is ${remainingTotalChars} chars (<${MIN_BOOTSTRAP_FILE_BUDGET_CHARS}); skipping additional bootstrap files`,\n );\n break;\n }\n\n const fileMaxChars = Math.max(1, Math.min(maxChars, remainingTotalChars));\n const trimmed = trimBootstrapContent(file.content ?? '', file.name, fileMaxChars);\n const contentWithinBudget = clampToBudget(trimmed.content, remainingTotalChars);\n if (!contentWithinBudget) {\n continue;\n }\n if (trimmed.truncated || contentWithinBudget.length < trimmed.content.length) {\n opts?.warn?.(\n `profile bootstrap file ${file.name} is ${trimmed.originalLength} chars (limit ${trimmed.maxChars}); truncating in injected context`,\n );\n }\n remainingTotalChars = Math.max(0, remainingTotalChars - contentWithinBudget.length);\n result.push({ path: pathValue, content: contentWithinBudget });\n }\n\n return result;\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"bootstrap-context.js","names":[],"sources":["../../../../src/agent/bootstrap/bootstrap-context.ts"],"sourcesContent":["import type { Config } from '../../config/schema.js';\nimport type { EmbeddedContextFile, WorkspaceBootstrapFile } from './types.js';\n\nexport const DEFAULT_BOOTSTRAP_MAX_CHARS = 12_000;\nexport const DEFAULT_BOOTSTRAP_TOTAL_MAX_CHARS = 60_000;\nconst MIN_BOOTSTRAP_FILE_BUDGET_CHARS = 64;\nconst BOOTSTRAP_HEAD_RATIO = 0.75;\nconst BOOTSTRAP_TAIL_RATIO = 0.25;\n\nexport function resolveBootstrapMaxChars(_config?: Config): number {\n return DEFAULT_BOOTSTRAP_MAX_CHARS;\n}\n\nexport function resolveBootstrapTotalMaxChars(_config?: Config): number {\n return DEFAULT_BOOTSTRAP_TOTAL_MAX_CHARS;\n}\n\nfunction clampToBudget(content: string, budget: number): string {\n if (budget <= 0) {\n return '';\n }\n if (content.length <= budget) {\n return content;\n }\n if (budget <= 3) {\n return content.slice(0, budget);\n }\n return `${content.slice(0, budget - 1)}…`;\n}\n\nfunction trimBootstrapContent(\n content: string,\n fileName: string,\n maxChars: number,\n): { content: string; truncated: boolean; originalLength: number; maxChars: number } {\n const trimmed = content.trimEnd();\n if (trimmed.length <= maxChars) {\n return { content: trimmed, truncated: false, originalLength: trimmed.length, maxChars };\n }\n\n const markerTemplate = (head: number, tail: number) =>\n `\\n\\n[...truncated ${fileName}: kept ${head}+${tail} of ${trimmed.length} chars...]\\n\\n`;\n let headChars = Math.floor(maxChars * BOOTSTRAP_HEAD_RATIO);\n let tailChars = Math.floor(maxChars * BOOTSTRAP_TAIL_RATIO);\n let marker = markerTemplate(headChars, tailChars);\n let renderedLength = headChars + tailChars + marker.length;\n\n while (renderedLength > maxChars && (headChars > 0 || tailChars > 0)) {\n if (tailChars >= headChars && tailChars > 0) {\n tailChars -= 1;\n } else if (headChars > 0) {\n headChars -= 1;\n } else {\n break;\n }\n marker = markerTemplate(headChars, tailChars);\n renderedLength = headChars + tailChars + marker.length;\n }\n\n const head = trimmed.slice(0, headChars);\n const tail = tailChars > 0 ? trimmed.slice(-tailChars) : '';\n const bounded = `${head}${marker}${tail}`;\n return {\n content: bounded.length > maxChars ? bounded.slice(0, maxChars) : bounded,\n truncated: true,\n originalLength: trimmed.length,\n maxChars,\n };\n}\n\nexport function buildBootstrapContextFiles(\n files: WorkspaceBootstrapFile[],\n opts?: { warn?: (message: string) => void; maxChars?: number; totalMaxChars?: number },\n): EmbeddedContextFile[] {\n const maxChars = opts?.maxChars ?? DEFAULT_BOOTSTRAP_MAX_CHARS;\n const totalMaxChars = Math.max(\n 1,\n Math.floor(opts?.totalMaxChars ?? Math.max(maxChars, DEFAULT_BOOTSTRAP_TOTAL_MAX_CHARS)),\n );\n let remainingTotalChars = totalMaxChars;\n const result: EmbeddedContextFile[] = [];\n\n for (const file of files) {\n if (remainingTotalChars <= 0) {\n break;\n }\n const pathValue = file.path.trim();\n if (!pathValue) {\n opts?.warn?.(`skipping bootstrap file \"${file.name}\" — missing path`);\n continue;\n }\n\n if (file.missing) {\n const missingText = `[MISSING] Expected at: ${pathValue}`;\n const capped = clampToBudget(missingText, remainingTotalChars);\n if (!capped) {\n break;\n }\n remainingTotalChars = Math.max(0, remainingTotalChars - capped.length);\n result.push({ path: pathValue, content: capped });\n continue;\n }\n\n if (remainingTotalChars < MIN_BOOTSTRAP_FILE_BUDGET_CHARS) {\n opts?.warn?.(\n `remaining bootstrap budget is ${remainingTotalChars} chars (<${MIN_BOOTSTRAP_FILE_BUDGET_CHARS}); skipping additional bootstrap files`,\n );\n break;\n }\n\n const fileMaxChars = Math.max(1, Math.min(maxChars, remainingTotalChars));\n const trimmed = trimBootstrapContent(file.content ?? '', file.name, fileMaxChars);\n const contentWithinBudget = clampToBudget(trimmed.content, remainingTotalChars);\n if (!contentWithinBudget) {\n continue;\n }\n if (trimmed.truncated || contentWithinBudget.length < trimmed.content.length) {\n opts?.warn?.(\n `profile bootstrap file ${file.name} is ${trimmed.originalLength} chars (limit ${trimmed.maxChars}); truncating in injected context`,\n );\n }\n remainingTotalChars = Math.max(0, remainingTotalChars - contentWithinBudget.length);\n result.push({ path: pathValue, content: contentWithinBudget });\n }\n\n return result;\n}\n"],"mappings":"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"}
@@ -3,17 +3,20 @@ import type { EmbeddedContextFile, WorkspaceBootstrapFile } from './types.js';
3
3
  export { clearAllBootstrapSnapshots, clearBootstrapSnapshot } from './bootstrap-cache.js';
4
4
  export declare function resolveBootstrapFilesSync(params: {
5
5
  profileDir: string;
6
+ userProfilePath?: string;
6
7
  sessionKey?: string;
7
8
  excludeHeartbeat?: boolean;
8
9
  }): WorkspaceBootstrapFile[];
9
10
  export declare function resolveBootstrapFilesForRun(params: {
10
11
  profileDir: string;
12
+ userProfilePath?: string;
11
13
  sessionKey?: string;
12
14
  excludeHeartbeat?: boolean;
13
15
  warn?: (message: string) => void;
14
16
  }): Promise<WorkspaceBootstrapFile[]>;
15
17
  export declare function resolveBootstrapContextSync(params: {
16
18
  profileDir: string;
19
+ userProfilePath?: string;
17
20
  config?: Config;
18
21
  sessionKey?: string;
19
22
  excludeHeartbeat?: boolean;
@@ -24,6 +27,7 @@ export declare function resolveBootstrapContextSync(params: {
24
27
  };
25
28
  export declare function resolveBootstrapContextForRun(params: {
26
29
  profileDir: string;
30
+ userProfilePath?: string;
27
31
  config?: Config;
28
32
  sessionKey?: string;
29
33
  excludeHeartbeat?: boolean;
@@ -1,5 +1,5 @@
1
1
  import { DEFAULT_HEARTBEAT_FILENAME } from "../context/workspace.js";
2
- import { loadProfileBootstrapFiles } from "./load-bootstrap-files.js";
2
+ import { loadProfileBootstrapFiles, loadUserProfileBootstrapFile } from "./load-bootstrap-files.js";
3
3
  import { clearAllBootstrapSnapshots, clearBootstrapSnapshot, getOrLoadBootstrapFiles, markBootstrapContextInjected, wasBootstrapContextInjected } from "./bootstrap-cache.js";
4
4
  import { buildBootstrapContextFiles, resolveBootstrapMaxChars, resolveBootstrapTotalMaxChars } from "./bootstrap-context.js";
5
5
  import { filterBootstrapFilesForSession } from "./filter-bootstrap-files.js";
@@ -9,14 +9,15 @@ function filterHeartbeatBootstrapFile(files, exclude) {
9
9
  return files.filter((file) => file.name !== DEFAULT_HEARTBEAT_FILENAME);
10
10
  }
11
11
  function resolveBootstrapFilesSync(params) {
12
- return filterHeartbeatBootstrapFile(filterBootstrapFilesForSession(loadProfileBootstrapFiles(params.profileDir), params.sessionKey), params.excludeHeartbeat ?? false);
12
+ return filterHeartbeatBootstrapFile(filterBootstrapFilesForSession([...loadUserProfileBootstrapFile(params.userProfilePath), ...loadProfileBootstrapFiles(params.profileDir)], params.sessionKey), params.excludeHeartbeat ?? false);
13
13
  }
14
14
  async function resolveBootstrapFilesForRun(params) {
15
15
  const sessionKey = params.sessionKey;
16
16
  return filterHeartbeatBootstrapFile(filterBootstrapFilesForSession(sessionKey ? await getOrLoadBootstrapFiles({
17
17
  profileDir: params.profileDir,
18
+ userProfilePath: params.userProfilePath,
18
19
  sessionKey
19
- }) : loadProfileBootstrapFiles(params.profileDir), sessionKey), params.excludeHeartbeat ?? false);
20
+ }) : [...loadUserProfileBootstrapFile(params.userProfilePath), ...loadProfileBootstrapFiles(params.profileDir)], sessionKey), params.excludeHeartbeat ?? false);
20
21
  }
21
22
  function resolveBootstrapContextSync(params) {
22
23
  const mode = params.contextInjection ?? "always";
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap-files.js","names":[],"sources":["../../../../src/agent/bootstrap/bootstrap-files.ts"],"sourcesContent":["import type { Config } from '../../config/schema.js';\nimport { DEFAULT_HEARTBEAT_FILENAME } from '../context/workspace.js';\nimport {\n getOrLoadBootstrapFiles,\n markBootstrapContextInjected,\n wasBootstrapContextInjected,\n} from './bootstrap-cache.js';\nimport {\n buildBootstrapContextFiles,\n resolveBootstrapMaxChars,\n resolveBootstrapTotalMaxChars,\n} from './bootstrap-context.js';\nimport { filterBootstrapFilesForSession } from './filter-bootstrap-files.js';\nimport { loadProfileBootstrapFiles } from './load-bootstrap-files.js';\nimport type { EmbeddedContextFile, WorkspaceBootstrapFile } from './types.js';\n\nexport { clearAllBootstrapSnapshots, clearBootstrapSnapshot } from './bootstrap-cache.js';\n\nfunction filterHeartbeatBootstrapFile(\n files: WorkspaceBootstrapFile[],\n exclude: boolean,\n): WorkspaceBootstrapFile[] {\n if (!exclude) {\n return files;\n }\n return files.filter((file) => file.name !== DEFAULT_HEARTBEAT_FILENAME);\n}\n\nexport function resolveBootstrapFilesSync(params: {\n profileDir: string;\n sessionKey?: string;\n excludeHeartbeat?: boolean;\n}): WorkspaceBootstrapFile[] {\n const rawFiles = loadProfileBootstrapFiles(params.profileDir);\n const filtered = filterBootstrapFilesForSession(rawFiles, params.sessionKey);\n return filterHeartbeatBootstrapFile(filtered, params.excludeHeartbeat ?? false);\n}\n\nexport async function resolveBootstrapFilesForRun(params: {\n profileDir: string;\n sessionKey?: string;\n excludeHeartbeat?: boolean;\n warn?: (message: string) => void;\n}): Promise<WorkspaceBootstrapFile[]> {\n const sessionKey = params.sessionKey;\n const rawFiles = sessionKey\n ? await getOrLoadBootstrapFiles({\n profileDir: params.profileDir,\n sessionKey,\n })\n : loadProfileBootstrapFiles(params.profileDir);\n const filtered = filterBootstrapFilesForSession(rawFiles, sessionKey);\n return filterHeartbeatBootstrapFile(filtered, params.excludeHeartbeat ?? false);\n}\n\nexport function resolveBootstrapContextSync(params: {\n profileDir: string;\n config?: Config;\n sessionKey?: string;\n excludeHeartbeat?: boolean;\n contextInjection?: 'always' | 'continuation-skip' | 'never';\n}): {\n bootstrapFiles: WorkspaceBootstrapFile[];\n contextFiles: EmbeddedContextFile[];\n} {\n const mode = params.contextInjection ?? 'always';\n if (mode === 'never') {\n return { bootstrapFiles: [], contextFiles: [] };\n }\n if (\n mode === 'continuation-skip' &&\n params.sessionKey &&\n wasBootstrapContextInjected(params.sessionKey)\n ) {\n return { bootstrapFiles: [], contextFiles: [] };\n }\n const bootstrapFiles = resolveBootstrapFilesSync(params);\n const contextFiles = buildBootstrapContextFiles(bootstrapFiles, {\n maxChars: resolveBootstrapMaxChars(params.config),\n totalMaxChars: resolveBootstrapTotalMaxChars(params.config),\n });\n if (mode === 'continuation-skip' && params.sessionKey && contextFiles.length > 0) {\n markBootstrapContextInjected(params.sessionKey);\n }\n return { bootstrapFiles, contextFiles };\n}\n\nexport async function resolveBootstrapContextForRun(params: {\n profileDir: string;\n config?: Config;\n sessionKey?: string;\n excludeHeartbeat?: boolean;\n contextInjection?: 'always' | 'continuation-skip' | 'never';\n warn?: (message: string) => void;\n}): Promise<{\n bootstrapFiles: WorkspaceBootstrapFile[];\n contextFiles: EmbeddedContextFile[];\n}> {\n const mode = params.contextInjection ?? 'always';\n if (mode === 'never') {\n return { bootstrapFiles: [], contextFiles: [] };\n }\n if (\n mode === 'continuation-skip' &&\n params.sessionKey &&\n wasBootstrapContextInjected(params.sessionKey)\n ) {\n return { bootstrapFiles: [], contextFiles: [] };\n }\n const bootstrapFiles = await resolveBootstrapFilesForRun(params);\n const contextFiles = buildBootstrapContextFiles(bootstrapFiles, {\n maxChars: resolveBootstrapMaxChars(params.config),\n totalMaxChars: resolveBootstrapTotalMaxChars(params.config),\n warn: params.warn,\n });\n if (mode === 'continuation-skip' && params.sessionKey && contextFiles.length > 0) {\n markBootstrapContextInjected(params.sessionKey);\n }\n return { bootstrapFiles, contextFiles };\n}\n"],"mappings":";;;;;;AAkBA,SAAS,6BACP,OACA,SAC0B;AAC1B,KAAI,CAAC,QACH,QAAO;AAET,QAAO,MAAM,QAAQ,SAAS,KAAK,SAAS,2BAA2B;;AAGzE,SAAgB,0BAA0B,QAIb;AAG3B,QAAO,6BADU,+BADA,0BAA0B,OAAO,WACM,EAAE,OAAO,WACrB,EAAE,OAAO,oBAAoB,MAAM;;AAGjF,eAAsB,4BAA4B,QAKZ;CACpC,MAAM,aAAa,OAAO;AAQ1B,QAAO,6BADU,+BANA,aACb,MAAM,wBAAwB;EAC5B,YAAY,OAAO;EACnB;EACD,CAAC,GACF,0BAA0B,OAAO,WAAW,EACU,WACd,EAAE,OAAO,oBAAoB,MAAM;;AAGjF,SAAgB,4BAA4B,QAS1C;CACA,MAAM,OAAO,OAAO,oBAAoB;AACxC,KAAI,SAAS,QACX,QAAO;EAAE,gBAAgB,EAAE;EAAE,cAAc,EAAE;EAAE;AAEjD,KACE,SAAS,uBACT,OAAO,cACP,4BAA4B,OAAO,WAAW,CAE9C,QAAO;EAAE,gBAAgB,EAAE;EAAE,cAAc,EAAE;EAAE;CAEjD,MAAM,iBAAiB,0BAA0B,OAAO;CACxD,MAAM,eAAe,2BAA2B,gBAAgB;EAC9D,UAAU,yBAAyB,OAAO,OAAO;EACjD,eAAe,8BAA8B,OAAO,OAAO;EAC5D,CAAC;AACF,KAAI,SAAS,uBAAuB,OAAO,cAAc,aAAa,SAAS,EAC7E,8BAA6B,OAAO,WAAW;AAEjD,QAAO;EAAE;EAAgB;EAAc;;AAGzC,eAAsB,8BAA8B,QAUjD;CACD,MAAM,OAAO,OAAO,oBAAoB;AACxC,KAAI,SAAS,QACX,QAAO;EAAE,gBAAgB,EAAE;EAAE,cAAc,EAAE;EAAE;AAEjD,KACE,SAAS,uBACT,OAAO,cACP,4BAA4B,OAAO,WAAW,CAE9C,QAAO;EAAE,gBAAgB,EAAE;EAAE,cAAc,EAAE;EAAE;CAEjD,MAAM,iBAAiB,MAAM,4BAA4B,OAAO;CAChE,MAAM,eAAe,2BAA2B,gBAAgB;EAC9D,UAAU,yBAAyB,OAAO,OAAO;EACjD,eAAe,8BAA8B,OAAO,OAAO;EAC3D,MAAM,OAAO;EACd,CAAC;AACF,KAAI,SAAS,uBAAuB,OAAO,cAAc,aAAa,SAAS,EAC7E,8BAA6B,OAAO,WAAW;AAEjD,QAAO;EAAE;EAAgB;EAAc"}
1
+ {"version":3,"file":"bootstrap-files.js","names":[],"sources":["../../../../src/agent/bootstrap/bootstrap-files.ts"],"sourcesContent":["import type { Config } from '../../config/schema.js';\nimport { DEFAULT_HEARTBEAT_FILENAME } from '../context/workspace.js';\nimport {\n getOrLoadBootstrapFiles,\n markBootstrapContextInjected,\n wasBootstrapContextInjected,\n} from './bootstrap-cache.js';\nimport {\n buildBootstrapContextFiles,\n resolveBootstrapMaxChars,\n resolveBootstrapTotalMaxChars,\n} from './bootstrap-context.js';\nimport { filterBootstrapFilesForSession } from './filter-bootstrap-files.js';\nimport { loadProfileBootstrapFiles, loadUserProfileBootstrapFile } from './load-bootstrap-files.js';\nimport type { EmbeddedContextFile, WorkspaceBootstrapFile } from './types.js';\n\nexport { clearAllBootstrapSnapshots, clearBootstrapSnapshot } from './bootstrap-cache.js';\n\nfunction filterHeartbeatBootstrapFile(\n files: WorkspaceBootstrapFile[],\n exclude: boolean,\n): WorkspaceBootstrapFile[] {\n if (!exclude) {\n return files;\n }\n return files.filter((file) => file.name !== DEFAULT_HEARTBEAT_FILENAME);\n}\n\nexport function resolveBootstrapFilesSync(params: {\n profileDir: string;\n userProfilePath?: string;\n sessionKey?: string;\n excludeHeartbeat?: boolean;\n}): WorkspaceBootstrapFile[] {\n const rawFiles = [\n ...loadUserProfileBootstrapFile(params.userProfilePath),\n ...loadProfileBootstrapFiles(params.profileDir),\n ];\n const filtered = filterBootstrapFilesForSession(rawFiles, params.sessionKey);\n return filterHeartbeatBootstrapFile(filtered, params.excludeHeartbeat ?? false);\n}\n\nexport async function resolveBootstrapFilesForRun(params: {\n profileDir: string;\n userProfilePath?: string;\n sessionKey?: string;\n excludeHeartbeat?: boolean;\n warn?: (message: string) => void;\n}): Promise<WorkspaceBootstrapFile[]> {\n const sessionKey = params.sessionKey;\n const rawFiles = sessionKey\n ? await getOrLoadBootstrapFiles({\n profileDir: params.profileDir,\n userProfilePath: params.userProfilePath,\n sessionKey,\n })\n : [\n ...loadUserProfileBootstrapFile(params.userProfilePath),\n ...loadProfileBootstrapFiles(params.profileDir),\n ];\n const filtered = filterBootstrapFilesForSession(rawFiles, sessionKey);\n return filterHeartbeatBootstrapFile(filtered, params.excludeHeartbeat ?? false);\n}\n\nexport function resolveBootstrapContextSync(params: {\n profileDir: string;\n userProfilePath?: string;\n config?: Config;\n sessionKey?: string;\n excludeHeartbeat?: boolean;\n contextInjection?: 'always' | 'continuation-skip' | 'never';\n}): {\n bootstrapFiles: WorkspaceBootstrapFile[];\n contextFiles: EmbeddedContextFile[];\n} {\n const mode = params.contextInjection ?? 'always';\n if (mode === 'never') {\n return { bootstrapFiles: [], contextFiles: [] };\n }\n if (\n mode === 'continuation-skip' &&\n params.sessionKey &&\n wasBootstrapContextInjected(params.sessionKey)\n ) {\n return { bootstrapFiles: [], contextFiles: [] };\n }\n const bootstrapFiles = resolveBootstrapFilesSync(params);\n const contextFiles = buildBootstrapContextFiles(bootstrapFiles, {\n maxChars: resolveBootstrapMaxChars(params.config),\n totalMaxChars: resolveBootstrapTotalMaxChars(params.config),\n });\n if (mode === 'continuation-skip' && params.sessionKey && contextFiles.length > 0) {\n markBootstrapContextInjected(params.sessionKey);\n }\n return { bootstrapFiles, contextFiles };\n}\n\nexport async function resolveBootstrapContextForRun(params: {\n profileDir: string;\n userProfilePath?: string;\n config?: Config;\n sessionKey?: string;\n excludeHeartbeat?: boolean;\n contextInjection?: 'always' | 'continuation-skip' | 'never';\n warn?: (message: string) => void;\n}): Promise<{\n bootstrapFiles: WorkspaceBootstrapFile[];\n contextFiles: EmbeddedContextFile[];\n}> {\n const mode = params.contextInjection ?? 'always';\n if (mode === 'never') {\n return { bootstrapFiles: [], contextFiles: [] };\n }\n if (\n mode === 'continuation-skip' &&\n params.sessionKey &&\n wasBootstrapContextInjected(params.sessionKey)\n ) {\n return { bootstrapFiles: [], contextFiles: [] };\n }\n const bootstrapFiles = await resolveBootstrapFilesForRun(params);\n const contextFiles = buildBootstrapContextFiles(bootstrapFiles, {\n maxChars: resolveBootstrapMaxChars(params.config),\n totalMaxChars: resolveBootstrapTotalMaxChars(params.config),\n warn: params.warn,\n });\n if (mode === 'continuation-skip' && params.sessionKey && contextFiles.length > 0) {\n markBootstrapContextInjected(params.sessionKey);\n }\n return { bootstrapFiles, contextFiles };\n}\n"],"mappings":";;;;;;AAkBA,SAAS,6BACP,OACA,SAC0B;AAC1B,KAAI,CAAC,QACH,QAAO;AAET,QAAO,MAAM,QAAQ,SAAS,KAAK,SAAS,2BAA2B;;AAGzE,SAAgB,0BAA0B,QAKb;AAM3B,QAAO,6BADU,+BAA+B,CAH9C,GAAG,6BAA6B,OAAO,gBAAgB,EACvD,GAAG,0BAA0B,OAAO,WAAW,CAEO,EAAE,OAAO,WACrB,EAAE,OAAO,oBAAoB,MAAM;;AAGjF,eAAsB,4BAA4B,QAMZ;CACpC,MAAM,aAAa,OAAO;AAY1B,QAAO,6BADU,+BAVA,aACb,MAAM,wBAAwB;EAC5B,YAAY,OAAO;EACnB,iBAAiB,OAAO;EACxB;EACD,CAAC,GACF,CACE,GAAG,6BAA6B,OAAO,gBAAgB,EACvD,GAAG,0BAA0B,OAAO,WAAW,CAChD,EACqD,WACd,EAAE,OAAO,oBAAoB,MAAM;;AAGjF,SAAgB,4BAA4B,QAU1C;CACA,MAAM,OAAO,OAAO,oBAAoB;AACxC,KAAI,SAAS,QACX,QAAO;EAAE,gBAAgB,EAAE;EAAE,cAAc,EAAE;EAAE;AAEjD,KACE,SAAS,uBACT,OAAO,cACP,4BAA4B,OAAO,WAAW,CAE9C,QAAO;EAAE,gBAAgB,EAAE;EAAE,cAAc,EAAE;EAAE;CAEjD,MAAM,iBAAiB,0BAA0B,OAAO;CACxD,MAAM,eAAe,2BAA2B,gBAAgB;EAC9D,UAAU,yBAAyB,OAAO,OAAO;EACjD,eAAe,8BAA8B,OAAO,OAAO;EAC5D,CAAC;AACF,KAAI,SAAS,uBAAuB,OAAO,cAAc,aAAa,SAAS,EAC7E,8BAA6B,OAAO,WAAW;AAEjD,QAAO;EAAE;EAAgB;EAAc;;AAGzC,eAAsB,8BAA8B,QAWjD;CACD,MAAM,OAAO,OAAO,oBAAoB;AACxC,KAAI,SAAS,QACX,QAAO;EAAE,gBAAgB,EAAE;EAAE,cAAc,EAAE;EAAE;AAEjD,KACE,SAAS,uBACT,OAAO,cACP,4BAA4B,OAAO,WAAW,CAE9C,QAAO;EAAE,gBAAgB,EAAE;EAAE,cAAc,EAAE;EAAE;CAEjD,MAAM,iBAAiB,MAAM,4BAA4B,OAAO;CAChE,MAAM,eAAe,2BAA2B,gBAAgB;EAC9D,UAAU,yBAAyB,OAAO,OAAO;EACjD,eAAe,8BAA8B,OAAO,OAAO;EAC3D,MAAM,OAAO;EACd,CAAC;AACF,KAAI,SAAS,uBAAuB,OAAO,cAAc,aAAa,SAAS,EAC7E,8BAA6B,OAAO,WAAW;AAEjD,QAAO;EAAE;EAAgB;EAAc"}
@@ -1,14 +1,16 @@
1
1
  import { isCronSessionKey, isSubagentSessionKey } from "../../routing/session-key-utils.js";
2
2
  import { init_session_key } from "../../routing/session-key.js";
3
- import { DEFAULT_AGENTS_FILENAME, DEFAULT_IDENTITY_FILENAME, DEFAULT_SOUL_FILENAME, DEFAULT_TOOLS_FILENAME, DEFAULT_USER_FILENAME } from "../context/workspace.js";
3
+ import { USER_PROFILE_FILENAME, init_paths } from "../../config/paths.js";
4
+ import { DEFAULT_AGENTS_FILENAME, DEFAULT_IDENTITY_FILENAME, DEFAULT_SOUL_FILENAME, DEFAULT_TOOLS_FILENAME } from "../context/workspace.js";
4
5
  //#region src/agent/bootstrap/filter-bootstrap-files.ts
6
+ init_paths();
5
7
  init_session_key();
6
8
  const MINIMAL_BOOTSTRAP_ALLOWLIST = new Set([
7
9
  DEFAULT_AGENTS_FILENAME,
8
10
  DEFAULT_TOOLS_FILENAME,
9
11
  DEFAULT_SOUL_FILENAME,
10
12
  DEFAULT_IDENTITY_FILENAME,
11
- DEFAULT_USER_FILENAME
13
+ USER_PROFILE_FILENAME
12
14
  ]);
13
15
  /** Subagent and cron sessions omit MEMORY.md and other heavy profile files. */
14
16
  function filterBootstrapFilesForSession(files, sessionKey) {
@@ -1 +1 @@
1
- {"version":3,"file":"filter-bootstrap-files.js","names":[],"sources":["../../../../src/agent/bootstrap/filter-bootstrap-files.ts"],"sourcesContent":["import { isCronSessionKey, isSubagentSessionKey } from '../../routing/session-key.js';\nimport {\n DEFAULT_AGENTS_FILENAME,\n DEFAULT_IDENTITY_FILENAME,\n DEFAULT_SOUL_FILENAME,\n DEFAULT_TOOLS_FILENAME,\n DEFAULT_USER_FILENAME,\n} from '../context/workspace.js';\nimport type { WorkspaceBootstrapFile } from './types.js';\n\nconst MINIMAL_BOOTSTRAP_ALLOWLIST = new Set<string>([\n DEFAULT_AGENTS_FILENAME,\n DEFAULT_TOOLS_FILENAME,\n DEFAULT_SOUL_FILENAME,\n DEFAULT_IDENTITY_FILENAME,\n DEFAULT_USER_FILENAME,\n]);\n\n/** Subagent and cron sessions omit MEMORY.md and other heavy profile files. */\nexport function filterBootstrapFilesForSession(\n files: WorkspaceBootstrapFile[],\n sessionKey?: string,\n): WorkspaceBootstrapFile[] {\n if (!sessionKey || (!isSubagentSessionKey(sessionKey) && !isCronSessionKey(sessionKey))) {\n return files;\n }\n return files.filter((file) => MINIMAL_BOOTSTRAP_ALLOWLIST.has(file.name));\n}\n"],"mappings":";;;;kBAAsF;AAUtF,MAAM,8BAA8B,IAAI,IAAY;CAClD;CACA;CACA;CACA;CACA;CACD,CAAC;;AAGF,SAAgB,+BACd,OACA,YAC0B;AAC1B,KAAI,CAAC,cAAe,CAAC,qBAAqB,WAAW,IAAI,CAAC,iBAAiB,WAAW,CACpF,QAAO;AAET,QAAO,MAAM,QAAQ,SAAS,4BAA4B,IAAI,KAAK,KAAK,CAAC"}
1
+ {"version":3,"file":"filter-bootstrap-files.js","names":[],"sources":["../../../../src/agent/bootstrap/filter-bootstrap-files.ts"],"sourcesContent":["import { USER_PROFILE_FILENAME } from '../../config/paths.js';\nimport { isCronSessionKey, isSubagentSessionKey } from '../../routing/session-key.js';\nimport {\n DEFAULT_AGENTS_FILENAME,\n DEFAULT_IDENTITY_FILENAME,\n DEFAULT_SOUL_FILENAME,\n DEFAULT_TOOLS_FILENAME,\n} from '../context/workspace.js';\nimport type { WorkspaceBootstrapFile } from './types.js';\n\nconst MINIMAL_BOOTSTRAP_ALLOWLIST = new Set<string>([\n DEFAULT_AGENTS_FILENAME,\n DEFAULT_TOOLS_FILENAME,\n DEFAULT_SOUL_FILENAME,\n DEFAULT_IDENTITY_FILENAME,\n USER_PROFILE_FILENAME,\n]);\n\n/** Subagent and cron sessions omit MEMORY.md and other heavy profile files. */\nexport function filterBootstrapFilesForSession(\n files: WorkspaceBootstrapFile[],\n sessionKey?: string,\n): WorkspaceBootstrapFile[] {\n if (!sessionKey || (!isSubagentSessionKey(sessionKey) && !isCronSessionKey(sessionKey))) {\n return files;\n }\n return files.filter((file) => MINIMAL_BOOTSTRAP_ALLOWLIST.has(file.name));\n}\n"],"mappings":";;;;;YAA8D;kBACwB;AAStF,MAAM,8BAA8B,IAAI,IAAY;CAClD;CACA;CACA;CACA;CACA;CACD,CAAC;;AAGF,SAAgB,+BACd,OACA,YAC0B;AAC1B,KAAI,CAAC,cAAe,CAAC,qBAAqB,WAAW,IAAI,CAAC,iBAAiB,WAAW,CACpF,QAAO;AAET,QAAO,MAAM,QAAQ,SAAS,4BAA4B,IAAI,KAAK,KAAK,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import type { WorkspaceBootstrapFile } from './types.js';
2
+ export declare function loadUserProfileBootstrapFile(userProfilePath: string | undefined): WorkspaceBootstrapFile[];
2
3
  /**
3
4
  * Load bootstrap profile Markdown from `agents/<id>/profile/`.
4
- * MEMORY.md is omitted when absent; other slots emit missing markers.
5
+ * Required files emit missing markers; optional files are omitted when absent.
5
6
  */
6
7
  export declare function loadProfileBootstrapFiles(profileDir: string): WorkspaceBootstrapFile[];
@@ -1,13 +1,14 @@
1
- import { DEFAULT_AGENTS_FILENAME, DEFAULT_HEARTBEAT_FILENAME, DEFAULT_IDENTITY_FILENAME, DEFAULT_MEMORY_FILENAME, DEFAULT_SOUL_FILENAME, DEFAULT_TOOLS_FILENAME, DEFAULT_USER_FILENAME, stripFrontMatter } from "../context/workspace.js";
2
- import { existsSync, readFileSync } from "node:fs";
1
+ import { USER_PROFILE_FILENAME, init_paths } from "../../config/paths.js";
2
+ import { DEFAULT_AGENTS_FILENAME, DEFAULT_HEARTBEAT_FILENAME, DEFAULT_IDENTITY_FILENAME, DEFAULT_MEMORY_FILENAME, DEFAULT_SOUL_FILENAME, DEFAULT_TOOLS_FILENAME, REQUIRED_AGENT_PROFILE_MARKDOWN_FILE_SET, stripFrontMatter } from "../context/workspace.js";
3
3
  import { join, resolve } from "node:path";
4
+ import { existsSync, readFileSync } from "node:fs";
4
5
  //#region src/agent/bootstrap/load-bootstrap-files.ts
6
+ init_paths();
5
7
  const PROFILE_LOAD_ORDER = [
6
8
  DEFAULT_AGENTS_FILENAME,
7
9
  DEFAULT_SOUL_FILENAME,
8
10
  DEFAULT_TOOLS_FILENAME,
9
11
  DEFAULT_IDENTITY_FILENAME,
10
- DEFAULT_USER_FILENAME,
11
12
  DEFAULT_HEARTBEAT_FILENAME,
12
13
  DEFAULT_MEMORY_FILENAME
13
14
  ];
@@ -19,26 +20,26 @@ function readProfileFile(filePath) {
19
20
  return null;
20
21
  }
21
22
  }
23
+ function loadUserProfileBootstrapFile(userProfilePath) {
24
+ if (!userProfilePath) return [];
25
+ const filePath = resolve(userProfilePath);
26
+ const content = readProfileFile(filePath);
27
+ return content !== null ? [{
28
+ name: USER_PROFILE_FILENAME,
29
+ path: filePath,
30
+ content,
31
+ missing: false
32
+ }] : [];
33
+ }
22
34
  /**
23
35
  * Load bootstrap profile Markdown from `agents/<id>/profile/`.
24
- * MEMORY.md is omitted when absent; other slots emit missing markers.
36
+ * Required files emit missing markers; optional files are omitted when absent.
25
37
  */
26
38
  function loadProfileBootstrapFiles(profileDir) {
27
39
  const resolvedDir = resolve(profileDir);
28
40
  const result = [];
29
41
  for (const name of PROFILE_LOAD_ORDER) {
30
42
  const filePath = join(resolvedDir, name);
31
- if (name === "MEMORY.md") {
32
- const content = readProfileFile(filePath);
33
- if (content === null) continue;
34
- result.push({
35
- name,
36
- path: filePath,
37
- content,
38
- missing: false
39
- });
40
- continue;
41
- }
42
43
  const content = readProfileFile(filePath);
43
44
  if (content !== null) result.push({
44
45
  name,
@@ -46,7 +47,7 @@ function loadProfileBootstrapFiles(profileDir) {
46
47
  content,
47
48
  missing: false
48
49
  });
49
- else result.push({
50
+ else if (REQUIRED_AGENT_PROFILE_MARKDOWN_FILE_SET.has(name)) result.push({
50
51
  name,
51
52
  path: filePath,
52
53
  missing: true
@@ -55,6 +56,6 @@ function loadProfileBootstrapFiles(profileDir) {
55
56
  return result;
56
57
  }
57
58
  //#endregion
58
- export { loadProfileBootstrapFiles };
59
+ export { loadProfileBootstrapFiles, loadUserProfileBootstrapFile };
59
60
 
60
61
  //# sourceMappingURL=load-bootstrap-files.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"load-bootstrap-files.js","names":[],"sources":["../../../../src/agent/bootstrap/load-bootstrap-files.ts"],"sourcesContent":["import { existsSync, readFileSync } from 'node:fs';\nimport { join, resolve } from 'node:path';\n\nimport { stripFrontMatter } from '../context/workspace.js';\nimport {\n DEFAULT_AGENTS_FILENAME,\n DEFAULT_HEARTBEAT_FILENAME,\n DEFAULT_IDENTITY_FILENAME,\n DEFAULT_MEMORY_FILENAME,\n DEFAULT_SOUL_FILENAME,\n DEFAULT_TOOLS_FILENAME,\n DEFAULT_USER_FILENAME,\n} from '../context/workspace.js';\nimport type { BootstrapFileName, WorkspaceBootstrapFile } from './types.js';\n\nconst PROFILE_LOAD_ORDER: BootstrapFileName[] = [\n DEFAULT_AGENTS_FILENAME,\n DEFAULT_SOUL_FILENAME,\n DEFAULT_TOOLS_FILENAME,\n DEFAULT_IDENTITY_FILENAME,\n DEFAULT_USER_FILENAME,\n DEFAULT_HEARTBEAT_FILENAME,\n DEFAULT_MEMORY_FILENAME,\n];\n\nfunction readProfileFile(filePath: string): string | null {\n if (!existsSync(filePath)) {\n return null;\n }\n try {\n return stripFrontMatter(readFileSync(filePath, 'utf-8'));\n } catch {\n return null;\n }\n}\n\n/**\n * Load bootstrap profile Markdown from `agents/<id>/profile/`.\n * MEMORY.md is omitted when absent; other slots emit missing markers.\n */\nexport function loadProfileBootstrapFiles(profileDir: string): WorkspaceBootstrapFile[] {\n const resolvedDir = resolve(profileDir);\n const result: WorkspaceBootstrapFile[] = [];\n\n for (const name of PROFILE_LOAD_ORDER) {\n const filePath = join(resolvedDir, name);\n\n if (name === DEFAULT_MEMORY_FILENAME) {\n const content = readProfileFile(filePath);\n if (content === null) {\n continue;\n }\n result.push({ name, path: filePath, content, missing: false });\n continue;\n }\n\n const content = readProfileFile(filePath);\n if (content !== null) {\n result.push({ name, path: filePath, content, missing: false });\n } else {\n result.push({ name, path: filePath, missing: true });\n }\n }\n\n return result;\n}\n"],"mappings":";;;;AAeA,MAAM,qBAA0C;CAC9C;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,SAAS,gBAAgB,UAAiC;AACxD,KAAI,CAAC,WAAW,SAAS,CACvB,QAAO;AAET,KAAI;AACF,SAAO,iBAAiB,aAAa,UAAU,QAAQ,CAAC;SAClD;AACN,SAAO;;;;;;;AAQX,SAAgB,0BAA0B,YAA8C;CACtF,MAAM,cAAc,QAAQ,WAAW;CACvC,MAAM,SAAmC,EAAE;AAE3C,MAAK,MAAM,QAAQ,oBAAoB;EACrC,MAAM,WAAW,KAAK,aAAa,KAAK;AAExC,MAAI,SAAA,aAAkC;GACpC,MAAM,UAAU,gBAAgB,SAAS;AACzC,OAAI,YAAY,KACd;AAEF,UAAO,KAAK;IAAE;IAAM,MAAM;IAAU;IAAS,SAAS;IAAO,CAAC;AAC9D;;EAGF,MAAM,UAAU,gBAAgB,SAAS;AACzC,MAAI,YAAY,KACd,QAAO,KAAK;GAAE;GAAM,MAAM;GAAU;GAAS,SAAS;GAAO,CAAC;MAE9D,QAAO,KAAK;GAAE;GAAM,MAAM;GAAU,SAAS;GAAM,CAAC;;AAIxD,QAAO"}
1
+ {"version":3,"file":"load-bootstrap-files.js","names":[],"sources":["../../../../src/agent/bootstrap/load-bootstrap-files.ts"],"sourcesContent":["import { existsSync, readFileSync } from 'node:fs';\nimport { join, resolve } from 'node:path';\n\nimport { USER_PROFILE_FILENAME } from '../../config/paths.js';\nimport { stripFrontMatter } from '../context/workspace.js';\nimport {\n DEFAULT_AGENTS_FILENAME,\n DEFAULT_HEARTBEAT_FILENAME,\n DEFAULT_IDENTITY_FILENAME,\n DEFAULT_MEMORY_FILENAME,\n DEFAULT_SOUL_FILENAME,\n DEFAULT_TOOLS_FILENAME,\n REQUIRED_AGENT_PROFILE_MARKDOWN_FILE_SET,\n} from '../context/workspace.js';\nimport type { BootstrapFileName, WorkspaceBootstrapFile } from './types.js';\n\nconst PROFILE_LOAD_ORDER: BootstrapFileName[] = [\n DEFAULT_AGENTS_FILENAME,\n DEFAULT_SOUL_FILENAME,\n DEFAULT_TOOLS_FILENAME,\n DEFAULT_IDENTITY_FILENAME,\n DEFAULT_HEARTBEAT_FILENAME,\n DEFAULT_MEMORY_FILENAME,\n];\n\nfunction readProfileFile(filePath: string): string | null {\n if (!existsSync(filePath)) {\n return null;\n }\n try {\n return stripFrontMatter(readFileSync(filePath, 'utf-8'));\n } catch {\n return null;\n }\n}\n\nexport function loadUserProfileBootstrapFile(userProfilePath: string | undefined): WorkspaceBootstrapFile[] {\n if (!userProfilePath) {\n return [];\n }\n const filePath = resolve(userProfilePath);\n const content = readProfileFile(filePath);\n return content !== null\n ? [{ name: USER_PROFILE_FILENAME, path: filePath, content, missing: false }]\n : [];\n}\n\n/**\n * Load bootstrap profile Markdown from `agents/<id>/profile/`.\n * Required files emit missing markers; optional files are omitted when absent.\n */\nexport function loadProfileBootstrapFiles(profileDir: string): WorkspaceBootstrapFile[] {\n const resolvedDir = resolve(profileDir);\n const result: WorkspaceBootstrapFile[] = [];\n\n for (const name of PROFILE_LOAD_ORDER) {\n const filePath = join(resolvedDir, name);\n\n const content = readProfileFile(filePath);\n if (content !== null) {\n result.push({ name, path: filePath, content, missing: false });\n } else if (REQUIRED_AGENT_PROFILE_MARKDOWN_FILE_SET.has(name)) {\n result.push({ name, path: filePath, missing: true });\n }\n }\n\n return result;\n}\n"],"mappings":";;;;;YAG8D;AAa9D,MAAM,qBAA0C;CAC9C;CACA;CACA;CACA;CACA;CACA;CACD;AAED,SAAS,gBAAgB,UAAiC;AACxD,KAAI,CAAC,WAAW,SAAS,CACvB,QAAO;AAET,KAAI;AACF,SAAO,iBAAiB,aAAa,UAAU,QAAQ,CAAC;SAClD;AACN,SAAO;;;AAIX,SAAgB,6BAA6B,iBAA+D;AAC1G,KAAI,CAAC,gBACH,QAAO,EAAE;CAEX,MAAM,WAAW,QAAQ,gBAAgB;CACzC,MAAM,UAAU,gBAAgB,SAAS;AACzC,QAAO,YAAY,OACf,CAAC;EAAE,MAAM;EAAuB,MAAM;EAAU;EAAS,SAAS;EAAO,CAAC,GAC1E,EAAE;;;;;;AAOR,SAAgB,0BAA0B,YAA8C;CACtF,MAAM,cAAc,QAAQ,WAAW;CACvC,MAAM,SAAmC,EAAE;AAE3C,MAAK,MAAM,QAAQ,oBAAoB;EACrC,MAAM,WAAW,KAAK,aAAa,KAAK;EAExC,MAAM,UAAU,gBAAgB,SAAS;AACzC,MAAI,YAAY,KACd,QAAO,KAAK;GAAE;GAAM,MAAM;GAAU;GAAS,SAAS;GAAO,CAAC;WACrD,yCAAyC,IAAI,KAAK,CAC3D,QAAO,KAAK;GAAE;GAAM,MAAM;GAAU,SAAS;GAAM,CAAC;;AAIxD,QAAO"}
@@ -1,6 +1,6 @@
1
1
  import { DEFAULT_AGENTS_FILENAME, stripFrontMatter } from "../context/workspace.js";
2
- import { existsSync, readFileSync } from "node:fs";
3
2
  import { join, resolve } from "node:path";
3
+ import { existsSync, readFileSync } from "node:fs";
4
4
  //#region src/agent/bootstrap/project-agents-context.ts
5
5
  const PROJECT_AGENTS_MAX_CHARS = 2e4;
6
6
  function truncateProjectAgentsContent(content) {
@@ -1,5 +1,5 @@
1
1
  import type { AgentProfileMarkdownFilename } from '../context/workspace.js';
2
- export type BootstrapFileName = AgentProfileMarkdownFilename;
2
+ export type BootstrapFileName = AgentProfileMarkdownFilename | 'PROFILE.md';
3
3
  export type WorkspaceBootstrapFile = {
4
4
  name: BootstrapFileName;
5
5
  path: string;
@@ -1,12 +1,12 @@
1
1
  import { init_agent_scope, resolveAgentProfileDir, resolveAgentWorkspaceDir, resolveDefaultAgentId } from "../agent-scope.js";
2
- import { WORKSPACE_FILES, init_paths } from "../../config/paths.js";
3
2
  import { createLogger } from "../../utils/logger/index.js";
4
3
  import { init_logger } from "../../utils/logger.js";
4
+ import { WORKSPACE_FILES, init_paths } from "../../config/paths.js";
5
5
  import { AGENT_PROFILE_MARKDOWN_SYSTEM_FILES } from "./workspace.js";
6
- import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
7
6
  import { dirname, join } from "node:path";
8
- import { fileURLToPath } from "node:url";
7
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
9
8
  import { execFileSync } from "node:child_process";
9
+ import { fileURLToPath } from "node:url";
10
10
  //#region src/agent/context/workspace-seed.ts
11
11
  /**
12
12
  * Seed profile Markdown files into `agents/<agentId>/profile/` (and optionally `git init` the Markdown workspace).
@@ -1,6 +1,6 @@
1
1
  import { FILENAMES, init_paths, resolveWorkspaceStatePath } from "../../config/paths.js";
2
- import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
3
2
  import { dirname, join } from "node:path";
3
+ import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
4
4
  //#region src/agent/context/workspace-state.ts
5
5
  /**
6
6
  * Workspace setup metadata in `<markdownWorkspace>/.xopc/workspace.json`
@@ -11,7 +11,7 @@ This workspace is the agent's working area. Treat it as user-owned state.
11
11
 
12
12
  ## Startup Context
13
13
 
14
- Use runtime-provided startup context first. It may already include profile files such as `SOUL.md`, `IDENTITY.md`, `USER.md`, `TOOLS.md`, `AGENTS.md`, `HEARTBEAT.md`, and `MEMORY.md`.
14
+ Use runtime-provided startup context first. It may already include the global user profile and profile files such as `SOUL.md`, `IDENTITY.md`, `TOOLS.md`, `AGENTS.md`, `HEARTBEAT.md`, and `MEMORY.md`.
15
15
 
16
16
  Do not manually reread startup files unless:
17
17
 
@@ -8,14 +8,16 @@ export declare const DEFAULT_AGENTS_FILENAME = "AGENTS.md";
8
8
  export declare const DEFAULT_SOUL_FILENAME = "SOUL.md";
9
9
  export declare const DEFAULT_TOOLS_FILENAME = "TOOLS.md";
10
10
  export declare const DEFAULT_IDENTITY_FILENAME = "IDENTITY.md";
11
- export declare const DEFAULT_USER_FILENAME = "USER.md";
12
11
  export declare const DEFAULT_HEARTBEAT_FILENAME = "HEARTBEAT.md";
13
12
  export declare const DEFAULT_MEMORY_FILENAME = "MEMORY.md";
14
- export type AgentProfileMarkdownFilename = typeof DEFAULT_AGENTS_FILENAME | typeof DEFAULT_SOUL_FILENAME | typeof DEFAULT_TOOLS_FILENAME | typeof DEFAULT_IDENTITY_FILENAME | typeof DEFAULT_USER_FILENAME | typeof DEFAULT_HEARTBEAT_FILENAME | typeof DEFAULT_MEMORY_FILENAME;
13
+ export type AgentProfileMarkdownFilename = typeof DEFAULT_AGENTS_FILENAME | typeof DEFAULT_SOUL_FILENAME | typeof DEFAULT_TOOLS_FILENAME | typeof DEFAULT_IDENTITY_FILENAME | typeof DEFAULT_HEARTBEAT_FILENAME | typeof DEFAULT_MEMORY_FILENAME;
15
14
  /**
16
15
  * Order for loading profile Markdown files into the system prompt (persona / user before repo guide, etc.).
17
16
  */
18
17
  export declare const AGENT_PROFILE_MARKDOWN_SYSTEM_FILES: readonly AgentProfileMarkdownFilename[];
18
+ /** Files that should be surfaced when missing. Other profile files are optional overlays. */
19
+ export declare const REQUIRED_AGENT_PROFILE_MARKDOWN_FILES: readonly AgentProfileMarkdownFilename[];
20
+ export declare const REQUIRED_AGENT_PROFILE_MARKDOWN_FILE_SET: ReadonlySet<string>;
19
21
  export interface WorkspaceProfileMarkdownFile {
20
22
  name: AgentProfileMarkdownFilename;
21
23
  path: string;
@@ -1,8 +1,8 @@
1
1
  import { createLogger } from "../../utils/logger/index.js";
2
2
  import { init_logger } from "../../utils/logger.js";
3
3
  import { parseFrontmatter } from "../../markdown/frontmatter.js";
4
- import { existsSync, readFileSync } from "fs";
5
4
  import { join, resolve } from "path";
5
+ import { existsSync, readFileSync } from "fs";
6
6
  //#region src/agent/context/workspace.ts
7
7
  /**
8
8
  * Agent profile Markdown (filenames, load order, system prompt assembly) and
@@ -16,7 +16,6 @@ const DEFAULT_AGENTS_FILENAME = "AGENTS.md";
16
16
  const DEFAULT_SOUL_FILENAME = "SOUL.md";
17
17
  const DEFAULT_TOOLS_FILENAME = "TOOLS.md";
18
18
  const DEFAULT_IDENTITY_FILENAME = "IDENTITY.md";
19
- const DEFAULT_USER_FILENAME = "USER.md";
20
19
  const DEFAULT_HEARTBEAT_FILENAME = "HEARTBEAT.md";
21
20
  const DEFAULT_MEMORY_FILENAME = "MEMORY.md";
22
21
  /**
@@ -25,12 +24,14 @@ const DEFAULT_MEMORY_FILENAME = "MEMORY.md";
25
24
  const AGENT_PROFILE_MARKDOWN_SYSTEM_FILES = [
26
25
  DEFAULT_SOUL_FILENAME,
27
26
  DEFAULT_IDENTITY_FILENAME,
28
- DEFAULT_USER_FILENAME,
29
27
  DEFAULT_TOOLS_FILENAME,
30
28
  DEFAULT_AGENTS_FILENAME,
31
29
  DEFAULT_HEARTBEAT_FILENAME,
32
30
  DEFAULT_MEMORY_FILENAME
33
31
  ];
32
+ /** Files that should be surfaced when missing. Other profile files are optional overlays. */
33
+ const REQUIRED_AGENT_PROFILE_MARKDOWN_FILES = [DEFAULT_SOUL_FILENAME, DEFAULT_IDENTITY_FILENAME];
34
+ const REQUIRED_AGENT_PROFILE_MARKDOWN_FILE_SET = new Set(REQUIRED_AGENT_PROFILE_MARKDOWN_FILES);
34
35
  /**
35
36
  * Strip YAML front matter from markdown content.
36
37
  */
@@ -118,7 +119,7 @@ function loadProfileMarkdownFiles(profileDir) {
118
119
  err
119
120
  }, "Failed to load profile Markdown file");
120
121
  }
121
- else {
122
+ else if (REQUIRED_AGENT_PROFILE_MARKDOWN_FILE_SET.has(filename)) {
122
123
  const hint = join(profileDir, filename);
123
124
  files.push({
124
125
  name: filename,
@@ -165,6 +166,6 @@ function extractThinkingFromAssistantMessage(message) {
165
166
  return typeof t === "string" ? t : "";
166
167
  }
167
168
  //#endregion
168
- export { AGENT_PROFILE_MARKDOWN_SYSTEM_FILES, DEFAULT_AGENTS_FILENAME, DEFAULT_HEARTBEAT_FILENAME, DEFAULT_IDENTITY_FILENAME, DEFAULT_MEMORY_FILENAME, DEFAULT_SOUL_FILENAME, DEFAULT_TOOLS_FILENAME, DEFAULT_USER_FILENAME, PROFILE_MARKDOWN_MAX_CHARS, extractTextContent, extractThinkingContent, extractThinkingFromAssistantMessage, loadProfileMarkdownFiles, stripFrontMatter, toWorkspaceProfileMarkdownFile, truncateProfileMarkdownContent };
169
+ export { AGENT_PROFILE_MARKDOWN_SYSTEM_FILES, DEFAULT_AGENTS_FILENAME, DEFAULT_HEARTBEAT_FILENAME, DEFAULT_IDENTITY_FILENAME, DEFAULT_MEMORY_FILENAME, DEFAULT_SOUL_FILENAME, DEFAULT_TOOLS_FILENAME, PROFILE_MARKDOWN_MAX_CHARS, REQUIRED_AGENT_PROFILE_MARKDOWN_FILES, REQUIRED_AGENT_PROFILE_MARKDOWN_FILE_SET, extractTextContent, extractThinkingContent, extractThinkingFromAssistantMessage, loadProfileMarkdownFiles, stripFrontMatter, toWorkspaceProfileMarkdownFile, truncateProfileMarkdownContent };
169
170
 
170
171
  //# sourceMappingURL=workspace.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"workspace.js","names":[],"sources":["../../../../src/agent/context/workspace.ts"],"sourcesContent":["/**\n * Agent profile Markdown (filenames, load order, system prompt assembly) and\n * small helpers for message content extraction.\n *\n * Canonical on-disk root: `agents/<agentId>/profile/`.\n */\n\nimport { readFileSync, existsSync } from 'fs';\nimport { join, resolve } from 'path';\nimport { createLogger } from '../../utils/logger.js';\nimport { parseFrontmatter } from '../../markdown/frontmatter.js';\n\nconst log = createLogger('Workspace');\n\n// =============================================================================\n// Profile Markdown filenames & types (SOUL.md, IDENTITY.md, … under `profile/`)\n// =============================================================================\n\nexport const DEFAULT_AGENTS_FILENAME = 'AGENTS.md';\nexport const DEFAULT_SOUL_FILENAME = 'SOUL.md';\nexport const DEFAULT_TOOLS_FILENAME = 'TOOLS.md';\nexport const DEFAULT_IDENTITY_FILENAME = 'IDENTITY.md';\nexport const DEFAULT_USER_FILENAME = 'USER.md';\nexport const DEFAULT_HEARTBEAT_FILENAME = 'HEARTBEAT.md';\nexport const DEFAULT_MEMORY_FILENAME = 'MEMORY.md';\n\nexport type AgentProfileMarkdownFilename =\n | typeof DEFAULT_AGENTS_FILENAME\n | typeof DEFAULT_SOUL_FILENAME\n | typeof DEFAULT_TOOLS_FILENAME\n | typeof DEFAULT_IDENTITY_FILENAME\n | typeof DEFAULT_USER_FILENAME\n | typeof DEFAULT_HEARTBEAT_FILENAME\n | typeof DEFAULT_MEMORY_FILENAME;\n\n/**\n * Order for loading profile Markdown files into the system prompt (persona / user before repo guide, etc.).\n */\nexport const AGENT_PROFILE_MARKDOWN_SYSTEM_FILES: readonly AgentProfileMarkdownFilename[] = [\n DEFAULT_SOUL_FILENAME,\n DEFAULT_IDENTITY_FILENAME,\n DEFAULT_USER_FILENAME,\n DEFAULT_TOOLS_FILENAME,\n DEFAULT_AGENTS_FILENAME,\n DEFAULT_HEARTBEAT_FILENAME,\n DEFAULT_MEMORY_FILENAME,\n];\n\nexport interface WorkspaceProfileMarkdownFile {\n name: AgentProfileMarkdownFilename;\n path: string;\n content?: string;\n missing: boolean;\n}\n\n/**\n * Strip YAML front matter from markdown content.\n */\nexport function stripFrontMatter(content: string): string {\n return parseFrontmatter(content).content;\n}\n\n// =============================================================================\n// Load & truncate profile Markdown for system prompt\n// =============================================================================\n\n/** Maximum characters to inject from workspace files into system prompt */\nexport const PROFILE_MARKDOWN_MAX_CHARS = 20_000;\n\n/** Profile Markdown truncation: fraction of `maxChars` kept from the start of the file */\nconst HEAD_TRUNCATION_RATIO = 0.7;\n/** Profile Markdown truncation: fraction of `maxChars` kept from the end of the file */\nconst TAIL_TRUNCATION_RATIO = 0.2;\n\nexport interface TruncateResult {\n content: string;\n truncated: boolean;\n originalLength: number;\n}\n\n/**\n * Truncate workspace file content to prevent token overflow.\n * Keeps head (HEAD_TRUNCATION_RATIO, 70%) and tail (TAIL_TRUNCATION_RATIO, 20%) with a\n * truncation marker in between; the remainder is reserved for the marker.\n */\nexport function truncateProfileMarkdownContent(content: string, maxChars: number): TruncateResult {\n const trimmed = content.trimEnd();\n if (trimmed.length <= maxChars) {\n return {\n content: trimmed,\n truncated: false,\n originalLength: trimmed.length,\n };\n }\n\n const headChars = Math.floor(maxChars * HEAD_TRUNCATION_RATIO);\n const tailChars = Math.floor(maxChars * TAIL_TRUNCATION_RATIO);\n const head = trimmed.slice(0, headChars);\n const tail = trimmed.slice(-tailChars);\n\n const marker = [\n '',\n '[...content truncated, read the full file for complete content...]',\n `...(truncated: kept ${headChars}+${tailChars} chars of ${trimmed.length})...`,\n '',\n ].join('\\n');\n\n return {\n content: head + marker + tail,\n truncated: true,\n originalLength: trimmed.length,\n };\n}\n\nexport interface ProfileMarkdownFile {\n name: AgentProfileMarkdownFilename;\n path?: string;\n content: string;\n missing?: boolean;\n}\n\n/**\n * Convert {@link ProfileMarkdownFile} to {@link WorkspaceProfileMarkdownFile} (adds required path field).\n * @param pathFallbackDir — used when `file.path` is absent (e.g. canonical `profile/` root).\n */\nexport function toWorkspaceProfileMarkdownFile(file: ProfileMarkdownFile, pathFallbackDir: string): {\n name: AgentProfileMarkdownFilename;\n path: string;\n content?: string;\n missing: boolean;\n} {\n return {\n name: file.name,\n path: file.path || join(pathFallbackDir, file.name),\n content: file.missing ? undefined : file.content,\n missing: file.missing ?? false,\n };\n}\n\n/**\n * Load profile Markdown from `profileDir` (`agents/<agentId>/profile/`).\n */\nexport function loadProfileMarkdownFiles(profileDir: string): ProfileMarkdownFile[] {\n const files: ProfileMarkdownFile[] = [];\n let loadedCount = 0;\n let missingCount = 0;\n\n for (const filename of AGENT_PROFILE_MARKDOWN_SYSTEM_FILES) {\n const filePath = join(profileDir, filename);\n\n if (existsSync(filePath)) {\n try {\n let content = readFileSync(filePath, 'utf-8');\n\n content = stripFrontMatter(content);\n\n const result = truncateProfileMarkdownContent(content, PROFILE_MARKDOWN_MAX_CHARS);\n\n if (result.content) {\n files.push({\n name: filename,\n content: result.content,\n path: resolve(filePath),\n });\n loadedCount++;\n\n if (result.truncated) {\n log.warn(\n {\n file: filename,\n originalLength: result.originalLength,\n keptLength: result.content.length,\n },\n 'Profile Markdown truncated in system prompt (too long)',\n );\n } else {\n log.debug({ file: filename, path: filePath }, 'Profile Markdown file loaded');\n }\n }\n } catch (err) {\n log.warn({ file: filename, err }, 'Failed to load profile Markdown file');\n }\n } else {\n const hint = join(profileDir, filename);\n files.push({\n name: filename,\n content: `[MISSING] Create this file at: ${hint}`,\n missing: true,\n path: resolve(hint),\n });\n missingCount++;\n log.debug({ file: filename }, 'Profile Markdown file missing');\n }\n }\n\n log.debug({ loaded: loadedCount, missing: missingCount, profileDir }, 'Profile Markdown scan done');\n\n return files;\n}\n\n// =============================================================================\n// Message content helpers\n// =============================================================================\n\n/**\n * Extract text content from agent message content array\n */\nexport function extractTextContent(\n content: Array<{ type: string; text?: string }>\n): string {\n return content\n .filter((c) => c.type === 'text')\n .map((c) => c.text || '')\n .join('');\n}\n\nconst THINKING_BLOCK_TYPES = new Set(['thinking', 'thinking_delta', 'redacted_thinking']);\n\n/**\n * Concatenate thinking / reasoning content blocks from assistant message.content.\n * pi-ai may use `thinking` or `text` on `type: \"thinking\"` blocks.\n */\nexport function extractThinkingContent(\n content: Array<{ type: string; thinking?: string; text?: string }> | undefined\n): string {\n if (!Array.isArray(content)) return '';\n return content\n .filter((c) => THINKING_BLOCK_TYPES.has(c.type))\n .map((c) => (typeof c.thinking === 'string' ? c.thinking : c.text) || '')\n .join('');\n}\n\n/**\n * Extended thinking on the assistant message (e.g. Anthropic reasoning / pi-ai reasoning_details).\n */\nexport function extractThinkingFromAssistantMessage(\n message: { role?: string; reasoning_details?: { thinking?: string } } | undefined\n): string {\n if (!message || message.role !== 'assistant') return '';\n const t = message.reasoning_details?.thinking;\n return typeof t === 'string' ? t : '';\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"workspace.js","names":[],"sources":["../../../../src/agent/context/workspace.ts"],"sourcesContent":["/**\n * Agent profile Markdown (filenames, load order, system prompt assembly) and\n * small helpers for message content extraction.\n *\n * Canonical on-disk root: `agents/<agentId>/profile/`.\n */\n\nimport { readFileSync, existsSync } from 'fs';\nimport { join, resolve } from 'path';\nimport { createLogger } from '../../utils/logger.js';\nimport { parseFrontmatter } from '../../markdown/frontmatter.js';\n\nconst log = createLogger('Workspace');\n\n// =============================================================================\n// Profile Markdown filenames & types (SOUL.md, IDENTITY.md, … under `profile/`)\n// =============================================================================\n\nexport const DEFAULT_AGENTS_FILENAME = 'AGENTS.md';\nexport const DEFAULT_SOUL_FILENAME = 'SOUL.md';\nexport const DEFAULT_TOOLS_FILENAME = 'TOOLS.md';\nexport const DEFAULT_IDENTITY_FILENAME = 'IDENTITY.md';\nexport const DEFAULT_HEARTBEAT_FILENAME = 'HEARTBEAT.md';\nexport const DEFAULT_MEMORY_FILENAME = 'MEMORY.md';\n\nexport type AgentProfileMarkdownFilename =\n | typeof DEFAULT_AGENTS_FILENAME\n | typeof DEFAULT_SOUL_FILENAME\n | typeof DEFAULT_TOOLS_FILENAME\n | typeof DEFAULT_IDENTITY_FILENAME\n | typeof DEFAULT_HEARTBEAT_FILENAME\n | typeof DEFAULT_MEMORY_FILENAME;\n\n/**\n * Order for loading profile Markdown files into the system prompt (persona / user before repo guide, etc.).\n */\nexport const AGENT_PROFILE_MARKDOWN_SYSTEM_FILES: readonly AgentProfileMarkdownFilename[] = [\n DEFAULT_SOUL_FILENAME,\n DEFAULT_IDENTITY_FILENAME,\n DEFAULT_TOOLS_FILENAME,\n DEFAULT_AGENTS_FILENAME,\n DEFAULT_HEARTBEAT_FILENAME,\n DEFAULT_MEMORY_FILENAME,\n];\n\n/** Files that should be surfaced when missing. Other profile files are optional overlays. */\nexport const REQUIRED_AGENT_PROFILE_MARKDOWN_FILES: readonly AgentProfileMarkdownFilename[] = [\n DEFAULT_SOUL_FILENAME,\n DEFAULT_IDENTITY_FILENAME,\n];\n\nexport const REQUIRED_AGENT_PROFILE_MARKDOWN_FILE_SET: ReadonlySet<string> = new Set(\n REQUIRED_AGENT_PROFILE_MARKDOWN_FILES,\n);\n\nexport interface WorkspaceProfileMarkdownFile {\n name: AgentProfileMarkdownFilename;\n path: string;\n content?: string;\n missing: boolean;\n}\n\n/**\n * Strip YAML front matter from markdown content.\n */\nexport function stripFrontMatter(content: string): string {\n return parseFrontmatter(content).content;\n}\n\n// =============================================================================\n// Load & truncate profile Markdown for system prompt\n// =============================================================================\n\n/** Maximum characters to inject from workspace files into system prompt */\nexport const PROFILE_MARKDOWN_MAX_CHARS = 20_000;\n\n/** Profile Markdown truncation: fraction of `maxChars` kept from the start of the file */\nconst HEAD_TRUNCATION_RATIO = 0.7;\n/** Profile Markdown truncation: fraction of `maxChars` kept from the end of the file */\nconst TAIL_TRUNCATION_RATIO = 0.2;\n\nexport interface TruncateResult {\n content: string;\n truncated: boolean;\n originalLength: number;\n}\n\n/**\n * Truncate workspace file content to prevent token overflow.\n * Keeps head (HEAD_TRUNCATION_RATIO, 70%) and tail (TAIL_TRUNCATION_RATIO, 20%) with a\n * truncation marker in between; the remainder is reserved for the marker.\n */\nexport function truncateProfileMarkdownContent(content: string, maxChars: number): TruncateResult {\n const trimmed = content.trimEnd();\n if (trimmed.length <= maxChars) {\n return {\n content: trimmed,\n truncated: false,\n originalLength: trimmed.length,\n };\n }\n\n const headChars = Math.floor(maxChars * HEAD_TRUNCATION_RATIO);\n const tailChars = Math.floor(maxChars * TAIL_TRUNCATION_RATIO);\n const head = trimmed.slice(0, headChars);\n const tail = trimmed.slice(-tailChars);\n\n const marker = [\n '',\n '[...content truncated, read the full file for complete content...]',\n `...(truncated: kept ${headChars}+${tailChars} chars of ${trimmed.length})...`,\n '',\n ].join('\\n');\n\n return {\n content: head + marker + tail,\n truncated: true,\n originalLength: trimmed.length,\n };\n}\n\nexport interface ProfileMarkdownFile {\n name: AgentProfileMarkdownFilename;\n path?: string;\n content: string;\n missing?: boolean;\n}\n\n/**\n * Convert {@link ProfileMarkdownFile} to {@link WorkspaceProfileMarkdownFile} (adds required path field).\n * @param pathFallbackDir — used when `file.path` is absent (e.g. canonical `profile/` root).\n */\nexport function toWorkspaceProfileMarkdownFile(file: ProfileMarkdownFile, pathFallbackDir: string): {\n name: AgentProfileMarkdownFilename;\n path: string;\n content?: string;\n missing: boolean;\n} {\n return {\n name: file.name,\n path: file.path || join(pathFallbackDir, file.name),\n content: file.missing ? undefined : file.content,\n missing: file.missing ?? false,\n };\n}\n\n/**\n * Load profile Markdown from `profileDir` (`agents/<agentId>/profile/`).\n */\nexport function loadProfileMarkdownFiles(profileDir: string): ProfileMarkdownFile[] {\n const files: ProfileMarkdownFile[] = [];\n let loadedCount = 0;\n let missingCount = 0;\n\n for (const filename of AGENT_PROFILE_MARKDOWN_SYSTEM_FILES) {\n const filePath = join(profileDir, filename);\n\n if (existsSync(filePath)) {\n try {\n let content = readFileSync(filePath, 'utf-8');\n\n content = stripFrontMatter(content);\n\n const result = truncateProfileMarkdownContent(content, PROFILE_MARKDOWN_MAX_CHARS);\n\n if (result.content) {\n files.push({\n name: filename,\n content: result.content,\n path: resolve(filePath),\n });\n loadedCount++;\n\n if (result.truncated) {\n log.warn(\n {\n file: filename,\n originalLength: result.originalLength,\n keptLength: result.content.length,\n },\n 'Profile Markdown truncated in system prompt (too long)',\n );\n } else {\n log.debug({ file: filename, path: filePath }, 'Profile Markdown file loaded');\n }\n }\n } catch (err) {\n log.warn({ file: filename, err }, 'Failed to load profile Markdown file');\n }\n } else if (REQUIRED_AGENT_PROFILE_MARKDOWN_FILE_SET.has(filename)) {\n const hint = join(profileDir, filename);\n files.push({\n name: filename,\n content: `[MISSING] Create this file at: ${hint}`,\n missing: true,\n path: resolve(hint),\n });\n missingCount++;\n log.debug({ file: filename }, 'Profile Markdown file missing');\n }\n }\n\n log.debug({ loaded: loadedCount, missing: missingCount, profileDir }, 'Profile Markdown scan done');\n\n return files;\n}\n\n// =============================================================================\n// Message content helpers\n// =============================================================================\n\n/**\n * Extract text content from agent message content array\n */\nexport function extractTextContent(\n content: Array<{ type: string; text?: string }>\n): string {\n return content\n .filter((c) => c.type === 'text')\n .map((c) => c.text || '')\n .join('');\n}\n\nconst THINKING_BLOCK_TYPES = new Set(['thinking', 'thinking_delta', 'redacted_thinking']);\n\n/**\n * Concatenate thinking / reasoning content blocks from assistant message.content.\n * pi-ai may use `thinking` or `text` on `type: \"thinking\"` blocks.\n */\nexport function extractThinkingContent(\n content: Array<{ type: string; thinking?: string; text?: string }> | undefined\n): string {\n if (!Array.isArray(content)) return '';\n return content\n .filter((c) => THINKING_BLOCK_TYPES.has(c.type))\n .map((c) => (typeof c.thinking === 'string' ? c.thinking : c.text) || '')\n .join('');\n}\n\n/**\n * Extended thinking on the assistant message (e.g. Anthropic reasoning / pi-ai reasoning_details).\n */\nexport function extractThinkingFromAssistantMessage(\n message: { role?: string; reasoning_details?: { thinking?: string } } | undefined\n): string {\n if (!message || message.role !== 'assistant') return '';\n const t = message.reasoning_details?.thinking;\n return typeof t === 'string' ? t : '';\n}\n"],"mappings":"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"}
@@ -1,3 +1,4 @@
1
+ import { resolveEffectiveAgentManifestForSession } from "../../config/agent-profile.js";
1
2
  import { createLogger } from "../../utils/logger/index.js";
2
3
  import { init_logger } from "../../utils/logger.js";
3
4
  import { resolveAgentTurnTimeoutMs } from "../orchestration/run-agent-turn-with-timeout.js";
@@ -74,7 +75,9 @@ async function runEmbeddedTurnForSession(params) {
74
75
  }
75
76
  async function maybeAutoCompactBeforeTurn(opts) {
76
77
  const { sessionKey, sessionStore, agentManager, model, config, onEvent } = opts;
77
- if ((config?.agents?.defaults?.compaction)?.enabled === false) return;
78
+ if (config) try {
79
+ if (resolveEffectiveAgentManifestForSession(config, sessionKey).memory.retention?.compaction === false) return;
80
+ } catch {}
78
81
  const contextWindow = model.contextWindow ?? 128e3;
79
82
  const messages = await sessionStore.load(sessionKey);
80
83
  const prep = sessionStore.prepareCompaction(sessionKey, messages, contextWindow);