qlogicagent 0.2.0 → 0.3.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 (453) hide show
  1. package/dist/agent.js +1 -0
  2. package/dist/cli.js +9 -0
  3. package/dist/contracts.js +1 -0
  4. package/dist/index.js +5 -16
  5. package/dist/orchestration.js +118 -0
  6. package/dist/{agent → types/agent}/agent.d.ts +0 -1
  7. package/dist/{agent → types/agent}/tool-loop.d.ts +0 -1
  8. package/dist/{agent → types/agent}/types.d.ts +0 -1
  9. package/dist/{cli → types/cli}/main.d.ts +0 -1
  10. package/dist/{cli → types/cli}/stdio-server.d.ts +0 -1
  11. package/dist/{config → types/config}/config.d.ts +0 -1
  12. package/dist/{contracts → types/contracts}/hooks.d.ts +0 -1
  13. package/dist/{contracts/index.js → types/contracts/index.d.ts} +0 -1
  14. package/dist/{contracts → types/contracts}/planner.d.ts +0 -1
  15. package/dist/{contracts → types/contracts}/skill-candidate.d.ts +0 -1
  16. package/dist/{contracts → types/contracts}/todo.d.ts +0 -1
  17. package/dist/{index.d.ts → types/index.d.ts} +0 -1
  18. package/dist/{llm → types/llm}/builtin-providers.d.ts +0 -1
  19. package/dist/{llm → types/llm}/index.d.ts +0 -1
  20. package/dist/{llm → types/llm}/llm-client.d.ts +0 -1
  21. package/dist/{llm → types/llm}/model-catalog.d.ts +0 -1
  22. package/dist/{llm → types/llm}/provider-def.d.ts +0 -1
  23. package/dist/{llm → types/llm}/provider-registry.d.ts +0 -1
  24. package/dist/{llm → types/llm}/transport.d.ts +0 -1
  25. package/dist/{llm → types/llm}/transports/anthropic-messages.d.ts +0 -1
  26. package/dist/{llm → types/llm}/transports/openai-chat.d.ts +0 -1
  27. package/dist/{orchestration → types/orchestration}/agent-registry.d.ts +0 -1
  28. package/dist/{orchestration → types/orchestration}/approval-aware-tool-plan.d.ts +0 -1
  29. package/dist/{orchestration → types/orchestration}/context-compression.d.ts +0 -1
  30. package/dist/{orchestration → types/orchestration}/conversation-repair.d.ts +0 -1
  31. package/dist/{orchestration → types/orchestration}/curator-scheduler.d.ts +0 -1
  32. package/dist/{orchestration → types/orchestration}/embedded-failover-policy.d.ts +0 -1
  33. package/dist/{orchestration → types/orchestration}/error-classification.d.ts +0 -1
  34. package/dist/{orchestration → types/orchestration}/failover-classification.d.ts +0 -1
  35. package/dist/{orchestration → types/orchestration}/failover-error.d.ts +0 -1
  36. package/dist/{orchestration → types/orchestration}/fork-subagent.d.ts +0 -1
  37. package/dist/{orchestration → types/orchestration}/index.d.ts +0 -1
  38. package/dist/{orchestration → types/orchestration}/memory-flush-policy.d.ts +0 -1
  39. package/dist/{orchestration → types/orchestration}/memory-provider.d.ts +0 -1
  40. package/dist/{orchestration → types/orchestration}/parallel-tool-calls.d.ts +0 -1
  41. package/dist/{orchestration → types/orchestration}/prompt-cache-strategy.d.ts +0 -1
  42. package/dist/{orchestration → types/orchestration}/reactive-compact.d.ts +0 -1
  43. package/dist/{orchestration → types/orchestration}/retry-loop.d.ts +0 -1
  44. package/dist/{orchestration → types/orchestration}/skill-candidate.d.ts +0 -1
  45. package/dist/{orchestration → types/orchestration}/skill-consolidation.d.ts +0 -1
  46. package/dist/{orchestration → types/orchestration}/skill-improvement.d.ts +0 -1
  47. package/dist/{orchestration → types/orchestration}/skill-similarity.d.ts +0 -1
  48. package/dist/{orchestration → types/orchestration}/streaming-tool-executor.d.ts +0 -1
  49. package/dist/{orchestration → types/orchestration}/team-orchestration.d.ts +0 -1
  50. package/dist/{orchestration → types/orchestration}/team-tool-loop-wiring.d.ts +0 -1
  51. package/dist/{orchestration → types/orchestration}/tool-choice-policy.d.ts +0 -1
  52. package/dist/{orchestration → types/orchestration}/tool-loop-state.d.ts +0 -1
  53. package/dist/{orchestration → types/orchestration}/tool-schema.d.ts +0 -1
  54. package/dist/{orchestration → types/orchestration}/transcript-repair.d.ts +0 -1
  55. package/dist/{orchestration → types/orchestration}/turn-loop-guard.d.ts +0 -1
  56. package/dist/{orchestration → types/orchestration}/web-browser-policy.d.ts +0 -1
  57. package/dist/{runtime → types/runtime}/context-compression.d.ts +0 -1
  58. package/dist/{runtime → types/runtime}/hook-registry.d.ts +0 -1
  59. package/dist/{runtime → types/runtime}/memory-hooks.d.ts +0 -1
  60. package/dist/{runtime → types/runtime}/tool-eligibility.d.ts +0 -1
  61. package/dist/{skills → types/skills}/index.d.ts +0 -1
  62. package/dist/{skills → types/skills}/memory-extractor.d.ts +0 -1
  63. package/dist/{skills → types/skills}/memory-query-tool.d.ts +0 -1
  64. package/dist/{skills → types/skills}/memory-store.d.ts +0 -1
  65. package/dist/{skills → types/skills}/memory-tool.d.ts +0 -1
  66. package/dist/{skills → types/skills}/portable-tool.d.ts +0 -1
  67. package/dist/{skills → types/skills}/qmemory-adapter.d.ts +0 -1
  68. package/dist/{skills → types/skills}/skill-frontmatter.d.ts +0 -1
  69. package/dist/{skills → types/skills}/skill-guard.d.ts +0 -1
  70. package/dist/{skills → types/skills}/skill-loader.d.ts +0 -1
  71. package/dist/{skills → types/skills}/skill-source.d.ts +0 -1
  72. package/dist/{skills → types/skills}/skill-types.d.ts +0 -1
  73. package/dist/{skills → types/skills}/think-tool.d.ts +0 -1
  74. package/dist/{skills → types/skills}/todo-tool.d.ts +0 -1
  75. package/dist/{skills → types/skills}/tools/agent-tool.d.ts +0 -1
  76. package/dist/{skills → types/skills}/tools/apply-patch-tool.d.ts +0 -1
  77. package/dist/{skills → types/skills}/tools/ask-user-tool.d.ts +0 -1
  78. package/dist/{skills → types/skills}/tools/brief-tool.d.ts +0 -1
  79. package/dist/{skills → types/skills}/tools/browser-tool.d.ts +0 -1
  80. package/dist/{skills → types/skills}/tools/checkpoint-tool.d.ts +0 -1
  81. package/dist/{skills → types/skills}/tools/config-tool.d.ts +0 -1
  82. package/dist/{skills → types/skills}/tools/cron-tool.d.ts +0 -1
  83. package/dist/{skills → types/skills}/tools/edit-tool.d.ts +0 -1
  84. package/dist/{skills → types/skills}/tools/exec-tool.d.ts +0 -1
  85. package/dist/{skills → types/skills}/tools/image-generate-tool.d.ts +0 -1
  86. package/dist/{skills → types/skills}/tools/instructions-tool.d.ts +0 -1
  87. package/dist/{skills → types/skills}/tools/lsp-tool.d.ts +0 -1
  88. package/dist/{skills → types/skills}/tools/mcp-client-types.d.ts +0 -1
  89. package/dist/{skills → types/skills}/tools/mcp-tool.d.ts +0 -1
  90. package/dist/{skills → types/skills}/tools/memory-tool.d.ts +0 -1
  91. package/dist/{skills → types/skills}/tools/monitor-tool.d.ts +0 -1
  92. package/dist/{skills → types/skills}/tools/music-generate-tool.d.ts +0 -1
  93. package/dist/{skills → types/skills}/tools/notify-tool.d.ts +0 -1
  94. package/dist/{skills → types/skills}/tools/patch-tool.d.ts +0 -1
  95. package/dist/{skills → types/skills}/tools/pdf-tool.d.ts +0 -1
  96. package/dist/{skills → types/skills}/tools/plan-mode-tool.d.ts +0 -1
  97. package/dist/{skills → types/skills}/tools/read-tool.d.ts +0 -1
  98. package/dist/{skills → types/skills}/tools/repl-tool.d.ts +0 -1
  99. package/dist/{skills → types/skills}/tools/search-tool.d.ts +0 -1
  100. package/dist/{skills → types/skills}/tools/send-message-tool.d.ts +0 -1
  101. package/dist/{skills → types/skills}/tools/skill-list-tool.d.ts +0 -1
  102. package/dist/{skills → types/skills}/tools/skill-manage-tool.d.ts +0 -1
  103. package/dist/{skills → types/skills}/tools/skill-view-tool.d.ts +0 -1
  104. package/dist/{skills → types/skills}/tools/sleep-tool.d.ts +0 -1
  105. package/dist/{skills → types/skills}/tools/structured-output-tool.d.ts +0 -1
  106. package/dist/{skills → types/skills}/tools/task-tool.d.ts +0 -1
  107. package/dist/{skills → types/skills}/tools/team-tool.d.ts +0 -1
  108. package/dist/{skills → types/skills}/tools/tool-search-tool.d.ts +0 -1
  109. package/dist/{skills → types/skills}/tools/tts-tool.d.ts +0 -1
  110. package/dist/{skills → types/skills}/tools/video-edit-tool.d.ts +0 -1
  111. package/dist/{skills → types/skills}/tools/video-generate-tool.d.ts +0 -1
  112. package/dist/{skills → types/skills}/tools/video-merge-tool.d.ts +0 -1
  113. package/dist/{skills → types/skills}/tools/video-upscale-tool.d.ts +0 -1
  114. package/dist/{skills → types/skills}/tools/web-fetch-tool.d.ts +0 -1
  115. package/dist/{skills → types/skills}/tools/web-search-tool.d.ts +0 -1
  116. package/dist/{skills → types/skills}/tools/worktree-tool.d.ts +0 -1
  117. package/dist/{skills → types/skills}/tools/write-tool.d.ts +0 -1
  118. package/package.json +56 -42
  119. package/dist/agent/agent.d.ts.map +0 -1
  120. package/dist/agent/agent.js +0 -114
  121. package/dist/agent/agent.js.map +0 -1
  122. package/dist/agent/tool-loop.d.ts.map +0 -1
  123. package/dist/agent/tool-loop.js +0 -576
  124. package/dist/agent/tool-loop.js.map +0 -1
  125. package/dist/agent/types.d.ts.map +0 -1
  126. package/dist/agent/types.js +0 -15
  127. package/dist/agent/types.js.map +0 -1
  128. package/dist/cli/main.d.ts.map +0 -1
  129. package/dist/cli/main.js +0 -24
  130. package/dist/cli/main.js.map +0 -1
  131. package/dist/cli/stdio-server.d.ts.map +0 -1
  132. package/dist/cli/stdio-server.js +0 -464
  133. package/dist/cli/stdio-server.js.map +0 -1
  134. package/dist/config/config.d.ts.map +0 -1
  135. package/dist/config/config.js +0 -22
  136. package/dist/config/config.js.map +0 -1
  137. package/dist/contracts/hooks.d.ts.map +0 -1
  138. package/dist/contracts/hooks.js +0 -8
  139. package/dist/contracts/hooks.js.map +0 -1
  140. package/dist/contracts/index.d.ts +0 -11
  141. package/dist/contracts/index.d.ts.map +0 -1
  142. package/dist/contracts/index.js.map +0 -1
  143. package/dist/contracts/planner.d.ts.map +0 -1
  144. package/dist/contracts/planner.js +0 -3
  145. package/dist/contracts/planner.js.map +0 -1
  146. package/dist/contracts/skill-candidate.d.ts.map +0 -1
  147. package/dist/contracts/skill-candidate.js +0 -196
  148. package/dist/contracts/skill-candidate.js.map +0 -1
  149. package/dist/contracts/todo.d.ts.map +0 -1
  150. package/dist/contracts/todo.js +0 -10
  151. package/dist/contracts/todo.js.map +0 -1
  152. package/dist/index.d.ts.map +0 -1
  153. package/dist/index.js.map +0 -1
  154. package/dist/llm/builtin-providers.d.ts.map +0 -1
  155. package/dist/llm/builtin-providers.js +0 -532
  156. package/dist/llm/builtin-providers.js.map +0 -1
  157. package/dist/llm/index.d.ts.map +0 -1
  158. package/dist/llm/index.js +0 -15
  159. package/dist/llm/index.js.map +0 -1
  160. package/dist/llm/llm-client.d.ts.map +0 -1
  161. package/dist/llm/llm-client.js +0 -68
  162. package/dist/llm/llm-client.js.map +0 -1
  163. package/dist/llm/model-catalog.d.ts.map +0 -1
  164. package/dist/llm/model-catalog.js +0 -192
  165. package/dist/llm/model-catalog.js.map +0 -1
  166. package/dist/llm/provider-def.d.ts.map +0 -1
  167. package/dist/llm/provider-def.js +0 -13
  168. package/dist/llm/provider-def.js.map +0 -1
  169. package/dist/llm/provider-registry.d.ts.map +0 -1
  170. package/dist/llm/provider-registry.js +0 -148
  171. package/dist/llm/provider-registry.js.map +0 -1
  172. package/dist/llm/transport.d.ts.map +0 -1
  173. package/dist/llm/transport.js +0 -28
  174. package/dist/llm/transport.js.map +0 -1
  175. package/dist/llm/transports/anthropic-messages.d.ts.map +0 -1
  176. package/dist/llm/transports/anthropic-messages.js +0 -294
  177. package/dist/llm/transports/anthropic-messages.js.map +0 -1
  178. package/dist/llm/transports/openai-chat.d.ts.map +0 -1
  179. package/dist/llm/transports/openai-chat.js +0 -166
  180. package/dist/llm/transports/openai-chat.js.map +0 -1
  181. package/dist/orchestration/agent-registry.d.ts.map +0 -1
  182. package/dist/orchestration/agent-registry.js +0 -117
  183. package/dist/orchestration/agent-registry.js.map +0 -1
  184. package/dist/orchestration/approval-aware-tool-plan.d.ts.map +0 -1
  185. package/dist/orchestration/approval-aware-tool-plan.js +0 -88
  186. package/dist/orchestration/approval-aware-tool-plan.js.map +0 -1
  187. package/dist/orchestration/context-compression.d.ts.map +0 -1
  188. package/dist/orchestration/context-compression.js +0 -584
  189. package/dist/orchestration/context-compression.js.map +0 -1
  190. package/dist/orchestration/conversation-repair.d.ts.map +0 -1
  191. package/dist/orchestration/conversation-repair.js +0 -430
  192. package/dist/orchestration/conversation-repair.js.map +0 -1
  193. package/dist/orchestration/curator-scheduler.d.ts.map +0 -1
  194. package/dist/orchestration/curator-scheduler.js +0 -136
  195. package/dist/orchestration/curator-scheduler.js.map +0 -1
  196. package/dist/orchestration/embedded-failover-policy.d.ts.map +0 -1
  197. package/dist/orchestration/embedded-failover-policy.js +0 -169
  198. package/dist/orchestration/embedded-failover-policy.js.map +0 -1
  199. package/dist/orchestration/error-classification.d.ts.map +0 -1
  200. package/dist/orchestration/error-classification.js +0 -78
  201. package/dist/orchestration/error-classification.js.map +0 -1
  202. package/dist/orchestration/failover-classification.d.ts.map +0 -1
  203. package/dist/orchestration/failover-classification.js +0 -382
  204. package/dist/orchestration/failover-classification.js.map +0 -1
  205. package/dist/orchestration/failover-error.d.ts.map +0 -1
  206. package/dist/orchestration/failover-error.js +0 -199
  207. package/dist/orchestration/failover-error.js.map +0 -1
  208. package/dist/orchestration/fork-subagent.d.ts.map +0 -1
  209. package/dist/orchestration/fork-subagent.js +0 -99
  210. package/dist/orchestration/fork-subagent.js.map +0 -1
  211. package/dist/orchestration/index.d.ts.map +0 -1
  212. package/dist/orchestration/index.js +0 -268
  213. package/dist/orchestration/index.js.map +0 -1
  214. package/dist/orchestration/memory-flush-policy.d.ts.map +0 -1
  215. package/dist/orchestration/memory-flush-policy.js +0 -86
  216. package/dist/orchestration/memory-flush-policy.js.map +0 -1
  217. package/dist/orchestration/memory-provider.d.ts.map +0 -1
  218. package/dist/orchestration/memory-provider.js +0 -3
  219. package/dist/orchestration/memory-provider.js.map +0 -1
  220. package/dist/orchestration/parallel-tool-calls.d.ts.map +0 -1
  221. package/dist/orchestration/parallel-tool-calls.js +0 -60
  222. package/dist/orchestration/parallel-tool-calls.js.map +0 -1
  223. package/dist/orchestration/prompt-cache-strategy.d.ts.map +0 -1
  224. package/dist/orchestration/prompt-cache-strategy.js +0 -229
  225. package/dist/orchestration/prompt-cache-strategy.js.map +0 -1
  226. package/dist/orchestration/reactive-compact.d.ts.map +0 -1
  227. package/dist/orchestration/reactive-compact.js +0 -79
  228. package/dist/orchestration/reactive-compact.js.map +0 -1
  229. package/dist/orchestration/retry-loop.d.ts.map +0 -1
  230. package/dist/orchestration/retry-loop.js +0 -25
  231. package/dist/orchestration/retry-loop.js.map +0 -1
  232. package/dist/orchestration/skill-candidate.d.ts.map +0 -1
  233. package/dist/orchestration/skill-candidate.js +0 -142
  234. package/dist/orchestration/skill-candidate.js.map +0 -1
  235. package/dist/orchestration/skill-consolidation.d.ts.map +0 -1
  236. package/dist/orchestration/skill-consolidation.js +0 -221
  237. package/dist/orchestration/skill-consolidation.js.map +0 -1
  238. package/dist/orchestration/skill-improvement.d.ts.map +0 -1
  239. package/dist/orchestration/skill-improvement.js +0 -67
  240. package/dist/orchestration/skill-improvement.js.map +0 -1
  241. package/dist/orchestration/skill-similarity.d.ts.map +0 -1
  242. package/dist/orchestration/skill-similarity.js +0 -132
  243. package/dist/orchestration/skill-similarity.js.map +0 -1
  244. package/dist/orchestration/streaming-tool-executor.d.ts.map +0 -1
  245. package/dist/orchestration/streaming-tool-executor.js +0 -97
  246. package/dist/orchestration/streaming-tool-executor.js.map +0 -1
  247. package/dist/orchestration/team-orchestration.d.ts.map +0 -1
  248. package/dist/orchestration/team-orchestration.js +0 -370
  249. package/dist/orchestration/team-orchestration.js.map +0 -1
  250. package/dist/orchestration/team-tool-loop-wiring.d.ts.map +0 -1
  251. package/dist/orchestration/team-tool-loop-wiring.js +0 -148
  252. package/dist/orchestration/team-tool-loop-wiring.js.map +0 -1
  253. package/dist/orchestration/tool-choice-policy.d.ts.map +0 -1
  254. package/dist/orchestration/tool-choice-policy.js +0 -165
  255. package/dist/orchestration/tool-choice-policy.js.map +0 -1
  256. package/dist/orchestration/tool-loop-state.d.ts.map +0 -1
  257. package/dist/orchestration/tool-loop-state.js +0 -134
  258. package/dist/orchestration/tool-loop-state.js.map +0 -1
  259. package/dist/orchestration/tool-schema.d.ts.map +0 -1
  260. package/dist/orchestration/tool-schema.js +0 -298
  261. package/dist/orchestration/tool-schema.js.map +0 -1
  262. package/dist/orchestration/transcript-repair.d.ts.map +0 -1
  263. package/dist/orchestration/transcript-repair.js +0 -427
  264. package/dist/orchestration/transcript-repair.js.map +0 -1
  265. package/dist/orchestration/turn-loop-guard.d.ts.map +0 -1
  266. package/dist/orchestration/turn-loop-guard.js +0 -93
  267. package/dist/orchestration/turn-loop-guard.js.map +0 -1
  268. package/dist/orchestration/web-browser-policy.d.ts.map +0 -1
  269. package/dist/orchestration/web-browser-policy.js +0 -40
  270. package/dist/orchestration/web-browser-policy.js.map +0 -1
  271. package/dist/runtime/context-compression.d.ts.map +0 -1
  272. package/dist/runtime/context-compression.js +0 -275
  273. package/dist/runtime/context-compression.js.map +0 -1
  274. package/dist/runtime/hook-registry.d.ts.map +0 -1
  275. package/dist/runtime/hook-registry.js +0 -54
  276. package/dist/runtime/hook-registry.js.map +0 -1
  277. package/dist/runtime/memory-hooks.d.ts.map +0 -1
  278. package/dist/runtime/memory-hooks.js +0 -66
  279. package/dist/runtime/memory-hooks.js.map +0 -1
  280. package/dist/runtime/tool-eligibility.d.ts.map +0 -1
  281. package/dist/runtime/tool-eligibility.js +0 -112
  282. package/dist/runtime/tool-eligibility.js.map +0 -1
  283. package/dist/skills/index.d.ts.map +0 -1
  284. package/dist/skills/index.js +0 -83
  285. package/dist/skills/index.js.map +0 -1
  286. package/dist/skills/memory-extractor.d.ts.map +0 -1
  287. package/dist/skills/memory-extractor.js +0 -174
  288. package/dist/skills/memory-extractor.js.map +0 -1
  289. package/dist/skills/memory-query-tool.d.ts.map +0 -1
  290. package/dist/skills/memory-query-tool.js +0 -128
  291. package/dist/skills/memory-query-tool.js.map +0 -1
  292. package/dist/skills/memory-store.d.ts.map +0 -1
  293. package/dist/skills/memory-store.js +0 -229
  294. package/dist/skills/memory-store.js.map +0 -1
  295. package/dist/skills/memory-tool.d.ts.map +0 -1
  296. package/dist/skills/memory-tool.js +0 -193
  297. package/dist/skills/memory-tool.js.map +0 -1
  298. package/dist/skills/portable-tool.d.ts.map +0 -1
  299. package/dist/skills/portable-tool.js +0 -15
  300. package/dist/skills/portable-tool.js.map +0 -1
  301. package/dist/skills/qmemory-adapter.d.ts.map +0 -1
  302. package/dist/skills/qmemory-adapter.js +0 -166
  303. package/dist/skills/qmemory-adapter.js.map +0 -1
  304. package/dist/skills/skill-frontmatter.d.ts.map +0 -1
  305. package/dist/skills/skill-frontmatter.js +0 -345
  306. package/dist/skills/skill-frontmatter.js.map +0 -1
  307. package/dist/skills/skill-guard.d.ts.map +0 -1
  308. package/dist/skills/skill-guard.js +0 -230
  309. package/dist/skills/skill-guard.js.map +0 -1
  310. package/dist/skills/skill-loader.d.ts.map +0 -1
  311. package/dist/skills/skill-loader.js +0 -304
  312. package/dist/skills/skill-loader.js.map +0 -1
  313. package/dist/skills/skill-source.d.ts.map +0 -1
  314. package/dist/skills/skill-source.js +0 -127
  315. package/dist/skills/skill-source.js.map +0 -1
  316. package/dist/skills/skill-types.d.ts.map +0 -1
  317. package/dist/skills/skill-types.js +0 -7
  318. package/dist/skills/skill-types.js.map +0 -1
  319. package/dist/skills/think-tool.d.ts.map +0 -1
  320. package/dist/skills/think-tool.js +0 -60
  321. package/dist/skills/think-tool.js.map +0 -1
  322. package/dist/skills/todo-tool.d.ts.map +0 -1
  323. package/dist/skills/todo-tool.js +0 -115
  324. package/dist/skills/todo-tool.js.map +0 -1
  325. package/dist/skills/tools/agent-tool.d.ts.map +0 -1
  326. package/dist/skills/tools/agent-tool.js +0 -143
  327. package/dist/skills/tools/agent-tool.js.map +0 -1
  328. package/dist/skills/tools/apply-patch-tool.d.ts.map +0 -1
  329. package/dist/skills/tools/apply-patch-tool.js +0 -185
  330. package/dist/skills/tools/apply-patch-tool.js.map +0 -1
  331. package/dist/skills/tools/ask-user-tool.d.ts.map +0 -1
  332. package/dist/skills/tools/ask-user-tool.js +0 -122
  333. package/dist/skills/tools/ask-user-tool.js.map +0 -1
  334. package/dist/skills/tools/brief-tool.d.ts.map +0 -1
  335. package/dist/skills/tools/brief-tool.js +0 -96
  336. package/dist/skills/tools/brief-tool.js.map +0 -1
  337. package/dist/skills/tools/browser-tool.d.ts.map +0 -1
  338. package/dist/skills/tools/browser-tool.js +0 -156
  339. package/dist/skills/tools/browser-tool.js.map +0 -1
  340. package/dist/skills/tools/checkpoint-tool.d.ts.map +0 -1
  341. package/dist/skills/tools/checkpoint-tool.js +0 -103
  342. package/dist/skills/tools/checkpoint-tool.js.map +0 -1
  343. package/dist/skills/tools/config-tool.d.ts.map +0 -1
  344. package/dist/skills/tools/config-tool.js +0 -144
  345. package/dist/skills/tools/config-tool.js.map +0 -1
  346. package/dist/skills/tools/cron-tool.d.ts.map +0 -1
  347. package/dist/skills/tools/cron-tool.js +0 -176
  348. package/dist/skills/tools/cron-tool.js.map +0 -1
  349. package/dist/skills/tools/edit-tool.d.ts.map +0 -1
  350. package/dist/skills/tools/edit-tool.js +0 -71
  351. package/dist/skills/tools/edit-tool.js.map +0 -1
  352. package/dist/skills/tools/exec-tool.d.ts.map +0 -1
  353. package/dist/skills/tools/exec-tool.js +0 -134
  354. package/dist/skills/tools/exec-tool.js.map +0 -1
  355. package/dist/skills/tools/image-generate-tool.d.ts.map +0 -1
  356. package/dist/skills/tools/image-generate-tool.js +0 -68
  357. package/dist/skills/tools/image-generate-tool.js.map +0 -1
  358. package/dist/skills/tools/instructions-tool.d.ts.map +0 -1
  359. package/dist/skills/tools/instructions-tool.js +0 -188
  360. package/dist/skills/tools/instructions-tool.js.map +0 -1
  361. package/dist/skills/tools/lsp-tool.d.ts.map +0 -1
  362. package/dist/skills/tools/lsp-tool.js +0 -228
  363. package/dist/skills/tools/lsp-tool.js.map +0 -1
  364. package/dist/skills/tools/mcp-client-types.d.ts.map +0 -1
  365. package/dist/skills/tools/mcp-client-types.js +0 -54
  366. package/dist/skills/tools/mcp-client-types.js.map +0 -1
  367. package/dist/skills/tools/mcp-tool.d.ts.map +0 -1
  368. package/dist/skills/tools/mcp-tool.js +0 -504
  369. package/dist/skills/tools/mcp-tool.js.map +0 -1
  370. package/dist/skills/tools/memory-tool.d.ts.map +0 -1
  371. package/dist/skills/tools/memory-tool.js +0 -89
  372. package/dist/skills/tools/memory-tool.js.map +0 -1
  373. package/dist/skills/tools/monitor-tool.d.ts.map +0 -1
  374. package/dist/skills/tools/monitor-tool.js +0 -132
  375. package/dist/skills/tools/monitor-tool.js.map +0 -1
  376. package/dist/skills/tools/music-generate-tool.d.ts.map +0 -1
  377. package/dist/skills/tools/music-generate-tool.js +0 -63
  378. package/dist/skills/tools/music-generate-tool.js.map +0 -1
  379. package/dist/skills/tools/notify-tool.d.ts.map +0 -1
  380. package/dist/skills/tools/notify-tool.js +0 -63
  381. package/dist/skills/tools/notify-tool.js.map +0 -1
  382. package/dist/skills/tools/patch-tool.d.ts.map +0 -1
  383. package/dist/skills/tools/patch-tool.js +0 -506
  384. package/dist/skills/tools/patch-tool.js.map +0 -1
  385. package/dist/skills/tools/pdf-tool.d.ts.map +0 -1
  386. package/dist/skills/tools/pdf-tool.js +0 -89
  387. package/dist/skills/tools/pdf-tool.js.map +0 -1
  388. package/dist/skills/tools/plan-mode-tool.d.ts.map +0 -1
  389. package/dist/skills/tools/plan-mode-tool.js +0 -123
  390. package/dist/skills/tools/plan-mode-tool.js.map +0 -1
  391. package/dist/skills/tools/read-tool.d.ts.map +0 -1
  392. package/dist/skills/tools/read-tool.js +0 -85
  393. package/dist/skills/tools/read-tool.js.map +0 -1
  394. package/dist/skills/tools/repl-tool.d.ts.map +0 -1
  395. package/dist/skills/tools/repl-tool.js +0 -70
  396. package/dist/skills/tools/repl-tool.js.map +0 -1
  397. package/dist/skills/tools/search-tool.d.ts.map +0 -1
  398. package/dist/skills/tools/search-tool.js +0 -226
  399. package/dist/skills/tools/search-tool.js.map +0 -1
  400. package/dist/skills/tools/send-message-tool.d.ts.map +0 -1
  401. package/dist/skills/tools/send-message-tool.js +0 -77
  402. package/dist/skills/tools/send-message-tool.js.map +0 -1
  403. package/dist/skills/tools/skill-list-tool.d.ts.map +0 -1
  404. package/dist/skills/tools/skill-list-tool.js +0 -55
  405. package/dist/skills/tools/skill-list-tool.js.map +0 -1
  406. package/dist/skills/tools/skill-manage-tool.d.ts.map +0 -1
  407. package/dist/skills/tools/skill-manage-tool.js +0 -154
  408. package/dist/skills/tools/skill-manage-tool.js.map +0 -1
  409. package/dist/skills/tools/skill-view-tool.d.ts.map +0 -1
  410. package/dist/skills/tools/skill-view-tool.js +0 -73
  411. package/dist/skills/tools/skill-view-tool.js.map +0 -1
  412. package/dist/skills/tools/sleep-tool.d.ts.map +0 -1
  413. package/dist/skills/tools/sleep-tool.js +0 -82
  414. package/dist/skills/tools/sleep-tool.js.map +0 -1
  415. package/dist/skills/tools/structured-output-tool.d.ts.map +0 -1
  416. package/dist/skills/tools/structured-output-tool.js +0 -177
  417. package/dist/skills/tools/structured-output-tool.js.map +0 -1
  418. package/dist/skills/tools/task-tool.d.ts.map +0 -1
  419. package/dist/skills/tools/task-tool.js +0 -162
  420. package/dist/skills/tools/task-tool.js.map +0 -1
  421. package/dist/skills/tools/team-tool.d.ts.map +0 -1
  422. package/dist/skills/tools/team-tool.js +0 -106
  423. package/dist/skills/tools/team-tool.js.map +0 -1
  424. package/dist/skills/tools/tool-search-tool.d.ts.map +0 -1
  425. package/dist/skills/tools/tool-search-tool.js +0 -111
  426. package/dist/skills/tools/tool-search-tool.js.map +0 -1
  427. package/dist/skills/tools/tts-tool.d.ts.map +0 -1
  428. package/dist/skills/tools/tts-tool.js +0 -46
  429. package/dist/skills/tools/tts-tool.js.map +0 -1
  430. package/dist/skills/tools/video-edit-tool.d.ts.map +0 -1
  431. package/dist/skills/tools/video-edit-tool.js +0 -75
  432. package/dist/skills/tools/video-edit-tool.js.map +0 -1
  433. package/dist/skills/tools/video-generate-tool.d.ts.map +0 -1
  434. package/dist/skills/tools/video-generate-tool.js +0 -67
  435. package/dist/skills/tools/video-generate-tool.js.map +0 -1
  436. package/dist/skills/tools/video-merge-tool.d.ts.map +0 -1
  437. package/dist/skills/tools/video-merge-tool.js +0 -93
  438. package/dist/skills/tools/video-merge-tool.js.map +0 -1
  439. package/dist/skills/tools/video-upscale-tool.d.ts.map +0 -1
  440. package/dist/skills/tools/video-upscale-tool.js +0 -53
  441. package/dist/skills/tools/video-upscale-tool.js.map +0 -1
  442. package/dist/skills/tools/web-fetch-tool.d.ts.map +0 -1
  443. package/dist/skills/tools/web-fetch-tool.js +0 -93
  444. package/dist/skills/tools/web-fetch-tool.js.map +0 -1
  445. package/dist/skills/tools/web-search-tool.d.ts.map +0 -1
  446. package/dist/skills/tools/web-search-tool.js +0 -87
  447. package/dist/skills/tools/web-search-tool.js.map +0 -1
  448. package/dist/skills/tools/worktree-tool.d.ts.map +0 -1
  449. package/dist/skills/tools/worktree-tool.js +0 -148
  450. package/dist/skills/tools/worktree-tool.js.map +0 -1
  451. package/dist/skills/tools/write-tool.d.ts.map +0 -1
  452. package/dist/skills/tools/write-tool.js +0 -82
  453. package/dist/skills/tools/write-tool.js.map +0 -1
@@ -1,229 +0,0 @@
1
- // ============================================================
2
- // Memory Store — character-bounded local memory for agent notes.
3
- //
4
- // Inspired by Hermes' MemoryStore design:
5
- // - Two targets: "memory" (agent notes) + "user" (user profile)
6
- // - § delimiter between entries
7
- // - Frozen snapshot for system prompt (KV cache stability)
8
- // - Exact duplicate rejection
9
- // - Content safety scanning
10
- // - Pure in-memory; persistence is the consumer's responsibility.
11
- // ============================================================
12
- import { isMemoryContentSafe } from "./memory-tool.js";
13
- // ── Constants ───────────────────────────────────────────────
14
- export const MEMORY_ENTRY_DELIMITER = "\n§\n";
15
- export const DEFAULT_MEMORY_CHAR_LIMIT = 2200;
16
- export const DEFAULT_USER_CHAR_LIMIT = 1375;
17
- // ── MemoryStore class ───────────────────────────────────────
18
- export class MemoryStore {
19
- memoryEntries = [];
20
- userEntries = [];
21
- frozenSnapshot = { memory: "", user: "" };
22
- snapshotFrozen = false;
23
- memoryCharLimit;
24
- userCharLimit;
25
- constructor(options) {
26
- this.memoryCharLimit = options?.memoryCharLimit ?? DEFAULT_MEMORY_CHAR_LIMIT;
27
- this.userCharLimit = options?.userCharLimit ?? DEFAULT_USER_CHAR_LIMIT;
28
- }
29
- // ── Load / Serialize ────────────────────────────────────
30
- /**
31
- * Load from serialized form (e.g. from PG or filesystem).
32
- * Deduplicates entries on load.
33
- */
34
- loadFromSerialized(data) {
35
- this.memoryEntries = deduplicateEntries(parseEntries(data.memory ?? ""));
36
- this.userEntries = deduplicateEntries(parseEntries(data.user ?? ""));
37
- }
38
- /**
39
- * Serialize current live state for persistence.
40
- */
41
- serialize() {
42
- return {
43
- memory: this.memoryEntries.join(MEMORY_ENTRY_DELIMITER),
44
- user: this.userEntries.join(MEMORY_ENTRY_DELIMITER),
45
- };
46
- }
47
- // ── Snapshot (frozen for system prompt) ─────────────────
48
- /**
49
- * Freeze current entries for system prompt injection.
50
- * Call once at session start. After freezing, mutations update
51
- * live state but NOT the system prompt block.
52
- */
53
- freezeSnapshot() {
54
- this.frozenSnapshot = {
55
- memory: this.renderBlock("memory", this.memoryEntries),
56
- user: this.renderBlock("user", this.userEntries),
57
- };
58
- this.snapshotFrozen = true;
59
- }
60
- /**
61
- * Get frozen system prompt block for the given target.
62
- * Returns empty string if no entries or not yet frozen.
63
- */
64
- getSystemPromptBlock(target) {
65
- if (!this.snapshotFrozen) {
66
- // Auto-freeze on first access
67
- this.freezeSnapshot();
68
- }
69
- return this.frozenSnapshot[target];
70
- }
71
- // ── Mutations ───────────────────────────────────────────
72
- add(target, content) {
73
- const trimmed = content.trim();
74
- if (!trimmed) {
75
- return this.errorResult(target, "Content cannot be empty.", "empty_content");
76
- }
77
- if (!isMemoryContentSafe(trimmed)) {
78
- return this.errorResult(target, "Content rejected: potential injection detected.", "unsafe_content");
79
- }
80
- const entries = this.entriesFor(target);
81
- // Exact duplicate check
82
- if (entries.includes(trimmed)) {
83
- return this.successResult(target, "Entry already exists (no change).");
84
- }
85
- // Character budget check
86
- const newEntries = [...entries, trimmed];
87
- const newTotal = newEntries.join(MEMORY_ENTRY_DELIMITER).length;
88
- if (newTotal > this.charLimitFor(target)) {
89
- const usage = this.formatUsage(target);
90
- return this.errorResult(target, `Memory full (${usage}). Remove old entries first.`, "over_limit");
91
- }
92
- entries.push(trimmed);
93
- return this.successResult(target, "Entry added.");
94
- }
95
- replace(target, oldText, newContent) {
96
- const searchText = oldText.trim();
97
- const replacement = newContent.trim();
98
- if (!searchText) {
99
- return this.errorResult(target, "old_text cannot be empty.", "empty_old_text");
100
- }
101
- if (!replacement) {
102
- return this.errorResult(target, "content cannot be empty.", "empty_content");
103
- }
104
- if (!isMemoryContentSafe(replacement)) {
105
- return this.errorResult(target, "Content rejected: potential injection detected.", "unsafe_content");
106
- }
107
- const entries = this.entriesFor(target);
108
- const matchIndices = entries
109
- .map((entry, i) => entry.includes(searchText) ? i : -1)
110
- .filter((i) => i >= 0);
111
- if (matchIndices.length === 0) {
112
- return this.errorResult(target, `No entry contains: "${clipForMessage(searchText)}"`, "not_found");
113
- }
114
- if (matchIndices.length > 1) {
115
- // Check if all matches are identical (harmless duplicate)
116
- const unique = new Set(matchIndices.map((i) => entries[i]));
117
- if (unique.size > 1) {
118
- return this.errorResult(target, `Multiple entries match: "${clipForMessage(searchText)}" (${matchIndices.length} matches). Be more specific.`, "ambiguous_match");
119
- }
120
- }
121
- // Replace first match
122
- const matchIndex = matchIndices[0];
123
- // Check char limit with replacement
124
- const projected = [...entries];
125
- projected[matchIndex] = replacement;
126
- const projectedTotal = projected.join(MEMORY_ENTRY_DELIMITER).length;
127
- if (projectedTotal > this.charLimitFor(target)) {
128
- const usage = this.formatUsage(target);
129
- return this.errorResult(target, `Replacement would exceed limit (${usage}).`, "over_limit");
130
- }
131
- entries[matchIndex] = replacement;
132
- return this.successResult(target, "Entry replaced.");
133
- }
134
- remove(target, oldText) {
135
- const searchText = oldText.trim();
136
- if (!searchText) {
137
- return this.errorResult(target, "old_text cannot be empty.", "empty_old_text");
138
- }
139
- const entries = this.entriesFor(target);
140
- const matchIndices = entries
141
- .map((entry, i) => entry.includes(searchText) ? i : -1)
142
- .filter((i) => i >= 0);
143
- if (matchIndices.length === 0) {
144
- return this.errorResult(target, `No entry contains: "${clipForMessage(searchText)}"`, "not_found");
145
- }
146
- // Remove all matches (safe: if they all contain the substring, remove them all)
147
- for (let i = matchIndices.length - 1; i >= 0; i--) {
148
- entries.splice(matchIndices[i], 1);
149
- }
150
- return this.successResult(target, matchIndices.length === 1 ? "Entry removed." : `${matchIndices.length} entries removed.`);
151
- }
152
- // ── Read-only accessors ─────────────────────────────────
153
- getEntries(target) {
154
- return this.entriesFor(target);
155
- }
156
- getUsage(target) {
157
- const entries = this.entriesFor(target);
158
- const used = entries.length > 0 ? entries.join(MEMORY_ENTRY_DELIMITER).length : 0;
159
- const limit = this.charLimitFor(target);
160
- return { used, limit, percent: limit > 0 ? Math.round((used / limit) * 100) : 0 };
161
- }
162
- isEmpty() {
163
- return this.memoryEntries.length === 0 && this.userEntries.length === 0;
164
- }
165
- // ── Private helpers ─────────────────────────────────────
166
- entriesFor(target) {
167
- return target === "user" ? this.userEntries : this.memoryEntries;
168
- }
169
- charLimitFor(target) {
170
- return target === "user" ? this.userCharLimit : this.memoryCharLimit;
171
- }
172
- formatUsage(target) {
173
- const { used, limit, percent } = this.getUsage(target);
174
- return `${percent}% — ${used}/${limit} chars`;
175
- }
176
- renderBlock(target, entries) {
177
- if (entries.length === 0)
178
- return "";
179
- const label = target === "user" ? "USER PROFILE" : "MEMORY";
180
- const usage = this.formatUsage(target);
181
- const divider = "══════════════════════════════════════════════════════════";
182
- const body = entries.join(MEMORY_ENTRY_DELIMITER);
183
- return `${divider}\n${label} (your personal notes) [${usage}]\n${divider}\n${body}`;
184
- }
185
- successResult(target, message) {
186
- const entries = this.entriesFor(target);
187
- return {
188
- ok: true,
189
- message,
190
- target,
191
- entries,
192
- entryCount: entries.length,
193
- usage: this.formatUsage(target),
194
- };
195
- }
196
- errorResult(target, message, errorCode) {
197
- const entries = this.entriesFor(target);
198
- return {
199
- ok: false,
200
- message,
201
- target,
202
- entries,
203
- entryCount: entries.length,
204
- usage: this.formatUsage(target),
205
- errorCode,
206
- };
207
- }
208
- }
209
- // ── Utilities ─────────────────────────────────────────────
210
- function parseEntries(raw) {
211
- if (!raw.trim())
212
- return [];
213
- return raw.split(MEMORY_ENTRY_DELIMITER).map((e) => e.trim()).filter(Boolean);
214
- }
215
- function deduplicateEntries(entries) {
216
- const seen = new Set();
217
- return entries.filter((entry) => {
218
- if (seen.has(entry))
219
- return false;
220
- seen.add(entry);
221
- return true;
222
- });
223
- }
224
- function clipForMessage(text, maxLength = 60) {
225
- if (text.length <= maxLength)
226
- return text;
227
- return `${text.slice(0, maxLength - 1).trimEnd()}…`;
228
- }
229
- //# sourceMappingURL=memory-store.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"memory-store.js","sourceRoot":"","sources":["../../src/skills/memory-store.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,iEAAiE;AACjE,EAAE;AACF,0CAA0C;AAC1C,gEAAgE;AAChE,gCAAgC;AAChC,2DAA2D;AAC3D,8BAA8B;AAC9B,4BAA4B;AAC5B,kEAAkE;AAClE,+DAA+D;AAE/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,+DAA+D;AAE/D,MAAM,CAAC,MAAM,sBAAsB,GAAG,OAAO,CAAC;AAC9C,MAAM,CAAC,MAAM,yBAAyB,GAAG,IAAI,CAAC;AAC9C,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,CAAC;AA8B5C,+DAA+D;AAE/D,MAAM,OAAO,WAAW;IACd,aAAa,GAAa,EAAE,CAAC;IAC7B,WAAW,GAAa,EAAE,CAAC;IAC3B,c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,OAAO,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,gDAAgD;IAChD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4CAA4C;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kCAAkC;IAClC,OAAO,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAC/B,+DAA+D;IAC/D,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAID,MAAM,WAAW,sBAAsB;IACrC,4CAA4C;IAC5C,QAAQ,EAAE,cAAc,CAAC;IACzB,uCAAuC;IACvC,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,gBAAgB,EACxB,IAAI,EAAE,sBAAsB,GAC3B,OAAO,CAAC,gBAAgB,CAAC,CAyG3B"}
@@ -1,193 +0,0 @@
1
- // ============================================================
2
- // Memory Tool Contract — dual-layer agent memory system.
3
- //
4
- // Two independent layers (Hermes-inspired):
5
- //
6
- // 1. **MD Memory** (local notes, always in system prompt):
7
- // Agent explicitly manages via add / replace / remove.
8
- // Character-bounded, no LLM needed, zero-cost.
9
- // Frozen snapshot in system prompt for KV cache stability.
10
- //
11
- // 2. **QMemory** (semantic long-term memory):
12
- // Automatic extraction from every conversation turn.
13
- // Agent queries via search action. Vector-based recall.
14
- //
15
- // The two layers are independent — no cross-dedup, no sync.
16
- // MD = curated highlights; QMemory = conversation sediment.
17
- // ============================================================
18
- // ── Constants ───────────────────────────────────────────────────
19
- export const MEMORY_TOOL_NAME = "memory";
20
- export const MEMORY_TOOL_MAX_CONTENT_LENGTH = 2000;
21
- export const MEMORY_TOOL_ACTIONS = ["add", "replace", "remove", "search"];
22
- // ── Tool schema (JSON Schema compatible) ────────────────────
23
- export const MEMORY_TOOL_SCHEMA = {
24
- type: "object",
25
- properties: {
26
- action: {
27
- type: "string",
28
- enum: MEMORY_TOOL_ACTIONS,
29
- description: [
30
- "The operation to perform:",
31
- "• 'add' — Save a concise note about this user (→ local notes, always visible)",
32
- "• 'replace' — Update an existing note by matching a substring (→ local notes)",
33
- "• 'remove' — Delete a note by matching a substring (→ local notes)",
34
- "• 'search' — Semantic search across long-term memory (→ qmemory)",
35
- ].join("\n"),
36
- },
37
- target: {
38
- type: "string",
39
- enum: ["memory", "user"],
40
- description: [
41
- "Which note target to operate on (for add/replace/remove):",
42
- "• 'memory' — Your personal observations/notes about this user (default)",
43
- "• 'user' — User profile facts (preferences, timezone, etc.)",
44
- ].join("\n"),
45
- },
46
- content: {
47
- type: "string",
48
- description: [
49
- "Required for 'add' and 'replace'. The note content to store.",
50
- "Write a concise, factual statement.",
51
- "Good: '用户是后端工程师,主要使用 TypeScript 和 Go'",
52
- "Good: 'User prefers dark UI themes and minimalist design'",
53
- "Bad: '用户说了很多话' (too vague)",
54
- "Bad: entire conversation transcripts (too long)",
55
- ].join("\n"),
56
- },
57
- old_text: {
58
- type: "string",
59
- description: "Required for 'replace' and 'remove'. A substring that uniquely identifies the note entry to modify.",
60
- },
61
- query: {
62
- type: "string",
63
- description: "Required for 'search'. Natural language query to find relevant memories.",
64
- },
65
- },
66
- required: ["action"],
67
- };
68
- export const MEMORY_TOOL_DESCRIPTION = [
69
- "Manage your notes about this user and search long-term memory.",
70
- "",
71
- "Your notes (add/replace/remove) are always visible in the system prompt.",
72
- "Long-term memories are automatically extracted from every conversation",
73
- "and searchable via 'search'.",
74
- "",
75
- "Guidelines:",
76
- "- Use 'add' to record important user preferences, facts, or context",
77
- "- Use 'replace' to update outdated notes (match by substring)",
78
- "- Use 'remove' to delete incorrect notes (match by substring)",
79
- "- Use 'search' to recall conversation history and past interactions",
80
- "- Keep notes concise — there's a character limit",
81
- ].join("\n");
82
- export const MEMORY_TOOL_LABEL = "Memory";
83
- // ── Content safety ──────────────────────────────────────────
84
- const BLOCKED_PATTERNS = [
85
- /ignore\s+(previous|all|above|prior)\s+instructions/i,
86
- /you\s+are\s+now\s+/i,
87
- /do\s+not\s+tell\s+the\s+user/i,
88
- /system\s+prompt\s+override/i,
89
- ];
90
- export function isMemoryContentSafe(text) {
91
- return !BLOCKED_PATTERNS.some((pattern) => pattern.test(text));
92
- }
93
- export async function executeMemoryTool(params, deps) {
94
- const { action } = params;
95
- const target = params.target ?? "memory";
96
- // ── MD store operations: add / replace / remove ───────
97
- if (action === "add") {
98
- if (!deps.store) {
99
- return { ok: false, message: "Local memory store is not available.", action, errorCode: "no_store" };
100
- }
101
- const content = params.content?.trim();
102
- if (!content) {
103
- return { ok: false, message: "content is required for 'add' action.", action, errorCode: "empty_content" };
104
- }
105
- if (content.length > MEMORY_TOOL_MAX_CONTENT_LENGTH) {
106
- return { ok: false, message: `Content too long (${content.length} chars, max ${MEMORY_TOOL_MAX_CONTENT_LENGTH}).`, action, errorCode: "too_long" };
107
- }
108
- const result = deps.store.add(target, content);
109
- return {
110
- ok: result.ok,
111
- message: result.ok
112
- ? `${result.message} [${result.usage}]`
113
- : result.message,
114
- action,
115
- entryCount: result.entryCount,
116
- usage: result.usage,
117
- storeModified: result.ok,
118
- errorCode: result.errorCode,
119
- };
120
- }
121
- if (action === "replace") {
122
- if (!deps.store) {
123
- return { ok: false, message: "Local memory store is not available.", action, errorCode: "no_store" };
124
- }
125
- const oldText = params.old_text?.trim();
126
- const content = params.content?.trim();
127
- if (!oldText) {
128
- return { ok: false, message: "old_text is required for 'replace' action.", action, errorCode: "empty_old_text" };
129
- }
130
- if (!content) {
131
- return { ok: false, message: "content is required for 'replace' action.", action, errorCode: "empty_content" };
132
- }
133
- if (content.length > MEMORY_TOOL_MAX_CONTENT_LENGTH) {
134
- return { ok: false, message: `Content too long (${content.length} chars, max ${MEMORY_TOOL_MAX_CONTENT_LENGTH}).`, action, errorCode: "too_long" };
135
- }
136
- const result = deps.store.replace(target, oldText, content);
137
- return {
138
- ok: result.ok,
139
- message: result.ok
140
- ? `${result.message} [${result.usage}]`
141
- : result.message,
142
- action,
143
- entryCount: result.entryCount,
144
- usage: result.usage,
145
- storeModified: result.ok,
146
- errorCode: result.errorCode,
147
- };
148
- }
149
- if (action === "remove") {
150
- if (!deps.store) {
151
- return { ok: false, message: "Local memory store is not available.", action, errorCode: "no_store" };
152
- }
153
- const oldText = params.old_text?.trim();
154
- if (!oldText) {
155
- return { ok: false, message: "old_text is required for 'remove' action.", action, errorCode: "empty_old_text" };
156
- }
157
- const result = deps.store.remove(target, oldText);
158
- return {
159
- ok: result.ok,
160
- message: result.ok
161
- ? `${result.message} [${result.usage}]`
162
- : result.message,
163
- action,
164
- entryCount: result.entryCount,
165
- usage: result.usage,
166
- storeModified: result.ok,
167
- errorCode: result.errorCode,
168
- };
169
- }
170
- if (action === "search") {
171
- const query = params.query?.trim();
172
- if (!query) {
173
- return { ok: false, message: "query is required for 'search' action.", action, errorCode: "empty_query" };
174
- }
175
- try {
176
- const results = await deps.provider.search(query, deps.userId, { limit: 10 });
177
- if (results.length === 0) {
178
- return { ok: true, message: "No matching memories found.", action, results: [] };
179
- }
180
- return {
181
- ok: true,
182
- message: results.map((r, i) => `${i + 1}. [${r.blockId}] ${r.text}`).join("\n"),
183
- action,
184
- results,
185
- };
186
- }
187
- catch (error) {
188
- return { ok: false, message: `Search failed: ${error instanceof Error ? error.message : String(error)}`, action, errorCode: "search_failed" };
189
- }
190
- }
191
- return { ok: false, message: `Unknown action: ${action}. Use 'add', 'replace', 'remove', or 'search'.`, action, errorCode: "unknown_action" };
192
- }
193
- //# sourceMappingURL=memory-tool.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"memory-tool.js","sourceRoot":"","sources":["../../src/skills/memory-tool.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,yDAAyD;AACzD,EAAE;AACF,4CAA4C;AAC5C,EAAE;AACF,2DAA2D;AAC3D,0DAA0D;AAC1D,kDAAkD;AAClD,8D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,CAAC;IACpB,2DAA2D;IAC3D,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC;;;;;OAKG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;;;;OAOG;IACH,OAAO,CACL,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,OAAO,EACf,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,kBAAkB,CAAC,CAAC;CAChC"}
@@ -1,15 +0,0 @@
1
- // ============================================================
2
- // Portable Tool Contract — runtime-agnostic tool interface.
3
- //
4
- // This is the minimal tool definition that any agent runtime
5
- // (openclaw, Hub, Electron, third-party) can consume. It uses
6
- // plain JSON Schema objects instead of @sinclair/typebox so
7
- // there are zero external dependencies.
8
- //
9
- // Consumers wrap PortableTool into their own tool system:
10
- // - openclaw → AgentTool<TSchema> (via typebox adapter)
11
- // - Hub → hub-managed tool registration
12
- // - Electron → desktop tool host
13
- // ============================================================
14
- export {};
15
- //# sourceMappingURL=portable-tool.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"portable-tool.js","sourceRoot":"","sources":["../../src/skills/portable-tool.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,4DAA4D;AAC5D,EAAE;AACF,6DAA6D;AAC7D,8DAA8D;AAC9D,4DAA4D;AAC5D,wCAAwC;AACxC,EAAE;AACF,0DAA0D;AAC1D,2DAA2D;AAC3D,+CAA+C;AAC/C,mCAAmC;AACnC,+DAA+D"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"qmemory-adapter.d.ts","sourceRoot":"","sources":["../../src/skills/qmemory-adapter.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAEV,mBAAmB,EACnB,cAAc,EAGf,MAAM,+BAA+B,CAAC;AAGvC,sEAAsE;AACtE,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,kDAAkD;AAClD,MAAM,WAAW,oBAAoB;IACnC,sEAAsE;IACtE,OAAO,EAAE,MAAM,CAAC;IAChB,2CAA2C;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uDAAuD;IACvD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6DAA6D;IAC7D,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,uDAAuD;AACvD,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;CACvB;AAKD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,oBAAoB,GAAG,cAAc,GAAG;IACnF,mCAAmC;IACnC,MAAM,IAAI,OAAO,CAAC,mBAAmB,CAAC,CAAC;IACvC,wEAAwE;IACxE,eAAe,CACb,KAAK,EAAE,mBAAmB,EAAE,EAC5B,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC;QAAE,aAAa,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACvC,CA6KA"}
@@ -1,166 +0,0 @@
1
- // ============================================================
2
- // QMemory HTTP adapter — implements MemoryProvider against the
3
- // QMemory REST API (v1).
4
- //
5
- // This is a Hub-ready, provider-agnostic adapter that can be
6
- // plugged into any consumer of the MemoryProvider contract.
7
- // ============================================================
8
- const DEFAULT_TIMEOUT_MS = 5_000;
9
- const PROVIDER_ID = "qmemory";
10
- /**
11
- * Create a MemoryProvider backed by a QMemory HTTP server.
12
- *
13
- * @example
14
- * ```ts
15
- * const provider = createQMemoryAdapter({
16
- * baseUrl: "http://localhost:18800",
17
- * apiKey: "sk-...",
18
- * });
19
- *
20
- * const results = await provider.search("last meeting notes", "alice");
21
- * await provider.ingest([{ role: "user", content: "..." }], "alice");
22
- * ```
23
- */
24
- export function createQMemoryAdapter(config) {
25
- const baseUrl = config.baseUrl.replace(/\/+$/, "");
26
- const timeoutMs = config.timeoutMs ?? DEFAULT_TIMEOUT_MS;
27
- function resolveUserId(userId) {
28
- return config.userIdPrefix ? `${config.userIdPrefix}:${userId}` : userId;
29
- }
30
- function buildHeaders() {
31
- const headers = {
32
- "Accept": "application/json",
33
- };
34
- if (config.apiKey) {
35
- headers["Authorization"] = `Bearer ${config.apiKey}`;
36
- }
37
- return headers;
38
- }
39
- async function request(pathname, init) {
40
- const url = `${baseUrl}${pathname}`;
41
- const controller = new AbortController();
42
- const timer = setTimeout(() => controller.abort(), timeoutMs);
43
- try {
44
- const response = await fetch(url, {
45
- ...init,
46
- headers: { ...buildHeaders(), ...init?.headers },
47
- signal: controller.signal,
48
- });
49
- if (!response.ok) {
50
- const text = await response.text().catch(() => "");
51
- throw new Error(`QMemory ${init?.method ?? "GET"} ${pathname} returned ${response.status}: ${text.slice(0, 200)}`);
52
- }
53
- return await response.json();
54
- }
55
- finally {
56
- clearTimeout(timer);
57
- }
58
- }
59
- return {
60
- providerId: PROVIDER_ID,
61
- async search(query, userId, options) {
62
- const resolvedUserId = resolveUserId(userId);
63
- const limit = options?.limit ?? 10;
64
- const params = new URLSearchParams({
65
- q: query,
66
- user_id: resolvedUserId,
67
- limit: String(limit),
68
- });
69
- const result = await request(`/v1/memories/search/?${params.toString()}`);
70
- return (result.memories ?? [])
71
- .filter((m) => m.id && m.text)
72
- .map((m) => ({
73
- blockId: m.id,
74
- text: m.text,
75
- score: typeof m.importance === "number" ? m.importance : 0,
76
- source: PROVIDER_ID,
77
- metadata: m.metadata,
78
- }));
79
- },
80
- async ingest(messages, userId, options) {
81
- const resolvedUserId = resolveUserId(userId);
82
- await request("/v1/memories/", {
83
- method: "POST",
84
- headers: { "Content-Type": "application/json" },
85
- body: JSON.stringify({
86
- user_id: resolvedUserId,
87
- messages: messages.map((m) => ({
88
- role: m.role,
89
- content: m.content,
90
- ...(m.timestamp ? { timestamp: m.timestamp } : {}),
91
- })), extraction_mode: "none", ...(options?.sessionId ? { session_id: options.sessionId } : {}),
92
- ...(options?.source ? { metadata: { source: options.source } } : {}),
93
- run_async: true,
94
- }),
95
- });
96
- },
97
- async health() {
98
- const raw = await request("/v1/health/");
99
- return {
100
- status: raw.status ?? "unknown",
101
- version: raw.version ?? "",
102
- memoryCount: raw.memory_count ?? 0,
103
- dbSizeBytes: raw.db_size_bytes ?? 0,
104
- embeddingModel: raw.embedding_model ?? "",
105
- uptimeSeconds: raw.uptime_seconds ?? 0,
106
- };
107
- },
108
- async addText(text, userId, options) {
109
- const resolvedUserId = resolveUserId(userId);
110
- const result = await request("/v1/memories/", {
111
- method: "POST",
112
- headers: { "Content-Type": "application/json" },
113
- body: JSON.stringify({
114
- user_id: resolvedUserId,
115
- text,
116
- extraction_mode: "none",
117
- ...(options?.sessionId ? { session_id: options.sessionId } : {}),
118
- ...(options?.source ? { metadata: { source: options.source } } : {}),
119
- }),
120
- });
121
- return { memoriesAdded: result.memories_added ?? 0 };
122
- },
123
- async ingestExtracted(items, userId, options) {
124
- if (items.length === 0)
125
- return { memoriesAdded: 0 };
126
- const resolvedUserId = resolveUserId(userId);
127
- const results = await Promise.allSettled(items.map((item) => request("/v1/memories/", {
128
- method: "POST",
129
- headers: { "Content-Type": "application/json" },
130
- body: JSON.stringify({
131
- user_id: resolvedUserId,
132
- text: item.text,
133
- extraction_mode: "none",
134
- ...(options?.sessionId ? { session_id: options.sessionId } : {}),
135
- metadata: {
136
- ...(options?.source ? { source: options.source } : {}),
137
- ...(item.category ? { category: item.category } : {}),
138
- ...(typeof item.importance === "number" ? { importance: item.importance } : {}),
139
- ...(item.speaker ? { speaker: item.speaker } : {}),
140
- ...(item.event_date ? { event_date: item.event_date } : {}),
141
- ...(item.tags?.length ? { tags: item.tags } : {}),
142
- },
143
- }),
144
- })));
145
- let total = 0;
146
- for (const r of results) {
147
- if (r.status === "fulfilled") {
148
- total += r.value.memories_added ?? 1;
149
- }
150
- }
151
- return { memoriesAdded: total };
152
- },
153
- async remove(memoryId) {
154
- try {
155
- await request(`/v1/memories/${encodeURIComponent(memoryId)}/`, {
156
- method: "DELETE",
157
- });
158
- return true;
159
- }
160
- catch {
161
- return false;
162
- }
163
- },
164
- };
165
- }
166
- //# sourceMappingURL=qmemory-adapter.js.map