@roackb2/heddle 1.5.0 → 1.7.0

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 (462) hide show
  1. package/README.md +5 -0
  2. package/dist/examples/conversation-engine.js +10 -10
  3. package/dist/examples/conversation-engine.js.map +1 -1
  4. package/dist/examples/heartbeat-scheduler.js +2 -2
  5. package/dist/examples/heartbeat-scheduler.js.map +1 -1
  6. package/dist/examples/heartbeat.js +2 -2
  7. package/dist/examples/heartbeat.js.map +1 -1
  8. package/dist/examples/programmatic-loop.js +2 -2
  9. package/dist/examples/programmatic-loop.js.map +1 -1
  10. package/dist/examples/repo-investigator.js +4 -4
  11. package/dist/examples/repo-investigator.js.map +1 -1
  12. package/dist/src/cli/ask.d.ts.map +1 -1
  13. package/dist/src/cli/ask.js +5 -5
  14. package/dist/src/cli/ask.js.map +1 -1
  15. package/dist/src/cli/auth.d.ts +14 -7
  16. package/dist/src/cli/auth.d.ts.map +1 -1
  17. package/dist/src/cli/auth.js +75 -70
  18. package/dist/src/cli/auth.js.map +1 -1
  19. package/dist/src/cli/chat/adapters/conversation-activity-adapter.d.ts +1 -1
  20. package/dist/src/cli/chat/adapters/conversation-activity-adapter.d.ts.map +1 -1
  21. package/dist/src/cli/chat/adapters/conversation-activity-adapter.js +29 -19
  22. package/dist/src/cli/chat/adapters/conversation-activity-adapter.js.map +1 -1
  23. package/dist/src/cli/chat/adapters/slash-command-context.js +4 -4
  24. package/dist/src/cli/chat/adapters/slash-command-context.js.map +1 -1
  25. package/dist/src/cli/chat/commands/debug-snapshot-command.js +2 -2
  26. package/dist/src/cli/chat/commands/debug-snapshot-command.js.map +1 -1
  27. package/dist/src/cli/chat/components/ModelPickerPanel.d.ts +1 -1
  28. package/dist/src/cli/chat/components/ModelPickerPanel.js +1 -1
  29. package/dist/src/cli/chat/debug/tui-debug-snapshot.d.ts +1 -1
  30. package/dist/src/cli/chat/debug/tui-debug-snapshot.js +1 -1
  31. package/dist/src/cli/chat/hooks/controllers/run/tui-direct-shell-result.js +3 -3
  32. package/dist/src/cli/chat/hooks/controllers/run/tui-direct-shell-result.js.map +1 -1
  33. package/dist/src/cli/chat/hooks/controllers/run/tui-direct-shell.js +2 -2
  34. package/dist/src/cli/chat/hooks/controllers/run/tui-direct-shell.js.map +1 -1
  35. package/dist/src/cli/chat/hooks/controllers/run/tui-run-loop-events.d.ts.map +1 -1
  36. package/dist/src/cli/chat/hooks/controllers/run/tui-run-loop-events.js +3 -3
  37. package/dist/src/cli/chat/hooks/controllers/run/tui-run-loop-events.js.map +1 -1
  38. package/dist/src/cli/chat/hooks/controllers/useAgentRunController.d.ts.map +1 -1
  39. package/dist/src/cli/chat/hooks/controllers/useAgentRunController.js +16 -6
  40. package/dist/src/cli/chat/hooks/controllers/useAgentRunController.js.map +1 -1
  41. package/dist/src/cli/chat/hooks/controllers/useChatAppController.d.ts.map +1 -1
  42. package/dist/src/cli/chat/hooks/controllers/useChatAppController.js +9 -10
  43. package/dist/src/cli/chat/hooks/controllers/useChatAppController.js.map +1 -1
  44. package/dist/src/cli/chat/hooks/controllers/usePromptSubmissionController.d.ts +1 -1
  45. package/dist/src/cli/chat/hooks/useChatPickers.d.ts +1 -1
  46. package/dist/src/cli/chat/hooks/useChatPickers.d.ts.map +1 -1
  47. package/dist/src/cli/chat/hooks/useChatPickers.js +7 -8
  48. package/dist/src/cli/chat/hooks/useChatPickers.js.map +1 -1
  49. package/dist/src/cli/chat/hooks/useChatStatusSummary.d.ts.map +1 -1
  50. package/dist/src/cli/chat/hooks/useChatStatusSummary.js +3 -4
  51. package/dist/src/cli/chat/hooks/useChatStatusSummary.js.map +1 -1
  52. package/dist/src/cli/chat/state/local-commands.d.ts +1 -1
  53. package/dist/src/cli/chat/state/local-commands.d.ts.map +1 -1
  54. package/dist/src/cli/chat/state/local-commands.js +6 -6
  55. package/dist/src/cli/chat/state/local-commands.js.map +1 -1
  56. package/dist/src/cli/chat/utils/format.d.ts +0 -1
  57. package/dist/src/cli/chat/utils/format.d.ts.map +1 -1
  58. package/dist/src/cli/chat/utils/format.js +0 -1
  59. package/dist/src/cli/chat/utils/format.js.map +1 -1
  60. package/dist/src/cli/chat/utils/runtime.d.ts.map +1 -1
  61. package/dist/src/cli/chat/utils/runtime.js +6 -6
  62. package/dist/src/cli/chat/utils/runtime.js.map +1 -1
  63. package/dist/src/cli/main.js +32 -27
  64. package/dist/src/cli/main.js.map +1 -1
  65. package/dist/src/cli/remote/control-plane-client.d.ts +3 -3
  66. package/dist/src/core/agent/budget/index.d.ts +2 -0
  67. package/dist/src/core/agent/budget/index.d.ts.map +1 -0
  68. package/dist/src/core/agent/budget/index.js +2 -0
  69. package/dist/src/core/agent/budget/index.js.map +1 -0
  70. package/dist/src/core/agent/budget/step-budget.d.ts +12 -0
  71. package/dist/src/core/agent/budget/step-budget.d.ts.map +1 -0
  72. package/dist/src/core/agent/budget/step-budget.js +21 -0
  73. package/dist/src/core/agent/budget/step-budget.js.map +1 -0
  74. package/dist/src/core/agent/context/run-context-builder.js +6 -6
  75. package/dist/src/core/agent/context/run-context-builder.js.map +1 -1
  76. package/dist/src/core/agent/tools/tool-dispatcher.d.ts +3 -4
  77. package/dist/src/core/agent/tools/tool-dispatcher.d.ts.map +1 -1
  78. package/dist/src/core/agent/tools/tool-dispatcher.js +2 -2
  79. package/dist/src/core/agent/tools/tool-dispatcher.js.map +1 -1
  80. package/dist/src/core/agent/types.d.ts +5 -5
  81. package/dist/src/core/agent/types.d.ts.map +1 -1
  82. package/dist/src/core/approvals/remembered-rules/schemas.d.ts +3 -3
  83. package/dist/src/core/auth/index.d.ts +4 -0
  84. package/dist/src/core/auth/index.d.ts.map +1 -0
  85. package/dist/src/core/auth/index.js +3 -0
  86. package/dist/src/core/auth/index.js.map +1 -0
  87. package/dist/src/core/auth/openai-oauth.d.ts +41 -61
  88. package/dist/src/core/auth/openai-oauth.d.ts.map +1 -1
  89. package/dist/src/core/auth/openai-oauth.js +264 -258
  90. package/dist/src/core/auth/openai-oauth.js.map +1 -1
  91. package/dist/src/core/auth/provider-credentials.d.ts +23 -51
  92. package/dist/src/core/auth/provider-credentials.d.ts.map +1 -1
  93. package/dist/src/core/auth/provider-credentials.js +69 -134
  94. package/dist/src/core/auth/provider-credentials.js.map +1 -1
  95. package/dist/src/core/auth/schemas.d.ts +54 -0
  96. package/dist/src/core/auth/schemas.d.ts.map +1 -0
  97. package/dist/src/core/auth/schemas.js +63 -0
  98. package/dist/src/core/auth/schemas.js.map +1 -0
  99. package/dist/src/core/auth/types.d.ts +80 -0
  100. package/dist/src/core/auth/types.d.ts.map +1 -0
  101. package/dist/src/core/auth/types.js +2 -0
  102. package/dist/src/core/auth/types.js.map +1 -0
  103. package/dist/src/core/chat/engine/compaction/service.js +2 -2
  104. package/dist/src/core/chat/engine/compaction/service.js.map +1 -1
  105. package/dist/src/core/chat/engine/compaction/summarizer/service.d.ts.map +1 -1
  106. package/dist/src/core/chat/engine/compaction/summarizer/service.js +9 -6
  107. package/dist/src/core/chat/engine/compaction/summarizer/service.js.map +1 -1
  108. package/dist/src/core/chat/engine/compaction/transcript-renderer.js +2 -2
  109. package/dist/src/core/chat/engine/compaction/transcript-renderer.js.map +1 -1
  110. package/dist/src/core/chat/engine/config.d.ts +2 -2
  111. package/dist/src/core/chat/engine/config.d.ts.map +1 -1
  112. package/dist/src/core/chat/engine/sessions/preferences/service.js +3 -3
  113. package/dist/src/core/chat/engine/sessions/preferences/service.js.map +1 -1
  114. package/dist/src/core/chat/engine/sessions/records/records.js +3 -3
  115. package/dist/src/core/chat/engine/sessions/records/records.js.map +1 -1
  116. package/dist/src/core/chat/engine/sessions/records/types.d.ts +2 -2
  117. package/dist/src/core/chat/engine/sessions/records/types.d.ts.map +1 -1
  118. package/dist/src/core/chat/engine/turns/host/host-normalizer.d.ts.map +1 -1
  119. package/dist/src/core/chat/engine/turns/host/host-normalizer.js +4 -4
  120. package/dist/src/core/chat/engine/turns/host/host-normalizer.js.map +1 -1
  121. package/dist/src/core/chat/engine/turns/memory/turn-memory-maintenance.d.ts.map +1 -1
  122. package/dist/src/core/chat/engine/turns/memory/turn-memory-maintenance.js +11 -7
  123. package/dist/src/core/chat/engine/turns/memory/turn-memory-maintenance.js.map +1 -1
  124. package/dist/src/core/chat/engine/turns/persistence/types.d.ts +3 -3
  125. package/dist/src/core/chat/engine/turns/persistence/types.d.ts.map +1 -1
  126. package/dist/src/core/chat/engine/turns/runtime/runtime-resolver.d.ts.map +1 -1
  127. package/dist/src/core/chat/engine/turns/runtime/runtime-resolver.js +12 -10
  128. package/dist/src/core/chat/engine/turns/runtime/runtime-resolver.js.map +1 -1
  129. package/dist/src/core/chat/engine/turns/types.d.ts +2 -3
  130. package/dist/src/core/chat/engine/turns/types.d.ts.map +1 -1
  131. package/dist/src/core/chat/engine/types.d.ts +4 -5
  132. package/dist/src/core/chat/engine/types.d.ts.map +1 -1
  133. package/dist/src/core/commands/slash/autocomplete.d.ts +9 -4
  134. package/dist/src/core/commands/slash/autocomplete.d.ts.map +1 -1
  135. package/dist/src/core/commands/slash/autocomplete.js +53 -48
  136. package/dist/src/core/commands/slash/autocomplete.js.map +1 -1
  137. package/dist/src/core/commands/slash/modules/auth/auth-commands.js +4 -4
  138. package/dist/src/core/commands/slash/modules/auth/auth-commands.js.map +1 -1
  139. package/dist/src/core/commands/slash/modules/compaction/compaction-commands.js +2 -2
  140. package/dist/src/core/commands/slash/modules/compaction/compaction-commands.js.map +1 -1
  141. package/dist/src/core/commands/slash/modules/drift/drift-commands.js +4 -4
  142. package/dist/src/core/commands/slash/modules/drift/drift-commands.js.map +1 -1
  143. package/dist/src/core/commands/slash/modules/heartbeat/heartbeat-commands.js +3 -3
  144. package/dist/src/core/commands/slash/modules/heartbeat/heartbeat-commands.js.map +1 -1
  145. package/dist/src/core/commands/slash/modules/model/model-commands.d.ts.map +1 -1
  146. package/dist/src/core/commands/slash/modules/model/model-commands.js +14 -15
  147. package/dist/src/core/commands/slash/modules/model/model-commands.js.map +1 -1
  148. package/dist/src/core/commands/slash/modules/session/session-commands.js +6 -6
  149. package/dist/src/core/commands/slash/modules/session/session-commands.js.map +1 -1
  150. package/dist/src/core/commands/slash/parser.d.ts +10 -5
  151. package/dist/src/core/commands/slash/parser.d.ts.map +1 -1
  152. package/dist/src/core/commands/slash/parser.js +42 -37
  153. package/dist/src/core/commands/slash/parser.js.map +1 -1
  154. package/dist/src/core/commands/slash/registry.d.ts +12 -3
  155. package/dist/src/core/commands/slash/registry.d.ts.map +1 -1
  156. package/dist/src/core/commands/slash/registry.js +50 -45
  157. package/dist/src/core/commands/slash/registry.js.map +1 -1
  158. package/dist/src/core/heartbeat/wake/service.d.ts.map +1 -1
  159. package/dist/src/core/heartbeat/wake/service.js +2 -3
  160. package/dist/src/core/heartbeat/wake/service.js.map +1 -1
  161. package/dist/src/core/llm/adapters/anthropic/anthropic-adapter.d.ts +21 -0
  162. package/dist/src/core/llm/adapters/anthropic/anthropic-adapter.d.ts.map +1 -0
  163. package/dist/src/core/llm/adapters/anthropic/anthropic-adapter.js +66 -0
  164. package/dist/src/core/llm/adapters/anthropic/anthropic-adapter.js.map +1 -0
  165. package/dist/src/core/llm/adapters/anthropic/anthropic-codec.d.ts +16 -0
  166. package/dist/src/core/llm/adapters/anthropic/anthropic-codec.d.ts.map +1 -0
  167. package/dist/src/core/llm/adapters/anthropic/anthropic-codec.js +64 -0
  168. package/dist/src/core/llm/adapters/anthropic/anthropic-codec.js.map +1 -0
  169. package/dist/src/core/llm/adapters/anthropic/anthropic-provider-adapter.d.ts +17 -0
  170. package/dist/src/core/llm/adapters/anthropic/anthropic-provider-adapter.d.ts.map +1 -0
  171. package/dist/src/core/llm/adapters/anthropic/anthropic-provider-adapter.js +20 -0
  172. package/dist/src/core/llm/adapters/anthropic/anthropic-provider-adapter.js.map +1 -0
  173. package/dist/src/core/llm/adapters/anthropic/index.d.ts +4 -0
  174. package/dist/src/core/llm/adapters/anthropic/index.d.ts.map +1 -0
  175. package/dist/src/core/llm/adapters/anthropic/index.js +3 -0
  176. package/dist/src/core/llm/adapters/anthropic/index.js.map +1 -0
  177. package/dist/src/core/llm/adapters/openai/index.d.ts +4 -0
  178. package/dist/src/core/llm/adapters/openai/index.d.ts.map +1 -0
  179. package/dist/src/core/llm/adapters/openai/index.js +3 -0
  180. package/dist/src/core/llm/adapters/openai/index.js.map +1 -0
  181. package/dist/src/core/llm/adapters/openai/openai-adapter.d.ts +53 -0
  182. package/dist/src/core/llm/adapters/openai/openai-adapter.d.ts.map +1 -0
  183. package/dist/src/core/llm/adapters/openai/openai-adapter.js +266 -0
  184. package/dist/src/core/llm/adapters/openai/openai-adapter.js.map +1 -0
  185. package/dist/src/core/llm/adapters/openai/openai-codec.d.ts +41 -0
  186. package/dist/src/core/llm/adapters/openai/openai-codec.d.ts.map +1 -0
  187. package/dist/src/core/llm/adapters/openai/openai-codec.js +169 -0
  188. package/dist/src/core/llm/adapters/openai/openai-codec.js.map +1 -0
  189. package/dist/src/core/llm/adapters/openai/openai-provider-adapter.d.ts +17 -0
  190. package/dist/src/core/llm/adapters/openai/openai-provider-adapter.d.ts.map +1 -0
  191. package/dist/src/core/llm/adapters/openai/openai-provider-adapter.js +20 -0
  192. package/dist/src/core/llm/adapters/openai/openai-provider-adapter.js.map +1 -0
  193. package/dist/src/core/llm/index.d.ts +9 -0
  194. package/dist/src/core/llm/index.d.ts.map +1 -0
  195. package/dist/src/core/llm/index.js +5 -0
  196. package/dist/src/core/llm/index.js.map +1 -0
  197. package/dist/src/core/llm/models/index.d.ts +5 -0
  198. package/dist/src/core/llm/models/index.d.ts.map +1 -0
  199. package/dist/src/core/llm/models/index.js +3 -0
  200. package/dist/src/core/llm/models/index.js.map +1 -0
  201. package/dist/src/core/llm/models/model-catalog.d.ts +23 -0
  202. package/dist/src/core/llm/models/model-catalog.d.ts.map +1 -0
  203. package/dist/src/core/llm/models/model-catalog.js +132 -0
  204. package/dist/src/core/llm/models/model-catalog.js.map +1 -0
  205. package/dist/src/core/llm/models/model-policy-service.d.ts +70 -0
  206. package/dist/src/core/llm/models/model-policy-service.d.ts.map +1 -0
  207. package/dist/src/core/llm/models/model-policy-service.js +137 -0
  208. package/dist/src/core/llm/models/model-policy-service.js.map +1 -0
  209. package/dist/src/core/llm/registry/builtin-llm-providers.d.ts +5 -0
  210. package/dist/src/core/llm/registry/builtin-llm-providers.d.ts.map +1 -0
  211. package/dist/src/core/llm/registry/builtin-llm-providers.js +16 -0
  212. package/dist/src/core/llm/registry/builtin-llm-providers.js.map +1 -0
  213. package/dist/src/core/llm/registry/index.d.ts +5 -0
  214. package/dist/src/core/llm/registry/index.d.ts.map +1 -0
  215. package/dist/src/core/llm/registry/index.js +4 -0
  216. package/dist/src/core/llm/registry/index.js.map +1 -0
  217. package/dist/src/core/llm/registry/llm-provider-registry.d.ts +17 -0
  218. package/dist/src/core/llm/registry/llm-provider-registry.d.ts.map +1 -0
  219. package/dist/src/core/llm/registry/llm-provider-registry.js +51 -0
  220. package/dist/src/core/llm/registry/llm-provider-registry.js.map +1 -0
  221. package/dist/src/core/llm/registry/provider-inference.d.ts +18 -0
  222. package/dist/src/core/llm/registry/provider-inference.d.ts.map +1 -0
  223. package/dist/src/core/llm/registry/provider-inference.js +41 -0
  224. package/dist/src/core/llm/registry/provider-inference.js.map +1 -0
  225. package/dist/src/core/llm/registry/types.d.ts +16 -0
  226. package/dist/src/core/llm/registry/types.d.ts.map +1 -0
  227. package/dist/src/core/llm/registry/types.js +2 -0
  228. package/dist/src/core/llm/registry/types.js.map +1 -0
  229. package/dist/src/core/llm/service.d.ts +15 -0
  230. package/dist/src/core/llm/service.d.ts.map +1 -0
  231. package/dist/src/core/llm/service.js +44 -0
  232. package/dist/src/core/llm/service.js.map +1 -0
  233. package/dist/src/core/llm/types.d.ts +18 -1
  234. package/dist/src/core/llm/types.d.ts.map +1 -1
  235. package/dist/src/core/memory/catalog.d.ts +22 -40
  236. package/dist/src/core/memory/catalog.d.ts.map +1 -1
  237. package/dist/src/core/memory/catalog.js +166 -155
  238. package/dist/src/core/memory/catalog.js.map +1 -1
  239. package/dist/src/core/memory/index.d.ts +14 -0
  240. package/dist/src/core/memory/index.d.ts.map +1 -0
  241. package/dist/src/core/memory/index.js +13 -0
  242. package/dist/src/core/memory/index.js.map +1 -0
  243. package/dist/src/core/memory/maintainer-prompt.d.ts +14 -0
  244. package/dist/src/core/memory/maintainer-prompt.d.ts.map +1 -0
  245. package/dist/src/core/memory/maintainer-prompt.js +58 -0
  246. package/dist/src/core/memory/maintainer-prompt.js.map +1 -0
  247. package/dist/src/core/memory/maintainer.d.ts +20 -44
  248. package/dist/src/core/memory/maintainer.d.ts.map +1 -1
  249. package/dist/src/core/memory/maintainer.js +124 -184
  250. package/dist/src/core/memory/maintainer.js.map +1 -1
  251. package/dist/src/core/memory/maintenance-integration.d.ts +22 -19
  252. package/dist/src/core/memory/maintenance-integration.d.ts.map +1 -1
  253. package/dist/src/core/memory/maintenance-integration.js +158 -163
  254. package/dist/src/core/memory/maintenance-integration.js.map +1 -1
  255. package/dist/src/core/memory/maintenance-repository.d.ts +27 -0
  256. package/dist/src/core/memory/maintenance-repository.d.ts.map +1 -0
  257. package/dist/src/core/memory/maintenance-repository.js +134 -0
  258. package/dist/src/core/memory/maintenance-repository.js.map +1 -0
  259. package/dist/src/core/memory/note-service.d.ts +23 -0
  260. package/dist/src/core/memory/note-service.d.ts.map +1 -0
  261. package/dist/src/core/memory/note-service.js +165 -0
  262. package/dist/src/core/memory/note-service.js.map +1 -0
  263. package/dist/src/core/memory/path-utils.d.ts +15 -0
  264. package/dist/src/core/memory/path-utils.d.ts.map +1 -0
  265. package/dist/src/core/memory/path-utils.js +31 -0
  266. package/dist/src/core/memory/path-utils.js.map +1 -0
  267. package/dist/src/core/memory/schemas.d.ts +116 -0
  268. package/dist/src/core/memory/schemas.d.ts.map +1 -0
  269. package/dist/src/core/memory/schemas.js +53 -0
  270. package/dist/src/core/memory/schemas.js.map +1 -0
  271. package/dist/src/core/memory/types.d.ts +149 -0
  272. package/dist/src/core/memory/types.d.ts.map +1 -0
  273. package/dist/src/core/memory/types.js +2 -0
  274. package/dist/src/core/memory/types.js.map +1 -0
  275. package/dist/src/core/memory/validation.d.ts +20 -38
  276. package/dist/src/core/memory/validation.d.ts.map +1 -1
  277. package/dist/src/core/memory/validation.js +98 -83
  278. package/dist/src/core/memory/validation.js.map +1 -1
  279. package/dist/src/core/memory/visibility.d.ts +19 -41
  280. package/dist/src/core/memory/visibility.d.ts.map +1 -1
  281. package/dist/src/core/memory/visibility.js +53 -153
  282. package/dist/src/core/memory/visibility.js.map +1 -1
  283. package/dist/src/core/observability/activity/conversation-activity-projector.d.ts +24 -0
  284. package/dist/src/core/observability/activity/conversation-activity-projector.d.ts.map +1 -0
  285. package/dist/src/core/observability/activity/conversation-activity-projector.js +146 -0
  286. package/dist/src/core/observability/activity/conversation-activity-projector.js.map +1 -0
  287. package/dist/src/core/observability/activity/index.d.ts +4 -0
  288. package/dist/src/core/observability/activity/index.d.ts.map +1 -0
  289. package/dist/src/core/observability/activity/index.js +3 -0
  290. package/dist/src/core/observability/activity/index.js.map +1 -0
  291. package/dist/src/core/observability/activity/tool-activity-summarizer.d.ts +15 -0
  292. package/dist/src/core/observability/activity/tool-activity-summarizer.d.ts.map +1 -0
  293. package/dist/src/core/observability/activity/tool-activity-summarizer.js +92 -0
  294. package/dist/src/core/observability/activity/tool-activity-summarizer.js.map +1 -0
  295. package/dist/src/core/observability/activity/types.d.ts +87 -0
  296. package/dist/src/core/observability/activity/types.d.ts.map +1 -0
  297. package/dist/src/core/observability/activity/types.js +2 -0
  298. package/dist/src/core/observability/activity/types.js.map +1 -0
  299. package/dist/src/core/observability/index.d.ts +6 -0
  300. package/dist/src/core/observability/index.d.ts.map +1 -0
  301. package/dist/src/core/observability/index.js +4 -0
  302. package/dist/src/core/observability/index.js.map +1 -0
  303. package/dist/src/core/observability/semantics/index.d.ts +2 -0
  304. package/dist/src/core/observability/semantics/index.d.ts.map +1 -0
  305. package/dist/src/core/observability/semantics/index.js +2 -0
  306. package/dist/src/core/observability/semantics/index.js.map +1 -0
  307. package/dist/src/core/observability/{semantic-conventions.d.ts → semantics/trace-semantics.d.ts} +1 -1
  308. package/dist/src/core/observability/semantics/trace-semantics.d.ts.map +1 -0
  309. package/dist/src/core/observability/{semantic-conventions.js → semantics/trace-semantics.js} +1 -1
  310. package/dist/src/core/observability/semantics/trace-semantics.js.map +1 -0
  311. package/dist/src/core/observability/summaries/default-trace-summarizers.d.ts +3 -0
  312. package/dist/src/core/observability/summaries/default-trace-summarizers.d.ts.map +1 -0
  313. package/dist/src/core/observability/summaries/default-trace-summarizers.js +29 -0
  314. package/dist/src/core/observability/summaries/default-trace-summarizers.js.map +1 -0
  315. package/dist/src/core/observability/summaries/index.d.ts +4 -0
  316. package/dist/src/core/observability/summaries/index.d.ts.map +1 -0
  317. package/dist/src/core/observability/summaries/index.js +3 -0
  318. package/dist/src/core/observability/summaries/index.js.map +1 -0
  319. package/dist/src/core/observability/summaries/trace-summary-service.d.ts +17 -0
  320. package/dist/src/core/observability/summaries/trace-summary-service.d.ts.map +1 -0
  321. package/dist/src/core/observability/summaries/trace-summary-service.js +32 -0
  322. package/dist/src/core/observability/summaries/trace-summary-service.js.map +1 -0
  323. package/dist/src/core/observability/summaries/types.d.ts +15 -0
  324. package/dist/src/core/observability/summaries/types.d.ts.map +1 -0
  325. package/dist/src/core/observability/summaries/types.js +2 -0
  326. package/dist/src/core/observability/summaries/types.js.map +1 -0
  327. package/dist/src/core/review/index.d.ts +3 -0
  328. package/dist/src/core/review/index.d.ts.map +1 -0
  329. package/dist/src/core/review/index.js +2 -0
  330. package/dist/src/core/review/index.js.map +1 -0
  331. package/dist/src/core/review/service.d.ts +22 -0
  332. package/dist/src/core/review/service.d.ts.map +1 -0
  333. package/dist/src/core/review/service.js +143 -0
  334. package/dist/src/core/review/service.js.map +1 -0
  335. package/dist/src/core/review/{diff-domain.d.ts → types.d.ts} +1 -3
  336. package/dist/src/core/review/types.d.ts.map +1 -0
  337. package/dist/src/core/review/types.js +2 -0
  338. package/dist/src/core/review/types.js.map +1 -0
  339. package/dist/src/core/runtime/credentials/service.d.ts +1 -1
  340. package/dist/src/core/runtime/credentials/service.d.ts.map +1 -1
  341. package/dist/src/core/runtime/credentials/service.js +8 -6
  342. package/dist/src/core/runtime/credentials/service.js.map +1 -1
  343. package/dist/src/core/runtime/loop/service.d.ts.map +1 -1
  344. package/dist/src/core/runtime/loop/service.js +14 -6
  345. package/dist/src/core/runtime/loop/service.js.map +1 -1
  346. package/dist/src/core/runtime/tools/service.js +2 -2
  347. package/dist/src/core/runtime/tools/service.js.map +1 -1
  348. package/dist/src/core/tools/execute-tool.d.ts +5 -4
  349. package/dist/src/core/tools/execute-tool.d.ts.map +1 -1
  350. package/dist/src/core/tools/execute-tool.js +23 -25
  351. package/dist/src/core/tools/execute-tool.js.map +1 -1
  352. package/dist/src/core/tools/index.d.ts +5 -0
  353. package/dist/src/core/tools/index.d.ts.map +1 -0
  354. package/dist/src/core/tools/index.js +4 -0
  355. package/dist/src/core/tools/index.js.map +1 -0
  356. package/dist/src/core/tools/registry.d.ts +8 -7
  357. package/dist/src/core/tools/registry.d.ts.map +1 -1
  358. package/dist/src/core/tools/registry.js +18 -21
  359. package/dist/src/core/tools/registry.js.map +1 -1
  360. package/dist/src/core/tools/toolkit.d.ts +9 -4
  361. package/dist/src/core/tools/toolkit.d.ts.map +1 -1
  362. package/dist/src/core/tools/toolkit.js +21 -16
  363. package/dist/src/core/tools/toolkit.js.map +1 -1
  364. package/dist/src/core/tools/toolkits/external-context/view-image.d.ts.map +1 -1
  365. package/dist/src/core/tools/toolkits/external-context/view-image.js +15 -9
  366. package/dist/src/core/tools/toolkits/external-context/view-image.js.map +1 -1
  367. package/dist/src/core/tools/toolkits/external-context/web-search.d.ts.map +1 -1
  368. package/dist/src/core/tools/toolkits/external-context/web-search.js +15 -9
  369. package/dist/src/core/tools/toolkits/external-context/web-search.js.map +1 -1
  370. package/dist/src/core/tools/toolkits/knowledge/memory-notes.d.ts +1 -1
  371. package/dist/src/core/tools/toolkits/knowledge/memory-notes.d.ts.map +1 -1
  372. package/dist/src/core/tools/toolkits/knowledge/memory-notes.js +48 -238
  373. package/dist/src/core/tools/toolkits/knowledge/memory-notes.js.map +1 -1
  374. package/dist/src/core/tools/toolkits/knowledge/record-knowledge.d.ts.map +1 -1
  375. package/dist/src/core/tools/toolkits/knowledge/record-knowledge.js +75 -105
  376. package/dist/src/core/tools/toolkits/knowledge/record-knowledge.js.map +1 -1
  377. package/dist/src/core/trace/format.d.ts +9 -3
  378. package/dist/src/core/trace/format.d.ts.map +1 -1
  379. package/dist/src/core/trace/format.js +106 -107
  380. package/dist/src/core/trace/format.js.map +1 -1
  381. package/dist/src/core/trace/index.d.ts +4 -0
  382. package/dist/src/core/trace/index.d.ts.map +1 -0
  383. package/dist/src/core/trace/index.js +3 -0
  384. package/dist/src/core/trace/index.js.map +1 -0
  385. package/dist/src/core/trace/recorder.d.ts +10 -7
  386. package/dist/src/core/trace/recorder.d.ts.map +1 -1
  387. package/dist/src/core/trace/recorder.js +15 -17
  388. package/dist/src/core/trace/recorder.js.map +1 -1
  389. package/dist/src/core/trace/types.d.ts +7 -0
  390. package/dist/src/core/trace/types.d.ts.map +1 -0
  391. package/dist/src/core/trace/types.js +2 -0
  392. package/dist/src/core/trace/types.js.map +1 -0
  393. package/dist/src/index.d.ts +23 -28
  394. package/dist/src/index.d.ts.map +1 -1
  395. package/dist/src/index.js +15 -15
  396. package/dist/src/index.js.map +1 -1
  397. package/dist/src/server/features/control-plane/controllers/ask.d.ts.map +1 -1
  398. package/dist/src/server/features/control-plane/controllers/ask.js +10 -8
  399. package/dist/src/server/features/control-plane/controllers/ask.js.map +1 -1
  400. package/dist/src/server/features/control-plane/controllers/chat-sessions-controller.js +5 -5
  401. package/dist/src/server/features/control-plane/controllers/chat-sessions-controller.js.map +1 -1
  402. package/dist/src/server/features/control-plane/controllers/chat-turn-review-presenter.js +3 -3
  403. package/dist/src/server/features/control-plane/controllers/chat-turn-review-presenter.js.map +1 -1
  404. package/dist/src/server/features/control-plane/controllers/memory.d.ts +2 -1
  405. package/dist/src/server/features/control-plane/controllers/memory.d.ts.map +1 -1
  406. package/dist/src/server/features/control-plane/controllers/memory.js +8 -7
  407. package/dist/src/server/features/control-plane/controllers/memory.js.map +1 -1
  408. package/dist/src/server/features/control-plane/controllers/workspace-diff.js +2 -2
  409. package/dist/src/server/features/control-plane/controllers/workspace-diff.js.map +1 -1
  410. package/dist/src/server/features/control-plane/router.d.ts +3 -3
  411. package/dist/src/server/features/control-plane/router.d.ts.map +1 -1
  412. package/dist/src/server/features/control-plane/router.js +5 -6
  413. package/dist/src/server/features/control-plane/router.js.map +1 -1
  414. package/dist/src/server/features/control-plane/types.d.ts +2 -2
  415. package/dist/src/server/features/control-plane/types.d.ts.map +1 -1
  416. package/dist/src/server/router.d.ts +3 -3
  417. package/dist/src/web/assets/{MonacoDiffViewer-F3AOHIps.js → MonacoDiffViewer-D_Fh9ndN.js} +1 -1
  418. package/dist/src/web/assets/index-B1wQ0pS4.js +87 -0
  419. package/dist/src/web/index.html +1 -1
  420. package/package.json +1 -1
  421. package/dist/src/core/llm/anthropic.d.ts +0 -7
  422. package/dist/src/core/llm/anthropic.d.ts.map +0 -1
  423. package/dist/src/core/llm/anthropic.js +0 -115
  424. package/dist/src/core/llm/anthropic.js.map +0 -1
  425. package/dist/src/core/llm/factory.d.ts +0 -14
  426. package/dist/src/core/llm/factory.d.ts.map +0 -1
  427. package/dist/src/core/llm/factory.js +0 -46
  428. package/dist/src/core/llm/factory.js.map +0 -1
  429. package/dist/src/core/llm/model-policy.d.ts +0 -63
  430. package/dist/src/core/llm/model-policy.d.ts.map +0 -1
  431. package/dist/src/core/llm/model-policy.js +0 -131
  432. package/dist/src/core/llm/model-policy.js.map +0 -1
  433. package/dist/src/core/llm/openai-models.d.ts +0 -17
  434. package/dist/src/core/llm/openai-models.d.ts.map +0 -1
  435. package/dist/src/core/llm/openai-models.js +0 -127
  436. package/dist/src/core/llm/openai-models.js.map +0 -1
  437. package/dist/src/core/llm/openai.d.ts +0 -31
  438. package/dist/src/core/llm/openai.d.ts.map +0 -1
  439. package/dist/src/core/llm/openai.js +0 -405
  440. package/dist/src/core/llm/openai.js.map +0 -1
  441. package/dist/src/core/llm/providers.d.ts +0 -3
  442. package/dist/src/core/llm/providers.d.ts.map +0 -1
  443. package/dist/src/core/llm/providers.js +0 -21
  444. package/dist/src/core/llm/providers.js.map +0 -1
  445. package/dist/src/core/observability/conversation-activity.d.ts +0 -116
  446. package/dist/src/core/observability/conversation-activity.d.ts.map +0 -1
  447. package/dist/src/core/observability/conversation-activity.js +0 -255
  448. package/dist/src/core/observability/conversation-activity.js.map +0 -1
  449. package/dist/src/core/observability/semantic-conventions.d.ts.map +0 -1
  450. package/dist/src/core/observability/semantic-conventions.js.map +0 -1
  451. package/dist/src/core/observability/trace-summarizers.d.ts +0 -23
  452. package/dist/src/core/observability/trace-summarizers.d.ts.map +0 -1
  453. package/dist/src/core/observability/trace-summarizers.js +0 -60
  454. package/dist/src/core/observability/trace-summarizers.js.map +0 -1
  455. package/dist/src/core/review/diff-domain.d.ts.map +0 -1
  456. package/dist/src/core/review/diff-domain.js +0 -134
  457. package/dist/src/core/review/diff-domain.js.map +0 -1
  458. package/dist/src/core/utils/budget.d.ts +0 -13
  459. package/dist/src/core/utils/budget.d.ts.map +0 -1
  460. package/dist/src/core/utils/budget.js +0 -22
  461. package/dist/src/core/utils/budget.js.map +0 -1
  462. package/dist/src/web/assets/index-D6aK1OFb.js +0 -81
@@ -0,0 +1,44 @@
1
+ import { ProviderCredentialRepository, } from '../../core/auth/index.js';
2
+ import { BuiltinLlmProviderRegistry } from './registry/index.js';
3
+ /**
4
+ * Main LLM application service. It is the public entry point for creating
5
+ * provider adapters and resolving provider/model ownership.
6
+ */
7
+ export class LlmAdapterService {
8
+ static registry = BuiltinLlmProviderRegistry.create();
9
+ static create(input = {}) {
10
+ const provider = LlmAdapterService.resolveProvider(input);
11
+ return LlmAdapterService.registry.createAdapter(LlmAdapterService.withStoredOAuthCredential(input, provider));
12
+ }
13
+ static resolveProvider(input = {}) {
14
+ return LlmAdapterService.registry.resolveProvider(input).provider;
15
+ }
16
+ static inferProvider(model) {
17
+ return LlmAdapterService.registry.inferProvider(model);
18
+ }
19
+ static withStoredOAuthCredential(input, provider) {
20
+ const credentials = input.credentials;
21
+ if (credentials?.credential || LlmAdapterService.hasApiKey(credentials?.apiKey)) {
22
+ return input;
23
+ }
24
+ const credential = LlmAdapterService.resolveStoredOAuthCredential(provider, credentials?.credentialStorePath);
25
+ if (!credential) {
26
+ return input;
27
+ }
28
+ return {
29
+ ...input,
30
+ credentials: {
31
+ ...(credentials ?? {}),
32
+ credential,
33
+ },
34
+ };
35
+ }
36
+ static resolveStoredOAuthCredential(provider, storePath) {
37
+ const credential = new ProviderCredentialRepository({ storePath }).get(provider);
38
+ return credential?.type === 'oauth' ? credential : undefined;
39
+ }
40
+ static hasApiKey(value) {
41
+ return typeof value === 'string' && value.trim().length > 0;
42
+ }
43
+ }
44
+ //# sourceMappingURL=service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.js","sourceRoot":"","sources":["../../../../src/core/llm/service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,GAE7B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AAGjE;;;GAGG;AACH,MAAM,OAAO,iBAAiB;IACpB,MAAM,CAAU,QAAQ,GAAG,0BAA0B,CAAC,MAAM,EAAE,CAAC;IAEvE,MAAM,CAAC,MAAM,CAAC,QAA+B,EAAE;QAC7C,MAAM,QAAQ,GAAG,iBAAiB,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;QAC1D,OAAO,iBAAiB,CAAC,QAAQ,CAAC,aAAa,CAC7C,iBAAiB,CAAC,yBAAyB,CAAC,KAAK,EAAE,QAAQ,CAAC,CA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 -1,4 +1,5 @@
1
1
  import type { AssistantDiagnostics, ToolCall, ToolDefinition } from '../types.js';
2
+ import type { StoredProviderCredential } from '../../core/auth/index.js';
2
3
  export type LlmStreamEvent = {
3
4
  type: 'content.delta';
4
5
  delta: string;
@@ -12,7 +13,7 @@ export type LlmStreamEvent = {
12
13
  type: 'reasoning_summary.done';
13
14
  text: string;
14
15
  };
15
- export type LlmProvider = 'openai' | 'anthropic' | 'google';
16
+ export type LlmProvider = 'openai' | 'anthropic' | 'google' | 'ollama' | 'huggingface';
16
17
  export type ReasoningEffort = 'low' | 'medium' | 'high' | 'ultrahigh';
17
18
  export type LlmAdapterCapabilities = {
18
19
  toolCalls: boolean;
@@ -68,4 +69,20 @@ export interface LlmAdapter {
68
69
  info?: LlmAdapterInfo;
69
70
  chat(messages: ChatMessage[], tools: ToolDefinition[], signal?: AbortSignal, onStreamEvent?: (event: LlmStreamEvent) => void): Promise<LlmResponse>;
70
71
  }
72
+ export type LlmCredentialContext = {
73
+ apiKey?: string;
74
+ credential?: StoredProviderCredential;
75
+ credentialStorePath?: string;
76
+ };
77
+ export type LlmRuntimeContext = {
78
+ reasoningEffort?: ReasoningEffort;
79
+ fetchImpl?: (url: unknown, init?: unknown) => Promise<globalThis.Response>;
80
+ };
81
+ export type LlmAdapterCreateInput = {
82
+ provider?: LlmProvider;
83
+ model?: string;
84
+ credentials?: LlmCredentialContext;
85
+ runtime?: LlmRuntimeContext;
86
+ };
87
+ export type LlmProviderResolutionInput = Pick<LlmAdapterCreateInput, 'provider' | 'model'>;
71
88
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/core/llm/types.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElF,MAAM,MAAM,cAAc,GACtB;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,KAAK,EAA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AAK,CAAC,EAAE,QAAQ,CAAC;CAClB,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,IAAI,CACF,QAAQ,EAAE,WAAW,EAAE,EACvB,KAAK,EAAE,cAAc,EAAE,EACvB,MAAM,CAAC,EAAE,WAAW,EACpB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,GAC9C,OAAO,CAAC,WAAW,CAAC,CAAC;CACzB;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,wBAAwB,CAAC;IACtC,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;CAC5E,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,CAAC,EAAE,WAAW,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,oBAAoB,CAAC;IACnC,OAAO,CAAC,EAAE,iBAAiB,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,IAAI,CAAC,qBAAqB,EAAE,UAAU,GAAG,OAAO,CAAC,CAAC"}
@@ -1,46 +1,28 @@
1
+ import type { BootstrapMemoryWorkspaceResult, MemoryCatalogLoadResult, MemoryCatalogShapeValidation, MemoryCategory } from './types.js';
1
2
  export declare const DEFAULT_MEMORY_ROOT_CATALOG_MAX_BYTES: number;
2
3
  export declare const DEFAULT_MEMORY_ROOT_CATALOG_TARGET_BYTES: number;
3
4
  export declare const DEFAULT_MEMORY_FOLDER_CATALOG_MAX_BYTES: number;
4
5
  export declare const DEFAULT_MEMORY_FOLDER_CATALOG_TARGET_BYTES: number;
5
- export type MemoryCategory = {
6
- path: string;
7
- title: string;
8
- purpose: string;
9
- readWhen: string;
10
- };
11
- export type BootstrapMemoryWorkspaceResult = {
12
- memoryRoot: string;
13
- createdPaths: string[];
14
- };
15
- export type MemoryCatalogLoadResult = {
16
- memoryRoot: string;
17
- catalogPath: string;
18
- exists: boolean;
19
- content: string;
20
- truncated: boolean;
21
- originalBytes: number;
22
- maxBytes: number;
23
- };
24
- export type MemoryCatalogShapeValidation = {
25
- ok: boolean;
26
- memoryRoot: string;
27
- missing: string[];
28
- };
29
6
  export declare const DEFAULT_MEMORY_CATEGORIES: MemoryCategory[];
30
- export declare function bootstrapMemoryWorkspace(options: {
31
- memoryRoot: string;
32
- }): BootstrapMemoryWorkspaceResult;
33
- export declare function loadMemoryRootCatalog(options: {
34
- memoryRoot: string;
35
- maxBytes?: number;
36
- }): MemoryCatalogLoadResult;
37
- export declare function formatMemoryCatalogSystemContext(catalog: MemoryCatalogLoadResult): string;
38
- export declare function appendMemoryCatalogSystemContext(options: {
39
- systemContext?: string;
40
- memoryRoot: string;
41
- maxBytes?: number;
42
- }): string;
43
- export declare function validateMemoryCatalogShape(options: {
44
- memoryRoot: string;
45
- }): MemoryCatalogShapeValidation;
7
+ /**
8
+ * Owns the cataloged memory workspace shape and the startup memory context.
9
+ */
10
+ export declare class MemoryCatalogService {
11
+ private readonly memoryRoot;
12
+ constructor(memoryRoot: string);
13
+ bootstrap(): BootstrapMemoryWorkspaceResult;
14
+ loadRootCatalog(maxBytes?: number): MemoryCatalogLoadResult;
15
+ formatCatalogSystemContext(catalog: MemoryCatalogLoadResult): string;
16
+ appendCatalogSystemContext(options: {
17
+ systemContext?: string;
18
+ maxBytes?: number;
19
+ }): string;
20
+ validateShape(): MemoryCatalogShapeValidation;
21
+ private resolveRoot;
22
+ private static missingRootCatalog;
23
+ private static writeIfMissing;
24
+ private static createRootCatalogTemplate;
25
+ private static createFolderCatalogTemplate;
26
+ private static truncateUtf8;
27
+ }
46
28
  //# sourceMappingURL=catalog.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../../src/core/memory/catalog.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,qCAAqC,QAAY,CAAC;AAC/D,eAAO,MAAM,wCAAwC,QAAW,CAAC;AACjE,eAAO,MAAM,uCAAuC,QAAW,CAAC;AAChE,eAAO,MAAM,0CAA0C,QAAW,CAAC;AAEnE,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG;IAC3C,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG;IACzC,EAAE,EAAE,OAAO,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,cAAc,EA2CrD,CAAC;AAEF,wBAAgB,wBAAwB,CAAC,OAAO,EAAE;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,GAAG,8BAA8B,CAiBxG;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE;IAC7C,UAAU,EAAE,MAAM,CAAC;I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IAqBjC,OAAO,CAAC,MAAM,CAAC,cAAc;IAU7B,OAAO,CAAC,MAAM,CAAC,yBAAyB;IA2CxC,OAAO,CAAC,MAAM,CAAC,2BAA2B;IA0B1C,OAAO,CAAC,MAAM,CAAC,YAAY;CAY5B"}
@@ -49,25 +49,91 @@ export const DEFAULT_MEMORY_CATEGORIES = [
49
49
  readWhen: 'Use when current behavior has historical causes or the task resembles a past incident or decision.',
50
50
  },
51
51
  ];
52
- export function bootstrapMemoryWorkspace(options) {
53
- const memoryRoot = resolve(options.memoryRoot);
54
- const createdPaths = [];
55
- mkdirSync(memoryRoot, { recursive: true });
56
- writeIfMissing(join(memoryRoot, 'README.md'), createRootCatalogTemplate(), createdPaths, memoryRoot);
57
- for (const category of DEFAULT_MEMORY_CATEGORIES) {
58
- const categoryRoot = join(memoryRoot, category.path);
59
- mkdirSync(categoryRoot, { recursive: true });
60
- writeIfMissing(join(categoryRoot, 'README.md'), createFolderCatalogTemplate(category), createdPaths, memoryRoot);
52
+ /**
53
+ * Owns the cataloged memory workspace shape and the startup memory context.
54
+ */
55
+ export class MemoryCatalogService {
56
+ memoryRoot;
57
+ constructor(memoryRoot) {
58
+ this.memoryRoot = memoryRoot;
61
59
  }
62
- mkdirSync(join(memoryRoot, '_maintenance'), { recursive: true });
63
- writeIfMissing(join(memoryRoot, '_maintenance', 'runs.jsonl'), '', createdPaths, memoryRoot);
64
- return { memoryRoot, createdPaths };
65
- }
66
- export function loadMemoryRootCatalog(options) {
67
- const memoryRoot = resolve(options.memoryRoot);
68
- const maxBytes = options.maxBytes ?? DEFAULT_MEMORY_ROOT_CATALOG_MAX_BYTES;
69
- const catalogPath = join(memoryRoot, 'README.md');
70
- if (!existsSync(catalogPath)) {
60
+ bootstrap() {
61
+ const memoryRoot = this.resolveRoot();
62
+ const createdPaths = [];
63
+ mkdirSync(memoryRoot, { recursive: true });
64
+ MemoryCatalogService.writeIfMissing(join(memoryRoot, 'README.md'), MemoryCatalogService.createRootCatalogTemplate(), createdPaths, memoryRoot);
65
+ for (const category of DEFAULT_MEMORY_CATEGORIES) {
66
+ const categoryRoot = join(memoryRoot, category.path);
67
+ mkdirSync(categoryRoot, { recursive: true });
68
+ MemoryCatalogService.writeIfMissing(join(categoryRoot, 'README.md'), MemoryCatalogService.createFolderCatalogTemplate(category), createdPaths, memoryRoot);
69
+ }
70
+ mkdirSync(join(memoryRoot, '_maintenance'), { recursive: true });
71
+ MemoryCatalogService.writeIfMissing(join(memoryRoot, '_maintenance', 'runs.jsonl'), '', createdPaths, memoryRoot);
72
+ return { memoryRoot, createdPaths };
73
+ }
74
+ loadRootCatalog(maxBytes = DEFAULT_MEMORY_ROOT_CATALOG_MAX_BYTES) {
75
+ const memoryRoot = this.resolveRoot();
76
+ const catalogPath = join(memoryRoot, 'README.md');
77
+ if (!existsSync(catalogPath)) {
78
+ return MemoryCatalogService.missingRootCatalog(memoryRoot, catalogPath, maxBytes);
79
+ }
80
+ const original = readFileSync(catalogPath, 'utf8').trim();
81
+ const originalBytes = Buffer.byteLength(original, 'utf8');
82
+ const truncatedContent = MemoryCatalogService.truncateUtf8(original, maxBytes);
83
+ const truncated = originalBytes > Buffer.byteLength(truncatedContent, 'utf8');
84
+ const content = truncated ?
85
+ [
86
+ truncatedContent,
87
+ '',
88
+ `[Memory catalog truncated to ${maxBytes} bytes from ${originalBytes} bytes. Use read_memory_note on README.md for the full catalog.]`,
89
+ ].join('\n')
90
+ : original;
91
+ return {
92
+ memoryRoot,
93
+ catalogPath,
94
+ exists: true,
95
+ content,
96
+ truncated,
97
+ originalBytes,
98
+ maxBytes,
99
+ };
100
+ }
101
+ formatCatalogSystemContext(catalog) {
102
+ const header = catalog.exists ? '## Workspace Memory Catalog' : '## Workspace Memory Catalog Missing';
103
+ return [
104
+ header,
105
+ '',
106
+ `Source: ${catalog.catalogPath}`,
107
+ '',
108
+ catalog.content,
109
+ '',
110
+ 'Startup memory policy: this is the only memory document loaded automatically. Use memory tools to read relevant folder catalogs or notes before relying on deeper memory.',
111
+ ].join('\n');
112
+ }
113
+ appendCatalogSystemContext(options) {
114
+ const catalog = this.loadRootCatalog(options.maxBytes);
115
+ const memoryContext = this.formatCatalogSystemContext(catalog);
116
+ const domainContext = buildMemoryDomainSystemContext();
117
+ const context = `${domainContext}\n\n${memoryContext}`;
118
+ return options.systemContext ? `${context}\n\n${options.systemContext}` : context;
119
+ }
120
+ validateShape() {
121
+ const memoryRoot = this.resolveRoot();
122
+ const requiredPaths = [
123
+ 'README.md',
124
+ ...DEFAULT_MEMORY_CATEGORIES.map((category) => join(category.path, 'README.md')),
125
+ ];
126
+ const missing = requiredPaths.filter((relativePath) => !existsSync(join(memoryRoot, relativePath)));
127
+ return {
128
+ ok: missing.length === 0,
129
+ memoryRoot,
130
+ missing,
131
+ };
132
+ }
133
+ resolveRoot() {
134
+ return resolve(this.memoryRoot);
135
+ }
136
+ static missingRootCatalog(memoryRoot, catalogPath, maxBytes) {
71
137
  const content = [
72
138
  'No workspace memory catalog exists yet.',
73
139
  '',
@@ -86,145 +152,90 @@ export function loadMemoryRootCatalog(options) {
86
152
  maxBytes,
87
153
  };
88
154
  }
89
- const original = readFileSync(catalogPath, 'utf8').trim();
90
- const originalBytes = Buffer.byteLength(original, 'utf8');
91
- const truncatedContent = truncateUtf8(original, maxBytes);
92
- const truncated = originalBytes > Buffer.byteLength(truncatedContent, 'utf8');
93
- const content = truncated ?
94
- [
95
- truncatedContent,
96
- '',
97
- `[Memory catalog truncated to ${maxBytes} bytes from ${originalBytes} bytes. Use read_memory_note on README.md for the full catalog.]`,
98
- ].join('\n')
99
- : original;
100
- return {
101
- memoryRoot,
102
- catalogPath,
103
- exists: true,
104
- content,
105
- truncated,
106
- originalBytes,
107
- maxBytes,
108
- };
109
- }
110
- export function formatMemoryCatalogSystemContext(catalog) {
111
- const header = catalog.exists ? '## Workspace Memory Catalog' : '## Workspace Memory Catalog Missing';
112
- return [
113
- header,
114
- '',
115
- `Source: ${catalog.catalogPath}`,
116
- '',
117
- catalog.content,
118
- '',
119
- 'Startup memory policy: this is the only memory document loaded automatically. Use memory tools to read relevant folder catalogs or notes before relying on deeper memory.',
120
- ].join('\n');
121
- }
122
- export function appendMemoryCatalogSystemContext(options) {
123
- const catalog = loadMemoryRootCatalog({ memoryRoot: options.memoryRoot, maxBytes: options.maxBytes });
124
- const memoryContext = formatMemoryCatalogSystemContext(catalog);
125
- const domainContext = buildMemoryDomainSystemContext();
126
- const context = `${domainContext}\n\n${memoryContext}`;
127
- return options.systemContext ? `${context}\n\n${options.systemContext}` : context;
128
- }
129
- export function validateMemoryCatalogShape(options) {
130
- const memoryRoot = resolve(options.memoryRoot);
131
- const requiredPaths = [
132
- 'README.md',
133
- ...DEFAULT_MEMORY_CATEGORIES.map((category) => join(category.path, 'README.md')),
134
- ];
135
- const missing = requiredPaths.filter((relativePath) => !existsSync(join(memoryRoot, relativePath)));
136
- return {
137
- ok: missing.length === 0,
138
- memoryRoot,
139
- missing,
140
- };
141
- }
142
- function writeIfMissing(path, content, createdPaths, memoryRoot) {
143
- if (existsSync(path)) {
144
- return;
155
+ static writeIfMissing(path, content, createdPaths, memoryRoot) {
156
+ if (existsSync(path)) {
157
+ return;
158
+ }
159
+ mkdirSync(dirname(path), { recursive: true });
160
+ writeFileSync(path, content, 'utf8');
161
+ createdPaths.push(path.slice(memoryRoot.length).replace(/^\/+/, '') || '.');
145
162
  }
146
- mkdirSync(dirname(path), { recursive: true });
147
- writeFileSync(path, content, 'utf8');
148
- createdPaths.push(toMemoryRelativePath(memoryRoot, path));
149
- }
150
- function createRootCatalogTemplate() {
151
- return [
152
- '# Workspace Memory',
153
- '',
154
- 'Purpose: durable workspace knowledge that helps future agents become operational quickly.',
155
- '',
156
- '## Authority And Freshness',
157
- '',
158
- '- Live workspace evidence wins over memory when they disagree.',
159
- '- Current-state notes with recent verification are stronger than older focused notes.',
160
- '- Historical notes explain decisions and incidents but may be stale.',
161
- '- Important stale, disputed, or superseded facts should be marked rather than silently removed.',
162
- '',
163
- '## Fast Reading Path',
164
- '',
165
- '- New non-trivial task: read `current-state/README.md`, then the category that matches the task.',
166
- '- Coding or architecture task: read `domain/README.md`, `operations/README.md`, and relevant preferences.',
167
- '- Workflow, release, PR, or incident task: read `workflows/README.md`, `operations/README.md`, and relevant history.',
168
- '- Coordination-heavy task: read `relationships/README.md`.',
169
- '',
170
- '## Category Index',
171
- '',
172
- ...DEFAULT_MEMORY_CATEGORIES.map((category) => `- [${category.title}](${category.path}/README.md): ${category.purpose}`),
173
- '',
174
- '## High-Value Notes',
175
- '',
176
- '- Add links here when notes become important enough for every fresh agent to notice.',
177
- '',
178
- '## Stale Or Disputed Notes',
179
- '',
180
- '- Add links here when a note should be treated with caution.',
181
- '',
182
- '## Maintenance Instructions',
183
- '',
184
- '- Keep this catalog short and navigable.',
185
- '- Every folder that contains memory notes needs its own `README.md` catalog.',
186
- '- Every durable note should be discoverable through this catalog or a folder catalog.',
187
- '- Prefer updating existing notes over scattering small one-off notes.',
188
- '- Do not store secrets.',
189
- '',
190
- ].join('\n');
191
- }
192
- function createFolderCatalogTemplate(category) {
193
- return [
194
- `# ${category.title}`,
195
- '',
196
- `Purpose: ${category.purpose}`,
197
- '',
198
- `When to read: ${category.readWhen}`,
199
- '',
200
- '## Notes Index',
201
- '',
202
- '- Add note links here as this folder grows.',
203
- '',
204
- '## Related Folders',
205
- '',
206
- '- `../README.md`: root memory catalog.',
207
- '',
208
- '## Maintenance Rules',
209
- '',
210
- '- Keep this catalog short enough to scan quickly.',
211
- '- Add notes only when they preserve durable context for future work.',
212
- '- Update this catalog whenever adding, renaming, or retiring notes in this folder.',
213
- '- Mark stale, disputed, or superseded knowledge explicitly.',
214
- '',
215
- ].join('\n');
216
- }
217
- function truncateUtf8(value, maxBytes) {
218
- if (maxBytes <= 0) {
219
- return '';
163
+ static createRootCatalogTemplate() {
164
+ return [
165
+ '# Workspace Memory',
166
+ '',
167
+ 'Purpose: durable workspace knowledge that helps future agents become operational quickly.',
168
+ '',
169
+ '## Authority And Freshness',
170
+ '',
171
+ '- Live workspace evidence wins over memory when they disagree.',
172
+ '- Current-state notes with recent verification are stronger than older focused notes.',
173
+ '- Historical notes explain decisions and incidents but may be stale.',
174
+ '- Important stale, disputed, or superseded facts should be marked rather than silently removed.',
175
+ '',
176
+ '## Fast Reading Path',
177
+ '',
178
+ '- New non-trivial task: read `current-state/README.md`, then the category that matches the task.',
179
+ '- Coding or architecture task: read `domain/README.md`, `operations/README.md`, and relevant preferences.',
180
+ '- Workflow, release, PR, or incident task: read `workflows/README.md`, `operations/README.md`, and relevant history.',
181
+ '- Coordination-heavy task: read `relationships/README.md`.',
182
+ '',
183
+ '## Category Index',
184
+ '',
185
+ ...DEFAULT_MEMORY_CATEGORIES.map((category) => `- [${category.title}](${category.path}/README.md): ${category.purpose}`),
186
+ '',
187
+ '## High-Value Notes',
188
+ '',
189
+ '- Add links here when notes become important enough for every fresh agent to notice.',
190
+ '',
191
+ '## Stale Or Disputed Notes',
192
+ '',
193
+ '- Add links here when a note should be treated with caution.',
194
+ '',
195
+ '## Maintenance Instructions',
196
+ '',
197
+ '- Keep this catalog short and navigable.',
198
+ '- Every folder that contains memory notes needs its own `README.md` catalog.',
199
+ '- Every durable note should be discoverable through this catalog or a folder catalog.',
200
+ '- Prefer updating existing notes over scattering small one-off notes.',
201
+ '- Do not store secrets.',
202
+ '',
203
+ ].join('\n');
220
204
  }
221
- const bytes = Buffer.from(value, 'utf8');
222
- if (bytes.length <= maxBytes) {
223
- return value;
205
+ static createFolderCatalogTemplate(category) {
206
+ return [
207
+ `# ${category.title}`,
208
+ '',
209
+ `Purpose: ${category.purpose}`,
210
+ '',
211
+ `When to read: ${category.readWhen}`,
212
+ '',
213
+ '## Notes Index',
214
+ '',
215
+ '- Add note links here as this folder grows.',
216
+ '',
217
+ '## Related Folders',
218
+ '',
219
+ '- `../README.md`: root memory catalog.',
220
+ '',
221
+ '## Maintenance Rules',
222
+ '',
223
+ '- Keep this catalog short enough to scan quickly.',
224
+ '- Add notes only when they preserve durable context for future work.',
225
+ '- Update this catalog whenever adding, renaming, or retiring a note in this folder.',
226
+ '- Mark stale, disputed, or superseded knowledge explicitly.',
227
+ '',
228
+ ].join('\n');
229
+ }
230
+ static truncateUtf8(value, maxBytes) {
231
+ if (maxBytes <= 0) {
232
+ return '';
233
+ }
234
+ const bytes = Buffer.from(value, 'utf8');
235
+ if (bytes.length <= maxBytes) {
236
+ return value;
237
+ }
238
+ return bytes.subarray(0, maxBytes).toString('utf8').replace(/\uFFFD+$/u, '').trimEnd();
224
239
  }
225
- return bytes.subarray(0, maxBytes).toString('utf8').replace(/\uFFFD+$/u, '').trimEnd();
226
- }
227
- function toMemoryRelativePath(memoryRoot, path) {
228
- return path.slice(memoryRoot.length).replace(/^\/+/, '') || '.';
229
240
  }
230
241
  //# sourceMappingURL=catalog.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"catalog.js","sourceRoot":"","sources":["../../../../src/core/memory/catalog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AAEpE,MAAM,CAAC,MAAM,qCAAqC,GAAG,EAAE,GAAG,IAAI,CAAC;AAC/D,MAAM,CAAC,MAAM,wCAAwC,GAAG,CAAC,GAAG,IAAI,CAAC;AACjE,MAAM,CAAC,MAAM,uCAAuC,GAAG,CAAC,GAAG,IAAI,CAAC;AAChE,MAAM,CAAC,MAAM,0CAA0C,GAAG,CAAC,GAAG,IAAI,CAAC;AA8BnE,MAAM,CAAC,MAAM,yBAAyB,GAAqB;IACzD;QACE,IAAI,EAAE,eAAe;QACrB,KAAK,EAAE,eAAe;QACtB,OAAO,EAAE,mFAAmF;QAC5F,QAAQ,EAAE,8EAA8E;KACzF;IACD;QAC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C,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;IACzF,CAAC;CACF"}
@@ -0,0 +1,14 @@
1
+ export { DEFAULT_MEMORY_CATEGORIES, DEFAULT_MEMORY_FOLDER_CATALOG_MAX_BYTES, DEFAULT_MEMORY_FOLDER_CATALOG_TARGET_BYTES, DEFAULT_MEMORY_ROOT_CATALOG_MAX_BYTES, DEFAULT_MEMORY_ROOT_CATALOG_TARGET_BYTES, MemoryCatalogService, } from './catalog.js';
2
+ export { buildMemoryDomainSystemContext } from './domain-prompt.js';
3
+ export { MemoryMaintenanceRepository } from './maintenance-repository.js';
4
+ export { MemoryMaintainerPrompt } from './maintainer-prompt.js';
5
+ export { MemoryMaintenanceService } from './maintainer.js';
6
+ export { MemoryMaintenanceIntegrationService } from './maintenance-integration.js';
7
+ export { createMemoryMaintainerTools } from './maintainer-tools.js';
8
+ export { MemoryNoteService } from './note-service.js';
9
+ export { MemorySchemas } from './schemas.js';
10
+ export { createMemoryNoteTemplate, slugifyMemoryTitle } from './templates.js';
11
+ export { MemoryValidationService } from './validation.js';
12
+ export { MemoryVisibilityService } from './visibility.js';
13
+ export type { BootstrapMemoryWorkspaceResult, KnowledgeCandidate, KnowledgeCandidateStatusRecord, KnowledgeMaintenanceRunRecord, ListMemoryNotesInput, MemoryCatalogLoadResult, MemoryCatalogShapeValidation, MemoryCategory, MemoryMaintenanceLockRecord, MemoryStatusView, MemoryValidationIssue, MemoryValidationResult, ReadMemoryNoteInput, RunKnowledgeMaintenanceOptions, RunKnowledgeMaintenanceResult, RunMaintenanceForRecordedCandidatesOptions, RunMaintenanceForRecordedCandidatesResult, SearchMemoryNotesInput, } from './types.js';
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/memory/index.ts"],"names":[],"mappings":"A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_BYTES, MemoryCatalogService, } from './catalog.js';
2
+ export { buildMemoryDomainSystemContext } from './domain-prompt.js';
3
+ export { MemoryMaintenanceRepository } from './maintenance-repository.js';
4
+ export { MemoryMaintainerPrompt } from './maintainer-prompt.js';
5
+ export { MemoryMaintenanceService } from './maintainer.js';
6
+ export { MemoryMaintenanceIntegrationService } from './maintenance-integration.js';
7
+ export { createMemoryMaintainerTools } from './maintainer-tools.js';
8
+ export { MemoryNoteService } from './note-service.js';
9
+ export { MemorySchemas } from './schemas.js';
10
+ export { createMemoryNoteTemplate, slugifyMemoryTitle } from './templates.js';
11
+ export { MemoryValidationService } from './validation.js';
12
+ export { MemoryVisibilityService } from './visibility.js';
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/memory/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EACzB,uCAAuC,EACvC,0CAA0C,EAC1C,qCAAqC,EACrC,wCAAwC,EACxC,oBAAoB,GACrB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,mCAAmC,EAAE,MAAM,8BAA8B,CAAC;AACnF,OAAO,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAC9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { KnowledgeCandidate } from './types.js';
2
+ /**
3
+ * Owns the memory maintainer prompt text.
4
+ *
5
+ * Keep static instructions before dynamic catalog/candidate content so model
6
+ * providers can reuse token cache across maintenance runs.
7
+ */
8
+ export declare class MemoryMaintainerPrompt {
9
+ private static readonly staticSystemContext;
10
+ static buildSystemContext(rootCatalog: string): string;
11
+ static buildMaintenanceGoal(observations: KnowledgeCandidate[]): string;
12
+ private static formatCandidates;
13
+ }
14
+ //# sourceMappingURL=maintainer-prompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"maintainer-prompt.d.ts","sourceRoot":"","sources":["../../../../src/core/memory/maintainer-prompt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD;;;;;GAKG;AACH,qBAAa,sBAAsB;IACjC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,mBAAmB,CAcgC;IAE3E,MAAM,CAAC,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM;IAQtD,MAAM,CAAC,oBAAoB,CAAC,YAAY,EAAE,kBAAkB,EAAE,GAAG,MAAM;IAUvE,OAAO,CAAC,MAAM,CAAC,gBAAgB;CAmBhC"}